How to use the @typewriter/editor.shallowEqual function in @typewriter/editor

To help you get started, we’ve selected a few @typewriter/editor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github typewriter-editor / typewriter / packages / view-vdom / src / view.ts View on Github external
updateEditorSelection(source: string = SOURCE_API) {
    if (this._settingBrowserSelection) return this._settingBrowserSelection = false;
    const range = this.getSelection();

    // Store the last non-null selection for restoration on focus()
    if (range) this.lastSelection = range;

    this._settingEditorSelection = true;
    this.editor.setSelection(range, source);
    this._settingEditorSelection = false;

    // If the selection was adjusted when set then update the browser's selection
    const selection = this.getBrowserSelection();
    if (!shallowEqual(range, this.editor.selection) || (range && range[0] === range[1] && selection && selection.type === 'Range')) {
      this.updateBrowserSelection();
    }
  }

@typewriter/editor

The core editor for typewriter. Manages the data model and updates. Can be run headless.

MIT
Latest version published 4 years ago

Package Health Score

51 / 100
Full package analysis