oasis-editor 0.0.123 → 0.0.125
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{OasisEditorApp-Dwc5ee9G.js → OasisEditorApp-CZVAf0XI.js} +138 -6
- package/dist/assets/{importDocxWorker-A73eR_fM.js → importDocxWorker-C9tO3vbp.js} +1 -1
- package/dist/core/layoutConstants.d.ts +13 -0
- package/dist/core/model/types/styles.d.ts +44 -0
- package/dist/export/docx/borders.d.ts +2 -0
- package/dist/import/docx/borders.d.ts +4 -0
- package/dist/{index-YMlNF1Ya.js → index-JfmhzLRe.js} +726 -515
- package/dist/layoutProjection/index.d.ts +1 -1
- package/dist/layoutProjection/paragraphBorders.d.ts +8 -0
- package/dist/oasis-editor.js +49 -49
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/ui/textMeasurement/lineFlow.d.ts +25 -0
- package/package.json +1 -1
|
@@ -2623,7 +2623,7 @@ function OasisEditorAppLazy(props = {}) {
|
|
|
2623
2623
|
onCleanup(() => {
|
|
2624
2624
|
cancelled = true;
|
|
2625
2625
|
});
|
|
2626
|
-
import("./OasisEditorApp-
|
|
2626
|
+
import("./OasisEditorApp-CZVAf0XI.js").then((m) => {
|
|
2627
2627
|
cancelled = true;
|
|
2628
2628
|
setProgress(1);
|
|
2629
2629
|
setTimeout(() => setApp(() => m.OasisEditorApp), 180);
|
|
@@ -3365,7 +3365,23 @@ const DEFAULT_PARAGRAPH_STYLE = asRequired({
|
|
|
3365
3365
|
keepLinesTogether: false,
|
|
3366
3366
|
widowControl: true,
|
|
3367
3367
|
textDirection: null,
|
|
3368
|
-
outlineLevel: null
|
|
3368
|
+
outlineLevel: null,
|
|
3369
|
+
suppressLineNumbers: false,
|
|
3370
|
+
bidi: false,
|
|
3371
|
+
kinsoku: true,
|
|
3372
|
+
wordWrap: true,
|
|
3373
|
+
overflowPunct: true,
|
|
3374
|
+
topLinePunct: false,
|
|
3375
|
+
autoSpaceDE: true,
|
|
3376
|
+
autoSpaceDN: true,
|
|
3377
|
+
adjustRightInd: true,
|
|
3378
|
+
textAlignment: null,
|
|
3379
|
+
textboxTightWrap: null,
|
|
3380
|
+
divId: null,
|
|
3381
|
+
conditionalStyle: null,
|
|
3382
|
+
borderBetween: null,
|
|
3383
|
+
borderBar: null,
|
|
3384
|
+
framePrXml: null
|
|
3369
3385
|
});
|
|
3370
3386
|
const DEFAULT_EDITOR_PAGE_SETTINGS = {
|
|
3371
3387
|
width: 816,
|
|
@@ -13866,6 +13882,151 @@ function getLineStartInset(paragraph, styles, isFirstLine) {
|
|
|
13866
13882
|
const firstLineOffset = paragraphStyle.indentHanging ? -Math.abs(paragraphStyle.indentHanging) : paragraphStyle.indentFirstLine ?? 0;
|
|
13867
13883
|
return baseInset + firstLineOffset;
|
|
13868
13884
|
}
|
|
13885
|
+
function intersectsVertically(aTop, aBottom, bTop, bBottom) {
|
|
13886
|
+
return aTop < bBottom && aBottom > bTop;
|
|
13887
|
+
}
|
|
13888
|
+
function subtractInterval(segments, cutLeft, cutRight) {
|
|
13889
|
+
const result = [];
|
|
13890
|
+
for (const segment of segments) {
|
|
13891
|
+
if (cutRight <= segment.left || cutLeft >= segment.right) {
|
|
13892
|
+
result.push(segment);
|
|
13893
|
+
continue;
|
|
13894
|
+
}
|
|
13895
|
+
if (cutLeft > segment.left) {
|
|
13896
|
+
result.push({
|
|
13897
|
+
left: segment.left,
|
|
13898
|
+
right: Math.max(segment.left, cutLeft)
|
|
13899
|
+
});
|
|
13900
|
+
}
|
|
13901
|
+
if (cutRight < segment.right) {
|
|
13902
|
+
result.push({
|
|
13903
|
+
left: Math.min(segment.right, cutRight),
|
|
13904
|
+
right: segment.right
|
|
13905
|
+
});
|
|
13906
|
+
}
|
|
13907
|
+
}
|
|
13908
|
+
return result.filter((segment) => segment.right - segment.left > 1);
|
|
13909
|
+
}
|
|
13910
|
+
function mergeIntervals(intervals) {
|
|
13911
|
+
if (intervals.length <= 1) return intervals.slice();
|
|
13912
|
+
const sorted = intervals.filter((interval) => interval.right > interval.left).sort((a, b) => a.left - b.left);
|
|
13913
|
+
const merged = [];
|
|
13914
|
+
for (const interval of sorted) {
|
|
13915
|
+
const last = merged[merged.length - 1];
|
|
13916
|
+
if (last && interval.left <= last.right) {
|
|
13917
|
+
last.right = Math.max(last.right, interval.right);
|
|
13918
|
+
} else {
|
|
13919
|
+
merged.push({ ...interval });
|
|
13920
|
+
}
|
|
13921
|
+
}
|
|
13922
|
+
return merged;
|
|
13923
|
+
}
|
|
13924
|
+
function coveredIntervalsAtScanline(polygon2, y) {
|
|
13925
|
+
const xs = [];
|
|
13926
|
+
for (let i = 0; i < polygon2.length; i += 1) {
|
|
13927
|
+
const a = polygon2[i];
|
|
13928
|
+
const b = polygon2[(i + 1) % polygon2.length];
|
|
13929
|
+
const crosses = a.y <= y && b.y > y || b.y <= y && a.y > y;
|
|
13930
|
+
if (!crosses) continue;
|
|
13931
|
+
const t = (y - a.y) / (b.y - a.y);
|
|
13932
|
+
xs.push(a.x + t * (b.x - a.x));
|
|
13933
|
+
}
|
|
13934
|
+
xs.sort((p, q) => p - q);
|
|
13935
|
+
const intervals = [];
|
|
13936
|
+
for (let k = 0; k + 1 < xs.length; k += 2) {
|
|
13937
|
+
intervals.push({ left: xs[k], right: xs[k + 1] });
|
|
13938
|
+
}
|
|
13939
|
+
return intervals;
|
|
13940
|
+
}
|
|
13941
|
+
function polygonCoveredIntervals(polygon2, top, bottom) {
|
|
13942
|
+
const samples = 5;
|
|
13943
|
+
const collected = [];
|
|
13944
|
+
for (let s = 0; s < samples; s += 1) {
|
|
13945
|
+
const y = bottom === top ? top : top + (bottom - top) * s / (samples - 1);
|
|
13946
|
+
collected.push(...coveredIntervalsAtScanline(polygon2, y));
|
|
13947
|
+
}
|
|
13948
|
+
return mergeIntervals(collected);
|
|
13949
|
+
}
|
|
13950
|
+
function resolveLineFlowBox(options) {
|
|
13951
|
+
const {
|
|
13952
|
+
paragraph,
|
|
13953
|
+
styles,
|
|
13954
|
+
contentWidth,
|
|
13955
|
+
isFirstLine,
|
|
13956
|
+
lineTop,
|
|
13957
|
+
lineHeight,
|
|
13958
|
+
exclusions = []
|
|
13959
|
+
} = options;
|
|
13960
|
+
const baseLeft = getLineStartInset(paragraph, styles, isFirstLine);
|
|
13961
|
+
const baseWidth = getAvailableWidth(
|
|
13962
|
+
paragraph,
|
|
13963
|
+
styles,
|
|
13964
|
+
contentWidth,
|
|
13965
|
+
isFirstLine
|
|
13966
|
+
);
|
|
13967
|
+
const lineBottom = lineTop + lineHeight;
|
|
13968
|
+
let segments = [
|
|
13969
|
+
{
|
|
13970
|
+
left: baseLeft,
|
|
13971
|
+
right: baseLeft + baseWidth
|
|
13972
|
+
}
|
|
13973
|
+
];
|
|
13974
|
+
let hasThrough = false;
|
|
13975
|
+
for (const exclusion of exclusions) {
|
|
13976
|
+
const exclusionBottom = exclusion.y + exclusion.height;
|
|
13977
|
+
if (!intersectsVertically(lineTop, lineBottom, exclusion.y, exclusionBottom)) {
|
|
13978
|
+
continue;
|
|
13979
|
+
}
|
|
13980
|
+
if (exclusion.wrap === "topAndBottom") {
|
|
13981
|
+
return {
|
|
13982
|
+
left: baseLeft,
|
|
13983
|
+
width: baseWidth,
|
|
13984
|
+
forcedTop: exclusionBottom,
|
|
13985
|
+
segments: [{ left: baseLeft, width: baseWidth }]
|
|
13986
|
+
};
|
|
13987
|
+
}
|
|
13988
|
+
if (exclusion.polygon) {
|
|
13989
|
+
if (exclusion.wrap === "through") {
|
|
13990
|
+
hasThrough = true;
|
|
13991
|
+
}
|
|
13992
|
+
for (const interval of polygonCoveredIntervals(
|
|
13993
|
+
exclusion.polygon,
|
|
13994
|
+
lineTop,
|
|
13995
|
+
lineBottom
|
|
13996
|
+
)) {
|
|
13997
|
+
segments = subtractInterval(segments, interval.left, interval.right);
|
|
13998
|
+
}
|
|
13999
|
+
} else {
|
|
14000
|
+
segments = subtractInterval(
|
|
14001
|
+
segments,
|
|
14002
|
+
exclusion.x,
|
|
14003
|
+
exclusion.x + exclusion.width
|
|
14004
|
+
);
|
|
14005
|
+
}
|
|
14006
|
+
}
|
|
14007
|
+
if (segments.length === 0) {
|
|
14008
|
+
const fallbackWidth = Math.max(1, baseWidth);
|
|
14009
|
+
return {
|
|
14010
|
+
left: baseLeft,
|
|
14011
|
+
width: fallbackWidth,
|
|
14012
|
+
segments: [{ left: baseLeft, width: fallbackWidth }]
|
|
14013
|
+
};
|
|
14014
|
+
}
|
|
14015
|
+
const ordered = segments.slice().sort((a, b) => a.left - b.left).map((segment) => ({
|
|
14016
|
+
left: segment.left,
|
|
14017
|
+
width: Math.max(1, segment.right - segment.left)
|
|
14018
|
+
}));
|
|
14019
|
+
const widest = ordered.reduce(
|
|
14020
|
+
(best, current) => current.width > best.width ? current : best
|
|
14021
|
+
);
|
|
14022
|
+
return {
|
|
14023
|
+
left: widest.left,
|
|
14024
|
+
width: widest.width,
|
|
14025
|
+
// Only "through" wrapping flows text across multiple gaps; every other mode
|
|
14026
|
+
// keeps text on the single widest side.
|
|
14027
|
+
segments: hasThrough ? ordered : [widest]
|
|
14028
|
+
};
|
|
14029
|
+
}
|
|
13869
14030
|
const DEFAULT_LINE_HEIGHT$1 = 1.15;
|
|
13870
14031
|
function resolveLineSpacing(paragraphStyle) {
|
|
13871
14032
|
const rule = paragraphStyle.lineRule ?? "auto";
|
|
@@ -14307,151 +14468,6 @@ function findHyphenationPoints(word, lang) {
|
|
|
14307
14468
|
}
|
|
14308
14469
|
const DEFAULT_CONTENT_WIDTH = 624;
|
|
14309
14470
|
const MIN_CONTENT_WIDTH = 120;
|
|
14310
|
-
function intersectsVertically(aTop, aBottom, bTop, bBottom) {
|
|
14311
|
-
return aTop < bBottom && aBottom > bTop;
|
|
14312
|
-
}
|
|
14313
|
-
function subtractInterval(segments, cutLeft, cutRight) {
|
|
14314
|
-
const result = [];
|
|
14315
|
-
for (const segment of segments) {
|
|
14316
|
-
if (cutRight <= segment.left || cutLeft >= segment.right) {
|
|
14317
|
-
result.push(segment);
|
|
14318
|
-
continue;
|
|
14319
|
-
}
|
|
14320
|
-
if (cutLeft > segment.left) {
|
|
14321
|
-
result.push({
|
|
14322
|
-
left: segment.left,
|
|
14323
|
-
right: Math.max(segment.left, cutLeft)
|
|
14324
|
-
});
|
|
14325
|
-
}
|
|
14326
|
-
if (cutRight < segment.right) {
|
|
14327
|
-
result.push({
|
|
14328
|
-
left: Math.min(segment.right, cutRight),
|
|
14329
|
-
right: segment.right
|
|
14330
|
-
});
|
|
14331
|
-
}
|
|
14332
|
-
}
|
|
14333
|
-
return result.filter((segment) => segment.right - segment.left > 1);
|
|
14334
|
-
}
|
|
14335
|
-
function mergeIntervals(intervals) {
|
|
14336
|
-
if (intervals.length <= 1) return intervals.slice();
|
|
14337
|
-
const sorted = intervals.filter((interval) => interval.right > interval.left).sort((a, b) => a.left - b.left);
|
|
14338
|
-
const merged = [];
|
|
14339
|
-
for (const interval of sorted) {
|
|
14340
|
-
const last = merged[merged.length - 1];
|
|
14341
|
-
if (last && interval.left <= last.right) {
|
|
14342
|
-
last.right = Math.max(last.right, interval.right);
|
|
14343
|
-
} else {
|
|
14344
|
-
merged.push({ ...interval });
|
|
14345
|
-
}
|
|
14346
|
-
}
|
|
14347
|
-
return merged;
|
|
14348
|
-
}
|
|
14349
|
-
function coveredIntervalsAtScanline(polygon2, y) {
|
|
14350
|
-
const xs = [];
|
|
14351
|
-
for (let i = 0; i < polygon2.length; i += 1) {
|
|
14352
|
-
const a = polygon2[i];
|
|
14353
|
-
const b = polygon2[(i + 1) % polygon2.length];
|
|
14354
|
-
const crosses = a.y <= y && b.y > y || b.y <= y && a.y > y;
|
|
14355
|
-
if (!crosses) continue;
|
|
14356
|
-
const t = (y - a.y) / (b.y - a.y);
|
|
14357
|
-
xs.push(a.x + t * (b.x - a.x));
|
|
14358
|
-
}
|
|
14359
|
-
xs.sort((p, q) => p - q);
|
|
14360
|
-
const intervals = [];
|
|
14361
|
-
for (let k = 0; k + 1 < xs.length; k += 2) {
|
|
14362
|
-
intervals.push({ left: xs[k], right: xs[k + 1] });
|
|
14363
|
-
}
|
|
14364
|
-
return intervals;
|
|
14365
|
-
}
|
|
14366
|
-
function polygonCoveredIntervals(polygon2, top, bottom) {
|
|
14367
|
-
const samples = 5;
|
|
14368
|
-
const collected = [];
|
|
14369
|
-
for (let s = 0; s < samples; s += 1) {
|
|
14370
|
-
const y = bottom === top ? top : top + (bottom - top) * s / (samples - 1);
|
|
14371
|
-
collected.push(...coveredIntervalsAtScanline(polygon2, y));
|
|
14372
|
-
}
|
|
14373
|
-
return mergeIntervals(collected);
|
|
14374
|
-
}
|
|
14375
|
-
function resolveLineFlowBox(options) {
|
|
14376
|
-
const {
|
|
14377
|
-
paragraph,
|
|
14378
|
-
styles,
|
|
14379
|
-
contentWidth,
|
|
14380
|
-
isFirstLine,
|
|
14381
|
-
lineTop,
|
|
14382
|
-
lineHeight,
|
|
14383
|
-
exclusions = []
|
|
14384
|
-
} = options;
|
|
14385
|
-
const baseLeft = getLineStartInset(paragraph, styles, isFirstLine);
|
|
14386
|
-
const baseWidth = getAvailableWidth(
|
|
14387
|
-
paragraph,
|
|
14388
|
-
styles,
|
|
14389
|
-
contentWidth,
|
|
14390
|
-
isFirstLine
|
|
14391
|
-
);
|
|
14392
|
-
const lineBottom = lineTop + lineHeight;
|
|
14393
|
-
let segments = [
|
|
14394
|
-
{
|
|
14395
|
-
left: baseLeft,
|
|
14396
|
-
right: baseLeft + baseWidth
|
|
14397
|
-
}
|
|
14398
|
-
];
|
|
14399
|
-
let hasThrough = false;
|
|
14400
|
-
for (const exclusion of exclusions) {
|
|
14401
|
-
const exclusionBottom = exclusion.y + exclusion.height;
|
|
14402
|
-
if (!intersectsVertically(lineTop, lineBottom, exclusion.y, exclusionBottom)) {
|
|
14403
|
-
continue;
|
|
14404
|
-
}
|
|
14405
|
-
if (exclusion.wrap === "topAndBottom") {
|
|
14406
|
-
return {
|
|
14407
|
-
left: baseLeft,
|
|
14408
|
-
width: baseWidth,
|
|
14409
|
-
forcedTop: exclusionBottom,
|
|
14410
|
-
segments: [{ left: baseLeft, width: baseWidth }]
|
|
14411
|
-
};
|
|
14412
|
-
}
|
|
14413
|
-
if (exclusion.polygon) {
|
|
14414
|
-
if (exclusion.wrap === "through") {
|
|
14415
|
-
hasThrough = true;
|
|
14416
|
-
}
|
|
14417
|
-
for (const interval of polygonCoveredIntervals(
|
|
14418
|
-
exclusion.polygon,
|
|
14419
|
-
lineTop,
|
|
14420
|
-
lineBottom
|
|
14421
|
-
)) {
|
|
14422
|
-
segments = subtractInterval(segments, interval.left, interval.right);
|
|
14423
|
-
}
|
|
14424
|
-
} else {
|
|
14425
|
-
segments = subtractInterval(
|
|
14426
|
-
segments,
|
|
14427
|
-
exclusion.x,
|
|
14428
|
-
exclusion.x + exclusion.width
|
|
14429
|
-
);
|
|
14430
|
-
}
|
|
14431
|
-
}
|
|
14432
|
-
if (segments.length === 0) {
|
|
14433
|
-
const fallbackWidth = Math.max(1, baseWidth);
|
|
14434
|
-
return {
|
|
14435
|
-
left: baseLeft,
|
|
14436
|
-
width: fallbackWidth,
|
|
14437
|
-
segments: [{ left: baseLeft, width: fallbackWidth }]
|
|
14438
|
-
};
|
|
14439
|
-
}
|
|
14440
|
-
const ordered = segments.slice().sort((a, b) => a.left - b.left).map((segment) => ({
|
|
14441
|
-
left: segment.left,
|
|
14442
|
-
width: Math.max(1, segment.right - segment.left)
|
|
14443
|
-
}));
|
|
14444
|
-
const widest = ordered.reduce(
|
|
14445
|
-
(best, current) => current.width > best.width ? current : best
|
|
14446
|
-
);
|
|
14447
|
-
return {
|
|
14448
|
-
left: widest.left,
|
|
14449
|
-
width: widest.width,
|
|
14450
|
-
// Only "through" wrapping flows text across multiple gaps; every other mode
|
|
14451
|
-
// keeps text on the single widest side.
|
|
14452
|
-
segments: hasThrough ? ordered : [widest]
|
|
14453
|
-
};
|
|
14454
|
-
}
|
|
14455
14471
|
function measureParagraphMinContentWidthPx(paragraph, styles) {
|
|
14456
14472
|
const fragments = buildParagraphFragments(paragraph);
|
|
14457
14473
|
const measuredChars = buildMeasuredChars(paragraph, fragments, styles);
|
|
@@ -14479,6 +14495,7 @@ function measureParagraphMinContentWidthPx(paragraph, styles) {
|
|
|
14479
14495
|
return Math.max(1, inset + largestUnbreakableToken, largestInlineObject);
|
|
14480
14496
|
}
|
|
14481
14497
|
function composeMeasuredParagraphLines(options) {
|
|
14498
|
+
var _a;
|
|
14482
14499
|
const { paragraph, fragments, styles, contentWidth, defaultTabStop } = options;
|
|
14483
14500
|
const exclusions = options.exclusions ?? [];
|
|
14484
14501
|
const hyphenation = options.hyphenation;
|
|
@@ -14493,10 +14510,10 @@ function composeMeasuredParagraphLines(options) {
|
|
|
14493
14510
|
DEFAULT_FONT_SIZE_PX,
|
|
14494
14511
|
...paragraph.runs.map(
|
|
14495
14512
|
(run) => {
|
|
14496
|
-
var
|
|
14513
|
+
var _a2;
|
|
14497
14514
|
return resolveEffectiveTextStyleForParagraph(
|
|
14498
14515
|
run.styles,
|
|
14499
|
-
(
|
|
14516
|
+
(_a2 = paragraph.style) == null ? void 0 : _a2.styleId,
|
|
14500
14517
|
styles
|
|
14501
14518
|
).fontSize ?? DEFAULT_FONT_SIZE_PX;
|
|
14502
14519
|
}
|
|
@@ -14683,7 +14700,7 @@ function composeMeasuredParagraphLines(options) {
|
|
|
14683
14700
|
const hyphenLimit = (hyphenation == null ? void 0 : hyphenation.consecutiveLimit) ?? 0;
|
|
14684
14701
|
const canHyphenateMore = () => hyphenLimit <= 0 || consecutiveHyphens < hyphenLimit;
|
|
14685
14702
|
const tryHyphenate = (chars2, remainingWidth) => {
|
|
14686
|
-
var
|
|
14703
|
+
var _a2, _b, _c, _d;
|
|
14687
14704
|
if (!(hyphenation == null ? void 0 : hyphenation.enabled) || !canHyphenateMore()) return null;
|
|
14688
14705
|
const word = chars2.map((char) => char.char).join("");
|
|
14689
14706
|
if (!shouldHyphenateWord(word, {
|
|
@@ -14691,12 +14708,12 @@ function composeMeasuredParagraphLines(options) {
|
|
|
14691
14708
|
})) {
|
|
14692
14709
|
return null;
|
|
14693
14710
|
}
|
|
14694
|
-
const langTag = (_c = (_b = (
|
|
14711
|
+
const langTag = (_c = (_b = (_a2 = chars2.find(
|
|
14695
14712
|
(char) => {
|
|
14696
|
-
var
|
|
14697
|
-
return (_b2 = (
|
|
14713
|
+
var _a3, _b2;
|
|
14714
|
+
return (_b2 = (_a3 = char.style) == null ? void 0 : _a3.language) == null ? void 0 : _b2.value;
|
|
14698
14715
|
}
|
|
14699
|
-
)) == null ? void 0 :
|
|
14716
|
+
)) == null ? void 0 : _a2.style) == null ? void 0 : _b.language) == null ? void 0 : _c.value;
|
|
14700
14717
|
const points = findHyphenationPoints(
|
|
14701
14718
|
word,
|
|
14702
14719
|
resolveHyphenationLanguage(langTag ?? void 0)
|
|
@@ -14778,7 +14795,8 @@ function composeMeasuredParagraphLines(options) {
|
|
|
14778
14795
|
resetLine(token.chars[0].offset);
|
|
14779
14796
|
layoutFreshWord(token.chars);
|
|
14780
14797
|
}
|
|
14781
|
-
|
|
14798
|
+
const endsWithTrailingLineBreak = ((_a = tokens[tokens.length - 1]) == null ? void 0 : _a.kind) === "newline";
|
|
14799
|
+
if (lines.length === 0 || lineStartOffset !== lineEndOffset || lineSlotLefts.length > 1 || endsWithTrailingLineBreak) {
|
|
14782
14800
|
flushLine();
|
|
14783
14801
|
}
|
|
14784
14802
|
return applyParagraphAlignment(
|
|
@@ -15029,9 +15047,36 @@ function getParagraphBorderInsets(style2) {
|
|
|
15029
15047
|
bottom: edgeInset(style2.borderBottom)
|
|
15030
15048
|
};
|
|
15031
15049
|
}
|
|
15050
|
+
function paragraphBetweenBorderMatches(a, b) {
|
|
15051
|
+
const ba = a.borderBetween;
|
|
15052
|
+
const bb = b.borderBetween;
|
|
15053
|
+
if (!isVisibleBorder$1(ba) || !isVisibleBorder$1(bb)) {
|
|
15054
|
+
return false;
|
|
15055
|
+
}
|
|
15056
|
+
return ba.type === bb.type && ba.width === bb.width && ba.color === bb.color;
|
|
15057
|
+
}
|
|
15032
15058
|
const VERTICAL_HIT_WEIGHT = 1e3;
|
|
15033
15059
|
const TEXT_BASELINE_RATIO = 0.8;
|
|
15034
15060
|
const NO_WRAP_MEASURE_WIDTH_PX = 1e5;
|
|
15061
|
+
function resolveTextAlignmentBaselineOffset(textAlignment, fontSizePx, lineHeightPx) {
|
|
15062
|
+
if (!textAlignment || textAlignment === "auto" || textAlignment === "baseline") {
|
|
15063
|
+
return 0;
|
|
15064
|
+
}
|
|
15065
|
+
if (fontSizePx >= lineHeightPx) {
|
|
15066
|
+
return 0;
|
|
15067
|
+
}
|
|
15068
|
+
const delta = fontSizePx - lineHeightPx;
|
|
15069
|
+
switch (textAlignment) {
|
|
15070
|
+
case "top":
|
|
15071
|
+
return TEXT_BASELINE_RATIO * delta;
|
|
15072
|
+
case "center":
|
|
15073
|
+
return (TEXT_BASELINE_RATIO - 0.5) * delta;
|
|
15074
|
+
case "bottom":
|
|
15075
|
+
return (1 - TEXT_BASELINE_RATIO) * -delta;
|
|
15076
|
+
default:
|
|
15077
|
+
return 0;
|
|
15078
|
+
}
|
|
15079
|
+
}
|
|
15035
15080
|
function formatTimestamp() {
|
|
15036
15081
|
const now = /* @__PURE__ */ new Date();
|
|
15037
15082
|
const h = String(now.getHours()).padStart(2, "0");
|
|
@@ -21242,6 +21287,11 @@ function drawParagraph(ctx, paragraph, lines, state, originX, originY, onUpdate,
|
|
|
21242
21287
|
slotByOffset.set(slot.offset, slot);
|
|
21243
21288
|
}
|
|
21244
21289
|
const baselineY = originY + line.top + line.height * TEXT_BASELINE_RATIO;
|
|
21290
|
+
const paragraphStyle = resolveEffectiveParagraphStyle(
|
|
21291
|
+
paragraph.style,
|
|
21292
|
+
state.document.styles
|
|
21293
|
+
);
|
|
21294
|
+
const textAlignment = paragraphStyle.textAlignment;
|
|
21245
21295
|
const listPrefix = line.index === 0 ? resolveListPrefix(paragraph, state.document) : "";
|
|
21246
21296
|
if (listPrefix) {
|
|
21247
21297
|
const prefixStyles = resolveEffectiveTextStyleForParagraph(
|
|
@@ -21384,7 +21434,11 @@ function drawParagraph(ctx, paragraph, lines, state, originX, originY, onUpdate,
|
|
|
21384
21434
|
state,
|
|
21385
21435
|
styles,
|
|
21386
21436
|
originX,
|
|
21387
|
-
baselineY + renderMetrics.baselineOffset
|
|
21437
|
+
baselineY + renderMetrics.baselineOffset + resolveTextAlignmentBaselineOffset(
|
|
21438
|
+
textAlignment,
|
|
21439
|
+
fontSize,
|
|
21440
|
+
line.height
|
|
21441
|
+
)
|
|
21388
21442
|
);
|
|
21389
21443
|
if (styles.reflection) {
|
|
21390
21444
|
drawFragmentReflection(
|
|
@@ -21393,7 +21447,11 @@ function drawParagraph(ctx, paragraph, lines, state, originX, originY, onUpdate,
|
|
|
21393
21447
|
slotByOffset,
|
|
21394
21448
|
styles,
|
|
21395
21449
|
originX,
|
|
21396
|
-
baselineY + renderMetrics.baselineOffset
|
|
21450
|
+
baselineY + renderMetrics.baselineOffset + resolveTextAlignmentBaselineOffset(
|
|
21451
|
+
textAlignment,
|
|
21452
|
+
fontSize,
|
|
21453
|
+
line.height
|
|
21454
|
+
),
|
|
21397
21455
|
styles.reflection
|
|
21398
21456
|
);
|
|
21399
21457
|
}
|
|
@@ -21623,7 +21681,7 @@ function toCanvasEdge(border) {
|
|
|
21623
21681
|
};
|
|
21624
21682
|
}
|
|
21625
21683
|
function drawParagraphDecorations(ctx, paragraphStyle, lines, originX, contentTop, contentWidth) {
|
|
21626
|
-
const hasBorder = !!paragraphStyle.borderTop || !!paragraphStyle.borderRight || !!paragraphStyle.borderBottom || !!paragraphStyle.borderLeft;
|
|
21684
|
+
const hasBorder = !!paragraphStyle.borderTop || !!paragraphStyle.borderRight || !!paragraphStyle.borderBottom || !!paragraphStyle.borderLeft || !!paragraphStyle.borderBar;
|
|
21627
21685
|
if (!paragraphStyle.shading && !hasBorder) {
|
|
21628
21686
|
return;
|
|
21629
21687
|
}
|
|
@@ -21653,11 +21711,17 @@ function drawParagraphDecorations(ctx, paragraphStyle, lines, originX, contentTo
|
|
|
21653
21711
|
left: toCanvasEdge(paragraphStyle.borderLeft)
|
|
21654
21712
|
});
|
|
21655
21713
|
}
|
|
21714
|
+
if (paragraphStyle.borderBar) {
|
|
21715
|
+
drawBorderBox(ctx, left, contentTop, 0, boxHeight, {
|
|
21716
|
+
left: toCanvasEdge(paragraphStyle.borderBar)
|
|
21717
|
+
});
|
|
21718
|
+
}
|
|
21656
21719
|
}
|
|
21657
21720
|
function renderBlockList(ctx, state, blocks, originX, originY, contentWidth, pageIndex, onUpdate, pageSettings) {
|
|
21658
21721
|
var _a;
|
|
21659
21722
|
let cursorY = originY;
|
|
21660
|
-
for (
|
|
21723
|
+
for (let blockIndex = 0; blockIndex < blocks.length; blockIndex += 1) {
|
|
21724
|
+
const block = blocks[blockIndex];
|
|
21661
21725
|
if (block.sourceBlock.type === "paragraph" && block.layout) {
|
|
21662
21726
|
const paragraphStyle = resolveEffectiveParagraphStyle(
|
|
21663
21727
|
block.sourceBlock.style,
|
|
@@ -21750,6 +21814,30 @@ function renderBlockList(ctx, state, blocks, originX, originY, contentWidth, pag
|
|
|
21750
21814
|
layer: "front"
|
|
21751
21815
|
});
|
|
21752
21816
|
}
|
|
21817
|
+
const nextBlock = blocks[blockIndex + 1];
|
|
21818
|
+
if ((nextBlock == null ? void 0 : nextBlock.sourceBlock.type) === "paragraph" && nextBlock.layout && nextBlock.sourceBlock.id !== block.sourceBlock.id) {
|
|
21819
|
+
const nextStyle = resolveEffectiveParagraphStyle(
|
|
21820
|
+
nextBlock.sourceBlock.style,
|
|
21821
|
+
state.document.styles
|
|
21822
|
+
);
|
|
21823
|
+
if (paragraphBetweenBorderMatches(paragraphStyle, nextStyle)) {
|
|
21824
|
+
let linesHeight = 0;
|
|
21825
|
+
for (const line of block.layout.lines) {
|
|
21826
|
+
linesHeight = Math.max(linesHeight, line.top + line.height);
|
|
21827
|
+
}
|
|
21828
|
+
const betweenY = textTop + linesHeight;
|
|
21829
|
+
const barLeft = originX + (paragraphStyle.indentLeft ?? 0);
|
|
21830
|
+
const barRight = originX + contentWidth - (paragraphStyle.indentRight ?? 0);
|
|
21831
|
+
drawBorderBox(
|
|
21832
|
+
ctx,
|
|
21833
|
+
barLeft,
|
|
21834
|
+
betweenY,
|
|
21835
|
+
Math.max(0, barRight - barLeft),
|
|
21836
|
+
0,
|
|
21837
|
+
{ top: toCanvasEdge(paragraphStyle.borderBetween) }
|
|
21838
|
+
);
|
|
21839
|
+
}
|
|
21840
|
+
}
|
|
21753
21841
|
} else if (block.sourceBlock.type === "table") {
|
|
21754
21842
|
const floating = (_a = block.sourceBlock.style) == null ? void 0 : _a.floating;
|
|
21755
21843
|
if (floating && pageSettings) {
|
|
@@ -33028,6 +33116,12 @@ function parseDocxBoxBorders(container) {
|
|
|
33028
33116
|
),
|
|
33029
33117
|
borderTopRightToBottomLeft: parseDocxBorder(
|
|
33030
33118
|
getFirstChildByTagNameNS(container, WORD_NS, "tr2bl")
|
|
33119
|
+
),
|
|
33120
|
+
borderBetween: parseDocxBorder(
|
|
33121
|
+
getFirstChildByTagNameNS(container, WORD_NS, "between")
|
|
33122
|
+
),
|
|
33123
|
+
borderBar: parseDocxBorder(
|
|
33124
|
+
getFirstChildByTagNameNS(container, WORD_NS, "bar")
|
|
33031
33125
|
)
|
|
33032
33126
|
};
|
|
33033
33127
|
}
|
|
@@ -33599,240 +33693,6 @@ function parseRunStyle(runProperties, theme) {
|
|
|
33599
33693
|
}
|
|
33600
33694
|
return emptyOrUndefined(styles);
|
|
33601
33695
|
}
|
|
33602
|
-
function normalizeImportedParagraphStyle(style2) {
|
|
33603
|
-
if (!style2) {
|
|
33604
|
-
return void 0;
|
|
33605
|
-
}
|
|
33606
|
-
const effective = resolveEffectiveParagraphStyle(
|
|
33607
|
-
style2,
|
|
33608
|
-
DEFAULT_EDITOR_STYLES
|
|
33609
|
-
);
|
|
33610
|
-
const defaultEffective = resolveEffectiveParagraphStyle(
|
|
33611
|
-
void 0,
|
|
33612
|
-
DEFAULT_EDITOR_STYLES
|
|
33613
|
-
);
|
|
33614
|
-
const normalized = stripUndefined({
|
|
33615
|
-
styleId: style2.styleId,
|
|
33616
|
-
align: effective.align !== defaultEffective.align ? effective.align : void 0,
|
|
33617
|
-
spacingBefore: effective.spacingBefore !== defaultEffective.spacingBefore ? effective.spacingBefore : void 0,
|
|
33618
|
-
spacingAfter: effective.spacingAfter !== defaultEffective.spacingAfter ? effective.spacingAfter : void 0,
|
|
33619
|
-
contextualSpacing: style2.contextualSpacing !== void 0 || effective.contextualSpacing !== defaultEffective.contextualSpacing ? effective.contextualSpacing : void 0,
|
|
33620
|
-
lineHeight: effective.lineHeight !== defaultEffective.lineHeight ? effective.lineHeight : void 0,
|
|
33621
|
-
lineRule: effective.lineRule ?? void 0,
|
|
33622
|
-
lineGridPitch: style2.lineGridPitch ?? void 0,
|
|
33623
|
-
snapToGrid: style2.snapToGrid !== void 0 || effective.snapToGrid !== defaultEffective.snapToGrid ? effective.snapToGrid : void 0,
|
|
33624
|
-
indentLeft: style2.indentLeft !== void 0 || effective.indentLeft !== defaultEffective.indentLeft ? effective.indentLeft : void 0,
|
|
33625
|
-
indentRight: style2.indentRight !== void 0 || effective.indentRight !== defaultEffective.indentRight ? effective.indentRight : void 0,
|
|
33626
|
-
indentFirstLine: style2.indentFirstLine !== void 0 || effective.indentFirstLine !== defaultEffective.indentFirstLine ? effective.indentFirstLine : void 0,
|
|
33627
|
-
indentHanging: style2.indentHanging !== void 0 || effective.indentHanging !== defaultEffective.indentHanging ? effective.indentHanging : void 0,
|
|
33628
|
-
mirrorIndents: style2.mirrorIndents !== void 0 || effective.mirrorIndents !== defaultEffective.mirrorIndents ? effective.mirrorIndents : void 0,
|
|
33629
|
-
pageBreakBefore: style2.pageBreakBefore !== void 0 || effective.pageBreakBefore !== defaultEffective.pageBreakBefore ? effective.pageBreakBefore : void 0,
|
|
33630
|
-
keepWithNext: style2.keepWithNext !== void 0 || effective.keepWithNext !== defaultEffective.keepWithNext ? effective.keepWithNext : void 0,
|
|
33631
|
-
keepLinesTogether: style2.keepLinesTogether !== void 0 || effective.keepLinesTogether !== defaultEffective.keepLinesTogether ? effective.keepLinesTogether : void 0,
|
|
33632
|
-
widowControl: style2.widowControl !== void 0 || effective.widowControl !== defaultEffective.widowControl ? effective.widowControl : void 0,
|
|
33633
|
-
shading: style2.shading ?? void 0,
|
|
33634
|
-
borderTop: style2.borderTop ?? void 0,
|
|
33635
|
-
borderRight: style2.borderRight ?? void 0,
|
|
33636
|
-
borderBottom: style2.borderBottom ?? void 0,
|
|
33637
|
-
borderLeft: style2.borderLeft ?? void 0,
|
|
33638
|
-
tabs: style2.tabs ?? void 0,
|
|
33639
|
-
textDirection: style2.textDirection ?? void 0,
|
|
33640
|
-
outlineLevel: style2.outlineLevel ?? void 0
|
|
33641
|
-
});
|
|
33642
|
-
return normalized;
|
|
33643
|
-
}
|
|
33644
|
-
function withDocxImplicitSingleLineHeight(style2) {
|
|
33645
|
-
if ((style2 == null ? void 0 : style2.lineHeight) !== void 0) {
|
|
33646
|
-
return style2;
|
|
33647
|
-
}
|
|
33648
|
-
return {
|
|
33649
|
-
...style2 ?? {},
|
|
33650
|
-
lineHeight: DOCX_IMPLICIT_SINGLE_LINE_HEIGHT
|
|
33651
|
-
};
|
|
33652
|
-
}
|
|
33653
|
-
function parseAutospacingFlags(paragraphProperties) {
|
|
33654
|
-
const spacing = getFirstChildByTagNameNS(
|
|
33655
|
-
paragraphProperties,
|
|
33656
|
-
WORD_NS,
|
|
33657
|
-
"spacing"
|
|
33658
|
-
);
|
|
33659
|
-
return {
|
|
33660
|
-
before: isWordTrue(getAttributeValue(spacing, "beforeAutospacing")),
|
|
33661
|
-
after: isWordTrue(getAttributeValue(spacing, "afterAutospacing"))
|
|
33662
|
-
};
|
|
33663
|
-
}
|
|
33664
|
-
function parseParagraphTabs(paragraphProperties) {
|
|
33665
|
-
const tabsElement = getFirstChildByTagNameNS(
|
|
33666
|
-
paragraphProperties,
|
|
33667
|
-
WORD_NS,
|
|
33668
|
-
"tabs"
|
|
33669
|
-
);
|
|
33670
|
-
if (!tabsElement) {
|
|
33671
|
-
return [];
|
|
33672
|
-
}
|
|
33673
|
-
const tabs = [];
|
|
33674
|
-
for (const tabElement of getChildrenByTagNameNS(
|
|
33675
|
-
tabsElement,
|
|
33676
|
-
WORD_NS,
|
|
33677
|
-
"tab"
|
|
33678
|
-
)) {
|
|
33679
|
-
const position2 = twipsToPoints(getAttributeValue(tabElement, "pos"));
|
|
33680
|
-
if (position2 === void 0) {
|
|
33681
|
-
continue;
|
|
33682
|
-
}
|
|
33683
|
-
const typeValue = getAttributeValue(tabElement, "val");
|
|
33684
|
-
const type = typeValue === "center" || typeValue === "right" || typeValue === "decimal" || typeValue === "bar" || typeValue === "clear" ? typeValue : "left";
|
|
33685
|
-
const leaderValue = getAttributeValue(tabElement, "leader");
|
|
33686
|
-
const leader = leaderValue === "dot" || leaderValue === "hyphen" || leaderValue === "underscore" || leaderValue === "heavy" || leaderValue === "middleDot" ? leaderValue : leaderValue === "none" ? "none" : void 0;
|
|
33687
|
-
tabs.push({
|
|
33688
|
-
position: position2,
|
|
33689
|
-
type,
|
|
33690
|
-
...leader !== void 0 ? { leader } : {}
|
|
33691
|
-
});
|
|
33692
|
-
}
|
|
33693
|
-
return tabs;
|
|
33694
|
-
}
|
|
33695
|
-
function parseParagraphStyle$1(paragraphProperties, colors) {
|
|
33696
|
-
if (!paragraphProperties) {
|
|
33697
|
-
return void 0;
|
|
33698
|
-
}
|
|
33699
|
-
const style2 = {};
|
|
33700
|
-
const styleId = parseStyleIdProperty(paragraphProperties, "pStyle");
|
|
33701
|
-
if (styleId) {
|
|
33702
|
-
style2.styleId = styleId;
|
|
33703
|
-
}
|
|
33704
|
-
const justification = getFirstChildByTagNameNS(
|
|
33705
|
-
paragraphProperties,
|
|
33706
|
-
WORD_NS,
|
|
33707
|
-
"jc"
|
|
33708
|
-
);
|
|
33709
|
-
const justificationValue = getAttributeValue(justification, "val");
|
|
33710
|
-
if (justificationValue === "left" || justificationValue === "start" || justificationValue === "center" || justificationValue === "right" || justificationValue === "end" || justificationValue === "justify") {
|
|
33711
|
-
style2.align = justificationValue === "start" ? "left" : justificationValue === "end" ? "right" : justificationValue;
|
|
33712
|
-
} else if (justificationValue === "both" || justificationValue === "distribute") {
|
|
33713
|
-
style2.align = "justify";
|
|
33714
|
-
}
|
|
33715
|
-
const spacing = getFirstChildByTagNameNS(
|
|
33716
|
-
paragraphProperties,
|
|
33717
|
-
WORD_NS,
|
|
33718
|
-
"spacing"
|
|
33719
|
-
);
|
|
33720
|
-
const before = getAttributeValue(spacing, "before");
|
|
33721
|
-
const after = getAttributeValue(spacing, "after");
|
|
33722
|
-
const line = getAttributeValue(spacing, "line");
|
|
33723
|
-
const lineRule = getAttributeValue(spacing, "lineRule");
|
|
33724
|
-
if (before) {
|
|
33725
|
-
style2.spacingBefore = twipsToPx(before, 0);
|
|
33726
|
-
}
|
|
33727
|
-
if (after) {
|
|
33728
|
-
style2.spacingAfter = twipsToPx(after, 0);
|
|
33729
|
-
}
|
|
33730
|
-
if (line) {
|
|
33731
|
-
if (lineRule === "exact" || lineRule === "atLeast") {
|
|
33732
|
-
style2.lineHeight = roundTo(Number(line) / 1440 * 96, 4);
|
|
33733
|
-
style2.lineRule = lineRule;
|
|
33734
|
-
} else {
|
|
33735
|
-
style2.lineHeight = Number(line) / 240;
|
|
33736
|
-
}
|
|
33737
|
-
}
|
|
33738
|
-
const contextualSpacing = parseOnOffProperty(
|
|
33739
|
-
paragraphProperties,
|
|
33740
|
-
"contextualSpacing"
|
|
33741
|
-
);
|
|
33742
|
-
if (contextualSpacing !== void 0) {
|
|
33743
|
-
style2.contextualSpacing = contextualSpacing;
|
|
33744
|
-
}
|
|
33745
|
-
const snapToGrid = parseOnOffProperty(paragraphProperties, "snapToGrid");
|
|
33746
|
-
if (snapToGrid !== void 0) {
|
|
33747
|
-
style2.snapToGrid = snapToGrid;
|
|
33748
|
-
}
|
|
33749
|
-
const indent = getFirstChildByTagNameNS(paragraphProperties, WORD_NS, "ind");
|
|
33750
|
-
const left = getAttributeValue(indent, "start") ?? getAttributeValue(indent, "left");
|
|
33751
|
-
const right = getAttributeValue(indent, "end") ?? getAttributeValue(indent, "right");
|
|
33752
|
-
const firstLine = getAttributeValue(indent, "firstLine");
|
|
33753
|
-
const hanging = getAttributeValue(indent, "hanging");
|
|
33754
|
-
if (left) {
|
|
33755
|
-
style2.indentLeft = twipsToPx(left, 0);
|
|
33756
|
-
}
|
|
33757
|
-
if (right) {
|
|
33758
|
-
style2.indentRight = twipsToPx(right, 0);
|
|
33759
|
-
}
|
|
33760
|
-
if (hanging) {
|
|
33761
|
-
style2.indentHanging = twipsToPx(hanging, 0);
|
|
33762
|
-
style2.indentFirstLine = void 0;
|
|
33763
|
-
} else if (firstLine) {
|
|
33764
|
-
style2.indentFirstLine = twipsToPx(firstLine, 0);
|
|
33765
|
-
}
|
|
33766
|
-
const tabs = parseParagraphTabs(paragraphProperties);
|
|
33767
|
-
if (tabs.length > 0) {
|
|
33768
|
-
style2.tabs = tabs;
|
|
33769
|
-
}
|
|
33770
|
-
const pageBreakBefore = parseOnOffProperty(
|
|
33771
|
-
paragraphProperties,
|
|
33772
|
-
"pageBreakBefore"
|
|
33773
|
-
);
|
|
33774
|
-
if (pageBreakBefore !== void 0) {
|
|
33775
|
-
style2.pageBreakBefore = pageBreakBefore;
|
|
33776
|
-
}
|
|
33777
|
-
const keepNext = parseOnOffProperty(paragraphProperties, "keepNext");
|
|
33778
|
-
if (keepNext !== void 0) {
|
|
33779
|
-
style2.keepWithNext = keepNext;
|
|
33780
|
-
}
|
|
33781
|
-
const keepLines = parseOnOffProperty(paragraphProperties, "keepLines");
|
|
33782
|
-
if (keepLines !== void 0) {
|
|
33783
|
-
style2.keepLinesTogether = keepLines;
|
|
33784
|
-
}
|
|
33785
|
-
const widowControl = parseOnOffProperty(paragraphProperties, "widowControl");
|
|
33786
|
-
if (widowControl !== void 0) {
|
|
33787
|
-
style2.widowControl = widowControl;
|
|
33788
|
-
}
|
|
33789
|
-
const mirrorIndents = parseOnOffProperty(
|
|
33790
|
-
paragraphProperties,
|
|
33791
|
-
"mirrorIndents"
|
|
33792
|
-
);
|
|
33793
|
-
if (mirrorIndents !== void 0) {
|
|
33794
|
-
style2.mirrorIndents = mirrorIndents;
|
|
33795
|
-
}
|
|
33796
|
-
const paragraphBorders = getFirstChildByTagNameNS(
|
|
33797
|
-
paragraphProperties,
|
|
33798
|
-
WORD_NS,
|
|
33799
|
-
"pBdr"
|
|
33800
|
-
);
|
|
33801
|
-
if (paragraphBorders) {
|
|
33802
|
-
const { borderTop, borderRight, borderBottom, borderLeft } = parseDocxBoxBorders(paragraphBorders);
|
|
33803
|
-
if (borderTop) style2.borderTop = borderTop;
|
|
33804
|
-
if (borderRight) style2.borderRight = borderRight;
|
|
33805
|
-
if (borderBottom) style2.borderBottom = borderBottom;
|
|
33806
|
-
if (borderLeft) style2.borderLeft = borderLeft;
|
|
33807
|
-
}
|
|
33808
|
-
const shading = getFirstChildByTagNameNS(paragraphProperties, WORD_NS, "shd");
|
|
33809
|
-
const shadingFill = parseShdFill(shading, colors);
|
|
33810
|
-
if (shadingFill) {
|
|
33811
|
-
style2.shading = shadingFill;
|
|
33812
|
-
}
|
|
33813
|
-
const textDirection = parseTextDirection(
|
|
33814
|
-
getAttributeValue(
|
|
33815
|
-
getFirstChildByTagNameNS(paragraphProperties, WORD_NS, "textDirection"),
|
|
33816
|
-
"val"
|
|
33817
|
-
)
|
|
33818
|
-
);
|
|
33819
|
-
if (textDirection) {
|
|
33820
|
-
style2.textDirection = textDirection;
|
|
33821
|
-
}
|
|
33822
|
-
const outlineLvlEl = getFirstChildByTagNameNS(
|
|
33823
|
-
paragraphProperties,
|
|
33824
|
-
WORD_NS,
|
|
33825
|
-
"outlineLvl"
|
|
33826
|
-
);
|
|
33827
|
-
const outlineLvlVal = getAttributeValue(outlineLvlEl, "val");
|
|
33828
|
-
if (outlineLvlVal !== void 0) {
|
|
33829
|
-
const level = Number(outlineLvlVal);
|
|
33830
|
-
if (Number.isFinite(level) && level >= 0 && level <= 8) {
|
|
33831
|
-
style2.outlineLevel = level;
|
|
33832
|
-
}
|
|
33833
|
-
}
|
|
33834
|
-
return emptyOrUndefined(style2);
|
|
33835
|
-
}
|
|
33836
33696
|
const TABLE_CONDITIONAL_FLAG_ATTRIBUTES = [
|
|
33837
33697
|
["firstRow", "firstRow"],
|
|
33838
33698
|
["lastRow", "lastRow"],
|
|
@@ -34370,6 +34230,355 @@ function collapseCellAutospacing(paragraphs, flags) {
|
|
|
34370
34230
|
}
|
|
34371
34231
|
}
|
|
34372
34232
|
}
|
|
34233
|
+
function normalizeImportedParagraphStyle(style2) {
|
|
34234
|
+
if (!style2) {
|
|
34235
|
+
return void 0;
|
|
34236
|
+
}
|
|
34237
|
+
const effective = resolveEffectiveParagraphStyle(
|
|
34238
|
+
style2,
|
|
34239
|
+
DEFAULT_EDITOR_STYLES
|
|
34240
|
+
);
|
|
34241
|
+
const defaultEffective = resolveEffectiveParagraphStyle(
|
|
34242
|
+
void 0,
|
|
34243
|
+
DEFAULT_EDITOR_STYLES
|
|
34244
|
+
);
|
|
34245
|
+
const normalized = stripUndefined({
|
|
34246
|
+
styleId: style2.styleId,
|
|
34247
|
+
align: effective.align !== defaultEffective.align ? effective.align : void 0,
|
|
34248
|
+
spacingBefore: effective.spacingBefore !== defaultEffective.spacingBefore ? effective.spacingBefore : void 0,
|
|
34249
|
+
spacingAfter: effective.spacingAfter !== defaultEffective.spacingAfter ? effective.spacingAfter : void 0,
|
|
34250
|
+
contextualSpacing: style2.contextualSpacing !== void 0 || effective.contextualSpacing !== defaultEffective.contextualSpacing ? effective.contextualSpacing : void 0,
|
|
34251
|
+
lineHeight: effective.lineHeight !== defaultEffective.lineHeight ? effective.lineHeight : void 0,
|
|
34252
|
+
lineRule: effective.lineRule ?? void 0,
|
|
34253
|
+
lineGridPitch: style2.lineGridPitch ?? void 0,
|
|
34254
|
+
snapToGrid: style2.snapToGrid !== void 0 || effective.snapToGrid !== defaultEffective.snapToGrid ? effective.snapToGrid : void 0,
|
|
34255
|
+
indentLeft: style2.indentLeft !== void 0 || effective.indentLeft !== defaultEffective.indentLeft ? effective.indentLeft : void 0,
|
|
34256
|
+
indentRight: style2.indentRight !== void 0 || effective.indentRight !== defaultEffective.indentRight ? effective.indentRight : void 0,
|
|
34257
|
+
indentFirstLine: style2.indentFirstLine !== void 0 || effective.indentFirstLine !== defaultEffective.indentFirstLine ? effective.indentFirstLine : void 0,
|
|
34258
|
+
indentHanging: style2.indentHanging !== void 0 || effective.indentHanging !== defaultEffective.indentHanging ? effective.indentHanging : void 0,
|
|
34259
|
+
mirrorIndents: style2.mirrorIndents !== void 0 || effective.mirrorIndents !== defaultEffective.mirrorIndents ? effective.mirrorIndents : void 0,
|
|
34260
|
+
pageBreakBefore: style2.pageBreakBefore !== void 0 || effective.pageBreakBefore !== defaultEffective.pageBreakBefore ? effective.pageBreakBefore : void 0,
|
|
34261
|
+
keepWithNext: style2.keepWithNext !== void 0 || effective.keepWithNext !== defaultEffective.keepWithNext ? effective.keepWithNext : void 0,
|
|
34262
|
+
keepLinesTogether: style2.keepLinesTogether !== void 0 || effective.keepLinesTogether !== defaultEffective.keepLinesTogether ? effective.keepLinesTogether : void 0,
|
|
34263
|
+
widowControl: style2.widowControl !== void 0 || effective.widowControl !== defaultEffective.widowControl ? effective.widowControl : void 0,
|
|
34264
|
+
shading: style2.shading ?? void 0,
|
|
34265
|
+
borderTop: style2.borderTop ?? void 0,
|
|
34266
|
+
borderRight: style2.borderRight ?? void 0,
|
|
34267
|
+
borderBottom: style2.borderBottom ?? void 0,
|
|
34268
|
+
borderLeft: style2.borderLeft ?? void 0,
|
|
34269
|
+
tabs: style2.tabs ?? void 0,
|
|
34270
|
+
textDirection: style2.textDirection ?? void 0,
|
|
34271
|
+
outlineLevel: style2.outlineLevel ?? void 0,
|
|
34272
|
+
suppressLineNumbers: style2.suppressLineNumbers !== void 0 || effective.suppressLineNumbers !== defaultEffective.suppressLineNumbers ? effective.suppressLineNumbers : void 0,
|
|
34273
|
+
bidi: style2.bidi !== void 0 || effective.bidi !== defaultEffective.bidi ? effective.bidi : void 0,
|
|
34274
|
+
kinsoku: style2.kinsoku !== void 0 || effective.kinsoku !== defaultEffective.kinsoku ? effective.kinsoku : void 0,
|
|
34275
|
+
wordWrap: style2.wordWrap !== void 0 || effective.wordWrap !== defaultEffective.wordWrap ? effective.wordWrap : void 0,
|
|
34276
|
+
overflowPunct: style2.overflowPunct !== void 0 || effective.overflowPunct !== defaultEffective.overflowPunct ? effective.overflowPunct : void 0,
|
|
34277
|
+
topLinePunct: style2.topLinePunct !== void 0 || effective.topLinePunct !== defaultEffective.topLinePunct ? effective.topLinePunct : void 0,
|
|
34278
|
+
autoSpaceDE: style2.autoSpaceDE !== void 0 || effective.autoSpaceDE !== defaultEffective.autoSpaceDE ? effective.autoSpaceDE : void 0,
|
|
34279
|
+
autoSpaceDN: style2.autoSpaceDN !== void 0 || effective.autoSpaceDN !== defaultEffective.autoSpaceDN ? effective.autoSpaceDN : void 0,
|
|
34280
|
+
adjustRightInd: style2.adjustRightInd !== void 0 || effective.adjustRightInd !== defaultEffective.adjustRightInd ? effective.adjustRightInd : void 0,
|
|
34281
|
+
textAlignment: style2.textAlignment ?? void 0,
|
|
34282
|
+
textboxTightWrap: style2.textboxTightWrap ?? void 0,
|
|
34283
|
+
divId: style2.divId ?? void 0,
|
|
34284
|
+
conditionalStyle: style2.conditionalStyle ?? void 0,
|
|
34285
|
+
borderBetween: style2.borderBetween ?? void 0,
|
|
34286
|
+
borderBar: style2.borderBar ?? void 0,
|
|
34287
|
+
framePrXml: style2.framePrXml ?? void 0
|
|
34288
|
+
});
|
|
34289
|
+
return normalized;
|
|
34290
|
+
}
|
|
34291
|
+
function withDocxImplicitSingleLineHeight(style2) {
|
|
34292
|
+
if ((style2 == null ? void 0 : style2.lineHeight) !== void 0) {
|
|
34293
|
+
return style2;
|
|
34294
|
+
}
|
|
34295
|
+
return {
|
|
34296
|
+
...style2 ?? {},
|
|
34297
|
+
lineHeight: DOCX_IMPLICIT_SINGLE_LINE_HEIGHT
|
|
34298
|
+
};
|
|
34299
|
+
}
|
|
34300
|
+
function parseAutospacingFlags(paragraphProperties) {
|
|
34301
|
+
const spacing = getFirstChildByTagNameNS(
|
|
34302
|
+
paragraphProperties,
|
|
34303
|
+
WORD_NS,
|
|
34304
|
+
"spacing"
|
|
34305
|
+
);
|
|
34306
|
+
return {
|
|
34307
|
+
before: isWordTrue(getAttributeValue(spacing, "beforeAutospacing")),
|
|
34308
|
+
after: isWordTrue(getAttributeValue(spacing, "afterAutospacing"))
|
|
34309
|
+
};
|
|
34310
|
+
}
|
|
34311
|
+
function parseParagraphTabs(paragraphProperties) {
|
|
34312
|
+
const tabsElement = getFirstChildByTagNameNS(
|
|
34313
|
+
paragraphProperties,
|
|
34314
|
+
WORD_NS,
|
|
34315
|
+
"tabs"
|
|
34316
|
+
);
|
|
34317
|
+
if (!tabsElement) {
|
|
34318
|
+
return [];
|
|
34319
|
+
}
|
|
34320
|
+
const tabs = [];
|
|
34321
|
+
for (const tabElement of getChildrenByTagNameNS(
|
|
34322
|
+
tabsElement,
|
|
34323
|
+
WORD_NS,
|
|
34324
|
+
"tab"
|
|
34325
|
+
)) {
|
|
34326
|
+
const position2 = twipsToPoints(getAttributeValue(tabElement, "pos"));
|
|
34327
|
+
if (position2 === void 0) {
|
|
34328
|
+
continue;
|
|
34329
|
+
}
|
|
34330
|
+
const typeValue = getAttributeValue(tabElement, "val");
|
|
34331
|
+
const type = typeValue === "center" || typeValue === "right" || typeValue === "decimal" || typeValue === "bar" || typeValue === "clear" ? typeValue : "left";
|
|
34332
|
+
const leaderValue = getAttributeValue(tabElement, "leader");
|
|
34333
|
+
const leader = leaderValue === "dot" || leaderValue === "hyphen" || leaderValue === "underscore" || leaderValue === "heavy" || leaderValue === "middleDot" ? leaderValue : leaderValue === "none" ? "none" : void 0;
|
|
34334
|
+
tabs.push({
|
|
34335
|
+
position: position2,
|
|
34336
|
+
type,
|
|
34337
|
+
...leader !== void 0 ? { leader } : {}
|
|
34338
|
+
});
|
|
34339
|
+
}
|
|
34340
|
+
return tabs;
|
|
34341
|
+
}
|
|
34342
|
+
function parseParagraphStyle$1(paragraphProperties, colors) {
|
|
34343
|
+
if (!paragraphProperties) {
|
|
34344
|
+
return void 0;
|
|
34345
|
+
}
|
|
34346
|
+
const style2 = {};
|
|
34347
|
+
const styleId = parseStyleIdProperty(paragraphProperties, "pStyle");
|
|
34348
|
+
if (styleId) {
|
|
34349
|
+
style2.styleId = styleId;
|
|
34350
|
+
}
|
|
34351
|
+
const justification = getFirstChildByTagNameNS(
|
|
34352
|
+
paragraphProperties,
|
|
34353
|
+
WORD_NS,
|
|
34354
|
+
"jc"
|
|
34355
|
+
);
|
|
34356
|
+
const justificationValue = getAttributeValue(justification, "val");
|
|
34357
|
+
if (justificationValue === "left" || justificationValue === "start" || justificationValue === "center" || justificationValue === "right" || justificationValue === "end" || justificationValue === "justify") {
|
|
34358
|
+
style2.align = justificationValue === "start" ? "left" : justificationValue === "end" ? "right" : justificationValue;
|
|
34359
|
+
} else if (justificationValue === "both" || justificationValue === "distribute") {
|
|
34360
|
+
style2.align = "justify";
|
|
34361
|
+
}
|
|
34362
|
+
const spacing = getFirstChildByTagNameNS(
|
|
34363
|
+
paragraphProperties,
|
|
34364
|
+
WORD_NS,
|
|
34365
|
+
"spacing"
|
|
34366
|
+
);
|
|
34367
|
+
const before = getAttributeValue(spacing, "before");
|
|
34368
|
+
const after = getAttributeValue(spacing, "after");
|
|
34369
|
+
const line = getAttributeValue(spacing, "line");
|
|
34370
|
+
const lineRule = getAttributeValue(spacing, "lineRule");
|
|
34371
|
+
if (before) {
|
|
34372
|
+
style2.spacingBefore = twipsToPx(before, 0);
|
|
34373
|
+
}
|
|
34374
|
+
if (after) {
|
|
34375
|
+
style2.spacingAfter = twipsToPx(after, 0);
|
|
34376
|
+
}
|
|
34377
|
+
if (line) {
|
|
34378
|
+
if (lineRule === "exact" || lineRule === "atLeast") {
|
|
34379
|
+
style2.lineHeight = roundTo(Number(line) / 1440 * 96, 4);
|
|
34380
|
+
style2.lineRule = lineRule;
|
|
34381
|
+
} else {
|
|
34382
|
+
style2.lineHeight = Number(line) / 240;
|
|
34383
|
+
}
|
|
34384
|
+
}
|
|
34385
|
+
const contextualSpacing = parseOnOffProperty(
|
|
34386
|
+
paragraphProperties,
|
|
34387
|
+
"contextualSpacing"
|
|
34388
|
+
);
|
|
34389
|
+
if (contextualSpacing !== void 0) {
|
|
34390
|
+
style2.contextualSpacing = contextualSpacing;
|
|
34391
|
+
}
|
|
34392
|
+
const snapToGrid = parseOnOffProperty(paragraphProperties, "snapToGrid");
|
|
34393
|
+
if (snapToGrid !== void 0) {
|
|
34394
|
+
style2.snapToGrid = snapToGrid;
|
|
34395
|
+
}
|
|
34396
|
+
const indent = getFirstChildByTagNameNS(paragraphProperties, WORD_NS, "ind");
|
|
34397
|
+
const left = getAttributeValue(indent, "start") ?? getAttributeValue(indent, "left");
|
|
34398
|
+
const right = getAttributeValue(indent, "end") ?? getAttributeValue(indent, "right");
|
|
34399
|
+
const firstLine = getAttributeValue(indent, "firstLine");
|
|
34400
|
+
const hanging = getAttributeValue(indent, "hanging");
|
|
34401
|
+
if (left) {
|
|
34402
|
+
style2.indentLeft = twipsToPx(left, 0);
|
|
34403
|
+
}
|
|
34404
|
+
if (right) {
|
|
34405
|
+
style2.indentRight = twipsToPx(right, 0);
|
|
34406
|
+
}
|
|
34407
|
+
if (hanging) {
|
|
34408
|
+
style2.indentHanging = twipsToPx(hanging, 0);
|
|
34409
|
+
style2.indentFirstLine = void 0;
|
|
34410
|
+
} else if (firstLine) {
|
|
34411
|
+
style2.indentFirstLine = twipsToPx(firstLine, 0);
|
|
34412
|
+
}
|
|
34413
|
+
const tabs = parseParagraphTabs(paragraphProperties);
|
|
34414
|
+
if (tabs.length > 0) {
|
|
34415
|
+
style2.tabs = tabs;
|
|
34416
|
+
}
|
|
34417
|
+
const pageBreakBefore = parseOnOffProperty(
|
|
34418
|
+
paragraphProperties,
|
|
34419
|
+
"pageBreakBefore"
|
|
34420
|
+
);
|
|
34421
|
+
if (pageBreakBefore !== void 0) {
|
|
34422
|
+
style2.pageBreakBefore = pageBreakBefore;
|
|
34423
|
+
}
|
|
34424
|
+
const keepNext = parseOnOffProperty(paragraphProperties, "keepNext");
|
|
34425
|
+
if (keepNext !== void 0) {
|
|
34426
|
+
style2.keepWithNext = keepNext;
|
|
34427
|
+
}
|
|
34428
|
+
const keepLines = parseOnOffProperty(paragraphProperties, "keepLines");
|
|
34429
|
+
if (keepLines !== void 0) {
|
|
34430
|
+
style2.keepLinesTogether = keepLines;
|
|
34431
|
+
}
|
|
34432
|
+
const widowControl = parseOnOffProperty(paragraphProperties, "widowControl");
|
|
34433
|
+
if (widowControl !== void 0) {
|
|
34434
|
+
style2.widowControl = widowControl;
|
|
34435
|
+
}
|
|
34436
|
+
const mirrorIndents = parseOnOffProperty(
|
|
34437
|
+
paragraphProperties,
|
|
34438
|
+
"mirrorIndents"
|
|
34439
|
+
);
|
|
34440
|
+
if (mirrorIndents !== void 0) {
|
|
34441
|
+
style2.mirrorIndents = mirrorIndents;
|
|
34442
|
+
}
|
|
34443
|
+
const paragraphBorders = getFirstChildByTagNameNS(
|
|
34444
|
+
paragraphProperties,
|
|
34445
|
+
WORD_NS,
|
|
34446
|
+
"pBdr"
|
|
34447
|
+
);
|
|
34448
|
+
if (paragraphBorders) {
|
|
34449
|
+
const {
|
|
34450
|
+
borderTop,
|
|
34451
|
+
borderRight,
|
|
34452
|
+
borderBottom,
|
|
34453
|
+
borderLeft,
|
|
34454
|
+
borderBetween,
|
|
34455
|
+
borderBar
|
|
34456
|
+
} = parseDocxBoxBorders(paragraphBorders);
|
|
34457
|
+
if (borderTop) style2.borderTop = borderTop;
|
|
34458
|
+
if (borderRight) style2.borderRight = borderRight;
|
|
34459
|
+
if (borderBottom) style2.borderBottom = borderBottom;
|
|
34460
|
+
if (borderLeft) style2.borderLeft = borderLeft;
|
|
34461
|
+
if (borderBetween) style2.borderBetween = borderBetween;
|
|
34462
|
+
if (borderBar) style2.borderBar = borderBar;
|
|
34463
|
+
}
|
|
34464
|
+
const shading = getFirstChildByTagNameNS(paragraphProperties, WORD_NS, "shd");
|
|
34465
|
+
const shadingFill = parseShdFill(shading, colors);
|
|
34466
|
+
if (shadingFill) {
|
|
34467
|
+
style2.shading = shadingFill;
|
|
34468
|
+
}
|
|
34469
|
+
const textDirection = parseTextDirection(
|
|
34470
|
+
getAttributeValue(
|
|
34471
|
+
getFirstChildByTagNameNS(paragraphProperties, WORD_NS, "textDirection"),
|
|
34472
|
+
"val"
|
|
34473
|
+
)
|
|
34474
|
+
);
|
|
34475
|
+
if (textDirection) {
|
|
34476
|
+
style2.textDirection = textDirection;
|
|
34477
|
+
}
|
|
34478
|
+
const outlineLvlEl = getFirstChildByTagNameNS(
|
|
34479
|
+
paragraphProperties,
|
|
34480
|
+
WORD_NS,
|
|
34481
|
+
"outlineLvl"
|
|
34482
|
+
);
|
|
34483
|
+
const outlineLvlVal = getAttributeValue(outlineLvlEl, "val");
|
|
34484
|
+
if (outlineLvlVal !== void 0) {
|
|
34485
|
+
const level = Number(outlineLvlVal);
|
|
34486
|
+
if (Number.isFinite(level) && level >= 0 && level <= 8) {
|
|
34487
|
+
style2.outlineLevel = level;
|
|
34488
|
+
}
|
|
34489
|
+
}
|
|
34490
|
+
const suppressLineNumbers = parseOnOffProperty(
|
|
34491
|
+
paragraphProperties,
|
|
34492
|
+
"suppressLineNumbers"
|
|
34493
|
+
);
|
|
34494
|
+
if (suppressLineNumbers !== void 0) {
|
|
34495
|
+
style2.suppressLineNumbers = suppressLineNumbers;
|
|
34496
|
+
}
|
|
34497
|
+
const bidi = parseOnOffProperty(paragraphProperties, "bidi");
|
|
34498
|
+
if (bidi !== void 0) {
|
|
34499
|
+
style2.bidi = bidi;
|
|
34500
|
+
}
|
|
34501
|
+
const kinsoku = parseOnOffProperty(paragraphProperties, "kinsoku");
|
|
34502
|
+
if (kinsoku !== void 0) {
|
|
34503
|
+
style2.kinsoku = kinsoku;
|
|
34504
|
+
}
|
|
34505
|
+
const wordWrap = parseOnOffProperty(paragraphProperties, "wordWrap");
|
|
34506
|
+
if (wordWrap !== void 0) {
|
|
34507
|
+
style2.wordWrap = wordWrap;
|
|
34508
|
+
}
|
|
34509
|
+
const overflowPunct = parseOnOffProperty(
|
|
34510
|
+
paragraphProperties,
|
|
34511
|
+
"overflowPunct"
|
|
34512
|
+
);
|
|
34513
|
+
if (overflowPunct !== void 0) {
|
|
34514
|
+
style2.overflowPunct = overflowPunct;
|
|
34515
|
+
}
|
|
34516
|
+
const topLinePunct = parseOnOffProperty(paragraphProperties, "topLinePunct");
|
|
34517
|
+
if (topLinePunct !== void 0) {
|
|
34518
|
+
style2.topLinePunct = topLinePunct;
|
|
34519
|
+
}
|
|
34520
|
+
const autoSpaceDE = parseOnOffProperty(paragraphProperties, "autoSpaceDE");
|
|
34521
|
+
if (autoSpaceDE !== void 0) {
|
|
34522
|
+
style2.autoSpaceDE = autoSpaceDE;
|
|
34523
|
+
}
|
|
34524
|
+
const autoSpaceDN = parseOnOffProperty(paragraphProperties, "autoSpaceDN");
|
|
34525
|
+
if (autoSpaceDN !== void 0) {
|
|
34526
|
+
style2.autoSpaceDN = autoSpaceDN;
|
|
34527
|
+
}
|
|
34528
|
+
const adjustRightInd = parseOnOffProperty(
|
|
34529
|
+
paragraphProperties,
|
|
34530
|
+
"adjustRightInd"
|
|
34531
|
+
);
|
|
34532
|
+
if (adjustRightInd !== void 0) {
|
|
34533
|
+
style2.adjustRightInd = adjustRightInd;
|
|
34534
|
+
}
|
|
34535
|
+
const textAlignmentEl = getFirstChildByTagNameNS(
|
|
34536
|
+
paragraphProperties,
|
|
34537
|
+
WORD_NS,
|
|
34538
|
+
"textAlignment"
|
|
34539
|
+
);
|
|
34540
|
+
const textAlignmentVal = getAttributeValue(textAlignmentEl, "val");
|
|
34541
|
+
if (textAlignmentVal === "auto" || textAlignmentVal === "top" || textAlignmentVal === "center" || textAlignmentVal === "baseline" || textAlignmentVal === "bottom") {
|
|
34542
|
+
style2.textAlignment = textAlignmentVal;
|
|
34543
|
+
}
|
|
34544
|
+
const textboxTightWrapEl = getFirstChildByTagNameNS(
|
|
34545
|
+
paragraphProperties,
|
|
34546
|
+
WORD_NS,
|
|
34547
|
+
"textboxTightWrap"
|
|
34548
|
+
);
|
|
34549
|
+
const textboxTightWrapVal = getAttributeValue(textboxTightWrapEl, "val");
|
|
34550
|
+
if (textboxTightWrapVal === "none" || textboxTightWrapVal === "allLines" || textboxTightWrapVal === "firstLineOnly" || textboxTightWrapVal === "firstLastLine") {
|
|
34551
|
+
style2.textboxTightWrap = textboxTightWrapVal;
|
|
34552
|
+
}
|
|
34553
|
+
const divIdEl = getFirstChildByTagNameNS(
|
|
34554
|
+
paragraphProperties,
|
|
34555
|
+
WORD_NS,
|
|
34556
|
+
"divId"
|
|
34557
|
+
);
|
|
34558
|
+
const divIdVal = getAttributeValue(divIdEl, "val");
|
|
34559
|
+
if (divIdVal !== null) {
|
|
34560
|
+
const divId = Number(divIdVal);
|
|
34561
|
+
if (Number.isFinite(divId) && divId >= 0) {
|
|
34562
|
+
style2.divId = Math.floor(divId);
|
|
34563
|
+
}
|
|
34564
|
+
}
|
|
34565
|
+
const conditionalStyle = parseTableConditionalFlags(paragraphProperties);
|
|
34566
|
+
if (conditionalStyle) {
|
|
34567
|
+
style2.conditionalStyle = conditionalStyle;
|
|
34568
|
+
}
|
|
34569
|
+
const framePrEl = getFirstChildByTagNameNS(
|
|
34570
|
+
paragraphProperties,
|
|
34571
|
+
WORD_NS,
|
|
34572
|
+
"framePr"
|
|
34573
|
+
);
|
|
34574
|
+
if (framePrEl) {
|
|
34575
|
+
const frameDropCap = getAttributeValue(framePrEl, "dropCap");
|
|
34576
|
+
if (!frameDropCap || frameDropCap === "none") {
|
|
34577
|
+
style2.framePrXml = new XMLSerializer().serializeToString(framePrEl);
|
|
34578
|
+
}
|
|
34579
|
+
}
|
|
34580
|
+
return emptyOrUndefined(style2);
|
|
34581
|
+
}
|
|
34373
34582
|
function parseImportedStyles(stylesXml, theme) {
|
|
34374
34583
|
if (!stylesXml) {
|
|
34375
34584
|
return void 0;
|
|
@@ -37292,7 +37501,7 @@ function importDocxInWorker(buffer, options = {}) {
|
|
|
37292
37501
|
const worker = new Worker(
|
|
37293
37502
|
new URL(
|
|
37294
37503
|
/* @vite-ignore */
|
|
37295
|
-
"" + new URL("assets/importDocxWorker-
|
|
37504
|
+
"" + new URL("assets/importDocxWorker-C9tO3vbp.js", import.meta.url).href,
|
|
37296
37505
|
import.meta.url
|
|
37297
37506
|
),
|
|
37298
37507
|
{
|
|
@@ -43761,7 +43970,7 @@ export {
|
|
|
43761
43970
|
FormField as ay,
|
|
43762
43971
|
Checkbox as az,
|
|
43763
43972
|
getPageBodyTop as b,
|
|
43764
|
-
|
|
43973
|
+
getDocumentParagraphs as b$,
|
|
43765
43974
|
EMU_PER_PT as b0,
|
|
43766
43975
|
OOXML_ROTATION_UNITS as b1,
|
|
43767
43976
|
OOXML_PERCENT_DENOMINATOR as b2,
|
|
@@ -43772,33 +43981,33 @@ export {
|
|
|
43772
43981
|
iterateEndnoteReferenceRuns as b7,
|
|
43773
43982
|
imageContentTypeDefaults as b8,
|
|
43774
43983
|
getRunFieldChar as b9,
|
|
43775
|
-
|
|
43776
|
-
|
|
43777
|
-
|
|
43778
|
-
|
|
43779
|
-
|
|
43780
|
-
|
|
43781
|
-
|
|
43782
|
-
|
|
43783
|
-
|
|
43784
|
-
|
|
43785
|
-
|
|
43786
|
-
|
|
43787
|
-
|
|
43788
|
-
|
|
43789
|
-
|
|
43790
|
-
|
|
43791
|
-
|
|
43792
|
-
|
|
43793
|
-
|
|
43794
|
-
|
|
43795
|
-
|
|
43796
|
-
|
|
43797
|
-
|
|
43798
|
-
|
|
43799
|
-
|
|
43800
|
-
|
|
43801
|
-
|
|
43984
|
+
DOUBLE_STRIKE_OFFSET_PX as bA,
|
|
43985
|
+
resolveListLabel as bB,
|
|
43986
|
+
getListLabelInset as bC,
|
|
43987
|
+
getAlignedListLabelInset as bD,
|
|
43988
|
+
getParagraphBorderInsets as bE,
|
|
43989
|
+
buildSegmentTable as bF,
|
|
43990
|
+
buildCanvasTableLayout as bG,
|
|
43991
|
+
resolveCanvasTableWidth as bH,
|
|
43992
|
+
resolveFloatingTableRect as bI,
|
|
43993
|
+
paragraphBetweenBorderMatches as bJ,
|
|
43994
|
+
normalizeFamily as bK,
|
|
43995
|
+
ROBOTO_FONT_FILES as bL,
|
|
43996
|
+
loadFontAsset as bM,
|
|
43997
|
+
OFFICE_COMPAT_FONT_FAMILIES as bN,
|
|
43998
|
+
BinaryReader as bO,
|
|
43999
|
+
buildSfnt as bP,
|
|
44000
|
+
defaultFontDecoderRegistry as bQ,
|
|
44001
|
+
SfntFontProgram as bR,
|
|
44002
|
+
collectPdfFontFamilies as bS,
|
|
44003
|
+
outlineFrom as bT,
|
|
44004
|
+
getPageHeaderZoneTop as bU,
|
|
44005
|
+
getPageColumnRects as bV,
|
|
44006
|
+
findFootnoteReference as bW,
|
|
44007
|
+
resolveImporterForFile as bX,
|
|
44008
|
+
roundTo as bY,
|
|
44009
|
+
getDocumentSectionsCanonical as bZ,
|
|
44010
|
+
getDocumentParagraphsCanonical as b_,
|
|
43802
44011
|
getRunFieldInstruction as ba,
|
|
43803
44012
|
createEditorRun as bb,
|
|
43804
44013
|
JSZip as bc,
|
|
@@ -43821,101 +44030,103 @@ export {
|
|
|
43821
44030
|
rgb255ToHex as bt,
|
|
43822
44031
|
getImageFloatingGeometry as bu,
|
|
43823
44032
|
textStyleToFontSizePt as bv,
|
|
43824
|
-
|
|
43825
|
-
|
|
43826
|
-
|
|
43827
|
-
|
|
44033
|
+
resolveTextAlignmentBaselineOffset as bw,
|
|
44034
|
+
TEXT_BASELINE_RATIO as bx,
|
|
44035
|
+
resolveOpenTypeFeatureTags as by,
|
|
44036
|
+
resolveDecorationLineY as bz,
|
|
43828
44037
|
getPageContentWidth as c,
|
|
43829
|
-
|
|
43830
|
-
|
|
43831
|
-
|
|
43832
|
-
|
|
43833
|
-
|
|
43834
|
-
|
|
43835
|
-
|
|
43836
|
-
|
|
43837
|
-
|
|
43838
|
-
|
|
43839
|
-
|
|
43840
|
-
|
|
43841
|
-
|
|
43842
|
-
|
|
43843
|
-
|
|
43844
|
-
|
|
43845
|
-
|
|
43846
|
-
|
|
43847
|
-
|
|
43848
|
-
|
|
43849
|
-
|
|
43850
|
-
|
|
43851
|
-
|
|
43852
|
-
|
|
43853
|
-
|
|
43854
|
-
|
|
43855
|
-
|
|
43856
|
-
|
|
43857
|
-
|
|
43858
|
-
|
|
43859
|
-
|
|
43860
|
-
|
|
43861
|
-
|
|
43862
|
-
|
|
43863
|
-
|
|
43864
|
-
|
|
43865
|
-
|
|
43866
|
-
|
|
43867
|
-
|
|
43868
|
-
|
|
43869
|
-
|
|
43870
|
-
|
|
43871
|
-
|
|
43872
|
-
|
|
43873
|
-
|
|
43874
|
-
|
|
43875
|
-
|
|
43876
|
-
|
|
43877
|
-
|
|
43878
|
-
|
|
43879
|
-
|
|
43880
|
-
|
|
43881
|
-
|
|
43882
|
-
|
|
43883
|
-
|
|
43884
|
-
|
|
43885
|
-
|
|
43886
|
-
|
|
43887
|
-
|
|
43888
|
-
|
|
43889
|
-
|
|
43890
|
-
|
|
43891
|
-
|
|
43892
|
-
|
|
44038
|
+
FloatingActionButton as c$,
|
|
44039
|
+
getDocumentPageSettings as c0,
|
|
44040
|
+
getTableCellContentWidthForParagraph as c1,
|
|
44041
|
+
layoutMetricsEpoch as c2,
|
|
44042
|
+
bumpLayoutMetricsEpoch as c3,
|
|
44043
|
+
createCanvasLayoutSnapshotProvider as c4,
|
|
44044
|
+
on as c5,
|
|
44045
|
+
debounce as c6,
|
|
44046
|
+
unwrap as c7,
|
|
44047
|
+
perfTimer as c8,
|
|
44048
|
+
getRunTextBox as c9,
|
|
44049
|
+
fontSizePtToPx as cA,
|
|
44050
|
+
createDefaultToolbarPreset as cB,
|
|
44051
|
+
MenuRegistry as cC,
|
|
44052
|
+
createToolbarRegistry as cD,
|
|
44053
|
+
Editor as cE,
|
|
44054
|
+
resolveCommandRef as cF,
|
|
44055
|
+
commandRefName as cG,
|
|
44056
|
+
createOasisEditorClient as cH,
|
|
44057
|
+
createEditorZoom as cI,
|
|
44058
|
+
startLongTaskObserver as cJ,
|
|
44059
|
+
installGlobalReport as cK,
|
|
44060
|
+
applyStoredPreciseFontPreference as cL,
|
|
44061
|
+
getWelcomeSeen as cM,
|
|
44062
|
+
isLocalFontAccessSupported as cN,
|
|
44063
|
+
EDITOR_SCROLL_PADDING_PX as cO,
|
|
44064
|
+
Toolbar as cP,
|
|
44065
|
+
OasisEditorLoading as cQ,
|
|
44066
|
+
I18nProvider as cR,
|
|
44067
|
+
createTranslator as cS,
|
|
44068
|
+
registerDomStatsSurface as cT,
|
|
44069
|
+
createEditorLogger as cU,
|
|
44070
|
+
ActionRow as cV,
|
|
44071
|
+
ColorPicker as cW,
|
|
44072
|
+
CommandRegistry as cX,
|
|
44073
|
+
DEFAULT_PALETTE as cY,
|
|
44074
|
+
DialogFooter as cZ,
|
|
44075
|
+
FieldRow as c_,
|
|
44076
|
+
createEditorDocument as ca,
|
|
44077
|
+
resolveResizedDimensions as cb,
|
|
44078
|
+
resolveTextBoxRenderHeight as cc,
|
|
44079
|
+
getToolbarStyleState as cd,
|
|
44080
|
+
VERTICAL_HIT_WEIGHT as ce,
|
|
44081
|
+
getCachedCanvasImage as cf,
|
|
44082
|
+
measureParagraphMinContentWidthPx as cg,
|
|
44083
|
+
getEditableBlocksForZone as ch,
|
|
44084
|
+
findParagraphLocation as ci,
|
|
44085
|
+
createSectionBoundaryParagraph as cj,
|
|
44086
|
+
normalizePageSettings as ck,
|
|
44087
|
+
DEFAULT_EDITOR_PAGE_SETTINGS as cl,
|
|
44088
|
+
markStart as cm,
|
|
44089
|
+
markEnd as cn,
|
|
44090
|
+
getParagraphEntries as co,
|
|
44091
|
+
getParagraphById as cp,
|
|
44092
|
+
createEditorFootnote as cq,
|
|
44093
|
+
createFootnoteReferenceRun as cr,
|
|
44094
|
+
renumberFootnotes as cs,
|
|
44095
|
+
getHeadingLevel as ct,
|
|
44096
|
+
preciseFontModeVersion as cu,
|
|
44097
|
+
isPreciseFontModeEnabled as cv,
|
|
44098
|
+
resolveNamedTextStyle as cw,
|
|
44099
|
+
togglePreciseFontMode as cx,
|
|
44100
|
+
nextFontSizePt as cy,
|
|
44101
|
+
previousFontSizePt as cz,
|
|
43893
44102
|
domTextMeasurer as d,
|
|
43894
|
-
|
|
43895
|
-
|
|
43896
|
-
|
|
43897
|
-
|
|
43898
|
-
|
|
43899
|
-
|
|
43900
|
-
|
|
43901
|
-
|
|
43902
|
-
|
|
43903
|
-
|
|
43904
|
-
|
|
43905
|
-
|
|
43906
|
-
|
|
43907
|
-
|
|
43908
|
-
|
|
43909
|
-
|
|
43910
|
-
|
|
43911
|
-
|
|
43912
|
-
|
|
43913
|
-
|
|
43914
|
-
|
|
43915
|
-
|
|
43916
|
-
|
|
43917
|
-
|
|
43918
|
-
|
|
44103
|
+
GridPicker as d0,
|
|
44104
|
+
Heading as d1,
|
|
44105
|
+
IconButton as d2,
|
|
44106
|
+
Menu as d3,
|
|
44107
|
+
OASIS_BUILTIN_COMMANDS as d4,
|
|
44108
|
+
OASIS_MENU_ITEMS as d5,
|
|
44109
|
+
OASIS_TOOLBAR_ITEMS as d6,
|
|
44110
|
+
OasisEditorAppLazy as d7,
|
|
44111
|
+
OasisEditorContainer as d8,
|
|
44112
|
+
PluginCollection as d9,
|
|
44113
|
+
Popover as da,
|
|
44114
|
+
RIBBON_TABS as db,
|
|
44115
|
+
Select as dc,
|
|
44116
|
+
Separator as dd,
|
|
44117
|
+
SidePanel as de,
|
|
44118
|
+
SidePanelBody as df,
|
|
44119
|
+
SidePanelFooter as dg,
|
|
44120
|
+
SidePanelHeader as dh,
|
|
44121
|
+
SplitButton as di,
|
|
44122
|
+
StyleGallery as dj,
|
|
44123
|
+
Button$1 as dk,
|
|
44124
|
+
buildRibbonTabDefinitions as dl,
|
|
44125
|
+
createEditorCommandBus as dm,
|
|
44126
|
+
createOasisEditor as dn,
|
|
44127
|
+
createOasisEditorContainer as dp,
|
|
44128
|
+
mount as dq,
|
|
44129
|
+
registerToolbarRenderer as dr,
|
|
43919
44130
|
estimateTableBlockHeight as e,
|
|
43920
44131
|
getParagraphText as f,
|
|
43921
44132
|
getProjectedParagraphBlockHeight as g,
|