mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: stale appState of MainMenu defaultItems rendered from Actions (#6074)
This commit is contained in:
parent
9803a85381
commit
40d53d9231
26 changed files with 463 additions and 431 deletions
|
@ -13,30 +13,30 @@ Object {
|
|||
"items": Array [
|
||||
Object {
|
||||
"contextItemLabel": "labels.cut",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "cut",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.copy",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": undefined,
|
||||
"name": "copy",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.paste",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": undefined,
|
||||
"name": "paste",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -44,28 +44,28 @@ Object {
|
|||
"separator",
|
||||
Object {
|
||||
"contextItemLabel": "labels.copyAsPng",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "copyAsPng",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.copyAsSvg",
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "copyAsSvg",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.copyText",
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "copyText",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -93,28 +93,28 @@ Object {
|
|||
Object {
|
||||
"PanelComponent": [Function],
|
||||
"contextItemLabel": "labels.group",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "group",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.unbindText",
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "unbindText",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.bindText",
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "bindText",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -122,10 +122,10 @@ Object {
|
|||
Object {
|
||||
"PanelComponent": [Function],
|
||||
"contextItemLabel": "labels.ungroup",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "ungroup",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -185,20 +185,20 @@ Object {
|
|||
"separator",
|
||||
Object {
|
||||
"contextItemLabel": "labels.flipHorizontal",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "flipHorizontal",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.flipVertical",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "flipVertical",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -206,9 +206,9 @@ Object {
|
|||
"separator",
|
||||
Object {
|
||||
"contextItemLabel": [Function],
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "toggleLinearEditor",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -216,10 +216,10 @@ Object {
|
|||
Object {
|
||||
"PanelComponent": [Function],
|
||||
"contextItemLabel": [Function],
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "hyperlink",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"action": "click",
|
||||
"category": "hyperlink",
|
||||
|
@ -4401,30 +4401,30 @@ Object {
|
|||
"items": Array [
|
||||
Object {
|
||||
"contextItemLabel": "labels.cut",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "cut",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.copy",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": undefined,
|
||||
"name": "copy",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.paste",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": undefined,
|
||||
"name": "paste",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -4432,28 +4432,28 @@ Object {
|
|||
"separator",
|
||||
Object {
|
||||
"contextItemLabel": "labels.copyAsPng",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "copyAsPng",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.copyAsSvg",
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "copyAsSvg",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.copyText",
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "copyText",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -4481,28 +4481,28 @@ Object {
|
|||
Object {
|
||||
"PanelComponent": [Function],
|
||||
"contextItemLabel": "labels.group",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "group",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.unbindText",
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "unbindText",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.bindText",
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "bindText",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -4510,10 +4510,10 @@ Object {
|
|||
Object {
|
||||
"PanelComponent": [Function],
|
||||
"contextItemLabel": "labels.ungroup",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "ungroup",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -4573,20 +4573,20 @@ Object {
|
|||
"separator",
|
||||
Object {
|
||||
"contextItemLabel": "labels.flipHorizontal",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "flipHorizontal",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.flipVertical",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "flipVertical",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -4594,9 +4594,9 @@ Object {
|
|||
"separator",
|
||||
Object {
|
||||
"contextItemLabel": [Function],
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "toggleLinearEditor",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -4604,10 +4604,10 @@ Object {
|
|||
Object {
|
||||
"PanelComponent": [Function],
|
||||
"contextItemLabel": [Function],
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "hyperlink",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"action": "click",
|
||||
"category": "hyperlink",
|
||||
|
@ -4942,30 +4942,30 @@ Object {
|
|||
"items": Array [
|
||||
Object {
|
||||
"contextItemLabel": "labels.cut",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "cut",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.copy",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": undefined,
|
||||
"name": "copy",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.paste",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": undefined,
|
||||
"name": "paste",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -4973,28 +4973,28 @@ Object {
|
|||
"separator",
|
||||
Object {
|
||||
"contextItemLabel": "labels.copyAsPng",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "copyAsPng",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.copyAsSvg",
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "copyAsSvg",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.copyText",
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "copyText",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -5022,28 +5022,28 @@ Object {
|
|||
Object {
|
||||
"PanelComponent": [Function],
|
||||
"contextItemLabel": "labels.group",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "group",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.unbindText",
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "unbindText",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.bindText",
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "bindText",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -5051,10 +5051,10 @@ Object {
|
|||
Object {
|
||||
"PanelComponent": [Function],
|
||||
"contextItemLabel": "labels.ungroup",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "ungroup",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -5114,20 +5114,20 @@ Object {
|
|||
"separator",
|
||||
Object {
|
||||
"contextItemLabel": "labels.flipHorizontal",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "flipHorizontal",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.flipVertical",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "flipVertical",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -5135,9 +5135,9 @@ Object {
|
|||
"separator",
|
||||
Object {
|
||||
"contextItemLabel": [Function],
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "toggleLinearEditor",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -5145,10 +5145,10 @@ Object {
|
|||
Object {
|
||||
"PanelComponent": [Function],
|
||||
"contextItemLabel": [Function],
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "hyperlink",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"action": "click",
|
||||
"category": "hyperlink",
|
||||
|
@ -5568,10 +5568,10 @@ Object {
|
|||
"items": Array [
|
||||
Object {
|
||||
"contextItemLabel": "labels.paste",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": undefined,
|
||||
"name": "paste",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -5579,28 +5579,28 @@ Object {
|
|||
"separator",
|
||||
Object {
|
||||
"contextItemLabel": "labels.copyAsPng",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "copyAsPng",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.copyAsSvg",
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "copyAsSvg",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.copyText",
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "copyText",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -5619,10 +5619,10 @@ Object {
|
|||
Object {
|
||||
"checked": [Function],
|
||||
"contextItemLabel": "labels.showGrid",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "gridMode",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "canvas",
|
||||
"predicate": [Function],
|
||||
|
@ -5632,10 +5632,10 @@ Object {
|
|||
Object {
|
||||
"checked": [Function],
|
||||
"contextItemLabel": "buttons.zenMode",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "zenMode",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "canvas",
|
||||
"predicate": [Function],
|
||||
|
@ -5645,10 +5645,10 @@ Object {
|
|||
Object {
|
||||
"checked": [Function],
|
||||
"contextItemLabel": "labels.viewMode",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "viewMode",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "canvas",
|
||||
"predicate": [Function],
|
||||
|
@ -5782,30 +5782,30 @@ Object {
|
|||
"items": Array [
|
||||
Object {
|
||||
"contextItemLabel": "labels.cut",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "cut",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.copy",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": undefined,
|
||||
"name": "copy",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.paste",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": undefined,
|
||||
"name": "paste",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -5813,28 +5813,28 @@ Object {
|
|||
"separator",
|
||||
Object {
|
||||
"contextItemLabel": "labels.copyAsPng",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "copyAsPng",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.copyAsSvg",
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "copyAsSvg",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.copyText",
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "copyText",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -5862,28 +5862,28 @@ Object {
|
|||
Object {
|
||||
"PanelComponent": [Function],
|
||||
"contextItemLabel": "labels.group",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "group",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.unbindText",
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "unbindText",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.bindText",
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "bindText",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -5891,10 +5891,10 @@ Object {
|
|||
Object {
|
||||
"PanelComponent": [Function],
|
||||
"contextItemLabel": "labels.ungroup",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "ungroup",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -5954,20 +5954,20 @@ Object {
|
|||
"separator",
|
||||
Object {
|
||||
"contextItemLabel": "labels.flipHorizontal",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "flipHorizontal",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.flipVertical",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "flipVertical",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -5975,9 +5975,9 @@ Object {
|
|||
"separator",
|
||||
Object {
|
||||
"contextItemLabel": [Function],
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "toggleLinearEditor",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -5985,10 +5985,10 @@ Object {
|
|||
Object {
|
||||
"PanelComponent": [Function],
|
||||
"contextItemLabel": [Function],
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "hyperlink",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"action": "click",
|
||||
"category": "hyperlink",
|
||||
|
@ -6119,30 +6119,30 @@ Object {
|
|||
"items": Array [
|
||||
Object {
|
||||
"contextItemLabel": "labels.cut",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "cut",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.copy",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": undefined,
|
||||
"name": "copy",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.paste",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": undefined,
|
||||
"name": "paste",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -6150,28 +6150,28 @@ Object {
|
|||
"separator",
|
||||
Object {
|
||||
"contextItemLabel": "labels.copyAsPng",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "copyAsPng",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.copyAsSvg",
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "copyAsSvg",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.copyText",
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "copyText",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -6199,28 +6199,28 @@ Object {
|
|||
Object {
|
||||
"PanelComponent": [Function],
|
||||
"contextItemLabel": "labels.group",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "group",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.unbindText",
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "unbindText",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.bindText",
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "bindText",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -6228,10 +6228,10 @@ Object {
|
|||
Object {
|
||||
"PanelComponent": [Function],
|
||||
"contextItemLabel": "labels.ungroup",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "ungroup",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -6291,20 +6291,20 @@ Object {
|
|||
"separator",
|
||||
Object {
|
||||
"contextItemLabel": "labels.flipHorizontal",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "flipHorizontal",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"contextItemLabel": "labels.flipVertical",
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "flipVertical",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -6312,9 +6312,9 @@ Object {
|
|||
"separator",
|
||||
Object {
|
||||
"contextItemLabel": [Function],
|
||||
"contextItemPredicate": [Function],
|
||||
"name": "toggleLinearEditor",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"category": "element",
|
||||
},
|
||||
|
@ -6322,10 +6322,10 @@ Object {
|
|||
Object {
|
||||
"PanelComponent": [Function],
|
||||
"contextItemLabel": [Function],
|
||||
"contextItemPredicate": [Function],
|
||||
"keyTest": [Function],
|
||||
"name": "hyperlink",
|
||||
"perform": [Function],
|
||||
"predicate": [Function],
|
||||
"trackEvent": Object {
|
||||
"action": "click",
|
||||
"category": "hyperlink",
|
||||
|
|
|
@ -1,5 +1,114 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`<Excalidraw/> <MainMenu/> should render main menu with host menu items if passed from host 1`] = `
|
||||
<div
|
||||
class="dropdown-menu"
|
||||
data-testid="dropdown-menu"
|
||||
>
|
||||
<div
|
||||
class="Island dropdown-menu-container"
|
||||
style="--padding: 2; z-index: 1;"
|
||||
>
|
||||
<button
|
||||
class="dropdown-menu-item dropdown-menu-item-base"
|
||||
type="button"
|
||||
>
|
||||
<div
|
||||
class="dropdown-menu-item__icon"
|
||||
/>
|
||||
<div
|
||||
class="dropdown-menu-item__text"
|
||||
>
|
||||
Click me
|
||||
</div>
|
||||
</button>
|
||||
<a
|
||||
class="dropdown-menu-item dropdown-menu-item-base"
|
||||
href="blog.excalidaw.com"
|
||||
rel="noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
<div
|
||||
class="dropdown-menu-item__icon"
|
||||
/>
|
||||
<div
|
||||
class="dropdown-menu-item__text"
|
||||
>
|
||||
Excalidraw blog
|
||||
</div>
|
||||
</a>
|
||||
<div
|
||||
class="dropdown-menu-item-base dropdown-menu-item-custom"
|
||||
>
|
||||
<button
|
||||
style="height: 2rem;"
|
||||
>
|
||||
|
||||
custom menu item
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
aria-label="Help"
|
||||
class="dropdown-menu-item dropdown-menu-item-base"
|
||||
data-testid="help-menu-item"
|
||||
title="Help"
|
||||
type="button"
|
||||
>
|
||||
<div
|
||||
class="dropdown-menu-item__icon"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class=""
|
||||
fill="none"
|
||||
focusable="false"
|
||||
role="img"
|
||||
stroke="currentColor"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<g
|
||||
stroke-width="1.5"
|
||||
>
|
||||
<path
|
||||
d="M0 0h24v24H0z"
|
||||
fill="none"
|
||||
stroke="none"
|
||||
/>
|
||||
<circle
|
||||
cx="12"
|
||||
cy="12"
|
||||
r="9"
|
||||
/>
|
||||
<line
|
||||
x1="12"
|
||||
x2="12"
|
||||
y1="17"
|
||||
y2="17.01"
|
||||
/>
|
||||
<path
|
||||
d="M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
<div
|
||||
class="dropdown-menu-item__text"
|
||||
>
|
||||
Help
|
||||
</div>
|
||||
<div
|
||||
class="dropdown-menu-item__shortcut"
|
||||
>
|
||||
?
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`<Excalidraw/> Test UIOptions prop Test canvasActions should render menu with default items when "UIOPtions" is "undefined" 1`] = `
|
||||
<div
|
||||
class="dropdown-menu"
|
||||
|
@ -454,112 +563,3 @@ exports[`<Excalidraw/> Test UIOptions prop Test canvasActions should render menu
|
|||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`<Excalidraw/> should render main menu with host menu items if passed from host 1`] = `
|
||||
<div
|
||||
class="dropdown-menu"
|
||||
data-testid="dropdown-menu"
|
||||
>
|
||||
<div
|
||||
class="Island dropdown-menu-container"
|
||||
style="--padding: 2; z-index: 1;"
|
||||
>
|
||||
<button
|
||||
class="dropdown-menu-item dropdown-menu-item-base"
|
||||
type="button"
|
||||
>
|
||||
<div
|
||||
class="dropdown-menu-item__icon"
|
||||
/>
|
||||
<div
|
||||
class="dropdown-menu-item__text"
|
||||
>
|
||||
Click me
|
||||
</div>
|
||||
</button>
|
||||
<a
|
||||
class="dropdown-menu-item dropdown-menu-item-base"
|
||||
href="blog.excalidaw.com"
|
||||
rel="noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
<div
|
||||
class="dropdown-menu-item__icon"
|
||||
/>
|
||||
<div
|
||||
class="dropdown-menu-item__text"
|
||||
>
|
||||
Excalidraw blog
|
||||
</div>
|
||||
</a>
|
||||
<div
|
||||
class="dropdown-menu-item-base dropdown-menu-item-custom"
|
||||
>
|
||||
<button
|
||||
style="height: 2rem;"
|
||||
>
|
||||
|
||||
custom menu item
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
aria-label="Help"
|
||||
class="dropdown-menu-item dropdown-menu-item-base"
|
||||
data-testid="help-menu-item"
|
||||
title="Help"
|
||||
type="button"
|
||||
>
|
||||
<div
|
||||
class="dropdown-menu-item__icon"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class=""
|
||||
fill="none"
|
||||
focusable="false"
|
||||
role="img"
|
||||
stroke="currentColor"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<g
|
||||
stroke-width="1.5"
|
||||
>
|
||||
<path
|
||||
d="M0 0h24v24H0z"
|
||||
fill="none"
|
||||
stroke="none"
|
||||
/>
|
||||
<circle
|
||||
cx="12"
|
||||
cy="12"
|
||||
r="9"
|
||||
/>
|
||||
<line
|
||||
x1="12"
|
||||
x2="12"
|
||||
y1="17"
|
||||
y2="17.01"
|
||||
/>
|
||||
<path
|
||||
d="M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
<div
|
||||
class="dropdown-menu-item__text"
|
||||
>
|
||||
Help
|
||||
</div>
|
||||
<div
|
||||
class="dropdown-menu-item__shortcut"
|
||||
>
|
||||
?
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
|
|
@ -3,6 +3,7 @@ import { Excalidraw, Footer, MainMenu } from "../../packages/excalidraw/index";
|
|||
import { queryByText, queryByTestId } from "@testing-library/react";
|
||||
import { GRID_SIZE, THEME } from "../../constants";
|
||||
import { t } from "../../i18n";
|
||||
import { useMemo } from "react";
|
||||
|
||||
const { h } = window;
|
||||
|
||||
|
@ -13,6 +14,7 @@ describe("<Excalidraw/>", () => {
|
|||
toggleMenu(document.querySelector(".excalidraw")!);
|
||||
}
|
||||
});
|
||||
|
||||
describe("Test zenModeEnabled prop", () => {
|
||||
it('should show exit zen mode button when zen mode is set and zen mode option in context menu when zenModeEnabled is "undefined"', async () => {
|
||||
const { container } = await render(<Excalidraw />);
|
||||
|
@ -121,34 +123,6 @@ describe("<Excalidraw/>", () => {
|
|||
});
|
||||
});
|
||||
|
||||
it("should render main menu with host menu items if passed from host", async () => {
|
||||
const { container } = await render(
|
||||
<Excalidraw UIOptions={undefined}>
|
||||
<MainMenu>
|
||||
<MainMenu.Item onSelect={() => window.alert("Clicked")}>
|
||||
Click me
|
||||
</MainMenu.Item>
|
||||
<MainMenu.ItemLink href="blog.excalidaw.com">
|
||||
Excalidraw blog
|
||||
</MainMenu.ItemLink>
|
||||
<MainMenu.ItemCustom>
|
||||
<button
|
||||
style={{ height: "2rem" }}
|
||||
onClick={() => window.alert("custom menu item")}
|
||||
>
|
||||
{" "}
|
||||
custom menu item
|
||||
</button>
|
||||
</MainMenu.ItemCustom>
|
||||
<MainMenu.DefaultItems.Help />
|
||||
</MainMenu>
|
||||
</Excalidraw>,
|
||||
);
|
||||
//open menu
|
||||
toggleMenu(container);
|
||||
expect(queryByTestId(container, "dropdown-menu")).toMatchSnapshot();
|
||||
});
|
||||
|
||||
describe("Test UIOptions prop", () => {
|
||||
describe("Test canvasActions", () => {
|
||||
it('should render menu with default items when "UIOPtions" is "undefined"', async () => {
|
||||
|
@ -306,7 +280,7 @@ describe("<Excalidraw/>", () => {
|
|||
//open menu
|
||||
toggleMenu(container);
|
||||
const darkModeToggle = queryByTestId(container, "toggle-dark-mode");
|
||||
expect(darkModeToggle).toBeFalsy();
|
||||
expect(darkModeToggle).toBe(null);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -336,6 +310,7 @@ describe("<Excalidraw/>", () => {
|
|||
expect(textInput?.nodeName).toBe("SPAN");
|
||||
});
|
||||
});
|
||||
|
||||
describe("Test autoFocus prop", () => {
|
||||
it("should not focus when autoFocus is false", async () => {
|
||||
const { container } = await render(<Excalidraw />);
|
||||
|
@ -353,4 +328,64 @@ describe("<Excalidraw/>", () => {
|
|||
).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("<MainMenu/>", () => {
|
||||
it("should render main menu with host menu items if passed from host", async () => {
|
||||
const { container } = await render(
|
||||
<Excalidraw>
|
||||
<MainMenu>
|
||||
<MainMenu.Item onSelect={() => window.alert("Clicked")}>
|
||||
Click me
|
||||
</MainMenu.Item>
|
||||
<MainMenu.ItemLink href="blog.excalidaw.com">
|
||||
Excalidraw blog
|
||||
</MainMenu.ItemLink>
|
||||
<MainMenu.ItemCustom>
|
||||
<button
|
||||
style={{ height: "2rem" }}
|
||||
onClick={() => window.alert("custom menu item")}
|
||||
>
|
||||
{" "}
|
||||
custom menu item
|
||||
</button>
|
||||
</MainMenu.ItemCustom>
|
||||
<MainMenu.DefaultItems.Help />
|
||||
</MainMenu>
|
||||
</Excalidraw>,
|
||||
);
|
||||
//open menu
|
||||
toggleMenu(container);
|
||||
expect(queryByTestId(container, "dropdown-menu")).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("should update themeToggle text even if MainMenu memoized", async () => {
|
||||
const CustomExcalidraw = () => {
|
||||
const customMenu = useMemo(() => {
|
||||
return (
|
||||
<MainMenu>
|
||||
<MainMenu.DefaultItems.ToggleTheme />
|
||||
</MainMenu>
|
||||
);
|
||||
}, []);
|
||||
|
||||
return <Excalidraw>{customMenu}</Excalidraw>;
|
||||
};
|
||||
|
||||
const { container } = await render(<CustomExcalidraw />);
|
||||
//open menu
|
||||
toggleMenu(container);
|
||||
|
||||
expect(h.state.theme).toBe(THEME.LIGHT);
|
||||
|
||||
expect(
|
||||
queryByTestId(container, "toggle-dark-mode")?.textContent,
|
||||
).toContain(t("buttons.darkMode"));
|
||||
|
||||
fireEvent.click(queryByTestId(container, "toggle-dark-mode")!);
|
||||
|
||||
expect(
|
||||
queryByTestId(container, "toggle-dark-mode")?.textContent,
|
||||
).toContain(t("buttons.lightMode"));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue