From 7c237cdd0ca9f45394370a5cbe4b764d964f6498 Mon Sep 17 00:00:00 2001 From: Matthew Lipski Date: Thu, 18 Jan 2024 17:28:28 +0100 Subject: [PATCH 1/2] Fixed formatting toolbar not hiding while dragging blocks --- .../FormattingToolbar/FormattingToolbarPlugin.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/core/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts b/packages/core/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts index 0dcdf50262..0a78178d68 100644 --- a/packages/core/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +++ b/packages/core/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts @@ -52,7 +52,8 @@ export class FormattingToolbarView { pmView.dom.addEventListener("mousedown", this.viewMousedownHandler); pmView.dom.addEventListener("mouseup", this.viewMouseupHandler); - pmView.dom.addEventListener("dragstart", this.dragstartHandler); + pmView.dom.addEventListener("dragstart", this.dragHandler); + pmView.dom.addEventListener("dragover", this.dragHandler); pmView.dom.addEventListener("focus", this.focusHandler); pmView.dom.addEventListener("blur", this.blurHandler); @@ -70,7 +71,7 @@ export class FormattingToolbarView { }; // For dragging the whole editor. - dragstartHandler = () => { + dragHandler = () => { if (this.formattingToolbarState?.show) { this.formattingToolbarState.show = false; this.updateFormattingToolbar(); @@ -177,7 +178,7 @@ export class FormattingToolbarView { destroy() { this.pmView.dom.removeEventListener("mousedown", this.viewMousedownHandler); this.pmView.dom.removeEventListener("mouseup", this.viewMouseupHandler); - this.pmView.dom.removeEventListener("dragstart", this.dragstartHandler); + this.pmView.dom.removeEventListener("dragstart", this.dragHandler); this.pmView.dom.removeEventListener("focus", this.focusHandler); this.pmView.dom.removeEventListener("blur", this.blurHandler); From 332e591b330e3f93de66f9c61a8905d76338c915 Mon Sep 17 00:00:00 2001 From: Matthew Lipski Date: Mon, 22 Jan 2024 02:42:45 +0100 Subject: [PATCH 2/2] Small fix --- .../src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts b/packages/core/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts index 0a78178d68..dac58aae43 100644 --- a/packages/core/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +++ b/packages/core/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts @@ -179,6 +179,7 @@ export class FormattingToolbarView { this.pmView.dom.removeEventListener("mousedown", this.viewMousedownHandler); this.pmView.dom.removeEventListener("mouseup", this.viewMouseupHandler); this.pmView.dom.removeEventListener("dragstart", this.dragHandler); + this.pmView.dom.removeEventListener("dragover", this.dragHandler); this.pmView.dom.removeEventListener("focus", this.focusHandler); this.pmView.dom.removeEventListener("blur", this.blurHandler);