mirror of
https://github.com/codex-team/editor.js
synced 2024-06-10 09:52:36 +02:00
Fixes due code review (#1365)
This commit is contained in:
parent
9581fc2dc9
commit
ea6f81d5e8
2
dist/editor.js
vendored
2
dist/editor.js
vendored
File diff suppressed because one or more lines are too long
|
@ -70,8 +70,10 @@ export default class MoveUpTune implements BlockTune {
|
|||
*/
|
||||
public handleClick(event: MouseEvent, button: HTMLElement): void {
|
||||
const currentBlockIndex = this.api.blocks.getCurrentBlockIndex();
|
||||
const currentBlock = this.api.blocks.getBlockByIndex(currentBlockIndex);
|
||||
const previousBlock = this.api.blocks.getBlockByIndex(currentBlockIndex - 1);
|
||||
|
||||
if (currentBlockIndex === 0) {
|
||||
if (currentBlockIndex === 0 || !currentBlock || !previousBlock) {
|
||||
button.classList.add(this.CSS.animation);
|
||||
|
||||
window.setTimeout(() => {
|
||||
|
@ -81,13 +83,6 @@ export default class MoveUpTune implements BlockTune {
|
|||
return;
|
||||
}
|
||||
|
||||
const currentBlock = this.api.blocks.getBlockByIndex(currentBlockIndex);
|
||||
const previousBlock = this.api.blocks.getBlockByIndex(currentBlockIndex - 1);
|
||||
|
||||
if (!currentBlock || !previousBlock) {
|
||||
return;
|
||||
}
|
||||
|
||||
const currentBlockElement = currentBlock.holder;
|
||||
const previousBlockElement = previousBlock.holder;
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ export default class BlocksAPI extends Module {
|
|||
const block = this.Editor.BlockManager.getBlockByIndex(index);
|
||||
|
||||
if (block === undefined) {
|
||||
_.log('There is no block at index `' + index + '`', 'warn');
|
||||
_.logLabeled('There is no block at index `' + index + '`', 'warn');
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
5
types/tools/block-tool.d.ts
vendored
5
types/tools/block-tool.d.ts
vendored
|
@ -16,11 +16,6 @@ export interface BlockTool extends BaseTool {
|
|||
*/
|
||||
sanitize?: SanitizerConfig;
|
||||
|
||||
/**
|
||||
* Creates and returns Tools HTML markup
|
||||
*/
|
||||
render(): HTMLElement;
|
||||
|
||||
/**
|
||||
* Process Tool's element in DOM and return raw data
|
||||
* @param {HTMLElement} block - element created by {@link BlockTool#render} function
|
||||
|
|
Loading…
Reference in a new issue