@examind/block-editor 0.1.0 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +3 -0
- package/dist/index.d.mts +9 -11
- package/dist/index.d.ts +9 -11
- package/dist/index.js +248 -232
- package/dist/index.mjs +119 -107
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14946,15 +14946,52 @@ function useTypeaheadTriggerMatch(trigger, {
|
|
|
14946
14946
|
);
|
|
14947
14947
|
}
|
|
14948
14948
|
|
|
14949
|
+
// src/utils/visitVariableNodes.ts
|
|
14950
|
+
var import_lexical91 = require("lexical");
|
|
14951
|
+
function visitVariableNodes(rootNode, cb) {
|
|
14952
|
+
if ($isVariableNode(rootNode)) {
|
|
14953
|
+
cb(rootNode);
|
|
14954
|
+
}
|
|
14955
|
+
if ((0, import_lexical91.$isElementNode)(rootNode)) {
|
|
14956
|
+
const children = rootNode.getChildren();
|
|
14957
|
+
for (const childNode of children) {
|
|
14958
|
+
visitVariableNodes(childNode, cb);
|
|
14959
|
+
}
|
|
14960
|
+
}
|
|
14961
|
+
}
|
|
14962
|
+
|
|
14949
14963
|
// src/plugins/VariablesPlugin/VariablesContext.tsx
|
|
14964
|
+
var import_lexical92 = require("lexical");
|
|
14950
14965
|
var import_react92 = __toESM(require("react"));
|
|
14951
14966
|
var import_jsx_runtime113 = require("react/jsx-runtime");
|
|
14952
14967
|
var VariablesContext = import_react92.default.createContext(null);
|
|
14953
14968
|
function VariablesProvider(props) {
|
|
14954
|
-
const {
|
|
14969
|
+
const { getEditor, getAllNestedEditors } = useBlockEditor();
|
|
14970
|
+
const { children, variablesSettings } = props;
|
|
14955
14971
|
const [variableList, setVariableList] = (0, import_react92.useState)(
|
|
14956
14972
|
variablesSettings.list
|
|
14957
14973
|
);
|
|
14974
|
+
const updateVariablesInEditor = (newName, oldName, editor) => {
|
|
14975
|
+
editor.update(() => {
|
|
14976
|
+
visitVariableNodes((0, import_lexical92.$getRoot)(), (variableNode) => {
|
|
14977
|
+
if (variableNode.__variable === oldName) {
|
|
14978
|
+
variableNode.setVariable(newName);
|
|
14979
|
+
}
|
|
14980
|
+
});
|
|
14981
|
+
});
|
|
14982
|
+
};
|
|
14983
|
+
const renameVariable = (newName, oldName) => {
|
|
14984
|
+
const allNestedEditors = getAllNestedEditors();
|
|
14985
|
+
for (const nestedEditor of allNestedEditors) {
|
|
14986
|
+
updateVariablesInEditor(newName, oldName, nestedEditor);
|
|
14987
|
+
}
|
|
14988
|
+
const editorRef = getEditor();
|
|
14989
|
+
if (editorRef) {
|
|
14990
|
+
updateVariablesInEditor(newName, oldName, editorRef);
|
|
14991
|
+
clearVariableSelection(editorRef, newName);
|
|
14992
|
+
setVariableSelection(editorRef, newName);
|
|
14993
|
+
}
|
|
14994
|
+
};
|
|
14958
14995
|
(0, import_react92.useEffect)(() => {
|
|
14959
14996
|
setVariableList(variablesSettings.list);
|
|
14960
14997
|
}, [variablesSettings]);
|
|
@@ -14963,13 +15000,17 @@ function VariablesProvider(props) {
|
|
|
14963
15000
|
const newVariableList = [...variableList, name];
|
|
14964
15001
|
setVariableList(newVariableList);
|
|
14965
15002
|
};
|
|
15003
|
+
const handleOnRenamed = (newName, oldName) => {
|
|
15004
|
+
renameVariable(newName, oldName);
|
|
15005
|
+
variablesSettings.onUpdated(newName, oldName);
|
|
15006
|
+
};
|
|
14966
15007
|
return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
|
|
14967
15008
|
VariablesContext.Provider,
|
|
14968
15009
|
{
|
|
14969
15010
|
value: {
|
|
14970
15011
|
variableList,
|
|
14971
15012
|
onCreated: handleOnCreated,
|
|
14972
|
-
|
|
15013
|
+
onRenamed: handleOnRenamed
|
|
14973
15014
|
},
|
|
14974
15015
|
children
|
|
14975
15016
|
}
|
|
@@ -14986,11 +15027,11 @@ var useVariables = () => {
|
|
|
14986
15027
|
};
|
|
14987
15028
|
|
|
14988
15029
|
// src/utils/getSelectionDOMRangeRect.ts
|
|
14989
|
-
var
|
|
15030
|
+
var import_lexical93 = require("lexical");
|
|
14990
15031
|
function getSelectionDOMRangeRect(editor, leadOffset) {
|
|
14991
15032
|
const editorWindow = editor._window || window;
|
|
14992
15033
|
const range = editorWindow.document.createRange();
|
|
14993
|
-
const domSelection = (0,
|
|
15034
|
+
const domSelection = (0, import_lexical93.getDOMSelection)(editorWindow);
|
|
14994
15035
|
if (domSelection === null || !domSelection.isCollapsed) {
|
|
14995
15036
|
return;
|
|
14996
15037
|
}
|
|
@@ -15011,7 +15052,7 @@ function getSelectionDOMRangeRect(editor, leadOffset) {
|
|
|
15011
15052
|
}
|
|
15012
15053
|
|
|
15013
15054
|
// src/utils/removeTextInDomSelection.ts
|
|
15014
|
-
var
|
|
15055
|
+
var import_lexical94 = require("lexical");
|
|
15015
15056
|
function removeText(editorWindow, leadOffset) {
|
|
15016
15057
|
const domSelection = editorWindow.getSelection();
|
|
15017
15058
|
if (!domSelection || !domSelection.anchorNode) {
|
|
@@ -15036,14 +15077,14 @@ function removeTextInDomSelection(editor, leadOffset, onUpdate) {
|
|
|
15036
15077
|
const editorWindow = editor._window || window;
|
|
15037
15078
|
editor.update(
|
|
15038
15079
|
() => {
|
|
15039
|
-
const selection = (0,
|
|
15080
|
+
const selection = (0, import_lexical94.$getSelection)();
|
|
15040
15081
|
let selectedNode;
|
|
15041
|
-
if ((0,
|
|
15082
|
+
if ((0, import_lexical94.$isRangeSelection)(selection)) {
|
|
15042
15083
|
selectedNode = selection.focus.getNode();
|
|
15043
15084
|
}
|
|
15044
15085
|
removeText(editorWindow, leadOffset);
|
|
15045
15086
|
if (selectedNode) {
|
|
15046
|
-
const selection2 = (0,
|
|
15087
|
+
const selection2 = (0, import_lexical94.$createRangeSelection)();
|
|
15047
15088
|
selection2.anchor.set(
|
|
15048
15089
|
selectedNode.getKey(),
|
|
15049
15090
|
leadOffset,
|
|
@@ -15054,7 +15095,7 @@ function removeTextInDomSelection(editor, leadOffset, onUpdate) {
|
|
|
15054
15095
|
leadOffset,
|
|
15055
15096
|
"text"
|
|
15056
15097
|
);
|
|
15057
|
-
(0,
|
|
15098
|
+
(0, import_lexical94.$setSelection)(selection2);
|
|
15058
15099
|
}
|
|
15059
15100
|
},
|
|
15060
15101
|
{
|
|
@@ -15065,11 +15106,11 @@ function removeTextInDomSelection(editor, leadOffset, onUpdate) {
|
|
|
15065
15106
|
|
|
15066
15107
|
// src/plugins/VariablesPlugin/TypeaheadVariablesPlugin.tsx
|
|
15067
15108
|
var import_LexicalComposerContext63 = require("@lexical/react/LexicalComposerContext");
|
|
15068
|
-
var
|
|
15069
|
-
var
|
|
15109
|
+
var import_utils31 = require("@lexical/utils");
|
|
15110
|
+
var import_lexical95 = require("lexical");
|
|
15070
15111
|
var import_react93 = require("react");
|
|
15071
15112
|
var import_jsx_runtime114 = require("react/jsx-runtime");
|
|
15072
|
-
var CREATE_VARIABLE_FROM_SELECTION_COMMAND = (0,
|
|
15113
|
+
var CREATE_VARIABLE_FROM_SELECTION_COMMAND = (0, import_lexical95.createCommand)("CREATE_VARIABLE_FROM_SELECTION_COMMAND");
|
|
15073
15114
|
function TypeaheadVariablesPlugin() {
|
|
15074
15115
|
const { variableList, onCreated } = useVariables();
|
|
15075
15116
|
const [editor] = (0, import_LexicalComposerContext63.useLexicalComposerContext)();
|
|
@@ -15082,8 +15123,8 @@ function TypeaheadVariablesPlugin() {
|
|
|
15082
15123
|
const textToReplaceTargetRef = (0, import_react93.useRef)();
|
|
15083
15124
|
const handleUpdate = () => {
|
|
15084
15125
|
activeEditorRef.current?.getEditorState().read(() => {
|
|
15085
|
-
const selection = (0,
|
|
15086
|
-
if ((0,
|
|
15126
|
+
const selection = (0, import_lexical95.$getSelection)();
|
|
15127
|
+
if ((0, import_lexical95.$isRangeSelection)(selection)) {
|
|
15087
15128
|
if (selection.isCollapsed()) {
|
|
15088
15129
|
const anchor = selection.anchor;
|
|
15089
15130
|
const isEmpty = anchor.getNode().getTextContent().trim().length === 0;
|
|
@@ -15222,7 +15263,7 @@ function TypeaheadVariablesPlugin() {
|
|
|
15222
15263
|
return false;
|
|
15223
15264
|
};
|
|
15224
15265
|
(0, import_react93.useEffect)(() => {
|
|
15225
|
-
return (0,
|
|
15266
|
+
return (0, import_utils31.mergeRegister)(
|
|
15226
15267
|
editor.registerCommand(
|
|
15227
15268
|
TYPEAHEAD_VARIABLES_COMMAND,
|
|
15228
15269
|
(_payload, activeEditor) => {
|
|
@@ -15230,27 +15271,27 @@ function TypeaheadVariablesPlugin() {
|
|
|
15230
15271
|
handleUpdate();
|
|
15231
15272
|
return true;
|
|
15232
15273
|
},
|
|
15233
|
-
|
|
15274
|
+
import_lexical95.COMMAND_PRIORITY_HIGH
|
|
15234
15275
|
),
|
|
15235
15276
|
editor.registerCommand(
|
|
15236
|
-
|
|
15277
|
+
import_lexical95.KEY_ENTER_COMMAND,
|
|
15237
15278
|
execute,
|
|
15238
|
-
|
|
15279
|
+
import_lexical95.COMMAND_PRIORITY_HIGH
|
|
15239
15280
|
),
|
|
15240
15281
|
editor.registerCommand(
|
|
15241
|
-
|
|
15282
|
+
import_lexical95.KEY_ESCAPE_COMMAND,
|
|
15242
15283
|
hidePopup,
|
|
15243
|
-
|
|
15284
|
+
import_lexical95.COMMAND_PRIORITY_HIGH
|
|
15244
15285
|
),
|
|
15245
15286
|
editor.registerCommand(
|
|
15246
|
-
|
|
15287
|
+
import_lexical95.KEY_ARROW_DOWN_COMMAND,
|
|
15247
15288
|
handleMenuItemSelect("down"),
|
|
15248
|
-
|
|
15289
|
+
import_lexical95.COMMAND_PRIORITY_HIGH
|
|
15249
15290
|
),
|
|
15250
15291
|
editor.registerCommand(
|
|
15251
|
-
|
|
15292
|
+
import_lexical95.KEY_ARROW_UP_COMMAND,
|
|
15252
15293
|
handleMenuItemSelect("up"),
|
|
15253
|
-
|
|
15294
|
+
import_lexical95.COMMAND_PRIORITY_HIGH
|
|
15254
15295
|
),
|
|
15255
15296
|
editor.registerCommand(
|
|
15256
15297
|
CREATE_VARIABLE_FROM_SELECTION_COMMAND,
|
|
@@ -15276,9 +15317,9 @@ function TypeaheadVariablesPlugin() {
|
|
|
15276
15317
|
onUpdate: () => {
|
|
15277
15318
|
if (newNodeKey) {
|
|
15278
15319
|
activeEditor.update(() => {
|
|
15279
|
-
const newSelection = (0,
|
|
15320
|
+
const newSelection = (0, import_lexical95.$createNodeSelection)();
|
|
15280
15321
|
newSelection.add(newNodeKey || "");
|
|
15281
|
-
(0,
|
|
15322
|
+
(0, import_lexical95.$setSelection)(newSelection);
|
|
15282
15323
|
});
|
|
15283
15324
|
}
|
|
15284
15325
|
}
|
|
@@ -15286,10 +15327,10 @@ function TypeaheadVariablesPlugin() {
|
|
|
15286
15327
|
);
|
|
15287
15328
|
return true;
|
|
15288
15329
|
},
|
|
15289
|
-
|
|
15330
|
+
import_lexical95.COMMAND_PRIORITY_HIGH
|
|
15290
15331
|
)
|
|
15291
15332
|
);
|
|
15292
|
-
}, [editor]);
|
|
15333
|
+
}, [editor, variableList]);
|
|
15293
15334
|
const menu = (0, import_react93.useMemo)(() => {
|
|
15294
15335
|
return renderVariablesMenu(
|
|
15295
15336
|
variableList || [],
|
|
@@ -15410,8 +15451,8 @@ var import_LexicalComposerContext64 = require("@lexical/react/LexicalComposerCon
|
|
|
15410
15451
|
var import_rich_text10 = require("@lexical/rich-text");
|
|
15411
15452
|
var import_selection2 = require("@lexical/selection");
|
|
15412
15453
|
var import_table16 = require("@lexical/table");
|
|
15413
|
-
var
|
|
15414
|
-
var
|
|
15454
|
+
var import_utils32 = require("@lexical/utils");
|
|
15455
|
+
var import_lexical96 = require("lexical");
|
|
15415
15456
|
var import_debounce5 = __toESM(require("lodash-es/debounce"));
|
|
15416
15457
|
var import_lucide_react19 = require("lucide-react");
|
|
15417
15458
|
var import_react94 = require("react");
|
|
@@ -15440,8 +15481,8 @@ function TextToolbarPlugin() {
|
|
|
15440
15481
|
const [selectionType, setSelectionType] = (0, import_react94.useState)("paragraph");
|
|
15441
15482
|
const formatText = (format) => {
|
|
15442
15483
|
activeEditorRef.current?.update(() => {
|
|
15443
|
-
const selection = (0,
|
|
15444
|
-
if (!(0,
|
|
15484
|
+
const selection = (0, import_lexical96.$getSelection)();
|
|
15485
|
+
if (!(0, import_lexical96.$isRangeSelection)(selection)) {
|
|
15445
15486
|
return false;
|
|
15446
15487
|
}
|
|
15447
15488
|
selection.formatText(format);
|
|
@@ -15449,15 +15490,15 @@ function TextToolbarPlugin() {
|
|
|
15449
15490
|
};
|
|
15450
15491
|
const formatElement = (format) => {
|
|
15451
15492
|
activeEditorRef.current?.update(() => {
|
|
15452
|
-
const selection = (0,
|
|
15453
|
-
if (!(0,
|
|
15493
|
+
const selection = (0, import_lexical96.$getSelection)();
|
|
15494
|
+
if (!(0, import_lexical96.$isRangeSelection)(selection) && !(0, import_lexical96.$isNodeSelection)(selection)) {
|
|
15454
15495
|
return false;
|
|
15455
15496
|
}
|
|
15456
15497
|
const nodes = selection.getNodes();
|
|
15457
15498
|
for (const node of nodes) {
|
|
15458
|
-
const element = (0,
|
|
15499
|
+
const element = (0, import_utils32.$findMatchingParent)(
|
|
15459
15500
|
node,
|
|
15460
|
-
(parentNode) => (0,
|
|
15501
|
+
(parentNode) => (0, import_lexical96.$isElementNode)(parentNode) && !parentNode.isInline()
|
|
15461
15502
|
);
|
|
15462
15503
|
if (element !== null) {
|
|
15463
15504
|
element.setFormat(format);
|
|
@@ -15468,7 +15509,7 @@ function TextToolbarPlugin() {
|
|
|
15468
15509
|
const formatColor = (newColor) => {
|
|
15469
15510
|
activeEditorRef.current?.update(
|
|
15470
15511
|
() => {
|
|
15471
|
-
const selection = (0,
|
|
15512
|
+
const selection = (0, import_lexical96.$getSelection)();
|
|
15472
15513
|
if (selection !== null) {
|
|
15473
15514
|
(0, import_selection2.$patchStyleText)(selection, {
|
|
15474
15515
|
color: newColor !== "default" ? newColor : null,
|
|
@@ -15491,7 +15532,7 @@ function TextToolbarPlugin() {
|
|
|
15491
15532
|
const formatBackgroundColor = (newColor) => {
|
|
15492
15533
|
activeEditorRef.current?.update(
|
|
15493
15534
|
() => {
|
|
15494
|
-
const selection = (0,
|
|
15535
|
+
const selection = (0, import_lexical96.$getSelection)();
|
|
15495
15536
|
if (selection !== null) {
|
|
15496
15537
|
(0, import_selection2.$patchStyleText)(selection, {
|
|
15497
15538
|
color: null,
|
|
@@ -15514,7 +15555,7 @@ function TextToolbarPlugin() {
|
|
|
15514
15555
|
const clearFormatting = () => {
|
|
15515
15556
|
activeEditorRef.current?.update(
|
|
15516
15557
|
() => {
|
|
15517
|
-
const selection = (0,
|
|
15558
|
+
const selection = (0, import_lexical96.$getSelection)();
|
|
15518
15559
|
if (selection !== null) {
|
|
15519
15560
|
(0, import_selection2.$patchStyleText)(selection, {
|
|
15520
15561
|
"background-color": null,
|
|
@@ -15527,10 +15568,10 @@ function TextToolbarPlugin() {
|
|
|
15527
15568
|
"font-size": null,
|
|
15528
15569
|
"font-weight": null
|
|
15529
15570
|
});
|
|
15530
|
-
if ((0,
|
|
15571
|
+
if ((0, import_lexical96.$isRangeSelection)(selection)) {
|
|
15531
15572
|
const selectedNodes = selection.getNodes();
|
|
15532
15573
|
for (const selectedNode of selectedNodes) {
|
|
15533
|
-
if ((0,
|
|
15574
|
+
if ((0, import_lexical96.$isTextNode)(selectedNode)) {
|
|
15534
15575
|
if (selectedNode.hasFormat("bold") || selectedNode.hasFormat("italic") || selectedNode.hasFormat("underline") || selectedNode.hasFormat("strikethrough") || selectedNode.hasFormat("subscript") || selectedNode.hasFormat("superscript")) {
|
|
15535
15576
|
selectedNode.setFormat(0);
|
|
15536
15577
|
}
|
|
@@ -15538,7 +15579,7 @@ function TextToolbarPlugin() {
|
|
|
15538
15579
|
}
|
|
15539
15580
|
const newSelection = selection.clone();
|
|
15540
15581
|
newSelection.format = 0;
|
|
15541
|
-
(0,
|
|
15582
|
+
(0, import_lexical96.$setSelection)(newSelection);
|
|
15542
15583
|
}
|
|
15543
15584
|
}
|
|
15544
15585
|
},
|
|
@@ -15552,7 +15593,7 @@ function TextToolbarPlugin() {
|
|
|
15552
15593
|
function createLink() {
|
|
15553
15594
|
let currentSelection;
|
|
15554
15595
|
activeEditorRef.current?.getEditorState().read(() => {
|
|
15555
|
-
currentSelection = (0,
|
|
15596
|
+
currentSelection = (0, import_lexical96.$getSelection)()?.clone();
|
|
15556
15597
|
if (currentSelection) {
|
|
15557
15598
|
activeEditorRef.current?.dispatchCommand(
|
|
15558
15599
|
SHOW_LINK_EDITOR_COMMAND,
|
|
@@ -15574,7 +15615,7 @@ function TextToolbarPlugin() {
|
|
|
15574
15615
|
} else if (!activeDecoratorRef.current) {
|
|
15575
15616
|
clearFormatting();
|
|
15576
15617
|
const selectedNode = selectedNodeRef.current;
|
|
15577
|
-
if ((0,
|
|
15618
|
+
if ((0, import_lexical96.$isParagraphNode)(selectedNode)) {
|
|
15578
15619
|
activeEditorRef.current?.getEditorState().read(() => {
|
|
15579
15620
|
const foundParentTableNode = getParentNodeType(
|
|
15580
15621
|
selectedNode,
|
|
@@ -15686,7 +15727,7 @@ function TextToolbarPlugin() {
|
|
|
15686
15727
|
}
|
|
15687
15728
|
};
|
|
15688
15729
|
(0, import_react94.useEffect)(() => {
|
|
15689
|
-
return (0,
|
|
15730
|
+
return (0, import_utils32.mergeRegister)(
|
|
15690
15731
|
editor.registerCommand(
|
|
15691
15732
|
TEXT_TOOLBAR_SELECTION_CHANGE_COMMAND,
|
|
15692
15733
|
(payload, activeEditor) => {
|
|
@@ -15694,18 +15735,18 @@ function TextToolbarPlugin() {
|
|
|
15694
15735
|
activeDecoratorRef.current = payload.decoratorNode;
|
|
15695
15736
|
if (popupToolbarRef.current) {
|
|
15696
15737
|
activeEditor.getEditorState().read(() => {
|
|
15697
|
-
const selection = (0,
|
|
15738
|
+
const selection = (0, import_lexical96.$getSelection)();
|
|
15698
15739
|
if (!selection || selection.isCollapsed()) {
|
|
15699
15740
|
popupToolbarRef.current?.hideToolbar();
|
|
15700
15741
|
return false;
|
|
15701
15742
|
}
|
|
15702
|
-
if (!(0,
|
|
15743
|
+
if (!(0, import_lexical96.$isRangeSelection)(selection)) {
|
|
15703
15744
|
popupToolbarRef.current?.hideToolbar();
|
|
15704
15745
|
return false;
|
|
15705
15746
|
}
|
|
15706
15747
|
const selectedNodes = selection.getNodes();
|
|
15707
15748
|
if (selectedNodes.findIndex(
|
|
15708
|
-
(node) => (0,
|
|
15749
|
+
(node) => (0, import_lexical96.$isDecoratorNode)(node)
|
|
15709
15750
|
) >= 0) {
|
|
15710
15751
|
popupToolbarRef.current?.hideToolbar();
|
|
15711
15752
|
return false;
|
|
@@ -15721,11 +15762,11 @@ function TextToolbarPlugin() {
|
|
|
15721
15762
|
return false;
|
|
15722
15763
|
}
|
|
15723
15764
|
const anchorNode = selection.anchor.getNode();
|
|
15724
|
-
let element = anchorNode.getKey() === "root" ? anchorNode : (0,
|
|
15765
|
+
let element = anchorNode.getKey() === "root" ? anchorNode : (0, import_utils32.$findMatchingParent)(
|
|
15725
15766
|
anchorNode,
|
|
15726
15767
|
(e) => {
|
|
15727
15768
|
const parent = e.getParent();
|
|
15728
|
-
return parent !== null && (0,
|
|
15769
|
+
return parent !== null && (0, import_lexical96.$isRootOrShadowRoot)(parent);
|
|
15729
15770
|
}
|
|
15730
15771
|
);
|
|
15731
15772
|
selectedNodeRef.current = element;
|
|
@@ -15736,7 +15777,7 @@ function TextToolbarPlugin() {
|
|
|
15736
15777
|
setSelectionType("list");
|
|
15737
15778
|
} else {
|
|
15738
15779
|
const type = (0, import_rich_text10.$isHeadingNode)(element) ? element.getTag() : element.getType();
|
|
15739
|
-
if (type ===
|
|
15780
|
+
if (type === import_lexical96.ParagraphNode.getType()) {
|
|
15740
15781
|
setSelectionType("paragraph");
|
|
15741
15782
|
} else {
|
|
15742
15783
|
setSelectionType("headings");
|
|
@@ -15784,7 +15825,7 @@ function TextToolbarPlugin() {
|
|
|
15784
15825
|
"background-color",
|
|
15785
15826
|
""
|
|
15786
15827
|
);
|
|
15787
|
-
if ((0,
|
|
15828
|
+
if ((0, import_lexical96.$isElementNode)(element)) {
|
|
15788
15829
|
newToolbarState.textAlign = element.getFormatType();
|
|
15789
15830
|
} else {
|
|
15790
15831
|
newToolbarState.textAlign = "left";
|
|
@@ -15794,17 +15835,17 @@ function TextToolbarPlugin() {
|
|
|
15794
15835
|
}
|
|
15795
15836
|
return false;
|
|
15796
15837
|
},
|
|
15797
|
-
|
|
15838
|
+
import_lexical96.COMMAND_PRIORITY_HIGH
|
|
15798
15839
|
),
|
|
15799
15840
|
editor.registerCommand(
|
|
15800
|
-
|
|
15841
|
+
import_lexical96.KEY_ESCAPE_COMMAND,
|
|
15801
15842
|
() => {
|
|
15802
15843
|
if (popupToolbarRef.current?.isShown()) {
|
|
15803
15844
|
popupToolbarRef.current?.hideToolbar();
|
|
15804
15845
|
}
|
|
15805
15846
|
return false;
|
|
15806
15847
|
},
|
|
15807
|
-
|
|
15848
|
+
import_lexical96.COMMAND_PRIORITY_NORMAL
|
|
15808
15849
|
),
|
|
15809
15850
|
editor.registerRootListener(
|
|
15810
15851
|
(rootElement, prevRootElement) => {
|
|
@@ -16095,7 +16136,7 @@ function TextToolbarPlugin() {
|
|
|
16095
16136
|
onClick: () => {
|
|
16096
16137
|
clearFormatting();
|
|
16097
16138
|
const selectedNode = selectedNodeRef.current;
|
|
16098
|
-
if ((0,
|
|
16139
|
+
if ((0, import_lexical96.$isParagraphNode)(selectedNode)) {
|
|
16099
16140
|
activeEditorRef.current?.getEditorState().read(() => {
|
|
16100
16141
|
const foundParentTableNode = getParentNodeType(
|
|
16101
16142
|
selectedNode,
|
|
@@ -16208,7 +16249,7 @@ function renderCalloutModuleMenu(popupRef, targetNodeKeyRef, activeEditorRef) {
|
|
|
16208
16249
|
// src/plugins/TypeaheadMenuPlugin/renderDefaultComponentsMenu.tsx
|
|
16209
16250
|
var import_list14 = require("@lexical/list");
|
|
16210
16251
|
var import_rich_text11 = require("@lexical/rich-text");
|
|
16211
|
-
var
|
|
16252
|
+
var import_lexical97 = require("lexical");
|
|
16212
16253
|
var import_lucide_react21 = require("lucide-react");
|
|
16213
16254
|
function renderDefaultComponentsMenu(popupRef, targetNodeKeyRef, activeEditorRef) {
|
|
16214
16255
|
return [
|
|
@@ -16225,7 +16266,7 @@ function renderDefaultComponentsMenu(popupRef, targetNodeKeyRef, activeEditorRef
|
|
|
16225
16266
|
onClick: () => {
|
|
16226
16267
|
activeEditorRef.current?.update(() => {
|
|
16227
16268
|
if (targetNodeKeyRef.current) {
|
|
16228
|
-
const targetNode = (0,
|
|
16269
|
+
const targetNode = (0, import_lexical97.$getNodeByKey)(
|
|
16229
16270
|
targetNodeKeyRef.current
|
|
16230
16271
|
);
|
|
16231
16272
|
if (targetNode) {
|
|
@@ -16246,7 +16287,7 @@ function renderDefaultComponentsMenu(popupRef, targetNodeKeyRef, activeEditorRef
|
|
|
16246
16287
|
onClick: () => {
|
|
16247
16288
|
activeEditorRef.current?.update(() => {
|
|
16248
16289
|
if (targetNodeKeyRef.current) {
|
|
16249
|
-
const targetNode = (0,
|
|
16290
|
+
const targetNode = (0, import_lexical97.$getNodeByKey)(
|
|
16250
16291
|
targetNodeKeyRef.current
|
|
16251
16292
|
);
|
|
16252
16293
|
if (targetNode) {
|
|
@@ -16267,7 +16308,7 @@ function renderDefaultComponentsMenu(popupRef, targetNodeKeyRef, activeEditorRef
|
|
|
16267
16308
|
onClick: () => {
|
|
16268
16309
|
activeEditorRef.current?.update(() => {
|
|
16269
16310
|
if (targetNodeKeyRef.current) {
|
|
16270
|
-
const targetNode = (0,
|
|
16311
|
+
const targetNode = (0, import_lexical97.$getNodeByKey)(
|
|
16271
16312
|
targetNodeKeyRef.current
|
|
16272
16313
|
);
|
|
16273
16314
|
if (targetNode) {
|
|
@@ -16299,11 +16340,11 @@ function renderDefaultComponentsMenu(popupRef, targetNodeKeyRef, activeEditorRef
|
|
|
16299
16340
|
onClick: () => {
|
|
16300
16341
|
activeEditorRef.current?.update(() => {
|
|
16301
16342
|
if (targetNodeKeyRef.current) {
|
|
16302
|
-
const targetNode = (0,
|
|
16343
|
+
const targetNode = (0, import_lexical97.$getNodeByKey)(
|
|
16303
16344
|
targetNodeKeyRef.current
|
|
16304
16345
|
);
|
|
16305
16346
|
if (targetNode) {
|
|
16306
|
-
const newParagraphNode = (0,
|
|
16347
|
+
const newParagraphNode = (0, import_lexical97.$createParagraphNode)();
|
|
16307
16348
|
targetNode.replace(newParagraphNode);
|
|
16308
16349
|
newParagraphNode.select();
|
|
16309
16350
|
activeEditorRef.current?.dispatchCommand(
|
|
@@ -16330,11 +16371,11 @@ function renderDefaultComponentsMenu(popupRef, targetNodeKeyRef, activeEditorRef
|
|
|
16330
16371
|
onClick: () => {
|
|
16331
16372
|
activeEditorRef.current?.update(() => {
|
|
16332
16373
|
if (targetNodeKeyRef.current) {
|
|
16333
|
-
const targetNode = (0,
|
|
16374
|
+
const targetNode = (0, import_lexical97.$getNodeByKey)(
|
|
16334
16375
|
targetNodeKeyRef.current
|
|
16335
16376
|
);
|
|
16336
16377
|
if (targetNode) {
|
|
16337
|
-
const newParagraphNode = (0,
|
|
16378
|
+
const newParagraphNode = (0, import_lexical97.$createParagraphNode)();
|
|
16338
16379
|
targetNode.replace(newParagraphNode);
|
|
16339
16380
|
newParagraphNode.select();
|
|
16340
16381
|
activeEditorRef.current?.dispatchCommand(
|
|
@@ -16361,13 +16402,13 @@ function renderDefaultComponentsMenu(popupRef, targetNodeKeyRef, activeEditorRef
|
|
|
16361
16402
|
onClick: () => {
|
|
16362
16403
|
activeEditorRef.current?.update(() => {
|
|
16363
16404
|
if (targetNodeKeyRef.current) {
|
|
16364
|
-
const targetNode = (0,
|
|
16405
|
+
const targetNode = (0, import_lexical97.$getNodeByKey)(
|
|
16365
16406
|
targetNodeKeyRef.current
|
|
16366
16407
|
);
|
|
16367
16408
|
if (targetNode) {
|
|
16368
16409
|
const newNode = $createHorizontalRuleNode();
|
|
16369
16410
|
targetNode.replace(newNode);
|
|
16370
|
-
const newParagraphNode = (0,
|
|
16411
|
+
const newParagraphNode = (0, import_lexical97.$createParagraphNode)();
|
|
16371
16412
|
newNode.insertAfter(newParagraphNode);
|
|
16372
16413
|
newParagraphNode.selectStart();
|
|
16373
16414
|
}
|
|
@@ -16405,7 +16446,7 @@ function renderImageModuleMenu(popupRef, targetNodeKeyRef, activeEditorRef) {
|
|
|
16405
16446
|
|
|
16406
16447
|
// src/plugins/FinancialStatementQuestionPlugin/FinancialStatementQuestionSettings.tsx
|
|
16407
16448
|
var import_LexicalComposerContext65 = require("@lexical/react/LexicalComposerContext");
|
|
16408
|
-
var
|
|
16449
|
+
var import_lexical98 = require("lexical");
|
|
16409
16450
|
var import_react95 = require("react");
|
|
16410
16451
|
|
|
16411
16452
|
// src/plugins/FinancialStatementQuestionPlugin/validatePointslnput.ts
|
|
@@ -16437,7 +16478,7 @@ function FinancialStatementQuestionSettings(props) {
|
|
|
16437
16478
|
(0, import_react95.useEffect)(() => {
|
|
16438
16479
|
if (nodeKey) {
|
|
16439
16480
|
editor.getEditorState().read(() => {
|
|
16440
|
-
const fillInTheBlankNode = (0,
|
|
16481
|
+
const fillInTheBlankNode = (0, import_lexical98.$getNodeByKey)(nodeKey);
|
|
16441
16482
|
if (fillInTheBlankNode && $isFinancialStatementQuestionNode(fillInTheBlankNode)) {
|
|
16442
16483
|
setFoundNode(fillInTheBlankNode);
|
|
16443
16484
|
}
|
|
@@ -16460,7 +16501,7 @@ function FinancialStatementQuestionSettings(props) {
|
|
|
16460
16501
|
label: "Points",
|
|
16461
16502
|
onChange: (value) => {
|
|
16462
16503
|
editor.update(() => {
|
|
16463
|
-
const targetNode = (0,
|
|
16504
|
+
const targetNode = (0, import_lexical98.$getNodeByKey)(nodeKey);
|
|
16464
16505
|
if (targetNode && $isFinancialStatementQuestionNode(targetNode)) {
|
|
16465
16506
|
try {
|
|
16466
16507
|
validatePointsInput6(value);
|
|
@@ -16478,11 +16519,11 @@ function FinancialStatementQuestionSettings(props) {
|
|
|
16478
16519
|
|
|
16479
16520
|
// src/plugins/FinancialStatementQuestionPlugin/FinancialStatementQuestionPlugin.tsx
|
|
16480
16521
|
var import_LexicalComposerContext66 = require("@lexical/react/LexicalComposerContext");
|
|
16481
|
-
var
|
|
16482
|
-
var
|
|
16522
|
+
var import_utils33 = require("@lexical/utils");
|
|
16523
|
+
var import_lexical99 = require("lexical");
|
|
16483
16524
|
var import_react96 = require("react");
|
|
16484
16525
|
var import_jsx_runtime117 = require("react/jsx-runtime");
|
|
16485
|
-
var INSERT_FINANCIAL_STATEMENT_QUESTION_COMMAND = (0,
|
|
16526
|
+
var INSERT_FINANCIAL_STATEMENT_QUESTION_COMMAND = (0, import_lexical99.createCommand)("INSERT_FINANCIAL_STATEMENT_QUESTION_COMMAND");
|
|
16486
16527
|
function FinancialStatementQuestionPlugin() {
|
|
16487
16528
|
const {
|
|
16488
16529
|
registerSettingsPanel,
|
|
@@ -16493,7 +16534,7 @@ function FinancialStatementQuestionPlugin() {
|
|
|
16493
16534
|
const [editor] = (0, import_LexicalComposerContext66.useLexicalComposerContext)();
|
|
16494
16535
|
const settingsPanelStickyRef = (0, import_react96.useRef)(null);
|
|
16495
16536
|
(0, import_react96.useEffect)(() => {
|
|
16496
|
-
return (0,
|
|
16537
|
+
return (0, import_utils33.mergeRegister)(
|
|
16497
16538
|
editor.registerCommand(
|
|
16498
16539
|
INSERT_FINANCIAL_STATEMENT_QUESTION_COMMAND,
|
|
16499
16540
|
(payload, activeEditor) => {
|
|
@@ -16501,12 +16542,12 @@ function FinancialStatementQuestionPlugin() {
|
|
|
16501
16542
|
const { nodeKey, insertionMode } = payload;
|
|
16502
16543
|
if (activeEditor === editor && nodeKey) {
|
|
16503
16544
|
activeEditor.update(() => {
|
|
16504
|
-
const targetNode = (0,
|
|
16545
|
+
const targetNode = (0, import_lexical99.$getNodeByKey)(nodeKey);
|
|
16505
16546
|
if (targetNode) {
|
|
16506
|
-
const headerEditor = (0,
|
|
16547
|
+
const headerEditor = (0, import_lexical99.createEditor)();
|
|
16507
16548
|
headerEditor.update(() => {
|
|
16508
|
-
const root = (0,
|
|
16509
|
-
const paragraph = (0,
|
|
16549
|
+
const root = (0, import_lexical99.$getRoot)();
|
|
16550
|
+
const paragraph = (0, import_lexical99.$createParagraphNode)();
|
|
16510
16551
|
root.append(paragraph);
|
|
16511
16552
|
});
|
|
16512
16553
|
const financialStatementNode = $createFinancialStatementQuestionNode(
|
|
@@ -16523,16 +16564,16 @@ function FinancialStatementQuestionPlugin() {
|
|
|
16523
16564
|
} else if (insertionMode === "before") {
|
|
16524
16565
|
targetNode.insertBefore(financialStatementNode);
|
|
16525
16566
|
}
|
|
16526
|
-
const selection = (0,
|
|
16567
|
+
const selection = (0, import_lexical99.$createNodeSelection)();
|
|
16527
16568
|
selection.add(financialStatementNode.getKey());
|
|
16528
|
-
(0,
|
|
16569
|
+
(0, import_lexical99.$setSelection)(selection);
|
|
16529
16570
|
}
|
|
16530
16571
|
});
|
|
16531
16572
|
}
|
|
16532
16573
|
}
|
|
16533
16574
|
return true;
|
|
16534
16575
|
},
|
|
16535
|
-
|
|
16576
|
+
import_lexical99.COMMAND_PRIORITY_EDITOR
|
|
16536
16577
|
)
|
|
16537
16578
|
);
|
|
16538
16579
|
}, [editor]);
|
|
@@ -16802,13 +16843,13 @@ function useTypeaheadTriggerMatch2(trigger, {
|
|
|
16802
16843
|
var import_LexicalComposerContext67 = require("@lexical/react/LexicalComposerContext");
|
|
16803
16844
|
var import_rich_text12 = require("@lexical/rich-text");
|
|
16804
16845
|
var import_table17 = require("@lexical/table");
|
|
16805
|
-
var
|
|
16806
|
-
var
|
|
16846
|
+
var import_utils34 = require("@lexical/utils");
|
|
16847
|
+
var import_lexical101 = require("lexical");
|
|
16807
16848
|
var import_react98 = require("react");
|
|
16808
16849
|
|
|
16809
16850
|
// src/plugins/TypeaheadMenuPlugin/renderFillInTheBlankMenu.tsx
|
|
16810
16851
|
var import_list15 = require("@lexical/list");
|
|
16811
|
-
var
|
|
16852
|
+
var import_lexical100 = require("lexical");
|
|
16812
16853
|
var import_lucide_react25 = require("lucide-react");
|
|
16813
16854
|
function renderFillInTheBlankMenu(popupRef, targetNodeKeyRef, activeEditorRef) {
|
|
16814
16855
|
return [
|
|
@@ -16831,11 +16872,11 @@ function renderFillInTheBlankMenu(popupRef, targetNodeKeyRef, activeEditorRef) {
|
|
|
16831
16872
|
onClick: () => {
|
|
16832
16873
|
activeEditorRef.current?.update(() => {
|
|
16833
16874
|
if (targetNodeKeyRef.current) {
|
|
16834
|
-
const targetNode = (0,
|
|
16875
|
+
const targetNode = (0, import_lexical100.$getNodeByKey)(
|
|
16835
16876
|
targetNodeKeyRef.current
|
|
16836
16877
|
);
|
|
16837
16878
|
if (targetNode) {
|
|
16838
|
-
const newParagraphNode = (0,
|
|
16879
|
+
const newParagraphNode = (0, import_lexical100.$createParagraphNode)();
|
|
16839
16880
|
targetNode.replace(newParagraphNode);
|
|
16840
16881
|
newParagraphNode.select();
|
|
16841
16882
|
activeEditorRef.current?.dispatchCommand(
|
|
@@ -16862,11 +16903,11 @@ function renderFillInTheBlankMenu(popupRef, targetNodeKeyRef, activeEditorRef) {
|
|
|
16862
16903
|
onClick: () => {
|
|
16863
16904
|
activeEditorRef.current?.update(() => {
|
|
16864
16905
|
if (targetNodeKeyRef.current) {
|
|
16865
|
-
const targetNode = (0,
|
|
16906
|
+
const targetNode = (0, import_lexical100.$getNodeByKey)(
|
|
16866
16907
|
targetNodeKeyRef.current
|
|
16867
16908
|
);
|
|
16868
16909
|
if (targetNode) {
|
|
16869
|
-
const newParagraphNode = (0,
|
|
16910
|
+
const newParagraphNode = (0, import_lexical100.$createParagraphNode)();
|
|
16870
16911
|
targetNode.replace(newParagraphNode);
|
|
16871
16912
|
newParagraphNode.select();
|
|
16872
16913
|
activeEditorRef.current?.dispatchCommand(
|
|
@@ -16926,8 +16967,8 @@ function TypeaheadMenuPlugin() {
|
|
|
16926
16967
|
const [activeDecorator, setActiveDecorator] = (0, import_react98.useState)();
|
|
16927
16968
|
const handleUpdate = () => {
|
|
16928
16969
|
activeEditorRef.current?.getEditorState().read(() => {
|
|
16929
|
-
const selection = (0,
|
|
16930
|
-
if ((0,
|
|
16970
|
+
const selection = (0, import_lexical101.$getSelection)();
|
|
16971
|
+
if ((0, import_lexical101.$isRangeSelection)(selection)) {
|
|
16931
16972
|
if (selection.isCollapsed()) {
|
|
16932
16973
|
const node = selection.focus.getNode();
|
|
16933
16974
|
const nodeKey = node.getKey();
|
|
@@ -16951,7 +16992,7 @@ function TypeaheadMenuPlugin() {
|
|
|
16951
16992
|
"data-placeholder",
|
|
16952
16993
|
`Heading ${level}`
|
|
16953
16994
|
);
|
|
16954
|
-
} else if ((0,
|
|
16995
|
+
} else if ((0, import_lexical101.$isParagraphNode)(node)) {
|
|
16955
16996
|
if (node.getChildrenSize() === 0) {
|
|
16956
16997
|
dom.setAttribute(
|
|
16957
16998
|
"data-placeholder",
|
|
@@ -16969,7 +17010,7 @@ function TypeaheadMenuPlugin() {
|
|
|
16969
17010
|
const text = anchorNode.getTextContent().slice(0, anchorOffset);
|
|
16970
17011
|
if (text) {
|
|
16971
17012
|
if (text.startsWith("/")) {
|
|
16972
|
-
if ((0,
|
|
17013
|
+
if ((0, import_lexical101.$isParagraphNode)(parentNode)) {
|
|
16973
17014
|
const tableCellNode = parentNode.getParent();
|
|
16974
17015
|
if (!(0, import_table17.$isTableCellNode)(tableCellNode)) {
|
|
16975
17016
|
const match = triggerFn(text, editor);
|
|
@@ -17039,7 +17080,7 @@ function TypeaheadMenuPlugin() {
|
|
|
17039
17080
|
return false;
|
|
17040
17081
|
};
|
|
17041
17082
|
(0, import_react98.useEffect)(() => {
|
|
17042
|
-
return (0,
|
|
17083
|
+
return (0, import_utils34.mergeRegister)(
|
|
17043
17084
|
editor.registerCommand(
|
|
17044
17085
|
TYPEAHEAD_MENU_COMMAND,
|
|
17045
17086
|
(payload, activeEditor) => {
|
|
@@ -17048,24 +17089,24 @@ function TypeaheadMenuPlugin() {
|
|
|
17048
17089
|
handleUpdate();
|
|
17049
17090
|
return true;
|
|
17050
17091
|
},
|
|
17051
|
-
|
|
17092
|
+
import_lexical101.COMMAND_PRIORITY_HIGH
|
|
17052
17093
|
),
|
|
17053
17094
|
editor.registerCommand(
|
|
17054
|
-
|
|
17095
|
+
import_lexical101.KEY_ENTER_COMMAND,
|
|
17055
17096
|
execute,
|
|
17056
|
-
|
|
17097
|
+
import_lexical101.COMMAND_PRIORITY_HIGH
|
|
17057
17098
|
),
|
|
17058
17099
|
editor.registerCommand(
|
|
17059
|
-
|
|
17100
|
+
import_lexical101.KEY_ESCAPE_COMMAND,
|
|
17060
17101
|
() => {
|
|
17061
17102
|
hidePopup();
|
|
17062
17103
|
editor.update(() => {
|
|
17063
17104
|
if (targetNodeKeyRef.current) {
|
|
17064
|
-
const foundNode = (0,
|
|
17105
|
+
const foundNode = (0, import_lexical101.$getNodeByKey)(
|
|
17065
17106
|
targetNodeKeyRef.current
|
|
17066
17107
|
);
|
|
17067
|
-
if ((0,
|
|
17068
|
-
const newParagraph = (0,
|
|
17108
|
+
if ((0, import_lexical101.$isParagraphNode)(foundNode)) {
|
|
17109
|
+
const newParagraph = (0, import_lexical101.$createParagraphNode)();
|
|
17069
17110
|
foundNode.replace(newParagraph);
|
|
17070
17111
|
newParagraph.selectEnd();
|
|
17071
17112
|
}
|
|
@@ -17073,20 +17114,20 @@ function TypeaheadMenuPlugin() {
|
|
|
17073
17114
|
});
|
|
17074
17115
|
return false;
|
|
17075
17116
|
},
|
|
17076
|
-
|
|
17117
|
+
import_lexical101.COMMAND_PRIORITY_HIGH
|
|
17077
17118
|
),
|
|
17078
17119
|
editor.registerCommand(
|
|
17079
|
-
|
|
17120
|
+
import_lexical101.KEY_ARROW_DOWN_COMMAND,
|
|
17080
17121
|
handleMenuItemSelect("down"),
|
|
17081
|
-
|
|
17122
|
+
import_lexical101.COMMAND_PRIORITY_HIGH
|
|
17082
17123
|
),
|
|
17083
17124
|
editor.registerCommand(
|
|
17084
|
-
|
|
17125
|
+
import_lexical101.KEY_ARROW_UP_COMMAND,
|
|
17085
17126
|
handleMenuItemSelect("up"),
|
|
17086
|
-
|
|
17127
|
+
import_lexical101.COMMAND_PRIORITY_HIGH
|
|
17087
17128
|
),
|
|
17088
17129
|
editor.registerCommand(
|
|
17089
|
-
|
|
17130
|
+
import_lexical101.BLUR_COMMAND,
|
|
17090
17131
|
(_payload, activeEditor) => {
|
|
17091
17132
|
activeEditor.getEditorState().read(() => {
|
|
17092
17133
|
const allPlaceholders = activeEditor.getRootElement()?.querySelectorAll("[data-placeholder]");
|
|
@@ -17097,14 +17138,14 @@ function TypeaheadMenuPlugin() {
|
|
|
17097
17138
|
);
|
|
17098
17139
|
});
|
|
17099
17140
|
}
|
|
17100
|
-
const rootNode = (0,
|
|
17141
|
+
const rootNode = (0, import_lexical101.$getRoot)();
|
|
17101
17142
|
if (rootNode) {
|
|
17102
17143
|
const childrenKeys = rootNode.getChildrenKeys();
|
|
17103
17144
|
if (childrenKeys.length > 0) {
|
|
17104
17145
|
const children = rootNode.getChildren();
|
|
17105
17146
|
let emptyCounter = 0;
|
|
17106
17147
|
for (const childNode of children) {
|
|
17107
|
-
if ((0,
|
|
17148
|
+
if ((0, import_lexical101.$isParagraphNode)(childNode) && childNode.getTextContent().trim() === "") {
|
|
17108
17149
|
emptyCounter++;
|
|
17109
17150
|
}
|
|
17110
17151
|
}
|
|
@@ -17124,7 +17165,7 @@ function TypeaheadMenuPlugin() {
|
|
|
17124
17165
|
});
|
|
17125
17166
|
return false;
|
|
17126
17167
|
},
|
|
17127
|
-
|
|
17168
|
+
import_lexical101.COMMAND_PRIORITY_HIGH
|
|
17128
17169
|
)
|
|
17129
17170
|
);
|
|
17130
17171
|
}, [editor]);
|
|
@@ -17416,6 +17457,15 @@ function BlockEditor(props) {
|
|
|
17416
17457
|
getNestedEditor: (nestedEditorId) => {
|
|
17417
17458
|
return nestedEditorsRef.current[nestedEditorId];
|
|
17418
17459
|
},
|
|
17460
|
+
getAllNestedEditors: () => {
|
|
17461
|
+
const nestedEditors = [];
|
|
17462
|
+
for (const [_, value] of Object.entries(
|
|
17463
|
+
nestedEditorsRef.current
|
|
17464
|
+
)) {
|
|
17465
|
+
nestedEditors.push(value);
|
|
17466
|
+
}
|
|
17467
|
+
return nestedEditors;
|
|
17468
|
+
},
|
|
17419
17469
|
unregisterNestedEditor: (nestedEditorId) => {
|
|
17420
17470
|
delete nestedEditorsRef.current[nestedEditorId];
|
|
17421
17471
|
},
|
|
@@ -17573,8 +17623,8 @@ function Image(props) {
|
|
|
17573
17623
|
// src/plugins/LinkToolbarPlugin/LinkToolbarPlugin.tsx
|
|
17574
17624
|
var import_link4 = require("@lexical/link");
|
|
17575
17625
|
var import_LexicalComposerContext69 = require("@lexical/react/LexicalComposerContext");
|
|
17576
|
-
var
|
|
17577
|
-
var
|
|
17626
|
+
var import_utils35 = require("@lexical/utils");
|
|
17627
|
+
var import_lexical102 = require("lexical");
|
|
17578
17628
|
var import_debounce6 = __toESM(require("lodash-es/debounce"));
|
|
17579
17629
|
var import_lucide_react26 = require("lucide-react");
|
|
17580
17630
|
var import_react104 = require("react");
|
|
@@ -17605,9 +17655,9 @@ function LinkToolbarPlugin() {
|
|
|
17605
17655
|
[editor]
|
|
17606
17656
|
);
|
|
17607
17657
|
(0, import_react104.useEffect)(() => {
|
|
17608
|
-
return (0,
|
|
17658
|
+
return (0, import_utils35.mergeRegister)(
|
|
17609
17659
|
editor.registerCommand(
|
|
17610
|
-
|
|
17660
|
+
import_lexical102.CLICK_COMMAND,
|
|
17611
17661
|
(event, activeEditor) => {
|
|
17612
17662
|
if (popupToolbarRef.current) {
|
|
17613
17663
|
activeEditorRef.current = activeEditor;
|
|
@@ -17616,8 +17666,8 @@ function LinkToolbarPlugin() {
|
|
|
17616
17666
|
popupToolbarRef.current?.hideToolbar();
|
|
17617
17667
|
return;
|
|
17618
17668
|
}
|
|
17619
|
-
const selection = (0,
|
|
17620
|
-
if (!(0,
|
|
17669
|
+
const selection = (0, import_lexical102.$getSelection)();
|
|
17670
|
+
if (!(0, import_lexical102.$isRangeSelection)(selection)) {
|
|
17621
17671
|
popupToolbarRef.current?.hideToolbar();
|
|
17622
17672
|
return;
|
|
17623
17673
|
}
|
|
@@ -17636,7 +17686,7 @@ function LinkToolbarPlugin() {
|
|
|
17636
17686
|
return;
|
|
17637
17687
|
}
|
|
17638
17688
|
const selectionNode = selection.anchor.getNode();
|
|
17639
|
-
if ((0,
|
|
17689
|
+
if ((0, import_lexical102.$isTextNode)(selectionNode)) {
|
|
17640
17690
|
linkTextNodeRef.current = selectionNode;
|
|
17641
17691
|
linkTextNodeOffsetRef.current = selection.focus.offset;
|
|
17642
17692
|
}
|
|
@@ -17666,15 +17716,15 @@ function LinkToolbarPlugin() {
|
|
|
17666
17716
|
}
|
|
17667
17717
|
return false;
|
|
17668
17718
|
},
|
|
17669
|
-
|
|
17719
|
+
import_lexical102.COMMAND_PRIORITY_LOW
|
|
17670
17720
|
),
|
|
17671
17721
|
editor.registerCommand(
|
|
17672
|
-
|
|
17722
|
+
import_lexical102.KEY_ESCAPE_COMMAND,
|
|
17673
17723
|
() => {
|
|
17674
17724
|
handleClose();
|
|
17675
17725
|
return false;
|
|
17676
17726
|
},
|
|
17677
|
-
|
|
17727
|
+
import_lexical102.COMMAND_PRIORITY_HIGH
|
|
17678
17728
|
)
|
|
17679
17729
|
);
|
|
17680
17730
|
}, [editor]);
|
|
@@ -17733,7 +17783,7 @@ function LinkToolbarPlugin() {
|
|
|
17733
17783
|
if (activeEditorRef.current) {
|
|
17734
17784
|
activeEditorRef.current.update(() => {
|
|
17735
17785
|
if (linkTextNodeRef.current) {
|
|
17736
|
-
const newSelection = (0,
|
|
17786
|
+
const newSelection = (0, import_lexical102.$createRangeSelection)();
|
|
17737
17787
|
newSelection.anchor.set(
|
|
17738
17788
|
linkTextNodeRef.current.getKey(),
|
|
17739
17789
|
linkTextNodeOffsetRef.current || 0,
|
|
@@ -17778,7 +17828,7 @@ function LinkToolbarPlugin() {
|
|
|
17778
17828
|
if (activeEditorRef.current) {
|
|
17779
17829
|
activeEditorRef.current.update(() => {
|
|
17780
17830
|
if (linkTextNodeRef.current) {
|
|
17781
|
-
const newSelection = (0,
|
|
17831
|
+
const newSelection = (0, import_lexical102.$createRangeSelection)();
|
|
17782
17832
|
newSelection.anchor.set(
|
|
17783
17833
|
linkTextNodeRef.current.getKey(),
|
|
17784
17834
|
linkTextNodeOffsetRef.current || 0,
|
|
@@ -17791,7 +17841,7 @@ function LinkToolbarPlugin() {
|
|
|
17791
17841
|
);
|
|
17792
17842
|
if (newSelection) {
|
|
17793
17843
|
popupToolbarRef.current?.hideToolbar();
|
|
17794
|
-
(0,
|
|
17844
|
+
(0, import_lexical102.$setSelection)(newSelection);
|
|
17795
17845
|
(0, import_link4.$toggleLink)(null);
|
|
17796
17846
|
}
|
|
17797
17847
|
}
|
|
@@ -17884,7 +17934,7 @@ var import_react109 = require("react");
|
|
|
17884
17934
|
|
|
17885
17935
|
// src/plugins/VariablesPlugin/VariableSettings.tsx
|
|
17886
17936
|
var import_LexicalComposerContext70 = require("@lexical/react/LexicalComposerContext");
|
|
17887
|
-
var
|
|
17937
|
+
var import_lexical103 = require("lexical");
|
|
17888
17938
|
var import_lucide_react27 = require("lucide-react");
|
|
17889
17939
|
var import_react108 = require("react");
|
|
17890
17940
|
var import_jsx_runtime129 = require("react/jsx-runtime");
|
|
@@ -17918,7 +17968,7 @@ function VariableSettings(props) {
|
|
|
17918
17968
|
setEditingMode,
|
|
17919
17969
|
getEditingModeDataCallback
|
|
17920
17970
|
} = useBlockEditor();
|
|
17921
|
-
const { variableList,
|
|
17971
|
+
const { variableList, onRenamed } = useVariables();
|
|
17922
17972
|
const [editor] = (0, import_LexicalComposerContext70.useLexicalComposerContext)();
|
|
17923
17973
|
const activeEditorRef = (0, import_react108.useRef)();
|
|
17924
17974
|
const [currentVariableNode, setCurrentVariableNode] = (0, import_react108.useState)();
|
|
@@ -17929,7 +17979,7 @@ function VariableSettings(props) {
|
|
|
17929
17979
|
activeEditorRef.current = nestedEditorId ? getNestedEditor(nestedEditorId) || editor : editor;
|
|
17930
17980
|
if (activeEditorRef.current) {
|
|
17931
17981
|
activeEditorRef.current.getEditorState().read(() => {
|
|
17932
|
-
const foundNode = (0,
|
|
17982
|
+
const foundNode = (0, import_lexical103.$getNodeByKey)(nodeKey);
|
|
17933
17983
|
if ($isVariableNode(foundNode)) {
|
|
17934
17984
|
setCurrentVariableNode(foundNode);
|
|
17935
17985
|
}
|
|
@@ -17945,7 +17995,7 @@ function VariableSettings(props) {
|
|
|
17945
17995
|
onClick: () => {
|
|
17946
17996
|
activeEditorRef.current?.update(
|
|
17947
17997
|
() => {
|
|
17948
|
-
const foundVariableNode = (0,
|
|
17998
|
+
const foundVariableNode = (0, import_lexical103.$getNodeByKey)(nodeKey);
|
|
17949
17999
|
if ($isVariableNode(foundVariableNode)) {
|
|
17950
18000
|
foundVariableNode.setVariable(variableItem);
|
|
17951
18001
|
}
|
|
@@ -17954,7 +18004,7 @@ function VariableSettings(props) {
|
|
|
17954
18004
|
onUpdate: () => {
|
|
17955
18005
|
setEditingMode({ mode: "edit" });
|
|
17956
18006
|
activeEditorRef.current?.update(() => {
|
|
17957
|
-
const foundVariableNode = (0,
|
|
18007
|
+
const foundVariableNode = (0, import_lexical103.$getNodeByKey)(nodeKey);
|
|
17958
18008
|
if ($isVariableNode(foundVariableNode)) {
|
|
17959
18009
|
const rootEditor = getEditor();
|
|
17960
18010
|
const variableName = foundVariableNode.getVariable();
|
|
@@ -17990,7 +18040,7 @@ function VariableSettings(props) {
|
|
|
17990
18040
|
onClick: () => {
|
|
17991
18041
|
activeEditorRef.current?.update(
|
|
17992
18042
|
() => {
|
|
17993
|
-
const foundVariableNode = (0,
|
|
18043
|
+
const foundVariableNode = (0, import_lexical103.$getNodeByKey)(nodeKey);
|
|
17994
18044
|
if (!$isVariableNode(foundVariableNode)) return;
|
|
17995
18045
|
if (typeItem === "number" && !foundVariableNode.getVariableFormat()) {
|
|
17996
18046
|
foundVariableNode.setVariableFormat(
|
|
@@ -18003,7 +18053,7 @@ function VariableSettings(props) {
|
|
|
18003
18053
|
{
|
|
18004
18054
|
onUpdate: () => {
|
|
18005
18055
|
activeEditorRef.current?.getEditorState().read(() => {
|
|
18006
|
-
const foundVariableNode = (0,
|
|
18056
|
+
const foundVariableNode = (0, import_lexical103.$getNodeByKey)(nodeKey);
|
|
18007
18057
|
if ($isVariableNode(foundVariableNode)) {
|
|
18008
18058
|
setCurrentVariableNode(foundVariableNode);
|
|
18009
18059
|
}
|
|
@@ -18024,7 +18074,7 @@ function VariableSettings(props) {
|
|
|
18024
18074
|
onClick: () => {
|
|
18025
18075
|
activeEditorRef.current?.update(
|
|
18026
18076
|
() => {
|
|
18027
|
-
const foundVariableNode = (0,
|
|
18077
|
+
const foundVariableNode = (0, import_lexical103.$getNodeByKey)(nodeKey);
|
|
18028
18078
|
if ($isVariableNode(foundVariableNode)) {
|
|
18029
18079
|
foundVariableNode.setVariableFormat(formatItem);
|
|
18030
18080
|
}
|
|
@@ -18032,7 +18082,7 @@ function VariableSettings(props) {
|
|
|
18032
18082
|
{
|
|
18033
18083
|
onUpdate: () => {
|
|
18034
18084
|
activeEditorRef.current?.getEditorState().read(() => {
|
|
18035
|
-
const foundVariableNode = (0,
|
|
18085
|
+
const foundVariableNode = (0, import_lexical103.$getNodeByKey)(nodeKey);
|
|
18036
18086
|
if ($isVariableNode(foundVariableNode)) {
|
|
18037
18087
|
setCurrentVariableNode(foundVariableNode);
|
|
18038
18088
|
}
|
|
@@ -18050,35 +18100,56 @@ function VariableSettings(props) {
|
|
|
18050
18100
|
const foundVariable = variableList.find(
|
|
18051
18101
|
(v) => v === variableNameInputRef.current?.getValue()
|
|
18052
18102
|
);
|
|
18103
|
+
let prevVariableName = void 0;
|
|
18053
18104
|
activeEditorRef.current?.update(
|
|
18054
18105
|
() => {
|
|
18055
|
-
const foundVariableNode = (0,
|
|
18106
|
+
const foundVariableNode = (0, import_lexical103.$getNodeByKey)(nodeKey);
|
|
18056
18107
|
if ($isVariableNode(foundVariableNode)) {
|
|
18108
|
+
prevVariableName = foundVariableNode.getVariable();
|
|
18057
18109
|
foundVariableNode.setVariable(newVariableName);
|
|
18058
18110
|
}
|
|
18059
18111
|
},
|
|
18060
18112
|
{
|
|
18061
18113
|
onUpdate: () => {
|
|
18062
|
-
if (!foundVariable) {
|
|
18063
|
-
|
|
18114
|
+
if (!foundVariable && prevVariableName) {
|
|
18115
|
+
onRenamed(newVariableName.toString(), prevVariableName);
|
|
18116
|
+
setTimeout(() => {
|
|
18117
|
+
activeEditorRef.current?.getEditorState().read(() => {
|
|
18118
|
+
setEditingMode({ mode: "edit" });
|
|
18119
|
+
const foundVariableNode = (0, import_lexical103.$getNodeByKey)(nodeKey);
|
|
18120
|
+
if ($isVariableNode(foundVariableNode)) {
|
|
18121
|
+
const rootEditor = getEditor();
|
|
18122
|
+
clearVariableSelection(
|
|
18123
|
+
rootEditor || editor,
|
|
18124
|
+
newVariableName
|
|
18125
|
+
);
|
|
18126
|
+
setVariableSelection(
|
|
18127
|
+
rootEditor || editor,
|
|
18128
|
+
newVariableName
|
|
18129
|
+
);
|
|
18130
|
+
setCurrentVariableNode(foundVariableNode);
|
|
18131
|
+
}
|
|
18132
|
+
});
|
|
18133
|
+
}, 300);
|
|
18134
|
+
} else {
|
|
18135
|
+
activeEditorRef.current?.getEditorState().read(() => {
|
|
18136
|
+
setEditingMode({ mode: "edit" });
|
|
18137
|
+
const foundVariableNode = (0, import_lexical103.$getNodeByKey)(nodeKey);
|
|
18138
|
+
if ($isVariableNode(foundVariableNode)) {
|
|
18139
|
+
const rootEditor = getEditor();
|
|
18140
|
+
const variableName = foundVariableNode.getVariable();
|
|
18141
|
+
clearVariableSelection(
|
|
18142
|
+
rootEditor || editor,
|
|
18143
|
+
variableName
|
|
18144
|
+
);
|
|
18145
|
+
setVariableSelection(
|
|
18146
|
+
rootEditor || editor,
|
|
18147
|
+
variableName
|
|
18148
|
+
);
|
|
18149
|
+
setCurrentVariableNode(foundVariableNode);
|
|
18150
|
+
}
|
|
18151
|
+
});
|
|
18064
18152
|
}
|
|
18065
|
-
activeEditorRef.current?.getEditorState().read(() => {
|
|
18066
|
-
setEditingMode({ mode: "edit" });
|
|
18067
|
-
const foundVariableNode = (0, import_lexical101.$getNodeByKey)(nodeKey);
|
|
18068
|
-
if ($isVariableNode(foundVariableNode)) {
|
|
18069
|
-
const rootEditor = getEditor();
|
|
18070
|
-
const variableName = foundVariableNode.getVariable();
|
|
18071
|
-
clearVariableSelection(
|
|
18072
|
-
rootEditor || editor,
|
|
18073
|
-
variableName
|
|
18074
|
-
);
|
|
18075
|
-
setVariableSelection(
|
|
18076
|
-
rootEditor || editor,
|
|
18077
|
-
variableName
|
|
18078
|
-
);
|
|
18079
|
-
setCurrentVariableNode(foundVariableNode);
|
|
18080
|
-
}
|
|
18081
|
-
});
|
|
18082
18153
|
setSettingsEditingMode(false);
|
|
18083
18154
|
}
|
|
18084
18155
|
}
|
|
@@ -18209,9 +18280,9 @@ function VariableSettings(props) {
|
|
|
18209
18280
|
let parentNodeKey;
|
|
18210
18281
|
activeEditorRef.current?.update(
|
|
18211
18282
|
() => {
|
|
18212
|
-
const foundVariableNode = (0,
|
|
18283
|
+
const foundVariableNode = (0, import_lexical103.$getNodeByKey)(nodeKey);
|
|
18213
18284
|
if ($isVariableNode(foundVariableNode)) {
|
|
18214
|
-
const textNode = (0,
|
|
18285
|
+
const textNode = (0, import_lexical103.$createTextNode)(
|
|
18215
18286
|
foundVariableNode.getVariable()
|
|
18216
18287
|
);
|
|
18217
18288
|
foundVariableNode.replace(textNode);
|
|
@@ -18224,7 +18295,7 @@ function VariableSettings(props) {
|
|
|
18224
18295
|
activeEditorRef.current?.update(() => {
|
|
18225
18296
|
if (parentNodeKey) {
|
|
18226
18297
|
activeEditorRef.current?.focus();
|
|
18227
|
-
const foundNode = (0,
|
|
18298
|
+
const foundNode = (0, import_lexical103.$getNodeByKey)(parentNodeKey);
|
|
18228
18299
|
foundNode?.selectStart();
|
|
18229
18300
|
}
|
|
18230
18301
|
});
|
|
@@ -18286,8 +18357,8 @@ function VariableSettingsPlugin() {
|
|
|
18286
18357
|
|
|
18287
18358
|
// src/plugins/VariablesPlugin/VariableToolbarPlugin.tsx
|
|
18288
18359
|
var import_LexicalComposerContext71 = require("@lexical/react/LexicalComposerContext");
|
|
18289
|
-
var
|
|
18290
|
-
var
|
|
18360
|
+
var import_utils37 = require("@lexical/utils");
|
|
18361
|
+
var import_lexical104 = require("lexical");
|
|
18291
18362
|
var import_debounce7 = __toESM(require("lodash-es/debounce"));
|
|
18292
18363
|
var import_lucide_react28 = require("lucide-react");
|
|
18293
18364
|
var import_react110 = require("react");
|
|
@@ -18304,7 +18375,7 @@ function VariableToolbarPlugin() {
|
|
|
18304
18375
|
});
|
|
18305
18376
|
function formatVariable(format) {
|
|
18306
18377
|
activeEditorRef.current?.update(() => {
|
|
18307
|
-
const foundNode = (0,
|
|
18378
|
+
const foundNode = (0, import_lexical104.$getNodeByKey)(
|
|
18308
18379
|
selectedNodeRef.current?.getKey() || ""
|
|
18309
18380
|
);
|
|
18310
18381
|
if ($isVariableNode(foundNode)) {
|
|
@@ -18401,16 +18472,16 @@ function VariableToolbarPlugin() {
|
|
|
18401
18472
|
[activeEditorRef.current]
|
|
18402
18473
|
);
|
|
18403
18474
|
(0, import_react110.useEffect)(() => {
|
|
18404
|
-
return (0,
|
|
18475
|
+
return (0, import_utils37.mergeRegister)(
|
|
18405
18476
|
editor.registerCommand(
|
|
18406
18477
|
VARIABLE_TOOLBAR_SELECTION_CHANGE_COMMAND,
|
|
18407
18478
|
(_, activeEditor) => {
|
|
18408
18479
|
activeEditorRef.current = activeEditor;
|
|
18409
18480
|
selectedNodeRef.current = void 0;
|
|
18410
18481
|
activeEditor.getEditorState().read(() => {
|
|
18411
|
-
const selection = (0,
|
|
18482
|
+
const selection = (0, import_lexical104.$getSelection)();
|
|
18412
18483
|
if (selection) {
|
|
18413
|
-
if ((0,
|
|
18484
|
+
if ((0, import_lexical104.$isNodeSelection)(selection)) {
|
|
18414
18485
|
const nodes = selection.extract();
|
|
18415
18486
|
const focusedNode = nodes[0];
|
|
18416
18487
|
if ($isVariableNode(focusedNode)) {
|
|
@@ -18427,7 +18498,7 @@ function VariableToolbarPlugin() {
|
|
|
18427
18498
|
});
|
|
18428
18499
|
return false;
|
|
18429
18500
|
},
|
|
18430
|
-
|
|
18501
|
+
import_lexical104.COMMAND_PRIORITY_NORMAL
|
|
18431
18502
|
),
|
|
18432
18503
|
editor.registerRootListener(
|
|
18433
18504
|
(rootElement, prevRootElement) => {
|
|
@@ -18487,84 +18558,29 @@ function VariableToolbarPlugin() {
|
|
|
18487
18558
|
return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(PopupToolbar, { ref: popupToolbarRef, menu: menuItems });
|
|
18488
18559
|
}
|
|
18489
18560
|
|
|
18490
|
-
// src/utils/replaceVariablesInEditorState.ts
|
|
18491
|
-
function replaceVariablesInEditorState(node, variablesMap) {
|
|
18492
|
-
if (node.type === VariableNode.getType()) {
|
|
18493
|
-
const foundPrevVariable = node.variableName ? variablesMap[node.variableName] : void 0;
|
|
18494
|
-
if (foundPrevVariable) {
|
|
18495
|
-
node.text = foundPrevVariable;
|
|
18496
|
-
node.variableName = foundPrevVariable;
|
|
18497
|
-
}
|
|
18498
|
-
}
|
|
18499
|
-
if (node.children && node.children.length > 0) {
|
|
18500
|
-
node.children.forEach((child) => {
|
|
18501
|
-
replaceVariablesInEditorState(child, variablesMap);
|
|
18502
|
-
});
|
|
18503
|
-
}
|
|
18504
|
-
}
|
|
18505
|
-
|
|
18506
18561
|
// src/modules/Variables.tsx
|
|
18507
18562
|
var import_react111 = require("react");
|
|
18508
18563
|
var import_jsx_runtime132 = require("react/jsx-runtime");
|
|
18509
|
-
|
|
18510
|
-
|
|
18511
|
-
|
|
18512
|
-
|
|
18513
|
-
|
|
18514
|
-
|
|
18515
|
-
|
|
18516
|
-
|
|
18517
|
-
} = useBlockEditor();
|
|
18518
|
-
const handleRenameVariable = (prevName, newName) => {
|
|
18519
|
-
const editorRef = getEditor();
|
|
18520
|
-
if (editorRef) {
|
|
18521
|
-
const editorState = editorRef.getEditorState().toJSON();
|
|
18522
|
-
if (editorState) {
|
|
18523
|
-
replaceVariablesInEditorState(editorState.root, {
|
|
18524
|
-
[prevName]: newName
|
|
18525
|
-
});
|
|
18526
|
-
const parsedEditorState = editorRef.parseEditorState(editorState);
|
|
18527
|
-
if (parsedEditorState) {
|
|
18528
|
-
editorRef.setEditorState(parsedEditorState, {
|
|
18529
|
-
tag: "new_state"
|
|
18530
|
-
});
|
|
18531
|
-
if (onChange) {
|
|
18532
|
-
onChange(editorState);
|
|
18533
|
-
}
|
|
18534
|
-
}
|
|
18535
|
-
}
|
|
18536
|
-
}
|
|
18537
|
-
};
|
|
18538
|
-
(0, import_react111.useImperativeHandle)(ref, () => {
|
|
18564
|
+
function Variables(props) {
|
|
18565
|
+
const { variablesSettings } = props;
|
|
18566
|
+
const { registerModule, setEditingModeDataCallback } = useBlockEditor();
|
|
18567
|
+
(0, import_react111.useEffect)(() => {
|
|
18568
|
+
registerModule("Variables");
|
|
18569
|
+
}, []);
|
|
18570
|
+
(0, import_react111.useEffect)(() => {
|
|
18571
|
+
setEditingModeDataCallback(() => {
|
|
18539
18572
|
return {
|
|
18540
|
-
|
|
18573
|
+
variableValues: variablesSettings.getVariableValues()
|
|
18541
18574
|
};
|
|
18542
18575
|
});
|
|
18543
|
-
|
|
18544
|
-
|
|
18545
|
-
|
|
18546
|
-
(0,
|
|
18547
|
-
|
|
18548
|
-
|
|
18549
|
-
|
|
18550
|
-
|
|
18551
|
-
});
|
|
18552
|
-
}, [variablesSettings, setEditingModeDataCallback]);
|
|
18553
|
-
return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(
|
|
18554
|
-
VariablesProvider,
|
|
18555
|
-
{
|
|
18556
|
-
variablesSettings,
|
|
18557
|
-
renameVariable: handleRenameVariable,
|
|
18558
|
-
children: [
|
|
18559
|
-
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(TypeaheadVariablesPlugin, {}),
|
|
18560
|
-
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(VariableSettingsPlugin, {}),
|
|
18561
|
-
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(VariableToolbarPlugin, {}),
|
|
18562
|
-
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(VariableToolbarAgentPlugin, {})
|
|
18563
|
-
]
|
|
18564
|
-
}
|
|
18565
|
-
);
|
|
18566
|
-
}
|
|
18567
|
-
);
|
|
18576
|
+
}, [variablesSettings, setEditingModeDataCallback]);
|
|
18577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(VariablesProvider, { variablesSettings, children: [
|
|
18578
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(TypeaheadVariablesPlugin, {}),
|
|
18579
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(VariableSettingsPlugin, {}),
|
|
18580
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(VariableToolbarPlugin, {}),
|
|
18581
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(VariableToolbarAgentPlugin, {})
|
|
18582
|
+
] });
|
|
18583
|
+
}
|
|
18568
18584
|
// Annotate the CommonJS export names for ESM import in node:
|
|
18569
18585
|
0 && (module.exports = {
|
|
18570
18586
|
BlockEditor,
|