-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b4f2a7f
commit 9fa28e8
Showing
14 changed files
with
569 additions
and
155 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import BaseUIComponent from "../common/BaseUIComponent"; | ||
import AddBlockButton from "./AddBlockButton"; | ||
|
||
class AddBlock extends BaseUIComponent { | ||
|
||
display: string; | ||
|
||
constructor() { | ||
super({}); | ||
this.display = "block" | ||
} | ||
|
||
init(): HTMLElement { | ||
const htmlElement = document.createElement("div"); | ||
|
||
htmlElement.classList.add("add-block-wrapper"); | ||
|
||
const button = new AddBlockButton(); | ||
|
||
htmlElement.appendChild(button.htmlElement); | ||
|
||
return htmlElement; | ||
} | ||
|
||
} | ||
|
||
export default AddBlock; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import ICommand from "services/common/ICommand"; | ||
import BaseUIComponent from "../common/BaseUIComponent"; | ||
import SVGIcon from "../common/SVGIcon"; | ||
import BlockOperationsService, { BLOCK_OPERATIONS } from "../../services/block-operations/BlockOperationsService"; | ||
|
||
class AddBlockButton extends BaseUIComponent { | ||
|
||
display: string; | ||
private readonly _commandService: ICommand; | ||
|
||
constructor() { | ||
super({}); | ||
|
||
this.display = "block"; | ||
this._commandService = BlockOperationsService.getInstance(); | ||
this.attachEvents(); | ||
} | ||
|
||
init(): HTMLElement { | ||
const htmlElement = document.createElement("button"); | ||
|
||
htmlElement.classList.add("add-block", "block-operation"); | ||
|
||
const svg = new SVGIcon("icon-add-block", "24", "24"); | ||
|
||
htmlElement.appendChild(svg.htmlElement); | ||
|
||
return htmlElement; | ||
} | ||
|
||
attachEvents(): void { | ||
this.htmlElement.addEventListener("click", () => { | ||
this._commandService.execCommand(BLOCK_OPERATIONS.CREATE_DEFAULT_BLOCK, ""); | ||
}) | ||
} | ||
} | ||
|
||
export default AddBlockButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.