@a3s-lab/office 0.30.0 → 0.32.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 +25 -5
- package/dist/{0~7231.js → 0~4808.js} +190 -3
- package/dist/0~4980.js +1 -1
- package/dist/0~5050.js +10 -1
- package/dist/{0~7360.js → 0~7240.js} +245 -16
- package/dist/0~7614.js +1 -1
- package/dist/0~document-editor.js +1756 -178
- package/dist/0~spreadsheet-editor.js +2 -1
- package/dist/0~work-docx-export.js +215 -27
- package/dist/0~work-docx-import.js +27 -33
- package/dist/0~work-docx-large-document-import.js +1 -1
- package/dist/0~work-office-diagnostics.js +28 -7
- package/dist/0~work-pptx-import.js +1 -1
- package/dist/{1544.js → 3266.js} +17 -1862
- package/dist/4121.js +425 -11
- package/dist/4166.js +3848 -0
- package/dist/{6282.js → 4174.js} +812 -10
- package/dist/9333.js +1849 -0
- package/dist/core.js +5259 -4
- package/dist/index.js +3 -3
- package/dist/internal/features/work/editors/document-command-catalog.d.ts +27 -0
- package/dist/internal/features/work/editors/document-compare-dialog.d.ts +14 -0
- package/dist/internal/features/work/editors/document-dom-selection.d.ts +7 -0
- package/dist/internal/features/work/editors/document-editor-support.d.ts +1 -0
- package/dist/internal/features/work/editors/document-index-dialog.d.ts +10 -0
- package/dist/internal/features/work/editors/document-index-entry-dialog.d.ts +10 -0
- package/dist/internal/features/work/editors/document-references-ribbon.d.ts +19 -0
- package/dist/internal/features/work/editors/document-toolbar.d.ts +6 -1
- package/dist/internal/features/work/editors/use-document-comparison.d.ts +9 -0
- package/dist/internal/features/work/editors/use-document-insert-commands.d.ts +3 -0
- package/dist/internal/features/work/work-document-changes.d.ts +5 -0
- package/dist/internal/features/work/work-document-compare-diff.d.ts +38 -0
- package/dist/internal/features/work/work-document-compare-stability.d.ts +5 -0
- package/dist/internal/features/work/work-document-compare.d.ts +27 -0
- package/dist/internal/features/work/work-document-index-fields.d.ts +19 -0
- package/dist/internal/features/work/work-document-index-nodes.d.ts +32 -0
- package/dist/internal/features/work/work-document-index.d.ts +63 -0
- package/dist/internal/features/work/work-docx-import.d.ts +3 -1
- package/dist/internal/features/work/work-docx-index-export.d.ts +14 -0
- package/dist/internal/features/work/work-docx-index-import.d.ts +23 -0
- package/dist/office-kernel.wasm +0 -0
- package/dist/styles.css +490 -0
- package/docs/latest/en/browser-editor-architecture.md +37 -0
- package/package.json +9 -3
- package/dist/4104.js +0 -9336
package/dist/{6282.js → 4174.js}
RENAMED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { __webpack_require__ } from "./0~rslib-runtime.js";
|
|
1
2
|
import { Extension, Mark, Node as core_Node, ResizableNodeView, generateHTML, getSchema, mergeAttributes } from "@tiptap/core";
|
|
2
3
|
import { Collaboration, isChangeOrigin } from "@tiptap/extension-collaboration";
|
|
3
|
-
import { NodeSelection, Plugin, PluginKey, Selection, TextSelection } from "@tiptap/pm/state";
|
|
4
|
+
import { EditorState, NodeSelection, Plugin, PluginKey, Selection, TextSelection } from "@tiptap/pm/state";
|
|
4
5
|
import { AddMarkStep, Mapping, RemoveMarkStep, ReplaceAroundStep, ReplaceStep } from "@tiptap/pm/transform";
|
|
5
6
|
import { defaultDeleteFilter, defaultProtectedNodes, prosemirrorJSONToYXmlFragment, ySyncPluginKey, yXmlFragmentToProsemirrorJSON } from "@tiptap/y-tiptap";
|
|
6
7
|
import extension_color from "@tiptap/extension-color";
|
|
@@ -21,10 +22,29 @@ import { CellSelection, TableMap, isInTable, selectedRect } from "@tiptap/pm/tab
|
|
|
21
22
|
import font_family from "@tiptap/extension-text-style/font-family";
|
|
22
23
|
import { TextStyle } from "@tiptap/extension-text-style";
|
|
23
24
|
import extension_highlight from "@tiptap/extension-highlight";
|
|
24
|
-
import { documentRunBorderDomAttributes, DOCUMENT_SCRIPT_FONT_SLOT_ATTRIBUTE, DOCUMENT_RUN_SHADING_ATTRIBUTE, serializeDocumentRunBorder, documentScriptFontSlotFromElement, documentScriptFontsForAllText, serializeDocumentScriptFonts, primeDocumentIntegrityFeatures, uniqueDocumentParagraphIdentity, documentScriptFontsDomAttributes, documentHighlightForCssColor, documentTableOfContentsValueFromElement, normalizeDocumentScriptFonts, buildDocumentTableOfContentsEntries, serializeDocumentParagraphShading, documentHasIntegrityFeature, parseDocumentRunBorder, normalizeDocumentParagraphId, DOCUMENT_PARAGRAPH_TEXT_ID_ATTRIBUTE, documentProofingLanguagesFromElement, normalizeDocumentProofingLanguages, parseDocumentParagraphBordersElement, parseDocumentParagraphBorders, documentScriptFontsFromElement, DOCUMENT_RUN_BORDER_ATTRIBUTE, normalizeDocumentTableOfContentsValue, DOCUMENT_PARAGRAPH_ID_ATTRIBUTE, documentNoProofFromElement, normalizeDocumentRunShading, documentScriptFontSegments, documentFontNameFromCssFamily, documentRunShadingDomAttributes, parseDocumentScriptFonts, normalizeDocumentRunBorder, normalizeDocumentParagraphBorder, serializeDocumentParagraphBorders, parseDocxThemeReference, parseDocumentRunShading, DOCUMENT_HIGHLIGHT_ATTRIBUTE, serializeDocumentRunShading, workDocumentOutlineLevel, DOCUMENT_PARAGRAPH_BORDERS_ATTRIBUTE, createDocumentParagraphIdentityRegistry, DOCUMENT_NO_PROOF_ATTRIBUTE, serializeDocxThemeReference, documentRunBorderIsVisible, normalizeDocumentTableOfContentsHtml, cssDocumentFontFamily, documentParagraphShadingDomAttributes, DOCUMENT_PROOFING_LANGUAGES_ATTRIBUTE, documentParagraphBordersDomAttributes, DOCUMENT_SCRIPT_FONTS_ATTRIBUTE, normalizeDocumentHighlight, normalizeDocumentParagraphIdentity, createOfficeId as createWorkId, DEFAULT_DOCUMENT_TABLE_OF_CONTENTS_OPTIONS, documentHighlightFromElement, normalizeDocumentLanguageTag, parseDocumentParagraphShading, normalizeDocumentNoProof, parseDocumentParagraphShadingElement, createDocumentParagraphIdentity, documentHighlightDomAttributes, DocumentParagraphIdentity, parseDocumentRunShadingElement, parseDocumentProofingLanguages, collectWorkDocumentOutline, documentScriptFontSlotFromHint, normalizeDocumentTableOfContentsOptions, documentBorderPresentation, documentScriptFontFamilyForRendering, parseDocumentRunBorderElement, documentProofingDomAttributes, normalizeDocumentScriptFontSlot, serializeDocumentProofingLanguages } from "./4121.js";
|
|
25
|
+
import { documentRunBorderDomAttributes, DOCUMENT_SCRIPT_FONT_SLOT_ATTRIBUTE, DOCUMENT_RUN_SHADING_ATTRIBUTE, serializeDocumentRunBorder, documentScriptFontSlotFromElement, documentScriptFontsForAllText, createArtifact as createWorkArtifact, serializeDocumentScriptFonts, primeDocumentIntegrityFeatures, uniqueDocumentParagraphIdentity, documentScriptFontsDomAttributes, documentHighlightForCssColor, documentTableOfContentsValueFromElement, buildDocumentIndexEntries, normalizeDocumentScriptFonts, buildDocumentTableOfContentsEntries, serializeDocumentParagraphShading, documentHasIntegrityFeature, parseDocumentRunBorder, documentIndexValueFromElement, normalizeDocumentParagraphId, DOCUMENT_PARAGRAPH_TEXT_ID_ATTRIBUTE, documentProofingLanguagesFromElement, normalizeDocumentProofingLanguages, normalizeDocumentIndexOptions, parseDocumentParagraphBordersElement, parseDocumentParagraphBorders, documentScriptFontsFromElement, DOCUMENT_RUN_BORDER_ATTRIBUTE, normalizeDocumentTableOfContentsValue, DOCUMENT_PARAGRAPH_ID_ATTRIBUTE, documentNoProofFromElement, normalizeDocumentRunShading, documentIndexEntryFromElement, documentScriptFontSegments, normalizeDocumentIndexEntry, documentFontNameFromCssFamily, documentRunShadingDomAttributes, normalizeDocumentIndexEntryDraft, parseDocumentScriptFonts, normalizeDocumentRunBorder, normalizeDocumentParagraphBorder, serializeDocumentParagraphBorders, parseDocxThemeReference, parseDocumentRunShading, DOCUMENT_HIGHLIGHT_ATTRIBUTE, serializeDocumentRunShading, workDocumentOutlineLevel, DOCUMENT_PARAGRAPH_BORDERS_ATTRIBUTE, createDocumentParagraphIdentityRegistry, DOCUMENT_NO_PROOF_ATTRIBUTE, serializeDocxThemeReference, documentRunBorderIsVisible, normalizeDocumentTableOfContentsHtml, cssDocumentFontFamily, documentParagraphShadingDomAttributes, normalizeDocumentIndexValue, DOCUMENT_PROOFING_LANGUAGES_ATTRIBUTE, documentParagraphBordersDomAttributes, DOCUMENT_SCRIPT_FONTS_ATTRIBUTE, normalizeDocumentHighlight, normalizeDocumentParagraphIdentity, createOfficeId as createWorkId, DEFAULT_DOCUMENT_TABLE_OF_CONTENTS_OPTIONS, DEFAULT_DOCUMENT_INDEX_OPTIONS, documentHighlightFromElement, normalizeDocumentLanguageTag, parseDocumentParagraphShading, normalizeDocumentNoProof, parseDocumentParagraphShadingElement, createDocumentParagraphIdentity, documentHighlightDomAttributes, DocumentParagraphIdentity, parseDocumentRunShadingElement, parseDocumentProofingLanguages, collectWorkDocumentOutline, documentScriptFontSlotFromHint, normalizeDocumentTableOfContentsOptions, documentBorderPresentation, documentScriptFontFamilyForRendering, parseDocumentRunBorderElement, documentProofingDomAttributes, normalizeDocumentScriptFontSlot, serializeDocumentProofingLanguages } from "./4121.js";
|
|
25
26
|
import { workOfficeCollaborationJsonEqual, canonicalWorkOfficeCollaborationJson, isWorkOfficeCollaborationRecord, cloneWorkOfficeCollaborationJson } from "./4650.js";
|
|
26
27
|
import { assertWorkOfficeCollaborationEditable, markWorkOfficeCollaborationInitialized, assertWorkOfficeCollaborationOrigin, initializeWorkOfficeCollaborationMetadata, assertWorkOfficeCollaborationWritable, OfficeCollaborationError as WorkOfficeCollaborationError, readOfficeCollaborationMetadata as readWorkOfficeCollaborationMetadata, registerWorkOfficeCollaborationInitializer } from "./9787.js";
|
|
27
28
|
import * as __rspack_external_yjs from "yjs";
|
|
29
|
+
var work_document_model_codec_namespaceObject = {};
|
|
30
|
+
__webpack_require__.r(work_document_model_codec_namespaceObject);
|
|
31
|
+
__webpack_require__.d(work_document_model_codec_namespaceObject, {
|
|
32
|
+
createWorkDocumentModelFromContent: ()=>work_document_model_codec_createWorkDocumentModelFromContent,
|
|
33
|
+
materializeWorkDocumentContent: ()=>work_document_model_codec_materializeWorkDocumentContent,
|
|
34
|
+
L: ()=>serializeWorkDocumentNode,
|
|
35
|
+
m: ()=>workDocumentSchema
|
|
36
|
+
});
|
|
37
|
+
var work_document_model_namespaceObject = {};
|
|
38
|
+
__webpack_require__.r(work_document_model_namespaceObject);
|
|
39
|
+
__webpack_require__.d(work_document_model_namespaceObject, {
|
|
40
|
+
U7: ()=>createSchemaDerivedWorkDocumentModel,
|
|
41
|
+
createSchemaValidatedWorkDocumentModel: ()=>work_document_model_createSchemaValidatedWorkDocumentModel,
|
|
42
|
+
MQ: ()=>createWorkDocumentModel,
|
|
43
|
+
hs: ()=>documentModelForContent,
|
|
44
|
+
BK: ()=>documentModelForHtml,
|
|
45
|
+
gK: ()=>documentModelHasTrustedInitialIntegrityFeatures,
|
|
46
|
+
Kh: ()=>resolveWorkDocumentEditorInput
|
|
47
|
+
});
|
|
28
48
|
const BOOKMARK_REFERENCE_SELECTOR = 'span[data-document-cross-reference][data-reference-target-type="bookmark"]';
|
|
29
49
|
const BLOCK_TEXT_CONTAINER_NAMES = new Set([
|
|
30
50
|
'ADDRESS',
|
|
@@ -1828,7 +1848,7 @@ function createWorkDocumentModelWithFingerprint(root, htmlFingerprint, previous)
|
|
|
1828
1848
|
transferLazyDocumentModelState(previous, model);
|
|
1829
1849
|
return model;
|
|
1830
1850
|
}
|
|
1831
|
-
function
|
|
1851
|
+
function work_document_model_createSchemaValidatedWorkDocumentModel(html, root, options = {}) {
|
|
1832
1852
|
const model = createWorkDocumentModel(html, root, options.previous);
|
|
1833
1853
|
schemaValidatedDocumentModels.set(model, {
|
|
1834
1854
|
html,
|
|
@@ -8887,6 +8907,14 @@ function activeParagraphNodeTypes(editor) {
|
|
|
8887
8907
|
function work_document_tab_stops_isRecord(value) {
|
|
8888
8908
|
return 'object' == typeof value && null !== value && !Array.isArray(value);
|
|
8889
8909
|
}
|
|
8910
|
+
const DOCUMENT_PARAGRAPH_CHANGE_ATTRIBUTES = [
|
|
8911
|
+
'paragraphChangeKind',
|
|
8912
|
+
'paragraphChangeId',
|
|
8913
|
+
'paragraphChangeActorId',
|
|
8914
|
+
'paragraphChangeAuthor',
|
|
8915
|
+
'paragraphChangeDate',
|
|
8916
|
+
'paragraphChangeBefore'
|
|
8917
|
+
];
|
|
8890
8918
|
const DOCUMENT_PARAGRAPH_FORMAT_ATTRIBUTES = [
|
|
8891
8919
|
'textAlign',
|
|
8892
8920
|
'paragraphDirection',
|
|
@@ -9261,7 +9289,12 @@ const DocumentChange = Mark.create({
|
|
|
9261
9289
|
paragraphChangeActorId: paragraphChangeAttribute('actorId', 'data-change-actor-id'),
|
|
9262
9290
|
paragraphChangeAuthor: paragraphChangeAttribute('author', 'data-change-author'),
|
|
9263
9291
|
paragraphChangeDate: paragraphChangeAttribute('date', 'data-change-date'),
|
|
9264
|
-
paragraphChangeBefore: paragraphChangeAttribute('before', 'data-change-before')
|
|
9292
|
+
paragraphChangeBefore: paragraphChangeAttribute('before', 'data-change-before'),
|
|
9293
|
+
blockChangeKind: blockChangeAttribute('kind'),
|
|
9294
|
+
blockChangeId: blockChangeAttribute('id'),
|
|
9295
|
+
blockChangeActorId: blockChangeAttribute('actorId'),
|
|
9296
|
+
blockChangeAuthor: blockChangeAttribute('author'),
|
|
9297
|
+
blockChangeDate: blockChangeAttribute('date')
|
|
9265
9298
|
}
|
|
9266
9299
|
}
|
|
9267
9300
|
];
|
|
@@ -9379,7 +9412,33 @@ const DocumentChange = Mark.create({
|
|
|
9379
9412
|
});
|
|
9380
9413
|
function collectDocumentChanges(document1) {
|
|
9381
9414
|
const changes = new Map();
|
|
9415
|
+
const blockChangeRanges = new Map();
|
|
9382
9416
|
document1.descendants((node, position)=>{
|
|
9417
|
+
if (('paragraph' === node.type.name || 'heading' === node.type.name) && ('insertion' === node.attrs.blockChangeKind || 'deletion' === node.attrs.blockChangeKind)) {
|
|
9418
|
+
const kind = node.attrs.blockChangeKind;
|
|
9419
|
+
const id = work_document_changes_stringAttribute(node.attrs.blockChangeId) || `block-change-at-${position}`;
|
|
9420
|
+
const key = `${kind}:${id}`;
|
|
9421
|
+
const from = position;
|
|
9422
|
+
const to = position + node.nodeSize;
|
|
9423
|
+
changes.set(key, {
|
|
9424
|
+
id,
|
|
9425
|
+
kind,
|
|
9426
|
+
...work_document_changes_stringAttribute(node.attrs.blockChangeActorId) ? {
|
|
9427
|
+
actorId: work_document_changes_stringAttribute(node.attrs.blockChangeActorId)
|
|
9428
|
+
} : {},
|
|
9429
|
+
author: work_document_changes_stringAttribute(node.attrs.blockChangeAuthor) || '未知审阅者',
|
|
9430
|
+
date: work_document_changes_stringAttribute(node.attrs.blockChangeDate),
|
|
9431
|
+
from,
|
|
9432
|
+
to,
|
|
9433
|
+
text: node.textContent
|
|
9434
|
+
});
|
|
9435
|
+
const ranges = blockChangeRanges.get(key) ?? [];
|
|
9436
|
+
ranges.push({
|
|
9437
|
+
from,
|
|
9438
|
+
to
|
|
9439
|
+
});
|
|
9440
|
+
blockChangeRanges.set(key, ranges);
|
|
9441
|
+
}
|
|
9383
9442
|
if (('paragraph' === node.type.name || 'heading' === node.type.name) && 'paragraph-formatting' === node.attrs.paragraphChangeKind) {
|
|
9384
9443
|
const id = work_document_changes_stringAttribute(node.attrs.paragraphChangeId) || `paragraph-change-at-${position}`;
|
|
9385
9444
|
const key = `paragraph-formatting:${id}`;
|
|
@@ -9409,6 +9468,7 @@ function collectDocumentChanges(document1) {
|
|
|
9409
9468
|
const kind = changeKind(mark.attrs.kind);
|
|
9410
9469
|
const id = work_document_changes_stringAttribute(mark.attrs.id) || `change-at-${position}`;
|
|
9411
9470
|
const key = `${kind}:${id}`;
|
|
9471
|
+
if (blockChangeRanges.get(key)?.some((range)=>position >= range.from && position + node.nodeSize <= range.to)) return;
|
|
9412
9472
|
const current = changes.get(key);
|
|
9413
9473
|
if (current) {
|
|
9414
9474
|
current.from = Math.min(current.from, position);
|
|
@@ -9431,10 +9491,24 @@ function collectDocumentChanges(document1) {
|
|
|
9431
9491
|
});
|
|
9432
9492
|
return Array.from(changes.values()).sort((left, right)=>left.from - right.from);
|
|
9433
9493
|
}
|
|
9494
|
+
function resolveAllDocumentChanges(document1, decision) {
|
|
9495
|
+
if (!collectDocumentChanges(document1).length) return document1;
|
|
9496
|
+
const type = document1.type.schema.marks.documentChange;
|
|
9497
|
+
if (!type) return null;
|
|
9498
|
+
const state = EditorState.create({
|
|
9499
|
+
doc: document1
|
|
9500
|
+
});
|
|
9501
|
+
const transaction = state.tr;
|
|
9502
|
+
return resolveDocumentChangesTransaction(state, transaction, type, decision) > 0 ? transaction.doc : null;
|
|
9503
|
+
}
|
|
9434
9504
|
function resolveDocumentChangesCommand({ state, tr }, type, decision, ids) {
|
|
9505
|
+
return resolveDocumentChangesTransaction(state, tr, type, decision, ids);
|
|
9506
|
+
}
|
|
9507
|
+
function resolveDocumentChangesTransaction(state, tr, type, decision, ids) {
|
|
9435
9508
|
const segments = documentChangeSegments(state.doc, type).filter((segment)=>!ids || ids.has(segment.id));
|
|
9436
9509
|
const paragraphSegments = paragraphChangeSegments(state.doc).filter((segment)=>!ids || ids.has(segment.id));
|
|
9437
|
-
|
|
9510
|
+
const blockSegments = blockChangeSegments(state.doc).filter((segment)=>!ids || ids.has(segment.id));
|
|
9511
|
+
if (!segments.length && !paragraphSegments.length && !blockSegments.length) return 0;
|
|
9438
9512
|
if (paragraphSegments.some((segment)=>!parseDocumentParagraphFormatting(segment.before)) || 'reject' === decision && segments.some((segment)=>'formatting' === segment.kind && !parseDocumentCharacterFormatting(segment.before))) return 0;
|
|
9439
9513
|
closeHistory(tr);
|
|
9440
9514
|
tr.setMeta(documentChangePluginKey, {
|
|
@@ -9443,7 +9517,9 @@ function resolveDocumentChangesCommand({ state, tr }, type, decision, ids) {
|
|
|
9443
9517
|
const markRemovals = [];
|
|
9444
9518
|
const contentDeletions = [];
|
|
9445
9519
|
const formattingRejections = [];
|
|
9520
|
+
const removedBlockIds = new Set(blockSegments.filter((segment)=>'accept' === decision && 'deletion' === segment.kind || 'reject' === decision && 'insertion' === segment.kind).map((segment)=>segment.id));
|
|
9446
9521
|
for (const segment of segments){
|
|
9522
|
+
if (removedBlockIds.has(segment.id)) continue;
|
|
9447
9523
|
if ('formatting' === segment.kind) {
|
|
9448
9524
|
markRemovals.push(segment);
|
|
9449
9525
|
if ('reject' === decision) formattingRejections.push(segment);
|
|
@@ -9460,11 +9536,25 @@ function resolveDocumentChangesCommand({ state, tr }, type, decision, ids) {
|
|
|
9460
9536
|
if (!attributes) return 0;
|
|
9461
9537
|
tr.setNodeMarkup(segment.position, void 0, attributes);
|
|
9462
9538
|
}
|
|
9539
|
+
for (const segment of blockSegments){
|
|
9540
|
+
if (removedBlockIds.has(segment.id)) continue;
|
|
9541
|
+
const position = tr.mapping.map(segment.position);
|
|
9542
|
+
const node = tr.doc.nodeAt(position);
|
|
9543
|
+
if (!node || 'paragraph' !== node.type.name && 'heading' !== node.type.name) return 0;
|
|
9544
|
+
tr.setNodeMarkup(position, void 0, clearDocumentBlockChangeAttributes(node.attrs));
|
|
9545
|
+
}
|
|
9463
9546
|
for (const segment of markRemovals)tr.removeMark(segment.from, segment.to, type);
|
|
9464
9547
|
for (const segment of contentDeletions.sort((left, right)=>right.from - left.from))tr.delete(segment.from, segment.to);
|
|
9548
|
+
for (const segment of blockSegments.filter((candidate)=>removedBlockIds.has(candidate.id)).sort((left, right)=>right.position - left.position)){
|
|
9549
|
+
const from = tr.mapping.map(segment.position);
|
|
9550
|
+
const node = tr.doc.nodeAt(from);
|
|
9551
|
+
if (!node || 'paragraph' !== node.type.name && 'heading' !== node.type.name) return 0;
|
|
9552
|
+
tr.delete(from, from + node.nodeSize);
|
|
9553
|
+
}
|
|
9465
9554
|
return tr.docChanged ? new Set([
|
|
9466
9555
|
...segments,
|
|
9467
|
-
...paragraphSegments
|
|
9556
|
+
...paragraphSegments,
|
|
9557
|
+
...blockSegments
|
|
9468
9558
|
].map((segment)=>segment.id)).size : 0;
|
|
9469
9559
|
}
|
|
9470
9560
|
function trackedReplacement(transaction, document1, type, from, to, text, createChange) {
|
|
@@ -9533,6 +9623,20 @@ function paragraphChangeSegments(document1) {
|
|
|
9533
9623
|
});
|
|
9534
9624
|
return segments;
|
|
9535
9625
|
}
|
|
9626
|
+
function blockChangeSegments(document1) {
|
|
9627
|
+
const segments = [];
|
|
9628
|
+
document1.descendants((node, position)=>{
|
|
9629
|
+
if ('paragraph' !== node.type.name && 'heading' !== node.type.name || 'insertion' !== node.attrs.blockChangeKind && 'deletion' !== node.attrs.blockChangeKind) return;
|
|
9630
|
+
segments.push({
|
|
9631
|
+
id: work_document_changes_stringAttribute(node.attrs.blockChangeId) || `block-change-at-${position}`,
|
|
9632
|
+
kind: node.attrs.blockChangeKind,
|
|
9633
|
+
position,
|
|
9634
|
+
from: position + 1,
|
|
9635
|
+
to: position + 1 + node.content.size
|
|
9636
|
+
});
|
|
9637
|
+
});
|
|
9638
|
+
return segments;
|
|
9639
|
+
}
|
|
9536
9640
|
function markFragment(fragment, insertion, type) {
|
|
9537
9641
|
const nodes = [];
|
|
9538
9642
|
fragment.forEach((node)=>{
|
|
@@ -9609,6 +9713,41 @@ function paragraphChangeAttribute(field, htmlName) {
|
|
|
9609
9713
|
}
|
|
9610
9714
|
};
|
|
9611
9715
|
}
|
|
9716
|
+
function blockChangeAttribute(field) {
|
|
9717
|
+
const modelName = `blockChange${field[0]?.toUpperCase() ?? ''}${field.slice(1)}`;
|
|
9718
|
+
const htmlName = 'kind' === field ? 'data-block-change-kind' : `data-block-change-${field.replace('actorId', 'actor-id')}`;
|
|
9719
|
+
return {
|
|
9720
|
+
default: 'kind' === field ? null : '',
|
|
9721
|
+
parseHTML: (element)=>{
|
|
9722
|
+
if ('true' !== element.getAttribute('data-document-block-change')) return 'kind' === field ? null : '';
|
|
9723
|
+
const value = element.getAttribute(htmlName) ?? '';
|
|
9724
|
+
if ('kind' === field) return 'insertion' === value || 'deletion' === value ? value : null;
|
|
9725
|
+
return value;
|
|
9726
|
+
},
|
|
9727
|
+
renderHTML: (attributes)=>{
|
|
9728
|
+
const kind = attributes.blockChangeKind;
|
|
9729
|
+
if ('insertion' !== kind && 'deletion' !== kind) return {};
|
|
9730
|
+
if ('kind' === field) return {
|
|
9731
|
+
'data-document-block-change': 'true',
|
|
9732
|
+
'data-block-change-kind': kind
|
|
9733
|
+
};
|
|
9734
|
+
const value = work_document_changes_stringAttribute(attributes[modelName]);
|
|
9735
|
+
return value ? {
|
|
9736
|
+
[htmlName]: value
|
|
9737
|
+
} : {};
|
|
9738
|
+
}
|
|
9739
|
+
};
|
|
9740
|
+
}
|
|
9741
|
+
function clearDocumentBlockChangeAttributes(attributes) {
|
|
9742
|
+
return {
|
|
9743
|
+
...attributes,
|
|
9744
|
+
blockChangeKind: null,
|
|
9745
|
+
blockChangeId: '',
|
|
9746
|
+
blockChangeActorId: '',
|
|
9747
|
+
blockChangeAuthor: '',
|
|
9748
|
+
blockChangeDate: ''
|
|
9749
|
+
};
|
|
9750
|
+
}
|
|
9612
9751
|
function work_document_changes_stringAttribute(value) {
|
|
9613
9752
|
return 'string' == typeof value ? value : '';
|
|
9614
9753
|
}
|
|
@@ -12583,6 +12722,433 @@ function syncImageDimension(element, dimension, value) {
|
|
|
12583
12722
|
element.style.removeProperty(dimension);
|
|
12584
12723
|
element.removeAttribute(dimension);
|
|
12585
12724
|
}
|
|
12725
|
+
const DocumentIndexEntry = core_Node.create({
|
|
12726
|
+
name: 'documentIndexEntry',
|
|
12727
|
+
group: 'inline',
|
|
12728
|
+
inline: true,
|
|
12729
|
+
atom: true,
|
|
12730
|
+
selectable: true,
|
|
12731
|
+
draggable: false,
|
|
12732
|
+
addAttributes () {
|
|
12733
|
+
return {
|
|
12734
|
+
id: work_document_index_nodes_hiddenAttribute(''),
|
|
12735
|
+
mainEntry: work_document_index_nodes_hiddenAttribute(''),
|
|
12736
|
+
subEntry: work_document_index_nodes_hiddenAttribute(''),
|
|
12737
|
+
crossReference: work_document_index_nodes_hiddenAttribute(''),
|
|
12738
|
+
pageBold: work_document_index_nodes_hiddenAttribute(false),
|
|
12739
|
+
pageItalic: work_document_index_nodes_hiddenAttribute(false)
|
|
12740
|
+
};
|
|
12741
|
+
},
|
|
12742
|
+
addCommands () {
|
|
12743
|
+
return {
|
|
12744
|
+
markDocumentIndexEntry: (value)=>(props)=>markDocumentIndexEntryCommand(props, value),
|
|
12745
|
+
updateDocumentIndexEntry: (value)=>(props)=>updateDocumentIndexEntryCommand(props, value)
|
|
12746
|
+
};
|
|
12747
|
+
},
|
|
12748
|
+
parseHTML () {
|
|
12749
|
+
return [
|
|
12750
|
+
{
|
|
12751
|
+
tag: 'span[data-document-index-entry]',
|
|
12752
|
+
getAttrs: (node)=>{
|
|
12753
|
+
if (!(node instanceof HTMLElement)) return false;
|
|
12754
|
+
const value = documentIndexEntryFromElement(node);
|
|
12755
|
+
return value ? indexEntryNodeAttributes(value) : false;
|
|
12756
|
+
}
|
|
12757
|
+
}
|
|
12758
|
+
];
|
|
12759
|
+
},
|
|
12760
|
+
renderHTML ({ node, HTMLAttributes }) {
|
|
12761
|
+
const value = normalizeDocumentIndexEntry(node.attrs);
|
|
12762
|
+
if (!value) return [
|
|
12763
|
+
'span',
|
|
12764
|
+
{
|
|
12765
|
+
hidden: 'true'
|
|
12766
|
+
}
|
|
12767
|
+
];
|
|
12768
|
+
const detail = indexEntryLabel(value);
|
|
12769
|
+
return [
|
|
12770
|
+
'span',
|
|
12771
|
+
mergeAttributes(HTMLAttributes, {
|
|
12772
|
+
'data-document-index-entry': 'true',
|
|
12773
|
+
'data-index-entry-id': value.id,
|
|
12774
|
+
'data-index-main-entry': value.mainEntry,
|
|
12775
|
+
'data-index-sub-entry': value.subEntry,
|
|
12776
|
+
'data-index-cross-reference': value.crossReference,
|
|
12777
|
+
'data-index-page-bold': String(value.pageBold),
|
|
12778
|
+
'data-index-page-italic': String(value.pageItalic),
|
|
12779
|
+
class: 'work-document-index-entry',
|
|
12780
|
+
contenteditable: 'false',
|
|
12781
|
+
'aria-label': `索引项:${detail}`
|
|
12782
|
+
}),
|
|
12783
|
+
[
|
|
12784
|
+
'span',
|
|
12785
|
+
{
|
|
12786
|
+
'aria-hidden': 'true'
|
|
12787
|
+
},
|
|
12788
|
+
'索引项'
|
|
12789
|
+
],
|
|
12790
|
+
[
|
|
12791
|
+
'strong',
|
|
12792
|
+
detail
|
|
12793
|
+
]
|
|
12794
|
+
];
|
|
12795
|
+
},
|
|
12796
|
+
renderText () {
|
|
12797
|
+
return '';
|
|
12798
|
+
}
|
|
12799
|
+
});
|
|
12800
|
+
const DocumentIndex = core_Node.create({
|
|
12801
|
+
name: 'documentIndex',
|
|
12802
|
+
group: 'block',
|
|
12803
|
+
atom: true,
|
|
12804
|
+
selectable: true,
|
|
12805
|
+
draggable: false,
|
|
12806
|
+
addAttributes () {
|
|
12807
|
+
return {
|
|
12808
|
+
id: work_document_index_nodes_hiddenAttribute(''),
|
|
12809
|
+
columns: work_document_index_nodes_hiddenAttribute(1),
|
|
12810
|
+
format: work_document_index_nodes_hiddenAttribute('indented'),
|
|
12811
|
+
rightAlignPageNumbers: work_document_index_nodes_hiddenAttribute(true),
|
|
12812
|
+
leader: work_document_index_nodes_hiddenAttribute('dot'),
|
|
12813
|
+
entries: work_document_index_nodes_hiddenAttribute([]),
|
|
12814
|
+
truncated: work_document_index_nodes_hiddenAttribute(false)
|
|
12815
|
+
};
|
|
12816
|
+
},
|
|
12817
|
+
addCommands () {
|
|
12818
|
+
return {
|
|
12819
|
+
insertDocumentIndex: (options = DEFAULT_DOCUMENT_INDEX_OPTIONS, buildOptions)=>(props)=>insertDocumentIndexCommand(props, options, buildOptions),
|
|
12820
|
+
updateDocumentIndex: (options, buildOptions)=>(props)=>updateDocumentIndexCommand(props, options, buildOptions),
|
|
12821
|
+
refreshDocumentIndexes: (buildOptions)=>(props)=>refreshDocumentIndexesCommand(props, buildOptions)
|
|
12822
|
+
};
|
|
12823
|
+
},
|
|
12824
|
+
parseHTML () {
|
|
12825
|
+
return [
|
|
12826
|
+
{
|
|
12827
|
+
tag: 'div[data-document-index]',
|
|
12828
|
+
getAttrs: (node)=>{
|
|
12829
|
+
if (!(node instanceof HTMLElement)) return false;
|
|
12830
|
+
return indexNodeAttributes(documentIndexValueFromElement(node));
|
|
12831
|
+
}
|
|
12832
|
+
}
|
|
12833
|
+
];
|
|
12834
|
+
},
|
|
12835
|
+
renderHTML ({ node, HTMLAttributes }) {
|
|
12836
|
+
const value = normalizeDocumentIndexValue({
|
|
12837
|
+
id: work_document_index_nodes_stringAttribute(node.attrs.id) || 'document-index',
|
|
12838
|
+
options: indexOptionsFromAttributes(node.attrs),
|
|
12839
|
+
entries: Array.isArray(node.attrs.entries) ? node.attrs.entries : [],
|
|
12840
|
+
truncated: Boolean(node.attrs.truncated)
|
|
12841
|
+
});
|
|
12842
|
+
const rows = value.entries.length ? value.entries.map((entry)=>indexEntrySpec(entry)) : [
|
|
12843
|
+
[
|
|
12844
|
+
'li',
|
|
12845
|
+
{
|
|
12846
|
+
class: 'work-document-index-empty'
|
|
12847
|
+
},
|
|
12848
|
+
'没有已标记的索引项'
|
|
12849
|
+
]
|
|
12850
|
+
];
|
|
12851
|
+
return [
|
|
12852
|
+
'div',
|
|
12853
|
+
mergeAttributes(HTMLAttributes, {
|
|
12854
|
+
'data-document-index': 'true',
|
|
12855
|
+
'data-index-id': value.id,
|
|
12856
|
+
'data-index-columns': String(value.options.columns),
|
|
12857
|
+
'data-index-format': value.options.format,
|
|
12858
|
+
'data-index-right-align-page-numbers': String(value.options.rightAlignPageNumbers),
|
|
12859
|
+
'data-index-leader': value.options.leader,
|
|
12860
|
+
'data-index-entries': JSON.stringify(value.entries),
|
|
12861
|
+
'data-index-truncated': String(value.truncated),
|
|
12862
|
+
class: 'work-document-index',
|
|
12863
|
+
contenteditable: 'false',
|
|
12864
|
+
'aria-label': '索引'
|
|
12865
|
+
}),
|
|
12866
|
+
[
|
|
12867
|
+
'div',
|
|
12868
|
+
{
|
|
12869
|
+
class: 'work-document-index-header'
|
|
12870
|
+
},
|
|
12871
|
+
[
|
|
12872
|
+
'strong',
|
|
12873
|
+
'索引'
|
|
12874
|
+
],
|
|
12875
|
+
[
|
|
12876
|
+
'span',
|
|
12877
|
+
value.truncated ? "仅显示前 512 项" : `${value.entries.length} 项`
|
|
12878
|
+
]
|
|
12879
|
+
],
|
|
12880
|
+
[
|
|
12881
|
+
'ol',
|
|
12882
|
+
{
|
|
12883
|
+
class: 'work-document-index-list'
|
|
12884
|
+
},
|
|
12885
|
+
...rows
|
|
12886
|
+
]
|
|
12887
|
+
];
|
|
12888
|
+
},
|
|
12889
|
+
renderText ({ node }) {
|
|
12890
|
+
const entries = Array.isArray(node.attrs.entries) ? node.attrs.entries : [];
|
|
12891
|
+
return entries.map((entry)=>[
|
|
12892
|
+
entry.mainEntry,
|
|
12893
|
+
entry.subEntry,
|
|
12894
|
+
entry.crossReference
|
|
12895
|
+
].filter(Boolean).join(' ')).join('\n');
|
|
12896
|
+
},
|
|
12897
|
+
addProseMirrorPlugins () {
|
|
12898
|
+
return [
|
|
12899
|
+
new Plugin({
|
|
12900
|
+
props: {
|
|
12901
|
+
handleDOMEvents: {
|
|
12902
|
+
click: (view, event)=>{
|
|
12903
|
+
if (!(event.target instanceof Element)) return false;
|
|
12904
|
+
const link = event.target.closest('[data-document-index] [data-index-target]');
|
|
12905
|
+
const targetId = link?.dataset.indexTarget?.trim();
|
|
12906
|
+
if (!link || !targetId) return false;
|
|
12907
|
+
let targetPosition = null;
|
|
12908
|
+
view.state.doc.descendants((node, position)=>{
|
|
12909
|
+
if (null !== targetPosition) return false;
|
|
12910
|
+
if ('documentIndexEntry' === node.type.name && node.attrs.id === targetId) {
|
|
12911
|
+
targetPosition = position;
|
|
12912
|
+
return false;
|
|
12913
|
+
}
|
|
12914
|
+
return true;
|
|
12915
|
+
});
|
|
12916
|
+
if (null === targetPosition) return false;
|
|
12917
|
+
event.preventDefault();
|
|
12918
|
+
view.dispatch(view.state.tr.setSelection(NodeSelection.create(view.state.doc, targetPosition)).scrollIntoView());
|
|
12919
|
+
view.focus();
|
|
12920
|
+
return true;
|
|
12921
|
+
}
|
|
12922
|
+
}
|
|
12923
|
+
}
|
|
12924
|
+
})
|
|
12925
|
+
];
|
|
12926
|
+
}
|
|
12927
|
+
});
|
|
12928
|
+
function selectedDocumentIndexEntry(editor) {
|
|
12929
|
+
const selection = editor.state.selection;
|
|
12930
|
+
if (!(selection instanceof NodeSelection) || 'documentIndexEntry' !== selection.node.type.name) return null;
|
|
12931
|
+
return normalizeDocumentIndexEntry(selection.node.attrs);
|
|
12932
|
+
}
|
|
12933
|
+
function selectedDocumentIndexOptions(editor) {
|
|
12934
|
+
const selection = editor.state.selection;
|
|
12935
|
+
if (!(selection instanceof NodeSelection) || 'documentIndex' !== selection.node.type.name) return null;
|
|
12936
|
+
return indexOptionsFromAttributes(selection.node.attrs);
|
|
12937
|
+
}
|
|
12938
|
+
function selectedDocumentIndexDraft(editor) {
|
|
12939
|
+
const selected = selectedDocumentIndexEntry(editor);
|
|
12940
|
+
if (selected) return {
|
|
12941
|
+
mainEntry: selected.mainEntry,
|
|
12942
|
+
subEntry: selected.subEntry,
|
|
12943
|
+
crossReference: selected.crossReference,
|
|
12944
|
+
pageBold: selected.pageBold,
|
|
12945
|
+
pageItalic: selected.pageItalic
|
|
12946
|
+
};
|
|
12947
|
+
const { from, to } = editor.state.selection;
|
|
12948
|
+
const mainEntry = editor.state.doc.textBetween(from, to, ' ').replace(/\s+/g, ' ').trim();
|
|
12949
|
+
return normalizeDocumentIndexEntryDraft({
|
|
12950
|
+
mainEntry
|
|
12951
|
+
});
|
|
12952
|
+
}
|
|
12953
|
+
function documentHasIndex(editor) {
|
|
12954
|
+
return documentHasNode(editor, 'documentIndex');
|
|
12955
|
+
}
|
|
12956
|
+
function markDocumentIndexEntryCommand({ dispatch, editor, state, tr }, source) {
|
|
12957
|
+
const value = normalizeDocumentIndexEntryDraft(source);
|
|
12958
|
+
const nodeType = editor.schema.nodes.documentIndexEntry;
|
|
12959
|
+
if (!value || !nodeType) return false;
|
|
12960
|
+
const selection = state.selection;
|
|
12961
|
+
if (selection instanceof NodeSelection && 'documentIndexEntry' === selection.node.type.name) return updateDocumentIndexEntryCommand({
|
|
12962
|
+
dispatch,
|
|
12963
|
+
editor,
|
|
12964
|
+
state,
|
|
12965
|
+
tr
|
|
12966
|
+
}, value);
|
|
12967
|
+
if (!dispatch) return true;
|
|
12968
|
+
const position = selection.to;
|
|
12969
|
+
const node = nodeType.create({
|
|
12970
|
+
id: createWorkId('index-entry'),
|
|
12971
|
+
...value
|
|
12972
|
+
});
|
|
12973
|
+
tr.insert(position, node);
|
|
12974
|
+
tr.setSelection(TextSelection.near(tr.doc.resolve(position + node.nodeSize)));
|
|
12975
|
+
tr.scrollIntoView();
|
|
12976
|
+
return tr.docChanged;
|
|
12977
|
+
}
|
|
12978
|
+
function updateDocumentIndexEntryCommand({ dispatch, state, tr }, source) {
|
|
12979
|
+
const selection = state.selection;
|
|
12980
|
+
const value = normalizeDocumentIndexEntryDraft(source);
|
|
12981
|
+
if (!value || !(selection instanceof NodeSelection) || 'documentIndexEntry' !== selection.node.type.name) return false;
|
|
12982
|
+
if (!dispatch) return true;
|
|
12983
|
+
tr.setNodeMarkup(selection.from, void 0, {
|
|
12984
|
+
...selection.node.attrs,
|
|
12985
|
+
...value
|
|
12986
|
+
});
|
|
12987
|
+
tr.scrollIntoView();
|
|
12988
|
+
return tr.docChanged;
|
|
12989
|
+
}
|
|
12990
|
+
function insertDocumentIndexCommand({ dispatch, editor, tr }, source, buildOptions = {}) {
|
|
12991
|
+
const nodeType = editor.schema.nodes.documentIndex;
|
|
12992
|
+
if (!nodeType) return false;
|
|
12993
|
+
if (!dispatch) return true;
|
|
12994
|
+
const options = normalizeDocumentIndexOptions(source);
|
|
12995
|
+
const built = buildDocumentIndexEntries(tr.doc, buildOptions);
|
|
12996
|
+
tr.replaceSelectionWith(nodeType.create({
|
|
12997
|
+
id: createWorkId('index'),
|
|
12998
|
+
...options,
|
|
12999
|
+
...built
|
|
13000
|
+
}), false);
|
|
13001
|
+
tr.scrollIntoView();
|
|
13002
|
+
return true;
|
|
13003
|
+
}
|
|
13004
|
+
function updateDocumentIndexCommand({ dispatch, state, tr }, source, buildOptions = {}) {
|
|
13005
|
+
const selection = state.selection;
|
|
13006
|
+
if (!(selection instanceof NodeSelection) || 'documentIndex' !== selection.node.type.name) return false;
|
|
13007
|
+
if (!dispatch) return true;
|
|
13008
|
+
const options = normalizeDocumentIndexOptions(source);
|
|
13009
|
+
const built = buildDocumentIndexEntries(tr.doc, buildOptions);
|
|
13010
|
+
tr.setNodeMarkup(selection.from, void 0, {
|
|
13011
|
+
...selection.node.attrs,
|
|
13012
|
+
...options,
|
|
13013
|
+
...built
|
|
13014
|
+
});
|
|
13015
|
+
tr.scrollIntoView();
|
|
13016
|
+
return tr.docChanged;
|
|
13017
|
+
}
|
|
13018
|
+
function refreshDocumentIndexesCommand({ dispatch, state, tr }, buildOptions = {}) {
|
|
13019
|
+
const updates = [];
|
|
13020
|
+
const built = buildDocumentIndexEntries(state.doc, buildOptions);
|
|
13021
|
+
state.doc.descendants((node, position)=>{
|
|
13022
|
+
if ('documentIndex' !== node.type.name) return;
|
|
13023
|
+
if (JSON.stringify(node.attrs.entries) === JSON.stringify(built.entries) && Boolean(node.attrs.truncated) === built.truncated) return;
|
|
13024
|
+
updates.push({
|
|
13025
|
+
position,
|
|
13026
|
+
attrs: {
|
|
13027
|
+
...node.attrs,
|
|
13028
|
+
...built
|
|
13029
|
+
}
|
|
13030
|
+
});
|
|
13031
|
+
});
|
|
13032
|
+
if (!updates.length) return false;
|
|
13033
|
+
if (!dispatch) return true;
|
|
13034
|
+
for (const update of updates)tr.setNodeMarkup(update.position, void 0, update.attrs);
|
|
13035
|
+
tr.scrollIntoView();
|
|
13036
|
+
return tr.docChanged;
|
|
13037
|
+
}
|
|
13038
|
+
function indexEntryNodeAttributes(value) {
|
|
13039
|
+
return {
|
|
13040
|
+
...value
|
|
13041
|
+
};
|
|
13042
|
+
}
|
|
13043
|
+
function indexNodeAttributes(value) {
|
|
13044
|
+
return {
|
|
13045
|
+
id: value.id,
|
|
13046
|
+
...value.options,
|
|
13047
|
+
entries: value.entries,
|
|
13048
|
+
truncated: value.truncated
|
|
13049
|
+
};
|
|
13050
|
+
}
|
|
13051
|
+
function indexOptionsFromAttributes(attrs) {
|
|
13052
|
+
return normalizeDocumentIndexOptions({
|
|
13053
|
+
columns: Number(attrs.columns),
|
|
13054
|
+
format: 'run-in' === attrs.format ? 'run-in' : 'indented',
|
|
13055
|
+
rightAlignPageNumbers: Boolean(attrs.rightAlignPageNumbers),
|
|
13056
|
+
leader: 'string' == typeof attrs.leader ? attrs.leader : 'dot'
|
|
13057
|
+
});
|
|
13058
|
+
}
|
|
13059
|
+
function indexEntrySpec(entry) {
|
|
13060
|
+
const term = [
|
|
13061
|
+
[
|
|
13062
|
+
'span',
|
|
13063
|
+
{
|
|
13064
|
+
class: 'work-document-index-main'
|
|
13065
|
+
},
|
|
13066
|
+
entry.mainEntry
|
|
13067
|
+
]
|
|
13068
|
+
];
|
|
13069
|
+
if (entry.subEntry) term.push([
|
|
13070
|
+
'span',
|
|
13071
|
+
{
|
|
13072
|
+
class: 'work-document-index-sub'
|
|
13073
|
+
},
|
|
13074
|
+
entry.subEntry
|
|
13075
|
+
]);
|
|
13076
|
+
const pages = entry.crossReference ? [
|
|
13077
|
+
[
|
|
13078
|
+
'span',
|
|
13079
|
+
{
|
|
13080
|
+
class: 'work-document-index-cross-reference'
|
|
13081
|
+
},
|
|
13082
|
+
`参见 ${entry.crossReference}`
|
|
13083
|
+
]
|
|
13084
|
+
] : entry.pages.flatMap((page, index)=>{
|
|
13085
|
+
const targetId = page.targetIds[0] ?? '';
|
|
13086
|
+
const result = [];
|
|
13087
|
+
if (index > 0) result.push([
|
|
13088
|
+
'span',
|
|
13089
|
+
{
|
|
13090
|
+
'aria-hidden': 'true'
|
|
13091
|
+
},
|
|
13092
|
+
', '
|
|
13093
|
+
]);
|
|
13094
|
+
result.push([
|
|
13095
|
+
'a',
|
|
13096
|
+
{
|
|
13097
|
+
href: `#${targetId}`,
|
|
13098
|
+
'data-index-target': targetId,
|
|
13099
|
+
tabindex: '-1',
|
|
13100
|
+
class: [
|
|
13101
|
+
page.pageBold ? 'bold' : '',
|
|
13102
|
+
page.pageItalic ? 'italic' : ''
|
|
13103
|
+
].filter(Boolean).join(' ') || void 0
|
|
13104
|
+
},
|
|
13105
|
+
String(page.pageNumber)
|
|
13106
|
+
]);
|
|
13107
|
+
return result;
|
|
13108
|
+
});
|
|
13109
|
+
return [
|
|
13110
|
+
'li',
|
|
13111
|
+
{
|
|
13112
|
+
'data-index-main-entry': entry.mainEntry,
|
|
13113
|
+
'data-index-sub-entry': entry.subEntry
|
|
13114
|
+
},
|
|
13115
|
+
...term,
|
|
13116
|
+
[
|
|
13117
|
+
'i',
|
|
13118
|
+
{
|
|
13119
|
+
'aria-hidden': 'true'
|
|
13120
|
+
}
|
|
13121
|
+
],
|
|
13122
|
+
[
|
|
13123
|
+
'span',
|
|
13124
|
+
{
|
|
13125
|
+
class: 'work-document-index-pages'
|
|
13126
|
+
},
|
|
13127
|
+
...pages
|
|
13128
|
+
]
|
|
13129
|
+
];
|
|
13130
|
+
}
|
|
13131
|
+
function indexEntryLabel(value) {
|
|
13132
|
+
const term = value.subEntry ? `${value.mainEntry} › ${value.subEntry}` : value.mainEntry;
|
|
13133
|
+
return value.crossReference ? `${term} · 参见 ${value.crossReference}` : term;
|
|
13134
|
+
}
|
|
13135
|
+
function documentHasNode(editor, typeName) {
|
|
13136
|
+
let found = false;
|
|
13137
|
+
editor.state.doc.descendants((node)=>{
|
|
13138
|
+
if (node.type.name === typeName) found = true;
|
|
13139
|
+
return !found;
|
|
13140
|
+
});
|
|
13141
|
+
return found;
|
|
13142
|
+
}
|
|
13143
|
+
function work_document_index_nodes_hiddenAttribute(defaultValue) {
|
|
13144
|
+
return {
|
|
13145
|
+
default: defaultValue,
|
|
13146
|
+
rendered: false
|
|
13147
|
+
};
|
|
13148
|
+
}
|
|
13149
|
+
function work_document_index_nodes_stringAttribute(value) {
|
|
13150
|
+
return 'string' == typeof value ? value.trim() : '';
|
|
13151
|
+
}
|
|
12586
13152
|
const DocumentLazyBlock = core_Node.create({
|
|
12587
13153
|
name: DOCUMENT_LAZY_BLOCK_NODE,
|
|
12588
13154
|
group: 'block',
|
|
@@ -18877,6 +19443,8 @@ function createWorkDocumentExtensions(options = {}) {
|
|
|
18877
19443
|
citationExtension,
|
|
18878
19444
|
DocumentBibliography,
|
|
18879
19445
|
DocumentTableOfContents,
|
|
19446
|
+
DocumentIndexEntry,
|
|
19447
|
+
DocumentIndex,
|
|
18880
19448
|
DocumentField,
|
|
18881
19449
|
DocumentEquation,
|
|
18882
19450
|
commentExtension,
|
|
@@ -18945,7 +19513,7 @@ function workDocumentSchema() {
|
|
|
18945
19513
|
function serializeWorkDocumentNode(root) {
|
|
18946
19514
|
return generateHTML(materializeWindowedDocumentModel(root), documentExtensions());
|
|
18947
19515
|
}
|
|
18948
|
-
function
|
|
19516
|
+
function work_document_model_codec_createWorkDocumentModelFromContent(content) {
|
|
18949
19517
|
const previous = content.model;
|
|
18950
19518
|
const synchronized = syncDocumentContentFromHtml(content, content.html);
|
|
18951
19519
|
const document1 = new DOMParser().parseFromString(synchronized.html, 'text/html');
|
|
@@ -18955,7 +19523,7 @@ function createWorkDocumentModelFromContent(content) {
|
|
|
18955
19523
|
model: createWorkDocumentModel(synchronized.html, root, previous)
|
|
18956
19524
|
};
|
|
18957
19525
|
}
|
|
18958
|
-
function
|
|
19526
|
+
function work_document_model_codec_materializeWorkDocumentContent(content) {
|
|
18959
19527
|
const model = documentModelForContent(content);
|
|
18960
19528
|
if (!model) return content;
|
|
18961
19529
|
let html;
|
|
@@ -20548,7 +21116,7 @@ function workOfficeDocumentCollaborationNode(session) {
|
|
|
20548
21116
|
}
|
|
20549
21117
|
function preparedDocumentContent(content) {
|
|
20550
21118
|
if (!content || 'document' !== content.type || 'string' != typeof content.html) throw new WorkOfficeCollaborationError('office.collaboration.content_invalid', 'Document collaboration initialization requires a valid Document content value.');
|
|
20551
|
-
const prepared = documentModelForContent(content) ? content :
|
|
21119
|
+
const prepared = documentModelForContent(content) ? content : work_document_model_codec_createWorkDocumentModelFromContent(content);
|
|
20552
21120
|
requiredDocumentModel(prepared);
|
|
20553
21121
|
return prepared;
|
|
20554
21122
|
}
|
|
@@ -20637,6 +21205,240 @@ function documentCollaborationPermissionExtension(session) {
|
|
|
20637
21205
|
function transactionTouchesRoot(transaction, root) {
|
|
20638
21206
|
return new Set(transaction.changedParentTypes.keys()).has(root);
|
|
20639
21207
|
}
|
|
21208
|
+
function fileNameWithoutExtension(value) {
|
|
21209
|
+
return value.replace(/\.[^.]+$/, '').trim() || '导入的文件';
|
|
21210
|
+
}
|
|
21211
|
+
function work_file_download_safeFileName(value) {
|
|
21212
|
+
return value.replace(/[<>:"/\\|?*\u0000-\u001f]/g, '_').trim() || 'A3S Work 文件';
|
|
21213
|
+
}
|
|
21214
|
+
function work_file_download_downloadBlob(blob, name) {
|
|
21215
|
+
const url = URL.createObjectURL(blob);
|
|
21216
|
+
const anchor = document.createElement('a');
|
|
21217
|
+
anchor.href = url;
|
|
21218
|
+
anchor.download = name;
|
|
21219
|
+
anchor.click();
|
|
21220
|
+
window.setTimeout(()=>URL.revokeObjectURL(url), 0);
|
|
21221
|
+
}
|
|
21222
|
+
const sourceBlobs = new Map();
|
|
21223
|
+
function rememberWorkSourceBlob(artifactId, source) {
|
|
21224
|
+
sourceBlobs.set(artifactId, source);
|
|
21225
|
+
}
|
|
21226
|
+
function forgetWorkSourceBlob(artifactId) {
|
|
21227
|
+
sourceBlobs.delete(artifactId);
|
|
21228
|
+
}
|
|
21229
|
+
function moveWorkSourceBlob(sourceArtifactId, targetArtifactId) {
|
|
21230
|
+
if (sourceArtifactId === targetArtifactId) return;
|
|
21231
|
+
const source = sourceBlobs.get(sourceArtifactId);
|
|
21232
|
+
if (!source) return;
|
|
21233
|
+
if (sourceBlobs.has(targetArtifactId)) throw new Error(`The target artifact '${targetArtifactId}' already owns a source file.`);
|
|
21234
|
+
sourceBlobs.set(targetArtifactId, source);
|
|
21235
|
+
sourceBlobs.delete(sourceArtifactId);
|
|
21236
|
+
}
|
|
21237
|
+
async function readWorkSourceBlob(artifact) {
|
|
21238
|
+
const source = sourceBlobs.get(artifact.id);
|
|
21239
|
+
if (source) return source;
|
|
21240
|
+
throw new Error(artifact.source ? 'The original file is not available in this browser session. Register it again before opening or exporting this source-backed artifact.' : 'This document has no original source file.');
|
|
21241
|
+
}
|
|
21242
|
+
async function readVerifiedWorkSourceBytes(artifact) {
|
|
21243
|
+
const source = await readWorkSourceBlob(artifact);
|
|
21244
|
+
const bytes = await source.arrayBuffer();
|
|
21245
|
+
const expected = artifact.source?.fingerprint;
|
|
21246
|
+
if (expected && await workSourceFingerprint(bytes) !== expected) throw new Error('The registered source file does not match the imported source fingerprint.');
|
|
21247
|
+
return bytes;
|
|
21248
|
+
}
|
|
21249
|
+
async function workSourceFingerprint(bytes) {
|
|
21250
|
+
const subtle = globalThis.crypto?.subtle;
|
|
21251
|
+
if (!subtle) throw new Error('SHA-256 source fingerprinting is unavailable.');
|
|
21252
|
+
const digest = new Uint8Array(await subtle.digest('SHA-256', bytes));
|
|
21253
|
+
return `sha256:${Array.from(digest, (value)=>value.toString(16).padStart(2, '0')).join('')}`;
|
|
21254
|
+
}
|
|
21255
|
+
const DOCX_CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
|
|
21256
|
+
async function importWorkDocumentFile(file, extension, context) {
|
|
21257
|
+
let html;
|
|
21258
|
+
if ('docx' === extension) {
|
|
21259
|
+
const importStartedAt = documentImportNow();
|
|
21260
|
+
const arrayBuffer = context?.bytes ?? await file.arrayBuffer();
|
|
21261
|
+
context?.controller.report('parsing', 0.1);
|
|
21262
|
+
const { OoxmlPackage } = await import("./4121.js");
|
|
21263
|
+
const packageStartedAt = documentImportNow();
|
|
21264
|
+
const sourcePackage = await OoxmlPackage.load(arrayBuffer).catch(()=>null);
|
|
21265
|
+
recordDocumentImportMeasure('a3s-office.document.package', packageStartedAt, documentImportNow());
|
|
21266
|
+
const largeSimpleStartedAt = documentImportNow();
|
|
21267
|
+
const { largeSimpleDocxPackageIsCandidate, largeSimpleDocxCompatibilityReport, largeSimpleDocxContent, parseLargeSimpleDocxPackage } = await import("./0~work-docx-large-document-import.js");
|
|
21268
|
+
let largeSimple = null;
|
|
21269
|
+
let largeSimplePath = 'ineligible';
|
|
21270
|
+
if (sourcePackage && largeSimpleDocxPackageIsCandidate(sourcePackage)) {
|
|
21271
|
+
const { parseLargeSimpleDocxInWorker } = await import("./0~work-document-import-worker-client.js");
|
|
21272
|
+
const inflateStartedAt = documentImportNow();
|
|
21273
|
+
const documentXmlBytes = await sourcePackage.bytes('word/document.xml').catch(()=>null);
|
|
21274
|
+
recordDocumentImportMeasure('a3s-office.document.large-simple-inflate', inflateStartedAt, documentImportNow());
|
|
21275
|
+
const workerAttempt = documentXmlBytes ? await parseLargeSimpleDocxInWorker(transferableDocumentXmlBuffer(documentXmlBytes), {}, context?.controller.signal) : null;
|
|
21276
|
+
if (workerAttempt?.status === 'accepted') {
|
|
21277
|
+
largeSimple = workerAttempt.result;
|
|
21278
|
+
largeSimplePath = 'worker';
|
|
21279
|
+
} else if (!workerAttempt) {
|
|
21280
|
+
largeSimple = await parseLargeSimpleDocxPackage(sourcePackage).catch(()=>null);
|
|
21281
|
+
largeSimplePath = largeSimple ? 'synchronous-fallback' : 'ineligible';
|
|
21282
|
+
}
|
|
21283
|
+
}
|
|
21284
|
+
recordDocumentImportMeasure('a3s-office.document.large-simple-inspection', largeSimpleStartedAt, documentImportNow(), {
|
|
21285
|
+
accepted: Boolean(largeSimple),
|
|
21286
|
+
path: largeSimplePath
|
|
21287
|
+
});
|
|
21288
|
+
if (largeSimple) {
|
|
21289
|
+
context?.controller.report('parsing', 0.8);
|
|
21290
|
+
const modelStartedAt = documentImportNow();
|
|
21291
|
+
const { createSchemaValidatedWorkDocumentModel } = await Promise.resolve(work_document_model_namespaceObject);
|
|
21292
|
+
const artifact = createWorkArtifact('blank-document');
|
|
21293
|
+
artifact.title = fileNameWithoutExtension(file.name);
|
|
21294
|
+
const fastContent = largeSimpleDocxContent(largeSimple);
|
|
21295
|
+
artifact.content = {
|
|
21296
|
+
...fastContent,
|
|
21297
|
+
model: createSchemaValidatedWorkDocumentModel(largeSimple.html, largeSimple.root, {
|
|
21298
|
+
initialIntegrityFeatures: 0,
|
|
21299
|
+
previous: fastContent.model
|
|
21300
|
+
})
|
|
21301
|
+
};
|
|
21302
|
+
recordDocumentImportMeasure('a3s-office.document.structured-model', modelStartedAt, documentImportNow(), {
|
|
21303
|
+
logicalBlocks: largeSimple.logicalBlockCount,
|
|
21304
|
+
tableRows: largeSimple.tableRowCount,
|
|
21305
|
+
windowed: true
|
|
21306
|
+
});
|
|
21307
|
+
context?.controller.report('analyzing', 0);
|
|
21308
|
+
artifact.compatibility = largeSimpleDocxCompatibilityReport(file, largeSimple);
|
|
21309
|
+
context?.controller.report('analyzing', 1);
|
|
21310
|
+
artifact.source = {
|
|
21311
|
+
name: file.name,
|
|
21312
|
+
contentType: file.type || DOCX_CONTENT_TYPE,
|
|
21313
|
+
size: file.size,
|
|
21314
|
+
updatedAt: file.lastModified || Date.now(),
|
|
21315
|
+
fingerprint: await workSourceFingerprint(arrayBuffer)
|
|
21316
|
+
};
|
|
21317
|
+
rememberWorkSourceBlob(artifact.id, file);
|
|
21318
|
+
recordDocumentImportMeasure('a3s-office.document.import-total', importStartedAt, documentImportNow(), {
|
|
21319
|
+
path: 'large-simple'
|
|
21320
|
+
});
|
|
21321
|
+
return artifact;
|
|
21322
|
+
}
|
|
21323
|
+
const mammoth = await import("mammoth");
|
|
21324
|
+
const { applyDocxSectionsToHtml, prepareDocxImport, readDocxLayout } = await import("./0~work-docx-import.js");
|
|
21325
|
+
const prepareStartedAt = documentImportNow();
|
|
21326
|
+
const prepared = await prepareDocxImport(arrayBuffer, sourcePackage ?? void 0).catch(()=>null);
|
|
21327
|
+
recordDocumentImportMeasure('a3s-office.document.prepare', prepareStartedAt, documentImportNow());
|
|
21328
|
+
context?.controller.report('parsing', 0.45);
|
|
21329
|
+
const conversionBuffer = prepared?.conversionBuffer ?? arrayBuffer;
|
|
21330
|
+
const input = {
|
|
21331
|
+
arrayBuffer: conversionBuffer,
|
|
21332
|
+
buffer: conversionBuffer
|
|
21333
|
+
};
|
|
21334
|
+
const mammothStartedAt = documentImportNow();
|
|
21335
|
+
const result = await mammoth.convertToHtml(input, {
|
|
21336
|
+
styleMap: [
|
|
21337
|
+
"br[type='page'] => hr.work-page-break[data-page-break='true']:fresh"
|
|
21338
|
+
]
|
|
21339
|
+
});
|
|
21340
|
+
recordDocumentImportMeasure('a3s-office.document.mammoth', mammothStartedAt, documentImportNow());
|
|
21341
|
+
context?.controller.report('parsing', 0.8);
|
|
21342
|
+
const markersStartedAt = documentImportNow();
|
|
21343
|
+
html = prepared ? applyDocxSectionsToHtml(result.value, prepared.sections, prepared.captionMarkers, prepared.bookmarkMarkers, prepared.changeMarkers, prepared.commentMarkers, prepared.fieldMarkers, prepared.tableOfContentsMarkers, prepared.indexMarkers, prepared.equationMarkers, prepared.citationMarkers, prepared.listMarkers, prepared.imageLayoutMarkers, prepared.paragraphIdentityMarkers, prepared.paragraphFormattingChangeMarkers, prepared.paragraphAlignmentMarkers, prepared.runFormattingMarkers, prepared.paragraphDirectionMarkers, prepared.paragraphIndentMarkers, prepared.paragraphSpacingMarkers, prepared.paragraphBorderMarkers, prepared.paragraphShadingMarkers, prepared.paragraphPaginationMarkers, prepared.bibliography, prepared.tabStopMarkers, prepared.tableCellMarkers, prepared.tableRowMarkers, prepared.tableSizingMarkers) : result.value;
|
|
21344
|
+
recordDocumentImportMeasure('a3s-office.document.markers', markersStartedAt, documentImportNow());
|
|
21345
|
+
const layout = prepared ? {
|
|
21346
|
+
...documentContentLayoutProperties(prepared.sections[0].layout),
|
|
21347
|
+
...prepared.pageColor ? {
|
|
21348
|
+
pageColor: prepared.pageColor
|
|
21349
|
+
} : {}
|
|
21350
|
+
} : await readDocxLayout(arrayBuffer).catch(()=>({
|
|
21351
|
+
pageSize: 'a4'
|
|
21352
|
+
}));
|
|
21353
|
+
const { analyzeDocxCompatibility } = await import("./0~work-office-diagnostics.js").then((m)=>m.work_office_diagnostics_namespaceObject);
|
|
21354
|
+
const artifact = createWorkArtifact('blank-document');
|
|
21355
|
+
artifact.title = fileNameWithoutExtension(file.name);
|
|
21356
|
+
const modelStartedAt = documentImportNow();
|
|
21357
|
+
artifact.content = await withStructuredDocumentModel({
|
|
21358
|
+
type: 'document',
|
|
21359
|
+
html,
|
|
21360
|
+
...layout,
|
|
21361
|
+
...prepared?.trackChanges ? {
|
|
21362
|
+
trackChanges: true
|
|
21363
|
+
} : {},
|
|
21364
|
+
...prepared?.commentMarkers.comments.length ? {
|
|
21365
|
+
comments: prepared.commentMarkers.comments
|
|
21366
|
+
} : {},
|
|
21367
|
+
...prepared?.bibliography ? {
|
|
21368
|
+
bibliography: prepared.bibliography
|
|
21369
|
+
} : {}
|
|
21370
|
+
});
|
|
21371
|
+
recordDocumentImportMeasure('a3s-office.document.structured-model', modelStartedAt, documentImportNow(), {
|
|
21372
|
+
windowed: false
|
|
21373
|
+
});
|
|
21374
|
+
context?.controller.report('analyzing', 0);
|
|
21375
|
+
const compatibilityStartedAt = documentImportNow();
|
|
21376
|
+
artifact.compatibility = await analyzeDocxCompatibility(file, result.messages, sourcePackage);
|
|
21377
|
+
recordDocumentImportMeasure('a3s-office.document.compatibility', compatibilityStartedAt, documentImportNow());
|
|
21378
|
+
context?.controller.report('analyzing', 1);
|
|
21379
|
+
artifact.source = {
|
|
21380
|
+
name: file.name,
|
|
21381
|
+
contentType: file.type || DOCX_CONTENT_TYPE,
|
|
21382
|
+
size: file.size,
|
|
21383
|
+
updatedAt: file.lastModified || Date.now(),
|
|
21384
|
+
fingerprint: await workSourceFingerprint(arrayBuffer)
|
|
21385
|
+
};
|
|
21386
|
+
rememberWorkSourceBlob(artifact.id, file);
|
|
21387
|
+
recordDocumentImportMeasure('a3s-office.document.import-total', importStartedAt, documentImportNow(), {
|
|
21388
|
+
path: 'complete'
|
|
21389
|
+
});
|
|
21390
|
+
return artifact;
|
|
21391
|
+
}
|
|
21392
|
+
const source = context ? new TextDecoder().decode(context.bytes) : await file.text();
|
|
21393
|
+
html = 'html' === extension || 'htm' === extension ? source : textToHtml(source);
|
|
21394
|
+
const artifact = createWorkArtifact('blank-document');
|
|
21395
|
+
artifact.title = fileNameWithoutExtension(file.name);
|
|
21396
|
+
artifact.content = await withStructuredDocumentModel({
|
|
21397
|
+
type: 'document',
|
|
21398
|
+
html,
|
|
21399
|
+
pageSize: 'a4'
|
|
21400
|
+
});
|
|
21401
|
+
context?.controller.report('parsing', 1);
|
|
21402
|
+
return artifact;
|
|
21403
|
+
}
|
|
21404
|
+
async function createWorkDocumentBlob(artifact) {
|
|
21405
|
+
if ('document' !== artifact.content.type) throw new Error('当前文件不是文档。');
|
|
21406
|
+
const { materializeWorkDocumentContent } = await Promise.resolve(work_document_model_codec_namespaceObject);
|
|
21407
|
+
const { createDocxBlob } = await import("./0~work-docx-export.js");
|
|
21408
|
+
const sourcePackage = artifact.source ? await readVerifiedWorkSourceBytes(artifact) : void 0;
|
|
21409
|
+
return createDocxBlob(materializeWorkDocumentContent(artifact.content), sourcePackage);
|
|
21410
|
+
}
|
|
21411
|
+
function textToHtml(source) {
|
|
21412
|
+
const blocks = source.replace(/\r\n?/g, '\n').split(/\n{2,}/).map((block)=>block.trim()).filter(Boolean);
|
|
21413
|
+
return blocks.map((block)=>{
|
|
21414
|
+
if (block.startsWith('# ')) return `<h1>${work_document_file_io_escapeHtml(block.slice(2))}</h1>`;
|
|
21415
|
+
if (block.startsWith('## ')) return `<h2>${work_document_file_io_escapeHtml(block.slice(3))}</h2>`;
|
|
21416
|
+
return `<p>${work_document_file_io_escapeHtml(block).replace(/\n/g, '<br>')}</p>`;
|
|
21417
|
+
}).join('');
|
|
21418
|
+
}
|
|
21419
|
+
async function withStructuredDocumentModel(content) {
|
|
21420
|
+
const { createWorkDocumentModelFromContent } = await Promise.resolve(work_document_model_codec_namespaceObject);
|
|
21421
|
+
return createWorkDocumentModelFromContent(content);
|
|
21422
|
+
}
|
|
21423
|
+
function work_document_file_io_escapeHtml(value) {
|
|
21424
|
+
return value.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>');
|
|
21425
|
+
}
|
|
21426
|
+
function documentImportNow() {
|
|
21427
|
+
return globalThis.performance?.now?.() ?? Date.now();
|
|
21428
|
+
}
|
|
21429
|
+
function transferableDocumentXmlBuffer(bytes) {
|
|
21430
|
+
if (0 === bytes.byteOffset && bytes.byteLength === bytes.buffer.byteLength && bytes.buffer instanceof ArrayBuffer) return bytes.buffer;
|
|
21431
|
+
return bytes.slice().buffer;
|
|
21432
|
+
}
|
|
21433
|
+
function recordDocumentImportMeasure(name, start, end, detail) {
|
|
21434
|
+
try {
|
|
21435
|
+
globalThis.performance?.measure(name, {
|
|
21436
|
+
detail,
|
|
21437
|
+
end,
|
|
21438
|
+
start
|
|
21439
|
+
});
|
|
21440
|
+
} catch {}
|
|
21441
|
+
}
|
|
20640
21442
|
function mountWorkLiveDocumentCapture(surface, firstPageIndex = 0, captureHeight) {
|
|
20641
21443
|
const host = document.createElement('div');
|
|
20642
21444
|
host.className = 'work-pdf-export-surface';
|
|
@@ -20736,4 +21538,4 @@ function registerDocumentPageSurfaceGeometry(element, provider) {
|
|
|
20736
21538
|
function documentPageSurfaceGeometryForElement(element) {
|
|
20737
21539
|
return documentPageSurfaceProviders.get(element)?.() ?? null;
|
|
20738
21540
|
}
|
|
20739
|
-
export { DEFAULT_DOCUMENT_TABLE_CELL_FORMAT, DEFAULT_DOCUMENT_TABLE_CELL_MARGINS, DEFAULT_DOCUMENT_TABLE_GEOMETRY, DOCUMENT_BOOKMARK_DUPLICATE_MESSAGE, DOCUMENT_CHUNK_HYDRATION_META, DOCUMENT_CHUNK_PAGINATION_META, DOCUMENT_CHUNK_VISIBLE_IDS_META, DOCUMENT_LEGACY_TEXT_EFFECT_NAMES, DOCUMENT_LEGACY_TEXT_EMBOSS_ATTRIBUTE, DOCUMENT_LEGACY_TEXT_IMPRINT_ATTRIBUTE, DOCUMENT_LEGACY_TEXT_OUTLINE_ATTRIBUTE, DOCUMENT_LEGACY_TEXT_SHADOW_ATTRIBUTE, DOCUMENT_PAGE_BORDER_EDGES, DOCUMENT_PAGE_MARGIN_KEYS, DOCUMENT_STRIKE_STYLE_ATTRIBUTE, DOCUMENT_TABLE_ROW_ID_ATTRIBUTE, DOCUMENT_TABLE_ROW_TEXT_ID_ATTRIBUTE, DOCUMENT_TABLE_STYLE_OPTIONS, DOCUMENT_UNDERLINE_STYLE_ATTRIBUTE, DocumentCharacterFormatting, DocumentEquation, DocumentFontFamily, DocumentHighlight, DocumentImage, DocumentParagraphFormatting, DocumentScriptFontFormatting, DocumentStrike, DocumentSubscript, DocumentSuperscript, DocumentTableRowIdentity, DocumentTextStyle, DocumentUnderline, MAX_DOCUMENT_IMAGE_RELATIVE_HEIGHT, MAX_DOCUMENT_NUMBERING_START, activeDocumentBookmark, activeDocumentSection, activeDocumentTableStyle, applyDocumentImageCropToElement, applyDocumentImageIdentityToElement, applyDocumentImageLayerToElement, applyDocumentImageWrapContourToElement, applyDocumentPageGeometry, applyDocumentTableGeometryToElement, applyDocumentTableRowIdentityToElement, applyDocumentTextCaseStyle, canChangeDocumentIndent, canInsertDocumentComment, canSetDocumentTableRowRepeatHeader, clampDocumentMargin, collectDocumentChanges, collectDocumentCommentAnchors, collectDocumentNotes, collectDocumentTextLayoutParagraphs, createDocumentBibliography, createDocumentEquationElement, createDocumentImageIdentityRegistry, createDocumentNoteElement, createSchemaDerivedWorkDocumentModel,
|
|
21541
|
+
export { DEFAULT_DOCUMENT_TABLE_CELL_FORMAT, DEFAULT_DOCUMENT_TABLE_CELL_MARGINS, DEFAULT_DOCUMENT_TABLE_GEOMETRY, DOCUMENT_BOOKMARK_DUPLICATE_MESSAGE, DOCUMENT_CHUNK_HYDRATION_META, DOCUMENT_CHUNK_PAGINATION_META, DOCUMENT_CHUNK_VISIBLE_IDS_META, DOCUMENT_LEGACY_TEXT_EFFECT_NAMES, DOCUMENT_LEGACY_TEXT_EMBOSS_ATTRIBUTE, DOCUMENT_LEGACY_TEXT_IMPRINT_ATTRIBUTE, DOCUMENT_LEGACY_TEXT_OUTLINE_ATTRIBUTE, DOCUMENT_LEGACY_TEXT_SHADOW_ATTRIBUTE, DOCUMENT_PAGE_BORDER_EDGES, DOCUMENT_PAGE_MARGIN_KEYS, DOCUMENT_PARAGRAPH_CHANGE_ATTRIBUTES, DOCUMENT_PARAGRAPH_FORMAT_ATTRIBUTES, DOCUMENT_STRIKE_STYLE_ATTRIBUTE, DOCUMENT_TABLE_ROW_ID_ATTRIBUTE, DOCUMENT_TABLE_ROW_TEXT_ID_ATTRIBUTE, DOCUMENT_TABLE_STYLE_OPTIONS, DOCUMENT_UNDERLINE_STYLE_ATTRIBUTE, DocumentCharacterFormatting, DocumentEquation, DocumentFontFamily, DocumentHighlight, DocumentImage, DocumentParagraphFormatting, DocumentScriptFontFormatting, DocumentStrike, DocumentSubscript, DocumentSuperscript, DocumentTableRowIdentity, DocumentTextStyle, DocumentUnderline, MAX_DOCUMENT_IMAGE_RELATIVE_HEIGHT, MAX_DOCUMENT_NUMBERING_START, activeDocumentBookmark, activeDocumentSection, activeDocumentTableStyle, applyDocumentImageCropToElement, applyDocumentImageIdentityToElement, applyDocumentImageLayerToElement, applyDocumentImageWrapContourToElement, applyDocumentPageGeometry, applyDocumentTableGeometryToElement, applyDocumentTableRowIdentityToElement, applyDocumentTextCaseStyle, canChangeDocumentIndent, canInsertDocumentComment, canSetDocumentTableRowRepeatHeader, clampDocumentMargin, collectDocumentChanges, collectDocumentCommentAnchors, collectDocumentNotes, collectDocumentTextLayoutParagraphs, createDocumentBibliography, createDocumentEquationElement, createDocumentImageIdentityRegistry, createDocumentNoteElement, createSchemaDerivedWorkDocumentModel, createWorkDocumentBlob, createWorkDocumentExtensions, createWorkDocumentModel, createWorkOfficeDocumentCollaborationBinding as createOfficeDocumentCollaborationBinding, defaultDocumentImageWrapContour, documentAutoLineHeight, documentBookmarkNameExists, documentBookmarkReferenceInstruction, documentBulletListStyle, documentCaptionKind, documentCaptionLabel, documentCharacterPositionDomAttributes, documentCharacterPositionHalfPointsFromElement, documentCharacterPositionPoints, documentCharacterScaleDomAttributes, documentCharacterScalePercentFromElement, documentCharacterSpacingDomAttributes, documentCharacterSpacingPoints, documentCharacterSpacingTwipsFromElement, documentChunkMountedIds, documentCitationCount, documentCitationInstruction, documentCitationStyle, documentCitationStyleDetails, documentCitationTags, documentCitationTagsFromInstruction, documentCommentDraftRange, documentCommentViews, documentContentLayoutProperties, documentEmphasisMarkDomAttributes, documentEmphasisMarkFromElement, documentEquationFromElement, documentEquationText, documentHasIndex, documentHasTableOfContents, documentHiddenTextDomAttributes, documentHiddenTextFromElement, documentHiddenTextKeyboardShortcut, documentImageCropFromElement, documentImageIdentityFromElement, documentImageLayerFromElement, documentImageLayoutFromElement, documentImageLayoutOptions, documentImagePositionFromElement, documentImageProperties, documentImageWrapContourFromElement, documentInitialSectionLayout, documentKerningDomAttributes, documentKerningIsEffective, documentKerningThresholdHalfPointsFromElement, documentKerningThresholdPoints, documentLazyHtmlChunkFragment, documentLazyHtmlProjection, documentLazyHtmlProjectionFingerprint, documentLegacyTextEffectsConflict, documentLegacyTextEffectsCss, documentLegacyTextEffectsDomAttributes, documentLegacyTextEffectsFromElement, documentLegacyTextEffectsFromTextStyleAttributes, documentModelForContent, documentModelForHtml, documentModelHasTrustedInitialIntegrityFeatures, documentModelUsesWindowing, documentNoteKey, documentNoteKind, documentOrderedListState, documentPageBordersVisible, documentPageChromeLegacyFields, documentPageGeometryForLayout, documentPageHorizontalMarginTwips, documentPageMarginBody, documentPageMarginsForLayout, documentPageMetrics, documentPageSurfaceGeometryForElement, documentPaperSizeForGeometry, documentParagraphDirection, documentParagraphIndent, documentParagraphPagination, documentParagraphSpacing, documentParagraphTabStops, documentSectionById, documentSectionDomAttributes, documentSections, documentStrikeDomAttributes, documentStrikeFormattingFromElement, documentStrikeStyle, documentTabLeaderLabel, documentTableBordersFromElement, documentTableCellFormat, documentTableCellMarginOverridesFromElement, documentTableColumnPercentagesFromElement, documentTableGeometryFromElement, documentTableHorizontalAlignment, documentTableRowIdentityFromElement, documentTableRowOptions, documentTableSizing, documentTextCaseFromWordFlags, documentTextCaseKeyboardShortcuts, documentTextLayoutBatches, documentTextStatistics, documentTransactionsOnlyHydrateChunks, documentUnderlineColor, documentUnderlineDomAttributes, documentUnderlineFormattingFromElement, documentUnderlineKeyboardShortcuts, documentUnderlineStyle, documentWordLineHeightFactor, docxBookmarkReferenceTarget, docxDocumentFieldKind, editorDocumentBookmarkReferenceTargets, editorDocumentCaptionTargets, fileNameWithoutExtension, forgetWorkSourceBlob as forgetSourceBlob, importWorkDocumentFile, importedDocumentCharacterFormatting, initializeWorkOfficeDocumentCollaboration as initializeOfficeDocumentCollaboration, invalidateDocumentLazyHtmlProjection, isContourImageLayout, isDocumentCharacterFormatMark, isValidDocumentCitationTag, materializeLazyDocumentEditorRoot, measureDocumentLayoutBlocksIncrementally, millimetersToPixels, mountWorkLiveDocumentCapture, moveWorkSourceBlob, nextDocumentTabAlignment, normalizeDocumentBookmarkName, normalizeDocumentBookmarkNativeId, normalizeDocumentBookmarkReferencesHtml, normalizeDocumentBookmarksHtml, normalizeDocumentCaptionsHtml, normalizeDocumentCharacterPositionHalfPoints, normalizeDocumentCharacterScalePercent, normalizeDocumentCharacterSpacingTwips, normalizeDocumentCitationsHtml, normalizeDocumentColumns, normalizeDocumentEmphasisMark, normalizeDocumentEquation, normalizeDocumentFieldsHtml, normalizeDocumentHiddenText, normalizeDocumentHtml, normalizeDocumentImageAlignment, normalizeDocumentImageCrop, normalizeDocumentImageIdentity, normalizeDocumentImageLayer, normalizeDocumentImageLayoutOptions, normalizeDocumentImagePosition, normalizeDocumentImageWrapContour, normalizeDocumentImageWrapSide, normalizeDocumentKerningThresholdHalfPoints, normalizeDocumentLegacyTextEffect, normalizeDocumentLegacyTextEffects, normalizeDocumentNotesHtml, normalizeDocumentPageBorders, normalizeDocumentPageChrome, normalizeDocumentPageGeometry, normalizeDocumentPageMargins, normalizeDocumentPaperSource, normalizeDocumentParagraphIndent, normalizeDocumentStrikeStyle, normalizeDocumentTabStops, normalizeDocumentTableBorderStyle, normalizeDocumentTableBorderWidth, normalizeDocumentTableRowHeightRule, normalizeDocumentTableRowIdentity, normalizeDocumentTableVerticalAlign, normalizeDocumentTextCase, normalizeDocumentUnderlineColor, normalizeDocumentUnderlineStyle, normalizeTableColor, normalizedTabPosition, pageTwipsToMillimeters, parseDocumentCharacterFormatting, parseDocumentParagraphFormatting, patchDocumentLazyHtmlProjection, positionWorkLiveDocumentCapture, readWorkOfficeDocumentCollaboration as readOfficeDocumentCollaboration, readWorkSourceBlob as readSourceBlob, registerDocumentPageSurfaceGeometry, rememberWorkSourceBlob as registerSourceBlob, renderDocumentAutoLineHeight, renderDocumentTableBorders, renderDocumentTableCellMarginOverrides, resolveAllDocumentChanges, resolveDocumentPageBorders, resolveDocumentPageChrome, resolveDocumentPageMargins, resolveDocumentPageSize, resolveWorkDocumentEditorInput, retainAnchoredDocumentComments, sanitizeDocumentPageChromeHtml, selectedDocumentChunkId, selectedDocumentIndexDraft, selectedDocumentIndexEntry, selectedDocumentIndexOptions, selectedDocumentTableOfContentsOptions, serializeDocumentCharacterFormatting, serializeDocumentParagraphFormatting, serializeDocumentTabStops, serializeWorkDocumentNode, setCustomDocumentColumns, supportedDocxBookmarkReferenceInstruction, syncDocumentContentFromHtml, transferChangedDocumentTextStatistics, uniqueDocumentImageIdentity, updateDocumentColumnWidth, updateDocumentCustomPageMillimeters, updateDocumentGutterPosition, updateDocumentMirrorMargins, updateDocumentPageChromeVariant, updateDocumentPageMarginMillimeters, updateDocumentPageMarginMode, updateDocumentPageOrientation, updateDocumentPaperSizePreset, validateDocumentBookmarkName, windowDocumentModel, workDocumentSchema, workOfficeDocumentCollaborationFragment as officeDocumentCollaborationFragment, work_document_model_codec_createWorkDocumentModelFromContent as createWorkDocumentModelFromContent, work_document_model_codec_materializeWorkDocumentContent as materializeWorkDocumentContent, work_document_model_createSchemaValidatedWorkDocumentModel as createSchemaValidatedWorkDocumentModel, work_document_page_margins_twipsToMillimeters, work_file_download_downloadBlob, work_file_download_safeFileName, wrapsBesideImage };
|