Fix: use stopImmediatePropagation to prevent macOS bugs
This commit is contained in:
parent
f60abfdb8a
commit
fe3f365885
1 changed files with 8 additions and 0 deletions
|
|
@ -180,6 +180,7 @@ export default function Page({
|
||||||
|
|
||||||
function handleUndo(e: KeyboardEvent) {
|
function handleUndo(e: KeyboardEvent) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
e.stopImmediatePropagation();
|
||||||
if (!isWrappedWithClass(e, "noundo")) {
|
if (!isWrappedWithClass(e, "noundo")) {
|
||||||
undo();
|
undo();
|
||||||
}
|
}
|
||||||
|
|
@ -187,6 +188,7 @@ export default function Page({
|
||||||
|
|
||||||
function handleRedo(e: KeyboardEvent) {
|
function handleRedo(e: KeyboardEvent) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
e.stopImmediatePropagation();
|
||||||
if (!isWrappedWithClass(e, "noundo")) {
|
if (!isWrappedWithClass(e, "noundo")) {
|
||||||
redo();
|
redo();
|
||||||
}
|
}
|
||||||
|
|
@ -194,6 +196,7 @@ export default function Page({
|
||||||
|
|
||||||
function handleGroup(e: KeyboardEvent) {
|
function handleGroup(e: KeyboardEvent) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
e.stopImmediatePropagation();
|
||||||
if (selectionMenuVisible) {
|
if (selectionMenuVisible) {
|
||||||
handleGroupNode();
|
handleGroupNode();
|
||||||
}
|
}
|
||||||
|
|
@ -202,6 +205,7 @@ export default function Page({
|
||||||
function handleDuplicate(e: KeyboardEvent) {
|
function handleDuplicate(e: KeyboardEvent) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
e.stopImmediatePropagation();
|
||||||
const selectedNode = nodes.filter((obj) => obj.selected);
|
const selectedNode = nodes.filter((obj) => obj.selected);
|
||||||
if (selectedNode.length > 0) {
|
if (selectedNode.length > 0) {
|
||||||
paste(
|
paste(
|
||||||
|
|
@ -216,6 +220,7 @@ export default function Page({
|
||||||
|
|
||||||
function handleCopy(e: KeyboardEvent) {
|
function handleCopy(e: KeyboardEvent) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
e.stopImmediatePropagation();
|
||||||
if (
|
if (
|
||||||
!isWrappedWithClass(e, "nocopy") &&
|
!isWrappedWithClass(e, "nocopy") &&
|
||||||
window.getSelection()?.toString().length === 0 &&
|
window.getSelection()?.toString().length === 0 &&
|
||||||
|
|
@ -227,6 +232,7 @@ export default function Page({
|
||||||
|
|
||||||
function handleCut(e: KeyboardEvent) {
|
function handleCut(e: KeyboardEvent) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
e.stopImmediatePropagation();
|
||||||
if (
|
if (
|
||||||
!isWrappedWithClass(e, "nocopy") &&
|
!isWrappedWithClass(e, "nocopy") &&
|
||||||
window.getSelection()?.toString().length === 0 &&
|
window.getSelection()?.toString().length === 0 &&
|
||||||
|
|
@ -238,6 +244,7 @@ export default function Page({
|
||||||
|
|
||||||
function handlePaste(e: KeyboardEvent) {
|
function handlePaste(e: KeyboardEvent) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
e.stopImmediatePropagation();
|
||||||
if (
|
if (
|
||||||
!isWrappedWithClass(e, "nocopy") &&
|
!isWrappedWithClass(e, "nocopy") &&
|
||||||
window.getSelection()?.toString().length === 0 &&
|
window.getSelection()?.toString().length === 0 &&
|
||||||
|
|
@ -253,6 +260,7 @@ export default function Page({
|
||||||
|
|
||||||
function handleDelete(e: KeyboardEvent) {
|
function handleDelete(e: KeyboardEvent) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
e.stopImmediatePropagation();
|
||||||
if (!isWrappedWithClass(e, "nodelete") && lastSelection) {
|
if (!isWrappedWithClass(e, "nodelete") && lastSelection) {
|
||||||
takeSnapshot();
|
takeSnapshot();
|
||||||
deleteNode(lastSelection.nodes.map((node) => node.id));
|
deleteNode(lastSelection.nodes.map((node) => node.id));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue