Skip to content

Commit d198f89

Browse files
Made all events in non-selectable blocks get handled by browser (#1112)
1 parent d0003b1 commit d198f89

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

packages/core/src/schema/blocks/createSpec.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,28 +63,20 @@ export type CustomBlockImplementation<
6363
) => PartialBlockFromConfig<T, I, S>["props"] | undefined;
6464
};
6565

66-
// Function that enables copying of selected content within non-selectable
67-
// blocks.
66+
// Function that causes events within non-selectable blocks to be handled by the
67+
// browser instead of the editor.
6868
export function applyNonSelectableBlockFix(nodeView: NodeView, editor: Editor) {
6969
nodeView.stopEvent = (event) => {
70-
// Ensures copy events are handled by the browser and not by ProseMirror.
71-
if (
72-
event.type === "copy" ||
73-
event.type === "cut" ||
74-
event.type === "paste"
75-
) {
76-
return true;
77-
}
7870
// Blurs the editor on mouse down as the block is non-selectable. This is
7971
// mainly done to prevent UI elements like the formatting toolbar from being
8072
// visible while content within a non-selectable block is selected.
8173
if (event.type === "mousedown") {
8274
setTimeout(() => {
8375
editor.view.dom.blur();
8476
}, 10);
85-
return true;
8677
}
87-
return false;
78+
79+
return true;
8880
};
8981
}
9082

0 commit comments

Comments
 (0)