Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing Bug #1270 and resolve all yarn lint warning. #1292

Merged
merged 4 commits into from
Sep 1, 2020
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/editor.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@
- `Improvements` - Unuseful log about missed i18n section has been removed [#1269](https://github.com/codex-team/editor.js/issues/1269)
- `Fix` - Fixed issue with enter key in inputs and textareas [#920](https://github.com/codex-team/editor.js/issues/920)
- `Improvements` - Allowed to set `false` as `toolbox` config in order to hide Toolbox button [#1221](https://github.com/codex-team/editor.js/issues/1221)
- `Fix` - Fixed bug of getBlockByIndex API[#1270](https://github.com/codex-team/editor.js/issues/1270)
robonetphy marked this conversation as resolved.
Show resolved Hide resolved

### 2.18

1 change: 0 additions & 1 deletion src/components/__module.ts
Original file line number Diff line number Diff line change
@@ -53,5 +53,4 @@ export default class Module {
protected get isRtl(): boolean {
return this.config.i18n.direction === 'rtl';
}

}
1 change: 0 additions & 1 deletion src/components/block/index.ts
Original file line number Diff line number Diff line change
@@ -14,7 +14,6 @@ import { SavedData } from '../../../types/data-formats';
import $ from '../dom';
import * as _ from '../utils';
import ApiModule from '../modules/api';
import SelectionUtils from '../selection';
import BlockAPI from './api';
import { ToolType } from '../modules/tools';

6 changes: 6 additions & 0 deletions src/components/modules/api/blocks.ts
Original file line number Diff line number Diff line change
@@ -60,6 +60,12 @@ export default class BlocksAPI extends Module {
public getBlockByIndex(index: number): BlockAPIInterface {
const block = this.Editor.BlockManager.getBlockByIndex(index);

if (block === undefined) {
_.log('Block is `undefined` at index `' + index + '`', 'warn');

return;
}

return new BlockAPI(block);
}

8 changes: 4 additions & 4 deletions src/components/modules/toolbar/conversion.ts
Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ export default class ConversionToolbar extends Module {
public make(): HTMLElement {
this.nodes.wrapper = $.make('div', [
ConversionToolbar.CSS.conversionToolbarWrapper,
...(this.isRtl ? [this.Editor.UI.CSS.editorRtlFix] : []),
...(this.isRtl ? [ this.Editor.UI.CSS.editorRtlFix ] : []),
]);
this.nodes.tools = $.make('div', ConversionToolbar.CSS.conversionToolbarTools);

@@ -298,8 +298,8 @@ export default class ConversionToolbar extends Module {
* @param {string} title - button title
*/
private addTool(toolName: string, toolIcon: string, title: string): void {
const tool = $.make('div', [ConversionToolbar.CSS.conversionTool]);
const icon = $.make('div', [ConversionToolbar.CSS.conversionToolIcon]);
const tool = $.make('div', [ ConversionToolbar.CSS.conversionTool ]);
const icon = $.make('div', [ ConversionToolbar.CSS.conversionToolIcon ]);

tool.dataset.tool = toolName;
icon.innerHTML = toolIcon;
@@ -310,7 +310,7 @@ export default class ConversionToolbar extends Module {
$.append(this.nodes.tools, tool);
this.tools[toolName] = tool;

this.Editor.Listeners.on(tool, 'click', async() => {
this.Editor.Listeners.on(tool, 'click', async () => {
await this.replaceWithBlock(toolName);
});
}
6 changes: 3 additions & 3 deletions src/components/modules/toolbar/inline.ts
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ export default class InlineToolbar extends Module {
focusedButton: 'ce-inline-tool--focused',
conversionToggler: 'ce-inline-toolbar__dropdown',
conversionTogglerHidden: 'ce-inline-toolbar__dropdown--hidden',
conversionTogglerContent: 'ce-inline-toolbar__dropdown-content'
conversionTogglerContent: 'ce-inline-toolbar__dropdown-content',
};

/**
@@ -118,7 +118,7 @@ export default class InlineToolbar extends Module {
public make(): void {
this.nodes.wrapper = $.make('div', [
this.CSS.inlineToolbar,
...(this.isRtl ? [this.Editor.UI.CSS.editorRtlFix] : []),
...(this.isRtl ? [ this.Editor.UI.CSS.editorRtlFix ] : []),
]);
this.nodes.buttons = $.make('div', this.CSS.buttonsWrapper);
this.nodes.actions = $.make('div', this.CSS.actionsWrapper);
@@ -572,7 +572,7 @@ export default class InlineToolbar extends Module {

return (toolClass as ToolSettings).class[Tools.INTERNAL_SETTINGS.IS_INLINE];
})
.map(([name]: [string, InlineToolConstructable | ToolSettings]) => name);
.map(([ name ]: [string, InlineToolConstructable | ToolSettings]) => name);

/**
* 1) For internal tools, check public getter 'shortcut'
2 changes: 1 addition & 1 deletion src/components/modules/ui.ts
Original file line number Diff line number Diff line change
@@ -256,7 +256,7 @@ export default class UI extends Module {
*/
this.nodes.wrapper = $.make('div', [
this.CSS.editorWrapper,
...(this.isRtl ? [this.CSS.editorRtlFix] : []),
...(this.isRtl ? [ this.CSS.editorRtlFix ] : []),
]);
this.nodes.redactor = $.make('div', this.CSS.editorZone);