Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix toolbox appearance, tools boxed are clickable (#331)
Browse files Browse the repository at this point in the history
talyguryn authored Jul 24, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 9027974 commit 11c9746
Showing 5 changed files with 33 additions and 58 deletions.
64 changes: 25 additions & 39 deletions build/codex-editor.js

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions build/codex-editor.js.map

Large diffs are not rendered by default.

18 changes: 5 additions & 13 deletions src/components/modules/toolbar-toolbox.js
Original file line number Diff line number Diff line change
@@ -98,19 +98,14 @@ export default class Toolbox extends Module {

button.innerHTML = tool.toolboxIcon;

/**
* Save tool's name in the button data-name
*/
button.dataset.name = toolName;

$.append(this.nodes.toolbox, button);

this.nodes.toolbox.appendChild(button);
this.nodes.buttons.push(button);

/** Add listener to click */
this.Editor.Listeners.on(button, 'click', (event) => {
this.buttonClicked(event);
this.toolButtonClicked(event, toolName);
});

/** Enable shortcut */
@@ -173,16 +168,13 @@ export default class Toolbox extends Module {
}

/**
* Toolbox button click listener
* 1) if block is empty -> replace
* 2) if block is not empty -> add new block below
* Toolbox Tool's button click handler
*
* @param {MouseEvent} event
* @param {string} toolName
*/
buttonClicked(event) {
let toolButton = event.target,
toolName = toolButton.dataset.name,
tool = this.Editor.Tools.toolClasses[toolName];
toolButtonClicked(event, toolName) {
const tool = this.Editor.Tools.toolClasses[toolName];

this.insertNewBlock(tool, toolName);
}
2 changes: 2 additions & 0 deletions src/styles/toolbox.css
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@
visibility: hidden;
transition: opacity 100ms ease;
will-change: opacity;
display: flex;
flex-direction: row;

&--opened {
opacity: 1;
1 change: 0 additions & 1 deletion src/styles/variables.css
Original file line number Diff line number Diff line change
@@ -67,7 +67,6 @@
--toolbox-button: {
color: var(--grayText);
cursor: pointer;
display: inline-block;
width: var(--toolbox-buttons-size);
height: var(--toolbox-buttons-size);
/*line-height: var(--toolbox-buttons-size);*/

0 comments on commit 11c9746

Please sign in to comment.