Skip to content

Commit

Permalink
improve focus handling
Browse files Browse the repository at this point in the history
  • Loading branch information
yesil committed Dec 23, 2024
1 parent f3cd2e9 commit c6b6744
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions studio/src/rte/rte-field.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class LinkNodeView {
this.getPos = getPos;

this.dom = document.createElement('a');
this.dom.tabIndex = -1;

for (const [key, value] of Object.entries(node.attrs)) {
if (value !== null) {
Expand Down Expand Up @@ -217,7 +218,7 @@ class RteField extends LitElement {
escKey: this.#handleEscKey.bind(this),
ostEvent: this.#handleOstEvent.bind(this),
linkSave: this.#handleLinkSave.bind(this),
blur: this.#handleBlur.bind(this),
focusout: this.#handleFocusout.bind(this),
focus: this.#handleFocus.bind(this),
doubleClickOn: this.#handleDoubleClickOn.bind(this),
};
Expand Down Expand Up @@ -412,7 +413,7 @@ class RteField extends LitElement {
editable: () => !this.readOnly,
dispatchTransaction: this.#handleTransaction.bind(this),
handleDOMEvents: {
blur: this.#boundHandlers.blur,
focusout: this.#boundHandlers.focusout,
focus: this.#boundHandlers.focus,
},
handleDoubleClickOn: this.#boundHandlers.doubleClickOn,
Expand Down Expand Up @@ -749,7 +750,7 @@ class RteField extends LitElement {
if (tr.docChanged) dispatch(tr);
}

#handleBlur(view, event) {
#handleFocusout(view, event) {
if (
event.relatedTarget &&
this.shadowRoot.contains(event.relatedTarget)
Expand Down

0 comments on commit c6b6744

Please sign in to comment.