bjones1 / CodeChat_Editor

The CodeChat Editor provides an easy-to-use literate programming environment
Other
8 stars 10 forks source link

Selected text causes TinyMCE menu and selection to disappear #27

Open bjones1 opened 5 months ago

bjones1 commented 5 months ago

If a selection is made in the TinyMCE editor inside Codemirror, then the user clicks on either the Format menu or the formatting drop-down, then the TinyMCE menu bar and the selection disappear.

bjones1 commented 3 months ago

Follow-up debug: v. 6.0.0 of the Codemirror view works, while v6.0.1 doesn't. Investigation shows that this commit causes the failure. Backing out this changes fixes the behavior. In the current Codemirror view we have:

        let selectionNotFocus = !focused &&
            hasSelection(this.dom, this.view.observer.selectionRange) && !(activeElt && this.dom.contains(activeElt));

Adding the following line fixes the bug:

        selectionNotFocus = this.view.state.facet(editable) ? focused : hasSelection(this.dom, this.view.observer.selectionRange)

I don't yet understand why, or how to investigate further.

bjones1 commented 2 months ago

The procedure to make this edit:

  1. In the client/ directory, run npm update.
  2. Edit client/node_modules/@codemirror/view/dist/index.js per the directions above. Important: do not edit index.cjs (which isn't used in the build).
  3. In the client directory, run npm run build.
  4. Stop the server then re-run it.