mirror of
https://github.com/codex-team/editor.js
synced 2024-06-13 19:32:28 +02:00
fix(readonly): crash with readonly property (#1969)
* fix(readonly): fix readonly property Resolves #1968 * changelog added * Update CHANGELOG.md
This commit is contained in:
parent
c1bca10d12
commit
640b1a2d7e
|
@ -1,5 +1,9 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
### 2.23.2
|
||||||
|
|
||||||
|
— `Fix` — Crash on initialization in the read-only mode [#1968](https://github.com/codex-team/editor.js/issues/1968)
|
||||||
|
|
||||||
### 2.23.1
|
### 2.23.1
|
||||||
|
|
||||||
— `Fix` — Incorrect release tag fixed
|
— `Fix` — Incorrect release tag fixed
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@editorjs/editorjs",
|
"name": "@editorjs/editorjs",
|
||||||
"version": "2.23.1",
|
"version": "2.23.2",
|
||||||
"description": "Editor.js — Native JS, based on API and Open Source",
|
"description": "Editor.js — Native JS, based on API and Open Source",
|
||||||
"main": "dist/editor.js",
|
"main": "dist/editor.js",
|
||||||
"types": "./types/index.d.ts",
|
"types": "./types/index.d.ts",
|
||||||
|
|
|
@ -376,7 +376,6 @@ export default class RectangleSelection extends Module {
|
||||||
this.inverseSelection();
|
this.inverseSelection();
|
||||||
|
|
||||||
SelectionUtils.get().removeAllRanges();
|
SelectionUtils.get().removeAllRanges();
|
||||||
event.preventDefault();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -227,7 +227,6 @@ export default class Toolbar extends Module<ToolbarNodes> {
|
||||||
this.enableModuleBindings();
|
this.enableModuleBindings();
|
||||||
} else {
|
} else {
|
||||||
this.destroy();
|
this.destroy();
|
||||||
this.toolboxInstance.destroy();
|
|
||||||
this.Editor.BlockSettings.destroy();
|
this.Editor.BlockSettings.destroy();
|
||||||
this.disableModuleBindings();
|
this.disableModuleBindings();
|
||||||
}
|
}
|
||||||
|
@ -295,6 +294,10 @@ export default class Toolbar extends Module<ToolbarNodes> {
|
||||||
* Close the Toolbar
|
* Close the Toolbar
|
||||||
*/
|
*/
|
||||||
public close(): void {
|
public close(): void {
|
||||||
|
if (this.Editor.ReadOnly.isEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.nodes.wrapper.classList.remove(this.CSS.toolbarOpened);
|
this.nodes.wrapper.classList.remove(this.CSS.toolbarOpened);
|
||||||
|
|
||||||
/** Close components */
|
/** Close components */
|
||||||
|
@ -551,7 +554,9 @@ export default class Toolbar extends Module<ToolbarNodes> {
|
||||||
*/
|
*/
|
||||||
private destroy(): void {
|
private destroy(): void {
|
||||||
this.removeAllNodes();
|
this.removeAllNodes();
|
||||||
this.toolboxInstance.destroy();
|
if (this.toolboxInstance) {
|
||||||
|
this.toolboxInstance.destroy();
|
||||||
|
}
|
||||||
this.tooltip.destroy();
|
this.tooltip.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,4 +25,26 @@ describe('Editor basic initialization', () => {
|
||||||
.should('be.visible');
|
.should('be.visible');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Configuration', () => {
|
||||||
|
describe('readOnly', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
if (this && this.editorInstance) {
|
||||||
|
this.editorInstance.destroy();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create editor without editing ability when true passed', () => {
|
||||||
|
cy.createEditor({
|
||||||
|
readOnly: true,
|
||||||
|
}).as('editorInstance');
|
||||||
|
|
||||||
|
cy.get('[data-cy=editorjs]')
|
||||||
|
.get('div.codex-editor')
|
||||||
|
.get('div.ce-paragraph')
|
||||||
|
.invoke('attr', 'contenteditable')
|
||||||
|
.should('eq', 'false');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue