@a3s-lab/office 0.27.0 → 0.29.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 +41 -1
- package/dist/0~1403.js +1 -1
- package/dist/0~4980.js +1 -1
- package/dist/0~5093.js +164 -5
- package/dist/0~7043.js +241 -241
- package/dist/0~7048.js +1 -1
- package/dist/0~7614.js +1 -1
- package/dist/0~document-editor.js +626 -12
- package/dist/0~presentation-editor.js +1 -1
- package/dist/0~spreadsheet-editor.js +1 -2
- package/dist/0~work-docx-export.js +396 -20
- package/dist/0~work-docx-import.js +7 -3
- package/dist/0~work-office-diagnostics.js +98 -4
- package/dist/0~work-pptx-export.js +1 -1
- package/dist/0~work-pptx-import.js +1 -1
- package/dist/0~work-presentation-charts.js +1 -1
- package/dist/1544.js +1 -1
- package/dist/4104.js +2 -2
- package/dist/4121.js +1510 -0
- package/dist/6282.js +220 -682
- package/dist/8715.js +1 -1
- package/dist/core.js +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/features/work/editors/document-command-catalog.d.ts +9 -0
- package/dist/internal/features/work/editors/document-font-dialog-model.d.ts +33 -2
- package/dist/internal/features/work/editors/document-font-dialog-run-border-model.d.ts +24 -0
- package/dist/internal/features/work/editors/document-font-dialog-run-border-section.d.ts +10 -0
- package/dist/internal/features/work/work-document-character-formatting.d.ts +4 -0
- package/dist/internal/features/work/work-document-format-changes.d.ts +5 -0
- package/dist/internal/features/work/work-document-legacy-text-effects.d.ts +27 -0
- package/dist/internal/features/work/work-document-run-border.d.ts +11 -0
- package/dist/internal/features/work/work-document-word-line-metrics.d.ts +5 -0
- package/dist/internal/features/work/work-docx-hidden-text-export.d.ts +1 -0
- package/dist/internal/features/work/work-docx-legacy-text-effects-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-legacy-text-effects-export.d.ts +18 -0
- package/dist/internal/features/work/work-docx-legacy-text-effects.d.ts +12 -0
- package/dist/internal/features/work/work-docx-run-border-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-run-border-export.d.ts +17 -0
- package/dist/internal/features/work/work-docx-run-border.d.ts +20 -0
- package/dist/internal/features/work/work-docx-run-formatting-import.d.ts +6 -0
- package/dist/internal/features/work/work-docx-run-property-order.d.ts +2 -0
- package/dist/office-kernel.wasm +0 -0
- package/dist/styles.css +72 -0
- package/docs/latest/en/browser-editor-architecture.md +36 -0
- package/package.json +7 -1
- package/dist/5184.js +0 -649
- package/dist/9424.js +0 -16
package/dist/6282.js
CHANGED
|
@@ -9,7 +9,6 @@ import extension_text_align from "@tiptap/extension-text-align";
|
|
|
9
9
|
import font_size from "@tiptap/extension-text-style/font-size";
|
|
10
10
|
import starter_kit from "@tiptap/starter-kit";
|
|
11
11
|
import { DOMParser as model_DOMParser, Fragment, Slice } from "@tiptap/pm/model";
|
|
12
|
-
import jszip from "jszip";
|
|
13
12
|
import { closeHistory, isHistoryTransaction } from "@tiptap/pm/history";
|
|
14
13
|
import extension_underline from "@tiptap/extension-underline";
|
|
15
14
|
import extension_strike from "@tiptap/extension-strike";
|
|
@@ -22,8 +21,7 @@ import { CellSelection, TableMap, isInTable, selectedRect } from "@tiptap/pm/tab
|
|
|
22
21
|
import font_family from "@tiptap/extension-text-style/font-family";
|
|
23
22
|
import { TextStyle } from "@tiptap/extension-text-style";
|
|
24
23
|
import extension_highlight from "@tiptap/extension-highlight";
|
|
25
|
-
import {
|
|
26
|
-
import { normalizeCssColor } from "./9424.js";
|
|
24
|
+
import { documentRunBorderDomAttributes, normalizeDocumentRunBorder, parseDocumentRunBorder, normalizeDocumentParagraphBorder, serializeDocumentParagraphBorders, parseDocxThemeReference, serializeDocumentRunBorder, normalizeCssColor, DOCUMENT_PARAGRAPH_BORDERS_ATTRIBUTE, serializeDocxThemeReference, parseDocumentParagraphBordersElement, parseDocumentParagraphBorders, documentBorderPresentation, DOCUMENT_RUN_BORDER_ATTRIBUTE, parseDocumentRunBorderElement, documentRunBorderIsVisible, documentParagraphBordersDomAttributes, createOfficeId as createWorkId } from "./4121.js";
|
|
27
25
|
import { workOfficeCollaborationJsonEqual, canonicalWorkOfficeCollaborationJson, isWorkOfficeCollaborationRecord, cloneWorkOfficeCollaborationJson } from "./4650.js";
|
|
28
26
|
import { assertWorkOfficeCollaborationEditable, markWorkOfficeCollaborationInitialized, assertWorkOfficeCollaborationOrigin, initializeWorkOfficeCollaborationMetadata, assertWorkOfficeCollaborationWritable, OfficeCollaborationError as WorkOfficeCollaborationError, readOfficeCollaborationMetadata as readWorkOfficeCollaborationMetadata, registerWorkOfficeCollaborationInitializer } from "./9787.js";
|
|
29
27
|
import * as __rspack_external_yjs from "yjs";
|
|
@@ -2210,681 +2208,6 @@ function work_document_notes_positiveInteger(value, fallback) {
|
|
|
2210
2208
|
const number = Number(value);
|
|
2211
2209
|
return Number.isSafeInteger(number) && number > 0 ? number : fallback;
|
|
2212
2210
|
}
|
|
2213
|
-
const WORD_NAMESPACE = 'http://schemas.openxmlformats.org/wordprocessingml/2006/main';
|
|
2214
|
-
class DocxThemePatchCollector {
|
|
2215
|
-
patches = [];
|
|
2216
|
-
nextMarker = 1;
|
|
2217
|
-
usedColors;
|
|
2218
|
-
constructor(sourceHtml){
|
|
2219
|
-
this.usedColors = sourceColors(sourceHtml);
|
|
2220
|
-
}
|
|
2221
|
-
marker(kind, reference, currentColor) {
|
|
2222
|
-
if (!reference || normalizeColor(currentColor) !== reference.resolved) return null;
|
|
2223
|
-
let marker = '';
|
|
2224
|
-
do {
|
|
2225
|
-
marker = (0xf00000 + this.nextMarker).toString(16).padStart(6, '0').toUpperCase();
|
|
2226
|
-
this.nextMarker += 1;
|
|
2227
|
-
}while (this.usedColors.has(marker))
|
|
2228
|
-
this.usedColors.add(marker);
|
|
2229
|
-
this.patches.push({
|
|
2230
|
-
kind,
|
|
2231
|
-
marker,
|
|
2232
|
-
reference
|
|
2233
|
-
});
|
|
2234
|
-
return marker;
|
|
2235
|
-
}
|
|
2236
|
-
}
|
|
2237
|
-
function serializeDocxThemeReference(reference) {
|
|
2238
|
-
return reference ? JSON.stringify(reference) : void 0;
|
|
2239
|
-
}
|
|
2240
|
-
function parseDocxThemeReference(value) {
|
|
2241
|
-
if (!value) return null;
|
|
2242
|
-
try {
|
|
2243
|
-
const parsed = JSON.parse(value);
|
|
2244
|
-
const theme = 'string' == typeof parsed.theme ? parsed.theme.trim() : '';
|
|
2245
|
-
const resolved = normalizeColor('string' == typeof parsed.resolved ? parsed.resolved : null);
|
|
2246
|
-
const tint = byteHex(parsed.tint);
|
|
2247
|
-
const shade = byteHex(parsed.shade);
|
|
2248
|
-
if (!theme || !resolved) return null;
|
|
2249
|
-
return {
|
|
2250
|
-
theme,
|
|
2251
|
-
resolved,
|
|
2252
|
-
...tint ? {
|
|
2253
|
-
tint
|
|
2254
|
-
} : {},
|
|
2255
|
-
...shade ? {
|
|
2256
|
-
shade
|
|
2257
|
-
} : {}
|
|
2258
|
-
};
|
|
2259
|
-
} catch {
|
|
2260
|
-
return null;
|
|
2261
|
-
}
|
|
2262
|
-
}
|
|
2263
|
-
async function patchDocxThemeReferences(buffer, patches) {
|
|
2264
|
-
if (!patches.length) return buffer;
|
|
2265
|
-
const archive = await jszip.loadAsync(buffer);
|
|
2266
|
-
const byMarker = new Map(patches.map((patch)=>[
|
|
2267
|
-
patch.marker,
|
|
2268
|
-
patch
|
|
2269
|
-
]));
|
|
2270
|
-
const entries = Object.values(archive.files).filter((entry)=>!entry.dir && /^word\/(?:document|header\d+|footer\d+|footnotes|endnotes|comments)\.xml$/.test(entry.name));
|
|
2271
|
-
for (const entry of entries){
|
|
2272
|
-
const document1 = parseXml(await entry.async('text'), entry.name);
|
|
2273
|
-
let changed = false;
|
|
2274
|
-
for (const element of Array.from(document1.getElementsByTagName('*')))for (const target of themePatchTargets(element.localName)){
|
|
2275
|
-
const marker = wordAttribute(element, target.directAttribute)?.toUpperCase();
|
|
2276
|
-
const patch = marker ? byMarker.get(marker) : void 0;
|
|
2277
|
-
if (patch && patch.kind === target.kind) {
|
|
2278
|
-
setWordAttribute(document1, element, target.directAttribute, patch.reference.resolved.slice(1).toUpperCase());
|
|
2279
|
-
setWordAttribute(document1, element, target.themeAttribute, patch.reference.theme);
|
|
2280
|
-
setOptionalWordAttribute(document1, element, target.tintAttribute, patch.reference.tint);
|
|
2281
|
-
setOptionalWordAttribute(document1, element, target.shadeAttribute, patch.reference.shade);
|
|
2282
|
-
changed = true;
|
|
2283
|
-
}
|
|
2284
|
-
}
|
|
2285
|
-
if (changed) archive.file(entry.name, new XMLSerializer().serializeToString(document1));
|
|
2286
|
-
}
|
|
2287
|
-
return archive.generateAsync({
|
|
2288
|
-
type: 'arraybuffer'
|
|
2289
|
-
});
|
|
2290
|
-
}
|
|
2291
|
-
function themePatchTargets(localName) {
|
|
2292
|
-
if ('color' === localName) return [
|
|
2293
|
-
{
|
|
2294
|
-
kind: 'color',
|
|
2295
|
-
directAttribute: 'val',
|
|
2296
|
-
themeAttribute: 'themeColor',
|
|
2297
|
-
tintAttribute: 'themeTint',
|
|
2298
|
-
shadeAttribute: 'themeShade'
|
|
2299
|
-
}
|
|
2300
|
-
];
|
|
2301
|
-
if ('u' === localName) return [
|
|
2302
|
-
{
|
|
2303
|
-
kind: 'underline',
|
|
2304
|
-
directAttribute: 'color',
|
|
2305
|
-
themeAttribute: 'themeColor',
|
|
2306
|
-
tintAttribute: 'themeTint',
|
|
2307
|
-
shadeAttribute: 'themeShade'
|
|
2308
|
-
}
|
|
2309
|
-
];
|
|
2310
|
-
if ('shd' === localName) return [
|
|
2311
|
-
{
|
|
2312
|
-
kind: 'fill',
|
|
2313
|
-
directAttribute: 'fill',
|
|
2314
|
-
themeAttribute: 'themeFill',
|
|
2315
|
-
tintAttribute: 'themeFillTint',
|
|
2316
|
-
shadeAttribute: 'themeFillShade'
|
|
2317
|
-
},
|
|
2318
|
-
{
|
|
2319
|
-
kind: 'shadingColor',
|
|
2320
|
-
directAttribute: 'color',
|
|
2321
|
-
themeAttribute: 'themeColor',
|
|
2322
|
-
tintAttribute: 'themeTint',
|
|
2323
|
-
shadeAttribute: 'themeShade'
|
|
2324
|
-
}
|
|
2325
|
-
];
|
|
2326
|
-
return [
|
|
2327
|
-
'top',
|
|
2328
|
-
'right',
|
|
2329
|
-
'bottom',
|
|
2330
|
-
'left',
|
|
2331
|
-
'start',
|
|
2332
|
-
'end'
|
|
2333
|
-
].includes(localName) ? [
|
|
2334
|
-
{
|
|
2335
|
-
kind: 'border',
|
|
2336
|
-
directAttribute: 'color',
|
|
2337
|
-
themeAttribute: 'themeColor',
|
|
2338
|
-
tintAttribute: 'themeTint',
|
|
2339
|
-
shadeAttribute: 'themeShade'
|
|
2340
|
-
}
|
|
2341
|
-
] : [];
|
|
2342
|
-
}
|
|
2343
|
-
function normalizeColor(value) {
|
|
2344
|
-
const normalized = value?.trim().toLowerCase();
|
|
2345
|
-
if (!normalized || !/^#[0-9a-f]{6}$/.test(normalized)) return null;
|
|
2346
|
-
return normalized;
|
|
2347
|
-
}
|
|
2348
|
-
function sourceColors(source) {
|
|
2349
|
-
const colors = new Set();
|
|
2350
|
-
for (const match of source.matchAll(/#([0-9a-f]{6})\b/gi))if (match[1]) colors.add(match[1].toUpperCase());
|
|
2351
|
-
for (const match of source.matchAll(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/gi)){
|
|
2352
|
-
const channels = match.slice(1, 4).map(Number);
|
|
2353
|
-
if (!channels.some((channel)=>channel < 0 || channel > 255)) colors.add(channels.map((channel)=>channel.toString(16).padStart(2, '0')).join('').toUpperCase());
|
|
2354
|
-
}
|
|
2355
|
-
return colors;
|
|
2356
|
-
}
|
|
2357
|
-
function byteHex(value) {
|
|
2358
|
-
if ('string' != typeof value) return;
|
|
2359
|
-
const normalized = value.trim().toUpperCase();
|
|
2360
|
-
return /^[0-9A-F]{2}$/.test(normalized) ? normalized : void 0;
|
|
2361
|
-
}
|
|
2362
|
-
function wordAttribute(element, name) {
|
|
2363
|
-
return element.getAttributeNS(WORD_NAMESPACE, name) ?? element.getAttribute(`w:${name}`);
|
|
2364
|
-
}
|
|
2365
|
-
function setWordAttribute(document1, element, name, value) {
|
|
2366
|
-
const prefix = xmlNamespacePrefix(document1.documentElement, WORD_NAMESPACE) ?? 'w';
|
|
2367
|
-
element.setAttributeNS(WORD_NAMESPACE, `${prefix}:${name}`, value);
|
|
2368
|
-
}
|
|
2369
|
-
function setOptionalWordAttribute(document1, element, name, value) {
|
|
2370
|
-
if (value) setWordAttribute(document1, element, name, value);
|
|
2371
|
-
else element.removeAttributeNS(WORD_NAMESPACE, name);
|
|
2372
|
-
}
|
|
2373
|
-
const DOCUMENT_PARAGRAPH_BORDERS_ATTRIBUTE = 'data-office-paragraph-borders';
|
|
2374
|
-
const DOCUMENT_PARAGRAPH_BORDER_EDGES = [
|
|
2375
|
-
'top',
|
|
2376
|
-
'left',
|
|
2377
|
-
'bottom',
|
|
2378
|
-
'right',
|
|
2379
|
-
'between',
|
|
2380
|
-
'bar'
|
|
2381
|
-
];
|
|
2382
|
-
const DOCUMENT_PARAGRAPH_BORDER_STYLES = [
|
|
2383
|
-
'nil',
|
|
2384
|
-
'none',
|
|
2385
|
-
'single',
|
|
2386
|
-
'thick',
|
|
2387
|
-
'double',
|
|
2388
|
-
'dotted',
|
|
2389
|
-
'dashed',
|
|
2390
|
-
'dotDash',
|
|
2391
|
-
'dotDotDash',
|
|
2392
|
-
'triple',
|
|
2393
|
-
'thinThickSmallGap',
|
|
2394
|
-
'thickThinSmallGap',
|
|
2395
|
-
'thinThickThinSmallGap',
|
|
2396
|
-
'thinThickMediumGap',
|
|
2397
|
-
'thickThinMediumGap',
|
|
2398
|
-
'thinThickThinMediumGap',
|
|
2399
|
-
'thinThickLargeGap',
|
|
2400
|
-
'thickThinLargeGap',
|
|
2401
|
-
'thinThickThinLargeGap',
|
|
2402
|
-
'wave',
|
|
2403
|
-
'doubleWave',
|
|
2404
|
-
'dashSmallGap',
|
|
2405
|
-
'dashDotStroked',
|
|
2406
|
-
'threeDEmboss',
|
|
2407
|
-
'threeDEngrave',
|
|
2408
|
-
'outset',
|
|
2409
|
-
'inset',
|
|
2410
|
-
'apples',
|
|
2411
|
-
'archedScallops',
|
|
2412
|
-
'babyPacifier',
|
|
2413
|
-
'babyRattle',
|
|
2414
|
-
'balloons3Colors',
|
|
2415
|
-
'balloonsHotAir',
|
|
2416
|
-
'basicBlackDashes',
|
|
2417
|
-
'basicBlackDots',
|
|
2418
|
-
'basicBlackSquares',
|
|
2419
|
-
'basicThinLines',
|
|
2420
|
-
'basicWhiteDashes',
|
|
2421
|
-
'basicWhiteDots',
|
|
2422
|
-
'basicWhiteSquares',
|
|
2423
|
-
'basicWideInline',
|
|
2424
|
-
'basicWideMidline',
|
|
2425
|
-
'basicWideOutline',
|
|
2426
|
-
'bats',
|
|
2427
|
-
'birds',
|
|
2428
|
-
'birdsFlight',
|
|
2429
|
-
'cabins',
|
|
2430
|
-
'cakeSlice',
|
|
2431
|
-
'candyCorn',
|
|
2432
|
-
'celticKnotwork',
|
|
2433
|
-
'certificateBanner',
|
|
2434
|
-
'chainLink',
|
|
2435
|
-
'champagneBottle',
|
|
2436
|
-
'checkedBarBlack',
|
|
2437
|
-
'checkedBarColor',
|
|
2438
|
-
'checkered',
|
|
2439
|
-
'christmasTree',
|
|
2440
|
-
'circlesLines',
|
|
2441
|
-
'circlesRectangles',
|
|
2442
|
-
'classicalWave',
|
|
2443
|
-
'clocks',
|
|
2444
|
-
'compass',
|
|
2445
|
-
'confetti',
|
|
2446
|
-
'confettiGrays',
|
|
2447
|
-
'confettiOutline',
|
|
2448
|
-
'confettiStreamers',
|
|
2449
|
-
'confettiWhite',
|
|
2450
|
-
'cornerTriangles',
|
|
2451
|
-
'couponCutoutDashes',
|
|
2452
|
-
'couponCutoutDots',
|
|
2453
|
-
'crazyMaze',
|
|
2454
|
-
'creaturesButterfly',
|
|
2455
|
-
'creaturesFish',
|
|
2456
|
-
'creaturesInsects',
|
|
2457
|
-
'creaturesLadyBug',
|
|
2458
|
-
'crossStitch',
|
|
2459
|
-
'cup',
|
|
2460
|
-
'decoArch',
|
|
2461
|
-
'decoArchColor',
|
|
2462
|
-
'decoBlocks',
|
|
2463
|
-
'diamondsGray',
|
|
2464
|
-
'doubleD',
|
|
2465
|
-
'doubleDiamonds',
|
|
2466
|
-
'earth1',
|
|
2467
|
-
'earth2',
|
|
2468
|
-
'eclipsingSquares1',
|
|
2469
|
-
'eclipsingSquares2',
|
|
2470
|
-
'eggsBlack',
|
|
2471
|
-
'fans',
|
|
2472
|
-
'film',
|
|
2473
|
-
'firecrackers',
|
|
2474
|
-
'flowersBlockPrint',
|
|
2475
|
-
'flowersDaisies',
|
|
2476
|
-
'flowersModern1',
|
|
2477
|
-
'flowersModern2',
|
|
2478
|
-
'flowersPansy',
|
|
2479
|
-
'flowersRedRose',
|
|
2480
|
-
'flowersRoses',
|
|
2481
|
-
'flowersTeacup',
|
|
2482
|
-
'flowersTiny',
|
|
2483
|
-
'gems',
|
|
2484
|
-
'gingerbreadMan',
|
|
2485
|
-
'gradient',
|
|
2486
|
-
'handmade1',
|
|
2487
|
-
'handmade2',
|
|
2488
|
-
'heartBalloon',
|
|
2489
|
-
'heartGray',
|
|
2490
|
-
'hearts',
|
|
2491
|
-
'heebieJeebies',
|
|
2492
|
-
'holly',
|
|
2493
|
-
'houseFunky',
|
|
2494
|
-
'hypnotic',
|
|
2495
|
-
'iceCreamCones',
|
|
2496
|
-
'lightBulb',
|
|
2497
|
-
'lightning1',
|
|
2498
|
-
'lightning2',
|
|
2499
|
-
'mapPins',
|
|
2500
|
-
'mapleLeaf',
|
|
2501
|
-
'mapleMuffins',
|
|
2502
|
-
'marquee',
|
|
2503
|
-
'marqueeToothed',
|
|
2504
|
-
'moons',
|
|
2505
|
-
'mosaic',
|
|
2506
|
-
'musicNotes',
|
|
2507
|
-
'northwest',
|
|
2508
|
-
'ovals',
|
|
2509
|
-
'packages',
|
|
2510
|
-
'palmsBlack',
|
|
2511
|
-
'palmsColor',
|
|
2512
|
-
'paperClips',
|
|
2513
|
-
'papyrus',
|
|
2514
|
-
'partyFavor',
|
|
2515
|
-
'partyGlass',
|
|
2516
|
-
'pencils',
|
|
2517
|
-
'people',
|
|
2518
|
-
'peopleWaving',
|
|
2519
|
-
'peopleHats',
|
|
2520
|
-
'poinsettias',
|
|
2521
|
-
'postageStamp',
|
|
2522
|
-
'pumpkin1',
|
|
2523
|
-
'pushPinNote2',
|
|
2524
|
-
'pushPinNote1',
|
|
2525
|
-
'pyramids',
|
|
2526
|
-
'pyramidsAbove',
|
|
2527
|
-
'quadrants',
|
|
2528
|
-
'rings',
|
|
2529
|
-
'safari',
|
|
2530
|
-
'sawtooth',
|
|
2531
|
-
'sawtoothGray',
|
|
2532
|
-
'scaredCat',
|
|
2533
|
-
'seattle',
|
|
2534
|
-
'shadowedSquares',
|
|
2535
|
-
'sharksTeeth',
|
|
2536
|
-
'shorebirdTracks',
|
|
2537
|
-
'skyrocket',
|
|
2538
|
-
'snowflakeFancy',
|
|
2539
|
-
'snowflakes',
|
|
2540
|
-
'sombrero',
|
|
2541
|
-
'southwest',
|
|
2542
|
-
'stars',
|
|
2543
|
-
'starsTop',
|
|
2544
|
-
'stars3d',
|
|
2545
|
-
'starsBlack',
|
|
2546
|
-
'starsShadowed',
|
|
2547
|
-
'sun',
|
|
2548
|
-
'swirligig',
|
|
2549
|
-
'tornPaper',
|
|
2550
|
-
'tornPaperBlack',
|
|
2551
|
-
'trees',
|
|
2552
|
-
'triangleParty',
|
|
2553
|
-
'triangles',
|
|
2554
|
-
'tribal1',
|
|
2555
|
-
'tribal2',
|
|
2556
|
-
'tribal3',
|
|
2557
|
-
'tribal4',
|
|
2558
|
-
'tribal5',
|
|
2559
|
-
'tribal6',
|
|
2560
|
-
'triangle1',
|
|
2561
|
-
'triangle2',
|
|
2562
|
-
'triangleCircle1',
|
|
2563
|
-
'triangleCircle2',
|
|
2564
|
-
'shapes1',
|
|
2565
|
-
'shapes2',
|
|
2566
|
-
'twistedLines1',
|
|
2567
|
-
'twistedLines2',
|
|
2568
|
-
'vine',
|
|
2569
|
-
'waveline',
|
|
2570
|
-
'weavingAngles',
|
|
2571
|
-
'weavingBraid',
|
|
2572
|
-
'weavingRibbon',
|
|
2573
|
-
'weavingStrips',
|
|
2574
|
-
'whiteFlowers',
|
|
2575
|
-
'woodwork',
|
|
2576
|
-
'xIllusions',
|
|
2577
|
-
'zanyTriangles',
|
|
2578
|
-
'zigZag',
|
|
2579
|
-
'zigZagStitch'
|
|
2580
|
-
];
|
|
2581
|
-
const BORDER_STYLE_SET = new Set(DOCUMENT_PARAGRAPH_BORDER_STYLES);
|
|
2582
|
-
const BORDER_EDGE_SET = new Set(DOCUMENT_PARAGRAPH_BORDER_EDGES);
|
|
2583
|
-
const BORDER_PROPERTY_SET = new Set([
|
|
2584
|
-
'style',
|
|
2585
|
-
'color',
|
|
2586
|
-
'size',
|
|
2587
|
-
'space',
|
|
2588
|
-
'shadow',
|
|
2589
|
-
'frame'
|
|
2590
|
-
]);
|
|
2591
|
-
const LINE_BORDER_STYLES = new Set(DOCUMENT_PARAGRAPH_BORDER_STYLES.slice(0, 27));
|
|
2592
|
-
const DASHED_BORDER_STYLES = new Set([
|
|
2593
|
-
'dashed',
|
|
2594
|
-
'dashSmallGap',
|
|
2595
|
-
'dashDotStroked',
|
|
2596
|
-
'dotDash',
|
|
2597
|
-
'dotDotDash'
|
|
2598
|
-
]);
|
|
2599
|
-
const DOUBLE_BORDER_STYLES = new Set([
|
|
2600
|
-
'double',
|
|
2601
|
-
'triple',
|
|
2602
|
-
'thinThickSmallGap',
|
|
2603
|
-
'thickThinSmallGap',
|
|
2604
|
-
'thinThickThinSmallGap',
|
|
2605
|
-
'thinThickMediumGap',
|
|
2606
|
-
'thickThinMediumGap',
|
|
2607
|
-
'thinThickThinMediumGap',
|
|
2608
|
-
'thinThickLargeGap',
|
|
2609
|
-
'thickThinLargeGap',
|
|
2610
|
-
'thinThickThinLargeGap',
|
|
2611
|
-
'doubleWave'
|
|
2612
|
-
]);
|
|
2613
|
-
const MAX_SERIALIZED_PARAGRAPH_BORDERS = 32768;
|
|
2614
|
-
const POINTS_TO_PIXELS = 96 / 72;
|
|
2615
|
-
function normalizeDocumentParagraphBorders(source) {
|
|
2616
|
-
if (!source || 'object' != typeof source || Array.isArray(source)) return null;
|
|
2617
|
-
const record = source;
|
|
2618
|
-
if (Object.keys(record).some((key)=>!BORDER_EDGE_SET.has(key))) return null;
|
|
2619
|
-
const borders = {};
|
|
2620
|
-
for (const edge of DOCUMENT_PARAGRAPH_BORDER_EDGES){
|
|
2621
|
-
if (void 0 === record[edge]) continue;
|
|
2622
|
-
const border = normalizeDocumentParagraphBorder(record[edge]);
|
|
2623
|
-
if (!border) return null;
|
|
2624
|
-
borders[edge] = border;
|
|
2625
|
-
}
|
|
2626
|
-
return Object.keys(borders).length ? borders : null;
|
|
2627
|
-
}
|
|
2628
|
-
function normalizeDocumentParagraphBorder(source) {
|
|
2629
|
-
if (!source || 'object' != typeof source || Array.isArray(source)) return null;
|
|
2630
|
-
const record = source;
|
|
2631
|
-
if (Object.keys(record).some((key)=>!BORDER_PROPERTY_SET.has(key))) return null;
|
|
2632
|
-
const style = record.style;
|
|
2633
|
-
if ('string' != typeof style || !BORDER_STYLE_SET.has(style)) return null;
|
|
2634
|
-
const normalizedStyle = style;
|
|
2635
|
-
const color = normalizeBorderColor(record.color);
|
|
2636
|
-
if (void 0 !== record.color && !color) return null;
|
|
2637
|
-
const size = optionalInteger(record.size);
|
|
2638
|
-
if (null === size || void 0 !== size && !validBorderSize(normalizedStyle, size)) return null;
|
|
2639
|
-
const space = optionalInteger(record.space);
|
|
2640
|
-
if (null === space || void 0 !== space && (space < 0 || space > 31)) return null;
|
|
2641
|
-
const shadow = optionalBoolean(record.shadow);
|
|
2642
|
-
const frame = optionalBoolean(record.frame);
|
|
2643
|
-
if (null === shadow || null === frame) return null;
|
|
2644
|
-
return {
|
|
2645
|
-
style: normalizedStyle,
|
|
2646
|
-
...color ? {
|
|
2647
|
-
color
|
|
2648
|
-
} : {},
|
|
2649
|
-
...void 0 !== size ? {
|
|
2650
|
-
size
|
|
2651
|
-
} : {},
|
|
2652
|
-
...void 0 !== space ? {
|
|
2653
|
-
space
|
|
2654
|
-
} : {},
|
|
2655
|
-
...void 0 !== shadow ? {
|
|
2656
|
-
shadow
|
|
2657
|
-
} : {},
|
|
2658
|
-
...void 0 !== frame ? {
|
|
2659
|
-
frame
|
|
2660
|
-
} : {}
|
|
2661
|
-
};
|
|
2662
|
-
}
|
|
2663
|
-
function parseDocumentParagraphBorders(source) {
|
|
2664
|
-
if ('string' != typeof source) return normalizeDocumentParagraphBorders(source);
|
|
2665
|
-
if (!source.trim() || source.length > MAX_SERIALIZED_PARAGRAPH_BORDERS) return null;
|
|
2666
|
-
try {
|
|
2667
|
-
return normalizeDocumentParagraphBorders(JSON.parse(source));
|
|
2668
|
-
} catch {
|
|
2669
|
-
return null;
|
|
2670
|
-
}
|
|
2671
|
-
}
|
|
2672
|
-
function serializeDocumentParagraphBorders(source) {
|
|
2673
|
-
const borders = normalizeDocumentParagraphBorders(source);
|
|
2674
|
-
if (!borders) return;
|
|
2675
|
-
return JSON.stringify(Object.fromEntries(DOCUMENT_PARAGRAPH_BORDER_EDGES.flatMap((edge)=>{
|
|
2676
|
-
const border = borders[edge];
|
|
2677
|
-
return border ? [
|
|
2678
|
-
[
|
|
2679
|
-
edge,
|
|
2680
|
-
serializedBorder(border)
|
|
2681
|
-
]
|
|
2682
|
-
] : [];
|
|
2683
|
-
})));
|
|
2684
|
-
}
|
|
2685
|
-
function parseDocumentParagraphBordersElement(element) {
|
|
2686
|
-
const semantic = parseDocumentParagraphBorders(element.getAttribute(DOCUMENT_PARAGRAPH_BORDERS_ATTRIBUTE));
|
|
2687
|
-
if (!semantic) return paragraphBordersFromCss(element);
|
|
2688
|
-
const edited = {
|
|
2689
|
-
...semantic
|
|
2690
|
-
};
|
|
2691
|
-
for (const edge of [
|
|
2692
|
-
'top',
|
|
2693
|
-
'left',
|
|
2694
|
-
'bottom',
|
|
2695
|
-
'right'
|
|
2696
|
-
]){
|
|
2697
|
-
const border = semantic[edge];
|
|
2698
|
-
const css = cssBorder(element, edge);
|
|
2699
|
-
if (!(!css || border && sameBorderPresentation(border, css))) {
|
|
2700
|
-
if ('none' === css.style) {
|
|
2701
|
-
edited[edge] = {
|
|
2702
|
-
style: 'nil'
|
|
2703
|
-
};
|
|
2704
|
-
continue;
|
|
2705
|
-
}
|
|
2706
|
-
edited[edge] = {
|
|
2707
|
-
...border ?? {
|
|
2708
|
-
style: 'single'
|
|
2709
|
-
},
|
|
2710
|
-
style: cssStyleToBorderStyle(css.style),
|
|
2711
|
-
color: {
|
|
2712
|
-
value: css.color
|
|
2713
|
-
},
|
|
2714
|
-
size: cssWidthToEighthPoints(css.width)
|
|
2715
|
-
};
|
|
2716
|
-
}
|
|
2717
|
-
}
|
|
2718
|
-
return normalizeDocumentParagraphBorders(edited);
|
|
2719
|
-
}
|
|
2720
|
-
function documentParagraphBordersDomAttributes(source) {
|
|
2721
|
-
const borders = normalizeDocumentParagraphBorders(source);
|
|
2722
|
-
const serialized = serializeDocumentParagraphBorders(borders);
|
|
2723
|
-
if (!borders || !serialized) return {};
|
|
2724
|
-
const styles = [];
|
|
2725
|
-
const shadows = [];
|
|
2726
|
-
for (const edge of [
|
|
2727
|
-
'top',
|
|
2728
|
-
'left',
|
|
2729
|
-
'bottom',
|
|
2730
|
-
'right'
|
|
2731
|
-
]){
|
|
2732
|
-
const border = borders[edge];
|
|
2733
|
-
if (!border) continue;
|
|
2734
|
-
const presentation = documentBorderPresentation(border);
|
|
2735
|
-
styles.push(`border-${edge}: ${formatPixels(presentation.width)}px ${presentation.style} ${presentation.color}`);
|
|
2736
|
-
if (border.space) styles.push(`padding-${edge}: ${formatPixels(border.space * POINTS_TO_PIXELS)}px`);
|
|
2737
|
-
if (border.shadow && presentation.width > 0) shadows.push(`2px 2px 0 ${presentation.color}`);
|
|
2738
|
-
}
|
|
2739
|
-
const between = borders.between ? documentBorderPresentation(borders.between) : null;
|
|
2740
|
-
if (between && between.width > 0) shadows.push(`inset 0 -${formatPixels(between.width)}px 0 ${between.color}`);
|
|
2741
|
-
const bar = borders.bar ? documentBorderPresentation(borders.bar) : null;
|
|
2742
|
-
if (bar && bar.width > 0) shadows.push(`inset ${formatPixels(bar.width)}px 0 0 ${bar.color}`);
|
|
2743
|
-
if (shadows.length) styles.push(`box-shadow: ${shadows.join(', ')}`);
|
|
2744
|
-
return {
|
|
2745
|
-
[DOCUMENT_PARAGRAPH_BORDERS_ATTRIBUTE]: serialized,
|
|
2746
|
-
...styles.length ? {
|
|
2747
|
-
style: styles.join('; ')
|
|
2748
|
-
} : {}
|
|
2749
|
-
};
|
|
2750
|
-
}
|
|
2751
|
-
function isDocumentParagraphArtBorderStyle(style) {
|
|
2752
|
-
return !LINE_BORDER_STYLES.has(style);
|
|
2753
|
-
}
|
|
2754
|
-
function normalizeBorderColor(source) {
|
|
2755
|
-
if (!source || 'object' != typeof source || Array.isArray(source)) return null;
|
|
2756
|
-
const record = source;
|
|
2757
|
-
if (Object.keys(record).some((key)=>'value' !== key && 'theme' !== key)) return null;
|
|
2758
|
-
const theme = parseDocxThemeReference('string' == typeof record.theme ? record.theme : record.theme ? JSON.stringify(record.theme) : void 0);
|
|
2759
|
-
const direct = 'auto' === record.value ? 'auto' : 'string' == typeof record.value ? normalizeCssColor(record.value) : null;
|
|
2760
|
-
const resolved = direct ?? theme?.resolved ?? null;
|
|
2761
|
-
if (!resolved || 'transparent' === resolved) return null;
|
|
2762
|
-
if (theme && resolved !== theme.resolved && !('auto' === resolved && 'none' === theme.theme && '#000000' === theme.resolved)) return null;
|
|
2763
|
-
return {
|
|
2764
|
-
value: resolved,
|
|
2765
|
-
...theme ? {
|
|
2766
|
-
theme
|
|
2767
|
-
} : {}
|
|
2768
|
-
};
|
|
2769
|
-
}
|
|
2770
|
-
function serializedBorder(border) {
|
|
2771
|
-
const color = border.color ? serializedBorderColor(border.color) : void 0;
|
|
2772
|
-
return {
|
|
2773
|
-
style: border.style,
|
|
2774
|
-
...color ? {
|
|
2775
|
-
color
|
|
2776
|
-
} : {},
|
|
2777
|
-
...void 0 !== border.size ? {
|
|
2778
|
-
size: border.size
|
|
2779
|
-
} : {},
|
|
2780
|
-
...void 0 !== border.space ? {
|
|
2781
|
-
space: border.space
|
|
2782
|
-
} : {},
|
|
2783
|
-
...void 0 !== border.shadow ? {
|
|
2784
|
-
shadow: border.shadow
|
|
2785
|
-
} : {},
|
|
2786
|
-
...void 0 !== border.frame ? {
|
|
2787
|
-
frame: border.frame
|
|
2788
|
-
} : {}
|
|
2789
|
-
};
|
|
2790
|
-
}
|
|
2791
|
-
function serializedBorderColor(color) {
|
|
2792
|
-
const theme = serializeDocxThemeReference(color.theme ?? null);
|
|
2793
|
-
return {
|
|
2794
|
-
value: color.value,
|
|
2795
|
-
...theme ? {
|
|
2796
|
-
theme: JSON.parse(theme)
|
|
2797
|
-
} : {}
|
|
2798
|
-
};
|
|
2799
|
-
}
|
|
2800
|
-
function optionalInteger(value) {
|
|
2801
|
-
if (void 0 === value) return;
|
|
2802
|
-
return 'number' == typeof value && Number.isSafeInteger(value) ? value : null;
|
|
2803
|
-
}
|
|
2804
|
-
function optionalBoolean(value) {
|
|
2805
|
-
if (void 0 === value) return;
|
|
2806
|
-
return 'boolean' == typeof value ? value : null;
|
|
2807
|
-
}
|
|
2808
|
-
function validBorderSize(style, size) {
|
|
2809
|
-
if ('nil' === style || 'none' === style) return size >= 0 && size <= 96;
|
|
2810
|
-
return isDocumentParagraphArtBorderStyle(style) ? size >= 1 && size <= 31 : size >= 2 && size <= 96;
|
|
2811
|
-
}
|
|
2812
|
-
function documentBorderPresentation(border) {
|
|
2813
|
-
if ('nil' === border.style || 'none' === border.style || !border.size) return {
|
|
2814
|
-
color: 'transparent',
|
|
2815
|
-
style: 'none',
|
|
2816
|
-
width: 0
|
|
2817
|
-
};
|
|
2818
|
-
const width = Math.min(16, isDocumentParagraphArtBorderStyle(border.style) ? border.size * POINTS_TO_PIXELS : border.size / 6);
|
|
2819
|
-
return {
|
|
2820
|
-
color: border.color && 'auto' !== border.color.value ? border.color.value : '#000000',
|
|
2821
|
-
style: borderStyleToCssStyle(border.style),
|
|
2822
|
-
width
|
|
2823
|
-
};
|
|
2824
|
-
}
|
|
2825
|
-
function borderStyleToCssStyle(style) {
|
|
2826
|
-
if ('nil' === style || 'none' === style) return 'none';
|
|
2827
|
-
if ('dotted' === style) return 'dotted';
|
|
2828
|
-
if (DASHED_BORDER_STYLES.has(style)) return 'dashed';
|
|
2829
|
-
if (DOUBLE_BORDER_STYLES.has(style)) return 'double';
|
|
2830
|
-
if ('inset' === style || 'threeDEngrave' === style) return 'inset';
|
|
2831
|
-
if ('outset' === style || 'threeDEmboss' === style) return 'outset';
|
|
2832
|
-
return 'solid';
|
|
2833
|
-
}
|
|
2834
|
-
function paragraphBordersFromCss(element) {
|
|
2835
|
-
const borders = {};
|
|
2836
|
-
for (const edge of [
|
|
2837
|
-
'top',
|
|
2838
|
-
'left',
|
|
2839
|
-
'bottom',
|
|
2840
|
-
'right'
|
|
2841
|
-
]){
|
|
2842
|
-
const css = cssBorder(element, edge);
|
|
2843
|
-
if (css && 'none' !== css.style) borders[edge] = {
|
|
2844
|
-
style: cssStyleToBorderStyle(css.style),
|
|
2845
|
-
color: {
|
|
2846
|
-
value: css.color
|
|
2847
|
-
},
|
|
2848
|
-
size: cssWidthToEighthPoints(css.width)
|
|
2849
|
-
};
|
|
2850
|
-
}
|
|
2851
|
-
return normalizeDocumentParagraphBorders(borders);
|
|
2852
|
-
}
|
|
2853
|
-
function cssBorder(element, edge) {
|
|
2854
|
-
const style = element.style.getPropertyValue(`border-${edge}-style`).trim();
|
|
2855
|
-
const width = Number.parseFloat(element.style.getPropertyValue(`border-${edge}-width`));
|
|
2856
|
-
const color = normalizeCssColor(element.style.getPropertyValue(`border-${edge}-color`));
|
|
2857
|
-
if (!style) return null;
|
|
2858
|
-
if ('none' === style || 'hidden' === style) return {
|
|
2859
|
-
color: '#000000',
|
|
2860
|
-
style: 'none',
|
|
2861
|
-
width: 0
|
|
2862
|
-
};
|
|
2863
|
-
return color && 'transparent' !== color && Number.isFinite(width) && width > 0 ? {
|
|
2864
|
-
color,
|
|
2865
|
-
style,
|
|
2866
|
-
width
|
|
2867
|
-
} : null;
|
|
2868
|
-
}
|
|
2869
|
-
function sameBorderPresentation(border, css) {
|
|
2870
|
-
const expected = documentBorderPresentation(border);
|
|
2871
|
-
if ('none' === expected.style) return 'none' === css.style && 0 === css.width;
|
|
2872
|
-
return expected.color === css.color && expected.style === css.style && Math.abs(expected.width - css.width) < 0.01;
|
|
2873
|
-
}
|
|
2874
|
-
function cssStyleToBorderStyle(style) {
|
|
2875
|
-
if ('double' === style) return 'double';
|
|
2876
|
-
if ('dashed' === style) return 'dashed';
|
|
2877
|
-
if ('dotted' === style) return 'dotted';
|
|
2878
|
-
if ('inset' === style || 'groove' === style) return 'inset';
|
|
2879
|
-
if ('outset' === style || 'ridge' === style) return 'outset';
|
|
2880
|
-
return 'single';
|
|
2881
|
-
}
|
|
2882
|
-
function cssWidthToEighthPoints(width) {
|
|
2883
|
-
return Math.max(2, Math.min(96, Math.round(6 * width)));
|
|
2884
|
-
}
|
|
2885
|
-
function formatPixels(value) {
|
|
2886
|
-
return Number(value.toFixed(3)).toString();
|
|
2887
|
-
}
|
|
2888
2211
|
const DOCUMENT_PAGE_BORDER_EDGES = [
|
|
2889
2212
|
'top',
|
|
2890
2213
|
'left',
|
|
@@ -2912,7 +2235,7 @@ const PAGE_BORDER_Z_ORDER_SET = new Set([
|
|
|
2912
2235
|
'back'
|
|
2913
2236
|
]);
|
|
2914
2237
|
const MAX_SERIALIZED_PAGE_BORDERS = 32768;
|
|
2915
|
-
const
|
|
2238
|
+
const POINTS_TO_PIXELS = 96 / 72;
|
|
2916
2239
|
function normalizeDocumentPageBorders(source) {
|
|
2917
2240
|
if (!source || 'object' != typeof source || Array.isArray(source)) return null;
|
|
2918
2241
|
const record = source;
|
|
@@ -2994,7 +2317,7 @@ function resolveDocumentPageBorders(source, margins) {
|
|
|
2994
2317
|
const border = borders.edges[edge];
|
|
2995
2318
|
const presentation = border ? documentBorderPresentation(border) : void 0;
|
|
2996
2319
|
if (presentation) presentations[edge] = presentation;
|
|
2997
|
-
const space = (border?.space ?? 0) *
|
|
2320
|
+
const space = (border?.space ?? 0) * POINTS_TO_PIXELS;
|
|
2998
2321
|
insets[edge] = 'page' === offsetFrom ? space : Math.max(0, millimetersToPixels(margins[edge]) - space - (presentation?.width ?? 0));
|
|
2999
2322
|
}
|
|
3000
2323
|
return {
|
|
@@ -6899,6 +6222,108 @@ function documentHiddenTextDomAttributes(value) {
|
|
|
6899
6222
|
[DOCUMENT_HIDDEN_TEXT_ATTRIBUTE]: String(hiddenText)
|
|
6900
6223
|
};
|
|
6901
6224
|
}
|
|
6225
|
+
const DOCUMENT_LEGACY_TEXT_OUTLINE_ATTRIBUTE = 'data-office-legacy-text-outline';
|
|
6226
|
+
const DOCUMENT_LEGACY_TEXT_SHADOW_ATTRIBUTE = 'data-office-legacy-text-shadow';
|
|
6227
|
+
const DOCUMENT_LEGACY_TEXT_EMBOSS_ATTRIBUTE = 'data-office-legacy-text-emboss';
|
|
6228
|
+
const DOCUMENT_LEGACY_TEXT_IMPRINT_ATTRIBUTE = 'data-office-legacy-text-imprint';
|
|
6229
|
+
const DOCUMENT_LEGACY_TEXT_EFFECT_NAMES = [
|
|
6230
|
+
'outline',
|
|
6231
|
+
'shadow',
|
|
6232
|
+
'emboss',
|
|
6233
|
+
'imprint'
|
|
6234
|
+
];
|
|
6235
|
+
const ATTRIBUTE_BY_EFFECT = {
|
|
6236
|
+
outline: DOCUMENT_LEGACY_TEXT_OUTLINE_ATTRIBUTE,
|
|
6237
|
+
shadow: DOCUMENT_LEGACY_TEXT_SHADOW_ATTRIBUTE,
|
|
6238
|
+
emboss: DOCUMENT_LEGACY_TEXT_EMBOSS_ATTRIBUTE,
|
|
6239
|
+
imprint: DOCUMENT_LEGACY_TEXT_IMPRINT_ATTRIBUTE
|
|
6240
|
+
};
|
|
6241
|
+
const TEXT_STYLE_ATTRIBUTE_BY_EFFECT = {
|
|
6242
|
+
outline: 'legacyTextOutline',
|
|
6243
|
+
shadow: 'legacyTextShadow',
|
|
6244
|
+
emboss: 'legacyTextEmboss',
|
|
6245
|
+
imprint: 'legacyTextImprint'
|
|
6246
|
+
};
|
|
6247
|
+
function normalizeDocumentLegacyTextEffect(value) {
|
|
6248
|
+
if (true === value || 'true' === value || '1' === value) return true;
|
|
6249
|
+
if (false === value || 'false' === value || '0' === value) return false;
|
|
6250
|
+
return null;
|
|
6251
|
+
}
|
|
6252
|
+
function normalizeDocumentLegacyTextEffects(value) {
|
|
6253
|
+
if (!work_document_legacy_text_effects_isRecord(value)) return null;
|
|
6254
|
+
const allowed = new Set(DOCUMENT_LEGACY_TEXT_EFFECT_NAMES);
|
|
6255
|
+
if (Object.keys(value).some((key)=>!allowed.has(key))) return null;
|
|
6256
|
+
const effects = {};
|
|
6257
|
+
for (const name of DOCUMENT_LEGACY_TEXT_EFFECT_NAMES)if (Object.hasOwn(value, name)) {
|
|
6258
|
+
if ('boolean' != typeof value[name]) return null;
|
|
6259
|
+
effects[name] = value[name];
|
|
6260
|
+
}
|
|
6261
|
+
return documentLegacyTextEffectsConflict(effects) ? null : effects;
|
|
6262
|
+
}
|
|
6263
|
+
function documentLegacyTextEffectsConflict(effects) {
|
|
6264
|
+
if (true === effects.emboss && (true === effects.outline || true === effects.shadow || true === effects.imprint)) return true;
|
|
6265
|
+
return true === effects.imprint && (true === effects.outline || true === effects.shadow || true === effects.emboss);
|
|
6266
|
+
}
|
|
6267
|
+
function documentLegacyTextEffectFromElement(element, effect) {
|
|
6268
|
+
return normalizeDocumentLegacyTextEffect(element.getAttribute(ATTRIBUTE_BY_EFFECT[effect]));
|
|
6269
|
+
}
|
|
6270
|
+
function documentLegacyTextEffectsFromElement(element) {
|
|
6271
|
+
const effects = {};
|
|
6272
|
+
for (const name of DOCUMENT_LEGACY_TEXT_EFFECT_NAMES){
|
|
6273
|
+
const attribute = ATTRIBUTE_BY_EFFECT[name];
|
|
6274
|
+
const value = documentLegacyTextEffectFromElement(element, name);
|
|
6275
|
+
if (element.hasAttribute(attribute) && null === value) return null;
|
|
6276
|
+
if (null !== value) effects[name] = value;
|
|
6277
|
+
}
|
|
6278
|
+
return documentLegacyTextEffectsConflict(effects) ? null : effects;
|
|
6279
|
+
}
|
|
6280
|
+
function documentLegacyTextEffectsFromTextStyleAttributes(attributes) {
|
|
6281
|
+
const effects = {};
|
|
6282
|
+
for (const name of DOCUMENT_LEGACY_TEXT_EFFECT_NAMES){
|
|
6283
|
+
const rawValue = attributes[TEXT_STYLE_ATTRIBUTE_BY_EFFECT[name]];
|
|
6284
|
+
if (null == rawValue) continue;
|
|
6285
|
+
const value = normalizeDocumentLegacyTextEffect(rawValue);
|
|
6286
|
+
if (null === value) return null;
|
|
6287
|
+
if (null !== value) effects[name] = value;
|
|
6288
|
+
}
|
|
6289
|
+
return documentLegacyTextEffectsConflict(effects) ? null : effects;
|
|
6290
|
+
}
|
|
6291
|
+
function documentLegacyTextEffectsDomAttributes(value) {
|
|
6292
|
+
const effects = normalizeDocumentLegacyTextEffects(value);
|
|
6293
|
+
if (!effects) return {};
|
|
6294
|
+
return Object.fromEntries(DOCUMENT_LEGACY_TEXT_EFFECT_NAMES.flatMap((name)=>void 0 === effects[name] ? [] : [
|
|
6295
|
+
[
|
|
6296
|
+
ATTRIBUTE_BY_EFFECT[name],
|
|
6297
|
+
String(effects[name])
|
|
6298
|
+
]
|
|
6299
|
+
]));
|
|
6300
|
+
}
|
|
6301
|
+
function documentLegacyTextEffectsCss(value) {
|
|
6302
|
+
const effects = normalizeDocumentLegacyTextEffects(value);
|
|
6303
|
+
if (!effects) return {};
|
|
6304
|
+
if (effects.emboss) return {
|
|
6305
|
+
textShadow: '-0.045em -0.045em 0 rgba(255, 255, 255, 0.9), 0.045em 0.045em 0 rgba(0, 0, 0, 0.52)'
|
|
6306
|
+
};
|
|
6307
|
+
if (effects.imprint) return {
|
|
6308
|
+
textShadow: '0.045em 0.045em 0 rgba(255, 255, 255, 0.9), -0.045em -0.045em 0 rgba(0, 0, 0, 0.52)'
|
|
6309
|
+
};
|
|
6310
|
+
return {
|
|
6311
|
+
...effects.outline ? {
|
|
6312
|
+
WebkitTextFillColor: 'transparent',
|
|
6313
|
+
WebkitTextStroke: '0.045em currentColor',
|
|
6314
|
+
paintOrder: 'stroke fill'
|
|
6315
|
+
} : {},
|
|
6316
|
+
...effects.shadow ? {
|
|
6317
|
+
textShadow: '0.08em 0.08em 0 currentColor'
|
|
6318
|
+
} : {}
|
|
6319
|
+
};
|
|
6320
|
+
}
|
|
6321
|
+
function documentLegacyTextStyleAttributeName(effect) {
|
|
6322
|
+
return TEXT_STYLE_ATTRIBUTE_BY_EFFECT[effect];
|
|
6323
|
+
}
|
|
6324
|
+
function work_document_legacy_text_effects_isRecord(value) {
|
|
6325
|
+
return 'object' == typeof value && null !== value && !Array.isArray(value);
|
|
6326
|
+
}
|
|
6902
6327
|
const IMAGE_OBJECT_ID_PATTERN = /^[0-9A-F]{8}$/;
|
|
6903
6328
|
const MAX_DOC_PROPERTIES_ID = 0xffffffff;
|
|
6904
6329
|
const MAX_WORDPROCESSING_ID = 0x7fffffff;
|
|
@@ -8925,6 +8350,10 @@ function sanitizeAttributes(element, tag) {
|
|
|
8925
8350
|
const emphasisMark = 'span' === tag ? documentEmphasisMarkFromElement(element) : null;
|
|
8926
8351
|
const emphasisAttributes = documentEmphasisMarkDomAttributes(emphasisMark);
|
|
8927
8352
|
const hiddenText = 'span' === tag ? documentHiddenTextFromElement(element) : null;
|
|
8353
|
+
const legacyTextEffects = 'span' === tag ? documentLegacyTextEffectsFromElement(element) ?? {} : {};
|
|
8354
|
+
const legacyTextEffectAttributes = documentLegacyTextEffectsDomAttributes(legacyTextEffects);
|
|
8355
|
+
const runBorder = 'span' === tag ? parseDocumentRunBorderElement(element) : null;
|
|
8356
|
+
const runBorderAttributes = documentRunBorderDomAttributes(runBorder);
|
|
8928
8357
|
const underline = 'u' === tag ? documentUnderlineFormattingFromElement(element) : null;
|
|
8929
8358
|
const underlineAttributes = underline ? documentUnderlineDomAttributes(underline) : {};
|
|
8930
8359
|
const strike = 's' === tag || 'strike' === tag ? documentStrikeFormattingFromElement(element) : null;
|
|
@@ -8947,6 +8376,11 @@ function sanitizeAttributes(element, tag) {
|
|
|
8947
8376
|
element.removeAttribute(DOCUMENT_KERNING_THRESHOLD_ATTRIBUTE);
|
|
8948
8377
|
element.removeAttribute(DOCUMENT_EMPHASIS_MARK_ATTRIBUTE);
|
|
8949
8378
|
element.removeAttribute(DOCUMENT_HIDDEN_TEXT_ATTRIBUTE);
|
|
8379
|
+
element.removeAttribute(DOCUMENT_LEGACY_TEXT_OUTLINE_ATTRIBUTE);
|
|
8380
|
+
element.removeAttribute(DOCUMENT_LEGACY_TEXT_SHADOW_ATTRIBUTE);
|
|
8381
|
+
element.removeAttribute(DOCUMENT_LEGACY_TEXT_EMBOSS_ATTRIBUTE);
|
|
8382
|
+
element.removeAttribute(DOCUMENT_LEGACY_TEXT_IMPRINT_ATTRIBUTE);
|
|
8383
|
+
element.removeAttribute(DOCUMENT_RUN_BORDER_ATTRIBUTE);
|
|
8950
8384
|
element.removeAttribute(DOCUMENT_SCRIPT_FONTS_ATTRIBUTE);
|
|
8951
8385
|
element.removeAttribute(DOCUMENT_SCRIPT_FONT_SLOT_ATTRIBUTE);
|
|
8952
8386
|
const styles = [
|
|
@@ -8962,6 +8396,7 @@ function sanitizeAttributes(element, tag) {
|
|
|
8962
8396
|
emphasisAttributes.style ?? '',
|
|
8963
8397
|
underlineAttributes.style ?? '',
|
|
8964
8398
|
strikeAttributes.style ?? '',
|
|
8399
|
+
runBorderAttributes.style ?? '',
|
|
8965
8400
|
borderAttributes.style ?? '',
|
|
8966
8401
|
shadingAttributes.style ?? ''
|
|
8967
8402
|
].filter(Boolean);
|
|
@@ -9008,6 +8443,11 @@ function sanitizeAttributes(element, tag) {
|
|
|
9008
8443
|
if ('span' === tag && null !== kerningThreshold) element.setAttribute(DOCUMENT_KERNING_THRESHOLD_ATTRIBUTE, String(kerningThreshold));
|
|
9009
8444
|
if ('span' === tag && null !== emphasisMark) element.setAttribute(DOCUMENT_EMPHASIS_MARK_ATTRIBUTE, emphasisMark);
|
|
9010
8445
|
if ('span' === tag && null !== hiddenText) element.setAttribute(DOCUMENT_HIDDEN_TEXT_ATTRIBUTE, String(hiddenText));
|
|
8446
|
+
if ('span' === tag) {
|
|
8447
|
+
for (const [name, value] of Object.entries(legacyTextEffectAttributes))element.setAttribute(name, value);
|
|
8448
|
+
const serializedRunBorder = runBorderAttributes[DOCUMENT_RUN_BORDER_ATTRIBUTE];
|
|
8449
|
+
if (serializedRunBorder) element.setAttribute(DOCUMENT_RUN_BORDER_ATTRIBUTE, serializedRunBorder);
|
|
8450
|
+
}
|
|
9011
8451
|
if ('span' === tag && scriptFonts) {
|
|
9012
8452
|
for (const [name, value] of Object.entries(scriptFontAttributes))if ('style' !== name) element.setAttribute(name, value);
|
|
9013
8453
|
}
|
|
@@ -9056,6 +8496,11 @@ function sanitizeAttributes(element, tag) {
|
|
|
9056
8496
|
DOCUMENT_KERNING_THRESHOLD_ATTRIBUTE,
|
|
9057
8497
|
DOCUMENT_EMPHASIS_MARK_ATTRIBUTE,
|
|
9058
8498
|
DOCUMENT_HIDDEN_TEXT_ATTRIBUTE,
|
|
8499
|
+
DOCUMENT_LEGACY_TEXT_OUTLINE_ATTRIBUTE,
|
|
8500
|
+
DOCUMENT_LEGACY_TEXT_SHADOW_ATTRIBUTE,
|
|
8501
|
+
DOCUMENT_LEGACY_TEXT_EMBOSS_ATTRIBUTE,
|
|
8502
|
+
DOCUMENT_LEGACY_TEXT_IMPRINT_ATTRIBUTE,
|
|
8503
|
+
DOCUMENT_RUN_BORDER_ATTRIBUTE,
|
|
9059
8504
|
DOCUMENT_SCRIPT_FONTS_ATTRIBUTE,
|
|
9060
8505
|
DOCUMENT_SCRIPT_FONT_SLOT_ATTRIBUTE
|
|
9061
8506
|
] : [],
|
|
@@ -9983,6 +9428,11 @@ const ALLOWED_ATTRIBUTES = {
|
|
|
9983
9428
|
'emphasisMark',
|
|
9984
9429
|
'kerningThresholdHalfPoints',
|
|
9985
9430
|
'hiddenText',
|
|
9431
|
+
'legacyTextOutline',
|
|
9432
|
+
'legacyTextShadow',
|
|
9433
|
+
'legacyTextEmboss',
|
|
9434
|
+
'legacyTextImprint',
|
|
9435
|
+
'runBorder',
|
|
9986
9436
|
"scriptFonts",
|
|
9987
9437
|
"scriptFontSlot",
|
|
9988
9438
|
'themeColor',
|
|
@@ -10074,6 +9524,11 @@ function importedDocumentCharacterFormatting(formatting) {
|
|
|
10074
9524
|
kerningThresholdHalfPoints: formatting.kerningThresholdHalfPoints,
|
|
10075
9525
|
emphasisMark: formatting.emphasisMark,
|
|
10076
9526
|
hiddenText: formatting.hiddenText,
|
|
9527
|
+
legacyTextOutline: formatting.legacyTextOutline,
|
|
9528
|
+
legacyTextShadow: formatting.legacyTextShadow,
|
|
9529
|
+
legacyTextEmboss: formatting.legacyTextEmboss,
|
|
9530
|
+
legacyTextImprint: formatting.legacyTextImprint,
|
|
9531
|
+
runBorder: formatting.runBorder,
|
|
10077
9532
|
color: formatting.color,
|
|
10078
9533
|
fontFamily: formatting.fontFamily,
|
|
10079
9534
|
scriptFonts: serializeDocumentScriptFonts(formatting.scriptFonts) ?? void 0,
|
|
@@ -10144,6 +9599,17 @@ function normalizeCharacterFormatMark(value) {
|
|
|
10144
9599
|
attrs[key] = hiddenText;
|
|
10145
9600
|
continue;
|
|
10146
9601
|
}
|
|
9602
|
+
if ('textStyle' === type && [
|
|
9603
|
+
'legacyTextOutline',
|
|
9604
|
+
'legacyTextShadow',
|
|
9605
|
+
'legacyTextEmboss',
|
|
9606
|
+
'legacyTextImprint'
|
|
9607
|
+
].includes(key)) {
|
|
9608
|
+
const effect = normalizeDocumentLegacyTextEffect(candidate);
|
|
9609
|
+
if (null === effect) return null;
|
|
9610
|
+
attrs[key] = effect;
|
|
9611
|
+
continue;
|
|
9612
|
+
}
|
|
10147
9613
|
if ('textStyle' === type && "scriptFonts" === key) {
|
|
10148
9614
|
const fonts = 'string' == typeof candidate ? serializeDocumentScriptFonts(parseDocumentScriptFonts(candidate)) : serializeDocumentScriptFonts(normalizeDocumentScriptFonts(candidate));
|
|
10149
9615
|
if (!fonts) return null;
|
|
@@ -10156,6 +9622,12 @@ function normalizeCharacterFormatMark(value) {
|
|
|
10156
9622
|
attrs[key] = slot;
|
|
10157
9623
|
continue;
|
|
10158
9624
|
}
|
|
9625
|
+
if ('textStyle' === type && 'runBorder' === key) {
|
|
9626
|
+
const border = serializeDocumentRunBorder(parseDocumentRunBorder(candidate));
|
|
9627
|
+
if (!border) return null;
|
|
9628
|
+
attrs[key] = border;
|
|
9629
|
+
continue;
|
|
9630
|
+
}
|
|
10159
9631
|
if ('string' == typeof candidate) {
|
|
10160
9632
|
if (!candidate.length) continue;
|
|
10161
9633
|
if ('textStyle' === type && 'textCase' === key && !normalizeDocumentTextCase(candidate)) return null;
|
|
@@ -10175,6 +9647,12 @@ function normalizeCharacterFormatMark(value) {
|
|
|
10175
9647
|
}
|
|
10176
9648
|
return null;
|
|
10177
9649
|
}
|
|
9650
|
+
if ('textStyle' === type && documentLegacyTextEffectsConflict({
|
|
9651
|
+
outline: 'boolean' == typeof attrs.legacyTextOutline ? attrs.legacyTextOutline : void 0,
|
|
9652
|
+
shadow: 'boolean' == typeof attrs.legacyTextShadow ? attrs.legacyTextShadow : void 0,
|
|
9653
|
+
emboss: 'boolean' == typeof attrs.legacyTextEmboss ? attrs.legacyTextEmboss : void 0,
|
|
9654
|
+
imprint: 'boolean' == typeof attrs.legacyTextImprint ? attrs.legacyTextImprint : void 0
|
|
9655
|
+
})) return null;
|
|
10178
9656
|
const keys = Object.keys(attrs).sort();
|
|
10179
9657
|
const normalizedAttributes = keys.length ? Object.fromEntries(keys.map((key)=>[
|
|
10180
9658
|
key,
|
|
@@ -11093,6 +10571,28 @@ const DocumentCharacterFormatting = Extension.create({
|
|
|
11093
10571
|
toggleDocumentTextCase: (textCase)=>({ commands, editor })=>{
|
|
11094
10572
|
const current = normalizeDocumentTextCase(editor.getAttributes('textStyle').textCase) ?? 'none';
|
|
11095
10573
|
return commands.setDocumentTextCase(current === textCase ? 'none' : textCase);
|
|
10574
|
+
},
|
|
10575
|
+
setDocumentRunBorder: (border)=>({ commands })=>{
|
|
10576
|
+
const serialized = serializeDocumentRunBorder(normalizeDocumentRunBorder(border));
|
|
10577
|
+
return serialized ? commands.setMark('textStyle', {
|
|
10578
|
+
runBorder: serialized
|
|
10579
|
+
}) : false;
|
|
10580
|
+
},
|
|
10581
|
+
unsetDocumentRunBorder: ()=>({ chain })=>chain().setMark('textStyle', {
|
|
10582
|
+
runBorder: null
|
|
10583
|
+
}).removeEmptyTextStyle().run(),
|
|
10584
|
+
toggleDocumentRunBorder: ()=>({ commands, editor })=>{
|
|
10585
|
+
const current = parseDocumentRunBorder(editor.getAttributes('textStyle').runBorder);
|
|
10586
|
+
return commands.setDocumentRunBorder(documentRunBorderIsVisible(current) ? {
|
|
10587
|
+
style: 'nil'
|
|
10588
|
+
} : {
|
|
10589
|
+
style: 'single',
|
|
10590
|
+
color: {
|
|
10591
|
+
value: 'auto'
|
|
10592
|
+
},
|
|
10593
|
+
size: 4,
|
|
10594
|
+
space: 1
|
|
10595
|
+
});
|
|
11096
10596
|
}
|
|
11097
10597
|
};
|
|
11098
10598
|
},
|
|
@@ -15832,7 +15332,7 @@ function documentTextParagraphStyle(style) {
|
|
|
15832
15332
|
function documentTextLayoutRunStyle(style, fonts, loadedFontIds, paragraphStyle, element, paragraphRoot) {
|
|
15833
15333
|
const direction = 'rtl' === style.direction ? 'rtl' : 'ltr';
|
|
15834
15334
|
const whiteSpace = 'break-spaces' === style.whiteSpace ? 'breakSpaces' : 'normal';
|
|
15835
|
-
if (direction !== paragraphStyle.direction || whiteSpace !== paragraphStyle.whiteSpace || !cssValueIs(style.whiteSpace, 'normal', 'break-spaces') || !cssValueIs(style.overflowWrap, 'normal', 'anywhere', 'break-word') || !cssValueIs(style.wordBreak, 'normal') || !cssValueIs(style.hyphens, 'manual', 'none') || !cssValueIs(style.wordSpacing, 'normal', '0', '0px') || !cssValueIs(style.textTransform, 'none') || !cssValueIs(style.fontVariationSettings, 'normal') || !cssValueIs(style.fontVariantCaps, 'normal') || !cssValueIs(style.fontVariantEastAsian, 'normal') || !cssValueIs(style.fontVariantNumeric, 'normal') || !cssValueIs(style.fontVariantPosition, 'normal') || !cssValueIs(style.fontStretch, 'normal', '100%') || !documentTextEmphasisAllowsKernel(style, element) || !cssValueIs(style.verticalAlign, 'baseline') || !cssValueIs(style.unicodeBidi, 'normal') && !(paragraphRoot && 'isolate' === style.unicodeBidi)) return null;
|
|
15335
|
+
if (direction !== paragraphStyle.direction || whiteSpace !== paragraphStyle.whiteSpace || !cssValueIs(style.whiteSpace, 'normal', 'break-spaces') || !cssValueIs(style.overflowWrap, 'normal', 'anywhere', 'break-word') || !cssValueIs(style.wordBreak, 'normal') || !cssValueIs(style.hyphens, 'manual', 'none') || !cssValueIs(style.wordSpacing, 'normal', '0', '0px') || !cssValueIs(style.textTransform, 'none') || !cssValueIs(style.fontVariationSettings, 'normal') || !cssValueIs(style.fontVariantCaps, 'normal') || !cssValueIs(style.fontVariantEastAsian, 'normal') || !cssValueIs(style.fontVariantNumeric, 'normal') || !cssValueIs(style.fontVariantPosition, 'normal') || !cssValueIs(style.fontStretch, 'normal', '100%') || !documentTextEmphasisAllowsKernel(style, element) || !documentRunBorderAllowsKernel(element) || !cssValueIs(style.verticalAlign, 'baseline') || !cssValueIs(style.unicodeBidi, 'normal') && !(paragraphRoot && 'isolate' === style.unicodeBidi)) return null;
|
|
15836
15336
|
const fontStyle = style.fontStyle && 'normal' !== style.fontStyle ? 'italic' === style.fontStyle ? 'italic' : null : 'normal';
|
|
15837
15337
|
if (!fontStyle) return null;
|
|
15838
15338
|
const families = cssFontFamilies(style.fontFamily);
|
|
@@ -15918,6 +15418,10 @@ function documentTextEmphasisAllowsKernel(style, element) {
|
|
|
15918
15418
|
const webkit = style.getPropertyValue('-webkit-text-emphasis-style').trim();
|
|
15919
15419
|
return (!standard || 'none' === standard) && (!webkit || 'none' === webkit);
|
|
15920
15420
|
}
|
|
15421
|
+
function documentRunBorderAllowsKernel(element) {
|
|
15422
|
+
for(let current = element; current; current = current.parentElement)if (current.hasAttribute(DOCUMENT_RUN_BORDER_ATTRIBUTE)) return !documentRunBorderIsVisible(parseDocumentRunBorder(current.getAttribute(DOCUMENT_RUN_BORDER_ATTRIBUTE)));
|
|
15423
|
+
return true;
|
|
15424
|
+
}
|
|
15921
15425
|
function cssLigatures(style) {
|
|
15922
15426
|
const variant = style.fontVariantLigatures;
|
|
15923
15427
|
if (variant && 'normal' !== variant && 'none' !== variant) return null;
|
|
@@ -17475,6 +16979,19 @@ const DocumentTextStyle = TextStyle.extend({
|
|
|
17475
16979
|
{
|
|
17476
16980
|
tag: `span[${DOCUMENT_HIDDEN_TEXT_ATTRIBUTE}]`,
|
|
17477
16981
|
consuming: false
|
|
16982
|
+
},
|
|
16983
|
+
...[
|
|
16984
|
+
DOCUMENT_LEGACY_TEXT_OUTLINE_ATTRIBUTE,
|
|
16985
|
+
DOCUMENT_LEGACY_TEXT_SHADOW_ATTRIBUTE,
|
|
16986
|
+
DOCUMENT_LEGACY_TEXT_EMBOSS_ATTRIBUTE,
|
|
16987
|
+
DOCUMENT_LEGACY_TEXT_IMPRINT_ATTRIBUTE
|
|
16988
|
+
].map((attribute)=>({
|
|
16989
|
+
tag: `span[${attribute}]`,
|
|
16990
|
+
consuming: false
|
|
16991
|
+
})),
|
|
16992
|
+
{
|
|
16993
|
+
tag: `span[${DOCUMENT_RUN_BORDER_ATTRIBUTE}]`,
|
|
16994
|
+
consuming: false
|
|
17478
16995
|
}
|
|
17479
16996
|
];
|
|
17480
16997
|
},
|
|
@@ -17520,6 +17037,15 @@ const DocumentTextStyle = TextStyle.extend({
|
|
|
17520
17037
|
parseHTML: (element)=>documentHiddenTextFromElement(element),
|
|
17521
17038
|
renderHTML: (attributes)=>documentHiddenTextDomAttributes(attributes.hiddenText)
|
|
17522
17039
|
},
|
|
17040
|
+
legacyTextOutline: legacyTextEffectAttribute('outline'),
|
|
17041
|
+
legacyTextShadow: legacyTextEffectAttribute('shadow'),
|
|
17042
|
+
legacyTextEmboss: legacyTextEffectAttribute('emboss'),
|
|
17043
|
+
legacyTextImprint: legacyTextEffectAttribute('imprint'),
|
|
17044
|
+
runBorder: {
|
|
17045
|
+
default: null,
|
|
17046
|
+
parseHTML: (element)=>serializeDocumentRunBorder(parseDocumentRunBorderElement(element)) ?? null,
|
|
17047
|
+
renderHTML: (attributes)=>documentRunBorderDomAttributes(parseDocumentRunBorder(attributes.runBorder))
|
|
17048
|
+
},
|
|
17523
17049
|
kerningThresholdHalfPoints: {
|
|
17524
17050
|
default: null,
|
|
17525
17051
|
parseHTML: (element)=>documentKerningThresholdHalfPointsFromElement(element),
|
|
@@ -17576,6 +17102,18 @@ const DocumentTextStyle = TextStyle.extend({
|
|
|
17576
17102
|
};
|
|
17577
17103
|
}
|
|
17578
17104
|
});
|
|
17105
|
+
function legacyTextEffectAttribute(effect) {
|
|
17106
|
+
return {
|
|
17107
|
+
default: null,
|
|
17108
|
+
parseHTML: (element)=>documentLegacyTextEffectFromElement(element, effect),
|
|
17109
|
+
renderHTML: (attributes)=>{
|
|
17110
|
+
const value = normalizeDocumentLegacyTextEffect(attributes[documentLegacyTextStyleAttributeName(effect)]);
|
|
17111
|
+
return null === value ? {} : documentLegacyTextEffectsDomAttributes({
|
|
17112
|
+
[effect]: value
|
|
17113
|
+
});
|
|
17114
|
+
}
|
|
17115
|
+
};
|
|
17116
|
+
}
|
|
17579
17117
|
function documentTextStyleAttributesAreEmpty(attributes) {
|
|
17580
17118
|
return Object.values(attributes).every((value)=>null == value || '' === value);
|
|
17581
17119
|
}
|
|
@@ -21703,4 +21241,4 @@ function registerDocumentPageSurfaceGeometry(element, provider) {
|
|
|
21703
21241
|
function documentPageSurfaceGeometryForElement(element) {
|
|
21704
21242
|
return documentPageSurfaceProviders.get(element)?.() ?? null;
|
|
21705
21243
|
}
|
|
21706
|
-
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,
|
|
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, DOCUMENT_PARAGRAPH_SHADING_PATTERNS, 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, DocumentImage, DocumentParagraphFormatting, DocumentParagraphIdentity, DocumentScriptFontFormatting, DocumentStrike, DocumentSubscript, DocumentSuperscript, DocumentTableRowIdentity, DocumentTextStyle, DocumentUnderline, MAX_DOCUMENT_IMAGE_RELATIVE_HEIGHT, MAX_DOCUMENT_NUMBERING_START, activeDocumentBookmark, activeDocumentSection, activeDocumentTableStyle, applyDocumentImageCropToElement, applyDocumentImageIdentityToElement, applyDocumentImageLayerToElement, applyDocumentImageWrapContourToElement, applyDocumentPageGeometry, applyDocumentParagraphIdentityToElement, applyDocumentTableGeometryToElement, applyDocumentTableRowIdentityToElement, applyDocumentTextCaseStyle, canChangeDocumentIndent, canInsertDocumentComment, canSetDocumentTableRowRepeatHeader, clampDocumentMargin, collectDocumentChanges, collectDocumentCommentAnchors, collectDocumentNotes, collectDocumentTextLayoutParagraphs, createDocumentBibliography, createDocumentEquationElement, createDocumentImageIdentityRegistry, createDocumentNoteElement, createDocumentParagraphIdentityRegistry, createSchemaDerivedWorkDocumentModel, createSchemaValidatedWorkDocumentModel, createWorkDocumentExtensions, createWorkDocumentModel, createWorkDocumentModelFromContent, createWorkOfficeDocumentCollaborationBinding as createOfficeDocumentCollaborationBinding, cssDocumentFontFamily, 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, documentFontNameFromCssFamily, 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, documentParagraphIdentityFromElement, documentParagraphIndent, documentParagraphPagination, documentParagraphShadingDomAttributes, documentParagraphSpacing, documentParagraphTabStops, documentScriptFontDirectFamily, documentScriptFontFallbackSlots, documentScriptFontFamily, documentScriptFontFamilyForRendering, documentScriptFontSegments, documentScriptFontSlotFromElement, documentScriptFontSlotFromHint, documentScriptFontsDomAttributes, documentScriptFontsFromElement, 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, normalizeDocumentFontName, normalizeDocumentHiddenText, normalizeDocumentHtml, normalizeDocumentImageAlignment, normalizeDocumentImageCrop, normalizeDocumentImageIdentity, normalizeDocumentImageLayer, normalizeDocumentImageLayoutOptions, normalizeDocumentImagePosition, normalizeDocumentImageWrapContour, normalizeDocumentImageWrapSide, normalizeDocumentKerningThresholdHalfPoints, normalizeDocumentLegacyTextEffect, normalizeDocumentLegacyTextEffects, normalizeDocumentNotesHtml, normalizeDocumentPageBorders, normalizeDocumentPageChrome, normalizeDocumentPageGeometry, normalizeDocumentPageMargins, normalizeDocumentPaperSource, normalizeDocumentParagraphId, normalizeDocumentParagraphIdentity, normalizeDocumentParagraphIndent, normalizeDocumentScriptFontHint, normalizeDocumentScriptFontSlot, normalizeDocumentScriptFonts, normalizeDocumentStrikeStyle, normalizeDocumentTabStops, normalizeDocumentTableBorderStyle, normalizeDocumentTableBorderWidth, normalizeDocumentTableRowHeightRule, normalizeDocumentTableRowIdentity, normalizeDocumentTableVerticalAlign, normalizeDocumentTextCase, normalizeDocumentThemeFont, normalizeDocumentUnderlineColor, normalizeDocumentUnderlineStyle, normalizeTableColor, normalizedTabPosition, pageTwipsToMillimeters, parseDocumentCharacterFormatting, parseDocumentParagraphFormatting, parseDocumentParagraphShadingElement, parseDocumentScriptFonts, patchDocumentLazyHtmlProjection, patchDocumentScriptFonts, positionWorkLiveDocumentCapture, readWorkOfficeDocumentCollaboration as readOfficeDocumentCollaboration, registerDocumentPageSurfaceGeometry, renderDocumentAutoLineHeight, renderDocumentTableBorders, renderDocumentTableCellMarginOverrides, resolveDocumentPageBorders, resolveDocumentPageChrome, resolveDocumentPageMargins, resolveDocumentPageSize, resolveWorkDocumentEditorInput, retainAnchoredDocumentComments, sanitizeDocumentPageChromeHtml, selectedDocumentChunkId, serializeDocumentParagraphFormatting, serializeDocumentScriptFonts, serializeDocumentTabStops, serializeWorkDocumentNode, setCustomDocumentColumns, supportedDocxBookmarkReferenceInstruction, syncDocumentContentFromHtml, transferChangedDocumentTextStatistics, uniqueDocumentImageIdentity, uniqueDocumentParagraphIdentity, updateDocumentColumnWidth, updateDocumentCustomPageMillimeters, updateDocumentGutterPosition, updateDocumentMirrorMargins, updateDocumentPageChromeVariant, updateDocumentPageMarginMillimeters, updateDocumentPageMarginMode, updateDocumentPageOrientation, updateDocumentPaperSizePreset, validateDocumentBookmarkName, windowDocumentModel, workDocumentSchema, workOfficeDocumentCollaborationFragment as officeDocumentCollaborationFragment, work_document_page_margins_twipsToMillimeters, wrapsBesideImage };
|