Skip to content

Commit

Permalink
feat: also emit change events when in readonly mode (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
artaius authored Nov 6, 2024
1 parent 9cfc345 commit c4ea31c
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions lib/canvas_editor/init/canvas_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ function initCanvasEditor(
Reaction,
) {
class CanvasEditor {
#isReadOnly;
#editorArea;
// Can be useful for debugging.
/* eslint-disable no-unused-private-class-members */
Expand All @@ -22,7 +21,6 @@ function initCanvasEditor(
#destroy;

constructor(parentElement, options = {}) {
const { readOnly = false } = options;
const { editorArea, toolbar, uiHelper, destroy } = createEditor(
parentElement,
options,
Expand All @@ -33,7 +31,6 @@ function initCanvasEditor(
Molecule,
Reaction,
);
this.#isReadOnly = readOnly;
this.#editorArea = editorArea;
this.#toolbar = toolbar;
this.#uiHelper = uiHelper;
Expand Down Expand Up @@ -82,8 +79,6 @@ function initCanvasEditor(
setOnChangeListener(onChange) {
this.#checkNotDestroyed();

if (this.#isReadOnly) return;

this.#onChange = onChange;
}

Expand Down Expand Up @@ -120,7 +115,6 @@ function initCanvasEditor(
* @param {{ what: number; isUserEvent: boolean; }} event
*/
#handleChange(event) {
if (this.#isReadOnly) return;
if (!this.#onChange) return;

const { what, isUserEvent } = event;
Expand Down

0 comments on commit c4ea31c

Please sign in to comment.