@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.js
CHANGED
|
@@ -797,8 +797,8 @@ var useSharedHistoryContext = () => {
|
|
|
797
797
|
};
|
|
798
798
|
|
|
799
799
|
// src/plugins/FillInTheBlankQuestionPlugin/FillInTheBlankQuestionNode.tsx
|
|
800
|
-
var
|
|
801
|
-
var
|
|
800
|
+
var import_lexical47 = require("lexical");
|
|
801
|
+
var import_nanoid7 = require("nanoid");
|
|
802
802
|
|
|
803
803
|
// src/plugins/SmartTablePlugin/AddNewColumnAction.tsx
|
|
804
804
|
var import_LexicalComposerContext5 = require("@lexical/react/LexicalComposerContext");
|
|
@@ -5157,9 +5157,9 @@ function $isImageNode(node) {
|
|
|
5157
5157
|
}
|
|
5158
5158
|
|
|
5159
5159
|
// src/plugins/JournalEntryQuestionPlugin/JournalEntryQuestionComponent.tsx
|
|
5160
|
-
var
|
|
5161
|
-
var
|
|
5162
|
-
var
|
|
5160
|
+
var import_LexicalComposerContext33 = require("@lexical/react/LexicalComposerContext");
|
|
5161
|
+
var import_lexical40 = require("lexical");
|
|
5162
|
+
var import_react50 = require("react");
|
|
5163
5163
|
|
|
5164
5164
|
// src/plugins/JournalEntryQuestionPlugin/DistractorButton.tsx
|
|
5165
5165
|
var import_LexicalComposerContext20 = require("@lexical/react/LexicalComposerContext");
|
|
@@ -5215,75 +5215,25 @@ function DistractorButton(props) {
|
|
|
5215
5215
|
] });
|
|
5216
5216
|
}
|
|
5217
5217
|
|
|
5218
|
-
// src/plugins/
|
|
5218
|
+
// src/plugins/FinancialStatementQuestionPlugin/FinancialStatementQuestionNode.tsx
|
|
5219
|
+
var import_lexical27 = require("lexical");
|
|
5220
|
+
var import_nanoid2 = require("nanoid");
|
|
5221
|
+
|
|
5222
|
+
// src/plugins/VariablesPlugin/VariableComponent.tsx
|
|
5219
5223
|
var import_LexicalComposerContext21 = require("@lexical/react/LexicalComposerContext");
|
|
5220
|
-
var import_utils6 = require("@lexical/utils");
|
|
5221
5224
|
var import_lexical23 = require("lexical");
|
|
5222
5225
|
var import_react38 = require("react");
|
|
5223
5226
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
5224
|
-
var TYPEAHEAD_VARIABLE_COMMAND = (0, import_lexical23.createCommand)("TYPEAHEAD_VARIABLE_COMMAND");
|
|
5225
|
-
function TypeaheadVariableAgentPlugin() {
|
|
5226
|
-
const { hasModule, modulesNumber } = useBlockEditor();
|
|
5227
|
-
const [editor] = (0, import_LexicalComposerContext21.useLexicalComposerContext)();
|
|
5228
|
-
(0, import_react38.useEffect)(() => {
|
|
5229
|
-
if (hasModule("Variables")) {
|
|
5230
|
-
return (0, import_utils6.mergeRegister)(
|
|
5231
|
-
editor.registerUpdateListener(({ tags }) => {
|
|
5232
|
-
if (!tags.has("history-merge")) {
|
|
5233
|
-
editor.dispatchCommand(
|
|
5234
|
-
TYPEAHEAD_VARIABLE_COMMAND,
|
|
5235
|
-
void 0
|
|
5236
|
-
);
|
|
5237
|
-
}
|
|
5238
|
-
})
|
|
5239
|
-
);
|
|
5240
|
-
}
|
|
5241
|
-
}, [editor, modulesNumber]);
|
|
5242
|
-
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_jsx_runtime49.Fragment, {});
|
|
5243
|
-
}
|
|
5244
|
-
|
|
5245
|
-
// src/plugins/VariablesPlugin/utils.ts
|
|
5246
|
-
function clearVariableSelection(editor, variable) {
|
|
5247
|
-
const allHighlightedVariables = editor.getRootElement()?.querySelectorAll("[data-variable-highlighted]");
|
|
5248
|
-
if (allHighlightedVariables && allHighlightedVariables.length > 0) {
|
|
5249
|
-
for (const highlightedVariable of allHighlightedVariables) {
|
|
5250
|
-
if (!variable || highlightedVariable.getAttribute(
|
|
5251
|
-
"data-block-editor-variable"
|
|
5252
|
-
) !== variable) {
|
|
5253
|
-
highlightedVariable.removeAttribute(
|
|
5254
|
-
"data-variable-highlighted"
|
|
5255
|
-
);
|
|
5256
|
-
}
|
|
5257
|
-
}
|
|
5258
|
-
}
|
|
5259
|
-
}
|
|
5260
|
-
function setVariableSelection(editor, variable) {
|
|
5261
|
-
const allVariableElements = editor.getRootElement()?.querySelectorAll(`[data-block-editor-variable="${variable}"]`);
|
|
5262
|
-
if (allVariableElements && allVariableElements.length > 0) {
|
|
5263
|
-
for (const variableElement of allVariableElements) {
|
|
5264
|
-
variableElement.setAttribute(
|
|
5265
|
-
"data-variable-highlighted",
|
|
5266
|
-
"true"
|
|
5267
|
-
);
|
|
5268
|
-
}
|
|
5269
|
-
}
|
|
5270
|
-
}
|
|
5271
|
-
|
|
5272
|
-
// src/plugins/VariablesPlugin/VariableComponent.tsx
|
|
5273
|
-
var import_LexicalComposerContext22 = require("@lexical/react/LexicalComposerContext");
|
|
5274
|
-
var import_lexical24 = require("lexical");
|
|
5275
|
-
var import_react39 = require("react");
|
|
5276
|
-
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
5277
5227
|
function VariableComponent(props) {
|
|
5278
5228
|
const { nodeKey } = props;
|
|
5279
|
-
const [editor] = (0,
|
|
5229
|
+
const [editor] = (0, import_LexicalComposerContext21.useLexicalComposerContext)();
|
|
5280
5230
|
const handleToggleModeEvent = (event) => {
|
|
5281
5231
|
const {
|
|
5282
5232
|
detail: { mode, variableValues }
|
|
5283
5233
|
} = event;
|
|
5284
5234
|
if (mode === "preview") {
|
|
5285
5235
|
editor.update(() => {
|
|
5286
|
-
const foundNode = (0,
|
|
5236
|
+
const foundNode = (0, import_lexical23.$getNodeByKey)(nodeKey);
|
|
5287
5237
|
if ($isVariableNode(foundNode)) {
|
|
5288
5238
|
foundNode.setPreviewMode(true);
|
|
5289
5239
|
if (variableValues) {
|
|
@@ -5296,14 +5246,14 @@ function VariableComponent(props) {
|
|
|
5296
5246
|
});
|
|
5297
5247
|
} else {
|
|
5298
5248
|
editor.update(() => {
|
|
5299
|
-
const foundNode = (0,
|
|
5249
|
+
const foundNode = (0, import_lexical23.$getNodeByKey)(nodeKey);
|
|
5300
5250
|
if ($isVariableNode(foundNode)) {
|
|
5301
5251
|
foundNode.setPreviewMode(false);
|
|
5302
5252
|
}
|
|
5303
5253
|
});
|
|
5304
5254
|
}
|
|
5305
5255
|
};
|
|
5306
|
-
(0,
|
|
5256
|
+
(0, import_react38.useEffect)(() => {
|
|
5307
5257
|
window.addEventListener(
|
|
5308
5258
|
TOGGLE_EDITING_MODE,
|
|
5309
5259
|
handleToggleModeEvent
|
|
@@ -5315,12 +5265,12 @@ function VariableComponent(props) {
|
|
|
5315
5265
|
);
|
|
5316
5266
|
};
|
|
5317
5267
|
}, [editor]);
|
|
5318
|
-
return /* @__PURE__ */ (0,
|
|
5268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_jsx_runtime49.Fragment, {});
|
|
5319
5269
|
}
|
|
5320
5270
|
|
|
5321
5271
|
// src/plugins/VariablesPlugin/VariableNode.tsx
|
|
5322
|
-
var
|
|
5323
|
-
var
|
|
5272
|
+
var import_lexical24 = require("lexical");
|
|
5273
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
5324
5274
|
var FORMAT_WHOLE_NUMBER = "0";
|
|
5325
5275
|
var FORMAT_WHOLE_NUMBER_COMMAS = "0,0";
|
|
5326
5276
|
var FORMAT_ONE_DECIMAL_COMMAS = "0,0.0";
|
|
@@ -5354,7 +5304,7 @@ function $convertVariableElement(domNode) {
|
|
|
5354
5304
|
return null;
|
|
5355
5305
|
}
|
|
5356
5306
|
var TYPE_NAME3 = "variable";
|
|
5357
|
-
var VariableNode = class _VariableNode extends
|
|
5307
|
+
var VariableNode = class _VariableNode extends import_lexical24.DecoratorNode {
|
|
5358
5308
|
static getType() {
|
|
5359
5309
|
return TYPE_NAME3;
|
|
5360
5310
|
}
|
|
@@ -5524,7 +5474,7 @@ var VariableNode = class _VariableNode extends import_lexical25.DecoratorNode {
|
|
|
5524
5474
|
writable.__isUnderline = value;
|
|
5525
5475
|
}
|
|
5526
5476
|
decorate() {
|
|
5527
|
-
return /* @__PURE__ */ (0,
|
|
5477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(VariableComponent, { nodeKey: this.__key });
|
|
5528
5478
|
}
|
|
5529
5479
|
};
|
|
5530
5480
|
function $createVariableNode(variableName, variableFormat, isBold, isItalic, isUnderline) {
|
|
@@ -5536,32 +5486,68 @@ function $createVariableNode(variableName, variableFormat, isBold, isItalic, isU
|
|
|
5536
5486
|
isItalic,
|
|
5537
5487
|
isUnderline
|
|
5538
5488
|
);
|
|
5539
|
-
return (0,
|
|
5489
|
+
return (0, import_lexical24.$applyNodeReplacement)(variableNode);
|
|
5540
5490
|
}
|
|
5541
5491
|
function $isVariableNode(node) {
|
|
5542
5492
|
return node instanceof VariableNode;
|
|
5543
5493
|
}
|
|
5544
5494
|
|
|
5495
|
+
// src/plugins/VariablesPlugin/utils.ts
|
|
5496
|
+
function clearVariableSelection(editor, variable) {
|
|
5497
|
+
const allHighlightedVariables = editor.getRootElement()?.querySelectorAll("[data-variable-highlighted]");
|
|
5498
|
+
if (allHighlightedVariables && allHighlightedVariables.length > 0) {
|
|
5499
|
+
for (const highlightedVariable of allHighlightedVariables) {
|
|
5500
|
+
if (!variable || highlightedVariable.getAttribute(
|
|
5501
|
+
"data-block-editor-variable"
|
|
5502
|
+
) !== variable) {
|
|
5503
|
+
highlightedVariable.removeAttribute(
|
|
5504
|
+
"data-variable-highlighted"
|
|
5505
|
+
);
|
|
5506
|
+
}
|
|
5507
|
+
}
|
|
5508
|
+
}
|
|
5509
|
+
}
|
|
5510
|
+
function setVariableSelection(editor, variable) {
|
|
5511
|
+
const allVariableElements = editor.getRootElement()?.querySelectorAll(`[data-block-editor-variable="${variable}"]`);
|
|
5512
|
+
if (allVariableElements && allVariableElements.length > 0) {
|
|
5513
|
+
for (const variableElement of allVariableElements) {
|
|
5514
|
+
variableElement.setAttribute(
|
|
5515
|
+
"data-variable-highlighted",
|
|
5516
|
+
"true"
|
|
5517
|
+
);
|
|
5518
|
+
}
|
|
5519
|
+
}
|
|
5520
|
+
}
|
|
5521
|
+
var isFloat = (value) => {
|
|
5522
|
+
const parts = value.split(".");
|
|
5523
|
+
if (parts.length !== 2) return false;
|
|
5524
|
+
const [whole, decimal] = parts;
|
|
5525
|
+
return isInteger(whole) && Number.isSafeInteger(Number(decimal));
|
|
5526
|
+
};
|
|
5527
|
+
var decimalPlaces = (value) => value.includes(".") ? value.split(".")[1].length : 0;
|
|
5528
|
+
var isInteger = (value) => /^[\d,]+$/.test(value);
|
|
5529
|
+
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;
|
|
5530
|
+
|
|
5545
5531
|
// src/plugins/VariablesPlugin/VariableComponentPlugin.tsx
|
|
5546
|
-
var
|
|
5547
|
-
var
|
|
5548
|
-
var
|
|
5549
|
-
var
|
|
5550
|
-
var
|
|
5532
|
+
var import_LexicalComposerContext22 = require("@lexical/react/LexicalComposerContext");
|
|
5533
|
+
var import_utils7 = require("@lexical/utils");
|
|
5534
|
+
var import_lexical25 = require("lexical");
|
|
5535
|
+
var import_react39 = require("react");
|
|
5536
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
5551
5537
|
function VariableComponentPlugin() {
|
|
5552
5538
|
const { hasModule, modulesNumber, getEditor } = useBlockEditor();
|
|
5553
|
-
const [editor] = (0,
|
|
5554
|
-
(0,
|
|
5539
|
+
const [editor] = (0, import_LexicalComposerContext22.useLexicalComposerContext)();
|
|
5540
|
+
(0, import_react39.useEffect)(() => {
|
|
5555
5541
|
if (hasModule("Variables")) {
|
|
5556
|
-
return (0,
|
|
5542
|
+
return (0, import_utils7.mergeRegister)(
|
|
5557
5543
|
editor.registerCommand(
|
|
5558
|
-
|
|
5544
|
+
import_lexical25.SELECTION_CHANGE_COMMAND,
|
|
5559
5545
|
() => {
|
|
5560
5546
|
const rootEditor = getEditor();
|
|
5561
5547
|
let variableName = void 0;
|
|
5562
|
-
const selection = (0,
|
|
5548
|
+
const selection = (0, import_lexical25.$getSelection)();
|
|
5563
5549
|
if (selection) {
|
|
5564
|
-
if ((0,
|
|
5550
|
+
if ((0, import_lexical25.$isNodeSelection)(selection)) {
|
|
5565
5551
|
const nodes = selection.extract();
|
|
5566
5552
|
const focusedNode = nodes[0];
|
|
5567
5553
|
if ($isVariableNode(focusedNode)) {
|
|
@@ -5583,479 +5569,289 @@ function VariableComponentPlugin() {
|
|
|
5583
5569
|
}
|
|
5584
5570
|
return false;
|
|
5585
5571
|
},
|
|
5586
|
-
|
|
5572
|
+
import_lexical25.COMMAND_PRIORITY_NORMAL
|
|
5587
5573
|
),
|
|
5588
5574
|
editor.registerCommand(
|
|
5589
|
-
|
|
5575
|
+
import_lexical25.CLICK_COMMAND,
|
|
5590
5576
|
(payload) => {
|
|
5591
5577
|
const { target } = payload;
|
|
5592
5578
|
if (target && target instanceof HTMLElement && target.hasAttribute("data-block-editor-variable")) {
|
|
5593
5579
|
const variableNodeKey = payload.target.getAttribute("data-block-editor-node-key");
|
|
5594
5580
|
if (variableNodeKey) {
|
|
5595
5581
|
editor.update(() => {
|
|
5596
|
-
const newSelection = (0,
|
|
5582
|
+
const newSelection = (0, import_lexical25.$createNodeSelection)();
|
|
5597
5583
|
newSelection.add(variableNodeKey);
|
|
5598
|
-
(0,
|
|
5584
|
+
(0, import_lexical25.$setSelection)(newSelection);
|
|
5599
5585
|
});
|
|
5600
5586
|
return true;
|
|
5601
5587
|
}
|
|
5602
5588
|
}
|
|
5603
5589
|
return false;
|
|
5604
5590
|
},
|
|
5605
|
-
|
|
5591
|
+
import_lexical25.COMMAND_PRIORITY_HIGH
|
|
5606
5592
|
)
|
|
5607
5593
|
);
|
|
5608
5594
|
}
|
|
5609
5595
|
}, [editor, modulesNumber]);
|
|
5610
|
-
return /* @__PURE__ */ (0,
|
|
5611
|
-
}
|
|
5612
|
-
|
|
5613
|
-
// src/plugins/VariablesPlugin/VariableToolbarAgentPlugin.tsx
|
|
5614
|
-
var import_LexicalComposerContext24 = require("@lexical/react/LexicalComposerContext");
|
|
5615
|
-
var import_utils9 = require("@lexical/utils");
|
|
5616
|
-
var import_lexical27 = require("lexical");
|
|
5617
|
-
var import_react41 = require("react");
|
|
5618
|
-
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
5619
|
-
var VARIABLE_TOOLBAR_SELECTION_CHANGE_COMMAND = (0, import_lexical27.createCommand)("VARIABLE_TOOLBAR_SELECTION_CHANGE_COMMAND");
|
|
5620
|
-
function VariableToolbarAgentPlugin() {
|
|
5621
|
-
const [editor] = (0, import_LexicalComposerContext24.useLexicalComposerContext)();
|
|
5622
|
-
(0, import_react41.useEffect)(() => {
|
|
5623
|
-
return (0, import_utils9.mergeRegister)(
|
|
5624
|
-
editor.registerCommand(
|
|
5625
|
-
import_lexical27.SELECTION_CHANGE_COMMAND,
|
|
5626
|
-
(_payload, activeEditor) => {
|
|
5627
|
-
if (editor === activeEditor) {
|
|
5628
|
-
activeEditor.dispatchCommand(
|
|
5629
|
-
VARIABLE_TOOLBAR_SELECTION_CHANGE_COMMAND,
|
|
5630
|
-
void 0
|
|
5631
|
-
);
|
|
5632
|
-
}
|
|
5633
|
-
return false;
|
|
5634
|
-
},
|
|
5635
|
-
import_lexical27.COMMAND_PRIORITY_EDITOR
|
|
5636
|
-
),
|
|
5637
|
-
editor.registerUpdateListener(({ tags }) => {
|
|
5638
|
-
if (!tags.has("history-merge")) {
|
|
5639
|
-
editor.dispatchCommand(
|
|
5640
|
-
VARIABLE_TOOLBAR_SELECTION_CHANGE_COMMAND,
|
|
5641
|
-
void 0
|
|
5642
|
-
);
|
|
5643
|
-
}
|
|
5644
|
-
})
|
|
5645
|
-
);
|
|
5646
|
-
}, [editor]);
|
|
5647
|
-
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_jsx_runtime53.Fragment, {});
|
|
5596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx_runtime51.Fragment, {});
|
|
5648
5597
|
}
|
|
5649
5598
|
|
|
5650
|
-
// src/plugins/
|
|
5651
|
-
var
|
|
5599
|
+
// src/plugins/FinancialStatementQuestionPlugin/FinancialStatementQuestionComponent.tsx
|
|
5600
|
+
var import_LexicalComposerContext23 = require("@lexical/react/LexicalComposerContext");
|
|
5652
5601
|
var import_LexicalErrorBoundary2 = require("@lexical/react/LexicalErrorBoundary");
|
|
5653
5602
|
var import_LexicalHistoryPlugin3 = require("@lexical/react/LexicalHistoryPlugin");
|
|
5654
5603
|
var import_LexicalNestedComposer2 = require("@lexical/react/LexicalNestedComposer");
|
|
5655
5604
|
var import_LexicalRichTextPlugin2 = require("@lexical/react/LexicalRichTextPlugin");
|
|
5656
|
-
var
|
|
5657
|
-
var
|
|
5658
|
-
var
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
function JournalEntryQuestionItemComponent(props) {
|
|
5662
|
-
const { nodeKey, id, itemIndex, correct, credit, debit, account } = props;
|
|
5605
|
+
var import_lexical26 = require("lexical");
|
|
5606
|
+
var import_react40 = require("react");
|
|
5607
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
5608
|
+
function FinancialStatementQuestionComponent(props) {
|
|
5609
|
+
const { id, header, columnHeaders, rows, distractors, nodeKey } = props;
|
|
5663
5610
|
const { historyState } = useSharedHistoryContext();
|
|
5664
|
-
const [editor] = (0,
|
|
5665
|
-
const
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
if (newEntryItem.account) {
|
|
5680
|
-
newEntryItem.account.update(() => {
|
|
5681
|
-
const root = (0, import_lexical28.$getRoot)();
|
|
5682
|
-
let firstChild = root.getFirstChild();
|
|
5683
|
-
if (!firstChild) {
|
|
5684
|
-
firstChild = (0, import_lexical28.$createParagraphNode)();
|
|
5685
|
-
root.append(firstChild);
|
|
5686
|
-
}
|
|
5687
|
-
firstChild.selectStart();
|
|
5688
|
-
});
|
|
5689
|
-
}
|
|
5690
|
-
if (newEntryItem.credit) {
|
|
5691
|
-
newEntryItem.credit.update(() => {
|
|
5692
|
-
const root = (0, import_lexical28.$getRoot)();
|
|
5693
|
-
let firstChild = root.getFirstChild();
|
|
5694
|
-
if (!firstChild) {
|
|
5695
|
-
firstChild = (0, import_lexical28.$createParagraphNode)();
|
|
5696
|
-
root.append(firstChild);
|
|
5697
|
-
}
|
|
5698
|
-
});
|
|
5699
|
-
}
|
|
5700
|
-
if (newEntryItem.debit) {
|
|
5701
|
-
newEntryItem.debit.update(() => {
|
|
5702
|
-
const root = (0, import_lexical28.$getRoot)();
|
|
5703
|
-
let firstChild = root.getFirstChild();
|
|
5704
|
-
if (!firstChild) {
|
|
5705
|
-
firstChild = (0, import_lexical28.$createParagraphNode)();
|
|
5706
|
-
root.append(firstChild);
|
|
5707
|
-
}
|
|
5708
|
-
});
|
|
5709
|
-
}
|
|
5611
|
+
const [editor] = (0, import_LexicalComposerContext23.useLexicalComposerContext)();
|
|
5612
|
+
const rootElementRef = (0, import_react40.useRef)(null);
|
|
5613
|
+
(0, import_react40.useEffect)(() => {
|
|
5614
|
+
return editor.registerCommand(
|
|
5615
|
+
import_lexical26.CLICK_COMMAND,
|
|
5616
|
+
(event, _activeEditor) => {
|
|
5617
|
+
if (rootElementRef.current?.contains(event.target) && event.target.hasAttribute(
|
|
5618
|
+
"data-selectable"
|
|
5619
|
+
)) {
|
|
5620
|
+
editor.update(() => {
|
|
5621
|
+
const foundNode = (0, import_lexical26.$getNodeByKey)(nodeKey);
|
|
5622
|
+
if ($isFinancialStatementQuestionNode(foundNode)) {
|
|
5623
|
+
const selection = (0, import_lexical26.$createNodeSelection)();
|
|
5624
|
+
selection.add(nodeKey);
|
|
5625
|
+
(0, import_lexical26.$setSelection)(selection);
|
|
5710
5626
|
}
|
|
5711
5627
|
});
|
|
5712
5628
|
}
|
|
5713
|
-
|
|
5629
|
+
return false;
|
|
5630
|
+
},
|
|
5631
|
+
import_lexical26.COMMAND_PRIORITY_LOW
|
|
5714
5632
|
);
|
|
5715
|
-
}, [editor
|
|
5716
|
-
|
|
5717
|
-
editor.update(() => {
|
|
5718
|
-
const foundNode = (0, import_lexical28.$getNodeByKey)(nodeKey);
|
|
5719
|
-
if ($isJournalEntryQuestionNode(foundNode)) {
|
|
5720
|
-
foundNode.removeItem(itemIndex);
|
|
5721
|
-
}
|
|
5722
|
-
});
|
|
5723
|
-
}, [editor, nodeKey, itemIndex]);
|
|
5724
|
-
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
5633
|
+
}, [editor]);
|
|
5634
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
5725
5635
|
"div",
|
|
5726
5636
|
{
|
|
5637
|
+
ref: rootElementRef,
|
|
5727
5638
|
id,
|
|
5728
|
-
className: "
|
|
5639
|
+
className: "financial-statement-question-prompt",
|
|
5729
5640
|
children: [
|
|
5730
|
-
/* @__PURE__ */ (0,
|
|
5641
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5731
5642
|
"div",
|
|
5732
5643
|
{
|
|
5733
|
-
className:
|
|
5734
|
-
|
|
5644
|
+
className: "financial-statement-question-prompt-title",
|
|
5645
|
+
"data-selectable": "true",
|
|
5646
|
+
children: "Financial Statement"
|
|
5647
|
+
}
|
|
5648
|
+
),
|
|
5649
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { "data-selectable": "true", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("table", { "data-selectable": "true", style: { width: "100%" }, children: [
|
|
5650
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("thead", { "data-selectable": "true", children: [
|
|
5651
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("tr", { "data-selectable": "true", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5652
|
+
"td",
|
|
5735
5653
|
{
|
|
5736
|
-
|
|
5737
|
-
|
|
5654
|
+
className: "financial-statement-question-header",
|
|
5655
|
+
colSpan: 2,
|
|
5656
|
+
"data-selectable": "true",
|
|
5657
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_LexicalNestedComposer2.LexicalNestedComposer, { initialEditor: header, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(NestedEditor, { nodeKey, children: [
|
|
5658
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(SettingsPanelNestedAgentPlugin, {}),
|
|
5659
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5660
|
+
import_LexicalRichTextPlugin2.RichTextPlugin,
|
|
5661
|
+
{
|
|
5662
|
+
contentEditable: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(NestedContentEditable, {}),
|
|
5663
|
+
ErrorBoundary: import_LexicalErrorBoundary2.LexicalErrorBoundary,
|
|
5664
|
+
placeholder: null
|
|
5665
|
+
},
|
|
5666
|
+
nodeKey
|
|
5667
|
+
),
|
|
5668
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5669
|
+
import_LexicalHistoryPlugin3.HistoryPlugin,
|
|
5670
|
+
{
|
|
5671
|
+
externalHistoryState: historyState
|
|
5672
|
+
}
|
|
5673
|
+
),
|
|
5674
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5675
|
+
TypeaheadVariableAgentPlugin,
|
|
5676
|
+
{
|
|
5677
|
+
decoratorNode: FinancialStatementQuestionNode
|
|
5678
|
+
}
|
|
5679
|
+
),
|
|
5680
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(VariableComponentPlugin, {})
|
|
5681
|
+
] }) })
|
|
5738
5682
|
}
|
|
5739
|
-
),
|
|
5740
|
-
"data-selectable": "true",
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { style: { height: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_LexicalNestedComposer2.LexicalNestedComposer, { initialEditor: account, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(NestedEditor, { nodeKey, children: [
|
|
5744
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(SettingsPanelNestedAgentPlugin, {}),
|
|
5745
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5746
|
-
import_LexicalRichTextPlugin2.RichTextPlugin,
|
|
5747
|
-
{
|
|
5748
|
-
contentEditable: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(NestedContentEditable, {}),
|
|
5749
|
-
ErrorBoundary: import_LexicalErrorBoundary2.LexicalErrorBoundary,
|
|
5750
|
-
placeholder: null
|
|
5751
|
-
},
|
|
5752
|
-
nodeKey
|
|
5753
|
-
),
|
|
5754
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_LexicalHistoryPlugin3.HistoryPlugin, { externalHistoryState: historyState }),
|
|
5755
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5756
|
-
TextToolbarAgentPlugin,
|
|
5757
|
-
{
|
|
5758
|
-
decoratorNode: JournalEntryQuestionNode
|
|
5759
|
-
}
|
|
5760
|
-
),
|
|
5761
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TypeaheadVariableAgentPlugin, {}),
|
|
5762
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(VariableComponentPlugin, {})
|
|
5763
|
-
] }) }) }),
|
|
5764
|
-
(!debit || !credit) && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "controls", children: [
|
|
5765
|
-
itemIndex > 0 ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5766
|
-
Button,
|
|
5767
|
-
{
|
|
5768
|
-
StartIcon: import_lucide_react5.CircleMinus,
|
|
5769
|
-
size: "medium",
|
|
5770
|
-
variant: "text",
|
|
5771
|
-
className: "cancel",
|
|
5772
|
-
onClick: removeItem
|
|
5773
|
-
}
|
|
5774
|
-
) }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", {}),
|
|
5775
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5776
|
-
Button,
|
|
5777
|
-
{
|
|
5778
|
-
StartIcon: import_lucide_react5.CirclePlus,
|
|
5779
|
-
size: "medium",
|
|
5780
|
-
variant: "text",
|
|
5781
|
-
className: "cancel",
|
|
5782
|
-
onClick: addItem
|
|
5783
|
-
}
|
|
5784
|
-
) })
|
|
5785
|
-
] })
|
|
5786
|
-
]
|
|
5787
|
-
}
|
|
5788
|
-
),
|
|
5789
|
-
debit ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
5790
|
-
"div",
|
|
5791
|
-
{
|
|
5792
|
-
className: (0, import_clsx2.default)(
|
|
5793
|
-
"journal-entry-question-prompt-question-item",
|
|
5794
|
-
{
|
|
5795
|
-
correct,
|
|
5796
|
-
incorrect: !correct
|
|
5797
|
-
}
|
|
5798
|
-
),
|
|
5799
|
-
"data-selectable": "true",
|
|
5800
|
-
children: [
|
|
5801
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "title", "data-selectable": "true", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { "data-selectable": "true", children: "Debit" }) }),
|
|
5802
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { style: { height: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_LexicalNestedComposer2.LexicalNestedComposer, { initialEditor: debit, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(NestedEditor, { nodeKey, children: [
|
|
5803
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(SettingsPanelNestedAgentPlugin, {}),
|
|
5804
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5805
|
-
import_LexicalRichTextPlugin2.RichTextPlugin,
|
|
5806
|
-
{
|
|
5807
|
-
contentEditable: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(NestedContentEditable, {}),
|
|
5808
|
-
ErrorBoundary: import_LexicalErrorBoundary2.LexicalErrorBoundary,
|
|
5809
|
-
placeholder: null
|
|
5810
|
-
},
|
|
5811
|
-
nodeKey
|
|
5812
|
-
),
|
|
5813
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_LexicalHistoryPlugin3.HistoryPlugin, { externalHistoryState: historyState }),
|
|
5814
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5815
|
-
TextToolbarAgentPlugin,
|
|
5816
|
-
{
|
|
5817
|
-
decoratorNode: JournalEntryQuestionNode
|
|
5818
|
-
}
|
|
5819
|
-
),
|
|
5820
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TypeaheadVariableAgentPlugin, {}),
|
|
5821
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(VariableComponentPlugin, {})
|
|
5822
|
-
] }) }) })
|
|
5823
|
-
]
|
|
5824
|
-
}
|
|
5825
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", {}),
|
|
5826
|
-
credit ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
5827
|
-
"div",
|
|
5828
|
-
{
|
|
5829
|
-
className: (0, import_clsx2.default)(
|
|
5830
|
-
"journal-entry-question-prompt-question-item",
|
|
5831
|
-
{
|
|
5832
|
-
correct,
|
|
5833
|
-
incorrect: !correct
|
|
5834
|
-
}
|
|
5835
|
-
),
|
|
5836
|
-
"data-selectable": "true",
|
|
5837
|
-
children: [
|
|
5838
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "title", "data-selectable": "true", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { "data-selectable": "true", children: "Credit" }) }),
|
|
5839
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { style: { height: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_LexicalNestedComposer2.LexicalNestedComposer, { initialEditor: credit, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(NestedEditor, { nodeKey, children: [
|
|
5840
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(SettingsPanelNestedAgentPlugin, {}),
|
|
5841
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5842
|
-
import_LexicalRichTextPlugin2.RichTextPlugin,
|
|
5843
|
-
{
|
|
5844
|
-
contentEditable: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(NestedContentEditable, {}),
|
|
5845
|
-
ErrorBoundary: import_LexicalErrorBoundary2.LexicalErrorBoundary,
|
|
5846
|
-
placeholder: null
|
|
5847
|
-
},
|
|
5848
|
-
nodeKey
|
|
5849
|
-
),
|
|
5850
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_LexicalHistoryPlugin3.HistoryPlugin, { externalHistoryState: historyState }),
|
|
5851
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5852
|
-
TextToolbarAgentPlugin,
|
|
5853
|
-
{
|
|
5854
|
-
decoratorNode: JournalEntryQuestionNode
|
|
5855
|
-
}
|
|
5856
|
-
),
|
|
5857
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TypeaheadVariableAgentPlugin, {}),
|
|
5858
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(VariableComponentPlugin, {}),
|
|
5859
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(VariableToolbarAgentPlugin, {})
|
|
5860
|
-
] }) }) }),
|
|
5861
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "controls", children: [
|
|
5862
|
-
itemIndex > 0 ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5863
|
-
Button,
|
|
5864
|
-
{
|
|
5865
|
-
StartIcon: import_lucide_react5.CircleMinus,
|
|
5866
|
-
size: "medium",
|
|
5867
|
-
variant: "text",
|
|
5868
|
-
className: "cancel",
|
|
5869
|
-
onClick: removeItem
|
|
5870
|
-
}
|
|
5871
|
-
) }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", {}),
|
|
5872
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5873
|
-
Button,
|
|
5874
|
-
{
|
|
5875
|
-
StartIcon: import_lucide_react5.CirclePlus,
|
|
5876
|
-
size: "medium",
|
|
5877
|
-
variant: "text",
|
|
5878
|
-
className: "cancel",
|
|
5879
|
-
onClick: addItem
|
|
5880
|
-
}
|
|
5881
|
-
) })
|
|
5882
|
-
] })
|
|
5883
|
-
]
|
|
5884
|
-
}
|
|
5885
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", {})
|
|
5886
|
-
]
|
|
5887
|
-
}
|
|
5888
|
-
);
|
|
5889
|
-
}
|
|
5890
|
-
|
|
5891
|
-
// src/plugins/JournalEntryQuestionPlugin/JournalEntryQuestionComponent.tsx
|
|
5892
|
-
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
5893
|
-
function JournalEntryQuestionComponent(props) {
|
|
5894
|
-
const { nodeKey, journalType, lineItems, id } = props;
|
|
5895
|
-
const [editor] = (0, import_LexicalComposerContext26.useLexicalComposerContext)();
|
|
5896
|
-
const rootElementRef = (0, import_react43.useRef)(null);
|
|
5897
|
-
(0, import_react43.useEffect)(() => {
|
|
5898
|
-
return editor.registerCommand(
|
|
5899
|
-
import_lexical29.CLICK_COMMAND,
|
|
5900
|
-
(event, _activeEditor) => {
|
|
5901
|
-
if (rootElementRef.current?.contains(event.target) && event.target.hasAttribute(
|
|
5902
|
-
"data-selectable"
|
|
5903
|
-
)) {
|
|
5904
|
-
editor.update(() => {
|
|
5905
|
-
const foundNode = (0, import_lexical29.$getNodeByKey)(nodeKey);
|
|
5906
|
-
if ($isJournalEntryQuestionNode(foundNode)) {
|
|
5907
|
-
const selection = (0, import_lexical29.$createNodeSelection)();
|
|
5908
|
-
selection.add(nodeKey);
|
|
5909
|
-
(0, import_lexical29.$setSelection)(selection);
|
|
5910
|
-
}
|
|
5911
|
-
});
|
|
5912
|
-
}
|
|
5913
|
-
return false;
|
|
5914
|
-
},
|
|
5915
|
-
import_lexical29.COMMAND_PRIORITY_LOW
|
|
5916
|
-
);
|
|
5917
|
-
}, [editor]);
|
|
5918
|
-
const doNeedDistractor = lineItems.reduce((a, i) => {
|
|
5919
|
-
return i.correct ? a : ++a;
|
|
5920
|
-
}, 0) <= 0;
|
|
5921
|
-
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
5922
|
-
"div",
|
|
5923
|
-
{
|
|
5924
|
-
ref: rootElementRef,
|
|
5925
|
-
id,
|
|
5926
|
-
className: "journal-entry-question-prompt",
|
|
5927
|
-
children: [
|
|
5928
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
5929
|
-
"div",
|
|
5930
|
-
{
|
|
5931
|
-
className: "journal-entry-question-prompt-title",
|
|
5932
|
-
"data-selectable": "true",
|
|
5933
|
-
children: "Journal Entry"
|
|
5934
|
-
}
|
|
5935
|
-
),
|
|
5936
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
5937
|
-
"div",
|
|
5938
|
-
{
|
|
5939
|
-
className: "journal-entry-question-prompt-items",
|
|
5940
|
-
"data-selectable": "true",
|
|
5941
|
-
children: [
|
|
5942
|
-
journalType === "noEntryRequiredCorrect" && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
5943
|
-
"div",
|
|
5683
|
+
) }),
|
|
5684
|
+
columnHeaders.length >= 2 && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("tr", { "data-selectable": "true", children: [
|
|
5685
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5686
|
+
"th",
|
|
5944
5687
|
{
|
|
5945
|
-
className: "journal-entry-question-prompt-question-item correct",
|
|
5946
5688
|
"data-selectable": "true",
|
|
5947
|
-
|
|
5948
|
-
|
|
5949
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { "data-selectable": "true", children: "No Entry Required" })
|
|
5950
|
-
]
|
|
5689
|
+
style: { textAlign: "left" },
|
|
5690
|
+
children: columnHeaders[0]
|
|
5951
5691
|
}
|
|
5952
5692
|
),
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
5956
|
-
JournalEntryQuestionItemComponent,
|
|
5957
|
-
{
|
|
5958
|
-
nodeKey,
|
|
5959
|
-
id: journalEntryItem.id,
|
|
5960
|
-
itemIndex,
|
|
5961
|
-
correct: journalEntryItem.correct,
|
|
5962
|
-
account: journalEntryItem.account,
|
|
5963
|
-
debit: journalEntryItem.debit,
|
|
5964
|
-
credit: journalEntryItem.credit
|
|
5965
|
-
},
|
|
5966
|
-
journalEntryItem.id
|
|
5967
|
-
);
|
|
5968
|
-
}
|
|
5969
|
-
}),
|
|
5970
|
-
(journalType === "default" || journalType === "noEntryRequiredDistractor") && lineItems.map((journalEntryItem, itemIndex) => {
|
|
5971
|
-
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
5972
|
-
JournalEntryQuestionItemComponent,
|
|
5973
|
-
{
|
|
5974
|
-
nodeKey,
|
|
5975
|
-
id: journalEntryItem.id,
|
|
5976
|
-
itemIndex,
|
|
5977
|
-
correct: journalEntryItem.correct,
|
|
5978
|
-
account: journalEntryItem.account,
|
|
5979
|
-
debit: journalEntryItem.debit,
|
|
5980
|
-
credit: journalEntryItem.credit
|
|
5981
|
-
},
|
|
5982
|
-
journalEntryItem.id
|
|
5983
|
-
);
|
|
5984
|
-
}),
|
|
5985
|
-
doNeedDistractor && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
5986
|
-
DistractorButton,
|
|
5693
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5694
|
+
"th",
|
|
5987
5695
|
{
|
|
5988
|
-
|
|
5989
|
-
|
|
5696
|
+
"data-selectable": "true",
|
|
5697
|
+
style: { textAlign: "right" },
|
|
5698
|
+
children: columnHeaders[1]
|
|
5990
5699
|
}
|
|
5991
5700
|
)
|
|
5992
|
-
]
|
|
5993
|
-
}
|
|
5994
|
-
|
|
5701
|
+
] })
|
|
5702
|
+
] }),
|
|
5703
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("tbody", { children: [
|
|
5704
|
+
rows.map(
|
|
5705
|
+
(rowItem, rowItemIndex) => {
|
|
5706
|
+
if (rowItem.type === "Heading") {
|
|
5707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("tr", { "data-selectable": "true", children: [
|
|
5708
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("td", { "data-selectable": "true", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5709
|
+
"strong",
|
|
5710
|
+
{
|
|
5711
|
+
style: {
|
|
5712
|
+
paddingLeft: `calc(1em * ${rowItem.depth})`
|
|
5713
|
+
},
|
|
5714
|
+
children: rowItem.entry
|
|
5715
|
+
}
|
|
5716
|
+
) }),
|
|
5717
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5718
|
+
"td",
|
|
5719
|
+
{
|
|
5720
|
+
className: "financial-statement-question-cell",
|
|
5721
|
+
"data-selectable": "true",
|
|
5722
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "financial-statement-question-cell-id", children: [
|
|
5723
|
+
"A",
|
|
5724
|
+
rowItemIndex + 1
|
|
5725
|
+
] })
|
|
5726
|
+
}
|
|
5727
|
+
)
|
|
5728
|
+
] }, rowItem.id);
|
|
5729
|
+
} else if (rowItem.type === "Line") {
|
|
5730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("tr", { "data-selectable": "true", children: [
|
|
5731
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("td", { "data-selectable": "true", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5732
|
+
"span",
|
|
5733
|
+
{
|
|
5734
|
+
style: {
|
|
5735
|
+
paddingLeft: `calc(1em * ${rowItem.depth})`
|
|
5736
|
+
},
|
|
5737
|
+
children: rowItem.entry
|
|
5738
|
+
}
|
|
5739
|
+
) }),
|
|
5740
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
5741
|
+
"td",
|
|
5742
|
+
{
|
|
5743
|
+
className: "financial-statement-question-cell",
|
|
5744
|
+
"data-selectable": "true",
|
|
5745
|
+
children: [
|
|
5746
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "financial-statement-question-cell-id", children: [
|
|
5747
|
+
"A",
|
|
5748
|
+
rowItemIndex + 1
|
|
5749
|
+
] }),
|
|
5750
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5751
|
+
import_LexicalNestedComposer2.LexicalNestedComposer,
|
|
5752
|
+
{
|
|
5753
|
+
initialEditor: rowItem.amount,
|
|
5754
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(NestedEditor, { nodeKey, children: [
|
|
5755
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(SettingsPanelNestedAgentPlugin, {}),
|
|
5756
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5757
|
+
import_LexicalRichTextPlugin2.RichTextPlugin,
|
|
5758
|
+
{
|
|
5759
|
+
contentEditable: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(NestedContentEditable, {}),
|
|
5760
|
+
ErrorBoundary: import_LexicalErrorBoundary2.LexicalErrorBoundary,
|
|
5761
|
+
placeholder: null
|
|
5762
|
+
},
|
|
5763
|
+
nodeKey
|
|
5764
|
+
),
|
|
5765
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5766
|
+
import_LexicalHistoryPlugin3.HistoryPlugin,
|
|
5767
|
+
{
|
|
5768
|
+
externalHistoryState: historyState
|
|
5769
|
+
}
|
|
5770
|
+
),
|
|
5771
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5772
|
+
TypeaheadVariableAgentPlugin,
|
|
5773
|
+
{
|
|
5774
|
+
decoratorNode: FinancialStatementQuestionNode
|
|
5775
|
+
}
|
|
5776
|
+
),
|
|
5777
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(VariableComponentPlugin, {})
|
|
5778
|
+
] })
|
|
5779
|
+
}
|
|
5780
|
+
)
|
|
5781
|
+
]
|
|
5782
|
+
}
|
|
5783
|
+
)
|
|
5784
|
+
] }, rowItem.id);
|
|
5785
|
+
}
|
|
5786
|
+
}
|
|
5787
|
+
),
|
|
5788
|
+
distractors.map(
|
|
5789
|
+
(distractorItem) => {
|
|
5790
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("tr", { "data-selectable": "true", children: [
|
|
5791
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("td", { "data-selectable": "true", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5792
|
+
"span",
|
|
5793
|
+
{
|
|
5794
|
+
style: { color: "var(--sl-color-red-500)" },
|
|
5795
|
+
children: distractorItem.entry
|
|
5796
|
+
}
|
|
5797
|
+
) }),
|
|
5798
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("td", { "data-selectable": "true" })
|
|
5799
|
+
] }, distractorItem.id);
|
|
5800
|
+
}
|
|
5801
|
+
)
|
|
5802
|
+
] })
|
|
5803
|
+
] }) })
|
|
5995
5804
|
]
|
|
5996
5805
|
}
|
|
5997
5806
|
);
|
|
5998
5807
|
}
|
|
5999
5808
|
|
|
6000
|
-
// src/plugins/
|
|
6001
|
-
var
|
|
6002
|
-
|
|
6003
|
-
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
6004
|
-
var TYPE_NAME4 = "journal-entry-question";
|
|
6005
|
-
var JournalTypeLabelMap = {
|
|
6006
|
-
default: "Default",
|
|
6007
|
-
noEntryRequiredCorrect: "No Entry Required Correct",
|
|
6008
|
-
noEntryRequiredDistractor: "No Entry Required Distractor"
|
|
5809
|
+
// src/plugins/FinancialStatementQuestionPlugin/isSerializableFinancialStatementHeading.ts
|
|
5810
|
+
var isSerializableFinancialStatementHeading = (row) => {
|
|
5811
|
+
return row.type === "Heading";
|
|
6009
5812
|
};
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
5813
|
+
|
|
5814
|
+
// src/plugins/FinancialStatementQuestionPlugin/isSerializableFinancialStatementLine.ts
|
|
5815
|
+
var isSerializableFinancialStatementLine = (row) => {
|
|
5816
|
+
return row.type === "Line";
|
|
5817
|
+
};
|
|
5818
|
+
|
|
5819
|
+
// src/plugins/FinancialStatementQuestionPlugin/FinancialStatementQuestionNode.tsx
|
|
5820
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
5821
|
+
var TYPE_NAME4 = "financial-statement-question";
|
|
5822
|
+
var isFinancialStatementHeading = (row) => {
|
|
5823
|
+
return row.type === "Heading";
|
|
5824
|
+
};
|
|
5825
|
+
var isFinancialStatementLine = (row) => {
|
|
5826
|
+
return row.type === "Line";
|
|
5827
|
+
};
|
|
5828
|
+
var FinancialStatementQuestionNode = class _FinancialStatementQuestionNode extends import_lexical27.DecoratorNode {
|
|
5829
|
+
constructor(points, header, columnHeaders, rows, distractors, id, key) {
|
|
6015
5830
|
super(key);
|
|
6016
|
-
this.__points = points < 0 ? 1 : points;
|
|
6017
|
-
this.__journalType = journalType;
|
|
6018
|
-
this.__errorTolerance = errorTolerance;
|
|
6019
5831
|
this.__id = id || (0, import_nanoid2.nanoid)();
|
|
6020
|
-
this.
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
correct: item.correct,
|
|
6026
|
-
account: item.account,
|
|
6027
|
-
credit: item.correct ? item.credit : void 0,
|
|
6028
|
-
debit: item.correct ? item.debit : void 0
|
|
6029
|
-
});
|
|
6030
|
-
}
|
|
6031
|
-
} else {
|
|
6032
|
-
for (let i = 0; i < 2; i++) {
|
|
6033
|
-
this.__lineItems.push({
|
|
6034
|
-
id: (0, import_nanoid2.nanoid)(),
|
|
6035
|
-
correct: true,
|
|
6036
|
-
account: initNewContentEditor(),
|
|
6037
|
-
credit: initNewContentEditor(),
|
|
6038
|
-
debit: initNewContentEditor()
|
|
6039
|
-
});
|
|
6040
|
-
}
|
|
6041
|
-
}
|
|
5832
|
+
this.__points = points < 0 ? 1 : points;
|
|
5833
|
+
this.__header = header;
|
|
5834
|
+
this.__columnHeaders = columnHeaders;
|
|
5835
|
+
this.__rows = rows;
|
|
5836
|
+
this.__distractors = distractors;
|
|
6042
5837
|
}
|
|
6043
5838
|
static getType() {
|
|
6044
5839
|
return TYPE_NAME4;
|
|
6045
5840
|
}
|
|
6046
5841
|
static clone(node) {
|
|
6047
|
-
return new
|
|
5842
|
+
return new _FinancialStatementQuestionNode(
|
|
6048
5843
|
node.__points,
|
|
6049
|
-
node.
|
|
6050
|
-
node.
|
|
6051
|
-
node.
|
|
5844
|
+
node.__header,
|
|
5845
|
+
node.__columnHeaders,
|
|
5846
|
+
node.__rows,
|
|
5847
|
+
node.__distractors,
|
|
6052
5848
|
node.__id,
|
|
6053
5849
|
node.__key
|
|
6054
5850
|
);
|
|
6055
5851
|
}
|
|
6056
5852
|
__createWrapper() {
|
|
6057
5853
|
const wrapper = document.createElement("div");
|
|
6058
|
-
wrapper.classList.add("
|
|
5854
|
+
wrapper.classList.add("financial-statement-question-wrapper");
|
|
6059
5855
|
return wrapper;
|
|
6060
5856
|
}
|
|
6061
5857
|
createDOM() {
|
|
@@ -6072,70 +5868,86 @@ var JournalEntryQuestionNode = class _JournalEntryQuestionNode extends import_le
|
|
|
6072
5868
|
return null;
|
|
6073
5869
|
}
|
|
6074
5870
|
static importJSON(serializedNode) {
|
|
6075
|
-
const
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
);
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
if (
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
}
|
|
6092
|
-
const debitNestedEditor = (0, import_lexical30.createEditor)();
|
|
6093
|
-
editorState2 = debitNestedEditor.parseEditorState(
|
|
6094
|
-
item.debit.editorState
|
|
6095
|
-
);
|
|
6096
|
-
if (!editorState2.isEmpty()) {
|
|
6097
|
-
debitNestedEditor.setEditorState(editorState2);
|
|
6098
|
-
}
|
|
6099
|
-
restoredItems.push({
|
|
6100
|
-
id: item.id,
|
|
6101
|
-
correct: item.correct,
|
|
6102
|
-
account: accountNestedEditor,
|
|
6103
|
-
credit: creditNestedEditor,
|
|
6104
|
-
debit: debitNestedEditor
|
|
5871
|
+
const headerNestedEditor = (0, import_lexical27.createEditor)();
|
|
5872
|
+
const editorState = headerNestedEditor.parseEditorState(
|
|
5873
|
+
serializedNode.header.editorState
|
|
5874
|
+
);
|
|
5875
|
+
if (!editorState.isEmpty()) {
|
|
5876
|
+
headerNestedEditor.setEditorState(editorState);
|
|
5877
|
+
}
|
|
5878
|
+
const restoredRows = [];
|
|
5879
|
+
for (const row of serializedNode.rows) {
|
|
5880
|
+
if (isSerializableFinancialStatementHeading(row)) {
|
|
5881
|
+
restoredRows.push({
|
|
5882
|
+
type: row.type,
|
|
5883
|
+
id: row.id,
|
|
5884
|
+
depth: row.depth,
|
|
5885
|
+
entry: row.entry,
|
|
5886
|
+
isHint: row.isHint
|
|
6105
5887
|
});
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
5888
|
+
continue;
|
|
5889
|
+
}
|
|
5890
|
+
if (isSerializableFinancialStatementLine(row)) {
|
|
5891
|
+
const amountNestedEditor = (0, import_lexical27.createEditor)();
|
|
5892
|
+
const editorState2 = amountNestedEditor.parseEditorState(
|
|
5893
|
+
row.amount.editorState
|
|
5894
|
+
);
|
|
5895
|
+
if (!editorState2.isEmpty()) {
|
|
5896
|
+
amountNestedEditor.setEditorState(editorState2);
|
|
5897
|
+
}
|
|
5898
|
+
restoredRows.push({
|
|
5899
|
+
type: row.type,
|
|
5900
|
+
id: row.id,
|
|
5901
|
+
depth: row.depth,
|
|
5902
|
+
entry: row.entry,
|
|
5903
|
+
amount: amountNestedEditor,
|
|
5904
|
+
isEntryHint: row.isEntryHint,
|
|
5905
|
+
isAmountHint: row.isAmountHint,
|
|
5906
|
+
role: row.role
|
|
6111
5907
|
});
|
|
5908
|
+
continue;
|
|
6112
5909
|
}
|
|
6113
5910
|
}
|
|
6114
|
-
return $
|
|
5911
|
+
return $createFinancialStatementQuestionNode(
|
|
6115
5912
|
serializedNode.points,
|
|
6116
|
-
|
|
6117
|
-
serializedNode.
|
|
6118
|
-
|
|
5913
|
+
headerNestedEditor,
|
|
5914
|
+
serializedNode.columnHeaders,
|
|
5915
|
+
restoredRows,
|
|
5916
|
+
serializedNode.distractors,
|
|
6119
5917
|
serializedNode.id
|
|
6120
5918
|
);
|
|
6121
5919
|
}
|
|
6122
5920
|
exportJSON() {
|
|
6123
|
-
const exportedOptions = [];
|
|
6124
|
-
for (const item of this.__lineItems) {
|
|
6125
|
-
exportedOptions.push({
|
|
6126
|
-
id: item.id,
|
|
6127
|
-
correct: item.correct,
|
|
6128
|
-
account: item.account.toJSON(),
|
|
6129
|
-
credit: item.credit?.toJSON(),
|
|
6130
|
-
debit: item.debit?.toJSON()
|
|
6131
|
-
});
|
|
6132
|
-
}
|
|
6133
5921
|
return {
|
|
6134
|
-
lineItems: exportedOptions,
|
|
6135
5922
|
id: this.__id,
|
|
6136
|
-
errorTolerance: this.__errorTolerance,
|
|
6137
|
-
journalType: this.__journalType,
|
|
6138
5923
|
points: this.__points,
|
|
5924
|
+
header: this.__header.toJSON(),
|
|
5925
|
+
columnHeaders: this.__columnHeaders,
|
|
5926
|
+
rows: this.__rows.map((row) => {
|
|
5927
|
+
if (isFinancialStatementHeading(row)) {
|
|
5928
|
+
return {
|
|
5929
|
+
type: row.type,
|
|
5930
|
+
id: row.id,
|
|
5931
|
+
depth: row.depth,
|
|
5932
|
+
entry: row.entry,
|
|
5933
|
+
isHint: row.isHint
|
|
5934
|
+
};
|
|
5935
|
+
}
|
|
5936
|
+
if (isFinancialStatementLine(row)) {
|
|
5937
|
+
return {
|
|
5938
|
+
type: row.type,
|
|
5939
|
+
id: row.id,
|
|
5940
|
+
depth: row.depth,
|
|
5941
|
+
entry: row.entry,
|
|
5942
|
+
amount: row.amount.toJSON(),
|
|
5943
|
+
isEntryHint: row.isEntryHint,
|
|
5944
|
+
isAmountHint: row.isAmountHint,
|
|
5945
|
+
role: row.role
|
|
5946
|
+
};
|
|
5947
|
+
}
|
|
5948
|
+
throw new Error("Invalid row type");
|
|
5949
|
+
}).filter(Boolean),
|
|
5950
|
+
distractors: this.__distractors,
|
|
6139
5951
|
type: TYPE_NAME4,
|
|
6140
5952
|
version: 1
|
|
6141
5953
|
};
|
|
@@ -6154,107 +5966,54 @@ var JournalEntryQuestionNode = class _JournalEntryQuestionNode extends import_le
|
|
|
6154
5966
|
}
|
|
6155
5967
|
setPoints(points) {
|
|
6156
5968
|
const writable = this.getWritable();
|
|
6157
|
-
writable.__points = points
|
|
6158
|
-
}
|
|
6159
|
-
getErrorTolerance() {
|
|
6160
|
-
return this.__errorTolerance;
|
|
6161
|
-
}
|
|
6162
|
-
setErrorTolerance(errorTolerance) {
|
|
6163
|
-
const writable = this.getWritable();
|
|
6164
|
-
writable.__errorTolerance = errorTolerance;
|
|
6165
|
-
}
|
|
6166
|
-
getJournalType() {
|
|
6167
|
-
return this.__journalType;
|
|
6168
|
-
}
|
|
6169
|
-
setJournalType(journalType) {
|
|
6170
|
-
const writable = this.getWritable();
|
|
6171
|
-
if (journalType === "noEntryRequiredDistractor") {
|
|
6172
|
-
const newItems = [...this.__lineItems];
|
|
6173
|
-
const newAccountContent = initNewContentEditor();
|
|
6174
|
-
newAccountContent.update(() => {
|
|
6175
|
-
const root = (0, import_lexical30.$getRoot)();
|
|
6176
|
-
let firstChild = root.getFirstChild();
|
|
6177
|
-
if (!firstChild) {
|
|
6178
|
-
firstChild = (0, import_lexical30.$createParagraphNode)();
|
|
6179
|
-
firstChild.append((0, import_lexical30.$createTextNode)("No Entry Required"));
|
|
6180
|
-
root.append(firstChild);
|
|
6181
|
-
}
|
|
6182
|
-
});
|
|
6183
|
-
newItems.push({
|
|
6184
|
-
id: (0, import_nanoid2.nanoid)(),
|
|
6185
|
-
correct: false,
|
|
6186
|
-
account: newAccountContent,
|
|
6187
|
-
credit: void 0,
|
|
6188
|
-
debit: void 0
|
|
6189
|
-
});
|
|
6190
|
-
writable.__lineItems = newItems;
|
|
6191
|
-
}
|
|
6192
|
-
writable.__journalType = journalType;
|
|
6193
|
-
}
|
|
6194
|
-
addItem(itemIndex, correct) {
|
|
6195
|
-
const newItemIndex = itemIndex + 1;
|
|
6196
|
-
const writable = this.getWritable();
|
|
6197
|
-
const newItems = [...writable.__lineItems];
|
|
6198
|
-
newItems.splice(newItemIndex, 0, {
|
|
6199
|
-
id: (0, import_nanoid2.nanoid)(),
|
|
6200
|
-
correct,
|
|
6201
|
-
account: initNewContentEditor(),
|
|
6202
|
-
credit: correct ? initNewContentEditor() : void 0,
|
|
6203
|
-
debit: correct ? initNewContentEditor() : void 0
|
|
6204
|
-
});
|
|
6205
|
-
writable.__lineItems = newItems;
|
|
6206
|
-
}
|
|
6207
|
-
removeItem(itemIndex) {
|
|
6208
|
-
if (this.__lineItems.length > 1 && this.__lineItems.length > itemIndex) {
|
|
6209
|
-
const writable = this.getWritable();
|
|
6210
|
-
const newItems = [...writable.__lineItems];
|
|
6211
|
-
newItems.splice(itemIndex, 1);
|
|
6212
|
-
writable.__lineItems = newItems;
|
|
6213
|
-
}
|
|
5969
|
+
writable.__points = points <= 0 ? 1 : points;
|
|
6214
5970
|
}
|
|
6215
5971
|
decorate() {
|
|
6216
|
-
return /* @__PURE__ */ (0,
|
|
6217
|
-
|
|
5972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
5973
|
+
FinancialStatementQuestionComponent,
|
|
6218
5974
|
{
|
|
6219
5975
|
nodeKey: this.__key,
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
5976
|
+
id: this.__id,
|
|
5977
|
+
header: this.__header,
|
|
5978
|
+
columnHeaders: this.__columnHeaders,
|
|
5979
|
+
rows: this.__rows,
|
|
5980
|
+
distractors: this.__distractors
|
|
6223
5981
|
}
|
|
6224
5982
|
);
|
|
6225
5983
|
}
|
|
6226
5984
|
};
|
|
6227
|
-
function $
|
|
6228
|
-
return (0,
|
|
6229
|
-
new
|
|
5985
|
+
function $createFinancialStatementQuestionNode(points, header, columnHeaders, rows, distractors, id) {
|
|
5986
|
+
return (0, import_lexical27.$applyNodeReplacement)(
|
|
5987
|
+
new FinancialStatementQuestionNode(
|
|
6230
5988
|
points,
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
5989
|
+
header,
|
|
5990
|
+
columnHeaders,
|
|
5991
|
+
rows,
|
|
5992
|
+
distractors,
|
|
6234
5993
|
id
|
|
6235
5994
|
)
|
|
6236
5995
|
);
|
|
6237
5996
|
}
|
|
6238
|
-
function $
|
|
6239
|
-
return node instanceof
|
|
5997
|
+
function $isFinancialStatementQuestionNode(node) {
|
|
5998
|
+
return node instanceof FinancialStatementQuestionNode;
|
|
6240
5999
|
}
|
|
6241
6000
|
|
|
6242
6001
|
// src/plugins/MatchingQuestionPlugin/MatchingQuestionNode.tsx
|
|
6243
|
-
var
|
|
6002
|
+
var import_lexical32 = require("lexical");
|
|
6244
6003
|
var import_nanoid3 = require("nanoid");
|
|
6245
6004
|
|
|
6246
6005
|
// src/plugins/MatchingQuestionPlugin/DistractorButton.tsx
|
|
6247
|
-
var
|
|
6248
|
-
var
|
|
6249
|
-
var
|
|
6250
|
-
var
|
|
6006
|
+
var import_LexicalComposerContext24 = require("@lexical/react/LexicalComposerContext");
|
|
6007
|
+
var import_lexical28 = require("lexical");
|
|
6008
|
+
var import_react41 = require("react");
|
|
6009
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
6251
6010
|
function DistractorButton2(props) {
|
|
6252
6011
|
const { nodeKey, itemIndex } = props;
|
|
6253
|
-
const [editor] = (0,
|
|
6254
|
-
const addDistractor = (0,
|
|
6012
|
+
const [editor] = (0, import_LexicalComposerContext24.useLexicalComposerContext)();
|
|
6013
|
+
const addDistractor = (0, import_react41.useCallback)(() => {
|
|
6255
6014
|
editor.update(
|
|
6256
6015
|
() => {
|
|
6257
|
-
const foundNode = (0,
|
|
6016
|
+
const foundNode = (0, import_lexical28.$getNodeByKey)(nodeKey);
|
|
6258
6017
|
if ($isMatchingQuestionNode(foundNode)) {
|
|
6259
6018
|
foundNode.addItem(itemIndex, false);
|
|
6260
6019
|
}
|
|
@@ -6262,15 +6021,15 @@ function DistractorButton2(props) {
|
|
|
6262
6021
|
{
|
|
6263
6022
|
onUpdate: () => {
|
|
6264
6023
|
editor.getEditorState().read(() => {
|
|
6265
|
-
const foundNode = (0,
|
|
6024
|
+
const foundNode = (0, import_lexical28.$getNodeByKey)(nodeKey);
|
|
6266
6025
|
if ($isMatchingQuestionNode(foundNode)) {
|
|
6267
6026
|
const newQuestionItem = foundNode.__items[itemIndex + 1];
|
|
6268
6027
|
if (newQuestionItem.itemOptionContent) {
|
|
6269
6028
|
newQuestionItem.itemOptionContent.update(() => {
|
|
6270
|
-
const root = (0,
|
|
6029
|
+
const root = (0, import_lexical28.$getRoot)();
|
|
6271
6030
|
let firstChild = root.getFirstChild();
|
|
6272
6031
|
if (!firstChild) {
|
|
6273
|
-
firstChild = (0,
|
|
6032
|
+
firstChild = (0, import_lexical28.$createParagraphNode)();
|
|
6274
6033
|
root.append(firstChild);
|
|
6275
6034
|
}
|
|
6276
6035
|
firstChild.selectStart();
|
|
@@ -6282,9 +6041,9 @@ function DistractorButton2(props) {
|
|
|
6282
6041
|
}
|
|
6283
6042
|
);
|
|
6284
6043
|
}, [editor, nodeKey, itemIndex]);
|
|
6285
|
-
return /* @__PURE__ */ (0,
|
|
6286
|
-
/* @__PURE__ */ (0,
|
|
6287
|
-
/* @__PURE__ */ (0,
|
|
6044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "matching-question-prompt-question-item-wrapper", children: [
|
|
6045
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", {}),
|
|
6046
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "matching-question-distractor-button", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
6288
6047
|
Button,
|
|
6289
6048
|
{
|
|
6290
6049
|
label: "Add Distractor",
|
|
@@ -6297,21 +6056,58 @@ function DistractorButton2(props) {
|
|
|
6297
6056
|
}
|
|
6298
6057
|
|
|
6299
6058
|
// src/plugins/MatchingQuestionPlugin/MatchingQuestionComponent.tsx
|
|
6300
|
-
var
|
|
6301
|
-
var
|
|
6302
|
-
var
|
|
6059
|
+
var import_LexicalComposerContext27 = require("@lexical/react/LexicalComposerContext");
|
|
6060
|
+
var import_lexical31 = require("lexical");
|
|
6061
|
+
var import_react44 = require("react");
|
|
6062
|
+
|
|
6063
|
+
// src/plugins/VariablesPlugin/VariableToolbarAgentPlugin.tsx
|
|
6064
|
+
var import_LexicalComposerContext25 = require("@lexical/react/LexicalComposerContext");
|
|
6065
|
+
var import_utils8 = require("@lexical/utils");
|
|
6066
|
+
var import_lexical29 = require("lexical");
|
|
6067
|
+
var import_react42 = require("react");
|
|
6068
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
6069
|
+
var VARIABLE_TOOLBAR_SELECTION_CHANGE_COMMAND = (0, import_lexical29.createCommand)("VARIABLE_TOOLBAR_SELECTION_CHANGE_COMMAND");
|
|
6070
|
+
function VariableToolbarAgentPlugin() {
|
|
6071
|
+
const [editor] = (0, import_LexicalComposerContext25.useLexicalComposerContext)();
|
|
6072
|
+
(0, import_react42.useEffect)(() => {
|
|
6073
|
+
return (0, import_utils8.mergeRegister)(
|
|
6074
|
+
editor.registerCommand(
|
|
6075
|
+
import_lexical29.SELECTION_CHANGE_COMMAND,
|
|
6076
|
+
(_payload, activeEditor) => {
|
|
6077
|
+
if (editor === activeEditor) {
|
|
6078
|
+
activeEditor.dispatchCommand(
|
|
6079
|
+
VARIABLE_TOOLBAR_SELECTION_CHANGE_COMMAND,
|
|
6080
|
+
void 0
|
|
6081
|
+
);
|
|
6082
|
+
}
|
|
6083
|
+
return false;
|
|
6084
|
+
},
|
|
6085
|
+
import_lexical29.COMMAND_PRIORITY_EDITOR
|
|
6086
|
+
),
|
|
6087
|
+
editor.registerUpdateListener(({ tags }) => {
|
|
6088
|
+
if (!tags.has("history-merge")) {
|
|
6089
|
+
editor.dispatchCommand(
|
|
6090
|
+
VARIABLE_TOOLBAR_SELECTION_CHANGE_COMMAND,
|
|
6091
|
+
void 0
|
|
6092
|
+
);
|
|
6093
|
+
}
|
|
6094
|
+
})
|
|
6095
|
+
);
|
|
6096
|
+
}, [editor]);
|
|
6097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_jsx_runtime55.Fragment, {});
|
|
6098
|
+
}
|
|
6303
6099
|
|
|
6304
6100
|
// src/plugins/MatchingQuestionPlugin/QuestionItemComponent.tsx
|
|
6305
|
-
var
|
|
6101
|
+
var import_LexicalComposerContext26 = require("@lexical/react/LexicalComposerContext");
|
|
6306
6102
|
var import_LexicalErrorBoundary3 = require("@lexical/react/LexicalErrorBoundary");
|
|
6307
6103
|
var import_LexicalHistoryPlugin4 = require("@lexical/react/LexicalHistoryPlugin");
|
|
6308
6104
|
var import_LexicalNestedComposer3 = require("@lexical/react/LexicalNestedComposer");
|
|
6309
6105
|
var import_LexicalRichTextPlugin3 = require("@lexical/react/LexicalRichTextPlugin");
|
|
6310
|
-
var
|
|
6311
|
-
var
|
|
6312
|
-
var
|
|
6313
|
-
var
|
|
6314
|
-
var
|
|
6106
|
+
var import_clsx2 = __toESM(require("clsx"));
|
|
6107
|
+
var import_lexical30 = require("lexical");
|
|
6108
|
+
var import_lucide_react5 = require("lucide-react");
|
|
6109
|
+
var import_react43 = require("react");
|
|
6110
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
6315
6111
|
function QuestionItemComponent(props) {
|
|
6316
6112
|
const {
|
|
6317
6113
|
nodeKey,
|
|
@@ -6322,11 +6118,11 @@ function QuestionItemComponent(props) {
|
|
|
6322
6118
|
itemOptionContent
|
|
6323
6119
|
} = props;
|
|
6324
6120
|
const { historyState } = useSharedHistoryContext();
|
|
6325
|
-
const [editor] = (0,
|
|
6326
|
-
const addItem = (0,
|
|
6121
|
+
const [editor] = (0, import_LexicalComposerContext26.useLexicalComposerContext)();
|
|
6122
|
+
const addItem = (0, import_react43.useCallback)(() => {
|
|
6327
6123
|
editor.update(
|
|
6328
6124
|
() => {
|
|
6329
|
-
const foundNode = (0,
|
|
6125
|
+
const foundNode = (0, import_lexical30.$getNodeByKey)(nodeKey);
|
|
6330
6126
|
if ($isMatchingQuestionNode(foundNode)) {
|
|
6331
6127
|
foundNode.addItem(itemIndex, correct);
|
|
6332
6128
|
}
|
|
@@ -6334,15 +6130,15 @@ function QuestionItemComponent(props) {
|
|
|
6334
6130
|
{
|
|
6335
6131
|
onUpdate: () => {
|
|
6336
6132
|
editor.getEditorState().read(() => {
|
|
6337
|
-
const foundNode = (0,
|
|
6133
|
+
const foundNode = (0, import_lexical30.$getNodeByKey)(nodeKey);
|
|
6338
6134
|
if ($isMatchingQuestionNode(foundNode)) {
|
|
6339
6135
|
const newQuestionItem = foundNode.__items[itemIndex + 1];
|
|
6340
6136
|
if (newQuestionItem.itemPremiseContent) {
|
|
6341
6137
|
newQuestionItem.itemPremiseContent.update(() => {
|
|
6342
|
-
const root = (0,
|
|
6138
|
+
const root = (0, import_lexical30.$getRoot)();
|
|
6343
6139
|
let firstChild = root.getFirstChild();
|
|
6344
6140
|
if (!firstChild) {
|
|
6345
|
-
firstChild = (0,
|
|
6141
|
+
firstChild = (0, import_lexical30.$createParagraphNode)();
|
|
6346
6142
|
root.append(firstChild);
|
|
6347
6143
|
}
|
|
6348
6144
|
firstChild.selectStart();
|
|
@@ -6350,10 +6146,10 @@ function QuestionItemComponent(props) {
|
|
|
6350
6146
|
}
|
|
6351
6147
|
if (newQuestionItem.itemOptionContent) {
|
|
6352
6148
|
newQuestionItem.itemOptionContent.update(() => {
|
|
6353
|
-
const root = (0,
|
|
6149
|
+
const root = (0, import_lexical30.$getRoot)();
|
|
6354
6150
|
let firstChild = root.getFirstChild();
|
|
6355
6151
|
if (!firstChild) {
|
|
6356
|
-
firstChild = (0,
|
|
6152
|
+
firstChild = (0, import_lexical30.$createParagraphNode)();
|
|
6357
6153
|
root.append(firstChild);
|
|
6358
6154
|
}
|
|
6359
6155
|
if (!newQuestionItem.itemPremiseContent) {
|
|
@@ -6367,93 +6163,108 @@ function QuestionItemComponent(props) {
|
|
|
6367
6163
|
}
|
|
6368
6164
|
);
|
|
6369
6165
|
}, [editor, nodeKey, itemIndex, correct]);
|
|
6370
|
-
const removeItem = (0,
|
|
6166
|
+
const removeItem = (0, import_react43.useCallback)(() => {
|
|
6371
6167
|
editor.update(() => {
|
|
6372
|
-
const foundNode = (0,
|
|
6168
|
+
const foundNode = (0, import_lexical30.$getNodeByKey)(nodeKey);
|
|
6373
6169
|
if ($isMatchingQuestionNode(foundNode)) {
|
|
6374
6170
|
foundNode.removeItem(itemIndex);
|
|
6375
6171
|
}
|
|
6376
6172
|
});
|
|
6377
6173
|
}, [editor, nodeKey, itemIndex]);
|
|
6378
|
-
return /* @__PURE__ */ (0,
|
|
6174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
6379
6175
|
"div",
|
|
6380
6176
|
{
|
|
6381
6177
|
id,
|
|
6382
6178
|
className: "matching-question-prompt-question-item-wrapper",
|
|
6383
6179
|
children: [
|
|
6384
|
-
itemPremiseContent ? /* @__PURE__ */ (0,
|
|
6180
|
+
itemPremiseContent ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
6385
6181
|
"div",
|
|
6386
6182
|
{
|
|
6387
6183
|
className: "matching-question-prompt-question-item",
|
|
6388
6184
|
"data-selectable": "true",
|
|
6389
6185
|
children: [
|
|
6390
|
-
/* @__PURE__ */ (0,
|
|
6391
|
-
/* @__PURE__ */ (0,
|
|
6392
|
-
/* @__PURE__ */ (0,
|
|
6393
|
-
/* @__PURE__ */ (0,
|
|
6186
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "title", "data-selectable": "true", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { "data-selectable": "true", children: "Item Premise" }) }),
|
|
6187
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { style: { height: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_LexicalNestedComposer3.LexicalNestedComposer, { initialEditor: itemPremiseContent, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(NestedEditor, { nodeKey, children: [
|
|
6188
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(SettingsPanelNestedAgentPlugin, {}),
|
|
6189
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6394
6190
|
import_LexicalRichTextPlugin3.RichTextPlugin,
|
|
6395
6191
|
{
|
|
6396
|
-
contentEditable: /* @__PURE__ */ (0,
|
|
6192
|
+
contentEditable: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(NestedContentEditable, {}),
|
|
6397
6193
|
ErrorBoundary: import_LexicalErrorBoundary3.LexicalErrorBoundary,
|
|
6398
6194
|
placeholder: null
|
|
6399
6195
|
},
|
|
6400
6196
|
nodeKey
|
|
6401
6197
|
),
|
|
6402
|
-
/* @__PURE__ */ (0,
|
|
6403
|
-
/* @__PURE__ */ (0,
|
|
6404
|
-
|
|
6405
|
-
|
|
6198
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_LexicalHistoryPlugin4.HistoryPlugin, { externalHistoryState: historyState }),
|
|
6199
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6200
|
+
TextToolbarAgentPlugin,
|
|
6201
|
+
{
|
|
6202
|
+
decoratorNode: MatchingQuestionNode
|
|
6203
|
+
}
|
|
6204
|
+
),
|
|
6205
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6206
|
+
TypeaheadVariableAgentPlugin,
|
|
6207
|
+
{
|
|
6208
|
+
decoratorNode: MatchingQuestionNode
|
|
6209
|
+
}
|
|
6210
|
+
),
|
|
6211
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(VariableComponentPlugin, {})
|
|
6406
6212
|
] }) }) })
|
|
6407
6213
|
]
|
|
6408
6214
|
}
|
|
6409
|
-
) : /* @__PURE__ */ (0,
|
|
6410
|
-
/* @__PURE__ */ (0,
|
|
6215
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", {}),
|
|
6216
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
6411
6217
|
"div",
|
|
6412
6218
|
{
|
|
6413
|
-
className: (0,
|
|
6219
|
+
className: (0, import_clsx2.default)("matching-question-prompt-question-item", {
|
|
6414
6220
|
correct,
|
|
6415
6221
|
incorrect: !correct
|
|
6416
6222
|
}),
|
|
6417
6223
|
"data-selectable": "true",
|
|
6418
6224
|
children: [
|
|
6419
|
-
/* @__PURE__ */ (0,
|
|
6420
|
-
/* @__PURE__ */ (0,
|
|
6421
|
-
/* @__PURE__ */ (0,
|
|
6422
|
-
/* @__PURE__ */ (0,
|
|
6225
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "title", "data-selectable": "true", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { "data-selectable": "true", children: correct ? "Correct Choice" : "Incorrect Choice" }) }),
|
|
6226
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { style: { height: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_LexicalNestedComposer3.LexicalNestedComposer, { initialEditor: itemOptionContent, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(NestedEditor, { nodeKey, children: [
|
|
6227
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(SettingsPanelNestedAgentPlugin, {}),
|
|
6228
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6423
6229
|
import_LexicalRichTextPlugin3.RichTextPlugin,
|
|
6424
6230
|
{
|
|
6425
|
-
contentEditable: /* @__PURE__ */ (0,
|
|
6231
|
+
contentEditable: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(NestedContentEditable, {}),
|
|
6426
6232
|
ErrorBoundary: import_LexicalErrorBoundary3.LexicalErrorBoundary,
|
|
6427
6233
|
placeholder: null
|
|
6428
6234
|
},
|
|
6429
6235
|
nodeKey
|
|
6430
6236
|
),
|
|
6431
|
-
/* @__PURE__ */ (0,
|
|
6432
|
-
/* @__PURE__ */ (0,
|
|
6237
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_LexicalHistoryPlugin4.HistoryPlugin, { externalHistoryState: historyState }),
|
|
6238
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6433
6239
|
TextToolbarAgentPlugin,
|
|
6434
6240
|
{
|
|
6435
6241
|
decoratorNode: MatchingQuestionNode
|
|
6436
6242
|
}
|
|
6437
6243
|
),
|
|
6438
|
-
/* @__PURE__ */ (0,
|
|
6439
|
-
|
|
6440
|
-
|
|
6244
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6245
|
+
TypeaheadVariableAgentPlugin,
|
|
6246
|
+
{
|
|
6247
|
+
decoratorNode: MatchingQuestionNode
|
|
6248
|
+
}
|
|
6249
|
+
),
|
|
6250
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(VariableComponentPlugin, {}),
|
|
6251
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(VariableToolbarAgentPlugin, {})
|
|
6441
6252
|
] }) }) }),
|
|
6442
|
-
/* @__PURE__ */ (0,
|
|
6443
|
-
itemIndex > 0 ? /* @__PURE__ */ (0,
|
|
6253
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "controls", children: [
|
|
6254
|
+
itemIndex > 0 ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6444
6255
|
Button,
|
|
6445
6256
|
{
|
|
6446
|
-
StartIcon:
|
|
6257
|
+
StartIcon: import_lucide_react5.CircleMinus,
|
|
6447
6258
|
size: "medium",
|
|
6448
6259
|
variant: "text",
|
|
6449
6260
|
className: "cancel",
|
|
6450
6261
|
onClick: removeItem
|
|
6451
6262
|
}
|
|
6452
|
-
) }) : /* @__PURE__ */ (0,
|
|
6453
|
-
/* @__PURE__ */ (0,
|
|
6263
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", {}),
|
|
6264
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
6454
6265
|
Button,
|
|
6455
6266
|
{
|
|
6456
|
-
StartIcon:
|
|
6267
|
+
StartIcon: import_lucide_react5.CirclePlus,
|
|
6457
6268
|
size: "medium",
|
|
6458
6269
|
variant: "text",
|
|
6459
6270
|
className: "cancel",
|
|
@@ -6470,43 +6281,43 @@ function QuestionItemComponent(props) {
|
|
|
6470
6281
|
}
|
|
6471
6282
|
|
|
6472
6283
|
// src/plugins/MatchingQuestionPlugin/MatchingQuestionComponent.tsx
|
|
6473
|
-
var
|
|
6284
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
6474
6285
|
function MatchingQuestionComponent(props) {
|
|
6475
6286
|
const { nodeKey, items, id } = props;
|
|
6476
|
-
const [editor] = (0,
|
|
6477
|
-
const rootElementRef = (0,
|
|
6478
|
-
(0,
|
|
6287
|
+
const [editor] = (0, import_LexicalComposerContext27.useLexicalComposerContext)();
|
|
6288
|
+
const rootElementRef = (0, import_react44.useRef)(null);
|
|
6289
|
+
(0, import_react44.useEffect)(() => {
|
|
6479
6290
|
return editor.registerCommand(
|
|
6480
|
-
|
|
6291
|
+
import_lexical31.CLICK_COMMAND,
|
|
6481
6292
|
(event, _activeEditor) => {
|
|
6482
6293
|
if (rootElementRef.current?.contains(event.target) && event.target.hasAttribute(
|
|
6483
6294
|
"data-selectable"
|
|
6484
6295
|
)) {
|
|
6485
6296
|
editor.update(() => {
|
|
6486
|
-
const foundNode = (0,
|
|
6297
|
+
const foundNode = (0, import_lexical31.$getNodeByKey)(nodeKey);
|
|
6487
6298
|
if ($isMatchingQuestionNode(foundNode)) {
|
|
6488
|
-
const selection = (0,
|
|
6299
|
+
const selection = (0, import_lexical31.$createNodeSelection)();
|
|
6489
6300
|
selection.add(nodeKey);
|
|
6490
|
-
(0,
|
|
6301
|
+
(0, import_lexical31.$setSelection)(selection);
|
|
6491
6302
|
}
|
|
6492
6303
|
});
|
|
6493
6304
|
}
|
|
6494
6305
|
return false;
|
|
6495
6306
|
},
|
|
6496
|
-
|
|
6307
|
+
import_lexical31.COMMAND_PRIORITY_LOW
|
|
6497
6308
|
);
|
|
6498
6309
|
}, [editor]);
|
|
6499
6310
|
const doNeedDistractor = items.reduce((a, i) => {
|
|
6500
6311
|
return i.correct ? a : ++a;
|
|
6501
6312
|
}, 0) <= 0;
|
|
6502
|
-
return /* @__PURE__ */ (0,
|
|
6313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
6503
6314
|
"div",
|
|
6504
6315
|
{
|
|
6505
6316
|
ref: rootElementRef,
|
|
6506
6317
|
id,
|
|
6507
6318
|
className: "matching-question-prompt",
|
|
6508
6319
|
children: [
|
|
6509
|
-
/* @__PURE__ */ (0,
|
|
6320
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
6510
6321
|
"div",
|
|
6511
6322
|
{
|
|
6512
6323
|
className: "matching-question-prompt-title",
|
|
@@ -6514,14 +6325,14 @@ function MatchingQuestionComponent(props) {
|
|
|
6514
6325
|
children: "Matching"
|
|
6515
6326
|
}
|
|
6516
6327
|
),
|
|
6517
|
-
/* @__PURE__ */ (0,
|
|
6328
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
6518
6329
|
"div",
|
|
6519
6330
|
{
|
|
6520
6331
|
className: "matching-question-prompt-items",
|
|
6521
6332
|
"data-selectable": "true",
|
|
6522
6333
|
children: [
|
|
6523
6334
|
items.map((questionItem, itemIndex) => {
|
|
6524
|
-
return /* @__PURE__ */ (0,
|
|
6335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
6525
6336
|
QuestionItemComponent,
|
|
6526
6337
|
{
|
|
6527
6338
|
nodeKey,
|
|
@@ -6534,7 +6345,7 @@ function MatchingQuestionComponent(props) {
|
|
|
6534
6345
|
questionItem.id
|
|
6535
6346
|
);
|
|
6536
6347
|
}),
|
|
6537
|
-
items.length > 0 && doNeedDistractor && /* @__PURE__ */ (0,
|
|
6348
|
+
items.length > 0 && doNeedDistractor && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
6538
6349
|
DistractorButton2,
|
|
6539
6350
|
{
|
|
6540
6351
|
nodeKey,
|
|
@@ -6550,12 +6361,12 @@ function MatchingQuestionComponent(props) {
|
|
|
6550
6361
|
}
|
|
6551
6362
|
|
|
6552
6363
|
// src/plugins/MatchingQuestionPlugin/MatchingQuestionNode.tsx
|
|
6553
|
-
var
|
|
6364
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
6554
6365
|
var TYPE_NAME5 = "matching-question";
|
|
6555
|
-
function
|
|
6556
|
-
return (0,
|
|
6366
|
+
function initNewContentEditor() {
|
|
6367
|
+
return (0, import_lexical32.createEditor)();
|
|
6557
6368
|
}
|
|
6558
|
-
var MatchingQuestionNode = class _MatchingQuestionNode extends
|
|
6369
|
+
var MatchingQuestionNode = class _MatchingQuestionNode extends import_lexical32.DecoratorNode {
|
|
6559
6370
|
constructor(pointsPerMatch, items, id, key) {
|
|
6560
6371
|
super(key);
|
|
6561
6372
|
this.__id = id || (0, import_nanoid3.nanoid)();
|
|
@@ -6566,8 +6377,8 @@ var MatchingQuestionNode = class _MatchingQuestionNode extends import_lexical34.
|
|
|
6566
6377
|
this.__items.push({
|
|
6567
6378
|
id: item.id,
|
|
6568
6379
|
correct: item.correct,
|
|
6569
|
-
itemPremiseContent: item.correct ? item.itemPremiseContent ||
|
|
6570
|
-
itemOptionContent: item.itemOptionContent ||
|
|
6380
|
+
itemPremiseContent: item.correct ? item.itemPremiseContent || initNewContentEditor() : void 0,
|
|
6381
|
+
itemOptionContent: item.itemOptionContent || initNewContentEditor()
|
|
6571
6382
|
});
|
|
6572
6383
|
}
|
|
6573
6384
|
} else {
|
|
@@ -6575,8 +6386,8 @@ var MatchingQuestionNode = class _MatchingQuestionNode extends import_lexical34.
|
|
|
6575
6386
|
this.__items.push({
|
|
6576
6387
|
id: (0, import_nanoid3.nanoid)(),
|
|
6577
6388
|
correct: true,
|
|
6578
|
-
itemPremiseContent:
|
|
6579
|
-
itemOptionContent:
|
|
6389
|
+
itemPremiseContent: initNewContentEditor(),
|
|
6390
|
+
itemOptionContent: initNewContentEditor()
|
|
6580
6391
|
});
|
|
6581
6392
|
}
|
|
6582
6393
|
}
|
|
@@ -6613,7 +6424,7 @@ var MatchingQuestionNode = class _MatchingQuestionNode extends import_lexical34.
|
|
|
6613
6424
|
static importJSON(serializedNode) {
|
|
6614
6425
|
const restoredItems = [];
|
|
6615
6426
|
for (const item of serializedNode.items) {
|
|
6616
|
-
const optionNestedEditor = (0,
|
|
6427
|
+
const optionNestedEditor = (0, import_lexical32.createEditor)();
|
|
6617
6428
|
const editorState = optionNestedEditor.parseEditorState(
|
|
6618
6429
|
item.itemOptionContent.editorState
|
|
6619
6430
|
);
|
|
@@ -6621,7 +6432,7 @@ var MatchingQuestionNode = class _MatchingQuestionNode extends import_lexical34.
|
|
|
6621
6432
|
optionNestedEditor.setEditorState(editorState);
|
|
6622
6433
|
}
|
|
6623
6434
|
if (item.correct && item.itemPremiseContent) {
|
|
6624
|
-
const premiseNestedEditor = (0,
|
|
6435
|
+
const premiseNestedEditor = (0, import_lexical32.createEditor)();
|
|
6625
6436
|
const editorState2 = premiseNestedEditor.parseEditorState(
|
|
6626
6437
|
item.itemPremiseContent.editorState
|
|
6627
6438
|
);
|
|
@@ -6689,8 +6500,8 @@ var MatchingQuestionNode = class _MatchingQuestionNode extends import_lexical34.
|
|
|
6689
6500
|
newItems.splice(newItemIndex, 0, {
|
|
6690
6501
|
id: (0, import_nanoid3.nanoid)(),
|
|
6691
6502
|
correct,
|
|
6692
|
-
itemPremiseContent: correct ?
|
|
6693
|
-
itemOptionContent:
|
|
6503
|
+
itemPremiseContent: correct ? initNewContentEditor() : void 0,
|
|
6504
|
+
itemOptionContent: initNewContentEditor()
|
|
6694
6505
|
});
|
|
6695
6506
|
writable.__items = newItems;
|
|
6696
6507
|
}
|
|
@@ -6703,7 +6514,7 @@ var MatchingQuestionNode = class _MatchingQuestionNode extends import_lexical34.
|
|
|
6703
6514
|
}
|
|
6704
6515
|
}
|
|
6705
6516
|
decorate() {
|
|
6706
|
-
return /* @__PURE__ */ (0,
|
|
6517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6707
6518
|
MatchingQuestionComponent,
|
|
6708
6519
|
{
|
|
6709
6520
|
nodeKey: this.__key,
|
|
@@ -6714,7 +6525,7 @@ var MatchingQuestionNode = class _MatchingQuestionNode extends import_lexical34.
|
|
|
6714
6525
|
}
|
|
6715
6526
|
};
|
|
6716
6527
|
function $createMatchingQuestionNode(pointsPerMatch, items, id) {
|
|
6717
|
-
return (0,
|
|
6528
|
+
return (0, import_lexical32.$applyNodeReplacement)(
|
|
6718
6529
|
new MatchingQuestionNode(pointsPerMatch, items, id)
|
|
6719
6530
|
);
|
|
6720
6531
|
}
|
|
@@ -6723,68 +6534,68 @@ function $isMatchingQuestionNode(node) {
|
|
|
6723
6534
|
}
|
|
6724
6535
|
|
|
6725
6536
|
// src/plugins/MultipleOptionQuestionPlugin/MultipleOptionQuestionNode.tsx
|
|
6726
|
-
var
|
|
6537
|
+
var import_lexical35 = require("lexical");
|
|
6727
6538
|
var import_nanoid4 = require("nanoid");
|
|
6728
6539
|
|
|
6729
6540
|
// src/plugins/MultipleOptionQuestionPlugin/MultipleOptionQuestionComponent.tsx
|
|
6730
|
-
var
|
|
6731
|
-
var
|
|
6732
|
-
var
|
|
6541
|
+
var import_LexicalComposerContext29 = require("@lexical/react/LexicalComposerContext");
|
|
6542
|
+
var import_lexical34 = require("lexical");
|
|
6543
|
+
var import_react46 = require("react");
|
|
6733
6544
|
|
|
6734
6545
|
// src/plugins/MultipleOptionQuestionPlugin/MultipleOptionQuestionItemComponent.tsx
|
|
6735
|
-
var
|
|
6546
|
+
var import_LexicalComposerContext28 = require("@lexical/react/LexicalComposerContext");
|
|
6736
6547
|
var import_LexicalErrorBoundary4 = require("@lexical/react/LexicalErrorBoundary");
|
|
6737
6548
|
var import_LexicalHistoryPlugin5 = require("@lexical/react/LexicalHistoryPlugin");
|
|
6738
6549
|
var import_LexicalNestedComposer4 = require("@lexical/react/LexicalNestedComposer");
|
|
6739
6550
|
var import_LexicalRichTextPlugin4 = require("@lexical/react/LexicalRichTextPlugin");
|
|
6740
|
-
var
|
|
6741
|
-
var
|
|
6742
|
-
var
|
|
6743
|
-
var
|
|
6744
|
-
var
|
|
6551
|
+
var import_clsx3 = __toESM(require("clsx"));
|
|
6552
|
+
var import_lexical33 = require("lexical");
|
|
6553
|
+
var import_lucide_react6 = require("lucide-react");
|
|
6554
|
+
var import_react45 = require("react");
|
|
6555
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
6745
6556
|
function MultipleOptionQuestionItemComponent(props) {
|
|
6746
6557
|
const { nodeKey, id, optionIndex, correct, content } = props;
|
|
6747
6558
|
const { historyState } = useSharedHistoryContext();
|
|
6748
|
-
const [editor] = (0,
|
|
6749
|
-
const toggleChoice = (0,
|
|
6559
|
+
const [editor] = (0, import_LexicalComposerContext28.useLexicalComposerContext)();
|
|
6560
|
+
const toggleChoice = (0, import_react45.useCallback)(() => {
|
|
6750
6561
|
editor.update(() => {
|
|
6751
|
-
const foundNode = (0,
|
|
6562
|
+
const foundNode = (0, import_lexical33.$getNodeByKey)(nodeKey);
|
|
6752
6563
|
if ($isMultipleOptionQuestionNode(foundNode)) {
|
|
6753
6564
|
foundNode.setCorrectChoice(optionIndex, !correct);
|
|
6754
6565
|
}
|
|
6755
6566
|
});
|
|
6756
6567
|
}, [editor, id, nodeKey, optionIndex, correct]);
|
|
6757
|
-
const addOptionItem = (0,
|
|
6568
|
+
const addOptionItem = (0, import_react45.useCallback)(() => {
|
|
6758
6569
|
editor.update(() => {
|
|
6759
|
-
const foundNode = (0,
|
|
6570
|
+
const foundNode = (0, import_lexical33.$getNodeByKey)(nodeKey);
|
|
6760
6571
|
if ($isMultipleOptionQuestionNode(foundNode)) {
|
|
6761
6572
|
foundNode.addOptionItem(optionIndex, !!correct);
|
|
6762
6573
|
}
|
|
6763
6574
|
});
|
|
6764
6575
|
}, [editor, id, nodeKey, optionIndex, correct]);
|
|
6765
|
-
const removeOptionItem = (0,
|
|
6576
|
+
const removeOptionItem = (0, import_react45.useCallback)(() => {
|
|
6766
6577
|
editor.update(() => {
|
|
6767
|
-
const foundNode = (0,
|
|
6578
|
+
const foundNode = (0, import_lexical33.$getNodeByKey)(nodeKey);
|
|
6768
6579
|
if ($isMultipleOptionQuestionNode(foundNode)) {
|
|
6769
6580
|
foundNode.removeOptionItem(optionIndex);
|
|
6770
6581
|
}
|
|
6771
6582
|
});
|
|
6772
6583
|
}, [editor, id, nodeKey, optionIndex]);
|
|
6773
|
-
return /* @__PURE__ */ (0,
|
|
6584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
6774
6585
|
"div",
|
|
6775
6586
|
{
|
|
6776
|
-
className: (0,
|
|
6587
|
+
className: (0, import_clsx3.default)("multiple-option-question-prompt-option-item", {
|
|
6777
6588
|
correct: !!correct,
|
|
6778
6589
|
incorrect: !correct
|
|
6779
6590
|
}),
|
|
6780
6591
|
"data-selectable": "true",
|
|
6781
6592
|
children: [
|
|
6782
|
-
/* @__PURE__ */ (0,
|
|
6783
|
-
/* @__PURE__ */ (0,
|
|
6784
|
-
/* @__PURE__ */ (0,
|
|
6593
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "title", "data-selectable": "true", children: [
|
|
6594
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { "data-selectable": "true", children: correct ? "Correct Choice" : "Incorrect Choice" }),
|
|
6595
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
6785
6596
|
Button,
|
|
6786
6597
|
{
|
|
6787
|
-
StartIcon:
|
|
6598
|
+
StartIcon: import_lucide_react6.Settings,
|
|
6788
6599
|
size: "small",
|
|
6789
6600
|
variant: "text",
|
|
6790
6601
|
className: "cancel",
|
|
@@ -6792,43 +6603,48 @@ function MultipleOptionQuestionItemComponent(props) {
|
|
|
6792
6603
|
}
|
|
6793
6604
|
) })
|
|
6794
6605
|
] }),
|
|
6795
|
-
/* @__PURE__ */ (0,
|
|
6796
|
-
/* @__PURE__ */ (0,
|
|
6797
|
-
/* @__PURE__ */ (0,
|
|
6606
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_LexicalNestedComposer4.LexicalNestedComposer, { initialEditor: content, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(NestedEditor, { nodeKey, children: [
|
|
6607
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SettingsPanelNestedAgentPlugin, {}),
|
|
6608
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
6798
6609
|
import_LexicalRichTextPlugin4.RichTextPlugin,
|
|
6799
6610
|
{
|
|
6800
|
-
contentEditable: /* @__PURE__ */ (0,
|
|
6611
|
+
contentEditable: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(NestedContentEditable, {}),
|
|
6801
6612
|
ErrorBoundary: import_LexicalErrorBoundary4.LexicalErrorBoundary,
|
|
6802
6613
|
placeholder: null
|
|
6803
6614
|
},
|
|
6804
6615
|
nodeKey
|
|
6805
6616
|
),
|
|
6806
|
-
/* @__PURE__ */ (0,
|
|
6807
|
-
/* @__PURE__ */ (0,
|
|
6617
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_LexicalHistoryPlugin5.HistoryPlugin, { externalHistoryState: historyState }),
|
|
6618
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
6808
6619
|
TextToolbarAgentPlugin,
|
|
6809
6620
|
{
|
|
6810
6621
|
decoratorNode: MultipleOptionQuestionNode
|
|
6811
6622
|
}
|
|
6812
6623
|
),
|
|
6813
|
-
/* @__PURE__ */ (0,
|
|
6814
|
-
|
|
6815
|
-
|
|
6624
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
6625
|
+
TypeaheadVariableAgentPlugin,
|
|
6626
|
+
{
|
|
6627
|
+
decoratorNode: MultipleOptionQuestionNode
|
|
6628
|
+
}
|
|
6629
|
+
),
|
|
6630
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(VariableComponentPlugin, {}),
|
|
6631
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(VariableToolbarAgentPlugin, {})
|
|
6816
6632
|
] }) }) }),
|
|
6817
|
-
/* @__PURE__ */ (0,
|
|
6818
|
-
/* @__PURE__ */ (0,
|
|
6633
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "controls", children: [
|
|
6634
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
6819
6635
|
Button,
|
|
6820
6636
|
{
|
|
6821
|
-
StartIcon:
|
|
6637
|
+
StartIcon: import_lucide_react6.CircleMinus,
|
|
6822
6638
|
size: "medium",
|
|
6823
6639
|
variant: "text",
|
|
6824
6640
|
className: "cancel",
|
|
6825
6641
|
onClick: removeOptionItem
|
|
6826
6642
|
}
|
|
6827
6643
|
) }),
|
|
6828
|
-
/* @__PURE__ */ (0,
|
|
6644
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
6829
6645
|
Button,
|
|
6830
6646
|
{
|
|
6831
|
-
StartIcon:
|
|
6647
|
+
StartIcon: import_lucide_react6.CirclePlus,
|
|
6832
6648
|
size: "medium",
|
|
6833
6649
|
variant: "text",
|
|
6834
6650
|
className: "cancel",
|
|
@@ -6842,39 +6658,39 @@ function MultipleOptionQuestionItemComponent(props) {
|
|
|
6842
6658
|
}
|
|
6843
6659
|
|
|
6844
6660
|
// src/plugins/MultipleOptionQuestionPlugin/MultipleOptionQuestionComponent.tsx
|
|
6845
|
-
var
|
|
6661
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
6846
6662
|
function MultipleOptionQuestionComponent(props) {
|
|
6847
6663
|
const { nodeKey, options, questionType } = props;
|
|
6848
|
-
const [editor] = (0,
|
|
6849
|
-
const rootElementRef = (0,
|
|
6850
|
-
(0,
|
|
6664
|
+
const [editor] = (0, import_LexicalComposerContext29.useLexicalComposerContext)();
|
|
6665
|
+
const rootElementRef = (0, import_react46.useRef)(null);
|
|
6666
|
+
(0, import_react46.useEffect)(() => {
|
|
6851
6667
|
return editor.registerCommand(
|
|
6852
|
-
|
|
6668
|
+
import_lexical34.CLICK_COMMAND,
|
|
6853
6669
|
(event, _activeEditor) => {
|
|
6854
6670
|
if (rootElementRef.current?.contains(event.target) && event.target.hasAttribute(
|
|
6855
6671
|
"data-selectable"
|
|
6856
6672
|
)) {
|
|
6857
6673
|
editor.update(() => {
|
|
6858
|
-
const foundNode = (0,
|
|
6674
|
+
const foundNode = (0, import_lexical34.$getNodeByKey)(nodeKey);
|
|
6859
6675
|
if ($isMultipleOptionQuestionNode(foundNode)) {
|
|
6860
|
-
const selection = (0,
|
|
6676
|
+
const selection = (0, import_lexical34.$createNodeSelection)();
|
|
6861
6677
|
selection.add(nodeKey);
|
|
6862
|
-
(0,
|
|
6678
|
+
(0, import_lexical34.$setSelection)(selection);
|
|
6863
6679
|
}
|
|
6864
6680
|
});
|
|
6865
6681
|
}
|
|
6866
6682
|
return false;
|
|
6867
6683
|
},
|
|
6868
|
-
|
|
6684
|
+
import_lexical34.COMMAND_PRIORITY_LOW
|
|
6869
6685
|
);
|
|
6870
6686
|
}, [editor]);
|
|
6871
|
-
return /* @__PURE__ */ (0,
|
|
6687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
6872
6688
|
"div",
|
|
6873
6689
|
{
|
|
6874
6690
|
ref: rootElementRef,
|
|
6875
6691
|
className: "multiple-option-question-prompt",
|
|
6876
6692
|
children: [
|
|
6877
|
-
/* @__PURE__ */ (0,
|
|
6693
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
6878
6694
|
"div",
|
|
6879
6695
|
{
|
|
6880
6696
|
className: "multiple-option-question-prompt-title",
|
|
@@ -6882,13 +6698,13 @@ function MultipleOptionQuestionComponent(props) {
|
|
|
6882
6698
|
children: questionType === "multiple-choice" ? "Multiple Choice" : "Multiple Answers"
|
|
6883
6699
|
}
|
|
6884
6700
|
),
|
|
6885
|
-
/* @__PURE__ */ (0,
|
|
6701
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
6886
6702
|
"div",
|
|
6887
6703
|
{
|
|
6888
6704
|
className: "multiple-option-question-prompt-options",
|
|
6889
6705
|
"data-selectable": "true",
|
|
6890
6706
|
children: options.map((optionItem, optionItemIndex) => {
|
|
6891
|
-
return /* @__PURE__ */ (0,
|
|
6707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
6892
6708
|
MultipleOptionQuestionItemComponent,
|
|
6893
6709
|
{
|
|
6894
6710
|
nodeKey,
|
|
@@ -6908,12 +6724,12 @@ function MultipleOptionQuestionComponent(props) {
|
|
|
6908
6724
|
}
|
|
6909
6725
|
|
|
6910
6726
|
// src/plugins/MultipleOptionQuestionPlugin/MultipleOptionQuestionNode.tsx
|
|
6911
|
-
var
|
|
6727
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
6912
6728
|
var TYPE_NAME6 = "multiple-option-question";
|
|
6913
|
-
function
|
|
6914
|
-
return (0,
|
|
6729
|
+
function initNewContentEditor2() {
|
|
6730
|
+
return (0, import_lexical35.createEditor)();
|
|
6915
6731
|
}
|
|
6916
|
-
var MultipleOptionQuestionNode = class _MultipleOptionQuestionNode extends
|
|
6732
|
+
var MultipleOptionQuestionNode = class _MultipleOptionQuestionNode extends import_lexical35.DecoratorNode {
|
|
6917
6733
|
constructor(questionType, points, choices, correctChoices, incorrectChoices, grading, noneOfTheAbove, options, id, key) {
|
|
6918
6734
|
super(key);
|
|
6919
6735
|
this.__id = id || (0, import_nanoid4.nanoid)();
|
|
@@ -6930,7 +6746,7 @@ var MultipleOptionQuestionNode = class _MultipleOptionQuestionNode extends impor
|
|
|
6930
6746
|
this.__options.push({
|
|
6931
6747
|
id: optionItem.id,
|
|
6932
6748
|
correct: optionItem.correct,
|
|
6933
|
-
content: optionItem.content || (0,
|
|
6749
|
+
content: optionItem.content || (0, import_lexical35.createEditor)()
|
|
6934
6750
|
});
|
|
6935
6751
|
}
|
|
6936
6752
|
} else {
|
|
@@ -6940,7 +6756,7 @@ var MultipleOptionQuestionNode = class _MultipleOptionQuestionNode extends impor
|
|
|
6940
6756
|
id: (0, import_nanoid4.nanoid)(),
|
|
6941
6757
|
correct: i > 1,
|
|
6942
6758
|
// two first are false
|
|
6943
|
-
content:
|
|
6759
|
+
content: initNewContentEditor2()
|
|
6944
6760
|
});
|
|
6945
6761
|
}
|
|
6946
6762
|
} else {
|
|
@@ -6949,7 +6765,7 @@ var MultipleOptionQuestionNode = class _MultipleOptionQuestionNode extends impor
|
|
|
6949
6765
|
id: (0, import_nanoid4.nanoid)(),
|
|
6950
6766
|
correct: i < 1,
|
|
6951
6767
|
// one first are true
|
|
6952
|
-
content:
|
|
6768
|
+
content: initNewContentEditor2()
|
|
6953
6769
|
});
|
|
6954
6770
|
}
|
|
6955
6771
|
}
|
|
@@ -6993,7 +6809,7 @@ var MultipleOptionQuestionNode = class _MultipleOptionQuestionNode extends impor
|
|
|
6993
6809
|
static importJSON(serializedNode) {
|
|
6994
6810
|
const restoredOptions = [];
|
|
6995
6811
|
for (const optionItem of serializedNode.options) {
|
|
6996
|
-
const nestedEditor = (0,
|
|
6812
|
+
const nestedEditor = (0, import_lexical35.createEditor)();
|
|
6997
6813
|
const editorState = nestedEditor.parseEditorState(
|
|
6998
6814
|
optionItem.content.editorState
|
|
6999
6815
|
);
|
|
@@ -7099,7 +6915,7 @@ var MultipleOptionQuestionNode = class _MultipleOptionQuestionNode extends impor
|
|
|
7099
6915
|
newOptions.splice(optionItemIndex + 1, 0, {
|
|
7100
6916
|
id: (0, import_nanoid4.nanoid)(),
|
|
7101
6917
|
correct: correctChoice,
|
|
7102
|
-
content:
|
|
6918
|
+
content: initNewContentEditor2()
|
|
7103
6919
|
});
|
|
7104
6920
|
writable.__options = newOptions;
|
|
7105
6921
|
}
|
|
@@ -7114,11 +6930,11 @@ var MultipleOptionQuestionNode = class _MultipleOptionQuestionNode extends impor
|
|
|
7114
6930
|
appendOptionItem(initialOptionText, correctChoice) {
|
|
7115
6931
|
const writable = this.getWritable();
|
|
7116
6932
|
const newOptions = [...writable.__options];
|
|
7117
|
-
const content =
|
|
6933
|
+
const content = initNewContentEditor2();
|
|
7118
6934
|
content.update(() => {
|
|
7119
|
-
const root = (0,
|
|
7120
|
-
const firstChild = (0,
|
|
7121
|
-
firstChild.append((0,
|
|
6935
|
+
const root = (0, import_lexical35.$getRoot)();
|
|
6936
|
+
const firstChild = (0, import_lexical35.$createParagraphNode)();
|
|
6937
|
+
firstChild.append((0, import_lexical35.$createTextNode)(initialOptionText));
|
|
7122
6938
|
root.append(firstChild);
|
|
7123
6939
|
});
|
|
7124
6940
|
newOptions.push({
|
|
@@ -7129,7 +6945,7 @@ var MultipleOptionQuestionNode = class _MultipleOptionQuestionNode extends impor
|
|
|
7129
6945
|
writable.__options = newOptions;
|
|
7130
6946
|
}
|
|
7131
6947
|
decorate() {
|
|
7132
|
-
return /* @__PURE__ */ (0,
|
|
6948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
7133
6949
|
MultipleOptionQuestionComponent,
|
|
7134
6950
|
{
|
|
7135
6951
|
nodeKey: this.__key,
|
|
@@ -7141,7 +6957,7 @@ var MultipleOptionQuestionNode = class _MultipleOptionQuestionNode extends impor
|
|
|
7141
6957
|
}
|
|
7142
6958
|
};
|
|
7143
6959
|
function $createMultipleOptionQuestionNode(questionType, points, choices, correctChoices, incorrectChoices, grading, noneOfTheAbove, options, id) {
|
|
7144
|
-
return (0,
|
|
6960
|
+
return (0, import_lexical35.$applyNodeReplacement)(
|
|
7145
6961
|
new MultipleOptionQuestionNode(
|
|
7146
6962
|
questionType,
|
|
7147
6963
|
points,
|
|
@@ -7156,7 +6972,7 @@ function $createMultipleOptionQuestionNode(questionType, points, choices, correc
|
|
|
7156
6972
|
);
|
|
7157
6973
|
}
|
|
7158
6974
|
function $createEmptyMultipleOptionQuestionNode(questionType, points) {
|
|
7159
|
-
return (0,
|
|
6975
|
+
return (0, import_lexical35.$applyNodeReplacement)(
|
|
7160
6976
|
new MultipleOptionQuestionNode(
|
|
7161
6977
|
questionType,
|
|
7162
6978
|
points,
|
|
@@ -7175,52 +6991,52 @@ function $isMultipleOptionQuestionNode(node) {
|
|
|
7175
6991
|
}
|
|
7176
6992
|
|
|
7177
6993
|
// src/plugins/ShortAnswerQuestionPlugin/ShortAnswerQuestionNode.tsx
|
|
7178
|
-
var
|
|
6994
|
+
var import_lexical37 = require("lexical");
|
|
7179
6995
|
var import_nanoid5 = require("nanoid");
|
|
7180
6996
|
|
|
7181
6997
|
// src/plugins/ShortAnswerQuestionPlugin/ShortAnswerQuestionComponent.tsx
|
|
7182
|
-
var
|
|
6998
|
+
var import_LexicalComposerContext30 = require("@lexical/react/LexicalComposerContext");
|
|
7183
6999
|
var import_LexicalErrorBoundary5 = require("@lexical/react/LexicalErrorBoundary");
|
|
7184
7000
|
var import_LexicalHistoryPlugin6 = require("@lexical/react/LexicalHistoryPlugin");
|
|
7185
7001
|
var import_LexicalNestedComposer5 = require("@lexical/react/LexicalNestedComposer");
|
|
7186
7002
|
var import_LexicalRichTextPlugin5 = require("@lexical/react/LexicalRichTextPlugin");
|
|
7187
|
-
var
|
|
7188
|
-
var
|
|
7189
|
-
var
|
|
7003
|
+
var import_lexical36 = require("lexical");
|
|
7004
|
+
var import_react47 = require("react");
|
|
7005
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
7190
7006
|
function ShortAnswerQuestionComponent(props) {
|
|
7191
7007
|
const { nodeKey, id, notes } = props;
|
|
7192
7008
|
const { historyState } = useSharedHistoryContext();
|
|
7193
|
-
const [editor] = (0,
|
|
7194
|
-
const rootElementRef = (0,
|
|
7195
|
-
(0,
|
|
7009
|
+
const [editor] = (0, import_LexicalComposerContext30.useLexicalComposerContext)();
|
|
7010
|
+
const rootElementRef = (0, import_react47.useRef)(null);
|
|
7011
|
+
(0, import_react47.useEffect)(() => {
|
|
7196
7012
|
return editor.registerCommand(
|
|
7197
|
-
|
|
7013
|
+
import_lexical36.CLICK_COMMAND,
|
|
7198
7014
|
(event, _activeEditor) => {
|
|
7199
7015
|
if (rootElementRef.current?.contains(event.target) && event.target.hasAttribute(
|
|
7200
7016
|
"data-selectable"
|
|
7201
7017
|
)) {
|
|
7202
7018
|
editor.update(() => {
|
|
7203
|
-
const foundNode = (0,
|
|
7019
|
+
const foundNode = (0, import_lexical36.$getNodeByKey)(nodeKey);
|
|
7204
7020
|
if ($isShortAnswerQuestionNode(foundNode)) {
|
|
7205
|
-
const selection = (0,
|
|
7021
|
+
const selection = (0, import_lexical36.$createNodeSelection)();
|
|
7206
7022
|
selection.add(nodeKey);
|
|
7207
|
-
(0,
|
|
7023
|
+
(0, import_lexical36.$setSelection)(selection);
|
|
7208
7024
|
}
|
|
7209
7025
|
});
|
|
7210
7026
|
}
|
|
7211
7027
|
return false;
|
|
7212
7028
|
},
|
|
7213
|
-
|
|
7029
|
+
import_lexical36.COMMAND_PRIORITY_LOW
|
|
7214
7030
|
);
|
|
7215
7031
|
}, [editor]);
|
|
7216
|
-
return /* @__PURE__ */ (0,
|
|
7032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
7217
7033
|
"div",
|
|
7218
7034
|
{
|
|
7219
7035
|
ref: rootElementRef,
|
|
7220
7036
|
id,
|
|
7221
7037
|
className: "short-answer-question-prompt",
|
|
7222
7038
|
children: [
|
|
7223
|
-
/* @__PURE__ */ (0,
|
|
7039
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
7224
7040
|
"div",
|
|
7225
7041
|
{
|
|
7226
7042
|
className: "short-answer-question-prompt-title",
|
|
@@ -7228,34 +7044,39 @@ function ShortAnswerQuestionComponent(props) {
|
|
|
7228
7044
|
children: "Short Answer"
|
|
7229
7045
|
}
|
|
7230
7046
|
),
|
|
7231
|
-
/* @__PURE__ */ (0,
|
|
7047
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
7232
7048
|
"div",
|
|
7233
7049
|
{
|
|
7234
7050
|
className: "short-answer-question-prompt-content",
|
|
7235
7051
|
"data-selectable": "true",
|
|
7236
7052
|
children: [
|
|
7237
|
-
/* @__PURE__ */ (0,
|
|
7238
|
-
/* @__PURE__ */ (0,
|
|
7239
|
-
/* @__PURE__ */ (0,
|
|
7240
|
-
/* @__PURE__ */ (0,
|
|
7053
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "title", "data-selectable": "true", children: "Answer Key" }),
|
|
7054
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_LexicalNestedComposer5.LexicalNestedComposer, { initialEditor: notes, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(NestedEditor, { nodeKey, children: [
|
|
7055
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(SettingsPanelNestedAgentPlugin, {}),
|
|
7056
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
7241
7057
|
import_LexicalRichTextPlugin5.RichTextPlugin,
|
|
7242
7058
|
{
|
|
7243
|
-
contentEditable: /* @__PURE__ */ (0,
|
|
7059
|
+
contentEditable: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(NestedContentEditable, {}),
|
|
7244
7060
|
ErrorBoundary: import_LexicalErrorBoundary5.LexicalErrorBoundary,
|
|
7245
7061
|
placeholder: null
|
|
7246
7062
|
},
|
|
7247
7063
|
nodeKey
|
|
7248
7064
|
),
|
|
7249
|
-
/* @__PURE__ */ (0,
|
|
7250
|
-
/* @__PURE__ */ (0,
|
|
7065
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_LexicalHistoryPlugin6.HistoryPlugin, { externalHistoryState: historyState }),
|
|
7066
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
7251
7067
|
TextToolbarAgentPlugin,
|
|
7252
7068
|
{
|
|
7253
7069
|
decoratorNode: ShortAnswerQuestionNode
|
|
7254
7070
|
}
|
|
7255
7071
|
),
|
|
7256
|
-
/* @__PURE__ */ (0,
|
|
7257
|
-
|
|
7258
|
-
|
|
7072
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
7073
|
+
TypeaheadVariableAgentPlugin,
|
|
7074
|
+
{
|
|
7075
|
+
decoratorNode: ShortAnswerQuestionNode
|
|
7076
|
+
}
|
|
7077
|
+
),
|
|
7078
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(VariableComponentPlugin, {}),
|
|
7079
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(VariableToolbarAgentPlugin, {})
|
|
7259
7080
|
] }) }) })
|
|
7260
7081
|
]
|
|
7261
7082
|
}
|
|
@@ -7266,18 +7087,18 @@ function ShortAnswerQuestionComponent(props) {
|
|
|
7266
7087
|
}
|
|
7267
7088
|
|
|
7268
7089
|
// src/plugins/ShortAnswerQuestionPlugin/ShortAnswerQuestionNode.tsx
|
|
7269
|
-
var
|
|
7090
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
7270
7091
|
var TYPE_NAME7 = "short-answer-question";
|
|
7271
|
-
function
|
|
7272
|
-
return (0,
|
|
7092
|
+
function initNewContentEditor3() {
|
|
7093
|
+
return (0, import_lexical37.createEditor)();
|
|
7273
7094
|
}
|
|
7274
|
-
var ShortAnswerQuestionNode = class _ShortAnswerQuestionNode extends
|
|
7095
|
+
var ShortAnswerQuestionNode = class _ShortAnswerQuestionNode extends import_lexical37.DecoratorNode {
|
|
7275
7096
|
constructor(points, maxWords, id, notes, key) {
|
|
7276
7097
|
super(key);
|
|
7277
7098
|
this.__id = id || (0, import_nanoid5.nanoid)();
|
|
7278
7099
|
this.__points = points <= 0 ? 1 : points;
|
|
7279
7100
|
this.__maxWords = maxWords;
|
|
7280
|
-
this.__notes = notes ||
|
|
7101
|
+
this.__notes = notes || initNewContentEditor3();
|
|
7281
7102
|
}
|
|
7282
7103
|
static getType() {
|
|
7283
7104
|
return TYPE_NAME7;
|
|
@@ -7310,7 +7131,7 @@ var ShortAnswerQuestionNode = class _ShortAnswerQuestionNode extends import_lexi
|
|
|
7310
7131
|
return null;
|
|
7311
7132
|
}
|
|
7312
7133
|
static importJSON(serializedNode) {
|
|
7313
|
-
const nestedEditor = (0,
|
|
7134
|
+
const nestedEditor = (0, import_lexical37.createEditor)();
|
|
7314
7135
|
const editorState = nestedEditor.parseEditorState(
|
|
7315
7136
|
serializedNode.notes.editorState
|
|
7316
7137
|
);
|
|
@@ -7355,7 +7176,7 @@ var ShortAnswerQuestionNode = class _ShortAnswerQuestionNode extends import_lexi
|
|
|
7355
7176
|
writable.__maxWords = maxWords;
|
|
7356
7177
|
}
|
|
7357
7178
|
decorate() {
|
|
7358
|
-
return /* @__PURE__ */ (0,
|
|
7179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
7359
7180
|
ShortAnswerQuestionComponent,
|
|
7360
7181
|
{
|
|
7361
7182
|
nodeKey: this.__key,
|
|
@@ -7366,7 +7187,7 @@ var ShortAnswerQuestionNode = class _ShortAnswerQuestionNode extends import_lexi
|
|
|
7366
7187
|
}
|
|
7367
7188
|
};
|
|
7368
7189
|
function $createShortAnswerQuestionNode(points, maxWords, id, notes) {
|
|
7369
|
-
return (0,
|
|
7190
|
+
return (0, import_lexical37.$applyNodeReplacement)(
|
|
7370
7191
|
new ShortAnswerQuestionNode(points, maxWords, id, notes)
|
|
7371
7192
|
);
|
|
7372
7193
|
}
|
|
@@ -7374,294 +7195,390 @@ function $isShortAnswerQuestionNode(node) {
|
|
|
7374
7195
|
return node instanceof ShortAnswerQuestionNode;
|
|
7375
7196
|
}
|
|
7376
7197
|
|
|
7377
|
-
// src/plugins/
|
|
7378
|
-
var
|
|
7379
|
-
var
|
|
7380
|
-
var
|
|
7381
|
-
var
|
|
7382
|
-
var
|
|
7383
|
-
var
|
|
7384
|
-
function
|
|
7385
|
-
const { decoratorNode } = props;
|
|
7386
|
-
const
|
|
7387
|
-
(0,
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
(
|
|
7392
|
-
if (
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
{ decoratorNode }
|
|
7396
|
-
);
|
|
7397
|
-
}
|
|
7398
|
-
return false;
|
|
7399
|
-
},
|
|
7400
|
-
import_lexical40.COMMAND_PRIORITY_EDITOR
|
|
7401
|
-
),
|
|
7402
|
-
editor.registerUpdateListener(({ tags }) => {
|
|
7403
|
-
if (!tags.has("history-merge")) {
|
|
7404
|
-
editor.dispatchCommand(
|
|
7405
|
-
TEXT_TOOLBAR_SELECTION_CHANGE_COMMAND,
|
|
7406
|
-
{ decoratorNode }
|
|
7407
|
-
);
|
|
7408
|
-
}
|
|
7409
|
-
})
|
|
7410
|
-
);
|
|
7411
|
-
}, [editor]);
|
|
7412
|
-
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_jsx_runtime66.Fragment, {});
|
|
7413
|
-
}
|
|
7414
|
-
|
|
7415
|
-
// src/plugins/TypeaheadMenuPlugin/TypeaheadMenuAgentPlugin.tsx
|
|
7416
|
-
var import_LexicalComposerContext34 = require("@lexical/react/LexicalComposerContext");
|
|
7417
|
-
var import_utils11 = require("@lexical/utils");
|
|
7418
|
-
var import_lexical41 = require("lexical");
|
|
7419
|
-
var import_react51 = require("react");
|
|
7420
|
-
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
7421
|
-
var TYPEAHEAD_MENU_COMMAND = (0, import_lexical41.createCommand)("TEXT_TOOLBAR_SELECTION_CHANGE_COMMAND");
|
|
7422
|
-
function TypeaheadMenuAgentPlugin(props) {
|
|
7423
|
-
const { decoratorNode } = props;
|
|
7424
|
-
const [editor] = (0, import_LexicalComposerContext34.useLexicalComposerContext)();
|
|
7425
|
-
(0, import_react51.useEffect)(() => {
|
|
7426
|
-
return (0, import_utils11.mergeRegister)(
|
|
7427
|
-
editor.registerUpdateListener(({ tags }) => {
|
|
7428
|
-
if (!tags.has("history-merge")) {
|
|
7429
|
-
editor.dispatchCommand(TYPEAHEAD_MENU_COMMAND, {
|
|
7430
|
-
decoratorNode
|
|
7431
|
-
});
|
|
7432
|
-
}
|
|
7433
|
-
})
|
|
7434
|
-
);
|
|
7435
|
-
}, [editor, decoratorNode]);
|
|
7436
|
-
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_jsx_runtime67.Fragment, {});
|
|
7437
|
-
}
|
|
7438
|
-
|
|
7439
|
-
// src/plugins/FillInTheBlankQuestionPlugin/FillInTheBlankQuestionComponent.tsx
|
|
7440
|
-
var import_LexicalComposerContext36 = require("@lexical/react/LexicalComposerContext");
|
|
7441
|
-
var import_LexicalErrorBoundary6 = require("@lexical/react/LexicalErrorBoundary");
|
|
7442
|
-
var import_LexicalHistoryPlugin7 = require("@lexical/react/LexicalHistoryPlugin");
|
|
7443
|
-
var import_LexicalListPlugin2 = require("@lexical/react/LexicalListPlugin");
|
|
7444
|
-
var import_LexicalNestedComposer6 = require("@lexical/react/LexicalNestedComposer");
|
|
7445
|
-
var import_LexicalRichTextPlugin6 = require("@lexical/react/LexicalRichTextPlugin");
|
|
7446
|
-
var import_LexicalTabIndentationPlugin2 = require("@lexical/react/LexicalTabIndentationPlugin");
|
|
7447
|
-
var import_lexical44 = require("lexical");
|
|
7448
|
-
var import_react53 = require("react");
|
|
7449
|
-
|
|
7450
|
-
// src/utils/extractSelectionNode.ts
|
|
7451
|
-
var import_lexical42 = require("lexical");
|
|
7452
|
-
function $extractSelectionNode() {
|
|
7453
|
-
const selection = (0, import_lexical42.$getSelection)();
|
|
7454
|
-
if (!(0, import_lexical42.$isRangeSelection)(selection) || selection.isCollapsed()) {
|
|
7455
|
-
return null;
|
|
7456
|
-
}
|
|
7457
|
-
const anchor = selection.anchor;
|
|
7458
|
-
if (anchor.type !== "text") {
|
|
7459
|
-
return null;
|
|
7460
|
-
}
|
|
7461
|
-
const anchorNode = anchor.getNode();
|
|
7462
|
-
if (!anchorNode.isSimpleText()) {
|
|
7463
|
-
return null;
|
|
7464
|
-
}
|
|
7465
|
-
const focus = selection.focus;
|
|
7466
|
-
const startOffset = Math.min(anchor.offset, focus.offset);
|
|
7467
|
-
let selectionOffset = Math.max(anchor.offset, focus.offset);
|
|
7468
|
-
if (startOffset < 0) {
|
|
7469
|
-
return null;
|
|
7470
|
-
}
|
|
7471
|
-
const textContent = anchorNode.getTextContent().slice(startOffset, selectionOffset);
|
|
7472
|
-
if (!textContent) {
|
|
7473
|
-
return null;
|
|
7474
|
-
}
|
|
7475
|
-
const textLength = textContent.length;
|
|
7476
|
-
const validTextLength = textContent.trim().length;
|
|
7477
|
-
selectionOffset -= textLength - validTextLength;
|
|
7478
|
-
let newNode;
|
|
7479
|
-
if (startOffset === 0) {
|
|
7480
|
-
[newNode] = anchorNode.splitText(selectionOffset);
|
|
7481
|
-
} else {
|
|
7482
|
-
[, newNode] = anchorNode.splitText(startOffset, selectionOffset);
|
|
7483
|
-
}
|
|
7484
|
-
return newNode;
|
|
7485
|
-
}
|
|
7486
|
-
|
|
7487
|
-
// src/plugins/FillInTheBlankQuestionPlugin/FillInTheBlankSpaceComponentPlugin.tsx
|
|
7488
|
-
var import_LexicalComposerContext35 = require("@lexical/react/LexicalComposerContext");
|
|
7489
|
-
var import_utils12 = require("@lexical/utils");
|
|
7490
|
-
var import_lexical43 = require("lexical");
|
|
7491
|
-
var import_react52 = require("react");
|
|
7492
|
-
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
7493
|
-
function FillInTheBlankSpaceComponentPlugin() {
|
|
7494
|
-
const { nestedEditorId } = useNestedEditor();
|
|
7495
|
-
const [editor] = (0, import_LexicalComposerContext35.useLexicalComposerContext)();
|
|
7496
|
-
const lastSelectedNodeRef = (0, import_react52.useRef)(
|
|
7497
|
-
void 0
|
|
7498
|
-
);
|
|
7499
|
-
const selectedSpaceNodeKeyRef = (0, import_react52.useRef)(void 0);
|
|
7500
|
-
(0, import_react52.useEffect)(() => {
|
|
7501
|
-
return (0, import_utils12.mergeRegister)(
|
|
7502
|
-
editor.registerCommand(
|
|
7503
|
-
CREATE_SPACE_FROM_SELECTION_COMMAND,
|
|
7504
|
-
() => {
|
|
7505
|
-
const textNode = $extractSelectionNode();
|
|
7506
|
-
if (textNode) {
|
|
7507
|
-
const spaceName = textNode.getTextContent();
|
|
7508
|
-
const newSpaceNode = $createFillInTheBlankSpaceNode(spaceName);
|
|
7509
|
-
textNode.replace(newSpaceNode);
|
|
7510
|
-
textNode.getParent()?.selectEnd();
|
|
7511
|
-
}
|
|
7512
|
-
return true;
|
|
7513
|
-
},
|
|
7514
|
-
import_lexical43.COMMAND_PRIORITY_EDITOR
|
|
7515
|
-
),
|
|
7516
|
-
// todo: extract this as a separate plugin
|
|
7517
|
-
// that tracks clicks on decorators and manages arrow keys
|
|
7518
|
-
editor.registerCommand(
|
|
7519
|
-
import_lexical43.CLICK_COMMAND,
|
|
7520
|
-
(payload) => {
|
|
7521
|
-
if (payload.target) {
|
|
7522
|
-
const spaceNodeKey = payload.target.getAttribute("data-block-editor-space");
|
|
7523
|
-
if (spaceNodeKey) {
|
|
7524
|
-
selectedSpaceNodeKeyRef.current = spaceNodeKey;
|
|
7525
|
-
editor.update(() => {
|
|
7526
|
-
const newSelection = (0, import_lexical43.$createNodeSelection)();
|
|
7527
|
-
newSelection.add(spaceNodeKey);
|
|
7528
|
-
(0, import_lexical43.$setSelection)(newSelection);
|
|
7529
|
-
});
|
|
7530
|
-
return true;
|
|
7531
|
-
}
|
|
7532
|
-
}
|
|
7533
|
-
selectedSpaceNodeKeyRef.current = void 0;
|
|
7534
|
-
return false;
|
|
7535
|
-
},
|
|
7536
|
-
import_lexical43.COMMAND_PRIORITY_HIGH
|
|
7537
|
-
),
|
|
7538
|
-
editor.registerCommand(
|
|
7539
|
-
import_lexical43.SELECTION_CHANGE_COMMAND,
|
|
7540
|
-
() => {
|
|
7541
|
-
const selection = (0, import_lexical43.$getSelection)();
|
|
7542
|
-
if ((0, import_lexical43.$isRangeSelection)(selection)) {
|
|
7543
|
-
lastSelectedNodeRef.current = selection.anchor.getNode();
|
|
7544
|
-
}
|
|
7545
|
-
return false;
|
|
7546
|
-
},
|
|
7547
|
-
import_lexical43.COMMAND_PRIORITY_EDITOR
|
|
7548
|
-
),
|
|
7549
|
-
...[
|
|
7550
|
-
import_lexical43.KEY_ARROW_UP_COMMAND,
|
|
7551
|
-
import_lexical43.KEY_ARROW_RIGHT_COMMAND,
|
|
7552
|
-
import_lexical43.KEY_ARROW_DOWN_COMMAND,
|
|
7553
|
-
import_lexical43.KEY_ARROW_LEFT_COMMAND
|
|
7554
|
-
].map(
|
|
7555
|
-
(keyCommand) => editor.registerCommand(
|
|
7556
|
-
keyCommand,
|
|
7557
|
-
() => {
|
|
7558
|
-
if (selectedSpaceNodeKeyRef.current) {
|
|
7559
|
-
selectedSpaceNodeKeyRef.current = void 0;
|
|
7560
|
-
if (lastSelectedNodeRef.current) {
|
|
7561
|
-
lastSelectedNodeRef.current.select();
|
|
7562
|
-
} else {
|
|
7563
|
-
editor.focus();
|
|
7564
|
-
}
|
|
7565
|
-
}
|
|
7566
|
-
return false;
|
|
7567
|
-
},
|
|
7568
|
-
import_lexical43.COMMAND_PRIORITY_EDITOR
|
|
7569
|
-
)
|
|
7570
|
-
)
|
|
7571
|
-
);
|
|
7572
|
-
}, [editor, nestedEditorId]);
|
|
7573
|
-
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_jsx_runtime68.Fragment, {});
|
|
7574
|
-
}
|
|
7575
|
-
|
|
7576
|
-
// src/plugins/FillInTheBlankQuestionPlugin/FillInTheBlankQuestionComponent.tsx
|
|
7577
|
-
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
7578
|
-
var CREATE_SPACE_FROM_SELECTION_COMMAND = (0, import_lexical44.createCommand)("CREATE_SPACE_FROM_SELECTION_COMMAND");
|
|
7579
|
-
function FillInTheBlankQuestionComponent(props) {
|
|
7580
|
-
const { nodeKey, id, content } = props;
|
|
7581
|
-
const { historyState } = useSharedHistoryContext();
|
|
7582
|
-
const [editor] = (0, import_LexicalComposerContext36.useLexicalComposerContext)();
|
|
7583
|
-
const rootElementRef = (0, import_react53.useRef)(null);
|
|
7584
|
-
(0, import_react53.useEffect)(() => {
|
|
7585
|
-
return editor.registerCommand(
|
|
7586
|
-
import_lexical44.CLICK_COMMAND,
|
|
7587
|
-
(event, _activeEditor) => {
|
|
7588
|
-
if (!event.target.hasAttribute(
|
|
7589
|
-
"data-block-editor-space"
|
|
7590
|
-
)) {
|
|
7591
|
-
if (rootElementRef.current?.contains(event.target) && event.target.hasAttribute(
|
|
7592
|
-
"data-selectable"
|
|
7593
|
-
)) {
|
|
7594
|
-
editor.update(() => {
|
|
7595
|
-
const foundNode = (0, import_lexical44.$getNodeByKey)(nodeKey);
|
|
7596
|
-
if ($isFillInTheBlankQuestionNode(foundNode)) {
|
|
7597
|
-
const selection = (0, import_lexical44.$createNodeSelection)();
|
|
7598
|
-
selection.add(nodeKey);
|
|
7599
|
-
(0, import_lexical44.$setSelection)(selection);
|
|
7600
|
-
}
|
|
7198
|
+
// src/plugins/VariablesPlugin/TypeaheadVariableAgentPlugin.tsx
|
|
7199
|
+
var import_LexicalComposerContext31 = require("@lexical/react/LexicalComposerContext");
|
|
7200
|
+
var import_utils9 = require("@lexical/utils");
|
|
7201
|
+
var import_lexical38 = require("lexical");
|
|
7202
|
+
var import_react48 = require("react");
|
|
7203
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
7204
|
+
var TYPEAHEAD_VARIABLE_COMMAND = (0, import_lexical38.createCommand)("TYPEAHEAD_VARIABLE_COMMAND");
|
|
7205
|
+
function TypeaheadVariableAgentPlugin(props) {
|
|
7206
|
+
const { decoratorNode } = props;
|
|
7207
|
+
const { hasModule, modulesNumber } = useBlockEditor();
|
|
7208
|
+
const [editor] = (0, import_LexicalComposerContext31.useLexicalComposerContext)();
|
|
7209
|
+
(0, import_react48.useEffect)(() => {
|
|
7210
|
+
if (hasModule("Variables")) {
|
|
7211
|
+
return (0, import_utils9.mergeRegister)(
|
|
7212
|
+
editor.registerUpdateListener(({ tags }) => {
|
|
7213
|
+
if (!tags.has("history-merge")) {
|
|
7214
|
+
editor.dispatchCommand(TYPEAHEAD_VARIABLE_COMMAND, {
|
|
7215
|
+
decoratorNode
|
|
7601
7216
|
});
|
|
7602
7217
|
}
|
|
7218
|
+
})
|
|
7219
|
+
);
|
|
7220
|
+
}
|
|
7221
|
+
}, [editor, modulesNumber, decoratorNode, hasModule]);
|
|
7222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_jsx_runtime64.Fragment, {});
|
|
7223
|
+
}
|
|
7224
|
+
|
|
7225
|
+
// src/plugins/JournalEntryQuestionPlugin/JournalEntryQuestionItemComponent.tsx
|
|
7226
|
+
var import_LexicalComposerContext32 = require("@lexical/react/LexicalComposerContext");
|
|
7227
|
+
var import_LexicalErrorBoundary6 = require("@lexical/react/LexicalErrorBoundary");
|
|
7228
|
+
var import_LexicalHistoryPlugin7 = require("@lexical/react/LexicalHistoryPlugin");
|
|
7229
|
+
var import_LexicalNestedComposer6 = require("@lexical/react/LexicalNestedComposer");
|
|
7230
|
+
var import_LexicalRichTextPlugin6 = require("@lexical/react/LexicalRichTextPlugin");
|
|
7231
|
+
var import_clsx4 = __toESM(require("clsx"));
|
|
7232
|
+
var import_lexical39 = require("lexical");
|
|
7233
|
+
var import_lucide_react7 = require("lucide-react");
|
|
7234
|
+
var import_react49 = require("react");
|
|
7235
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
7236
|
+
function JournalEntryQuestionItemComponent(props) {
|
|
7237
|
+
const { nodeKey, id, itemIndex, correct, credit, debit, account } = props;
|
|
7238
|
+
const { historyState } = useSharedHistoryContext();
|
|
7239
|
+
const [editor] = (0, import_LexicalComposerContext32.useLexicalComposerContext)();
|
|
7240
|
+
const addItem = (0, import_react49.useCallback)(() => {
|
|
7241
|
+
editor.update(
|
|
7242
|
+
() => {
|
|
7243
|
+
const foundNode = (0, import_lexical39.$getNodeByKey)(nodeKey);
|
|
7244
|
+
if ($isJournalEntryQuestionNode(foundNode)) {
|
|
7245
|
+
foundNode.addItem(itemIndex, correct);
|
|
7603
7246
|
}
|
|
7604
|
-
return false;
|
|
7605
7247
|
},
|
|
7606
|
-
|
|
7248
|
+
{
|
|
7249
|
+
onUpdate: () => {
|
|
7250
|
+
editor.getEditorState().read(() => {
|
|
7251
|
+
const foundNode = (0, import_lexical39.$getNodeByKey)(nodeKey);
|
|
7252
|
+
if ($isJournalEntryQuestionNode(foundNode)) {
|
|
7253
|
+
const newEntryItem = foundNode.__lineItems[itemIndex + 1];
|
|
7254
|
+
if (newEntryItem.account) {
|
|
7255
|
+
newEntryItem.account.update(() => {
|
|
7256
|
+
const root = (0, import_lexical39.$getRoot)();
|
|
7257
|
+
let firstChild = root.getFirstChild();
|
|
7258
|
+
if (!firstChild) {
|
|
7259
|
+
firstChild = (0, import_lexical39.$createParagraphNode)();
|
|
7260
|
+
root.append(firstChild);
|
|
7261
|
+
}
|
|
7262
|
+
firstChild.selectStart();
|
|
7263
|
+
});
|
|
7264
|
+
}
|
|
7265
|
+
if (newEntryItem.credit) {
|
|
7266
|
+
newEntryItem.credit.update(() => {
|
|
7267
|
+
const root = (0, import_lexical39.$getRoot)();
|
|
7268
|
+
let firstChild = root.getFirstChild();
|
|
7269
|
+
if (!firstChild) {
|
|
7270
|
+
firstChild = (0, import_lexical39.$createParagraphNode)();
|
|
7271
|
+
root.append(firstChild);
|
|
7272
|
+
}
|
|
7273
|
+
});
|
|
7274
|
+
}
|
|
7275
|
+
if (newEntryItem.debit) {
|
|
7276
|
+
newEntryItem.debit.update(() => {
|
|
7277
|
+
const root = (0, import_lexical39.$getRoot)();
|
|
7278
|
+
let firstChild = root.getFirstChild();
|
|
7279
|
+
if (!firstChild) {
|
|
7280
|
+
firstChild = (0, import_lexical39.$createParagraphNode)();
|
|
7281
|
+
root.append(firstChild);
|
|
7282
|
+
}
|
|
7283
|
+
});
|
|
7284
|
+
}
|
|
7285
|
+
}
|
|
7286
|
+
});
|
|
7287
|
+
}
|
|
7288
|
+
}
|
|
7607
7289
|
);
|
|
7608
|
-
}, [editor]);
|
|
7609
|
-
|
|
7290
|
+
}, [editor, nodeKey, itemIndex, correct]);
|
|
7291
|
+
const removeItem = (0, import_react49.useCallback)(() => {
|
|
7292
|
+
editor.update(() => {
|
|
7293
|
+
const foundNode = (0, import_lexical39.$getNodeByKey)(nodeKey);
|
|
7294
|
+
if ($isJournalEntryQuestionNode(foundNode)) {
|
|
7295
|
+
foundNode.removeItem(itemIndex);
|
|
7296
|
+
}
|
|
7297
|
+
});
|
|
7298
|
+
}, [editor, nodeKey, itemIndex]);
|
|
7299
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
7610
7300
|
"div",
|
|
7611
7301
|
{
|
|
7612
|
-
ref: rootElementRef,
|
|
7613
7302
|
id,
|
|
7614
|
-
className: "
|
|
7303
|
+
className: "journal-entry-question-prompt-question-item-wrapper",
|
|
7615
7304
|
children: [
|
|
7616
|
-
/* @__PURE__ */ (0,
|
|
7305
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
7617
7306
|
"div",
|
|
7618
7307
|
{
|
|
7619
|
-
className:
|
|
7308
|
+
className: (0, import_clsx4.default)(
|
|
7309
|
+
"journal-entry-question-prompt-question-item",
|
|
7310
|
+
{
|
|
7311
|
+
correct,
|
|
7312
|
+
incorrect: !correct
|
|
7313
|
+
}
|
|
7314
|
+
),
|
|
7620
7315
|
"data-selectable": "true",
|
|
7621
|
-
children:
|
|
7316
|
+
children: [
|
|
7317
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "title", "data-selectable": "true", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { "data-selectable": "true", children: correct ? "Account" : "Incorrect Choice" }) }),
|
|
7318
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { style: { height: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_LexicalNestedComposer6.LexicalNestedComposer, { initialEditor: account, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(NestedEditor, { nodeKey, children: [
|
|
7319
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(SettingsPanelNestedAgentPlugin, {}),
|
|
7320
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
7321
|
+
import_LexicalRichTextPlugin6.RichTextPlugin,
|
|
7322
|
+
{
|
|
7323
|
+
contentEditable: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(NestedContentEditable, {}),
|
|
7324
|
+
ErrorBoundary: import_LexicalErrorBoundary6.LexicalErrorBoundary,
|
|
7325
|
+
placeholder: null
|
|
7326
|
+
},
|
|
7327
|
+
nodeKey
|
|
7328
|
+
),
|
|
7329
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_LexicalHistoryPlugin7.HistoryPlugin, { externalHistoryState: historyState }),
|
|
7330
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
7331
|
+
TextToolbarAgentPlugin,
|
|
7332
|
+
{
|
|
7333
|
+
decoratorNode: JournalEntryQuestionNode
|
|
7334
|
+
}
|
|
7335
|
+
),
|
|
7336
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
7337
|
+
TypeaheadVariableAgentPlugin,
|
|
7338
|
+
{
|
|
7339
|
+
decoratorNode: JournalEntryQuestionNode
|
|
7340
|
+
}
|
|
7341
|
+
),
|
|
7342
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(VariableComponentPlugin, {})
|
|
7343
|
+
] }) }) }),
|
|
7344
|
+
(!debit || !credit) && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "controls", children: [
|
|
7345
|
+
itemIndex > 0 ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
7346
|
+
Button,
|
|
7347
|
+
{
|
|
7348
|
+
StartIcon: import_lucide_react7.CircleMinus,
|
|
7349
|
+
size: "medium",
|
|
7350
|
+
variant: "text",
|
|
7351
|
+
className: "cancel",
|
|
7352
|
+
onClick: removeItem
|
|
7353
|
+
}
|
|
7354
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", {}),
|
|
7355
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
7356
|
+
Button,
|
|
7357
|
+
{
|
|
7358
|
+
StartIcon: import_lucide_react7.CirclePlus,
|
|
7359
|
+
size: "medium",
|
|
7360
|
+
variant: "text",
|
|
7361
|
+
className: "cancel",
|
|
7362
|
+
onClick: addItem
|
|
7363
|
+
}
|
|
7364
|
+
) })
|
|
7365
|
+
] })
|
|
7366
|
+
]
|
|
7622
7367
|
}
|
|
7623
7368
|
),
|
|
7624
|
-
/* @__PURE__ */ (0,
|
|
7369
|
+
debit ? /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
7625
7370
|
"div",
|
|
7626
7371
|
{
|
|
7627
|
-
className:
|
|
7372
|
+
className: (0, import_clsx4.default)(
|
|
7373
|
+
"journal-entry-question-prompt-question-item",
|
|
7374
|
+
{
|
|
7375
|
+
correct,
|
|
7376
|
+
incorrect: !correct
|
|
7377
|
+
}
|
|
7378
|
+
),
|
|
7628
7379
|
"data-selectable": "true",
|
|
7629
7380
|
children: [
|
|
7630
|
-
/* @__PURE__ */ (0,
|
|
7631
|
-
/* @__PURE__ */ (0,
|
|
7632
|
-
/* @__PURE__ */ (0,
|
|
7633
|
-
/* @__PURE__ */ (0,
|
|
7634
|
-
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(FillInTheBlankSpaceSettingsPlugin, {}),
|
|
7635
|
-
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
7381
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "title", "data-selectable": "true", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { "data-selectable": "true", children: "Debit" }) }),
|
|
7382
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { style: { height: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_LexicalNestedComposer6.LexicalNestedComposer, { initialEditor: debit, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(NestedEditor, { nodeKey, children: [
|
|
7383
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(SettingsPanelNestedAgentPlugin, {}),
|
|
7384
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
7636
7385
|
import_LexicalRichTextPlugin6.RichTextPlugin,
|
|
7637
7386
|
{
|
|
7638
|
-
contentEditable: /* @__PURE__ */ (0,
|
|
7387
|
+
contentEditable: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(NestedContentEditable, {}),
|
|
7639
7388
|
ErrorBoundary: import_LexicalErrorBoundary6.LexicalErrorBoundary,
|
|
7640
7389
|
placeholder: null
|
|
7641
7390
|
},
|
|
7642
7391
|
nodeKey
|
|
7643
7392
|
),
|
|
7644
|
-
/* @__PURE__ */ (0,
|
|
7645
|
-
/* @__PURE__ */ (0,
|
|
7393
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_LexicalHistoryPlugin7.HistoryPlugin, { externalHistoryState: historyState }),
|
|
7394
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
7646
7395
|
TextToolbarAgentPlugin,
|
|
7647
7396
|
{
|
|
7648
|
-
decoratorNode:
|
|
7397
|
+
decoratorNode: JournalEntryQuestionNode
|
|
7649
7398
|
}
|
|
7650
7399
|
),
|
|
7651
|
-
/* @__PURE__ */ (0,
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
|
|
7655
|
-
|
|
7400
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
7401
|
+
TypeaheadVariableAgentPlugin,
|
|
7402
|
+
{
|
|
7403
|
+
decoratorNode: JournalEntryQuestionNode
|
|
7404
|
+
}
|
|
7405
|
+
),
|
|
7406
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(VariableComponentPlugin, {})
|
|
7407
|
+
] }) }) })
|
|
7408
|
+
]
|
|
7409
|
+
}
|
|
7410
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", {}),
|
|
7411
|
+
credit ? /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
7412
|
+
"div",
|
|
7413
|
+
{
|
|
7414
|
+
className: (0, import_clsx4.default)(
|
|
7415
|
+
"journal-entry-question-prompt-question-item",
|
|
7416
|
+
{
|
|
7417
|
+
correct,
|
|
7418
|
+
incorrect: !correct
|
|
7419
|
+
}
|
|
7420
|
+
),
|
|
7421
|
+
"data-selectable": "true",
|
|
7422
|
+
children: [
|
|
7423
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "title", "data-selectable": "true", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { "data-selectable": "true", children: "Credit" }) }),
|
|
7424
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { style: { height: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_LexicalNestedComposer6.LexicalNestedComposer, { initialEditor: credit, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(NestedEditor, { nodeKey, children: [
|
|
7425
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(SettingsPanelNestedAgentPlugin, {}),
|
|
7426
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
7427
|
+
import_LexicalRichTextPlugin6.RichTextPlugin,
|
|
7428
|
+
{
|
|
7429
|
+
contentEditable: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(NestedContentEditable, {}),
|
|
7430
|
+
ErrorBoundary: import_LexicalErrorBoundary6.LexicalErrorBoundary,
|
|
7431
|
+
placeholder: null
|
|
7432
|
+
},
|
|
7433
|
+
nodeKey
|
|
7434
|
+
),
|
|
7435
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_LexicalHistoryPlugin7.HistoryPlugin, { externalHistoryState: historyState }),
|
|
7436
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
7437
|
+
TextToolbarAgentPlugin,
|
|
7438
|
+
{
|
|
7439
|
+
decoratorNode: JournalEntryQuestionNode
|
|
7440
|
+
}
|
|
7441
|
+
),
|
|
7442
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
7443
|
+
TypeaheadVariableAgentPlugin,
|
|
7444
|
+
{
|
|
7445
|
+
decoratorNode: JournalEntryQuestionNode
|
|
7446
|
+
}
|
|
7447
|
+
),
|
|
7448
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(VariableComponentPlugin, {}),
|
|
7449
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(VariableToolbarAgentPlugin, {})
|
|
7450
|
+
] }) }) }),
|
|
7451
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "controls", children: [
|
|
7452
|
+
itemIndex > 0 ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
7453
|
+
Button,
|
|
7454
|
+
{
|
|
7455
|
+
StartIcon: import_lucide_react7.CircleMinus,
|
|
7456
|
+
size: "medium",
|
|
7457
|
+
variant: "text",
|
|
7458
|
+
className: "cancel",
|
|
7459
|
+
onClick: removeItem
|
|
7460
|
+
}
|
|
7461
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", {}),
|
|
7462
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
7463
|
+
Button,
|
|
7464
|
+
{
|
|
7465
|
+
StartIcon: import_lucide_react7.CirclePlus,
|
|
7466
|
+
size: "medium",
|
|
7467
|
+
variant: "text",
|
|
7468
|
+
className: "cancel",
|
|
7469
|
+
onClick: addItem
|
|
7470
|
+
}
|
|
7471
|
+
) })
|
|
7472
|
+
] })
|
|
7473
|
+
]
|
|
7474
|
+
}
|
|
7475
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", {})
|
|
7476
|
+
]
|
|
7477
|
+
}
|
|
7478
|
+
);
|
|
7479
|
+
}
|
|
7480
|
+
|
|
7481
|
+
// src/plugins/JournalEntryQuestionPlugin/JournalEntryQuestionComponent.tsx
|
|
7482
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
7483
|
+
function JournalEntryQuestionComponent(props) {
|
|
7484
|
+
const { nodeKey, journalType, lineItems, id } = props;
|
|
7485
|
+
const [editor] = (0, import_LexicalComposerContext33.useLexicalComposerContext)();
|
|
7486
|
+
const rootElementRef = (0, import_react50.useRef)(null);
|
|
7487
|
+
(0, import_react50.useEffect)(() => {
|
|
7488
|
+
return editor.registerCommand(
|
|
7489
|
+
import_lexical40.CLICK_COMMAND,
|
|
7490
|
+
(event, _activeEditor) => {
|
|
7491
|
+
if (rootElementRef.current?.contains(event.target) && event.target.hasAttribute(
|
|
7492
|
+
"data-selectable"
|
|
7493
|
+
)) {
|
|
7494
|
+
editor.update(() => {
|
|
7495
|
+
const foundNode = (0, import_lexical40.$getNodeByKey)(nodeKey);
|
|
7496
|
+
if ($isJournalEntryQuestionNode(foundNode)) {
|
|
7497
|
+
const selection = (0, import_lexical40.$createNodeSelection)();
|
|
7498
|
+
selection.add(nodeKey);
|
|
7499
|
+
(0, import_lexical40.$setSelection)(selection);
|
|
7500
|
+
}
|
|
7501
|
+
});
|
|
7502
|
+
}
|
|
7503
|
+
return false;
|
|
7504
|
+
},
|
|
7505
|
+
import_lexical40.COMMAND_PRIORITY_LOW
|
|
7506
|
+
);
|
|
7507
|
+
}, [editor]);
|
|
7508
|
+
const doNeedDistractor = lineItems.reduce((a, i) => {
|
|
7509
|
+
return i.correct ? a : ++a;
|
|
7510
|
+
}, 0) <= 0;
|
|
7511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
7512
|
+
"div",
|
|
7513
|
+
{
|
|
7514
|
+
ref: rootElementRef,
|
|
7515
|
+
id,
|
|
7516
|
+
className: "journal-entry-question-prompt",
|
|
7517
|
+
children: [
|
|
7518
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
7519
|
+
"div",
|
|
7520
|
+
{
|
|
7521
|
+
className: "journal-entry-question-prompt-title",
|
|
7522
|
+
"data-selectable": "true",
|
|
7523
|
+
children: "Journal Entry"
|
|
7524
|
+
}
|
|
7525
|
+
),
|
|
7526
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
7527
|
+
"div",
|
|
7528
|
+
{
|
|
7529
|
+
className: "journal-entry-question-prompt-items",
|
|
7530
|
+
"data-selectable": "true",
|
|
7531
|
+
children: [
|
|
7532
|
+
journalType === "noEntryRequiredCorrect" && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
7533
|
+
"div",
|
|
7534
|
+
{
|
|
7535
|
+
className: "journal-entry-question-prompt-question-item correct",
|
|
7536
|
+
"data-selectable": "true",
|
|
7537
|
+
children: [
|
|
7538
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "title", "data-selectable": "true", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { "data-selectable": "true", children: "Correct Choice" }) }),
|
|
7539
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { "data-selectable": "true", children: "No Entry Required" })
|
|
7540
|
+
]
|
|
7541
|
+
}
|
|
7542
|
+
),
|
|
7543
|
+
journalType === "noEntryRequiredCorrect" && lineItems.map((journalEntryItem, itemIndex) => {
|
|
7544
|
+
if (!journalEntryItem.correct) {
|
|
7545
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
7546
|
+
JournalEntryQuestionItemComponent,
|
|
7547
|
+
{
|
|
7548
|
+
nodeKey,
|
|
7549
|
+
id: journalEntryItem.id,
|
|
7550
|
+
itemIndex,
|
|
7551
|
+
correct: journalEntryItem.correct,
|
|
7552
|
+
account: journalEntryItem.account,
|
|
7553
|
+
debit: journalEntryItem.debit,
|
|
7554
|
+
credit: journalEntryItem.credit
|
|
7555
|
+
},
|
|
7556
|
+
journalEntryItem.id
|
|
7557
|
+
);
|
|
7558
|
+
}
|
|
7559
|
+
}),
|
|
7560
|
+
(journalType === "default" || journalType === "noEntryRequiredDistractor") && lineItems.map((journalEntryItem, itemIndex) => {
|
|
7561
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
7562
|
+
JournalEntryQuestionItemComponent,
|
|
7656
7563
|
{
|
|
7657
|
-
|
|
7658
|
-
|
|
7659
|
-
|
|
7660
|
-
|
|
7661
|
-
|
|
7662
|
-
|
|
7663
|
-
|
|
7664
|
-
|
|
7564
|
+
nodeKey,
|
|
7565
|
+
id: journalEntryItem.id,
|
|
7566
|
+
itemIndex,
|
|
7567
|
+
correct: journalEntryItem.correct,
|
|
7568
|
+
account: journalEntryItem.account,
|
|
7569
|
+
debit: journalEntryItem.debit,
|
|
7570
|
+
credit: journalEntryItem.credit
|
|
7571
|
+
},
|
|
7572
|
+
journalEntryItem.id
|
|
7573
|
+
);
|
|
7574
|
+
}),
|
|
7575
|
+
doNeedDistractor && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
7576
|
+
DistractorButton,
|
|
7577
|
+
{
|
|
7578
|
+
nodeKey,
|
|
7579
|
+
itemIndex: lineItems.length - 1
|
|
7580
|
+
}
|
|
7581
|
+
)
|
|
7665
7582
|
]
|
|
7666
7583
|
}
|
|
7667
7584
|
)
|
|
@@ -7670,33 +7587,65 @@ function FillInTheBlankQuestionComponent(props) {
|
|
|
7670
7587
|
);
|
|
7671
7588
|
}
|
|
7672
7589
|
|
|
7673
|
-
// src/plugins/
|
|
7674
|
-
var
|
|
7675
|
-
var
|
|
7676
|
-
|
|
7677
|
-
|
|
7590
|
+
// src/plugins/JournalEntryQuestionPlugin/JournalEntryQuestionNode.tsx
|
|
7591
|
+
var import_lexical41 = require("lexical");
|
|
7592
|
+
var import_nanoid6 = require("nanoid");
|
|
7593
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
7594
|
+
var TYPE_NAME8 = "journal-entry-question";
|
|
7595
|
+
var JournalTypeLabelMap = {
|
|
7596
|
+
default: "Default",
|
|
7597
|
+
noEntryRequiredCorrect: "No Entry Required Correct",
|
|
7598
|
+
noEntryRequiredDistractor: "No Entry Required Distractor"
|
|
7599
|
+
};
|
|
7600
|
+
function initNewContentEditor4() {
|
|
7601
|
+
return (0, import_lexical41.createEditor)();
|
|
7678
7602
|
}
|
|
7679
|
-
var
|
|
7680
|
-
constructor(
|
|
7603
|
+
var JournalEntryQuestionNode = class _JournalEntryQuestionNode extends import_lexical41.DecoratorNode {
|
|
7604
|
+
constructor(points, journalType, errorTolerance, lineItems, id, key) {
|
|
7681
7605
|
super(key);
|
|
7606
|
+
this.__points = points < 0 ? 1 : points;
|
|
7607
|
+
this.__journalType = journalType;
|
|
7608
|
+
this.__errorTolerance = errorTolerance;
|
|
7682
7609
|
this.__id = id || (0, import_nanoid6.nanoid)();
|
|
7683
|
-
this.
|
|
7684
|
-
|
|
7610
|
+
this.__lineItems = [];
|
|
7611
|
+
if (lineItems) {
|
|
7612
|
+
for (const item of lineItems) {
|
|
7613
|
+
this.__lineItems.push({
|
|
7614
|
+
id: item.id,
|
|
7615
|
+
correct: item.correct,
|
|
7616
|
+
account: item.account,
|
|
7617
|
+
credit: item.correct ? item.credit : void 0,
|
|
7618
|
+
debit: item.correct ? item.debit : void 0
|
|
7619
|
+
});
|
|
7620
|
+
}
|
|
7621
|
+
} else {
|
|
7622
|
+
for (let i = 0; i < 2; i++) {
|
|
7623
|
+
this.__lineItems.push({
|
|
7624
|
+
id: (0, import_nanoid6.nanoid)(),
|
|
7625
|
+
correct: true,
|
|
7626
|
+
account: initNewContentEditor4(),
|
|
7627
|
+
credit: initNewContentEditor4(),
|
|
7628
|
+
debit: initNewContentEditor4()
|
|
7629
|
+
});
|
|
7630
|
+
}
|
|
7631
|
+
}
|
|
7685
7632
|
}
|
|
7686
7633
|
static getType() {
|
|
7687
7634
|
return TYPE_NAME8;
|
|
7688
7635
|
}
|
|
7689
7636
|
static clone(node) {
|
|
7690
|
-
return new
|
|
7691
|
-
node.
|
|
7637
|
+
return new _JournalEntryQuestionNode(
|
|
7638
|
+
node.__points,
|
|
7639
|
+
node.__journalType,
|
|
7640
|
+
node.__errorTolerance,
|
|
7641
|
+
node.__lineItems,
|
|
7692
7642
|
node.__id,
|
|
7693
|
-
node.__content,
|
|
7694
7643
|
node.__key
|
|
7695
7644
|
);
|
|
7696
7645
|
}
|
|
7697
7646
|
__createWrapper() {
|
|
7698
7647
|
const wrapper = document.createElement("div");
|
|
7699
|
-
wrapper.classList.add("
|
|
7648
|
+
wrapper.classList.add("journal-entry-question-wrapper");
|
|
7700
7649
|
return wrapper;
|
|
7701
7650
|
}
|
|
7702
7651
|
createDOM() {
|
|
@@ -7713,24 +7662,70 @@ var FillInTheBlankQuestionNode = class _FillInTheBlankQuestionNode extends impor
|
|
|
7713
7662
|
return null;
|
|
7714
7663
|
}
|
|
7715
7664
|
static importJSON(serializedNode) {
|
|
7716
|
-
const
|
|
7717
|
-
const
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7665
|
+
const restoredItems = [];
|
|
7666
|
+
for (const item of serializedNode.lineItems) {
|
|
7667
|
+
const accountNestedEditor = (0, import_lexical41.createEditor)();
|
|
7668
|
+
const editorState = accountNestedEditor.parseEditorState(
|
|
7669
|
+
item.account.editorState
|
|
7670
|
+
);
|
|
7671
|
+
if (!editorState.isEmpty()) {
|
|
7672
|
+
accountNestedEditor.setEditorState(editorState);
|
|
7673
|
+
}
|
|
7674
|
+
if (item.correct && item.credit && item.debit) {
|
|
7675
|
+
const creditNestedEditor = (0, import_lexical41.createEditor)();
|
|
7676
|
+
let editorState2 = creditNestedEditor.parseEditorState(
|
|
7677
|
+
item.credit.editorState
|
|
7678
|
+
);
|
|
7679
|
+
if (!editorState2.isEmpty()) {
|
|
7680
|
+
creditNestedEditor.setEditorState(editorState2);
|
|
7681
|
+
}
|
|
7682
|
+
const debitNestedEditor = (0, import_lexical41.createEditor)();
|
|
7683
|
+
editorState2 = debitNestedEditor.parseEditorState(
|
|
7684
|
+
item.debit.editorState
|
|
7685
|
+
);
|
|
7686
|
+
if (!editorState2.isEmpty()) {
|
|
7687
|
+
debitNestedEditor.setEditorState(editorState2);
|
|
7688
|
+
}
|
|
7689
|
+
restoredItems.push({
|
|
7690
|
+
id: item.id,
|
|
7691
|
+
correct: item.correct,
|
|
7692
|
+
account: accountNestedEditor,
|
|
7693
|
+
credit: creditNestedEditor,
|
|
7694
|
+
debit: debitNestedEditor
|
|
7695
|
+
});
|
|
7696
|
+
} else {
|
|
7697
|
+
restoredItems.push({
|
|
7698
|
+
id: item.id,
|
|
7699
|
+
correct: item.correct,
|
|
7700
|
+
account: accountNestedEditor
|
|
7701
|
+
});
|
|
7702
|
+
}
|
|
7722
7703
|
}
|
|
7723
|
-
return $
|
|
7724
|
-
serializedNode.
|
|
7725
|
-
serializedNode.
|
|
7726
|
-
|
|
7704
|
+
return $createJournalEntryQuestionNode(
|
|
7705
|
+
serializedNode.points,
|
|
7706
|
+
serializedNode.journalType,
|
|
7707
|
+
serializedNode.errorTolerance,
|
|
7708
|
+
restoredItems,
|
|
7709
|
+
serializedNode.id
|
|
7727
7710
|
);
|
|
7728
7711
|
}
|
|
7729
7712
|
exportJSON() {
|
|
7713
|
+
const exportedOptions = [];
|
|
7714
|
+
for (const item of this.__lineItems) {
|
|
7715
|
+
exportedOptions.push({
|
|
7716
|
+
id: item.id,
|
|
7717
|
+
correct: item.correct,
|
|
7718
|
+
account: item.account.toJSON(),
|
|
7719
|
+
credit: item.credit?.toJSON(),
|
|
7720
|
+
debit: item.debit?.toJSON()
|
|
7721
|
+
});
|
|
7722
|
+
}
|
|
7730
7723
|
return {
|
|
7724
|
+
lineItems: exportedOptions,
|
|
7731
7725
|
id: this.__id,
|
|
7732
|
-
|
|
7733
|
-
|
|
7726
|
+
errorTolerance: this.__errorTolerance,
|
|
7727
|
+
journalType: this.__journalType,
|
|
7728
|
+
points: this.__points,
|
|
7734
7729
|
type: TYPE_NAME8,
|
|
7735
7730
|
version: 1
|
|
7736
7731
|
};
|
|
@@ -7747,280 +7742,421 @@ var FillInTheBlankQuestionNode = class _FillInTheBlankQuestionNode extends impor
|
|
|
7747
7742
|
isKeyboardSelectable() {
|
|
7748
7743
|
return false;
|
|
7749
7744
|
}
|
|
7750
|
-
|
|
7745
|
+
setPoints(points) {
|
|
7751
7746
|
const writable = this.getWritable();
|
|
7752
|
-
writable.
|
|
7747
|
+
writable.__points = points < 0 ? 1 : points;
|
|
7748
|
+
}
|
|
7749
|
+
getErrorTolerance() {
|
|
7750
|
+
return this.__errorTolerance;
|
|
7751
|
+
}
|
|
7752
|
+
setErrorTolerance(errorTolerance) {
|
|
7753
|
+
const writable = this.getWritable();
|
|
7754
|
+
writable.__errorTolerance = errorTolerance;
|
|
7755
|
+
}
|
|
7756
|
+
getJournalType() {
|
|
7757
|
+
return this.__journalType;
|
|
7758
|
+
}
|
|
7759
|
+
setJournalType(journalType) {
|
|
7760
|
+
const writable = this.getWritable();
|
|
7761
|
+
if (journalType === "noEntryRequiredDistractor") {
|
|
7762
|
+
const newItems = [...this.__lineItems];
|
|
7763
|
+
const newAccountContent = initNewContentEditor4();
|
|
7764
|
+
newAccountContent.update(() => {
|
|
7765
|
+
const root = (0, import_lexical41.$getRoot)();
|
|
7766
|
+
let firstChild = root.getFirstChild();
|
|
7767
|
+
if (!firstChild) {
|
|
7768
|
+
firstChild = (0, import_lexical41.$createParagraphNode)();
|
|
7769
|
+
firstChild.append((0, import_lexical41.$createTextNode)("No Entry Required"));
|
|
7770
|
+
root.append(firstChild);
|
|
7771
|
+
}
|
|
7772
|
+
});
|
|
7773
|
+
newItems.push({
|
|
7774
|
+
id: (0, import_nanoid6.nanoid)(),
|
|
7775
|
+
correct: false,
|
|
7776
|
+
account: newAccountContent,
|
|
7777
|
+
credit: void 0,
|
|
7778
|
+
debit: void 0
|
|
7779
|
+
});
|
|
7780
|
+
writable.__lineItems = newItems;
|
|
7781
|
+
}
|
|
7782
|
+
writable.__journalType = journalType;
|
|
7783
|
+
}
|
|
7784
|
+
addItem(itemIndex, correct) {
|
|
7785
|
+
const newItemIndex = itemIndex + 1;
|
|
7786
|
+
const writable = this.getWritable();
|
|
7787
|
+
const newItems = [...writable.__lineItems];
|
|
7788
|
+
newItems.splice(newItemIndex, 0, {
|
|
7789
|
+
id: (0, import_nanoid6.nanoid)(),
|
|
7790
|
+
correct,
|
|
7791
|
+
account: initNewContentEditor4(),
|
|
7792
|
+
credit: correct ? initNewContentEditor4() : void 0,
|
|
7793
|
+
debit: correct ? initNewContentEditor4() : void 0
|
|
7794
|
+
});
|
|
7795
|
+
writable.__lineItems = newItems;
|
|
7796
|
+
}
|
|
7797
|
+
removeItem(itemIndex) {
|
|
7798
|
+
if (this.__lineItems.length > 1 && this.__lineItems.length > itemIndex) {
|
|
7799
|
+
const writable = this.getWritable();
|
|
7800
|
+
const newItems = [...writable.__lineItems];
|
|
7801
|
+
newItems.splice(itemIndex, 1);
|
|
7802
|
+
writable.__lineItems = newItems;
|
|
7803
|
+
}
|
|
7753
7804
|
}
|
|
7754
7805
|
decorate() {
|
|
7755
|
-
return /* @__PURE__ */ (0,
|
|
7756
|
-
|
|
7806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
7807
|
+
JournalEntryQuestionComponent,
|
|
7757
7808
|
{
|
|
7758
7809
|
nodeKey: this.__key,
|
|
7759
|
-
|
|
7760
|
-
|
|
7810
|
+
journalType: this.__journalType,
|
|
7811
|
+
lineItems: this.__lineItems,
|
|
7812
|
+
id: this.__id
|
|
7761
7813
|
}
|
|
7762
7814
|
);
|
|
7763
|
-
}
|
|
7764
|
-
};
|
|
7765
|
-
function $
|
|
7766
|
-
return (0,
|
|
7767
|
-
new
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
|
|
7815
|
+
}
|
|
7816
|
+
};
|
|
7817
|
+
function $createJournalEntryQuestionNode(points, journalType, errorTolerance, lineItems, id) {
|
|
7818
|
+
return (0, import_lexical41.$applyNodeReplacement)(
|
|
7819
|
+
new JournalEntryQuestionNode(
|
|
7820
|
+
points,
|
|
7821
|
+
journalType || "default",
|
|
7822
|
+
errorTolerance,
|
|
7823
|
+
lineItems,
|
|
7824
|
+
id
|
|
7825
|
+
)
|
|
7826
|
+
);
|
|
7827
|
+
}
|
|
7828
|
+
function $isJournalEntryQuestionNode(node) {
|
|
7829
|
+
return node instanceof JournalEntryQuestionNode;
|
|
7830
|
+
}
|
|
7831
|
+
|
|
7832
|
+
// src/plugins/TextToolbarPlugin/TextToolbarAgentPlugin.tsx
|
|
7833
|
+
var import_LexicalComposerContext34 = require("@lexical/react/LexicalComposerContext");
|
|
7834
|
+
var import_utils10 = require("@lexical/utils");
|
|
7835
|
+
var import_lexical42 = require("lexical");
|
|
7836
|
+
var import_react51 = require("react");
|
|
7837
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
7838
|
+
var TEXT_TOOLBAR_SELECTION_CHANGE_COMMAND = (0, import_lexical42.createCommand)("TEXT_TOOLBAR_SELECTION_CHANGE_COMMAND");
|
|
7839
|
+
function TextToolbarAgentPlugin(props) {
|
|
7840
|
+
const { decoratorNode } = props;
|
|
7841
|
+
const [editor] = (0, import_LexicalComposerContext34.useLexicalComposerContext)();
|
|
7842
|
+
(0, import_react51.useEffect)(() => {
|
|
7843
|
+
return (0, import_utils10.mergeRegister)(
|
|
7844
|
+
editor.registerCommand(
|
|
7845
|
+
import_lexical42.SELECTION_CHANGE_COMMAND,
|
|
7846
|
+
(_payload, activeEditor) => {
|
|
7847
|
+
if (editor === activeEditor) {
|
|
7848
|
+
activeEditor.dispatchCommand(
|
|
7849
|
+
TEXT_TOOLBAR_SELECTION_CHANGE_COMMAND,
|
|
7850
|
+
{ decoratorNode }
|
|
7851
|
+
);
|
|
7852
|
+
}
|
|
7853
|
+
return false;
|
|
7854
|
+
},
|
|
7855
|
+
import_lexical42.COMMAND_PRIORITY_EDITOR
|
|
7856
|
+
),
|
|
7857
|
+
editor.registerUpdateListener(({ tags }) => {
|
|
7858
|
+
if (!tags.has("history-merge")) {
|
|
7859
|
+
editor.dispatchCommand(
|
|
7860
|
+
TEXT_TOOLBAR_SELECTION_CHANGE_COMMAND,
|
|
7861
|
+
{ decoratorNode }
|
|
7862
|
+
);
|
|
7863
|
+
}
|
|
7864
|
+
})
|
|
7865
|
+
);
|
|
7866
|
+
}, [editor]);
|
|
7867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_jsx_runtime68.Fragment, {});
|
|
7868
|
+
}
|
|
7869
|
+
|
|
7870
|
+
// src/plugins/TypeaheadMenuPlugin/TypeaheadMenuAgentPlugin.tsx
|
|
7871
|
+
var import_LexicalComposerContext35 = require("@lexical/react/LexicalComposerContext");
|
|
7872
|
+
var import_utils11 = require("@lexical/utils");
|
|
7873
|
+
var import_lexical43 = require("lexical");
|
|
7874
|
+
var import_react52 = require("react");
|
|
7875
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
7876
|
+
var TYPEAHEAD_MENU_COMMAND = (0, import_lexical43.createCommand)("TEXT_TOOLBAR_SELECTION_CHANGE_COMMAND");
|
|
7877
|
+
function TypeaheadMenuAgentPlugin(props) {
|
|
7878
|
+
const { decoratorNode } = props;
|
|
7879
|
+
const [editor] = (0, import_LexicalComposerContext35.useLexicalComposerContext)();
|
|
7880
|
+
(0, import_react52.useEffect)(() => {
|
|
7881
|
+
return (0, import_utils11.mergeRegister)(
|
|
7882
|
+
editor.registerUpdateListener(({ tags }) => {
|
|
7883
|
+
if (!tags.has("history-merge")) {
|
|
7884
|
+
editor.dispatchCommand(TYPEAHEAD_MENU_COMMAND, {
|
|
7885
|
+
decoratorNode
|
|
7886
|
+
});
|
|
7887
|
+
}
|
|
7888
|
+
})
|
|
7889
|
+
);
|
|
7890
|
+
}, [editor, decoratorNode]);
|
|
7891
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_jsx_runtime69.Fragment, {});
|
|
7772
7892
|
}
|
|
7773
7893
|
|
|
7774
|
-
// src/plugins/
|
|
7775
|
-
var import_lexical47 = require("lexical");
|
|
7776
|
-
var import_nanoid7 = require("nanoid");
|
|
7777
|
-
|
|
7778
|
-
// src/plugins/FinancialStatementQuestionPlugin/FinancialStatementQuestionComponent.tsx
|
|
7894
|
+
// src/plugins/FillInTheBlankQuestionPlugin/FillInTheBlankQuestionComponent.tsx
|
|
7779
7895
|
var import_LexicalComposerContext37 = require("@lexical/react/LexicalComposerContext");
|
|
7780
7896
|
var import_LexicalErrorBoundary7 = require("@lexical/react/LexicalErrorBoundary");
|
|
7781
7897
|
var import_LexicalHistoryPlugin8 = require("@lexical/react/LexicalHistoryPlugin");
|
|
7898
|
+
var import_LexicalListPlugin2 = require("@lexical/react/LexicalListPlugin");
|
|
7782
7899
|
var import_LexicalNestedComposer7 = require("@lexical/react/LexicalNestedComposer");
|
|
7783
7900
|
var import_LexicalRichTextPlugin7 = require("@lexical/react/LexicalRichTextPlugin");
|
|
7901
|
+
var import_LexicalTabIndentationPlugin2 = require("@lexical/react/LexicalTabIndentationPlugin");
|
|
7784
7902
|
var import_lexical46 = require("lexical");
|
|
7785
7903
|
var import_react54 = require("react");
|
|
7786
|
-
|
|
7787
|
-
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
const
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7904
|
+
|
|
7905
|
+
// src/utils/extractSelectionNode.ts
|
|
7906
|
+
var import_lexical44 = require("lexical");
|
|
7907
|
+
function $extractSelectionNode() {
|
|
7908
|
+
const selection = (0, import_lexical44.$getSelection)();
|
|
7909
|
+
if (!(0, import_lexical44.$isRangeSelection)(selection) || selection.isCollapsed()) {
|
|
7910
|
+
return null;
|
|
7911
|
+
}
|
|
7912
|
+
const anchor = selection.anchor;
|
|
7913
|
+
if (anchor.type !== "text") {
|
|
7914
|
+
return null;
|
|
7915
|
+
}
|
|
7916
|
+
const anchorNode = anchor.getNode();
|
|
7917
|
+
if (!anchorNode.isSimpleText()) {
|
|
7918
|
+
return null;
|
|
7919
|
+
}
|
|
7920
|
+
const focus = selection.focus;
|
|
7921
|
+
const startOffset = Math.min(anchor.offset, focus.offset);
|
|
7922
|
+
let selectionOffset = Math.max(anchor.offset, focus.offset);
|
|
7923
|
+
if (startOffset < 0) {
|
|
7924
|
+
return null;
|
|
7925
|
+
}
|
|
7926
|
+
const textContent = anchorNode.getTextContent().slice(startOffset, selectionOffset);
|
|
7927
|
+
if (!textContent) {
|
|
7928
|
+
return null;
|
|
7929
|
+
}
|
|
7930
|
+
const textLength = textContent.length;
|
|
7931
|
+
const validTextLength = textContent.trim().length;
|
|
7932
|
+
selectionOffset -= textLength - validTextLength;
|
|
7933
|
+
let newNode;
|
|
7934
|
+
if (startOffset === 0) {
|
|
7935
|
+
[newNode] = anchorNode.splitText(selectionOffset);
|
|
7936
|
+
} else {
|
|
7937
|
+
[, newNode] = anchorNode.splitText(startOffset, selectionOffset);
|
|
7938
|
+
}
|
|
7939
|
+
return newNode;
|
|
7940
|
+
}
|
|
7941
|
+
|
|
7942
|
+
// src/plugins/FillInTheBlankQuestionPlugin/FillInTheBlankSpaceComponentPlugin.tsx
|
|
7943
|
+
var import_LexicalComposerContext36 = require("@lexical/react/LexicalComposerContext");
|
|
7944
|
+
var import_utils12 = require("@lexical/utils");
|
|
7945
|
+
var import_lexical45 = require("lexical");
|
|
7946
|
+
var import_react53 = require("react");
|
|
7947
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
7948
|
+
function FillInTheBlankSpaceComponentPlugin() {
|
|
7949
|
+
const { nestedEditorId } = useNestedEditor();
|
|
7950
|
+
const [editor] = (0, import_LexicalComposerContext36.useLexicalComposerContext)();
|
|
7951
|
+
const lastSelectedNodeRef = (0, import_react53.useRef)(
|
|
7952
|
+
void 0
|
|
7953
|
+
);
|
|
7954
|
+
const selectedSpaceNodeKeyRef = (0, import_react53.useRef)(void 0);
|
|
7955
|
+
(0, import_react53.useEffect)(() => {
|
|
7956
|
+
return (0, import_utils12.mergeRegister)(
|
|
7957
|
+
editor.registerCommand(
|
|
7958
|
+
CREATE_SPACE_FROM_SELECTION_COMMAND,
|
|
7959
|
+
() => {
|
|
7960
|
+
const textNode = $extractSelectionNode();
|
|
7961
|
+
if (textNode) {
|
|
7962
|
+
const spaceName = textNode.getTextContent();
|
|
7963
|
+
const newSpaceNode = $createFillInTheBlankSpaceNode(spaceName);
|
|
7964
|
+
textNode.replace(newSpaceNode);
|
|
7965
|
+
textNode.getParent()?.selectEnd();
|
|
7966
|
+
}
|
|
7967
|
+
return true;
|
|
7968
|
+
},
|
|
7969
|
+
import_lexical45.COMMAND_PRIORITY_EDITOR
|
|
7970
|
+
),
|
|
7971
|
+
// todo: extract this as a separate plugin
|
|
7972
|
+
// that tracks clicks on decorators and manages arrow keys
|
|
7973
|
+
editor.registerCommand(
|
|
7974
|
+
import_lexical45.CLICK_COMMAND,
|
|
7975
|
+
(payload) => {
|
|
7976
|
+
if (payload.target) {
|
|
7977
|
+
const spaceNodeKey = payload.target.getAttribute("data-block-editor-space");
|
|
7978
|
+
if (spaceNodeKey) {
|
|
7979
|
+
selectedSpaceNodeKeyRef.current = spaceNodeKey;
|
|
7980
|
+
editor.update(() => {
|
|
7981
|
+
const newSelection = (0, import_lexical45.$createNodeSelection)();
|
|
7982
|
+
newSelection.add(spaceNodeKey);
|
|
7983
|
+
(0, import_lexical45.$setSelection)(newSelection);
|
|
7984
|
+
});
|
|
7985
|
+
return true;
|
|
7805
7986
|
}
|
|
7806
|
-
});
|
|
7807
|
-
}
|
|
7808
|
-
return false;
|
|
7809
|
-
},
|
|
7810
|
-
import_lexical46.COMMAND_PRIORITY_LOW
|
|
7811
|
-
);
|
|
7812
|
-
}, [editor]);
|
|
7813
|
-
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
7814
|
-
"div",
|
|
7815
|
-
{
|
|
7816
|
-
ref: rootElementRef,
|
|
7817
|
-
id,
|
|
7818
|
-
className: "financial-statement-question-prompt",
|
|
7819
|
-
children: [
|
|
7820
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7821
|
-
"div",
|
|
7822
|
-
{
|
|
7823
|
-
className: "financial-statement-question-prompt-title",
|
|
7824
|
-
"data-selectable": "true",
|
|
7825
|
-
children: "Financial Statement"
|
|
7826
7987
|
}
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
}
|
|
7857
|
-
|
|
7858
|
-
columnHeaders.length >= 2 && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("tr", { "data-selectable": "true", children: [
|
|
7859
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7860
|
-
"th",
|
|
7861
|
-
{
|
|
7862
|
-
"data-selectable": "true",
|
|
7863
|
-
style: { textAlign: "left" },
|
|
7864
|
-
children: columnHeaders[0]
|
|
7865
|
-
}
|
|
7866
|
-
),
|
|
7867
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7868
|
-
"th",
|
|
7869
|
-
{
|
|
7870
|
-
"data-selectable": "true",
|
|
7871
|
-
style: { textAlign: "right" },
|
|
7872
|
-
children: columnHeaders[1]
|
|
7873
|
-
}
|
|
7874
|
-
)
|
|
7875
|
-
] })
|
|
7876
|
-
] }),
|
|
7877
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("tbody", { children: [
|
|
7878
|
-
rows.map(
|
|
7879
|
-
(rowItem, rowItemIndex) => {
|
|
7880
|
-
if (rowItem.type === "Heading") {
|
|
7881
|
-
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("tr", { "data-selectable": "true", children: [
|
|
7882
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("td", { "data-selectable": "true", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7883
|
-
"strong",
|
|
7884
|
-
{
|
|
7885
|
-
style: {
|
|
7886
|
-
paddingLeft: `calc(1em * ${rowItem.depth})`
|
|
7887
|
-
},
|
|
7888
|
-
children: rowItem.entry
|
|
7889
|
-
}
|
|
7890
|
-
) }),
|
|
7891
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7892
|
-
"td",
|
|
7893
|
-
{
|
|
7894
|
-
className: "financial-statement-question-cell",
|
|
7895
|
-
"data-selectable": "true",
|
|
7896
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "financial-statement-question-cell-id", children: [
|
|
7897
|
-
"A",
|
|
7898
|
-
rowItemIndex + 1
|
|
7899
|
-
] })
|
|
7900
|
-
}
|
|
7901
|
-
)
|
|
7902
|
-
] }, rowItem.id);
|
|
7903
|
-
} else if (rowItem.type === "Line") {
|
|
7904
|
-
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("tr", { "data-selectable": "true", children: [
|
|
7905
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("td", { "data-selectable": "true", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7906
|
-
"span",
|
|
7907
|
-
{
|
|
7908
|
-
style: {
|
|
7909
|
-
paddingLeft: `calc(1em * ${rowItem.depth})`
|
|
7910
|
-
},
|
|
7911
|
-
children: rowItem.entry
|
|
7912
|
-
}
|
|
7913
|
-
) }),
|
|
7914
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
7915
|
-
"td",
|
|
7916
|
-
{
|
|
7917
|
-
className: "financial-statement-question-cell",
|
|
7918
|
-
"data-selectable": "true",
|
|
7919
|
-
children: [
|
|
7920
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "financial-statement-question-cell-id", children: [
|
|
7921
|
-
"A",
|
|
7922
|
-
rowItemIndex + 1
|
|
7923
|
-
] }),
|
|
7924
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7925
|
-
import_LexicalNestedComposer7.LexicalNestedComposer,
|
|
7926
|
-
{
|
|
7927
|
-
initialEditor: rowItem.amount,
|
|
7928
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(NestedEditor, { nodeKey, children: [
|
|
7929
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(SettingsPanelNestedAgentPlugin, {}),
|
|
7930
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7931
|
-
import_LexicalRichTextPlugin7.RichTextPlugin,
|
|
7932
|
-
{
|
|
7933
|
-
contentEditable: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(NestedContentEditable, {}),
|
|
7934
|
-
ErrorBoundary: import_LexicalErrorBoundary7.LexicalErrorBoundary,
|
|
7935
|
-
placeholder: null
|
|
7936
|
-
},
|
|
7937
|
-
nodeKey
|
|
7938
|
-
),
|
|
7939
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7940
|
-
import_LexicalHistoryPlugin8.HistoryPlugin,
|
|
7941
|
-
{
|
|
7942
|
-
externalHistoryState: historyState
|
|
7943
|
-
}
|
|
7944
|
-
),
|
|
7945
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(TypeaheadVariableAgentPlugin, {}),
|
|
7946
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(VariableComponentPlugin, {})
|
|
7947
|
-
] })
|
|
7948
|
-
}
|
|
7949
|
-
)
|
|
7950
|
-
]
|
|
7951
|
-
}
|
|
7952
|
-
)
|
|
7953
|
-
] }, rowItem.id);
|
|
7954
|
-
}
|
|
7955
|
-
}
|
|
7956
|
-
),
|
|
7957
|
-
distractors.map(
|
|
7958
|
-
(distractorItem) => {
|
|
7959
|
-
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("tr", { "data-selectable": "true", children: [
|
|
7960
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("td", { "data-selectable": "true", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7961
|
-
"span",
|
|
7962
|
-
{
|
|
7963
|
-
style: { color: "var(--sl-color-red-500)" },
|
|
7964
|
-
children: distractorItem.entry
|
|
7965
|
-
}
|
|
7966
|
-
) }),
|
|
7967
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("td", { "data-selectable": "true" })
|
|
7968
|
-
] }, distractorItem.id);
|
|
7988
|
+
selectedSpaceNodeKeyRef.current = void 0;
|
|
7989
|
+
return false;
|
|
7990
|
+
},
|
|
7991
|
+
import_lexical45.COMMAND_PRIORITY_HIGH
|
|
7992
|
+
),
|
|
7993
|
+
editor.registerCommand(
|
|
7994
|
+
import_lexical45.SELECTION_CHANGE_COMMAND,
|
|
7995
|
+
() => {
|
|
7996
|
+
const selection = (0, import_lexical45.$getSelection)();
|
|
7997
|
+
if ((0, import_lexical45.$isRangeSelection)(selection)) {
|
|
7998
|
+
lastSelectedNodeRef.current = selection.anchor.getNode();
|
|
7999
|
+
}
|
|
8000
|
+
return false;
|
|
8001
|
+
},
|
|
8002
|
+
import_lexical45.COMMAND_PRIORITY_EDITOR
|
|
8003
|
+
),
|
|
8004
|
+
...[
|
|
8005
|
+
import_lexical45.KEY_ARROW_UP_COMMAND,
|
|
8006
|
+
import_lexical45.KEY_ARROW_RIGHT_COMMAND,
|
|
8007
|
+
import_lexical45.KEY_ARROW_DOWN_COMMAND,
|
|
8008
|
+
import_lexical45.KEY_ARROW_LEFT_COMMAND
|
|
8009
|
+
].map(
|
|
8010
|
+
(keyCommand) => editor.registerCommand(
|
|
8011
|
+
keyCommand,
|
|
8012
|
+
() => {
|
|
8013
|
+
if (selectedSpaceNodeKeyRef.current) {
|
|
8014
|
+
selectedSpaceNodeKeyRef.current = void 0;
|
|
8015
|
+
if (lastSelectedNodeRef.current) {
|
|
8016
|
+
lastSelectedNodeRef.current.select();
|
|
8017
|
+
} else {
|
|
8018
|
+
editor.focus();
|
|
7969
8019
|
}
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
8020
|
+
}
|
|
8021
|
+
return false;
|
|
8022
|
+
},
|
|
8023
|
+
import_lexical45.COMMAND_PRIORITY_EDITOR
|
|
8024
|
+
)
|
|
8025
|
+
)
|
|
8026
|
+
);
|
|
8027
|
+
}, [editor, nestedEditorId]);
|
|
8028
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_jsx_runtime70.Fragment, {});
|
|
8029
|
+
}
|
|
8030
|
+
|
|
8031
|
+
// src/plugins/FillInTheBlankQuestionPlugin/FillInTheBlankQuestionComponent.tsx
|
|
8032
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
8033
|
+
var CREATE_SPACE_FROM_SELECTION_COMMAND = (0, import_lexical46.createCommand)("CREATE_SPACE_FROM_SELECTION_COMMAND");
|
|
8034
|
+
function FillInTheBlankQuestionComponent(props) {
|
|
8035
|
+
const { nodeKey, id, content } = props;
|
|
8036
|
+
const { historyState } = useSharedHistoryContext();
|
|
8037
|
+
const [editor] = (0, import_LexicalComposerContext37.useLexicalComposerContext)();
|
|
8038
|
+
const rootElementRef = (0, import_react54.useRef)(null);
|
|
8039
|
+
(0, import_react54.useEffect)(() => {
|
|
8040
|
+
return editor.registerCommand(
|
|
8041
|
+
import_lexical46.CLICK_COMMAND,
|
|
8042
|
+
(event, _activeEditor) => {
|
|
8043
|
+
if (!event.target.hasAttribute(
|
|
8044
|
+
"data-block-editor-space"
|
|
8045
|
+
)) {
|
|
8046
|
+
if (rootElementRef.current?.contains(event.target) && event.target.hasAttribute(
|
|
8047
|
+
"data-selectable"
|
|
8048
|
+
)) {
|
|
8049
|
+
editor.update(() => {
|
|
8050
|
+
const foundNode = (0, import_lexical46.$getNodeByKey)(nodeKey);
|
|
8051
|
+
if ($isFillInTheBlankQuestionNode(foundNode)) {
|
|
8052
|
+
const selection = (0, import_lexical46.$createNodeSelection)();
|
|
8053
|
+
selection.add(nodeKey);
|
|
8054
|
+
(0, import_lexical46.$setSelection)(selection);
|
|
8055
|
+
}
|
|
8056
|
+
});
|
|
8057
|
+
}
|
|
8058
|
+
}
|
|
8059
|
+
return false;
|
|
8060
|
+
},
|
|
8061
|
+
import_lexical46.COMMAND_PRIORITY_LOW
|
|
8062
|
+
);
|
|
8063
|
+
}, [editor]);
|
|
8064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
8065
|
+
"div",
|
|
8066
|
+
{
|
|
8067
|
+
ref: rootElementRef,
|
|
8068
|
+
id,
|
|
8069
|
+
className: "fill-in-the-blank-question-prompt",
|
|
8070
|
+
children: [
|
|
8071
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
8072
|
+
"div",
|
|
8073
|
+
{
|
|
8074
|
+
className: "fill-in-the-blank-question-prompt-title",
|
|
8075
|
+
"data-selectable": "true",
|
|
8076
|
+
children: "Fill In The Blank"
|
|
8077
|
+
}
|
|
8078
|
+
),
|
|
8079
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
8080
|
+
"div",
|
|
8081
|
+
{
|
|
8082
|
+
className: "fill-in-the-blank-question-prompt-content",
|
|
8083
|
+
"data-selectable": "true",
|
|
8084
|
+
children: [
|
|
8085
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "title", "data-selectable": "true", children: "Statement" }),
|
|
8086
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_LexicalNestedComposer7.LexicalNestedComposer, { initialEditor: content, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(NestedEditor, { nodeKey, children: [
|
|
8087
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(SettingsPanelNestedAgentPlugin, {}),
|
|
8088
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(FillInTheBlankSpaceComponentPlugin, {}),
|
|
8089
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(FillInTheBlankSpaceSettingsPlugin, {}),
|
|
8090
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
8091
|
+
import_LexicalRichTextPlugin7.RichTextPlugin,
|
|
8092
|
+
{
|
|
8093
|
+
contentEditable: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(NestedContentEditable, {}),
|
|
8094
|
+
ErrorBoundary: import_LexicalErrorBoundary7.LexicalErrorBoundary,
|
|
8095
|
+
placeholder: null
|
|
8096
|
+
},
|
|
8097
|
+
nodeKey
|
|
8098
|
+
),
|
|
8099
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_LexicalHistoryPlugin8.HistoryPlugin, { externalHistoryState: historyState }),
|
|
8100
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
8101
|
+
TextToolbarAgentPlugin,
|
|
8102
|
+
{
|
|
8103
|
+
decoratorNode: FillInTheBlankQuestionNode
|
|
8104
|
+
}
|
|
8105
|
+
),
|
|
8106
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
8107
|
+
TypeaheadVariableAgentPlugin,
|
|
8108
|
+
{
|
|
8109
|
+
decoratorNode: FillInTheBlankQuestionNode
|
|
8110
|
+
}
|
|
8111
|
+
),
|
|
8112
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(VariableComponentPlugin, {}),
|
|
8113
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(VariableToolbarAgentPlugin, {}),
|
|
8114
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
8115
|
+
TypeaheadMenuAgentPlugin,
|
|
8116
|
+
{
|
|
8117
|
+
decoratorNode: FillInTheBlankQuestionNode
|
|
8118
|
+
}
|
|
8119
|
+
),
|
|
8120
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_LexicalListPlugin2.ListPlugin, {}),
|
|
8121
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ListLevelLimitPlugin, {}),
|
|
8122
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Table, {}),
|
|
8123
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_LexicalTabIndentationPlugin2.TabIndentationPlugin, {})
|
|
8124
|
+
] }) })
|
|
8125
|
+
]
|
|
8126
|
+
}
|
|
8127
|
+
)
|
|
7973
8128
|
]
|
|
7974
8129
|
}
|
|
7975
8130
|
);
|
|
7976
8131
|
}
|
|
7977
8132
|
|
|
7978
|
-
// src/plugins/
|
|
7979
|
-
var isSerializableFinancialStatementHeading = (row) => {
|
|
7980
|
-
return row.type === "Heading";
|
|
7981
|
-
};
|
|
7982
|
-
|
|
7983
|
-
// src/plugins/FinancialStatementQuestionPlugin/isSerializableFinancialStatementLine.ts
|
|
7984
|
-
var isSerializableFinancialStatementLine = (row) => {
|
|
7985
|
-
return row.type === "Line";
|
|
7986
|
-
};
|
|
7987
|
-
|
|
7988
|
-
// src/plugins/FinancialStatementQuestionPlugin/FinancialStatementQuestionNode.tsx
|
|
8133
|
+
// src/plugins/FillInTheBlankQuestionPlugin/FillInTheBlankQuestionNode.tsx
|
|
7989
8134
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
7990
|
-
var TYPE_NAME9 = "
|
|
7991
|
-
|
|
7992
|
-
return
|
|
7993
|
-
}
|
|
7994
|
-
var
|
|
7995
|
-
|
|
7996
|
-
};
|
|
7997
|
-
var FinancialStatementQuestionNode = class _FinancialStatementQuestionNode extends import_lexical47.DecoratorNode {
|
|
7998
|
-
constructor(points, header, columnHeaders, rows, distractors, id, key) {
|
|
8135
|
+
var TYPE_NAME9 = "fill-in-the-blank-question";
|
|
8136
|
+
function initNewContentEditor5() {
|
|
8137
|
+
return (0, import_lexical47.createEditor)();
|
|
8138
|
+
}
|
|
8139
|
+
var FillInTheBlankQuestionNode = class _FillInTheBlankQuestionNode extends import_lexical47.DecoratorNode {
|
|
8140
|
+
constructor(pointsPerSpace, id, content, key) {
|
|
7999
8141
|
super(key);
|
|
8000
8142
|
this.__id = id || (0, import_nanoid7.nanoid)();
|
|
8001
|
-
this.
|
|
8002
|
-
this.
|
|
8003
|
-
this.__columnHeaders = columnHeaders;
|
|
8004
|
-
this.__rows = rows;
|
|
8005
|
-
this.__distractors = distractors;
|
|
8143
|
+
this.__pointsPerSpace = pointsPerSpace < 0 ? 1 : pointsPerSpace;
|
|
8144
|
+
this.__content = content || initNewContentEditor5();
|
|
8006
8145
|
}
|
|
8007
8146
|
static getType() {
|
|
8008
8147
|
return TYPE_NAME9;
|
|
8009
8148
|
}
|
|
8010
8149
|
static clone(node) {
|
|
8011
|
-
return new
|
|
8012
|
-
node.
|
|
8013
|
-
node.__header,
|
|
8014
|
-
node.__columnHeaders,
|
|
8015
|
-
node.__rows,
|
|
8016
|
-
node.__distractors,
|
|
8150
|
+
return new _FillInTheBlankQuestionNode(
|
|
8151
|
+
node.__pointsPerSpace,
|
|
8017
8152
|
node.__id,
|
|
8153
|
+
node.__content,
|
|
8018
8154
|
node.__key
|
|
8019
8155
|
);
|
|
8020
8156
|
}
|
|
8021
8157
|
__createWrapper() {
|
|
8022
8158
|
const wrapper = document.createElement("div");
|
|
8023
|
-
wrapper.classList.add("
|
|
8159
|
+
wrapper.classList.add("fill-in-the-blank-question-wrapper");
|
|
8024
8160
|
return wrapper;
|
|
8025
8161
|
}
|
|
8026
8162
|
createDOM() {
|
|
@@ -8037,86 +8173,24 @@ var FinancialStatementQuestionNode = class _FinancialStatementQuestionNode exten
|
|
|
8037
8173
|
return null;
|
|
8038
8174
|
}
|
|
8039
8175
|
static importJSON(serializedNode) {
|
|
8040
|
-
const
|
|
8041
|
-
const editorState =
|
|
8042
|
-
serializedNode.
|
|
8176
|
+
const nestedEditor = (0, import_lexical47.createEditor)();
|
|
8177
|
+
const editorState = nestedEditor.parseEditorState(
|
|
8178
|
+
serializedNode.content.editorState
|
|
8043
8179
|
);
|
|
8044
8180
|
if (!editorState.isEmpty()) {
|
|
8045
|
-
|
|
8046
|
-
}
|
|
8047
|
-
const restoredRows = [];
|
|
8048
|
-
for (const row of serializedNode.rows) {
|
|
8049
|
-
if (isSerializableFinancialStatementHeading(row)) {
|
|
8050
|
-
restoredRows.push({
|
|
8051
|
-
type: row.type,
|
|
8052
|
-
id: row.id,
|
|
8053
|
-
depth: row.depth,
|
|
8054
|
-
entry: row.entry,
|
|
8055
|
-
isHint: row.isHint
|
|
8056
|
-
});
|
|
8057
|
-
continue;
|
|
8058
|
-
}
|
|
8059
|
-
if (isSerializableFinancialStatementLine(row)) {
|
|
8060
|
-
const amountNestedEditor = (0, import_lexical47.createEditor)();
|
|
8061
|
-
const editorState2 = amountNestedEditor.parseEditorState(
|
|
8062
|
-
row.amount.editorState
|
|
8063
|
-
);
|
|
8064
|
-
if (!editorState2.isEmpty()) {
|
|
8065
|
-
amountNestedEditor.setEditorState(editorState2);
|
|
8066
|
-
}
|
|
8067
|
-
restoredRows.push({
|
|
8068
|
-
type: row.type,
|
|
8069
|
-
id: row.id,
|
|
8070
|
-
depth: row.depth,
|
|
8071
|
-
entry: row.entry,
|
|
8072
|
-
amount: amountNestedEditor,
|
|
8073
|
-
isEntryHint: row.isEntryHint,
|
|
8074
|
-
isAmountHint: row.isAmountHint,
|
|
8075
|
-
role: row.role
|
|
8076
|
-
});
|
|
8077
|
-
continue;
|
|
8078
|
-
}
|
|
8181
|
+
nestedEditor.setEditorState(editorState);
|
|
8079
8182
|
}
|
|
8080
|
-
return $
|
|
8081
|
-
serializedNode.
|
|
8082
|
-
|
|
8083
|
-
|
|
8084
|
-
restoredRows,
|
|
8085
|
-
serializedNode.distractors,
|
|
8086
|
-
serializedNode.id
|
|
8183
|
+
return $createFillInTheBlankQuestionNode(
|
|
8184
|
+
serializedNode.pointsPerSpace,
|
|
8185
|
+
serializedNode.id,
|
|
8186
|
+
nestedEditor
|
|
8087
8187
|
);
|
|
8088
8188
|
}
|
|
8089
8189
|
exportJSON() {
|
|
8090
8190
|
return {
|
|
8091
8191
|
id: this.__id,
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
columnHeaders: this.__columnHeaders,
|
|
8095
|
-
rows: this.__rows.map((row) => {
|
|
8096
|
-
if (isFinancialStatementHeading(row)) {
|
|
8097
|
-
return {
|
|
8098
|
-
type: row.type,
|
|
8099
|
-
id: row.id,
|
|
8100
|
-
depth: row.depth,
|
|
8101
|
-
entry: row.entry,
|
|
8102
|
-
isHint: row.isHint
|
|
8103
|
-
};
|
|
8104
|
-
}
|
|
8105
|
-
if (isFinancialStatementLine(row)) {
|
|
8106
|
-
return {
|
|
8107
|
-
type: row.type,
|
|
8108
|
-
id: row.id,
|
|
8109
|
-
depth: row.depth,
|
|
8110
|
-
entry: row.entry,
|
|
8111
|
-
amount: row.amount.toJSON(),
|
|
8112
|
-
isEntryHint: row.isEntryHint,
|
|
8113
|
-
isAmountHint: row.isAmountHint,
|
|
8114
|
-
role: row.role
|
|
8115
|
-
};
|
|
8116
|
-
}
|
|
8117
|
-
throw new Error("Invalid row type");
|
|
8118
|
-
}).filter(Boolean),
|
|
8119
|
-
distractors: this.__distractors,
|
|
8192
|
+
pointsPerSpace: this.__pointsPerSpace,
|
|
8193
|
+
content: this.__content.toJSON(),
|
|
8120
8194
|
type: TYPE_NAME9,
|
|
8121
8195
|
version: 1
|
|
8122
8196
|
};
|
|
@@ -8133,38 +8207,28 @@ var FinancialStatementQuestionNode = class _FinancialStatementQuestionNode exten
|
|
|
8133
8207
|
isKeyboardSelectable() {
|
|
8134
8208
|
return false;
|
|
8135
8209
|
}
|
|
8136
|
-
|
|
8210
|
+
setPointsPerSpace(points) {
|
|
8137
8211
|
const writable = this.getWritable();
|
|
8138
|
-
writable.
|
|
8212
|
+
writable.__pointsPerSpace = points <= 0 ? 1 : points;
|
|
8139
8213
|
}
|
|
8140
8214
|
decorate() {
|
|
8141
8215
|
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
8142
|
-
|
|
8216
|
+
FillInTheBlankQuestionComponent,
|
|
8143
8217
|
{
|
|
8144
8218
|
nodeKey: this.__key,
|
|
8145
8219
|
id: this.__id,
|
|
8146
|
-
|
|
8147
|
-
columnHeaders: this.__columnHeaders,
|
|
8148
|
-
rows: this.__rows,
|
|
8149
|
-
distractors: this.__distractors
|
|
8220
|
+
content: this.__content
|
|
8150
8221
|
}
|
|
8151
8222
|
);
|
|
8152
8223
|
}
|
|
8153
8224
|
};
|
|
8154
|
-
function $
|
|
8225
|
+
function $createFillInTheBlankQuestionNode(pointsPerSpace, id, content) {
|
|
8155
8226
|
return (0, import_lexical47.$applyNodeReplacement)(
|
|
8156
|
-
new
|
|
8157
|
-
points,
|
|
8158
|
-
header,
|
|
8159
|
-
columnHeaders,
|
|
8160
|
-
rows,
|
|
8161
|
-
distractors,
|
|
8162
|
-
id
|
|
8163
|
-
)
|
|
8227
|
+
new FillInTheBlankQuestionNode(pointsPerSpace, id, content)
|
|
8164
8228
|
);
|
|
8165
8229
|
}
|
|
8166
|
-
function $
|
|
8167
|
-
return node instanceof
|
|
8230
|
+
function $isFillInTheBlankQuestionNode(node) {
|
|
8231
|
+
return node instanceof FillInTheBlankQuestionNode;
|
|
8168
8232
|
}
|
|
8169
8233
|
|
|
8170
8234
|
// src/plugins/SettingsPanel/SmartTableSettings.tsx
|
|
@@ -10368,10 +10432,12 @@ function traverseListNode(rootNode, cb) {
|
|
|
10368
10432
|
cb(rootNode);
|
|
10369
10433
|
const children = rootNode.getChildren();
|
|
10370
10434
|
for (const childNode of children) {
|
|
10371
|
-
if ((0, import_list3.$
|
|
10435
|
+
if ((0, import_list3.$isListItemNode)(childNode)) {
|
|
10372
10436
|
const nestedChildren = childNode.getChildren();
|
|
10373
|
-
|
|
10374
|
-
|
|
10437
|
+
if (nestedChildren && nestedChildren.length > 0) {
|
|
10438
|
+
for (const nestedItem of nestedChildren) {
|
|
10439
|
+
traverseListNode(nestedItem, cb);
|
|
10440
|
+
}
|
|
10375
10441
|
}
|
|
10376
10442
|
}
|
|
10377
10443
|
}
|
|
@@ -14935,7 +15001,7 @@ function replaceWithVariable(variableName, variableFormat, editor, textToReplace
|
|
|
14935
15001
|
}
|
|
14936
15002
|
|
|
14937
15003
|
// src/plugins/VariablesPlugin/renderVariableMenu.tsx
|
|
14938
|
-
function renderVariableMenu(list, popupRef, highlighterRef, activeEditorRef, textToReplaceTargetRef, onUpdateCb) {
|
|
15004
|
+
function renderVariableMenu(list, popupRef, highlighterRef, activeEditorRef, textToReplaceTargetRef, doInferVariableType, onUpdateCb) {
|
|
14939
15005
|
return [...list].map((variableName) => {
|
|
14940
15006
|
return {
|
|
14941
15007
|
id: variableName,
|
|
@@ -14943,7 +15009,7 @@ function renderVariableMenu(list, popupRef, highlighterRef, activeEditorRef, tex
|
|
|
14943
15009
|
onClick: () => {
|
|
14944
15010
|
replaceWithVariable(
|
|
14945
15011
|
variableName,
|
|
14946
|
-
|
|
15012
|
+
doInferVariableType ? inferFormat(variableName) : void 0,
|
|
14947
15013
|
activeEditorRef.current,
|
|
14948
15014
|
textToReplaceTargetRef.current,
|
|
14949
15015
|
onUpdateCb
|
|
@@ -15146,7 +15212,7 @@ function removeTextInDomSelection(editor, leadOffset, onUpdate) {
|
|
|
15146
15212
|
|
|
15147
15213
|
// src/plugins/VariablesPlugin/TypeaheadVariablePlugin.tsx
|
|
15148
15214
|
var import_LexicalComposerContext63 = require("@lexical/react/LexicalComposerContext");
|
|
15149
|
-
var
|
|
15215
|
+
var import_utils33 = require("@lexical/utils");
|
|
15150
15216
|
var import_lexical95 = require("lexical");
|
|
15151
15217
|
var import_react93 = require("react");
|
|
15152
15218
|
var import_jsx_runtime114 = require("react/jsx-runtime");
|
|
@@ -15161,6 +15227,7 @@ function TypeaheadVariablePlugin() {
|
|
|
15161
15227
|
const highlighterRef = (0, import_react93.useRef)(null);
|
|
15162
15228
|
const activeEditorRef = (0, import_react93.useRef)();
|
|
15163
15229
|
const textToReplaceTargetRef = (0, import_react93.useRef)();
|
|
15230
|
+
const activeDecoratorRef = (0, import_react93.useRef)(void 0);
|
|
15164
15231
|
const handleUpdate = () => {
|
|
15165
15232
|
activeEditorRef.current?.getEditorState().read(() => {
|
|
15166
15233
|
const selection = (0, import_lexical95.$getSelection)();
|
|
@@ -15260,7 +15327,7 @@ function TypeaheadVariablePlugin() {
|
|
|
15260
15327
|
if (foundVariable) {
|
|
15261
15328
|
replaceWithVariable(
|
|
15262
15329
|
foundVariable,
|
|
15263
|
-
|
|
15330
|
+
activeDecoratorRef.current === JournalEntryQuestionNode ? void 0 : inferFormat(foundVariable),
|
|
15264
15331
|
activeEditorRef.current,
|
|
15265
15332
|
textToReplaceTargetRef.current
|
|
15266
15333
|
);
|
|
@@ -15272,7 +15339,7 @@ function TypeaheadVariablePlugin() {
|
|
|
15272
15339
|
}
|
|
15273
15340
|
replaceWithVariable(
|
|
15274
15341
|
newVariable,
|
|
15275
|
-
|
|
15342
|
+
activeDecoratorRef.current === JournalEntryQuestionNode ? void 0 : inferFormat(newVariable),
|
|
15276
15343
|
activeEditorRef.current,
|
|
15277
15344
|
textToReplaceTargetRef.current,
|
|
15278
15345
|
(newNode) => {
|
|
@@ -15303,10 +15370,11 @@ function TypeaheadVariablePlugin() {
|
|
|
15303
15370
|
return false;
|
|
15304
15371
|
};
|
|
15305
15372
|
(0, import_react93.useEffect)(() => {
|
|
15306
|
-
return (0,
|
|
15373
|
+
return (0, import_utils33.mergeRegister)(
|
|
15307
15374
|
editor.registerCommand(
|
|
15308
15375
|
TYPEAHEAD_VARIABLE_COMMAND,
|
|
15309
|
-
(
|
|
15376
|
+
(payload, activeEditor) => {
|
|
15377
|
+
activeDecoratorRef.current = payload.decoratorNode;
|
|
15310
15378
|
activeEditorRef.current = activeEditor;
|
|
15311
15379
|
handleUpdate();
|
|
15312
15380
|
return true;
|
|
@@ -15345,7 +15413,10 @@ function TypeaheadVariablePlugin() {
|
|
|
15345
15413
|
const foundVariable = variableList.find(
|
|
15346
15414
|
(v) => v === variableName
|
|
15347
15415
|
);
|
|
15348
|
-
const newVariableNode = $createVariableNode(
|
|
15416
|
+
const newVariableNode = $createVariableNode(
|
|
15417
|
+
variableName,
|
|
15418
|
+
activeDecoratorRef.current === JournalEntryQuestionNode ? void 0 : inferFormat(variableName)
|
|
15419
|
+
);
|
|
15349
15420
|
textNode.replace(newVariableNode);
|
|
15350
15421
|
if (!foundVariable) {
|
|
15351
15422
|
onCreated(variableName);
|
|
@@ -15377,9 +15448,10 @@ function TypeaheadVariablePlugin() {
|
|
|
15377
15448
|
popupRef,
|
|
15378
15449
|
highlighterRef,
|
|
15379
15450
|
activeEditorRef,
|
|
15380
|
-
textToReplaceTargetRef
|
|
15451
|
+
textToReplaceTargetRef,
|
|
15452
|
+
activeDecoratorRef.current !== JournalEntryQuestionNode
|
|
15381
15453
|
);
|
|
15382
|
-
}, [
|
|
15454
|
+
}, [variableList, activeDecoratorRef.current]);
|
|
15383
15455
|
return /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)(import_jsx_runtime114.Fragment, { children: [
|
|
15384
15456
|
/* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
|
|
15385
15457
|
PopupMenu,
|
|
@@ -15491,7 +15563,7 @@ var import_LexicalComposerContext64 = require("@lexical/react/LexicalComposerCon
|
|
|
15491
15563
|
var import_rich_text10 = require("@lexical/rich-text");
|
|
15492
15564
|
var import_selection2 = require("@lexical/selection");
|
|
15493
15565
|
var import_table16 = require("@lexical/table");
|
|
15494
|
-
var
|
|
15566
|
+
var import_utils34 = require("@lexical/utils");
|
|
15495
15567
|
var import_lexical96 = require("lexical");
|
|
15496
15568
|
var import_debounce5 = __toESM(require("lodash-es/debounce"));
|
|
15497
15569
|
var import_lucide_react19 = require("lucide-react");
|
|
@@ -15536,7 +15608,7 @@ function TextToolbarPlugin() {
|
|
|
15536
15608
|
}
|
|
15537
15609
|
const nodes = selection.getNodes();
|
|
15538
15610
|
for (const node of nodes) {
|
|
15539
|
-
const element = (0,
|
|
15611
|
+
const element = (0, import_utils34.$findMatchingParent)(
|
|
15540
15612
|
node,
|
|
15541
15613
|
(parentNode) => (0, import_lexical96.$isElementNode)(parentNode) && !parentNode.isInline()
|
|
15542
15614
|
);
|
|
@@ -15767,7 +15839,7 @@ function TextToolbarPlugin() {
|
|
|
15767
15839
|
}
|
|
15768
15840
|
};
|
|
15769
15841
|
(0, import_react94.useEffect)(() => {
|
|
15770
|
-
return (0,
|
|
15842
|
+
return (0, import_utils34.mergeRegister)(
|
|
15771
15843
|
editor.registerCommand(
|
|
15772
15844
|
TEXT_TOOLBAR_SELECTION_CHANGE_COMMAND,
|
|
15773
15845
|
(payload, activeEditor) => {
|
|
@@ -15802,7 +15874,7 @@ function TextToolbarPlugin() {
|
|
|
15802
15874
|
return false;
|
|
15803
15875
|
}
|
|
15804
15876
|
const anchorNode = selection.anchor.getNode();
|
|
15805
|
-
let element = anchorNode.getKey() === "root" ? anchorNode : (0,
|
|
15877
|
+
let element = anchorNode.getKey() === "root" ? anchorNode : (0, import_utils34.$findMatchingParent)(
|
|
15806
15878
|
anchorNode,
|
|
15807
15879
|
(e) => {
|
|
15808
15880
|
const parent = e.getParent();
|
|
@@ -16562,7 +16634,7 @@ function FinancialStatementQuestionSettings(props) {
|
|
|
16562
16634
|
|
|
16563
16635
|
// src/plugins/FinancialStatementQuestionPlugin/FinancialStatementQuestionPlugin.tsx
|
|
16564
16636
|
var import_LexicalComposerContext66 = require("@lexical/react/LexicalComposerContext");
|
|
16565
|
-
var
|
|
16637
|
+
var import_utils35 = require("@lexical/utils");
|
|
16566
16638
|
var import_lexical99 = require("lexical");
|
|
16567
16639
|
var import_react96 = require("react");
|
|
16568
16640
|
var import_jsx_runtime117 = require("react/jsx-runtime");
|
|
@@ -16577,7 +16649,7 @@ function FinancialStatementQuestionPlugin() {
|
|
|
16577
16649
|
const [editor] = (0, import_LexicalComposerContext66.useLexicalComposerContext)();
|
|
16578
16650
|
const settingsPanelStickyRef = (0, import_react96.useRef)(null);
|
|
16579
16651
|
(0, import_react96.useEffect)(() => {
|
|
16580
|
-
return (0,
|
|
16652
|
+
return (0, import_utils35.mergeRegister)(
|
|
16581
16653
|
editor.registerCommand(
|
|
16582
16654
|
INSERT_FINANCIAL_STATEMENT_QUESTION_COMMAND,
|
|
16583
16655
|
(payload, activeEditor) => {
|
|
@@ -16886,7 +16958,7 @@ function useTypeaheadTriggerMatch2(trigger, {
|
|
|
16886
16958
|
var import_LexicalComposerContext67 = require("@lexical/react/LexicalComposerContext");
|
|
16887
16959
|
var import_rich_text12 = require("@lexical/rich-text");
|
|
16888
16960
|
var import_table17 = require("@lexical/table");
|
|
16889
|
-
var
|
|
16961
|
+
var import_utils36 = require("@lexical/utils");
|
|
16890
16962
|
var import_lexical101 = require("lexical");
|
|
16891
16963
|
var import_react98 = require("react");
|
|
16892
16964
|
|
|
@@ -17130,7 +17202,7 @@ function TypeaheadMenuPlugin() {
|
|
|
17130
17202
|
return false;
|
|
17131
17203
|
};
|
|
17132
17204
|
(0, import_react98.useEffect)(() => {
|
|
17133
|
-
return (0,
|
|
17205
|
+
return (0, import_utils36.mergeRegister)(
|
|
17134
17206
|
editor.registerCommand(
|
|
17135
17207
|
TYPEAHEAD_MENU_COMMAND,
|
|
17136
17208
|
(payload, activeEditor) => {
|
|
@@ -17673,7 +17745,7 @@ function Image(props) {
|
|
|
17673
17745
|
// src/plugins/LinkToolbarPlugin/LinkToolbarPlugin.tsx
|
|
17674
17746
|
var import_link4 = require("@lexical/link");
|
|
17675
17747
|
var import_LexicalComposerContext69 = require("@lexical/react/LexicalComposerContext");
|
|
17676
|
-
var
|
|
17748
|
+
var import_utils37 = require("@lexical/utils");
|
|
17677
17749
|
var import_lexical102 = require("lexical");
|
|
17678
17750
|
var import_debounce6 = __toESM(require("lodash-es/debounce"));
|
|
17679
17751
|
var import_lucide_react26 = require("lucide-react");
|
|
@@ -17705,7 +17777,7 @@ function LinkToolbarPlugin() {
|
|
|
17705
17777
|
[editor]
|
|
17706
17778
|
);
|
|
17707
17779
|
(0, import_react104.useEffect)(() => {
|
|
17708
|
-
return (0,
|
|
17780
|
+
return (0, import_utils37.mergeRegister)(
|
|
17709
17781
|
editor.registerCommand(
|
|
17710
17782
|
import_lexical102.CLICK_COMMAND,
|
|
17711
17783
|
(event, activeEditor) => {
|
|
@@ -18407,7 +18479,7 @@ function VariableSettingsPlugin() {
|
|
|
18407
18479
|
|
|
18408
18480
|
// src/plugins/VariablesPlugin/VariableToolbarPlugin.tsx
|
|
18409
18481
|
var import_LexicalComposerContext71 = require("@lexical/react/LexicalComposerContext");
|
|
18410
|
-
var
|
|
18482
|
+
var import_utils39 = require("@lexical/utils");
|
|
18411
18483
|
var import_lexical104 = require("lexical");
|
|
18412
18484
|
var import_debounce7 = __toESM(require("lodash-es/debounce"));
|
|
18413
18485
|
var import_lucide_react28 = require("lucide-react");
|
|
@@ -18522,7 +18594,7 @@ function VariableToolbarPlugin() {
|
|
|
18522
18594
|
[activeEditorRef.current]
|
|
18523
18595
|
);
|
|
18524
18596
|
(0, import_react110.useEffect)(() => {
|
|
18525
|
-
return (0,
|
|
18597
|
+
return (0, import_utils39.mergeRegister)(
|
|
18526
18598
|
editor.registerCommand(
|
|
18527
18599
|
VARIABLE_TOOLBAR_SELECTION_CHANGE_COMMAND,
|
|
18528
18600
|
(_, activeEditor) => {
|