@examind/block-editor 0.1.4 → 0.1.5
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 +9 -0
- package/dist/index.js +113 -63
- package/dist/index.mjs +113 -63
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -3400,6 +3400,15 @@ article {
|
|
|
3400
3400
|
font-weight: var(--sl-font-weight-bold);
|
|
3401
3401
|
color: var(--sl-color-neutral-600);
|
|
3402
3402
|
}
|
|
3403
|
+
.financial-statement-question-header {
|
|
3404
|
+
position: relative;
|
|
3405
|
+
padding: var(--sl-spacing-3x-small) var(--sl-spacing-2x-small);
|
|
3406
|
+
text-align: left;
|
|
3407
|
+
vertical-align: top;
|
|
3408
|
+
border-bottom: 1px solid var(--sl-color-neutral-200);
|
|
3409
|
+
border-right: 1px solid var(--sl-color-neutral-200);
|
|
3410
|
+
background-color: var(--sl-color-neutral-100);
|
|
3411
|
+
}
|
|
3403
3412
|
.financial-statement-question-cell {
|
|
3404
3413
|
position: relative;
|
|
3405
3414
|
padding-left: var(--sl-spacing-large);
|
package/dist/index.js
CHANGED
|
@@ -5215,14 +5215,14 @@ function DistractorButton(props) {
|
|
|
5215
5215
|
] });
|
|
5216
5216
|
}
|
|
5217
5217
|
|
|
5218
|
-
// src/plugins/VariablesPlugin/
|
|
5218
|
+
// src/plugins/VariablesPlugin/TypeaheadVariableAgentPlugin.tsx
|
|
5219
5219
|
var import_LexicalComposerContext21 = require("@lexical/react/LexicalComposerContext");
|
|
5220
5220
|
var import_utils6 = require("@lexical/utils");
|
|
5221
5221
|
var import_lexical23 = require("lexical");
|
|
5222
5222
|
var import_react38 = require("react");
|
|
5223
5223
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
5224
|
-
var
|
|
5225
|
-
function
|
|
5224
|
+
var TYPEAHEAD_VARIABLE_COMMAND = (0, import_lexical23.createCommand)("TYPEAHEAD_VARIABLE_COMMAND");
|
|
5225
|
+
function TypeaheadVariableAgentPlugin() {
|
|
5226
5226
|
const { hasModule, modulesNumber } = useBlockEditor();
|
|
5227
5227
|
const [editor] = (0, import_LexicalComposerContext21.useLexicalComposerContext)();
|
|
5228
5228
|
(0, import_react38.useEffect)(() => {
|
|
@@ -5231,7 +5231,7 @@ function TypeaheadVariablesAgentPlugin() {
|
|
|
5231
5231
|
editor.registerUpdateListener(({ tags }) => {
|
|
5232
5232
|
if (!tags.has("history-merge")) {
|
|
5233
5233
|
editor.dispatchCommand(
|
|
5234
|
-
|
|
5234
|
+
TYPEAHEAD_VARIABLE_COMMAND,
|
|
5235
5235
|
void 0
|
|
5236
5236
|
);
|
|
5237
5237
|
}
|
|
@@ -5758,7 +5758,7 @@ function JournalEntryQuestionItemComponent(props) {
|
|
|
5758
5758
|
decoratorNode: JournalEntryQuestionNode
|
|
5759
5759
|
}
|
|
5760
5760
|
),
|
|
5761
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5761
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TypeaheadVariableAgentPlugin, {}),
|
|
5762
5762
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(VariableComponentPlugin, {})
|
|
5763
5763
|
] }) }) }),
|
|
5764
5764
|
(!debit || !credit) && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "controls", children: [
|
|
@@ -5817,7 +5817,7 @@ function JournalEntryQuestionItemComponent(props) {
|
|
|
5817
5817
|
decoratorNode: JournalEntryQuestionNode
|
|
5818
5818
|
}
|
|
5819
5819
|
),
|
|
5820
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5820
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TypeaheadVariableAgentPlugin, {}),
|
|
5821
5821
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(VariableComponentPlugin, {})
|
|
5822
5822
|
] }) }) })
|
|
5823
5823
|
]
|
|
@@ -5854,7 +5854,7 @@ function JournalEntryQuestionItemComponent(props) {
|
|
|
5854
5854
|
decoratorNode: JournalEntryQuestionNode
|
|
5855
5855
|
}
|
|
5856
5856
|
),
|
|
5857
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5857
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TypeaheadVariableAgentPlugin, {}),
|
|
5858
5858
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(VariableComponentPlugin, {}),
|
|
5859
5859
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(VariableToolbarAgentPlugin, {})
|
|
5860
5860
|
] }) }) }),
|
|
@@ -6401,7 +6401,7 @@ function QuestionItemComponent(props) {
|
|
|
6401
6401
|
),
|
|
6402
6402
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_LexicalHistoryPlugin4.HistoryPlugin, { externalHistoryState: historyState }),
|
|
6403
6403
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(TextToolbarAgentPlugin, {}),
|
|
6404
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6404
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(TypeaheadVariableAgentPlugin, {}),
|
|
6405
6405
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(VariableComponentPlugin, {})
|
|
6406
6406
|
] }) }) })
|
|
6407
6407
|
]
|
|
@@ -6435,7 +6435,7 @@ function QuestionItemComponent(props) {
|
|
|
6435
6435
|
decoratorNode: MatchingQuestionNode
|
|
6436
6436
|
}
|
|
6437
6437
|
),
|
|
6438
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6438
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(TypeaheadVariableAgentPlugin, {}),
|
|
6439
6439
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(VariableComponentPlugin, {}),
|
|
6440
6440
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(VariableToolbarAgentPlugin, {})
|
|
6441
6441
|
] }) }) }),
|
|
@@ -6810,7 +6810,7 @@ function MultipleOptionQuestionItemComponent(props) {
|
|
|
6810
6810
|
decoratorNode: MultipleOptionQuestionNode
|
|
6811
6811
|
}
|
|
6812
6812
|
),
|
|
6813
|
-
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
6813
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TypeaheadVariableAgentPlugin, {}),
|
|
6814
6814
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(VariableComponentPlugin, {}),
|
|
6815
6815
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(VariableToolbarAgentPlugin, {})
|
|
6816
6816
|
] }) }) }),
|
|
@@ -7253,7 +7253,7 @@ function ShortAnswerQuestionComponent(props) {
|
|
|
7253
7253
|
decoratorNode: ShortAnswerQuestionNode
|
|
7254
7254
|
}
|
|
7255
7255
|
),
|
|
7256
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
7256
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(TypeaheadVariableAgentPlugin, {}),
|
|
7257
7257
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(VariableComponentPlugin, {}),
|
|
7258
7258
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(VariableToolbarAgentPlugin, {})
|
|
7259
7259
|
] }) }) })
|
|
@@ -7648,7 +7648,7 @@ function FillInTheBlankQuestionComponent(props) {
|
|
|
7648
7648
|
decoratorNode: FillInTheBlankQuestionNode
|
|
7649
7649
|
}
|
|
7650
7650
|
),
|
|
7651
|
-
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
7651
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(TypeaheadVariableAgentPlugin, {}),
|
|
7652
7652
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(VariableComponentPlugin, {}),
|
|
7653
7653
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(VariableToolbarAgentPlugin, {}),
|
|
7654
7654
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
@@ -7827,26 +7827,34 @@ function FinancialStatementQuestionComponent(props) {
|
|
|
7827
7827
|
),
|
|
7828
7828
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { "data-selectable": "true", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("table", { "data-selectable": "true", style: { width: "100%" }, children: [
|
|
7829
7829
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("thead", { "data-selectable": "true", children: [
|
|
7830
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("tr", { "data-selectable": "true", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7830
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("tr", { "data-selectable": "true", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7831
|
+
"td",
|
|
7832
|
+
{
|
|
7833
|
+
className: "financial-statement-question-header",
|
|
7834
|
+
colSpan: 2,
|
|
7835
|
+
"data-selectable": "true",
|
|
7836
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_LexicalNestedComposer7.LexicalNestedComposer, { initialEditor: header, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(NestedEditor, { nodeKey, children: [
|
|
7837
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(SettingsPanelNestedAgentPlugin, {}),
|
|
7838
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7839
|
+
import_LexicalRichTextPlugin7.RichTextPlugin,
|
|
7840
|
+
{
|
|
7841
|
+
contentEditable: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(NestedContentEditable, {}),
|
|
7842
|
+
ErrorBoundary: import_LexicalErrorBoundary7.LexicalErrorBoundary,
|
|
7843
|
+
placeholder: null
|
|
7844
|
+
},
|
|
7845
|
+
nodeKey
|
|
7846
|
+
),
|
|
7847
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7848
|
+
import_LexicalHistoryPlugin8.HistoryPlugin,
|
|
7849
|
+
{
|
|
7850
|
+
externalHistoryState: historyState
|
|
7851
|
+
}
|
|
7852
|
+
),
|
|
7853
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(TypeaheadVariableAgentPlugin, {}),
|
|
7854
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(VariableComponentPlugin, {})
|
|
7855
|
+
] }) })
|
|
7856
|
+
}
|
|
7857
|
+
) }),
|
|
7850
7858
|
columnHeaders.length >= 2 && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("tr", { "data-selectable": "true", children: [
|
|
7851
7859
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7852
7860
|
"th",
|
|
@@ -7934,7 +7942,7 @@ function FinancialStatementQuestionComponent(props) {
|
|
|
7934
7942
|
externalHistoryState: historyState
|
|
7935
7943
|
}
|
|
7936
7944
|
),
|
|
7937
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7945
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(TypeaheadVariableAgentPlugin, {}),
|
|
7938
7946
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(VariableComponentPlugin, {})
|
|
7939
7947
|
] })
|
|
7940
7948
|
}
|
|
@@ -14123,16 +14131,48 @@ var PopupToolbar = (0, import_react86.forwardRef)((props, ref) => {
|
|
|
14123
14131
|
|
|
14124
14132
|
// src/content/colorDialog/colorConstants.ts
|
|
14125
14133
|
var textColorList = [
|
|
14126
|
-
{
|
|
14127
|
-
|
|
14128
|
-
|
|
14129
|
-
|
|
14134
|
+
{
|
|
14135
|
+
label: "Red",
|
|
14136
|
+
color: "var(--td-editor-text-color-red)",
|
|
14137
|
+
bgColor: "default"
|
|
14138
|
+
},
|
|
14139
|
+
{
|
|
14140
|
+
label: "Green",
|
|
14141
|
+
color: "var(--td-editor-text-color-green)",
|
|
14142
|
+
bgColor: "default"
|
|
14143
|
+
},
|
|
14144
|
+
{
|
|
14145
|
+
label: "Blue",
|
|
14146
|
+
color: "var(--td-editor-text-color-blue)",
|
|
14147
|
+
bgColor: "default"
|
|
14148
|
+
},
|
|
14149
|
+
{
|
|
14150
|
+
label: "Purple",
|
|
14151
|
+
color: "var(--td-editor-text-color-purple)",
|
|
14152
|
+
bgColor: "default"
|
|
14153
|
+
}
|
|
14130
14154
|
];
|
|
14131
14155
|
var bgColorList = [
|
|
14132
|
-
{
|
|
14133
|
-
|
|
14134
|
-
|
|
14135
|
-
|
|
14156
|
+
{
|
|
14157
|
+
label: "Red",
|
|
14158
|
+
bgColor: "var(--td-editor-bg-color-red)",
|
|
14159
|
+
color: "var(--td-editor-text-color-red)"
|
|
14160
|
+
},
|
|
14161
|
+
{
|
|
14162
|
+
label: "Green",
|
|
14163
|
+
bgColor: "var(--td-editor-bg-color-green)",
|
|
14164
|
+
color: "var(--td-editor-text-color-green)"
|
|
14165
|
+
},
|
|
14166
|
+
{
|
|
14167
|
+
label: "Blue",
|
|
14168
|
+
bgColor: "var(--td-editor-bg-color-blue)",
|
|
14169
|
+
color: "var(--td-editor-text-color-blue)"
|
|
14170
|
+
},
|
|
14171
|
+
{
|
|
14172
|
+
label: "Purple",
|
|
14173
|
+
bgColor: "var(--td-editor-bg-color-purple)",
|
|
14174
|
+
color: "var(--td-editor-text-color-purple)"
|
|
14175
|
+
}
|
|
14136
14176
|
];
|
|
14137
14177
|
|
|
14138
14178
|
// src/components/feedback/ProgressBar.tsx
|
|
@@ -14894,8 +14934,8 @@ function replaceWithVariable(variableName, variableFormat, editor, textToReplace
|
|
|
14894
14934
|
);
|
|
14895
14935
|
}
|
|
14896
14936
|
|
|
14897
|
-
// src/plugins/VariablesPlugin/
|
|
14898
|
-
function
|
|
14937
|
+
// src/plugins/VariablesPlugin/renderVariableMenu.tsx
|
|
14938
|
+
function renderVariableMenu(list, popupRef, highlighterRef, activeEditorRef, textToReplaceTargetRef, onUpdateCb) {
|
|
14899
14939
|
return [...list].map((variableName) => {
|
|
14900
14940
|
return {
|
|
14901
14941
|
id: variableName,
|
|
@@ -15104,14 +15144,14 @@ function removeTextInDomSelection(editor, leadOffset, onUpdate) {
|
|
|
15104
15144
|
);
|
|
15105
15145
|
}
|
|
15106
15146
|
|
|
15107
|
-
// src/plugins/VariablesPlugin/
|
|
15147
|
+
// src/plugins/VariablesPlugin/TypeaheadVariablePlugin.tsx
|
|
15108
15148
|
var import_LexicalComposerContext63 = require("@lexical/react/LexicalComposerContext");
|
|
15109
15149
|
var import_utils31 = require("@lexical/utils");
|
|
15110
15150
|
var import_lexical95 = require("lexical");
|
|
15111
15151
|
var import_react93 = require("react");
|
|
15112
15152
|
var import_jsx_runtime114 = require("react/jsx-runtime");
|
|
15113
15153
|
var CREATE_VARIABLE_FROM_SELECTION_COMMAND = (0, import_lexical95.createCommand)("CREATE_VARIABLE_FROM_SELECTION_COMMAND");
|
|
15114
|
-
function
|
|
15154
|
+
function TypeaheadVariablePlugin() {
|
|
15115
15155
|
const { variableList, onCreated } = useVariables();
|
|
15116
15156
|
const [editor] = (0, import_LexicalComposerContext63.useLexicalComposerContext)();
|
|
15117
15157
|
const triggerVariableFn = useTypeaheadTriggerMatch("@", {
|
|
@@ -15265,7 +15305,7 @@ function TypeaheadVariablesPlugin() {
|
|
|
15265
15305
|
(0, import_react93.useEffect)(() => {
|
|
15266
15306
|
return (0, import_utils31.mergeRegister)(
|
|
15267
15307
|
editor.registerCommand(
|
|
15268
|
-
|
|
15308
|
+
TYPEAHEAD_VARIABLE_COMMAND,
|
|
15269
15309
|
(_payload, activeEditor) => {
|
|
15270
15310
|
activeEditorRef.current = activeEditor;
|
|
15271
15311
|
handleUpdate();
|
|
@@ -15332,7 +15372,7 @@ function TypeaheadVariablesPlugin() {
|
|
|
15332
15372
|
);
|
|
15333
15373
|
}, [editor, variableList]);
|
|
15334
15374
|
const menu = (0, import_react93.useMemo)(() => {
|
|
15335
|
-
return
|
|
15375
|
+
return renderVariableMenu(
|
|
15336
15376
|
variableList || [],
|
|
15337
15377
|
popupRef,
|
|
15338
15378
|
highlighterRef,
|
|
@@ -15529,19 +15569,19 @@ function TextToolbarPlugin() {
|
|
|
15529
15569
|
}
|
|
15530
15570
|
);
|
|
15531
15571
|
};
|
|
15532
|
-
const formatBackgroundColor = (
|
|
15572
|
+
const formatBackgroundColor = (color, bgColor) => {
|
|
15533
15573
|
activeEditorRef.current?.update(
|
|
15534
15574
|
() => {
|
|
15535
15575
|
const selection = (0, import_lexical96.$getSelection)();
|
|
15536
15576
|
if (selection !== null) {
|
|
15537
15577
|
(0, import_selection2.$patchStyleText)(selection, {
|
|
15538
|
-
color: null,
|
|
15539
|
-
"background-color":
|
|
15540
|
-
"border-radius":
|
|
15541
|
-
"outline-width":
|
|
15542
|
-
"outline-color":
|
|
15543
|
-
"outline-style":
|
|
15544
|
-
"padding-inline":
|
|
15578
|
+
color: color !== "default" ? color : null,
|
|
15579
|
+
"background-color": bgColor !== "default" ? bgColor : null,
|
|
15580
|
+
"border-radius": bgColor !== "default" ? "calc(var(--sl-border-radius-small) * 0.5)" : null,
|
|
15581
|
+
"outline-width": bgColor !== "default" ? "2px" : null,
|
|
15582
|
+
"outline-color": bgColor !== "default" ? bgColor : null,
|
|
15583
|
+
"outline-style": bgColor !== "default" ? "solid" : null,
|
|
15584
|
+
"padding-inline": bgColor !== "default" ? "1px" : null
|
|
15545
15585
|
});
|
|
15546
15586
|
}
|
|
15547
15587
|
},
|
|
@@ -16011,7 +16051,7 @@ function TextToolbarPlugin() {
|
|
|
16011
16051
|
label: "Default",
|
|
16012
16052
|
Icon: import_lucide_react19.Circle,
|
|
16013
16053
|
onClick: () => {
|
|
16014
|
-
formatBackgroundColor("default");
|
|
16054
|
+
formatBackgroundColor("default", "default");
|
|
16015
16055
|
}
|
|
16016
16056
|
},
|
|
16017
16057
|
...bgColorList.map((simpleColor, index) => {
|
|
@@ -16022,7 +16062,10 @@ function TextToolbarPlugin() {
|
|
|
16022
16062
|
color: bgColorList[index].color,
|
|
16023
16063
|
bgColor: simpleColor.color,
|
|
16024
16064
|
onClick: () => {
|
|
16025
|
-
formatBackgroundColor(
|
|
16065
|
+
formatBackgroundColor(
|
|
16066
|
+
simpleColor.color,
|
|
16067
|
+
simpleColor.bgColor
|
|
16068
|
+
);
|
|
16026
16069
|
}
|
|
16027
16070
|
};
|
|
16028
16071
|
})
|
|
@@ -16994,10 +17037,17 @@ function TypeaheadMenuPlugin() {
|
|
|
16994
17037
|
);
|
|
16995
17038
|
} else if ((0, import_lexical101.$isParagraphNode)(node)) {
|
|
16996
17039
|
if (node.getChildrenSize() === 0) {
|
|
16997
|
-
|
|
16998
|
-
|
|
16999
|
-
|
|
17000
|
-
|
|
17040
|
+
if (hasModule("Variables")) {
|
|
17041
|
+
dom.setAttribute(
|
|
17042
|
+
"data-placeholder",
|
|
17043
|
+
"Type / for commands or @ for variables"
|
|
17044
|
+
);
|
|
17045
|
+
} else {
|
|
17046
|
+
dom.setAttribute(
|
|
17047
|
+
"data-placeholder",
|
|
17048
|
+
"Type / for commands"
|
|
17049
|
+
);
|
|
17050
|
+
}
|
|
17001
17051
|
}
|
|
17002
17052
|
}
|
|
17003
17053
|
hidePopup();
|
|
@@ -17535,7 +17585,7 @@ function BlockEditor(props) {
|
|
|
17535
17585
|
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(NodeMousePlugin, {}),
|
|
17536
17586
|
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(TextToolbarPlugin, {}),
|
|
17537
17587
|
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(TextToolbarAgentPlugin, {}),
|
|
17538
|
-
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
17588
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(TypeaheadVariableAgentPlugin, {}),
|
|
17539
17589
|
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(VariableComponentPlugin, {}),
|
|
17540
17590
|
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(MarkdownPlugin, {})
|
|
17541
17591
|
]
|
|
@@ -18575,7 +18625,7 @@ function Variables(props) {
|
|
|
18575
18625
|
});
|
|
18576
18626
|
}, [variablesSettings, setEditingModeDataCallback]);
|
|
18577
18627
|
return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(VariablesProvider, { variablesSettings, children: [
|
|
18578
|
-
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
18628
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(TypeaheadVariablePlugin, {}),
|
|
18579
18629
|
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(VariableSettingsPlugin, {}),
|
|
18580
18630
|
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(VariableToolbarPlugin, {}),
|
|
18581
18631
|
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(VariableToolbarAgentPlugin, {})
|
package/dist/index.mjs
CHANGED
|
@@ -5329,14 +5329,14 @@ function DistractorButton(props) {
|
|
|
5329
5329
|
] });
|
|
5330
5330
|
}
|
|
5331
5331
|
|
|
5332
|
-
// src/plugins/VariablesPlugin/
|
|
5332
|
+
// src/plugins/VariablesPlugin/TypeaheadVariableAgentPlugin.tsx
|
|
5333
5333
|
import { useLexicalComposerContext as useLexicalComposerContext21 } from "@lexical/react/LexicalComposerContext";
|
|
5334
5334
|
import { mergeRegister as mergeRegister6 } from "@lexical/utils";
|
|
5335
5335
|
import { createCommand as createCommand6 } from "lexical";
|
|
5336
5336
|
import { useEffect as useEffect30 } from "react";
|
|
5337
5337
|
import { Fragment as Fragment20, jsx as jsx49 } from "react/jsx-runtime";
|
|
5338
|
-
var
|
|
5339
|
-
function
|
|
5338
|
+
var TYPEAHEAD_VARIABLE_COMMAND = createCommand6("TYPEAHEAD_VARIABLE_COMMAND");
|
|
5339
|
+
function TypeaheadVariableAgentPlugin() {
|
|
5340
5340
|
const { hasModule, modulesNumber } = useBlockEditor();
|
|
5341
5341
|
const [editor] = useLexicalComposerContext21();
|
|
5342
5342
|
useEffect30(() => {
|
|
@@ -5345,7 +5345,7 @@ function TypeaheadVariablesAgentPlugin() {
|
|
|
5345
5345
|
editor.registerUpdateListener(({ tags }) => {
|
|
5346
5346
|
if (!tags.has("history-merge")) {
|
|
5347
5347
|
editor.dispatchCommand(
|
|
5348
|
-
|
|
5348
|
+
TYPEAHEAD_VARIABLE_COMMAND,
|
|
5349
5349
|
void 0
|
|
5350
5350
|
);
|
|
5351
5351
|
}
|
|
@@ -5892,7 +5892,7 @@ function JournalEntryQuestionItemComponent(props) {
|
|
|
5892
5892
|
decoratorNode: JournalEntryQuestionNode
|
|
5893
5893
|
}
|
|
5894
5894
|
),
|
|
5895
|
-
/* @__PURE__ */ jsx54(
|
|
5895
|
+
/* @__PURE__ */ jsx54(TypeaheadVariableAgentPlugin, {}),
|
|
5896
5896
|
/* @__PURE__ */ jsx54(VariableComponentPlugin, {})
|
|
5897
5897
|
] }) }) }),
|
|
5898
5898
|
(!debit || !credit) && /* @__PURE__ */ jsxs17("div", { className: "controls", children: [
|
|
@@ -5951,7 +5951,7 @@ function JournalEntryQuestionItemComponent(props) {
|
|
|
5951
5951
|
decoratorNode: JournalEntryQuestionNode
|
|
5952
5952
|
}
|
|
5953
5953
|
),
|
|
5954
|
-
/* @__PURE__ */ jsx54(
|
|
5954
|
+
/* @__PURE__ */ jsx54(TypeaheadVariableAgentPlugin, {}),
|
|
5955
5955
|
/* @__PURE__ */ jsx54(VariableComponentPlugin, {})
|
|
5956
5956
|
] }) }) })
|
|
5957
5957
|
]
|
|
@@ -5988,7 +5988,7 @@ function JournalEntryQuestionItemComponent(props) {
|
|
|
5988
5988
|
decoratorNode: JournalEntryQuestionNode
|
|
5989
5989
|
}
|
|
5990
5990
|
),
|
|
5991
|
-
/* @__PURE__ */ jsx54(
|
|
5991
|
+
/* @__PURE__ */ jsx54(TypeaheadVariableAgentPlugin, {}),
|
|
5992
5992
|
/* @__PURE__ */ jsx54(VariableComponentPlugin, {}),
|
|
5993
5993
|
/* @__PURE__ */ jsx54(VariableToolbarAgentPlugin, {})
|
|
5994
5994
|
] }) }) }),
|
|
@@ -6560,7 +6560,7 @@ function QuestionItemComponent(props) {
|
|
|
6560
6560
|
),
|
|
6561
6561
|
/* @__PURE__ */ jsx58(HistoryPlugin3, { externalHistoryState: historyState }),
|
|
6562
6562
|
/* @__PURE__ */ jsx58(TextToolbarAgentPlugin, {}),
|
|
6563
|
-
/* @__PURE__ */ jsx58(
|
|
6563
|
+
/* @__PURE__ */ jsx58(TypeaheadVariableAgentPlugin, {}),
|
|
6564
6564
|
/* @__PURE__ */ jsx58(VariableComponentPlugin, {})
|
|
6565
6565
|
] }) }) })
|
|
6566
6566
|
]
|
|
@@ -6594,7 +6594,7 @@ function QuestionItemComponent(props) {
|
|
|
6594
6594
|
decoratorNode: MatchingQuestionNode
|
|
6595
6595
|
}
|
|
6596
6596
|
),
|
|
6597
|
-
/* @__PURE__ */ jsx58(
|
|
6597
|
+
/* @__PURE__ */ jsx58(TypeaheadVariableAgentPlugin, {}),
|
|
6598
6598
|
/* @__PURE__ */ jsx58(VariableComponentPlugin, {}),
|
|
6599
6599
|
/* @__PURE__ */ jsx58(VariableToolbarAgentPlugin, {})
|
|
6600
6600
|
] }) }) }),
|
|
@@ -6982,7 +6982,7 @@ function MultipleOptionQuestionItemComponent(props) {
|
|
|
6982
6982
|
decoratorNode: MultipleOptionQuestionNode
|
|
6983
6983
|
}
|
|
6984
6984
|
),
|
|
6985
|
-
/* @__PURE__ */ jsx61(
|
|
6985
|
+
/* @__PURE__ */ jsx61(TypeaheadVariableAgentPlugin, {}),
|
|
6986
6986
|
/* @__PURE__ */ jsx61(VariableComponentPlugin, {}),
|
|
6987
6987
|
/* @__PURE__ */ jsx61(VariableToolbarAgentPlugin, {})
|
|
6988
6988
|
] }) }) }),
|
|
@@ -7435,7 +7435,7 @@ function ShortAnswerQuestionComponent(props) {
|
|
|
7435
7435
|
decoratorNode: ShortAnswerQuestionNode
|
|
7436
7436
|
}
|
|
7437
7437
|
),
|
|
7438
|
-
/* @__PURE__ */ jsx64(
|
|
7438
|
+
/* @__PURE__ */ jsx64(TypeaheadVariableAgentPlugin, {}),
|
|
7439
7439
|
/* @__PURE__ */ jsx64(VariableComponentPlugin, {}),
|
|
7440
7440
|
/* @__PURE__ */ jsx64(VariableToolbarAgentPlugin, {})
|
|
7441
7441
|
] }) }) })
|
|
@@ -7854,7 +7854,7 @@ function FillInTheBlankQuestionComponent(props) {
|
|
|
7854
7854
|
decoratorNode: FillInTheBlankQuestionNode
|
|
7855
7855
|
}
|
|
7856
7856
|
),
|
|
7857
|
-
/* @__PURE__ */ jsx69(
|
|
7857
|
+
/* @__PURE__ */ jsx69(TypeaheadVariableAgentPlugin, {}),
|
|
7858
7858
|
/* @__PURE__ */ jsx69(VariableComponentPlugin, {}),
|
|
7859
7859
|
/* @__PURE__ */ jsx69(VariableToolbarAgentPlugin, {}),
|
|
7860
7860
|
/* @__PURE__ */ jsx69(
|
|
@@ -8043,26 +8043,34 @@ function FinancialStatementQuestionComponent(props) {
|
|
|
8043
8043
|
),
|
|
8044
8044
|
/* @__PURE__ */ jsx71("div", { "data-selectable": "true", children: /* @__PURE__ */ jsxs26("table", { "data-selectable": "true", style: { width: "100%" }, children: [
|
|
8045
8045
|
/* @__PURE__ */ jsxs26("thead", { "data-selectable": "true", children: [
|
|
8046
|
-
/* @__PURE__ */ jsx71("tr", { "data-selectable": "true", children: /* @__PURE__ */ jsx71(
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
|
|
8053
|
-
|
|
8054
|
-
|
|
8055
|
-
|
|
8056
|
-
|
|
8057
|
-
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8046
|
+
/* @__PURE__ */ jsx71("tr", { "data-selectable": "true", children: /* @__PURE__ */ jsx71(
|
|
8047
|
+
"td",
|
|
8048
|
+
{
|
|
8049
|
+
className: "financial-statement-question-header",
|
|
8050
|
+
colSpan: 2,
|
|
8051
|
+
"data-selectable": "true",
|
|
8052
|
+
children: /* @__PURE__ */ jsx71(LexicalNestedComposer7, { initialEditor: header, children: /* @__PURE__ */ jsxs26(NestedEditor, { nodeKey, children: [
|
|
8053
|
+
/* @__PURE__ */ jsx71(SettingsPanelNestedAgentPlugin, {}),
|
|
8054
|
+
/* @__PURE__ */ jsx71(
|
|
8055
|
+
RichTextPlugin7,
|
|
8056
|
+
{
|
|
8057
|
+
contentEditable: /* @__PURE__ */ jsx71(NestedContentEditable, {}),
|
|
8058
|
+
ErrorBoundary: LexicalErrorBoundary7,
|
|
8059
|
+
placeholder: null
|
|
8060
|
+
},
|
|
8061
|
+
nodeKey
|
|
8062
|
+
),
|
|
8063
|
+
/* @__PURE__ */ jsx71(
|
|
8064
|
+
HistoryPlugin7,
|
|
8065
|
+
{
|
|
8066
|
+
externalHistoryState: historyState
|
|
8067
|
+
}
|
|
8068
|
+
),
|
|
8069
|
+
/* @__PURE__ */ jsx71(TypeaheadVariableAgentPlugin, {}),
|
|
8070
|
+
/* @__PURE__ */ jsx71(VariableComponentPlugin, {})
|
|
8071
|
+
] }) })
|
|
8072
|
+
}
|
|
8073
|
+
) }),
|
|
8066
8074
|
columnHeaders.length >= 2 && /* @__PURE__ */ jsxs26("tr", { "data-selectable": "true", children: [
|
|
8067
8075
|
/* @__PURE__ */ jsx71(
|
|
8068
8076
|
"th",
|
|
@@ -8150,7 +8158,7 @@ function FinancialStatementQuestionComponent(props) {
|
|
|
8150
8158
|
externalHistoryState: historyState
|
|
8151
8159
|
}
|
|
8152
8160
|
),
|
|
8153
|
-
/* @__PURE__ */ jsx71(
|
|
8161
|
+
/* @__PURE__ */ jsx71(TypeaheadVariableAgentPlugin, {}),
|
|
8154
8162
|
/* @__PURE__ */ jsx71(VariableComponentPlugin, {})
|
|
8155
8163
|
] })
|
|
8156
8164
|
}
|
|
@@ -14589,16 +14597,48 @@ var PopupToolbar = forwardRef12((props, ref) => {
|
|
|
14589
14597
|
|
|
14590
14598
|
// src/content/colorDialog/colorConstants.ts
|
|
14591
14599
|
var textColorList = [
|
|
14592
|
-
{
|
|
14593
|
-
|
|
14594
|
-
|
|
14595
|
-
|
|
14600
|
+
{
|
|
14601
|
+
label: "Red",
|
|
14602
|
+
color: "var(--td-editor-text-color-red)",
|
|
14603
|
+
bgColor: "default"
|
|
14604
|
+
},
|
|
14605
|
+
{
|
|
14606
|
+
label: "Green",
|
|
14607
|
+
color: "var(--td-editor-text-color-green)",
|
|
14608
|
+
bgColor: "default"
|
|
14609
|
+
},
|
|
14610
|
+
{
|
|
14611
|
+
label: "Blue",
|
|
14612
|
+
color: "var(--td-editor-text-color-blue)",
|
|
14613
|
+
bgColor: "default"
|
|
14614
|
+
},
|
|
14615
|
+
{
|
|
14616
|
+
label: "Purple",
|
|
14617
|
+
color: "var(--td-editor-text-color-purple)",
|
|
14618
|
+
bgColor: "default"
|
|
14619
|
+
}
|
|
14596
14620
|
];
|
|
14597
14621
|
var bgColorList = [
|
|
14598
|
-
{
|
|
14599
|
-
|
|
14600
|
-
|
|
14601
|
-
|
|
14622
|
+
{
|
|
14623
|
+
label: "Red",
|
|
14624
|
+
bgColor: "var(--td-editor-bg-color-red)",
|
|
14625
|
+
color: "var(--td-editor-text-color-red)"
|
|
14626
|
+
},
|
|
14627
|
+
{
|
|
14628
|
+
label: "Green",
|
|
14629
|
+
bgColor: "var(--td-editor-bg-color-green)",
|
|
14630
|
+
color: "var(--td-editor-text-color-green)"
|
|
14631
|
+
},
|
|
14632
|
+
{
|
|
14633
|
+
label: "Blue",
|
|
14634
|
+
bgColor: "var(--td-editor-bg-color-blue)",
|
|
14635
|
+
color: "var(--td-editor-text-color-blue)"
|
|
14636
|
+
},
|
|
14637
|
+
{
|
|
14638
|
+
label: "Purple",
|
|
14639
|
+
bgColor: "var(--td-editor-bg-color-purple)",
|
|
14640
|
+
color: "var(--td-editor-text-color-purple)"
|
|
14641
|
+
}
|
|
14602
14642
|
];
|
|
14603
14643
|
|
|
14604
14644
|
// src/components/feedback/ProgressBar.tsx
|
|
@@ -15386,8 +15426,8 @@ function replaceWithVariable(variableName, variableFormat, editor, textToReplace
|
|
|
15386
15426
|
);
|
|
15387
15427
|
}
|
|
15388
15428
|
|
|
15389
|
-
// src/plugins/VariablesPlugin/
|
|
15390
|
-
function
|
|
15429
|
+
// src/plugins/VariablesPlugin/renderVariableMenu.tsx
|
|
15430
|
+
function renderVariableMenu(list, popupRef, highlighterRef, activeEditorRef, textToReplaceTargetRef, onUpdateCb) {
|
|
15391
15431
|
return [...list].map((variableName) => {
|
|
15392
15432
|
return {
|
|
15393
15433
|
id: variableName,
|
|
@@ -15605,7 +15645,7 @@ function removeTextInDomSelection(editor, leadOffset, onUpdate) {
|
|
|
15605
15645
|
);
|
|
15606
15646
|
}
|
|
15607
15647
|
|
|
15608
|
-
// src/plugins/VariablesPlugin/
|
|
15648
|
+
// src/plugins/VariablesPlugin/TypeaheadVariablePlugin.tsx
|
|
15609
15649
|
import { useLexicalComposerContext as useLexicalComposerContext63 } from "@lexical/react/LexicalComposerContext";
|
|
15610
15650
|
import { mergeRegister as mergeRegister25 } from "@lexical/utils";
|
|
15611
15651
|
import {
|
|
@@ -15623,7 +15663,7 @@ import {
|
|
|
15623
15663
|
import { useEffect as useEffect76, useMemo as useMemo12, useRef as useRef52 } from "react";
|
|
15624
15664
|
import { Fragment as Fragment46, jsx as jsx114, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
15625
15665
|
var CREATE_VARIABLE_FROM_SELECTION_COMMAND = createCommand20("CREATE_VARIABLE_FROM_SELECTION_COMMAND");
|
|
15626
|
-
function
|
|
15666
|
+
function TypeaheadVariablePlugin() {
|
|
15627
15667
|
const { variableList, onCreated } = useVariables();
|
|
15628
15668
|
const [editor] = useLexicalComposerContext63();
|
|
15629
15669
|
const triggerVariableFn = useTypeaheadTriggerMatch("@", {
|
|
@@ -15777,7 +15817,7 @@ function TypeaheadVariablesPlugin() {
|
|
|
15777
15817
|
useEffect76(() => {
|
|
15778
15818
|
return mergeRegister25(
|
|
15779
15819
|
editor.registerCommand(
|
|
15780
|
-
|
|
15820
|
+
TYPEAHEAD_VARIABLE_COMMAND,
|
|
15781
15821
|
(_payload, activeEditor) => {
|
|
15782
15822
|
activeEditorRef.current = activeEditor;
|
|
15783
15823
|
handleUpdate();
|
|
@@ -15844,7 +15884,7 @@ function TypeaheadVariablesPlugin() {
|
|
|
15844
15884
|
);
|
|
15845
15885
|
}, [editor, variableList]);
|
|
15846
15886
|
const menu = useMemo12(() => {
|
|
15847
|
-
return
|
|
15887
|
+
return renderVariableMenu(
|
|
15848
15888
|
variableList || [],
|
|
15849
15889
|
popupRef,
|
|
15850
15890
|
highlighterRef,
|
|
@@ -16086,19 +16126,19 @@ function TextToolbarPlugin() {
|
|
|
16086
16126
|
}
|
|
16087
16127
|
);
|
|
16088
16128
|
};
|
|
16089
|
-
const formatBackgroundColor = (
|
|
16129
|
+
const formatBackgroundColor = (color, bgColor) => {
|
|
16090
16130
|
activeEditorRef.current?.update(
|
|
16091
16131
|
() => {
|
|
16092
16132
|
const selection = $getSelection14();
|
|
16093
16133
|
if (selection !== null) {
|
|
16094
16134
|
$patchStyleText(selection, {
|
|
16095
|
-
color: null,
|
|
16096
|
-
"background-color":
|
|
16097
|
-
"border-radius":
|
|
16098
|
-
"outline-width":
|
|
16099
|
-
"outline-color":
|
|
16100
|
-
"outline-style":
|
|
16101
|
-
"padding-inline":
|
|
16135
|
+
color: color !== "default" ? color : null,
|
|
16136
|
+
"background-color": bgColor !== "default" ? bgColor : null,
|
|
16137
|
+
"border-radius": bgColor !== "default" ? "calc(var(--sl-border-radius-small) * 0.5)" : null,
|
|
16138
|
+
"outline-width": bgColor !== "default" ? "2px" : null,
|
|
16139
|
+
"outline-color": bgColor !== "default" ? bgColor : null,
|
|
16140
|
+
"outline-style": bgColor !== "default" ? "solid" : null,
|
|
16141
|
+
"padding-inline": bgColor !== "default" ? "1px" : null
|
|
16102
16142
|
});
|
|
16103
16143
|
}
|
|
16104
16144
|
},
|
|
@@ -16568,7 +16608,7 @@ function TextToolbarPlugin() {
|
|
|
16568
16608
|
label: "Default",
|
|
16569
16609
|
Icon: Circle,
|
|
16570
16610
|
onClick: () => {
|
|
16571
|
-
formatBackgroundColor("default");
|
|
16611
|
+
formatBackgroundColor("default", "default");
|
|
16572
16612
|
}
|
|
16573
16613
|
},
|
|
16574
16614
|
...bgColorList.map((simpleColor, index) => {
|
|
@@ -16579,7 +16619,10 @@ function TextToolbarPlugin() {
|
|
|
16579
16619
|
color: bgColorList[index].color,
|
|
16580
16620
|
bgColor: simpleColor.color,
|
|
16581
16621
|
onClick: () => {
|
|
16582
|
-
formatBackgroundColor(
|
|
16622
|
+
formatBackgroundColor(
|
|
16623
|
+
simpleColor.color,
|
|
16624
|
+
simpleColor.bgColor
|
|
16625
|
+
);
|
|
16583
16626
|
}
|
|
16584
16627
|
};
|
|
16585
16628
|
})
|
|
@@ -17599,10 +17642,17 @@ function TypeaheadMenuPlugin() {
|
|
|
17599
17642
|
);
|
|
17600
17643
|
} else if ($isParagraphNode7(node)) {
|
|
17601
17644
|
if (node.getChildrenSize() === 0) {
|
|
17602
|
-
|
|
17603
|
-
|
|
17604
|
-
|
|
17605
|
-
|
|
17645
|
+
if (hasModule("Variables")) {
|
|
17646
|
+
dom.setAttribute(
|
|
17647
|
+
"data-placeholder",
|
|
17648
|
+
"Type / for commands or @ for variables"
|
|
17649
|
+
);
|
|
17650
|
+
} else {
|
|
17651
|
+
dom.setAttribute(
|
|
17652
|
+
"data-placeholder",
|
|
17653
|
+
"Type / for commands"
|
|
17654
|
+
);
|
|
17655
|
+
}
|
|
17606
17656
|
}
|
|
17607
17657
|
}
|
|
17608
17658
|
hidePopup();
|
|
@@ -18152,7 +18202,7 @@ function BlockEditor(props) {
|
|
|
18152
18202
|
/* @__PURE__ */ jsx120(NodeMousePlugin, {}),
|
|
18153
18203
|
/* @__PURE__ */ jsx120(TextToolbarPlugin, {}),
|
|
18154
18204
|
/* @__PURE__ */ jsx120(TextToolbarAgentPlugin, {}),
|
|
18155
|
-
/* @__PURE__ */ jsx120(
|
|
18205
|
+
/* @__PURE__ */ jsx120(TypeaheadVariableAgentPlugin, {}),
|
|
18156
18206
|
/* @__PURE__ */ jsx120(VariableComponentPlugin, {}),
|
|
18157
18207
|
/* @__PURE__ */ jsx120(MarkdownPlugin, {})
|
|
18158
18208
|
]
|
|
@@ -19221,7 +19271,7 @@ function Variables(props) {
|
|
|
19221
19271
|
});
|
|
19222
19272
|
}, [variablesSettings, setEditingModeDataCallback]);
|
|
19223
19273
|
return /* @__PURE__ */ jsxs49(VariablesProvider, { variablesSettings, children: [
|
|
19224
|
-
/* @__PURE__ */ jsx132(
|
|
19274
|
+
/* @__PURE__ */ jsx132(TypeaheadVariablePlugin, {}),
|
|
19225
19275
|
/* @__PURE__ */ jsx132(VariableSettingsPlugin, {}),
|
|
19226
19276
|
/* @__PURE__ */ jsx132(VariableToolbarPlugin, {}),
|
|
19227
19277
|
/* @__PURE__ */ jsx132(VariableToolbarAgentPlugin, {})
|