@examind/block-editor 0.1.7 → 0.1.8
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 +1 -1
- package/dist/index.js +1508 -1436
- package/dist/index.mjs +1481 -1406
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -784,11 +784,11 @@ var useSharedHistoryContext = () => {
|
|
|
784
784
|
|
|
785
785
|
// src/plugins/FillInTheBlankQuestionPlugin/FillInTheBlankQuestionNode.tsx
|
|
786
786
|
import {
|
|
787
|
-
$applyNodeReplacement as $
|
|
788
|
-
DecoratorNode as
|
|
789
|
-
createEditor as
|
|
787
|
+
$applyNodeReplacement as $applyNodeReplacement10,
|
|
788
|
+
DecoratorNode as DecoratorNode10,
|
|
789
|
+
createEditor as createEditor7
|
|
790
790
|
} from "lexical";
|
|
791
|
-
import { nanoid as
|
|
791
|
+
import { nanoid as nanoid7 } from "nanoid";
|
|
792
792
|
|
|
793
793
|
// src/plugins/SmartTablePlugin/AddNewColumnAction.tsx
|
|
794
794
|
import { useLexicalComposerContext as useLexicalComposerContext5 } from "@lexical/react/LexicalComposerContext";
|
|
@@ -5261,15 +5261,15 @@ function $isImageNode(node) {
|
|
|
5261
5261
|
}
|
|
5262
5262
|
|
|
5263
5263
|
// src/plugins/JournalEntryQuestionPlugin/JournalEntryQuestionComponent.tsx
|
|
5264
|
-
import { useLexicalComposerContext as
|
|
5264
|
+
import { useLexicalComposerContext as useLexicalComposerContext33 } from "@lexical/react/LexicalComposerContext";
|
|
5265
5265
|
import {
|
|
5266
|
-
$createNodeSelection as $
|
|
5267
|
-
$getNodeByKey as $
|
|
5268
|
-
$setSelection as $
|
|
5269
|
-
CLICK_COMMAND as
|
|
5270
|
-
COMMAND_PRIORITY_LOW as
|
|
5266
|
+
$createNodeSelection as $createNodeSelection7,
|
|
5267
|
+
$getNodeByKey as $getNodeByKey27,
|
|
5268
|
+
$setSelection as $setSelection7,
|
|
5269
|
+
CLICK_COMMAND as CLICK_COMMAND7,
|
|
5270
|
+
COMMAND_PRIORITY_LOW as COMMAND_PRIORITY_LOW7
|
|
5271
5271
|
} from "lexical";
|
|
5272
|
-
import { useEffect as
|
|
5272
|
+
import { useEffect as useEffect38, useRef as useRef24 } from "react";
|
|
5273
5273
|
|
|
5274
5274
|
// src/plugins/JournalEntryQuestionPlugin/DistractorButton.tsx
|
|
5275
5275
|
import { useLexicalComposerContext as useLexicalComposerContext20 } from "@lexical/react/LexicalComposerContext";
|
|
@@ -5329,68 +5329,22 @@ function DistractorButton(props) {
|
|
|
5329
5329
|
] });
|
|
5330
5330
|
}
|
|
5331
5331
|
|
|
5332
|
-
// src/plugins/
|
|
5333
|
-
import {
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
function TypeaheadVariableAgentPlugin() {
|
|
5340
|
-
const { hasModule, modulesNumber } = useBlockEditor();
|
|
5341
|
-
const [editor] = useLexicalComposerContext21();
|
|
5342
|
-
useEffect30(() => {
|
|
5343
|
-
if (hasModule("Variables")) {
|
|
5344
|
-
return mergeRegister6(
|
|
5345
|
-
editor.registerUpdateListener(({ tags }) => {
|
|
5346
|
-
if (!tags.has("history-merge")) {
|
|
5347
|
-
editor.dispatchCommand(
|
|
5348
|
-
TYPEAHEAD_VARIABLE_COMMAND,
|
|
5349
|
-
void 0
|
|
5350
|
-
);
|
|
5351
|
-
}
|
|
5352
|
-
})
|
|
5353
|
-
);
|
|
5354
|
-
}
|
|
5355
|
-
}, [editor, modulesNumber]);
|
|
5356
|
-
return /* @__PURE__ */ jsx49(Fragment20, {});
|
|
5357
|
-
}
|
|
5358
|
-
|
|
5359
|
-
// src/plugins/VariablesPlugin/utils.ts
|
|
5360
|
-
function clearVariableSelection(editor, variable) {
|
|
5361
|
-
const allHighlightedVariables = editor.getRootElement()?.querySelectorAll("[data-variable-highlighted]");
|
|
5362
|
-
if (allHighlightedVariables && allHighlightedVariables.length > 0) {
|
|
5363
|
-
for (const highlightedVariable of allHighlightedVariables) {
|
|
5364
|
-
if (!variable || highlightedVariable.getAttribute(
|
|
5365
|
-
"data-block-editor-variable"
|
|
5366
|
-
) !== variable) {
|
|
5367
|
-
highlightedVariable.removeAttribute(
|
|
5368
|
-
"data-variable-highlighted"
|
|
5369
|
-
);
|
|
5370
|
-
}
|
|
5371
|
-
}
|
|
5372
|
-
}
|
|
5373
|
-
}
|
|
5374
|
-
function setVariableSelection(editor, variable) {
|
|
5375
|
-
const allVariableElements = editor.getRootElement()?.querySelectorAll(`[data-block-editor-variable="${variable}"]`);
|
|
5376
|
-
if (allVariableElements && allVariableElements.length > 0) {
|
|
5377
|
-
for (const variableElement of allVariableElements) {
|
|
5378
|
-
variableElement.setAttribute(
|
|
5379
|
-
"data-variable-highlighted",
|
|
5380
|
-
"true"
|
|
5381
|
-
);
|
|
5382
|
-
}
|
|
5383
|
-
}
|
|
5384
|
-
}
|
|
5332
|
+
// src/plugins/FinancialStatementQuestionPlugin/FinancialStatementQuestionNode.tsx
|
|
5333
|
+
import {
|
|
5334
|
+
$applyNodeReplacement as $applyNodeReplacement5,
|
|
5335
|
+
DecoratorNode as DecoratorNode5,
|
|
5336
|
+
createEditor as createEditor2
|
|
5337
|
+
} from "lexical";
|
|
5338
|
+
import { nanoid as nanoid2 } from "nanoid";
|
|
5385
5339
|
|
|
5386
5340
|
// src/plugins/VariablesPlugin/VariableComponent.tsx
|
|
5387
|
-
import { useLexicalComposerContext as
|
|
5341
|
+
import { useLexicalComposerContext as useLexicalComposerContext21 } from "@lexical/react/LexicalComposerContext";
|
|
5388
5342
|
import { $getNodeByKey as $getNodeByKey18 } from "lexical";
|
|
5389
|
-
import { useEffect as
|
|
5390
|
-
import { Fragment as
|
|
5343
|
+
import { useEffect as useEffect30 } from "react";
|
|
5344
|
+
import { Fragment as Fragment20, jsx as jsx49 } from "react/jsx-runtime";
|
|
5391
5345
|
function VariableComponent(props) {
|
|
5392
5346
|
const { nodeKey } = props;
|
|
5393
|
-
const [editor] =
|
|
5347
|
+
const [editor] = useLexicalComposerContext21();
|
|
5394
5348
|
const handleToggleModeEvent = (event) => {
|
|
5395
5349
|
const {
|
|
5396
5350
|
detail: { mode, variableValues }
|
|
@@ -5417,7 +5371,7 @@ function VariableComponent(props) {
|
|
|
5417
5371
|
});
|
|
5418
5372
|
}
|
|
5419
5373
|
};
|
|
5420
|
-
|
|
5374
|
+
useEffect30(() => {
|
|
5421
5375
|
window.addEventListener(
|
|
5422
5376
|
TOGGLE_EDITING_MODE,
|
|
5423
5377
|
handleToggleModeEvent
|
|
@@ -5429,7 +5383,7 @@ function VariableComponent(props) {
|
|
|
5429
5383
|
);
|
|
5430
5384
|
};
|
|
5431
5385
|
}, [editor]);
|
|
5432
|
-
return /* @__PURE__ */
|
|
5386
|
+
return /* @__PURE__ */ jsx49(Fragment20, {});
|
|
5433
5387
|
}
|
|
5434
5388
|
|
|
5435
5389
|
// src/plugins/VariablesPlugin/VariableNode.tsx
|
|
@@ -5437,7 +5391,7 @@ import {
|
|
|
5437
5391
|
$applyNodeReplacement as $applyNodeReplacement4,
|
|
5438
5392
|
DecoratorNode as DecoratorNode4
|
|
5439
5393
|
} from "lexical";
|
|
5440
|
-
import { jsx as
|
|
5394
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
5441
5395
|
var FORMAT_WHOLE_NUMBER = "0";
|
|
5442
5396
|
var FORMAT_WHOLE_NUMBER_COMMAS = "0,0";
|
|
5443
5397
|
var FORMAT_ONE_DECIMAL_COMMAS = "0,0.0";
|
|
@@ -5641,7 +5595,7 @@ var VariableNode = class _VariableNode extends DecoratorNode4 {
|
|
|
5641
5595
|
writable.__isUnderline = value;
|
|
5642
5596
|
}
|
|
5643
5597
|
decorate() {
|
|
5644
|
-
return /* @__PURE__ */
|
|
5598
|
+
return /* @__PURE__ */ jsx50(VariableComponent, { nodeKey: this.__key });
|
|
5645
5599
|
}
|
|
5646
5600
|
};
|
|
5647
5601
|
function $createVariableNode(variableName, variableFormat, isBold, isItalic, isUnderline) {
|
|
@@ -5659,9 +5613,45 @@ function $isVariableNode(node) {
|
|
|
5659
5613
|
return node instanceof VariableNode;
|
|
5660
5614
|
}
|
|
5661
5615
|
|
|
5616
|
+
// src/plugins/VariablesPlugin/utils.ts
|
|
5617
|
+
function clearVariableSelection(editor, variable) {
|
|
5618
|
+
const allHighlightedVariables = editor.getRootElement()?.querySelectorAll("[data-variable-highlighted]");
|
|
5619
|
+
if (allHighlightedVariables && allHighlightedVariables.length > 0) {
|
|
5620
|
+
for (const highlightedVariable of allHighlightedVariables) {
|
|
5621
|
+
if (!variable || highlightedVariable.getAttribute(
|
|
5622
|
+
"data-block-editor-variable"
|
|
5623
|
+
) !== variable) {
|
|
5624
|
+
highlightedVariable.removeAttribute(
|
|
5625
|
+
"data-variable-highlighted"
|
|
5626
|
+
);
|
|
5627
|
+
}
|
|
5628
|
+
}
|
|
5629
|
+
}
|
|
5630
|
+
}
|
|
5631
|
+
function setVariableSelection(editor, variable) {
|
|
5632
|
+
const allVariableElements = editor.getRootElement()?.querySelectorAll(`[data-block-editor-variable="${variable}"]`);
|
|
5633
|
+
if (allVariableElements && allVariableElements.length > 0) {
|
|
5634
|
+
for (const variableElement of allVariableElements) {
|
|
5635
|
+
variableElement.setAttribute(
|
|
5636
|
+
"data-variable-highlighted",
|
|
5637
|
+
"true"
|
|
5638
|
+
);
|
|
5639
|
+
}
|
|
5640
|
+
}
|
|
5641
|
+
}
|
|
5642
|
+
var isFloat = (value) => {
|
|
5643
|
+
const parts = value.split(".");
|
|
5644
|
+
if (parts.length !== 2) return false;
|
|
5645
|
+
const [whole, decimal] = parts;
|
|
5646
|
+
return isInteger(whole) && Number.isSafeInteger(Number(decimal));
|
|
5647
|
+
};
|
|
5648
|
+
var decimalPlaces = (value) => value.includes(".") ? value.split(".")[1].length : 0;
|
|
5649
|
+
var isInteger = (value) => /^[\d,]+$/.test(value);
|
|
5650
|
+
var inferFormat = (value) => isInteger(value) ? value.includes(",") ? FORMAT_WHOLE_NUMBER_COMMAS : FORMAT_WHOLE_NUMBER : isFloat(value) ? decimalPlaces(value) === 1 ? FORMAT_ONE_DECIMAL_COMMAS : decimalPlaces(value) === 2 ? FORMAT_TWO_DECIMALS_COMMAS : void 0 : void 0;
|
|
5651
|
+
|
|
5662
5652
|
// src/plugins/VariablesPlugin/VariableComponentPlugin.tsx
|
|
5663
|
-
import { useLexicalComposerContext as
|
|
5664
|
-
import { mergeRegister as
|
|
5653
|
+
import { useLexicalComposerContext as useLexicalComposerContext22 } from "@lexical/react/LexicalComposerContext";
|
|
5654
|
+
import { mergeRegister as mergeRegister6 } from "@lexical/utils";
|
|
5665
5655
|
import {
|
|
5666
5656
|
$createNodeSelection as $createNodeSelection2,
|
|
5667
5657
|
$getSelection,
|
|
@@ -5672,14 +5662,14 @@ import {
|
|
|
5672
5662
|
COMMAND_PRIORITY_NORMAL as COMMAND_PRIORITY_NORMAL2,
|
|
5673
5663
|
SELECTION_CHANGE_COMMAND
|
|
5674
5664
|
} from "lexical";
|
|
5675
|
-
import { useEffect as
|
|
5676
|
-
import { Fragment as
|
|
5665
|
+
import { useEffect as useEffect31 } from "react";
|
|
5666
|
+
import { Fragment as Fragment21, jsx as jsx51 } from "react/jsx-runtime";
|
|
5677
5667
|
function VariableComponentPlugin() {
|
|
5678
5668
|
const { hasModule, modulesNumber, getEditor } = useBlockEditor();
|
|
5679
|
-
const [editor] =
|
|
5680
|
-
|
|
5669
|
+
const [editor] = useLexicalComposerContext22();
|
|
5670
|
+
useEffect31(() => {
|
|
5681
5671
|
if (hasModule("Variables")) {
|
|
5682
|
-
return
|
|
5672
|
+
return mergeRegister6(
|
|
5683
5673
|
editor.registerCommand(
|
|
5684
5674
|
SELECTION_CHANGE_COMMAND,
|
|
5685
5675
|
() => {
|
|
@@ -5733,470 +5723,271 @@ function VariableComponentPlugin() {
|
|
|
5733
5723
|
);
|
|
5734
5724
|
}
|
|
5735
5725
|
}, [editor, modulesNumber]);
|
|
5736
|
-
return /* @__PURE__ */
|
|
5737
|
-
}
|
|
5738
|
-
|
|
5739
|
-
// src/plugins/VariablesPlugin/VariableToolbarAgentPlugin.tsx
|
|
5740
|
-
import { useLexicalComposerContext as useLexicalComposerContext24 } from "@lexical/react/LexicalComposerContext";
|
|
5741
|
-
import { mergeRegister as mergeRegister8 } from "@lexical/utils";
|
|
5742
|
-
import {
|
|
5743
|
-
COMMAND_PRIORITY_EDITOR as COMMAND_PRIORITY_EDITOR4,
|
|
5744
|
-
SELECTION_CHANGE_COMMAND as SELECTION_CHANGE_COMMAND2,
|
|
5745
|
-
createCommand as createCommand7
|
|
5746
|
-
} from "lexical";
|
|
5747
|
-
import { useEffect as useEffect33 } from "react";
|
|
5748
|
-
import { Fragment as Fragment23, jsx as jsx53 } from "react/jsx-runtime";
|
|
5749
|
-
var VARIABLE_TOOLBAR_SELECTION_CHANGE_COMMAND = createCommand7("VARIABLE_TOOLBAR_SELECTION_CHANGE_COMMAND");
|
|
5750
|
-
function VariableToolbarAgentPlugin() {
|
|
5751
|
-
const [editor] = useLexicalComposerContext24();
|
|
5752
|
-
useEffect33(() => {
|
|
5753
|
-
return mergeRegister8(
|
|
5754
|
-
editor.registerCommand(
|
|
5755
|
-
SELECTION_CHANGE_COMMAND2,
|
|
5756
|
-
(_payload, activeEditor) => {
|
|
5757
|
-
if (editor === activeEditor) {
|
|
5758
|
-
activeEditor.dispatchCommand(
|
|
5759
|
-
VARIABLE_TOOLBAR_SELECTION_CHANGE_COMMAND,
|
|
5760
|
-
void 0
|
|
5761
|
-
);
|
|
5762
|
-
}
|
|
5763
|
-
return false;
|
|
5764
|
-
},
|
|
5765
|
-
COMMAND_PRIORITY_EDITOR4
|
|
5766
|
-
),
|
|
5767
|
-
editor.registerUpdateListener(({ tags }) => {
|
|
5768
|
-
if (!tags.has("history-merge")) {
|
|
5769
|
-
editor.dispatchCommand(
|
|
5770
|
-
VARIABLE_TOOLBAR_SELECTION_CHANGE_COMMAND,
|
|
5771
|
-
void 0
|
|
5772
|
-
);
|
|
5773
|
-
}
|
|
5774
|
-
})
|
|
5775
|
-
);
|
|
5776
|
-
}, [editor]);
|
|
5777
|
-
return /* @__PURE__ */ jsx53(Fragment23, {});
|
|
5726
|
+
return /* @__PURE__ */ jsx51(Fragment21, {});
|
|
5778
5727
|
}
|
|
5779
5728
|
|
|
5780
|
-
// src/plugins/
|
|
5781
|
-
import { useLexicalComposerContext as
|
|
5729
|
+
// src/plugins/FinancialStatementQuestionPlugin/FinancialStatementQuestionComponent.tsx
|
|
5730
|
+
import { useLexicalComposerContext as useLexicalComposerContext23 } from "@lexical/react/LexicalComposerContext";
|
|
5782
5731
|
import { LexicalErrorBoundary as LexicalErrorBoundary2 } from "@lexical/react/LexicalErrorBoundary";
|
|
5783
5732
|
import { HistoryPlugin as HistoryPlugin2 } from "@lexical/react/LexicalHistoryPlugin";
|
|
5784
5733
|
import { LexicalNestedComposer as LexicalNestedComposer2 } from "@lexical/react/LexicalNestedComposer";
|
|
5785
5734
|
import { RichTextPlugin as RichTextPlugin2 } from "@lexical/react/LexicalRichTextPlugin";
|
|
5786
|
-
import clsx2 from "clsx";
|
|
5787
5735
|
import {
|
|
5788
|
-
$
|
|
5736
|
+
$createNodeSelection as $createNodeSelection3,
|
|
5789
5737
|
$getNodeByKey as $getNodeByKey19,
|
|
5790
|
-
$
|
|
5738
|
+
$setSelection as $setSelection3,
|
|
5739
|
+
CLICK_COMMAND as CLICK_COMMAND3,
|
|
5740
|
+
COMMAND_PRIORITY_LOW as COMMAND_PRIORITY_LOW3
|
|
5791
5741
|
} from "lexical";
|
|
5792
|
-
import {
|
|
5793
|
-
import {
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
const { nodeKey, id, itemIndex, correct, credit, debit, account } = props;
|
|
5742
|
+
import { useEffect as useEffect32, useRef as useRef20 } from "react";
|
|
5743
|
+
import { jsx as jsx52, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5744
|
+
function FinancialStatementQuestionComponent(props) {
|
|
5745
|
+
const { id, header, columnHeaders, rows, distractors, nodeKey } = props;
|
|
5797
5746
|
const { historyState } = useSharedHistoryContext();
|
|
5798
|
-
const [editor] =
|
|
5799
|
-
const
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
onUpdate: () => {
|
|
5809
|
-
editor.getEditorState().read(() => {
|
|
5747
|
+
const [editor] = useLexicalComposerContext23();
|
|
5748
|
+
const rootElementRef = useRef20(null);
|
|
5749
|
+
useEffect32(() => {
|
|
5750
|
+
return editor.registerCommand(
|
|
5751
|
+
CLICK_COMMAND3,
|
|
5752
|
+
(event, _activeEditor) => {
|
|
5753
|
+
if (rootElementRef.current?.contains(event.target) && event.target.hasAttribute(
|
|
5754
|
+
"data-selectable"
|
|
5755
|
+
)) {
|
|
5756
|
+
editor.update(() => {
|
|
5810
5757
|
const foundNode = $getNodeByKey19(nodeKey);
|
|
5811
|
-
if ($
|
|
5812
|
-
const
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
const root = $getRoot5();
|
|
5816
|
-
let firstChild = root.getFirstChild();
|
|
5817
|
-
if (!firstChild) {
|
|
5818
|
-
firstChild = $createParagraphNode6();
|
|
5819
|
-
root.append(firstChild);
|
|
5820
|
-
}
|
|
5821
|
-
firstChild.selectStart();
|
|
5822
|
-
});
|
|
5823
|
-
}
|
|
5824
|
-
if (newEntryItem.credit) {
|
|
5825
|
-
newEntryItem.credit.update(() => {
|
|
5826
|
-
const root = $getRoot5();
|
|
5827
|
-
let firstChild = root.getFirstChild();
|
|
5828
|
-
if (!firstChild) {
|
|
5829
|
-
firstChild = $createParagraphNode6();
|
|
5830
|
-
root.append(firstChild);
|
|
5831
|
-
}
|
|
5832
|
-
});
|
|
5833
|
-
}
|
|
5834
|
-
if (newEntryItem.debit) {
|
|
5835
|
-
newEntryItem.debit.update(() => {
|
|
5836
|
-
const root = $getRoot5();
|
|
5837
|
-
let firstChild = root.getFirstChild();
|
|
5838
|
-
if (!firstChild) {
|
|
5839
|
-
firstChild = $createParagraphNode6();
|
|
5840
|
-
root.append(firstChild);
|
|
5841
|
-
}
|
|
5842
|
-
});
|
|
5843
|
-
}
|
|
5758
|
+
if ($isFinancialStatementQuestionNode(foundNode)) {
|
|
5759
|
+
const selection = $createNodeSelection3();
|
|
5760
|
+
selection.add(nodeKey);
|
|
5761
|
+
$setSelection3(selection);
|
|
5844
5762
|
}
|
|
5845
5763
|
});
|
|
5846
5764
|
}
|
|
5847
|
-
|
|
5765
|
+
return false;
|
|
5766
|
+
},
|
|
5767
|
+
COMMAND_PRIORITY_LOW3
|
|
5848
5768
|
);
|
|
5849
|
-
}, [editor
|
|
5850
|
-
const removeItem = useCallback4(() => {
|
|
5851
|
-
editor.update(() => {
|
|
5852
|
-
const foundNode = $getNodeByKey19(nodeKey);
|
|
5853
|
-
if ($isJournalEntryQuestionNode(foundNode)) {
|
|
5854
|
-
foundNode.removeItem(itemIndex);
|
|
5855
|
-
}
|
|
5856
|
-
});
|
|
5857
|
-
}, [editor, nodeKey, itemIndex]);
|
|
5769
|
+
}, [editor]);
|
|
5858
5770
|
return /* @__PURE__ */ jsxs17(
|
|
5859
5771
|
"div",
|
|
5860
5772
|
{
|
|
5773
|
+
ref: rootElementRef,
|
|
5861
5774
|
id,
|
|
5862
|
-
className: "
|
|
5775
|
+
className: "financial-statement-question-prompt",
|
|
5863
5776
|
children: [
|
|
5864
|
-
/* @__PURE__ */
|
|
5777
|
+
/* @__PURE__ */ jsx52(
|
|
5865
5778
|
"div",
|
|
5866
5779
|
{
|
|
5867
|
-
className:
|
|
5868
|
-
"journal-entry-question-prompt-question-item",
|
|
5869
|
-
{
|
|
5870
|
-
correct,
|
|
5871
|
-
incorrect: !correct
|
|
5872
|
-
}
|
|
5873
|
-
),
|
|
5780
|
+
className: "financial-statement-question-prompt-title",
|
|
5874
5781
|
"data-selectable": "true",
|
|
5875
|
-
children:
|
|
5876
|
-
/* @__PURE__ */ jsx54("div", { className: "title", "data-selectable": "true", children: /* @__PURE__ */ jsx54("div", { "data-selectable": "true", children: correct ? "Account" : "Incorrect Choice" }) }),
|
|
5877
|
-
/* @__PURE__ */ jsx54("div", { style: { height: "100%" }, children: /* @__PURE__ */ jsx54(LexicalNestedComposer2, { initialEditor: account, children: /* @__PURE__ */ jsxs17(NestedEditor, { nodeKey, children: [
|
|
5878
|
-
/* @__PURE__ */ jsx54(SettingsPanelNestedAgentPlugin, {}),
|
|
5879
|
-
/* @__PURE__ */ jsx54(
|
|
5880
|
-
RichTextPlugin2,
|
|
5881
|
-
{
|
|
5882
|
-
contentEditable: /* @__PURE__ */ jsx54(NestedContentEditable, {}),
|
|
5883
|
-
ErrorBoundary: LexicalErrorBoundary2,
|
|
5884
|
-
placeholder: null
|
|
5885
|
-
},
|
|
5886
|
-
nodeKey
|
|
5887
|
-
),
|
|
5888
|
-
/* @__PURE__ */ jsx54(HistoryPlugin2, { externalHistoryState: historyState }),
|
|
5889
|
-
/* @__PURE__ */ jsx54(
|
|
5890
|
-
TextToolbarAgentPlugin,
|
|
5891
|
-
{
|
|
5892
|
-
decoratorNode: JournalEntryQuestionNode
|
|
5893
|
-
}
|
|
5894
|
-
),
|
|
5895
|
-
/* @__PURE__ */ jsx54(TypeaheadVariableAgentPlugin, {}),
|
|
5896
|
-
/* @__PURE__ */ jsx54(VariableComponentPlugin, {})
|
|
5897
|
-
] }) }) }),
|
|
5898
|
-
(!debit || !credit) && /* @__PURE__ */ jsxs17("div", { className: "controls", children: [
|
|
5899
|
-
itemIndex > 0 ? /* @__PURE__ */ jsx54("div", { children: /* @__PURE__ */ jsx54(
|
|
5900
|
-
Button,
|
|
5901
|
-
{
|
|
5902
|
-
StartIcon: CircleMinus,
|
|
5903
|
-
size: "medium",
|
|
5904
|
-
variant: "text",
|
|
5905
|
-
className: "cancel",
|
|
5906
|
-
onClick: removeItem
|
|
5907
|
-
}
|
|
5908
|
-
) }) : /* @__PURE__ */ jsx54("div", {}),
|
|
5909
|
-
/* @__PURE__ */ jsx54("div", { children: /* @__PURE__ */ jsx54(
|
|
5910
|
-
Button,
|
|
5911
|
-
{
|
|
5912
|
-
StartIcon: CirclePlus,
|
|
5913
|
-
size: "medium",
|
|
5914
|
-
variant: "text",
|
|
5915
|
-
className: "cancel",
|
|
5916
|
-
onClick: addItem
|
|
5917
|
-
}
|
|
5918
|
-
) })
|
|
5919
|
-
] })
|
|
5920
|
-
]
|
|
5782
|
+
children: "Financial Statement"
|
|
5921
5783
|
}
|
|
5922
5784
|
),
|
|
5923
|
-
|
|
5924
|
-
"
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
"journal-entry-question-prompt-question-item",
|
|
5928
|
-
{
|
|
5929
|
-
correct,
|
|
5930
|
-
incorrect: !correct
|
|
5931
|
-
}
|
|
5932
|
-
),
|
|
5933
|
-
"data-selectable": "true",
|
|
5934
|
-
children: [
|
|
5935
|
-
/* @__PURE__ */ jsx54("div", { className: "title", "data-selectable": "true", children: /* @__PURE__ */ jsx54("div", { "data-selectable": "true", children: "Debit" }) }),
|
|
5936
|
-
/* @__PURE__ */ jsx54("div", { style: { height: "100%" }, children: /* @__PURE__ */ jsx54(LexicalNestedComposer2, { initialEditor: debit, children: /* @__PURE__ */ jsxs17(NestedEditor, { nodeKey, children: [
|
|
5937
|
-
/* @__PURE__ */ jsx54(SettingsPanelNestedAgentPlugin, {}),
|
|
5938
|
-
/* @__PURE__ */ jsx54(
|
|
5939
|
-
RichTextPlugin2,
|
|
5940
|
-
{
|
|
5941
|
-
contentEditable: /* @__PURE__ */ jsx54(NestedContentEditable, {}),
|
|
5942
|
-
ErrorBoundary: LexicalErrorBoundary2,
|
|
5943
|
-
placeholder: null
|
|
5944
|
-
},
|
|
5945
|
-
nodeKey
|
|
5946
|
-
),
|
|
5947
|
-
/* @__PURE__ */ jsx54(HistoryPlugin2, { externalHistoryState: historyState }),
|
|
5948
|
-
/* @__PURE__ */ jsx54(
|
|
5949
|
-
TextToolbarAgentPlugin,
|
|
5950
|
-
{
|
|
5951
|
-
decoratorNode: JournalEntryQuestionNode
|
|
5952
|
-
}
|
|
5953
|
-
),
|
|
5954
|
-
/* @__PURE__ */ jsx54(TypeaheadVariableAgentPlugin, {}),
|
|
5955
|
-
/* @__PURE__ */ jsx54(VariableComponentPlugin, {})
|
|
5956
|
-
] }) }) })
|
|
5957
|
-
]
|
|
5958
|
-
}
|
|
5959
|
-
) : /* @__PURE__ */ jsx54("div", {}),
|
|
5960
|
-
credit ? /* @__PURE__ */ jsxs17(
|
|
5961
|
-
"div",
|
|
5962
|
-
{
|
|
5963
|
-
className: clsx2(
|
|
5964
|
-
"journal-entry-question-prompt-question-item",
|
|
5785
|
+
/* @__PURE__ */ jsx52("div", { "data-selectable": "true", children: /* @__PURE__ */ jsxs17("table", { "data-selectable": "true", style: { width: "100%" }, children: [
|
|
5786
|
+
/* @__PURE__ */ jsxs17("thead", { "data-selectable": "true", children: [
|
|
5787
|
+
/* @__PURE__ */ jsx52("tr", { "data-selectable": "true", children: /* @__PURE__ */ jsx52(
|
|
5788
|
+
"td",
|
|
5965
5789
|
{
|
|
5966
|
-
|
|
5967
|
-
|
|
5790
|
+
className: "financial-statement-question-header",
|
|
5791
|
+
colSpan: 2,
|
|
5792
|
+
"data-selectable": "true",
|
|
5793
|
+
children: /* @__PURE__ */ jsx52(LexicalNestedComposer2, { initialEditor: header, children: /* @__PURE__ */ jsxs17(NestedEditor, { nodeKey, children: [
|
|
5794
|
+
/* @__PURE__ */ jsx52(SettingsPanelNestedAgentPlugin, {}),
|
|
5795
|
+
/* @__PURE__ */ jsx52(
|
|
5796
|
+
RichTextPlugin2,
|
|
5797
|
+
{
|
|
5798
|
+
contentEditable: /* @__PURE__ */ jsx52(NestedContentEditable, {}),
|
|
5799
|
+
ErrorBoundary: LexicalErrorBoundary2,
|
|
5800
|
+
placeholder: null
|
|
5801
|
+
},
|
|
5802
|
+
nodeKey
|
|
5803
|
+
),
|
|
5804
|
+
/* @__PURE__ */ jsx52(
|
|
5805
|
+
HistoryPlugin2,
|
|
5806
|
+
{
|
|
5807
|
+
externalHistoryState: historyState
|
|
5808
|
+
}
|
|
5809
|
+
),
|
|
5810
|
+
/* @__PURE__ */ jsx52(
|
|
5811
|
+
TypeaheadVariableAgentPlugin,
|
|
5812
|
+
{
|
|
5813
|
+
decoratorNode: FinancialStatementQuestionNode
|
|
5814
|
+
}
|
|
5815
|
+
),
|
|
5816
|
+
/* @__PURE__ */ jsx52(VariableComponentPlugin, {})
|
|
5817
|
+
] }) })
|
|
5968
5818
|
}
|
|
5969
|
-
),
|
|
5970
|
-
"data-selectable": "true",
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
/* @__PURE__ */ jsx54("div", { style: { height: "100%" }, children: /* @__PURE__ */ jsx54(LexicalNestedComposer2, { initialEditor: credit, children: /* @__PURE__ */ jsxs17(NestedEditor, { nodeKey, children: [
|
|
5974
|
-
/* @__PURE__ */ jsx54(SettingsPanelNestedAgentPlugin, {}),
|
|
5975
|
-
/* @__PURE__ */ jsx54(
|
|
5976
|
-
RichTextPlugin2,
|
|
5977
|
-
{
|
|
5978
|
-
contentEditable: /* @__PURE__ */ jsx54(NestedContentEditable, {}),
|
|
5979
|
-
ErrorBoundary: LexicalErrorBoundary2,
|
|
5980
|
-
placeholder: null
|
|
5981
|
-
},
|
|
5982
|
-
nodeKey
|
|
5983
|
-
),
|
|
5984
|
-
/* @__PURE__ */ jsx54(HistoryPlugin2, { externalHistoryState: historyState }),
|
|
5985
|
-
/* @__PURE__ */ jsx54(
|
|
5986
|
-
TextToolbarAgentPlugin,
|
|
5987
|
-
{
|
|
5988
|
-
decoratorNode: JournalEntryQuestionNode
|
|
5989
|
-
}
|
|
5990
|
-
),
|
|
5991
|
-
/* @__PURE__ */ jsx54(TypeaheadVariableAgentPlugin, {}),
|
|
5992
|
-
/* @__PURE__ */ jsx54(VariableComponentPlugin, {}),
|
|
5993
|
-
/* @__PURE__ */ jsx54(VariableToolbarAgentPlugin, {})
|
|
5994
|
-
] }) }) }),
|
|
5995
|
-
/* @__PURE__ */ jsxs17("div", { className: "controls", children: [
|
|
5996
|
-
itemIndex > 0 ? /* @__PURE__ */ jsx54("div", { children: /* @__PURE__ */ jsx54(
|
|
5997
|
-
Button,
|
|
5998
|
-
{
|
|
5999
|
-
StartIcon: CircleMinus,
|
|
6000
|
-
size: "medium",
|
|
6001
|
-
variant: "text",
|
|
6002
|
-
className: "cancel",
|
|
6003
|
-
onClick: removeItem
|
|
6004
|
-
}
|
|
6005
|
-
) }) : /* @__PURE__ */ jsx54("div", {}),
|
|
6006
|
-
/* @__PURE__ */ jsx54("div", { children: /* @__PURE__ */ jsx54(
|
|
6007
|
-
Button,
|
|
6008
|
-
{
|
|
6009
|
-
StartIcon: CirclePlus,
|
|
6010
|
-
size: "medium",
|
|
6011
|
-
variant: "text",
|
|
6012
|
-
className: "cancel",
|
|
6013
|
-
onClick: addItem
|
|
6014
|
-
}
|
|
6015
|
-
) })
|
|
6016
|
-
] })
|
|
6017
|
-
]
|
|
6018
|
-
}
|
|
6019
|
-
) : /* @__PURE__ */ jsx54("div", {})
|
|
6020
|
-
]
|
|
6021
|
-
}
|
|
6022
|
-
);
|
|
6023
|
-
}
|
|
6024
|
-
|
|
6025
|
-
// src/plugins/JournalEntryQuestionPlugin/JournalEntryQuestionComponent.tsx
|
|
6026
|
-
import { jsx as jsx55, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
6027
|
-
function JournalEntryQuestionComponent(props) {
|
|
6028
|
-
const { nodeKey, journalType, lineItems, id } = props;
|
|
6029
|
-
const [editor] = useLexicalComposerContext26();
|
|
6030
|
-
const rootElementRef = useRef20(null);
|
|
6031
|
-
useEffect34(() => {
|
|
6032
|
-
return editor.registerCommand(
|
|
6033
|
-
CLICK_COMMAND3,
|
|
6034
|
-
(event, _activeEditor) => {
|
|
6035
|
-
if (rootElementRef.current?.contains(event.target) && event.target.hasAttribute(
|
|
6036
|
-
"data-selectable"
|
|
6037
|
-
)) {
|
|
6038
|
-
editor.update(() => {
|
|
6039
|
-
const foundNode = $getNodeByKey20(nodeKey);
|
|
6040
|
-
if ($isJournalEntryQuestionNode(foundNode)) {
|
|
6041
|
-
const selection = $createNodeSelection3();
|
|
6042
|
-
selection.add(nodeKey);
|
|
6043
|
-
$setSelection3(selection);
|
|
6044
|
-
}
|
|
6045
|
-
});
|
|
6046
|
-
}
|
|
6047
|
-
return false;
|
|
6048
|
-
},
|
|
6049
|
-
COMMAND_PRIORITY_LOW3
|
|
6050
|
-
);
|
|
6051
|
-
}, [editor]);
|
|
6052
|
-
const doNeedDistractor = lineItems.reduce((a, i) => {
|
|
6053
|
-
return i.correct ? a : ++a;
|
|
6054
|
-
}, 0) <= 0;
|
|
6055
|
-
return /* @__PURE__ */ jsxs18(
|
|
6056
|
-
"div",
|
|
6057
|
-
{
|
|
6058
|
-
ref: rootElementRef,
|
|
6059
|
-
id,
|
|
6060
|
-
className: "journal-entry-question-prompt",
|
|
6061
|
-
children: [
|
|
6062
|
-
/* @__PURE__ */ jsx55(
|
|
6063
|
-
"div",
|
|
6064
|
-
{
|
|
6065
|
-
className: "journal-entry-question-prompt-title",
|
|
6066
|
-
"data-selectable": "true",
|
|
6067
|
-
children: "Journal Entry"
|
|
6068
|
-
}
|
|
6069
|
-
),
|
|
6070
|
-
/* @__PURE__ */ jsxs18(
|
|
6071
|
-
"div",
|
|
6072
|
-
{
|
|
6073
|
-
className: "journal-entry-question-prompt-items",
|
|
6074
|
-
"data-selectable": "true",
|
|
6075
|
-
children: [
|
|
6076
|
-
journalType === "noEntryRequiredCorrect" && /* @__PURE__ */ jsxs18(
|
|
6077
|
-
"div",
|
|
5819
|
+
) }),
|
|
5820
|
+
columnHeaders.length >= 2 && /* @__PURE__ */ jsxs17("tr", { "data-selectable": "true", children: [
|
|
5821
|
+
/* @__PURE__ */ jsx52(
|
|
5822
|
+
"th",
|
|
6078
5823
|
{
|
|
6079
|
-
className: "journal-entry-question-prompt-question-item correct",
|
|
6080
5824
|
"data-selectable": "true",
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
/* @__PURE__ */ jsx55("div", { "data-selectable": "true", children: "No Entry Required" })
|
|
6084
|
-
]
|
|
5825
|
+
style: { textAlign: "left" },
|
|
5826
|
+
children: columnHeaders[0]
|
|
6085
5827
|
}
|
|
6086
5828
|
),
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
return /* @__PURE__ */ jsx55(
|
|
6090
|
-
JournalEntryQuestionItemComponent,
|
|
6091
|
-
{
|
|
6092
|
-
nodeKey,
|
|
6093
|
-
id: journalEntryItem.id,
|
|
6094
|
-
itemIndex,
|
|
6095
|
-
correct: journalEntryItem.correct,
|
|
6096
|
-
account: journalEntryItem.account,
|
|
6097
|
-
debit: journalEntryItem.debit,
|
|
6098
|
-
credit: journalEntryItem.credit
|
|
6099
|
-
},
|
|
6100
|
-
journalEntryItem.id
|
|
6101
|
-
);
|
|
6102
|
-
}
|
|
6103
|
-
}),
|
|
6104
|
-
(journalType === "default" || journalType === "noEntryRequiredDistractor") && lineItems.map((journalEntryItem, itemIndex) => {
|
|
6105
|
-
return /* @__PURE__ */ jsx55(
|
|
6106
|
-
JournalEntryQuestionItemComponent,
|
|
6107
|
-
{
|
|
6108
|
-
nodeKey,
|
|
6109
|
-
id: journalEntryItem.id,
|
|
6110
|
-
itemIndex,
|
|
6111
|
-
correct: journalEntryItem.correct,
|
|
6112
|
-
account: journalEntryItem.account,
|
|
6113
|
-
debit: journalEntryItem.debit,
|
|
6114
|
-
credit: journalEntryItem.credit
|
|
6115
|
-
},
|
|
6116
|
-
journalEntryItem.id
|
|
6117
|
-
);
|
|
6118
|
-
}),
|
|
6119
|
-
doNeedDistractor && /* @__PURE__ */ jsx55(
|
|
6120
|
-
DistractorButton,
|
|
5829
|
+
/* @__PURE__ */ jsx52(
|
|
5830
|
+
"th",
|
|
6121
5831
|
{
|
|
6122
|
-
|
|
6123
|
-
|
|
5832
|
+
"data-selectable": "true",
|
|
5833
|
+
style: { textAlign: "right" },
|
|
5834
|
+
children: columnHeaders[1]
|
|
6124
5835
|
}
|
|
6125
5836
|
)
|
|
6126
|
-
]
|
|
6127
|
-
}
|
|
6128
|
-
|
|
5837
|
+
] })
|
|
5838
|
+
] }),
|
|
5839
|
+
/* @__PURE__ */ jsxs17("tbody", { children: [
|
|
5840
|
+
rows.map(
|
|
5841
|
+
(rowItem, rowItemIndex) => {
|
|
5842
|
+
if (rowItem.type === "Heading") {
|
|
5843
|
+
return /* @__PURE__ */ jsxs17("tr", { "data-selectable": "true", children: [
|
|
5844
|
+
/* @__PURE__ */ jsx52("td", { "data-selectable": "true", children: /* @__PURE__ */ jsx52(
|
|
5845
|
+
"strong",
|
|
5846
|
+
{
|
|
5847
|
+
style: {
|
|
5848
|
+
paddingLeft: `calc(1em * ${rowItem.depth})`
|
|
5849
|
+
},
|
|
5850
|
+
children: rowItem.entry
|
|
5851
|
+
}
|
|
5852
|
+
) }),
|
|
5853
|
+
/* @__PURE__ */ jsx52(
|
|
5854
|
+
"td",
|
|
5855
|
+
{
|
|
5856
|
+
className: "financial-statement-question-cell",
|
|
5857
|
+
"data-selectable": "true",
|
|
5858
|
+
children: /* @__PURE__ */ jsxs17("div", { className: "financial-statement-question-cell-id", children: [
|
|
5859
|
+
"A",
|
|
5860
|
+
rowItemIndex + 1
|
|
5861
|
+
] })
|
|
5862
|
+
}
|
|
5863
|
+
)
|
|
5864
|
+
] }, rowItem.id);
|
|
5865
|
+
} else if (rowItem.type === "Line") {
|
|
5866
|
+
return /* @__PURE__ */ jsxs17("tr", { "data-selectable": "true", children: [
|
|
5867
|
+
/* @__PURE__ */ jsx52("td", { "data-selectable": "true", children: /* @__PURE__ */ jsx52(
|
|
5868
|
+
"span",
|
|
5869
|
+
{
|
|
5870
|
+
style: {
|
|
5871
|
+
paddingLeft: `calc(1em * ${rowItem.depth})`
|
|
5872
|
+
},
|
|
5873
|
+
children: rowItem.entry
|
|
5874
|
+
}
|
|
5875
|
+
) }),
|
|
5876
|
+
/* @__PURE__ */ jsxs17(
|
|
5877
|
+
"td",
|
|
5878
|
+
{
|
|
5879
|
+
className: "financial-statement-question-cell",
|
|
5880
|
+
"data-selectable": "true",
|
|
5881
|
+
children: [
|
|
5882
|
+
/* @__PURE__ */ jsxs17("div", { className: "financial-statement-question-cell-id", children: [
|
|
5883
|
+
"A",
|
|
5884
|
+
rowItemIndex + 1
|
|
5885
|
+
] }),
|
|
5886
|
+
/* @__PURE__ */ jsx52(
|
|
5887
|
+
LexicalNestedComposer2,
|
|
5888
|
+
{
|
|
5889
|
+
initialEditor: rowItem.amount,
|
|
5890
|
+
children: /* @__PURE__ */ jsxs17(NestedEditor, { nodeKey, children: [
|
|
5891
|
+
/* @__PURE__ */ jsx52(SettingsPanelNestedAgentPlugin, {}),
|
|
5892
|
+
/* @__PURE__ */ jsx52(
|
|
5893
|
+
RichTextPlugin2,
|
|
5894
|
+
{
|
|
5895
|
+
contentEditable: /* @__PURE__ */ jsx52(NestedContentEditable, {}),
|
|
5896
|
+
ErrorBoundary: LexicalErrorBoundary2,
|
|
5897
|
+
placeholder: null
|
|
5898
|
+
},
|
|
5899
|
+
nodeKey
|
|
5900
|
+
),
|
|
5901
|
+
/* @__PURE__ */ jsx52(
|
|
5902
|
+
HistoryPlugin2,
|
|
5903
|
+
{
|
|
5904
|
+
externalHistoryState: historyState
|
|
5905
|
+
}
|
|
5906
|
+
),
|
|
5907
|
+
/* @__PURE__ */ jsx52(
|
|
5908
|
+
TypeaheadVariableAgentPlugin,
|
|
5909
|
+
{
|
|
5910
|
+
decoratorNode: FinancialStatementQuestionNode
|
|
5911
|
+
}
|
|
5912
|
+
),
|
|
5913
|
+
/* @__PURE__ */ jsx52(VariableComponentPlugin, {})
|
|
5914
|
+
] })
|
|
5915
|
+
}
|
|
5916
|
+
)
|
|
5917
|
+
]
|
|
5918
|
+
}
|
|
5919
|
+
)
|
|
5920
|
+
] }, rowItem.id);
|
|
5921
|
+
}
|
|
5922
|
+
}
|
|
5923
|
+
),
|
|
5924
|
+
distractors.map(
|
|
5925
|
+
(distractorItem) => {
|
|
5926
|
+
return /* @__PURE__ */ jsxs17("tr", { "data-selectable": "true", children: [
|
|
5927
|
+
/* @__PURE__ */ jsx52("td", { "data-selectable": "true", children: /* @__PURE__ */ jsx52(
|
|
5928
|
+
"span",
|
|
5929
|
+
{
|
|
5930
|
+
style: { color: "var(--sl-color-red-500)" },
|
|
5931
|
+
children: distractorItem.entry
|
|
5932
|
+
}
|
|
5933
|
+
) }),
|
|
5934
|
+
/* @__PURE__ */ jsx52("td", { "data-selectable": "true" })
|
|
5935
|
+
] }, distractorItem.id);
|
|
5936
|
+
}
|
|
5937
|
+
)
|
|
5938
|
+
] })
|
|
5939
|
+
] }) })
|
|
6129
5940
|
]
|
|
6130
5941
|
}
|
|
6131
5942
|
);
|
|
6132
5943
|
}
|
|
6133
5944
|
|
|
6134
|
-
// src/plugins/
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
$createParagraphNode as $createParagraphNode7,
|
|
6138
|
-
$createTextNode as $createTextNode4,
|
|
6139
|
-
$getRoot as $getRoot6,
|
|
6140
|
-
DecoratorNode as DecoratorNode5,
|
|
6141
|
-
createEditor as createEditor2
|
|
6142
|
-
} from "lexical";
|
|
6143
|
-
import { nanoid as nanoid2 } from "nanoid";
|
|
6144
|
-
import { jsx as jsx56 } from "react/jsx-runtime";
|
|
6145
|
-
var TYPE_NAME4 = "journal-entry-question";
|
|
6146
|
-
var JournalTypeLabelMap = {
|
|
6147
|
-
default: "Default",
|
|
6148
|
-
noEntryRequiredCorrect: "No Entry Required Correct",
|
|
6149
|
-
noEntryRequiredDistractor: "No Entry Required Distractor"
|
|
5945
|
+
// src/plugins/FinancialStatementQuestionPlugin/isSerializableFinancialStatementHeading.ts
|
|
5946
|
+
var isSerializableFinancialStatementHeading = (row) => {
|
|
5947
|
+
return row.type === "Heading";
|
|
6150
5948
|
};
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
5949
|
+
|
|
5950
|
+
// src/plugins/FinancialStatementQuestionPlugin/isSerializableFinancialStatementLine.ts
|
|
5951
|
+
var isSerializableFinancialStatementLine = (row) => {
|
|
5952
|
+
return row.type === "Line";
|
|
5953
|
+
};
|
|
5954
|
+
|
|
5955
|
+
// src/plugins/FinancialStatementQuestionPlugin/FinancialStatementQuestionNode.tsx
|
|
5956
|
+
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
5957
|
+
var TYPE_NAME4 = "financial-statement-question";
|
|
5958
|
+
var isFinancialStatementHeading = (row) => {
|
|
5959
|
+
return row.type === "Heading";
|
|
5960
|
+
};
|
|
5961
|
+
var isFinancialStatementLine = (row) => {
|
|
5962
|
+
return row.type === "Line";
|
|
5963
|
+
};
|
|
5964
|
+
var FinancialStatementQuestionNode = class _FinancialStatementQuestionNode extends DecoratorNode5 {
|
|
5965
|
+
constructor(points, header, columnHeaders, rows, distractors, id, key) {
|
|
6156
5966
|
super(key);
|
|
6157
|
-
this.__points = points < 0 ? 1 : points;
|
|
6158
|
-
this.__journalType = journalType;
|
|
6159
|
-
this.__errorTolerance = errorTolerance;
|
|
6160
5967
|
this.__id = id || nanoid2();
|
|
6161
|
-
this.
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
correct: item.correct,
|
|
6167
|
-
account: item.account,
|
|
6168
|
-
credit: item.correct ? item.credit : void 0,
|
|
6169
|
-
debit: item.correct ? item.debit : void 0
|
|
6170
|
-
});
|
|
6171
|
-
}
|
|
6172
|
-
} else {
|
|
6173
|
-
for (let i = 0; i < 2; i++) {
|
|
6174
|
-
this.__lineItems.push({
|
|
6175
|
-
id: nanoid2(),
|
|
6176
|
-
correct: true,
|
|
6177
|
-
account: initNewContentEditor(),
|
|
6178
|
-
credit: initNewContentEditor(),
|
|
6179
|
-
debit: initNewContentEditor()
|
|
6180
|
-
});
|
|
6181
|
-
}
|
|
6182
|
-
}
|
|
5968
|
+
this.__points = points < 0 ? 1 : points;
|
|
5969
|
+
this.__header = header;
|
|
5970
|
+
this.__columnHeaders = columnHeaders;
|
|
5971
|
+
this.__rows = rows;
|
|
5972
|
+
this.__distractors = distractors;
|
|
6183
5973
|
}
|
|
6184
5974
|
static getType() {
|
|
6185
5975
|
return TYPE_NAME4;
|
|
6186
5976
|
}
|
|
6187
5977
|
static clone(node) {
|
|
6188
|
-
return new
|
|
5978
|
+
return new _FinancialStatementQuestionNode(
|
|
6189
5979
|
node.__points,
|
|
6190
|
-
node.
|
|
6191
|
-
node.
|
|
6192
|
-
node.
|
|
5980
|
+
node.__header,
|
|
5981
|
+
node.__columnHeaders,
|
|
5982
|
+
node.__rows,
|
|
5983
|
+
node.__distractors,
|
|
6193
5984
|
node.__id,
|
|
6194
5985
|
node.__key
|
|
6195
5986
|
);
|
|
6196
5987
|
}
|
|
6197
5988
|
__createWrapper() {
|
|
6198
5989
|
const wrapper = document.createElement("div");
|
|
6199
|
-
wrapper.classList.add("
|
|
5990
|
+
wrapper.classList.add("financial-statement-question-wrapper");
|
|
6200
5991
|
return wrapper;
|
|
6201
5992
|
}
|
|
6202
5993
|
createDOM() {
|
|
@@ -6213,70 +6004,86 @@ var JournalEntryQuestionNode = class _JournalEntryQuestionNode extends Decorator
|
|
|
6213
6004
|
return null;
|
|
6214
6005
|
}
|
|
6215
6006
|
static importJSON(serializedNode) {
|
|
6216
|
-
const
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
);
|
|
6222
|
-
|
|
6223
|
-
|
|
6007
|
+
const headerNestedEditor = createEditor2();
|
|
6008
|
+
const editorState = headerNestedEditor.parseEditorState(
|
|
6009
|
+
serializedNode.header.editorState
|
|
6010
|
+
);
|
|
6011
|
+
if (!editorState.isEmpty()) {
|
|
6012
|
+
headerNestedEditor.setEditorState(editorState);
|
|
6013
|
+
}
|
|
6014
|
+
const restoredRows = [];
|
|
6015
|
+
for (const row of serializedNode.rows) {
|
|
6016
|
+
if (isSerializableFinancialStatementHeading(row)) {
|
|
6017
|
+
restoredRows.push({
|
|
6018
|
+
type: row.type,
|
|
6019
|
+
id: row.id,
|
|
6020
|
+
depth: row.depth,
|
|
6021
|
+
entry: row.entry,
|
|
6022
|
+
isHint: row.isHint
|
|
6023
|
+
});
|
|
6024
|
+
continue;
|
|
6224
6025
|
}
|
|
6225
|
-
if (
|
|
6226
|
-
const
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
);
|
|
6230
|
-
if (!editorState2.isEmpty()) {
|
|
6231
|
-
creditNestedEditor.setEditorState(editorState2);
|
|
6232
|
-
}
|
|
6233
|
-
const debitNestedEditor = createEditor2();
|
|
6234
|
-
editorState2 = debitNestedEditor.parseEditorState(
|
|
6235
|
-
item.debit.editorState
|
|
6026
|
+
if (isSerializableFinancialStatementLine(row)) {
|
|
6027
|
+
const amountNestedEditor = createEditor2();
|
|
6028
|
+
const editorState2 = amountNestedEditor.parseEditorState(
|
|
6029
|
+
row.amount.editorState
|
|
6236
6030
|
);
|
|
6237
6031
|
if (!editorState2.isEmpty()) {
|
|
6238
|
-
|
|
6032
|
+
amountNestedEditor.setEditorState(editorState2);
|
|
6239
6033
|
}
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
id: item.id,
|
|
6250
|
-
correct: item.correct,
|
|
6251
|
-
account: accountNestedEditor
|
|
6034
|
+
restoredRows.push({
|
|
6035
|
+
type: row.type,
|
|
6036
|
+
id: row.id,
|
|
6037
|
+
depth: row.depth,
|
|
6038
|
+
entry: row.entry,
|
|
6039
|
+
amount: amountNestedEditor,
|
|
6040
|
+
isEntryHint: row.isEntryHint,
|
|
6041
|
+
isAmountHint: row.isAmountHint,
|
|
6042
|
+
role: row.role
|
|
6252
6043
|
});
|
|
6044
|
+
continue;
|
|
6253
6045
|
}
|
|
6254
6046
|
}
|
|
6255
|
-
return $
|
|
6047
|
+
return $createFinancialStatementQuestionNode(
|
|
6256
6048
|
serializedNode.points,
|
|
6257
|
-
|
|
6258
|
-
serializedNode.
|
|
6259
|
-
|
|
6049
|
+
headerNestedEditor,
|
|
6050
|
+
serializedNode.columnHeaders,
|
|
6051
|
+
restoredRows,
|
|
6052
|
+
serializedNode.distractors,
|
|
6260
6053
|
serializedNode.id
|
|
6261
6054
|
);
|
|
6262
6055
|
}
|
|
6263
6056
|
exportJSON() {
|
|
6264
|
-
const exportedOptions = [];
|
|
6265
|
-
for (const item of this.__lineItems) {
|
|
6266
|
-
exportedOptions.push({
|
|
6267
|
-
id: item.id,
|
|
6268
|
-
correct: item.correct,
|
|
6269
|
-
account: item.account.toJSON(),
|
|
6270
|
-
credit: item.credit?.toJSON(),
|
|
6271
|
-
debit: item.debit?.toJSON()
|
|
6272
|
-
});
|
|
6273
|
-
}
|
|
6274
6057
|
return {
|
|
6275
|
-
lineItems: exportedOptions,
|
|
6276
6058
|
id: this.__id,
|
|
6277
|
-
errorTolerance: this.__errorTolerance,
|
|
6278
|
-
journalType: this.__journalType,
|
|
6279
6059
|
points: this.__points,
|
|
6060
|
+
header: this.__header.toJSON(),
|
|
6061
|
+
columnHeaders: this.__columnHeaders,
|
|
6062
|
+
rows: this.__rows.map((row) => {
|
|
6063
|
+
if (isFinancialStatementHeading(row)) {
|
|
6064
|
+
return {
|
|
6065
|
+
type: row.type,
|
|
6066
|
+
id: row.id,
|
|
6067
|
+
depth: row.depth,
|
|
6068
|
+
entry: row.entry,
|
|
6069
|
+
isHint: row.isHint
|
|
6070
|
+
};
|
|
6071
|
+
}
|
|
6072
|
+
if (isFinancialStatementLine(row)) {
|
|
6073
|
+
return {
|
|
6074
|
+
type: row.type,
|
|
6075
|
+
id: row.id,
|
|
6076
|
+
depth: row.depth,
|
|
6077
|
+
entry: row.entry,
|
|
6078
|
+
amount: row.amount.toJSON(),
|
|
6079
|
+
isEntryHint: row.isEntryHint,
|
|
6080
|
+
isAmountHint: row.isAmountHint,
|
|
6081
|
+
role: row.role
|
|
6082
|
+
};
|
|
6083
|
+
}
|
|
6084
|
+
throw new Error("Invalid row type");
|
|
6085
|
+
}).filter(Boolean),
|
|
6086
|
+
distractors: this.__distractors,
|
|
6280
6087
|
type: TYPE_NAME4,
|
|
6281
6088
|
version: 1
|
|
6282
6089
|
};
|
|
@@ -6295,89 +6102,36 @@ var JournalEntryQuestionNode = class _JournalEntryQuestionNode extends Decorator
|
|
|
6295
6102
|
}
|
|
6296
6103
|
setPoints(points) {
|
|
6297
6104
|
const writable = this.getWritable();
|
|
6298
|
-
writable.__points = points
|
|
6299
|
-
}
|
|
6300
|
-
getErrorTolerance() {
|
|
6301
|
-
return this.__errorTolerance;
|
|
6302
|
-
}
|
|
6303
|
-
setErrorTolerance(errorTolerance) {
|
|
6304
|
-
const writable = this.getWritable();
|
|
6305
|
-
writable.__errorTolerance = errorTolerance;
|
|
6306
|
-
}
|
|
6307
|
-
getJournalType() {
|
|
6308
|
-
return this.__journalType;
|
|
6309
|
-
}
|
|
6310
|
-
setJournalType(journalType) {
|
|
6311
|
-
const writable = this.getWritable();
|
|
6312
|
-
if (journalType === "noEntryRequiredDistractor") {
|
|
6313
|
-
const newItems = [...this.__lineItems];
|
|
6314
|
-
const newAccountContent = initNewContentEditor();
|
|
6315
|
-
newAccountContent.update(() => {
|
|
6316
|
-
const root = $getRoot6();
|
|
6317
|
-
let firstChild = root.getFirstChild();
|
|
6318
|
-
if (!firstChild) {
|
|
6319
|
-
firstChild = $createParagraphNode7();
|
|
6320
|
-
firstChild.append($createTextNode4("No Entry Required"));
|
|
6321
|
-
root.append(firstChild);
|
|
6322
|
-
}
|
|
6323
|
-
});
|
|
6324
|
-
newItems.push({
|
|
6325
|
-
id: nanoid2(),
|
|
6326
|
-
correct: false,
|
|
6327
|
-
account: newAccountContent,
|
|
6328
|
-
credit: void 0,
|
|
6329
|
-
debit: void 0
|
|
6330
|
-
});
|
|
6331
|
-
writable.__lineItems = newItems;
|
|
6332
|
-
}
|
|
6333
|
-
writable.__journalType = journalType;
|
|
6334
|
-
}
|
|
6335
|
-
addItem(itemIndex, correct) {
|
|
6336
|
-
const newItemIndex = itemIndex + 1;
|
|
6337
|
-
const writable = this.getWritable();
|
|
6338
|
-
const newItems = [...writable.__lineItems];
|
|
6339
|
-
newItems.splice(newItemIndex, 0, {
|
|
6340
|
-
id: nanoid2(),
|
|
6341
|
-
correct,
|
|
6342
|
-
account: initNewContentEditor(),
|
|
6343
|
-
credit: correct ? initNewContentEditor() : void 0,
|
|
6344
|
-
debit: correct ? initNewContentEditor() : void 0
|
|
6345
|
-
});
|
|
6346
|
-
writable.__lineItems = newItems;
|
|
6347
|
-
}
|
|
6348
|
-
removeItem(itemIndex) {
|
|
6349
|
-
if (this.__lineItems.length > 1 && this.__lineItems.length > itemIndex) {
|
|
6350
|
-
const writable = this.getWritable();
|
|
6351
|
-
const newItems = [...writable.__lineItems];
|
|
6352
|
-
newItems.splice(itemIndex, 1);
|
|
6353
|
-
writable.__lineItems = newItems;
|
|
6354
|
-
}
|
|
6105
|
+
writable.__points = points <= 0 ? 1 : points;
|
|
6355
6106
|
}
|
|
6356
6107
|
decorate() {
|
|
6357
|
-
return /* @__PURE__ */
|
|
6358
|
-
|
|
6108
|
+
return /* @__PURE__ */ jsx53(
|
|
6109
|
+
FinancialStatementQuestionComponent,
|
|
6359
6110
|
{
|
|
6360
6111
|
nodeKey: this.__key,
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
6112
|
+
id: this.__id,
|
|
6113
|
+
header: this.__header,
|
|
6114
|
+
columnHeaders: this.__columnHeaders,
|
|
6115
|
+
rows: this.__rows,
|
|
6116
|
+
distractors: this.__distractors
|
|
6364
6117
|
}
|
|
6365
6118
|
);
|
|
6366
6119
|
}
|
|
6367
6120
|
};
|
|
6368
|
-
function $
|
|
6121
|
+
function $createFinancialStatementQuestionNode(points, header, columnHeaders, rows, distractors, id) {
|
|
6369
6122
|
return $applyNodeReplacement5(
|
|
6370
|
-
new
|
|
6123
|
+
new FinancialStatementQuestionNode(
|
|
6371
6124
|
points,
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6125
|
+
header,
|
|
6126
|
+
columnHeaders,
|
|
6127
|
+
rows,
|
|
6128
|
+
distractors,
|
|
6375
6129
|
id
|
|
6376
6130
|
)
|
|
6377
6131
|
);
|
|
6378
6132
|
}
|
|
6379
|
-
function $
|
|
6380
|
-
return node instanceof
|
|
6133
|
+
function $isFinancialStatementQuestionNode(node) {
|
|
6134
|
+
return node instanceof FinancialStatementQuestionNode;
|
|
6381
6135
|
}
|
|
6382
6136
|
|
|
6383
6137
|
// src/plugins/MatchingQuestionPlugin/MatchingQuestionNode.tsx
|
|
@@ -6389,21 +6143,21 @@ import {
|
|
|
6389
6143
|
import { nanoid as nanoid3 } from "nanoid";
|
|
6390
6144
|
|
|
6391
6145
|
// src/plugins/MatchingQuestionPlugin/DistractorButton.tsx
|
|
6392
|
-
import { useLexicalComposerContext as
|
|
6146
|
+
import { useLexicalComposerContext as useLexicalComposerContext24 } from "@lexical/react/LexicalComposerContext";
|
|
6393
6147
|
import {
|
|
6394
|
-
$createParagraphNode as $
|
|
6395
|
-
$getNodeByKey as $
|
|
6396
|
-
$getRoot as $
|
|
6148
|
+
$createParagraphNode as $createParagraphNode6,
|
|
6149
|
+
$getNodeByKey as $getNodeByKey20,
|
|
6150
|
+
$getRoot as $getRoot5
|
|
6397
6151
|
} from "lexical";
|
|
6398
|
-
import { useCallback as
|
|
6399
|
-
import { jsx as
|
|
6152
|
+
import { useCallback as useCallback4 } from "react";
|
|
6153
|
+
import { jsx as jsx54, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
6400
6154
|
function DistractorButton2(props) {
|
|
6401
6155
|
const { nodeKey, itemIndex } = props;
|
|
6402
|
-
const [editor] =
|
|
6403
|
-
const addDistractor =
|
|
6156
|
+
const [editor] = useLexicalComposerContext24();
|
|
6157
|
+
const addDistractor = useCallback4(() => {
|
|
6404
6158
|
editor.update(
|
|
6405
6159
|
() => {
|
|
6406
|
-
const foundNode = $
|
|
6160
|
+
const foundNode = $getNodeByKey20(nodeKey);
|
|
6407
6161
|
if ($isMatchingQuestionNode(foundNode)) {
|
|
6408
6162
|
foundNode.addItem(itemIndex, false);
|
|
6409
6163
|
}
|
|
@@ -6411,15 +6165,15 @@ function DistractorButton2(props) {
|
|
|
6411
6165
|
{
|
|
6412
6166
|
onUpdate: () => {
|
|
6413
6167
|
editor.getEditorState().read(() => {
|
|
6414
|
-
const foundNode = $
|
|
6168
|
+
const foundNode = $getNodeByKey20(nodeKey);
|
|
6415
6169
|
if ($isMatchingQuestionNode(foundNode)) {
|
|
6416
6170
|
const newQuestionItem = foundNode.__items[itemIndex + 1];
|
|
6417
6171
|
if (newQuestionItem.itemOptionContent) {
|
|
6418
6172
|
newQuestionItem.itemOptionContent.update(() => {
|
|
6419
|
-
const root = $
|
|
6173
|
+
const root = $getRoot5();
|
|
6420
6174
|
let firstChild = root.getFirstChild();
|
|
6421
6175
|
if (!firstChild) {
|
|
6422
|
-
firstChild = $
|
|
6176
|
+
firstChild = $createParagraphNode6();
|
|
6423
6177
|
root.append(firstChild);
|
|
6424
6178
|
}
|
|
6425
6179
|
firstChild.selectStart();
|
|
@@ -6431,9 +6185,9 @@ function DistractorButton2(props) {
|
|
|
6431
6185
|
}
|
|
6432
6186
|
);
|
|
6433
6187
|
}, [editor, nodeKey, itemIndex]);
|
|
6434
|
-
return /* @__PURE__ */
|
|
6435
|
-
/* @__PURE__ */
|
|
6436
|
-
/* @__PURE__ */
|
|
6188
|
+
return /* @__PURE__ */ jsxs18("div", { className: "matching-question-prompt-question-item-wrapper", children: [
|
|
6189
|
+
/* @__PURE__ */ jsx54("div", {}),
|
|
6190
|
+
/* @__PURE__ */ jsx54("div", { className: "matching-question-distractor-button", children: /* @__PURE__ */ jsx54(
|
|
6437
6191
|
Button,
|
|
6438
6192
|
{
|
|
6439
6193
|
label: "Add Distractor",
|
|
@@ -6446,31 +6200,72 @@ function DistractorButton2(props) {
|
|
|
6446
6200
|
}
|
|
6447
6201
|
|
|
6448
6202
|
// src/plugins/MatchingQuestionPlugin/MatchingQuestionComponent.tsx
|
|
6449
|
-
import { useLexicalComposerContext as
|
|
6203
|
+
import { useLexicalComposerContext as useLexicalComposerContext27 } from "@lexical/react/LexicalComposerContext";
|
|
6450
6204
|
import {
|
|
6451
6205
|
$createNodeSelection as $createNodeSelection4,
|
|
6452
|
-
$getNodeByKey as $
|
|
6206
|
+
$getNodeByKey as $getNodeByKey22,
|
|
6453
6207
|
$setSelection as $setSelection4,
|
|
6454
6208
|
CLICK_COMMAND as CLICK_COMMAND4,
|
|
6455
6209
|
COMMAND_PRIORITY_LOW as COMMAND_PRIORITY_LOW4
|
|
6456
6210
|
} from "lexical";
|
|
6457
|
-
import { useEffect as
|
|
6211
|
+
import { useEffect as useEffect34, useRef as useRef21 } from "react";
|
|
6212
|
+
|
|
6213
|
+
// src/plugins/VariablesPlugin/VariableToolbarAgentPlugin.tsx
|
|
6214
|
+
import { useLexicalComposerContext as useLexicalComposerContext25 } from "@lexical/react/LexicalComposerContext";
|
|
6215
|
+
import { mergeRegister as mergeRegister7 } from "@lexical/utils";
|
|
6216
|
+
import {
|
|
6217
|
+
COMMAND_PRIORITY_EDITOR as COMMAND_PRIORITY_EDITOR4,
|
|
6218
|
+
SELECTION_CHANGE_COMMAND as SELECTION_CHANGE_COMMAND2,
|
|
6219
|
+
createCommand as createCommand6
|
|
6220
|
+
} from "lexical";
|
|
6221
|
+
import { useEffect as useEffect33 } from "react";
|
|
6222
|
+
import { Fragment as Fragment22, jsx as jsx55 } from "react/jsx-runtime";
|
|
6223
|
+
var VARIABLE_TOOLBAR_SELECTION_CHANGE_COMMAND = createCommand6("VARIABLE_TOOLBAR_SELECTION_CHANGE_COMMAND");
|
|
6224
|
+
function VariableToolbarAgentPlugin() {
|
|
6225
|
+
const [editor] = useLexicalComposerContext25();
|
|
6226
|
+
useEffect33(() => {
|
|
6227
|
+
return mergeRegister7(
|
|
6228
|
+
editor.registerCommand(
|
|
6229
|
+
SELECTION_CHANGE_COMMAND2,
|
|
6230
|
+
(_payload, activeEditor) => {
|
|
6231
|
+
if (editor === activeEditor) {
|
|
6232
|
+
activeEditor.dispatchCommand(
|
|
6233
|
+
VARIABLE_TOOLBAR_SELECTION_CHANGE_COMMAND,
|
|
6234
|
+
void 0
|
|
6235
|
+
);
|
|
6236
|
+
}
|
|
6237
|
+
return false;
|
|
6238
|
+
},
|
|
6239
|
+
COMMAND_PRIORITY_EDITOR4
|
|
6240
|
+
),
|
|
6241
|
+
editor.registerUpdateListener(({ tags }) => {
|
|
6242
|
+
if (!tags.has("history-merge")) {
|
|
6243
|
+
editor.dispatchCommand(
|
|
6244
|
+
VARIABLE_TOOLBAR_SELECTION_CHANGE_COMMAND,
|
|
6245
|
+
void 0
|
|
6246
|
+
);
|
|
6247
|
+
}
|
|
6248
|
+
})
|
|
6249
|
+
);
|
|
6250
|
+
}, [editor]);
|
|
6251
|
+
return /* @__PURE__ */ jsx55(Fragment22, {});
|
|
6252
|
+
}
|
|
6458
6253
|
|
|
6459
6254
|
// src/plugins/MatchingQuestionPlugin/QuestionItemComponent.tsx
|
|
6460
|
-
import { useLexicalComposerContext as
|
|
6255
|
+
import { useLexicalComposerContext as useLexicalComposerContext26 } from "@lexical/react/LexicalComposerContext";
|
|
6461
6256
|
import { LexicalErrorBoundary as LexicalErrorBoundary3 } from "@lexical/react/LexicalErrorBoundary";
|
|
6462
6257
|
import { HistoryPlugin as HistoryPlugin3 } from "@lexical/react/LexicalHistoryPlugin";
|
|
6463
6258
|
import { LexicalNestedComposer as LexicalNestedComposer3 } from "@lexical/react/LexicalNestedComposer";
|
|
6464
6259
|
import { RichTextPlugin as RichTextPlugin3 } from "@lexical/react/LexicalRichTextPlugin";
|
|
6465
|
-
import
|
|
6260
|
+
import clsx2 from "clsx";
|
|
6466
6261
|
import {
|
|
6467
|
-
$createParagraphNode as $
|
|
6468
|
-
$getNodeByKey as $
|
|
6469
|
-
$getRoot as $
|
|
6262
|
+
$createParagraphNode as $createParagraphNode7,
|
|
6263
|
+
$getNodeByKey as $getNodeByKey21,
|
|
6264
|
+
$getRoot as $getRoot6
|
|
6470
6265
|
} from "lexical";
|
|
6471
|
-
import { CircleMinus
|
|
6472
|
-
import { useCallback as
|
|
6473
|
-
import { jsx as
|
|
6266
|
+
import { CircleMinus, CirclePlus } from "lucide-react";
|
|
6267
|
+
import { useCallback as useCallback5 } from "react";
|
|
6268
|
+
import { jsx as jsx56, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
6474
6269
|
function QuestionItemComponent(props) {
|
|
6475
6270
|
const {
|
|
6476
6271
|
nodeKey,
|
|
@@ -6481,11 +6276,11 @@ function QuestionItemComponent(props) {
|
|
|
6481
6276
|
itemOptionContent
|
|
6482
6277
|
} = props;
|
|
6483
6278
|
const { historyState } = useSharedHistoryContext();
|
|
6484
|
-
const [editor] =
|
|
6485
|
-
const addItem =
|
|
6279
|
+
const [editor] = useLexicalComposerContext26();
|
|
6280
|
+
const addItem = useCallback5(() => {
|
|
6486
6281
|
editor.update(
|
|
6487
6282
|
() => {
|
|
6488
|
-
const foundNode = $
|
|
6283
|
+
const foundNode = $getNodeByKey21(nodeKey);
|
|
6489
6284
|
if ($isMatchingQuestionNode(foundNode)) {
|
|
6490
6285
|
foundNode.addItem(itemIndex, correct);
|
|
6491
6286
|
}
|
|
@@ -6493,15 +6288,15 @@ function QuestionItemComponent(props) {
|
|
|
6493
6288
|
{
|
|
6494
6289
|
onUpdate: () => {
|
|
6495
6290
|
editor.getEditorState().read(() => {
|
|
6496
|
-
const foundNode = $
|
|
6291
|
+
const foundNode = $getNodeByKey21(nodeKey);
|
|
6497
6292
|
if ($isMatchingQuestionNode(foundNode)) {
|
|
6498
6293
|
const newQuestionItem = foundNode.__items[itemIndex + 1];
|
|
6499
6294
|
if (newQuestionItem.itemPremiseContent) {
|
|
6500
6295
|
newQuestionItem.itemPremiseContent.update(() => {
|
|
6501
|
-
const root = $
|
|
6296
|
+
const root = $getRoot6();
|
|
6502
6297
|
let firstChild = root.getFirstChild();
|
|
6503
6298
|
if (!firstChild) {
|
|
6504
|
-
firstChild = $
|
|
6299
|
+
firstChild = $createParagraphNode7();
|
|
6505
6300
|
root.append(firstChild);
|
|
6506
6301
|
}
|
|
6507
6302
|
firstChild.selectStart();
|
|
@@ -6509,10 +6304,10 @@ function QuestionItemComponent(props) {
|
|
|
6509
6304
|
}
|
|
6510
6305
|
if (newQuestionItem.itemOptionContent) {
|
|
6511
6306
|
newQuestionItem.itemOptionContent.update(() => {
|
|
6512
|
-
const root = $
|
|
6307
|
+
const root = $getRoot6();
|
|
6513
6308
|
let firstChild = root.getFirstChild();
|
|
6514
6309
|
if (!firstChild) {
|
|
6515
|
-
firstChild = $
|
|
6310
|
+
firstChild = $createParagraphNode7();
|
|
6516
6311
|
root.append(firstChild);
|
|
6517
6312
|
}
|
|
6518
6313
|
if (!newQuestionItem.itemPremiseContent) {
|
|
@@ -6526,93 +6321,108 @@ function QuestionItemComponent(props) {
|
|
|
6526
6321
|
}
|
|
6527
6322
|
);
|
|
6528
6323
|
}, [editor, nodeKey, itemIndex, correct]);
|
|
6529
|
-
const removeItem =
|
|
6324
|
+
const removeItem = useCallback5(() => {
|
|
6530
6325
|
editor.update(() => {
|
|
6531
|
-
const foundNode = $
|
|
6326
|
+
const foundNode = $getNodeByKey21(nodeKey);
|
|
6532
6327
|
if ($isMatchingQuestionNode(foundNode)) {
|
|
6533
6328
|
foundNode.removeItem(itemIndex);
|
|
6534
6329
|
}
|
|
6535
6330
|
});
|
|
6536
6331
|
}, [editor, nodeKey, itemIndex]);
|
|
6537
|
-
return /* @__PURE__ */
|
|
6332
|
+
return /* @__PURE__ */ jsxs19(
|
|
6538
6333
|
"div",
|
|
6539
6334
|
{
|
|
6540
6335
|
id,
|
|
6541
6336
|
className: "matching-question-prompt-question-item-wrapper",
|
|
6542
6337
|
children: [
|
|
6543
|
-
itemPremiseContent ? /* @__PURE__ */
|
|
6338
|
+
itemPremiseContent ? /* @__PURE__ */ jsxs19(
|
|
6544
6339
|
"div",
|
|
6545
6340
|
{
|
|
6546
6341
|
className: "matching-question-prompt-question-item",
|
|
6547
6342
|
"data-selectable": "true",
|
|
6548
6343
|
children: [
|
|
6549
|
-
/* @__PURE__ */
|
|
6550
|
-
/* @__PURE__ */
|
|
6551
|
-
/* @__PURE__ */
|
|
6552
|
-
/* @__PURE__ */
|
|
6344
|
+
/* @__PURE__ */ jsx56("div", { className: "title", "data-selectable": "true", children: /* @__PURE__ */ jsx56("div", { "data-selectable": "true", children: "Item Premise" }) }),
|
|
6345
|
+
/* @__PURE__ */ jsx56("div", { style: { height: "100%" }, children: /* @__PURE__ */ jsx56(LexicalNestedComposer3, { initialEditor: itemPremiseContent, children: /* @__PURE__ */ jsxs19(NestedEditor, { nodeKey, children: [
|
|
6346
|
+
/* @__PURE__ */ jsx56(SettingsPanelNestedAgentPlugin, {}),
|
|
6347
|
+
/* @__PURE__ */ jsx56(
|
|
6553
6348
|
RichTextPlugin3,
|
|
6554
6349
|
{
|
|
6555
|
-
contentEditable: /* @__PURE__ */
|
|
6350
|
+
contentEditable: /* @__PURE__ */ jsx56(NestedContentEditable, {}),
|
|
6556
6351
|
ErrorBoundary: LexicalErrorBoundary3,
|
|
6557
6352
|
placeholder: null
|
|
6558
6353
|
},
|
|
6559
6354
|
nodeKey
|
|
6560
6355
|
),
|
|
6561
|
-
/* @__PURE__ */
|
|
6562
|
-
/* @__PURE__ */
|
|
6563
|
-
|
|
6564
|
-
|
|
6356
|
+
/* @__PURE__ */ jsx56(HistoryPlugin3, { externalHistoryState: historyState }),
|
|
6357
|
+
/* @__PURE__ */ jsx56(
|
|
6358
|
+
TextToolbarAgentPlugin,
|
|
6359
|
+
{
|
|
6360
|
+
decoratorNode: MatchingQuestionNode
|
|
6361
|
+
}
|
|
6362
|
+
),
|
|
6363
|
+
/* @__PURE__ */ jsx56(
|
|
6364
|
+
TypeaheadVariableAgentPlugin,
|
|
6365
|
+
{
|
|
6366
|
+
decoratorNode: MatchingQuestionNode
|
|
6367
|
+
}
|
|
6368
|
+
),
|
|
6369
|
+
/* @__PURE__ */ jsx56(VariableComponentPlugin, {})
|
|
6565
6370
|
] }) }) })
|
|
6566
6371
|
]
|
|
6567
6372
|
}
|
|
6568
|
-
) : /* @__PURE__ */
|
|
6569
|
-
/* @__PURE__ */
|
|
6373
|
+
) : /* @__PURE__ */ jsx56("div", {}),
|
|
6374
|
+
/* @__PURE__ */ jsxs19(
|
|
6570
6375
|
"div",
|
|
6571
6376
|
{
|
|
6572
|
-
className:
|
|
6377
|
+
className: clsx2("matching-question-prompt-question-item", {
|
|
6573
6378
|
correct,
|
|
6574
6379
|
incorrect: !correct
|
|
6575
6380
|
}),
|
|
6576
6381
|
"data-selectable": "true",
|
|
6577
6382
|
children: [
|
|
6578
|
-
/* @__PURE__ */
|
|
6579
|
-
/* @__PURE__ */
|
|
6580
|
-
/* @__PURE__ */
|
|
6581
|
-
/* @__PURE__ */
|
|
6383
|
+
/* @__PURE__ */ jsx56("div", { className: "title", "data-selectable": "true", children: /* @__PURE__ */ jsx56("div", { "data-selectable": "true", children: correct ? "Correct Choice" : "Incorrect Choice" }) }),
|
|
6384
|
+
/* @__PURE__ */ jsx56("div", { style: { height: "100%" }, children: /* @__PURE__ */ jsx56(LexicalNestedComposer3, { initialEditor: itemOptionContent, children: /* @__PURE__ */ jsxs19(NestedEditor, { nodeKey, children: [
|
|
6385
|
+
/* @__PURE__ */ jsx56(SettingsPanelNestedAgentPlugin, {}),
|
|
6386
|
+
/* @__PURE__ */ jsx56(
|
|
6582
6387
|
RichTextPlugin3,
|
|
6583
6388
|
{
|
|
6584
|
-
contentEditable: /* @__PURE__ */
|
|
6389
|
+
contentEditable: /* @__PURE__ */ jsx56(NestedContentEditable, {}),
|
|
6585
6390
|
ErrorBoundary: LexicalErrorBoundary3,
|
|
6586
6391
|
placeholder: null
|
|
6587
6392
|
},
|
|
6588
6393
|
nodeKey
|
|
6589
6394
|
),
|
|
6590
|
-
/* @__PURE__ */
|
|
6591
|
-
/* @__PURE__ */
|
|
6395
|
+
/* @__PURE__ */ jsx56(HistoryPlugin3, { externalHistoryState: historyState }),
|
|
6396
|
+
/* @__PURE__ */ jsx56(
|
|
6592
6397
|
TextToolbarAgentPlugin,
|
|
6593
6398
|
{
|
|
6594
6399
|
decoratorNode: MatchingQuestionNode
|
|
6595
6400
|
}
|
|
6596
6401
|
),
|
|
6597
|
-
/* @__PURE__ */
|
|
6598
|
-
|
|
6599
|
-
|
|
6402
|
+
/* @__PURE__ */ jsx56(
|
|
6403
|
+
TypeaheadVariableAgentPlugin,
|
|
6404
|
+
{
|
|
6405
|
+
decoratorNode: MatchingQuestionNode
|
|
6406
|
+
}
|
|
6407
|
+
),
|
|
6408
|
+
/* @__PURE__ */ jsx56(VariableComponentPlugin, {}),
|
|
6409
|
+
/* @__PURE__ */ jsx56(VariableToolbarAgentPlugin, {})
|
|
6600
6410
|
] }) }) }),
|
|
6601
|
-
/* @__PURE__ */
|
|
6602
|
-
itemIndex > 0 ? /* @__PURE__ */
|
|
6411
|
+
/* @__PURE__ */ jsxs19("div", { className: "controls", children: [
|
|
6412
|
+
itemIndex > 0 ? /* @__PURE__ */ jsx56("div", { children: /* @__PURE__ */ jsx56(
|
|
6603
6413
|
Button,
|
|
6604
6414
|
{
|
|
6605
|
-
StartIcon:
|
|
6415
|
+
StartIcon: CircleMinus,
|
|
6606
6416
|
size: "medium",
|
|
6607
6417
|
variant: "text",
|
|
6608
6418
|
className: "cancel",
|
|
6609
6419
|
onClick: removeItem
|
|
6610
6420
|
}
|
|
6611
|
-
) }) : /* @__PURE__ */
|
|
6612
|
-
/* @__PURE__ */
|
|
6421
|
+
) }) : /* @__PURE__ */ jsx56("div", {}),
|
|
6422
|
+
/* @__PURE__ */ jsx56("div", { children: /* @__PURE__ */ jsx56(
|
|
6613
6423
|
Button,
|
|
6614
6424
|
{
|
|
6615
|
-
StartIcon:
|
|
6425
|
+
StartIcon: CirclePlus,
|
|
6616
6426
|
size: "medium",
|
|
6617
6427
|
variant: "text",
|
|
6618
6428
|
className: "cancel",
|
|
@@ -6629,12 +6439,12 @@ function QuestionItemComponent(props) {
|
|
|
6629
6439
|
}
|
|
6630
6440
|
|
|
6631
6441
|
// src/plugins/MatchingQuestionPlugin/MatchingQuestionComponent.tsx
|
|
6632
|
-
import { jsx as
|
|
6442
|
+
import { jsx as jsx57, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
6633
6443
|
function MatchingQuestionComponent(props) {
|
|
6634
6444
|
const { nodeKey, items, id } = props;
|
|
6635
|
-
const [editor] =
|
|
6445
|
+
const [editor] = useLexicalComposerContext27();
|
|
6636
6446
|
const rootElementRef = useRef21(null);
|
|
6637
|
-
|
|
6447
|
+
useEffect34(() => {
|
|
6638
6448
|
return editor.registerCommand(
|
|
6639
6449
|
CLICK_COMMAND4,
|
|
6640
6450
|
(event, _activeEditor) => {
|
|
@@ -6642,7 +6452,7 @@ function MatchingQuestionComponent(props) {
|
|
|
6642
6452
|
"data-selectable"
|
|
6643
6453
|
)) {
|
|
6644
6454
|
editor.update(() => {
|
|
6645
|
-
const foundNode = $
|
|
6455
|
+
const foundNode = $getNodeByKey22(nodeKey);
|
|
6646
6456
|
if ($isMatchingQuestionNode(foundNode)) {
|
|
6647
6457
|
const selection = $createNodeSelection4();
|
|
6648
6458
|
selection.add(nodeKey);
|
|
@@ -6658,14 +6468,14 @@ function MatchingQuestionComponent(props) {
|
|
|
6658
6468
|
const doNeedDistractor = items.reduce((a, i) => {
|
|
6659
6469
|
return i.correct ? a : ++a;
|
|
6660
6470
|
}, 0) <= 0;
|
|
6661
|
-
return /* @__PURE__ */
|
|
6471
|
+
return /* @__PURE__ */ jsxs20(
|
|
6662
6472
|
"div",
|
|
6663
6473
|
{
|
|
6664
6474
|
ref: rootElementRef,
|
|
6665
6475
|
id,
|
|
6666
6476
|
className: "matching-question-prompt",
|
|
6667
6477
|
children: [
|
|
6668
|
-
/* @__PURE__ */
|
|
6478
|
+
/* @__PURE__ */ jsx57(
|
|
6669
6479
|
"div",
|
|
6670
6480
|
{
|
|
6671
6481
|
className: "matching-question-prompt-title",
|
|
@@ -6673,14 +6483,14 @@ function MatchingQuestionComponent(props) {
|
|
|
6673
6483
|
children: "Matching"
|
|
6674
6484
|
}
|
|
6675
6485
|
),
|
|
6676
|
-
/* @__PURE__ */
|
|
6486
|
+
/* @__PURE__ */ jsxs20(
|
|
6677
6487
|
"div",
|
|
6678
6488
|
{
|
|
6679
6489
|
className: "matching-question-prompt-items",
|
|
6680
6490
|
"data-selectable": "true",
|
|
6681
6491
|
children: [
|
|
6682
6492
|
items.map((questionItem, itemIndex) => {
|
|
6683
|
-
return /* @__PURE__ */
|
|
6493
|
+
return /* @__PURE__ */ jsx57(
|
|
6684
6494
|
QuestionItemComponent,
|
|
6685
6495
|
{
|
|
6686
6496
|
nodeKey,
|
|
@@ -6693,7 +6503,7 @@ function MatchingQuestionComponent(props) {
|
|
|
6693
6503
|
questionItem.id
|
|
6694
6504
|
);
|
|
6695
6505
|
}),
|
|
6696
|
-
items.length > 0 && doNeedDistractor && /* @__PURE__ */
|
|
6506
|
+
items.length > 0 && doNeedDistractor && /* @__PURE__ */ jsx57(
|
|
6697
6507
|
DistractorButton2,
|
|
6698
6508
|
{
|
|
6699
6509
|
nodeKey,
|
|
@@ -6709,9 +6519,9 @@ function MatchingQuestionComponent(props) {
|
|
|
6709
6519
|
}
|
|
6710
6520
|
|
|
6711
6521
|
// src/plugins/MatchingQuestionPlugin/MatchingQuestionNode.tsx
|
|
6712
|
-
import { jsx as
|
|
6522
|
+
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
6713
6523
|
var TYPE_NAME5 = "matching-question";
|
|
6714
|
-
function
|
|
6524
|
+
function initNewContentEditor() {
|
|
6715
6525
|
return createEditor3();
|
|
6716
6526
|
}
|
|
6717
6527
|
var MatchingQuestionNode = class _MatchingQuestionNode extends DecoratorNode6 {
|
|
@@ -6725,8 +6535,8 @@ var MatchingQuestionNode = class _MatchingQuestionNode extends DecoratorNode6 {
|
|
|
6725
6535
|
this.__items.push({
|
|
6726
6536
|
id: item.id,
|
|
6727
6537
|
correct: item.correct,
|
|
6728
|
-
itemPremiseContent: item.correct ? item.itemPremiseContent ||
|
|
6729
|
-
itemOptionContent: item.itemOptionContent ||
|
|
6538
|
+
itemPremiseContent: item.correct ? item.itemPremiseContent || initNewContentEditor() : void 0,
|
|
6539
|
+
itemOptionContent: item.itemOptionContent || initNewContentEditor()
|
|
6730
6540
|
});
|
|
6731
6541
|
}
|
|
6732
6542
|
} else {
|
|
@@ -6734,8 +6544,8 @@ var MatchingQuestionNode = class _MatchingQuestionNode extends DecoratorNode6 {
|
|
|
6734
6544
|
this.__items.push({
|
|
6735
6545
|
id: nanoid3(),
|
|
6736
6546
|
correct: true,
|
|
6737
|
-
itemPremiseContent:
|
|
6738
|
-
itemOptionContent:
|
|
6547
|
+
itemPremiseContent: initNewContentEditor(),
|
|
6548
|
+
itemOptionContent: initNewContentEditor()
|
|
6739
6549
|
});
|
|
6740
6550
|
}
|
|
6741
6551
|
}
|
|
@@ -6848,8 +6658,8 @@ var MatchingQuestionNode = class _MatchingQuestionNode extends DecoratorNode6 {
|
|
|
6848
6658
|
newItems.splice(newItemIndex, 0, {
|
|
6849
6659
|
id: nanoid3(),
|
|
6850
6660
|
correct,
|
|
6851
|
-
itemPremiseContent: correct ?
|
|
6852
|
-
itemOptionContent:
|
|
6661
|
+
itemPremiseContent: correct ? initNewContentEditor() : void 0,
|
|
6662
|
+
itemOptionContent: initNewContentEditor()
|
|
6853
6663
|
});
|
|
6854
6664
|
writable.__items = newItems;
|
|
6855
6665
|
}
|
|
@@ -6862,7 +6672,7 @@ var MatchingQuestionNode = class _MatchingQuestionNode extends DecoratorNode6 {
|
|
|
6862
6672
|
}
|
|
6863
6673
|
}
|
|
6864
6674
|
decorate() {
|
|
6865
|
-
return /* @__PURE__ */
|
|
6675
|
+
return /* @__PURE__ */ jsx58(
|
|
6866
6676
|
MatchingQuestionComponent,
|
|
6867
6677
|
{
|
|
6868
6678
|
nodeKey: this.__key,
|
|
@@ -6884,76 +6694,76 @@ function $isMatchingQuestionNode(node) {
|
|
|
6884
6694
|
// src/plugins/MultipleOptionQuestionPlugin/MultipleOptionQuestionNode.tsx
|
|
6885
6695
|
import {
|
|
6886
6696
|
$applyNodeReplacement as $applyNodeReplacement7,
|
|
6887
|
-
$createParagraphNode as $
|
|
6888
|
-
$createTextNode as $
|
|
6889
|
-
$getRoot as $
|
|
6697
|
+
$createParagraphNode as $createParagraphNode8,
|
|
6698
|
+
$createTextNode as $createTextNode4,
|
|
6699
|
+
$getRoot as $getRoot7,
|
|
6890
6700
|
DecoratorNode as DecoratorNode7,
|
|
6891
6701
|
createEditor as createEditor4
|
|
6892
6702
|
} from "lexical";
|
|
6893
6703
|
import { nanoid as nanoid4 } from "nanoid";
|
|
6894
6704
|
|
|
6895
6705
|
// src/plugins/MultipleOptionQuestionPlugin/MultipleOptionQuestionComponent.tsx
|
|
6896
|
-
import { useLexicalComposerContext as
|
|
6706
|
+
import { useLexicalComposerContext as useLexicalComposerContext29 } from "@lexical/react/LexicalComposerContext";
|
|
6897
6707
|
import {
|
|
6898
6708
|
$createNodeSelection as $createNodeSelection5,
|
|
6899
|
-
$getNodeByKey as $
|
|
6709
|
+
$getNodeByKey as $getNodeByKey24,
|
|
6900
6710
|
$setSelection as $setSelection5,
|
|
6901
6711
|
CLICK_COMMAND as CLICK_COMMAND5,
|
|
6902
6712
|
COMMAND_PRIORITY_LOW as COMMAND_PRIORITY_LOW5
|
|
6903
6713
|
} from "lexical";
|
|
6904
|
-
import { useEffect as
|
|
6714
|
+
import { useEffect as useEffect35, useRef as useRef22 } from "react";
|
|
6905
6715
|
|
|
6906
6716
|
// src/plugins/MultipleOptionQuestionPlugin/MultipleOptionQuestionItemComponent.tsx
|
|
6907
|
-
import { useLexicalComposerContext as
|
|
6717
|
+
import { useLexicalComposerContext as useLexicalComposerContext28 } from "@lexical/react/LexicalComposerContext";
|
|
6908
6718
|
import { LexicalErrorBoundary as LexicalErrorBoundary4 } from "@lexical/react/LexicalErrorBoundary";
|
|
6909
6719
|
import { HistoryPlugin as HistoryPlugin4 } from "@lexical/react/LexicalHistoryPlugin";
|
|
6910
6720
|
import { LexicalNestedComposer as LexicalNestedComposer4 } from "@lexical/react/LexicalNestedComposer";
|
|
6911
6721
|
import { RichTextPlugin as RichTextPlugin4 } from "@lexical/react/LexicalRichTextPlugin";
|
|
6912
|
-
import
|
|
6913
|
-
import { $getNodeByKey as $
|
|
6914
|
-
import { CircleMinus as
|
|
6915
|
-
import { useCallback as
|
|
6916
|
-
import { jsx as
|
|
6722
|
+
import clsx3 from "clsx";
|
|
6723
|
+
import { $getNodeByKey as $getNodeByKey23 } from "lexical";
|
|
6724
|
+
import { CircleMinus as CircleMinus2, CirclePlus as CirclePlus2, Settings } from "lucide-react";
|
|
6725
|
+
import { useCallback as useCallback6 } from "react";
|
|
6726
|
+
import { jsx as jsx59, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
6917
6727
|
function MultipleOptionQuestionItemComponent(props) {
|
|
6918
6728
|
const { nodeKey, id, optionIndex, correct, content } = props;
|
|
6919
6729
|
const { historyState } = useSharedHistoryContext();
|
|
6920
|
-
const [editor] =
|
|
6921
|
-
const toggleChoice =
|
|
6730
|
+
const [editor] = useLexicalComposerContext28();
|
|
6731
|
+
const toggleChoice = useCallback6(() => {
|
|
6922
6732
|
editor.update(() => {
|
|
6923
|
-
const foundNode = $
|
|
6733
|
+
const foundNode = $getNodeByKey23(nodeKey);
|
|
6924
6734
|
if ($isMultipleOptionQuestionNode(foundNode)) {
|
|
6925
6735
|
foundNode.setCorrectChoice(optionIndex, !correct);
|
|
6926
6736
|
}
|
|
6927
6737
|
});
|
|
6928
6738
|
}, [editor, id, nodeKey, optionIndex, correct]);
|
|
6929
|
-
const addOptionItem =
|
|
6739
|
+
const addOptionItem = useCallback6(() => {
|
|
6930
6740
|
editor.update(() => {
|
|
6931
|
-
const foundNode = $
|
|
6741
|
+
const foundNode = $getNodeByKey23(nodeKey);
|
|
6932
6742
|
if ($isMultipleOptionQuestionNode(foundNode)) {
|
|
6933
6743
|
foundNode.addOptionItem(optionIndex, !!correct);
|
|
6934
6744
|
}
|
|
6935
6745
|
});
|
|
6936
6746
|
}, [editor, id, nodeKey, optionIndex, correct]);
|
|
6937
|
-
const removeOptionItem =
|
|
6747
|
+
const removeOptionItem = useCallback6(() => {
|
|
6938
6748
|
editor.update(() => {
|
|
6939
|
-
const foundNode = $
|
|
6749
|
+
const foundNode = $getNodeByKey23(nodeKey);
|
|
6940
6750
|
if ($isMultipleOptionQuestionNode(foundNode)) {
|
|
6941
6751
|
foundNode.removeOptionItem(optionIndex);
|
|
6942
6752
|
}
|
|
6943
6753
|
});
|
|
6944
6754
|
}, [editor, id, nodeKey, optionIndex]);
|
|
6945
|
-
return /* @__PURE__ */
|
|
6755
|
+
return /* @__PURE__ */ jsxs21(
|
|
6946
6756
|
"div",
|
|
6947
6757
|
{
|
|
6948
|
-
className:
|
|
6758
|
+
className: clsx3("multiple-option-question-prompt-option-item", {
|
|
6949
6759
|
correct: !!correct,
|
|
6950
6760
|
incorrect: !correct
|
|
6951
6761
|
}),
|
|
6952
6762
|
"data-selectable": "true",
|
|
6953
6763
|
children: [
|
|
6954
|
-
/* @__PURE__ */
|
|
6955
|
-
/* @__PURE__ */
|
|
6956
|
-
/* @__PURE__ */
|
|
6764
|
+
/* @__PURE__ */ jsxs21("div", { className: "title", "data-selectable": "true", children: [
|
|
6765
|
+
/* @__PURE__ */ jsx59("div", { "data-selectable": "true", children: correct ? "Correct Choice" : "Incorrect Choice" }),
|
|
6766
|
+
/* @__PURE__ */ jsx59("div", { children: /* @__PURE__ */ jsx59(
|
|
6957
6767
|
Button,
|
|
6958
6768
|
{
|
|
6959
6769
|
StartIcon: Settings,
|
|
@@ -6964,43 +6774,48 @@ function MultipleOptionQuestionItemComponent(props) {
|
|
|
6964
6774
|
}
|
|
6965
6775
|
) })
|
|
6966
6776
|
] }),
|
|
6967
|
-
/* @__PURE__ */
|
|
6968
|
-
/* @__PURE__ */
|
|
6969
|
-
/* @__PURE__ */
|
|
6777
|
+
/* @__PURE__ */ jsx59("div", { children: /* @__PURE__ */ jsx59(LexicalNestedComposer4, { initialEditor: content, children: /* @__PURE__ */ jsxs21(NestedEditor, { nodeKey, children: [
|
|
6778
|
+
/* @__PURE__ */ jsx59(SettingsPanelNestedAgentPlugin, {}),
|
|
6779
|
+
/* @__PURE__ */ jsx59(
|
|
6970
6780
|
RichTextPlugin4,
|
|
6971
6781
|
{
|
|
6972
|
-
contentEditable: /* @__PURE__ */
|
|
6782
|
+
contentEditable: /* @__PURE__ */ jsx59(NestedContentEditable, {}),
|
|
6973
6783
|
ErrorBoundary: LexicalErrorBoundary4,
|
|
6974
6784
|
placeholder: null
|
|
6975
6785
|
},
|
|
6976
6786
|
nodeKey
|
|
6977
6787
|
),
|
|
6978
|
-
/* @__PURE__ */
|
|
6979
|
-
/* @__PURE__ */
|
|
6788
|
+
/* @__PURE__ */ jsx59(HistoryPlugin4, { externalHistoryState: historyState }),
|
|
6789
|
+
/* @__PURE__ */ jsx59(
|
|
6980
6790
|
TextToolbarAgentPlugin,
|
|
6981
6791
|
{
|
|
6982
6792
|
decoratorNode: MultipleOptionQuestionNode
|
|
6983
6793
|
}
|
|
6984
6794
|
),
|
|
6985
|
-
/* @__PURE__ */
|
|
6986
|
-
|
|
6987
|
-
|
|
6795
|
+
/* @__PURE__ */ jsx59(
|
|
6796
|
+
TypeaheadVariableAgentPlugin,
|
|
6797
|
+
{
|
|
6798
|
+
decoratorNode: MultipleOptionQuestionNode
|
|
6799
|
+
}
|
|
6800
|
+
),
|
|
6801
|
+
/* @__PURE__ */ jsx59(VariableComponentPlugin, {}),
|
|
6802
|
+
/* @__PURE__ */ jsx59(VariableToolbarAgentPlugin, {})
|
|
6988
6803
|
] }) }) }),
|
|
6989
|
-
/* @__PURE__ */
|
|
6990
|
-
/* @__PURE__ */
|
|
6804
|
+
/* @__PURE__ */ jsxs21("div", { className: "controls", children: [
|
|
6805
|
+
/* @__PURE__ */ jsx59("div", { children: /* @__PURE__ */ jsx59(
|
|
6991
6806
|
Button,
|
|
6992
6807
|
{
|
|
6993
|
-
StartIcon:
|
|
6808
|
+
StartIcon: CircleMinus2,
|
|
6994
6809
|
size: "medium",
|
|
6995
6810
|
variant: "text",
|
|
6996
6811
|
className: "cancel",
|
|
6997
6812
|
onClick: removeOptionItem
|
|
6998
6813
|
}
|
|
6999
6814
|
) }),
|
|
7000
|
-
/* @__PURE__ */
|
|
6815
|
+
/* @__PURE__ */ jsx59("div", { children: /* @__PURE__ */ jsx59(
|
|
7001
6816
|
Button,
|
|
7002
6817
|
{
|
|
7003
|
-
StartIcon:
|
|
6818
|
+
StartIcon: CirclePlus2,
|
|
7004
6819
|
size: "medium",
|
|
7005
6820
|
variant: "text",
|
|
7006
6821
|
className: "cancel",
|
|
@@ -7014,12 +6829,12 @@ function MultipleOptionQuestionItemComponent(props) {
|
|
|
7014
6829
|
}
|
|
7015
6830
|
|
|
7016
6831
|
// src/plugins/MultipleOptionQuestionPlugin/MultipleOptionQuestionComponent.tsx
|
|
7017
|
-
import { jsx as
|
|
6832
|
+
import { jsx as jsx60, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
7018
6833
|
function MultipleOptionQuestionComponent(props) {
|
|
7019
6834
|
const { nodeKey, options, questionType } = props;
|
|
7020
|
-
const [editor] =
|
|
6835
|
+
const [editor] = useLexicalComposerContext29();
|
|
7021
6836
|
const rootElementRef = useRef22(null);
|
|
7022
|
-
|
|
6837
|
+
useEffect35(() => {
|
|
7023
6838
|
return editor.registerCommand(
|
|
7024
6839
|
CLICK_COMMAND5,
|
|
7025
6840
|
(event, _activeEditor) => {
|
|
@@ -7027,7 +6842,7 @@ function MultipleOptionQuestionComponent(props) {
|
|
|
7027
6842
|
"data-selectable"
|
|
7028
6843
|
)) {
|
|
7029
6844
|
editor.update(() => {
|
|
7030
|
-
const foundNode = $
|
|
6845
|
+
const foundNode = $getNodeByKey24(nodeKey);
|
|
7031
6846
|
if ($isMultipleOptionQuestionNode(foundNode)) {
|
|
7032
6847
|
const selection = $createNodeSelection5();
|
|
7033
6848
|
selection.add(nodeKey);
|
|
@@ -7040,13 +6855,13 @@ function MultipleOptionQuestionComponent(props) {
|
|
|
7040
6855
|
COMMAND_PRIORITY_LOW5
|
|
7041
6856
|
);
|
|
7042
6857
|
}, [editor]);
|
|
7043
|
-
return /* @__PURE__ */
|
|
6858
|
+
return /* @__PURE__ */ jsxs22(
|
|
7044
6859
|
"div",
|
|
7045
6860
|
{
|
|
7046
6861
|
ref: rootElementRef,
|
|
7047
6862
|
className: "multiple-option-question-prompt",
|
|
7048
6863
|
children: [
|
|
7049
|
-
/* @__PURE__ */
|
|
6864
|
+
/* @__PURE__ */ jsx60(
|
|
7050
6865
|
"div",
|
|
7051
6866
|
{
|
|
7052
6867
|
className: "multiple-option-question-prompt-title",
|
|
@@ -7054,13 +6869,13 @@ function MultipleOptionQuestionComponent(props) {
|
|
|
7054
6869
|
children: questionType === "multiple-choice" ? "Multiple Choice" : "Multiple Answers"
|
|
7055
6870
|
}
|
|
7056
6871
|
),
|
|
7057
|
-
/* @__PURE__ */
|
|
6872
|
+
/* @__PURE__ */ jsx60(
|
|
7058
6873
|
"div",
|
|
7059
6874
|
{
|
|
7060
6875
|
className: "multiple-option-question-prompt-options",
|
|
7061
6876
|
"data-selectable": "true",
|
|
7062
6877
|
children: options.map((optionItem, optionItemIndex) => {
|
|
7063
|
-
return /* @__PURE__ */
|
|
6878
|
+
return /* @__PURE__ */ jsx60(
|
|
7064
6879
|
MultipleOptionQuestionItemComponent,
|
|
7065
6880
|
{
|
|
7066
6881
|
nodeKey,
|
|
@@ -7080,9 +6895,9 @@ function MultipleOptionQuestionComponent(props) {
|
|
|
7080
6895
|
}
|
|
7081
6896
|
|
|
7082
6897
|
// src/plugins/MultipleOptionQuestionPlugin/MultipleOptionQuestionNode.tsx
|
|
7083
|
-
import { jsx as
|
|
6898
|
+
import { jsx as jsx61 } from "react/jsx-runtime";
|
|
7084
6899
|
var TYPE_NAME6 = "multiple-option-question";
|
|
7085
|
-
function
|
|
6900
|
+
function initNewContentEditor2() {
|
|
7086
6901
|
return createEditor4();
|
|
7087
6902
|
}
|
|
7088
6903
|
var MultipleOptionQuestionNode = class _MultipleOptionQuestionNode extends DecoratorNode7 {
|
|
@@ -7112,7 +6927,7 @@ var MultipleOptionQuestionNode = class _MultipleOptionQuestionNode extends Decor
|
|
|
7112
6927
|
id: nanoid4(),
|
|
7113
6928
|
correct: i > 1,
|
|
7114
6929
|
// two first are false
|
|
7115
|
-
content:
|
|
6930
|
+
content: initNewContentEditor2()
|
|
7116
6931
|
});
|
|
7117
6932
|
}
|
|
7118
6933
|
} else {
|
|
@@ -7121,7 +6936,7 @@ var MultipleOptionQuestionNode = class _MultipleOptionQuestionNode extends Decor
|
|
|
7121
6936
|
id: nanoid4(),
|
|
7122
6937
|
correct: i < 1,
|
|
7123
6938
|
// one first are true
|
|
7124
|
-
content:
|
|
6939
|
+
content: initNewContentEditor2()
|
|
7125
6940
|
});
|
|
7126
6941
|
}
|
|
7127
6942
|
}
|
|
@@ -7271,7 +7086,7 @@ var MultipleOptionQuestionNode = class _MultipleOptionQuestionNode extends Decor
|
|
|
7271
7086
|
newOptions.splice(optionItemIndex + 1, 0, {
|
|
7272
7087
|
id: nanoid4(),
|
|
7273
7088
|
correct: correctChoice,
|
|
7274
|
-
content:
|
|
7089
|
+
content: initNewContentEditor2()
|
|
7275
7090
|
});
|
|
7276
7091
|
writable.__options = newOptions;
|
|
7277
7092
|
}
|
|
@@ -7286,11 +7101,11 @@ var MultipleOptionQuestionNode = class _MultipleOptionQuestionNode extends Decor
|
|
|
7286
7101
|
appendOptionItem(initialOptionText, correctChoice) {
|
|
7287
7102
|
const writable = this.getWritable();
|
|
7288
7103
|
const newOptions = [...writable.__options];
|
|
7289
|
-
const content =
|
|
7104
|
+
const content = initNewContentEditor2();
|
|
7290
7105
|
content.update(() => {
|
|
7291
|
-
const root = $
|
|
7292
|
-
const firstChild = $
|
|
7293
|
-
firstChild.append($
|
|
7106
|
+
const root = $getRoot7();
|
|
7107
|
+
const firstChild = $createParagraphNode8();
|
|
7108
|
+
firstChild.append($createTextNode4(initialOptionText));
|
|
7294
7109
|
root.append(firstChild);
|
|
7295
7110
|
});
|
|
7296
7111
|
newOptions.push({
|
|
@@ -7301,7 +7116,7 @@ var MultipleOptionQuestionNode = class _MultipleOptionQuestionNode extends Decor
|
|
|
7301
7116
|
writable.__options = newOptions;
|
|
7302
7117
|
}
|
|
7303
7118
|
decorate() {
|
|
7304
|
-
return /* @__PURE__ */
|
|
7119
|
+
return /* @__PURE__ */ jsx61(
|
|
7305
7120
|
MultipleOptionQuestionComponent,
|
|
7306
7121
|
{
|
|
7307
7122
|
nodeKey: this.__key,
|
|
@@ -7355,26 +7170,26 @@ import {
|
|
|
7355
7170
|
import { nanoid as nanoid5 } from "nanoid";
|
|
7356
7171
|
|
|
7357
7172
|
// src/plugins/ShortAnswerQuestionPlugin/ShortAnswerQuestionComponent.tsx
|
|
7358
|
-
import { useLexicalComposerContext as
|
|
7173
|
+
import { useLexicalComposerContext as useLexicalComposerContext30 } from "@lexical/react/LexicalComposerContext";
|
|
7359
7174
|
import { LexicalErrorBoundary as LexicalErrorBoundary5 } from "@lexical/react/LexicalErrorBoundary";
|
|
7360
7175
|
import { HistoryPlugin as HistoryPlugin5 } from "@lexical/react/LexicalHistoryPlugin";
|
|
7361
7176
|
import { LexicalNestedComposer as LexicalNestedComposer5 } from "@lexical/react/LexicalNestedComposer";
|
|
7362
7177
|
import { RichTextPlugin as RichTextPlugin5 } from "@lexical/react/LexicalRichTextPlugin";
|
|
7363
7178
|
import {
|
|
7364
7179
|
$createNodeSelection as $createNodeSelection6,
|
|
7365
|
-
$getNodeByKey as $
|
|
7180
|
+
$getNodeByKey as $getNodeByKey25,
|
|
7366
7181
|
$setSelection as $setSelection6,
|
|
7367
7182
|
CLICK_COMMAND as CLICK_COMMAND6,
|
|
7368
7183
|
COMMAND_PRIORITY_LOW as COMMAND_PRIORITY_LOW6
|
|
7369
7184
|
} from "lexical";
|
|
7370
|
-
import { useEffect as
|
|
7371
|
-
import { jsx as
|
|
7185
|
+
import { useEffect as useEffect36, useRef as useRef23 } from "react";
|
|
7186
|
+
import { jsx as jsx62, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
7372
7187
|
function ShortAnswerQuestionComponent(props) {
|
|
7373
7188
|
const { nodeKey, id, notes } = props;
|
|
7374
7189
|
const { historyState } = useSharedHistoryContext();
|
|
7375
|
-
const [editor] =
|
|
7190
|
+
const [editor] = useLexicalComposerContext30();
|
|
7376
7191
|
const rootElementRef = useRef23(null);
|
|
7377
|
-
|
|
7192
|
+
useEffect36(() => {
|
|
7378
7193
|
return editor.registerCommand(
|
|
7379
7194
|
CLICK_COMMAND6,
|
|
7380
7195
|
(event, _activeEditor) => {
|
|
@@ -7382,7 +7197,7 @@ function ShortAnswerQuestionComponent(props) {
|
|
|
7382
7197
|
"data-selectable"
|
|
7383
7198
|
)) {
|
|
7384
7199
|
editor.update(() => {
|
|
7385
|
-
const foundNode = $
|
|
7200
|
+
const foundNode = $getNodeByKey25(nodeKey);
|
|
7386
7201
|
if ($isShortAnswerQuestionNode(foundNode)) {
|
|
7387
7202
|
const selection = $createNodeSelection6();
|
|
7388
7203
|
selection.add(nodeKey);
|
|
@@ -7395,14 +7210,14 @@ function ShortAnswerQuestionComponent(props) {
|
|
|
7395
7210
|
COMMAND_PRIORITY_LOW6
|
|
7396
7211
|
);
|
|
7397
7212
|
}, [editor]);
|
|
7398
|
-
return /* @__PURE__ */
|
|
7213
|
+
return /* @__PURE__ */ jsxs23(
|
|
7399
7214
|
"div",
|
|
7400
7215
|
{
|
|
7401
7216
|
ref: rootElementRef,
|
|
7402
7217
|
id,
|
|
7403
7218
|
className: "short-answer-question-prompt",
|
|
7404
7219
|
children: [
|
|
7405
|
-
/* @__PURE__ */
|
|
7220
|
+
/* @__PURE__ */ jsx62(
|
|
7406
7221
|
"div",
|
|
7407
7222
|
{
|
|
7408
7223
|
className: "short-answer-question-prompt-title",
|
|
@@ -7410,34 +7225,39 @@ function ShortAnswerQuestionComponent(props) {
|
|
|
7410
7225
|
children: "Short Answer"
|
|
7411
7226
|
}
|
|
7412
7227
|
),
|
|
7413
|
-
/* @__PURE__ */
|
|
7228
|
+
/* @__PURE__ */ jsxs23(
|
|
7414
7229
|
"div",
|
|
7415
7230
|
{
|
|
7416
7231
|
className: "short-answer-question-prompt-content",
|
|
7417
7232
|
"data-selectable": "true",
|
|
7418
7233
|
children: [
|
|
7419
|
-
/* @__PURE__ */
|
|
7420
|
-
/* @__PURE__ */
|
|
7421
|
-
/* @__PURE__ */
|
|
7422
|
-
/* @__PURE__ */
|
|
7234
|
+
/* @__PURE__ */ jsx62("div", { className: "title", "data-selectable": "true", children: "Answer Key" }),
|
|
7235
|
+
/* @__PURE__ */ jsx62("div", { children: /* @__PURE__ */ jsx62(LexicalNestedComposer5, { initialEditor: notes, children: /* @__PURE__ */ jsxs23(NestedEditor, { nodeKey, children: [
|
|
7236
|
+
/* @__PURE__ */ jsx62(SettingsPanelNestedAgentPlugin, {}),
|
|
7237
|
+
/* @__PURE__ */ jsx62(
|
|
7423
7238
|
RichTextPlugin5,
|
|
7424
7239
|
{
|
|
7425
|
-
contentEditable: /* @__PURE__ */
|
|
7240
|
+
contentEditable: /* @__PURE__ */ jsx62(NestedContentEditable, {}),
|
|
7426
7241
|
ErrorBoundary: LexicalErrorBoundary5,
|
|
7427
7242
|
placeholder: null
|
|
7428
7243
|
},
|
|
7429
7244
|
nodeKey
|
|
7430
7245
|
),
|
|
7431
|
-
/* @__PURE__ */
|
|
7432
|
-
/* @__PURE__ */
|
|
7246
|
+
/* @__PURE__ */ jsx62(HistoryPlugin5, { externalHistoryState: historyState }),
|
|
7247
|
+
/* @__PURE__ */ jsx62(
|
|
7433
7248
|
TextToolbarAgentPlugin,
|
|
7434
7249
|
{
|
|
7435
7250
|
decoratorNode: ShortAnswerQuestionNode
|
|
7436
7251
|
}
|
|
7437
7252
|
),
|
|
7438
|
-
/* @__PURE__ */
|
|
7439
|
-
|
|
7440
|
-
|
|
7253
|
+
/* @__PURE__ */ jsx62(
|
|
7254
|
+
TypeaheadVariableAgentPlugin,
|
|
7255
|
+
{
|
|
7256
|
+
decoratorNode: ShortAnswerQuestionNode
|
|
7257
|
+
}
|
|
7258
|
+
),
|
|
7259
|
+
/* @__PURE__ */ jsx62(VariableComponentPlugin, {}),
|
|
7260
|
+
/* @__PURE__ */ jsx62(VariableToolbarAgentPlugin, {})
|
|
7441
7261
|
] }) }) })
|
|
7442
7262
|
]
|
|
7443
7263
|
}
|
|
@@ -7448,9 +7268,9 @@ function ShortAnswerQuestionComponent(props) {
|
|
|
7448
7268
|
}
|
|
7449
7269
|
|
|
7450
7270
|
// src/plugins/ShortAnswerQuestionPlugin/ShortAnswerQuestionNode.tsx
|
|
7451
|
-
import { jsx as
|
|
7271
|
+
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
7452
7272
|
var TYPE_NAME7 = "short-answer-question";
|
|
7453
|
-
function
|
|
7273
|
+
function initNewContentEditor3() {
|
|
7454
7274
|
return createEditor5();
|
|
7455
7275
|
}
|
|
7456
7276
|
var ShortAnswerQuestionNode = class _ShortAnswerQuestionNode extends DecoratorNode8 {
|
|
@@ -7459,7 +7279,7 @@ var ShortAnswerQuestionNode = class _ShortAnswerQuestionNode extends DecoratorNo
|
|
|
7459
7279
|
this.__id = id || nanoid5();
|
|
7460
7280
|
this.__points = points <= 0 ? 1 : points;
|
|
7461
7281
|
this.__maxWords = maxWords;
|
|
7462
|
-
this.__notes = notes ||
|
|
7282
|
+
this.__notes = notes || initNewContentEditor3();
|
|
7463
7283
|
}
|
|
7464
7284
|
static getType() {
|
|
7465
7285
|
return TYPE_NAME7;
|
|
@@ -7537,7 +7357,7 @@ var ShortAnswerQuestionNode = class _ShortAnswerQuestionNode extends DecoratorNo
|
|
|
7537
7357
|
writable.__maxWords = maxWords;
|
|
7538
7358
|
}
|
|
7539
7359
|
decorate() {
|
|
7540
|
-
return /* @__PURE__ */
|
|
7360
|
+
return /* @__PURE__ */ jsx63(
|
|
7541
7361
|
ShortAnswerQuestionComponent,
|
|
7542
7362
|
{
|
|
7543
7363
|
nodeKey: this.__key,
|
|
@@ -7556,318 +7376,394 @@ function $isShortAnswerQuestionNode(node) {
|
|
|
7556
7376
|
return node instanceof ShortAnswerQuestionNode;
|
|
7557
7377
|
}
|
|
7558
7378
|
|
|
7559
|
-
// src/plugins/
|
|
7560
|
-
import { useLexicalComposerContext as
|
|
7561
|
-
import { mergeRegister as
|
|
7562
|
-
import {
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
import { useEffect as useEffect38 } from "react";
|
|
7568
|
-
import { Fragment as Fragment24, jsx as jsx66 } from "react/jsx-runtime";
|
|
7569
|
-
var TEXT_TOOLBAR_SELECTION_CHANGE_COMMAND = createCommand8("TEXT_TOOLBAR_SELECTION_CHANGE_COMMAND");
|
|
7570
|
-
function TextToolbarAgentPlugin(props) {
|
|
7379
|
+
// src/plugins/VariablesPlugin/TypeaheadVariableAgentPlugin.tsx
|
|
7380
|
+
import { useLexicalComposerContext as useLexicalComposerContext31 } from "@lexical/react/LexicalComposerContext";
|
|
7381
|
+
import { mergeRegister as mergeRegister8 } from "@lexical/utils";
|
|
7382
|
+
import { createCommand as createCommand7 } from "lexical";
|
|
7383
|
+
import { useEffect as useEffect37 } from "react";
|
|
7384
|
+
import { Fragment as Fragment23, jsx as jsx64 } from "react/jsx-runtime";
|
|
7385
|
+
var TYPEAHEAD_VARIABLE_COMMAND = createCommand7("TYPEAHEAD_VARIABLE_COMMAND");
|
|
7386
|
+
function TypeaheadVariableAgentPlugin(props) {
|
|
7571
7387
|
const { decoratorNode } = props;
|
|
7572
|
-
const
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
(
|
|
7578
|
-
if (
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
);
|
|
7388
|
+
const { hasModule, modulesNumber } = useBlockEditor();
|
|
7389
|
+
const [editor] = useLexicalComposerContext31();
|
|
7390
|
+
useEffect37(() => {
|
|
7391
|
+
if (hasModule("Variables")) {
|
|
7392
|
+
return mergeRegister8(
|
|
7393
|
+
editor.registerUpdateListener(({ tags }) => {
|
|
7394
|
+
if (!tags.has("history-merge")) {
|
|
7395
|
+
editor.dispatchCommand(TYPEAHEAD_VARIABLE_COMMAND, {
|
|
7396
|
+
decoratorNode
|
|
7397
|
+
});
|
|
7583
7398
|
}
|
|
7584
|
-
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
if (!tags.has("history-merge")) {
|
|
7590
|
-
editor.dispatchCommand(
|
|
7591
|
-
TEXT_TOOLBAR_SELECTION_CHANGE_COMMAND,
|
|
7592
|
-
{ decoratorNode }
|
|
7593
|
-
);
|
|
7594
|
-
}
|
|
7595
|
-
})
|
|
7596
|
-
);
|
|
7597
|
-
}, [editor]);
|
|
7598
|
-
return /* @__PURE__ */ jsx66(Fragment24, {});
|
|
7599
|
-
}
|
|
7600
|
-
|
|
7601
|
-
// src/plugins/TypeaheadMenuPlugin/TypeaheadMenuAgentPlugin.tsx
|
|
7602
|
-
import { useLexicalComposerContext as useLexicalComposerContext34 } from "@lexical/react/LexicalComposerContext";
|
|
7603
|
-
import { mergeRegister as mergeRegister10 } from "@lexical/utils";
|
|
7604
|
-
import { createCommand as createCommand9 } from "lexical";
|
|
7605
|
-
import { useEffect as useEffect39 } from "react";
|
|
7606
|
-
import { Fragment as Fragment25, jsx as jsx67 } from "react/jsx-runtime";
|
|
7607
|
-
var TYPEAHEAD_MENU_COMMAND = createCommand9("TEXT_TOOLBAR_SELECTION_CHANGE_COMMAND");
|
|
7608
|
-
function TypeaheadMenuAgentPlugin(props) {
|
|
7609
|
-
const { decoratorNode } = props;
|
|
7610
|
-
const [editor] = useLexicalComposerContext34();
|
|
7611
|
-
useEffect39(() => {
|
|
7612
|
-
return mergeRegister10(
|
|
7613
|
-
editor.registerUpdateListener(({ tags }) => {
|
|
7614
|
-
if (!tags.has("history-merge")) {
|
|
7615
|
-
editor.dispatchCommand(TYPEAHEAD_MENU_COMMAND, {
|
|
7616
|
-
decoratorNode
|
|
7617
|
-
});
|
|
7618
|
-
}
|
|
7619
|
-
})
|
|
7620
|
-
);
|
|
7621
|
-
}, [editor, decoratorNode]);
|
|
7622
|
-
return /* @__PURE__ */ jsx67(Fragment25, {});
|
|
7399
|
+
})
|
|
7400
|
+
);
|
|
7401
|
+
}
|
|
7402
|
+
}, [editor, modulesNumber, decoratorNode, hasModule]);
|
|
7403
|
+
return /* @__PURE__ */ jsx64(Fragment23, {});
|
|
7623
7404
|
}
|
|
7624
7405
|
|
|
7625
|
-
// src/plugins/
|
|
7626
|
-
import { useLexicalComposerContext as
|
|
7406
|
+
// src/plugins/JournalEntryQuestionPlugin/JournalEntryQuestionItemComponent.tsx
|
|
7407
|
+
import { useLexicalComposerContext as useLexicalComposerContext32 } from "@lexical/react/LexicalComposerContext";
|
|
7627
7408
|
import { LexicalErrorBoundary as LexicalErrorBoundary6 } from "@lexical/react/LexicalErrorBoundary";
|
|
7628
7409
|
import { HistoryPlugin as HistoryPlugin6 } from "@lexical/react/LexicalHistoryPlugin";
|
|
7629
|
-
import { ListPlugin as ListPlugin2 } from "@lexical/react/LexicalListPlugin";
|
|
7630
7410
|
import { LexicalNestedComposer as LexicalNestedComposer6 } from "@lexical/react/LexicalNestedComposer";
|
|
7631
7411
|
import { RichTextPlugin as RichTextPlugin6 } from "@lexical/react/LexicalRichTextPlugin";
|
|
7632
|
-
import
|
|
7633
|
-
import {
|
|
7634
|
-
$createNodeSelection as $createNodeSelection8,
|
|
7635
|
-
$getNodeByKey as $getNodeByKey27,
|
|
7636
|
-
$setSelection as $setSelection8,
|
|
7637
|
-
CLICK_COMMAND as CLICK_COMMAND8,
|
|
7638
|
-
COMMAND_PRIORITY_LOW as COMMAND_PRIORITY_LOW7,
|
|
7639
|
-
createCommand as createCommand10
|
|
7640
|
-
} from "lexical";
|
|
7641
|
-
import { useEffect as useEffect41, useRef as useRef25 } from "react";
|
|
7642
|
-
|
|
7643
|
-
// src/utils/extractSelectionNode.ts
|
|
7644
|
-
import { $getSelection as $getSelection2, $isRangeSelection } from "lexical";
|
|
7645
|
-
function $extractSelectionNode() {
|
|
7646
|
-
const selection = $getSelection2();
|
|
7647
|
-
if (!$isRangeSelection(selection) || selection.isCollapsed()) {
|
|
7648
|
-
return null;
|
|
7649
|
-
}
|
|
7650
|
-
const anchor = selection.anchor;
|
|
7651
|
-
if (anchor.type !== "text") {
|
|
7652
|
-
return null;
|
|
7653
|
-
}
|
|
7654
|
-
const anchorNode = anchor.getNode();
|
|
7655
|
-
if (!anchorNode.isSimpleText()) {
|
|
7656
|
-
return null;
|
|
7657
|
-
}
|
|
7658
|
-
const focus = selection.focus;
|
|
7659
|
-
const startOffset = Math.min(anchor.offset, focus.offset);
|
|
7660
|
-
let selectionOffset = Math.max(anchor.offset, focus.offset);
|
|
7661
|
-
if (startOffset < 0) {
|
|
7662
|
-
return null;
|
|
7663
|
-
}
|
|
7664
|
-
const textContent = anchorNode.getTextContent().slice(startOffset, selectionOffset);
|
|
7665
|
-
if (!textContent) {
|
|
7666
|
-
return null;
|
|
7667
|
-
}
|
|
7668
|
-
const textLength = textContent.length;
|
|
7669
|
-
const validTextLength = textContent.trim().length;
|
|
7670
|
-
selectionOffset -= textLength - validTextLength;
|
|
7671
|
-
let newNode;
|
|
7672
|
-
if (startOffset === 0) {
|
|
7673
|
-
[newNode] = anchorNode.splitText(selectionOffset);
|
|
7674
|
-
} else {
|
|
7675
|
-
[, newNode] = anchorNode.splitText(startOffset, selectionOffset);
|
|
7676
|
-
}
|
|
7677
|
-
return newNode;
|
|
7678
|
-
}
|
|
7679
|
-
|
|
7680
|
-
// src/plugins/FillInTheBlankQuestionPlugin/FillInTheBlankSpaceComponentPlugin.tsx
|
|
7681
|
-
import { useLexicalComposerContext as useLexicalComposerContext35 } from "@lexical/react/LexicalComposerContext";
|
|
7682
|
-
import { mergeRegister as mergeRegister11 } from "@lexical/utils";
|
|
7412
|
+
import clsx4 from "clsx";
|
|
7683
7413
|
import {
|
|
7684
|
-
$
|
|
7685
|
-
$
|
|
7686
|
-
$
|
|
7687
|
-
$setSelection as $setSelection7,
|
|
7688
|
-
CLICK_COMMAND as CLICK_COMMAND7,
|
|
7689
|
-
COMMAND_PRIORITY_EDITOR as COMMAND_PRIORITY_EDITOR6,
|
|
7690
|
-
COMMAND_PRIORITY_HIGH as COMMAND_PRIORITY_HIGH2,
|
|
7691
|
-
KEY_ARROW_DOWN_COMMAND,
|
|
7692
|
-
KEY_ARROW_LEFT_COMMAND,
|
|
7693
|
-
KEY_ARROW_RIGHT_COMMAND,
|
|
7694
|
-
KEY_ARROW_UP_COMMAND,
|
|
7695
|
-
SELECTION_CHANGE_COMMAND as SELECTION_CHANGE_COMMAND4
|
|
7414
|
+
$createParagraphNode as $createParagraphNode9,
|
|
7415
|
+
$getNodeByKey as $getNodeByKey26,
|
|
7416
|
+
$getRoot as $getRoot8
|
|
7696
7417
|
} from "lexical";
|
|
7697
|
-
import {
|
|
7698
|
-
import {
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
const
|
|
7702
|
-
const
|
|
7703
|
-
|
|
7704
|
-
)
|
|
7705
|
-
|
|
7706
|
-
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
if ($isRangeSelection2(selection)) {
|
|
7749
|
-
lastSelectedNodeRef.current = selection.anchor.getNode();
|
|
7750
|
-
}
|
|
7751
|
-
return false;
|
|
7752
|
-
},
|
|
7753
|
-
COMMAND_PRIORITY_EDITOR6
|
|
7754
|
-
),
|
|
7755
|
-
...[
|
|
7756
|
-
KEY_ARROW_UP_COMMAND,
|
|
7757
|
-
KEY_ARROW_RIGHT_COMMAND,
|
|
7758
|
-
KEY_ARROW_DOWN_COMMAND,
|
|
7759
|
-
KEY_ARROW_LEFT_COMMAND
|
|
7760
|
-
].map(
|
|
7761
|
-
(keyCommand) => editor.registerCommand(
|
|
7762
|
-
keyCommand,
|
|
7763
|
-
() => {
|
|
7764
|
-
if (selectedSpaceNodeKeyRef.current) {
|
|
7765
|
-
selectedSpaceNodeKeyRef.current = void 0;
|
|
7766
|
-
if (lastSelectedNodeRef.current) {
|
|
7767
|
-
lastSelectedNodeRef.current.select();
|
|
7768
|
-
} else {
|
|
7769
|
-
editor.focus();
|
|
7418
|
+
import { CircleMinus as CircleMinus3, CirclePlus as CirclePlus3 } from "lucide-react";
|
|
7419
|
+
import { useCallback as useCallback7 } from "react";
|
|
7420
|
+
import { jsx as jsx65, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
7421
|
+
function JournalEntryQuestionItemComponent(props) {
|
|
7422
|
+
const { nodeKey, id, itemIndex, correct, credit, debit, account } = props;
|
|
7423
|
+
const { historyState } = useSharedHistoryContext();
|
|
7424
|
+
const [editor] = useLexicalComposerContext32();
|
|
7425
|
+
const addItem = useCallback7(() => {
|
|
7426
|
+
editor.update(
|
|
7427
|
+
() => {
|
|
7428
|
+
const foundNode = $getNodeByKey26(nodeKey);
|
|
7429
|
+
if ($isJournalEntryQuestionNode(foundNode)) {
|
|
7430
|
+
foundNode.addItem(itemIndex, correct);
|
|
7431
|
+
}
|
|
7432
|
+
},
|
|
7433
|
+
{
|
|
7434
|
+
onUpdate: () => {
|
|
7435
|
+
editor.getEditorState().read(() => {
|
|
7436
|
+
const foundNode = $getNodeByKey26(nodeKey);
|
|
7437
|
+
if ($isJournalEntryQuestionNode(foundNode)) {
|
|
7438
|
+
const newEntryItem = foundNode.__lineItems[itemIndex + 1];
|
|
7439
|
+
if (newEntryItem.account) {
|
|
7440
|
+
newEntryItem.account.update(() => {
|
|
7441
|
+
const root = $getRoot8();
|
|
7442
|
+
let firstChild = root.getFirstChild();
|
|
7443
|
+
if (!firstChild) {
|
|
7444
|
+
firstChild = $createParagraphNode9();
|
|
7445
|
+
root.append(firstChild);
|
|
7446
|
+
}
|
|
7447
|
+
firstChild.selectStart();
|
|
7448
|
+
});
|
|
7449
|
+
}
|
|
7450
|
+
if (newEntryItem.credit) {
|
|
7451
|
+
newEntryItem.credit.update(() => {
|
|
7452
|
+
const root = $getRoot8();
|
|
7453
|
+
let firstChild = root.getFirstChild();
|
|
7454
|
+
if (!firstChild) {
|
|
7455
|
+
firstChild = $createParagraphNode9();
|
|
7456
|
+
root.append(firstChild);
|
|
7457
|
+
}
|
|
7458
|
+
});
|
|
7459
|
+
}
|
|
7460
|
+
if (newEntryItem.debit) {
|
|
7461
|
+
newEntryItem.debit.update(() => {
|
|
7462
|
+
const root = $getRoot8();
|
|
7463
|
+
let firstChild = root.getFirstChild();
|
|
7464
|
+
if (!firstChild) {
|
|
7465
|
+
firstChild = $createParagraphNode9();
|
|
7466
|
+
root.append(firstChild);
|
|
7467
|
+
}
|
|
7468
|
+
});
|
|
7770
7469
|
}
|
|
7771
7470
|
}
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
)
|
|
7776
|
-
)
|
|
7471
|
+
});
|
|
7472
|
+
}
|
|
7473
|
+
}
|
|
7777
7474
|
);
|
|
7778
|
-
}, [editor,
|
|
7779
|
-
|
|
7475
|
+
}, [editor, nodeKey, itemIndex, correct]);
|
|
7476
|
+
const removeItem = useCallback7(() => {
|
|
7477
|
+
editor.update(() => {
|
|
7478
|
+
const foundNode = $getNodeByKey26(nodeKey);
|
|
7479
|
+
if ($isJournalEntryQuestionNode(foundNode)) {
|
|
7480
|
+
foundNode.removeItem(itemIndex);
|
|
7481
|
+
}
|
|
7482
|
+
});
|
|
7483
|
+
}, [editor, nodeKey, itemIndex]);
|
|
7484
|
+
return /* @__PURE__ */ jsxs24(
|
|
7485
|
+
"div",
|
|
7486
|
+
{
|
|
7487
|
+
id,
|
|
7488
|
+
className: "journal-entry-question-prompt-question-item-wrapper",
|
|
7489
|
+
children: [
|
|
7490
|
+
/* @__PURE__ */ jsxs24(
|
|
7491
|
+
"div",
|
|
7492
|
+
{
|
|
7493
|
+
className: clsx4(
|
|
7494
|
+
"journal-entry-question-prompt-question-item",
|
|
7495
|
+
{
|
|
7496
|
+
correct,
|
|
7497
|
+
incorrect: !correct
|
|
7498
|
+
}
|
|
7499
|
+
),
|
|
7500
|
+
"data-selectable": "true",
|
|
7501
|
+
children: [
|
|
7502
|
+
/* @__PURE__ */ jsx65("div", { className: "title", "data-selectable": "true", children: /* @__PURE__ */ jsx65("div", { "data-selectable": "true", children: correct ? "Account" : "Incorrect Choice" }) }),
|
|
7503
|
+
/* @__PURE__ */ jsx65("div", { style: { height: "100%" }, children: /* @__PURE__ */ jsx65(LexicalNestedComposer6, { initialEditor: account, children: /* @__PURE__ */ jsxs24(NestedEditor, { nodeKey, children: [
|
|
7504
|
+
/* @__PURE__ */ jsx65(SettingsPanelNestedAgentPlugin, {}),
|
|
7505
|
+
/* @__PURE__ */ jsx65(
|
|
7506
|
+
RichTextPlugin6,
|
|
7507
|
+
{
|
|
7508
|
+
contentEditable: /* @__PURE__ */ jsx65(NestedContentEditable, {}),
|
|
7509
|
+
ErrorBoundary: LexicalErrorBoundary6,
|
|
7510
|
+
placeholder: null
|
|
7511
|
+
},
|
|
7512
|
+
nodeKey
|
|
7513
|
+
),
|
|
7514
|
+
/* @__PURE__ */ jsx65(HistoryPlugin6, { externalHistoryState: historyState }),
|
|
7515
|
+
/* @__PURE__ */ jsx65(
|
|
7516
|
+
TextToolbarAgentPlugin,
|
|
7517
|
+
{
|
|
7518
|
+
decoratorNode: JournalEntryQuestionNode
|
|
7519
|
+
}
|
|
7520
|
+
),
|
|
7521
|
+
/* @__PURE__ */ jsx65(
|
|
7522
|
+
TypeaheadVariableAgentPlugin,
|
|
7523
|
+
{
|
|
7524
|
+
decoratorNode: JournalEntryQuestionNode
|
|
7525
|
+
}
|
|
7526
|
+
),
|
|
7527
|
+
/* @__PURE__ */ jsx65(VariableComponentPlugin, {})
|
|
7528
|
+
] }) }) }),
|
|
7529
|
+
(!debit || !credit) && /* @__PURE__ */ jsxs24("div", { className: "controls", children: [
|
|
7530
|
+
itemIndex > 0 ? /* @__PURE__ */ jsx65("div", { children: /* @__PURE__ */ jsx65(
|
|
7531
|
+
Button,
|
|
7532
|
+
{
|
|
7533
|
+
StartIcon: CircleMinus3,
|
|
7534
|
+
size: "medium",
|
|
7535
|
+
variant: "text",
|
|
7536
|
+
className: "cancel",
|
|
7537
|
+
onClick: removeItem
|
|
7538
|
+
}
|
|
7539
|
+
) }) : /* @__PURE__ */ jsx65("div", {}),
|
|
7540
|
+
/* @__PURE__ */ jsx65("div", { children: /* @__PURE__ */ jsx65(
|
|
7541
|
+
Button,
|
|
7542
|
+
{
|
|
7543
|
+
StartIcon: CirclePlus3,
|
|
7544
|
+
size: "medium",
|
|
7545
|
+
variant: "text",
|
|
7546
|
+
className: "cancel",
|
|
7547
|
+
onClick: addItem
|
|
7548
|
+
}
|
|
7549
|
+
) })
|
|
7550
|
+
] })
|
|
7551
|
+
]
|
|
7552
|
+
}
|
|
7553
|
+
),
|
|
7554
|
+
debit ? /* @__PURE__ */ jsxs24(
|
|
7555
|
+
"div",
|
|
7556
|
+
{
|
|
7557
|
+
className: clsx4(
|
|
7558
|
+
"journal-entry-question-prompt-question-item",
|
|
7559
|
+
{
|
|
7560
|
+
correct,
|
|
7561
|
+
incorrect: !correct
|
|
7562
|
+
}
|
|
7563
|
+
),
|
|
7564
|
+
"data-selectable": "true",
|
|
7565
|
+
children: [
|
|
7566
|
+
/* @__PURE__ */ jsx65("div", { className: "title", "data-selectable": "true", children: /* @__PURE__ */ jsx65("div", { "data-selectable": "true", children: "Debit" }) }),
|
|
7567
|
+
/* @__PURE__ */ jsx65("div", { style: { height: "100%" }, children: /* @__PURE__ */ jsx65(LexicalNestedComposer6, { initialEditor: debit, children: /* @__PURE__ */ jsxs24(NestedEditor, { nodeKey, children: [
|
|
7568
|
+
/* @__PURE__ */ jsx65(SettingsPanelNestedAgentPlugin, {}),
|
|
7569
|
+
/* @__PURE__ */ jsx65(
|
|
7570
|
+
RichTextPlugin6,
|
|
7571
|
+
{
|
|
7572
|
+
contentEditable: /* @__PURE__ */ jsx65(NestedContentEditable, {}),
|
|
7573
|
+
ErrorBoundary: LexicalErrorBoundary6,
|
|
7574
|
+
placeholder: null
|
|
7575
|
+
},
|
|
7576
|
+
nodeKey
|
|
7577
|
+
),
|
|
7578
|
+
/* @__PURE__ */ jsx65(HistoryPlugin6, { externalHistoryState: historyState }),
|
|
7579
|
+
/* @__PURE__ */ jsx65(
|
|
7580
|
+
TextToolbarAgentPlugin,
|
|
7581
|
+
{
|
|
7582
|
+
decoratorNode: JournalEntryQuestionNode
|
|
7583
|
+
}
|
|
7584
|
+
),
|
|
7585
|
+
/* @__PURE__ */ jsx65(
|
|
7586
|
+
TypeaheadVariableAgentPlugin,
|
|
7587
|
+
{
|
|
7588
|
+
decoratorNode: JournalEntryQuestionNode
|
|
7589
|
+
}
|
|
7590
|
+
),
|
|
7591
|
+
/* @__PURE__ */ jsx65(VariableComponentPlugin, {})
|
|
7592
|
+
] }) }) })
|
|
7593
|
+
]
|
|
7594
|
+
}
|
|
7595
|
+
) : /* @__PURE__ */ jsx65("div", {}),
|
|
7596
|
+
credit ? /* @__PURE__ */ jsxs24(
|
|
7597
|
+
"div",
|
|
7598
|
+
{
|
|
7599
|
+
className: clsx4(
|
|
7600
|
+
"journal-entry-question-prompt-question-item",
|
|
7601
|
+
{
|
|
7602
|
+
correct,
|
|
7603
|
+
incorrect: !correct
|
|
7604
|
+
}
|
|
7605
|
+
),
|
|
7606
|
+
"data-selectable": "true",
|
|
7607
|
+
children: [
|
|
7608
|
+
/* @__PURE__ */ jsx65("div", { className: "title", "data-selectable": "true", children: /* @__PURE__ */ jsx65("div", { "data-selectable": "true", children: "Credit" }) }),
|
|
7609
|
+
/* @__PURE__ */ jsx65("div", { style: { height: "100%" }, children: /* @__PURE__ */ jsx65(LexicalNestedComposer6, { initialEditor: credit, children: /* @__PURE__ */ jsxs24(NestedEditor, { nodeKey, children: [
|
|
7610
|
+
/* @__PURE__ */ jsx65(SettingsPanelNestedAgentPlugin, {}),
|
|
7611
|
+
/* @__PURE__ */ jsx65(
|
|
7612
|
+
RichTextPlugin6,
|
|
7613
|
+
{
|
|
7614
|
+
contentEditable: /* @__PURE__ */ jsx65(NestedContentEditable, {}),
|
|
7615
|
+
ErrorBoundary: LexicalErrorBoundary6,
|
|
7616
|
+
placeholder: null
|
|
7617
|
+
},
|
|
7618
|
+
nodeKey
|
|
7619
|
+
),
|
|
7620
|
+
/* @__PURE__ */ jsx65(HistoryPlugin6, { externalHistoryState: historyState }),
|
|
7621
|
+
/* @__PURE__ */ jsx65(
|
|
7622
|
+
TextToolbarAgentPlugin,
|
|
7623
|
+
{
|
|
7624
|
+
decoratorNode: JournalEntryQuestionNode
|
|
7625
|
+
}
|
|
7626
|
+
),
|
|
7627
|
+
/* @__PURE__ */ jsx65(
|
|
7628
|
+
TypeaheadVariableAgentPlugin,
|
|
7629
|
+
{
|
|
7630
|
+
decoratorNode: JournalEntryQuestionNode
|
|
7631
|
+
}
|
|
7632
|
+
),
|
|
7633
|
+
/* @__PURE__ */ jsx65(VariableComponentPlugin, {}),
|
|
7634
|
+
/* @__PURE__ */ jsx65(VariableToolbarAgentPlugin, {})
|
|
7635
|
+
] }) }) }),
|
|
7636
|
+
/* @__PURE__ */ jsxs24("div", { className: "controls", children: [
|
|
7637
|
+
itemIndex > 0 ? /* @__PURE__ */ jsx65("div", { children: /* @__PURE__ */ jsx65(
|
|
7638
|
+
Button,
|
|
7639
|
+
{
|
|
7640
|
+
StartIcon: CircleMinus3,
|
|
7641
|
+
size: "medium",
|
|
7642
|
+
variant: "text",
|
|
7643
|
+
className: "cancel",
|
|
7644
|
+
onClick: removeItem
|
|
7645
|
+
}
|
|
7646
|
+
) }) : /* @__PURE__ */ jsx65("div", {}),
|
|
7647
|
+
/* @__PURE__ */ jsx65("div", { children: /* @__PURE__ */ jsx65(
|
|
7648
|
+
Button,
|
|
7649
|
+
{
|
|
7650
|
+
StartIcon: CirclePlus3,
|
|
7651
|
+
size: "medium",
|
|
7652
|
+
variant: "text",
|
|
7653
|
+
className: "cancel",
|
|
7654
|
+
onClick: addItem
|
|
7655
|
+
}
|
|
7656
|
+
) })
|
|
7657
|
+
] })
|
|
7658
|
+
]
|
|
7659
|
+
}
|
|
7660
|
+
) : /* @__PURE__ */ jsx65("div", {})
|
|
7661
|
+
]
|
|
7662
|
+
}
|
|
7663
|
+
);
|
|
7780
7664
|
}
|
|
7781
7665
|
|
|
7782
|
-
// src/plugins/
|
|
7783
|
-
import { jsx as
|
|
7784
|
-
|
|
7785
|
-
|
|
7786
|
-
const
|
|
7787
|
-
const
|
|
7788
|
-
|
|
7789
|
-
const rootElementRef = useRef25(null);
|
|
7790
|
-
useEffect41(() => {
|
|
7666
|
+
// src/plugins/JournalEntryQuestionPlugin/JournalEntryQuestionComponent.tsx
|
|
7667
|
+
import { jsx as jsx66, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
7668
|
+
function JournalEntryQuestionComponent(props) {
|
|
7669
|
+
const { nodeKey, journalType, lineItems, id } = props;
|
|
7670
|
+
const [editor] = useLexicalComposerContext33();
|
|
7671
|
+
const rootElementRef = useRef24(null);
|
|
7672
|
+
useEffect38(() => {
|
|
7791
7673
|
return editor.registerCommand(
|
|
7792
|
-
|
|
7674
|
+
CLICK_COMMAND7,
|
|
7793
7675
|
(event, _activeEditor) => {
|
|
7794
|
-
if (
|
|
7795
|
-
"data-
|
|
7676
|
+
if (rootElementRef.current?.contains(event.target) && event.target.hasAttribute(
|
|
7677
|
+
"data-selectable"
|
|
7796
7678
|
)) {
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
$setSelection8(selection);
|
|
7806
|
-
}
|
|
7807
|
-
});
|
|
7808
|
-
}
|
|
7679
|
+
editor.update(() => {
|
|
7680
|
+
const foundNode = $getNodeByKey27(nodeKey);
|
|
7681
|
+
if ($isJournalEntryQuestionNode(foundNode)) {
|
|
7682
|
+
const selection = $createNodeSelection7();
|
|
7683
|
+
selection.add(nodeKey);
|
|
7684
|
+
$setSelection7(selection);
|
|
7685
|
+
}
|
|
7686
|
+
});
|
|
7809
7687
|
}
|
|
7810
7688
|
return false;
|
|
7811
7689
|
},
|
|
7812
7690
|
COMMAND_PRIORITY_LOW7
|
|
7813
7691
|
);
|
|
7814
7692
|
}, [editor]);
|
|
7693
|
+
const doNeedDistractor = lineItems.reduce((a, i) => {
|
|
7694
|
+
return i.correct ? a : ++a;
|
|
7695
|
+
}, 0) <= 0;
|
|
7815
7696
|
return /* @__PURE__ */ jsxs25(
|
|
7816
7697
|
"div",
|
|
7817
7698
|
{
|
|
7818
7699
|
ref: rootElementRef,
|
|
7819
7700
|
id,
|
|
7820
|
-
className: "
|
|
7701
|
+
className: "journal-entry-question-prompt",
|
|
7821
7702
|
children: [
|
|
7822
|
-
/* @__PURE__ */
|
|
7703
|
+
/* @__PURE__ */ jsx66(
|
|
7823
7704
|
"div",
|
|
7824
7705
|
{
|
|
7825
|
-
className: "
|
|
7706
|
+
className: "journal-entry-question-prompt-title",
|
|
7826
7707
|
"data-selectable": "true",
|
|
7827
|
-
children: "
|
|
7708
|
+
children: "Journal Entry"
|
|
7828
7709
|
}
|
|
7829
7710
|
),
|
|
7830
7711
|
/* @__PURE__ */ jsxs25(
|
|
7831
7712
|
"div",
|
|
7832
7713
|
{
|
|
7833
|
-
className: "
|
|
7714
|
+
className: "journal-entry-question-prompt-items",
|
|
7834
7715
|
"data-selectable": "true",
|
|
7835
7716
|
children: [
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7717
|
+
journalType === "noEntryRequiredCorrect" && /* @__PURE__ */ jsxs25(
|
|
7718
|
+
"div",
|
|
7719
|
+
{
|
|
7720
|
+
className: "journal-entry-question-prompt-question-item correct",
|
|
7721
|
+
"data-selectable": "true",
|
|
7722
|
+
children: [
|
|
7723
|
+
/* @__PURE__ */ jsx66("div", { className: "title", "data-selectable": "true", children: /* @__PURE__ */ jsx66("div", { "data-selectable": "true", children: "Correct Choice" }) }),
|
|
7724
|
+
/* @__PURE__ */ jsx66("div", { "data-selectable": "true", children: "No Entry Required" })
|
|
7725
|
+
]
|
|
7726
|
+
}
|
|
7727
|
+
),
|
|
7728
|
+
journalType === "noEntryRequiredCorrect" && lineItems.map((journalEntryItem, itemIndex) => {
|
|
7729
|
+
if (!journalEntryItem.correct) {
|
|
7730
|
+
return /* @__PURE__ */ jsx66(
|
|
7731
|
+
JournalEntryQuestionItemComponent,
|
|
7732
|
+
{
|
|
7733
|
+
nodeKey,
|
|
7734
|
+
id: journalEntryItem.id,
|
|
7735
|
+
itemIndex,
|
|
7736
|
+
correct: journalEntryItem.correct,
|
|
7737
|
+
account: journalEntryItem.account,
|
|
7738
|
+
debit: journalEntryItem.debit,
|
|
7739
|
+
credit: journalEntryItem.credit
|
|
7740
|
+
},
|
|
7741
|
+
journalEntryItem.id
|
|
7742
|
+
);
|
|
7743
|
+
}
|
|
7744
|
+
}),
|
|
7745
|
+
(journalType === "default" || journalType === "noEntryRequiredDistractor") && lineItems.map((journalEntryItem, itemIndex) => {
|
|
7746
|
+
return /* @__PURE__ */ jsx66(
|
|
7747
|
+
JournalEntryQuestionItemComponent,
|
|
7843
7748
|
{
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7749
|
+
nodeKey,
|
|
7750
|
+
id: journalEntryItem.id,
|
|
7751
|
+
itemIndex,
|
|
7752
|
+
correct: journalEntryItem.correct,
|
|
7753
|
+
account: journalEntryItem.account,
|
|
7754
|
+
debit: journalEntryItem.debit,
|
|
7755
|
+
credit: journalEntryItem.credit
|
|
7847
7756
|
},
|
|
7848
|
-
|
|
7849
|
-
)
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
/* @__PURE__ */ jsx69(VariableComponentPlugin, {}),
|
|
7859
|
-
/* @__PURE__ */ jsx69(VariableToolbarAgentPlugin, {}),
|
|
7860
|
-
/* @__PURE__ */ jsx69(
|
|
7861
|
-
TypeaheadMenuAgentPlugin,
|
|
7862
|
-
{
|
|
7863
|
-
decoratorNode: FillInTheBlankQuestionNode
|
|
7864
|
-
}
|
|
7865
|
-
),
|
|
7866
|
-
/* @__PURE__ */ jsx69(ListPlugin2, {}),
|
|
7867
|
-
/* @__PURE__ */ jsx69(ListLevelLimitPlugin, {}),
|
|
7868
|
-
/* @__PURE__ */ jsx69(Table, {}),
|
|
7869
|
-
/* @__PURE__ */ jsx69(TabIndentationPlugin2, {})
|
|
7870
|
-
] }) })
|
|
7757
|
+
journalEntryItem.id
|
|
7758
|
+
);
|
|
7759
|
+
}),
|
|
7760
|
+
doNeedDistractor && /* @__PURE__ */ jsx66(
|
|
7761
|
+
DistractorButton,
|
|
7762
|
+
{
|
|
7763
|
+
nodeKey,
|
|
7764
|
+
itemIndex: lineItems.length - 1
|
|
7765
|
+
}
|
|
7766
|
+
)
|
|
7871
7767
|
]
|
|
7872
7768
|
}
|
|
7873
7769
|
)
|
|
@@ -7876,33 +7772,72 @@ function FillInTheBlankQuestionComponent(props) {
|
|
|
7876
7772
|
);
|
|
7877
7773
|
}
|
|
7878
7774
|
|
|
7879
|
-
// src/plugins/
|
|
7880
|
-
import {
|
|
7881
|
-
|
|
7882
|
-
|
|
7775
|
+
// src/plugins/JournalEntryQuestionPlugin/JournalEntryQuestionNode.tsx
|
|
7776
|
+
import {
|
|
7777
|
+
$applyNodeReplacement as $applyNodeReplacement9,
|
|
7778
|
+
$createParagraphNode as $createParagraphNode10,
|
|
7779
|
+
$createTextNode as $createTextNode5,
|
|
7780
|
+
$getRoot as $getRoot9,
|
|
7781
|
+
DecoratorNode as DecoratorNode9,
|
|
7782
|
+
createEditor as createEditor6
|
|
7783
|
+
} from "lexical";
|
|
7784
|
+
import { nanoid as nanoid6 } from "nanoid";
|
|
7785
|
+
import { jsx as jsx67 } from "react/jsx-runtime";
|
|
7786
|
+
var TYPE_NAME8 = "journal-entry-question";
|
|
7787
|
+
var JournalTypeLabelMap = {
|
|
7788
|
+
default: "Default",
|
|
7789
|
+
noEntryRequiredCorrect: "No Entry Required Correct",
|
|
7790
|
+
noEntryRequiredDistractor: "No Entry Required Distractor"
|
|
7791
|
+
};
|
|
7792
|
+
function initNewContentEditor4() {
|
|
7883
7793
|
return createEditor6();
|
|
7884
7794
|
}
|
|
7885
|
-
var
|
|
7886
|
-
constructor(
|
|
7795
|
+
var JournalEntryQuestionNode = class _JournalEntryQuestionNode extends DecoratorNode9 {
|
|
7796
|
+
constructor(points, journalType, errorTolerance, lineItems, id, key) {
|
|
7887
7797
|
super(key);
|
|
7798
|
+
this.__points = points < 0 ? 1 : points;
|
|
7799
|
+
this.__journalType = journalType;
|
|
7800
|
+
this.__errorTolerance = errorTolerance;
|
|
7888
7801
|
this.__id = id || nanoid6();
|
|
7889
|
-
this.
|
|
7890
|
-
|
|
7802
|
+
this.__lineItems = [];
|
|
7803
|
+
if (lineItems) {
|
|
7804
|
+
for (const item of lineItems) {
|
|
7805
|
+
this.__lineItems.push({
|
|
7806
|
+
id: item.id,
|
|
7807
|
+
correct: item.correct,
|
|
7808
|
+
account: item.account,
|
|
7809
|
+
credit: item.correct ? item.credit : void 0,
|
|
7810
|
+
debit: item.correct ? item.debit : void 0
|
|
7811
|
+
});
|
|
7812
|
+
}
|
|
7813
|
+
} else {
|
|
7814
|
+
for (let i = 0; i < 2; i++) {
|
|
7815
|
+
this.__lineItems.push({
|
|
7816
|
+
id: nanoid6(),
|
|
7817
|
+
correct: true,
|
|
7818
|
+
account: initNewContentEditor4(),
|
|
7819
|
+
credit: initNewContentEditor4(),
|
|
7820
|
+
debit: initNewContentEditor4()
|
|
7821
|
+
});
|
|
7822
|
+
}
|
|
7823
|
+
}
|
|
7891
7824
|
}
|
|
7892
7825
|
static getType() {
|
|
7893
7826
|
return TYPE_NAME8;
|
|
7894
7827
|
}
|
|
7895
7828
|
static clone(node) {
|
|
7896
|
-
return new
|
|
7897
|
-
node.
|
|
7829
|
+
return new _JournalEntryQuestionNode(
|
|
7830
|
+
node.__points,
|
|
7831
|
+
node.__journalType,
|
|
7832
|
+
node.__errorTolerance,
|
|
7833
|
+
node.__lineItems,
|
|
7898
7834
|
node.__id,
|
|
7899
|
-
node.__content,
|
|
7900
7835
|
node.__key
|
|
7901
7836
|
);
|
|
7902
7837
|
}
|
|
7903
7838
|
__createWrapper() {
|
|
7904
7839
|
const wrapper = document.createElement("div");
|
|
7905
|
-
wrapper.classList.add("
|
|
7840
|
+
wrapper.classList.add("journal-entry-question-wrapper");
|
|
7906
7841
|
return wrapper;
|
|
7907
7842
|
}
|
|
7908
7843
|
createDOM() {
|
|
@@ -7919,24 +7854,70 @@ var FillInTheBlankQuestionNode = class _FillInTheBlankQuestionNode extends Decor
|
|
|
7919
7854
|
return null;
|
|
7920
7855
|
}
|
|
7921
7856
|
static importJSON(serializedNode) {
|
|
7922
|
-
const
|
|
7923
|
-
const
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
|
|
7857
|
+
const restoredItems = [];
|
|
7858
|
+
for (const item of serializedNode.lineItems) {
|
|
7859
|
+
const accountNestedEditor = createEditor6();
|
|
7860
|
+
const editorState = accountNestedEditor.parseEditorState(
|
|
7861
|
+
item.account.editorState
|
|
7862
|
+
);
|
|
7863
|
+
if (!editorState.isEmpty()) {
|
|
7864
|
+
accountNestedEditor.setEditorState(editorState);
|
|
7865
|
+
}
|
|
7866
|
+
if (item.correct && item.credit && item.debit) {
|
|
7867
|
+
const creditNestedEditor = createEditor6();
|
|
7868
|
+
let editorState2 = creditNestedEditor.parseEditorState(
|
|
7869
|
+
item.credit.editorState
|
|
7870
|
+
);
|
|
7871
|
+
if (!editorState2.isEmpty()) {
|
|
7872
|
+
creditNestedEditor.setEditorState(editorState2);
|
|
7873
|
+
}
|
|
7874
|
+
const debitNestedEditor = createEditor6();
|
|
7875
|
+
editorState2 = debitNestedEditor.parseEditorState(
|
|
7876
|
+
item.debit.editorState
|
|
7877
|
+
);
|
|
7878
|
+
if (!editorState2.isEmpty()) {
|
|
7879
|
+
debitNestedEditor.setEditorState(editorState2);
|
|
7880
|
+
}
|
|
7881
|
+
restoredItems.push({
|
|
7882
|
+
id: item.id,
|
|
7883
|
+
correct: item.correct,
|
|
7884
|
+
account: accountNestedEditor,
|
|
7885
|
+
credit: creditNestedEditor,
|
|
7886
|
+
debit: debitNestedEditor
|
|
7887
|
+
});
|
|
7888
|
+
} else {
|
|
7889
|
+
restoredItems.push({
|
|
7890
|
+
id: item.id,
|
|
7891
|
+
correct: item.correct,
|
|
7892
|
+
account: accountNestedEditor
|
|
7893
|
+
});
|
|
7894
|
+
}
|
|
7928
7895
|
}
|
|
7929
|
-
return $
|
|
7930
|
-
serializedNode.
|
|
7931
|
-
serializedNode.
|
|
7932
|
-
|
|
7896
|
+
return $createJournalEntryQuestionNode(
|
|
7897
|
+
serializedNode.points,
|
|
7898
|
+
serializedNode.journalType,
|
|
7899
|
+
serializedNode.errorTolerance,
|
|
7900
|
+
restoredItems,
|
|
7901
|
+
serializedNode.id
|
|
7933
7902
|
);
|
|
7934
7903
|
}
|
|
7935
7904
|
exportJSON() {
|
|
7905
|
+
const exportedOptions = [];
|
|
7906
|
+
for (const item of this.__lineItems) {
|
|
7907
|
+
exportedOptions.push({
|
|
7908
|
+
id: item.id,
|
|
7909
|
+
correct: item.correct,
|
|
7910
|
+
account: item.account.toJSON(),
|
|
7911
|
+
credit: item.credit?.toJSON(),
|
|
7912
|
+
debit: item.debit?.toJSON()
|
|
7913
|
+
});
|
|
7914
|
+
}
|
|
7936
7915
|
return {
|
|
7916
|
+
lineItems: exportedOptions,
|
|
7937
7917
|
id: this.__id,
|
|
7938
|
-
|
|
7939
|
-
|
|
7918
|
+
errorTolerance: this.__errorTolerance,
|
|
7919
|
+
journalType: this.__journalType,
|
|
7920
|
+
points: this.__points,
|
|
7940
7921
|
type: TYPE_NAME8,
|
|
7941
7922
|
version: 1
|
|
7942
7923
|
};
|
|
@@ -7953,290 +7934,445 @@ var FillInTheBlankQuestionNode = class _FillInTheBlankQuestionNode extends Decor
|
|
|
7953
7934
|
isKeyboardSelectable() {
|
|
7954
7935
|
return false;
|
|
7955
7936
|
}
|
|
7956
|
-
|
|
7937
|
+
setPoints(points) {
|
|
7957
7938
|
const writable = this.getWritable();
|
|
7958
|
-
writable.
|
|
7939
|
+
writable.__points = points < 0 ? 1 : points;
|
|
7940
|
+
}
|
|
7941
|
+
getErrorTolerance() {
|
|
7942
|
+
return this.__errorTolerance;
|
|
7943
|
+
}
|
|
7944
|
+
setErrorTolerance(errorTolerance) {
|
|
7945
|
+
const writable = this.getWritable();
|
|
7946
|
+
writable.__errorTolerance = errorTolerance;
|
|
7947
|
+
}
|
|
7948
|
+
getJournalType() {
|
|
7949
|
+
return this.__journalType;
|
|
7950
|
+
}
|
|
7951
|
+
setJournalType(journalType) {
|
|
7952
|
+
const writable = this.getWritable();
|
|
7953
|
+
if (journalType === "noEntryRequiredDistractor") {
|
|
7954
|
+
const newItems = [...this.__lineItems];
|
|
7955
|
+
const newAccountContent = initNewContentEditor4();
|
|
7956
|
+
newAccountContent.update(() => {
|
|
7957
|
+
const root = $getRoot9();
|
|
7958
|
+
let firstChild = root.getFirstChild();
|
|
7959
|
+
if (!firstChild) {
|
|
7960
|
+
firstChild = $createParagraphNode10();
|
|
7961
|
+
firstChild.append($createTextNode5("No Entry Required"));
|
|
7962
|
+
root.append(firstChild);
|
|
7963
|
+
}
|
|
7964
|
+
});
|
|
7965
|
+
newItems.push({
|
|
7966
|
+
id: nanoid6(),
|
|
7967
|
+
correct: false,
|
|
7968
|
+
account: newAccountContent,
|
|
7969
|
+
credit: void 0,
|
|
7970
|
+
debit: void 0
|
|
7971
|
+
});
|
|
7972
|
+
writable.__lineItems = newItems;
|
|
7973
|
+
}
|
|
7974
|
+
writable.__journalType = journalType;
|
|
7975
|
+
}
|
|
7976
|
+
addItem(itemIndex, correct) {
|
|
7977
|
+
const newItemIndex = itemIndex + 1;
|
|
7978
|
+
const writable = this.getWritable();
|
|
7979
|
+
const newItems = [...writable.__lineItems];
|
|
7980
|
+
newItems.splice(newItemIndex, 0, {
|
|
7981
|
+
id: nanoid6(),
|
|
7982
|
+
correct,
|
|
7983
|
+
account: initNewContentEditor4(),
|
|
7984
|
+
credit: correct ? initNewContentEditor4() : void 0,
|
|
7985
|
+
debit: correct ? initNewContentEditor4() : void 0
|
|
7986
|
+
});
|
|
7987
|
+
writable.__lineItems = newItems;
|
|
7988
|
+
}
|
|
7989
|
+
removeItem(itemIndex) {
|
|
7990
|
+
if (this.__lineItems.length > 1 && this.__lineItems.length > itemIndex) {
|
|
7991
|
+
const writable = this.getWritable();
|
|
7992
|
+
const newItems = [...writable.__lineItems];
|
|
7993
|
+
newItems.splice(itemIndex, 1);
|
|
7994
|
+
writable.__lineItems = newItems;
|
|
7995
|
+
}
|
|
7959
7996
|
}
|
|
7960
7997
|
decorate() {
|
|
7961
|
-
return /* @__PURE__ */
|
|
7962
|
-
|
|
7998
|
+
return /* @__PURE__ */ jsx67(
|
|
7999
|
+
JournalEntryQuestionComponent,
|
|
7963
8000
|
{
|
|
7964
8001
|
nodeKey: this.__key,
|
|
7965
|
-
|
|
7966
|
-
|
|
8002
|
+
journalType: this.__journalType,
|
|
8003
|
+
lineItems: this.__lineItems,
|
|
8004
|
+
id: this.__id
|
|
7967
8005
|
}
|
|
7968
8006
|
);
|
|
7969
8007
|
}
|
|
7970
8008
|
};
|
|
7971
|
-
function $
|
|
8009
|
+
function $createJournalEntryQuestionNode(points, journalType, errorTolerance, lineItems, id) {
|
|
7972
8010
|
return $applyNodeReplacement9(
|
|
7973
|
-
new
|
|
8011
|
+
new JournalEntryQuestionNode(
|
|
8012
|
+
points,
|
|
8013
|
+
journalType || "default",
|
|
8014
|
+
errorTolerance,
|
|
8015
|
+
lineItems,
|
|
8016
|
+
id
|
|
8017
|
+
)
|
|
7974
8018
|
);
|
|
7975
8019
|
}
|
|
7976
|
-
function $
|
|
7977
|
-
return node instanceof
|
|
8020
|
+
function $isJournalEntryQuestionNode(node) {
|
|
8021
|
+
return node instanceof JournalEntryQuestionNode;
|
|
7978
8022
|
}
|
|
7979
8023
|
|
|
7980
|
-
// src/plugins/
|
|
8024
|
+
// src/plugins/TextToolbarPlugin/TextToolbarAgentPlugin.tsx
|
|
8025
|
+
import { useLexicalComposerContext as useLexicalComposerContext34 } from "@lexical/react/LexicalComposerContext";
|
|
8026
|
+
import { mergeRegister as mergeRegister9 } from "@lexical/utils";
|
|
7981
8027
|
import {
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
|
|
8028
|
+
COMMAND_PRIORITY_EDITOR as COMMAND_PRIORITY_EDITOR5,
|
|
8029
|
+
SELECTION_CHANGE_COMMAND as SELECTION_CHANGE_COMMAND3,
|
|
8030
|
+
createCommand as createCommand8
|
|
7985
8031
|
} from "lexical";
|
|
7986
|
-
import {
|
|
8032
|
+
import { useEffect as useEffect39 } from "react";
|
|
8033
|
+
import { Fragment as Fragment24, jsx as jsx68 } from "react/jsx-runtime";
|
|
8034
|
+
var TEXT_TOOLBAR_SELECTION_CHANGE_COMMAND = createCommand8("TEXT_TOOLBAR_SELECTION_CHANGE_COMMAND");
|
|
8035
|
+
function TextToolbarAgentPlugin(props) {
|
|
8036
|
+
const { decoratorNode } = props;
|
|
8037
|
+
const [editor] = useLexicalComposerContext34();
|
|
8038
|
+
useEffect39(() => {
|
|
8039
|
+
return mergeRegister9(
|
|
8040
|
+
editor.registerCommand(
|
|
8041
|
+
SELECTION_CHANGE_COMMAND3,
|
|
8042
|
+
(_payload, activeEditor) => {
|
|
8043
|
+
if (editor === activeEditor) {
|
|
8044
|
+
activeEditor.dispatchCommand(
|
|
8045
|
+
TEXT_TOOLBAR_SELECTION_CHANGE_COMMAND,
|
|
8046
|
+
{ decoratorNode }
|
|
8047
|
+
);
|
|
8048
|
+
}
|
|
8049
|
+
return false;
|
|
8050
|
+
},
|
|
8051
|
+
COMMAND_PRIORITY_EDITOR5
|
|
8052
|
+
),
|
|
8053
|
+
editor.registerUpdateListener(({ tags }) => {
|
|
8054
|
+
if (!tags.has("history-merge")) {
|
|
8055
|
+
editor.dispatchCommand(
|
|
8056
|
+
TEXT_TOOLBAR_SELECTION_CHANGE_COMMAND,
|
|
8057
|
+
{ decoratorNode }
|
|
8058
|
+
);
|
|
8059
|
+
}
|
|
8060
|
+
})
|
|
8061
|
+
);
|
|
8062
|
+
}, [editor]);
|
|
8063
|
+
return /* @__PURE__ */ jsx68(Fragment24, {});
|
|
8064
|
+
}
|
|
8065
|
+
|
|
8066
|
+
// src/plugins/TypeaheadMenuPlugin/TypeaheadMenuAgentPlugin.tsx
|
|
8067
|
+
import { useLexicalComposerContext as useLexicalComposerContext35 } from "@lexical/react/LexicalComposerContext";
|
|
8068
|
+
import { mergeRegister as mergeRegister10 } from "@lexical/utils";
|
|
8069
|
+
import { createCommand as createCommand9 } from "lexical";
|
|
8070
|
+
import { useEffect as useEffect40 } from "react";
|
|
8071
|
+
import { Fragment as Fragment25, jsx as jsx69 } from "react/jsx-runtime";
|
|
8072
|
+
var TYPEAHEAD_MENU_COMMAND = createCommand9("TEXT_TOOLBAR_SELECTION_CHANGE_COMMAND");
|
|
8073
|
+
function TypeaheadMenuAgentPlugin(props) {
|
|
8074
|
+
const { decoratorNode } = props;
|
|
8075
|
+
const [editor] = useLexicalComposerContext35();
|
|
8076
|
+
useEffect40(() => {
|
|
8077
|
+
return mergeRegister10(
|
|
8078
|
+
editor.registerUpdateListener(({ tags }) => {
|
|
8079
|
+
if (!tags.has("history-merge")) {
|
|
8080
|
+
editor.dispatchCommand(TYPEAHEAD_MENU_COMMAND, {
|
|
8081
|
+
decoratorNode
|
|
8082
|
+
});
|
|
8083
|
+
}
|
|
8084
|
+
})
|
|
8085
|
+
);
|
|
8086
|
+
}, [editor, decoratorNode]);
|
|
8087
|
+
return /* @__PURE__ */ jsx69(Fragment25, {});
|
|
8088
|
+
}
|
|
7987
8089
|
|
|
7988
|
-
// src/plugins/
|
|
8090
|
+
// src/plugins/FillInTheBlankQuestionPlugin/FillInTheBlankQuestionComponent.tsx
|
|
7989
8091
|
import { useLexicalComposerContext as useLexicalComposerContext37 } from "@lexical/react/LexicalComposerContext";
|
|
7990
8092
|
import { LexicalErrorBoundary as LexicalErrorBoundary7 } from "@lexical/react/LexicalErrorBoundary";
|
|
7991
8093
|
import { HistoryPlugin as HistoryPlugin7 } from "@lexical/react/LexicalHistoryPlugin";
|
|
8094
|
+
import { ListPlugin as ListPlugin2 } from "@lexical/react/LexicalListPlugin";
|
|
7992
8095
|
import { LexicalNestedComposer as LexicalNestedComposer7 } from "@lexical/react/LexicalNestedComposer";
|
|
7993
8096
|
import { RichTextPlugin as RichTextPlugin7 } from "@lexical/react/LexicalRichTextPlugin";
|
|
8097
|
+
import { TabIndentationPlugin as TabIndentationPlugin2 } from "@lexical/react/LexicalTabIndentationPlugin";
|
|
7994
8098
|
import {
|
|
7995
8099
|
$createNodeSelection as $createNodeSelection9,
|
|
7996
8100
|
$getNodeByKey as $getNodeByKey28,
|
|
7997
8101
|
$setSelection as $setSelection9,
|
|
7998
8102
|
CLICK_COMMAND as CLICK_COMMAND9,
|
|
7999
|
-
COMMAND_PRIORITY_LOW as COMMAND_PRIORITY_LOW8
|
|
8103
|
+
COMMAND_PRIORITY_LOW as COMMAND_PRIORITY_LOW8,
|
|
8104
|
+
createCommand as createCommand10
|
|
8000
8105
|
} from "lexical";
|
|
8001
8106
|
import { useEffect as useEffect42, useRef as useRef26 } from "react";
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
const
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
8011
|
-
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8107
|
+
|
|
8108
|
+
// src/utils/extractSelectionNode.ts
|
|
8109
|
+
import { $getSelection as $getSelection2, $isRangeSelection } from "lexical";
|
|
8110
|
+
function $extractSelectionNode() {
|
|
8111
|
+
const selection = $getSelection2();
|
|
8112
|
+
if (!$isRangeSelection(selection) || selection.isCollapsed()) {
|
|
8113
|
+
return null;
|
|
8114
|
+
}
|
|
8115
|
+
const anchor = selection.anchor;
|
|
8116
|
+
if (anchor.type !== "text") {
|
|
8117
|
+
return null;
|
|
8118
|
+
}
|
|
8119
|
+
const anchorNode = anchor.getNode();
|
|
8120
|
+
if (!anchorNode.isSimpleText()) {
|
|
8121
|
+
return null;
|
|
8122
|
+
}
|
|
8123
|
+
const focus = selection.focus;
|
|
8124
|
+
const startOffset = Math.min(anchor.offset, focus.offset);
|
|
8125
|
+
let selectionOffset = Math.max(anchor.offset, focus.offset);
|
|
8126
|
+
if (startOffset < 0) {
|
|
8127
|
+
return null;
|
|
8128
|
+
}
|
|
8129
|
+
const textContent = anchorNode.getTextContent().slice(startOffset, selectionOffset);
|
|
8130
|
+
if (!textContent) {
|
|
8131
|
+
return null;
|
|
8132
|
+
}
|
|
8133
|
+
const textLength = textContent.length;
|
|
8134
|
+
const validTextLength = textContent.trim().length;
|
|
8135
|
+
selectionOffset -= textLength - validTextLength;
|
|
8136
|
+
let newNode;
|
|
8137
|
+
if (startOffset === 0) {
|
|
8138
|
+
[newNode] = anchorNode.splitText(selectionOffset);
|
|
8139
|
+
} else {
|
|
8140
|
+
[, newNode] = anchorNode.splitText(startOffset, selectionOffset);
|
|
8141
|
+
}
|
|
8142
|
+
return newNode;
|
|
8143
|
+
}
|
|
8144
|
+
|
|
8145
|
+
// src/plugins/FillInTheBlankQuestionPlugin/FillInTheBlankSpaceComponentPlugin.tsx
|
|
8146
|
+
import { useLexicalComposerContext as useLexicalComposerContext36 } from "@lexical/react/LexicalComposerContext";
|
|
8147
|
+
import { mergeRegister as mergeRegister11 } from "@lexical/utils";
|
|
8148
|
+
import {
|
|
8149
|
+
$createNodeSelection as $createNodeSelection8,
|
|
8150
|
+
$getSelection as $getSelection3,
|
|
8151
|
+
$isRangeSelection as $isRangeSelection2,
|
|
8152
|
+
$setSelection as $setSelection8,
|
|
8153
|
+
CLICK_COMMAND as CLICK_COMMAND8,
|
|
8154
|
+
COMMAND_PRIORITY_EDITOR as COMMAND_PRIORITY_EDITOR6,
|
|
8155
|
+
COMMAND_PRIORITY_HIGH as COMMAND_PRIORITY_HIGH2,
|
|
8156
|
+
KEY_ARROW_DOWN_COMMAND,
|
|
8157
|
+
KEY_ARROW_LEFT_COMMAND,
|
|
8158
|
+
KEY_ARROW_RIGHT_COMMAND,
|
|
8159
|
+
KEY_ARROW_UP_COMMAND,
|
|
8160
|
+
SELECTION_CHANGE_COMMAND as SELECTION_CHANGE_COMMAND4
|
|
8161
|
+
} from "lexical";
|
|
8162
|
+
import { useEffect as useEffect41, useRef as useRef25 } from "react";
|
|
8163
|
+
import { Fragment as Fragment26, jsx as jsx70 } from "react/jsx-runtime";
|
|
8164
|
+
function FillInTheBlankSpaceComponentPlugin() {
|
|
8165
|
+
const { nestedEditorId } = useNestedEditor();
|
|
8166
|
+
const [editor] = useLexicalComposerContext36();
|
|
8167
|
+
const lastSelectedNodeRef = useRef25(
|
|
8168
|
+
void 0
|
|
8169
|
+
);
|
|
8170
|
+
const selectedSpaceNodeKeyRef = useRef25(void 0);
|
|
8171
|
+
useEffect41(() => {
|
|
8172
|
+
return mergeRegister11(
|
|
8173
|
+
editor.registerCommand(
|
|
8174
|
+
CREATE_SPACE_FROM_SELECTION_COMMAND,
|
|
8175
|
+
() => {
|
|
8176
|
+
const textNode = $extractSelectionNode();
|
|
8177
|
+
if (textNode) {
|
|
8178
|
+
const spaceName = textNode.getTextContent();
|
|
8179
|
+
const newSpaceNode = $createFillInTheBlankSpaceNode(spaceName);
|
|
8180
|
+
textNode.replace(newSpaceNode);
|
|
8181
|
+
textNode.getParent()?.selectEnd();
|
|
8182
|
+
}
|
|
8183
|
+
return true;
|
|
8184
|
+
},
|
|
8185
|
+
COMMAND_PRIORITY_EDITOR6
|
|
8186
|
+
),
|
|
8187
|
+
// todo: extract this as a separate plugin
|
|
8188
|
+
// that tracks clicks on decorators and manages arrow keys
|
|
8189
|
+
editor.registerCommand(
|
|
8190
|
+
CLICK_COMMAND8,
|
|
8191
|
+
(payload) => {
|
|
8192
|
+
if (payload.target) {
|
|
8193
|
+
const spaceNodeKey = payload.target.getAttribute("data-block-editor-space");
|
|
8194
|
+
if (spaceNodeKey) {
|
|
8195
|
+
selectedSpaceNodeKeyRef.current = spaceNodeKey;
|
|
8196
|
+
editor.update(() => {
|
|
8197
|
+
const newSelection = $createNodeSelection8();
|
|
8198
|
+
newSelection.add(spaceNodeKey);
|
|
8199
|
+
$setSelection8(newSelection);
|
|
8200
|
+
});
|
|
8201
|
+
return true;
|
|
8021
8202
|
}
|
|
8022
|
-
});
|
|
8023
|
-
}
|
|
8024
|
-
return false;
|
|
8025
|
-
},
|
|
8026
|
-
COMMAND_PRIORITY_LOW8
|
|
8027
|
-
);
|
|
8028
|
-
}, [editor]);
|
|
8029
|
-
return /* @__PURE__ */ jsxs26(
|
|
8030
|
-
"div",
|
|
8031
|
-
{
|
|
8032
|
-
ref: rootElementRef,
|
|
8033
|
-
id,
|
|
8034
|
-
className: "financial-statement-question-prompt",
|
|
8035
|
-
children: [
|
|
8036
|
-
/* @__PURE__ */ jsx71(
|
|
8037
|
-
"div",
|
|
8038
|
-
{
|
|
8039
|
-
className: "financial-statement-question-prompt-title",
|
|
8040
|
-
"data-selectable": "true",
|
|
8041
|
-
children: "Financial Statement"
|
|
8042
8203
|
}
|
|
8043
|
-
|
|
8044
|
-
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
|
|
8053
|
-
|
|
8054
|
-
|
|
8055
|
-
|
|
8056
|
-
|
|
8057
|
-
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
|
|
8072
|
-
}
|
|
8073
|
-
|
|
8074
|
-
columnHeaders.length >= 2 && /* @__PURE__ */ jsxs26("tr", { "data-selectable": "true", children: [
|
|
8075
|
-
/* @__PURE__ */ jsx71(
|
|
8076
|
-
"th",
|
|
8077
|
-
{
|
|
8078
|
-
"data-selectable": "true",
|
|
8079
|
-
style: { textAlign: "left" },
|
|
8080
|
-
children: columnHeaders[0]
|
|
8081
|
-
}
|
|
8082
|
-
),
|
|
8083
|
-
/* @__PURE__ */ jsx71(
|
|
8084
|
-
"th",
|
|
8085
|
-
{
|
|
8086
|
-
"data-selectable": "true",
|
|
8087
|
-
style: { textAlign: "right" },
|
|
8088
|
-
children: columnHeaders[1]
|
|
8089
|
-
}
|
|
8090
|
-
)
|
|
8091
|
-
] })
|
|
8092
|
-
] }),
|
|
8093
|
-
/* @__PURE__ */ jsxs26("tbody", { children: [
|
|
8094
|
-
rows.map(
|
|
8095
|
-
(rowItem, rowItemIndex) => {
|
|
8096
|
-
if (rowItem.type === "Heading") {
|
|
8097
|
-
return /* @__PURE__ */ jsxs26("tr", { "data-selectable": "true", children: [
|
|
8098
|
-
/* @__PURE__ */ jsx71("td", { "data-selectable": "true", children: /* @__PURE__ */ jsx71(
|
|
8099
|
-
"strong",
|
|
8100
|
-
{
|
|
8101
|
-
style: {
|
|
8102
|
-
paddingLeft: `calc(1em * ${rowItem.depth})`
|
|
8103
|
-
},
|
|
8104
|
-
children: rowItem.entry
|
|
8105
|
-
}
|
|
8106
|
-
) }),
|
|
8107
|
-
/* @__PURE__ */ jsx71(
|
|
8108
|
-
"td",
|
|
8109
|
-
{
|
|
8110
|
-
className: "financial-statement-question-cell",
|
|
8111
|
-
"data-selectable": "true",
|
|
8112
|
-
children: /* @__PURE__ */ jsxs26("div", { className: "financial-statement-question-cell-id", children: [
|
|
8113
|
-
"A",
|
|
8114
|
-
rowItemIndex + 1
|
|
8115
|
-
] })
|
|
8116
|
-
}
|
|
8117
|
-
)
|
|
8118
|
-
] }, rowItem.id);
|
|
8119
|
-
} else if (rowItem.type === "Line") {
|
|
8120
|
-
return /* @__PURE__ */ jsxs26("tr", { "data-selectable": "true", children: [
|
|
8121
|
-
/* @__PURE__ */ jsx71("td", { "data-selectable": "true", children: /* @__PURE__ */ jsx71(
|
|
8122
|
-
"span",
|
|
8123
|
-
{
|
|
8124
|
-
style: {
|
|
8125
|
-
paddingLeft: `calc(1em * ${rowItem.depth})`
|
|
8126
|
-
},
|
|
8127
|
-
children: rowItem.entry
|
|
8128
|
-
}
|
|
8129
|
-
) }),
|
|
8130
|
-
/* @__PURE__ */ jsxs26(
|
|
8131
|
-
"td",
|
|
8132
|
-
{
|
|
8133
|
-
className: "financial-statement-question-cell",
|
|
8134
|
-
"data-selectable": "true",
|
|
8135
|
-
children: [
|
|
8136
|
-
/* @__PURE__ */ jsxs26("div", { className: "financial-statement-question-cell-id", children: [
|
|
8137
|
-
"A",
|
|
8138
|
-
rowItemIndex + 1
|
|
8139
|
-
] }),
|
|
8140
|
-
/* @__PURE__ */ jsx71(
|
|
8141
|
-
LexicalNestedComposer7,
|
|
8142
|
-
{
|
|
8143
|
-
initialEditor: rowItem.amount,
|
|
8144
|
-
children: /* @__PURE__ */ jsxs26(NestedEditor, { nodeKey, children: [
|
|
8145
|
-
/* @__PURE__ */ jsx71(SettingsPanelNestedAgentPlugin, {}),
|
|
8146
|
-
/* @__PURE__ */ jsx71(
|
|
8147
|
-
RichTextPlugin7,
|
|
8148
|
-
{
|
|
8149
|
-
contentEditable: /* @__PURE__ */ jsx71(NestedContentEditable, {}),
|
|
8150
|
-
ErrorBoundary: LexicalErrorBoundary7,
|
|
8151
|
-
placeholder: null
|
|
8152
|
-
},
|
|
8153
|
-
nodeKey
|
|
8154
|
-
),
|
|
8155
|
-
/* @__PURE__ */ jsx71(
|
|
8156
|
-
HistoryPlugin7,
|
|
8157
|
-
{
|
|
8158
|
-
externalHistoryState: historyState
|
|
8159
|
-
}
|
|
8160
|
-
),
|
|
8161
|
-
/* @__PURE__ */ jsx71(TypeaheadVariableAgentPlugin, {}),
|
|
8162
|
-
/* @__PURE__ */ jsx71(VariableComponentPlugin, {})
|
|
8163
|
-
] })
|
|
8164
|
-
}
|
|
8165
|
-
)
|
|
8166
|
-
]
|
|
8167
|
-
}
|
|
8168
|
-
)
|
|
8169
|
-
] }, rowItem.id);
|
|
8170
|
-
}
|
|
8204
|
+
selectedSpaceNodeKeyRef.current = void 0;
|
|
8205
|
+
return false;
|
|
8206
|
+
},
|
|
8207
|
+
COMMAND_PRIORITY_HIGH2
|
|
8208
|
+
),
|
|
8209
|
+
editor.registerCommand(
|
|
8210
|
+
SELECTION_CHANGE_COMMAND4,
|
|
8211
|
+
() => {
|
|
8212
|
+
const selection = $getSelection3();
|
|
8213
|
+
if ($isRangeSelection2(selection)) {
|
|
8214
|
+
lastSelectedNodeRef.current = selection.anchor.getNode();
|
|
8215
|
+
}
|
|
8216
|
+
return false;
|
|
8217
|
+
},
|
|
8218
|
+
COMMAND_PRIORITY_EDITOR6
|
|
8219
|
+
),
|
|
8220
|
+
...[
|
|
8221
|
+
KEY_ARROW_UP_COMMAND,
|
|
8222
|
+
KEY_ARROW_RIGHT_COMMAND,
|
|
8223
|
+
KEY_ARROW_DOWN_COMMAND,
|
|
8224
|
+
KEY_ARROW_LEFT_COMMAND
|
|
8225
|
+
].map(
|
|
8226
|
+
(keyCommand) => editor.registerCommand(
|
|
8227
|
+
keyCommand,
|
|
8228
|
+
() => {
|
|
8229
|
+
if (selectedSpaceNodeKeyRef.current) {
|
|
8230
|
+
selectedSpaceNodeKeyRef.current = void 0;
|
|
8231
|
+
if (lastSelectedNodeRef.current) {
|
|
8232
|
+
lastSelectedNodeRef.current.select();
|
|
8233
|
+
} else {
|
|
8234
|
+
editor.focus();
|
|
8171
8235
|
}
|
|
8172
|
-
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
|
|
8184
|
-
|
|
8236
|
+
}
|
|
8237
|
+
return false;
|
|
8238
|
+
},
|
|
8239
|
+
COMMAND_PRIORITY_EDITOR6
|
|
8240
|
+
)
|
|
8241
|
+
)
|
|
8242
|
+
);
|
|
8243
|
+
}, [editor, nestedEditorId]);
|
|
8244
|
+
return /* @__PURE__ */ jsx70(Fragment26, {});
|
|
8245
|
+
}
|
|
8246
|
+
|
|
8247
|
+
// src/plugins/FillInTheBlankQuestionPlugin/FillInTheBlankQuestionComponent.tsx
|
|
8248
|
+
import { jsx as jsx71, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
8249
|
+
var CREATE_SPACE_FROM_SELECTION_COMMAND = createCommand10("CREATE_SPACE_FROM_SELECTION_COMMAND");
|
|
8250
|
+
function FillInTheBlankQuestionComponent(props) {
|
|
8251
|
+
const { nodeKey, id, content } = props;
|
|
8252
|
+
const { historyState } = useSharedHistoryContext();
|
|
8253
|
+
const [editor] = useLexicalComposerContext37();
|
|
8254
|
+
const rootElementRef = useRef26(null);
|
|
8255
|
+
useEffect42(() => {
|
|
8256
|
+
return editor.registerCommand(
|
|
8257
|
+
CLICK_COMMAND9,
|
|
8258
|
+
(event, _activeEditor) => {
|
|
8259
|
+
if (!event.target.hasAttribute(
|
|
8260
|
+
"data-block-editor-space"
|
|
8261
|
+
)) {
|
|
8262
|
+
if (rootElementRef.current?.contains(event.target) && event.target.hasAttribute(
|
|
8263
|
+
"data-selectable"
|
|
8264
|
+
)) {
|
|
8265
|
+
editor.update(() => {
|
|
8266
|
+
const foundNode = $getNodeByKey28(nodeKey);
|
|
8267
|
+
if ($isFillInTheBlankQuestionNode(foundNode)) {
|
|
8268
|
+
const selection = $createNodeSelection9();
|
|
8269
|
+
selection.add(nodeKey);
|
|
8270
|
+
$setSelection9(selection);
|
|
8185
8271
|
}
|
|
8186
|
-
)
|
|
8187
|
-
|
|
8188
|
-
|
|
8272
|
+
});
|
|
8273
|
+
}
|
|
8274
|
+
}
|
|
8275
|
+
return false;
|
|
8276
|
+
},
|
|
8277
|
+
COMMAND_PRIORITY_LOW8
|
|
8278
|
+
);
|
|
8279
|
+
}, [editor]);
|
|
8280
|
+
return /* @__PURE__ */ jsxs26(
|
|
8281
|
+
"div",
|
|
8282
|
+
{
|
|
8283
|
+
ref: rootElementRef,
|
|
8284
|
+
id,
|
|
8285
|
+
className: "fill-in-the-blank-question-prompt",
|
|
8286
|
+
children: [
|
|
8287
|
+
/* @__PURE__ */ jsx71(
|
|
8288
|
+
"div",
|
|
8289
|
+
{
|
|
8290
|
+
className: "fill-in-the-blank-question-prompt-title",
|
|
8291
|
+
"data-selectable": "true",
|
|
8292
|
+
children: "Fill In The Blank"
|
|
8293
|
+
}
|
|
8294
|
+
),
|
|
8295
|
+
/* @__PURE__ */ jsxs26(
|
|
8296
|
+
"div",
|
|
8297
|
+
{
|
|
8298
|
+
className: "fill-in-the-blank-question-prompt-content",
|
|
8299
|
+
"data-selectable": "true",
|
|
8300
|
+
children: [
|
|
8301
|
+
/* @__PURE__ */ jsx71("div", { className: "title", "data-selectable": "true", children: "Statement" }),
|
|
8302
|
+
/* @__PURE__ */ jsx71(LexicalNestedComposer7, { initialEditor: content, children: /* @__PURE__ */ jsxs26(NestedEditor, { nodeKey, children: [
|
|
8303
|
+
/* @__PURE__ */ jsx71(SettingsPanelNestedAgentPlugin, {}),
|
|
8304
|
+
/* @__PURE__ */ jsx71(FillInTheBlankSpaceComponentPlugin, {}),
|
|
8305
|
+
/* @__PURE__ */ jsx71(FillInTheBlankSpaceSettingsPlugin, {}),
|
|
8306
|
+
/* @__PURE__ */ jsx71(
|
|
8307
|
+
RichTextPlugin7,
|
|
8308
|
+
{
|
|
8309
|
+
contentEditable: /* @__PURE__ */ jsx71(NestedContentEditable, {}),
|
|
8310
|
+
ErrorBoundary: LexicalErrorBoundary7,
|
|
8311
|
+
placeholder: null
|
|
8312
|
+
},
|
|
8313
|
+
nodeKey
|
|
8314
|
+
),
|
|
8315
|
+
/* @__PURE__ */ jsx71(HistoryPlugin7, { externalHistoryState: historyState }),
|
|
8316
|
+
/* @__PURE__ */ jsx71(
|
|
8317
|
+
TextToolbarAgentPlugin,
|
|
8318
|
+
{
|
|
8319
|
+
decoratorNode: FillInTheBlankQuestionNode
|
|
8320
|
+
}
|
|
8321
|
+
),
|
|
8322
|
+
/* @__PURE__ */ jsx71(
|
|
8323
|
+
TypeaheadVariableAgentPlugin,
|
|
8324
|
+
{
|
|
8325
|
+
decoratorNode: FillInTheBlankQuestionNode
|
|
8326
|
+
}
|
|
8327
|
+
),
|
|
8328
|
+
/* @__PURE__ */ jsx71(VariableComponentPlugin, {}),
|
|
8329
|
+
/* @__PURE__ */ jsx71(VariableToolbarAgentPlugin, {}),
|
|
8330
|
+
/* @__PURE__ */ jsx71(
|
|
8331
|
+
TypeaheadMenuAgentPlugin,
|
|
8332
|
+
{
|
|
8333
|
+
decoratorNode: FillInTheBlankQuestionNode
|
|
8334
|
+
}
|
|
8335
|
+
),
|
|
8336
|
+
/* @__PURE__ */ jsx71(ListPlugin2, {}),
|
|
8337
|
+
/* @__PURE__ */ jsx71(ListLevelLimitPlugin, {}),
|
|
8338
|
+
/* @__PURE__ */ jsx71(Table, {}),
|
|
8339
|
+
/* @__PURE__ */ jsx71(TabIndentationPlugin2, {})
|
|
8340
|
+
] }) })
|
|
8341
|
+
]
|
|
8342
|
+
}
|
|
8343
|
+
)
|
|
8189
8344
|
]
|
|
8190
8345
|
}
|
|
8191
8346
|
);
|
|
8192
8347
|
}
|
|
8193
8348
|
|
|
8194
|
-
// src/plugins/
|
|
8195
|
-
var isSerializableFinancialStatementHeading = (row) => {
|
|
8196
|
-
return row.type === "Heading";
|
|
8197
|
-
};
|
|
8198
|
-
|
|
8199
|
-
// src/plugins/FinancialStatementQuestionPlugin/isSerializableFinancialStatementLine.ts
|
|
8200
|
-
var isSerializableFinancialStatementLine = (row) => {
|
|
8201
|
-
return row.type === "Line";
|
|
8202
|
-
};
|
|
8203
|
-
|
|
8204
|
-
// src/plugins/FinancialStatementQuestionPlugin/FinancialStatementQuestionNode.tsx
|
|
8349
|
+
// src/plugins/FillInTheBlankQuestionPlugin/FillInTheBlankQuestionNode.tsx
|
|
8205
8350
|
import { jsx as jsx72 } from "react/jsx-runtime";
|
|
8206
|
-
var TYPE_NAME9 = "
|
|
8207
|
-
|
|
8208
|
-
return
|
|
8209
|
-
}
|
|
8210
|
-
var
|
|
8211
|
-
|
|
8212
|
-
};
|
|
8213
|
-
var FinancialStatementQuestionNode = class _FinancialStatementQuestionNode extends DecoratorNode10 {
|
|
8214
|
-
constructor(points, header, columnHeaders, rows, distractors, id, key) {
|
|
8351
|
+
var TYPE_NAME9 = "fill-in-the-blank-question";
|
|
8352
|
+
function initNewContentEditor5() {
|
|
8353
|
+
return createEditor7();
|
|
8354
|
+
}
|
|
8355
|
+
var FillInTheBlankQuestionNode = class _FillInTheBlankQuestionNode extends DecoratorNode10 {
|
|
8356
|
+
constructor(pointsPerSpace, id, content, key) {
|
|
8215
8357
|
super(key);
|
|
8216
8358
|
this.__id = id || nanoid7();
|
|
8217
|
-
this.
|
|
8218
|
-
this.
|
|
8219
|
-
this.__columnHeaders = columnHeaders;
|
|
8220
|
-
this.__rows = rows;
|
|
8221
|
-
this.__distractors = distractors;
|
|
8359
|
+
this.__pointsPerSpace = pointsPerSpace < 0 ? 1 : pointsPerSpace;
|
|
8360
|
+
this.__content = content || initNewContentEditor5();
|
|
8222
8361
|
}
|
|
8223
8362
|
static getType() {
|
|
8224
8363
|
return TYPE_NAME9;
|
|
8225
8364
|
}
|
|
8226
8365
|
static clone(node) {
|
|
8227
|
-
return new
|
|
8228
|
-
node.
|
|
8229
|
-
node.__header,
|
|
8230
|
-
node.__columnHeaders,
|
|
8231
|
-
node.__rows,
|
|
8232
|
-
node.__distractors,
|
|
8366
|
+
return new _FillInTheBlankQuestionNode(
|
|
8367
|
+
node.__pointsPerSpace,
|
|
8233
8368
|
node.__id,
|
|
8369
|
+
node.__content,
|
|
8234
8370
|
node.__key
|
|
8235
8371
|
);
|
|
8236
8372
|
}
|
|
8237
8373
|
__createWrapper() {
|
|
8238
8374
|
const wrapper = document.createElement("div");
|
|
8239
|
-
wrapper.classList.add("
|
|
8375
|
+
wrapper.classList.add("fill-in-the-blank-question-wrapper");
|
|
8240
8376
|
return wrapper;
|
|
8241
8377
|
}
|
|
8242
8378
|
createDOM() {
|
|
@@ -8253,86 +8389,24 @@ var FinancialStatementQuestionNode = class _FinancialStatementQuestionNode exten
|
|
|
8253
8389
|
return null;
|
|
8254
8390
|
}
|
|
8255
8391
|
static importJSON(serializedNode) {
|
|
8256
|
-
const
|
|
8257
|
-
const editorState =
|
|
8258
|
-
serializedNode.
|
|
8392
|
+
const nestedEditor = createEditor7();
|
|
8393
|
+
const editorState = nestedEditor.parseEditorState(
|
|
8394
|
+
serializedNode.content.editorState
|
|
8259
8395
|
);
|
|
8260
8396
|
if (!editorState.isEmpty()) {
|
|
8261
|
-
|
|
8262
|
-
}
|
|
8263
|
-
const restoredRows = [];
|
|
8264
|
-
for (const row of serializedNode.rows) {
|
|
8265
|
-
if (isSerializableFinancialStatementHeading(row)) {
|
|
8266
|
-
restoredRows.push({
|
|
8267
|
-
type: row.type,
|
|
8268
|
-
id: row.id,
|
|
8269
|
-
depth: row.depth,
|
|
8270
|
-
entry: row.entry,
|
|
8271
|
-
isHint: row.isHint
|
|
8272
|
-
});
|
|
8273
|
-
continue;
|
|
8274
|
-
}
|
|
8275
|
-
if (isSerializableFinancialStatementLine(row)) {
|
|
8276
|
-
const amountNestedEditor = createEditor7();
|
|
8277
|
-
const editorState2 = amountNestedEditor.parseEditorState(
|
|
8278
|
-
row.amount.editorState
|
|
8279
|
-
);
|
|
8280
|
-
if (!editorState2.isEmpty()) {
|
|
8281
|
-
amountNestedEditor.setEditorState(editorState2);
|
|
8282
|
-
}
|
|
8283
|
-
restoredRows.push({
|
|
8284
|
-
type: row.type,
|
|
8285
|
-
id: row.id,
|
|
8286
|
-
depth: row.depth,
|
|
8287
|
-
entry: row.entry,
|
|
8288
|
-
amount: amountNestedEditor,
|
|
8289
|
-
isEntryHint: row.isEntryHint,
|
|
8290
|
-
isAmountHint: row.isAmountHint,
|
|
8291
|
-
role: row.role
|
|
8292
|
-
});
|
|
8293
|
-
continue;
|
|
8294
|
-
}
|
|
8397
|
+
nestedEditor.setEditorState(editorState);
|
|
8295
8398
|
}
|
|
8296
|
-
return $
|
|
8297
|
-
serializedNode.
|
|
8298
|
-
|
|
8299
|
-
|
|
8300
|
-
restoredRows,
|
|
8301
|
-
serializedNode.distractors,
|
|
8302
|
-
serializedNode.id
|
|
8399
|
+
return $createFillInTheBlankQuestionNode(
|
|
8400
|
+
serializedNode.pointsPerSpace,
|
|
8401
|
+
serializedNode.id,
|
|
8402
|
+
nestedEditor
|
|
8303
8403
|
);
|
|
8304
8404
|
}
|
|
8305
8405
|
exportJSON() {
|
|
8306
8406
|
return {
|
|
8307
8407
|
id: this.__id,
|
|
8308
|
-
|
|
8309
|
-
|
|
8310
|
-
columnHeaders: this.__columnHeaders,
|
|
8311
|
-
rows: this.__rows.map((row) => {
|
|
8312
|
-
if (isFinancialStatementHeading(row)) {
|
|
8313
|
-
return {
|
|
8314
|
-
type: row.type,
|
|
8315
|
-
id: row.id,
|
|
8316
|
-
depth: row.depth,
|
|
8317
|
-
entry: row.entry,
|
|
8318
|
-
isHint: row.isHint
|
|
8319
|
-
};
|
|
8320
|
-
}
|
|
8321
|
-
if (isFinancialStatementLine(row)) {
|
|
8322
|
-
return {
|
|
8323
|
-
type: row.type,
|
|
8324
|
-
id: row.id,
|
|
8325
|
-
depth: row.depth,
|
|
8326
|
-
entry: row.entry,
|
|
8327
|
-
amount: row.amount.toJSON(),
|
|
8328
|
-
isEntryHint: row.isEntryHint,
|
|
8329
|
-
isAmountHint: row.isAmountHint,
|
|
8330
|
-
role: row.role
|
|
8331
|
-
};
|
|
8332
|
-
}
|
|
8333
|
-
throw new Error("Invalid row type");
|
|
8334
|
-
}).filter(Boolean),
|
|
8335
|
-
distractors: this.__distractors,
|
|
8408
|
+
pointsPerSpace: this.__pointsPerSpace,
|
|
8409
|
+
content: this.__content.toJSON(),
|
|
8336
8410
|
type: TYPE_NAME9,
|
|
8337
8411
|
version: 1
|
|
8338
8412
|
};
|
|
@@ -8349,38 +8423,28 @@ var FinancialStatementQuestionNode = class _FinancialStatementQuestionNode exten
|
|
|
8349
8423
|
isKeyboardSelectable() {
|
|
8350
8424
|
return false;
|
|
8351
8425
|
}
|
|
8352
|
-
|
|
8426
|
+
setPointsPerSpace(points) {
|
|
8353
8427
|
const writable = this.getWritable();
|
|
8354
|
-
writable.
|
|
8428
|
+
writable.__pointsPerSpace = points <= 0 ? 1 : points;
|
|
8355
8429
|
}
|
|
8356
8430
|
decorate() {
|
|
8357
8431
|
return /* @__PURE__ */ jsx72(
|
|
8358
|
-
|
|
8432
|
+
FillInTheBlankQuestionComponent,
|
|
8359
8433
|
{
|
|
8360
8434
|
nodeKey: this.__key,
|
|
8361
8435
|
id: this.__id,
|
|
8362
|
-
|
|
8363
|
-
columnHeaders: this.__columnHeaders,
|
|
8364
|
-
rows: this.__rows,
|
|
8365
|
-
distractors: this.__distractors
|
|
8436
|
+
content: this.__content
|
|
8366
8437
|
}
|
|
8367
8438
|
);
|
|
8368
8439
|
}
|
|
8369
8440
|
};
|
|
8370
|
-
function $
|
|
8441
|
+
function $createFillInTheBlankQuestionNode(pointsPerSpace, id, content) {
|
|
8371
8442
|
return $applyNodeReplacement10(
|
|
8372
|
-
new
|
|
8373
|
-
points,
|
|
8374
|
-
header,
|
|
8375
|
-
columnHeaders,
|
|
8376
|
-
rows,
|
|
8377
|
-
distractors,
|
|
8378
|
-
id
|
|
8379
|
-
)
|
|
8443
|
+
new FillInTheBlankQuestionNode(pointsPerSpace, id, content)
|
|
8380
8444
|
);
|
|
8381
8445
|
}
|
|
8382
|
-
function $
|
|
8383
|
-
return node instanceof
|
|
8446
|
+
function $isFillInTheBlankQuestionNode(node) {
|
|
8447
|
+
return node instanceof FillInTheBlankQuestionNode;
|
|
8384
8448
|
}
|
|
8385
8449
|
|
|
8386
8450
|
// src/plugins/SettingsPanel/SmartTableSettings.tsx
|
|
@@ -10682,16 +10746,21 @@ function MatchingQuestionPlugin() {
|
|
|
10682
10746
|
}
|
|
10683
10747
|
|
|
10684
10748
|
// src/utils/traverseListNode.ts
|
|
10685
|
-
import {
|
|
10749
|
+
import {
|
|
10750
|
+
$isListItemNode,
|
|
10751
|
+
$isListNode
|
|
10752
|
+
} from "@lexical/list";
|
|
10686
10753
|
function traverseListNode(rootNode, cb) {
|
|
10687
10754
|
if ($isListNode(rootNode)) {
|
|
10688
10755
|
cb(rootNode);
|
|
10689
10756
|
const children = rootNode.getChildren();
|
|
10690
10757
|
for (const childNode of children) {
|
|
10691
|
-
if ($
|
|
10758
|
+
if ($isListItemNode(childNode)) {
|
|
10692
10759
|
const nestedChildren = childNode.getChildren();
|
|
10693
|
-
|
|
10694
|
-
|
|
10760
|
+
if (nestedChildren && nestedChildren.length > 0) {
|
|
10761
|
+
for (const nestedItem of nestedChildren) {
|
|
10762
|
+
traverseListNode(nestedItem, cb);
|
|
10763
|
+
}
|
|
10695
10764
|
}
|
|
10696
10765
|
}
|
|
10697
10766
|
}
|
|
@@ -12969,7 +13038,7 @@ import {
|
|
|
12969
13038
|
} from "lexical";
|
|
12970
13039
|
|
|
12971
13040
|
// src/plugins/MarkdownPlugin/markdown/utils.ts
|
|
12972
|
-
import { $isListItemNode, $isListNode as $isListNode5 } from "@lexical/list";
|
|
13041
|
+
import { $isListItemNode as $isListItemNode2, $isListNode as $isListNode5 } from "@lexical/list";
|
|
12973
13042
|
import { $isHeadingNode as $isHeadingNode2, $isQuoteNode } from "@lexical/rich-text";
|
|
12974
13043
|
import {
|
|
12975
13044
|
$isParagraphNode as $isParagraphNode3,
|
|
@@ -13169,7 +13238,7 @@ function processNestedLists(listNode, exportChildren, depth) {
|
|
|
13169
13238
|
const children = listNode.getChildren();
|
|
13170
13239
|
let index = 0;
|
|
13171
13240
|
for (const listItemNode of children) {
|
|
13172
|
-
if ($
|
|
13241
|
+
if ($isListItemNode2(listItemNode)) {
|
|
13173
13242
|
if (listItemNode.getChildrenSize() === 1) {
|
|
13174
13243
|
const firstChild = listItemNode.getFirstChild();
|
|
13175
13244
|
if ($isListNode5(firstChild)) {
|
|
@@ -13214,7 +13283,7 @@ var PUNCTUATION_OR_SPACE = /[!-/:-@[-`{-~\s]/;
|
|
|
13214
13283
|
|
|
13215
13284
|
// src/plugins/MarkdownPlugin/markdown/MarkdownImport.ts
|
|
13216
13285
|
import {
|
|
13217
|
-
$isListItemNode as $
|
|
13286
|
+
$isListItemNode as $isListItemNode3,
|
|
13218
13287
|
$isListNode as $isListNode6
|
|
13219
13288
|
} from "@lexical/list";
|
|
13220
13289
|
import { $isQuoteNode as $isQuoteNode2 } from "@lexical/rich-text";
|
|
@@ -13528,7 +13597,7 @@ import {
|
|
|
13528
13597
|
import {
|
|
13529
13598
|
$createListItemNode,
|
|
13530
13599
|
$createListNode,
|
|
13531
|
-
$isListItemNode as $
|
|
13600
|
+
$isListItemNode as $isListItemNode4,
|
|
13532
13601
|
$isListNode as $isListNode7,
|
|
13533
13602
|
ListItemNode as ListItemNode5,
|
|
13534
13603
|
ListNode as ListNode4
|
|
@@ -13611,7 +13680,7 @@ var listExport2 = (listNode, exportChildren, depth) => {
|
|
|
13611
13680
|
const children = listNode.getChildren();
|
|
13612
13681
|
let index = 0;
|
|
13613
13682
|
for (const listItemNode of children) {
|
|
13614
|
-
if ($
|
|
13683
|
+
if ($isListItemNode4(listItemNode)) {
|
|
13615
13684
|
if (listItemNode.getChildrenSize() === 1) {
|
|
13616
13685
|
const firstChild = listItemNode.getFirstChild();
|
|
13617
13686
|
if ($isListNode7(firstChild)) {
|
|
@@ -13894,7 +13963,7 @@ function NodeMouseAnchorPlugin() {
|
|
|
13894
13963
|
|
|
13895
13964
|
// src/plugins/NodeMousePlugin/NodeMousePlugin.tsx
|
|
13896
13965
|
import {
|
|
13897
|
-
$isListItemNode as $
|
|
13966
|
+
$isListItemNode as $isListItemNode5,
|
|
13898
13967
|
$isListNode as $isListNode8,
|
|
13899
13968
|
ListNode as ListNode5
|
|
13900
13969
|
} from "@lexical/list";
|
|
@@ -14043,7 +14112,7 @@ function NodeMousePlugin() {
|
|
|
14043
14112
|
let isValidNode = true;
|
|
14044
14113
|
if ($isListNode8(refNode)) {
|
|
14045
14114
|
const listParentNode = refNode.getParent();
|
|
14046
|
-
if ($isListNode8(listParentNode) || $
|
|
14115
|
+
if ($isListNode8(listParentNode) || $isListItemNode5(listParentNode)) {
|
|
14047
14116
|
isValidNode = false;
|
|
14048
14117
|
}
|
|
14049
14118
|
} else if ($isParagraphNode5(refNode)) {
|
|
@@ -15427,7 +15496,7 @@ function replaceWithVariable(variableName, variableFormat, editor, textToReplace
|
|
|
15427
15496
|
}
|
|
15428
15497
|
|
|
15429
15498
|
// src/plugins/VariablesPlugin/renderVariableMenu.tsx
|
|
15430
|
-
function renderVariableMenu(list, popupRef, highlighterRef, activeEditorRef, textToReplaceTargetRef, onUpdateCb) {
|
|
15499
|
+
function renderVariableMenu(list, popupRef, highlighterRef, activeEditorRef, textToReplaceTargetRef, doInferVariableType, onUpdateCb) {
|
|
15431
15500
|
return [...list].map((variableName) => {
|
|
15432
15501
|
return {
|
|
15433
15502
|
id: variableName,
|
|
@@ -15435,7 +15504,7 @@ function renderVariableMenu(list, popupRef, highlighterRef, activeEditorRef, tex
|
|
|
15435
15504
|
onClick: () => {
|
|
15436
15505
|
replaceWithVariable(
|
|
15437
15506
|
variableName,
|
|
15438
|
-
|
|
15507
|
+
doInferVariableType ? inferFormat(variableName) : void 0,
|
|
15439
15508
|
activeEditorRef.current,
|
|
15440
15509
|
textToReplaceTargetRef.current,
|
|
15441
15510
|
onUpdateCb
|
|
@@ -15673,6 +15742,7 @@ function TypeaheadVariablePlugin() {
|
|
|
15673
15742
|
const highlighterRef = useRef52(null);
|
|
15674
15743
|
const activeEditorRef = useRef52();
|
|
15675
15744
|
const textToReplaceTargetRef = useRef52();
|
|
15745
|
+
const activeDecoratorRef = useRef52(void 0);
|
|
15676
15746
|
const handleUpdate = () => {
|
|
15677
15747
|
activeEditorRef.current?.getEditorState().read(() => {
|
|
15678
15748
|
const selection = $getSelection13();
|
|
@@ -15772,7 +15842,7 @@ function TypeaheadVariablePlugin() {
|
|
|
15772
15842
|
if (foundVariable) {
|
|
15773
15843
|
replaceWithVariable(
|
|
15774
15844
|
foundVariable,
|
|
15775
|
-
|
|
15845
|
+
activeDecoratorRef.current === JournalEntryQuestionNode ? void 0 : inferFormat(foundVariable),
|
|
15776
15846
|
activeEditorRef.current,
|
|
15777
15847
|
textToReplaceTargetRef.current
|
|
15778
15848
|
);
|
|
@@ -15784,7 +15854,7 @@ function TypeaheadVariablePlugin() {
|
|
|
15784
15854
|
}
|
|
15785
15855
|
replaceWithVariable(
|
|
15786
15856
|
newVariable,
|
|
15787
|
-
|
|
15857
|
+
activeDecoratorRef.current === JournalEntryQuestionNode ? void 0 : inferFormat(newVariable),
|
|
15788
15858
|
activeEditorRef.current,
|
|
15789
15859
|
textToReplaceTargetRef.current,
|
|
15790
15860
|
(newNode) => {
|
|
@@ -15818,7 +15888,8 @@ function TypeaheadVariablePlugin() {
|
|
|
15818
15888
|
return mergeRegister25(
|
|
15819
15889
|
editor.registerCommand(
|
|
15820
15890
|
TYPEAHEAD_VARIABLE_COMMAND,
|
|
15821
|
-
(
|
|
15891
|
+
(payload, activeEditor) => {
|
|
15892
|
+
activeDecoratorRef.current = payload.decoratorNode;
|
|
15822
15893
|
activeEditorRef.current = activeEditor;
|
|
15823
15894
|
handleUpdate();
|
|
15824
15895
|
return true;
|
|
@@ -15857,7 +15928,10 @@ function TypeaheadVariablePlugin() {
|
|
|
15857
15928
|
const foundVariable = variableList.find(
|
|
15858
15929
|
(v) => v === variableName
|
|
15859
15930
|
);
|
|
15860
|
-
const newVariableNode = $createVariableNode(
|
|
15931
|
+
const newVariableNode = $createVariableNode(
|
|
15932
|
+
variableName,
|
|
15933
|
+
activeDecoratorRef.current === JournalEntryQuestionNode ? void 0 : inferFormat(variableName)
|
|
15934
|
+
);
|
|
15861
15935
|
textNode.replace(newVariableNode);
|
|
15862
15936
|
if (!foundVariable) {
|
|
15863
15937
|
onCreated(variableName);
|
|
@@ -15889,9 +15963,10 @@ function TypeaheadVariablePlugin() {
|
|
|
15889
15963
|
popupRef,
|
|
15890
15964
|
highlighterRef,
|
|
15891
15965
|
activeEditorRef,
|
|
15892
|
-
textToReplaceTargetRef
|
|
15966
|
+
textToReplaceTargetRef,
|
|
15967
|
+
activeDecoratorRef.current !== JournalEntryQuestionNode
|
|
15893
15968
|
);
|
|
15894
|
-
}, [
|
|
15969
|
+
}, [variableList, activeDecoratorRef.current]);
|
|
15895
15970
|
return /* @__PURE__ */ jsxs42(Fragment46, { children: [
|
|
15896
15971
|
/* @__PURE__ */ jsx114(
|
|
15897
15972
|
PopupMenu,
|