Skip to content

Commit cd6e1ae

Browse files
fix: Formatting toolbar not hiding while dragging blocks (#529)
* Fixed formatting toolbar not hiding while dragging blocks * Small fix
1 parent 03177d2 commit cd6e1ae

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/core/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ export class FormattingToolbarView {
5252

5353
pmView.dom.addEventListener("mousedown", this.viewMousedownHandler);
5454
pmView.dom.addEventListener("mouseup", this.viewMouseupHandler);
55-
pmView.dom.addEventListener("dragstart", this.dragstartHandler);
55+
pmView.dom.addEventListener("dragstart", this.dragHandler);
56+
pmView.dom.addEventListener("dragover", this.dragHandler);
5657

5758
pmView.dom.addEventListener("focus", this.focusHandler);
5859
pmView.dom.addEventListener("blur", this.blurHandler);
@@ -70,7 +71,7 @@ export class FormattingToolbarView {
7071
};
7172

7273
// For dragging the whole editor.
73-
dragstartHandler = () => {
74+
dragHandler = () => {
7475
if (this.formattingToolbarState?.show) {
7576
this.formattingToolbarState.show = false;
7677
this.updateFormattingToolbar();
@@ -177,7 +178,8 @@ export class FormattingToolbarView {
177178
destroy() {
178179
this.pmView.dom.removeEventListener("mousedown", this.viewMousedownHandler);
179180
this.pmView.dom.removeEventListener("mouseup", this.viewMouseupHandler);
180-
this.pmView.dom.removeEventListener("dragstart", this.dragstartHandler);
181+
this.pmView.dom.removeEventListener("dragstart", this.dragHandler);
182+
this.pmView.dom.removeEventListener("dragover", this.dragHandler);
181183

182184
this.pmView.dom.removeEventListener("focus", this.focusHandler);
183185
this.pmView.dom.removeEventListener("blur", this.blurHandler);

0 commit comments

Comments
 (0)