@examind/block-editor 0.1.28 → 0.1.29
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 +45 -2
- package/dist/index.js +789 -671
- package/dist/index.mjs +450 -329
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -6300,7 +6300,7 @@ function QuestionItemComponent(props) {
|
|
|
6300
6300
|
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6301
6301
|
Button,
|
|
6302
6302
|
{
|
|
6303
|
-
StartIcon: import_lucide_react7.
|
|
6303
|
+
StartIcon: import_lucide_react7.Trash,
|
|
6304
6304
|
size: "small",
|
|
6305
6305
|
variant: "text",
|
|
6306
6306
|
className: "neutral",
|
|
@@ -6806,7 +6806,7 @@ function MultipleOptionQuestionItemComponent(props) {
|
|
|
6806
6806
|
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
6807
6807
|
Button,
|
|
6808
6808
|
{
|
|
6809
|
-
StartIcon: import_lucide_react9.
|
|
6809
|
+
StartIcon: import_lucide_react9.Trash,
|
|
6810
6810
|
size: "small",
|
|
6811
6811
|
variant: "text",
|
|
6812
6812
|
className: "neutral",
|
|
@@ -6872,15 +6872,22 @@ function MultipleOptionQuestionNoneOfTheAboveItem(props) {
|
|
|
6872
6872
|
"data-selectable": "true",
|
|
6873
6873
|
children: [
|
|
6874
6874
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "controls", children: [
|
|
6875
|
-
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime60.
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
|
|
6881
|
-
|
|
6882
|
-
|
|
6883
|
-
|
|
6875
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("sl-tooltip", { style: { "--show-delay": "1000" }, hoist: true, children: [
|
|
6876
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { slot: "content", children: [
|
|
6877
|
+
"Grade as Correct",
|
|
6878
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("br", {}),
|
|
6879
|
+
"(Randomly)"
|
|
6880
|
+
] }),
|
|
6881
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
6882
|
+
Button,
|
|
6883
|
+
{
|
|
6884
|
+
StartIcon: import_lucide_react10.Check,
|
|
6885
|
+
size: "small",
|
|
6886
|
+
variant: "text",
|
|
6887
|
+
className: "success"
|
|
6888
|
+
}
|
|
6889
|
+
)
|
|
6890
|
+
] }) }),
|
|
6884
6891
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
6885
6892
|
"sl-tooltip",
|
|
6886
6893
|
{
|
|
@@ -6890,7 +6897,7 @@ function MultipleOptionQuestionNoneOfTheAboveItem(props) {
|
|
|
6890
6897
|
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
6891
6898
|
Button,
|
|
6892
6899
|
{
|
|
6893
|
-
StartIcon: import_lucide_react10.
|
|
6900
|
+
StartIcon: import_lucide_react10.Trash,
|
|
6894
6901
|
size: "small",
|
|
6895
6902
|
variant: "text",
|
|
6896
6903
|
className: "neutral",
|
|
@@ -6900,7 +6907,7 @@ function MultipleOptionQuestionNoneOfTheAboveItem(props) {
|
|
|
6900
6907
|
}
|
|
6901
6908
|
) })
|
|
6902
6909
|
] }),
|
|
6903
|
-
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "none-of-the-above-item", "data-selectable": "true", children: "None
|
|
6910
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "none-of-the-above-item", "data-selectable": "true", children: "None of the above" })
|
|
6904
6911
|
]
|
|
6905
6912
|
}
|
|
6906
6913
|
);
|
|
@@ -7000,7 +7007,7 @@ function MultipleOptionQuestionComponent(props) {
|
|
|
7000
7007
|
size: "medium",
|
|
7001
7008
|
variant: "text",
|
|
7002
7009
|
StartIcon: import_lucide_react11.Plus,
|
|
7003
|
-
label: "ADD
|
|
7010
|
+
label: "ADD CHOICE",
|
|
7004
7011
|
onClick: addOptionItem
|
|
7005
7012
|
}
|
|
7006
7013
|
) })
|
|
@@ -7888,7 +7895,7 @@ function JournalEntryQuestionItemComponent(props) {
|
|
|
7888
7895
|
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
7889
7896
|
Button,
|
|
7890
7897
|
{
|
|
7891
|
-
StartIcon: import_lucide_react13.
|
|
7898
|
+
StartIcon: import_lucide_react13.Trash,
|
|
7892
7899
|
size: "small",
|
|
7893
7900
|
variant: "text",
|
|
7894
7901
|
className: "neutral",
|
|
@@ -9441,48 +9448,157 @@ function $isCalloutBoxNode(node) {
|
|
|
9441
9448
|
return node instanceof CalloutBoxNode;
|
|
9442
9449
|
}
|
|
9443
9450
|
|
|
9444
|
-
// src/plugins/
|
|
9445
|
-
var
|
|
9451
|
+
// src/plugins/CustomQuestionPlugin/CustomQuestionComponent.tsx
|
|
9452
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
9453
|
+
function CustomQuestionComponent(props) {
|
|
9454
|
+
const { name } = props;
|
|
9455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "custom-question-prompt", children: [
|
|
9456
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
9457
|
+
"div",
|
|
9458
|
+
{
|
|
9459
|
+
className: "custom-question-prompt-title",
|
|
9460
|
+
"data-selectable": "true",
|
|
9461
|
+
children: "Custom"
|
|
9462
|
+
}
|
|
9463
|
+
),
|
|
9464
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
9465
|
+
"div",
|
|
9466
|
+
{
|
|
9467
|
+
className: "custom-question-prompt-content",
|
|
9468
|
+
"data-selectable": "true",
|
|
9469
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { children: name })
|
|
9470
|
+
}
|
|
9471
|
+
)
|
|
9472
|
+
] });
|
|
9473
|
+
}
|
|
9474
|
+
|
|
9475
|
+
// src/plugins/CustomQuestionPlugin/CustomQuestionNode.tsx
|
|
9476
|
+
var import_lexical57 = require("lexical");
|
|
9446
9477
|
var import_nanoid8 = require("nanoid");
|
|
9478
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
9479
|
+
var TYPE_NAME11 = "custom-question";
|
|
9480
|
+
var CustomQuestionNode = class _CustomQuestionNode extends import_lexical57.DecoratorNode {
|
|
9481
|
+
constructor(points, name, data, id, key) {
|
|
9482
|
+
super(key);
|
|
9483
|
+
this.__id = id || (0, import_nanoid8.nanoid)();
|
|
9484
|
+
this.__points = points;
|
|
9485
|
+
this.__name = name;
|
|
9486
|
+
this.__data = data;
|
|
9487
|
+
}
|
|
9488
|
+
static getType() {
|
|
9489
|
+
return TYPE_NAME11;
|
|
9490
|
+
}
|
|
9491
|
+
static clone(node) {
|
|
9492
|
+
return new _CustomQuestionNode(
|
|
9493
|
+
node.__points,
|
|
9494
|
+
node.__name,
|
|
9495
|
+
node.__data,
|
|
9496
|
+
node.__id,
|
|
9497
|
+
node.__key
|
|
9498
|
+
);
|
|
9499
|
+
}
|
|
9500
|
+
__createWrapper() {
|
|
9501
|
+
return document.createElement("div");
|
|
9502
|
+
}
|
|
9503
|
+
createDOM() {
|
|
9504
|
+
return this.__createWrapper();
|
|
9505
|
+
}
|
|
9506
|
+
exportDOM() {
|
|
9507
|
+
const element = this.__createWrapper();
|
|
9508
|
+
return { element };
|
|
9509
|
+
}
|
|
9510
|
+
updateDOM() {
|
|
9511
|
+
return false;
|
|
9512
|
+
}
|
|
9513
|
+
static importDOM() {
|
|
9514
|
+
return null;
|
|
9515
|
+
}
|
|
9516
|
+
static importJSON(serializedNode) {
|
|
9517
|
+
return $createCustomQuestionNode(
|
|
9518
|
+
serializedNode.points,
|
|
9519
|
+
serializedNode.name,
|
|
9520
|
+
serializedNode.data,
|
|
9521
|
+
serializedNode.id
|
|
9522
|
+
);
|
|
9523
|
+
}
|
|
9524
|
+
exportJSON() {
|
|
9525
|
+
return {
|
|
9526
|
+
id: this.__id,
|
|
9527
|
+
points: this.__points,
|
|
9528
|
+
name: this.__name,
|
|
9529
|
+
data: this.__data,
|
|
9530
|
+
type: TYPE_NAME11,
|
|
9531
|
+
version: 1
|
|
9532
|
+
};
|
|
9533
|
+
}
|
|
9534
|
+
canIndent() {
|
|
9535
|
+
return false;
|
|
9536
|
+
}
|
|
9537
|
+
isInline() {
|
|
9538
|
+
return false;
|
|
9539
|
+
}
|
|
9540
|
+
isIsolated() {
|
|
9541
|
+
return true;
|
|
9542
|
+
}
|
|
9543
|
+
isKeyboardSelectable() {
|
|
9544
|
+
return false;
|
|
9545
|
+
}
|
|
9546
|
+
setPoints(points) {
|
|
9547
|
+
const writable = this.getWritable();
|
|
9548
|
+
writable.__points = points;
|
|
9549
|
+
}
|
|
9550
|
+
decorate() {
|
|
9551
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(CustomQuestionComponent, { name: this.__name });
|
|
9552
|
+
}
|
|
9553
|
+
};
|
|
9554
|
+
function $createCustomQuestionNode(points, name, data, id) {
|
|
9555
|
+
return (0, import_lexical57.$applyNodeReplacement)(
|
|
9556
|
+
new CustomQuestionNode(points, name, data, id)
|
|
9557
|
+
);
|
|
9558
|
+
}
|
|
9559
|
+
|
|
9560
|
+
// src/plugins/EssayQuestionPlugin/EssayQuestionNode.tsx
|
|
9561
|
+
var import_lexical59 = require("lexical");
|
|
9562
|
+
var import_nanoid9 = require("nanoid");
|
|
9447
9563
|
|
|
9448
9564
|
// src/plugins/EssayQuestionPlugin/EssayQuestionComponent.tsx
|
|
9449
9565
|
var import_LexicalComposerContext44 = require("@lexical/react/LexicalComposerContext");
|
|
9450
|
-
var
|
|
9566
|
+
var import_lexical58 = require("lexical");
|
|
9451
9567
|
var import_react63 = require("react");
|
|
9452
|
-
var
|
|
9568
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
9453
9569
|
function EssayQuestionComponent(props) {
|
|
9454
9570
|
const { nodeKey, id, aiSystemMessage } = props;
|
|
9455
9571
|
const [editor] = (0, import_LexicalComposerContext44.useLexicalComposerContext)();
|
|
9456
9572
|
const rootElementRef = (0, import_react63.useRef)(null);
|
|
9457
9573
|
(0, import_react63.useEffect)(() => {
|
|
9458
9574
|
return editor.registerCommand(
|
|
9459
|
-
|
|
9575
|
+
import_lexical58.CLICK_COMMAND,
|
|
9460
9576
|
(event, _activeEditor) => {
|
|
9461
9577
|
if (rootElementRef.current?.contains(event.target) && event.target.hasAttribute(
|
|
9462
9578
|
"data-selectable"
|
|
9463
9579
|
)) {
|
|
9464
9580
|
editor.update(() => {
|
|
9465
|
-
const foundNode = (0,
|
|
9581
|
+
const foundNode = (0, import_lexical58.$getNodeByKey)(nodeKey);
|
|
9466
9582
|
if ($isEssayQuestionNode(foundNode)) {
|
|
9467
|
-
const selection = (0,
|
|
9583
|
+
const selection = (0, import_lexical58.$createNodeSelection)();
|
|
9468
9584
|
selection.add(nodeKey);
|
|
9469
|
-
(0,
|
|
9585
|
+
(0, import_lexical58.$setSelection)(selection);
|
|
9470
9586
|
}
|
|
9471
9587
|
});
|
|
9472
9588
|
}
|
|
9473
9589
|
return false;
|
|
9474
9590
|
},
|
|
9475
|
-
|
|
9591
|
+
import_lexical58.COMMAND_PRIORITY_LOW
|
|
9476
9592
|
);
|
|
9477
9593
|
}, [editor]);
|
|
9478
|
-
return /* @__PURE__ */ (0,
|
|
9594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
|
|
9479
9595
|
"div",
|
|
9480
9596
|
{
|
|
9481
9597
|
ref: rootElementRef,
|
|
9482
9598
|
id,
|
|
9483
9599
|
className: "essay-question-prompt",
|
|
9484
9600
|
children: [
|
|
9485
|
-
/* @__PURE__ */ (0,
|
|
9601
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
9486
9602
|
"div",
|
|
9487
9603
|
{
|
|
9488
9604
|
className: "essay-question-prompt-title",
|
|
@@ -9490,12 +9606,12 @@ function EssayQuestionComponent(props) {
|
|
|
9490
9606
|
children: "Essay"
|
|
9491
9607
|
}
|
|
9492
9608
|
),
|
|
9493
|
-
/* @__PURE__ */ (0,
|
|
9609
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
9494
9610
|
"div",
|
|
9495
9611
|
{
|
|
9496
9612
|
className: "essay-question-prompt-content",
|
|
9497
9613
|
"data-selectable": "true",
|
|
9498
|
-
children: /* @__PURE__ */ (0,
|
|
9614
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "title", "data-selectable": "true", children: aiSystemMessage })
|
|
9499
9615
|
}
|
|
9500
9616
|
)
|
|
9501
9617
|
]
|
|
@@ -9504,12 +9620,12 @@ function EssayQuestionComponent(props) {
|
|
|
9504
9620
|
}
|
|
9505
9621
|
|
|
9506
9622
|
// src/plugins/EssayQuestionPlugin/EssayQuestionNode.tsx
|
|
9507
|
-
var
|
|
9508
|
-
var
|
|
9509
|
-
var EssayQuestionNode = class _EssayQuestionNode extends
|
|
9623
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
9624
|
+
var TYPE_NAME12 = "essay-question";
|
|
9625
|
+
var EssayQuestionNode = class _EssayQuestionNode extends import_lexical59.DecoratorNode {
|
|
9510
9626
|
constructor(points, maxWords, hideChat, aiSystemMessage, aiChatModel, id, key) {
|
|
9511
9627
|
super(key);
|
|
9512
|
-
this.__id = id || (0,
|
|
9628
|
+
this.__id = id || (0, import_nanoid9.nanoid)();
|
|
9513
9629
|
this.__points = points < 0 ? 1 : points;
|
|
9514
9630
|
this.__maxWords = maxWords;
|
|
9515
9631
|
this.__hideChat = hideChat || false;
|
|
@@ -9517,7 +9633,7 @@ var EssayQuestionNode = class _EssayQuestionNode extends import_lexical58.Decora
|
|
|
9517
9633
|
this.__aiChatModel = aiChatModel || null;
|
|
9518
9634
|
}
|
|
9519
9635
|
static getType() {
|
|
9520
|
-
return
|
|
9636
|
+
return TYPE_NAME12;
|
|
9521
9637
|
}
|
|
9522
9638
|
static clone(node) {
|
|
9523
9639
|
return new _EssayQuestionNode(
|
|
@@ -9566,7 +9682,7 @@ var EssayQuestionNode = class _EssayQuestionNode extends import_lexical58.Decora
|
|
|
9566
9682
|
hideChat: this.__hideChat,
|
|
9567
9683
|
aiChatModel: this.__aiChatModel,
|
|
9568
9684
|
aiSystemMessage: this.__aiSystemMessage,
|
|
9569
|
-
type:
|
|
9685
|
+
type: TYPE_NAME12,
|
|
9570
9686
|
version: 1
|
|
9571
9687
|
};
|
|
9572
9688
|
}
|
|
@@ -9591,7 +9707,7 @@ var EssayQuestionNode = class _EssayQuestionNode extends import_lexical58.Decora
|
|
|
9591
9707
|
writable.__maxWords = maxWords;
|
|
9592
9708
|
}
|
|
9593
9709
|
decorate() {
|
|
9594
|
-
return /* @__PURE__ */ (0,
|
|
9710
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
9595
9711
|
EssayQuestionComponent,
|
|
9596
9712
|
{
|
|
9597
9713
|
nodeKey: this.__key,
|
|
@@ -9602,7 +9718,7 @@ var EssayQuestionNode = class _EssayQuestionNode extends import_lexical58.Decora
|
|
|
9602
9718
|
}
|
|
9603
9719
|
};
|
|
9604
9720
|
function $createEssayQuestionNode(points, maxWords, hideChat, aiSystemMessage, aiChatModel, id) {
|
|
9605
|
-
return (0,
|
|
9721
|
+
return (0, import_lexical59.$applyNodeReplacement)(
|
|
9606
9722
|
new EssayQuestionNode(
|
|
9607
9723
|
points,
|
|
9608
9724
|
maxWords,
|
|
@@ -9621,17 +9737,17 @@ function $isEssayQuestionNode(node) {
|
|
|
9621
9737
|
var import_LexicalComposerContext45 = require("@lexical/react/LexicalComposerContext");
|
|
9622
9738
|
var import_useLexicalNodeSelection4 = require("@lexical/react/useLexicalNodeSelection");
|
|
9623
9739
|
var import_utils16 = require("@lexical/utils");
|
|
9624
|
-
var
|
|
9740
|
+
var import_lexical60 = require("lexical");
|
|
9625
9741
|
var import_react64 = require("react");
|
|
9626
|
-
var
|
|
9627
|
-
var INSERT_HORIZONTAL_RULE_COMMAND = (0,
|
|
9742
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
9743
|
+
var INSERT_HORIZONTAL_RULE_COMMAND = (0, import_lexical60.createCommand)("INSERT_HORIZONTAL_RULE_COMMAND");
|
|
9628
9744
|
function HorizontalRuleComponent({ nodeKey }) {
|
|
9629
9745
|
const [editor] = (0, import_LexicalComposerContext45.useLexicalComposerContext)();
|
|
9630
9746
|
const [isSelected, setSelected, clearSelection] = (0, import_useLexicalNodeSelection4.useLexicalNodeSelection)(nodeKey);
|
|
9631
9747
|
const $onDelete = (0, import_react64.useCallback)(
|
|
9632
9748
|
(event) => {
|
|
9633
|
-
const deleteSelection = (0,
|
|
9634
|
-
if (isSelected && (0,
|
|
9749
|
+
const deleteSelection = (0, import_lexical60.$getSelection)();
|
|
9750
|
+
if (isSelected && (0, import_lexical60.$isNodeSelection)(deleteSelection)) {
|
|
9635
9751
|
event.preventDefault();
|
|
9636
9752
|
deleteSelection.getNodes().forEach((node) => {
|
|
9637
9753
|
if ($isHorizontalRuleNode(node)) {
|
|
@@ -9646,7 +9762,7 @@ function HorizontalRuleComponent({ nodeKey }) {
|
|
|
9646
9762
|
(0, import_react64.useEffect)(() => {
|
|
9647
9763
|
return (0, import_utils16.mergeRegister)(
|
|
9648
9764
|
editor.registerCommand(
|
|
9649
|
-
|
|
9765
|
+
import_lexical60.CLICK_COMMAND,
|
|
9650
9766
|
(event) => {
|
|
9651
9767
|
const hrElem = editor.getElementByKey(nodeKey);
|
|
9652
9768
|
if (event.target === hrElem) {
|
|
@@ -9657,17 +9773,17 @@ function HorizontalRuleComponent({ nodeKey }) {
|
|
|
9657
9773
|
}
|
|
9658
9774
|
return false;
|
|
9659
9775
|
},
|
|
9660
|
-
|
|
9776
|
+
import_lexical60.COMMAND_PRIORITY_LOW
|
|
9661
9777
|
),
|
|
9662
9778
|
editor.registerCommand(
|
|
9663
|
-
|
|
9779
|
+
import_lexical60.KEY_DELETE_COMMAND,
|
|
9664
9780
|
$onDelete,
|
|
9665
|
-
|
|
9781
|
+
import_lexical60.COMMAND_PRIORITY_LOW
|
|
9666
9782
|
),
|
|
9667
9783
|
editor.registerCommand(
|
|
9668
|
-
|
|
9784
|
+
import_lexical60.KEY_BACKSPACE_COMMAND,
|
|
9669
9785
|
$onDelete,
|
|
9670
|
-
|
|
9786
|
+
import_lexical60.COMMAND_PRIORITY_LOW
|
|
9671
9787
|
)
|
|
9672
9788
|
);
|
|
9673
9789
|
}, [
|
|
@@ -9691,7 +9807,7 @@ function HorizontalRuleComponent({ nodeKey }) {
|
|
|
9691
9807
|
}, [editor, isSelected, nodeKey]);
|
|
9692
9808
|
return null;
|
|
9693
9809
|
}
|
|
9694
|
-
var HorizontalRuleNode = class _HorizontalRuleNode extends
|
|
9810
|
+
var HorizontalRuleNode = class _HorizontalRuleNode extends import_lexical60.DecoratorNode {
|
|
9695
9811
|
static getType() {
|
|
9696
9812
|
return "horizontalrule";
|
|
9697
9813
|
}
|
|
@@ -9735,61 +9851,61 @@ var HorizontalRuleNode = class _HorizontalRuleNode extends import_lexical59.Deco
|
|
|
9735
9851
|
return false;
|
|
9736
9852
|
}
|
|
9737
9853
|
decorate() {
|
|
9738
|
-
return /* @__PURE__ */ (0,
|
|
9854
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(HorizontalRuleComponent, { nodeKey: this.__key });
|
|
9739
9855
|
}
|
|
9740
9856
|
};
|
|
9741
9857
|
function $convertHorizontalRuleElement() {
|
|
9742
9858
|
return { node: $createHorizontalRuleNode() };
|
|
9743
9859
|
}
|
|
9744
9860
|
function $createHorizontalRuleNode() {
|
|
9745
|
-
return (0,
|
|
9861
|
+
return (0, import_lexical60.$applyNodeReplacement)(new HorizontalRuleNode());
|
|
9746
9862
|
}
|
|
9747
9863
|
function $isHorizontalRuleNode(node) {
|
|
9748
9864
|
return node instanceof HorizontalRuleNode;
|
|
9749
9865
|
}
|
|
9750
9866
|
|
|
9751
9867
|
// src/plugins/SimulationQuestionPlugin/SimulationQuestionNode.tsx
|
|
9752
|
-
var
|
|
9753
|
-
var
|
|
9868
|
+
var import_lexical62 = require("lexical");
|
|
9869
|
+
var import_nanoid10 = require("nanoid");
|
|
9754
9870
|
|
|
9755
9871
|
// src/plugins/SimulationQuestionPlugin/SimulationQuestionComponent.tsx
|
|
9756
9872
|
var import_LexicalComposerContext46 = require("@lexical/react/LexicalComposerContext");
|
|
9757
|
-
var
|
|
9873
|
+
var import_lexical61 = require("lexical");
|
|
9758
9874
|
var import_react65 = require("react");
|
|
9759
|
-
var
|
|
9875
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
9760
9876
|
function SimulationQuestionComponent(props) {
|
|
9761
9877
|
const { nodeKey, id, aiSystemMessage, step2Instruction } = props;
|
|
9762
9878
|
const [editor] = (0, import_LexicalComposerContext46.useLexicalComposerContext)();
|
|
9763
9879
|
const rootElementRef = (0, import_react65.useRef)(null);
|
|
9764
9880
|
(0, import_react65.useEffect)(() => {
|
|
9765
9881
|
return editor.registerCommand(
|
|
9766
|
-
|
|
9882
|
+
import_lexical61.CLICK_COMMAND,
|
|
9767
9883
|
(event, _activeEditor) => {
|
|
9768
9884
|
if (rootElementRef.current?.contains(event.target) && event.target.hasAttribute(
|
|
9769
9885
|
"data-selectable"
|
|
9770
9886
|
)) {
|
|
9771
9887
|
editor.update(() => {
|
|
9772
|
-
const foundNode = (0,
|
|
9888
|
+
const foundNode = (0, import_lexical61.$getNodeByKey)(nodeKey);
|
|
9773
9889
|
if ($isSimulationQuestionNode(foundNode)) {
|
|
9774
|
-
const selection = (0,
|
|
9890
|
+
const selection = (0, import_lexical61.$createNodeSelection)();
|
|
9775
9891
|
selection.add(nodeKey);
|
|
9776
|
-
(0,
|
|
9892
|
+
(0, import_lexical61.$setSelection)(selection);
|
|
9777
9893
|
}
|
|
9778
9894
|
});
|
|
9779
9895
|
}
|
|
9780
9896
|
return false;
|
|
9781
9897
|
},
|
|
9782
|
-
|
|
9898
|
+
import_lexical61.COMMAND_PRIORITY_LOW
|
|
9783
9899
|
);
|
|
9784
9900
|
}, [editor]);
|
|
9785
|
-
return /* @__PURE__ */ (0,
|
|
9901
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
|
|
9786
9902
|
"div",
|
|
9787
9903
|
{
|
|
9788
9904
|
ref: rootElementRef,
|
|
9789
9905
|
id,
|
|
9790
9906
|
className: "simulation-question-prompt",
|
|
9791
9907
|
children: [
|
|
9792
|
-
/* @__PURE__ */ (0,
|
|
9908
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
9793
9909
|
"div",
|
|
9794
9910
|
{
|
|
9795
9911
|
className: "simulation-question-prompt-title",
|
|
@@ -9797,14 +9913,14 @@ function SimulationQuestionComponent(props) {
|
|
|
9797
9913
|
children: "Simulation"
|
|
9798
9914
|
}
|
|
9799
9915
|
),
|
|
9800
|
-
/* @__PURE__ */ (0,
|
|
9916
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
|
|
9801
9917
|
"div",
|
|
9802
9918
|
{
|
|
9803
9919
|
className: "simulation-question-prompt-content",
|
|
9804
9920
|
"data-selectable": "true",
|
|
9805
9921
|
children: [
|
|
9806
|
-
/* @__PURE__ */ (0,
|
|
9807
|
-
/* @__PURE__ */ (0,
|
|
9922
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "title", "data-selectable": "true", children: aiSystemMessage }),
|
|
9923
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { children: step2Instruction })
|
|
9808
9924
|
]
|
|
9809
9925
|
}
|
|
9810
9926
|
)
|
|
@@ -9814,19 +9930,19 @@ function SimulationQuestionComponent(props) {
|
|
|
9814
9930
|
}
|
|
9815
9931
|
|
|
9816
9932
|
// src/plugins/SimulationQuestionPlugin/SimulationQuestionNode.tsx
|
|
9817
|
-
var
|
|
9818
|
-
var
|
|
9819
|
-
var SimulationQuestionNode = class _SimulationQuestionNode extends
|
|
9933
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
9934
|
+
var TYPE_NAME13 = "simulation-question";
|
|
9935
|
+
var SimulationQuestionNode = class _SimulationQuestionNode extends import_lexical62.DecoratorNode {
|
|
9820
9936
|
constructor(points, aiSystemMessage, aiChatModel, step2Instructions, id, key) {
|
|
9821
9937
|
super(key);
|
|
9822
|
-
this.__id = id || (0,
|
|
9938
|
+
this.__id = id || (0, import_nanoid10.nanoid)();
|
|
9823
9939
|
this.__points = points < 0 ? 1 : points;
|
|
9824
9940
|
this.__aiSystemMessage = aiSystemMessage || null;
|
|
9825
9941
|
this.__aiChatModel = aiChatModel || null;
|
|
9826
9942
|
this.__step2Instructions = step2Instructions || null;
|
|
9827
9943
|
}
|
|
9828
9944
|
static getType() {
|
|
9829
|
-
return
|
|
9945
|
+
return TYPE_NAME13;
|
|
9830
9946
|
}
|
|
9831
9947
|
static clone(node) {
|
|
9832
9948
|
return new _SimulationQuestionNode(
|
|
@@ -9872,7 +9988,7 @@ var SimulationQuestionNode = class _SimulationQuestionNode extends import_lexica
|
|
|
9872
9988
|
aiSystemMessage: this.__aiSystemMessage,
|
|
9873
9989
|
aiChatModel: this.__aiChatModel,
|
|
9874
9990
|
step2Instructions: this.__step2Instructions,
|
|
9875
|
-
type:
|
|
9991
|
+
type: TYPE_NAME13,
|
|
9876
9992
|
version: 1
|
|
9877
9993
|
};
|
|
9878
9994
|
}
|
|
@@ -9893,7 +10009,7 @@ var SimulationQuestionNode = class _SimulationQuestionNode extends import_lexica
|
|
|
9893
10009
|
writable.__points = points <= 0 ? 1 : points;
|
|
9894
10010
|
}
|
|
9895
10011
|
decorate() {
|
|
9896
|
-
return /* @__PURE__ */ (0,
|
|
10012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
9897
10013
|
SimulationQuestionComponent,
|
|
9898
10014
|
{
|
|
9899
10015
|
nodeKey: this.__key,
|
|
@@ -9905,7 +10021,7 @@ var SimulationQuestionNode = class _SimulationQuestionNode extends import_lexica
|
|
|
9905
10021
|
}
|
|
9906
10022
|
};
|
|
9907
10023
|
function $createSimulationQuestionNode(points, aiSystemMessage, aiChatModel, step2Instructions, id) {
|
|
9908
|
-
return (0,
|
|
10024
|
+
return (0, import_lexical62.$applyNodeReplacement)(
|
|
9909
10025
|
new SimulationQuestionNode(
|
|
9910
10026
|
points,
|
|
9911
10027
|
aiSystemMessage,
|
|
@@ -9946,7 +10062,8 @@ var commonEditorNodes = [
|
|
|
9946
10062
|
JournalEntryQuestionNode,
|
|
9947
10063
|
FinancialStatementQuestionNode,
|
|
9948
10064
|
EssayQuestionNode,
|
|
9949
|
-
SimulationQuestionNode
|
|
10065
|
+
SimulationQuestionNode,
|
|
10066
|
+
CustomQuestionNode
|
|
9950
10067
|
];
|
|
9951
10068
|
var editorNodes = [...commonEditorNodes];
|
|
9952
10069
|
|
|
@@ -9990,7 +10107,7 @@ var initialEditorRegistry = {
|
|
|
9990
10107
|
// src/content/drawer/Drawer.tsx
|
|
9991
10108
|
var import_lucide_react16 = require("lucide-react");
|
|
9992
10109
|
var import_react66 = require("react");
|
|
9993
|
-
var
|
|
10110
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
9994
10111
|
var Drawer = (0, import_react66.forwardRef)(
|
|
9995
10112
|
(props, ref) => {
|
|
9996
10113
|
const {
|
|
@@ -10005,12 +10122,12 @@ var Drawer = (0, import_react66.forwardRef)(
|
|
|
10005
10122
|
setShowSettingsButton(true);
|
|
10006
10123
|
}
|
|
10007
10124
|
}, [modulesNumber, hasModule]);
|
|
10008
|
-
return /* @__PURE__ */ (0,
|
|
10125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
10009
10126
|
"nav",
|
|
10010
10127
|
{
|
|
10011
10128
|
ref,
|
|
10012
10129
|
className: !showSettingsButton ? "disabled" : settingsPanelSwitch === "on" ? "shown" : "hidden",
|
|
10013
|
-
children: settingsPanelSwitch === "off" && /* @__PURE__ */ (0,
|
|
10130
|
+
children: settingsPanelSwitch === "off" && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
10014
10131
|
Button,
|
|
10015
10132
|
{
|
|
10016
10133
|
className: "cancel",
|
|
@@ -10027,9 +10144,9 @@ var Drawer = (0, import_react66.forwardRef)(
|
|
|
10027
10144
|
|
|
10028
10145
|
// src/content/editable/ContentEditable.tsx
|
|
10029
10146
|
var import_LexicalContentEditable2 = require("@lexical/react/LexicalContentEditable");
|
|
10030
|
-
var
|
|
10147
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
10031
10148
|
function ContentEditable() {
|
|
10032
|
-
return /* @__PURE__ */ (0,
|
|
10149
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_LexicalContentEditable2.ContentEditable, { className: "content" });
|
|
10033
10150
|
}
|
|
10034
10151
|
|
|
10035
10152
|
// src/content/node/NodeProvider.tsx
|
|
@@ -10037,7 +10154,7 @@ var import_react82 = __toESM(require("react"));
|
|
|
10037
10154
|
|
|
10038
10155
|
// src/components/inputs/DropdownWrapper.tsx
|
|
10039
10156
|
var import_react67 = require("react");
|
|
10040
|
-
var
|
|
10157
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
10041
10158
|
var DropdownWrapper = (0, import_react67.forwardRef)((props, ref) => {
|
|
10042
10159
|
const {
|
|
10043
10160
|
className,
|
|
@@ -10120,9 +10237,9 @@ var DropdownWrapper = (0, import_react67.forwardRef)((props, ref) => {
|
|
|
10120
10237
|
subMenu
|
|
10121
10238
|
} = menuItem;
|
|
10122
10239
|
if (menuItemDivider) {
|
|
10123
|
-
menuItemElement = /* @__PURE__ */ (0,
|
|
10240
|
+
menuItemElement = /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("sl-divider", { ...triggerData }, `menuItem${menuItemId}`);
|
|
10124
10241
|
} else if (menuItemIsGroup) {
|
|
10125
|
-
menuItemElement = /* @__PURE__ */ (0,
|
|
10242
|
+
menuItemElement = /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("sl-menu-label", { children: menuItemLabel }, `menuItem${menuItemId}`);
|
|
10126
10243
|
} else if (subMenu) {
|
|
10127
10244
|
const subMenuElements = [];
|
|
10128
10245
|
let subTabsIndex = 0;
|
|
@@ -10131,7 +10248,7 @@ var DropdownWrapper = (0, import_react67.forwardRef)((props, ref) => {
|
|
|
10131
10248
|
createMenuItem(subMenuItem, subTabsIndex++)
|
|
10132
10249
|
);
|
|
10133
10250
|
}
|
|
10134
|
-
menuItemElement = /* @__PURE__ */ (0,
|
|
10251
|
+
menuItemElement = /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
|
10135
10252
|
"sl-menu-item",
|
|
10136
10253
|
{
|
|
10137
10254
|
className: menuItemClassName,
|
|
@@ -10141,7 +10258,7 @@ var DropdownWrapper = (0, import_react67.forwardRef)((props, ref) => {
|
|
|
10141
10258
|
e.stopPropagation();
|
|
10142
10259
|
},
|
|
10143
10260
|
children: [
|
|
10144
|
-
MenuItemIcon && /* @__PURE__ */ (0,
|
|
10261
|
+
MenuItemIcon && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
10145
10262
|
Icon,
|
|
10146
10263
|
{
|
|
10147
10264
|
style: { color: menuItemColor || "inherit" },
|
|
@@ -10150,7 +10267,7 @@ var DropdownWrapper = (0, import_react67.forwardRef)((props, ref) => {
|
|
|
10150
10267
|
}
|
|
10151
10268
|
),
|
|
10152
10269
|
menuItemLabel,
|
|
10153
|
-
/* @__PURE__ */ (0,
|
|
10270
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
10154
10271
|
"sl-menu",
|
|
10155
10272
|
{
|
|
10156
10273
|
slot: "submenu",
|
|
@@ -10175,7 +10292,7 @@ var DropdownWrapper = (0, import_react67.forwardRef)((props, ref) => {
|
|
|
10175
10292
|
menuItemAttributes.type = "checkbox";
|
|
10176
10293
|
menuItemAttributes.checked = menuItemSelected;
|
|
10177
10294
|
}
|
|
10178
|
-
menuItemElement = /* @__PURE__ */ (0,
|
|
10295
|
+
menuItemElement = /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
|
10179
10296
|
"sl-menu-item",
|
|
10180
10297
|
{
|
|
10181
10298
|
value: menuItemId,
|
|
@@ -10187,7 +10304,7 @@ var DropdownWrapper = (0, import_react67.forwardRef)((props, ref) => {
|
|
|
10187
10304
|
e.stopPropagation();
|
|
10188
10305
|
},
|
|
10189
10306
|
children: [
|
|
10190
|
-
MenuItemIcon && /* @__PURE__ */ (0,
|
|
10307
|
+
MenuItemIcon && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
10191
10308
|
Icon,
|
|
10192
10309
|
{
|
|
10193
10310
|
style: { color: menuItemColor || "inherit" },
|
|
@@ -10196,7 +10313,7 @@ var DropdownWrapper = (0, import_react67.forwardRef)((props, ref) => {
|
|
|
10196
10313
|
}
|
|
10197
10314
|
),
|
|
10198
10315
|
menuItemLabel,
|
|
10199
|
-
menuItemIsError && /* @__PURE__ */ (0,
|
|
10316
|
+
menuItemIsError && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(DotBadge, { variant: "danger", leftSided: true })
|
|
10200
10317
|
]
|
|
10201
10318
|
},
|
|
10202
10319
|
`menuItem${menuItemId}`
|
|
@@ -10262,7 +10379,7 @@ var DropdownWrapper = (0, import_react67.forwardRef)((props, ref) => {
|
|
|
10262
10379
|
}
|
|
10263
10380
|
};
|
|
10264
10381
|
}, []);
|
|
10265
|
-
const buttonElement = /* @__PURE__ */ (0,
|
|
10382
|
+
const buttonElement = /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
|
10266
10383
|
"sl-dropdown",
|
|
10267
10384
|
{
|
|
10268
10385
|
ref: dropdownRef,
|
|
@@ -10271,7 +10388,7 @@ var DropdownWrapper = (0, import_react67.forwardRef)((props, ref) => {
|
|
|
10271
10388
|
...dropdownAttributes,
|
|
10272
10389
|
children: [
|
|
10273
10390
|
children,
|
|
10274
|
-
menuItems.length > 0 && /* @__PURE__ */ (0,
|
|
10391
|
+
menuItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
10275
10392
|
"sl-menu",
|
|
10276
10393
|
{
|
|
10277
10394
|
ref: menuRef,
|
|
@@ -10290,7 +10407,7 @@ var DropdownWrapper = (0, import_react67.forwardRef)((props, ref) => {
|
|
|
10290
10407
|
});
|
|
10291
10408
|
|
|
10292
10409
|
// src/utils/exportNodeToJSON.ts
|
|
10293
|
-
var
|
|
10410
|
+
var import_lexical63 = require("lexical");
|
|
10294
10411
|
var LEXICAL_NODE_MIME_TYPE = "/application/x-lexical-node/";
|
|
10295
10412
|
function exportNodeToJSON(node) {
|
|
10296
10413
|
const serializedNode = node.exportJSON();
|
|
@@ -10300,7 +10417,7 @@ function exportNodeToJSON(node) {
|
|
|
10300
10417
|
`LexicalNode: Node ${nodeClass.name} does not match the serialized type. Check if .exportJSON() is implemented and it is returning the correct type.`
|
|
10301
10418
|
);
|
|
10302
10419
|
}
|
|
10303
|
-
if ((0,
|
|
10420
|
+
if ((0, import_lexical63.$isElementNode)(node)) {
|
|
10304
10421
|
const serializedChildren = serializedNode.children;
|
|
10305
10422
|
if (!Array.isArray(serializedChildren)) {
|
|
10306
10423
|
throw Error(
|
|
@@ -10321,12 +10438,12 @@ function exportNodeToJSON(node) {
|
|
|
10321
10438
|
var import_LexicalComposerContext48 = require("@lexical/react/LexicalComposerContext");
|
|
10322
10439
|
var import_table13 = require("@lexical/table");
|
|
10323
10440
|
var import_utils17 = require("@lexical/utils");
|
|
10324
|
-
var
|
|
10441
|
+
var import_lexical65 = require("lexical");
|
|
10325
10442
|
var import_react69 = require("react");
|
|
10326
10443
|
|
|
10327
10444
|
// src/plugins/FillInTheBlankQuestionPlugin/FillInTheBlankQuestionSettings.tsx
|
|
10328
10445
|
var import_LexicalComposerContext47 = require("@lexical/react/LexicalComposerContext");
|
|
10329
|
-
var
|
|
10446
|
+
var import_lexical64 = require("lexical");
|
|
10330
10447
|
var import_react68 = require("react");
|
|
10331
10448
|
|
|
10332
10449
|
// src/plugins/FillInTheBlankQuestionPlugin/validatePointslnput.ts
|
|
@@ -10349,7 +10466,7 @@ function validatePointsInput(input) {
|
|
|
10349
10466
|
}
|
|
10350
10467
|
|
|
10351
10468
|
// src/plugins/FillInTheBlankQuestionPlugin/FillInTheBlankQuestionSettings.tsx
|
|
10352
|
-
var
|
|
10469
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
10353
10470
|
function FillInTheBlankQuestionSettings(props) {
|
|
10354
10471
|
const { nodeKey } = props;
|
|
10355
10472
|
const [editor] = (0, import_LexicalComposerContext47.useLexicalComposerContext)();
|
|
@@ -10358,7 +10475,7 @@ function FillInTheBlankQuestionSettings(props) {
|
|
|
10358
10475
|
(0, import_react68.useEffect)(() => {
|
|
10359
10476
|
if (nodeKey) {
|
|
10360
10477
|
editor.getEditorState().read(() => {
|
|
10361
|
-
const fillInTheBlankNode = (0,
|
|
10478
|
+
const fillInTheBlankNode = (0, import_lexical64.$getNodeByKey)(nodeKey);
|
|
10362
10479
|
if (fillInTheBlankNode && $isFillInTheBlankQuestionNode(fillInTheBlankNode)) {
|
|
10363
10480
|
setFoundNode(fillInTheBlankNode);
|
|
10364
10481
|
}
|
|
@@ -10368,7 +10485,7 @@ function FillInTheBlankQuestionSettings(props) {
|
|
|
10368
10485
|
if (!foundNode) {
|
|
10369
10486
|
return null;
|
|
10370
10487
|
}
|
|
10371
|
-
return /* @__PURE__ */ (0,
|
|
10488
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
10372
10489
|
TextInput,
|
|
10373
10490
|
{
|
|
10374
10491
|
ref: pointsTextInputRef,
|
|
@@ -10381,7 +10498,7 @@ function FillInTheBlankQuestionSettings(props) {
|
|
|
10381
10498
|
label: "Points Per Space",
|
|
10382
10499
|
onChange: (value) => {
|
|
10383
10500
|
editor.update(() => {
|
|
10384
|
-
const targetNode = (0,
|
|
10501
|
+
const targetNode = (0, import_lexical64.$getNodeByKey)(nodeKey);
|
|
10385
10502
|
if (targetNode && $isFillInTheBlankQuestionNode(targetNode)) {
|
|
10386
10503
|
try {
|
|
10387
10504
|
validatePointsInput(value);
|
|
@@ -10398,8 +10515,8 @@ function FillInTheBlankQuestionSettings(props) {
|
|
|
10398
10515
|
}
|
|
10399
10516
|
|
|
10400
10517
|
// src/plugins/FillInTheBlankQuestionPlugin/FillInTheBlankQuestionPlugin.tsx
|
|
10401
|
-
var
|
|
10402
|
-
var INSERT_FILL_IN_THE_BLANK_QUESTION_COMMAND = (0,
|
|
10518
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
10519
|
+
var INSERT_FILL_IN_THE_BLANK_QUESTION_COMMAND = (0, import_lexical65.createCommand)("INSERT_FILL_IN_THE_BLANK_QUESTION_COMMAND");
|
|
10403
10520
|
function FillInTheBlankQuestionPlugin() {
|
|
10404
10521
|
const {
|
|
10405
10522
|
registerSettingsPanel,
|
|
@@ -10423,7 +10540,7 @@ function FillInTheBlankQuestionPlugin() {
|
|
|
10423
10540
|
let serializedData;
|
|
10424
10541
|
activeEditor.update(
|
|
10425
10542
|
() => {
|
|
10426
|
-
const targetNode = (0,
|
|
10543
|
+
const targetNode = (0, import_lexical65.$getNodeByKey)(nodeKey);
|
|
10427
10544
|
if (targetNode) {
|
|
10428
10545
|
const textNode = $extractSelectionNode();
|
|
10429
10546
|
if (textNode) {
|
|
@@ -10433,7 +10550,7 @@ function FillInTheBlankQuestionPlugin() {
|
|
|
10433
10550
|
}
|
|
10434
10551
|
fillInTheBlankNode = $createFillInTheBlankQuestionNode(1);
|
|
10435
10552
|
if (tableNodeKey) {
|
|
10436
|
-
const foundTableNode = (0,
|
|
10553
|
+
const foundTableNode = (0, import_lexical65.$getNodeByKey)(tableNodeKey);
|
|
10437
10554
|
if ((0, import_table13.$isTableNode)(foundTableNode)) {
|
|
10438
10555
|
nodeSerialized = exportNodeToJSON(foundTableNode);
|
|
10439
10556
|
serializedData = JSON.stringify(nodeSerialized);
|
|
@@ -10446,9 +10563,9 @@ function FillInTheBlankQuestionPlugin() {
|
|
|
10446
10563
|
targetNode.selectStart();
|
|
10447
10564
|
targetNode.insertAfter(fillInTheBlankNode);
|
|
10448
10565
|
}
|
|
10449
|
-
const selection = (0,
|
|
10566
|
+
const selection = (0, import_lexical65.$createNodeSelection)();
|
|
10450
10567
|
selection.add(fillInTheBlankNode.getKey());
|
|
10451
|
-
(0,
|
|
10568
|
+
(0, import_lexical65.$setSelection)(selection);
|
|
10452
10569
|
targetNode.remove();
|
|
10453
10570
|
}
|
|
10454
10571
|
},
|
|
@@ -10456,10 +10573,10 @@ function FillInTheBlankQuestionPlugin() {
|
|
|
10456
10573
|
onUpdate: () => {
|
|
10457
10574
|
if (fillInTheBlankNode) {
|
|
10458
10575
|
fillInTheBlankNode.__content.update(() => {
|
|
10459
|
-
const root = (0,
|
|
10576
|
+
const root = (0, import_lexical65.$getRoot)();
|
|
10460
10577
|
if (serializedData) {
|
|
10461
10578
|
const nodeSerialized2 = JSON.parse(serializedData);
|
|
10462
|
-
const newNode = (0,
|
|
10579
|
+
const newNode = (0, import_lexical65.$parseSerializedNode)(nodeSerialized2);
|
|
10463
10580
|
root.append(newNode);
|
|
10464
10581
|
newNode.selectStart();
|
|
10465
10582
|
}
|
|
@@ -10472,7 +10589,7 @@ function FillInTheBlankQuestionPlugin() {
|
|
|
10472
10589
|
let fillInTheBlankNode = void 0;
|
|
10473
10590
|
activeEditor.update(
|
|
10474
10591
|
() => {
|
|
10475
|
-
const targetNode = (0,
|
|
10592
|
+
const targetNode = (0, import_lexical65.$getNodeByKey)(nodeKey);
|
|
10476
10593
|
if (targetNode) {
|
|
10477
10594
|
fillInTheBlankNode = $createFillInTheBlankQuestionNode(1);
|
|
10478
10595
|
if (insertionMode === "replace") {
|
|
@@ -10482,18 +10599,18 @@ function FillInTheBlankQuestionPlugin() {
|
|
|
10482
10599
|
} else if (insertionMode === "before") {
|
|
10483
10600
|
targetNode.insertBefore(fillInTheBlankNode);
|
|
10484
10601
|
}
|
|
10485
|
-
const selection = (0,
|
|
10602
|
+
const selection = (0, import_lexical65.$createNodeSelection)();
|
|
10486
10603
|
selection.add(fillInTheBlankNode.getKey());
|
|
10487
|
-
(0,
|
|
10604
|
+
(0, import_lexical65.$setSelection)(selection);
|
|
10488
10605
|
}
|
|
10489
10606
|
},
|
|
10490
10607
|
{
|
|
10491
10608
|
onUpdate: () => {
|
|
10492
10609
|
fillInTheBlankNode?.__content.update(() => {
|
|
10493
|
-
const root = (0,
|
|
10610
|
+
const root = (0, import_lexical65.$getRoot)();
|
|
10494
10611
|
let firstChild = root.getFirstChild();
|
|
10495
10612
|
if (!firstChild) {
|
|
10496
|
-
firstChild = (0,
|
|
10613
|
+
firstChild = (0, import_lexical65.$createParagraphNode)();
|
|
10497
10614
|
root.append(firstChild);
|
|
10498
10615
|
}
|
|
10499
10616
|
firstChild.selectStart();
|
|
@@ -10506,7 +10623,7 @@ function FillInTheBlankQuestionPlugin() {
|
|
|
10506
10623
|
}
|
|
10507
10624
|
return true;
|
|
10508
10625
|
},
|
|
10509
|
-
|
|
10626
|
+
import_lexical65.COMMAND_PRIORITY_EDITOR
|
|
10510
10627
|
)
|
|
10511
10628
|
);
|
|
10512
10629
|
}, [editor]);
|
|
@@ -10520,20 +10637,20 @@ function FillInTheBlankQuestionPlugin() {
|
|
|
10520
10637
|
}
|
|
10521
10638
|
}
|
|
10522
10639
|
}, [isBlockEditorReady]);
|
|
10523
|
-
return /* @__PURE__ */ (0,
|
|
10640
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_jsx_runtime94.Fragment, { children: drawer && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
10524
10641
|
StickyToPosition,
|
|
10525
10642
|
{
|
|
10526
10643
|
ref: settingsPanelStickyRef,
|
|
10527
10644
|
container: drawer,
|
|
10528
10645
|
children: (data, position, isVisible) => {
|
|
10529
|
-
return /* @__PURE__ */ (0,
|
|
10646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { style: { width: position.width }, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
10530
10647
|
SettingsCard,
|
|
10531
10648
|
{
|
|
10532
10649
|
isVisible: !!isVisible,
|
|
10533
10650
|
container: drawer,
|
|
10534
10651
|
title: "Fill In The Blank Settings",
|
|
10535
10652
|
onClose: toggleSettingsPanelSwitch,
|
|
10536
|
-
children: /* @__PURE__ */ (0,
|
|
10653
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
10537
10654
|
FillInTheBlankQuestionSettings,
|
|
10538
10655
|
{
|
|
10539
10656
|
nodeKey: data.nodeKey
|
|
@@ -10550,12 +10667,12 @@ function FillInTheBlankQuestionPlugin() {
|
|
|
10550
10667
|
// src/plugins/JournalEntryQuestionPlugin/JournalEntryQuestionPlugin.tsx
|
|
10551
10668
|
var import_LexicalComposerContext50 = require("@lexical/react/LexicalComposerContext");
|
|
10552
10669
|
var import_utils18 = require("@lexical/utils");
|
|
10553
|
-
var
|
|
10670
|
+
var import_lexical67 = require("lexical");
|
|
10554
10671
|
var import_react71 = require("react");
|
|
10555
10672
|
|
|
10556
10673
|
// src/plugins/JournalEntryQuestionPlugin/JournalEntryQuestionSettings.tsx
|
|
10557
10674
|
var import_LexicalComposerContext49 = require("@lexical/react/LexicalComposerContext");
|
|
10558
|
-
var
|
|
10675
|
+
var import_lexical66 = require("lexical");
|
|
10559
10676
|
var import_react70 = require("react");
|
|
10560
10677
|
|
|
10561
10678
|
// src/plugins/JournalEntryQuestionPlugin/validateErrorTolerancelnput.ts
|
|
@@ -10597,7 +10714,7 @@ function validatePointsInput2(input) {
|
|
|
10597
10714
|
}
|
|
10598
10715
|
|
|
10599
10716
|
// src/plugins/JournalEntryQuestionPlugin/JournalEntryQuestionSettings.tsx
|
|
10600
|
-
var
|
|
10717
|
+
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
10601
10718
|
function JournalEntryQuestionSettings(props) {
|
|
10602
10719
|
const { nodeKey } = props;
|
|
10603
10720
|
const [editor] = (0, import_LexicalComposerContext49.useLexicalComposerContext)();
|
|
@@ -10608,7 +10725,7 @@ function JournalEntryQuestionSettings(props) {
|
|
|
10608
10725
|
(0, import_react70.useEffect)(() => {
|
|
10609
10726
|
if (nodeKey) {
|
|
10610
10727
|
editor.getEditorState().read(() => {
|
|
10611
|
-
const journalEntryNode = (0,
|
|
10728
|
+
const journalEntryNode = (0, import_lexical66.$getNodeByKey)(nodeKey);
|
|
10612
10729
|
if (journalEntryNode && $isJournalEntryQuestionNode(journalEntryNode)) {
|
|
10613
10730
|
setFoundNode(journalEntryNode);
|
|
10614
10731
|
}
|
|
@@ -10623,7 +10740,7 @@ function JournalEntryQuestionSettings(props) {
|
|
|
10623
10740
|
const mutation = nodeMutations.get(nodeKey);
|
|
10624
10741
|
if (mutation === "updated") {
|
|
10625
10742
|
editor.getEditorState().read(() => {
|
|
10626
|
-
const questionNode = (0,
|
|
10743
|
+
const questionNode = (0, import_lexical66.$getNodeByKey)(nodeKey);
|
|
10627
10744
|
if ($isJournalEntryQuestionNode(questionNode)) {
|
|
10628
10745
|
noEntryRequiredCheckboxRef.current?.setChecked(
|
|
10629
10746
|
questionNode.getNoEntryRequired()
|
|
@@ -10641,8 +10758,8 @@ function JournalEntryQuestionSettings(props) {
|
|
|
10641
10758
|
if (!foundNode) {
|
|
10642
10759
|
return null;
|
|
10643
10760
|
}
|
|
10644
|
-
return /* @__PURE__ */ (0,
|
|
10645
|
-
/* @__PURE__ */ (0,
|
|
10761
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(import_jsx_runtime95.Fragment, { children: [
|
|
10762
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
10646
10763
|
TextInput,
|
|
10647
10764
|
{
|
|
10648
10765
|
ref: pointsTextInputRef,
|
|
@@ -10655,7 +10772,7 @@ function JournalEntryQuestionSettings(props) {
|
|
|
10655
10772
|
label: "Points",
|
|
10656
10773
|
onChange: (value) => {
|
|
10657
10774
|
editor.update(() => {
|
|
10658
|
-
const targetNode = (0,
|
|
10775
|
+
const targetNode = (0, import_lexical66.$getNodeByKey)(nodeKey);
|
|
10659
10776
|
if (targetNode && $isJournalEntryQuestionNode(targetNode)) {
|
|
10660
10777
|
try {
|
|
10661
10778
|
validatePointsInput2(value);
|
|
@@ -10669,7 +10786,7 @@ function JournalEntryQuestionSettings(props) {
|
|
|
10669
10786
|
}
|
|
10670
10787
|
}
|
|
10671
10788
|
) }),
|
|
10672
|
-
/* @__PURE__ */ (0,
|
|
10789
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
10673
10790
|
TextInput,
|
|
10674
10791
|
{
|
|
10675
10792
|
ref: errorToleranceTextInputRef,
|
|
@@ -10682,7 +10799,7 @@ function JournalEntryQuestionSettings(props) {
|
|
|
10682
10799
|
label: "Error Tolerance (%)",
|
|
10683
10800
|
onChange: (value) => {
|
|
10684
10801
|
editor.update(() => {
|
|
10685
|
-
const targetNode = (0,
|
|
10802
|
+
const targetNode = (0, import_lexical66.$getNodeByKey)(nodeKey);
|
|
10686
10803
|
if (targetNode && $isJournalEntryQuestionNode(targetNode)) {
|
|
10687
10804
|
try {
|
|
10688
10805
|
validateErrorTolerance2(value);
|
|
@@ -10700,7 +10817,7 @@ function JournalEntryQuestionSettings(props) {
|
|
|
10700
10817
|
}
|
|
10701
10818
|
}
|
|
10702
10819
|
) }),
|
|
10703
|
-
/* @__PURE__ */ (0,
|
|
10820
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
10704
10821
|
Checkbox,
|
|
10705
10822
|
{
|
|
10706
10823
|
ref: noEntryRequiredCheckboxRef,
|
|
@@ -10710,7 +10827,7 @@ function JournalEntryQuestionSettings(props) {
|
|
|
10710
10827
|
checked: foundNode.getNoEntryRequired(),
|
|
10711
10828
|
onChange: (checked) => {
|
|
10712
10829
|
editor.update(() => {
|
|
10713
|
-
const targetNode = (0,
|
|
10830
|
+
const targetNode = (0, import_lexical66.$getNodeByKey)(nodeKey);
|
|
10714
10831
|
if (targetNode && $isJournalEntryQuestionNode(targetNode)) {
|
|
10715
10832
|
targetNode.setNoEntryRequired(checked);
|
|
10716
10833
|
}
|
|
@@ -10722,8 +10839,8 @@ function JournalEntryQuestionSettings(props) {
|
|
|
10722
10839
|
}
|
|
10723
10840
|
|
|
10724
10841
|
// src/plugins/JournalEntryQuestionPlugin/JournalEntryQuestionPlugin.tsx
|
|
10725
|
-
var
|
|
10726
|
-
var INSERT_JOURNAL_ENTRY_QUESTION_COMMAND = (0,
|
|
10842
|
+
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
10843
|
+
var INSERT_JOURNAL_ENTRY_QUESTION_COMMAND = (0, import_lexical67.createCommand)("INSERT_JOURNAL_ENTRY_QUESTION_COMMAND");
|
|
10727
10844
|
function JournalEntryQuestionPlugin() {
|
|
10728
10845
|
const {
|
|
10729
10846
|
registerSettingsPanel,
|
|
@@ -10744,9 +10861,9 @@ function JournalEntryQuestionPlugin() {
|
|
|
10744
10861
|
let journalEntryNodeKey = void 0;
|
|
10745
10862
|
activeEditor.update(
|
|
10746
10863
|
() => {
|
|
10747
|
-
const targetNode = (0,
|
|
10864
|
+
const targetNode = (0, import_lexical67.$getNodeByKey)(nodeKey);
|
|
10748
10865
|
if (targetNode) {
|
|
10749
|
-
const journalEntryNode = $createJournalEntryQuestionNode(1);
|
|
10866
|
+
const journalEntryNode = $createJournalEntryQuestionNode(1, false, 0.1);
|
|
10750
10867
|
if (insertionMode === "replace") {
|
|
10751
10868
|
targetNode.replace(journalEntryNode);
|
|
10752
10869
|
} else if (insertionMode === "after") {
|
|
@@ -10755,16 +10872,16 @@ function JournalEntryQuestionPlugin() {
|
|
|
10755
10872
|
targetNode.insertBefore(journalEntryNode);
|
|
10756
10873
|
}
|
|
10757
10874
|
journalEntryNodeKey = journalEntryNode.getKey();
|
|
10758
|
-
const selection = (0,
|
|
10875
|
+
const selection = (0, import_lexical67.$createNodeSelection)();
|
|
10759
10876
|
selection.add(journalEntryNodeKey);
|
|
10760
|
-
(0,
|
|
10877
|
+
(0, import_lexical67.$setSelection)(selection);
|
|
10761
10878
|
}
|
|
10762
10879
|
},
|
|
10763
10880
|
{
|
|
10764
10881
|
onUpdate: () => {
|
|
10765
10882
|
activeEditor.getEditorState().read(() => {
|
|
10766
10883
|
if (journalEntryNodeKey) {
|
|
10767
|
-
const journalEntryNode = (0,
|
|
10884
|
+
const journalEntryNode = (0, import_lexical67.$getNodeByKey)(
|
|
10768
10885
|
journalEntryNodeKey
|
|
10769
10886
|
);
|
|
10770
10887
|
if ($isJournalEntryQuestionNode(
|
|
@@ -10773,10 +10890,10 @@ function JournalEntryQuestionPlugin() {
|
|
|
10773
10890
|
let index = 0;
|
|
10774
10891
|
for (const questionItem of journalEntryNode.__lineItems) {
|
|
10775
10892
|
questionItem.account.update(() => {
|
|
10776
|
-
const root = (0,
|
|
10893
|
+
const root = (0, import_lexical67.$getRoot)();
|
|
10777
10894
|
let firstChild = root.getFirstChild();
|
|
10778
10895
|
if (!firstChild) {
|
|
10779
|
-
firstChild = (0,
|
|
10896
|
+
firstChild = (0, import_lexical67.$createParagraphNode)();
|
|
10780
10897
|
root.append(firstChild);
|
|
10781
10898
|
}
|
|
10782
10899
|
if (index === 0) {
|
|
@@ -10785,20 +10902,20 @@ function JournalEntryQuestionPlugin() {
|
|
|
10785
10902
|
});
|
|
10786
10903
|
if (questionItem.debit) {
|
|
10787
10904
|
questionItem.debit.update(() => {
|
|
10788
|
-
const root = (0,
|
|
10905
|
+
const root = (0, import_lexical67.$getRoot)();
|
|
10789
10906
|
let firstChild = root.getFirstChild();
|
|
10790
10907
|
if (!firstChild) {
|
|
10791
|
-
firstChild = (0,
|
|
10908
|
+
firstChild = (0, import_lexical67.$createParagraphNode)();
|
|
10792
10909
|
root.append(firstChild);
|
|
10793
10910
|
}
|
|
10794
10911
|
});
|
|
10795
10912
|
}
|
|
10796
10913
|
if (questionItem.credit) {
|
|
10797
10914
|
questionItem.credit.update(() => {
|
|
10798
|
-
const root = (0,
|
|
10915
|
+
const root = (0, import_lexical67.$getRoot)();
|
|
10799
10916
|
let firstChild = root.getFirstChild();
|
|
10800
10917
|
if (!firstChild) {
|
|
10801
|
-
firstChild = (0,
|
|
10918
|
+
firstChild = (0, import_lexical67.$createParagraphNode)();
|
|
10802
10919
|
root.append(firstChild);
|
|
10803
10920
|
}
|
|
10804
10921
|
});
|
|
@@ -10815,7 +10932,7 @@ function JournalEntryQuestionPlugin() {
|
|
|
10815
10932
|
}
|
|
10816
10933
|
return true;
|
|
10817
10934
|
},
|
|
10818
|
-
|
|
10935
|
+
import_lexical67.COMMAND_PRIORITY_EDITOR
|
|
10819
10936
|
)
|
|
10820
10937
|
);
|
|
10821
10938
|
}, [editor]);
|
|
@@ -10827,20 +10944,20 @@ function JournalEntryQuestionPlugin() {
|
|
|
10827
10944
|
);
|
|
10828
10945
|
}
|
|
10829
10946
|
}, [isBlockEditorReady]);
|
|
10830
|
-
return /* @__PURE__ */ (0,
|
|
10947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_jsx_runtime96.Fragment, { children: drawer && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
10831
10948
|
StickyToPosition,
|
|
10832
10949
|
{
|
|
10833
10950
|
ref: settingsPanelStickyRef,
|
|
10834
10951
|
container: drawer,
|
|
10835
10952
|
children: (data, position, isVisible) => {
|
|
10836
|
-
return /* @__PURE__ */ (0,
|
|
10953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { style: { width: position.width }, children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
10837
10954
|
SettingsCard,
|
|
10838
10955
|
{
|
|
10839
10956
|
isVisible: !!isVisible,
|
|
10840
10957
|
container: drawer,
|
|
10841
10958
|
title: "Journal Entry Settings",
|
|
10842
10959
|
onClose: toggleSettingsPanelSwitch,
|
|
10843
|
-
children: isVisible && /* @__PURE__ */ (0,
|
|
10960
|
+
children: isVisible && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
10844
10961
|
JournalEntryQuestionSettings,
|
|
10845
10962
|
{
|
|
10846
10963
|
nodeKey: data.nodeKey
|
|
@@ -10855,7 +10972,7 @@ function JournalEntryQuestionPlugin() {
|
|
|
10855
10972
|
|
|
10856
10973
|
// src/plugins/MatchingQuestionPlugin/MatchingQuestionSettings.tsx
|
|
10857
10974
|
var import_LexicalComposerContext51 = require("@lexical/react/LexicalComposerContext");
|
|
10858
|
-
var
|
|
10975
|
+
var import_lexical68 = require("lexical");
|
|
10859
10976
|
var import_react72 = require("react");
|
|
10860
10977
|
|
|
10861
10978
|
// src/plugins/MatchingQuestionPlugin/validatePointslnput.ts
|
|
@@ -10878,7 +10995,7 @@ function validatePointsInput3(input) {
|
|
|
10878
10995
|
}
|
|
10879
10996
|
|
|
10880
10997
|
// src/plugins/MatchingQuestionPlugin/MatchingQuestionSettings.tsx
|
|
10881
|
-
var
|
|
10998
|
+
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
10882
10999
|
function MatchingQuestionSettings(props) {
|
|
10883
11000
|
const { nodeKey } = props;
|
|
10884
11001
|
const [editor] = (0, import_LexicalComposerContext51.useLexicalComposerContext)();
|
|
@@ -10887,7 +11004,7 @@ function MatchingQuestionSettings(props) {
|
|
|
10887
11004
|
(0, import_react72.useEffect)(() => {
|
|
10888
11005
|
if (nodeKey) {
|
|
10889
11006
|
editor.getEditorState().read(() => {
|
|
10890
|
-
const matchingQuestionNode = (0,
|
|
11007
|
+
const matchingQuestionNode = (0, import_lexical68.$getNodeByKey)(nodeKey);
|
|
10891
11008
|
if (matchingQuestionNode && $isMatchingQuestionNode(matchingQuestionNode)) {
|
|
10892
11009
|
setFoundNode(matchingQuestionNode);
|
|
10893
11010
|
}
|
|
@@ -10897,7 +11014,7 @@ function MatchingQuestionSettings(props) {
|
|
|
10897
11014
|
if (!foundNode) {
|
|
10898
11015
|
return null;
|
|
10899
11016
|
}
|
|
10900
|
-
return /* @__PURE__ */ (0,
|
|
11017
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
10901
11018
|
TextInput,
|
|
10902
11019
|
{
|
|
10903
11020
|
ref: pointsTextInputRef,
|
|
@@ -10910,7 +11027,7 @@ function MatchingQuestionSettings(props) {
|
|
|
10910
11027
|
label: "Points Per Match",
|
|
10911
11028
|
onChange: (value) => {
|
|
10912
11029
|
editor.update(() => {
|
|
10913
|
-
const targetNode = (0,
|
|
11030
|
+
const targetNode = (0, import_lexical68.$getNodeByKey)(nodeKey);
|
|
10914
11031
|
if (targetNode && $isMatchingQuestionNode(targetNode)) {
|
|
10915
11032
|
try {
|
|
10916
11033
|
validatePointsInput3(value);
|
|
@@ -10929,10 +11046,10 @@ function MatchingQuestionSettings(props) {
|
|
|
10929
11046
|
// src/plugins/MatchingQuestionPlugin/MatchingQuestionPlugin.tsx
|
|
10930
11047
|
var import_LexicalComposerContext52 = require("@lexical/react/LexicalComposerContext");
|
|
10931
11048
|
var import_utils19 = require("@lexical/utils");
|
|
10932
|
-
var
|
|
11049
|
+
var import_lexical69 = require("lexical");
|
|
10933
11050
|
var import_react73 = require("react");
|
|
10934
|
-
var
|
|
10935
|
-
var INSERT_MATCHING_QUESTION_COMMAND = (0,
|
|
11051
|
+
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
11052
|
+
var INSERT_MATCHING_QUESTION_COMMAND = (0, import_lexical69.createCommand)("INSERT_MATCHING_QUESTION_COMMAND");
|
|
10936
11053
|
function MatchingQuestionPlugin() {
|
|
10937
11054
|
const {
|
|
10938
11055
|
registerSettingsPanel,
|
|
@@ -10951,7 +11068,7 @@ function MatchingQuestionPlugin() {
|
|
|
10951
11068
|
const { nodeKey, insertionMode } = payload;
|
|
10952
11069
|
if (activeEditor === editor && nodeKey) {
|
|
10953
11070
|
activeEditor.update(() => {
|
|
10954
|
-
const targetNode = (0,
|
|
11071
|
+
const targetNode = (0, import_lexical69.$getNodeByKey)(nodeKey);
|
|
10955
11072
|
if (targetNode) {
|
|
10956
11073
|
const matchingQuestionNode = $createMatchingQuestionNode(1);
|
|
10957
11074
|
if (insertionMode === "replace") {
|
|
@@ -10961,18 +11078,18 @@ function MatchingQuestionPlugin() {
|
|
|
10961
11078
|
} else if (insertionMode === "before") {
|
|
10962
11079
|
targetNode.insertBefore(matchingQuestionNode);
|
|
10963
11080
|
}
|
|
10964
|
-
const selection = (0,
|
|
11081
|
+
const selection = (0, import_lexical69.$createNodeSelection)();
|
|
10965
11082
|
selection.add(matchingQuestionNode.getKey());
|
|
10966
|
-
(0,
|
|
11083
|
+
(0, import_lexical69.$setSelection)(selection);
|
|
10967
11084
|
setTimeout(() => {
|
|
10968
11085
|
let index = 0;
|
|
10969
11086
|
for (const questionItem of matchingQuestionNode.__items) {
|
|
10970
11087
|
if (questionItem.itemPremiseContent) {
|
|
10971
11088
|
questionItem.itemPremiseContent.update(() => {
|
|
10972
|
-
const root = (0,
|
|
11089
|
+
const root = (0, import_lexical69.$getRoot)();
|
|
10973
11090
|
let firstChild = root.getFirstChild();
|
|
10974
11091
|
if (!firstChild) {
|
|
10975
|
-
firstChild = (0,
|
|
11092
|
+
firstChild = (0, import_lexical69.$createParagraphNode)();
|
|
10976
11093
|
root.append(firstChild);
|
|
10977
11094
|
}
|
|
10978
11095
|
if (index === 0) {
|
|
@@ -10981,10 +11098,10 @@ function MatchingQuestionPlugin() {
|
|
|
10981
11098
|
});
|
|
10982
11099
|
}
|
|
10983
11100
|
questionItem.itemOptionContent.update(() => {
|
|
10984
|
-
const root = (0,
|
|
11101
|
+
const root = (0, import_lexical69.$getRoot)();
|
|
10985
11102
|
let firstChild = root.getFirstChild();
|
|
10986
11103
|
if (!firstChild) {
|
|
10987
|
-
firstChild = (0,
|
|
11104
|
+
firstChild = (0, import_lexical69.$createParagraphNode)();
|
|
10988
11105
|
root.append(firstChild);
|
|
10989
11106
|
}
|
|
10990
11107
|
});
|
|
@@ -10997,7 +11114,7 @@ function MatchingQuestionPlugin() {
|
|
|
10997
11114
|
}
|
|
10998
11115
|
return true;
|
|
10999
11116
|
},
|
|
11000
|
-
|
|
11117
|
+
import_lexical69.COMMAND_PRIORITY_EDITOR
|
|
11001
11118
|
)
|
|
11002
11119
|
);
|
|
11003
11120
|
}, [editor]);
|
|
@@ -11009,20 +11126,20 @@ function MatchingQuestionPlugin() {
|
|
|
11009
11126
|
);
|
|
11010
11127
|
}
|
|
11011
11128
|
}, [isBlockEditorReady]);
|
|
11012
|
-
return /* @__PURE__ */ (0,
|
|
11129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_jsx_runtime98.Fragment, { children: drawer && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
11013
11130
|
StickyToPosition,
|
|
11014
11131
|
{
|
|
11015
11132
|
ref: settingsPanelStickyRef,
|
|
11016
11133
|
container: drawer,
|
|
11017
11134
|
children: (data, position, isVisible) => {
|
|
11018
|
-
return /* @__PURE__ */ (0,
|
|
11135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { style: { width: position.width }, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
11019
11136
|
SettingsCard,
|
|
11020
11137
|
{
|
|
11021
11138
|
isVisible: !!isVisible,
|
|
11022
11139
|
container: drawer,
|
|
11023
11140
|
title: "Matching Settings",
|
|
11024
11141
|
onClose: toggleSettingsPanelSwitch,
|
|
11025
|
-
children: isVisible && /* @__PURE__ */ (0,
|
|
11142
|
+
children: isVisible && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
11026
11143
|
MatchingQuestionSettings,
|
|
11027
11144
|
{
|
|
11028
11145
|
nodeKey: data.nodeKey
|
|
@@ -11074,12 +11191,12 @@ function traverseListItemNodes(rootNode, cb) {
|
|
|
11074
11191
|
var import_list4 = require("@lexical/list");
|
|
11075
11192
|
var import_LexicalComposerContext54 = require("@lexical/react/LexicalComposerContext");
|
|
11076
11193
|
var import_utils20 = require("@lexical/utils");
|
|
11077
|
-
var
|
|
11194
|
+
var import_lexical71 = require("lexical");
|
|
11078
11195
|
var import_react75 = require("react");
|
|
11079
11196
|
|
|
11080
11197
|
// src/plugins/MultipleOptionQuestionPlugin/MultipleOptionQuestionSettings.tsx
|
|
11081
11198
|
var import_LexicalComposerContext53 = require("@lexical/react/LexicalComposerContext");
|
|
11082
|
-
var
|
|
11199
|
+
var import_lexical70 = require("lexical");
|
|
11083
11200
|
var import_react74 = require("react");
|
|
11084
11201
|
|
|
11085
11202
|
// src/plugins/MultipleOptionQuestionPlugin/validateChoicesInput.ts
|
|
@@ -11124,7 +11241,7 @@ function validatePointsInput4(input) {
|
|
|
11124
11241
|
}
|
|
11125
11242
|
|
|
11126
11243
|
// src/plugins/MultipleOptionQuestionPlugin/MultipleOptionQuestionSettings.tsx
|
|
11127
|
-
var
|
|
11244
|
+
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
11128
11245
|
function MultipleOptionQuestionSettings(props) {
|
|
11129
11246
|
const { nodeKey, questionType } = props;
|
|
11130
11247
|
const [editor] = (0, import_LexicalComposerContext53.useLexicalComposerContext)();
|
|
@@ -11138,7 +11255,7 @@ function MultipleOptionQuestionSettings(props) {
|
|
|
11138
11255
|
(0, import_react74.useEffect)(() => {
|
|
11139
11256
|
if (nodeKey) {
|
|
11140
11257
|
editor.getEditorState().read(() => {
|
|
11141
|
-
const optionsQuestionNode = (0,
|
|
11258
|
+
const optionsQuestionNode = (0, import_lexical70.$getNodeByKey)(nodeKey);
|
|
11142
11259
|
if (optionsQuestionNode && $isMultipleOptionQuestionNode(optionsQuestionNode)) {
|
|
11143
11260
|
setFoundNodeRef(optionsQuestionNode);
|
|
11144
11261
|
}
|
|
@@ -11153,7 +11270,7 @@ function MultipleOptionQuestionSettings(props) {
|
|
|
11153
11270
|
const mutation = nodeMutations.get(nodeKey);
|
|
11154
11271
|
if (mutation === "updated") {
|
|
11155
11272
|
editor.getEditorState().read(() => {
|
|
11156
|
-
const optionsQuestionNode = (0,
|
|
11273
|
+
const optionsQuestionNode = (0, import_lexical70.$getNodeByKey)(nodeKey);
|
|
11157
11274
|
if ($isMultipleOptionQuestionNode(optionsQuestionNode)) {
|
|
11158
11275
|
noneOfTheAboveInputRef.current?.setChecked(
|
|
11159
11276
|
!!optionsQuestionNode.getNoneOfTheAbove()
|
|
@@ -11171,7 +11288,7 @@ function MultipleOptionQuestionSettings(props) {
|
|
|
11171
11288
|
const handlePointsChange = (0, import_react74.useCallback)(
|
|
11172
11289
|
(value) => {
|
|
11173
11290
|
editor.update(() => {
|
|
11174
|
-
const targetNode = (0,
|
|
11291
|
+
const targetNode = (0, import_lexical70.$getNodeByKey)(nodeKey);
|
|
11175
11292
|
if (targetNode && $isMultipleOptionQuestionNode(targetNode)) {
|
|
11176
11293
|
try {
|
|
11177
11294
|
validatePointsInput4(value);
|
|
@@ -11188,7 +11305,7 @@ function MultipleOptionQuestionSettings(props) {
|
|
|
11188
11305
|
const handleGradingChange = (0, import_react74.useCallback)(
|
|
11189
11306
|
(value) => {
|
|
11190
11307
|
editor.update(() => {
|
|
11191
|
-
const targetNode = (0,
|
|
11308
|
+
const targetNode = (0, import_lexical70.$getNodeByKey)(nodeKey);
|
|
11192
11309
|
if (targetNode && $isMultipleOptionQuestionNode(targetNode)) {
|
|
11193
11310
|
targetNode.setGrading(value);
|
|
11194
11311
|
}
|
|
@@ -11199,7 +11316,7 @@ function MultipleOptionQuestionSettings(props) {
|
|
|
11199
11316
|
const handleCorrectChoicesChange = (0, import_react74.useCallback)(
|
|
11200
11317
|
(value) => {
|
|
11201
11318
|
editor.update(() => {
|
|
11202
|
-
const targetNode = (0,
|
|
11319
|
+
const targetNode = (0, import_lexical70.$getNodeByKey)(nodeKey);
|
|
11203
11320
|
if (targetNode && $isMultipleOptionQuestionNode(targetNode)) {
|
|
11204
11321
|
try {
|
|
11205
11322
|
validateChoicesInput(value, 0);
|
|
@@ -11220,7 +11337,7 @@ function MultipleOptionQuestionSettings(props) {
|
|
|
11220
11337
|
const handleIncorrectChoicesChange = (0, import_react74.useCallback)(
|
|
11221
11338
|
(value) => {
|
|
11222
11339
|
editor.update(() => {
|
|
11223
|
-
const targetNode = (0,
|
|
11340
|
+
const targetNode = (0, import_lexical70.$getNodeByKey)(nodeKey);
|
|
11224
11341
|
if (targetNode && $isMultipleOptionQuestionNode(targetNode)) {
|
|
11225
11342
|
try {
|
|
11226
11343
|
validateChoicesInput(value, 0);
|
|
@@ -11241,7 +11358,7 @@ function MultipleOptionQuestionSettings(props) {
|
|
|
11241
11358
|
const handleChoicesChange = (0, import_react74.useCallback)(
|
|
11242
11359
|
(value) => {
|
|
11243
11360
|
editor.update(() => {
|
|
11244
|
-
const targetNode = (0,
|
|
11361
|
+
const targetNode = (0, import_lexical70.$getNodeByKey)(nodeKey);
|
|
11245
11362
|
if (targetNode && $isMultipleOptionQuestionNode(targetNode)) {
|
|
11246
11363
|
try {
|
|
11247
11364
|
validateChoicesInput(value, 1);
|
|
@@ -11262,7 +11379,7 @@ function MultipleOptionQuestionSettings(props) {
|
|
|
11262
11379
|
const handleNoneOfTheAboveChange = (0, import_react74.useCallback)(
|
|
11263
11380
|
(checked) => {
|
|
11264
11381
|
editor.update(() => {
|
|
11265
|
-
const targetNode = (0,
|
|
11382
|
+
const targetNode = (0, import_lexical70.$getNodeByKey)(nodeKey);
|
|
11266
11383
|
if (targetNode && $isMultipleOptionQuestionNode(targetNode)) {
|
|
11267
11384
|
targetNode.setNoneOfTheAbove(checked);
|
|
11268
11385
|
}
|
|
@@ -11273,8 +11390,8 @@ function MultipleOptionQuestionSettings(props) {
|
|
|
11273
11390
|
if (!foundNodeRef) {
|
|
11274
11391
|
return null;
|
|
11275
11392
|
}
|
|
11276
|
-
return /* @__PURE__ */ (0,
|
|
11277
|
-
/* @__PURE__ */ (0,
|
|
11393
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(import_jsx_runtime99.Fragment, { children: [
|
|
11394
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
11278
11395
|
TextInput,
|
|
11279
11396
|
{
|
|
11280
11397
|
ref: pointsTextInputRef,
|
|
@@ -11289,7 +11406,7 @@ function MultipleOptionQuestionSettings(props) {
|
|
|
11289
11406
|
},
|
|
11290
11407
|
`points_${nodeKey}`
|
|
11291
11408
|
) }),
|
|
11292
|
-
questionType === "multiple-answers" && /* @__PURE__ */ (0,
|
|
11409
|
+
questionType === "multiple-answers" && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
11293
11410
|
RadioGroup,
|
|
11294
11411
|
{
|
|
11295
11412
|
ref: gradingRadioGroupRef,
|
|
@@ -11310,7 +11427,7 @@ function MultipleOptionQuestionSettings(props) {
|
|
|
11310
11427
|
},
|
|
11311
11428
|
`grading_${nodeKey}`
|
|
11312
11429
|
) }),
|
|
11313
|
-
questionType === "multiple-answers" && /* @__PURE__ */ (0,
|
|
11430
|
+
questionType === "multiple-answers" && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
11314
11431
|
TextInput,
|
|
11315
11432
|
{
|
|
11316
11433
|
ref: correctChoicesTextInputRef,
|
|
@@ -11325,7 +11442,7 @@ function MultipleOptionQuestionSettings(props) {
|
|
|
11325
11442
|
},
|
|
11326
11443
|
`correctChoices_${nodeKey}`
|
|
11327
11444
|
) }),
|
|
11328
|
-
questionType === "multiple-answers" && /* @__PURE__ */ (0,
|
|
11445
|
+
questionType === "multiple-answers" && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
11329
11446
|
TextInput,
|
|
11330
11447
|
{
|
|
11331
11448
|
ref: incorrectChoicesTextInputRef,
|
|
@@ -11340,7 +11457,7 @@ function MultipleOptionQuestionSettings(props) {
|
|
|
11340
11457
|
},
|
|
11341
11458
|
`incorrectChoices_${nodeKey}`
|
|
11342
11459
|
) }),
|
|
11343
|
-
questionType === "multiple-choice" && /* @__PURE__ */ (0,
|
|
11460
|
+
questionType === "multiple-choice" && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
11344
11461
|
TextInput,
|
|
11345
11462
|
{
|
|
11346
11463
|
ref: choicesTextInputRef,
|
|
@@ -11355,13 +11472,13 @@ function MultipleOptionQuestionSettings(props) {
|
|
|
11355
11472
|
},
|
|
11356
11473
|
`choices_${nodeKey}`
|
|
11357
11474
|
) }),
|
|
11358
|
-
/* @__PURE__ */ (0,
|
|
11475
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
11359
11476
|
"div",
|
|
11360
11477
|
{
|
|
11361
11478
|
style: {
|
|
11362
11479
|
paddingBottom: "var(--sl-spacing-medium)"
|
|
11363
11480
|
},
|
|
11364
|
-
children: /* @__PURE__ */ (0,
|
|
11481
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
11365
11482
|
Checkbox,
|
|
11366
11483
|
{
|
|
11367
11484
|
ref: noneOfTheAboveInputRef,
|
|
@@ -11379,10 +11496,10 @@ function MultipleOptionQuestionSettings(props) {
|
|
|
11379
11496
|
}
|
|
11380
11497
|
|
|
11381
11498
|
// src/plugins/MultipleOptionQuestionPlugin/MultipleOptionQuestionPlugin.tsx
|
|
11382
|
-
var
|
|
11383
|
-
var INSERT_MULTIPLE_OPTION_QUESTION_COMMAND = (0,
|
|
11384
|
-
var REPLACE_LIST_WITH_MULTIPLE_OPTION_QUESTION_COMMAND = (0,
|
|
11385
|
-
var REPLACE_MULTIPLE_OPTION_QUESTION_COMMAND = (0,
|
|
11499
|
+
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
11500
|
+
var INSERT_MULTIPLE_OPTION_QUESTION_COMMAND = (0, import_lexical71.createCommand)("INSERT_MULTIPLE_OPTION_QUESTION_COMMAND");
|
|
11501
|
+
var REPLACE_LIST_WITH_MULTIPLE_OPTION_QUESTION_COMMAND = (0, import_lexical71.createCommand)("REPLACE_LIST_WITH_MULTIPLE_OPTION_QUESTION_COMMAND");
|
|
11502
|
+
var REPLACE_MULTIPLE_OPTION_QUESTION_COMMAND = (0, import_lexical71.createCommand)("REPLACE_MULTIPLE_OPTION_QUESTION_COMMAND");
|
|
11386
11503
|
function MultipleOptionQuestionPlugin() {
|
|
11387
11504
|
const {
|
|
11388
11505
|
registerSettingsPanel,
|
|
@@ -11403,7 +11520,7 @@ function MultipleOptionQuestionPlugin() {
|
|
|
11403
11520
|
let newNodeKey = void 0;
|
|
11404
11521
|
activeEditor.update(
|
|
11405
11522
|
() => {
|
|
11406
|
-
const targetNode = (0,
|
|
11523
|
+
const targetNode = (0, import_lexical71.$getNodeByKey)(nodeKey);
|
|
11407
11524
|
if (targetNode) {
|
|
11408
11525
|
const optionsQuestionNode = $createMultipleOptionQuestionNode(
|
|
11409
11526
|
questionType,
|
|
@@ -11416,25 +11533,25 @@ function MultipleOptionQuestionPlugin() {
|
|
|
11416
11533
|
} else if (insertionMode === "before") {
|
|
11417
11534
|
targetNode.insertBefore(optionsQuestionNode);
|
|
11418
11535
|
}
|
|
11419
|
-
const selection = (0,
|
|
11536
|
+
const selection = (0, import_lexical71.$createNodeSelection)();
|
|
11420
11537
|
newNodeKey = optionsQuestionNode.getKey();
|
|
11421
11538
|
selection.add(nodeKey);
|
|
11422
|
-
(0,
|
|
11539
|
+
(0, import_lexical71.$setSelection)(selection);
|
|
11423
11540
|
}
|
|
11424
11541
|
},
|
|
11425
11542
|
{
|
|
11426
11543
|
onUpdate: () => {
|
|
11427
11544
|
activeEditor.getEditorState().read(() => {
|
|
11428
11545
|
if (newNodeKey) {
|
|
11429
|
-
const foundNode = (0,
|
|
11546
|
+
const foundNode = (0, import_lexical71.$getNodeByKey)(newNodeKey);
|
|
11430
11547
|
if ($isMultipleOptionQuestionNode(foundNode)) {
|
|
11431
11548
|
let index = 0;
|
|
11432
11549
|
for (const optionItem of foundNode.__options) {
|
|
11433
11550
|
optionItem.content.update(() => {
|
|
11434
|
-
const root = (0,
|
|
11551
|
+
const root = (0, import_lexical71.$getRoot)();
|
|
11435
11552
|
let firstChild = root.getFirstChild();
|
|
11436
11553
|
if (!firstChild) {
|
|
11437
|
-
firstChild = (0,
|
|
11554
|
+
firstChild = (0, import_lexical71.$createParagraphNode)();
|
|
11438
11555
|
root.append(firstChild);
|
|
11439
11556
|
}
|
|
11440
11557
|
if (index === 0) {
|
|
@@ -11453,7 +11570,7 @@ function MultipleOptionQuestionPlugin() {
|
|
|
11453
11570
|
}
|
|
11454
11571
|
return true;
|
|
11455
11572
|
},
|
|
11456
|
-
|
|
11573
|
+
import_lexical71.COMMAND_PRIORITY_EDITOR
|
|
11457
11574
|
),
|
|
11458
11575
|
editor.registerCommand(
|
|
11459
11576
|
REPLACE_LIST_WITH_MULTIPLE_OPTION_QUESTION_COMMAND,
|
|
@@ -11463,7 +11580,7 @@ function MultipleOptionQuestionPlugin() {
|
|
|
11463
11580
|
let newNodeKey = void 0;
|
|
11464
11581
|
activeEditor.update(
|
|
11465
11582
|
() => {
|
|
11466
|
-
const foundNode = (0,
|
|
11583
|
+
const foundNode = (0, import_lexical71.$getNodeByKey)(nodeKey);
|
|
11467
11584
|
if ((0, import_list4.$isListNode)(foundNode)) {
|
|
11468
11585
|
const textNodesTexts = [];
|
|
11469
11586
|
traverseListItemNodes(foundNode, (listItemNode) => {
|
|
@@ -11491,10 +11608,10 @@ function MultipleOptionQuestionPlugin() {
|
|
|
11491
11608
|
);
|
|
11492
11609
|
}
|
|
11493
11610
|
foundNode.replace(optionsQuestionNode);
|
|
11494
|
-
const selection = (0,
|
|
11611
|
+
const selection = (0, import_lexical71.$createNodeSelection)();
|
|
11495
11612
|
newNodeKey = optionsQuestionNode.getKey();
|
|
11496
11613
|
selection.add(nodeKey);
|
|
11497
|
-
(0,
|
|
11614
|
+
(0, import_lexical71.$setSelection)(selection);
|
|
11498
11615
|
}
|
|
11499
11616
|
}
|
|
11500
11617
|
},
|
|
@@ -11502,10 +11619,10 @@ function MultipleOptionQuestionPlugin() {
|
|
|
11502
11619
|
onUpdate: () => {
|
|
11503
11620
|
activeEditor.getEditorState().read(() => {
|
|
11504
11621
|
if (newNodeKey) {
|
|
11505
|
-
const foundNode = (0,
|
|
11622
|
+
const foundNode = (0, import_lexical71.$getNodeByKey)(newNodeKey);
|
|
11506
11623
|
if ($isMultipleOptionQuestionNode(foundNode)) {
|
|
11507
11624
|
foundNode.__options[0].content.update(() => {
|
|
11508
|
-
const root = (0,
|
|
11625
|
+
const root = (0, import_lexical71.$getRoot)();
|
|
11509
11626
|
const firstChild = root.getFirstChild();
|
|
11510
11627
|
firstChild?.selectStart();
|
|
11511
11628
|
});
|
|
@@ -11518,7 +11635,7 @@ function MultipleOptionQuestionPlugin() {
|
|
|
11518
11635
|
}
|
|
11519
11636
|
return true;
|
|
11520
11637
|
},
|
|
11521
|
-
|
|
11638
|
+
import_lexical71.COMMAND_PRIORITY_EDITOR
|
|
11522
11639
|
),
|
|
11523
11640
|
editor.registerCommand(
|
|
11524
11641
|
REPLACE_MULTIPLE_OPTION_QUESTION_COMMAND,
|
|
@@ -11528,7 +11645,7 @@ function MultipleOptionQuestionPlugin() {
|
|
|
11528
11645
|
let newNodeKey = void 0;
|
|
11529
11646
|
activeEditor.update(
|
|
11530
11647
|
() => {
|
|
11531
|
-
const foundNode = (0,
|
|
11648
|
+
const foundNode = (0, import_lexical71.$getNodeByKey)(nodeKey);
|
|
11532
11649
|
if ($isMultipleOptionQuestionNode(foundNode)) {
|
|
11533
11650
|
const newNode = $createMultipleOptionQuestionNode(
|
|
11534
11651
|
questionType,
|
|
@@ -11541,20 +11658,20 @@ function MultipleOptionQuestionPlugin() {
|
|
|
11541
11658
|
foundNode.__options
|
|
11542
11659
|
);
|
|
11543
11660
|
foundNode.replace(newNode);
|
|
11544
|
-
const selection = (0,
|
|
11661
|
+
const selection = (0, import_lexical71.$createNodeSelection)();
|
|
11545
11662
|
newNodeKey = newNode.getKey();
|
|
11546
11663
|
selection.add(newNodeKey);
|
|
11547
|
-
(0,
|
|
11664
|
+
(0, import_lexical71.$setSelection)(selection);
|
|
11548
11665
|
}
|
|
11549
11666
|
},
|
|
11550
11667
|
{
|
|
11551
11668
|
onUpdate: () => {
|
|
11552
11669
|
activeEditor.update(() => {
|
|
11553
11670
|
if (newNodeKey) {
|
|
11554
|
-
const foundNode = (0,
|
|
11671
|
+
const foundNode = (0, import_lexical71.$getNodeByKey)(newNodeKey);
|
|
11555
11672
|
if ($isMultipleOptionQuestionNode(foundNode)) {
|
|
11556
11673
|
foundNode.__options[0].content.update(() => {
|
|
11557
|
-
const root = (0,
|
|
11674
|
+
const root = (0, import_lexical71.$getRoot)();
|
|
11558
11675
|
const firstChild = root.getFirstChild();
|
|
11559
11676
|
firstChild?.selectStart();
|
|
11560
11677
|
});
|
|
@@ -11567,7 +11684,7 @@ function MultipleOptionQuestionPlugin() {
|
|
|
11567
11684
|
}
|
|
11568
11685
|
return true;
|
|
11569
11686
|
},
|
|
11570
|
-
|
|
11687
|
+
import_lexical71.COMMAND_PRIORITY_EDITOR
|
|
11571
11688
|
)
|
|
11572
11689
|
);
|
|
11573
11690
|
}, [editor]);
|
|
@@ -11579,7 +11696,7 @@ function MultipleOptionQuestionPlugin() {
|
|
|
11579
11696
|
);
|
|
11580
11697
|
}
|
|
11581
11698
|
}, [isBlockEditorReady]);
|
|
11582
|
-
return /* @__PURE__ */ (0,
|
|
11699
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_jsx_runtime100.Fragment, { children: drawer && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
11583
11700
|
StickyToPosition,
|
|
11584
11701
|
{
|
|
11585
11702
|
ref: settingsPanelStickyRef,
|
|
@@ -11588,7 +11705,7 @@ function MultipleOptionQuestionPlugin() {
|
|
|
11588
11705
|
let questionType = void 0;
|
|
11589
11706
|
if (data.nodeKey) {
|
|
11590
11707
|
editor.getEditorState().read(() => {
|
|
11591
|
-
const optionsQuestionNode = (0,
|
|
11708
|
+
const optionsQuestionNode = (0, import_lexical71.$getNodeByKey)(
|
|
11592
11709
|
data.nodeKey
|
|
11593
11710
|
);
|
|
11594
11711
|
if (optionsQuestionNode && $isMultipleOptionQuestionNode(optionsQuestionNode)) {
|
|
@@ -11596,14 +11713,14 @@ function MultipleOptionQuestionPlugin() {
|
|
|
11596
11713
|
}
|
|
11597
11714
|
});
|
|
11598
11715
|
}
|
|
11599
|
-
return /* @__PURE__ */ (0,
|
|
11716
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { style: { width: position.width }, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
11600
11717
|
SettingsCard,
|
|
11601
11718
|
{
|
|
11602
11719
|
isVisible: !!isVisible,
|
|
11603
11720
|
container: drawer,
|
|
11604
11721
|
title: questionType === "multiple-answers" ? "Multiple Answers Settings" : "Multiple Choice Settings",
|
|
11605
11722
|
onClose: toggleSettingsPanelSwitch,
|
|
11606
|
-
children: isVisible && questionType && /* @__PURE__ */ (0,
|
|
11723
|
+
children: isVisible && questionType && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
11607
11724
|
MultipleOptionQuestionSettings,
|
|
11608
11725
|
{
|
|
11609
11726
|
nodeKey: data.nodeKey,
|
|
@@ -11620,12 +11737,12 @@ function MultipleOptionQuestionPlugin() {
|
|
|
11620
11737
|
// src/plugins/ShortAnswerQuestionPlugin/ShortAnswerQuestionPlugin.tsx
|
|
11621
11738
|
var import_LexicalComposerContext56 = require("@lexical/react/LexicalComposerContext");
|
|
11622
11739
|
var import_utils21 = require("@lexical/utils");
|
|
11623
|
-
var
|
|
11740
|
+
var import_lexical73 = require("lexical");
|
|
11624
11741
|
var import_react77 = require("react");
|
|
11625
11742
|
|
|
11626
11743
|
// src/plugins/ShortAnswerQuestionPlugin/ShortAnswerQuestionSettings.tsx
|
|
11627
11744
|
var import_LexicalComposerContext55 = require("@lexical/react/LexicalComposerContext");
|
|
11628
|
-
var
|
|
11745
|
+
var import_lexical72 = require("lexical");
|
|
11629
11746
|
var import_react76 = require("react");
|
|
11630
11747
|
|
|
11631
11748
|
// src/plugins/ShortAnswerQuestionPlugin/validateMaxWordsInput.ts
|
|
@@ -11670,7 +11787,7 @@ function validatePointsInput5(input) {
|
|
|
11670
11787
|
}
|
|
11671
11788
|
|
|
11672
11789
|
// src/plugins/ShortAnswerQuestionPlugin/ShortAnswerQuestionSettings.tsx
|
|
11673
|
-
var
|
|
11790
|
+
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
11674
11791
|
function ShortAnswerQuestionSettings(props) {
|
|
11675
11792
|
const { nodeKey } = props;
|
|
11676
11793
|
const [editor] = (0, import_LexicalComposerContext55.useLexicalComposerContext)();
|
|
@@ -11680,7 +11797,7 @@ function ShortAnswerQuestionSettings(props) {
|
|
|
11680
11797
|
(0, import_react76.useEffect)(() => {
|
|
11681
11798
|
if (nodeKey) {
|
|
11682
11799
|
editor.getEditorState().read(() => {
|
|
11683
|
-
const shortAnswerNode = (0,
|
|
11800
|
+
const shortAnswerNode = (0, import_lexical72.$getNodeByKey)(nodeKey);
|
|
11684
11801
|
if (shortAnswerNode && $isShortAnswerQuestionNode(shortAnswerNode)) {
|
|
11685
11802
|
setFoundNode(shortAnswerNode);
|
|
11686
11803
|
}
|
|
@@ -11690,8 +11807,8 @@ function ShortAnswerQuestionSettings(props) {
|
|
|
11690
11807
|
if (!foundNode) {
|
|
11691
11808
|
return null;
|
|
11692
11809
|
}
|
|
11693
|
-
return /* @__PURE__ */ (0,
|
|
11694
|
-
/* @__PURE__ */ (0,
|
|
11810
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(import_jsx_runtime101.Fragment, { children: [
|
|
11811
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
11695
11812
|
TextInput,
|
|
11696
11813
|
{
|
|
11697
11814
|
ref: pointsTextInputRef,
|
|
@@ -11704,7 +11821,7 @@ function ShortAnswerQuestionSettings(props) {
|
|
|
11704
11821
|
label: "Points",
|
|
11705
11822
|
onChange: (value) => {
|
|
11706
11823
|
editor.update(() => {
|
|
11707
|
-
const targetNode = (0,
|
|
11824
|
+
const targetNode = (0, import_lexical72.$getNodeByKey)(nodeKey);
|
|
11708
11825
|
if (targetNode && $isShortAnswerQuestionNode(targetNode)) {
|
|
11709
11826
|
try {
|
|
11710
11827
|
validatePointsInput5(value);
|
|
@@ -11718,7 +11835,7 @@ function ShortAnswerQuestionSettings(props) {
|
|
|
11718
11835
|
}
|
|
11719
11836
|
}
|
|
11720
11837
|
) }),
|
|
11721
|
-
/* @__PURE__ */ (0,
|
|
11838
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
11722
11839
|
TextInput,
|
|
11723
11840
|
{
|
|
11724
11841
|
ref: maxWordsTextInputRef,
|
|
@@ -11731,7 +11848,7 @@ function ShortAnswerQuestionSettings(props) {
|
|
|
11731
11848
|
label: "Max Words",
|
|
11732
11849
|
onChange: (value) => {
|
|
11733
11850
|
editor.update(() => {
|
|
11734
|
-
const targetNode = (0,
|
|
11851
|
+
const targetNode = (0, import_lexical72.$getNodeByKey)(nodeKey);
|
|
11735
11852
|
if (targetNode && $isShortAnswerQuestionNode(targetNode)) {
|
|
11736
11853
|
try {
|
|
11737
11854
|
validateMaxWordsInput(value, 1);
|
|
@@ -11749,8 +11866,8 @@ function ShortAnswerQuestionSettings(props) {
|
|
|
11749
11866
|
}
|
|
11750
11867
|
|
|
11751
11868
|
// src/plugins/ShortAnswerQuestionPlugin/ShortAnswerQuestionPlugin.tsx
|
|
11752
|
-
var
|
|
11753
|
-
var INSERT_SHORT_ANSWER_QUESTION_COMMAND = (0,
|
|
11869
|
+
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
11870
|
+
var INSERT_SHORT_ANSWER_QUESTION_COMMAND = (0, import_lexical73.createCommand)("INSERT_SHORT_ANSWER_QUESTION_COMMAND");
|
|
11754
11871
|
function ShortAnswerQuestionPlugin() {
|
|
11755
11872
|
const {
|
|
11756
11873
|
registerSettingsPanel,
|
|
@@ -11771,7 +11888,7 @@ function ShortAnswerQuestionPlugin() {
|
|
|
11771
11888
|
let newNodeKey = void 0;
|
|
11772
11889
|
activeEditor.update(
|
|
11773
11890
|
() => {
|
|
11774
|
-
const targetNode = (0,
|
|
11891
|
+
const targetNode = (0, import_lexical73.$getNodeByKey)(nodeKey);
|
|
11775
11892
|
if (targetNode) {
|
|
11776
11893
|
const shortAnswerNode = $createShortAnswerQuestionNode(1, 100);
|
|
11777
11894
|
if (insertionMode === "replace") {
|
|
@@ -11781,23 +11898,23 @@ function ShortAnswerQuestionPlugin() {
|
|
|
11781
11898
|
} else if (insertionMode === "before") {
|
|
11782
11899
|
targetNode.insertBefore(shortAnswerNode);
|
|
11783
11900
|
}
|
|
11784
|
-
const selection = (0,
|
|
11901
|
+
const selection = (0, import_lexical73.$createNodeSelection)();
|
|
11785
11902
|
newNodeKey = shortAnswerNode.getKey();
|
|
11786
11903
|
selection.add(newNodeKey);
|
|
11787
|
-
(0,
|
|
11904
|
+
(0, import_lexical73.$setSelection)(selection);
|
|
11788
11905
|
}
|
|
11789
11906
|
},
|
|
11790
11907
|
{
|
|
11791
11908
|
onUpdate: () => {
|
|
11792
11909
|
activeEditor.getEditorState().read(() => {
|
|
11793
11910
|
if (newNodeKey) {
|
|
11794
|
-
const shortAnswerNode = (0,
|
|
11911
|
+
const shortAnswerNode = (0, import_lexical73.$getNodeByKey)(newNodeKey);
|
|
11795
11912
|
if ($isShortAnswerQuestionNode(shortAnswerNode)) {
|
|
11796
11913
|
shortAnswerNode.__notes.update(() => {
|
|
11797
|
-
const root = (0,
|
|
11914
|
+
const root = (0, import_lexical73.$getRoot)();
|
|
11798
11915
|
let firstChild = root.getFirstChild();
|
|
11799
11916
|
if (!firstChild) {
|
|
11800
|
-
firstChild = (0,
|
|
11917
|
+
firstChild = (0, import_lexical73.$createParagraphNode)();
|
|
11801
11918
|
root.append(firstChild);
|
|
11802
11919
|
}
|
|
11803
11920
|
firstChild.selectStart();
|
|
@@ -11812,7 +11929,7 @@ function ShortAnswerQuestionPlugin() {
|
|
|
11812
11929
|
}
|
|
11813
11930
|
return true;
|
|
11814
11931
|
},
|
|
11815
|
-
|
|
11932
|
+
import_lexical73.COMMAND_PRIORITY_EDITOR
|
|
11816
11933
|
)
|
|
11817
11934
|
);
|
|
11818
11935
|
}, [editor]);
|
|
@@ -11824,20 +11941,20 @@ function ShortAnswerQuestionPlugin() {
|
|
|
11824
11941
|
);
|
|
11825
11942
|
}
|
|
11826
11943
|
}, [isBlockEditorReady]);
|
|
11827
|
-
return /* @__PURE__ */ (0,
|
|
11944
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_jsx_runtime102.Fragment, { children: drawer && /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
11828
11945
|
StickyToPosition,
|
|
11829
11946
|
{
|
|
11830
11947
|
ref: settingsPanelStickyRef,
|
|
11831
11948
|
container: drawer,
|
|
11832
11949
|
children: (data, position, isVisible) => {
|
|
11833
|
-
return /* @__PURE__ */ (0,
|
|
11950
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { style: { width: position.width }, children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
11834
11951
|
SettingsCard,
|
|
11835
11952
|
{
|
|
11836
11953
|
isVisible: !!isVisible,
|
|
11837
11954
|
container: drawer,
|
|
11838
11955
|
title: "Short Answer Settings",
|
|
11839
11956
|
onClose: toggleSettingsPanelSwitch,
|
|
11840
|
-
children: isVisible && /* @__PURE__ */ (0,
|
|
11957
|
+
children: isVisible && /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
11841
11958
|
ShortAnswerQuestionSettings,
|
|
11842
11959
|
{
|
|
11843
11960
|
nodeKey: data.nodeKey
|
|
@@ -11853,10 +11970,10 @@ function ShortAnswerQuestionPlugin() {
|
|
|
11853
11970
|
// src/content/node/AddMenuHandle.tsx
|
|
11854
11971
|
var import_list5 = require("@lexical/list");
|
|
11855
11972
|
var import_rich_text2 = require("@lexical/rich-text");
|
|
11856
|
-
var
|
|
11973
|
+
var import_lexical74 = require("lexical");
|
|
11857
11974
|
var import_lucide_react17 = require("lucide-react");
|
|
11858
11975
|
var import_react78 = require("react");
|
|
11859
|
-
var
|
|
11976
|
+
var import_jsx_runtime103 = require("react/jsx-runtime");
|
|
11860
11977
|
var handlerStyle3 = {
|
|
11861
11978
|
display: "flex",
|
|
11862
11979
|
zIndex: 10,
|
|
@@ -11886,9 +12003,9 @@ function AddMenuHandle(props) {
|
|
|
11886
12003
|
onClick: () => {
|
|
11887
12004
|
currentEditor.update(() => {
|
|
11888
12005
|
if (nodeKey) {
|
|
11889
|
-
const targetNode = (0,
|
|
12006
|
+
const targetNode = (0, import_lexical74.$getNodeByKey)(nodeKey);
|
|
11890
12007
|
if (targetNode) {
|
|
11891
|
-
const newNode = (0,
|
|
12008
|
+
const newNode = (0, import_lexical74.$createParagraphNode)();
|
|
11892
12009
|
targetNode.insertAfter(newNode);
|
|
11893
12010
|
newNode.selectStart();
|
|
11894
12011
|
}
|
|
@@ -11908,7 +12025,7 @@ function AddMenuHandle(props) {
|
|
|
11908
12025
|
onClick: () => {
|
|
11909
12026
|
currentEditor.update(() => {
|
|
11910
12027
|
if (nodeKey) {
|
|
11911
|
-
const targetNode = (0,
|
|
12028
|
+
const targetNode = (0, import_lexical74.$getNodeByKey)(nodeKey);
|
|
11912
12029
|
if (targetNode) {
|
|
11913
12030
|
const newNode = (0, import_rich_text2.$createHeadingNode)("h1");
|
|
11914
12031
|
targetNode.insertAfter(newNode);
|
|
@@ -11925,7 +12042,7 @@ function AddMenuHandle(props) {
|
|
|
11925
12042
|
onClick: () => {
|
|
11926
12043
|
currentEditor.update(() => {
|
|
11927
12044
|
if (nodeKey) {
|
|
11928
|
-
const targetNode = (0,
|
|
12045
|
+
const targetNode = (0, import_lexical74.$getNodeByKey)(nodeKey);
|
|
11929
12046
|
if (targetNode) {
|
|
11930
12047
|
const newNode = (0, import_rich_text2.$createHeadingNode)("h2");
|
|
11931
12048
|
targetNode.insertAfter(newNode);
|
|
@@ -11942,7 +12059,7 @@ function AddMenuHandle(props) {
|
|
|
11942
12059
|
onClick: () => {
|
|
11943
12060
|
currentEditor.update(() => {
|
|
11944
12061
|
if (nodeKey) {
|
|
11945
|
-
const targetNode = (0,
|
|
12062
|
+
const targetNode = (0, import_lexical74.$getNodeByKey)(nodeKey);
|
|
11946
12063
|
if (targetNode) {
|
|
11947
12064
|
const newNode = (0, import_rich_text2.$createHeadingNode)("h3");
|
|
11948
12065
|
targetNode.insertAfter(newNode);
|
|
@@ -11964,9 +12081,9 @@ function AddMenuHandle(props) {
|
|
|
11964
12081
|
onClick: () => {
|
|
11965
12082
|
currentEditor.update(() => {
|
|
11966
12083
|
if (nodeKey) {
|
|
11967
|
-
const targetNode = (0,
|
|
12084
|
+
const targetNode = (0, import_lexical74.$getNodeByKey)(nodeKey);
|
|
11968
12085
|
if (targetNode) {
|
|
11969
|
-
const newParagraphNode = (0,
|
|
12086
|
+
const newParagraphNode = (0, import_lexical74.$createParagraphNode)();
|
|
11970
12087
|
targetNode.insertAfter(newParagraphNode);
|
|
11971
12088
|
newParagraphNode.select();
|
|
11972
12089
|
currentEditor.dispatchCommand(
|
|
@@ -11985,9 +12102,9 @@ function AddMenuHandle(props) {
|
|
|
11985
12102
|
onClick: () => {
|
|
11986
12103
|
currentEditor.update(() => {
|
|
11987
12104
|
if (nodeKey) {
|
|
11988
|
-
const targetNode = (0,
|
|
12105
|
+
const targetNode = (0, import_lexical74.$getNodeByKey)(nodeKey);
|
|
11989
12106
|
if (targetNode) {
|
|
11990
|
-
const newParagraphNode = (0,
|
|
12107
|
+
const newParagraphNode = (0, import_lexical74.$createParagraphNode)();
|
|
11991
12108
|
targetNode.insertAfter(newParagraphNode);
|
|
11992
12109
|
newParagraphNode.select();
|
|
11993
12110
|
currentEditor.dispatchCommand(
|
|
@@ -12006,11 +12123,11 @@ function AddMenuHandle(props) {
|
|
|
12006
12123
|
onClick: () => {
|
|
12007
12124
|
currentEditor.update(() => {
|
|
12008
12125
|
if (nodeKey) {
|
|
12009
|
-
const targetNode = (0,
|
|
12126
|
+
const targetNode = (0, import_lexical74.$getNodeByKey)(nodeKey);
|
|
12010
12127
|
if (targetNode) {
|
|
12011
12128
|
const newNode = $createHorizontalRuleNode();
|
|
12012
12129
|
targetNode.insertAfter(newNode);
|
|
12013
|
-
const newParagraphNode = (0,
|
|
12130
|
+
const newParagraphNode = (0, import_lexical74.$createParagraphNode)();
|
|
12014
12131
|
newNode.insertAfter(newParagraphNode);
|
|
12015
12132
|
newParagraphNode.selectStart();
|
|
12016
12133
|
}
|
|
@@ -12027,9 +12144,9 @@ function AddMenuHandle(props) {
|
|
|
12027
12144
|
onClick: () => {
|
|
12028
12145
|
currentEditor.update(() => {
|
|
12029
12146
|
if (nodeKey) {
|
|
12030
|
-
const targetNode = (0,
|
|
12147
|
+
const targetNode = (0, import_lexical74.$getNodeByKey)(nodeKey);
|
|
12031
12148
|
if (targetNode) {
|
|
12032
|
-
const newNode = (0,
|
|
12149
|
+
const newNode = (0, import_lexical74.$createParagraphNode)();
|
|
12033
12150
|
targetNode.insertAfter(newNode);
|
|
12034
12151
|
newNode.selectStart();
|
|
12035
12152
|
currentEditor.dispatchCommand(
|
|
@@ -12198,7 +12315,7 @@ function AddMenuHandle(props) {
|
|
|
12198
12315
|
}
|
|
12199
12316
|
return menu2;
|
|
12200
12317
|
}, [hoveredNode]);
|
|
12201
|
-
return /* @__PURE__ */ (0,
|
|
12318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { id: handlerKey, style: handlerStyle3, children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
12202
12319
|
DropdownWrapper,
|
|
12203
12320
|
{
|
|
12204
12321
|
placement: "bottom-start",
|
|
@@ -12209,13 +12326,13 @@ function AddMenuHandle(props) {
|
|
|
12209
12326
|
onHideMenu: () => {
|
|
12210
12327
|
removeVisiblePopup();
|
|
12211
12328
|
},
|
|
12212
|
-
children: /* @__PURE__ */ (0,
|
|
12329
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { slot: "trigger", className: "add-menu-handle", children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Icon, { icon: import_lucide_react17.Plus }) })
|
|
12213
12330
|
}
|
|
12214
12331
|
) });
|
|
12215
12332
|
}
|
|
12216
12333
|
|
|
12217
12334
|
// src/content/node/menus/copyToClipboardMenu.tsx
|
|
12218
|
-
var
|
|
12335
|
+
var import_lexical75 = require("lexical");
|
|
12219
12336
|
var import_lucide_react18 = require("lucide-react");
|
|
12220
12337
|
function renderCopyToClipboardMenu(nodeKey, editor) {
|
|
12221
12338
|
return [
|
|
@@ -12226,7 +12343,7 @@ function renderCopyToClipboardMenu(nodeKey, editor) {
|
|
|
12226
12343
|
onClick: () => {
|
|
12227
12344
|
editor.update(() => {
|
|
12228
12345
|
let nodeSerialized = void 0;
|
|
12229
|
-
const node = (0,
|
|
12346
|
+
const node = (0, import_lexical75.$getNodeByKey)(nodeKey);
|
|
12230
12347
|
if (node) {
|
|
12231
12348
|
nodeSerialized = exportNodeToJSON(node);
|
|
12232
12349
|
let serializedData = JSON.stringify(nodeSerialized);
|
|
@@ -12242,7 +12359,7 @@ function renderCopyToClipboardMenu(nodeKey, editor) {
|
|
|
12242
12359
|
}
|
|
12243
12360
|
|
|
12244
12361
|
// src/content/node/menus/deleteMenu.tsx
|
|
12245
|
-
var
|
|
12362
|
+
var import_lexical76 = require("lexical");
|
|
12246
12363
|
var import_lucide_react19 = require("lucide-react");
|
|
12247
12364
|
function renderDeleteMenu(nodeKey, editor) {
|
|
12248
12365
|
return [
|
|
@@ -12252,7 +12369,7 @@ function renderDeleteMenu(nodeKey, editor) {
|
|
|
12252
12369
|
Icon: import_lucide_react19.Trash2,
|
|
12253
12370
|
onClick: () => {
|
|
12254
12371
|
editor.update(() => {
|
|
12255
|
-
const targetNode = (0,
|
|
12372
|
+
const targetNode = (0, import_lexical76.$getNodeByKey)(nodeKey);
|
|
12256
12373
|
if (targetNode) {
|
|
12257
12374
|
const nextBlock = targetNode.getNextSibling();
|
|
12258
12375
|
const prevBlock = targetNode.getPreviousSibling();
|
|
@@ -12262,8 +12379,8 @@ function renderDeleteMenu(nodeKey, editor) {
|
|
|
12262
12379
|
} else if (prevBlock) {
|
|
12263
12380
|
prevBlock.selectStart();
|
|
12264
12381
|
} else {
|
|
12265
|
-
const root = (0,
|
|
12266
|
-
const newParagraph = (0,
|
|
12382
|
+
const root = (0, import_lexical76.$getRoot)();
|
|
12383
|
+
const newParagraph = (0, import_lexical76.$createParagraphNode)();
|
|
12267
12384
|
root.append(newParagraph);
|
|
12268
12385
|
newParagraph.selectStart();
|
|
12269
12386
|
}
|
|
@@ -12279,12 +12396,12 @@ function renderDeleteMenu(nodeKey, editor) {
|
|
|
12279
12396
|
|
|
12280
12397
|
// src/content/node/menus/listReplaceMenu.tsx
|
|
12281
12398
|
var import_list6 = require("@lexical/list");
|
|
12282
|
-
var
|
|
12399
|
+
var import_lexical77 = require("lexical");
|
|
12283
12400
|
var import_lucide_react20 = require("lucide-react");
|
|
12284
12401
|
function renderListReplaceMenu(nodeKey, editor) {
|
|
12285
12402
|
let listType = void 0;
|
|
12286
12403
|
editor.getEditorState().read(() => {
|
|
12287
|
-
const foundNode = (0,
|
|
12404
|
+
const foundNode = (0, import_lexical77.$getNodeByKey)(nodeKey);
|
|
12288
12405
|
if ((0, import_list6.$isListNode)(foundNode)) {
|
|
12289
12406
|
listType = foundNode.getListType();
|
|
12290
12407
|
}
|
|
@@ -12297,7 +12414,7 @@ function renderListReplaceMenu(nodeKey, editor) {
|
|
|
12297
12414
|
selected: listType === "number",
|
|
12298
12415
|
onClick: () => {
|
|
12299
12416
|
editor.update(() => {
|
|
12300
|
-
const targetNode = (0,
|
|
12417
|
+
const targetNode = (0, import_lexical77.$getNodeByKey)(nodeKey);
|
|
12301
12418
|
if (targetNode) {
|
|
12302
12419
|
traverseListNode(targetNode, (listNode) => {
|
|
12303
12420
|
listNode.setListType("number");
|
|
@@ -12314,7 +12431,7 @@ function renderListReplaceMenu(nodeKey, editor) {
|
|
|
12314
12431
|
selected: listType === "bullet",
|
|
12315
12432
|
onClick: () => {
|
|
12316
12433
|
editor.update(() => {
|
|
12317
|
-
const targetNode = (0,
|
|
12434
|
+
const targetNode = (0, import_lexical77.$getNodeByKey)(nodeKey);
|
|
12318
12435
|
if (targetNode) {
|
|
12319
12436
|
traverseListNode(targetNode, (listNode) => {
|
|
12320
12437
|
listNode.setListType("bullet");
|
|
@@ -12330,13 +12447,13 @@ function renderListReplaceMenu(nodeKey, editor) {
|
|
|
12330
12447
|
// src/content/node/menus/typographyReplaceMenu.tsx
|
|
12331
12448
|
var import_rich_text3 = require("@lexical/rich-text");
|
|
12332
12449
|
var import_selection = require("@lexical/selection");
|
|
12333
|
-
var
|
|
12450
|
+
var import_lexical78 = require("lexical");
|
|
12334
12451
|
var import_lucide_react21 = require("lucide-react");
|
|
12335
12452
|
function renderTypographyReplaceMenu(nodeKey, editor) {
|
|
12336
12453
|
let nodeType = "";
|
|
12337
12454
|
let nodeTag = "";
|
|
12338
12455
|
editor.getEditorState().read(() => {
|
|
12339
|
-
const foundNode = (0,
|
|
12456
|
+
const foundNode = (0, import_lexical78.$getNodeByKey)(nodeKey);
|
|
12340
12457
|
if (foundNode) {
|
|
12341
12458
|
nodeType = foundNode.getType();
|
|
12342
12459
|
if ((0, import_rich_text3.$isHeadingNode)(foundNode)) {
|
|
@@ -12352,7 +12469,7 @@ function renderTypographyReplaceMenu(nodeKey, editor) {
|
|
|
12352
12469
|
selected: import_rich_text3.HeadingNode.getType() === nodeType && nodeTag === "h1",
|
|
12353
12470
|
onClick: () => {
|
|
12354
12471
|
editor.update(() => {
|
|
12355
|
-
const targetNode = (0,
|
|
12472
|
+
const targetNode = (0, import_lexical78.$getNodeByKey)(nodeKey);
|
|
12356
12473
|
if (targetNode) {
|
|
12357
12474
|
(0, import_selection.$setBlocksType)(
|
|
12358
12475
|
targetNode.selectStart(),
|
|
@@ -12369,7 +12486,7 @@ function renderTypographyReplaceMenu(nodeKey, editor) {
|
|
|
12369
12486
|
selected: import_rich_text3.HeadingNode.getType() === nodeType && nodeTag === "h2",
|
|
12370
12487
|
onClick: () => {
|
|
12371
12488
|
editor.update(() => {
|
|
12372
|
-
const targetNode = (0,
|
|
12489
|
+
const targetNode = (0, import_lexical78.$getNodeByKey)(nodeKey);
|
|
12373
12490
|
if (targetNode) {
|
|
12374
12491
|
(0, import_selection.$setBlocksType)(
|
|
12375
12492
|
targetNode.selectStart(),
|
|
@@ -12386,7 +12503,7 @@ function renderTypographyReplaceMenu(nodeKey, editor) {
|
|
|
12386
12503
|
selected: import_rich_text3.HeadingNode.getType() === nodeType && nodeTag === "h3",
|
|
12387
12504
|
onClick: () => {
|
|
12388
12505
|
editor.update(() => {
|
|
12389
|
-
const targetNode = (0,
|
|
12506
|
+
const targetNode = (0, import_lexical78.$getNodeByKey)(nodeKey);
|
|
12390
12507
|
if (targetNode) {
|
|
12391
12508
|
(0, import_selection.$setBlocksType)(
|
|
12392
12509
|
targetNode.selectStart(),
|
|
@@ -12400,14 +12517,14 @@ function renderTypographyReplaceMenu(nodeKey, editor) {
|
|
|
12400
12517
|
id: "replace_with_paragraph",
|
|
12401
12518
|
label: "Paragraph",
|
|
12402
12519
|
Icon: import_lucide_react21.Pilcrow,
|
|
12403
|
-
selected:
|
|
12520
|
+
selected: import_lexical78.ParagraphNode.getType() === nodeType,
|
|
12404
12521
|
onClick: () => {
|
|
12405
12522
|
editor.update(() => {
|
|
12406
|
-
const targetNode = (0,
|
|
12523
|
+
const targetNode = (0, import_lexical78.$getNodeByKey)(nodeKey);
|
|
12407
12524
|
if (targetNode) {
|
|
12408
12525
|
(0, import_selection.$setBlocksType)(
|
|
12409
12526
|
targetNode.selectStart(),
|
|
12410
|
-
() => (0,
|
|
12527
|
+
() => (0, import_lexical78.$createParagraphNode)()
|
|
12411
12528
|
);
|
|
12412
12529
|
}
|
|
12413
12530
|
});
|
|
@@ -12418,7 +12535,7 @@ function renderTypographyReplaceMenu(nodeKey, editor) {
|
|
|
12418
12535
|
|
|
12419
12536
|
// src/content/node/menus/listReplaceWithQuestionMenu.tsx
|
|
12420
12537
|
var import_list7 = require("@lexical/list");
|
|
12421
|
-
var
|
|
12538
|
+
var import_lexical79 = require("lexical");
|
|
12422
12539
|
var import_lucide_react22 = require("lucide-react");
|
|
12423
12540
|
function renderListReplaceWithQuestionMenu(nodeKey, editor) {
|
|
12424
12541
|
return [
|
|
@@ -12428,7 +12545,7 @@ function renderListReplaceWithQuestionMenu(nodeKey, editor) {
|
|
|
12428
12545
|
Icon: import_lucide_react22.ListChecks,
|
|
12429
12546
|
onClick: () => {
|
|
12430
12547
|
editor.update(() => {
|
|
12431
|
-
const targetNode = (0,
|
|
12548
|
+
const targetNode = (0, import_lexical79.$getNodeByKey)(nodeKey);
|
|
12432
12549
|
if ((0, import_list7.$isListNode)(targetNode)) {
|
|
12433
12550
|
editor.dispatchCommand(
|
|
12434
12551
|
REPLACE_LIST_WITH_MULTIPLE_OPTION_QUESTION_COMMAND,
|
|
@@ -12447,7 +12564,7 @@ function renderListReplaceWithQuestionMenu(nodeKey, editor) {
|
|
|
12447
12564
|
Icon: import_lucide_react22.LayoutList,
|
|
12448
12565
|
onClick: () => {
|
|
12449
12566
|
editor.update(() => {
|
|
12450
|
-
const targetNode = (0,
|
|
12567
|
+
const targetNode = (0, import_lexical79.$getNodeByKey)(nodeKey);
|
|
12451
12568
|
if ((0, import_list7.$isListNode)(targetNode)) {
|
|
12452
12569
|
editor.dispatchCommand(
|
|
12453
12570
|
REPLACE_LIST_WITH_MULTIPLE_OPTION_QUESTION_COMMAND,
|
|
@@ -12464,12 +12581,12 @@ function renderListReplaceWithQuestionMenu(nodeKey, editor) {
|
|
|
12464
12581
|
}
|
|
12465
12582
|
|
|
12466
12583
|
// src/content/node/menus/multipleOptionsQuestionReplaceMenu.tsx
|
|
12467
|
-
var
|
|
12584
|
+
var import_lexical80 = require("lexical");
|
|
12468
12585
|
var import_lucide_react23 = require("lucide-react");
|
|
12469
12586
|
function renderMultipleOptionsQuestionReplaceMenu(nodeKey, editor) {
|
|
12470
12587
|
let questionType = void 0;
|
|
12471
12588
|
editor.getEditorState().read(() => {
|
|
12472
|
-
const foundNode = (0,
|
|
12589
|
+
const foundNode = (0, import_lexical80.$getNodeByKey)(nodeKey);
|
|
12473
12590
|
if ($isMultipleOptionQuestionNode(foundNode)) {
|
|
12474
12591
|
questionType = foundNode.getQuestionType();
|
|
12475
12592
|
}
|
|
@@ -12482,7 +12599,7 @@ function renderMultipleOptionsQuestionReplaceMenu(nodeKey, editor) {
|
|
|
12482
12599
|
selected: questionType === "multiple-answers",
|
|
12483
12600
|
onClick: () => {
|
|
12484
12601
|
editor.update(() => {
|
|
12485
|
-
const targetNode = (0,
|
|
12602
|
+
const targetNode = (0, import_lexical80.$getNodeByKey)(nodeKey);
|
|
12486
12603
|
if ($isMultipleOptionQuestionNode(targetNode)) {
|
|
12487
12604
|
editor.dispatchCommand(
|
|
12488
12605
|
REPLACE_MULTIPLE_OPTION_QUESTION_COMMAND,
|
|
@@ -12502,7 +12619,7 @@ function renderMultipleOptionsQuestionReplaceMenu(nodeKey, editor) {
|
|
|
12502
12619
|
selected: questionType === "multiple-choice",
|
|
12503
12620
|
onClick: () => {
|
|
12504
12621
|
editor.update(() => {
|
|
12505
|
-
const targetNode = (0,
|
|
12622
|
+
const targetNode = (0, import_lexical80.$getNodeByKey)(nodeKey);
|
|
12506
12623
|
if ($isMultipleOptionQuestionNode(targetNode)) {
|
|
12507
12624
|
editor.dispatchCommand(
|
|
12508
12625
|
REPLACE_MULTIPLE_OPTION_QUESTION_COMMAND,
|
|
@@ -12522,10 +12639,10 @@ function renderMultipleOptionsQuestionReplaceMenu(nodeKey, editor) {
|
|
|
12522
12639
|
var import_core7 = require("@dnd-kit/core");
|
|
12523
12640
|
var import_list8 = require("@lexical/list");
|
|
12524
12641
|
var import_rich_text4 = require("@lexical/rich-text");
|
|
12525
|
-
var
|
|
12642
|
+
var import_lexical81 = require("lexical");
|
|
12526
12643
|
var import_lucide_react24 = require("lucide-react");
|
|
12527
12644
|
var import_react79 = require("react");
|
|
12528
|
-
var
|
|
12645
|
+
var import_jsx_runtime104 = require("react/jsx-runtime");
|
|
12529
12646
|
var handlerStyle4 = {
|
|
12530
12647
|
display: "flex",
|
|
12531
12648
|
zIndex: 10,
|
|
@@ -12554,7 +12671,7 @@ function DragHandle(props) {
|
|
|
12554
12671
|
const nodeType = hoveredNode.nodeType;
|
|
12555
12672
|
const nodeKey = hoveredNode.nodeKey;
|
|
12556
12673
|
if (currentEditor) {
|
|
12557
|
-
if (nodeType === import_rich_text4.HeadingNode.getType() || nodeType ===
|
|
12674
|
+
if (nodeType === import_rich_text4.HeadingNode.getType() || nodeType === import_lexical81.ParagraphNode.getType()) {
|
|
12558
12675
|
menu2 = menu2.concat([
|
|
12559
12676
|
...renderTypographyReplaceMenu(nodeKey, currentEditor),
|
|
12560
12677
|
{
|
|
@@ -12612,7 +12729,7 @@ function DragHandle(props) {
|
|
|
12612
12729
|
}
|
|
12613
12730
|
return menu2;
|
|
12614
12731
|
}, [hoveredNode, currentEditor]);
|
|
12615
|
-
return /* @__PURE__ */ (0,
|
|
12732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
12616
12733
|
"div",
|
|
12617
12734
|
{
|
|
12618
12735
|
id: handlerKey,
|
|
@@ -12620,7 +12737,7 @@ function DragHandle(props) {
|
|
|
12620
12737
|
...listeners,
|
|
12621
12738
|
...attributes,
|
|
12622
12739
|
style: handlerStyle4,
|
|
12623
|
-
children: /* @__PURE__ */ (0,
|
|
12740
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
12624
12741
|
DropdownWrapper,
|
|
12625
12742
|
{
|
|
12626
12743
|
placement: "bottom-start",
|
|
@@ -12631,7 +12748,7 @@ function DragHandle(props) {
|
|
|
12631
12748
|
onHideMenu: () => {
|
|
12632
12749
|
removeVisiblePopup();
|
|
12633
12750
|
},
|
|
12634
|
-
children: /* @__PURE__ */ (0,
|
|
12751
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("div", { slot: "trigger", className: "draggable-handle", children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(Icon, { icon: import_lucide_react24.GripVertical }) })
|
|
12635
12752
|
}
|
|
12636
12753
|
)
|
|
12637
12754
|
}
|
|
@@ -12665,7 +12782,7 @@ function findNodePosition(rows, point, lastFound) {
|
|
|
12665
12782
|
}
|
|
12666
12783
|
|
|
12667
12784
|
// src/content/node/NodeDragOverlay.tsx
|
|
12668
|
-
var
|
|
12785
|
+
var import_jsx_runtime105 = require("react/jsx-runtime");
|
|
12669
12786
|
var overlayStyle2 = {
|
|
12670
12787
|
display: "flex",
|
|
12671
12788
|
minWidth: "150px",
|
|
@@ -12684,12 +12801,12 @@ var overlayStyle2 = {
|
|
|
12684
12801
|
boxShadow: "0 1px 3px rgba(34, 25, 25, 0.4)"
|
|
12685
12802
|
};
|
|
12686
12803
|
function NodeDragOverlay(props) {
|
|
12687
|
-
return /* @__PURE__ */ (0,
|
|
12804
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("div", { style: overlayStyle2, children: props.children() });
|
|
12688
12805
|
}
|
|
12689
12806
|
|
|
12690
12807
|
// src/content/node/NodeDropMarker.tsx
|
|
12691
12808
|
var import_react80 = require("react");
|
|
12692
|
-
var
|
|
12809
|
+
var import_jsx_runtime106 = require("react/jsx-runtime");
|
|
12693
12810
|
var placeholderStyle3 = {
|
|
12694
12811
|
position: "absolute",
|
|
12695
12812
|
top: "calc(-1 * var(--sl-spacing-small) / 2)",
|
|
@@ -12720,15 +12837,15 @@ function NodeDropMarker(props) {
|
|
|
12720
12837
|
}, 5);
|
|
12721
12838
|
}
|
|
12722
12839
|
}, [visible, top]);
|
|
12723
|
-
return /* @__PURE__ */ (0,
|
|
12840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", { style: { ...placeholderStyle3, width: props.width }, children: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", { ref: lineDivRef, style: lineStyle3 }) });
|
|
12724
12841
|
}
|
|
12725
12842
|
|
|
12726
12843
|
// src/content/node/NodeDraggableHandleSticky.tsx
|
|
12727
12844
|
var import_core8 = require("@dnd-kit/core");
|
|
12728
|
-
var
|
|
12845
|
+
var import_lexical82 = require("lexical");
|
|
12729
12846
|
var import_throttle3 = __toESM(require("lodash-es/throttle"));
|
|
12730
12847
|
var import_react81 = require("react");
|
|
12731
|
-
var
|
|
12848
|
+
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
12732
12849
|
var NodeDraggableHandleSticky = (0, import_react81.forwardRef)((props, ref) => {
|
|
12733
12850
|
const {
|
|
12734
12851
|
getRegisteredEditor,
|
|
@@ -12802,9 +12919,9 @@ var NodeDraggableHandleSticky = (0, import_react81.forwardRef)((props, ref) => {
|
|
|
12802
12919
|
isHandleVisible: () => !!nodeHandleSticky.current?.isVisible()
|
|
12803
12920
|
}));
|
|
12804
12921
|
if (!isAnchorElementReady || !anchorElementRef.current) {
|
|
12805
|
-
return /* @__PURE__ */ (0,
|
|
12922
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_jsx_runtime107.Fragment, {});
|
|
12806
12923
|
}
|
|
12807
|
-
return /* @__PURE__ */ (0,
|
|
12924
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(
|
|
12808
12925
|
import_core8.DndContext,
|
|
12809
12926
|
{
|
|
12810
12927
|
sensors,
|
|
@@ -12932,8 +13049,8 @@ var NodeDraggableHandleSticky = (0, import_react81.forwardRef)((props, ref) => {
|
|
|
12932
13049
|
const editor = getRegisteredEditor(editorKey);
|
|
12933
13050
|
editor?.update(
|
|
12934
13051
|
() => {
|
|
12935
|
-
const draggedNode = (0,
|
|
12936
|
-
const targetNode = (0,
|
|
13052
|
+
const draggedNode = (0, import_lexical82.$getNodeByKey)(nodeKey);
|
|
13053
|
+
const targetNode = (0, import_lexical82.$getNodeByKey)(targetNodeKey);
|
|
12937
13054
|
if (draggedNode && targetNode) {
|
|
12938
13055
|
try {
|
|
12939
13056
|
if (isLast) {
|
|
@@ -12965,7 +13082,7 @@ var NodeDraggableHandleSticky = (0, import_react81.forwardRef)((props, ref) => {
|
|
|
12965
13082
|
const updateTag = `t_${Date.now()}`;
|
|
12966
13083
|
editor.update(
|
|
12967
13084
|
() => {
|
|
12968
|
-
const node = (0,
|
|
13085
|
+
const node = (0, import_lexical82.$getNodeByKey)(nodeKey);
|
|
12969
13086
|
if (node) {
|
|
12970
13087
|
nodeSerialized = exportNodeToJSON(node);
|
|
12971
13088
|
node.remove();
|
|
@@ -12977,8 +13094,8 @@ var NodeDraggableHandleSticky = (0, import_react81.forwardRef)((props, ref) => {
|
|
|
12977
13094
|
targetEditor.update(
|
|
12978
13095
|
() => {
|
|
12979
13096
|
if (nodeSerialized) {
|
|
12980
|
-
const draggedNode = (0,
|
|
12981
|
-
const targetNode = (0,
|
|
13097
|
+
const draggedNode = (0, import_lexical82.$parseSerializedNode)(nodeSerialized);
|
|
13098
|
+
const targetNode = (0, import_lexical82.$getNodeByKey)(targetNodeKey);
|
|
12982
13099
|
if (draggedNode && targetNode) {
|
|
12983
13100
|
try {
|
|
12984
13101
|
if (isLast) {
|
|
@@ -13025,13 +13142,13 @@ var NodeDraggableHandleSticky = (0, import_react81.forwardRef)((props, ref) => {
|
|
|
13025
13142
|
unsetHandleDragged();
|
|
13026
13143
|
},
|
|
13027
13144
|
children: [
|
|
13028
|
-
/* @__PURE__ */ (0,
|
|
13145
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
13029
13146
|
StickyToPosition,
|
|
13030
13147
|
{
|
|
13031
13148
|
ref: nodeHandleSticky,
|
|
13032
13149
|
container: anchorElementRef.current,
|
|
13033
13150
|
children: (data, _position) => {
|
|
13034
|
-
return /* @__PURE__ */ (0,
|
|
13151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(
|
|
13035
13152
|
"div",
|
|
13036
13153
|
{
|
|
13037
13154
|
style: {
|
|
@@ -13043,21 +13160,21 @@ var NodeDraggableHandleSticky = (0, import_react81.forwardRef)((props, ref) => {
|
|
|
13043
13160
|
gap: "6px"
|
|
13044
13161
|
},
|
|
13045
13162
|
children: [
|
|
13046
|
-
/* @__PURE__ */ (0,
|
|
13047
|
-
/* @__PURE__ */ (0,
|
|
13163
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(AddMenuHandle, { hoveredNode: data.hoveredNode }),
|
|
13164
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(DragHandle, { hoveredNode: data.hoveredNode })
|
|
13048
13165
|
]
|
|
13049
13166
|
}
|
|
13050
13167
|
);
|
|
13051
13168
|
}
|
|
13052
13169
|
}
|
|
13053
13170
|
),
|
|
13054
|
-
/* @__PURE__ */ (0,
|
|
13171
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
13055
13172
|
StickyToPosition,
|
|
13056
13173
|
{
|
|
13057
13174
|
ref: dropMarkerSticky,
|
|
13058
13175
|
container: anchorElementRef.current,
|
|
13059
13176
|
children: (_data, position, isVisible) => {
|
|
13060
|
-
return /* @__PURE__ */ (0,
|
|
13177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
13061
13178
|
NodeDropMarker,
|
|
13062
13179
|
{
|
|
13063
13180
|
top: `${position.top}px`,
|
|
@@ -13068,8 +13185,8 @@ var NodeDraggableHandleSticky = (0, import_react81.forwardRef)((props, ref) => {
|
|
|
13068
13185
|
}
|
|
13069
13186
|
}
|
|
13070
13187
|
),
|
|
13071
|
-
/* @__PURE__ */ (0,
|
|
13072
|
-
return /* @__PURE__ */ (0,
|
|
13188
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_core8.DragOverlay, { dropAnimation: null, children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(NodeDragOverlay, { children: () => {
|
|
13189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { children: "Move Block" });
|
|
13073
13190
|
} }) })
|
|
13074
13191
|
]
|
|
13075
13192
|
}
|
|
@@ -13077,7 +13194,7 @@ var NodeDraggableHandleSticky = (0, import_react81.forwardRef)((props, ref) => {
|
|
|
13077
13194
|
});
|
|
13078
13195
|
|
|
13079
13196
|
// src/content/node/NodeProvider.tsx
|
|
13080
|
-
var
|
|
13197
|
+
var import_jsx_runtime108 = require("react/jsx-runtime");
|
|
13081
13198
|
var NodeProviderContext = import_react82.default.createContext(null);
|
|
13082
13199
|
function NodeProvider(props) {
|
|
13083
13200
|
const { children } = props;
|
|
@@ -13156,7 +13273,7 @@ function NodeProvider(props) {
|
|
|
13156
13273
|
}
|
|
13157
13274
|
};
|
|
13158
13275
|
}, []);
|
|
13159
|
-
return /* @__PURE__ */ (0,
|
|
13276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(
|
|
13160
13277
|
NodeProviderContext.Provider,
|
|
13161
13278
|
{
|
|
13162
13279
|
value: {
|
|
@@ -13179,7 +13296,7 @@ function NodeProvider(props) {
|
|
|
13179
13296
|
},
|
|
13180
13297
|
children: [
|
|
13181
13298
|
children,
|
|
13182
|
-
/* @__PURE__ */ (0,
|
|
13299
|
+
/* @__PURE__ */ (0, import_jsx_runtime108.jsx)(NodeDraggableHandleSticky, { ref: nodeDraggableHandleRef })
|
|
13183
13300
|
]
|
|
13184
13301
|
}
|
|
13185
13302
|
);
|
|
@@ -13196,20 +13313,20 @@ var useNode = () => {
|
|
|
13196
13313
|
var import_LexicalComposerContext57 = require("@lexical/react/LexicalComposerContext");
|
|
13197
13314
|
var import_table14 = require("@lexical/table");
|
|
13198
13315
|
var import_utils22 = require("@lexical/utils");
|
|
13199
|
-
var
|
|
13316
|
+
var import_lexical83 = require("lexical");
|
|
13200
13317
|
var import_react83 = require("react");
|
|
13201
|
-
var
|
|
13318
|
+
var import_jsx_runtime109 = require("react/jsx-runtime");
|
|
13202
13319
|
function AutoBottomParagraphPlugin() {
|
|
13203
13320
|
const [editor] = (0, import_LexicalComposerContext57.useLexicalComposerContext)();
|
|
13204
13321
|
const listener = (nodeMutations) => {
|
|
13205
13322
|
for (const [_key, mutation] of nodeMutations) {
|
|
13206
13323
|
if (mutation === "created") {
|
|
13207
13324
|
editor.update(() => {
|
|
13208
|
-
const rootNode = (0,
|
|
13325
|
+
const rootNode = (0, import_lexical83.$getRoot)();
|
|
13209
13326
|
if (rootNode) {
|
|
13210
13327
|
const lastChild = rootNode.getLastChild();
|
|
13211
|
-
if (lastChild && !(0,
|
|
13212
|
-
const newParagraph = (0,
|
|
13328
|
+
if (lastChild && !(0, import_lexical83.$isParagraphNode)(lastChild)) {
|
|
13329
|
+
const newParagraph = (0, import_lexical83.$createParagraphNode)();
|
|
13213
13330
|
lastChild.insertAfter(newParagraph);
|
|
13214
13331
|
}
|
|
13215
13332
|
}
|
|
@@ -13240,19 +13357,19 @@ function AutoBottomParagraphPlugin() {
|
|
|
13240
13357
|
)
|
|
13241
13358
|
);
|
|
13242
13359
|
}, [editor]);
|
|
13243
|
-
return /* @__PURE__ */ (0,
|
|
13360
|
+
return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_jsx_runtime109.Fragment, {});
|
|
13244
13361
|
}
|
|
13245
13362
|
|
|
13246
13363
|
// src/plugins/AutoFocusPlugin/AutoFocusPlugin.tsx
|
|
13247
13364
|
var import_LexicalComposerContext58 = require("@lexical/react/LexicalComposerContext");
|
|
13248
|
-
var
|
|
13365
|
+
var import_lexical84 = require("lexical");
|
|
13249
13366
|
var import_react84 = require("react");
|
|
13250
13367
|
function AutoFocusPlugin() {
|
|
13251
13368
|
const [editor] = (0, import_LexicalComposerContext58.useLexicalComposerContext)();
|
|
13252
13369
|
(0, import_react84.useEffect)(() => {
|
|
13253
13370
|
setTimeout(() => {
|
|
13254
13371
|
editor.update(() => {
|
|
13255
|
-
const rootNode = (0,
|
|
13372
|
+
const rootNode = (0, import_lexical84.$getRoot)();
|
|
13256
13373
|
if (rootNode.getChildrenKeys().length >= 1) {
|
|
13257
13374
|
rootNode.getFirstChild()?.selectStart();
|
|
13258
13375
|
}
|
|
@@ -13282,12 +13399,12 @@ var import_react86 = require("react");
|
|
|
13282
13399
|
var import_LexicalComposerContext60 = require("@lexical/react/LexicalComposerContext");
|
|
13283
13400
|
|
|
13284
13401
|
// src/plugins/MarkdownPlugin/markdown/MarkdownExport.ts
|
|
13285
|
-
var
|
|
13402
|
+
var import_lexical86 = require("lexical");
|
|
13286
13403
|
|
|
13287
13404
|
// src/plugins/MarkdownPlugin/markdown/utils.ts
|
|
13288
13405
|
var import_list9 = require("@lexical/list");
|
|
13289
13406
|
var import_rich_text5 = require("@lexical/rich-text");
|
|
13290
|
-
var
|
|
13407
|
+
var import_lexical85 = require("lexical");
|
|
13291
13408
|
var autoFormatBase = {
|
|
13292
13409
|
markdownFormatKind: null,
|
|
13293
13410
|
regEx: /(?:)/,
|
|
@@ -13529,7 +13646,7 @@ var PUNCTUATION_OR_SPACE = /[!-/:-@[-`{-~\s]/;
|
|
|
13529
13646
|
var import_list10 = require("@lexical/list");
|
|
13530
13647
|
var import_rich_text6 = require("@lexical/rich-text");
|
|
13531
13648
|
var import_utils24 = require("@lexical/utils");
|
|
13532
|
-
var
|
|
13649
|
+
var import_lexical87 = require("lexical");
|
|
13533
13650
|
|
|
13534
13651
|
// src/plugins/MarkdownPlugin/markdown/canUseDOM.ts
|
|
13535
13652
|
var CAN_USE_DOM = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
@@ -13546,7 +13663,7 @@ var IS_CHROME = CAN_USE_DOM && /^(?=.*Chrome).*/i.test(navigator.userAgent);
|
|
|
13546
13663
|
var IS_APPLE_WEBKIT = CAN_USE_DOM && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !IS_CHROME;
|
|
13547
13664
|
|
|
13548
13665
|
// src/plugins/MarkdownPlugin/markdown/MarkdownShortcuts.ts
|
|
13549
|
-
var
|
|
13666
|
+
var import_lexical88 = require("lexical");
|
|
13550
13667
|
|
|
13551
13668
|
// src/plugins/MarkdownPlugin/markdown/invariant.ts
|
|
13552
13669
|
function invariant(cond, message, ..._args) {
|
|
@@ -13561,7 +13678,7 @@ function invariant(cond, message, ..._args) {
|
|
|
13561
13678
|
// src/plugins/MarkdownPlugin/markdown/MarkdownShortcuts.ts
|
|
13562
13679
|
function runElementTransformers(parentNode, anchorNode, anchorOffset, elementTransformers) {
|
|
13563
13680
|
const grandParentNode = parentNode.getParent();
|
|
13564
|
-
if (!(0,
|
|
13681
|
+
if (!(0, import_lexical88.$isRootOrShadowRoot)(grandParentNode) || parentNode.getFirstChild() !== anchorNode) {
|
|
13565
13682
|
return false;
|
|
13566
13683
|
}
|
|
13567
13684
|
const textContent = anchorNode.getTextContent();
|
|
@@ -13649,10 +13766,10 @@ function $runTextFormatTransformers(anchorNode, anchorOffset, textFormatTransfor
|
|
|
13649
13766
|
);
|
|
13650
13767
|
let sibling = openNode;
|
|
13651
13768
|
while (openTagStartIndex < 0 && (sibling = sibling.getPreviousSibling())) {
|
|
13652
|
-
if ((0,
|
|
13769
|
+
if ((0, import_lexical88.$isLineBreakNode)(sibling)) {
|
|
13653
13770
|
break;
|
|
13654
13771
|
}
|
|
13655
|
-
if ((0,
|
|
13772
|
+
if ((0, import_lexical88.$isTextNode)(sibling)) {
|
|
13656
13773
|
const siblingTextContent = sibling.getTextContent();
|
|
13657
13774
|
openNode = sibling;
|
|
13658
13775
|
openTagStartIndex = getOpenTagStartIndex(
|
|
@@ -13683,9 +13800,9 @@ function $runTextFormatTransformers(anchorNode, anchorOffset, textFormatTransfor
|
|
|
13683
13800
|
openNode.setTextContent(
|
|
13684
13801
|
openNodeText.slice(0, openTagStartIndex) + openNodeText.slice(openTagStartIndex + tagLength)
|
|
13685
13802
|
);
|
|
13686
|
-
const selection = (0,
|
|
13687
|
-
const nextSelection = (0,
|
|
13688
|
-
(0,
|
|
13803
|
+
const selection = (0, import_lexical88.$getSelection)();
|
|
13804
|
+
const nextSelection = (0, import_lexical88.$createRangeSelection)();
|
|
13805
|
+
(0, import_lexical88.$setSelection)(nextSelection);
|
|
13689
13806
|
const newOffset = closeTagEndIndex - tagLength * (openNode === closeNode ? 2 : 1) + 1;
|
|
13690
13807
|
nextSelection.anchor.set(
|
|
13691
13808
|
openNode.__key,
|
|
@@ -13708,7 +13825,7 @@ function $runTextFormatTransformers(anchorNode, anchorOffset, textFormatTransfor
|
|
|
13708
13825
|
nextSelection.toggleFormat(format);
|
|
13709
13826
|
}
|
|
13710
13827
|
}
|
|
13711
|
-
if ((0,
|
|
13828
|
+
if ((0, import_lexical88.$isRangeSelection)(selection)) {
|
|
13712
13829
|
nextSelection.format = selection.format;
|
|
13713
13830
|
}
|
|
13714
13831
|
return true;
|
|
@@ -13789,15 +13906,15 @@ function registerMarkdownShortcuts(editor, transformers) {
|
|
|
13789
13906
|
if (editor.isComposing()) {
|
|
13790
13907
|
return;
|
|
13791
13908
|
}
|
|
13792
|
-
const selection = editorState.read(
|
|
13793
|
-
const prevSelection = prevEditorState.read(
|
|
13794
|
-
if (!(0,
|
|
13909
|
+
const selection = editorState.read(import_lexical88.$getSelection);
|
|
13910
|
+
const prevSelection = prevEditorState.read(import_lexical88.$getSelection);
|
|
13911
|
+
if (!(0, import_lexical88.$isRangeSelection)(prevSelection) || !(0, import_lexical88.$isRangeSelection)(selection) || !selection.isCollapsed()) {
|
|
13795
13912
|
return;
|
|
13796
13913
|
}
|
|
13797
13914
|
const anchorKey = selection.anchor.key;
|
|
13798
13915
|
const anchorOffset = selection.anchor.offset;
|
|
13799
13916
|
const anchorNode = editorState._nodeMap.get(anchorKey);
|
|
13800
|
-
if (!(0,
|
|
13917
|
+
if (!(0, import_lexical88.$isTextNode)(anchorNode) || !dirtyLeaves.has(anchorKey) || anchorOffset !== 1 && anchorOffset > prevSelection.anchor.offset + 1) {
|
|
13801
13918
|
return;
|
|
13802
13919
|
}
|
|
13803
13920
|
editor.update(() => {
|
|
@@ -13819,7 +13936,7 @@ var import_link2 = require("@lexical/link");
|
|
|
13819
13936
|
var import_list11 = require("@lexical/list");
|
|
13820
13937
|
var import_LexicalHorizontalRuleNode = require("@lexical/react/LexicalHorizontalRuleNode");
|
|
13821
13938
|
var import_rich_text7 = require("@lexical/rich-text");
|
|
13822
|
-
var
|
|
13939
|
+
var import_lexical89 = require("lexical");
|
|
13823
13940
|
var createBlockNode = (createNode) => {
|
|
13824
13941
|
return (parentNode, children, match) => {
|
|
13825
13942
|
const node = createNode(match);
|
|
@@ -13934,7 +14051,7 @@ var QUOTE = {
|
|
|
13934
14051
|
const previousNode = parentNode.getPreviousSibling();
|
|
13935
14052
|
if ((0, import_rich_text7.$isQuoteNode)(previousNode)) {
|
|
13936
14053
|
previousNode.splice(previousNode.getChildrenSize(), 0, [
|
|
13937
|
-
(0,
|
|
14054
|
+
(0, import_lexical89.$createLineBreakNode)(),
|
|
13938
14055
|
...children
|
|
13939
14056
|
]);
|
|
13940
14057
|
previousNode.select(0, 0);
|
|
@@ -14033,7 +14150,7 @@ var LINK = {
|
|
|
14033
14150
|
const title = node.getTitle();
|
|
14034
14151
|
const linkContent = title ? `[${node.getTextContent()}](${node.getURL()} "${title}")` : `[${node.getTextContent()}](${node.getURL()})`;
|
|
14035
14152
|
const firstChild = node.getFirstChild();
|
|
14036
|
-
if (node.getChildrenSize() === 1 && (0,
|
|
14153
|
+
if (node.getChildrenSize() === 1 && (0, import_lexical89.$isTextNode)(firstChild)) {
|
|
14037
14154
|
return exportFormat(firstChild, linkContent);
|
|
14038
14155
|
} else {
|
|
14039
14156
|
return linkContent;
|
|
@@ -14044,7 +14161,7 @@ var LINK = {
|
|
|
14044
14161
|
replace: (textNode, match) => {
|
|
14045
14162
|
const [, linkText, linkUrl, linkTitle] = match;
|
|
14046
14163
|
const linkNode = (0, import_link2.$createLinkNode)(linkUrl, { title: linkTitle });
|
|
14047
|
-
const linkTextNode = (0,
|
|
14164
|
+
const linkTextNode = (0, import_lexical89.$createTextNode)(linkText);
|
|
14048
14165
|
linkTextNode.setFormat(textNode.getFormat());
|
|
14049
14166
|
linkNode.append(linkTextNode);
|
|
14050
14167
|
textNode.replace(linkNode);
|
|
@@ -14108,7 +14225,7 @@ function MarkdownPlugin() {
|
|
|
14108
14225
|
// src/plugins/NodeMousePlugin/NodeMouseAnchorPlugin.tsx
|
|
14109
14226
|
var import_LexicalComposerContext61 = require("@lexical/react/LexicalComposerContext");
|
|
14110
14227
|
var import_react87 = require("react");
|
|
14111
|
-
var
|
|
14228
|
+
var import_jsx_runtime110 = require("react/jsx-runtime");
|
|
14112
14229
|
function NodeMouseAnchorPlugin() {
|
|
14113
14230
|
const [editor] = (0, import_LexicalComposerContext61.useLexicalComposerContext)();
|
|
14114
14231
|
const { setAnchorElement, hideHandles } = useNode();
|
|
@@ -14158,7 +14275,7 @@ function NodeMouseAnchorPlugin() {
|
|
|
14158
14275
|
removeRootListener();
|
|
14159
14276
|
};
|
|
14160
14277
|
}, [editor]);
|
|
14161
|
-
return /* @__PURE__ */ (0,
|
|
14278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(import_jsx_runtime110.Fragment, {});
|
|
14162
14279
|
}
|
|
14163
14280
|
|
|
14164
14281
|
// src/plugins/NodeMousePlugin/NodeMousePlugin.tsx
|
|
@@ -14168,7 +14285,7 @@ var import_LexicalHorizontalRuleNode2 = require("@lexical/react/LexicalHorizonta
|
|
|
14168
14285
|
var import_rich_text8 = require("@lexical/rich-text");
|
|
14169
14286
|
var import_table15 = require("@lexical/table");
|
|
14170
14287
|
var import_utils27 = require("@lexical/utils");
|
|
14171
|
-
var
|
|
14288
|
+
var import_lexical90 = require("lexical");
|
|
14172
14289
|
var import_debounce5 = __toESM(require("lodash-es/debounce"));
|
|
14173
14290
|
var import_uniqueId2 = __toESM(require("lodash-es/uniqueId"));
|
|
14174
14291
|
var import_react88 = require("react");
|
|
@@ -14187,7 +14304,7 @@ function getNodePosition2(element, parent) {
|
|
|
14187
14304
|
}
|
|
14188
14305
|
|
|
14189
14306
|
// src/plugins/NodeMousePlugin/NodeMousePlugin.tsx
|
|
14190
|
-
var
|
|
14307
|
+
var import_jsx_runtime111 = require("react/jsx-runtime");
|
|
14191
14308
|
function NodeMousePlugin() {
|
|
14192
14309
|
const [editor] = (0, import_LexicalComposerContext62.useLexicalComposerContext)();
|
|
14193
14310
|
const editorUniqueIdRef = (0, import_react88.useRef)((0, import_uniqueId2.default)("editor"));
|
|
@@ -14297,14 +14414,14 @@ function NodeMousePlugin() {
|
|
|
14297
14414
|
function addHandler(key, refElement) {
|
|
14298
14415
|
if (refElement) {
|
|
14299
14416
|
editor.getEditorState().read(() => {
|
|
14300
|
-
const refNode = (0,
|
|
14417
|
+
const refNode = (0, import_lexical90.$getNodeByKey)(key);
|
|
14301
14418
|
let isValidNode = true;
|
|
14302
14419
|
if ((0, import_list12.$isListNode)(refNode)) {
|
|
14303
14420
|
const listParentNode = refNode.getParent();
|
|
14304
14421
|
if ((0, import_list12.$isListNode)(listParentNode) || (0, import_list12.$isListItemNode)(listParentNode)) {
|
|
14305
14422
|
isValidNode = false;
|
|
14306
14423
|
}
|
|
14307
|
-
} else if ((0,
|
|
14424
|
+
} else if ((0, import_lexical90.$isParagraphNode)(refNode)) {
|
|
14308
14425
|
const paragraphParentNode = refNode.getParent();
|
|
14309
14426
|
if ((0, import_table15.$isTableCellNode)(paragraphParentNode)) {
|
|
14310
14427
|
isValidNode = false;
|
|
@@ -14463,7 +14580,7 @@ function NodeMousePlugin() {
|
|
|
14463
14580
|
}
|
|
14464
14581
|
let childrenCount = 0;
|
|
14465
14582
|
editor.getEditorState().read(() => {
|
|
14466
|
-
const rootNode = (0,
|
|
14583
|
+
const rootNode = (0, import_lexical90.$getRoot)();
|
|
14467
14584
|
if (rootNode) {
|
|
14468
14585
|
const childrenKeys = rootNode.getChildrenKeys();
|
|
14469
14586
|
childrenCount = childrenKeys.length;
|
|
@@ -14471,10 +14588,10 @@ function NodeMousePlugin() {
|
|
|
14471
14588
|
});
|
|
14472
14589
|
if (childrenCount === 0) {
|
|
14473
14590
|
editor.update(() => {
|
|
14474
|
-
const rootNode = (0,
|
|
14591
|
+
const rootNode = (0, import_lexical90.$getRoot)();
|
|
14475
14592
|
if (rootNode && rootNode.getChildrenSize() <= 0) {
|
|
14476
|
-
const newParagraph = (0,
|
|
14477
|
-
newParagraph.append((0,
|
|
14593
|
+
const newParagraph = (0, import_lexical90.$createParagraphNode)();
|
|
14594
|
+
newParagraph.append((0, import_lexical90.$createTextNode)());
|
|
14478
14595
|
rootNode.append(newParagraph);
|
|
14479
14596
|
}
|
|
14480
14597
|
});
|
|
@@ -14502,7 +14619,7 @@ function NodeMousePlugin() {
|
|
|
14502
14619
|
ImageNode2,
|
|
14503
14620
|
ImagePlaceholderNode,
|
|
14504
14621
|
import_list12.ListNode,
|
|
14505
|
-
|
|
14622
|
+
import_lexical90.ParagraphNode,
|
|
14506
14623
|
CalloutBoxNode,
|
|
14507
14624
|
import_table15.TableNode,
|
|
14508
14625
|
MultipleOptionQuestionNode,
|
|
@@ -14512,7 +14629,8 @@ function NodeMousePlugin() {
|
|
|
14512
14629
|
JournalEntryQuestionNode,
|
|
14513
14630
|
FinancialStatementQuestionNode,
|
|
14514
14631
|
EssayQuestionNode,
|
|
14515
|
-
SimulationQuestionNode
|
|
14632
|
+
SimulationQuestionNode,
|
|
14633
|
+
CustomQuestionNode
|
|
14516
14634
|
].map(
|
|
14517
14635
|
(Klass) => editor.registerMutationListener(
|
|
14518
14636
|
Klass,
|
|
@@ -14529,7 +14647,7 @@ function NodeMousePlugin() {
|
|
|
14529
14647
|
if (nextRootElem) {
|
|
14530
14648
|
let childrenCount = 0;
|
|
14531
14649
|
editor.getEditorState().read(() => {
|
|
14532
|
-
const rootNode = (0,
|
|
14650
|
+
const rootNode = (0, import_lexical90.$getRoot)();
|
|
14533
14651
|
if (rootNode) {
|
|
14534
14652
|
const childrenKeys = rootNode.getChildrenKeys();
|
|
14535
14653
|
childrenCount = childrenKeys.length;
|
|
@@ -14541,10 +14659,10 @@ function NodeMousePlugin() {
|
|
|
14541
14659
|
});
|
|
14542
14660
|
if (childrenCount === 0) {
|
|
14543
14661
|
editor.update(() => {
|
|
14544
|
-
const rootNode = (0,
|
|
14662
|
+
const rootNode = (0, import_lexical90.$getRoot)();
|
|
14545
14663
|
if (rootNode && rootNode.getChildrenSize() <= 0) {
|
|
14546
|
-
const newParagraph = (0,
|
|
14547
|
-
newParagraph.append((0,
|
|
14664
|
+
const newParagraph = (0, import_lexical90.$createParagraphNode)();
|
|
14665
|
+
newParagraph.append((0, import_lexical90.$createTextNode)());
|
|
14548
14666
|
rootNode.append(newParagraph);
|
|
14549
14667
|
}
|
|
14550
14668
|
});
|
|
@@ -14557,68 +14675,68 @@ function NodeMousePlugin() {
|
|
|
14557
14675
|
removeRegistration();
|
|
14558
14676
|
};
|
|
14559
14677
|
}, [editor]);
|
|
14560
|
-
return /* @__PURE__ */ (0,
|
|
14678
|
+
return /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(import_jsx_runtime111.Fragment, {});
|
|
14561
14679
|
}
|
|
14562
14680
|
|
|
14563
14681
|
// src/plugins/NodePastePlugin/NodePastePlugin.tsx
|
|
14564
14682
|
var import_LexicalComposerContext63 = require("@lexical/react/LexicalComposerContext");
|
|
14565
14683
|
var import_rich_text9 = require("@lexical/rich-text");
|
|
14566
14684
|
var import_utils28 = require("@lexical/utils");
|
|
14567
|
-
var
|
|
14685
|
+
var import_lexical91 = require("lexical");
|
|
14568
14686
|
var import_react89 = require("react");
|
|
14569
14687
|
|
|
14570
14688
|
// src/plugins/NodePastePlugin/regenerateIdsInQuestion.ts
|
|
14571
|
-
var
|
|
14689
|
+
var import_nanoid11 = require("nanoid");
|
|
14572
14690
|
function regenerateIdsInQuestion(serializedNode) {
|
|
14573
14691
|
if (serializedNode.type === MultipleOptionQuestionNode.getType()) {
|
|
14574
14692
|
const multiOptionQuestionNode = serializedNode;
|
|
14575
|
-
multiOptionQuestionNode.id = (0,
|
|
14693
|
+
multiOptionQuestionNode.id = (0, import_nanoid11.nanoid)();
|
|
14576
14694
|
const children = multiOptionQuestionNode.options;
|
|
14577
14695
|
for (const childNode of children) {
|
|
14578
|
-
childNode.id = (0,
|
|
14696
|
+
childNode.id = (0, import_nanoid11.nanoid)();
|
|
14579
14697
|
}
|
|
14580
14698
|
} else if (serializedNode.type === FillInTheBlankQuestionNode.getType()) {
|
|
14581
14699
|
const fillInTheBlankQuestionNode = serializedNode;
|
|
14582
|
-
fillInTheBlankQuestionNode.id = (0,
|
|
14700
|
+
fillInTheBlankQuestionNode.id = (0, import_nanoid11.nanoid)();
|
|
14583
14701
|
} else if (serializedNode.type === FinancialStatementQuestionNode.getType()) {
|
|
14584
14702
|
const financialStatementQuestionNode = serializedNode;
|
|
14585
|
-
financialStatementQuestionNode.id = (0,
|
|
14703
|
+
financialStatementQuestionNode.id = (0, import_nanoid11.nanoid)();
|
|
14586
14704
|
for (const rowItem of financialStatementQuestionNode.rows) {
|
|
14587
|
-
rowItem.id = (0,
|
|
14705
|
+
rowItem.id = (0, import_nanoid11.nanoid)();
|
|
14588
14706
|
}
|
|
14589
14707
|
for (const distractorItem of financialStatementQuestionNode.distractors) {
|
|
14590
|
-
distractorItem.id = (0,
|
|
14708
|
+
distractorItem.id = (0, import_nanoid11.nanoid)();
|
|
14591
14709
|
}
|
|
14592
14710
|
} else if (serializedNode.type === JournalEntryQuestionNode.getType()) {
|
|
14593
14711
|
const journalEntryQuestionNode = serializedNode;
|
|
14594
|
-
journalEntryQuestionNode.id = (0,
|
|
14712
|
+
journalEntryQuestionNode.id = (0, import_nanoid11.nanoid)();
|
|
14595
14713
|
for (const lineItem of journalEntryQuestionNode.lineItems) {
|
|
14596
|
-
lineItem.id = (0,
|
|
14714
|
+
lineItem.id = (0, import_nanoid11.nanoid)();
|
|
14597
14715
|
}
|
|
14598
14716
|
} else if (serializedNode.type === MatchingQuestionNode.getType()) {
|
|
14599
14717
|
const matchingQuestionNode = serializedNode;
|
|
14600
|
-
matchingQuestionNode.id = (0,
|
|
14718
|
+
matchingQuestionNode.id = (0, import_nanoid11.nanoid)();
|
|
14601
14719
|
for (const childItem of matchingQuestionNode.items) {
|
|
14602
|
-
childItem.id = (0,
|
|
14720
|
+
childItem.id = (0, import_nanoid11.nanoid)();
|
|
14603
14721
|
}
|
|
14604
14722
|
} else if (serializedNode.type === ShortAnswerQuestionNode.getType()) {
|
|
14605
14723
|
const shortAnswerQuestionNode = serializedNode;
|
|
14606
|
-
shortAnswerQuestionNode.id = (0,
|
|
14724
|
+
shortAnswerQuestionNode.id = (0, import_nanoid11.nanoid)();
|
|
14607
14725
|
} else if (serializedNode.type === SimulationQuestionNode.getType()) {
|
|
14608
14726
|
const simulationQuestionNode = serializedNode;
|
|
14609
|
-
simulationQuestionNode.id = (0,
|
|
14727
|
+
simulationQuestionNode.id = (0, import_nanoid11.nanoid)();
|
|
14610
14728
|
}
|
|
14611
14729
|
return serializedNode;
|
|
14612
14730
|
}
|
|
14613
14731
|
|
|
14614
14732
|
// src/plugins/NodePastePlugin/NodePastePlugin.tsx
|
|
14615
|
-
var
|
|
14733
|
+
var import_jsx_runtime112 = require("react/jsx-runtime");
|
|
14616
14734
|
function NodePastePlugin() {
|
|
14617
14735
|
const [editor] = (0, import_LexicalComposerContext63.useLexicalComposerContext)();
|
|
14618
14736
|
(0, import_react89.useEffect)(() => {
|
|
14619
14737
|
return (0, import_utils28.mergeRegister)(
|
|
14620
14738
|
editor.registerCommand(
|
|
14621
|
-
|
|
14739
|
+
import_lexical91.PASTE_COMMAND,
|
|
14622
14740
|
(event, activeEditor) => {
|
|
14623
14741
|
const { clipboardData } = event;
|
|
14624
14742
|
if (clipboardData) {
|
|
@@ -14633,12 +14751,12 @@ function NodePastePlugin() {
|
|
|
14633
14751
|
const newNodes = [];
|
|
14634
14752
|
for (const node of payload.nodes) {
|
|
14635
14753
|
newNodes.push(
|
|
14636
|
-
(0,
|
|
14754
|
+
(0, import_lexical91.$parseSerializedNode)(
|
|
14637
14755
|
regenerateIdsInQuestion(node)
|
|
14638
14756
|
)
|
|
14639
14757
|
);
|
|
14640
14758
|
}
|
|
14641
|
-
const selection = (0,
|
|
14759
|
+
const selection = (0, import_lexical91.$getSelection)();
|
|
14642
14760
|
if (newNodes.length > 0 && selection) {
|
|
14643
14761
|
selection.insertNodes(newNodes);
|
|
14644
14762
|
newNodes[newNodes.length - 1].selectStart();
|
|
@@ -14664,8 +14782,8 @@ function NodePastePlugin() {
|
|
|
14664
14782
|
activeEditor.update(() => {
|
|
14665
14783
|
let nodeSerialized = JSON.parse(pastedText);
|
|
14666
14784
|
nodeSerialized = regenerateIdsInQuestion(nodeSerialized);
|
|
14667
|
-
const newNode = (0,
|
|
14668
|
-
const selection = (0,
|
|
14785
|
+
const newNode = (0, import_lexical91.$parseSerializedNode)(nodeSerialized);
|
|
14786
|
+
const selection = (0, import_lexical91.$getSelection)();
|
|
14669
14787
|
if (newNode && selection) {
|
|
14670
14788
|
selection.insertNodes([newNode]);
|
|
14671
14789
|
}
|
|
@@ -14680,7 +14798,7 @@ function NodePastePlugin() {
|
|
|
14680
14798
|
}
|
|
14681
14799
|
return false;
|
|
14682
14800
|
},
|
|
14683
|
-
|
|
14801
|
+
import_lexical91.COMMAND_PRIORITY_HIGH
|
|
14684
14802
|
),
|
|
14685
14803
|
editor.registerCommand(
|
|
14686
14804
|
import_rich_text9.DRAG_DROP_PASTE,
|
|
@@ -14690,17 +14808,17 @@ function NodePastePlugin() {
|
|
|
14690
14808
|
});
|
|
14691
14809
|
return true;
|
|
14692
14810
|
},
|
|
14693
|
-
|
|
14811
|
+
import_lexical91.COMMAND_PRIORITY_LOW
|
|
14694
14812
|
)
|
|
14695
14813
|
);
|
|
14696
14814
|
}, [editor]);
|
|
14697
|
-
return /* @__PURE__ */ (0,
|
|
14815
|
+
return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(import_jsx_runtime112.Fragment, {});
|
|
14698
14816
|
}
|
|
14699
14817
|
|
|
14700
14818
|
// src/components/inputs/PopupToolbar.tsx
|
|
14701
14819
|
var import_clsx4 = __toESM(require("clsx"));
|
|
14702
14820
|
var import_react90 = require("react");
|
|
14703
|
-
var
|
|
14821
|
+
var import_jsx_runtime113 = require("react/jsx-runtime");
|
|
14704
14822
|
var PopupToolbar = (0, import_react90.forwardRef)((props, ref) => {
|
|
14705
14823
|
const { onEscape, menu, toolbar } = props;
|
|
14706
14824
|
const popupRef = (0, import_react90.useRef)(null);
|
|
@@ -14733,7 +14851,7 @@ var PopupToolbar = (0, import_react90.forwardRef)((props, ref) => {
|
|
|
14733
14851
|
menuItemAttributes.checked = menuItemSelected;
|
|
14734
14852
|
menuItemAttributes.type = "checkbox";
|
|
14735
14853
|
}
|
|
14736
|
-
let buttonElement = menuItem.subMenu ? /* @__PURE__ */ (0,
|
|
14854
|
+
let buttonElement = menuItem.subMenu ? /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
|
|
14737
14855
|
DropdownButton,
|
|
14738
14856
|
{
|
|
14739
14857
|
size: "medium",
|
|
@@ -14743,7 +14861,7 @@ var PopupToolbar = (0, import_react90.forwardRef)((props, ref) => {
|
|
|
14743
14861
|
menu: menuItem.subMenu
|
|
14744
14862
|
},
|
|
14745
14863
|
`menuItem${menuItemId}`
|
|
14746
|
-
) : /* @__PURE__ */ (0,
|
|
14864
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)(
|
|
14747
14865
|
"sl-button",
|
|
14748
14866
|
{
|
|
14749
14867
|
size: "medium",
|
|
@@ -14758,15 +14876,15 @@ var PopupToolbar = (0, import_react90.forwardRef)((props, ref) => {
|
|
|
14758
14876
|
}
|
|
14759
14877
|
},
|
|
14760
14878
|
children: [
|
|
14761
|
-
MenuItemIcon && /* @__PURE__ */ (0,
|
|
14879
|
+
MenuItemIcon && /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(Icon, { slot: "prefix", icon: MenuItemIcon }),
|
|
14762
14880
|
menuItemLabel,
|
|
14763
|
-
menuItemIsError && /* @__PURE__ */ (0,
|
|
14881
|
+
menuItemIsError && /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(DotBadge, { variant: "danger" })
|
|
14764
14882
|
]
|
|
14765
14883
|
},
|
|
14766
14884
|
`menuItem${menuItemId}`
|
|
14767
14885
|
);
|
|
14768
14886
|
if (tooltip && !menuItem.subMenu) {
|
|
14769
|
-
buttonElement = /* @__PURE__ */ (0,
|
|
14887
|
+
buttonElement = /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
|
|
14770
14888
|
"sl-tooltip",
|
|
14771
14889
|
{
|
|
14772
14890
|
content: tooltip,
|
|
@@ -14828,7 +14946,7 @@ var PopupToolbar = (0, import_react90.forwardRef)((props, ref) => {
|
|
|
14828
14946
|
};
|
|
14829
14947
|
}
|
|
14830
14948
|
}, [onEscape]);
|
|
14831
|
-
return /* @__PURE__ */ (0,
|
|
14949
|
+
return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_jsx_runtime113.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
|
|
14832
14950
|
"sl-popup",
|
|
14833
14951
|
{
|
|
14834
14952
|
ref: popupRef,
|
|
@@ -14836,7 +14954,7 @@ var PopupToolbar = (0, import_react90.forwardRef)((props, ref) => {
|
|
|
14836
14954
|
shift: true,
|
|
14837
14955
|
"auto-size": "horizontal",
|
|
14838
14956
|
strategy: "fixed",
|
|
14839
|
-
children: toolbar || /* @__PURE__ */ (0,
|
|
14957
|
+
children: toolbar || /* @__PURE__ */ (0, import_jsx_runtime113.jsx)("sl-button-group", { ref: toolbarRef, children: menuItems })
|
|
14840
14958
|
}
|
|
14841
14959
|
) });
|
|
14842
14960
|
});
|
|
@@ -14888,16 +15006,16 @@ var bgColorList = [
|
|
|
14888
15006
|
];
|
|
14889
15007
|
|
|
14890
15008
|
// src/components/feedback/ProgressBar.tsx
|
|
14891
|
-
var
|
|
15009
|
+
var import_jsx_runtime114 = require("react/jsx-runtime");
|
|
14892
15010
|
function ProgressBar() {
|
|
14893
|
-
return /* @__PURE__ */ (0,
|
|
15011
|
+
return /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("sl-progress-bar", { indeterminate: "indeterminate" });
|
|
14894
15012
|
}
|
|
14895
15013
|
|
|
14896
15014
|
// src/components/layouts/Stack.tsx
|
|
14897
|
-
var
|
|
15015
|
+
var import_jsx_runtime115 = require("react/jsx-runtime");
|
|
14898
15016
|
function Stack(props) {
|
|
14899
15017
|
const { id, style, className, slot, children } = props;
|
|
14900
|
-
return /* @__PURE__ */ (0,
|
|
15018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
|
|
14901
15019
|
"div",
|
|
14902
15020
|
{
|
|
14903
15021
|
id,
|
|
@@ -14911,7 +15029,7 @@ function Stack(props) {
|
|
|
14911
15029
|
|
|
14912
15030
|
// src/components/dialogs/FormDialog.tsx
|
|
14913
15031
|
var import_react91 = require("react");
|
|
14914
|
-
var
|
|
15032
|
+
var import_jsx_runtime116 = require("react/jsx-runtime");
|
|
14915
15033
|
var FormDialog = (0, import_react91.forwardRef)((props, ref) => {
|
|
14916
15034
|
const {
|
|
14917
15035
|
id,
|
|
@@ -15039,13 +15157,13 @@ var FormDialog = (0, import_react91.forwardRef)((props, ref) => {
|
|
|
15039
15157
|
}
|
|
15040
15158
|
};
|
|
15041
15159
|
});
|
|
15042
|
-
return /* @__PURE__ */ (0,
|
|
15160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("form", { id, method: "POST", onSubmit: handleSubmit, children: /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(
|
|
15043
15161
|
"sl-dialog",
|
|
15044
15162
|
{
|
|
15045
15163
|
class: `dialog_control ${className}`,
|
|
15046
15164
|
ref: dialogRef,
|
|
15047
15165
|
children: [
|
|
15048
|
-
/* @__PURE__ */ (0,
|
|
15166
|
+
/* @__PURE__ */ (0, import_jsx_runtime116.jsx)("div", { slot: "label", children: headerControls && headerControls.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(
|
|
15049
15167
|
Stack,
|
|
15050
15168
|
{
|
|
15051
15169
|
className: "stack__gap-3 stack__row",
|
|
@@ -15056,29 +15174,29 @@ var FormDialog = (0, import_react91.forwardRef)((props, ref) => {
|
|
|
15056
15174
|
},
|
|
15057
15175
|
children: [
|
|
15058
15176
|
headerControls,
|
|
15059
|
-
/* @__PURE__ */ (0,
|
|
15177
|
+
/* @__PURE__ */ (0, import_jsx_runtime116.jsx)("div", { style: { flexGrow: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("span", { className: "font-medium font-w-semibold", children: title }) })
|
|
15060
15178
|
]
|
|
15061
15179
|
}
|
|
15062
|
-
) : /* @__PURE__ */ (0,
|
|
15063
|
-
loading && /* @__PURE__ */ (0,
|
|
15064
|
-
/* @__PURE__ */ (0,
|
|
15065
|
-
/* @__PURE__ */ (0,
|
|
15180
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("span", { className: "font-medium font-w-semibold", children: title }) }),
|
|
15181
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(ProgressBar, {}),
|
|
15182
|
+
/* @__PURE__ */ (0, import_jsx_runtime116.jsx)("input", { type: "hidden", name: "formDialogId", value: id }),
|
|
15183
|
+
/* @__PURE__ */ (0, import_jsx_runtime116.jsx)("input", { type: "hidden", name: "action", value: actionName }),
|
|
15066
15184
|
children,
|
|
15067
|
-
/* @__PURE__ */ (0,
|
|
15185
|
+
/* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(
|
|
15068
15186
|
Stack,
|
|
15069
15187
|
{
|
|
15070
15188
|
slot: "footer",
|
|
15071
15189
|
className: "stack__row stack__gap-4",
|
|
15072
15190
|
style: { width: "100%", flexWrap: "nowrap" },
|
|
15073
15191
|
children: [
|
|
15074
|
-
extraControl && /* @__PURE__ */ (0,
|
|
15075
|
-
/* @__PURE__ */ (0,
|
|
15192
|
+
extraControl && /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("div", { style: { flexGrow: 0 }, children: extraControl }),
|
|
15193
|
+
/* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(
|
|
15076
15194
|
Stack,
|
|
15077
15195
|
{
|
|
15078
15196
|
className: "stack__row stack__gap-4",
|
|
15079
15197
|
style: { flexGrow: 1, justifyContent: "end" },
|
|
15080
15198
|
children: [
|
|
15081
|
-
/* @__PURE__ */ (0,
|
|
15199
|
+
/* @__PURE__ */ (0, import_jsx_runtime116.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
|
|
15082
15200
|
Button,
|
|
15083
15201
|
{
|
|
15084
15202
|
slot: "footer",
|
|
@@ -15090,7 +15208,7 @@ var FormDialog = (0, import_react91.forwardRef)((props, ref) => {
|
|
|
15090
15208
|
onClick: handleCancel
|
|
15091
15209
|
}
|
|
15092
15210
|
) }),
|
|
15093
|
-
/* @__PURE__ */ (0,
|
|
15211
|
+
/* @__PURE__ */ (0, import_jsx_runtime116.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
|
|
15094
15212
|
Button,
|
|
15095
15213
|
{
|
|
15096
15214
|
slot: "footer",
|
|
@@ -15120,10 +15238,10 @@ var FORM_DIALOG_CLOSE_EVENT = "FORM_DIALOG_CLOSE_EVENT";
|
|
|
15120
15238
|
var import_link3 = require("@lexical/link");
|
|
15121
15239
|
var import_LexicalComposerContext64 = require("@lexical/react/LexicalComposerContext");
|
|
15122
15240
|
var import_utils29 = require("@lexical/utils");
|
|
15123
|
-
var
|
|
15241
|
+
var import_lexical92 = require("lexical");
|
|
15124
15242
|
var import_react92 = require("react");
|
|
15125
|
-
var
|
|
15126
|
-
var SHOW_LINK_EDITOR_COMMAND = (0,
|
|
15243
|
+
var import_jsx_runtime117 = require("react/jsx-runtime");
|
|
15244
|
+
var SHOW_LINK_EDITOR_COMMAND = (0, import_lexical92.createCommand)("SHOW_LINK_EDITOR_COMMAND");
|
|
15127
15245
|
function LinkEditorPlugin() {
|
|
15128
15246
|
const [editor] = (0, import_LexicalComposerContext64.useLexicalComposerContext)();
|
|
15129
15247
|
const formDialogRef = (0, import_react92.useRef)(null);
|
|
@@ -15151,11 +15269,11 @@ function LinkEditorPlugin() {
|
|
|
15151
15269
|
});
|
|
15152
15270
|
return true;
|
|
15153
15271
|
},
|
|
15154
|
-
|
|
15272
|
+
import_lexical92.COMMAND_PRIORITY_EDITOR
|
|
15155
15273
|
)
|
|
15156
15274
|
);
|
|
15157
15275
|
}, [editor]);
|
|
15158
|
-
return /* @__PURE__ */ (0,
|
|
15276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
|
|
15159
15277
|
FormDialog,
|
|
15160
15278
|
{
|
|
15161
15279
|
ref: formDialogRef,
|
|
@@ -15192,8 +15310,8 @@ function LinkEditorPlugin() {
|
|
|
15192
15310
|
onCancel: () => {
|
|
15193
15311
|
formDialogRef.current?.close();
|
|
15194
15312
|
},
|
|
15195
|
-
children: /* @__PURE__ */ (0,
|
|
15196
|
-
/* @__PURE__ */ (0,
|
|
15313
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("div", { style: { width: "450px" }, children: /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)(Stack, { className: "stack__column stack__gap-4", children: [
|
|
15314
|
+
/* @__PURE__ */ (0, import_jsx_runtime117.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
|
|
15197
15315
|
TextInput,
|
|
15198
15316
|
{
|
|
15199
15317
|
ref: linkUrlInputRef,
|
|
@@ -15203,7 +15321,7 @@ function LinkEditorPlugin() {
|
|
|
15203
15321
|
defaultValue: ""
|
|
15204
15322
|
}
|
|
15205
15323
|
) }),
|
|
15206
|
-
/* @__PURE__ */ (0,
|
|
15324
|
+
/* @__PURE__ */ (0, import_jsx_runtime117.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
|
|
15207
15325
|
Checkbox,
|
|
15208
15326
|
{
|
|
15209
15327
|
size: "small",
|
|
@@ -15222,7 +15340,7 @@ function LinkEditorPlugin() {
|
|
|
15222
15340
|
|
|
15223
15341
|
// src/components/inputs/PopupHighlight.tsx
|
|
15224
15342
|
var import_react93 = require("react");
|
|
15225
|
-
var
|
|
15343
|
+
var import_jsx_runtime118 = require("react/jsx-runtime");
|
|
15226
15344
|
var PopupHighlighter = (0, import_react93.forwardRef)((props, ref) => {
|
|
15227
15345
|
const { highlighterClassName } = props;
|
|
15228
15346
|
const popupRef = (0, import_react93.useRef)(null);
|
|
@@ -15257,7 +15375,7 @@ var PopupHighlighter = (0, import_react93.forwardRef)((props, ref) => {
|
|
|
15257
15375
|
}
|
|
15258
15376
|
}
|
|
15259
15377
|
}));
|
|
15260
|
-
return /* @__PURE__ */ (0,
|
|
15378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("sl-popup", { ref: popupRef, placement: "top-start", strategy: "fixed", children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("div", { style: { position: "relative" }, children: highlighterClassName ? /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
|
|
15261
15379
|
"div",
|
|
15262
15380
|
{
|
|
15263
15381
|
className: highlighterClassName,
|
|
@@ -15266,7 +15384,7 @@ var PopupHighlighter = (0, import_react93.forwardRef)((props, ref) => {
|
|
|
15266
15384
|
"--variable-placeholder-height": `${popupRect?.height || 0}px`
|
|
15267
15385
|
}
|
|
15268
15386
|
}
|
|
15269
|
-
) : /* @__PURE__ */ (0,
|
|
15387
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
|
|
15270
15388
|
"div",
|
|
15271
15389
|
{
|
|
15272
15390
|
style: {
|
|
@@ -15285,7 +15403,7 @@ var PopupHighlighter = (0, import_react93.forwardRef)((props, ref) => {
|
|
|
15285
15403
|
|
|
15286
15404
|
// src/components/inputs/PopupMenu.tsx
|
|
15287
15405
|
var import_react94 = require("react");
|
|
15288
|
-
var
|
|
15406
|
+
var import_jsx_runtime119 = require("react/jsx-runtime");
|
|
15289
15407
|
var PopupMenu = (0, import_react94.forwardRef)(
|
|
15290
15408
|
(props, ref) => {
|
|
15291
15409
|
const {
|
|
@@ -15365,11 +15483,11 @@ var PopupMenu = (0, import_react94.forwardRef)(
|
|
|
15365
15483
|
} = menuItem;
|
|
15366
15484
|
if (menuItemDivider) {
|
|
15367
15485
|
resultList.push(
|
|
15368
|
-
/* @__PURE__ */ (0,
|
|
15486
|
+
/* @__PURE__ */ (0, import_jsx_runtime119.jsx)("sl-divider", {}, `menuItem${menuItemId}`)
|
|
15369
15487
|
);
|
|
15370
15488
|
} else if (menuItemIsGroup) {
|
|
15371
15489
|
resultList.push(
|
|
15372
|
-
/* @__PURE__ */ (0,
|
|
15490
|
+
/* @__PURE__ */ (0, import_jsx_runtime119.jsx)("sl-menu-label", { children: menuItemLabel }, `menuItem${menuItemId}`)
|
|
15373
15491
|
);
|
|
15374
15492
|
} else {
|
|
15375
15493
|
const menuItemAttributes = {};
|
|
@@ -15381,16 +15499,16 @@ var PopupMenu = (0, import_react94.forwardRef)(
|
|
|
15381
15499
|
menuItemAttributes.type = "checkbox";
|
|
15382
15500
|
}
|
|
15383
15501
|
resultList.push(
|
|
15384
|
-
/* @__PURE__ */ (0,
|
|
15502
|
+
/* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(
|
|
15385
15503
|
"sl-menu-item",
|
|
15386
15504
|
{
|
|
15387
15505
|
value: menuItemId,
|
|
15388
15506
|
class: menuItemClassName,
|
|
15389
15507
|
...menuItemAttributes,
|
|
15390
15508
|
children: [
|
|
15391
|
-
MenuItemIcon && /* @__PURE__ */ (0,
|
|
15509
|
+
MenuItemIcon && /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(Icon, { slot: "prefix", icon: MenuItemIcon }),
|
|
15392
15510
|
menuItemLabel,
|
|
15393
|
-
menuItemIsError && /* @__PURE__ */ (0,
|
|
15511
|
+
menuItemIsError && /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(DotBadge, { variant: "danger" })
|
|
15394
15512
|
]
|
|
15395
15513
|
},
|
|
15396
15514
|
`menuItem${menuItemId}`
|
|
@@ -15413,7 +15531,7 @@ var PopupMenu = (0, import_react94.forwardRef)(
|
|
|
15413
15531
|
}
|
|
15414
15532
|
if (constMenu.length > 0) {
|
|
15415
15533
|
if (resultList.length > 0) {
|
|
15416
|
-
resultList.push(/* @__PURE__ */ (0,
|
|
15534
|
+
resultList.push(/* @__PURE__ */ (0, import_jsx_runtime119.jsx)("sl-divider", {}, "const-menu-divider"));
|
|
15417
15535
|
}
|
|
15418
15536
|
resultList = resultList.concat(createMenuList(constMenu));
|
|
15419
15537
|
}
|
|
@@ -15541,7 +15659,7 @@ var PopupMenu = (0, import_react94.forwardRef)(
|
|
|
15541
15659
|
};
|
|
15542
15660
|
}
|
|
15543
15661
|
}, [onEscape]);
|
|
15544
|
-
return /* @__PURE__ */ (0,
|
|
15662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(import_jsx_runtime119.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
15545
15663
|
"sl-popup",
|
|
15546
15664
|
{
|
|
15547
15665
|
ref: popupRef,
|
|
@@ -15553,7 +15671,7 @@ var PopupMenu = (0, import_react94.forwardRef)(
|
|
|
15553
15671
|
strategy: "fixed",
|
|
15554
15672
|
"auto-size": "vertical",
|
|
15555
15673
|
"auto-size-padding": "10",
|
|
15556
|
-
children: /* @__PURE__ */ (0,
|
|
15674
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
15557
15675
|
"sl-menu",
|
|
15558
15676
|
{
|
|
15559
15677
|
ref: menuRef,
|
|
@@ -15570,7 +15688,7 @@ var PopupMenu = (0, import_react94.forwardRef)(
|
|
|
15570
15688
|
);
|
|
15571
15689
|
|
|
15572
15690
|
// src/plugins/VariablesPlugin/replaceWithVariable.ts
|
|
15573
|
-
var
|
|
15691
|
+
var import_lexical93 = require("lexical");
|
|
15574
15692
|
function getFullMatchOffset(documentText, entryText, offset) {
|
|
15575
15693
|
let triggerOffset = offset;
|
|
15576
15694
|
for (let i = triggerOffset; i <= entryText.length; i++) {
|
|
@@ -15581,8 +15699,8 @@ function getFullMatchOffset(documentText, entryText, offset) {
|
|
|
15581
15699
|
return triggerOffset;
|
|
15582
15700
|
}
|
|
15583
15701
|
function $splitNodeContainingQuery(replaceableString, matchingString) {
|
|
15584
|
-
const selection = (0,
|
|
15585
|
-
if (!(0,
|
|
15702
|
+
const selection = (0, import_lexical93.$getSelection)();
|
|
15703
|
+
if (!(0, import_lexical93.$isRangeSelection)(selection) || !selection.isCollapsed()) {
|
|
15586
15704
|
return null;
|
|
15587
15705
|
}
|
|
15588
15706
|
const anchor = selection.anchor;
|
|
@@ -15633,9 +15751,9 @@ function replaceWithVariable(variableName, variableFormat, editor, textToReplace
|
|
|
15633
15751
|
onUpdate: () => {
|
|
15634
15752
|
if (newNode) {
|
|
15635
15753
|
editor?.update(() => {
|
|
15636
|
-
const newSelection = (0,
|
|
15754
|
+
const newSelection = (0, import_lexical93.$createNodeSelection)();
|
|
15637
15755
|
newSelection.add(newNode?.getKey() || "");
|
|
15638
|
-
(0,
|
|
15756
|
+
(0, import_lexical93.$setSelection)(newSelection);
|
|
15639
15757
|
});
|
|
15640
15758
|
}
|
|
15641
15759
|
if (onUpdateCb) {
|
|
@@ -15699,12 +15817,12 @@ function useTypeaheadTriggerMatch(trigger, {
|
|
|
15699
15817
|
}
|
|
15700
15818
|
|
|
15701
15819
|
// src/utils/visitVariableNodes.ts
|
|
15702
|
-
var
|
|
15820
|
+
var import_lexical94 = require("lexical");
|
|
15703
15821
|
function visitVariableNodes(rootNode, cb) {
|
|
15704
15822
|
if ($isVariableNode(rootNode)) {
|
|
15705
15823
|
cb(rootNode);
|
|
15706
15824
|
}
|
|
15707
|
-
if ((0,
|
|
15825
|
+
if ((0, import_lexical94.$isElementNode)(rootNode)) {
|
|
15708
15826
|
const children = rootNode.getChildren();
|
|
15709
15827
|
for (const childNode of children) {
|
|
15710
15828
|
visitVariableNodes(childNode, cb);
|
|
@@ -15713,9 +15831,9 @@ function visitVariableNodes(rootNode, cb) {
|
|
|
15713
15831
|
}
|
|
15714
15832
|
|
|
15715
15833
|
// src/plugins/VariablesPlugin/VariablesContext.tsx
|
|
15716
|
-
var
|
|
15834
|
+
var import_lexical95 = require("lexical");
|
|
15717
15835
|
var import_react96 = __toESM(require("react"));
|
|
15718
|
-
var
|
|
15836
|
+
var import_jsx_runtime120 = require("react/jsx-runtime");
|
|
15719
15837
|
var VariablesContext = import_react96.default.createContext(null);
|
|
15720
15838
|
function VariablesProvider(props) {
|
|
15721
15839
|
const { getEditor, getAllNestedEditors } = useBlockEditor();
|
|
@@ -15725,7 +15843,7 @@ function VariablesProvider(props) {
|
|
|
15725
15843
|
);
|
|
15726
15844
|
const updateVariablesInEditor = (newName, oldName, editor) => {
|
|
15727
15845
|
editor.update(() => {
|
|
15728
|
-
visitVariableNodes((0,
|
|
15846
|
+
visitVariableNodes((0, import_lexical95.$getRoot)(), (variableNode) => {
|
|
15729
15847
|
if (variableNode.__variable === oldName) {
|
|
15730
15848
|
variableNode.setVariable(newName);
|
|
15731
15849
|
}
|
|
@@ -15756,7 +15874,7 @@ function VariablesProvider(props) {
|
|
|
15756
15874
|
renameVariable(newName, oldName);
|
|
15757
15875
|
variablesSettings.onUpdated(newName, oldName);
|
|
15758
15876
|
};
|
|
15759
|
-
return /* @__PURE__ */ (0,
|
|
15877
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
15760
15878
|
VariablesContext.Provider,
|
|
15761
15879
|
{
|
|
15762
15880
|
value: {
|
|
@@ -15779,11 +15897,11 @@ var useVariables = () => {
|
|
|
15779
15897
|
};
|
|
15780
15898
|
|
|
15781
15899
|
// src/utils/getSelectionDOMRangeRect.ts
|
|
15782
|
-
var
|
|
15900
|
+
var import_lexical96 = require("lexical");
|
|
15783
15901
|
function getSelectionDOMRangeRect(editor, leadOffset) {
|
|
15784
15902
|
const editorWindow = editor._window || window;
|
|
15785
15903
|
const range = editorWindow.document.createRange();
|
|
15786
|
-
const domSelection = (0,
|
|
15904
|
+
const domSelection = (0, import_lexical96.getDOMSelection)(editorWindow);
|
|
15787
15905
|
if (domSelection === null || !domSelection.isCollapsed) {
|
|
15788
15906
|
return;
|
|
15789
15907
|
}
|
|
@@ -15804,7 +15922,7 @@ function getSelectionDOMRangeRect(editor, leadOffset) {
|
|
|
15804
15922
|
}
|
|
15805
15923
|
|
|
15806
15924
|
// src/utils/removeTextInDomSelection.ts
|
|
15807
|
-
var
|
|
15925
|
+
var import_lexical97 = require("lexical");
|
|
15808
15926
|
function removeText(editorWindow, leadOffset) {
|
|
15809
15927
|
const domSelection = editorWindow.getSelection();
|
|
15810
15928
|
if (!domSelection || !domSelection.anchorNode) {
|
|
@@ -15829,14 +15947,14 @@ function removeTextInDomSelection(editor, leadOffset, onUpdate) {
|
|
|
15829
15947
|
const editorWindow = editor._window || window;
|
|
15830
15948
|
editor.update(
|
|
15831
15949
|
() => {
|
|
15832
|
-
const selection = (0,
|
|
15950
|
+
const selection = (0, import_lexical97.$getSelection)();
|
|
15833
15951
|
let selectedNode;
|
|
15834
|
-
if ((0,
|
|
15952
|
+
if ((0, import_lexical97.$isRangeSelection)(selection)) {
|
|
15835
15953
|
selectedNode = selection.focus.getNode();
|
|
15836
15954
|
}
|
|
15837
15955
|
removeText(editorWindow, leadOffset);
|
|
15838
15956
|
if (selectedNode) {
|
|
15839
|
-
const selection2 = (0,
|
|
15957
|
+
const selection2 = (0, import_lexical97.$createRangeSelection)();
|
|
15840
15958
|
selection2.anchor.set(
|
|
15841
15959
|
selectedNode.getKey(),
|
|
15842
15960
|
leadOffset,
|
|
@@ -15847,7 +15965,7 @@ function removeTextInDomSelection(editor, leadOffset, onUpdate) {
|
|
|
15847
15965
|
leadOffset,
|
|
15848
15966
|
"text"
|
|
15849
15967
|
);
|
|
15850
|
-
(0,
|
|
15968
|
+
(0, import_lexical97.$setSelection)(selection2);
|
|
15851
15969
|
}
|
|
15852
15970
|
},
|
|
15853
15971
|
{
|
|
@@ -15859,10 +15977,10 @@ function removeTextInDomSelection(editor, leadOffset, onUpdate) {
|
|
|
15859
15977
|
// src/plugins/VariablesPlugin/TypeaheadVariablePlugin.tsx
|
|
15860
15978
|
var import_LexicalComposerContext65 = require("@lexical/react/LexicalComposerContext");
|
|
15861
15979
|
var import_utils33 = require("@lexical/utils");
|
|
15862
|
-
var
|
|
15980
|
+
var import_lexical98 = require("lexical");
|
|
15863
15981
|
var import_react97 = require("react");
|
|
15864
|
-
var
|
|
15865
|
-
var CREATE_VARIABLE_FROM_SELECTION_COMMAND = (0,
|
|
15982
|
+
var import_jsx_runtime121 = require("react/jsx-runtime");
|
|
15983
|
+
var CREATE_VARIABLE_FROM_SELECTION_COMMAND = (0, import_lexical98.createCommand)("CREATE_VARIABLE_FROM_SELECTION_COMMAND");
|
|
15866
15984
|
function TypeaheadVariablePlugin() {
|
|
15867
15985
|
const { variableList, onCreated } = useVariables();
|
|
15868
15986
|
const [editor] = (0, import_LexicalComposerContext65.useLexicalComposerContext)();
|
|
@@ -15876,8 +15994,8 @@ function TypeaheadVariablePlugin() {
|
|
|
15876
15994
|
const activeDecoratorRef = (0, import_react97.useRef)(void 0);
|
|
15877
15995
|
const handleUpdate = () => {
|
|
15878
15996
|
activeEditorRef.current?.getEditorState().read(() => {
|
|
15879
|
-
const selection = (0,
|
|
15880
|
-
if ((0,
|
|
15997
|
+
const selection = (0, import_lexical98.$getSelection)();
|
|
15998
|
+
if ((0, import_lexical98.$isRangeSelection)(selection)) {
|
|
15881
15999
|
if (selection.isCollapsed()) {
|
|
15882
16000
|
const anchor = selection.anchor;
|
|
15883
16001
|
const isEmpty = anchor.getNode().getTextContent().trim().length === 0;
|
|
@@ -16025,27 +16143,27 @@ function TypeaheadVariablePlugin() {
|
|
|
16025
16143
|
handleUpdate();
|
|
16026
16144
|
return true;
|
|
16027
16145
|
},
|
|
16028
|
-
|
|
16146
|
+
import_lexical98.COMMAND_PRIORITY_HIGH
|
|
16029
16147
|
),
|
|
16030
16148
|
editor.registerCommand(
|
|
16031
|
-
|
|
16149
|
+
import_lexical98.KEY_ENTER_COMMAND,
|
|
16032
16150
|
execute,
|
|
16033
|
-
|
|
16151
|
+
import_lexical98.COMMAND_PRIORITY_HIGH
|
|
16034
16152
|
),
|
|
16035
16153
|
editor.registerCommand(
|
|
16036
|
-
|
|
16154
|
+
import_lexical98.KEY_ESCAPE_COMMAND,
|
|
16037
16155
|
hidePopup,
|
|
16038
|
-
|
|
16156
|
+
import_lexical98.COMMAND_PRIORITY_HIGH
|
|
16039
16157
|
),
|
|
16040
16158
|
editor.registerCommand(
|
|
16041
|
-
|
|
16159
|
+
import_lexical98.KEY_ARROW_DOWN_COMMAND,
|
|
16042
16160
|
handleMenuItemSelect("down"),
|
|
16043
|
-
|
|
16161
|
+
import_lexical98.COMMAND_PRIORITY_HIGH
|
|
16044
16162
|
),
|
|
16045
16163
|
editor.registerCommand(
|
|
16046
|
-
|
|
16164
|
+
import_lexical98.KEY_ARROW_UP_COMMAND,
|
|
16047
16165
|
handleMenuItemSelect("up"),
|
|
16048
|
-
|
|
16166
|
+
import_lexical98.COMMAND_PRIORITY_HIGH
|
|
16049
16167
|
),
|
|
16050
16168
|
editor.registerCommand(
|
|
16051
16169
|
CREATE_VARIABLE_FROM_SELECTION_COMMAND,
|
|
@@ -16074,9 +16192,9 @@ function TypeaheadVariablePlugin() {
|
|
|
16074
16192
|
onUpdate: () => {
|
|
16075
16193
|
if (newNodeKey) {
|
|
16076
16194
|
activeEditor.update(() => {
|
|
16077
|
-
const newSelection = (0,
|
|
16195
|
+
const newSelection = (0, import_lexical98.$createNodeSelection)();
|
|
16078
16196
|
newSelection.add(newNodeKey || "");
|
|
16079
|
-
(0,
|
|
16197
|
+
(0, import_lexical98.$setSelection)(newSelection);
|
|
16080
16198
|
});
|
|
16081
16199
|
}
|
|
16082
16200
|
}
|
|
@@ -16084,7 +16202,7 @@ function TypeaheadVariablePlugin() {
|
|
|
16084
16202
|
);
|
|
16085
16203
|
return true;
|
|
16086
16204
|
},
|
|
16087
|
-
|
|
16205
|
+
import_lexical98.COMMAND_PRIORITY_HIGH
|
|
16088
16206
|
)
|
|
16089
16207
|
);
|
|
16090
16208
|
}, [editor, variableList]);
|
|
@@ -16098,8 +16216,8 @@ function TypeaheadVariablePlugin() {
|
|
|
16098
16216
|
activeDecoratorRef.current !== JournalEntryQuestionNode
|
|
16099
16217
|
);
|
|
16100
16218
|
}, [variableList, activeDecoratorRef.current]);
|
|
16101
|
-
return /* @__PURE__ */ (0,
|
|
16102
|
-
/* @__PURE__ */ (0,
|
|
16219
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(import_jsx_runtime121.Fragment, { children: [
|
|
16220
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
16103
16221
|
PopupMenu,
|
|
16104
16222
|
{
|
|
16105
16223
|
ref: popupRef,
|
|
@@ -16107,7 +16225,7 @@ function TypeaheadVariablePlugin() {
|
|
|
16107
16225
|
menu
|
|
16108
16226
|
}
|
|
16109
16227
|
),
|
|
16110
|
-
/* @__PURE__ */ (0,
|
|
16228
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
16111
16229
|
PopupHighlighter,
|
|
16112
16230
|
{
|
|
16113
16231
|
highlighterClassName: "variable-placeholder",
|
|
@@ -16210,11 +16328,11 @@ var import_rich_text10 = require("@lexical/rich-text");
|
|
|
16210
16328
|
var import_selection2 = require("@lexical/selection");
|
|
16211
16329
|
var import_table16 = require("@lexical/table");
|
|
16212
16330
|
var import_utils34 = require("@lexical/utils");
|
|
16213
|
-
var
|
|
16331
|
+
var import_lexical99 = require("lexical");
|
|
16214
16332
|
var import_debounce6 = __toESM(require("lodash-es/debounce"));
|
|
16215
16333
|
var import_lucide_react26 = require("lucide-react");
|
|
16216
16334
|
var import_react98 = require("react");
|
|
16217
|
-
var
|
|
16335
|
+
var import_jsx_runtime122 = require("react/jsx-runtime");
|
|
16218
16336
|
function TextToolbarPlugin() {
|
|
16219
16337
|
const { hasModule } = useBlockEditor();
|
|
16220
16338
|
const [editor] = (0, import_LexicalComposerContext66.useLexicalComposerContext)();
|
|
@@ -16239,8 +16357,8 @@ function TextToolbarPlugin() {
|
|
|
16239
16357
|
const [selectionType, setSelectionType] = (0, import_react98.useState)("paragraph");
|
|
16240
16358
|
const formatText = (format) => {
|
|
16241
16359
|
activeEditorRef.current?.update(() => {
|
|
16242
|
-
const selection = (0,
|
|
16243
|
-
if (!(0,
|
|
16360
|
+
const selection = (0, import_lexical99.$getSelection)();
|
|
16361
|
+
if (!(0, import_lexical99.$isRangeSelection)(selection)) {
|
|
16244
16362
|
return false;
|
|
16245
16363
|
}
|
|
16246
16364
|
selection.formatText(format);
|
|
@@ -16248,15 +16366,15 @@ function TextToolbarPlugin() {
|
|
|
16248
16366
|
};
|
|
16249
16367
|
const formatElement = (format) => {
|
|
16250
16368
|
activeEditorRef.current?.update(() => {
|
|
16251
|
-
const selection = (0,
|
|
16252
|
-
if (!(0,
|
|
16369
|
+
const selection = (0, import_lexical99.$getSelection)();
|
|
16370
|
+
if (!(0, import_lexical99.$isRangeSelection)(selection) && !(0, import_lexical99.$isNodeSelection)(selection)) {
|
|
16253
16371
|
return false;
|
|
16254
16372
|
}
|
|
16255
16373
|
const nodes = selection.getNodes();
|
|
16256
16374
|
for (const node of nodes) {
|
|
16257
16375
|
const element = (0, import_utils34.$findMatchingParent)(
|
|
16258
16376
|
node,
|
|
16259
|
-
(parentNode) => (0,
|
|
16377
|
+
(parentNode) => (0, import_lexical99.$isElementNode)(parentNode) && !parentNode.isInline()
|
|
16260
16378
|
);
|
|
16261
16379
|
if (element !== null) {
|
|
16262
16380
|
element.setFormat(format);
|
|
@@ -16267,7 +16385,7 @@ function TextToolbarPlugin() {
|
|
|
16267
16385
|
const formatColor = (newColor) => {
|
|
16268
16386
|
activeEditorRef.current?.update(
|
|
16269
16387
|
() => {
|
|
16270
|
-
const selection = (0,
|
|
16388
|
+
const selection = (0, import_lexical99.$getSelection)();
|
|
16271
16389
|
if (selection !== null) {
|
|
16272
16390
|
(0, import_selection2.$patchStyleText)(selection, {
|
|
16273
16391
|
color: newColor !== "default" ? newColor : null,
|
|
@@ -16290,7 +16408,7 @@ function TextToolbarPlugin() {
|
|
|
16290
16408
|
const formatBackgroundColor = (color, bgColor) => {
|
|
16291
16409
|
activeEditorRef.current?.update(
|
|
16292
16410
|
() => {
|
|
16293
|
-
const selection = (0,
|
|
16411
|
+
const selection = (0, import_lexical99.$getSelection)();
|
|
16294
16412
|
if (selection !== null) {
|
|
16295
16413
|
(0, import_selection2.$patchStyleText)(selection, {
|
|
16296
16414
|
color: color !== "default" ? color : null,
|
|
@@ -16313,7 +16431,7 @@ function TextToolbarPlugin() {
|
|
|
16313
16431
|
const clearFormatting = () => {
|
|
16314
16432
|
activeEditorRef.current?.update(
|
|
16315
16433
|
() => {
|
|
16316
|
-
const selection = (0,
|
|
16434
|
+
const selection = (0, import_lexical99.$getSelection)();
|
|
16317
16435
|
if (selection !== null) {
|
|
16318
16436
|
(0, import_selection2.$patchStyleText)(selection, {
|
|
16319
16437
|
"background-color": null,
|
|
@@ -16326,10 +16444,10 @@ function TextToolbarPlugin() {
|
|
|
16326
16444
|
"font-size": null,
|
|
16327
16445
|
"font-weight": null
|
|
16328
16446
|
});
|
|
16329
|
-
if ((0,
|
|
16447
|
+
if ((0, import_lexical99.$isRangeSelection)(selection)) {
|
|
16330
16448
|
const selectedNodes = selection.getNodes();
|
|
16331
16449
|
for (const selectedNode of selectedNodes) {
|
|
16332
|
-
if ((0,
|
|
16450
|
+
if ((0, import_lexical99.$isTextNode)(selectedNode)) {
|
|
16333
16451
|
if (selectedNode.hasFormat("bold") || selectedNode.hasFormat("italic") || selectedNode.hasFormat("underline") || selectedNode.hasFormat("strikethrough") || selectedNode.hasFormat("subscript") || selectedNode.hasFormat("superscript")) {
|
|
16334
16452
|
selectedNode.setFormat(0);
|
|
16335
16453
|
}
|
|
@@ -16337,7 +16455,7 @@ function TextToolbarPlugin() {
|
|
|
16337
16455
|
}
|
|
16338
16456
|
const newSelection = selection.clone();
|
|
16339
16457
|
newSelection.format = 0;
|
|
16340
|
-
(0,
|
|
16458
|
+
(0, import_lexical99.$setSelection)(newSelection);
|
|
16341
16459
|
}
|
|
16342
16460
|
}
|
|
16343
16461
|
},
|
|
@@ -16351,7 +16469,7 @@ function TextToolbarPlugin() {
|
|
|
16351
16469
|
function createLink() {
|
|
16352
16470
|
let currentSelection;
|
|
16353
16471
|
activeEditorRef.current?.getEditorState().read(() => {
|
|
16354
|
-
currentSelection = (0,
|
|
16472
|
+
currentSelection = (0, import_lexical99.$getSelection)()?.clone();
|
|
16355
16473
|
if (currentSelection) {
|
|
16356
16474
|
activeEditorRef.current?.dispatchCommand(
|
|
16357
16475
|
SHOW_LINK_EDITOR_COMMAND,
|
|
@@ -16373,7 +16491,7 @@ function TextToolbarPlugin() {
|
|
|
16373
16491
|
} else if (!activeDecoratorRef.current) {
|
|
16374
16492
|
clearFormatting();
|
|
16375
16493
|
const selectedNode = selectedNodeRef.current;
|
|
16376
|
-
if ((0,
|
|
16494
|
+
if ((0, import_lexical99.$isParagraphNode)(selectedNode)) {
|
|
16377
16495
|
activeEditorRef.current?.getEditorState().read(() => {
|
|
16378
16496
|
const foundParentTableNode = getParentNodeType(
|
|
16379
16497
|
selectedNode,
|
|
@@ -16493,18 +16611,18 @@ function TextToolbarPlugin() {
|
|
|
16493
16611
|
activeDecoratorRef.current = payload.decoratorNode;
|
|
16494
16612
|
if (popupToolbarRef.current) {
|
|
16495
16613
|
activeEditor.getEditorState().read(() => {
|
|
16496
|
-
const selection = (0,
|
|
16614
|
+
const selection = (0, import_lexical99.$getSelection)();
|
|
16497
16615
|
if (!selection || selection.isCollapsed()) {
|
|
16498
16616
|
popupToolbarRef.current?.hideToolbar();
|
|
16499
16617
|
return false;
|
|
16500
16618
|
}
|
|
16501
|
-
if (!(0,
|
|
16619
|
+
if (!(0, import_lexical99.$isRangeSelection)(selection)) {
|
|
16502
16620
|
popupToolbarRef.current?.hideToolbar();
|
|
16503
16621
|
return false;
|
|
16504
16622
|
}
|
|
16505
16623
|
const selectedNodes = selection.getNodes();
|
|
16506
16624
|
if (selectedNodes.findIndex(
|
|
16507
|
-
(node) => (0,
|
|
16625
|
+
(node) => (0, import_lexical99.$isDecoratorNode)(node)
|
|
16508
16626
|
) >= 0) {
|
|
16509
16627
|
popupToolbarRef.current?.hideToolbar();
|
|
16510
16628
|
return false;
|
|
@@ -16524,7 +16642,7 @@ function TextToolbarPlugin() {
|
|
|
16524
16642
|
anchorNode,
|
|
16525
16643
|
(e) => {
|
|
16526
16644
|
const parent = e.getParent();
|
|
16527
|
-
return parent !== null && (0,
|
|
16645
|
+
return parent !== null && (0, import_lexical99.$isRootOrShadowRoot)(parent);
|
|
16528
16646
|
}
|
|
16529
16647
|
);
|
|
16530
16648
|
selectedNodeRef.current = element;
|
|
@@ -16535,7 +16653,7 @@ function TextToolbarPlugin() {
|
|
|
16535
16653
|
setSelectionType("list");
|
|
16536
16654
|
} else {
|
|
16537
16655
|
const type = (0, import_rich_text10.$isHeadingNode)(element) ? element.getTag() : element.getType();
|
|
16538
|
-
if (type ===
|
|
16656
|
+
if (type === import_lexical99.ParagraphNode.getType()) {
|
|
16539
16657
|
setSelectionType("paragraph");
|
|
16540
16658
|
} else {
|
|
16541
16659
|
setSelectionType("headings");
|
|
@@ -16583,7 +16701,7 @@ function TextToolbarPlugin() {
|
|
|
16583
16701
|
"background-color",
|
|
16584
16702
|
""
|
|
16585
16703
|
);
|
|
16586
|
-
if ((0,
|
|
16704
|
+
if ((0, import_lexical99.$isElementNode)(element)) {
|
|
16587
16705
|
newToolbarState.textAlign = element.getFormatType();
|
|
16588
16706
|
} else {
|
|
16589
16707
|
newToolbarState.textAlign = "left";
|
|
@@ -16593,17 +16711,17 @@ function TextToolbarPlugin() {
|
|
|
16593
16711
|
}
|
|
16594
16712
|
return false;
|
|
16595
16713
|
},
|
|
16596
|
-
|
|
16714
|
+
import_lexical99.COMMAND_PRIORITY_HIGH
|
|
16597
16715
|
),
|
|
16598
16716
|
editor.registerCommand(
|
|
16599
|
-
|
|
16717
|
+
import_lexical99.KEY_ESCAPE_COMMAND,
|
|
16600
16718
|
() => {
|
|
16601
16719
|
if (popupToolbarRef.current?.isShown()) {
|
|
16602
16720
|
popupToolbarRef.current?.hideToolbar();
|
|
16603
16721
|
}
|
|
16604
16722
|
return false;
|
|
16605
16723
|
},
|
|
16606
|
-
|
|
16724
|
+
import_lexical99.COMMAND_PRIORITY_NORMAL
|
|
16607
16725
|
),
|
|
16608
16726
|
editor.registerRootListener(
|
|
16609
16727
|
(rootElement, prevRootElement) => {
|
|
@@ -16897,7 +17015,7 @@ function TextToolbarPlugin() {
|
|
|
16897
17015
|
onClick: () => {
|
|
16898
17016
|
clearFormatting();
|
|
16899
17017
|
const selectedNode = selectedNodeRef.current;
|
|
16900
|
-
if ((0,
|
|
17018
|
+
if ((0, import_lexical99.$isParagraphNode)(selectedNode)) {
|
|
16901
17019
|
activeEditorRef.current?.getEditorState().read(() => {
|
|
16902
17020
|
const foundParentTableNode = getParentNodeType(
|
|
16903
17021
|
selectedNode,
|
|
@@ -16967,7 +17085,7 @@ function TextToolbarPlugin() {
|
|
|
16967
17085
|
}
|
|
16968
17086
|
return resultList;
|
|
16969
17087
|
}, [toolbarState, selectionType, activeEditorRef.current]);
|
|
16970
|
-
return /* @__PURE__ */ (0,
|
|
17088
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(PopupToolbar, { ref: popupToolbarRef, menu: menuItems });
|
|
16971
17089
|
}
|
|
16972
17090
|
|
|
16973
17091
|
// src/plugins/TypeaheadMenuPlugin/renderCalloutModuleMenu.tsx
|
|
@@ -17010,7 +17128,7 @@ function renderCalloutModuleMenu(popupRef, targetNodeKeyRef, activeEditorRef) {
|
|
|
17010
17128
|
// src/plugins/TypeaheadMenuPlugin/renderDefaultComponentsMenu.tsx
|
|
17011
17129
|
var import_list14 = require("@lexical/list");
|
|
17012
17130
|
var import_rich_text11 = require("@lexical/rich-text");
|
|
17013
|
-
var
|
|
17131
|
+
var import_lexical100 = require("lexical");
|
|
17014
17132
|
var import_lucide_react28 = require("lucide-react");
|
|
17015
17133
|
function renderDefaultComponentsMenu(popupRef, targetNodeKeyRef, activeEditorRef) {
|
|
17016
17134
|
return [
|
|
@@ -17027,7 +17145,7 @@ function renderDefaultComponentsMenu(popupRef, targetNodeKeyRef, activeEditorRef
|
|
|
17027
17145
|
onClick: () => {
|
|
17028
17146
|
activeEditorRef.current?.update(() => {
|
|
17029
17147
|
if (targetNodeKeyRef.current) {
|
|
17030
|
-
const targetNode = (0,
|
|
17148
|
+
const targetNode = (0, import_lexical100.$getNodeByKey)(
|
|
17031
17149
|
targetNodeKeyRef.current
|
|
17032
17150
|
);
|
|
17033
17151
|
if (targetNode) {
|
|
@@ -17048,7 +17166,7 @@ function renderDefaultComponentsMenu(popupRef, targetNodeKeyRef, activeEditorRef
|
|
|
17048
17166
|
onClick: () => {
|
|
17049
17167
|
activeEditorRef.current?.update(() => {
|
|
17050
17168
|
if (targetNodeKeyRef.current) {
|
|
17051
|
-
const targetNode = (0,
|
|
17169
|
+
const targetNode = (0, import_lexical100.$getNodeByKey)(
|
|
17052
17170
|
targetNodeKeyRef.current
|
|
17053
17171
|
);
|
|
17054
17172
|
if (targetNode) {
|
|
@@ -17069,7 +17187,7 @@ function renderDefaultComponentsMenu(popupRef, targetNodeKeyRef, activeEditorRef
|
|
|
17069
17187
|
onClick: () => {
|
|
17070
17188
|
activeEditorRef.current?.update(() => {
|
|
17071
17189
|
if (targetNodeKeyRef.current) {
|
|
17072
|
-
const targetNode = (0,
|
|
17190
|
+
const targetNode = (0, import_lexical100.$getNodeByKey)(
|
|
17073
17191
|
targetNodeKeyRef.current
|
|
17074
17192
|
);
|
|
17075
17193
|
if (targetNode) {
|
|
@@ -17101,11 +17219,11 @@ function renderDefaultComponentsMenu(popupRef, targetNodeKeyRef, activeEditorRef
|
|
|
17101
17219
|
onClick: () => {
|
|
17102
17220
|
activeEditorRef.current?.update(() => {
|
|
17103
17221
|
if (targetNodeKeyRef.current) {
|
|
17104
|
-
const targetNode = (0,
|
|
17222
|
+
const targetNode = (0, import_lexical100.$getNodeByKey)(
|
|
17105
17223
|
targetNodeKeyRef.current
|
|
17106
17224
|
);
|
|
17107
17225
|
if (targetNode) {
|
|
17108
|
-
const newParagraphNode = (0,
|
|
17226
|
+
const newParagraphNode = (0, import_lexical100.$createParagraphNode)();
|
|
17109
17227
|
targetNode.replace(newParagraphNode);
|
|
17110
17228
|
newParagraphNode.select();
|
|
17111
17229
|
activeEditorRef.current?.dispatchCommand(
|
|
@@ -17132,11 +17250,11 @@ function renderDefaultComponentsMenu(popupRef, targetNodeKeyRef, activeEditorRef
|
|
|
17132
17250
|
onClick: () => {
|
|
17133
17251
|
activeEditorRef.current?.update(() => {
|
|
17134
17252
|
if (targetNodeKeyRef.current) {
|
|
17135
|
-
const targetNode = (0,
|
|
17253
|
+
const targetNode = (0, import_lexical100.$getNodeByKey)(
|
|
17136
17254
|
targetNodeKeyRef.current
|
|
17137
17255
|
);
|
|
17138
17256
|
if (targetNode) {
|
|
17139
|
-
const newParagraphNode = (0,
|
|
17257
|
+
const newParagraphNode = (0, import_lexical100.$createParagraphNode)();
|
|
17140
17258
|
targetNode.replace(newParagraphNode);
|
|
17141
17259
|
newParagraphNode.select();
|
|
17142
17260
|
activeEditorRef.current?.dispatchCommand(
|
|
@@ -17163,13 +17281,13 @@ function renderDefaultComponentsMenu(popupRef, targetNodeKeyRef, activeEditorRef
|
|
|
17163
17281
|
onClick: () => {
|
|
17164
17282
|
activeEditorRef.current?.update(() => {
|
|
17165
17283
|
if (targetNodeKeyRef.current) {
|
|
17166
|
-
const targetNode = (0,
|
|
17284
|
+
const targetNode = (0, import_lexical100.$getNodeByKey)(
|
|
17167
17285
|
targetNodeKeyRef.current
|
|
17168
17286
|
);
|
|
17169
17287
|
if (targetNode) {
|
|
17170
17288
|
const newNode = $createHorizontalRuleNode();
|
|
17171
17289
|
targetNode.replace(newNode);
|
|
17172
|
-
const newParagraphNode = (0,
|
|
17290
|
+
const newParagraphNode = (0, import_lexical100.$createParagraphNode)();
|
|
17173
17291
|
newNode.insertAfter(newParagraphNode);
|
|
17174
17292
|
newParagraphNode.selectStart();
|
|
17175
17293
|
}
|
|
@@ -17416,12 +17534,12 @@ var import_LexicalComposerContext67 = require("@lexical/react/LexicalComposerCon
|
|
|
17416
17534
|
var import_rich_text12 = require("@lexical/rich-text");
|
|
17417
17535
|
var import_table17 = require("@lexical/table");
|
|
17418
17536
|
var import_utils35 = require("@lexical/utils");
|
|
17419
|
-
var
|
|
17537
|
+
var import_lexical102 = require("lexical");
|
|
17420
17538
|
var import_react100 = require("react");
|
|
17421
17539
|
|
|
17422
17540
|
// src/plugins/TypeaheadMenuPlugin/renderFillInTheBlankMenu.tsx
|
|
17423
17541
|
var import_list15 = require("@lexical/list");
|
|
17424
|
-
var
|
|
17542
|
+
var import_lexical101 = require("lexical");
|
|
17425
17543
|
var import_lucide_react32 = require("lucide-react");
|
|
17426
17544
|
function renderFillInTheBlankMenu(popupRef, targetNodeKeyRef, activeEditorRef) {
|
|
17427
17545
|
return [
|
|
@@ -17444,11 +17562,11 @@ function renderFillInTheBlankMenu(popupRef, targetNodeKeyRef, activeEditorRef) {
|
|
|
17444
17562
|
onClick: () => {
|
|
17445
17563
|
activeEditorRef.current?.update(() => {
|
|
17446
17564
|
if (targetNodeKeyRef.current) {
|
|
17447
|
-
const targetNode = (0,
|
|
17565
|
+
const targetNode = (0, import_lexical101.$getNodeByKey)(
|
|
17448
17566
|
targetNodeKeyRef.current
|
|
17449
17567
|
);
|
|
17450
17568
|
if (targetNode) {
|
|
17451
|
-
const newParagraphNode = (0,
|
|
17569
|
+
const newParagraphNode = (0, import_lexical101.$createParagraphNode)();
|
|
17452
17570
|
targetNode.replace(newParagraphNode);
|
|
17453
17571
|
newParagraphNode.select();
|
|
17454
17572
|
activeEditorRef.current?.dispatchCommand(
|
|
@@ -17475,11 +17593,11 @@ function renderFillInTheBlankMenu(popupRef, targetNodeKeyRef, activeEditorRef) {
|
|
|
17475
17593
|
onClick: () => {
|
|
17476
17594
|
activeEditorRef.current?.update(() => {
|
|
17477
17595
|
if (targetNodeKeyRef.current) {
|
|
17478
|
-
const targetNode = (0,
|
|
17596
|
+
const targetNode = (0, import_lexical101.$getNodeByKey)(
|
|
17479
17597
|
targetNodeKeyRef.current
|
|
17480
17598
|
);
|
|
17481
17599
|
if (targetNode) {
|
|
17482
|
-
const newParagraphNode = (0,
|
|
17600
|
+
const newParagraphNode = (0, import_lexical101.$createParagraphNode)();
|
|
17483
17601
|
targetNode.replace(newParagraphNode);
|
|
17484
17602
|
newParagraphNode.select();
|
|
17485
17603
|
activeEditorRef.current?.dispatchCommand(
|
|
@@ -17526,7 +17644,7 @@ function renderFillInTheBlankMenu(popupRef, targetNodeKeyRef, activeEditorRef) {
|
|
|
17526
17644
|
}
|
|
17527
17645
|
|
|
17528
17646
|
// src/plugins/TypeaheadMenuPlugin/TypeaheadMenuPlugin.tsx
|
|
17529
|
-
var
|
|
17647
|
+
var import_jsx_runtime123 = require("react/jsx-runtime");
|
|
17530
17648
|
function TypeaheadMenuPlugin() {
|
|
17531
17649
|
const { hasModule, modulesNumber } = useBlockEditor();
|
|
17532
17650
|
const [editor] = (0, import_LexicalComposerContext67.useLexicalComposerContext)();
|
|
@@ -17539,8 +17657,8 @@ function TypeaheadMenuPlugin() {
|
|
|
17539
17657
|
const [activeDecorator, setActiveDecorator] = (0, import_react100.useState)();
|
|
17540
17658
|
const handleUpdate = () => {
|
|
17541
17659
|
activeEditorRef.current?.getEditorState().read(() => {
|
|
17542
|
-
const selection = (0,
|
|
17543
|
-
if ((0,
|
|
17660
|
+
const selection = (0, import_lexical102.$getSelection)();
|
|
17661
|
+
if ((0, import_lexical102.$isRangeSelection)(selection)) {
|
|
17544
17662
|
if (selection.isCollapsed()) {
|
|
17545
17663
|
const node = selection.focus.getNode();
|
|
17546
17664
|
const nodeKey = node.getKey();
|
|
@@ -17564,7 +17682,7 @@ function TypeaheadMenuPlugin() {
|
|
|
17564
17682
|
"data-placeholder",
|
|
17565
17683
|
`Heading ${level}`
|
|
17566
17684
|
);
|
|
17567
|
-
} else if ((0,
|
|
17685
|
+
} else if ((0, import_lexical102.$isParagraphNode)(node)) {
|
|
17568
17686
|
if (node.getChildrenSize() === 0) {
|
|
17569
17687
|
if (hasModule("Variables")) {
|
|
17570
17688
|
dom.setAttribute(
|
|
@@ -17589,7 +17707,7 @@ function TypeaheadMenuPlugin() {
|
|
|
17589
17707
|
const text = anchorNode.getTextContent().slice(0, anchorOffset);
|
|
17590
17708
|
if (text) {
|
|
17591
17709
|
if (text.startsWith("/")) {
|
|
17592
|
-
if ((0,
|
|
17710
|
+
if ((0, import_lexical102.$isParagraphNode)(parentNode)) {
|
|
17593
17711
|
const tableCellNode = parentNode.getParent();
|
|
17594
17712
|
if (!(0, import_table17.$isTableCellNode)(tableCellNode)) {
|
|
17595
17713
|
const match = triggerFn(text, editor);
|
|
@@ -17668,24 +17786,24 @@ function TypeaheadMenuPlugin() {
|
|
|
17668
17786
|
handleUpdate();
|
|
17669
17787
|
return true;
|
|
17670
17788
|
},
|
|
17671
|
-
|
|
17789
|
+
import_lexical102.COMMAND_PRIORITY_HIGH
|
|
17672
17790
|
),
|
|
17673
17791
|
editor.registerCommand(
|
|
17674
|
-
|
|
17792
|
+
import_lexical102.KEY_ENTER_COMMAND,
|
|
17675
17793
|
execute,
|
|
17676
|
-
|
|
17794
|
+
import_lexical102.COMMAND_PRIORITY_HIGH
|
|
17677
17795
|
),
|
|
17678
17796
|
editor.registerCommand(
|
|
17679
|
-
|
|
17797
|
+
import_lexical102.KEY_ESCAPE_COMMAND,
|
|
17680
17798
|
() => {
|
|
17681
17799
|
hidePopup();
|
|
17682
17800
|
editor.update(() => {
|
|
17683
17801
|
if (targetNodeKeyRef.current) {
|
|
17684
|
-
const foundNode = (0,
|
|
17802
|
+
const foundNode = (0, import_lexical102.$getNodeByKey)(
|
|
17685
17803
|
targetNodeKeyRef.current
|
|
17686
17804
|
);
|
|
17687
|
-
if ((0,
|
|
17688
|
-
const newParagraph = (0,
|
|
17805
|
+
if ((0, import_lexical102.$isParagraphNode)(foundNode)) {
|
|
17806
|
+
const newParagraph = (0, import_lexical102.$createParagraphNode)();
|
|
17689
17807
|
foundNode.replace(newParagraph);
|
|
17690
17808
|
newParagraph.selectEnd();
|
|
17691
17809
|
}
|
|
@@ -17693,20 +17811,20 @@ function TypeaheadMenuPlugin() {
|
|
|
17693
17811
|
});
|
|
17694
17812
|
return false;
|
|
17695
17813
|
},
|
|
17696
|
-
|
|
17814
|
+
import_lexical102.COMMAND_PRIORITY_HIGH
|
|
17697
17815
|
),
|
|
17698
17816
|
editor.registerCommand(
|
|
17699
|
-
|
|
17817
|
+
import_lexical102.KEY_ARROW_DOWN_COMMAND,
|
|
17700
17818
|
handleMenuItemSelect("down"),
|
|
17701
|
-
|
|
17819
|
+
import_lexical102.COMMAND_PRIORITY_HIGH
|
|
17702
17820
|
),
|
|
17703
17821
|
editor.registerCommand(
|
|
17704
|
-
|
|
17822
|
+
import_lexical102.KEY_ARROW_UP_COMMAND,
|
|
17705
17823
|
handleMenuItemSelect("up"),
|
|
17706
|
-
|
|
17824
|
+
import_lexical102.COMMAND_PRIORITY_HIGH
|
|
17707
17825
|
),
|
|
17708
17826
|
editor.registerCommand(
|
|
17709
|
-
|
|
17827
|
+
import_lexical102.BLUR_COMMAND,
|
|
17710
17828
|
(_payload, activeEditor) => {
|
|
17711
17829
|
activeEditor.getEditorState().read(() => {
|
|
17712
17830
|
const allPlaceholders = activeEditor.getRootElement()?.querySelectorAll("[data-placeholder]");
|
|
@@ -17717,14 +17835,14 @@ function TypeaheadMenuPlugin() {
|
|
|
17717
17835
|
);
|
|
17718
17836
|
});
|
|
17719
17837
|
}
|
|
17720
|
-
const rootNode = (0,
|
|
17838
|
+
const rootNode = (0, import_lexical102.$getRoot)();
|
|
17721
17839
|
if (rootNode) {
|
|
17722
17840
|
const childrenKeys = rootNode.getChildrenKeys();
|
|
17723
17841
|
if (childrenKeys.length > 0) {
|
|
17724
17842
|
const children = rootNode.getChildren();
|
|
17725
17843
|
let emptyCounter = 0;
|
|
17726
17844
|
for (const childNode of children) {
|
|
17727
|
-
if ((0,
|
|
17845
|
+
if ((0, import_lexical102.$isParagraphNode)(childNode) && childNode.getTextContent().trim() === "" && childNode.getChildren().length === 0) {
|
|
17728
17846
|
emptyCounter++;
|
|
17729
17847
|
}
|
|
17730
17848
|
}
|
|
@@ -17744,7 +17862,7 @@ function TypeaheadMenuPlugin() {
|
|
|
17744
17862
|
});
|
|
17745
17863
|
return false;
|
|
17746
17864
|
},
|
|
17747
|
-
|
|
17865
|
+
import_lexical102.COMMAND_PRIORITY_HIGH
|
|
17748
17866
|
)
|
|
17749
17867
|
);
|
|
17750
17868
|
}, [editor]);
|
|
@@ -17809,7 +17927,7 @@ function TypeaheadMenuPlugin() {
|
|
|
17809
17927
|
}
|
|
17810
17928
|
return menuItems;
|
|
17811
17929
|
}, [editor, modulesNumber, activeDecorator]);
|
|
17812
|
-
return /* @__PURE__ */ (0,
|
|
17930
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
17813
17931
|
PopupMenu,
|
|
17814
17932
|
{
|
|
17815
17933
|
ref: popupRef,
|
|
@@ -18519,7 +18637,7 @@ var defaultThemeSettings = {
|
|
|
18519
18637
|
};
|
|
18520
18638
|
|
|
18521
18639
|
// src/theme/ThemeProvider.tsx
|
|
18522
|
-
var
|
|
18640
|
+
var import_jsx_runtime124 = require("react/jsx-runtime");
|
|
18523
18641
|
var ThemeContext = (0, import_react101.createContext)(
|
|
18524
18642
|
void 0
|
|
18525
18643
|
);
|
|
@@ -18552,7 +18670,7 @@ function ThemeProvider({
|
|
|
18552
18670
|
);
|
|
18553
18671
|
rootElementRef.current?.classList.add(`theme-${effectiveTheme}`);
|
|
18554
18672
|
}, [effectiveTheme]);
|
|
18555
|
-
return /* @__PURE__ */ (0,
|
|
18673
|
+
return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(ThemeContext.Provider, { value: { theme, effectiveTheme }, children: /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
|
|
18556
18674
|
"article",
|
|
18557
18675
|
{
|
|
18558
18676
|
ref: rootElementRef,
|
|
@@ -18569,7 +18687,7 @@ function ThemeProvider({
|
|
|
18569
18687
|
)
|
|
18570
18688
|
},
|
|
18571
18689
|
children: [
|
|
18572
|
-
/* @__PURE__ */ (0,
|
|
18690
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
|
|
18573
18691
|
"style",
|
|
18574
18692
|
{
|
|
18575
18693
|
dangerouslySetInnerHTML: {
|
|
@@ -18592,7 +18710,7 @@ var import_LexicalOnChangePlugin = require("@lexical/react/LexicalOnChangePlugin
|
|
|
18592
18710
|
var import_LexicalRichTextPlugin9 = require("@lexical/react/LexicalRichTextPlugin");
|
|
18593
18711
|
var import_LexicalTabIndentationPlugin2 = require("@lexical/react/LexicalTabIndentationPlugin");
|
|
18594
18712
|
var import_react102 = __toESM(require("react"));
|
|
18595
|
-
var
|
|
18713
|
+
var import_jsx_runtime125 = require("react/jsx-runtime");
|
|
18596
18714
|
var TOGGLE_EDITING_MODE = "TOGGLE_EDITING_MODE";
|
|
18597
18715
|
var RESET_EDITING_MODE = "RESET_EDITING_MODE";
|
|
18598
18716
|
var BlockEditorContext = import_react102.default.createContext(null);
|
|
@@ -18706,7 +18824,7 @@ function BlockEditor(props) {
|
|
|
18706
18824
|
);
|
|
18707
18825
|
};
|
|
18708
18826
|
}, []);
|
|
18709
|
-
return /* @__PURE__ */ (0,
|
|
18827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
18710
18828
|
BlockEditorContext.Provider,
|
|
18711
18829
|
{
|
|
18712
18830
|
value: {
|
|
@@ -18762,62 +18880,62 @@ function BlockEditor(props) {
|
|
|
18762
18880
|
},
|
|
18763
18881
|
drawer: drawerRef.current,
|
|
18764
18882
|
isBlockEditorReady,
|
|
18765
|
-
renderSettings: renderSettings ? renderSettings : () => /* @__PURE__ */ (0,
|
|
18883
|
+
renderSettings: renderSettings ? renderSettings : () => /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("div", {})
|
|
18766
18884
|
},
|
|
18767
|
-
children: /* @__PURE__ */ (0,
|
|
18768
|
-
/* @__PURE__ */ (0,
|
|
18885
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(ResizeObserver, { children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(ThemeProvider, { theme, themeSettings, children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(SharedHistoryContext, { children: /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(NodeProvider, { children: [
|
|
18886
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
18769
18887
|
"main",
|
|
18770
18888
|
{
|
|
18771
18889
|
className: `${settingsPanelSwitch === "on" ? "narrow" : ""}`,
|
|
18772
|
-
children: /* @__PURE__ */ (0,
|
|
18773
|
-
/* @__PURE__ */ (0,
|
|
18890
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(import_LexicalComposer.LexicalComposer, { initialConfig: { ...initialConfig }, children: [
|
|
18891
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
18774
18892
|
EditorRefPlugin,
|
|
18775
18893
|
{
|
|
18776
18894
|
onMountRef: (editor) => editorRef.current = editor
|
|
18777
18895
|
}
|
|
18778
18896
|
),
|
|
18779
|
-
/* @__PURE__ */ (0,
|
|
18780
|
-
/* @__PURE__ */ (0,
|
|
18781
|
-
/* @__PURE__ */ (0,
|
|
18897
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(AutoFocusPlugin, {}),
|
|
18898
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(AutoBottomParagraphPlugin, {}),
|
|
18899
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
18782
18900
|
import_LexicalHistoryPlugin12.HistoryPlugin,
|
|
18783
18901
|
{
|
|
18784
18902
|
externalHistoryState: historyState
|
|
18785
18903
|
}
|
|
18786
18904
|
),
|
|
18787
|
-
/* @__PURE__ */ (0,
|
|
18905
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
18788
18906
|
import_LexicalOnChangePlugin.OnChangePlugin,
|
|
18789
18907
|
{
|
|
18790
18908
|
onChange: handleChange,
|
|
18791
18909
|
ignoreSelectionChange: true
|
|
18792
18910
|
}
|
|
18793
18911
|
),
|
|
18794
|
-
/* @__PURE__ */ (0,
|
|
18795
|
-
/* @__PURE__ */ (0,
|
|
18912
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(OnNestedChangePlugin, { onChange: handleChange }),
|
|
18913
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
18796
18914
|
import_LexicalRichTextPlugin9.RichTextPlugin,
|
|
18797
18915
|
{
|
|
18798
|
-
contentEditable: /* @__PURE__ */ (0,
|
|
18916
|
+
contentEditable: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(ContentEditable, {}),
|
|
18799
18917
|
placeholder: null,
|
|
18800
18918
|
ErrorBoundary: import_LexicalErrorBoundary11.LexicalErrorBoundary
|
|
18801
18919
|
}
|
|
18802
18920
|
),
|
|
18803
|
-
/* @__PURE__ */ (0,
|
|
18804
|
-
/* @__PURE__ */ (0,
|
|
18805
|
-
/* @__PURE__ */ (0,
|
|
18806
|
-
/* @__PURE__ */ (0,
|
|
18921
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(NodePastePlugin, {}),
|
|
18922
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(import_LexicalListPlugin2.ListPlugin, {}),
|
|
18923
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(ListLevelLimitPlugin, {}),
|
|
18924
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(import_LexicalTabIndentationPlugin2.TabIndentationPlugin, {}),
|
|
18807
18925
|
children,
|
|
18808
|
-
/* @__PURE__ */ (0,
|
|
18809
|
-
/* @__PURE__ */ (0,
|
|
18810
|
-
/* @__PURE__ */ (0,
|
|
18811
|
-
/* @__PURE__ */ (0,
|
|
18812
|
-
/* @__PURE__ */ (0,
|
|
18813
|
-
/* @__PURE__ */ (0,
|
|
18814
|
-
/* @__PURE__ */ (0,
|
|
18815
|
-
/* @__PURE__ */ (0,
|
|
18816
|
-
/* @__PURE__ */ (0,
|
|
18926
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(TypeaheadMenuPlugin, {}),
|
|
18927
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(TypeaheadMenuAgentPlugin, {}),
|
|
18928
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(NodeMouseAnchorPlugin, {}),
|
|
18929
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(NodeMousePlugin, {}),
|
|
18930
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(TextToolbarPlugin, {}),
|
|
18931
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(TextToolbarAgentPlugin, {}),
|
|
18932
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(TypeaheadVariableAgentPlugin, {}),
|
|
18933
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(VariableComponentPlugin, {}),
|
|
18934
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(MarkdownPlugin, {})
|
|
18817
18935
|
] })
|
|
18818
18936
|
}
|
|
18819
18937
|
),
|
|
18820
|
-
/* @__PURE__ */ (0,
|
|
18938
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Drawer, { ref: drawerRef })
|
|
18821
18939
|
] }) }) }) })
|
|
18822
18940
|
}
|
|
18823
18941
|
);
|
|
@@ -18833,30 +18951,30 @@ var useBlockEditor = () => {
|
|
|
18833
18951
|
};
|
|
18834
18952
|
|
|
18835
18953
|
// src/BlockEditorStyle.tsx
|
|
18836
|
-
var
|
|
18954
|
+
var import_jsx_runtime126 = require("react/jsx-runtime");
|
|
18837
18955
|
function BlockEditorStyle(props) {
|
|
18838
18956
|
const { children, theme, themeSettings } = props;
|
|
18839
|
-
return /* @__PURE__ */ (0,
|
|
18957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(ThemeProvider, { theme, themeSettings, children });
|
|
18840
18958
|
}
|
|
18841
18959
|
|
|
18842
18960
|
// src/modules/Callout.tsx
|
|
18843
18961
|
var import_react103 = require("react");
|
|
18844
|
-
var
|
|
18962
|
+
var import_jsx_runtime127 = require("react/jsx-runtime");
|
|
18845
18963
|
function Callout() {
|
|
18846
18964
|
const { registerModule } = useBlockEditor();
|
|
18847
18965
|
(0, import_react103.useEffect)(() => {
|
|
18848
18966
|
registerModule("Callout");
|
|
18849
18967
|
}, [registerModule]);
|
|
18850
|
-
return /* @__PURE__ */ (0,
|
|
18968
|
+
return /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(CalloutBoxPlugin, {});
|
|
18851
18969
|
}
|
|
18852
18970
|
|
|
18853
18971
|
// src/plugins/TreeViewPlugin/index.tsx
|
|
18854
18972
|
var import_LexicalComposerContext68 = require("@lexical/react/LexicalComposerContext");
|
|
18855
18973
|
var import_LexicalTreeView = require("@lexical/react/LexicalTreeView");
|
|
18856
|
-
var
|
|
18974
|
+
var import_jsx_runtime128 = require("react/jsx-runtime");
|
|
18857
18975
|
function TreeViewPlugin() {
|
|
18858
18976
|
const [editor] = (0, import_LexicalComposerContext68.useLexicalComposerContext)();
|
|
18859
|
-
return /* @__PURE__ */ (0,
|
|
18977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
18860
18978
|
import_LexicalTreeView.TreeView,
|
|
18861
18979
|
{
|
|
18862
18980
|
viewClassName: "tree-view-output",
|
|
@@ -18872,36 +18990,36 @@ function TreeViewPlugin() {
|
|
|
18872
18990
|
|
|
18873
18991
|
// src/modules/Debug.tsx
|
|
18874
18992
|
var import_react104 = require("react");
|
|
18875
|
-
var
|
|
18993
|
+
var import_jsx_runtime129 = require("react/jsx-runtime");
|
|
18876
18994
|
function Debug() {
|
|
18877
18995
|
const { registerModule } = useBlockEditor();
|
|
18878
18996
|
(0, import_react104.useEffect)(() => {
|
|
18879
18997
|
registerModule("Debug");
|
|
18880
18998
|
}, [registerModule]);
|
|
18881
|
-
return /* @__PURE__ */ (0,
|
|
18999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(TreeViewPlugin, {});
|
|
18882
19000
|
}
|
|
18883
19001
|
|
|
18884
19002
|
// src/modules/Image.tsx
|
|
18885
19003
|
var import_react105 = require("react");
|
|
18886
|
-
var
|
|
19004
|
+
var import_jsx_runtime130 = require("react/jsx-runtime");
|
|
18887
19005
|
function Image(props) {
|
|
18888
19006
|
const { imageSettings } = props;
|
|
18889
19007
|
const { registerModule } = useBlockEditor();
|
|
18890
19008
|
(0, import_react105.useEffect)(() => {
|
|
18891
19009
|
registerModule("Image");
|
|
18892
19010
|
}, [registerModule]);
|
|
18893
|
-
return /* @__PURE__ */ (0,
|
|
19011
|
+
return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(import_jsx_runtime130.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(ImagePlugin, { imageSettings }) });
|
|
18894
19012
|
}
|
|
18895
19013
|
|
|
18896
19014
|
// src/plugins/LinkToolbarPlugin/LinkToolbarPlugin.tsx
|
|
18897
19015
|
var import_link4 = require("@lexical/link");
|
|
18898
19016
|
var import_LexicalComposerContext69 = require("@lexical/react/LexicalComposerContext");
|
|
18899
19017
|
var import_utils36 = require("@lexical/utils");
|
|
18900
|
-
var
|
|
19018
|
+
var import_lexical103 = require("lexical");
|
|
18901
19019
|
var import_debounce7 = __toESM(require("lodash-es/debounce"));
|
|
18902
19020
|
var import_lucide_react33 = require("lucide-react");
|
|
18903
19021
|
var import_react106 = require("react");
|
|
18904
|
-
var
|
|
19022
|
+
var import_jsx_runtime131 = require("react/jsx-runtime");
|
|
18905
19023
|
function LinkToolbarPlugin() {
|
|
18906
19024
|
const [editor] = (0, import_LexicalComposerContext69.useLexicalComposerContext)();
|
|
18907
19025
|
const popupToolbarRef = (0, import_react106.useRef)(null);
|
|
@@ -18930,7 +19048,7 @@ function LinkToolbarPlugin() {
|
|
|
18930
19048
|
(0, import_react106.useEffect)(() => {
|
|
18931
19049
|
return (0, import_utils36.mergeRegister)(
|
|
18932
19050
|
editor.registerCommand(
|
|
18933
|
-
|
|
19051
|
+
import_lexical103.CLICK_COMMAND,
|
|
18934
19052
|
(event, activeEditor) => {
|
|
18935
19053
|
if (popupToolbarRef.current) {
|
|
18936
19054
|
activeEditorRef.current = activeEditor;
|
|
@@ -18939,8 +19057,8 @@ function LinkToolbarPlugin() {
|
|
|
18939
19057
|
popupToolbarRef.current?.hideToolbar();
|
|
18940
19058
|
return;
|
|
18941
19059
|
}
|
|
18942
|
-
const selection = (0,
|
|
18943
|
-
if (!(0,
|
|
19060
|
+
const selection = (0, import_lexical103.$getSelection)();
|
|
19061
|
+
if (!(0, import_lexical103.$isRangeSelection)(selection)) {
|
|
18944
19062
|
popupToolbarRef.current?.hideToolbar();
|
|
18945
19063
|
return;
|
|
18946
19064
|
}
|
|
@@ -18959,7 +19077,7 @@ function LinkToolbarPlugin() {
|
|
|
18959
19077
|
return;
|
|
18960
19078
|
}
|
|
18961
19079
|
const selectionNode = selection.anchor.getNode();
|
|
18962
|
-
if ((0,
|
|
19080
|
+
if ((0, import_lexical103.$isTextNode)(selectionNode)) {
|
|
18963
19081
|
linkTextNodeRef.current = selectionNode;
|
|
18964
19082
|
linkTextNodeOffsetRef.current = selection.focus.offset;
|
|
18965
19083
|
}
|
|
@@ -18989,15 +19107,15 @@ function LinkToolbarPlugin() {
|
|
|
18989
19107
|
}
|
|
18990
19108
|
return false;
|
|
18991
19109
|
},
|
|
18992
|
-
|
|
19110
|
+
import_lexical103.COMMAND_PRIORITY_LOW
|
|
18993
19111
|
),
|
|
18994
19112
|
editor.registerCommand(
|
|
18995
|
-
|
|
19113
|
+
import_lexical103.KEY_ESCAPE_COMMAND,
|
|
18996
19114
|
() => {
|
|
18997
19115
|
handleClose();
|
|
18998
19116
|
return false;
|
|
18999
19117
|
},
|
|
19000
|
-
|
|
19118
|
+
import_lexical103.COMMAND_PRIORITY_HIGH
|
|
19001
19119
|
)
|
|
19002
19120
|
);
|
|
19003
19121
|
}, [editor]);
|
|
@@ -19011,12 +19129,12 @@ function LinkToolbarPlugin() {
|
|
|
19011
19129
|
}, [editor]);
|
|
19012
19130
|
const linkUrl = linkNode?.linkUrl;
|
|
19013
19131
|
const linkTitle = linkNode?.linkUrl;
|
|
19014
|
-
return /* @__PURE__ */ (0,
|
|
19132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
19015
19133
|
PopupToolbar,
|
|
19016
19134
|
{
|
|
19017
19135
|
ref: popupToolbarRef,
|
|
19018
19136
|
onEscape: handleClose,
|
|
19019
|
-
toolbar: /* @__PURE__ */ (0,
|
|
19137
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(
|
|
19020
19138
|
"div",
|
|
19021
19139
|
{
|
|
19022
19140
|
style: {
|
|
@@ -19029,23 +19147,23 @@ function LinkToolbarPlugin() {
|
|
|
19029
19147
|
padding: "var(--sl-spacing-2x-small) var(--sl-spacing-x-small) var(--sl-spacing-2x-small) var(--sl-spacing-medium)"
|
|
19030
19148
|
},
|
|
19031
19149
|
children: [
|
|
19032
|
-
/* @__PURE__ */ (0,
|
|
19150
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("a", { href: linkUrl, target: linkNode?.linkTarget || "", children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
19033
19151
|
"sl-tooltip",
|
|
19034
19152
|
{
|
|
19035
19153
|
style: { "--show-delay": "1800" },
|
|
19036
19154
|
hoist: true,
|
|
19037
19155
|
content: linkUrl || "[Empty URL]",
|
|
19038
|
-
children: /* @__PURE__ */ (0,
|
|
19156
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("span", { className: "line-short-20", children: linkTitle })
|
|
19039
19157
|
}
|
|
19040
19158
|
) }) }),
|
|
19041
|
-
/* @__PURE__ */ (0,
|
|
19042
|
-
/* @__PURE__ */ (0,
|
|
19159
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(Stack, { className: "stack__row", children: [
|
|
19160
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
19043
19161
|
"sl-tooltip",
|
|
19044
19162
|
{
|
|
19045
19163
|
style: { "--show-delay": "1800" },
|
|
19046
19164
|
hoist: "hoist",
|
|
19047
19165
|
content: "Edit Link",
|
|
19048
|
-
children: /* @__PURE__ */ (0,
|
|
19166
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
19049
19167
|
Button,
|
|
19050
19168
|
{
|
|
19051
19169
|
size: "small",
|
|
@@ -19056,7 +19174,7 @@ function LinkToolbarPlugin() {
|
|
|
19056
19174
|
if (activeEditorRef.current) {
|
|
19057
19175
|
activeEditorRef.current.update(() => {
|
|
19058
19176
|
if (linkTextNodeRef.current) {
|
|
19059
|
-
const newSelection = (0,
|
|
19177
|
+
const newSelection = (0, import_lexical103.$createRangeSelection)();
|
|
19060
19178
|
newSelection.anchor.set(
|
|
19061
19179
|
linkTextNodeRef.current.getKey(),
|
|
19062
19180
|
linkTextNodeOffsetRef.current || 0,
|
|
@@ -19084,13 +19202,13 @@ function LinkToolbarPlugin() {
|
|
|
19084
19202
|
)
|
|
19085
19203
|
}
|
|
19086
19204
|
) }),
|
|
19087
|
-
/* @__PURE__ */ (0,
|
|
19205
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
19088
19206
|
"sl-tooltip",
|
|
19089
19207
|
{
|
|
19090
19208
|
style: { "--show-delay": "1800" },
|
|
19091
19209
|
hoist: "hoist",
|
|
19092
19210
|
content: "Remove Link",
|
|
19093
|
-
children: /* @__PURE__ */ (0,
|
|
19211
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
19094
19212
|
Button,
|
|
19095
19213
|
{
|
|
19096
19214
|
size: "small",
|
|
@@ -19101,7 +19219,7 @@ function LinkToolbarPlugin() {
|
|
|
19101
19219
|
if (activeEditorRef.current) {
|
|
19102
19220
|
activeEditorRef.current.update(() => {
|
|
19103
19221
|
if (linkTextNodeRef.current) {
|
|
19104
|
-
const newSelection = (0,
|
|
19222
|
+
const newSelection = (0, import_lexical103.$createRangeSelection)();
|
|
19105
19223
|
newSelection.anchor.set(
|
|
19106
19224
|
linkTextNodeRef.current.getKey(),
|
|
19107
19225
|
linkTextNodeOffsetRef.current || 0,
|
|
@@ -19114,7 +19232,7 @@ function LinkToolbarPlugin() {
|
|
|
19114
19232
|
);
|
|
19115
19233
|
if (newSelection) {
|
|
19116
19234
|
popupToolbarRef.current?.hideToolbar();
|
|
19117
|
-
(0,
|
|
19235
|
+
(0, import_lexical103.$setSelection)(newSelection);
|
|
19118
19236
|
(0, import_link4.$toggleLink)(null);
|
|
19119
19237
|
}
|
|
19120
19238
|
}
|
|
@@ -19125,13 +19243,13 @@ function LinkToolbarPlugin() {
|
|
|
19125
19243
|
)
|
|
19126
19244
|
}
|
|
19127
19245
|
) }),
|
|
19128
|
-
/* @__PURE__ */ (0,
|
|
19246
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
19129
19247
|
"sl-tooltip",
|
|
19130
19248
|
{
|
|
19131
19249
|
style: { "--show-delay": "1800" },
|
|
19132
19250
|
hoist: "hoist",
|
|
19133
19251
|
content: "Close",
|
|
19134
|
-
children: /* @__PURE__ */ (0,
|
|
19252
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
19135
19253
|
Button,
|
|
19136
19254
|
{
|
|
19137
19255
|
size: "small",
|
|
@@ -19154,25 +19272,25 @@ function LinkToolbarPlugin() {
|
|
|
19154
19272
|
|
|
19155
19273
|
// src/modules/Link.tsx
|
|
19156
19274
|
var import_react107 = require("react");
|
|
19157
|
-
var
|
|
19275
|
+
var import_jsx_runtime132 = require("react/jsx-runtime");
|
|
19158
19276
|
function Link() {
|
|
19159
19277
|
const { registerModule } = useBlockEditor();
|
|
19160
19278
|
(0, import_react107.useEffect)(() => {
|
|
19161
19279
|
registerModule("Link");
|
|
19162
19280
|
}, [registerModule]);
|
|
19163
|
-
return /* @__PURE__ */ (0,
|
|
19164
|
-
/* @__PURE__ */ (0,
|
|
19165
|
-
/* @__PURE__ */ (0,
|
|
19281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(import_jsx_runtime132.Fragment, { children: [
|
|
19282
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(LinkEditorPlugin, {}),
|
|
19283
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(LinkToolbarPlugin, {})
|
|
19166
19284
|
] });
|
|
19167
19285
|
}
|
|
19168
19286
|
|
|
19169
19287
|
// src/plugins/EssayQuestionPlugin/EssayQuestionPlugin.tsx
|
|
19170
19288
|
var import_LexicalComposerContext70 = require("@lexical/react/LexicalComposerContext");
|
|
19171
19289
|
var import_utils37 = require("@lexical/utils");
|
|
19172
|
-
var
|
|
19290
|
+
var import_lexical104 = require("lexical");
|
|
19173
19291
|
var import_react108 = require("react");
|
|
19174
|
-
var
|
|
19175
|
-
var INSERT_ESSAY_QUESTION_COMMAND = (0,
|
|
19292
|
+
var import_jsx_runtime133 = require("react/jsx-runtime");
|
|
19293
|
+
var INSERT_ESSAY_QUESTION_COMMAND = (0, import_lexical104.createCommand)("INSERT_ESSAY_QUESTION_COMMAND");
|
|
19176
19294
|
function EssayQuestionPlugin() {
|
|
19177
19295
|
const [editor] = (0, import_LexicalComposerContext70.useLexicalComposerContext)();
|
|
19178
19296
|
(0, import_react108.useEffect)(() => {
|
|
@@ -19185,7 +19303,7 @@ function EssayQuestionPlugin() {
|
|
|
19185
19303
|
if (activeEditor === editor && nodeKey) {
|
|
19186
19304
|
let newNodeKey = void 0;
|
|
19187
19305
|
activeEditor.update(() => {
|
|
19188
|
-
const targetNode = (0,
|
|
19306
|
+
const targetNode = (0, import_lexical104.$getNodeByKey)(nodeKey);
|
|
19189
19307
|
if (targetNode) {
|
|
19190
19308
|
const essayNode = $createEssayQuestionNode(1, 100);
|
|
19191
19309
|
if (insertionMode === "replace") {
|
|
@@ -19195,26 +19313,26 @@ function EssayQuestionPlugin() {
|
|
|
19195
19313
|
} else if (insertionMode === "before") {
|
|
19196
19314
|
targetNode.insertBefore(essayNode);
|
|
19197
19315
|
}
|
|
19198
|
-
const selection = (0,
|
|
19316
|
+
const selection = (0, import_lexical104.$createNodeSelection)();
|
|
19199
19317
|
newNodeKey = essayNode.getKey();
|
|
19200
19318
|
selection.add(newNodeKey);
|
|
19201
|
-
(0,
|
|
19319
|
+
(0, import_lexical104.$setSelection)(selection);
|
|
19202
19320
|
}
|
|
19203
19321
|
});
|
|
19204
19322
|
}
|
|
19205
19323
|
}
|
|
19206
19324
|
return true;
|
|
19207
19325
|
},
|
|
19208
|
-
|
|
19326
|
+
import_lexical104.COMMAND_PRIORITY_EDITOR
|
|
19209
19327
|
)
|
|
19210
19328
|
);
|
|
19211
19329
|
}, [editor]);
|
|
19212
|
-
return /* @__PURE__ */ (0,
|
|
19330
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_jsx_runtime133.Fragment, {});
|
|
19213
19331
|
}
|
|
19214
19332
|
|
|
19215
19333
|
// src/plugins/FinancialStatementQuestionPlugin/FinancialStatementQuestionSettings.tsx
|
|
19216
19334
|
var import_LexicalComposerContext71 = require("@lexical/react/LexicalComposerContext");
|
|
19217
|
-
var
|
|
19335
|
+
var import_lexical105 = require("lexical");
|
|
19218
19336
|
var import_react109 = require("react");
|
|
19219
19337
|
|
|
19220
19338
|
// src/plugins/FinancialStatementQuestionPlugin/validatePointslnput.ts
|
|
@@ -19237,7 +19355,7 @@ function validatePointsInput6(input) {
|
|
|
19237
19355
|
}
|
|
19238
19356
|
|
|
19239
19357
|
// src/plugins/FinancialStatementQuestionPlugin/FinancialStatementQuestionSettings.tsx
|
|
19240
|
-
var
|
|
19358
|
+
var import_jsx_runtime134 = require("react/jsx-runtime");
|
|
19241
19359
|
function FinancialStatementQuestionSettings(props) {
|
|
19242
19360
|
const { nodeKey } = props;
|
|
19243
19361
|
const [editor] = (0, import_LexicalComposerContext71.useLexicalComposerContext)();
|
|
@@ -19246,7 +19364,7 @@ function FinancialStatementQuestionSettings(props) {
|
|
|
19246
19364
|
(0, import_react109.useEffect)(() => {
|
|
19247
19365
|
if (nodeKey) {
|
|
19248
19366
|
editor.getEditorState().read(() => {
|
|
19249
|
-
const fillInTheBlankNode = (0,
|
|
19367
|
+
const fillInTheBlankNode = (0, import_lexical105.$getNodeByKey)(nodeKey);
|
|
19250
19368
|
if (fillInTheBlankNode && $isFinancialStatementQuestionNode(fillInTheBlankNode)) {
|
|
19251
19369
|
setFoundNode(fillInTheBlankNode);
|
|
19252
19370
|
}
|
|
@@ -19256,7 +19374,7 @@ function FinancialStatementQuestionSettings(props) {
|
|
|
19256
19374
|
if (!foundNode) {
|
|
19257
19375
|
return null;
|
|
19258
19376
|
}
|
|
19259
|
-
return /* @__PURE__ */ (0,
|
|
19377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
19260
19378
|
TextInput,
|
|
19261
19379
|
{
|
|
19262
19380
|
ref: pointsTextInputRef,
|
|
@@ -19269,7 +19387,7 @@ function FinancialStatementQuestionSettings(props) {
|
|
|
19269
19387
|
label: "Points",
|
|
19270
19388
|
onChange: (value) => {
|
|
19271
19389
|
editor.update(() => {
|
|
19272
|
-
const targetNode = (0,
|
|
19390
|
+
const targetNode = (0, import_lexical105.$getNodeByKey)(nodeKey);
|
|
19273
19391
|
if (targetNode && $isFinancialStatementQuestionNode(targetNode)) {
|
|
19274
19392
|
try {
|
|
19275
19393
|
validatePointsInput6(value);
|
|
@@ -19288,10 +19406,10 @@ function FinancialStatementQuestionSettings(props) {
|
|
|
19288
19406
|
// src/plugins/FinancialStatementQuestionPlugin/FinancialStatementQuestionPlugin.tsx
|
|
19289
19407
|
var import_LexicalComposerContext72 = require("@lexical/react/LexicalComposerContext");
|
|
19290
19408
|
var import_utils38 = require("@lexical/utils");
|
|
19291
|
-
var
|
|
19409
|
+
var import_lexical106 = require("lexical");
|
|
19292
19410
|
var import_react110 = require("react");
|
|
19293
|
-
var
|
|
19294
|
-
var INSERT_FINANCIAL_STATEMENT_QUESTION_COMMAND = (0,
|
|
19411
|
+
var import_jsx_runtime135 = require("react/jsx-runtime");
|
|
19412
|
+
var INSERT_FINANCIAL_STATEMENT_QUESTION_COMMAND = (0, import_lexical106.createCommand)("INSERT_FINANCIAL_STATEMENT_QUESTION_COMMAND");
|
|
19295
19413
|
function FinancialStatementQuestionPlugin() {
|
|
19296
19414
|
const {
|
|
19297
19415
|
registerSettingsPanel,
|
|
@@ -19310,12 +19428,12 @@ function FinancialStatementQuestionPlugin() {
|
|
|
19310
19428
|
const { nodeKey, insertionMode } = payload;
|
|
19311
19429
|
if (activeEditor === editor && nodeKey) {
|
|
19312
19430
|
activeEditor.update(() => {
|
|
19313
|
-
const targetNode = (0,
|
|
19431
|
+
const targetNode = (0, import_lexical106.$getNodeByKey)(nodeKey);
|
|
19314
19432
|
if (targetNode) {
|
|
19315
|
-
const headerEditor = (0,
|
|
19433
|
+
const headerEditor = (0, import_lexical106.createEditor)();
|
|
19316
19434
|
headerEditor.update(() => {
|
|
19317
|
-
const root = (0,
|
|
19318
|
-
const paragraph = (0,
|
|
19435
|
+
const root = (0, import_lexical106.$getRoot)();
|
|
19436
|
+
const paragraph = (0, import_lexical106.$createParagraphNode)();
|
|
19319
19437
|
root.append(paragraph);
|
|
19320
19438
|
});
|
|
19321
19439
|
const financialStatementNode = $createFinancialStatementQuestionNode(
|
|
@@ -19332,16 +19450,16 @@ function FinancialStatementQuestionPlugin() {
|
|
|
19332
19450
|
} else if (insertionMode === "before") {
|
|
19333
19451
|
targetNode.insertBefore(financialStatementNode);
|
|
19334
19452
|
}
|
|
19335
|
-
const selection = (0,
|
|
19453
|
+
const selection = (0, import_lexical106.$createNodeSelection)();
|
|
19336
19454
|
selection.add(financialStatementNode.getKey());
|
|
19337
|
-
(0,
|
|
19455
|
+
(0, import_lexical106.$setSelection)(selection);
|
|
19338
19456
|
}
|
|
19339
19457
|
});
|
|
19340
19458
|
}
|
|
19341
19459
|
}
|
|
19342
19460
|
return true;
|
|
19343
19461
|
},
|
|
19344
|
-
|
|
19462
|
+
import_lexical106.COMMAND_PRIORITY_EDITOR
|
|
19345
19463
|
)
|
|
19346
19464
|
);
|
|
19347
19465
|
}, [editor]);
|
|
@@ -19355,21 +19473,21 @@ function FinancialStatementQuestionPlugin() {
|
|
|
19355
19473
|
}
|
|
19356
19474
|
}
|
|
19357
19475
|
}, [isBlockEditorReady]);
|
|
19358
|
-
return /* @__PURE__ */ (0,
|
|
19359
|
-
drawer && /* @__PURE__ */ (0,
|
|
19476
|
+
return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(import_jsx_runtime135.Fragment, { children: [
|
|
19477
|
+
drawer && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
19360
19478
|
StickyToPosition,
|
|
19361
19479
|
{
|
|
19362
19480
|
ref: settingsPanelStickyRef,
|
|
19363
19481
|
container: drawer,
|
|
19364
19482
|
children: (data, position, isVisible) => {
|
|
19365
|
-
return /* @__PURE__ */ (0,
|
|
19483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { style: { width: position.width }, children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
19366
19484
|
SettingsCard,
|
|
19367
19485
|
{
|
|
19368
19486
|
isVisible: !!isVisible,
|
|
19369
19487
|
container: drawer,
|
|
19370
19488
|
title: "Financial Statement Settings",
|
|
19371
19489
|
onClose: toggleSettingsPanelSwitch,
|
|
19372
|
-
children: isVisible && /* @__PURE__ */ (0,
|
|
19490
|
+
children: isVisible && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
19373
19491
|
FinancialStatementQuestionSettings,
|
|
19374
19492
|
{
|
|
19375
19493
|
nodeKey: data.nodeKey
|
|
@@ -19381,32 +19499,32 @@ function FinancialStatementQuestionPlugin() {
|
|
|
19381
19499
|
}
|
|
19382
19500
|
}
|
|
19383
19501
|
),
|
|
19384
|
-
/* @__PURE__ */ (0,
|
|
19502
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(FillInTheBlankSpaceSettingsPlugin, {})
|
|
19385
19503
|
] });
|
|
19386
19504
|
}
|
|
19387
19505
|
|
|
19388
19506
|
// src/modules/Questions.tsx
|
|
19389
19507
|
var import_react111 = require("react");
|
|
19390
|
-
var
|
|
19508
|
+
var import_jsx_runtime136 = require("react/jsx-runtime");
|
|
19391
19509
|
function Questions() {
|
|
19392
19510
|
const { registerModule } = useBlockEditor();
|
|
19393
19511
|
(0, import_react111.useEffect)(() => {
|
|
19394
19512
|
registerModule("Questions");
|
|
19395
19513
|
}, [registerModule]);
|
|
19396
|
-
return /* @__PURE__ */ (0,
|
|
19397
|
-
/* @__PURE__ */ (0,
|
|
19398
|
-
/* @__PURE__ */ (0,
|
|
19399
|
-
/* @__PURE__ */ (0,
|
|
19400
|
-
/* @__PURE__ */ (0,
|
|
19401
|
-
/* @__PURE__ */ (0,
|
|
19402
|
-
/* @__PURE__ */ (0,
|
|
19403
|
-
/* @__PURE__ */ (0,
|
|
19514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_jsx_runtime136.Fragment, { children: [
|
|
19515
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(MultipleOptionQuestionPlugin, {}),
|
|
19516
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(ShortAnswerQuestionPlugin, {}),
|
|
19517
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(MatchingQuestionPlugin, {}),
|
|
19518
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(FillInTheBlankQuestionPlugin, {}),
|
|
19519
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(JournalEntryQuestionPlugin, {}),
|
|
19520
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(FinancialStatementQuestionPlugin, {}),
|
|
19521
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(EssayQuestionPlugin, {})
|
|
19404
19522
|
] });
|
|
19405
19523
|
}
|
|
19406
19524
|
|
|
19407
19525
|
// src/modules/SettingsPanel.tsx
|
|
19408
19526
|
var import_react112 = require("react");
|
|
19409
|
-
var
|
|
19527
|
+
var import_jsx_runtime137 = require("react/jsx-runtime");
|
|
19410
19528
|
function SettingsPanel(props) {
|
|
19411
19529
|
const { defaultOpen = true } = props;
|
|
19412
19530
|
const { registerModule, openSettingsPanel } = useBlockEditor();
|
|
@@ -19418,7 +19536,7 @@ function SettingsPanel(props) {
|
|
|
19418
19536
|
}
|
|
19419
19537
|
}, 50);
|
|
19420
19538
|
}, [registerModule, defaultOpen, openSettingsPanel]);
|
|
19421
|
-
return /* @__PURE__ */ (0,
|
|
19539
|
+
return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(SettingsPanelPlugin, {});
|
|
19422
19540
|
}
|
|
19423
19541
|
|
|
19424
19542
|
// src/plugins/VariablesPlugin/VariableSettingsPlugin.tsx
|
|
@@ -19426,10 +19544,10 @@ var import_react114 = require("react");
|
|
|
19426
19544
|
|
|
19427
19545
|
// src/plugins/VariablesPlugin/VariableSettings.tsx
|
|
19428
19546
|
var import_LexicalComposerContext73 = require("@lexical/react/LexicalComposerContext");
|
|
19429
|
-
var
|
|
19547
|
+
var import_lexical107 = require("lexical");
|
|
19430
19548
|
var import_lucide_react34 = require("lucide-react");
|
|
19431
19549
|
var import_react113 = require("react");
|
|
19432
|
-
var
|
|
19550
|
+
var import_jsx_runtime138 = require("react/jsx-runtime");
|
|
19433
19551
|
var controlGridStyle = {
|
|
19434
19552
|
width: "100%",
|
|
19435
19553
|
display: "flex",
|
|
@@ -19471,7 +19589,7 @@ function VariableSettings(props) {
|
|
|
19471
19589
|
activeEditorRef.current = nestedEditorId ? getNestedEditor(nestedEditorId) || editor : editor;
|
|
19472
19590
|
if (activeEditorRef.current) {
|
|
19473
19591
|
activeEditorRef.current.getEditorState().read(() => {
|
|
19474
|
-
const foundNode = (0,
|
|
19592
|
+
const foundNode = (0, import_lexical107.$getNodeByKey)(nodeKey);
|
|
19475
19593
|
if ($isVariableNode(foundNode)) {
|
|
19476
19594
|
setCurrentVariableNode(foundNode);
|
|
19477
19595
|
}
|
|
@@ -19487,7 +19605,7 @@ function VariableSettings(props) {
|
|
|
19487
19605
|
onClick: () => {
|
|
19488
19606
|
activeEditorRef.current?.update(
|
|
19489
19607
|
() => {
|
|
19490
|
-
const foundVariableNode = (0,
|
|
19608
|
+
const foundVariableNode = (0, import_lexical107.$getNodeByKey)(nodeKey);
|
|
19491
19609
|
if ($isVariableNode(foundVariableNode)) {
|
|
19492
19610
|
foundVariableNode.setVariable(variableItem);
|
|
19493
19611
|
}
|
|
@@ -19496,7 +19614,7 @@ function VariableSettings(props) {
|
|
|
19496
19614
|
onUpdate: () => {
|
|
19497
19615
|
setEditingMode({ mode: "edit" });
|
|
19498
19616
|
activeEditorRef.current?.update(() => {
|
|
19499
|
-
const foundVariableNode = (0,
|
|
19617
|
+
const foundVariableNode = (0, import_lexical107.$getNodeByKey)(nodeKey);
|
|
19500
19618
|
if ($isVariableNode(foundVariableNode)) {
|
|
19501
19619
|
const rootEditor = getEditor();
|
|
19502
19620
|
const variableName = foundVariableNode.getVariable();
|
|
@@ -19532,7 +19650,7 @@ function VariableSettings(props) {
|
|
|
19532
19650
|
onClick: () => {
|
|
19533
19651
|
activeEditorRef.current?.update(
|
|
19534
19652
|
() => {
|
|
19535
|
-
const foundVariableNode = (0,
|
|
19653
|
+
const foundVariableNode = (0, import_lexical107.$getNodeByKey)(nodeKey);
|
|
19536
19654
|
if (!$isVariableNode(foundVariableNode)) return;
|
|
19537
19655
|
if (typeItem === "number" && !foundVariableNode.getVariableFormat()) {
|
|
19538
19656
|
foundVariableNode.setVariableFormat(
|
|
@@ -19545,7 +19663,7 @@ function VariableSettings(props) {
|
|
|
19545
19663
|
{
|
|
19546
19664
|
onUpdate: () => {
|
|
19547
19665
|
activeEditorRef.current?.getEditorState().read(() => {
|
|
19548
|
-
const foundVariableNode = (0,
|
|
19666
|
+
const foundVariableNode = (0, import_lexical107.$getNodeByKey)(nodeKey);
|
|
19549
19667
|
if ($isVariableNode(foundVariableNode)) {
|
|
19550
19668
|
setCurrentVariableNode(foundVariableNode);
|
|
19551
19669
|
}
|
|
@@ -19566,7 +19684,7 @@ function VariableSettings(props) {
|
|
|
19566
19684
|
onClick: () => {
|
|
19567
19685
|
activeEditorRef.current?.update(
|
|
19568
19686
|
() => {
|
|
19569
|
-
const foundVariableNode = (0,
|
|
19687
|
+
const foundVariableNode = (0, import_lexical107.$getNodeByKey)(nodeKey);
|
|
19570
19688
|
if ($isVariableNode(foundVariableNode)) {
|
|
19571
19689
|
foundVariableNode.setVariableFormat(formatItem);
|
|
19572
19690
|
}
|
|
@@ -19574,7 +19692,7 @@ function VariableSettings(props) {
|
|
|
19574
19692
|
{
|
|
19575
19693
|
onUpdate: () => {
|
|
19576
19694
|
activeEditorRef.current?.getEditorState().read(() => {
|
|
19577
|
-
const foundVariableNode = (0,
|
|
19695
|
+
const foundVariableNode = (0, import_lexical107.$getNodeByKey)(nodeKey);
|
|
19578
19696
|
if ($isVariableNode(foundVariableNode)) {
|
|
19579
19697
|
setCurrentVariableNode(foundVariableNode);
|
|
19580
19698
|
}
|
|
@@ -19595,7 +19713,7 @@ function VariableSettings(props) {
|
|
|
19595
19713
|
let prevVariableName = void 0;
|
|
19596
19714
|
activeEditorRef.current?.update(
|
|
19597
19715
|
() => {
|
|
19598
|
-
const foundVariableNode = (0,
|
|
19716
|
+
const foundVariableNode = (0, import_lexical107.$getNodeByKey)(nodeKey);
|
|
19599
19717
|
if ($isVariableNode(foundVariableNode)) {
|
|
19600
19718
|
prevVariableName = foundVariableNode.getVariable();
|
|
19601
19719
|
foundVariableNode.setVariable(newVariableName);
|
|
@@ -19608,7 +19726,7 @@ function VariableSettings(props) {
|
|
|
19608
19726
|
setTimeout(() => {
|
|
19609
19727
|
activeEditorRef.current?.getEditorState().read(() => {
|
|
19610
19728
|
setEditingMode({ mode: "edit" });
|
|
19611
|
-
const foundVariableNode = (0,
|
|
19729
|
+
const foundVariableNode = (0, import_lexical107.$getNodeByKey)(nodeKey);
|
|
19612
19730
|
if ($isVariableNode(foundVariableNode)) {
|
|
19613
19731
|
const rootEditor = getEditor();
|
|
19614
19732
|
clearVariableSelection(
|
|
@@ -19626,7 +19744,7 @@ function VariableSettings(props) {
|
|
|
19626
19744
|
} else {
|
|
19627
19745
|
activeEditorRef.current?.getEditorState().read(() => {
|
|
19628
19746
|
setEditingMode({ mode: "edit" });
|
|
19629
|
-
const foundVariableNode = (0,
|
|
19747
|
+
const foundVariableNode = (0, import_lexical107.$getNodeByKey)(nodeKey);
|
|
19630
19748
|
if ($isVariableNode(foundVariableNode)) {
|
|
19631
19749
|
const rootEditor = getEditor();
|
|
19632
19750
|
const variableName = foundVariableNode.getVariable();
|
|
@@ -19651,8 +19769,8 @@ function VariableSettings(props) {
|
|
|
19651
19769
|
if (!currentVariableNode) {
|
|
19652
19770
|
return null;
|
|
19653
19771
|
}
|
|
19654
|
-
return /* @__PURE__ */ (0,
|
|
19655
|
-
/* @__PURE__ */ (0,
|
|
19772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_jsx_runtime138.Fragment, { children: [
|
|
19773
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("div", { style: formFieldStyle, children: /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
|
|
19656
19774
|
Button,
|
|
19657
19775
|
{
|
|
19658
19776
|
className: "button__fullwidth",
|
|
@@ -19671,10 +19789,10 @@ function VariableSettings(props) {
|
|
|
19671
19789
|
variant: "default"
|
|
19672
19790
|
}
|
|
19673
19791
|
) }),
|
|
19674
|
-
/* @__PURE__ */ (0,
|
|
19675
|
-
/* @__PURE__ */ (0,
|
|
19676
|
-
/* @__PURE__ */ (0,
|
|
19677
|
-
/* @__PURE__ */ (0,
|
|
19792
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsxs)("div", { style: formFieldStyle, children: [
|
|
19793
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("div", { style: formFieldLabel, children: "Name" }),
|
|
19794
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsxs)("div", { style: controlGridStyle, children: [
|
|
19795
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("div", { style: { flexGrow: 1 }, children: isSettingsEditingMode ? /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
|
|
19678
19796
|
"form",
|
|
19679
19797
|
{
|
|
19680
19798
|
onSubmit: (e) => {
|
|
@@ -19682,7 +19800,7 @@ function VariableSettings(props) {
|
|
|
19682
19800
|
e.preventDefault();
|
|
19683
19801
|
updateVariableName();
|
|
19684
19802
|
},
|
|
19685
|
-
children: /* @__PURE__ */ (0,
|
|
19803
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
|
|
19686
19804
|
TextInput,
|
|
19687
19805
|
{
|
|
19688
19806
|
ref: variableNameInputRef,
|
|
@@ -19694,7 +19812,7 @@ function VariableSettings(props) {
|
|
|
19694
19812
|
}
|
|
19695
19813
|
)
|
|
19696
19814
|
}
|
|
19697
|
-
) : /* @__PURE__ */ (0,
|
|
19815
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
|
|
19698
19816
|
DropdownButton,
|
|
19699
19817
|
{
|
|
19700
19818
|
className: "button__fullwidth button__left_aligned",
|
|
@@ -19707,7 +19825,7 @@ function VariableSettings(props) {
|
|
|
19707
19825
|
menu: variablesMenu
|
|
19708
19826
|
}
|
|
19709
19827
|
) }),
|
|
19710
|
-
/* @__PURE__ */ (0,
|
|
19828
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("div", { style: { flexGrow: 0 }, children: isSettingsEditingMode ? /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
|
|
19711
19829
|
Button,
|
|
19712
19830
|
{
|
|
19713
19831
|
StartIcon: import_lucide_react34.Save,
|
|
@@ -19715,7 +19833,7 @@ function VariableSettings(props) {
|
|
|
19715
19833
|
size: "small",
|
|
19716
19834
|
onClick: updateVariableName
|
|
19717
19835
|
}
|
|
19718
|
-
) : /* @__PURE__ */ (0,
|
|
19836
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
|
|
19719
19837
|
Button,
|
|
19720
19838
|
{
|
|
19721
19839
|
StartIcon: import_lucide_react34.Pencil,
|
|
@@ -19728,9 +19846,9 @@ function VariableSettings(props) {
|
|
|
19728
19846
|
) })
|
|
19729
19847
|
] })
|
|
19730
19848
|
] }),
|
|
19731
|
-
/* @__PURE__ */ (0,
|
|
19732
|
-
/* @__PURE__ */ (0,
|
|
19733
|
-
/* @__PURE__ */ (0,
|
|
19849
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsxs)("div", { style: formFieldStyle, children: [
|
|
19850
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("div", { style: formFieldLabel, children: "Type" }),
|
|
19851
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
|
|
19734
19852
|
DropdownButton,
|
|
19735
19853
|
{
|
|
19736
19854
|
className: "button__fullwidth button__left_aligned",
|
|
@@ -19744,9 +19862,9 @@ function VariableSettings(props) {
|
|
|
19744
19862
|
}
|
|
19745
19863
|
)
|
|
19746
19864
|
] }),
|
|
19747
|
-
currentVariableNode.getVariableFormat() && /* @__PURE__ */ (0,
|
|
19748
|
-
/* @__PURE__ */ (0,
|
|
19749
|
-
/* @__PURE__ */ (0,
|
|
19865
|
+
currentVariableNode.getVariableFormat() && /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)("div", { style: formFieldStyle, children: [
|
|
19866
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("div", { style: formFieldLabel, children: "Format" }),
|
|
19867
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
|
|
19750
19868
|
DropdownButton,
|
|
19751
19869
|
{
|
|
19752
19870
|
className: "button__fullwidth button__left_aligned",
|
|
@@ -19760,7 +19878,7 @@ function VariableSettings(props) {
|
|
|
19760
19878
|
}
|
|
19761
19879
|
)
|
|
19762
19880
|
] }),
|
|
19763
|
-
/* @__PURE__ */ (0,
|
|
19881
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("div", { style: { width: "100%", display: "f" }, children: /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
|
|
19764
19882
|
Button,
|
|
19765
19883
|
{
|
|
19766
19884
|
size: "small",
|
|
@@ -19772,9 +19890,9 @@ function VariableSettings(props) {
|
|
|
19772
19890
|
let parentNodeKey;
|
|
19773
19891
|
activeEditorRef.current?.update(
|
|
19774
19892
|
() => {
|
|
19775
|
-
const foundVariableNode = (0,
|
|
19893
|
+
const foundVariableNode = (0, import_lexical107.$getNodeByKey)(nodeKey);
|
|
19776
19894
|
if ($isVariableNode(foundVariableNode)) {
|
|
19777
|
-
const textNode = (0,
|
|
19895
|
+
const textNode = (0, import_lexical107.$createTextNode)(
|
|
19778
19896
|
foundVariableNode.getVariable()
|
|
19779
19897
|
);
|
|
19780
19898
|
foundVariableNode.replace(textNode);
|
|
@@ -19787,7 +19905,7 @@ function VariableSettings(props) {
|
|
|
19787
19905
|
activeEditorRef.current?.update(() => {
|
|
19788
19906
|
if (parentNodeKey) {
|
|
19789
19907
|
activeEditorRef.current?.focus();
|
|
19790
|
-
const foundNode = (0,
|
|
19908
|
+
const foundNode = (0, import_lexical107.$getNodeByKey)(parentNodeKey);
|
|
19791
19909
|
foundNode?.selectStart();
|
|
19792
19910
|
}
|
|
19793
19911
|
});
|
|
@@ -19802,7 +19920,7 @@ function VariableSettings(props) {
|
|
|
19802
19920
|
}
|
|
19803
19921
|
|
|
19804
19922
|
// src/plugins/VariablesPlugin/VariableSettingsPlugin.tsx
|
|
19805
|
-
var
|
|
19923
|
+
var import_jsx_runtime139 = require("react/jsx-runtime");
|
|
19806
19924
|
function VariableSettingsPlugin() {
|
|
19807
19925
|
const {
|
|
19808
19926
|
registerSettingsPanel,
|
|
@@ -19821,20 +19939,20 @@ function VariableSettingsPlugin() {
|
|
|
19821
19939
|
}
|
|
19822
19940
|
}
|
|
19823
19941
|
}, [isBlockEditorReady]);
|
|
19824
|
-
return /* @__PURE__ */ (0,
|
|
19942
|
+
return /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_jsx_runtime139.Fragment, { children: drawer && /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
19825
19943
|
StickyToPosition,
|
|
19826
19944
|
{
|
|
19827
19945
|
ref: settingsPanelStickyRef,
|
|
19828
19946
|
container: drawer,
|
|
19829
19947
|
children: (data, position, isVisible) => {
|
|
19830
|
-
return /* @__PURE__ */ (0,
|
|
19948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime139.jsx)("div", { style: { width: position.width }, children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
19831
19949
|
SettingsCard,
|
|
19832
19950
|
{
|
|
19833
19951
|
isVisible: !!isVisible,
|
|
19834
19952
|
container: drawer,
|
|
19835
19953
|
title: "Variable Settings",
|
|
19836
19954
|
onClose: toggleSettingsPanelSwitch,
|
|
19837
|
-
children: /* @__PURE__ */ (0,
|
|
19955
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
19838
19956
|
VariableSettings,
|
|
19839
19957
|
{
|
|
19840
19958
|
nodeKey: data.nodeKey,
|
|
@@ -19852,11 +19970,11 @@ function VariableSettingsPlugin() {
|
|
|
19852
19970
|
// src/plugins/VariablesPlugin/VariableToolbarPlugin.tsx
|
|
19853
19971
|
var import_LexicalComposerContext74 = require("@lexical/react/LexicalComposerContext");
|
|
19854
19972
|
var import_utils40 = require("@lexical/utils");
|
|
19855
|
-
var
|
|
19973
|
+
var import_lexical108 = require("lexical");
|
|
19856
19974
|
var import_debounce8 = __toESM(require("lodash-es/debounce"));
|
|
19857
19975
|
var import_lucide_react35 = require("lucide-react");
|
|
19858
19976
|
var import_react115 = require("react");
|
|
19859
|
-
var
|
|
19977
|
+
var import_jsx_runtime140 = require("react/jsx-runtime");
|
|
19860
19978
|
function VariableToolbarPlugin() {
|
|
19861
19979
|
const [editor] = (0, import_LexicalComposerContext74.useLexicalComposerContext)();
|
|
19862
19980
|
const popupToolbarRef = (0, import_react115.useRef)(null);
|
|
@@ -19869,7 +19987,7 @@ function VariableToolbarPlugin() {
|
|
|
19869
19987
|
});
|
|
19870
19988
|
function formatVariable(format) {
|
|
19871
19989
|
activeEditorRef.current?.update(() => {
|
|
19872
|
-
const foundNode = (0,
|
|
19990
|
+
const foundNode = (0, import_lexical108.$getNodeByKey)(
|
|
19873
19991
|
selectedNodeRef.current?.getKey() || ""
|
|
19874
19992
|
);
|
|
19875
19993
|
if ($isVariableNode(foundNode)) {
|
|
@@ -19973,9 +20091,9 @@ function VariableToolbarPlugin() {
|
|
|
19973
20091
|
activeEditorRef.current = activeEditor;
|
|
19974
20092
|
selectedNodeRef.current = void 0;
|
|
19975
20093
|
activeEditor.getEditorState().read(() => {
|
|
19976
|
-
const selection = (0,
|
|
20094
|
+
const selection = (0, import_lexical108.$getSelection)();
|
|
19977
20095
|
if (selection) {
|
|
19978
|
-
if ((0,
|
|
20096
|
+
if ((0, import_lexical108.$isNodeSelection)(selection)) {
|
|
19979
20097
|
const nodes = selection.extract();
|
|
19980
20098
|
const focusedNode = nodes[0];
|
|
19981
20099
|
if ($isVariableNode(focusedNode)) {
|
|
@@ -19992,7 +20110,7 @@ function VariableToolbarPlugin() {
|
|
|
19992
20110
|
});
|
|
19993
20111
|
return false;
|
|
19994
20112
|
},
|
|
19995
|
-
|
|
20113
|
+
import_lexical108.COMMAND_PRIORITY_NORMAL
|
|
19996
20114
|
),
|
|
19997
20115
|
editor.registerRootListener(
|
|
19998
20116
|
(rootElement, prevRootElement) => {
|
|
@@ -20049,12 +20167,12 @@ function VariableToolbarPlugin() {
|
|
|
20049
20167
|
];
|
|
20050
20168
|
return resultList;
|
|
20051
20169
|
}, [toolbarState]);
|
|
20052
|
-
return /* @__PURE__ */ (0,
|
|
20170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(PopupToolbar, { ref: popupToolbarRef, menu: menuItems });
|
|
20053
20171
|
}
|
|
20054
20172
|
|
|
20055
20173
|
// src/modules/Variables.tsx
|
|
20056
20174
|
var import_react116 = require("react");
|
|
20057
|
-
var
|
|
20175
|
+
var import_jsx_runtime141 = require("react/jsx-runtime");
|
|
20058
20176
|
function Variables(props) {
|
|
20059
20177
|
const { variablesSettings } = props;
|
|
20060
20178
|
const { registerModule, setEditingModeDataCallback } = useBlockEditor();
|
|
@@ -20068,11 +20186,11 @@ function Variables(props) {
|
|
|
20068
20186
|
};
|
|
20069
20187
|
});
|
|
20070
20188
|
}, [variablesSettings, setEditingModeDataCallback]);
|
|
20071
|
-
return /* @__PURE__ */ (0,
|
|
20072
|
-
/* @__PURE__ */ (0,
|
|
20073
|
-
/* @__PURE__ */ (0,
|
|
20074
|
-
/* @__PURE__ */ (0,
|
|
20075
|
-
/* @__PURE__ */ (0,
|
|
20189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(VariablesProvider, { variablesSettings, children: [
|
|
20190
|
+
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)(TypeaheadVariablePlugin, {}),
|
|
20191
|
+
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)(VariableSettingsPlugin, {}),
|
|
20192
|
+
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)(VariableToolbarPlugin, {}),
|
|
20193
|
+
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)(VariableToolbarAgentPlugin, {})
|
|
20076
20194
|
] });
|
|
20077
20195
|
}
|
|
20078
20196
|
// Annotate the CommonJS export names for ESM import in node:
|