Ignore double-click on Markdown cells (#1937)

This commit is contained in:
Jonatan Kłosko 2023-05-30 13:07:18 +02:00 committed by GitHub
parent 3e1067f4b5
commit df51b9d6d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -85,14 +85,12 @@ const Session = {
this._handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this); this._handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);
this._handleDocumentFocus = this.handleDocumentFocus.bind(this); this._handleDocumentFocus = this.handleDocumentFocus.bind(this);
this._handleDocumentClick = this.handleDocumentClick.bind(this); this._handleDocumentClick = this.handleDocumentClick.bind(this);
this._handleDocumentDoubleClick = this.handleDocumentDoubleClick.bind(this);
document.addEventListener("keydown", this._handleDocumentKeyDown, true); document.addEventListener("keydown", this._handleDocumentKeyDown, true);
document.addEventListener("mousedown", this._handleDocumentMouseDown); document.addEventListener("mousedown", this._handleDocumentMouseDown);
// Note: the focus event doesn't bubble, so we register for the capture phase // Note: the focus event doesn't bubble, so we register for the capture phase
document.addEventListener("focus", this._handleDocumentFocus, true); document.addEventListener("focus", this._handleDocumentFocus, true);
document.addEventListener("click", this._handleDocumentClick); document.addEventListener("click", this._handleDocumentClick);
document.addEventListener("dblclick", this._handleDocumentDoubleClick);
this.getElement("sections-list").addEventListener("click", (event) => { this.getElement("sections-list").addEventListener("click", (event) => {
this.handleSectionsListClick(event); this.handleSectionsListClick(event);
@ -255,7 +253,6 @@ const Session = {
document.removeEventListener("mousedown", this._handleDocumentMouseDown); document.removeEventListener("mousedown", this._handleDocumentMouseDown);
document.removeEventListener("focus", this._handleDocumentFocus, true); document.removeEventListener("focus", this._handleDocumentFocus, true);
document.removeEventListener("click", this._handleDocumentClick); document.removeEventListener("click", this._handleDocumentClick);
document.removeEventListener("dblclick", this._handleDocumentDoubleClick);
setFavicon("favicon"); setFavicon("favicon");
@ -566,18 +563,6 @@ const Session = {
} }
}, },
/**
* Enters insert mode when a markdown cell is double-clicked.
*/
handleDocumentDoubleClick(event) {
const cell = event.target.closest(`[data-el-cell]`);
const type = cell && cell.getAttribute("data-type");
if (type && type === "markdown" && this.focusedId && !this.insertMode) {
this.setInsertMode(true);
}
},
/** /**
* Handles section link clicks in the section list. * Handles section link clicks in the section list.
*/ */