@pixerate/editor 0.19.0 → 0.20.0
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/README.md +91 -2
- package/dist/agent/index.cjs +625 -2
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +286 -2
- package/dist/agent/index.d.ts +286 -2
- package/dist/agent/index.js +624 -1
- package/dist/agent/index.js.map +1 -1
- package/dist/canvas/index.cjs +1240 -22
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +515 -3
- package/dist/canvas/index.d.ts +515 -3
- package/dist/canvas/index.js +1219 -1
- package/dist/canvas/index.js.map +1 -1
- package/dist/chunk-3TYMNULT.js +1367 -0
- package/dist/chunk-3TYMNULT.js.map +1 -0
- package/dist/chunk-4QPLEUL2.cjs +4480 -0
- package/dist/chunk-4QPLEUL2.cjs.map +1 -0
- package/dist/chunk-4SUNJZWB.cjs +553 -0
- package/dist/chunk-4SUNJZWB.cjs.map +1 -0
- package/dist/chunk-A7DKIA72.js +2657 -0
- package/dist/chunk-A7DKIA72.js.map +1 -0
- package/dist/chunk-AXV2ZW34.cjs +118 -0
- package/dist/chunk-AXV2ZW34.cjs.map +1 -0
- package/dist/chunk-B2ZRLN4S.js +118 -0
- package/dist/chunk-B2ZRLN4S.js.map +1 -0
- package/dist/chunk-CYFJCKC4.js +4480 -0
- package/dist/chunk-CYFJCKC4.js.map +1 -0
- package/dist/chunk-GVW4P7BG.js +2706 -0
- package/dist/chunk-GVW4P7BG.js.map +1 -0
- package/dist/chunk-JACER6TE.cjs +1 -0
- package/dist/chunk-JACER6TE.cjs.map +1 -0
- package/dist/chunk-JYRIOFEN.cjs +2657 -0
- package/dist/chunk-JYRIOFEN.cjs.map +1 -0
- package/dist/chunk-KYRZDWM4.js +299 -0
- package/dist/chunk-KYRZDWM4.js.map +1 -0
- package/dist/chunk-LA7PEGU3.cjs +299 -0
- package/dist/chunk-LA7PEGU3.cjs.map +1 -0
- package/dist/chunk-N7FG6CBO.js +1 -0
- package/dist/chunk-N7FG6CBO.js.map +1 -0
- package/dist/chunk-OYXSKQFR.js +553 -0
- package/dist/chunk-OYXSKQFR.js.map +1 -0
- package/dist/chunk-TVRC4KVT.cjs +1367 -0
- package/dist/chunk-TVRC4KVT.cjs.map +1 -0
- package/dist/chunk-U6NDQFOK.cjs +2706 -0
- package/dist/chunk-U6NDQFOK.cjs.map +1 -0
- package/dist/controller-OUdxPY-X.d.cts +754 -0
- package/dist/controller-OUdxPY-X.d.ts +754 -0
- package/dist/extensions/index.cjs +144 -3
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +9 -144
- package/dist/extensions/index.d.ts +9 -144
- package/dist/extensions/index.js +145 -4
- package/dist/grammar/index.cjs +31 -3
- package/dist/grammar/index.cjs.map +1 -1
- package/dist/grammar/index.d.cts +239 -19
- package/dist/grammar/index.d.ts +239 -19
- package/dist/grammar/index.js +31 -3
- package/dist/history/index.d.cts +2 -41
- package/dist/history/index.d.ts +2 -41
- package/dist/index-Ng1pG7JE.d.ts +899 -0
- package/dist/index-k3mFbPx_.d.cts +899 -0
- package/dist/index.cjs +457 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +99 -12
- package/dist/index.d.ts +99 -12
- package/dist/index.js +457 -20
- package/dist/index.js.map +1 -1
- package/dist/registry-iAHbqkYt.d.cts +128 -0
- package/dist/registry-iAHbqkYt.d.ts +128 -0
- package/dist/serializers/index.cjs +26 -3
- package/dist/serializers/index.cjs.map +1 -1
- package/dist/serializers/index.d.cts +119 -6
- package/dist/serializers/index.d.ts +119 -6
- package/dist/serializers/index.js +24 -1
- package/dist/spreadsheet/index.cjs +122 -2
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +371 -313
- package/dist/spreadsheet/index.d.ts +371 -313
- package/dist/spreadsheet/index.js +127 -7
- package/dist/tokens-CyLZmIei.d.cts +76 -0
- package/dist/tokens-CyLZmIei.d.ts +76 -0
- package/dist/track-changes-G8JcWB8b.d.cts +306 -0
- package/dist/track-changes-G8JcWB8b.d.ts +306 -0
- package/dist/types-BZgcDsC5.d.cts +42 -0
- package/dist/types-BZgcDsC5.d.ts +42 -0
- package/dist/{types-JV3S8VeR.d.cts → types-DMe0vFB1.d.cts} +1 -1
- package/dist/{types-JV3S8VeR.d.ts → types-DMe0vFB1.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-7FWEWE6T.js +0 -1888
- package/dist/chunk-7FWEWE6T.js.map +0 -1
- package/dist/chunk-AIZUKWTL.js +0 -1715
- package/dist/chunk-AIZUKWTL.js.map +0 -1
- package/dist/chunk-GLSIZKOX.js +0 -17
- package/dist/chunk-GLSIZKOX.js.map +0 -1
- package/dist/chunk-LDES3EOS.cjs +0 -1888
- package/dist/chunk-LDES3EOS.cjs.map +0 -1
- package/dist/chunk-LLUAKTLW.cjs +0 -532
- package/dist/chunk-LLUAKTLW.cjs.map +0 -1
- package/dist/chunk-MPPXH7U5.cjs +0 -336
- package/dist/chunk-MPPXH7U5.cjs.map +0 -1
- package/dist/chunk-O7LOPQMH.js +0 -336
- package/dist/chunk-O7LOPQMH.js.map +0 -1
- package/dist/chunk-QGVMBCT5.js +0 -532
- package/dist/chunk-QGVMBCT5.js.map +0 -1
- package/dist/chunk-SEDR75VH.cjs +0 -17
- package/dist/chunk-SEDR75VH.cjs.map +0 -1
- package/dist/chunk-YQCI4CCN.cjs +0 -1715
- package/dist/chunk-YQCI4CCN.cjs.map +0 -1
- package/dist/mention-Dcevh3ff.d.cts +0 -32
- package/dist/mention-Dcevh3ff.d.ts +0 -32
- package/dist/tokens-7kRTEtPb.d.cts +0 -39
- package/dist/tokens-7kRTEtPb.d.ts +0 -39
package/dist/index.js
CHANGED
|
@@ -1,86 +1,261 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TEMPLATE_DEPTH_ERROR,
|
|
3
3
|
TEMPLATE_LOOP_ERROR,
|
|
4
|
+
compactVariableValues,
|
|
5
|
+
evaluatePromptTokens,
|
|
4
6
|
extractInstructionNames,
|
|
5
7
|
extractTemplateNames,
|
|
6
8
|
extractVariableNames,
|
|
9
|
+
extractVariables,
|
|
7
10
|
getLatestVersion,
|
|
11
|
+
getPromptDiagnostics,
|
|
8
12
|
getTemplateBody,
|
|
13
|
+
getVariableFormFields,
|
|
9
14
|
mapRawOffsetToResolved,
|
|
10
15
|
mapResolvedOffsetToRaw,
|
|
16
|
+
resolvePrompt,
|
|
11
17
|
resolveTemplates,
|
|
12
18
|
resolveTemplatesWithMapping,
|
|
13
19
|
resolveVariables,
|
|
14
|
-
tokenizePrompt
|
|
15
|
-
|
|
20
|
+
tokenizePrompt,
|
|
21
|
+
tokenizePromptWithDiagnostics
|
|
22
|
+
} from "./chunk-OYXSKQFR.js";
|
|
16
23
|
import {
|
|
24
|
+
Autocorrect,
|
|
25
|
+
BUILT_IN_IMPORT_ADAPTERS,
|
|
26
|
+
Bookmark,
|
|
27
|
+
COMMENT_MARK_NAME,
|
|
17
28
|
ColorHighlighter,
|
|
29
|
+
Comments,
|
|
30
|
+
CrossReference,
|
|
31
|
+
DEFAULT_AUTOCORRECT_EXCEPTIONS,
|
|
32
|
+
FileImport,
|
|
18
33
|
FontSize,
|
|
34
|
+
Footnote,
|
|
35
|
+
FootnoteReference,
|
|
36
|
+
Footnotes,
|
|
19
37
|
GradientText,
|
|
20
38
|
Image,
|
|
39
|
+
ImportAdapterRegistry,
|
|
40
|
+
ImportError,
|
|
21
41
|
LoadingNode,
|
|
22
42
|
Markdown,
|
|
23
43
|
Mention,
|
|
44
|
+
Outline,
|
|
45
|
+
RichClipboard,
|
|
46
|
+
SMILIE_REPLACEMENTS,
|
|
24
47
|
SlashCommands,
|
|
25
48
|
SmilieReplacer,
|
|
49
|
+
TableOfContents,
|
|
26
50
|
TemplateSuggestions,
|
|
51
|
+
autocorrectPluginKey,
|
|
52
|
+
buildOutlineTree,
|
|
53
|
+
capitalizeSentenceRules,
|
|
54
|
+
commentsPluginKey,
|
|
55
|
+
computeOutline,
|
|
56
|
+
createImportAdapterRegistry,
|
|
57
|
+
createImportContext,
|
|
27
58
|
createMentionExtension,
|
|
59
|
+
createOutlineStore,
|
|
28
60
|
createRichTextPreset,
|
|
61
|
+
crossReferencePluginKey,
|
|
62
|
+
defaultAutocorrectRules,
|
|
63
|
+
defaultImportRegistry,
|
|
64
|
+
documentStructureCommandItems,
|
|
65
|
+
fileImportPluginKey,
|
|
66
|
+
findAutocorrection,
|
|
67
|
+
findCommentRanges,
|
|
29
68
|
findHexColors,
|
|
69
|
+
findImportAdapter,
|
|
70
|
+
footnotesMarkdownIt,
|
|
71
|
+
footnotesPluginKey,
|
|
72
|
+
fractionRules,
|
|
73
|
+
getActiveHeading,
|
|
74
|
+
getBookmarks,
|
|
75
|
+
getCommentAnchors,
|
|
76
|
+
getCommentAuthor,
|
|
77
|
+
getCommentIdsAt,
|
|
78
|
+
getCommentStore,
|
|
79
|
+
getCrossReferenceTargets,
|
|
80
|
+
getDocumentStructureCommandItems,
|
|
81
|
+
getFootnotes,
|
|
82
|
+
getImportAccept,
|
|
83
|
+
getOutline,
|
|
84
|
+
getTableOfContentsEntries,
|
|
30
85
|
handleImageInsertion,
|
|
86
|
+
htmlImportAdapter,
|
|
87
|
+
htmlToSlice,
|
|
31
88
|
imagePastePluginKey,
|
|
89
|
+
importFile,
|
|
90
|
+
importFilesIntoEditor,
|
|
32
91
|
insertImageNode,
|
|
92
|
+
insertImportedDocument,
|
|
93
|
+
isInsidePromptToken,
|
|
94
|
+
markdownImportAdapter,
|
|
95
|
+
navigateToHeading,
|
|
96
|
+
outlinePluginKey,
|
|
97
|
+
plainTextImportAdapter,
|
|
98
|
+
registerImportAdapter,
|
|
33
99
|
removeImageNode,
|
|
34
|
-
|
|
35
|
-
|
|
100
|
+
richClipboardPluginKey,
|
|
101
|
+
rtfImportAdapter,
|
|
102
|
+
smartQuoteRules,
|
|
103
|
+
smilieAutocorrectRules,
|
|
104
|
+
symbolRules,
|
|
105
|
+
syncFootnotes,
|
|
106
|
+
tableOfContentsMarkdownIt,
|
|
107
|
+
tableOfContentsPluginKey,
|
|
108
|
+
twoInitialCapitalsRules,
|
|
109
|
+
unregisterImportAdapter,
|
|
110
|
+
updateImageSrc,
|
|
111
|
+
writeRichClipboard
|
|
112
|
+
} from "./chunk-CYFJCKC4.js";
|
|
36
113
|
import {
|
|
37
114
|
INSTRUCTION_REGEX,
|
|
38
115
|
TEMPLATE_REGEX,
|
|
39
116
|
VARIABLE_REGEX,
|
|
117
|
+
escapeVariableText,
|
|
118
|
+
evaluateCondition,
|
|
119
|
+
getSuppliedValue,
|
|
40
120
|
instructionRegex,
|
|
121
|
+
isPromptValueSet,
|
|
122
|
+
matchConditionalTags,
|
|
123
|
+
parseVariableBody,
|
|
41
124
|
templateRegex,
|
|
125
|
+
unescapeVariableText,
|
|
42
126
|
variableRegex
|
|
43
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-B2ZRLN4S.js";
|
|
128
|
+
import "./chunk-N7FG6CBO.js";
|
|
129
|
+
import {
|
|
130
|
+
PIXERATE_DOCUMENT_MIME,
|
|
131
|
+
getClipboardData,
|
|
132
|
+
getSchemaSignature,
|
|
133
|
+
parseRichClipboardPayload,
|
|
134
|
+
plainTextToParagraphHtml,
|
|
135
|
+
readRichClipboard,
|
|
136
|
+
rtfToPlainText,
|
|
137
|
+
sanitizeImportedHtml,
|
|
138
|
+
serializeRichClipboardPayload
|
|
139
|
+
} from "./chunk-KYRZDWM4.js";
|
|
140
|
+
import {
|
|
141
|
+
DEFAULT_COLUMN_WIDTH,
|
|
142
|
+
DEFAULT_ROW_HEIGHT,
|
|
143
|
+
DataSourceBinder,
|
|
144
|
+
DependencyGraph,
|
|
145
|
+
SPREADSHEET_CLIPBOARD_MIME,
|
|
146
|
+
SPREADSHEET_IMPORT_ADAPTERS,
|
|
147
|
+
SPREADSHEET_TABLE_ACTIONS,
|
|
148
|
+
SpreadsheetController,
|
|
149
|
+
aggregateValues,
|
|
150
|
+
applyFormulaSuggestion,
|
|
151
|
+
bindSpreadsheetTableActions,
|
|
152
|
+
buildSpreadsheetView,
|
|
153
|
+
columnDependencyKey,
|
|
154
|
+
compareCellValues,
|
|
155
|
+
computeFillTarget,
|
|
156
|
+
computeRowGroups,
|
|
157
|
+
createSpreadsheetClipboardData,
|
|
158
|
+
csvImportAdapter,
|
|
159
|
+
escapeCsvField,
|
|
160
|
+
extractCellDependencies,
|
|
161
|
+
fillSeries,
|
|
162
|
+
getFillDirection,
|
|
163
|
+
getFormulaCaretContext,
|
|
164
|
+
getFormulaHints,
|
|
165
|
+
getRowSection,
|
|
166
|
+
getSpreadsheetMenuItems,
|
|
167
|
+
getTableSections,
|
|
168
|
+
importFileIntoSpreadsheet,
|
|
169
|
+
isBlankValue,
|
|
170
|
+
isSingleCellRange,
|
|
171
|
+
mapFormulaReferences,
|
|
172
|
+
matchesFilterRule,
|
|
173
|
+
normalizeRange,
|
|
174
|
+
offsetFormulaReferences,
|
|
175
|
+
parseCsv,
|
|
176
|
+
parseHtmlTable,
|
|
177
|
+
parseTsv,
|
|
178
|
+
rangeContains,
|
|
179
|
+
rangeContainsRange,
|
|
180
|
+
rangesIntersect,
|
|
181
|
+
readSpreadsheetClipboard,
|
|
182
|
+
rebaseClipboardRows,
|
|
183
|
+
registerSpreadsheetImportAdapters,
|
|
184
|
+
remapFormulaReferences,
|
|
185
|
+
roundFloat,
|
|
186
|
+
rowPassesFilters,
|
|
187
|
+
serializeCsv,
|
|
188
|
+
serializeHtmlTable,
|
|
189
|
+
serializeTsv,
|
|
190
|
+
shiftFormulaReferences,
|
|
191
|
+
toNumber,
|
|
192
|
+
tsvImportAdapter
|
|
193
|
+
} from "./chunk-GVW4P7BG.js";
|
|
44
194
|
import {
|
|
195
|
+
HistoryManager,
|
|
196
|
+
createHistoryManager
|
|
197
|
+
} from "./chunk-KAADNAPF.js";
|
|
198
|
+
import {
|
|
199
|
+
CommentStore,
|
|
200
|
+
DELETION_MARK_NAME,
|
|
201
|
+
INSERTION_MARK_NAME,
|
|
45
202
|
MARKDOWN_MENTION_SPLIT_REGEX,
|
|
46
203
|
MENTION_REGEX,
|
|
204
|
+
TRACK_CHANGES_SKIP_META,
|
|
205
|
+
TrackChanges,
|
|
206
|
+
TrackChangesStore,
|
|
207
|
+
TrackedDeletion,
|
|
208
|
+
TrackedInsertion,
|
|
209
|
+
createCommentStore,
|
|
210
|
+
createReviewId,
|
|
47
211
|
escapeHtml,
|
|
48
212
|
extractMentions,
|
|
49
213
|
extractMentionsFromDoc,
|
|
214
|
+
formatReviewTime,
|
|
50
215
|
getEditorMarkdown,
|
|
51
216
|
getEditorText,
|
|
217
|
+
getTrackChangesStore,
|
|
218
|
+
getTrackedChangeAt,
|
|
219
|
+
getTrackedChanges,
|
|
52
220
|
htmlToPlainText,
|
|
221
|
+
isTrackChangesEnabled,
|
|
53
222
|
markdownToTipTapHtml,
|
|
54
223
|
parseMentionSegments,
|
|
55
224
|
plainTextToSlice,
|
|
56
225
|
plainTextToTipTapHtml,
|
|
57
226
|
preprocessMarkdownFileLinks,
|
|
58
227
|
preprocessMarkdownMentions,
|
|
59
|
-
|
|
60
|
-
|
|
228
|
+
resolveTrackedChanges,
|
|
229
|
+
sanitizeHtml,
|
|
230
|
+
stripMarkdownCode,
|
|
231
|
+
trackChangesPluginKey
|
|
232
|
+
} from "./chunk-3TYMNULT.js";
|
|
61
233
|
import {
|
|
62
|
-
DataSourceBinder,
|
|
63
|
-
DependencyGraph,
|
|
64
234
|
FORMULA_ERRORS,
|
|
65
235
|
FormulaEvaluator,
|
|
66
236
|
FormulaParser,
|
|
67
|
-
SpreadsheetController,
|
|
68
237
|
WHOLE_COLUMN_END_ROW,
|
|
238
|
+
checkFormulaArgumentCount,
|
|
69
239
|
colNameToIndex,
|
|
70
|
-
|
|
71
|
-
|
|
240
|
+
describeFormulaError,
|
|
241
|
+
formatValueWithCode,
|
|
242
|
+
getFormulaArgumentSpecIndex,
|
|
243
|
+
getFormulaFunction,
|
|
244
|
+
getFormulaSignature,
|
|
245
|
+
getFormulaSignatureParts,
|
|
72
246
|
indexToColName,
|
|
73
247
|
isFormulaError,
|
|
248
|
+
listFormulaFunctions,
|
|
74
249
|
parseCellReference,
|
|
250
|
+
parseCriteria,
|
|
75
251
|
parseFormula,
|
|
76
252
|
parseRange,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
} from "./chunk-KAADNAPF.js";
|
|
253
|
+
registerFormulaFunction,
|
|
254
|
+
searchFormulaFunctions,
|
|
255
|
+
tokenizeFormula,
|
|
256
|
+
unregisterFormulaFunction,
|
|
257
|
+
wildcardToRegExp
|
|
258
|
+
} from "./chunk-A7DKIA72.js";
|
|
84
259
|
|
|
85
260
|
// src/controller.ts
|
|
86
261
|
import { Editor } from "@tiptap/core";
|
|
@@ -134,6 +309,12 @@ var EditorController = class {
|
|
|
134
309
|
this.baselineContent = this.getCurrentContentString();
|
|
135
310
|
}
|
|
136
311
|
enforcePlainTextClipboard() {
|
|
312
|
+
const richClipboard = this.editor.storage?.richClipboard;
|
|
313
|
+
if (richClipboard) richClipboard.plainTextMode = true;
|
|
314
|
+
const fileImport = this.editor.extensionManager?.extensions.find(
|
|
315
|
+
(ext) => ext.name === "fileImport"
|
|
316
|
+
);
|
|
317
|
+
if (fileImport) fileImport.options.asPlainText = true;
|
|
137
318
|
this.editor.setOptions({
|
|
138
319
|
editorProps: {
|
|
139
320
|
...this.editor.options.editorProps,
|
|
@@ -296,82 +477,338 @@ var DirtyTracker = class {
|
|
|
296
477
|
function createDirtyTracker(initialBaseline, options) {
|
|
297
478
|
return new DirtyTracker(initialBaseline, options);
|
|
298
479
|
}
|
|
480
|
+
|
|
481
|
+
// src/import/controller.ts
|
|
482
|
+
function pickImportFiles(options = {}) {
|
|
483
|
+
if (typeof document === "undefined") return Promise.resolve([]);
|
|
484
|
+
return new Promise((resolve) => {
|
|
485
|
+
const input = document.createElement("input");
|
|
486
|
+
input.type = "file";
|
|
487
|
+
input.accept = options.accept ?? defaultImportRegistry.accept("document");
|
|
488
|
+
input.multiple = options.multiple ?? true;
|
|
489
|
+
input.style.display = "none";
|
|
490
|
+
const finish = (files) => {
|
|
491
|
+
input.remove();
|
|
492
|
+
resolve(files);
|
|
493
|
+
};
|
|
494
|
+
input.addEventListener("change", () => finish(Array.from(input.files ?? [])), { once: true });
|
|
495
|
+
input.addEventListener("cancel", () => finish([]), { once: true });
|
|
496
|
+
document.body.appendChild(input);
|
|
497
|
+
input.click();
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
var FileImportController = class {
|
|
501
|
+
constructor(getTarget, options = {}) {
|
|
502
|
+
this.getTarget = getTarget;
|
|
503
|
+
this.options = options;
|
|
504
|
+
}
|
|
505
|
+
getTarget;
|
|
506
|
+
options;
|
|
507
|
+
state = { isImporting: false, error: null, lastOutcomes: [] };
|
|
508
|
+
listeners = /* @__PURE__ */ new Set();
|
|
509
|
+
pending = 0;
|
|
510
|
+
setOptions(options) {
|
|
511
|
+
this.options = options;
|
|
512
|
+
}
|
|
513
|
+
/** `accept` attribute value for document imports. */
|
|
514
|
+
get accept() {
|
|
515
|
+
return (this.options.registry ?? defaultImportRegistry).accept("document");
|
|
516
|
+
}
|
|
517
|
+
getState = () => this.state;
|
|
518
|
+
subscribe = (listener) => {
|
|
519
|
+
this.listeners.add(listener);
|
|
520
|
+
return () => {
|
|
521
|
+
this.listeners.delete(listener);
|
|
522
|
+
};
|
|
523
|
+
};
|
|
524
|
+
setState(patch) {
|
|
525
|
+
this.state = { ...this.state, ...patch };
|
|
526
|
+
this.listeners.forEach((listener) => listener(this.state));
|
|
527
|
+
}
|
|
528
|
+
/** Imports files into the editor at `at` (default: the selection). */
|
|
529
|
+
importFiles = async (files, at) => {
|
|
530
|
+
const target = this.getTarget();
|
|
531
|
+
const list = Array.from(files);
|
|
532
|
+
if (!target || list.length === 0) return [];
|
|
533
|
+
this.pending++;
|
|
534
|
+
this.setState({ isImporting: true, error: null });
|
|
535
|
+
let error = null;
|
|
536
|
+
try {
|
|
537
|
+
const outcomes = await importFilesIntoEditor(target, list, {
|
|
538
|
+
...this.options,
|
|
539
|
+
at,
|
|
540
|
+
onError: (err, file) => {
|
|
541
|
+
error = err;
|
|
542
|
+
this.options.onError?.(err, file);
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
this.pending--;
|
|
546
|
+
this.setState({ isImporting: this.pending > 0, error, lastOutcomes: outcomes });
|
|
547
|
+
return outcomes;
|
|
548
|
+
} catch (err) {
|
|
549
|
+
this.pending--;
|
|
550
|
+
this.setState({ isImporting: this.pending > 0, error: err instanceof Error ? err : new Error(String(err)) });
|
|
551
|
+
return [];
|
|
552
|
+
}
|
|
553
|
+
};
|
|
554
|
+
/** Opens the file picker and imports the chosen files at the selection. */
|
|
555
|
+
openFilePicker = async () => {
|
|
556
|
+
const files = await pickImportFiles({ accept: this.accept, multiple: this.options.multiple });
|
|
557
|
+
return this.importFiles(files);
|
|
558
|
+
};
|
|
559
|
+
};
|
|
560
|
+
function createFileImportController(getTarget, options) {
|
|
561
|
+
return new FileImportController(getTarget, options);
|
|
562
|
+
}
|
|
299
563
|
export {
|
|
564
|
+
Autocorrect,
|
|
565
|
+
BUILT_IN_IMPORT_ADAPTERS,
|
|
566
|
+
Bookmark,
|
|
567
|
+
COMMENT_MARK_NAME,
|
|
300
568
|
ColorHighlighter,
|
|
569
|
+
CommentStore,
|
|
570
|
+
Comments,
|
|
571
|
+
CrossReference,
|
|
572
|
+
DEFAULT_AUTOCORRECT_EXCEPTIONS,
|
|
573
|
+
DEFAULT_COLUMN_WIDTH,
|
|
574
|
+
DEFAULT_ROW_HEIGHT,
|
|
575
|
+
DELETION_MARK_NAME,
|
|
301
576
|
DataSourceBinder,
|
|
302
577
|
DependencyGraph,
|
|
303
578
|
DirtyTracker,
|
|
304
579
|
EditorController,
|
|
305
580
|
FORMULA_ERRORS,
|
|
581
|
+
FileImport,
|
|
582
|
+
FileImportController,
|
|
306
583
|
FontSize,
|
|
584
|
+
Footnote,
|
|
585
|
+
FootnoteReference,
|
|
586
|
+
Footnotes,
|
|
307
587
|
FormulaEvaluator,
|
|
308
588
|
FormulaParser,
|
|
309
589
|
GradientText,
|
|
310
590
|
HistoryManager,
|
|
591
|
+
INSERTION_MARK_NAME,
|
|
311
592
|
INSTRUCTION_REGEX,
|
|
312
593
|
Image,
|
|
594
|
+
ImportAdapterRegistry,
|
|
595
|
+
ImportError,
|
|
313
596
|
LoadingNode,
|
|
314
597
|
MARKDOWN_MENTION_SPLIT_REGEX,
|
|
315
598
|
MENTION_REGEX,
|
|
316
599
|
Markdown,
|
|
317
600
|
Mention,
|
|
601
|
+
Outline,
|
|
602
|
+
PIXERATE_DOCUMENT_MIME,
|
|
603
|
+
RichClipboard,
|
|
604
|
+
SMILIE_REPLACEMENTS,
|
|
605
|
+
SPREADSHEET_CLIPBOARD_MIME,
|
|
606
|
+
SPREADSHEET_IMPORT_ADAPTERS,
|
|
607
|
+
SPREADSHEET_TABLE_ACTIONS,
|
|
318
608
|
SlashCommands,
|
|
319
609
|
SmilieReplacer,
|
|
320
610
|
SpreadsheetController,
|
|
321
611
|
TEMPLATE_DEPTH_ERROR,
|
|
322
612
|
TEMPLATE_LOOP_ERROR,
|
|
323
613
|
TEMPLATE_REGEX,
|
|
614
|
+
TRACK_CHANGES_SKIP_META,
|
|
615
|
+
TableOfContents,
|
|
324
616
|
TemplateSuggestions,
|
|
617
|
+
TrackChanges,
|
|
618
|
+
TrackChangesStore,
|
|
619
|
+
TrackedDeletion,
|
|
620
|
+
TrackedInsertion,
|
|
325
621
|
VARIABLE_REGEX,
|
|
326
622
|
WHOLE_COLUMN_END_ROW,
|
|
623
|
+
aggregateValues,
|
|
624
|
+
applyFormulaSuggestion,
|
|
625
|
+
autocorrectPluginKey,
|
|
626
|
+
bindSpreadsheetTableActions,
|
|
627
|
+
buildOutlineTree,
|
|
628
|
+
buildSpreadsheetView,
|
|
629
|
+
capitalizeSentenceRules,
|
|
630
|
+
checkFormulaArgumentCount,
|
|
327
631
|
colNameToIndex,
|
|
328
632
|
columnDependencyKey,
|
|
633
|
+
commentsPluginKey,
|
|
634
|
+
compactVariableValues,
|
|
635
|
+
compareCellValues,
|
|
636
|
+
computeFillTarget,
|
|
637
|
+
computeOutline,
|
|
638
|
+
computeRowGroups,
|
|
639
|
+
createCommentStore,
|
|
329
640
|
createDirtyTracker,
|
|
330
641
|
createEditor,
|
|
642
|
+
createFileImportController,
|
|
331
643
|
createHistoryManager,
|
|
644
|
+
createImportAdapterRegistry,
|
|
645
|
+
createImportContext,
|
|
332
646
|
createMentionExtension,
|
|
647
|
+
createOutlineStore,
|
|
648
|
+
createReviewId,
|
|
333
649
|
createRichTextPreset,
|
|
650
|
+
createSpreadsheetClipboardData,
|
|
651
|
+
crossReferencePluginKey,
|
|
652
|
+
csvImportAdapter,
|
|
653
|
+
defaultAutocorrectRules,
|
|
654
|
+
defaultImportRegistry,
|
|
334
655
|
defaultIsEqual,
|
|
656
|
+
describeFormulaError,
|
|
657
|
+
documentStructureCommandItems,
|
|
658
|
+
escapeCsvField,
|
|
335
659
|
escapeHtml,
|
|
660
|
+
escapeVariableText,
|
|
661
|
+
evaluateCondition,
|
|
662
|
+
evaluatePromptTokens,
|
|
336
663
|
extractCellDependencies,
|
|
337
664
|
extractInstructionNames,
|
|
338
665
|
extractMentions,
|
|
339
666
|
extractMentionsFromDoc,
|
|
340
667
|
extractTemplateNames,
|
|
341
668
|
extractVariableNames,
|
|
669
|
+
extractVariables,
|
|
670
|
+
fileImportPluginKey,
|
|
671
|
+
fillSeries,
|
|
672
|
+
findAutocorrection,
|
|
673
|
+
findCommentRanges,
|
|
342
674
|
findHexColors,
|
|
675
|
+
findImportAdapter,
|
|
676
|
+
footnotesMarkdownIt,
|
|
677
|
+
footnotesPluginKey,
|
|
678
|
+
formatReviewTime,
|
|
679
|
+
formatValueWithCode,
|
|
680
|
+
fractionRules,
|
|
681
|
+
getActiveHeading,
|
|
682
|
+
getBookmarks,
|
|
683
|
+
getClipboardData,
|
|
684
|
+
getCommentAnchors,
|
|
685
|
+
getCommentAuthor,
|
|
686
|
+
getCommentIdsAt,
|
|
687
|
+
getCommentStore,
|
|
688
|
+
getCrossReferenceTargets,
|
|
689
|
+
getDocumentStructureCommandItems,
|
|
343
690
|
getEditorMarkdown,
|
|
344
691
|
getEditorText,
|
|
692
|
+
getFillDirection,
|
|
693
|
+
getFootnotes,
|
|
694
|
+
getFormulaArgumentSpecIndex,
|
|
695
|
+
getFormulaCaretContext,
|
|
696
|
+
getFormulaFunction,
|
|
697
|
+
getFormulaHints,
|
|
698
|
+
getFormulaSignature,
|
|
699
|
+
getFormulaSignatureParts,
|
|
700
|
+
getImportAccept,
|
|
345
701
|
getLatestVersion,
|
|
702
|
+
getOutline,
|
|
703
|
+
getPromptDiagnostics,
|
|
704
|
+
getRowSection,
|
|
705
|
+
getSchemaSignature,
|
|
706
|
+
getSpreadsheetMenuItems,
|
|
707
|
+
getSuppliedValue,
|
|
708
|
+
getTableOfContentsEntries,
|
|
709
|
+
getTableSections,
|
|
346
710
|
getTemplateBody,
|
|
711
|
+
getTrackChangesStore,
|
|
712
|
+
getTrackedChangeAt,
|
|
713
|
+
getTrackedChanges,
|
|
714
|
+
getVariableFormFields,
|
|
347
715
|
handleImageInsertion,
|
|
716
|
+
htmlImportAdapter,
|
|
348
717
|
htmlToPlainText,
|
|
718
|
+
htmlToSlice,
|
|
349
719
|
imagePastePluginKey,
|
|
720
|
+
importFile,
|
|
721
|
+
importFileIntoSpreadsheet,
|
|
722
|
+
importFilesIntoEditor,
|
|
350
723
|
indexToColName,
|
|
351
724
|
insertImageNode,
|
|
725
|
+
insertImportedDocument,
|
|
352
726
|
instructionRegex,
|
|
727
|
+
isBlankValue,
|
|
353
728
|
isFormulaError,
|
|
729
|
+
isInsidePromptToken,
|
|
730
|
+
isPromptValueSet,
|
|
731
|
+
isSingleCellRange,
|
|
732
|
+
isTrackChangesEnabled,
|
|
733
|
+
listFormulaFunctions,
|
|
734
|
+
mapFormulaReferences,
|
|
354
735
|
mapRawOffsetToResolved,
|
|
355
736
|
mapResolvedOffsetToRaw,
|
|
737
|
+
markdownImportAdapter,
|
|
356
738
|
markdownToTipTapHtml,
|
|
739
|
+
matchConditionalTags,
|
|
740
|
+
matchesFilterRule,
|
|
741
|
+
navigateToHeading,
|
|
742
|
+
normalizeRange,
|
|
743
|
+
offsetFormulaReferences,
|
|
744
|
+
outlinePluginKey,
|
|
357
745
|
parseCellReference,
|
|
746
|
+
parseCriteria,
|
|
747
|
+
parseCsv,
|
|
358
748
|
parseFormula,
|
|
749
|
+
parseHtmlTable,
|
|
359
750
|
parseMentionSegments,
|
|
360
751
|
parseRange,
|
|
752
|
+
parseRichClipboardPayload,
|
|
753
|
+
parseTsv,
|
|
754
|
+
parseVariableBody,
|
|
755
|
+
pickImportFiles,
|
|
756
|
+
plainTextImportAdapter,
|
|
757
|
+
plainTextToParagraphHtml,
|
|
361
758
|
plainTextToSlice,
|
|
362
759
|
plainTextToTipTapHtml,
|
|
363
760
|
preprocessMarkdownFileLinks,
|
|
364
761
|
preprocessMarkdownMentions,
|
|
762
|
+
rangeContains,
|
|
763
|
+
rangeContainsRange,
|
|
764
|
+
rangesIntersect,
|
|
765
|
+
readRichClipboard,
|
|
766
|
+
readSpreadsheetClipboard,
|
|
767
|
+
rebaseClipboardRows,
|
|
768
|
+
registerFormulaFunction,
|
|
769
|
+
registerImportAdapter,
|
|
770
|
+
registerSpreadsheetImportAdapters,
|
|
771
|
+
remapFormulaReferences,
|
|
365
772
|
removeImageNode,
|
|
773
|
+
resolvePrompt,
|
|
366
774
|
resolveTemplates,
|
|
367
775
|
resolveTemplatesWithMapping,
|
|
776
|
+
resolveTrackedChanges,
|
|
368
777
|
resolveVariables,
|
|
778
|
+
richClipboardPluginKey,
|
|
779
|
+
roundFloat,
|
|
780
|
+
rowPassesFilters,
|
|
781
|
+
rtfImportAdapter,
|
|
782
|
+
rtfToPlainText,
|
|
783
|
+
sanitizeHtml,
|
|
784
|
+
sanitizeImportedHtml,
|
|
785
|
+
searchFormulaFunctions,
|
|
786
|
+
serializeCsv,
|
|
787
|
+
serializeHtmlTable,
|
|
788
|
+
serializeRichClipboardPayload,
|
|
789
|
+
serializeTsv,
|
|
369
790
|
shiftFormulaReferences,
|
|
791
|
+
smartQuoteRules,
|
|
792
|
+
smilieAutocorrectRules,
|
|
370
793
|
stripMarkdownCode,
|
|
794
|
+
symbolRules,
|
|
795
|
+
syncFootnotes,
|
|
796
|
+
tableOfContentsMarkdownIt,
|
|
797
|
+
tableOfContentsPluginKey,
|
|
371
798
|
templateRegex,
|
|
799
|
+
toNumber,
|
|
372
800
|
tokenizeFormula,
|
|
373
801
|
tokenizePrompt,
|
|
802
|
+
tokenizePromptWithDiagnostics,
|
|
803
|
+
trackChangesPluginKey,
|
|
804
|
+
tsvImportAdapter,
|
|
805
|
+
twoInitialCapitalsRules,
|
|
806
|
+
unescapeVariableText,
|
|
807
|
+
unregisterFormulaFunction,
|
|
808
|
+
unregisterImportAdapter,
|
|
374
809
|
updateImageSrc,
|
|
375
|
-
variableRegex
|
|
810
|
+
variableRegex,
|
|
811
|
+
wildcardToRegExp,
|
|
812
|
+
writeRichClipboard
|
|
376
813
|
};
|
|
377
814
|
//# sourceMappingURL=index.js.map
|