@a3s-lab/office 0.29.0 → 0.30.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 +100 -3
- package/dist/{0~7043.js → 0~7231.js} +160 -2
- package/dist/{0~5093.js → 0~7360.js} +233 -52
- package/dist/0~document-editor.js +1159 -149
- package/dist/0~spreadsheet-editor.js +183 -34
- package/dist/0~work-docx-export.js +299 -11
- package/dist/0~work-docx-import.js +30 -7
- package/dist/0~work-office-diagnostics.js +125 -5
- package/dist/1544.js +13 -1
- package/dist/4104.js +29 -6
- package/dist/4121.js +1939 -1
- package/dist/6282.js +501 -1006
- package/dist/internal/features/work/editors/document-command-catalog.d.ts +18 -0
- package/dist/internal/features/work/editors/document-font-dialog-model.d.ts +5 -2
- package/dist/internal/features/work/editors/document-font-dialog-run-shading-model.d.ts +23 -0
- package/dist/internal/features/work/editors/document-font-dialog-run-shading-section.d.ts +8 -0
- package/dist/internal/features/work/editors/document-page-chrome-ribbon.d.ts +2 -1
- package/dist/internal/features/work/editors/document-proofing-dialog-model.d.ts +22 -0
- package/dist/internal/features/work/editors/document-proofing-dialog.d.ts +7 -0
- package/dist/internal/features/work/editors/document-table-of-contents-dialog.d.ts +10 -0
- package/dist/internal/features/work/editors/document-toolbar.d.ts +3 -1
- package/dist/internal/features/work/editors/spreadsheet-data-validation.d.ts +7 -1
- package/dist/internal/features/work/editors/use-document-insert-commands.d.ts +2 -0
- package/dist/internal/features/work/work-document-character-formatting.d.ts +8 -0
- package/dist/internal/features/work/work-document-format-changes.d.ts +6 -0
- package/dist/internal/features/work/work-document-highlight.d.ts +9 -0
- package/dist/internal/features/work/work-document-outline.d.ts +1 -0
- package/dist/internal/features/work/work-document-paragraph-shading.d.ts +6 -0
- package/dist/internal/features/work/work-document-proofing.d.ts +19 -0
- package/dist/internal/features/work/work-document-run-shading.d.ts +12 -0
- package/dist/internal/features/work/work-document-table-of-contents-node.d.ts +18 -0
- package/dist/internal/features/work/work-document-table-of-contents.d.ts +51 -0
- package/dist/internal/features/work/work-document-word-line-metrics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-field-instructions.d.ts +1 -1
- package/dist/internal/features/work/work-docx-import.d.ts +3 -1
- package/dist/internal/features/work/work-docx-proofing-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-proofing.d.ts +38 -0
- package/dist/internal/features/work/work-docx-run-formatting-import.d.ts +7 -0
- package/dist/internal/features/work/work-docx-run-shading-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-run-shading-export.d.ts +17 -0
- package/dist/internal/features/work/work-docx-run-shading.d.ts +20 -0
- package/dist/internal/features/work/work-docx-table-of-contents-export.d.ts +11 -0
- package/dist/internal/features/work/work-docx-table-of-contents-import.d.ts +15 -0
- package/dist/internal/features/work/work-spreadsheet-data-validation.d.ts +7 -0
- package/dist/internal/features/work/work-types.d.ts +9 -0
- package/dist/internal/kernel/office-kernel-protocol.d.ts +1 -0
- package/dist/office-kernel.wasm +0 -0
- package/dist/styles.css +311 -4
- package/docs/latest/en/browser-editor-architecture.md +50 -1
- package/package.json +12 -2
package/dist/6282.js
CHANGED
|
@@ -21,7 +21,7 @@ import { CellSelection, TableMap, isInTable, selectedRect } from "@tiptap/pm/tab
|
|
|
21
21
|
import font_family from "@tiptap/extension-text-style/font-family";
|
|
22
22
|
import { TextStyle } from "@tiptap/extension-text-style";
|
|
23
23
|
import extension_highlight from "@tiptap/extension-highlight";
|
|
24
|
-
import { documentRunBorderDomAttributes,
|
|
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
25
|
import { workOfficeCollaborationJsonEqual, canonicalWorkOfficeCollaborationJson, isWorkOfficeCollaborationRecord, cloneWorkOfficeCollaborationJson } from "./4650.js";
|
|
26
26
|
import { assertWorkOfficeCollaborationEditable, markWorkOfficeCollaborationInitialized, assertWorkOfficeCollaborationOrigin, initializeWorkOfficeCollaborationMetadata, assertWorkOfficeCollaborationWritable, OfficeCollaborationError as WorkOfficeCollaborationError, readOfficeCollaborationMetadata as readWorkOfficeCollaborationMetadata, registerWorkOfficeCollaborationInitializer } from "./9787.js";
|
|
27
27
|
import * as __rspack_external_yjs from "yjs";
|
|
@@ -195,71 +195,6 @@ function normalizedReferenceText(value) {
|
|
|
195
195
|
function stringAttribute(value) {
|
|
196
196
|
return 'string' == typeof value ? value.trim() : '';
|
|
197
197
|
}
|
|
198
|
-
const DOCUMENT_INTEGRITY_BOOKMARK = 1;
|
|
199
|
-
const DOCUMENT_INTEGRITY_FIELD = 2;
|
|
200
|
-
const DOCUMENT_INTEGRITY_IMAGE = 4;
|
|
201
|
-
const DOCUMENT_INTEGRITY_NOTE = 8;
|
|
202
|
-
const DOCUMENT_INTEGRITY_PARAGRAPH_IDENTITY = 16;
|
|
203
|
-
const DOCUMENT_INTEGRITY_TABLE_ROW_IDENTITY = 32;
|
|
204
|
-
const featureCache = new WeakMap();
|
|
205
|
-
function documentHasIntegrityFeature(document1, feature) {
|
|
206
|
-
return (documentIntegrityFeatures(document1, true) & feature) !== 0;
|
|
207
|
-
}
|
|
208
|
-
function primeDocumentIntegrityFeatures(document1) {
|
|
209
|
-
document1.forEach(primeDocumentIntegrityNode);
|
|
210
|
-
}
|
|
211
|
-
function primeDocumentIntegrityNode(node) {
|
|
212
|
-
if ('documentChunk' === node.type.name) {
|
|
213
|
-
const features = nonNegativeInteger(node.attrs.integrityFeatures);
|
|
214
|
-
if (null !== features) featureCache.set(node, features);
|
|
215
|
-
if (true !== node.attrs.windowContainer) return;
|
|
216
|
-
}
|
|
217
|
-
node.forEach(primeDocumentIntegrityNode);
|
|
218
|
-
}
|
|
219
|
-
function documentIntegrityFeatures(node, cacheNode) {
|
|
220
|
-
if (cacheNode) {
|
|
221
|
-
const cached = featureCache.get(node);
|
|
222
|
-
if (void 0 !== cached) return cached;
|
|
223
|
-
}
|
|
224
|
-
let features = nodeIntegrityFeatures(node);
|
|
225
|
-
node.forEach((child)=>{
|
|
226
|
-
features |= documentIntegrityFeatures(child, 'documentChunk' === child.type.name);
|
|
227
|
-
});
|
|
228
|
-
if (cacheNode) featureCache.set(node, features);
|
|
229
|
-
return features;
|
|
230
|
-
}
|
|
231
|
-
function nodeIntegrityFeatures(node) {
|
|
232
|
-
let features = 0;
|
|
233
|
-
switch(node.type.name){
|
|
234
|
-
case 'documentBookmarkBoundary':
|
|
235
|
-
features |= DOCUMENT_INTEGRITY_BOOKMARK;
|
|
236
|
-
break;
|
|
237
|
-
case 'documentCrossReference':
|
|
238
|
-
if ('bookmark' === node.attrs.targetType) features |= DOCUMENT_INTEGRITY_BOOKMARK;
|
|
239
|
-
break;
|
|
240
|
-
case 'documentField':
|
|
241
|
-
features |= DOCUMENT_INTEGRITY_FIELD;
|
|
242
|
-
break;
|
|
243
|
-
case 'image':
|
|
244
|
-
features |= DOCUMENT_INTEGRITY_IMAGE;
|
|
245
|
-
break;
|
|
246
|
-
case 'documentNote':
|
|
247
|
-
case 'documentNoteReference':
|
|
248
|
-
features |= DOCUMENT_INTEGRITY_NOTE;
|
|
249
|
-
break;
|
|
250
|
-
}
|
|
251
|
-
if (node.isText && node.marks.some((mark)=>'link' === mark.type.name && 'string' == typeof mark.attrs.href && mark.attrs.href.startsWith('#'))) features |= DOCUMENT_INTEGRITY_BOOKMARK;
|
|
252
|
-
if (identityComponent(node.attrs.paragraphId) || identityComponent(node.attrs.textId)) features |= DOCUMENT_INTEGRITY_PARAGRAPH_IDENTITY;
|
|
253
|
-
if (identityComponent(node.attrs.rowId) || identityComponent(node.attrs.rowTextId)) features |= DOCUMENT_INTEGRITY_TABLE_ROW_IDENTITY;
|
|
254
|
-
return features;
|
|
255
|
-
}
|
|
256
|
-
function identityComponent(value) {
|
|
257
|
-
return 'string' == typeof value && value.trim().length > 0;
|
|
258
|
-
}
|
|
259
|
-
function nonNegativeInteger(value) {
|
|
260
|
-
const number = Number(value);
|
|
261
|
-
return Number.isSafeInteger(number) && number >= 0 ? number : null;
|
|
262
|
-
}
|
|
263
198
|
const BOOKMARK_NAME_PATTERN = /^[\p{L}_][\p{L}\p{N}_]*$/u;
|
|
264
199
|
const BOOKMARK_UI_NAME_PATTERN = /^[\p{L}][\p{L}\p{N}_]*$/u;
|
|
265
200
|
const MAX_BOOKMARK_NAME_LENGTH = 40;
|
|
@@ -1898,7 +1833,7 @@ function createSchemaValidatedWorkDocumentModel(html, root, options = {}) {
|
|
|
1898
1833
|
schemaValidatedDocumentModels.set(model, {
|
|
1899
1834
|
html,
|
|
1900
1835
|
htmlFingerprint: model.htmlFingerprint,
|
|
1901
|
-
initialIntegrityFeatures:
|
|
1836
|
+
initialIntegrityFeatures: nonNegativeInteger(options.initialIntegrityFeatures),
|
|
1902
1837
|
root
|
|
1903
1838
|
});
|
|
1904
1839
|
return model;
|
|
@@ -1947,7 +1882,7 @@ function nextRevision(previous) {
|
|
|
1947
1882
|
const revision = previous?.schema === DOCUMENT_MODEL_SCHEMA && previous.version === DOCUMENT_MODEL_VERSION && Number.isSafeInteger(previous.revision) && previous.revision > 0 ? previous.revision : 0;
|
|
1948
1883
|
return revision >= Number.MAX_SAFE_INTEGER ? 1 : revision + 1;
|
|
1949
1884
|
}
|
|
1950
|
-
function
|
|
1885
|
+
function nonNegativeInteger(value) {
|
|
1951
1886
|
const number = Number(value);
|
|
1952
1887
|
return Number.isSafeInteger(number) && number >= 0 ? number : null;
|
|
1953
1888
|
}
|
|
@@ -6624,506 +6559,6 @@ function formatHexIdentifier(value) {
|
|
|
6624
6559
|
function formatWordprocessingIdentifier(value) {
|
|
6625
6560
|
return formatHexIdentifier(value & MAX_WORDPROCESSING_ID || 1);
|
|
6626
6561
|
}
|
|
6627
|
-
const DOCUMENT_PARAGRAPH_ID_ATTRIBUTE = 'data-office-paragraph-id';
|
|
6628
|
-
const DOCUMENT_PARAGRAPH_TEXT_ID_ATTRIBUTE = 'data-office-paragraph-text-id';
|
|
6629
|
-
const PARAGRAPH_ID_PATTERN = /^[0-9A-F]{8}$/;
|
|
6630
|
-
const MAX_PARAGRAPH_ID = 0x7fffffff;
|
|
6631
|
-
let work_document_paragraph_identity_fallbackIdentitySequence = 0;
|
|
6632
|
-
const DocumentParagraphIdentity = Extension.create({
|
|
6633
|
-
name: 'documentParagraphIdentity',
|
|
6634
|
-
addOptions () {
|
|
6635
|
-
return {
|
|
6636
|
-
rotateTextId: ()=>true,
|
|
6637
|
-
types: [
|
|
6638
|
-
'paragraph',
|
|
6639
|
-
'heading',
|
|
6640
|
-
'documentCaption'
|
|
6641
|
-
]
|
|
6642
|
-
};
|
|
6643
|
-
},
|
|
6644
|
-
addGlobalAttributes () {
|
|
6645
|
-
return [
|
|
6646
|
-
{
|
|
6647
|
-
types: this.options.types,
|
|
6648
|
-
attributes: {
|
|
6649
|
-
paragraphId: {
|
|
6650
|
-
default: null,
|
|
6651
|
-
parseHTML: (element)=>normalizeDocumentParagraphId(element.getAttribute(DOCUMENT_PARAGRAPH_ID_ATTRIBUTE)),
|
|
6652
|
-
renderHTML: (attributes)=>{
|
|
6653
|
-
const value = normalizeDocumentParagraphId(attributes.paragraphId);
|
|
6654
|
-
return value ? {
|
|
6655
|
-
[DOCUMENT_PARAGRAPH_ID_ATTRIBUTE]: value
|
|
6656
|
-
} : {};
|
|
6657
|
-
}
|
|
6658
|
-
},
|
|
6659
|
-
textId: {
|
|
6660
|
-
default: null,
|
|
6661
|
-
parseHTML: (element)=>normalizeDocumentParagraphId(element.getAttribute(DOCUMENT_PARAGRAPH_TEXT_ID_ATTRIBUTE)),
|
|
6662
|
-
renderHTML: (attributes)=>{
|
|
6663
|
-
const value = normalizeDocumentParagraphId(attributes.textId);
|
|
6664
|
-
return value ? {
|
|
6665
|
-
[DOCUMENT_PARAGRAPH_TEXT_ID_ATTRIBUTE]: value
|
|
6666
|
-
} : {};
|
|
6667
|
-
}
|
|
6668
|
-
}
|
|
6669
|
-
}
|
|
6670
|
-
}
|
|
6671
|
-
];
|
|
6672
|
-
},
|
|
6673
|
-
addProseMirrorPlugins () {
|
|
6674
|
-
return [
|
|
6675
|
-
createDocumentParagraphIdentityPlugin(this.options.types, this.options.rotateTextId)
|
|
6676
|
-
];
|
|
6677
|
-
}
|
|
6678
|
-
});
|
|
6679
|
-
function normalizeDocumentParagraphId(value) {
|
|
6680
|
-
if ('string' != typeof value) return null;
|
|
6681
|
-
const normalized = value.trim().toUpperCase();
|
|
6682
|
-
if (!PARAGRAPH_ID_PATTERN.test(normalized)) return null;
|
|
6683
|
-
const number = Number.parseInt(normalized, 16);
|
|
6684
|
-
return number > 0 && number <= MAX_PARAGRAPH_ID ? normalized : null;
|
|
6685
|
-
}
|
|
6686
|
-
function createDocumentParagraphIdentityRegistry() {
|
|
6687
|
-
return {
|
|
6688
|
-
paragraphIds: new Set()
|
|
6689
|
-
};
|
|
6690
|
-
}
|
|
6691
|
-
function normalizeDocumentParagraphIdentity(source) {
|
|
6692
|
-
const paragraphId = normalizeDocumentParagraphId(source.paragraphId);
|
|
6693
|
-
const textId = normalizeDocumentParagraphId(source.textId);
|
|
6694
|
-
return paragraphId && textId ? {
|
|
6695
|
-
paragraphId,
|
|
6696
|
-
textId
|
|
6697
|
-
} : null;
|
|
6698
|
-
}
|
|
6699
|
-
function documentParagraphIdentityFromElement(element) {
|
|
6700
|
-
return normalizeDocumentParagraphIdentity({
|
|
6701
|
-
paragraphId: element.getAttribute(DOCUMENT_PARAGRAPH_ID_ATTRIBUTE),
|
|
6702
|
-
textId: element.getAttribute(DOCUMENT_PARAGRAPH_TEXT_ID_ATTRIBUTE)
|
|
6703
|
-
});
|
|
6704
|
-
}
|
|
6705
|
-
function applyDocumentParagraphIdentityToElement(element, source) {
|
|
6706
|
-
const identity = normalizeDocumentParagraphIdentity(source);
|
|
6707
|
-
if (!identity) {
|
|
6708
|
-
element.removeAttribute(DOCUMENT_PARAGRAPH_ID_ATTRIBUTE);
|
|
6709
|
-
element.removeAttribute(DOCUMENT_PARAGRAPH_TEXT_ID_ATTRIBUTE);
|
|
6710
|
-
return null;
|
|
6711
|
-
}
|
|
6712
|
-
element.setAttribute(DOCUMENT_PARAGRAPH_ID_ATTRIBUTE, identity.paragraphId);
|
|
6713
|
-
element.setAttribute(DOCUMENT_PARAGRAPH_TEXT_ID_ATTRIBUTE, identity.textId);
|
|
6714
|
-
return identity;
|
|
6715
|
-
}
|
|
6716
|
-
function createDocumentParagraphIdentityPlugin(types, rotateTextId) {
|
|
6717
|
-
const trackedTypes = new Set(types);
|
|
6718
|
-
return new Plugin({
|
|
6719
|
-
view (view) {
|
|
6720
|
-
const transaction = normalizeDocumentParagraphIdentities(view.state, trackedTypes, rotateTextId);
|
|
6721
|
-
if (transaction) {
|
|
6722
|
-
transaction.setMeta('addToHistory', false);
|
|
6723
|
-
view.dispatch(transaction);
|
|
6724
|
-
}
|
|
6725
|
-
return {};
|
|
6726
|
-
},
|
|
6727
|
-
appendTransaction (transactions, oldState, newState) {
|
|
6728
|
-
if (!transactions.some((transaction)=>transaction.docChanged)) return null;
|
|
6729
|
-
return normalizeDocumentParagraphIdentities(newState, trackedTypes, rotateTextId, oldState, transactions);
|
|
6730
|
-
}
|
|
6731
|
-
});
|
|
6732
|
-
}
|
|
6733
|
-
function normalizeDocumentParagraphIdentities(state, trackedTypes, rotateTextId, oldState, transactions = []) {
|
|
6734
|
-
if (!documentHasIntegrityFeature(state.doc, 16)) return null;
|
|
6735
|
-
const paragraphs = documentParagraphs(state.doc, trackedTypes);
|
|
6736
|
-
if (!paragraphs.length) return null;
|
|
6737
|
-
const retainedPositions = oldState ? retainedDocumentParagraphPositions(oldState, state, transactions, trackedTypes) : new Set();
|
|
6738
|
-
const editedPositions = oldState && rotateTextId() && !transactions.some(isHistoryTransaction) ? editedDocumentParagraphPositions(oldState, state, transactions, trackedTypes) : new Set();
|
|
6739
|
-
const ordered = [
|
|
6740
|
-
...paragraphs.filter((item)=>retainedPositions.has(item.position)),
|
|
6741
|
-
...paragraphs.filter((item)=>!retainedPositions.has(item.position))
|
|
6742
|
-
];
|
|
6743
|
-
const registry = createDocumentParagraphIdentityRegistry();
|
|
6744
|
-
const updates = new Map();
|
|
6745
|
-
for (const paragraph of ordered){
|
|
6746
|
-
const current = paragraphIdentitySourceFromNode(paragraph.node);
|
|
6747
|
-
const source = editedPositions.has(paragraph.position) ? {
|
|
6748
|
-
...current,
|
|
6749
|
-
textId: nextDocumentParagraphTextId(current.textId)
|
|
6750
|
-
} : current;
|
|
6751
|
-
const identity = uniqueDocumentParagraphIdentity(source, registry);
|
|
6752
|
-
if (!sameDocumentParagraphIdentity(current, identity)) updates.set(paragraph.position, identity);
|
|
6753
|
-
}
|
|
6754
|
-
if (!updates.size) return null;
|
|
6755
|
-
const transaction = state.tr;
|
|
6756
|
-
for (const paragraph of paragraphs){
|
|
6757
|
-
const identity = updates.get(paragraph.position);
|
|
6758
|
-
if (identity) transaction.setNodeMarkup(paragraph.position, void 0, {
|
|
6759
|
-
...paragraph.node.attrs,
|
|
6760
|
-
...identity
|
|
6761
|
-
});
|
|
6762
|
-
}
|
|
6763
|
-
if (!transaction.docChanged) return null;
|
|
6764
|
-
transaction.setMeta('addToHistory', false);
|
|
6765
|
-
return transaction;
|
|
6766
|
-
}
|
|
6767
|
-
function hasDocumentParagraphIdentityComponent(node) {
|
|
6768
|
-
return Boolean(normalizeDocumentParagraphId(node.attrs.paragraphId) || normalizeDocumentParagraphId(node.attrs.textId));
|
|
6769
|
-
}
|
|
6770
|
-
function retainedDocumentParagraphPositions(oldState, newState, transactions, trackedTypes) {
|
|
6771
|
-
const mapping = work_document_paragraph_identity_transactionMapping(transactions);
|
|
6772
|
-
const retained = new Set();
|
|
6773
|
-
for (const previous of documentParagraphs(oldState.doc, trackedTypes)){
|
|
6774
|
-
const paragraphId = normalizeDocumentParagraphId(previous.node.attrs.paragraphId);
|
|
6775
|
-
if (!paragraphId) continue;
|
|
6776
|
-
const mapped = mapping.mapResult(previous.position, 1);
|
|
6777
|
-
const current = newState.doc.nodeAt(mapped.pos);
|
|
6778
|
-
if (current && trackedTypes.has(current.type.name) && normalizeDocumentParagraphId(current.attrs.paragraphId) === paragraphId) retained.add(mapped.pos);
|
|
6779
|
-
}
|
|
6780
|
-
return retained;
|
|
6781
|
-
}
|
|
6782
|
-
function editedDocumentParagraphPositions(oldState, newState, transactions, trackedTypes) {
|
|
6783
|
-
const mapping = work_document_paragraph_identity_transactionMapping(transactions);
|
|
6784
|
-
const previousParagraphs = documentParagraphs(oldState.doc, trackedTypes);
|
|
6785
|
-
const currentParagraphs = documentParagraphs(newState.doc, trackedTypes);
|
|
6786
|
-
const previousById = paragraphsById(previousParagraphs);
|
|
6787
|
-
const currentById = paragraphsById(currentParagraphs);
|
|
6788
|
-
const edited = new Set();
|
|
6789
|
-
for (const previous of previousParagraphs){
|
|
6790
|
-
const identity = normalizeDocumentParagraphIdentity(paragraphIdentitySourceFromNode(previous.node));
|
|
6791
|
-
if (!identity) continue;
|
|
6792
|
-
const mapped = mapping.mapResult(previous.position, 1);
|
|
6793
|
-
const current = newState.doc.nodeAt(mapped.pos);
|
|
6794
|
-
if (current && trackedTypes.has(current.type.name) && normalizeDocumentParagraphId(current.attrs.paragraphId) === identity.paragraphId) {
|
|
6795
|
-
if (paragraphTextChanged(previous.node, current, identity.textId)) edited.add(mapped.pos);
|
|
6796
|
-
continue;
|
|
6797
|
-
}
|
|
6798
|
-
const previousMatches = previousById.get(identity.paragraphId) ?? [];
|
|
6799
|
-
const currentMatches = currentById.get(identity.paragraphId) ?? [];
|
|
6800
|
-
if (1 === previousMatches.length && 1 === currentMatches.length && paragraphTextChanged(previous.node, currentMatches[0].node, identity.textId)) edited.add(currentMatches[0].position);
|
|
6801
|
-
}
|
|
6802
|
-
return edited;
|
|
6803
|
-
}
|
|
6804
|
-
function paragraphTextChanged(previous, current, previousTextId) {
|
|
6805
|
-
return previous.textContent !== current.textContent && normalizeDocumentParagraphId(current.attrs.textId) === previousTextId;
|
|
6806
|
-
}
|
|
6807
|
-
function paragraphsById(paragraphs) {
|
|
6808
|
-
const result = new Map();
|
|
6809
|
-
for (const paragraph of paragraphs){
|
|
6810
|
-
const id = normalizeDocumentParagraphId(paragraph.node.attrs.paragraphId);
|
|
6811
|
-
if (!id) continue;
|
|
6812
|
-
const matches = result.get(id) ?? [];
|
|
6813
|
-
matches.push(paragraph);
|
|
6814
|
-
result.set(id, matches);
|
|
6815
|
-
}
|
|
6816
|
-
return result;
|
|
6817
|
-
}
|
|
6818
|
-
function documentParagraphs(document1, trackedTypes) {
|
|
6819
|
-
const paragraphs = [];
|
|
6820
|
-
document1.descendants((node, position)=>{
|
|
6821
|
-
if (trackedTypes.has(node.type.name) && hasDocumentParagraphIdentityComponent(node)) paragraphs.push({
|
|
6822
|
-
node,
|
|
6823
|
-
position
|
|
6824
|
-
});
|
|
6825
|
-
});
|
|
6826
|
-
return paragraphs;
|
|
6827
|
-
}
|
|
6828
|
-
function paragraphIdentitySourceFromNode(node) {
|
|
6829
|
-
return {
|
|
6830
|
-
paragraphId: node.attrs.paragraphId,
|
|
6831
|
-
textId: node.attrs.textId
|
|
6832
|
-
};
|
|
6833
|
-
}
|
|
6834
|
-
function uniqueDocumentParagraphIdentity(source, registry) {
|
|
6835
|
-
const preferred = normalizeDocumentParagraphIdentity(source);
|
|
6836
|
-
if (preferred && !registry.paragraphIds.has(preferred.paragraphId)) {
|
|
6837
|
-
registry.paragraphIds.add(preferred.paragraphId);
|
|
6838
|
-
return preferred;
|
|
6839
|
-
}
|
|
6840
|
-
for(let attempt = 0; attempt < 8; attempt += 1){
|
|
6841
|
-
const identity = createDocumentParagraphIdentity();
|
|
6842
|
-
if (!registry.paragraphIds.has(identity.paragraphId)) {
|
|
6843
|
-
registry.paragraphIds.add(identity.paragraphId);
|
|
6844
|
-
return identity;
|
|
6845
|
-
}
|
|
6846
|
-
}
|
|
6847
|
-
return sequentialDocumentParagraphIdentity(registry);
|
|
6848
|
-
}
|
|
6849
|
-
function createDocumentParagraphIdentity() {
|
|
6850
|
-
return {
|
|
6851
|
-
paragraphId: randomDocumentParagraphId(),
|
|
6852
|
-
textId: randomDocumentParagraphId()
|
|
6853
|
-
};
|
|
6854
|
-
}
|
|
6855
|
-
function sequentialDocumentParagraphIdentity(registry) {
|
|
6856
|
-
for(let value = 1; value <= MAX_PARAGRAPH_ID; value += 1){
|
|
6857
|
-
const paragraphId = formatDocumentParagraphId(value);
|
|
6858
|
-
if (!registry.paragraphIds.has(paragraphId)) {
|
|
6859
|
-
registry.paragraphIds.add(paragraphId);
|
|
6860
|
-
return {
|
|
6861
|
-
paragraphId,
|
|
6862
|
-
textId: randomDocumentParagraphId()
|
|
6863
|
-
};
|
|
6864
|
-
}
|
|
6865
|
-
}
|
|
6866
|
-
throw new Error('No unique Word paragraph identity is available.');
|
|
6867
|
-
}
|
|
6868
|
-
function nextDocumentParagraphTextId(value) {
|
|
6869
|
-
const current = normalizeDocumentParagraphId(value);
|
|
6870
|
-
if (!current) return randomDocumentParagraphId();
|
|
6871
|
-
const number = Number.parseInt(current, 16);
|
|
6872
|
-
return formatDocumentParagraphId(number >= MAX_PARAGRAPH_ID ? 1 : number + 1);
|
|
6873
|
-
}
|
|
6874
|
-
function randomDocumentParagraphId() {
|
|
6875
|
-
let value = 0;
|
|
6876
|
-
const cryptoApi = globalThis.crypto;
|
|
6877
|
-
if ('function' == typeof cryptoApi?.getRandomValues) {
|
|
6878
|
-
const values = new Uint32Array(1);
|
|
6879
|
-
cryptoApi.getRandomValues(values);
|
|
6880
|
-
value = values[0] ?? 0;
|
|
6881
|
-
} else if ('function' == typeof cryptoApi?.randomUUID) value = Number.parseInt(cryptoApi.randomUUID().replaceAll('-', '').slice(0, 8), 16);
|
|
6882
|
-
if (!value) {
|
|
6883
|
-
work_document_paragraph_identity_fallbackIdentitySequence += 1;
|
|
6884
|
-
value = work_document_paragraph_identity_stableIdentityHash(`${Date.now()}:${Math.random()}:${work_document_paragraph_identity_fallbackIdentitySequence}`);
|
|
6885
|
-
}
|
|
6886
|
-
return formatDocumentParagraphId(value || work_document_paragraph_identity_fallbackIdentitySequence || 1);
|
|
6887
|
-
}
|
|
6888
|
-
function work_document_paragraph_identity_stableIdentityHash(value) {
|
|
6889
|
-
let hash = 0x811c9dc5;
|
|
6890
|
-
for(let index = 0; index < value.length; index += 1){
|
|
6891
|
-
hash ^= value.charCodeAt(index);
|
|
6892
|
-
hash = Math.imul(hash, 0x01000193);
|
|
6893
|
-
}
|
|
6894
|
-
return hash >>> 0 || 1;
|
|
6895
|
-
}
|
|
6896
|
-
function formatDocumentParagraphId(value) {
|
|
6897
|
-
return (value >>> 0 & MAX_PARAGRAPH_ID || 1).toString(16).toUpperCase().padStart(8, '0');
|
|
6898
|
-
}
|
|
6899
|
-
function sameDocumentParagraphIdentity(source, identity) {
|
|
6900
|
-
return normalizeDocumentParagraphId(source.paragraphId) === identity.paragraphId && normalizeDocumentParagraphId(source.textId) === identity.textId;
|
|
6901
|
-
}
|
|
6902
|
-
function work_document_paragraph_identity_transactionMapping(transactions) {
|
|
6903
|
-
const mapping = new Mapping();
|
|
6904
|
-
for (const transaction of transactions)mapping.appendMapping(transaction.mapping);
|
|
6905
|
-
return mapping;
|
|
6906
|
-
}
|
|
6907
|
-
const DOCUMENT_PARAGRAPH_SHADING_PATTERNS = new Set([
|
|
6908
|
-
'nil',
|
|
6909
|
-
'clear',
|
|
6910
|
-
'solid',
|
|
6911
|
-
'horzStripe',
|
|
6912
|
-
'vertStripe',
|
|
6913
|
-
'reverseDiagStripe',
|
|
6914
|
-
'diagStripe',
|
|
6915
|
-
'horzCross',
|
|
6916
|
-
'diagCross',
|
|
6917
|
-
'thinHorzStripe',
|
|
6918
|
-
'thinVertStripe',
|
|
6919
|
-
'thinReverseDiagStripe',
|
|
6920
|
-
'thinDiagStripe',
|
|
6921
|
-
'thinHorzCross',
|
|
6922
|
-
'thinDiagCross',
|
|
6923
|
-
'pct5',
|
|
6924
|
-
'pct10',
|
|
6925
|
-
'pct12',
|
|
6926
|
-
'pct15',
|
|
6927
|
-
'pct20',
|
|
6928
|
-
'pct25',
|
|
6929
|
-
'pct30',
|
|
6930
|
-
'pct35',
|
|
6931
|
-
'pct37',
|
|
6932
|
-
'pct40',
|
|
6933
|
-
'pct45',
|
|
6934
|
-
'pct50',
|
|
6935
|
-
'pct55',
|
|
6936
|
-
'pct60',
|
|
6937
|
-
'pct62',
|
|
6938
|
-
'pct65',
|
|
6939
|
-
'pct70',
|
|
6940
|
-
'pct75',
|
|
6941
|
-
'pct80',
|
|
6942
|
-
'pct85',
|
|
6943
|
-
'pct87',
|
|
6944
|
-
'pct90',
|
|
6945
|
-
'pct95'
|
|
6946
|
-
]);
|
|
6947
|
-
function normalizeDocumentParagraphShading(source) {
|
|
6948
|
-
if (!source || 'object' != typeof source) return null;
|
|
6949
|
-
const value = source;
|
|
6950
|
-
const pattern = value.pattern;
|
|
6951
|
-
if ('string' != typeof pattern || !DOCUMENT_PARAGRAPH_SHADING_PATTERNS.has(pattern)) return null;
|
|
6952
|
-
const color = normalizeShadingColor(value.color);
|
|
6953
|
-
const fill = normalizeShadingColor(value.fill);
|
|
6954
|
-
if (void 0 !== value.color && !color || void 0 !== value.fill && !fill) return null;
|
|
6955
|
-
return {
|
|
6956
|
-
pattern: pattern,
|
|
6957
|
-
...color ? {
|
|
6958
|
-
color
|
|
6959
|
-
} : {},
|
|
6960
|
-
...fill ? {
|
|
6961
|
-
fill
|
|
6962
|
-
} : {}
|
|
6963
|
-
};
|
|
6964
|
-
}
|
|
6965
|
-
function parseDocumentParagraphShading(source) {
|
|
6966
|
-
if ('string' != typeof source) return normalizeDocumentParagraphShading(source);
|
|
6967
|
-
if (!source.trim()) return null;
|
|
6968
|
-
try {
|
|
6969
|
-
return normalizeDocumentParagraphShading(JSON.parse(source));
|
|
6970
|
-
} catch {
|
|
6971
|
-
return null;
|
|
6972
|
-
}
|
|
6973
|
-
}
|
|
6974
|
-
function serializeDocumentParagraphShading(source) {
|
|
6975
|
-
const shading = normalizeDocumentParagraphShading(source);
|
|
6976
|
-
if (!shading) return;
|
|
6977
|
-
return JSON.stringify({
|
|
6978
|
-
pattern: shading.pattern,
|
|
6979
|
-
...shading.color ? {
|
|
6980
|
-
color: serializedShadingColor(shading.color)
|
|
6981
|
-
} : {},
|
|
6982
|
-
...shading.fill ? {
|
|
6983
|
-
fill: serializedShadingColor(shading.fill)
|
|
6984
|
-
} : {}
|
|
6985
|
-
});
|
|
6986
|
-
}
|
|
6987
|
-
function parseDocumentParagraphShadingElement(element) {
|
|
6988
|
-
const semantic = parseDocumentParagraphShading(element.dataset.officeParagraphShading);
|
|
6989
|
-
const background = normalizeCssColor(element.style.backgroundColor);
|
|
6990
|
-
if (semantic) {
|
|
6991
|
-
const presentation = documentParagraphShadingPresentation(semantic);
|
|
6992
|
-
const expected = normalizeCssColor(presentation.backgroundColor);
|
|
6993
|
-
if (background && expected && background !== expected) {
|
|
6994
|
-
if ('transparent' === background) return {
|
|
6995
|
-
pattern: 'nil'
|
|
6996
|
-
};
|
|
6997
|
-
if (paragraphShadingBackgroundUsesForeground(semantic)) return {
|
|
6998
|
-
...semantic,
|
|
6999
|
-
color: {
|
|
7000
|
-
value: background
|
|
7001
|
-
}
|
|
7002
|
-
};
|
|
7003
|
-
return {
|
|
7004
|
-
...semantic,
|
|
7005
|
-
fill: {
|
|
7006
|
-
value: background
|
|
7007
|
-
}
|
|
7008
|
-
};
|
|
7009
|
-
}
|
|
7010
|
-
return semantic;
|
|
7011
|
-
}
|
|
7012
|
-
return background && 'transparent' !== background ? {
|
|
7013
|
-
pattern: 'clear',
|
|
7014
|
-
fill: {
|
|
7015
|
-
value: background
|
|
7016
|
-
}
|
|
7017
|
-
} : null;
|
|
7018
|
-
}
|
|
7019
|
-
function documentParagraphShadingDomAttributes(source) {
|
|
7020
|
-
const shading = normalizeDocumentParagraphShading(source);
|
|
7021
|
-
const serialized = serializeDocumentParagraphShading(shading);
|
|
7022
|
-
if (!shading || !serialized) return {};
|
|
7023
|
-
const presentation = documentParagraphShadingPresentation(shading);
|
|
7024
|
-
const styles = [
|
|
7025
|
-
`background-color: ${presentation.backgroundColor}`,
|
|
7026
|
-
presentation.backgroundImage ? `background-image: ${presentation.backgroundImage}` : '',
|
|
7027
|
-
presentation.backgroundSize ? `background-size: ${presentation.backgroundSize}` : ''
|
|
7028
|
-
].filter(Boolean);
|
|
7029
|
-
return {
|
|
7030
|
-
'data-office-paragraph-shading': serialized,
|
|
7031
|
-
style: styles.join('; ')
|
|
7032
|
-
};
|
|
7033
|
-
}
|
|
7034
|
-
function normalizeShadingColor(source) {
|
|
7035
|
-
if (!source || 'object' != typeof source) return null;
|
|
7036
|
-
const value = source;
|
|
7037
|
-
const theme = parseDocxThemeReference('string' == typeof value.theme ? value.theme : value.theme ? JSON.stringify(value.theme) : void 0);
|
|
7038
|
-
const direct = 'auto' === value.value ? 'auto' : 'string' == typeof value.value ? normalizeCssColor(value.value) : null;
|
|
7039
|
-
const resolved = direct ?? theme?.resolved ?? null;
|
|
7040
|
-
if (!resolved || 'transparent' === resolved) return null;
|
|
7041
|
-
if (theme && resolved !== theme.resolved) return null;
|
|
7042
|
-
return {
|
|
7043
|
-
value: resolved,
|
|
7044
|
-
...theme ? {
|
|
7045
|
-
theme
|
|
7046
|
-
} : {}
|
|
7047
|
-
};
|
|
7048
|
-
}
|
|
7049
|
-
function serializedShadingColor(color) {
|
|
7050
|
-
const theme = serializeDocxThemeReference(color.theme ?? null);
|
|
7051
|
-
return {
|
|
7052
|
-
value: color.value,
|
|
7053
|
-
...theme ? {
|
|
7054
|
-
theme: JSON.parse(theme)
|
|
7055
|
-
} : {}
|
|
7056
|
-
};
|
|
7057
|
-
}
|
|
7058
|
-
function documentParagraphShadingPresentation(shading) {
|
|
7059
|
-
if ('nil' === shading.pattern) return {
|
|
7060
|
-
backgroundColor: 'transparent'
|
|
7061
|
-
};
|
|
7062
|
-
const foreground = shadingColor(shading.color, '#000000');
|
|
7063
|
-
const background = shadingColor(shading.fill, 'transparent');
|
|
7064
|
-
if ('clear' === shading.pattern) return {
|
|
7065
|
-
backgroundColor: background
|
|
7066
|
-
};
|
|
7067
|
-
if ('solid' === shading.pattern) return {
|
|
7068
|
-
backgroundColor: foreground
|
|
7069
|
-
};
|
|
7070
|
-
const percentage = shadingPercentage(shading.pattern);
|
|
7071
|
-
if (null !== percentage) {
|
|
7072
|
-
const inverted = percentage > 50;
|
|
7073
|
-
const dotColor = inverted ? background : foreground;
|
|
7074
|
-
const baseColor = inverted ? foreground : background;
|
|
7075
|
-
const density = Math.min(50, inverted ? 100 - percentage : percentage);
|
|
7076
|
-
const spacing = Math.max(2, Math.round(9 - density / 7));
|
|
7077
|
-
return {
|
|
7078
|
-
backgroundColor: baseColor,
|
|
7079
|
-
backgroundImage: `radial-gradient(circle, ${dotColor} 0 1px, transparent 1.2px)`,
|
|
7080
|
-
backgroundSize: `${spacing}px ${spacing}px`
|
|
7081
|
-
};
|
|
7082
|
-
}
|
|
7083
|
-
const thin = shading.pattern.startsWith('thin');
|
|
7084
|
-
const width = thin ? 1 : 2;
|
|
7085
|
-
const period = thin ? 7 : 6;
|
|
7086
|
-
const stripe = (angle)=>`repeating-linear-gradient(${angle}deg, ${foreground} 0 ${width}px, transparent ${width}px ${period}px)`;
|
|
7087
|
-
const angles = shadingPatternAngles(shading.pattern);
|
|
7088
|
-
return {
|
|
7089
|
-
backgroundColor: background,
|
|
7090
|
-
backgroundImage: angles.map(stripe).join(', ')
|
|
7091
|
-
};
|
|
7092
|
-
}
|
|
7093
|
-
function shadingColor(color, fallback) {
|
|
7094
|
-
return color && 'auto' !== color.value ? color.value : fallback;
|
|
7095
|
-
}
|
|
7096
|
-
function shadingPercentage(pattern) {
|
|
7097
|
-
const match = /^pct(\d+)$/.exec(pattern);
|
|
7098
|
-
return match?.[1] ? Number(match[1]) : null;
|
|
7099
|
-
}
|
|
7100
|
-
function paragraphShadingBackgroundUsesForeground(shading) {
|
|
7101
|
-
if ('solid' === shading.pattern) return true;
|
|
7102
|
-
const percentage = shadingPercentage(shading.pattern);
|
|
7103
|
-
return null !== percentage && percentage > 50;
|
|
7104
|
-
}
|
|
7105
|
-
function shadingPatternAngles(pattern) {
|
|
7106
|
-
if (pattern.includes('HorzCross')) return [
|
|
7107
|
-
0,
|
|
7108
|
-
90
|
|
7109
|
-
];
|
|
7110
|
-
if (pattern.includes('DiagCross')) return [
|
|
7111
|
-
45,
|
|
7112
|
-
-45
|
|
7113
|
-
];
|
|
7114
|
-
if (pattern.includes('VertStripe')) return [
|
|
7115
|
-
90
|
|
7116
|
-
];
|
|
7117
|
-
if (pattern.includes('ReverseDiagStripe')) return [
|
|
7118
|
-
-45
|
|
7119
|
-
];
|
|
7120
|
-
if (pattern.includes('DiagStripe')) return [
|
|
7121
|
-
45
|
|
7122
|
-
];
|
|
7123
|
-
return [
|
|
7124
|
-
0
|
|
7125
|
-
];
|
|
7126
|
-
}
|
|
7127
6562
|
const DOCUMENT_TABLE_ROW_ID_ATTRIBUTE = 'data-office-row-id';
|
|
7128
6563
|
const DOCUMENT_TABLE_ROW_TEXT_ID_ATTRIBUTE = 'data-office-row-text-id';
|
|
7129
6564
|
const DocumentTableRowIdentity = Extension.create({
|
|
@@ -7311,447 +6746,52 @@ function tableRowsById(rows) {
|
|
|
7311
6746
|
}
|
|
7312
6747
|
function documentTableRows(document1) {
|
|
7313
6748
|
const rows = [];
|
|
7314
|
-
document1.descendants((node, position)=>{
|
|
7315
|
-
if ('tableRow' === node.type.name && hasDocumentTableRowIdentityComponent(node)) rows.push({
|
|
7316
|
-
node,
|
|
7317
|
-
position
|
|
7318
|
-
});
|
|
7319
|
-
});
|
|
7320
|
-
return rows;
|
|
7321
|
-
}
|
|
7322
|
-
function tableRowIdentitySourceFromNode(node) {
|
|
7323
|
-
return {
|
|
7324
|
-
rowId: node.attrs.rowId,
|
|
7325
|
-
rowTextId: node.attrs.rowTextId
|
|
7326
|
-
};
|
|
7327
|
-
}
|
|
7328
|
-
function sameDocumentTableRowIdentity(source, identity) {
|
|
7329
|
-
return normalizeDocumentParagraphId(source.rowId) === identity.rowId && normalizeDocumentParagraphId(source.rowTextId) === identity.rowTextId;
|
|
7330
|
-
}
|
|
7331
|
-
function work_document_table_row_identity_transactionMapping(transactions) {
|
|
7332
|
-
const mapping = new Mapping();
|
|
7333
|
-
for (const transaction of transactions)mapping.appendMapping(transaction.mapping);
|
|
7334
|
-
return mapping;
|
|
7335
|
-
}
|
|
7336
|
-
const DOCUMENT_TEXT_CASE_ATTRIBUTE = 'data-office-text-case';
|
|
7337
|
-
const documentTextCaseKeyboardShortcuts = {
|
|
7338
|
-
allCaps: 'Mod-Shift-a',
|
|
7339
|
-
smallCaps: 'Mod-Shift-k'
|
|
7340
|
-
};
|
|
7341
|
-
function normalizeDocumentTextCase(value) {
|
|
7342
|
-
return 'none' === value || 'all-caps' === value || 'small-caps' === value ? value : null;
|
|
7343
|
-
}
|
|
7344
|
-
function documentTextCaseFromWordFlags(allCaps, smallCaps) {
|
|
7345
|
-
if (void 0 === allCaps && void 0 === smallCaps) return null;
|
|
7346
|
-
if (allCaps) return 'all-caps';
|
|
7347
|
-
if (smallCaps) return 'small-caps';
|
|
7348
|
-
return 'none';
|
|
7349
|
-
}
|
|
7350
|
-
function applyDocumentTextCaseStyle(element, textCase) {
|
|
7351
|
-
element.dataset.officeTextCase = textCase;
|
|
7352
|
-
element.style.textTransform = 'all-caps' === textCase ? 'uppercase' : 'none';
|
|
7353
|
-
element.style.fontVariantCaps = 'small-caps' === textCase ? 'small-caps' : 'normal';
|
|
7354
|
-
}
|
|
7355
|
-
function documentTextCaseCss(textCase) {
|
|
7356
|
-
return [
|
|
7357
|
-
`text-transform: ${'all-caps' === textCase ? 'uppercase' : 'none'}`,
|
|
7358
|
-
`font-variant-caps: ${'small-caps' === textCase ? 'small-caps' : 'normal'}`
|
|
7359
|
-
].join('; ');
|
|
7360
|
-
}
|
|
7361
|
-
const DOCUMENT_SCRIPT_FONTS_ATTRIBUTE = "data-office-script-fonts";
|
|
7362
|
-
const DOCUMENT_SCRIPT_FONT_SLOT_ATTRIBUTE = "data-office-script-font-slot";
|
|
7363
|
-
const MAX_FONT_NAME_LENGTH = 127;
|
|
7364
|
-
const MAX_SERIALIZED_SCRIPT_FONTS_LENGTH = 4096;
|
|
7365
|
-
const SCRIPT_FONT_KEYS = new Set([
|
|
7366
|
-
'ascii',
|
|
7367
|
-
'highAnsi',
|
|
7368
|
-
'eastAsia',
|
|
7369
|
-
'complexScript',
|
|
7370
|
-
'hint'
|
|
7371
|
-
]);
|
|
7372
|
-
const SCRIPT_FONT_FACE_KEYS = new Set([
|
|
7373
|
-
'name',
|
|
7374
|
-
'theme',
|
|
7375
|
-
'resolved'
|
|
7376
|
-
]);
|
|
7377
|
-
const SCRIPT_FONT_HINTS = new Set([
|
|
7378
|
-
'default',
|
|
7379
|
-
'eastAsia',
|
|
7380
|
-
'cs'
|
|
7381
|
-
]);
|
|
7382
|
-
const work_document_script_fonts_THEME_FONTS = new Set([
|
|
7383
|
-
'majorEastAsia',
|
|
7384
|
-
'majorBidi',
|
|
7385
|
-
'majorAscii',
|
|
7386
|
-
'majorHAnsi',
|
|
7387
|
-
'minorEastAsia',
|
|
7388
|
-
'minorBidi',
|
|
7389
|
-
'minorAscii',
|
|
7390
|
-
'minorHAnsi'
|
|
7391
|
-
]);
|
|
7392
|
-
const SLOT_FALLBACK_ORDER = {
|
|
7393
|
-
ascii: [
|
|
7394
|
-
'ascii',
|
|
7395
|
-
'highAnsi',
|
|
7396
|
-
'eastAsia',
|
|
7397
|
-
'complexScript'
|
|
7398
|
-
],
|
|
7399
|
-
highAnsi: [
|
|
7400
|
-
'highAnsi',
|
|
7401
|
-
'ascii',
|
|
7402
|
-
'eastAsia',
|
|
7403
|
-
'complexScript'
|
|
7404
|
-
],
|
|
7405
|
-
eastAsia: [
|
|
7406
|
-
'eastAsia',
|
|
7407
|
-
'highAnsi',
|
|
7408
|
-
'ascii',
|
|
7409
|
-
'complexScript'
|
|
7410
|
-
],
|
|
7411
|
-
complexScript: [
|
|
7412
|
-
'complexScript',
|
|
7413
|
-
'highAnsi',
|
|
7414
|
-
'ascii',
|
|
7415
|
-
'eastAsia'
|
|
7416
|
-
]
|
|
7417
|
-
};
|
|
7418
|
-
const NEUTRAL_SCRIPT_CHARACTER = /^[\p{Cc}\p{Cf}\p{M}\p{N}\p{P}\p{S}\p{Z}]$/u;
|
|
7419
|
-
function normalizeDocumentScriptFonts(source) {
|
|
7420
|
-
if (!work_document_script_fonts_isRecordWithKeys(source, SCRIPT_FONT_KEYS)) return null;
|
|
7421
|
-
const normalized = {};
|
|
7422
|
-
for (const slot of scriptFontSlots){
|
|
7423
|
-
if (void 0 === source[slot]) continue;
|
|
7424
|
-
const face = normalizeDocumentScriptFontFace(source[slot]);
|
|
7425
|
-
if (!face) return null;
|
|
7426
|
-
normalized[slot] = face;
|
|
7427
|
-
}
|
|
7428
|
-
if (void 0 !== source.hint) {
|
|
7429
|
-
const hint = normalizeDocumentScriptFontHint(source.hint);
|
|
7430
|
-
if (!hint) return null;
|
|
7431
|
-
normalized.hint = hint;
|
|
7432
|
-
}
|
|
7433
|
-
return Object.keys(normalized).length ? normalized : null;
|
|
7434
|
-
}
|
|
7435
|
-
function serializeDocumentScriptFonts(source) {
|
|
7436
|
-
const fonts = normalizeDocumentScriptFonts(source);
|
|
7437
|
-
return fonts ? JSON.stringify(fonts) : null;
|
|
7438
|
-
}
|
|
7439
|
-
function parseDocumentScriptFonts(source) {
|
|
7440
|
-
if (!source || source.length > MAX_SERIALIZED_SCRIPT_FONTS_LENGTH) return null;
|
|
7441
|
-
try {
|
|
7442
|
-
return normalizeDocumentScriptFonts(JSON.parse(source));
|
|
7443
|
-
} catch {
|
|
7444
|
-
return null;
|
|
7445
|
-
}
|
|
7446
|
-
}
|
|
7447
|
-
function documentScriptFontsFromElement(element) {
|
|
7448
|
-
return parseDocumentScriptFonts(element.getAttribute(DOCUMENT_SCRIPT_FONTS_ATTRIBUTE));
|
|
7449
|
-
}
|
|
7450
|
-
function documentScriptFontSlotFromElement(element) {
|
|
7451
|
-
return normalizeDocumentScriptFontSlot(element.getAttribute(DOCUMENT_SCRIPT_FONT_SLOT_ATTRIBUTE));
|
|
7452
|
-
}
|
|
7453
|
-
function documentScriptFontsDomAttributes(source, slot) {
|
|
7454
|
-
const fonts = normalizeDocumentScriptFonts(source);
|
|
7455
|
-
const normalizedSlot = normalizeDocumentScriptFontSlot(slot);
|
|
7456
|
-
if (!fonts) return {};
|
|
7457
|
-
const serialized = serializeDocumentScriptFonts(fonts);
|
|
7458
|
-
if (!serialized) return {};
|
|
7459
|
-
const family = documentScriptFontFamily(fonts, normalizedSlot ?? documentScriptFontSlotFromHint(fonts.hint));
|
|
7460
|
-
return {
|
|
7461
|
-
[DOCUMENT_SCRIPT_FONTS_ATTRIBUTE]: serialized,
|
|
7462
|
-
...normalizedSlot ? {
|
|
7463
|
-
[DOCUMENT_SCRIPT_FONT_SLOT_ATTRIBUTE]: normalizedSlot
|
|
7464
|
-
} : {},
|
|
7465
|
-
...family ? {
|
|
7466
|
-
style: `font-family: ${family}`
|
|
7467
|
-
} : {}
|
|
7468
|
-
};
|
|
7469
|
-
}
|
|
7470
|
-
function documentScriptFontFamily(source, slot) {
|
|
7471
|
-
const fonts = normalizeDocumentScriptFonts(source);
|
|
7472
|
-
if (!fonts) return;
|
|
7473
|
-
const families = [];
|
|
7474
|
-
const seen = new Set();
|
|
7475
|
-
for (const candidate of documentScriptFontFallbackSlots(slot)){
|
|
7476
|
-
const family = documentScriptFontFaceFamily(fonts[candidate]);
|
|
7477
|
-
const key = family?.toLocaleLowerCase();
|
|
7478
|
-
if (!(!family || !key || seen.has(key))) {
|
|
7479
|
-
seen.add(key);
|
|
7480
|
-
families.push(cssFontFamily(family));
|
|
7481
|
-
}
|
|
7482
|
-
}
|
|
7483
|
-
return families.length ? families.join(', ') : void 0;
|
|
7484
|
-
}
|
|
7485
|
-
function documentScriptFontFallbackSlots(slot) {
|
|
7486
|
-
return SLOT_FALLBACK_ORDER[slot];
|
|
7487
|
-
}
|
|
7488
|
-
function documentScriptFontFamilyForRendering(source, slot, currentFontFamily) {
|
|
7489
|
-
const projected = documentScriptFontFamily(source, slot);
|
|
7490
|
-
const safeCurrent = safeCssFontFamilyList(currentFontFamily);
|
|
7491
|
-
if (!safeCurrent || !projected) return projected;
|
|
7492
|
-
const currentPrimary = documentFontNameFromCssFamily(safeCurrent);
|
|
7493
|
-
const projectedPrimary = documentFontNameFromCssFamily(projected);
|
|
7494
|
-
return currentPrimary && projectedPrimary && currentPrimary.toLocaleLowerCase() === projectedPrimary.toLocaleLowerCase() ? safeCurrent : projected;
|
|
7495
|
-
}
|
|
7496
|
-
function documentScriptFontDirectFamily(source, slot) {
|
|
7497
|
-
const fonts = normalizeDocumentScriptFonts(source);
|
|
7498
|
-
return fonts ? documentScriptFontFaceFamily(fonts[slot]) ?? null : null;
|
|
7499
|
-
}
|
|
7500
|
-
function documentScriptFontsForAllText(fontFamily) {
|
|
7501
|
-
const name = documentFontNameFromCssFamily(fontFamily);
|
|
7502
|
-
if (!name) return null;
|
|
7503
|
-
const face = {
|
|
7504
|
-
name,
|
|
7505
|
-
resolved: name
|
|
7506
|
-
};
|
|
7507
|
-
return {
|
|
7508
|
-
ascii: face,
|
|
7509
|
-
highAnsi: face,
|
|
7510
|
-
eastAsia: face,
|
|
7511
|
-
complexScript: face,
|
|
7512
|
-
hint: 'default'
|
|
7513
|
-
};
|
|
7514
|
-
}
|
|
7515
|
-
function patchDocumentScriptFonts(source, patch, fallbackFontFamily) {
|
|
7516
|
-
const current = normalizeDocumentScriptFonts(source) ?? documentScriptFontsForAllText(fallbackFontFamily) ?? {};
|
|
7517
|
-
const next = {
|
|
7518
|
-
...current
|
|
7519
|
-
};
|
|
7520
|
-
if (void 0 !== patch.latin) {
|
|
7521
|
-
const face = directFontFace(patch.latin);
|
|
7522
|
-
if (face) {
|
|
7523
|
-
next.ascii = face;
|
|
7524
|
-
next.highAnsi = face;
|
|
7525
|
-
} else {
|
|
7526
|
-
delete next.ascii;
|
|
7527
|
-
delete next.highAnsi;
|
|
7528
|
-
}
|
|
7529
|
-
}
|
|
7530
|
-
if (void 0 !== patch.eastAsia) {
|
|
7531
|
-
const face = directFontFace(patch.eastAsia);
|
|
7532
|
-
if (face) next.eastAsia = face;
|
|
7533
|
-
else delete next.eastAsia;
|
|
7534
|
-
}
|
|
7535
|
-
if (void 0 !== patch.complexScript) {
|
|
7536
|
-
const face = directFontFace(patch.complexScript);
|
|
7537
|
-
if (face) next.complexScript = face;
|
|
7538
|
-
else delete next.complexScript;
|
|
7539
|
-
}
|
|
7540
|
-
return normalizeDocumentScriptFonts(next);
|
|
7541
|
-
}
|
|
7542
|
-
function documentScriptFontSegments(text, hint = 'default', forceComplexScript = false) {
|
|
7543
|
-
if (!text) return [];
|
|
7544
|
-
if (forceComplexScript) return [
|
|
7545
|
-
{
|
|
7546
|
-
from: 0,
|
|
7547
|
-
to: text.length,
|
|
7548
|
-
slot: 'complexScript'
|
|
7549
|
-
}
|
|
7550
|
-
];
|
|
7551
|
-
const characters = [];
|
|
7552
|
-
let offset = 0;
|
|
7553
|
-
for (const character of text){
|
|
7554
|
-
const from = offset;
|
|
7555
|
-
offset += character.length;
|
|
7556
|
-
characters.push({
|
|
7557
|
-
from,
|
|
7558
|
-
to: offset,
|
|
7559
|
-
slot: strongDocumentScriptFontSlot(character)
|
|
7560
|
-
});
|
|
7561
|
-
}
|
|
7562
|
-
const fallback = documentScriptFontSlotFromHint(hint);
|
|
7563
|
-
let previous = null;
|
|
7564
|
-
for(let index = 0; index < characters.length; index += 1){
|
|
7565
|
-
const entry = characters[index];
|
|
7566
|
-
if (!entry) continue;
|
|
7567
|
-
if (entry.slot) {
|
|
7568
|
-
previous = entry.slot;
|
|
7569
|
-
continue;
|
|
7570
|
-
}
|
|
7571
|
-
let next = previous;
|
|
7572
|
-
if (!next) for(let cursor = index + 1; cursor < characters.length; cursor += 1){
|
|
7573
|
-
const candidate = characters[cursor]?.slot;
|
|
7574
|
-
if (candidate) {
|
|
7575
|
-
next = candidate;
|
|
7576
|
-
break;
|
|
7577
|
-
}
|
|
7578
|
-
}
|
|
7579
|
-
entry.slot = next ?? fallback;
|
|
7580
|
-
}
|
|
7581
|
-
const segments = [];
|
|
7582
|
-
for (const entry of characters){
|
|
7583
|
-
const slot = entry.slot ?? fallback;
|
|
7584
|
-
const prior = segments[segments.length - 1];
|
|
7585
|
-
if (prior?.slot === slot && prior.to === entry.from) prior.to = entry.to;
|
|
7586
|
-
else segments.push({
|
|
7587
|
-
from: entry.from,
|
|
7588
|
-
to: entry.to,
|
|
7589
|
-
slot
|
|
7590
|
-
});
|
|
7591
|
-
}
|
|
7592
|
-
return segments;
|
|
7593
|
-
}
|
|
7594
|
-
function normalizeDocumentScriptFontSlot(value) {
|
|
7595
|
-
return scriptFontSlots.includes(value) ? value : null;
|
|
7596
|
-
}
|
|
7597
|
-
function normalizeDocumentScriptFontHint(value) {
|
|
7598
|
-
return SCRIPT_FONT_HINTS.has(value) ? value : null;
|
|
7599
|
-
}
|
|
7600
|
-
function normalizeDocumentThemeFont(value) {
|
|
7601
|
-
return work_document_script_fonts_THEME_FONTS.has(value) ? value : null;
|
|
7602
|
-
}
|
|
7603
|
-
function documentScriptFontSlotFromHint(hint) {
|
|
7604
|
-
if ('eastAsia' === hint) return 'eastAsia';
|
|
7605
|
-
if ('cs' === hint) return 'complexScript';
|
|
7606
|
-
return 'ascii';
|
|
7607
|
-
}
|
|
7608
|
-
function documentFontNameFromCssFamily(value) {
|
|
7609
|
-
if ('string' != typeof value) return null;
|
|
7610
|
-
const source = value.trim();
|
|
7611
|
-
if (!source) return null;
|
|
7612
|
-
let family = '';
|
|
7613
|
-
const quote = source[0];
|
|
7614
|
-
if ('"' === quote || "'" === quote) {
|
|
7615
|
-
let closed = false;
|
|
7616
|
-
for(let index = 1; index < source.length; index += 1){
|
|
7617
|
-
const character = source[index];
|
|
7618
|
-
if (character === quote) {
|
|
7619
|
-
closed = true;
|
|
7620
|
-
break;
|
|
7621
|
-
}
|
|
7622
|
-
if ('\\' !== character) {
|
|
7623
|
-
family += character;
|
|
7624
|
-
continue;
|
|
7625
|
-
}
|
|
7626
|
-
const decoded = decodeCssEscape(source, index + 1);
|
|
7627
|
-
if (!decoded) return null;
|
|
7628
|
-
family += decoded.value;
|
|
7629
|
-
index = decoded.end - 1;
|
|
7630
|
-
}
|
|
7631
|
-
if (!closed) return null;
|
|
7632
|
-
} else family = source.split(',')[0] ?? '';
|
|
7633
|
-
return normalizeDocumentFontName(family);
|
|
7634
|
-
}
|
|
7635
|
-
function cssDocumentFontFamily(value) {
|
|
7636
|
-
const family = normalizeDocumentFontName(value);
|
|
7637
|
-
return family ? cssFontFamily(family) : null;
|
|
7638
|
-
}
|
|
7639
|
-
function normalizeDocumentFontName(value) {
|
|
7640
|
-
if ('string' != typeof value) return null;
|
|
7641
|
-
const normalized = value.trim();
|
|
7642
|
-
return normalized && normalized.length <= MAX_FONT_NAME_LENGTH && !/[\p{Cc}\p{Cs}]/u.test(normalized) ? normalized : null;
|
|
6749
|
+
document1.descendants((node, position)=>{
|
|
6750
|
+
if ('tableRow' === node.type.name && hasDocumentTableRowIdentityComponent(node)) rows.push({
|
|
6751
|
+
node,
|
|
6752
|
+
position
|
|
6753
|
+
});
|
|
6754
|
+
});
|
|
6755
|
+
return rows;
|
|
7643
6756
|
}
|
|
7644
|
-
|
|
7645
|
-
'ascii',
|
|
7646
|
-
'highAnsi',
|
|
7647
|
-
'eastAsia',
|
|
7648
|
-
'complexScript'
|
|
7649
|
-
];
|
|
7650
|
-
function normalizeDocumentScriptFontFace(source) {
|
|
7651
|
-
if (!work_document_script_fonts_isRecordWithKeys(source, SCRIPT_FONT_FACE_KEYS)) return null;
|
|
7652
|
-
const name = void 0 === source.name ? void 0 : normalizeDocumentFontName(source.name);
|
|
7653
|
-
const resolved = void 0 === source.resolved ? void 0 : normalizeDocumentFontName(source.resolved);
|
|
7654
|
-
const theme = void 0 === source.theme ? void 0 : normalizeDocumentThemeFont(source.theme);
|
|
7655
|
-
if (void 0 !== source.name && !name || void 0 !== source.resolved && !resolved || null === theme || !name && !theme && !resolved) return null;
|
|
6757
|
+
function tableRowIdentitySourceFromNode(node) {
|
|
7656
6758
|
return {
|
|
7657
|
-
|
|
7658
|
-
|
|
7659
|
-
} : {},
|
|
7660
|
-
...theme ? {
|
|
7661
|
-
theme
|
|
7662
|
-
} : {},
|
|
7663
|
-
...resolved ? {
|
|
7664
|
-
resolved
|
|
7665
|
-
} : {}
|
|
6759
|
+
rowId: node.attrs.rowId,
|
|
6760
|
+
rowTextId: node.attrs.rowTextId
|
|
7666
6761
|
};
|
|
7667
6762
|
}
|
|
7668
|
-
function
|
|
7669
|
-
|
|
7670
|
-
const name = documentFontNameFromCssFamily(value) ?? normalizeDocumentFontName(value);
|
|
7671
|
-
return name ? {
|
|
7672
|
-
name,
|
|
7673
|
-
resolved: name
|
|
7674
|
-
} : null;
|
|
7675
|
-
}
|
|
7676
|
-
function documentScriptFontFaceFamily(face) {
|
|
7677
|
-
return face?.resolved ?? face?.name;
|
|
7678
|
-
}
|
|
7679
|
-
function strongDocumentScriptFontSlot(character) {
|
|
7680
|
-
if (NEUTRAL_SCRIPT_CHARACTER.test(character)) return null;
|
|
7681
|
-
const codePoint = character.codePointAt(0);
|
|
7682
|
-
if (void 0 === codePoint) return null;
|
|
7683
|
-
if (isComplexScriptCodePoint(codePoint)) return 'complexScript';
|
|
7684
|
-
if (isEastAsianCodePoint(codePoint)) return 'eastAsia';
|
|
7685
|
-
return codePoint <= 0x7f ? 'ascii' : 'highAnsi';
|
|
7686
|
-
}
|
|
7687
|
-
function isComplexScriptCodePoint(codePoint) {
|
|
7688
|
-
return codePoint >= 0x0590 && codePoint <= 0x08ff || codePoint >= 0x0900 && codePoint <= 0x109f || codePoint >= 0x1780 && codePoint <= 0x18af || codePoint >= 0x1900 && codePoint <= 0x1cff || codePoint >= 0xa800 && codePoint <= 0xa8ff || codePoint >= 0xa980 && codePoint <= 0xa9df || codePoint >= 0xaa00 && codePoint <= 0xaa7f || codePoint >= 0xabc0 && codePoint <= 0xabff || codePoint >= 0xfb1d && codePoint <= 0xfdff || codePoint >= 0xfe70 && codePoint <= 0xfeff || codePoint >= 0x10a00 && codePoint <= 0x10fff || codePoint >= 0x11000 && codePoint <= 0x11fff || codePoint >= 0x1e900 && codePoint <= 0x1edff || codePoint >= 0x1ee00 && codePoint <= 0x1eeff;
|
|
6763
|
+
function sameDocumentTableRowIdentity(source, identity) {
|
|
6764
|
+
return normalizeDocumentParagraphId(source.rowId) === identity.rowId && normalizeDocumentParagraphId(source.rowTextId) === identity.rowTextId;
|
|
7689
6765
|
}
|
|
7690
|
-
function
|
|
7691
|
-
|
|
6766
|
+
function work_document_table_row_identity_transactionMapping(transactions) {
|
|
6767
|
+
const mapping = new Mapping();
|
|
6768
|
+
for (const transaction of transactions)mapping.appendMapping(transaction.mapping);
|
|
6769
|
+
return mapping;
|
|
7692
6770
|
}
|
|
7693
|
-
|
|
7694
|
-
|
|
6771
|
+
const DOCUMENT_TEXT_CASE_ATTRIBUTE = 'data-office-text-case';
|
|
6772
|
+
const documentTextCaseKeyboardShortcuts = {
|
|
6773
|
+
allCaps: 'Mod-Shift-a',
|
|
6774
|
+
smallCaps: 'Mod-Shift-k'
|
|
6775
|
+
};
|
|
6776
|
+
function normalizeDocumentTextCase(value) {
|
|
6777
|
+
return 'none' === value || 'all-caps' === value || 'small-caps' === value ? value : null;
|
|
7695
6778
|
}
|
|
7696
|
-
function
|
|
7697
|
-
|
|
6779
|
+
function documentTextCaseFromWordFlags(allCaps, smallCaps) {
|
|
6780
|
+
if (void 0 === allCaps && void 0 === smallCaps) return null;
|
|
6781
|
+
if (allCaps) return 'all-caps';
|
|
6782
|
+
if (smallCaps) return 'small-caps';
|
|
6783
|
+
return 'none';
|
|
7698
6784
|
}
|
|
7699
|
-
function
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
const tokens = [];
|
|
7704
|
-
let start = 0;
|
|
7705
|
-
let quote = '';
|
|
7706
|
-
for(let index = 0; index < source.length; index += 1){
|
|
7707
|
-
const character = source[index] ?? '';
|
|
7708
|
-
if (quote) {
|
|
7709
|
-
if ('\\' === character) {
|
|
7710
|
-
index += 1;
|
|
7711
|
-
if (index >= source.length) return null;
|
|
7712
|
-
} else if (character === quote) quote = '';
|
|
7713
|
-
continue;
|
|
7714
|
-
}
|
|
7715
|
-
if ('"' === character || "'" === character) {
|
|
7716
|
-
quote = character;
|
|
7717
|
-
continue;
|
|
7718
|
-
}
|
|
7719
|
-
if (',' === character) {
|
|
7720
|
-
tokens.push(source.slice(start, index).trim());
|
|
7721
|
-
start = index + 1;
|
|
7722
|
-
}
|
|
7723
|
-
}
|
|
7724
|
-
if (quote) return null;
|
|
7725
|
-
tokens.push(source.slice(start).trim());
|
|
7726
|
-
return tokens.length && tokens.every(validCssFontFamilyToken) ? source : null;
|
|
7727
|
-
}
|
|
7728
|
-
function validCssFontFamilyToken(value) {
|
|
7729
|
-
if (!value) return false;
|
|
7730
|
-
if (value.startsWith('"')) return /^"(?:[^"\\\r\n\f]|\\(?:[\da-f]{1,6}\s?|[^\r\n\f]))*"$/iu.test(value) && null !== documentFontNameFromCssFamily(value);
|
|
7731
|
-
if (value.startsWith("'")) return /^'(?:[^'\\\r\n\f]|\\(?:[\da-f]{1,6}\s?|[^\r\n\f]))*'$/iu.test(value) && null !== documentFontNameFromCssFamily(value);
|
|
7732
|
-
return /[\p{L}_]/u.test(value) && /^[\p{L}_-][\p{L}\p{N}_ -]*$/u.test(value) && !/^(?:inherit|initial|revert(?:-layer)?|unset)$/iu.test(value);
|
|
7733
|
-
}
|
|
7734
|
-
function decodeCssEscape(source, start) {
|
|
7735
|
-
if (start >= source.length) return null;
|
|
7736
|
-
const hexadecimal = /^[\da-f]{1,6}/i.exec(source.slice(start))?.[0];
|
|
7737
|
-
if (hexadecimal) {
|
|
7738
|
-
const codePoint = Number.parseInt(hexadecimal, 16);
|
|
7739
|
-
if (0 === codePoint || codePoint > 0x10ffff || codePoint >= 0xd800 && codePoint <= 0xdfff) return null;
|
|
7740
|
-
let end = start + hexadecimal.length;
|
|
7741
|
-
if (/\s/u.test(source[end] ?? '')) end += 1;
|
|
7742
|
-
return {
|
|
7743
|
-
value: String.fromCodePoint(codePoint),
|
|
7744
|
-
end
|
|
7745
|
-
};
|
|
7746
|
-
}
|
|
7747
|
-
const value = source[start];
|
|
7748
|
-
return !value || /[\r\n\f]/u.test(value) ? null : {
|
|
7749
|
-
value,
|
|
7750
|
-
end: start + 1
|
|
7751
|
-
};
|
|
6785
|
+
function applyDocumentTextCaseStyle(element, textCase) {
|
|
6786
|
+
element.dataset.officeTextCase = textCase;
|
|
6787
|
+
element.style.textTransform = 'all-caps' === textCase ? 'uppercase' : 'none';
|
|
6788
|
+
element.style.fontVariantCaps = 'small-caps' === textCase ? 'small-caps' : 'normal';
|
|
7752
6789
|
}
|
|
7753
|
-
function
|
|
7754
|
-
return
|
|
6790
|
+
function documentTextCaseCss(textCase) {
|
|
6791
|
+
return [
|
|
6792
|
+
`text-transform: ${'all-caps' === textCase ? 'uppercase' : 'none'}`,
|
|
6793
|
+
`font-variant-caps: ${'small-caps' === textCase ? 'small-caps' : 'normal'}`
|
|
6794
|
+
].join('; ');
|
|
7755
6795
|
}
|
|
7756
6796
|
const workDocumentUnderlineStyles = [
|
|
7757
6797
|
'none',
|
|
@@ -8350,10 +7390,17 @@ function sanitizeAttributes(element, tag) {
|
|
|
8350
7390
|
const emphasisMark = 'span' === tag ? documentEmphasisMarkFromElement(element) : null;
|
|
8351
7391
|
const emphasisAttributes = documentEmphasisMarkDomAttributes(emphasisMark);
|
|
8352
7392
|
const hiddenText = 'span' === tag ? documentHiddenTextFromElement(element) : null;
|
|
7393
|
+
const proofingLanguages = 'span' === tag ? documentProofingLanguagesFromElement(element) : null;
|
|
7394
|
+
const noProof = 'span' === tag ? documentNoProofFromElement(element) : null;
|
|
7395
|
+
const proofingAttributes = documentProofingDomAttributes(proofingLanguages, noProof, scriptFontSlot);
|
|
8353
7396
|
const legacyTextEffects = 'span' === tag ? documentLegacyTextEffectsFromElement(element) ?? {} : {};
|
|
8354
7397
|
const legacyTextEffectAttributes = documentLegacyTextEffectsDomAttributes(legacyTextEffects);
|
|
8355
7398
|
const runBorder = 'span' === tag ? parseDocumentRunBorderElement(element) : null;
|
|
8356
7399
|
const runBorderAttributes = documentRunBorderDomAttributes(runBorder);
|
|
7400
|
+
const runShading = 'span' === tag ? parseDocumentRunShadingElement(element) : null;
|
|
7401
|
+
const runShadingAttributes = documentRunShadingDomAttributes(runShading);
|
|
7402
|
+
const highlight = 'span' === tag && element.hasAttribute(DOCUMENT_HIGHLIGHT_ATTRIBUTE) ? documentHighlightFromElement(element) : null;
|
|
7403
|
+
const highlightAttributes = documentHighlightDomAttributes(highlight);
|
|
8357
7404
|
const underline = 'u' === tag ? documentUnderlineFormattingFromElement(element) : null;
|
|
8358
7405
|
const underlineAttributes = underline ? documentUnderlineDomAttributes(underline) : {};
|
|
8359
7406
|
const strike = 's' === tag || 'strike' === tag ? documentStrikeFormattingFromElement(element) : null;
|
|
@@ -8381,6 +7428,12 @@ function sanitizeAttributes(element, tag) {
|
|
|
8381
7428
|
element.removeAttribute(DOCUMENT_LEGACY_TEXT_EMBOSS_ATTRIBUTE);
|
|
8382
7429
|
element.removeAttribute(DOCUMENT_LEGACY_TEXT_IMPRINT_ATTRIBUTE);
|
|
8383
7430
|
element.removeAttribute(DOCUMENT_RUN_BORDER_ATTRIBUTE);
|
|
7431
|
+
element.removeAttribute(DOCUMENT_RUN_SHADING_ATTRIBUTE);
|
|
7432
|
+
element.removeAttribute(DOCUMENT_PROOFING_LANGUAGES_ATTRIBUTE);
|
|
7433
|
+
element.removeAttribute(DOCUMENT_NO_PROOF_ATTRIBUTE);
|
|
7434
|
+
element.removeAttribute('lang');
|
|
7435
|
+
element.removeAttribute('spellcheck');
|
|
7436
|
+
element.removeAttribute(DOCUMENT_HIGHLIGHT_ATTRIBUTE);
|
|
8384
7437
|
element.removeAttribute(DOCUMENT_SCRIPT_FONTS_ATTRIBUTE);
|
|
8385
7438
|
element.removeAttribute(DOCUMENT_SCRIPT_FONT_SLOT_ATTRIBUTE);
|
|
8386
7439
|
const styles = [
|
|
@@ -8397,6 +7450,8 @@ function sanitizeAttributes(element, tag) {
|
|
|
8397
7450
|
underlineAttributes.style ?? '',
|
|
8398
7451
|
strikeAttributes.style ?? '',
|
|
8399
7452
|
runBorderAttributes.style ?? '',
|
|
7453
|
+
runShadingAttributes.style ?? '',
|
|
7454
|
+
highlightAttributes.style ?? '',
|
|
8400
7455
|
borderAttributes.style ?? '',
|
|
8401
7456
|
shadingAttributes.style ?? ''
|
|
8402
7457
|
].filter(Boolean);
|
|
@@ -8447,6 +7502,11 @@ function sanitizeAttributes(element, tag) {
|
|
|
8447
7502
|
for (const [name, value] of Object.entries(legacyTextEffectAttributes))element.setAttribute(name, value);
|
|
8448
7503
|
const serializedRunBorder = runBorderAttributes[DOCUMENT_RUN_BORDER_ATTRIBUTE];
|
|
8449
7504
|
if (serializedRunBorder) element.setAttribute(DOCUMENT_RUN_BORDER_ATTRIBUTE, serializedRunBorder);
|
|
7505
|
+
const serializedRunShading = runShadingAttributes[DOCUMENT_RUN_SHADING_ATTRIBUTE];
|
|
7506
|
+
if (serializedRunShading) element.setAttribute(DOCUMENT_RUN_SHADING_ATTRIBUTE, serializedRunShading);
|
|
7507
|
+
for (const [name, value] of Object.entries(proofingAttributes))element.setAttribute(name, value);
|
|
7508
|
+
const nativeHighlight = highlightAttributes[DOCUMENT_HIGHLIGHT_ATTRIBUTE];
|
|
7509
|
+
if (nativeHighlight) element.setAttribute(DOCUMENT_HIGHLIGHT_ATTRIBUTE, nativeHighlight);
|
|
8450
7510
|
}
|
|
8451
7511
|
if ('span' === tag && scriptFonts) {
|
|
8452
7512
|
for (const [name, value] of Object.entries(scriptFontAttributes))if ('style' !== name) element.setAttribute(name, value);
|
|
@@ -8501,6 +7561,12 @@ function sanitizeAttributes(element, tag) {
|
|
|
8501
7561
|
DOCUMENT_LEGACY_TEXT_EMBOSS_ATTRIBUTE,
|
|
8502
7562
|
DOCUMENT_LEGACY_TEXT_IMPRINT_ATTRIBUTE,
|
|
8503
7563
|
DOCUMENT_RUN_BORDER_ATTRIBUTE,
|
|
7564
|
+
DOCUMENT_RUN_SHADING_ATTRIBUTE,
|
|
7565
|
+
DOCUMENT_PROOFING_LANGUAGES_ATTRIBUTE,
|
|
7566
|
+
DOCUMENT_NO_PROOF_ATTRIBUTE,
|
|
7567
|
+
'lang',
|
|
7568
|
+
'spellcheck',
|
|
7569
|
+
DOCUMENT_HIGHLIGHT_ATTRIBUTE,
|
|
8504
7570
|
DOCUMENT_SCRIPT_FONTS_ATTRIBUTE,
|
|
8505
7571
|
DOCUMENT_SCRIPT_FONT_SLOT_ATTRIBUTE
|
|
8506
7572
|
] : [],
|
|
@@ -8847,7 +7913,7 @@ function documentContentLayoutProperties(layout) {
|
|
|
8847
7913
|
};
|
|
8848
7914
|
}
|
|
8849
7915
|
function normalizeDocumentSemanticHtml(source, bibliography) {
|
|
8850
|
-
return normalizeDocumentBookmarkReferencesHtml(normalizeDocumentBookmarksHtml(normalizeDocumentCitationsHtml(normalizeDocumentFieldsHtml(normalizeDocumentCaptionsHtml(normalizeDocumentNotesHtml(source))), bibliography)));
|
|
7916
|
+
return normalizeDocumentBookmarkReferencesHtml(normalizeDocumentBookmarksHtml(normalizeDocumentCitationsHtml(normalizeDocumentTableOfContentsHtml(normalizeDocumentFieldsHtml(normalizeDocumentCaptionsHtml(normalizeDocumentNotesHtml(source)))), bibliography)));
|
|
8851
7917
|
}
|
|
8852
7918
|
function applyDocumentSectionDomAttributes(element, layout, id) {
|
|
8853
7919
|
for (const [name, value] of Object.entries(documentSectionDomAttributes(layout, id)))element.setAttribute(name, value);
|
|
@@ -9433,6 +8499,9 @@ const ALLOWED_ATTRIBUTES = {
|
|
|
9433
8499
|
'legacyTextEmboss',
|
|
9434
8500
|
'legacyTextImprint',
|
|
9435
8501
|
'runBorder',
|
|
8502
|
+
'runShading',
|
|
8503
|
+
'proofingLanguages',
|
|
8504
|
+
'noProof',
|
|
9436
8505
|
"scriptFonts",
|
|
9437
8506
|
"scriptFontSlot",
|
|
9438
8507
|
'themeColor',
|
|
@@ -9442,6 +8511,7 @@ const ALLOWED_ATTRIBUTES = {
|
|
|
9442
8511
|
]),
|
|
9443
8512
|
highlight: new Set([
|
|
9444
8513
|
'color',
|
|
8514
|
+
'nativeHighlight',
|
|
9445
8515
|
'themeFill'
|
|
9446
8516
|
])
|
|
9447
8517
|
};
|
|
@@ -9529,6 +8599,9 @@ function importedDocumentCharacterFormatting(formatting) {
|
|
|
9529
8599
|
legacyTextEmboss: formatting.legacyTextEmboss,
|
|
9530
8600
|
legacyTextImprint: formatting.legacyTextImprint,
|
|
9531
8601
|
runBorder: formatting.runBorder,
|
|
8602
|
+
runShading: formatting.runShading,
|
|
8603
|
+
proofingLanguages: serializeDocumentProofingLanguages(formatting.proofingLanguages) ?? void 0,
|
|
8604
|
+
noProof: formatting.noProof,
|
|
9532
8605
|
color: formatting.color,
|
|
9533
8606
|
fontFamily: formatting.fontFamily,
|
|
9534
8607
|
scriptFonts: serializeDocumentScriptFonts(formatting.scriptFonts) ?? void 0,
|
|
@@ -9545,6 +8618,7 @@ function importedDocumentCharacterFormatting(formatting) {
|
|
|
9545
8618
|
});
|
|
9546
8619
|
const highlight = compactAttributes({
|
|
9547
8620
|
color: formatting.backgroundColor,
|
|
8621
|
+
nativeHighlight: formatting.highlight,
|
|
9548
8622
|
themeFill: formatting.themeFill
|
|
9549
8623
|
});
|
|
9550
8624
|
if (highlight) marks.push({
|
|
@@ -9628,6 +8702,30 @@ function normalizeCharacterFormatMark(value) {
|
|
|
9628
8702
|
attrs[key] = border;
|
|
9629
8703
|
continue;
|
|
9630
8704
|
}
|
|
8705
|
+
if ('textStyle' === type && 'runShading' === key) {
|
|
8706
|
+
const shading = serializeDocumentRunShading(parseDocumentRunShading(candidate));
|
|
8707
|
+
if (!shading) return null;
|
|
8708
|
+
attrs[key] = shading;
|
|
8709
|
+
continue;
|
|
8710
|
+
}
|
|
8711
|
+
if ('textStyle' === type && 'proofingLanguages' === key) {
|
|
8712
|
+
const languages = serializeDocumentProofingLanguages(parseDocumentProofingLanguages(candidate));
|
|
8713
|
+
if (!languages) return null;
|
|
8714
|
+
attrs[key] = languages;
|
|
8715
|
+
continue;
|
|
8716
|
+
}
|
|
8717
|
+
if ('textStyle' === type && 'noProof' === key) {
|
|
8718
|
+
const noProof = normalizeDocumentNoProof(candidate);
|
|
8719
|
+
if (null === noProof) return null;
|
|
8720
|
+
attrs[key] = noProof;
|
|
8721
|
+
continue;
|
|
8722
|
+
}
|
|
8723
|
+
if ('highlight' === type && 'nativeHighlight' === key) {
|
|
8724
|
+
const highlight = normalizeDocumentHighlight(candidate);
|
|
8725
|
+
if (!highlight) return null;
|
|
8726
|
+
attrs[key] = highlight;
|
|
8727
|
+
continue;
|
|
8728
|
+
}
|
|
9631
8729
|
if ('string' == typeof candidate) {
|
|
9632
8730
|
if (!candidate.length) continue;
|
|
9633
8731
|
if ('textStyle' === type && 'textCase' === key && !normalizeDocumentTextCase(candidate)) return null;
|
|
@@ -10593,7 +9691,34 @@ const DocumentCharacterFormatting = Extension.create({
|
|
|
10593
9691
|
size: 4,
|
|
10594
9692
|
space: 1
|
|
10595
9693
|
});
|
|
10596
|
-
}
|
|
9694
|
+
},
|
|
9695
|
+
setDocumentRunShading: (shading)=>({ commands })=>{
|
|
9696
|
+
const serialized = serializeDocumentRunShading(normalizeDocumentRunShading(shading));
|
|
9697
|
+
return serialized ? commands.setMark('textStyle', {
|
|
9698
|
+
runShading: serialized
|
|
9699
|
+
}) : false;
|
|
9700
|
+
},
|
|
9701
|
+
unsetDocumentRunShading: ()=>({ chain })=>chain().setMark('textStyle', {
|
|
9702
|
+
runShading: null
|
|
9703
|
+
}).removeEmptyTextStyle().run(),
|
|
9704
|
+
setDocumentProofingLanguages: (languages)=>({ commands })=>{
|
|
9705
|
+
const serialized = serializeDocumentProofingLanguages(normalizeDocumentProofingLanguages(languages));
|
|
9706
|
+
return serialized ? commands.setMark('textStyle', {
|
|
9707
|
+
proofingLanguages: serialized
|
|
9708
|
+
}) : false;
|
|
9709
|
+
},
|
|
9710
|
+
unsetDocumentProofingLanguages: ()=>({ chain })=>chain().setMark('textStyle', {
|
|
9711
|
+
proofingLanguages: null
|
|
9712
|
+
}).removeEmptyTextStyle().run(),
|
|
9713
|
+
setDocumentNoProof: (noProof)=>({ commands })=>{
|
|
9714
|
+
const normalized = normalizeDocumentNoProof(noProof);
|
|
9715
|
+
return null === normalized ? false : commands.setMark('textStyle', {
|
|
9716
|
+
noProof: normalized
|
|
9717
|
+
});
|
|
9718
|
+
},
|
|
9719
|
+
unsetDocumentNoProof: ()=>({ chain })=>chain().setMark('textStyle', {
|
|
9720
|
+
noProof: null
|
|
9721
|
+
}).removeEmptyTextStyle().run()
|
|
10597
9722
|
};
|
|
10598
9723
|
},
|
|
10599
9724
|
addKeyboardShortcuts () {
|
|
@@ -15356,6 +14481,8 @@ function documentTextLayoutRunStyle(style, fonts, loadedFontIds, paragraphStyle,
|
|
|
15356
14481
|
if (null === ligatures || null === kerning) return null;
|
|
15357
14482
|
const letterSpacing = style.letterSpacing && 'normal' !== style.letterSpacing ? finitePixels(style.letterSpacing) : 0;
|
|
15358
14483
|
if (letterSpacing < -100 || letterSpacing > 100) return null;
|
|
14484
|
+
const language = documentTextLayoutLanguage(element);
|
|
14485
|
+
if (null === language) return null;
|
|
15359
14486
|
return {
|
|
15360
14487
|
fontId: font.id,
|
|
15361
14488
|
...fallbackFonts.length ? {
|
|
@@ -15363,6 +14490,9 @@ function documentTextLayoutRunStyle(style, fonts, loadedFontIds, paragraphStyle,
|
|
|
15363
14490
|
} : {},
|
|
15364
14491
|
fontSize,
|
|
15365
14492
|
lineHeight,
|
|
14493
|
+
...language ? {
|
|
14494
|
+
language
|
|
14495
|
+
} : {},
|
|
15366
14496
|
letterSpacing,
|
|
15367
14497
|
ligatures,
|
|
15368
14498
|
kerning
|
|
@@ -15397,11 +14527,20 @@ function documentTextLayoutRunStyleKey(style) {
|
|
|
15397
14527
|
(style.fallbackFontIds ?? []).join('\u0002'),
|
|
15398
14528
|
style.fontSize,
|
|
15399
14529
|
style.lineHeight,
|
|
14530
|
+
style.language ?? '',
|
|
15400
14531
|
style.letterSpacing ?? 0,
|
|
15401
14532
|
style.ligatures ?? true,
|
|
15402
14533
|
style.kerning ?? true
|
|
15403
14534
|
].join('\u0000');
|
|
15404
14535
|
}
|
|
14536
|
+
function documentTextLayoutLanguage(element) {
|
|
14537
|
+
for(let current = element; current; current = current.parentElement){
|
|
14538
|
+
if (!current.hasAttribute('lang')) continue;
|
|
14539
|
+
const source = current.getAttribute('lang') ?? '';
|
|
14540
|
+
if (!source) break;
|
|
14541
|
+
return normalizeDocumentLanguageTag(source);
|
|
14542
|
+
}
|
|
14543
|
+
}
|
|
15405
14544
|
function cssValueIs(value, ...supported) {
|
|
15406
14545
|
return !value || supported.includes(value);
|
|
15407
14546
|
}
|
|
@@ -16992,6 +16131,18 @@ const DocumentTextStyle = TextStyle.extend({
|
|
|
16992
16131
|
{
|
|
16993
16132
|
tag: `span[${DOCUMENT_RUN_BORDER_ATTRIBUTE}]`,
|
|
16994
16133
|
consuming: false
|
|
16134
|
+
},
|
|
16135
|
+
{
|
|
16136
|
+
tag: `span[${DOCUMENT_RUN_SHADING_ATTRIBUTE}]`,
|
|
16137
|
+
consuming: false
|
|
16138
|
+
},
|
|
16139
|
+
{
|
|
16140
|
+
tag: `span[${DOCUMENT_PROOFING_LANGUAGES_ATTRIBUTE}]`,
|
|
16141
|
+
consuming: false
|
|
16142
|
+
},
|
|
16143
|
+
{
|
|
16144
|
+
tag: `span[${DOCUMENT_NO_PROOF_ATTRIBUTE}]`,
|
|
16145
|
+
consuming: false
|
|
16995
16146
|
}
|
|
16996
16147
|
];
|
|
16997
16148
|
},
|
|
@@ -17046,6 +16197,21 @@ const DocumentTextStyle = TextStyle.extend({
|
|
|
17046
16197
|
parseHTML: (element)=>serializeDocumentRunBorder(parseDocumentRunBorderElement(element)) ?? null,
|
|
17047
16198
|
renderHTML: (attributes)=>documentRunBorderDomAttributes(parseDocumentRunBorder(attributes.runBorder))
|
|
17048
16199
|
},
|
|
16200
|
+
runShading: {
|
|
16201
|
+
default: null,
|
|
16202
|
+
parseHTML: (element)=>serializeDocumentRunShading(parseDocumentRunShadingElement(element)) ?? null,
|
|
16203
|
+
renderHTML: (attributes)=>documentRunShadingDomAttributes(parseDocumentRunShading(attributes.runShading))
|
|
16204
|
+
},
|
|
16205
|
+
proofingLanguages: {
|
|
16206
|
+
default: null,
|
|
16207
|
+
parseHTML: (element)=>serializeDocumentProofingLanguages(parseDocumentProofingLanguages(element.getAttribute(DOCUMENT_PROOFING_LANGUAGES_ATTRIBUTE))) ?? null,
|
|
16208
|
+
renderHTML: (attributes)=>documentProofingDomAttributes(parseDocumentProofingLanguages(attributes.proofingLanguages), attributes.noProof, normalizeDocumentScriptFontSlot(attributes.scriptFontSlot))
|
|
16209
|
+
},
|
|
16210
|
+
noProof: {
|
|
16211
|
+
default: null,
|
|
16212
|
+
parseHTML: (element)=>normalizeDocumentNoProof(element.getAttribute(DOCUMENT_NO_PROOF_ATTRIBUTE)),
|
|
16213
|
+
renderHTML: (attributes)=>documentProofingDomAttributes(parseDocumentProofingLanguages(attributes.proofingLanguages), attributes.noProof, normalizeDocumentScriptFontSlot(attributes.scriptFontSlot))
|
|
16214
|
+
},
|
|
17049
16215
|
kerningThresholdHalfPoints: {
|
|
17050
16216
|
default: null,
|
|
17051
16217
|
parseHTML: (element)=>documentKerningThresholdHalfPointsFromElement(element),
|
|
@@ -17122,19 +16288,51 @@ const DocumentHighlight = extension_highlight.extend({
|
|
|
17122
16288
|
return {};
|
|
17123
16289
|
},
|
|
17124
16290
|
addAttributes () {
|
|
16291
|
+
const parent = this.parent?.() ?? {};
|
|
17125
16292
|
return {
|
|
17126
|
-
...
|
|
16293
|
+
...parent,
|
|
16294
|
+
color: {
|
|
16295
|
+
...parent.color ?? {},
|
|
16296
|
+
renderHTML: (attributes)=>{
|
|
16297
|
+
const color = 'string' == typeof attributes.color ? attributes.color : null;
|
|
16298
|
+
if (!color) return {};
|
|
16299
|
+
const native = normalizeDocumentHighlight(attributes.nativeHighlight) ?? documentHighlightForCssColor(color);
|
|
16300
|
+
return {
|
|
16301
|
+
'data-color': color,
|
|
16302
|
+
...native ? {
|
|
16303
|
+
[DOCUMENT_HIGHLIGHT_ATTRIBUTE]: native
|
|
16304
|
+
} : {},
|
|
16305
|
+
style: `background-color: ${color}; color: inherit`
|
|
16306
|
+
};
|
|
16307
|
+
}
|
|
16308
|
+
},
|
|
16309
|
+
nativeHighlight: {
|
|
16310
|
+
default: null,
|
|
16311
|
+
parseHTML: (element)=>normalizeDocumentHighlight(element.getAttribute(DOCUMENT_HIGHLIGHT_ATTRIBUTE)),
|
|
16312
|
+
renderHTML: (attributes)=>{
|
|
16313
|
+
const value = normalizeDocumentHighlight(attributes.nativeHighlight);
|
|
16314
|
+
return value ? {
|
|
16315
|
+
[DOCUMENT_HIGHLIGHT_ATTRIBUTE]: value
|
|
16316
|
+
} : {};
|
|
16317
|
+
}
|
|
16318
|
+
},
|
|
17127
16319
|
themeFill: themeReferenceAttribute('officeThemeFill')
|
|
17128
16320
|
};
|
|
17129
16321
|
},
|
|
17130
16322
|
parseHTML () {
|
|
16323
|
+
const excludesRunShading = (element)=>element.hasAttribute(DOCUMENT_RUN_SHADING_ATTRIBUTE) && !element.hasAttribute(DOCUMENT_HIGHLIGHT_ATTRIBUTE) ? false : null;
|
|
17131
16324
|
return [
|
|
17132
16325
|
...this.parent?.() ?? [],
|
|
17133
16326
|
{
|
|
17134
|
-
tag:
|
|
16327
|
+
tag: `span[${DOCUMENT_HIGHLIGHT_ATTRIBUTE}]`
|
|
16328
|
+
},
|
|
16329
|
+
{
|
|
16330
|
+
tag: 'span[data-office-theme-fill]',
|
|
16331
|
+
getAttrs: excludesRunShading
|
|
17135
16332
|
},
|
|
17136
16333
|
{
|
|
17137
|
-
tag: 'span[style*="background-color"]'
|
|
16334
|
+
tag: 'span[style*="background-color"]',
|
|
16335
|
+
getAttrs: excludesRunShading
|
|
17138
16336
|
}
|
|
17139
16337
|
];
|
|
17140
16338
|
}
|
|
@@ -17476,6 +16674,302 @@ function documentTabLeaderLabel(leader) {
|
|
|
17476
16674
|
if ('middleDot' === leader) return '居中点前导符';
|
|
17477
16675
|
return '无前导符';
|
|
17478
16676
|
}
|
|
16677
|
+
const DocumentTableOfContents = core_Node.create({
|
|
16678
|
+
name: 'documentTableOfContents',
|
|
16679
|
+
group: 'block',
|
|
16680
|
+
atom: true,
|
|
16681
|
+
selectable: true,
|
|
16682
|
+
draggable: false,
|
|
16683
|
+
addCommands () {
|
|
16684
|
+
return {
|
|
16685
|
+
insertDocumentTableOfContents: (options = DEFAULT_DOCUMENT_TABLE_OF_CONTENTS_OPTIONS, buildOptions)=>(props)=>insertDocumentTableOfContentsCommand(props, options, buildOptions),
|
|
16686
|
+
updateDocumentTableOfContents: (options, buildOptions)=>(props)=>updateDocumentTableOfContentsCommand(props, options, buildOptions),
|
|
16687
|
+
refreshDocumentTablesOfContents: (buildOptions)=>(props)=>refreshDocumentTablesOfContentsCommand(props, buildOptions)
|
|
16688
|
+
};
|
|
16689
|
+
},
|
|
16690
|
+
addAttributes () {
|
|
16691
|
+
return {
|
|
16692
|
+
id: work_document_table_of_contents_node_hiddenAttribute(''),
|
|
16693
|
+
minLevel: work_document_table_of_contents_node_hiddenAttribute(1),
|
|
16694
|
+
maxLevel: work_document_table_of_contents_node_hiddenAttribute(3),
|
|
16695
|
+
hyperlinks: work_document_table_of_contents_node_hiddenAttribute(true),
|
|
16696
|
+
showPageNumbers: work_document_table_of_contents_node_hiddenAttribute(true),
|
|
16697
|
+
rightAlignPageNumbers: work_document_table_of_contents_node_hiddenAttribute(true),
|
|
16698
|
+
leader: work_document_table_of_contents_node_hiddenAttribute('dot'),
|
|
16699
|
+
entries: work_document_table_of_contents_node_hiddenAttribute([]),
|
|
16700
|
+
truncated: work_document_table_of_contents_node_hiddenAttribute(false)
|
|
16701
|
+
};
|
|
16702
|
+
},
|
|
16703
|
+
parseHTML () {
|
|
16704
|
+
return [
|
|
16705
|
+
{
|
|
16706
|
+
tag: 'div[data-document-table-of-contents]',
|
|
16707
|
+
getAttrs: (node)=>{
|
|
16708
|
+
if (!(node instanceof HTMLElement)) return false;
|
|
16709
|
+
return tableOfContentsNodeAttributes(documentTableOfContentsValueFromElement(node));
|
|
16710
|
+
}
|
|
16711
|
+
}
|
|
16712
|
+
];
|
|
16713
|
+
},
|
|
16714
|
+
renderHTML ({ node, HTMLAttributes }) {
|
|
16715
|
+
const value = normalizeDocumentTableOfContentsValue({
|
|
16716
|
+
id: work_document_table_of_contents_node_stringAttribute(node.attrs.id) || 'document-table-of-contents',
|
|
16717
|
+
options: tableOfContentsOptionsFromAttributes(node.attrs),
|
|
16718
|
+
entries: Array.isArray(node.attrs.entries) ? node.attrs.entries : [],
|
|
16719
|
+
truncated: Boolean(node.attrs.truncated)
|
|
16720
|
+
});
|
|
16721
|
+
const options = value.options;
|
|
16722
|
+
const rows = value.entries.length ? value.entries.map((entry)=>tableOfContentsEntrySpec(entry, options)) : [
|
|
16723
|
+
[
|
|
16724
|
+
'li',
|
|
16725
|
+
{
|
|
16726
|
+
class: 'work-document-table-of-contents-empty'
|
|
16727
|
+
},
|
|
16728
|
+
'没有符合级别范围的标题'
|
|
16729
|
+
]
|
|
16730
|
+
];
|
|
16731
|
+
return [
|
|
16732
|
+
'div',
|
|
16733
|
+
mergeAttributes(HTMLAttributes, {
|
|
16734
|
+
'data-document-table-of-contents': 'true',
|
|
16735
|
+
'data-toc-id': value.id,
|
|
16736
|
+
'data-toc-min-level': String(options.minLevel),
|
|
16737
|
+
'data-toc-max-level': String(options.maxLevel),
|
|
16738
|
+
'data-toc-hyperlinks': String(options.hyperlinks),
|
|
16739
|
+
'data-toc-show-page-numbers': String(options.showPageNumbers),
|
|
16740
|
+
'data-toc-right-align-page-numbers': String(options.rightAlignPageNumbers),
|
|
16741
|
+
'data-toc-leader': options.leader,
|
|
16742
|
+
'data-toc-entries': JSON.stringify(value.entries),
|
|
16743
|
+
'data-toc-truncated': String(value.truncated),
|
|
16744
|
+
class: 'work-document-table-of-contents',
|
|
16745
|
+
contenteditable: 'false',
|
|
16746
|
+
'aria-label': '目录'
|
|
16747
|
+
}),
|
|
16748
|
+
[
|
|
16749
|
+
'div',
|
|
16750
|
+
{
|
|
16751
|
+
class: 'work-document-table-of-contents-header'
|
|
16752
|
+
},
|
|
16753
|
+
[
|
|
16754
|
+
'strong',
|
|
16755
|
+
'目录'
|
|
16756
|
+
],
|
|
16757
|
+
[
|
|
16758
|
+
'span',
|
|
16759
|
+
value.truncated ? '仅显示前 512 项' : `${value.entries.length} 项`
|
|
16760
|
+
]
|
|
16761
|
+
],
|
|
16762
|
+
[
|
|
16763
|
+
'ol',
|
|
16764
|
+
{
|
|
16765
|
+
class: 'work-document-table-of-contents-list'
|
|
16766
|
+
},
|
|
16767
|
+
...rows
|
|
16768
|
+
]
|
|
16769
|
+
];
|
|
16770
|
+
},
|
|
16771
|
+
renderText ({ node }) {
|
|
16772
|
+
const entries = Array.isArray(node.attrs.entries) ? node.attrs.entries : [];
|
|
16773
|
+
return entries.map((entry)=>entry.title).join('\n');
|
|
16774
|
+
},
|
|
16775
|
+
addProseMirrorPlugins () {
|
|
16776
|
+
return [
|
|
16777
|
+
new Plugin({
|
|
16778
|
+
props: {
|
|
16779
|
+
handleDOMEvents: {
|
|
16780
|
+
click: (view, event)=>{
|
|
16781
|
+
if (!(event.target instanceof Element)) return false;
|
|
16782
|
+
const table = event.target.closest('[data-document-table-of-contents][data-toc-hyperlinks="true"]');
|
|
16783
|
+
if (!table) return false;
|
|
16784
|
+
const link = event.target.closest('[data-toc-target]');
|
|
16785
|
+
if (!link || !table.contains(link)) return false;
|
|
16786
|
+
const targetId = link.dataset.tocTarget?.trim();
|
|
16787
|
+
if (!targetId) return false;
|
|
16788
|
+
const target = collectWorkDocumentOutline(view.state.doc).find((item)=>item.id === targetId);
|
|
16789
|
+
if (!target) return false;
|
|
16790
|
+
event.preventDefault();
|
|
16791
|
+
view.dispatch(view.state.tr.setSelection(TextSelection.near(view.state.doc.resolve(target.from))).scrollIntoView());
|
|
16792
|
+
view.focus();
|
|
16793
|
+
return true;
|
|
16794
|
+
}
|
|
16795
|
+
}
|
|
16796
|
+
}
|
|
16797
|
+
})
|
|
16798
|
+
];
|
|
16799
|
+
}
|
|
16800
|
+
});
|
|
16801
|
+
function selectedDocumentTableOfContentsOptions(editor) {
|
|
16802
|
+
const selection = editor.state.selection;
|
|
16803
|
+
if (!(selection instanceof NodeSelection) || 'documentTableOfContents' !== selection.node.type.name) return null;
|
|
16804
|
+
return tableOfContentsOptionsFromAttributes(selection.node.attrs);
|
|
16805
|
+
}
|
|
16806
|
+
function documentHasTableOfContents(editor) {
|
|
16807
|
+
let found = false;
|
|
16808
|
+
editor.state.doc.descendants((node)=>{
|
|
16809
|
+
if ('documentTableOfContents' === node.type.name) found = true;
|
|
16810
|
+
return !found;
|
|
16811
|
+
});
|
|
16812
|
+
return found;
|
|
16813
|
+
}
|
|
16814
|
+
function insertDocumentTableOfContentsCommand({ dispatch, editor, tr }, source, buildOptions = {}) {
|
|
16815
|
+
const nodeType = editor.schema.nodes.documentTableOfContents;
|
|
16816
|
+
if (!nodeType) return false;
|
|
16817
|
+
if (!dispatch) return true;
|
|
16818
|
+
const options = normalizeDocumentTableOfContentsOptions(source);
|
|
16819
|
+
ensureTableOfContentsHeadingIdentities(tr, [
|
|
16820
|
+
options
|
|
16821
|
+
]);
|
|
16822
|
+
const built = buildDocumentTableOfContentsEntries(tr.doc, options, buildOptions);
|
|
16823
|
+
tr.replaceSelectionWith(nodeType.create({
|
|
16824
|
+
id: createWorkId('toc'),
|
|
16825
|
+
...options,
|
|
16826
|
+
...built
|
|
16827
|
+
}), false);
|
|
16828
|
+
tr.scrollIntoView();
|
|
16829
|
+
return true;
|
|
16830
|
+
}
|
|
16831
|
+
function updateDocumentTableOfContentsCommand({ dispatch, state, tr }, source, buildOptions = {}) {
|
|
16832
|
+
const selection = state.selection;
|
|
16833
|
+
if (!(selection instanceof NodeSelection) || 'documentTableOfContents' !== selection.node.type.name) return false;
|
|
16834
|
+
if (!dispatch) return true;
|
|
16835
|
+
const options = normalizeDocumentTableOfContentsOptions(source);
|
|
16836
|
+
ensureTableOfContentsHeadingIdentities(tr, [
|
|
16837
|
+
options
|
|
16838
|
+
]);
|
|
16839
|
+
const built = buildDocumentTableOfContentsEntries(tr.doc, options, buildOptions);
|
|
16840
|
+
tr.setNodeMarkup(selection.from, void 0, {
|
|
16841
|
+
...selection.node.attrs,
|
|
16842
|
+
...options,
|
|
16843
|
+
...built
|
|
16844
|
+
});
|
|
16845
|
+
tr.scrollIntoView();
|
|
16846
|
+
return tr.docChanged;
|
|
16847
|
+
}
|
|
16848
|
+
function refreshDocumentTablesOfContentsCommand({ dispatch, state, tr }, buildOptions = {}) {
|
|
16849
|
+
const tableOptions = [];
|
|
16850
|
+
state.doc.descendants((node)=>{
|
|
16851
|
+
if ('documentTableOfContents' === node.type.name) tableOptions.push(tableOfContentsOptionsFromAttributes(node.attrs));
|
|
16852
|
+
});
|
|
16853
|
+
if (!tableOptions.length) return false;
|
|
16854
|
+
ensureTableOfContentsHeadingIdentities(tr, tableOptions);
|
|
16855
|
+
const updates = [];
|
|
16856
|
+
tr.doc.descendants((node, position)=>{
|
|
16857
|
+
if ('documentTableOfContents' !== node.type.name) return;
|
|
16858
|
+
const options = tableOfContentsOptionsFromAttributes(node.attrs);
|
|
16859
|
+
const built = buildDocumentTableOfContentsEntries(tr.doc, options, buildOptions);
|
|
16860
|
+
if (JSON.stringify(node.attrs.entries) === JSON.stringify(built.entries) && Boolean(node.attrs.truncated) === built.truncated) return;
|
|
16861
|
+
updates.push({
|
|
16862
|
+
position,
|
|
16863
|
+
attrs: {
|
|
16864
|
+
...node.attrs,
|
|
16865
|
+
...options,
|
|
16866
|
+
...built
|
|
16867
|
+
}
|
|
16868
|
+
});
|
|
16869
|
+
});
|
|
16870
|
+
if (!updates.length) return false;
|
|
16871
|
+
if (!dispatch) return true;
|
|
16872
|
+
for (const update of updates)tr.setNodeMarkup(update.position, void 0, update.attrs);
|
|
16873
|
+
tr.scrollIntoView();
|
|
16874
|
+
return tr.docChanged;
|
|
16875
|
+
}
|
|
16876
|
+
function ensureTableOfContentsHeadingIdentities(transaction, tableOptions) {
|
|
16877
|
+
const paragraphIdCounts = new Map();
|
|
16878
|
+
transaction.doc.descendants((node)=>{
|
|
16879
|
+
const paragraphId = normalizeDocumentParagraphId(node.attrs.paragraphId);
|
|
16880
|
+
if (!paragraphId) return;
|
|
16881
|
+
paragraphIdCounts.set(paragraphId, (paragraphIdCounts.get(paragraphId) ?? 0) + 1);
|
|
16882
|
+
});
|
|
16883
|
+
const registry = createDocumentParagraphIdentityRegistry();
|
|
16884
|
+
for (const paragraphId of paragraphIdCounts.keys())registry.paragraphIds.add(paragraphId);
|
|
16885
|
+
const updates = [];
|
|
16886
|
+
transaction.doc.descendants((node, position)=>{
|
|
16887
|
+
const level = workDocumentOutlineLevel(node);
|
|
16888
|
+
if (null === level || !tableOptions.some((options)=>level >= options.minLevel && level <= options.maxLevel)) return;
|
|
16889
|
+
const paragraphId = normalizeDocumentParagraphId(node.attrs.paragraphId);
|
|
16890
|
+
const textId = normalizeDocumentParagraphId(node.attrs.textId);
|
|
16891
|
+
let identity;
|
|
16892
|
+
identity = paragraphId && 1 === paragraphIdCounts.get(paragraphId) ? {
|
|
16893
|
+
paragraphId,
|
|
16894
|
+
textId: textId ?? createDocumentParagraphIdentity().textId
|
|
16895
|
+
} : uniqueDocumentParagraphIdentity({}, registry);
|
|
16896
|
+
if (paragraphId === identity.paragraphId && textId === identity.textId) return;
|
|
16897
|
+
updates.push({
|
|
16898
|
+
attrs: node.attrs,
|
|
16899
|
+
identity,
|
|
16900
|
+
position
|
|
16901
|
+
});
|
|
16902
|
+
});
|
|
16903
|
+
for (const update of updates)transaction.setNodeMarkup(update.position, void 0, {
|
|
16904
|
+
...update.attrs,
|
|
16905
|
+
...update.identity
|
|
16906
|
+
});
|
|
16907
|
+
}
|
|
16908
|
+
function tableOfContentsOptionsFromAttributes(attrs) {
|
|
16909
|
+
return normalizeDocumentTableOfContentsOptions({
|
|
16910
|
+
minLevel: Number(attrs.minLevel),
|
|
16911
|
+
maxLevel: Number(attrs.maxLevel),
|
|
16912
|
+
hyperlinks: Boolean(attrs.hyperlinks),
|
|
16913
|
+
showPageNumbers: Boolean(attrs.showPageNumbers),
|
|
16914
|
+
rightAlignPageNumbers: Boolean(attrs.rightAlignPageNumbers),
|
|
16915
|
+
leader: 'string' == typeof attrs.leader ? attrs.leader : 'dot'
|
|
16916
|
+
});
|
|
16917
|
+
}
|
|
16918
|
+
function tableOfContentsNodeAttributes(value) {
|
|
16919
|
+
return {
|
|
16920
|
+
id: value.id,
|
|
16921
|
+
...value.options,
|
|
16922
|
+
entries: value.entries,
|
|
16923
|
+
truncated: value.truncated
|
|
16924
|
+
};
|
|
16925
|
+
}
|
|
16926
|
+
function tableOfContentsEntrySpec(entry, options) {
|
|
16927
|
+
const title = options.hyperlinks ? [
|
|
16928
|
+
'a',
|
|
16929
|
+
{
|
|
16930
|
+
href: `#${entry.targetId}`,
|
|
16931
|
+
'data-toc-target': entry.targetId,
|
|
16932
|
+
tabindex: '-1'
|
|
16933
|
+
},
|
|
16934
|
+
entry.title
|
|
16935
|
+
] : [
|
|
16936
|
+
'span',
|
|
16937
|
+
entry.title
|
|
16938
|
+
];
|
|
16939
|
+
return [
|
|
16940
|
+
'li',
|
|
16941
|
+
{
|
|
16942
|
+
'data-toc-target': entry.targetId,
|
|
16943
|
+
'data-toc-level': String(entry.level),
|
|
16944
|
+
style: `--work-toc-level:${entry.level}`
|
|
16945
|
+
},
|
|
16946
|
+
title,
|
|
16947
|
+
[
|
|
16948
|
+
'i',
|
|
16949
|
+
{
|
|
16950
|
+
'aria-hidden': 'true'
|
|
16951
|
+
}
|
|
16952
|
+
],
|
|
16953
|
+
...options.showPageNumbers ? [
|
|
16954
|
+
[
|
|
16955
|
+
'span',
|
|
16956
|
+
{
|
|
16957
|
+
class: 'work-document-table-of-contents-page'
|
|
16958
|
+
},
|
|
16959
|
+
String(entry.pageNumber)
|
|
16960
|
+
]
|
|
16961
|
+
] : []
|
|
16962
|
+
];
|
|
16963
|
+
}
|
|
16964
|
+
function work_document_table_of_contents_node_hiddenAttribute(defaultValue) {
|
|
16965
|
+
return {
|
|
16966
|
+
default: defaultValue,
|
|
16967
|
+
rendered: false
|
|
16968
|
+
};
|
|
16969
|
+
}
|
|
16970
|
+
function work_document_table_of_contents_node_stringAttribute(value) {
|
|
16971
|
+
return 'string' == typeof value ? value.trim() : '';
|
|
16972
|
+
}
|
|
17479
16973
|
const BORDER_EDGES = [
|
|
17480
16974
|
'top',
|
|
17481
16975
|
'right',
|
|
@@ -19382,6 +18876,7 @@ function createWorkDocumentExtensions(options = {}) {
|
|
|
19382
18876
|
DocumentCrossReference,
|
|
19383
18877
|
citationExtension,
|
|
19384
18878
|
DocumentBibliography,
|
|
18879
|
+
DocumentTableOfContents,
|
|
19385
18880
|
DocumentField,
|
|
19386
18881
|
DocumentEquation,
|
|
19387
18882
|
commentExtension,
|
|
@@ -21241,4 +20736,4 @@ function registerDocumentPageSurfaceGeometry(element, provider) {
|
|
|
21241
20736
|
function documentPageSurfaceGeometryForElement(element) {
|
|
21242
20737
|
return documentPageSurfaceProviders.get(element)?.() ?? null;
|
|
21243
20738
|
}
|
|
21244
|
-
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,
|
|
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, createSchemaValidatedWorkDocumentModel, createWorkDocumentExtensions, createWorkDocumentModel, createWorkDocumentModelFromContent, 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, 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, importedDocumentCharacterFormatting, initializeWorkOfficeDocumentCollaboration as initializeOfficeDocumentCollaboration, invalidateDocumentLazyHtmlProjection, isContourImageLayout, isValidDocumentCitationTag, materializeLazyDocumentEditorRoot, materializeWorkDocumentContent, measureDocumentLayoutBlocksIncrementally, millimetersToPixels, mountWorkLiveDocumentCapture, 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, registerDocumentPageSurfaceGeometry, renderDocumentAutoLineHeight, renderDocumentTableBorders, renderDocumentTableCellMarginOverrides, resolveDocumentPageBorders, resolveDocumentPageChrome, resolveDocumentPageMargins, resolveDocumentPageSize, resolveWorkDocumentEditorInput, retainAnchoredDocumentComments, sanitizeDocumentPageChromeHtml, selectedDocumentChunkId, selectedDocumentTableOfContentsOptions, 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_page_margins_twipsToMillimeters, wrapsBesideImage };
|