oasis-editor 0.0.113 → 0.0.115
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-BKPrQtm5.js → OasisEditorApp-C1dyjJoH.js} +903 -1161
- package/dist/assets/{importDocxWorker-Bz2kZOBO.js → importDocxWorker-D0F0jbcF.js} +1 -1
- package/dist/core/decorationGeometry.d.ts +10 -0
- package/dist/core/gradientAxis.d.ts +11 -0
- package/dist/core/textStyleMappings.d.ts +4 -0
- package/dist/export/pdf/draw/drawFragment.d.ts +4 -4
- package/dist/export/pdf/draw/fragment/pdfColor.d.ts +1 -0
- package/dist/export/pdf/draw/fragment/pdfEmphasisAndTabLeaders.d.ts +5 -0
- package/dist/export/pdf/draw/fragment/pdfGradient.d.ts +4 -0
- package/dist/export/pdf/draw/fragment/pdfRunBackground.d.ts +12 -0
- package/dist/export/pdf/draw/fragment/pdfTextChunks.d.ts +25 -0
- package/dist/export/pdf/draw/fragment/pdfTextDecoration.d.ts +4 -0
- package/dist/{index-DSDwe-yy.js → index-Cq3YFYX2.js} +1007 -1001
- package/dist/oasis-editor.js +50 -50
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/text/fonts/opentype/otLayoutCommon.d.ts +6 -0
- package/dist/ui/canvas/CanvasTableLayout.d.ts +12 -63
- package/dist/ui/canvas/canvasBorders.d.ts +1 -0
- package/dist/ui/canvas/canvasParagraphPainter.d.ts +4 -22
- package/dist/ui/canvas/paragraph/canvasEmphasis.d.ts +3 -0
- package/dist/ui/canvas/paragraph/canvasInlineImage.d.ts +26 -0
- package/dist/ui/canvas/paragraph/canvasRunBackground.d.ts +13 -0
- package/dist/ui/canvas/paragraph/canvasTabLeaders.d.ts +4 -0
- package/dist/ui/canvas/paragraph/canvasTextDecoration.d.ts +4 -0
- package/dist/ui/canvas/paragraph/canvasTextEffects.d.ts +43 -0
- package/dist/ui/canvas/table/assembleCellEntries.d.ts +15 -0
- package/dist/ui/canvas/table/prepareCells.d.ts +53 -0
- package/dist/ui/canvas/table/resolveRowHeights.d.ts +9 -0
- package/dist/ui/canvas/table/tableCellGeometry.d.ts +37 -0
- package/dist/ui/canvas/table/types.d.ts +63 -0
- package/package.json +1 -1
|
@@ -2539,7 +2539,7 @@ function OasisEditorAppLazy(props = {}) {
|
|
|
2539
2539
|
onCleanup(() => {
|
|
2540
2540
|
cancelled = true;
|
|
2541
2541
|
});
|
|
2542
|
-
import("./OasisEditorApp-
|
|
2542
|
+
import("./OasisEditorApp-C1dyjJoH.js").then((m) => {
|
|
2543
2543
|
cancelled = true;
|
|
2544
2544
|
setProgress(1);
|
|
2545
2545
|
setTimeout(() => setApp(() => m.OasisEditorApp), 180);
|
|
@@ -3057,6 +3057,88 @@ function createStore(...[store, options]) {
|
|
|
3057
3057
|
}
|
|
3058
3058
|
return [wrappedStore, setStore];
|
|
3059
3059
|
}
|
|
3060
|
+
const $ROOT = Symbol("store-root");
|
|
3061
|
+
function applyState(target, parent, property, merge, key) {
|
|
3062
|
+
const previous = parent[property];
|
|
3063
|
+
if (target === previous) return;
|
|
3064
|
+
const isArray = Array.isArray(target);
|
|
3065
|
+
if (property !== $ROOT && (!isWrappable(target) || !isWrappable(previous) || isArray !== Array.isArray(previous) || key && target[key] !== previous[key])) {
|
|
3066
|
+
setProperty(parent, property, target);
|
|
3067
|
+
return;
|
|
3068
|
+
}
|
|
3069
|
+
if (isArray) {
|
|
3070
|
+
if (target.length && previous.length && (!merge || key && target[0] && target[0][key] != null)) {
|
|
3071
|
+
let i, j, start, end, newEnd, item, newIndicesNext, keyVal;
|
|
3072
|
+
for (start = 0, end = Math.min(previous.length, target.length); start < end && (previous[start] === target[start] || key && previous[start] && target[start] && previous[start][key] && previous[start][key] === target[start][key]); start++) {
|
|
3073
|
+
applyState(target[start], previous, start, merge, key);
|
|
3074
|
+
}
|
|
3075
|
+
const temp = new Array(target.length), newIndices = /* @__PURE__ */ new Map();
|
|
3076
|
+
for (end = previous.length - 1, newEnd = target.length - 1; end >= start && newEnd >= start && (previous[end] === target[newEnd] || key && previous[end] && target[newEnd] && previous[end][key] && previous[end][key] === target[newEnd][key]); end--, newEnd--) {
|
|
3077
|
+
temp[newEnd] = previous[end];
|
|
3078
|
+
}
|
|
3079
|
+
if (start > newEnd || start > end) {
|
|
3080
|
+
for (j = start; j <= newEnd; j++) setProperty(previous, j, target[j]);
|
|
3081
|
+
for (; j < target.length; j++) {
|
|
3082
|
+
setProperty(previous, j, temp[j]);
|
|
3083
|
+
applyState(target[j], previous, j, merge, key);
|
|
3084
|
+
}
|
|
3085
|
+
if (previous.length > target.length) setProperty(previous, "length", target.length);
|
|
3086
|
+
return;
|
|
3087
|
+
}
|
|
3088
|
+
newIndicesNext = new Array(newEnd + 1);
|
|
3089
|
+
for (j = newEnd; j >= start; j--) {
|
|
3090
|
+
item = target[j];
|
|
3091
|
+
keyVal = key && item ? item[key] : item;
|
|
3092
|
+
i = newIndices.get(keyVal);
|
|
3093
|
+
newIndicesNext[j] = i === void 0 ? -1 : i;
|
|
3094
|
+
newIndices.set(keyVal, j);
|
|
3095
|
+
}
|
|
3096
|
+
for (i = start; i <= end; i++) {
|
|
3097
|
+
item = previous[i];
|
|
3098
|
+
keyVal = key && item ? item[key] : item;
|
|
3099
|
+
j = newIndices.get(keyVal);
|
|
3100
|
+
if (j !== void 0 && j !== -1) {
|
|
3101
|
+
temp[j] = previous[i];
|
|
3102
|
+
j = newIndicesNext[j];
|
|
3103
|
+
newIndices.set(keyVal, j);
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3106
|
+
for (j = start; j < target.length; j++) {
|
|
3107
|
+
if (j in temp) {
|
|
3108
|
+
setProperty(previous, j, temp[j]);
|
|
3109
|
+
applyState(target[j], previous, j, merge, key);
|
|
3110
|
+
} else setProperty(previous, j, target[j]);
|
|
3111
|
+
}
|
|
3112
|
+
} else {
|
|
3113
|
+
for (let i = 0, len = target.length; i < len; i++) {
|
|
3114
|
+
applyState(target[i], previous, i, merge, key);
|
|
3115
|
+
}
|
|
3116
|
+
}
|
|
3117
|
+
if (previous.length > target.length) setProperty(previous, "length", target.length);
|
|
3118
|
+
return;
|
|
3119
|
+
}
|
|
3120
|
+
const targetKeys = Object.keys(target);
|
|
3121
|
+
for (let i = 0, len = targetKeys.length; i < len; i++) {
|
|
3122
|
+
applyState(target[targetKeys[i]], previous, targetKeys[i], merge, key);
|
|
3123
|
+
}
|
|
3124
|
+
const previousKeys = Object.keys(previous);
|
|
3125
|
+
for (let i = 0, len = previousKeys.length; i < len; i++) {
|
|
3126
|
+
if (target[previousKeys[i]] === void 0) setProperty(previous, previousKeys[i], void 0);
|
|
3127
|
+
}
|
|
3128
|
+
}
|
|
3129
|
+
function reconcile(value, options = {}) {
|
|
3130
|
+
const {
|
|
3131
|
+
merge,
|
|
3132
|
+
key = "id"
|
|
3133
|
+
} = options, v = unwrap(value);
|
|
3134
|
+
return (state) => {
|
|
3135
|
+
if (!isWrappable(state) || !isWrappable(v)) return v;
|
|
3136
|
+
const res = applyState(v, {
|
|
3137
|
+
[$ROOT]: state
|
|
3138
|
+
}, $ROOT, merge, key);
|
|
3139
|
+
return res === void 0 ? state : res;
|
|
3140
|
+
};
|
|
3141
|
+
}
|
|
3060
3142
|
function assertNever(value, label = "value") {
|
|
3061
3143
|
const tag = value && typeof value === "object" && "type" in value ? value.type : value;
|
|
3062
3144
|
throw new Error(`Unhandled ${label}: ${String(tag)}`);
|
|
@@ -17761,17 +17843,8 @@ function drawStackedParagraph(ctx, paragraph, state, box, startColumn, columnsRt
|
|
|
17761
17843
|
ctx.restore();
|
|
17762
17844
|
return endColumnRight;
|
|
17763
17845
|
}
|
|
17764
|
-
const NO_WRAP_WIDTH_PX = 1e5;
|
|
17765
|
-
function resolveCellVerticalMode(cell) {
|
|
17766
|
-
var _a, _b, _c;
|
|
17767
|
-
const direction = ((_a = cell.style) == null ? void 0 : _a.textDirection) ?? ((_c = (_b = cell.blocks[0]) == null ? void 0 : _b.style) == null ? void 0 : _c.textDirection) ?? null;
|
|
17768
|
-
return resolveVerticalMode(direction);
|
|
17769
|
-
}
|
|
17770
|
-
const DEFAULT_TABLE_ROW_HEIGHT = 14;
|
|
17771
17846
|
const DEFAULT_CELL_PADDING_TOP_BOTTOM_PX = 0;
|
|
17772
17847
|
const DEFAULT_CELL_PADDING_LEFT_RIGHT_PX = 7.2;
|
|
17773
|
-
const MIN_TABLE_CELL_CONTENT_WIDTH_PX = 24;
|
|
17774
|
-
const MIN_TABLE_CELL_CONTENT_HEIGHT_PX = 1;
|
|
17775
17848
|
function toPx(value) {
|
|
17776
17849
|
return value * PX_PER_POINT;
|
|
17777
17850
|
}
|
|
@@ -17790,51 +17863,6 @@ function parseDimensionToPx(value) {
|
|
|
17790
17863
|
const parsed = Number.parseFloat(trimmed);
|
|
17791
17864
|
return Number.isFinite(parsed) ? parsed : null;
|
|
17792
17865
|
}
|
|
17793
|
-
function resolveCanvasTableWidth(table, contentWidth) {
|
|
17794
|
-
var _a;
|
|
17795
|
-
const raw = (_a = table.style) == null ? void 0 : _a.width;
|
|
17796
|
-
if (typeof raw === "number") return Math.max(24, toPx(raw));
|
|
17797
|
-
if (typeof raw === "string" && raw.trim().endsWith("%")) {
|
|
17798
|
-
const value = Number.parseFloat(raw.trim().slice(0, -1));
|
|
17799
|
-
if (Number.isFinite(value))
|
|
17800
|
-
return Math.max(24, contentWidth * (value / 100));
|
|
17801
|
-
}
|
|
17802
|
-
return contentWidth;
|
|
17803
|
-
}
|
|
17804
|
-
function resolveTableIndentLeft(table) {
|
|
17805
|
-
var _a;
|
|
17806
|
-
const raw = (_a = table.style) == null ? void 0 : _a.indentLeft;
|
|
17807
|
-
return typeof raw === "number" && Number.isFinite(raw) ? toPx(raw) : 0;
|
|
17808
|
-
}
|
|
17809
|
-
function resolveTableCellSpacingPx(table) {
|
|
17810
|
-
var _a;
|
|
17811
|
-
const px = parseDimensionToPx((_a = table.style) == null ? void 0 : _a.cellSpacing);
|
|
17812
|
-
return px !== null && px > 0 ? px : 0;
|
|
17813
|
-
}
|
|
17814
|
-
function lineNaturalWidth(line) {
|
|
17815
|
-
if (line.slots.length < 2) return 0;
|
|
17816
|
-
return line.slots[line.slots.length - 1].left - line.slots[0].left;
|
|
17817
|
-
}
|
|
17818
|
-
function applyFitTextScale(paragraph, scalePercent) {
|
|
17819
|
-
return {
|
|
17820
|
-
...paragraph,
|
|
17821
|
-
runs: paragraph.runs.map((run) => {
|
|
17822
|
-
var _a;
|
|
17823
|
-
const existing = (_a = run.styles) == null ? void 0 : _a.characterScale;
|
|
17824
|
-
const combined = typeof existing === "number" && existing > 0 ? existing * scalePercent / 100 : scalePercent;
|
|
17825
|
-
return { ...run, styles: { ...run.styles, characterScale: combined } };
|
|
17826
|
-
})
|
|
17827
|
-
};
|
|
17828
|
-
}
|
|
17829
|
-
function resolveTableLeftOffset(table, tableWidth, contentWidth) {
|
|
17830
|
-
var _a;
|
|
17831
|
-
const align = (_a = table.style) == null ? void 0 : _a.align;
|
|
17832
|
-
if (align === "center" || align === "right") {
|
|
17833
|
-
const slack = Math.max(0, contentWidth - tableWidth);
|
|
17834
|
-
return align === "center" ? slack / 2 : slack;
|
|
17835
|
-
}
|
|
17836
|
-
return resolveTableIndentLeft(table);
|
|
17837
|
-
}
|
|
17838
17866
|
function resolveDefaultBorder() {
|
|
17839
17867
|
return { width: 1, color: "#6f6f6f", type: "solid" };
|
|
17840
17868
|
}
|
|
@@ -17863,6 +17891,17 @@ function resolveCellPadding(cell) {
|
|
|
17863
17891
|
const left = ((_f = cell.style) == null ? void 0 : _f.paddingLeft) !== void 0 ? toPx(cell.style.paddingLeft) : ((_g = cell.style) == null ? void 0 : _g.paddingStart) !== void 0 ? toPx(cell.style.paddingStart) : DEFAULT_CELL_PADDING_LEFT_RIGHT_PX;
|
|
17864
17892
|
return { top, right, bottom, left };
|
|
17865
17893
|
}
|
|
17894
|
+
function resolveVerticalContentOffset(cell, contentHeightPx, contentNaturalHeightPx) {
|
|
17895
|
+
var _a, _b;
|
|
17896
|
+
const available = Math.max(0, contentHeightPx - contentNaturalHeightPx);
|
|
17897
|
+
if (((_a = cell.style) == null ? void 0 : _a.verticalAlign) === "bottom") {
|
|
17898
|
+
return available;
|
|
17899
|
+
}
|
|
17900
|
+
if (((_b = cell.style) == null ? void 0 : _b.verticalAlign) === "middle") {
|
|
17901
|
+
return available / 2;
|
|
17902
|
+
}
|
|
17903
|
+
return 0;
|
|
17904
|
+
}
|
|
17866
17905
|
function fitImagesToCellWidth(paragraph, maxImageWidthPx) {
|
|
17867
17906
|
if (!Number.isFinite(maxImageWidthPx) || maxImageWidthPx <= 0) {
|
|
17868
17907
|
return paragraph;
|
|
@@ -17886,116 +17925,87 @@ function fitImagesToCellWidth(paragraph, maxImageWidthPx) {
|
|
|
17886
17925
|
if (!changed) return paragraph;
|
|
17887
17926
|
return { ...paragraph, runs };
|
|
17888
17927
|
}
|
|
17889
|
-
function
|
|
17890
|
-
|
|
17891
|
-
|
|
17892
|
-
|
|
17893
|
-
|
|
17928
|
+
function applyFitTextScale(paragraph, scalePercent) {
|
|
17929
|
+
return {
|
|
17930
|
+
...paragraph,
|
|
17931
|
+
runs: paragraph.runs.map((run) => {
|
|
17932
|
+
var _a;
|
|
17933
|
+
const existing = (_a = run.styles) == null ? void 0 : _a.characterScale;
|
|
17934
|
+
const combined = typeof existing === "number" && existing > 0 ? existing * scalePercent / 100 : scalePercent;
|
|
17935
|
+
return { ...run, styles: { ...run.styles, characterScale: combined } };
|
|
17936
|
+
})
|
|
17937
|
+
};
|
|
17938
|
+
}
|
|
17939
|
+
function resolveCanvasTableWidth(table, contentWidth) {
|
|
17940
|
+
var _a;
|
|
17941
|
+
const raw = (_a = table.style) == null ? void 0 : _a.width;
|
|
17942
|
+
if (typeof raw === "number") return Math.max(24, toPx(raw));
|
|
17943
|
+
if (typeof raw === "string" && raw.trim().endsWith("%")) {
|
|
17944
|
+
const value = Number.parseFloat(raw.trim().slice(0, -1));
|
|
17945
|
+
if (Number.isFinite(value))
|
|
17946
|
+
return Math.max(24, contentWidth * (value / 100));
|
|
17894
17947
|
}
|
|
17895
|
-
|
|
17896
|
-
|
|
17948
|
+
return contentWidth;
|
|
17949
|
+
}
|
|
17950
|
+
function resolveTableIndentLeft(table) {
|
|
17951
|
+
var _a;
|
|
17952
|
+
const raw = (_a = table.style) == null ? void 0 : _a.indentLeft;
|
|
17953
|
+
return typeof raw === "number" && Number.isFinite(raw) ? toPx(raw) : 0;
|
|
17954
|
+
}
|
|
17955
|
+
function resolveTableCellSpacingPx(table) {
|
|
17956
|
+
var _a;
|
|
17957
|
+
const px = parseDimensionToPx((_a = table.style) == null ? void 0 : _a.cellSpacing);
|
|
17958
|
+
return px !== null && px > 0 ? px : 0;
|
|
17959
|
+
}
|
|
17960
|
+
function resolveTableLeftOffset(table, tableWidth, contentWidth) {
|
|
17961
|
+
var _a;
|
|
17962
|
+
const align = (_a = table.style) == null ? void 0 : _a.align;
|
|
17963
|
+
if (align === "center" || align === "right") {
|
|
17964
|
+
const slack = Math.max(0, contentWidth - tableWidth);
|
|
17965
|
+
return align === "center" ? slack / 2 : slack;
|
|
17897
17966
|
}
|
|
17898
|
-
return
|
|
17967
|
+
return resolveTableIndentLeft(table);
|
|
17899
17968
|
}
|
|
17900
|
-
|
|
17901
|
-
|
|
17969
|
+
const NO_WRAP_WIDTH_PX = 1e5;
|
|
17970
|
+
const MIN_TABLE_CELL_CONTENT_WIDTH_PX = 24;
|
|
17971
|
+
function resolveCellVerticalMode(cell) {
|
|
17972
|
+
var _a, _b, _c;
|
|
17973
|
+
const direction = ((_a = cell.style) == null ? void 0 : _a.textDirection) ?? ((_c = (_b = cell.blocks[0]) == null ? void 0 : _b.style) == null ? void 0 : _c.textDirection) ?? null;
|
|
17974
|
+
return resolveVerticalMode(direction);
|
|
17975
|
+
}
|
|
17976
|
+
function lineNaturalWidth(line) {
|
|
17977
|
+
if (line.slots.length < 2) return 0;
|
|
17978
|
+
return line.slots[line.slots.length - 1].left - line.slots[0].left;
|
|
17979
|
+
}
|
|
17980
|
+
function prepareCells(options) {
|
|
17981
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
17902
17982
|
const {
|
|
17903
|
-
table
|
|
17983
|
+
table,
|
|
17984
|
+
sourceTable,
|
|
17985
|
+
tableEntries,
|
|
17986
|
+
columnOffsets,
|
|
17987
|
+
cellSpacingPx,
|
|
17988
|
+
visualColumnCount,
|
|
17989
|
+
effectiveRowStyles,
|
|
17904
17990
|
state,
|
|
17905
|
-
pageIndex
|
|
17906
|
-
originX,
|
|
17907
|
-
originY,
|
|
17908
|
-
contentWidth,
|
|
17909
|
-
estimatedHeight
|
|
17991
|
+
pageIndex
|
|
17910
17992
|
} = options;
|
|
17911
|
-
const table = {
|
|
17912
|
-
...sourceTable,
|
|
17913
|
-
style: resolveEffectiveTableStyle(sourceTable, state.document.styles)
|
|
17914
|
-
};
|
|
17915
|
-
const tableWidth = resolveCanvasTableWidth(table, contentWidth);
|
|
17916
|
-
const tableLeft = originX + resolveTableLeftOffset(table, tableWidth, contentWidth);
|
|
17917
|
-
const cellSpacingPx = resolveTableCellSpacingPx(table);
|
|
17918
|
-
const tableEntries = buildTableCellLayout(table);
|
|
17919
17993
|
const unsupported = [];
|
|
17920
|
-
const visualColumnCount = Math.max(
|
|
17921
|
-
1,
|
|
17922
|
-
...tableEntries.map(
|
|
17923
|
-
(entry) => entry.visualColumnIndex + Math.max(1, entry.colSpan)
|
|
17924
|
-
)
|
|
17925
|
-
);
|
|
17926
|
-
const columnsWidthBudget = Math.max(
|
|
17927
|
-
visualColumnCount,
|
|
17928
|
-
tableWidth - (visualColumnCount + 1) * cellSpacingPx
|
|
17929
|
-
);
|
|
17930
|
-
let resolvedColumnWidths = [];
|
|
17931
|
-
if (table.gridCols && table.gridCols.length >= visualColumnCount) {
|
|
17932
|
-
const gridTotalWidth = table.gridCols.reduce((a, b) => a + b, 0);
|
|
17933
|
-
const scale = gridTotalWidth > 0 ? columnsWidthBudget / gridTotalWidth : 1;
|
|
17934
|
-
resolvedColumnWidths = table.gridCols.map((w) => w * scale);
|
|
17935
|
-
} else {
|
|
17936
|
-
const baseCellWidth = columnsWidthBudget / visualColumnCount;
|
|
17937
|
-
resolvedColumnWidths = Array(visualColumnCount).fill(baseCellWidth);
|
|
17938
|
-
for (const entry of tableEntries) {
|
|
17939
|
-
if (Math.max(1, entry.colSpan) !== 1) continue;
|
|
17940
|
-
const cell = (_a = table.rows[entry.rowIndex]) == null ? void 0 : _a.cells[entry.cellIndex];
|
|
17941
|
-
if (!cell || resolveCellVerticalMode(cell) !== "stack") continue;
|
|
17942
|
-
let glyphWidth = 0;
|
|
17943
|
-
for (const block of cell.blocks) {
|
|
17944
|
-
if (block.type !== "paragraph") continue;
|
|
17945
|
-
glyphWidth = Math.max(
|
|
17946
|
-
glyphWidth,
|
|
17947
|
-
estimateStackedColumnWidth(block, state)
|
|
17948
|
-
);
|
|
17949
|
-
}
|
|
17950
|
-
if (glyphWidth <= 0) continue;
|
|
17951
|
-
const padding = resolveCellPadding(cell);
|
|
17952
|
-
const needed = glyphWidth + padding.left + padding.right + resolveBorder(((_b = cell.style) == null ? void 0 : _b.borderLeft) ?? ((_c = cell.style) == null ? void 0 : _c.borderStart)).width + resolveBorder(((_d = cell.style) == null ? void 0 : _d.borderRight) ?? ((_e = cell.style) == null ? void 0 : _e.borderEnd)).width;
|
|
17953
|
-
const col = entry.visualColumnIndex;
|
|
17954
|
-
if (needed > (resolvedColumnWidths[col] ?? 0)) {
|
|
17955
|
-
resolvedColumnWidths[col] = needed;
|
|
17956
|
-
}
|
|
17957
|
-
}
|
|
17958
|
-
}
|
|
17959
|
-
const columnOffsets = [cellSpacingPx];
|
|
17960
|
-
for (let i = 0; i < resolvedColumnWidths.length; i++) {
|
|
17961
|
-
columnOffsets[i + 1] = columnOffsets[i] + resolvedColumnWidths[i] + cellSpacingPx;
|
|
17962
|
-
}
|
|
17963
17994
|
const cellEntriesByKey = new Map(
|
|
17964
17995
|
tableEntries.map(
|
|
17965
17996
|
(entry) => [`${entry.rowIndex}:${entry.cellIndex}`, entry]
|
|
17966
17997
|
)
|
|
17967
17998
|
);
|
|
17968
|
-
const effectiveRowStyles = table.rows.map((row, rowIndex) => {
|
|
17969
|
-
const entry = tableEntries.find(
|
|
17970
|
-
(candidate) => candidate.rowIndex === rowIndex
|
|
17971
|
-
);
|
|
17972
|
-
return entry ? resolveEffectiveTableCellFormatting({
|
|
17973
|
-
table: sourceTable,
|
|
17974
|
-
rowIndex,
|
|
17975
|
-
cellIndex: entry.cellIndex,
|
|
17976
|
-
visualColumnIndex: entry.visualColumnIndex,
|
|
17977
|
-
columnCount: visualColumnCount,
|
|
17978
|
-
styles: state.document.styles
|
|
17979
|
-
}).rowStyle : row.style;
|
|
17980
|
-
});
|
|
17981
17999
|
const prepared = [];
|
|
17982
18000
|
for (let rowIndex = 0; rowIndex < table.rows.length; rowIndex += 1) {
|
|
17983
18001
|
const row = table.rows[rowIndex];
|
|
17984
|
-
if ((
|
|
17985
|
-
|
|
17986
|
-
}
|
|
17987
|
-
if (((_h = (_g = effectiveRowStyles[rowIndex]) == null ? void 0 : _g.revision) == null ? void 0 : _h.type) === "delete") {
|
|
17988
|
-
continue;
|
|
17989
|
-
}
|
|
18002
|
+
if ((_a = effectiveRowStyles[rowIndex]) == null ? void 0 : _a.hidden) continue;
|
|
18003
|
+
if (((_c = (_b = effectiveRowStyles[rowIndex]) == null ? void 0 : _b.revision) == null ? void 0 : _c.type) === "delete") continue;
|
|
17990
18004
|
for (let cellIndex = 0; cellIndex < row.cells.length; cellIndex += 1) {
|
|
17991
18005
|
const sourceCell = row.cells[cellIndex];
|
|
17992
|
-
if (((
|
|
17993
|
-
continue;
|
|
17994
|
-
}
|
|
18006
|
+
if (((_e = (_d = sourceCell.style) == null ? void 0 : _d.revision) == null ? void 0 : _e.type) === "delete") continue;
|
|
17995
18007
|
const entry = cellEntriesByKey.get(`${rowIndex}:${cellIndex}`);
|
|
17996
|
-
if (!entry)
|
|
17997
|
-
continue;
|
|
17998
|
-
}
|
|
18008
|
+
if (!entry) continue;
|
|
17999
18009
|
const formatting = resolveEffectiveTableCellFormatting({
|
|
18000
18010
|
table: sourceTable,
|
|
18001
18011
|
rowIndex,
|
|
@@ -18017,36 +18027,25 @@ function buildCanvasTableLayout(options) {
|
|
|
18017
18027
|
};
|
|
18018
18028
|
const effectiveRow = formatting.rowStyle;
|
|
18019
18029
|
const rowSpan = Math.max(1, cell.rowSpan ?? 1);
|
|
18020
|
-
if (rowSpan > 1)
|
|
18021
|
-
|
|
18022
|
-
}
|
|
18023
|
-
if (cell.vMerge === "continue" || cell.vMerge === "restart") {
|
|
18030
|
+
if (rowSpan > 1) unsupported.push("unsupported:v-span");
|
|
18031
|
+
if (cell.vMerge === "continue" || cell.vMerge === "restart")
|
|
18024
18032
|
unsupported.push("unsupported:v-merge");
|
|
18025
|
-
}
|
|
18026
18033
|
const visualCol = entry.visualColumnIndex;
|
|
18027
18034
|
const colSpan = Math.max(1, entry.colSpan);
|
|
18028
18035
|
const width = Math.max(
|
|
18029
18036
|
1,
|
|
18030
|
-
(columnOffsets[visualCol + colSpan] ??
|
|
18037
|
+
(columnOffsets[visualCol + colSpan] ?? 0) - (columnOffsets[visualCol] ?? 0) - cellSpacingPx
|
|
18031
18038
|
);
|
|
18032
18039
|
const padding = resolveCellPadding(cell);
|
|
18033
|
-
const logicalLeft = ((
|
|
18034
|
-
const logicalRight = ((
|
|
18040
|
+
const logicalLeft = ((_f = table.style) == null ? void 0 : _f.bidiVisual) ? (_g = cell.style) == null ? void 0 : _g.borderEnd : (_h = cell.style) == null ? void 0 : _h.borderStart;
|
|
18041
|
+
const logicalRight = ((_i = table.style) == null ? void 0 : _i.bidiVisual) ? (_j = cell.style) == null ? void 0 : _j.borderStart : (_k = cell.style) == null ? void 0 : _k.borderEnd;
|
|
18035
18042
|
const borders = {
|
|
18036
|
-
top: resolveBorder((
|
|
18037
|
-
right: resolveBorder(((
|
|
18038
|
-
bottom: resolveBorder((
|
|
18039
|
-
left: resolveBorder(((
|
|
18040
|
-
...((
|
|
18041
|
-
|
|
18042
|
-
cell.style.borderTopLeftToBottomRight
|
|
18043
|
-
)
|
|
18044
|
-
} : {},
|
|
18045
|
-
...((_v = cell.style) == null ? void 0 : _v.borderTopRightToBottomLeft) ? {
|
|
18046
|
-
topRightToBottomLeft: resolveBorder(
|
|
18047
|
-
cell.style.borderTopRightToBottomLeft
|
|
18048
|
-
)
|
|
18049
|
-
} : {}
|
|
18043
|
+
top: resolveBorder((_l = cell.style) == null ? void 0 : _l.borderTop),
|
|
18044
|
+
right: resolveBorder(((_m = cell.style) == null ? void 0 : _m.borderRight) ?? logicalRight),
|
|
18045
|
+
bottom: resolveBorder((_n = cell.style) == null ? void 0 : _n.borderBottom),
|
|
18046
|
+
left: resolveBorder(((_o = cell.style) == null ? void 0 : _o.borderLeft) ?? logicalLeft),
|
|
18047
|
+
...((_p = cell.style) == null ? void 0 : _p.borderTopLeftToBottomRight) ? { topLeftToBottomRight: resolveBorder(cell.style.borderTopLeftToBottomRight) } : {},
|
|
18048
|
+
...((_q = cell.style) == null ? void 0 : _q.borderTopRightToBottomLeft) ? { topRightToBottomLeft: resolveBorder(cell.style.borderTopRightToBottomLeft) } : {}
|
|
18050
18049
|
};
|
|
18051
18050
|
const contentWidthPx = Math.max(
|
|
18052
18051
|
MIN_TABLE_CELL_CONTENT_WIDTH_PX,
|
|
@@ -18055,9 +18054,10 @@ function buildCanvasTableLayout(options) {
|
|
|
18055
18054
|
const verticalMode = resolveCellVerticalMode(cell);
|
|
18056
18055
|
const isRotated = verticalMode === "rotate-cw" || verticalMode === "rotate-ccw";
|
|
18057
18056
|
const isStacked = verticalMode === "stack";
|
|
18058
|
-
const isFitText = !!((
|
|
18057
|
+
const isFitText = !!((_r = cell.style) == null ? void 0 : _r.fitText) && !isRotated && !isStacked;
|
|
18059
18058
|
const explicitRowHeightPx = parseDimensionToPx(effectiveRow.height);
|
|
18060
|
-
const
|
|
18059
|
+
const hasExplicitRowHeight = explicitRowHeightPx !== null && explicitRowHeightPx > 0;
|
|
18060
|
+
const wrapWidth = isRotated || ((_s = cell.style) == null ? void 0 : _s.noWrap) ? isRotated && hasExplicitRowHeight ? Math.max(
|
|
18061
18061
|
MIN_TABLE_CELL_CONTENT_WIDTH_PX,
|
|
18062
18062
|
explicitRowHeightPx - borders.top.width - borders.bottom.width - padding.top - padding.bottom
|
|
18063
18063
|
) : NO_WRAP_WIDTH_PX : contentWidthPx;
|
|
@@ -18073,7 +18073,7 @@ function buildCanvasTableLayout(options) {
|
|
|
18073
18073
|
state.document.styles,
|
|
18074
18074
|
NO_WRAP_WIDTH_PX,
|
|
18075
18075
|
void 0,
|
|
18076
|
-
(
|
|
18076
|
+
(_t = state.document.settings) == null ? void 0 : _t.defaultTabStop
|
|
18077
18077
|
);
|
|
18078
18078
|
const naturalWidth = noWrapProjected.lines.length > 0 ? lineNaturalWidth(noWrapProjected.lines[0]) : 0;
|
|
18079
18079
|
if (naturalWidth > 0 && contentWidthPx > 0) {
|
|
@@ -18099,8 +18099,7 @@ function buildCanvasTableLayout(options) {
|
|
|
18099
18099
|
spacingBefore,
|
|
18100
18100
|
spacingAfter
|
|
18101
18101
|
});
|
|
18102
|
-
const
|
|
18103
|
-
const paragraphStyleSize = ((_A = (_z = paragraph.runs[0]) == null ? void 0 : _z.styles) == null ? void 0 : _A.fontSize) ?? DEFAULT_FONT_SIZE_PX;
|
|
18102
|
+
const paragraphStyleSize = ((_v = (_u = paragraph.runs[0]) == null ? void 0 : _u.styles) == null ? void 0 : _v.fontSize) ?? DEFAULT_FONT_SIZE_PX;
|
|
18104
18103
|
contentNaturalHeightPx = Math.max(
|
|
18105
18104
|
contentNaturalHeightPx,
|
|
18106
18105
|
hasExplicitRowHeight ? paragraphStyleSize * 1.25 : stackLength
|
|
@@ -18114,13 +18113,13 @@ function buildCanvasTableLayout(options) {
|
|
|
18114
18113
|
state.document.styles,
|
|
18115
18114
|
wrapWidth,
|
|
18116
18115
|
void 0,
|
|
18117
|
-
(
|
|
18116
|
+
(_w = state.document.settings) == null ? void 0 : _w.defaultTabStop
|
|
18118
18117
|
);
|
|
18119
18118
|
const linesBottom = projected.lines.length > 0 ? Math.max(...projected.lines.map((line) => line.top + line.height)) : 1;
|
|
18120
18119
|
let effectiveSpacingBefore = spacingBefore;
|
|
18121
18120
|
if (!isRotated && projectedParagraphs.length > 0) {
|
|
18122
18121
|
const previous = projectedParagraphs[projectedParagraphs.length - 1];
|
|
18123
|
-
if (((
|
|
18122
|
+
if (((_x = state.document.settings) == null ? void 0 : _x.allowSpaceOfSameStyleInTable) && shouldCollapseContextualSpacing(
|
|
18124
18123
|
previous.paragraph,
|
|
18125
18124
|
paragraph,
|
|
18126
18125
|
state.document.styles
|
|
@@ -18128,10 +18127,7 @@ function buildCanvasTableLayout(options) {
|
|
|
18128
18127
|
const removedAfter = previous.spacingAfter;
|
|
18129
18128
|
previous.height = Math.max(1, previous.height - removedAfter);
|
|
18130
18129
|
previous.spacingAfter = 0;
|
|
18131
|
-
contentNaturalHeightPx = Math.max(
|
|
18132
|
-
0,
|
|
18133
|
-
contentNaturalHeightPx - removedAfter
|
|
18134
|
-
);
|
|
18130
|
+
contentNaturalHeightPx = Math.max(0, contentNaturalHeightPx - removedAfter);
|
|
18135
18131
|
effectiveSpacingBefore = 0;
|
|
18136
18132
|
} else {
|
|
18137
18133
|
const collapsed = Math.min(previous.spacingAfter, spacingBefore);
|
|
@@ -18162,7 +18158,6 @@ function buildCanvasTableLayout(options) {
|
|
|
18162
18158
|
});
|
|
18163
18159
|
if (isRotated) {
|
|
18164
18160
|
const lineThickness = projected.lines.length > 0 ? Math.max(...projected.lines.map((line) => line.height)) : paragraphHeight;
|
|
18165
|
-
const hasExplicitRowHeight = explicitRowHeightPx !== null && explicitRowHeightPx > 0;
|
|
18166
18161
|
const flowLength = projected.lines.length ? Math.max(
|
|
18167
18162
|
...projected.lines.map((line) => {
|
|
18168
18163
|
const last = line.slots[line.slots.length - 1];
|
|
@@ -18177,15 +18172,13 @@ function buildCanvasTableLayout(options) {
|
|
|
18177
18172
|
contentNaturalHeightPx += paragraphHeight;
|
|
18178
18173
|
}
|
|
18179
18174
|
}
|
|
18180
|
-
if ((
|
|
18175
|
+
if ((_y = cell.style) == null ? void 0 : _y.hideMark) {
|
|
18181
18176
|
const allEmpty = cell.blocks.every(
|
|
18182
18177
|
(para) => para.runs.every(
|
|
18183
18178
|
(run) => (run.kind === "text" || run.kind === void 0) && (!run.text || run.text.length === 0)
|
|
18184
18179
|
)
|
|
18185
18180
|
);
|
|
18186
|
-
if (allEmpty)
|
|
18187
|
-
contentNaturalHeightPx = 0;
|
|
18188
|
-
}
|
|
18181
|
+
if (allEmpty) contentNaturalHeightPx = 0;
|
|
18189
18182
|
}
|
|
18190
18183
|
prepared.push({
|
|
18191
18184
|
rowIndex,
|
|
@@ -18204,21 +18197,24 @@ function buildCanvasTableLayout(options) {
|
|
|
18204
18197
|
});
|
|
18205
18198
|
}
|
|
18206
18199
|
}
|
|
18200
|
+
return { prepared, unsupported };
|
|
18201
|
+
}
|
|
18202
|
+
const DEFAULT_TABLE_ROW_HEIGHT$1 = 14;
|
|
18203
|
+
function resolveRowHeights(options) {
|
|
18204
|
+
var _a, _b, _c;
|
|
18205
|
+
const { prepared, table, effectiveRowStyles, estimatedHeight } = options;
|
|
18207
18206
|
const rowCount = Math.max(1, table.rows.length);
|
|
18208
|
-
const explicitRowHeights = table.rows.map((row) => {
|
|
18207
|
+
const explicitRowHeights = table.rows.map((row, rowIndex) => {
|
|
18209
18208
|
var _a2;
|
|
18210
|
-
const rowIndex = table.rows.indexOf(row);
|
|
18211
18209
|
const effective = effectiveRowStyles[rowIndex];
|
|
18212
|
-
if ((effective == null ? void 0 : effective.hidden) || ((_a2 = effective == null ? void 0 : effective.revision) == null ? void 0 : _a2.type) === "delete")
|
|
18213
|
-
return 0;
|
|
18214
|
-
}
|
|
18210
|
+
if ((effective == null ? void 0 : effective.hidden) || ((_a2 = effective == null ? void 0 : effective.revision) == null ? void 0 : _a2.type) === "delete") return 0;
|
|
18215
18211
|
const explicit = parseDimensionToPx(effective == null ? void 0 : effective.height);
|
|
18216
18212
|
return explicit !== null && explicit > 0 ? explicit : null;
|
|
18217
18213
|
});
|
|
18218
|
-
const fallbackPerRow = estimatedHeight > 0 ? estimatedHeight / rowCount : DEFAULT_TABLE_ROW_HEIGHT;
|
|
18214
|
+
const fallbackPerRow = estimatedHeight > 0 ? estimatedHeight / rowCount : DEFAULT_TABLE_ROW_HEIGHT$1;
|
|
18219
18215
|
const rowHeights = [];
|
|
18220
18216
|
for (let rowIndex = 0; rowIndex < table.rows.length; rowIndex += 1) {
|
|
18221
|
-
if (((
|
|
18217
|
+
if (((_a = effectiveRowStyles[rowIndex]) == null ? void 0 : _a.hidden) || ((_c = (_b = effectiveRowStyles[rowIndex]) == null ? void 0 : _b.revision) == null ? void 0 : _c.type) === "delete") {
|
|
18222
18218
|
rowHeights[rowIndex] = 0;
|
|
18223
18219
|
continue;
|
|
18224
18220
|
}
|
|
@@ -18233,12 +18229,22 @@ function buildCanvasTableLayout(options) {
|
|
|
18233
18229
|
const baseFloor = explicit !== null ? explicit : Math.max(1, fallbackPerRow * 0.25);
|
|
18234
18230
|
rowHeights[rowIndex] = Math.max(baseFloor, measured, 1);
|
|
18235
18231
|
}
|
|
18236
|
-
|
|
18237
|
-
|
|
18238
|
-
|
|
18239
|
-
|
|
18240
|
-
|
|
18241
|
-
|
|
18232
|
+
return rowHeights;
|
|
18233
|
+
}
|
|
18234
|
+
const DEFAULT_TABLE_ROW_HEIGHT = 14;
|
|
18235
|
+
const MIN_TABLE_CELL_CONTENT_HEIGHT_PX = 1;
|
|
18236
|
+
function assembleCellEntries(options) {
|
|
18237
|
+
var _a, _b, _c;
|
|
18238
|
+
const {
|
|
18239
|
+
prepared,
|
|
18240
|
+
rowHeights,
|
|
18241
|
+
rowOffsets,
|
|
18242
|
+
columnOffsets,
|
|
18243
|
+
tableLeft,
|
|
18244
|
+
originY,
|
|
18245
|
+
cellSpacingPx,
|
|
18246
|
+
table
|
|
18247
|
+
} = options;
|
|
18242
18248
|
const cells = [];
|
|
18243
18249
|
for (const cellEntry of prepared) {
|
|
18244
18250
|
const {
|
|
@@ -18273,11 +18279,7 @@ function buildCanvasTableLayout(options) {
|
|
|
18273
18279
|
0
|
|
18274
18280
|
);
|
|
18275
18281
|
let paragraphCursorY = 0;
|
|
18276
|
-
const verticalContentOffset = cellEntry.verticalMode === "horizontal" ? resolveVerticalContentOffset(
|
|
18277
|
-
cell,
|
|
18278
|
-
contentHeightPx,
|
|
18279
|
-
cellEntry.contentNaturalHeightPx
|
|
18280
|
-
) : 0;
|
|
18282
|
+
const verticalContentOffset = cellEntry.verticalMode === "horizontal" ? resolveVerticalContentOffset(cell, contentHeightPx, cellEntry.contentNaturalHeightPx) : 0;
|
|
18281
18283
|
const paragraphs = [];
|
|
18282
18284
|
for (const projected of cellEntry.projectedParagraphs) {
|
|
18283
18285
|
paragraphs.push({
|
|
@@ -18302,21 +18304,132 @@ function buildCanvasTableLayout(options) {
|
|
|
18302
18304
|
contentTop,
|
|
18303
18305
|
contentWidth: contentWidthPx,
|
|
18304
18306
|
contentHeight: contentHeightPx,
|
|
18305
|
-
shading: (
|
|
18307
|
+
shading: (_a = cell.style) == null ? void 0 : _a.shading,
|
|
18306
18308
|
anchorPosition,
|
|
18307
18309
|
padding,
|
|
18308
18310
|
borders,
|
|
18309
18311
|
paragraphs,
|
|
18310
18312
|
verticalMode: cellEntry.verticalMode,
|
|
18311
|
-
revision: ((
|
|
18313
|
+
revision: ((_b = cell.style) == null ? void 0 : _b.revision) ?? (((_c = cell.style) == null ? void 0 : _c.propertyRevision) ? { ...cell.style.propertyRevision, type: "property" } : void 0)
|
|
18312
18314
|
});
|
|
18313
18315
|
}
|
|
18316
|
+
return cells;
|
|
18317
|
+
}
|
|
18318
|
+
function buildRowOffsets(rowHeights, cellSpacingPx) {
|
|
18319
|
+
const rowOffsets = [];
|
|
18320
|
+
let cumulativeY = cellSpacingPx;
|
|
18321
|
+
for (let rowIndex = 0; rowIndex < rowHeights.length; rowIndex += 1) {
|
|
18322
|
+
rowOffsets[rowIndex] = cumulativeY;
|
|
18323
|
+
cumulativeY += (rowHeights[rowIndex] ?? DEFAULT_TABLE_ROW_HEIGHT) + cellSpacingPx;
|
|
18324
|
+
}
|
|
18325
|
+
return rowOffsets;
|
|
18326
|
+
}
|
|
18327
|
+
function buildCanvasTableLayout(options) {
|
|
18328
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
18329
|
+
const {
|
|
18330
|
+
table: sourceTable,
|
|
18331
|
+
state,
|
|
18332
|
+
pageIndex,
|
|
18333
|
+
originX,
|
|
18334
|
+
originY,
|
|
18335
|
+
contentWidth,
|
|
18336
|
+
estimatedHeight
|
|
18337
|
+
} = options;
|
|
18338
|
+
const table = {
|
|
18339
|
+
...sourceTable,
|
|
18340
|
+
style: resolveEffectiveTableStyle(sourceTable, state.document.styles)
|
|
18341
|
+
};
|
|
18342
|
+
const tableWidth = resolveCanvasTableWidth(table, contentWidth);
|
|
18343
|
+
const tableLeft = originX + resolveTableLeftOffset(table, tableWidth, contentWidth);
|
|
18344
|
+
const cellSpacingPx = resolveTableCellSpacingPx(table);
|
|
18345
|
+
const tableEntries = buildTableCellLayout(table);
|
|
18346
|
+
const visualColumnCount = Math.max(
|
|
18347
|
+
1,
|
|
18348
|
+
...tableEntries.map(
|
|
18349
|
+
(entry) => entry.visualColumnIndex + Math.max(1, entry.colSpan)
|
|
18350
|
+
)
|
|
18351
|
+
);
|
|
18352
|
+
const columnsWidthBudget = Math.max(
|
|
18353
|
+
visualColumnCount,
|
|
18354
|
+
tableWidth - (visualColumnCount + 1) * cellSpacingPx
|
|
18355
|
+
);
|
|
18356
|
+
let resolvedColumnWidths = [];
|
|
18357
|
+
if (table.gridCols && table.gridCols.length >= visualColumnCount) {
|
|
18358
|
+
const gridTotalWidth = table.gridCols.reduce((a, b) => a + b, 0);
|
|
18359
|
+
const scale = gridTotalWidth > 0 ? columnsWidthBudget / gridTotalWidth : 1;
|
|
18360
|
+
resolvedColumnWidths = table.gridCols.map((w) => w * scale);
|
|
18361
|
+
} else {
|
|
18362
|
+
const baseCellWidth = columnsWidthBudget / visualColumnCount;
|
|
18363
|
+
resolvedColumnWidths = Array(visualColumnCount).fill(baseCellWidth);
|
|
18364
|
+
for (const entry of tableEntries) {
|
|
18365
|
+
if (Math.max(1, entry.colSpan) !== 1) continue;
|
|
18366
|
+
const cell = (_a = table.rows[entry.rowIndex]) == null ? void 0 : _a.cells[entry.cellIndex];
|
|
18367
|
+
if (!cell) continue;
|
|
18368
|
+
const direction = ((_b = cell.style) == null ? void 0 : _b.textDirection) ?? ((_d = (_c = cell.blocks[0]) == null ? void 0 : _c.style) == null ? void 0 : _d.textDirection) ?? null;
|
|
18369
|
+
if (direction !== "tbRl" && direction !== "btLr" && direction !== "lrTbV" && direction !== "tbRlV")
|
|
18370
|
+
continue;
|
|
18371
|
+
let glyphWidth = 0;
|
|
18372
|
+
for (const block of cell.blocks) {
|
|
18373
|
+
if (block.type !== "paragraph") continue;
|
|
18374
|
+
glyphWidth = Math.max(glyphWidth, estimateStackedColumnWidth(block, state));
|
|
18375
|
+
}
|
|
18376
|
+
if (glyphWidth <= 0) continue;
|
|
18377
|
+
const padding = resolveCellPadding(cell);
|
|
18378
|
+
const needed = glyphWidth + padding.left + padding.right + resolveBorder(((_e = cell.style) == null ? void 0 : _e.borderLeft) ?? ((_f = cell.style) == null ? void 0 : _f.borderStart)).width + resolveBorder(((_g = cell.style) == null ? void 0 : _g.borderRight) ?? ((_h = cell.style) == null ? void 0 : _h.borderEnd)).width;
|
|
18379
|
+
const col = entry.visualColumnIndex;
|
|
18380
|
+
if (needed > (resolvedColumnWidths[col] ?? 0)) {
|
|
18381
|
+
resolvedColumnWidths[col] = needed;
|
|
18382
|
+
}
|
|
18383
|
+
}
|
|
18384
|
+
}
|
|
18385
|
+
const columnOffsets = [cellSpacingPx];
|
|
18386
|
+
for (let i = 0; i < resolvedColumnWidths.length; i++) {
|
|
18387
|
+
columnOffsets[i + 1] = columnOffsets[i] + resolvedColumnWidths[i] + cellSpacingPx;
|
|
18388
|
+
}
|
|
18389
|
+
const effectiveRowStyles = table.rows.map((row, rowIndex) => {
|
|
18390
|
+
const entry = tableEntries.find((candidate) => candidate.rowIndex === rowIndex);
|
|
18391
|
+
return entry ? resolveEffectiveTableCellFormatting({
|
|
18392
|
+
table: sourceTable,
|
|
18393
|
+
rowIndex,
|
|
18394
|
+
cellIndex: entry.cellIndex,
|
|
18395
|
+
visualColumnIndex: entry.visualColumnIndex,
|
|
18396
|
+
columnCount: visualColumnCount,
|
|
18397
|
+
styles: state.document.styles
|
|
18398
|
+
}).rowStyle : row.style;
|
|
18399
|
+
});
|
|
18400
|
+
const { prepared, unsupported } = prepareCells({
|
|
18401
|
+
table,
|
|
18402
|
+
sourceTable,
|
|
18403
|
+
tableEntries,
|
|
18404
|
+
columnOffsets,
|
|
18405
|
+
cellSpacingPx,
|
|
18406
|
+
visualColumnCount,
|
|
18407
|
+
effectiveRowStyles,
|
|
18408
|
+
state,
|
|
18409
|
+
pageIndex
|
|
18410
|
+
});
|
|
18411
|
+
const rowHeights = resolveRowHeights({
|
|
18412
|
+
prepared,
|
|
18413
|
+
table,
|
|
18414
|
+
effectiveRowStyles,
|
|
18415
|
+
estimatedHeight
|
|
18416
|
+
});
|
|
18417
|
+
const rowOffsets = buildRowOffsets(rowHeights, cellSpacingPx);
|
|
18418
|
+
const cells = assembleCellEntries({
|
|
18419
|
+
prepared,
|
|
18420
|
+
rowHeights,
|
|
18421
|
+
rowOffsets,
|
|
18422
|
+
columnOffsets,
|
|
18423
|
+
tableLeft,
|
|
18424
|
+
originY,
|
|
18425
|
+
cellSpacingPx,
|
|
18426
|
+
table
|
|
18427
|
+
});
|
|
18314
18428
|
return {
|
|
18315
18429
|
tableId: table.id,
|
|
18316
18430
|
left: tableLeft,
|
|
18317
18431
|
top: originY,
|
|
18318
18432
|
width: tableWidth,
|
|
18319
|
-
// Total height includes the leading/trailing/inter-row cell-spacing gaps.
|
|
18320
18433
|
height: rowHeights.reduce((sum, current) => sum + current, 0) + (rowHeights.length + 1) * cellSpacingPx,
|
|
18321
18434
|
rowHeights,
|
|
18322
18435
|
cells,
|
|
@@ -18332,16 +18445,6 @@ function PageBreak(props) {
|
|
|
18332
18445
|
return _el$;
|
|
18333
18446
|
})();
|
|
18334
18447
|
}
|
|
18335
|
-
const imageCache = /* @__PURE__ */ new Map();
|
|
18336
|
-
function getCachedCanvasImage(src, onUpdate) {
|
|
18337
|
-
const cached = imageCache.get(src);
|
|
18338
|
-
if (cached) return cached;
|
|
18339
|
-
const img = new Image();
|
|
18340
|
-
img.src = src;
|
|
18341
|
-
img.onload = onUpdate;
|
|
18342
|
-
imageCache.set(src, img);
|
|
18343
|
-
return img;
|
|
18344
|
-
}
|
|
18345
18448
|
const listLabelsCache = /* @__PURE__ */ new WeakMap();
|
|
18346
18449
|
function resolveListPrefix(paragraph, document2) {
|
|
18347
18450
|
let labels = listLabelsCache.get(document2);
|
|
@@ -19876,6 +19979,39 @@ function buildPresetPath(preset, x, y, width, height) {
|
|
|
19876
19979
|
}
|
|
19877
19980
|
return path;
|
|
19878
19981
|
}
|
|
19982
|
+
const DEG_TO_RAD$1 = Math.PI / 180;
|
|
19983
|
+
const CANVAS_DASH_DASHED = [5, 3];
|
|
19984
|
+
const CANVAS_DASH_DOTTED = [1, 3];
|
|
19985
|
+
function drawEdge(ctx, border, x1, y1, x2, y2) {
|
|
19986
|
+
if (!border || border.type === "none" || border.width <= 0) {
|
|
19987
|
+
return;
|
|
19988
|
+
}
|
|
19989
|
+
ctx.save();
|
|
19990
|
+
ctx.beginPath();
|
|
19991
|
+
ctx.strokeStyle = border.color;
|
|
19992
|
+
ctx.lineWidth = border.width;
|
|
19993
|
+
if (border.type === "dashed") {
|
|
19994
|
+
ctx.setLineDash(CANVAS_DASH_DASHED);
|
|
19995
|
+
} else if (border.type === "dotted") {
|
|
19996
|
+
ctx.setLineDash(CANVAS_DASH_DOTTED);
|
|
19997
|
+
} else {
|
|
19998
|
+
ctx.setLineDash([]);
|
|
19999
|
+
}
|
|
20000
|
+
ctx.moveTo(x1, y1);
|
|
20001
|
+
ctx.lineTo(x2, y2);
|
|
20002
|
+
ctx.stroke();
|
|
20003
|
+
ctx.restore();
|
|
20004
|
+
}
|
|
20005
|
+
function drawBorderBox(ctx, left, top, width, height, borders) {
|
|
20006
|
+
const right = left + width;
|
|
20007
|
+
const bottom = top + height;
|
|
20008
|
+
drawEdge(ctx, borders.top, left, top, right, top);
|
|
20009
|
+
drawEdge(ctx, borders.right, right, top, right, bottom);
|
|
20010
|
+
drawEdge(ctx, borders.bottom, left, bottom, right, bottom);
|
|
20011
|
+
drawEdge(ctx, borders.left, left, top, left, bottom);
|
|
20012
|
+
drawEdge(ctx, borders.topLeftToBottomRight, left, top, right, bottom);
|
|
20013
|
+
drawEdge(ctx, borders.topRightToBottomLeft, right, top, left, bottom);
|
|
20014
|
+
}
|
|
19879
20015
|
const TEXT_BOX_AUTOFIT_MEASURE_HEIGHT = 1e5;
|
|
19880
20016
|
const TEXT_BOX_AUTOFIT_SAFETY_PX = 2;
|
|
19881
20017
|
function getTextBoxPadding(textBox) {
|
|
@@ -20060,7 +20196,7 @@ function paintTextBox(ctx, textBox, state, x, y, width, height, pageIndex, onUpd
|
|
|
20060
20196
|
if (rotation) {
|
|
20061
20197
|
ctx.save();
|
|
20062
20198
|
ctx.translate(x + width / 2, y + height / 2);
|
|
20063
|
-
ctx.rotate(rotation *
|
|
20199
|
+
ctx.rotate(rotation * DEG_TO_RAD$1);
|
|
20064
20200
|
ctx.translate(-(x + width / 2), -(y + height / 2));
|
|
20065
20201
|
}
|
|
20066
20202
|
drawTextBoxShape(ctx, textBox, x, y, width, height);
|
|
@@ -20232,6 +20368,259 @@ function collectInlineTextBoxesFromLines(options) {
|
|
|
20232
20368
|
}
|
|
20233
20369
|
return inlineTextBoxes;
|
|
20234
20370
|
}
|
|
20371
|
+
const imageCache = /* @__PURE__ */ new Map();
|
|
20372
|
+
function getCachedCanvasImage(src, onUpdate) {
|
|
20373
|
+
const cached = imageCache.get(src);
|
|
20374
|
+
if (cached) return cached;
|
|
20375
|
+
const img = new Image();
|
|
20376
|
+
img.src = src;
|
|
20377
|
+
img.onload = onUpdate;
|
|
20378
|
+
imageCache.set(src, img);
|
|
20379
|
+
return img;
|
|
20380
|
+
}
|
|
20381
|
+
function resolveFragmentPaintBounds(line, fragment) {
|
|
20382
|
+
const slotByOffset = new Map(
|
|
20383
|
+
line.slots.map((slot) => [slot.offset, slot])
|
|
20384
|
+
);
|
|
20385
|
+
const slots = fragment.chars.filter((char) => char.char !== "\n").map((char) => slotByOffset.get(char.paragraphOffset)).filter((slot) => Boolean(slot));
|
|
20386
|
+
if (slots.length === 0) return null;
|
|
20387
|
+
const first = slots[0];
|
|
20388
|
+
const last = slots[slots.length - 1];
|
|
20389
|
+
const nextSlot = slotByOffset.get(last.offset + 1);
|
|
20390
|
+
if (nextSlot) {
|
|
20391
|
+
return { left: first.left, right: nextSlot.left };
|
|
20392
|
+
}
|
|
20393
|
+
const lastSlotIndex = line.slots.findIndex(
|
|
20394
|
+
(slot) => slot.offset === last.offset
|
|
20395
|
+
);
|
|
20396
|
+
const followingSlot = lastSlotIndex >= 0 ? line.slots[lastSlotIndex + 1] : void 0;
|
|
20397
|
+
return {
|
|
20398
|
+
left: first.left,
|
|
20399
|
+
right: (followingSlot == null ? void 0 : followingSlot.left) ?? last.left + Math.max(8, line.height * 0.45)
|
|
20400
|
+
};
|
|
20401
|
+
}
|
|
20402
|
+
function drawFragmentColorRect(ctx, line, fragment, originX, originY, color, alpha) {
|
|
20403
|
+
const bounds = resolveFragmentPaintBounds(line, fragment);
|
|
20404
|
+
if (!bounds) return;
|
|
20405
|
+
ctx.save();
|
|
20406
|
+
if (alpha !== void 0) ctx.globalAlpha = alpha;
|
|
20407
|
+
ctx.fillStyle = color;
|
|
20408
|
+
ctx.fillRect(
|
|
20409
|
+
originX + bounds.left,
|
|
20410
|
+
originY + line.top + 2,
|
|
20411
|
+
Math.max(0, bounds.right - bounds.left),
|
|
20412
|
+
Math.max(2, line.height - 4)
|
|
20413
|
+
);
|
|
20414
|
+
ctx.restore();
|
|
20415
|
+
}
|
|
20416
|
+
function drawFragmentHighlight(ctx, line, fragment, originX, originY, color) {
|
|
20417
|
+
drawFragmentColorRect(ctx, line, fragment, originX, originY, color, 0.35);
|
|
20418
|
+
}
|
|
20419
|
+
function drawFragmentShading(ctx, line, fragment, originX, originY, color) {
|
|
20420
|
+
drawFragmentColorRect(ctx, line, fragment, originX, originY, color);
|
|
20421
|
+
}
|
|
20422
|
+
function drawFragmentBorder(ctx, line, fragment, originX, originY, border) {
|
|
20423
|
+
if (border.type === "none" || border.width <= 0) return;
|
|
20424
|
+
const bounds = resolveFragmentPaintBounds(line, fragment);
|
|
20425
|
+
if (!bounds) return;
|
|
20426
|
+
const edge = { ...border, width: Math.max(0.5, border.width * PX_PER_POINT) };
|
|
20427
|
+
drawBorderBox(
|
|
20428
|
+
ctx,
|
|
20429
|
+
originX + bounds.left,
|
|
20430
|
+
originY + line.top + 1,
|
|
20431
|
+
Math.max(0, bounds.right - bounds.left),
|
|
20432
|
+
Math.max(2, line.height - 2),
|
|
20433
|
+
{ top: edge, right: edge, bottom: edge, left: edge }
|
|
20434
|
+
);
|
|
20435
|
+
}
|
|
20436
|
+
const HEX6_PATTERN = /^[0-9a-fA-F]{6}$/;
|
|
20437
|
+
function stripHashPrefix(color) {
|
|
20438
|
+
return color.trim().replace(/^#/, "");
|
|
20439
|
+
}
|
|
20440
|
+
function normalizeHex6(color) {
|
|
20441
|
+
if (!color) {
|
|
20442
|
+
return null;
|
|
20443
|
+
}
|
|
20444
|
+
const body = stripHashPrefix(color);
|
|
20445
|
+
return HEX6_PATTERN.test(body) ? body.toUpperCase() : null;
|
|
20446
|
+
}
|
|
20447
|
+
function parseHexColorToRgb255(color) {
|
|
20448
|
+
if (!color) {
|
|
20449
|
+
return null;
|
|
20450
|
+
}
|
|
20451
|
+
const normalized = stripHashPrefix(color);
|
|
20452
|
+
if (!HEX6_PATTERN.test(normalized)) {
|
|
20453
|
+
return null;
|
|
20454
|
+
}
|
|
20455
|
+
return [
|
|
20456
|
+
Number.parseInt(normalized.slice(0, 2), 16),
|
|
20457
|
+
Number.parseInt(normalized.slice(2, 4), 16),
|
|
20458
|
+
Number.parseInt(normalized.slice(4, 6), 16)
|
|
20459
|
+
];
|
|
20460
|
+
}
|
|
20461
|
+
function rgb255ToHex(r, g2, b) {
|
|
20462
|
+
const toHex2 = (value) => Math.max(0, Math.min(255, Math.round(value))).toString(16).padStart(2, "0");
|
|
20463
|
+
return `#${toHex2(r)}${toHex2(g2)}${toHex2(b)}`;
|
|
20464
|
+
}
|
|
20465
|
+
const DEG_TO_RAD = Math.PI / 180;
|
|
20466
|
+
function resolveGradientAxis(boxX0, boxY0, boxX1, boxY1, angleDeg) {
|
|
20467
|
+
const cx = (boxX0 + boxX1) / 2;
|
|
20468
|
+
const cy = (boxY0 + boxY1) / 2;
|
|
20469
|
+
const rad = angleDeg * DEG_TO_RAD;
|
|
20470
|
+
const dx = Math.cos(rad) * (boxX1 - boxX0) / 2;
|
|
20471
|
+
const dy = Math.sin(rad) * (boxY1 - boxY0) / 2;
|
|
20472
|
+
return { x0: cx - dx, y0: cy - dy, x1: cx + dx, y1: cy + dy };
|
|
20473
|
+
}
|
|
20474
|
+
function hexToRgba(color, alpha) {
|
|
20475
|
+
const [r, g2, b] = parseHexColorToRgb255(color) ?? [0, 0, 0];
|
|
20476
|
+
return `rgba(${r},${g2},${b},${alpha})`;
|
|
20477
|
+
}
|
|
20478
|
+
function resolveCanvasTextFill(ctx, styles, line, fragment, originX, originY) {
|
|
20479
|
+
const fill = styles.textFill;
|
|
20480
|
+
if (!fill) return styles.color ?? "#000000";
|
|
20481
|
+
if (fill.type === "solid") return fill.color;
|
|
20482
|
+
if (fill.stops.length < 2) return styles.color ?? "#000000";
|
|
20483
|
+
const bounds = resolveFragmentPaintBounds(line, fragment);
|
|
20484
|
+
if (!bounds) return fill.stops[0].color;
|
|
20485
|
+
const x0 = originX + bounds.left;
|
|
20486
|
+
const x1 = originX + bounds.right;
|
|
20487
|
+
const y0 = originY + line.top;
|
|
20488
|
+
const y1 = originY + line.top + line.height;
|
|
20489
|
+
const axis = resolveGradientAxis(x0, y0, x1, y1, fill.angle ?? 0);
|
|
20490
|
+
const gradient = ctx.createLinearGradient(axis.x0, axis.y0, axis.x1, axis.y1);
|
|
20491
|
+
for (const stop of fill.stops) {
|
|
20492
|
+
gradient.addColorStop(stop.position, hexToRgba(stop.color, stop.alpha ?? 1));
|
|
20493
|
+
}
|
|
20494
|
+
return gradient;
|
|
20495
|
+
}
|
|
20496
|
+
function drawScaledText(ctx, text, x, y, scale) {
|
|
20497
|
+
if (scale === 1) {
|
|
20498
|
+
ctx.fillText(text, x, y);
|
|
20499
|
+
return;
|
|
20500
|
+
}
|
|
20501
|
+
ctx.save();
|
|
20502
|
+
ctx.translate(x, y);
|
|
20503
|
+
ctx.scale(scale, 1);
|
|
20504
|
+
ctx.fillText(text, 0, 0);
|
|
20505
|
+
ctx.restore();
|
|
20506
|
+
}
|
|
20507
|
+
function drawStyledText(ctx, text, x, y, scale, styles) {
|
|
20508
|
+
const hasEffects = styles.outline || styles.shadow || styles.textShadow || styles.glow || styles.emboss || styles.imprint || styles.textOutline || styles.reflection;
|
|
20509
|
+
if (!hasEffects) {
|
|
20510
|
+
drawScaledText(ctx, text, x, y, scale);
|
|
20511
|
+
return;
|
|
20512
|
+
}
|
|
20513
|
+
if (styles.emboss || styles.imprint) {
|
|
20514
|
+
const offset = styles.imprint ? 1 : -1;
|
|
20515
|
+
ctx.save();
|
|
20516
|
+
ctx.shadowColor = "transparent";
|
|
20517
|
+
ctx.fillStyle = "rgba(255,255,255,0.75)";
|
|
20518
|
+
drawScaledText(ctx, text, x + offset, y + offset, scale);
|
|
20519
|
+
ctx.restore();
|
|
20520
|
+
}
|
|
20521
|
+
ctx.save();
|
|
20522
|
+
if (styles.textShadow) {
|
|
20523
|
+
const ts = styles.textShadow;
|
|
20524
|
+
const dirRad = ts.dirDeg * DEG_TO_RAD$1;
|
|
20525
|
+
const distPx = ts.distPt * PX_PER_POINT;
|
|
20526
|
+
ctx.shadowColor = hexToRgba(ts.color, ts.alpha ?? 1);
|
|
20527
|
+
ctx.shadowBlur = ts.blurPt * PX_PER_POINT;
|
|
20528
|
+
ctx.shadowOffsetX = Math.cos(dirRad) * distPx;
|
|
20529
|
+
ctx.shadowOffsetY = Math.sin(dirRad) * distPx;
|
|
20530
|
+
} else if (styles.glow) {
|
|
20531
|
+
const gl = styles.glow;
|
|
20532
|
+
ctx.shadowColor = hexToRgba(gl.color, gl.alpha ?? 0.7);
|
|
20533
|
+
ctx.shadowBlur = gl.radiusPt * PX_PER_POINT;
|
|
20534
|
+
ctx.shadowOffsetX = 0;
|
|
20535
|
+
ctx.shadowOffsetY = 0;
|
|
20536
|
+
} else if (styles.shadow) {
|
|
20537
|
+
ctx.shadowColor = "rgba(0,0,0,0.45)";
|
|
20538
|
+
ctx.shadowOffsetX = 1;
|
|
20539
|
+
ctx.shadowOffsetY = 1;
|
|
20540
|
+
ctx.shadowBlur = 1;
|
|
20541
|
+
}
|
|
20542
|
+
if (styles.textOutline) {
|
|
20543
|
+
ctx.strokeStyle = styles.textOutline.color ?? ctx.fillStyle;
|
|
20544
|
+
ctx.lineWidth = styles.textOutline.widthPt * PX_PER_POINT;
|
|
20545
|
+
drawScaledText(ctx, text, x, y, scale);
|
|
20546
|
+
if (scale === 1) {
|
|
20547
|
+
ctx.strokeText(text, x, y);
|
|
20548
|
+
} else {
|
|
20549
|
+
ctx.save();
|
|
20550
|
+
ctx.translate(x, y);
|
|
20551
|
+
ctx.scale(scale, 1);
|
|
20552
|
+
ctx.strokeText(text, 0, 0);
|
|
20553
|
+
ctx.restore();
|
|
20554
|
+
}
|
|
20555
|
+
} else if (styles.outline) {
|
|
20556
|
+
ctx.strokeStyle = ctx.fillStyle;
|
|
20557
|
+
ctx.lineWidth = 0.75;
|
|
20558
|
+
if (scale === 1) {
|
|
20559
|
+
ctx.strokeText(text, x, y);
|
|
20560
|
+
} else {
|
|
20561
|
+
ctx.translate(x, y);
|
|
20562
|
+
ctx.scale(scale, 1);
|
|
20563
|
+
ctx.strokeText(text, 0, 0);
|
|
20564
|
+
}
|
|
20565
|
+
} else {
|
|
20566
|
+
drawScaledText(ctx, text, x, y, scale);
|
|
20567
|
+
}
|
|
20568
|
+
ctx.restore();
|
|
20569
|
+
if (styles.reflection) {
|
|
20570
|
+
const ref = styles.reflection;
|
|
20571
|
+
const distPx = ref.distPt * PX_PER_POINT;
|
|
20572
|
+
const avgAlpha = Math.max(
|
|
20573
|
+
0,
|
|
20574
|
+
Math.min(1, (ref.startAlpha + ref.endAlpha) / 2)
|
|
20575
|
+
);
|
|
20576
|
+
ctx.save();
|
|
20577
|
+
ctx.shadowColor = "transparent";
|
|
20578
|
+
ctx.globalAlpha = avgAlpha;
|
|
20579
|
+
if (ref.blurPt > 0 && "filter" in ctx) {
|
|
20580
|
+
ctx.filter = `blur(${ref.blurPt * PX_PER_POINT}px)`;
|
|
20581
|
+
}
|
|
20582
|
+
ctx.translate(0, 2 * y + distPx);
|
|
20583
|
+
ctx.scale(1, -1);
|
|
20584
|
+
drawScaledText(ctx, text, x, y, scale);
|
|
20585
|
+
ctx.restore();
|
|
20586
|
+
}
|
|
20587
|
+
}
|
|
20588
|
+
function drawFragmentReflection(ctx, fragment, slotByOffset, styles, originX, baselineY, reflection) {
|
|
20589
|
+
const firstChar = fragment.chars.find(
|
|
20590
|
+
(c) => c.char !== "\n" && c.char !== " "
|
|
20591
|
+
);
|
|
20592
|
+
if (!firstChar) return;
|
|
20593
|
+
const firstSlot = slotByOffset.get(firstChar.paragraphOffset);
|
|
20594
|
+
if (!firstSlot) return;
|
|
20595
|
+
const text = fragment.chars.filter((c) => c.char !== "\n" && c.char !== " ").map((c) => styles.allCaps ? c.char.toUpperCase() : c.char).join("");
|
|
20596
|
+
if (!text) return;
|
|
20597
|
+
const scale = styles.characterScale && styles.characterScale > 0 ? styles.characterScale / 100 : 1;
|
|
20598
|
+
const avgAlpha = (reflection.startAlpha + reflection.endAlpha) / 2;
|
|
20599
|
+
const distPx = reflection.distPt * PX_PER_POINT;
|
|
20600
|
+
const reflectY = baselineY + distPx;
|
|
20601
|
+
ctx.save();
|
|
20602
|
+
ctx.globalAlpha = (ctx.globalAlpha ?? 1) * avgAlpha;
|
|
20603
|
+
ctx.shadowColor = "transparent";
|
|
20604
|
+
ctx.shadowBlur = 0;
|
|
20605
|
+
ctx.shadowOffsetX = 0;
|
|
20606
|
+
ctx.shadowOffsetY = 0;
|
|
20607
|
+
ctx.translate(0, 2 * reflectY);
|
|
20608
|
+
ctx.scale(1, -1);
|
|
20609
|
+
const x = originX + firstSlot.left;
|
|
20610
|
+
if (scale === 1) {
|
|
20611
|
+
ctx.fillText(text, x, baselineY);
|
|
20612
|
+
} else {
|
|
20613
|
+
ctx.save();
|
|
20614
|
+
ctx.translate(x, baselineY);
|
|
20615
|
+
ctx.scale(scale, 1);
|
|
20616
|
+
ctx.fillText(text, 0, 0);
|
|
20617
|
+
ctx.restore();
|
|
20618
|
+
}
|
|
20619
|
+
ctx.restore();
|
|
20620
|
+
}
|
|
20621
|
+
function getRenderedChar(char, styles) {
|
|
20622
|
+
return styles.allCaps ? char.toUpperCase() : char;
|
|
20623
|
+
}
|
|
20235
20624
|
function underlineStyleToCssDecorationStyle(underlineStyle) {
|
|
20236
20625
|
switch (underlineStyle) {
|
|
20237
20626
|
case "double":
|
|
@@ -20262,6 +20651,8 @@ function isDoubleUnderlineStyle(underlineStyle) {
|
|
|
20262
20651
|
function isWavyUnderlineStyle(underlineStyle) {
|
|
20263
20652
|
return underlineStyle === "wave" || underlineStyle === "wavyHeavy";
|
|
20264
20653
|
}
|
|
20654
|
+
const WAVY_UNDERLINE_AMPLITUDE_PX = 1.5;
|
|
20655
|
+
const WAVY_UNDERLINE_WAVELENGTH_PX = 4;
|
|
20265
20656
|
function underlineStyleLineWidthPx(underlineStyle) {
|
|
20266
20657
|
switch (underlineStyle) {
|
|
20267
20658
|
case "thick":
|
|
@@ -20306,6 +20697,12 @@ function resolveOpenTypeFeatureTags(style2, fontSizePt) {
|
|
|
20306
20697
|
}
|
|
20307
20698
|
return Array.from(tags).sort();
|
|
20308
20699
|
}
|
|
20700
|
+
const EMPHASIS_GLYPH = {
|
|
20701
|
+
dot: "•",
|
|
20702
|
+
comma: "‚",
|
|
20703
|
+
circle: "○",
|
|
20704
|
+
underDot: "•"
|
|
20705
|
+
};
|
|
20309
20706
|
function underlineStyleDashArray(underlineStyle) {
|
|
20310
20707
|
switch (underlineStyle) {
|
|
20311
20708
|
case "dotted":
|
|
@@ -20327,107 +20724,102 @@ function underlineStyleDashArray(underlineStyle) {
|
|
|
20327
20724
|
return void 0;
|
|
20328
20725
|
}
|
|
20329
20726
|
}
|
|
20330
|
-
const
|
|
20331
|
-
const
|
|
20332
|
-
function
|
|
20333
|
-
if (
|
|
20334
|
-
|
|
20335
|
-
|
|
20727
|
+
const DOUBLE_STRIKE_OFFSET_PX = 1.3;
|
|
20728
|
+
const DOUBLE_UNDERLINE_OFFSET_PX = 1.5;
|
|
20729
|
+
function resolveDecorationLineY(kind, lineTop, lineHeight) {
|
|
20730
|
+
if (kind === "underline") return lineTop + lineHeight - 2;
|
|
20731
|
+
if (kind === "doubleStrike") return lineTop + lineHeight * 0.5;
|
|
20732
|
+
return lineTop + lineHeight * 0.52;
|
|
20733
|
+
}
|
|
20734
|
+
function drawTextDecoration(ctx, line, fragment, originX, originY, kind, underlineStyle, underlineColor) {
|
|
20735
|
+
const bounds = resolveFragmentPaintBounds(line, fragment);
|
|
20736
|
+
if (!bounds) return;
|
|
20737
|
+
const y = originY + resolveDecorationLineY(kind, line.top, line.height);
|
|
20738
|
+
const x1 = originX + bounds.left;
|
|
20739
|
+
const x2 = originX + bounds.right;
|
|
20336
20740
|
ctx.save();
|
|
20337
|
-
ctx.
|
|
20338
|
-
|
|
20339
|
-
|
|
20340
|
-
if (
|
|
20341
|
-
ctx.
|
|
20342
|
-
|
|
20343
|
-
ctx.setLineDash(
|
|
20741
|
+
ctx.strokeStyle = underlineColor || ctx.fillStyle;
|
|
20742
|
+
if (kind === "underline") {
|
|
20743
|
+
drawUnderlineWithStyle(ctx, x1, x2, y, underlineStyle);
|
|
20744
|
+
} else if (kind === "doubleStrike") {
|
|
20745
|
+
ctx.beginPath();
|
|
20746
|
+
ctx.lineWidth = 1;
|
|
20747
|
+
ctx.setLineDash([]);
|
|
20748
|
+
ctx.moveTo(x1, y - DOUBLE_STRIKE_OFFSET_PX);
|
|
20749
|
+
ctx.lineTo(x2, y - DOUBLE_STRIKE_OFFSET_PX);
|
|
20750
|
+
ctx.moveTo(x1, y + DOUBLE_STRIKE_OFFSET_PX);
|
|
20751
|
+
ctx.lineTo(x2, y + DOUBLE_STRIKE_OFFSET_PX);
|
|
20752
|
+
ctx.stroke();
|
|
20344
20753
|
} else {
|
|
20754
|
+
ctx.beginPath();
|
|
20755
|
+
ctx.lineWidth = 1;
|
|
20345
20756
|
ctx.setLineDash([]);
|
|
20757
|
+
ctx.moveTo(x1, y);
|
|
20758
|
+
ctx.lineTo(x2, y);
|
|
20759
|
+
ctx.stroke();
|
|
20346
20760
|
}
|
|
20347
|
-
ctx.moveTo(x1, y1);
|
|
20348
|
-
ctx.lineTo(x2, y2);
|
|
20349
|
-
ctx.stroke();
|
|
20350
20761
|
ctx.restore();
|
|
20351
20762
|
}
|
|
20352
|
-
function
|
|
20353
|
-
|
|
20354
|
-
|
|
20355
|
-
|
|
20356
|
-
|
|
20357
|
-
|
|
20358
|
-
|
|
20359
|
-
|
|
20360
|
-
|
|
20361
|
-
|
|
20362
|
-
const DOUBLE_STRIKE_OFFSET_PX = 1.3;
|
|
20363
|
-
const DOUBLE_UNDERLINE_OFFSET_PX = 1.5;
|
|
20364
|
-
const WAVY_UNDERLINE_AMPLITUDE_PX = 1.5;
|
|
20365
|
-
const WAVY_UNDERLINE_WAVELENGTH_PX = 4;
|
|
20366
|
-
const canvasTextLogger = createEditorLogger("canvas-text");
|
|
20367
|
-
const loggedCanvasFontKeys = /* @__PURE__ */ new Set();
|
|
20368
|
-
const MAX_CANVAS_FONT_LOGS = 40;
|
|
20369
|
-
function logCanvasFontUse(options) {
|
|
20370
|
-
if (loggedCanvasFontKeys.size >= MAX_CANVAS_FONT_LOGS) {
|
|
20763
|
+
function drawUnderlineWithStyle(ctx, x1, x2, y, underlineStyle) {
|
|
20764
|
+
ctx.setLineDash([]);
|
|
20765
|
+
ctx.lineWidth = underlineStyleLineWidthPx(underlineStyle);
|
|
20766
|
+
if (isDoubleUnderlineStyle(underlineStyle)) {
|
|
20767
|
+
ctx.beginPath();
|
|
20768
|
+
ctx.moveTo(x1, y - DOUBLE_UNDERLINE_OFFSET_PX);
|
|
20769
|
+
ctx.lineTo(x2, y - DOUBLE_UNDERLINE_OFFSET_PX);
|
|
20770
|
+
ctx.moveTo(x1, y + DOUBLE_UNDERLINE_OFFSET_PX);
|
|
20771
|
+
ctx.lineTo(x2, y + DOUBLE_UNDERLINE_OFFSET_PX);
|
|
20772
|
+
ctx.stroke();
|
|
20371
20773
|
return;
|
|
20372
20774
|
}
|
|
20373
|
-
|
|
20374
|
-
|
|
20375
|
-
options.metricFamily,
|
|
20376
|
-
options.fontSize,
|
|
20377
|
-
options.bold,
|
|
20378
|
-
options.italic
|
|
20379
|
-
].join("|");
|
|
20380
|
-
if (loggedCanvasFontKeys.has(key)) {
|
|
20775
|
+
if (isWavyUnderlineStyle(underlineStyle)) {
|
|
20776
|
+
drawWavyLine(ctx, x1, x2, y);
|
|
20381
20777
|
return;
|
|
20382
20778
|
}
|
|
20383
|
-
|
|
20384
|
-
|
|
20385
|
-
|
|
20386
|
-
const fontCheck = typeof document !== "undefined" && document.fonts ? document.fonts.check(
|
|
20387
|
-
`${style2}${weight} ${options.fontSize}px "${options.metricFamily}"`
|
|
20388
|
-
) : "unavailable";
|
|
20389
|
-
canvasTextLogger.info("font:use", {
|
|
20390
|
-
...options,
|
|
20391
|
-
fontCheck,
|
|
20392
|
-
documentFontsStatus: typeof document !== "undefined" && document.fonts ? document.fonts.status : "unavailable"
|
|
20393
|
-
});
|
|
20394
|
-
}
|
|
20395
|
-
function resolveTabLeader(paragraph, line, tabLeft, state) {
|
|
20396
|
-
var _a;
|
|
20397
|
-
const paragraphStyle = resolveEffectiveParagraphStyle(
|
|
20398
|
-
paragraph.style,
|
|
20399
|
-
state.document.styles
|
|
20400
|
-
);
|
|
20401
|
-
const tabs = paragraphStyle.tabs ?? [];
|
|
20402
|
-
if (tabs.length === 0) {
|
|
20403
|
-
return void 0;
|
|
20779
|
+
const dashArray = underlineStyleDashArray(underlineStyle);
|
|
20780
|
+
if (dashArray) {
|
|
20781
|
+
ctx.setLineDash(dashArray);
|
|
20404
20782
|
}
|
|
20405
|
-
|
|
20406
|
-
|
|
20407
|
-
|
|
20408
|
-
|
|
20783
|
+
ctx.beginPath();
|
|
20784
|
+
ctx.moveTo(x1, y);
|
|
20785
|
+
ctx.lineTo(x2, y);
|
|
20786
|
+
ctx.stroke();
|
|
20787
|
+
ctx.setLineDash([]);
|
|
20409
20788
|
}
|
|
20410
|
-
function
|
|
20411
|
-
|
|
20412
|
-
|
|
20789
|
+
function drawWavyLine(ctx, x1, x2, y) {
|
|
20790
|
+
ctx.beginPath();
|
|
20791
|
+
ctx.moveTo(x1, y);
|
|
20792
|
+
for (let x = x1; x <= x2; x += 1) {
|
|
20793
|
+
const dy = Math.sin((x - x1) / WAVY_UNDERLINE_WAVELENGTH_PX * Math.PI) * WAVY_UNDERLINE_AMPLITUDE_PX;
|
|
20794
|
+
ctx.lineTo(x, y + dy);
|
|
20413
20795
|
}
|
|
20796
|
+
ctx.stroke();
|
|
20797
|
+
}
|
|
20798
|
+
function drawFragmentEmphasis(ctx, line, fragment, slotByOffset, originX, originY, mark, color) {
|
|
20799
|
+
if (mark === "none") return;
|
|
20800
|
+
const glyph = EMPHASIS_GLYPH[mark];
|
|
20801
|
+
if (!glyph) return;
|
|
20802
|
+
const below = mark === "underDot";
|
|
20803
|
+
const y = below ? originY + line.top + line.height + 1 : originY + line.top + 2;
|
|
20414
20804
|
ctx.save();
|
|
20415
|
-
ctx.
|
|
20416
|
-
ctx.
|
|
20417
|
-
|
|
20418
|
-
|
|
20419
|
-
|
|
20420
|
-
|
|
20421
|
-
|
|
20422
|
-
|
|
20805
|
+
ctx.fillStyle = color;
|
|
20806
|
+
ctx.textAlign = "center";
|
|
20807
|
+
ctx.textBaseline = below ? "top" : "bottom";
|
|
20808
|
+
ctx.font = `400 ${Math.max(6, line.height * 0.35)}px Calibri`;
|
|
20809
|
+
for (const char of fragment.chars) {
|
|
20810
|
+
if (char.char === "\n" || char.char === " " || char.char === " ") continue;
|
|
20811
|
+
const slot = slotByOffset.get(char.paragraphOffset);
|
|
20812
|
+
const nextSlot = slotByOffset.get(char.paragraphOffset + 1);
|
|
20813
|
+
if (!slot) continue;
|
|
20814
|
+
const centerX = nextSlot ? (slot.left + nextSlot.left) / 2 : slot.left + line.height * 0.25;
|
|
20815
|
+
ctx.fillText(glyph, originX + centerX, y);
|
|
20423
20816
|
}
|
|
20424
|
-
const leaderY = leader === "underscore" ? y + 2 : y;
|
|
20425
|
-
ctx.beginPath();
|
|
20426
|
-
ctx.moveTo(x1, leaderY);
|
|
20427
|
-
ctx.lineTo(x2, leaderY);
|
|
20428
|
-
ctx.stroke();
|
|
20429
20817
|
ctx.restore();
|
|
20430
20818
|
}
|
|
20819
|
+
function clamp01(value) {
|
|
20820
|
+
if (!Number.isFinite(value) || value < 0) return 0;
|
|
20821
|
+
return value > 1 ? 1 : value;
|
|
20822
|
+
}
|
|
20431
20823
|
function drawImageFragment(ctx, img, image, x, y) {
|
|
20432
20824
|
const { width, height, crop, fillMode, rotation, flipH, flipV } = image;
|
|
20433
20825
|
const hasTransform = Boolean(rotation) || Boolean(flipH) || Boolean(flipV);
|
|
@@ -20440,9 +20832,7 @@ function drawImageFragment(ctx, img, image, x, y) {
|
|
|
20440
20832
|
ctx.save();
|
|
20441
20833
|
if (hasTransform) {
|
|
20442
20834
|
ctx.translate(x + width / 2, y + height / 2);
|
|
20443
|
-
if (rotation)
|
|
20444
|
-
ctx.rotate(rotation * Math.PI / 180);
|
|
20445
|
-
}
|
|
20835
|
+
if (rotation) ctx.rotate(rotation * DEG_TO_RAD$1);
|
|
20446
20836
|
ctx.scale(flipH ? -1 : 1, flipV ? -1 : 1);
|
|
20447
20837
|
ctx.translate(-(x + width / 2), -(y + height / 2));
|
|
20448
20838
|
}
|
|
@@ -20474,19 +20864,11 @@ function drawImageFragment(ctx, img, image, x, y) {
|
|
|
20474
20864
|
}
|
|
20475
20865
|
ctx.save();
|
|
20476
20866
|
ctx.translate(x + width / 2, y + height / 2);
|
|
20477
|
-
if (rotation)
|
|
20478
|
-
ctx.rotate(rotation * Math.PI / 180);
|
|
20479
|
-
}
|
|
20867
|
+
if (rotation) ctx.rotate(rotation * DEG_TO_RAD$1);
|
|
20480
20868
|
ctx.scale(flipH ? -1 : 1, flipV ? -1 : 1);
|
|
20481
20869
|
ctx.drawImage(img, sx, sy, sw, sh, -width / 2, -height / 2, width, height);
|
|
20482
20870
|
ctx.restore();
|
|
20483
20871
|
}
|
|
20484
|
-
function clamp01(value) {
|
|
20485
|
-
if (!Number.isFinite(value) || value < 0) {
|
|
20486
|
-
return 0;
|
|
20487
|
-
}
|
|
20488
|
-
return value > 1 ? 1 : value;
|
|
20489
|
-
}
|
|
20490
20872
|
function drawFloatingImagesForParagraph(options) {
|
|
20491
20873
|
const {
|
|
20492
20874
|
ctx,
|
|
@@ -20506,13 +20888,9 @@ function drawFloatingImagesForParagraph(options) {
|
|
|
20506
20888
|
);
|
|
20507
20889
|
for (const fragment of line.fragments) {
|
|
20508
20890
|
const image = fragment.image;
|
|
20509
|
-
if (!(image == null ? void 0 : image.floating))
|
|
20510
|
-
continue;
|
|
20511
|
-
}
|
|
20891
|
+
if (!(image == null ? void 0 : image.floating)) continue;
|
|
20512
20892
|
const isBehind = Boolean(image.floating.behindDoc);
|
|
20513
|
-
if (layer === "behind" !== isBehind)
|
|
20514
|
-
continue;
|
|
20515
|
-
}
|
|
20893
|
+
if (layer === "behind" !== isBehind) continue;
|
|
20516
20894
|
const slot = slotByOffset.get(fragment.startOffset);
|
|
20517
20895
|
const anchorLeft = contentLeft + ((slot == null ? void 0 : slot.left) ?? 0);
|
|
20518
20896
|
const lineTop = paragraphTop + line.top;
|
|
@@ -20534,6 +20912,115 @@ function drawFloatingImagesForParagraph(options) {
|
|
|
20534
20912
|
}
|
|
20535
20913
|
}
|
|
20536
20914
|
}
|
|
20915
|
+
function resolveTabLeader(paragraph, line, tabLeft, state) {
|
|
20916
|
+
var _a;
|
|
20917
|
+
const paragraphStyle = resolveEffectiveParagraphStyle(
|
|
20918
|
+
paragraph.style,
|
|
20919
|
+
state.document.styles
|
|
20920
|
+
);
|
|
20921
|
+
const tabs = paragraphStyle.tabs ?? [];
|
|
20922
|
+
if (tabs.length === 0) return void 0;
|
|
20923
|
+
const lineStart = ((_a = line.slots[0]) == null ? void 0 : _a.left) ?? 0;
|
|
20924
|
+
const relativeLeft = tabLeft - lineStart;
|
|
20925
|
+
const stop = tabs.filter((tab) => tab.type !== "clear").map((tab) => ({ ...tab, positionPx: tab.position * PX_PER_POINT })).filter((tab) => tab.positionPx > relativeLeft + 0.01).sort((a, b) => a.positionPx - b.positionPx)[0];
|
|
20926
|
+
return (stop == null ? void 0 : stop.leader) && stop.leader !== "none" ? stop.leader : void 0;
|
|
20927
|
+
}
|
|
20928
|
+
function drawTabLeader(ctx, leader, x1, x2, y) {
|
|
20929
|
+
if (x2 <= x1 + 2) return;
|
|
20930
|
+
ctx.save();
|
|
20931
|
+
ctx.lineWidth = leader === "heavy" ? 1.5 : 1;
|
|
20932
|
+
ctx.strokeStyle = ctx.fillStyle;
|
|
20933
|
+
if (leader === "dot" || leader === "middleDot") {
|
|
20934
|
+
ctx.setLineDash(CANVAS_DASH_DOTTED);
|
|
20935
|
+
} else if (leader === "hyphen") {
|
|
20936
|
+
ctx.setLineDash(CANVAS_DASH_DASHED);
|
|
20937
|
+
} else {
|
|
20938
|
+
ctx.setLineDash([]);
|
|
20939
|
+
}
|
|
20940
|
+
const leaderY = leader === "underscore" ? y + 2 : y;
|
|
20941
|
+
ctx.beginPath();
|
|
20942
|
+
ctx.moveTo(x1, leaderY);
|
|
20943
|
+
ctx.lineTo(x2, leaderY);
|
|
20944
|
+
ctx.stroke();
|
|
20945
|
+
ctx.restore();
|
|
20946
|
+
}
|
|
20947
|
+
const canvasTextLogger = createEditorLogger("canvas-text");
|
|
20948
|
+
const loggedCanvasFontKeys = /* @__PURE__ */ new Set();
|
|
20949
|
+
const MAX_CANVAS_FONT_LOGS = 40;
|
|
20950
|
+
function logCanvasFontUse(options) {
|
|
20951
|
+
if (loggedCanvasFontKeys.size >= MAX_CANVAS_FONT_LOGS) return;
|
|
20952
|
+
const key = [
|
|
20953
|
+
options.requestedFamily ?? "",
|
|
20954
|
+
options.metricFamily,
|
|
20955
|
+
options.fontSize,
|
|
20956
|
+
options.bold,
|
|
20957
|
+
options.italic
|
|
20958
|
+
].join("|");
|
|
20959
|
+
if (loggedCanvasFontKeys.has(key)) return;
|
|
20960
|
+
loggedCanvasFontKeys.add(key);
|
|
20961
|
+
const style2 = options.italic ? "italic " : "";
|
|
20962
|
+
const weight = options.bold ? "700" : "400";
|
|
20963
|
+
const fontCheck = typeof document !== "undefined" && document.fonts ? document.fonts.check(
|
|
20964
|
+
`${style2}${weight} ${options.fontSize}px "${options.metricFamily}"`
|
|
20965
|
+
) : "unavailable";
|
|
20966
|
+
canvasTextLogger.info("font:use", {
|
|
20967
|
+
...options,
|
|
20968
|
+
fontCheck,
|
|
20969
|
+
documentFontsStatus: typeof document !== "undefined" && document.fonts ? document.fonts.status : "unavailable"
|
|
20970
|
+
});
|
|
20971
|
+
}
|
|
20972
|
+
function drawTextFragment(ctx, paragraph, line, fragment, slotByOffset, state, styles, originX, baselineY) {
|
|
20973
|
+
const scale = styles.characterScale && styles.characterScale > 0 ? styles.characterScale / 100 : 1;
|
|
20974
|
+
const hasManualCharacterSpacing = styles.characterSpacing !== void 0 && styles.characterSpacing !== null && styles.characterSpacing !== 0;
|
|
20975
|
+
let segmentText = "";
|
|
20976
|
+
let segmentLeft = null;
|
|
20977
|
+
const flushSegment = () => {
|
|
20978
|
+
if (!segmentText || segmentLeft === null) {
|
|
20979
|
+
segmentText = "";
|
|
20980
|
+
segmentLeft = null;
|
|
20981
|
+
return;
|
|
20982
|
+
}
|
|
20983
|
+
drawStyledText(ctx, segmentText, originX + segmentLeft, baselineY, scale, styles);
|
|
20984
|
+
segmentText = "";
|
|
20985
|
+
segmentLeft = null;
|
|
20986
|
+
};
|
|
20987
|
+
for (const char of fragment.chars) {
|
|
20988
|
+
if (char.char === "\n") {
|
|
20989
|
+
flushSegment();
|
|
20990
|
+
continue;
|
|
20991
|
+
}
|
|
20992
|
+
const slot = slotByOffset.get(char.paragraphOffset);
|
|
20993
|
+
if (!slot) {
|
|
20994
|
+
flushSegment();
|
|
20995
|
+
continue;
|
|
20996
|
+
}
|
|
20997
|
+
if (char.char === " ") {
|
|
20998
|
+
flushSegment();
|
|
20999
|
+
const nextSlot = slotByOffset.get(char.paragraphOffset + 1);
|
|
21000
|
+
const leader = resolveTabLeader(paragraph, line, slot.left, state);
|
|
21001
|
+
if (nextSlot && leader) {
|
|
21002
|
+
drawTabLeader(ctx, leader, originX + slot.left, originX + nextSlot.left, baselineY);
|
|
21003
|
+
}
|
|
21004
|
+
continue;
|
|
21005
|
+
}
|
|
21006
|
+
const renderedChar = getRenderedChar(char.char, styles);
|
|
21007
|
+
if (hasManualCharacterSpacing) {
|
|
21008
|
+
flushSegment();
|
|
21009
|
+
drawStyledText(ctx, renderedChar, originX + slot.left, baselineY, scale, styles);
|
|
21010
|
+
continue;
|
|
21011
|
+
}
|
|
21012
|
+
if (char.char === " ") {
|
|
21013
|
+
flushSegment();
|
|
21014
|
+
segmentLeft = slot.left;
|
|
21015
|
+
segmentText = renderedChar;
|
|
21016
|
+
flushSegment();
|
|
21017
|
+
continue;
|
|
21018
|
+
}
|
|
21019
|
+
if (segmentLeft === null) segmentLeft = slot.left;
|
|
21020
|
+
segmentText += renderedChar;
|
|
21021
|
+
}
|
|
21022
|
+
flushSegment();
|
|
21023
|
+
}
|
|
20537
21024
|
function drawParagraph(ctx, paragraph, lines, state, originX, originY, onUpdate, painters, pageIndex = 0) {
|
|
20538
21025
|
var _a, _b, _c, _d;
|
|
20539
21026
|
for (const line of lines) {
|
|
@@ -20573,9 +21060,7 @@ function drawParagraph(ctx, paragraph, lines, state, originX, originY, onUpdate,
|
|
|
20573
21060
|
(_c = paragraph.style) == null ? void 0 : _c.styleId,
|
|
20574
21061
|
state.document.styles
|
|
20575
21062
|
);
|
|
20576
|
-
if (styles.hidden)
|
|
20577
|
-
continue;
|
|
20578
|
-
}
|
|
21063
|
+
if (styles.hidden) continue;
|
|
20579
21064
|
const fontSize = styles.fontSize ?? DEFAULT_FONT_SIZE_PX;
|
|
20580
21065
|
const metricFamily = resolveMetricCompatibleFamily(
|
|
20581
21066
|
styles.fontFamily ?? "Calibri"
|
|
@@ -20593,43 +21078,15 @@ function drawParagraph(ctx, paragraph, lines, state, originX, originY, onUpdate,
|
|
|
20593
21078
|
italic: Boolean(styles.italic),
|
|
20594
21079
|
sample: fragment.text.slice(0, 80)
|
|
20595
21080
|
});
|
|
20596
|
-
ctx.fillStyle = resolveCanvasTextFill(
|
|
20597
|
-
ctx,
|
|
20598
|
-
styles,
|
|
20599
|
-
line,
|
|
20600
|
-
fragment,
|
|
20601
|
-
originX,
|
|
20602
|
-
originY
|
|
20603
|
-
);
|
|
21081
|
+
ctx.fillStyle = resolveCanvasTextFill(ctx, styles, line, fragment, originX, originY);
|
|
20604
21082
|
if (styles.shading) {
|
|
20605
|
-
drawFragmentShading(
|
|
20606
|
-
ctx,
|
|
20607
|
-
line,
|
|
20608
|
-
fragment,
|
|
20609
|
-
originX,
|
|
20610
|
-
originY,
|
|
20611
|
-
styles.shading
|
|
20612
|
-
);
|
|
21083
|
+
drawFragmentShading(ctx, line, fragment, originX, originY, styles.shading);
|
|
20613
21084
|
}
|
|
20614
21085
|
if (styles.highlight) {
|
|
20615
|
-
drawFragmentHighlight(
|
|
20616
|
-
ctx,
|
|
20617
|
-
line,
|
|
20618
|
-
fragment,
|
|
20619
|
-
originX,
|
|
20620
|
-
originY,
|
|
20621
|
-
styles.highlight
|
|
20622
|
-
);
|
|
21086
|
+
drawFragmentHighlight(ctx, line, fragment, originX, originY, styles.highlight);
|
|
20623
21087
|
}
|
|
20624
21088
|
if (styles.textBorder) {
|
|
20625
|
-
drawFragmentBorder(
|
|
20626
|
-
ctx,
|
|
20627
|
-
line,
|
|
20628
|
-
fragment,
|
|
20629
|
-
originX,
|
|
20630
|
-
originY,
|
|
20631
|
-
styles.textBorder
|
|
20632
|
-
);
|
|
21089
|
+
drawFragmentBorder(ctx, line, fragment, originX, originY, styles.textBorder);
|
|
20633
21090
|
}
|
|
20634
21091
|
if (fragment.image && !fragment.image.floating) {
|
|
20635
21092
|
const slot = slotByOffset.get(fragment.startOffset);
|
|
@@ -20716,14 +21173,7 @@ function drawParagraph(ctx, paragraph, lines, state, originX, originY, onUpdate,
|
|
|
20716
21173
|
drawTextDecoration(ctx, line, fragment, originX, originY, "strike");
|
|
20717
21174
|
}
|
|
20718
21175
|
if (styles.doubleStrike) {
|
|
20719
|
-
drawTextDecoration(
|
|
20720
|
-
ctx,
|
|
20721
|
-
line,
|
|
20722
|
-
fragment,
|
|
20723
|
-
originX,
|
|
20724
|
-
originY,
|
|
20725
|
-
"doubleStrike"
|
|
20726
|
-
);
|
|
21176
|
+
drawTextDecoration(ctx, line, fragment, originX, originY, "doubleStrike");
|
|
20727
21177
|
}
|
|
20728
21178
|
if (styles.emphasisMark) {
|
|
20729
21179
|
drawFragmentEmphasis(
|
|
@@ -20740,9 +21190,7 @@ function drawParagraph(ctx, paragraph, lines, state, originX, originY, onUpdate,
|
|
|
20740
21190
|
ctx.restore();
|
|
20741
21191
|
}
|
|
20742
21192
|
if (line.trailingHyphen) {
|
|
20743
|
-
const lastFragment = [...line.fragments].reverse().find(
|
|
20744
|
-
(fragment) => fragment.text && !fragment.image && !fragment.textBox
|
|
20745
|
-
);
|
|
21193
|
+
const lastFragment = [...line.fragments].reverse().find((f) => f.text && !f.image && !f.textBox);
|
|
20746
21194
|
const endSlot = slotByOffset.get(line.endOffset) ?? line.slots[line.slots.length - 1];
|
|
20747
21195
|
if (lastFragment && endSlot) {
|
|
20748
21196
|
const styles = resolveEffectiveTextStyleForParagraph(
|
|
@@ -20782,396 +21230,6 @@ function drawParagraph(ctx, paragraph, lines, state, originX, originY, onUpdate,
|
|
|
20782
21230
|
}
|
|
20783
21231
|
}
|
|
20784
21232
|
}
|
|
20785
|
-
function drawFragmentHighlight(ctx, line, fragment, originX, originY, color) {
|
|
20786
|
-
const bounds = resolveFragmentPaintBounds(line, fragment);
|
|
20787
|
-
if (!bounds) return;
|
|
20788
|
-
ctx.save();
|
|
20789
|
-
ctx.globalAlpha = 0.35;
|
|
20790
|
-
ctx.fillStyle = color;
|
|
20791
|
-
ctx.fillRect(
|
|
20792
|
-
originX + bounds.left,
|
|
20793
|
-
originY + line.top + 2,
|
|
20794
|
-
Math.max(0, bounds.right - bounds.left),
|
|
20795
|
-
Math.max(2, line.height - 4)
|
|
20796
|
-
);
|
|
20797
|
-
ctx.restore();
|
|
20798
|
-
}
|
|
20799
|
-
function resolveFragmentPaintBounds(line, fragment) {
|
|
20800
|
-
const slotByOffset = new Map(
|
|
20801
|
-
line.slots.map((slot) => [slot.offset, slot])
|
|
20802
|
-
);
|
|
20803
|
-
const slots = fragment.chars.filter((char) => char.char !== "\n").map((char) => slotByOffset.get(char.paragraphOffset)).filter((slot) => Boolean(slot));
|
|
20804
|
-
if (slots.length === 0) return null;
|
|
20805
|
-
const first = slots[0];
|
|
20806
|
-
const last = slots[slots.length - 1];
|
|
20807
|
-
const nextSlot = slotByOffset.get(last.offset + 1);
|
|
20808
|
-
if (nextSlot) {
|
|
20809
|
-
return { left: first.left, right: nextSlot.left };
|
|
20810
|
-
}
|
|
20811
|
-
const lastSlotIndex = line.slots.findIndex(
|
|
20812
|
-
(slot) => slot.offset === last.offset
|
|
20813
|
-
);
|
|
20814
|
-
const followingSlot = lastSlotIndex >= 0 ? line.slots[lastSlotIndex + 1] : void 0;
|
|
20815
|
-
return {
|
|
20816
|
-
left: first.left,
|
|
20817
|
-
right: (followingSlot == null ? void 0 : followingSlot.left) ?? last.left + Math.max(8, line.height * 0.45)
|
|
20818
|
-
};
|
|
20819
|
-
}
|
|
20820
|
-
function drawFragmentShading(ctx, line, fragment, originX, originY, color) {
|
|
20821
|
-
const bounds = resolveFragmentPaintBounds(line, fragment);
|
|
20822
|
-
if (!bounds) return;
|
|
20823
|
-
ctx.save();
|
|
20824
|
-
ctx.fillStyle = color;
|
|
20825
|
-
ctx.fillRect(
|
|
20826
|
-
originX + bounds.left,
|
|
20827
|
-
originY + line.top + 2,
|
|
20828
|
-
Math.max(0, bounds.right - bounds.left),
|
|
20829
|
-
Math.max(2, line.height - 4)
|
|
20830
|
-
);
|
|
20831
|
-
ctx.restore();
|
|
20832
|
-
}
|
|
20833
|
-
function getRenderedChar(char, styles) {
|
|
20834
|
-
return styles.allCaps ? char.toUpperCase() : char;
|
|
20835
|
-
}
|
|
20836
|
-
function drawScaledText(ctx, text, x, y, scale) {
|
|
20837
|
-
if (scale === 1) {
|
|
20838
|
-
ctx.fillText(text, x, y);
|
|
20839
|
-
return;
|
|
20840
|
-
}
|
|
20841
|
-
ctx.save();
|
|
20842
|
-
ctx.translate(x, y);
|
|
20843
|
-
ctx.scale(scale, 1);
|
|
20844
|
-
ctx.fillText(text, 0, 0);
|
|
20845
|
-
ctx.restore();
|
|
20846
|
-
}
|
|
20847
|
-
function resolveCanvasTextFill(ctx, styles, line, fragment, originX, originY) {
|
|
20848
|
-
const fill = styles.textFill;
|
|
20849
|
-
if (!fill) return styles.color ?? "#000000";
|
|
20850
|
-
if (fill.type === "solid") return fill.color;
|
|
20851
|
-
if (fill.stops.length < 2) return styles.color ?? "#000000";
|
|
20852
|
-
const bounds = resolveFragmentPaintBounds(line, fragment);
|
|
20853
|
-
if (!bounds) return fill.stops[0].color;
|
|
20854
|
-
const x0 = originX + bounds.left;
|
|
20855
|
-
const x1 = originX + bounds.right;
|
|
20856
|
-
const y0 = originY + line.top;
|
|
20857
|
-
const y1 = originY + line.top + line.height;
|
|
20858
|
-
const cx = (x0 + x1) / 2;
|
|
20859
|
-
const cy = (y0 + y1) / 2;
|
|
20860
|
-
const angleDeg = fill.angle ?? 0;
|
|
20861
|
-
const rad = angleDeg * Math.PI / 180;
|
|
20862
|
-
const dx = Math.cos(rad) * (x1 - x0) / 2;
|
|
20863
|
-
const dy = Math.sin(rad) * (y1 - y0) / 2;
|
|
20864
|
-
const gradient = ctx.createLinearGradient(cx - dx, cy - dy, cx + dx, cy + dy);
|
|
20865
|
-
for (const stop of fill.stops) {
|
|
20866
|
-
const alpha = stop.alpha ?? 1;
|
|
20867
|
-
const r = Number.parseInt(stop.color.slice(1, 3), 16);
|
|
20868
|
-
const g2 = Number.parseInt(stop.color.slice(3, 5), 16);
|
|
20869
|
-
const b = Number.parseInt(stop.color.slice(5, 7), 16);
|
|
20870
|
-
gradient.addColorStop(stop.position, `rgba(${r},${g2},${b},${alpha})`);
|
|
20871
|
-
}
|
|
20872
|
-
return gradient;
|
|
20873
|
-
}
|
|
20874
|
-
function drawStyledText(ctx, text, x, y, scale, styles) {
|
|
20875
|
-
const hasEffects = styles.outline || styles.shadow || styles.textShadow || styles.glow || styles.emboss || styles.imprint || styles.textOutline || styles.reflection;
|
|
20876
|
-
if (!hasEffects) {
|
|
20877
|
-
drawScaledText(ctx, text, x, y, scale);
|
|
20878
|
-
return;
|
|
20879
|
-
}
|
|
20880
|
-
if (styles.emboss || styles.imprint) {
|
|
20881
|
-
const offset = styles.imprint ? 1 : -1;
|
|
20882
|
-
ctx.save();
|
|
20883
|
-
ctx.shadowColor = "transparent";
|
|
20884
|
-
ctx.fillStyle = "rgba(255,255,255,0.75)";
|
|
20885
|
-
drawScaledText(ctx, text, x + offset, y + offset, scale);
|
|
20886
|
-
ctx.restore();
|
|
20887
|
-
}
|
|
20888
|
-
ctx.save();
|
|
20889
|
-
if (styles.textShadow) {
|
|
20890
|
-
const ts = styles.textShadow;
|
|
20891
|
-
const dirRad = ts.dirDeg * Math.PI / 180;
|
|
20892
|
-
const distPx = ts.distPt * PX_PER_POINT;
|
|
20893
|
-
const alpha = ts.alpha ?? 1;
|
|
20894
|
-
const r = Number.parseInt(ts.color.slice(1, 3), 16);
|
|
20895
|
-
const g2 = Number.parseInt(ts.color.slice(3, 5), 16);
|
|
20896
|
-
const b = Number.parseInt(ts.color.slice(5, 7), 16);
|
|
20897
|
-
ctx.shadowColor = `rgba(${r},${g2},${b},${alpha})`;
|
|
20898
|
-
ctx.shadowBlur = ts.blurPt * PX_PER_POINT;
|
|
20899
|
-
ctx.shadowOffsetX = Math.cos(dirRad) * distPx;
|
|
20900
|
-
ctx.shadowOffsetY = Math.sin(dirRad) * distPx;
|
|
20901
|
-
} else if (styles.glow) {
|
|
20902
|
-
const gl = styles.glow;
|
|
20903
|
-
const alpha = gl.alpha ?? 0.7;
|
|
20904
|
-
const r = Number.parseInt(gl.color.slice(1, 3), 16);
|
|
20905
|
-
const g2 = Number.parseInt(gl.color.slice(3, 5), 16);
|
|
20906
|
-
const b = Number.parseInt(gl.color.slice(5, 7), 16);
|
|
20907
|
-
ctx.shadowColor = `rgba(${r},${g2},${b},${alpha})`;
|
|
20908
|
-
ctx.shadowBlur = gl.radiusPt * PX_PER_POINT;
|
|
20909
|
-
ctx.shadowOffsetX = 0;
|
|
20910
|
-
ctx.shadowOffsetY = 0;
|
|
20911
|
-
} else if (styles.shadow) {
|
|
20912
|
-
ctx.shadowColor = "rgba(0,0,0,0.45)";
|
|
20913
|
-
ctx.shadowOffsetX = 1;
|
|
20914
|
-
ctx.shadowOffsetY = 1;
|
|
20915
|
-
ctx.shadowBlur = 1;
|
|
20916
|
-
}
|
|
20917
|
-
if (styles.textOutline) {
|
|
20918
|
-
ctx.strokeStyle = styles.textOutline.color ?? ctx.fillStyle;
|
|
20919
|
-
ctx.lineWidth = styles.textOutline.widthPt * PX_PER_POINT;
|
|
20920
|
-
drawScaledText(ctx, text, x, y, scale);
|
|
20921
|
-
if (scale === 1) {
|
|
20922
|
-
ctx.strokeText(text, x, y);
|
|
20923
|
-
} else {
|
|
20924
|
-
ctx.save();
|
|
20925
|
-
ctx.translate(x, y);
|
|
20926
|
-
ctx.scale(scale, 1);
|
|
20927
|
-
ctx.strokeText(text, 0, 0);
|
|
20928
|
-
ctx.restore();
|
|
20929
|
-
}
|
|
20930
|
-
} else if (styles.outline) {
|
|
20931
|
-
ctx.strokeStyle = ctx.fillStyle;
|
|
20932
|
-
ctx.lineWidth = 0.75;
|
|
20933
|
-
if (scale === 1) {
|
|
20934
|
-
ctx.strokeText(text, x, y);
|
|
20935
|
-
} else {
|
|
20936
|
-
ctx.translate(x, y);
|
|
20937
|
-
ctx.scale(scale, 1);
|
|
20938
|
-
ctx.strokeText(text, 0, 0);
|
|
20939
|
-
}
|
|
20940
|
-
} else {
|
|
20941
|
-
drawScaledText(ctx, text, x, y, scale);
|
|
20942
|
-
}
|
|
20943
|
-
ctx.restore();
|
|
20944
|
-
if (styles.reflection) {
|
|
20945
|
-
const ref = styles.reflection;
|
|
20946
|
-
const distPx = ref.distPt * PX_PER_POINT;
|
|
20947
|
-
const avgAlpha = Math.max(
|
|
20948
|
-
0,
|
|
20949
|
-
Math.min(1, (ref.startAlpha + ref.endAlpha) / 2)
|
|
20950
|
-
);
|
|
20951
|
-
ctx.save();
|
|
20952
|
-
ctx.shadowColor = "transparent";
|
|
20953
|
-
ctx.globalAlpha = avgAlpha;
|
|
20954
|
-
if (ref.blurPt > 0 && "filter" in ctx) {
|
|
20955
|
-
ctx.filter = `blur(${ref.blurPt * PX_PER_POINT}px)`;
|
|
20956
|
-
}
|
|
20957
|
-
ctx.translate(0, 2 * y + distPx);
|
|
20958
|
-
ctx.scale(1, -1);
|
|
20959
|
-
drawScaledText(ctx, text, x, y, scale);
|
|
20960
|
-
ctx.restore();
|
|
20961
|
-
}
|
|
20962
|
-
}
|
|
20963
|
-
function drawFragmentBorder(ctx, line, fragment, originX, originY, border) {
|
|
20964
|
-
if (border.type === "none" || border.width <= 0) return;
|
|
20965
|
-
const bounds = resolveFragmentPaintBounds(line, fragment);
|
|
20966
|
-
if (!bounds) return;
|
|
20967
|
-
const edge = { ...border, width: Math.max(0.5, border.width * PX_PER_POINT) };
|
|
20968
|
-
drawBorderBox(
|
|
20969
|
-
ctx,
|
|
20970
|
-
originX + bounds.left,
|
|
20971
|
-
originY + line.top + 1,
|
|
20972
|
-
Math.max(0, bounds.right - bounds.left),
|
|
20973
|
-
Math.max(2, line.height - 2),
|
|
20974
|
-
{ top: edge, right: edge, bottom: edge, left: edge }
|
|
20975
|
-
);
|
|
20976
|
-
}
|
|
20977
|
-
const EMPHASIS_GLYPH = {
|
|
20978
|
-
dot: "•",
|
|
20979
|
-
comma: "‚",
|
|
20980
|
-
circle: "○",
|
|
20981
|
-
underDot: "•"
|
|
20982
|
-
};
|
|
20983
|
-
function drawFragmentEmphasis(ctx, line, fragment, slotByOffset, originX, originY, mark, color) {
|
|
20984
|
-
if (mark === "none") return;
|
|
20985
|
-
const glyph = EMPHASIS_GLYPH[mark];
|
|
20986
|
-
if (!glyph) return;
|
|
20987
|
-
const below = mark === "underDot";
|
|
20988
|
-
const y = below ? originY + line.top + line.height + 1 : originY + line.top + 2;
|
|
20989
|
-
ctx.save();
|
|
20990
|
-
ctx.fillStyle = color;
|
|
20991
|
-
ctx.textAlign = "center";
|
|
20992
|
-
ctx.textBaseline = below ? "top" : "bottom";
|
|
20993
|
-
ctx.font = `400 ${Math.max(6, line.height * 0.35)}px Calibri`;
|
|
20994
|
-
for (const char of fragment.chars) {
|
|
20995
|
-
if (char.char === "\n" || char.char === " " || char.char === " ") continue;
|
|
20996
|
-
const slot = slotByOffset.get(char.paragraphOffset);
|
|
20997
|
-
const nextSlot = slotByOffset.get(char.paragraphOffset + 1);
|
|
20998
|
-
if (!slot) continue;
|
|
20999
|
-
const centerX = nextSlot ? (slot.left + nextSlot.left) / 2 : slot.left + line.height * 0.25;
|
|
21000
|
-
ctx.fillText(glyph, originX + centerX, y);
|
|
21001
|
-
}
|
|
21002
|
-
ctx.restore();
|
|
21003
|
-
}
|
|
21004
|
-
function drawTextFragment(ctx, paragraph, line, fragment, slotByOffset, state, styles, originX, baselineY) {
|
|
21005
|
-
const scale = styles.characterScale && styles.characterScale > 0 ? styles.characterScale / 100 : 1;
|
|
21006
|
-
const hasManualCharacterSpacing = styles.characterSpacing !== void 0 && styles.characterSpacing !== null && styles.characterSpacing !== 0;
|
|
21007
|
-
let segmentText = "";
|
|
21008
|
-
let segmentLeft = null;
|
|
21009
|
-
const flushSegment = () => {
|
|
21010
|
-
if (!segmentText || segmentLeft === null) {
|
|
21011
|
-
segmentText = "";
|
|
21012
|
-
segmentLeft = null;
|
|
21013
|
-
return;
|
|
21014
|
-
}
|
|
21015
|
-
drawStyledText(
|
|
21016
|
-
ctx,
|
|
21017
|
-
segmentText,
|
|
21018
|
-
originX + segmentLeft,
|
|
21019
|
-
baselineY,
|
|
21020
|
-
scale,
|
|
21021
|
-
styles
|
|
21022
|
-
);
|
|
21023
|
-
segmentText = "";
|
|
21024
|
-
segmentLeft = null;
|
|
21025
|
-
};
|
|
21026
|
-
for (const char of fragment.chars) {
|
|
21027
|
-
if (char.char === "\n") {
|
|
21028
|
-
flushSegment();
|
|
21029
|
-
continue;
|
|
21030
|
-
}
|
|
21031
|
-
const slot = slotByOffset.get(char.paragraphOffset);
|
|
21032
|
-
if (!slot) {
|
|
21033
|
-
flushSegment();
|
|
21034
|
-
continue;
|
|
21035
|
-
}
|
|
21036
|
-
if (char.char === " ") {
|
|
21037
|
-
flushSegment();
|
|
21038
|
-
const nextSlot = slotByOffset.get(char.paragraphOffset + 1);
|
|
21039
|
-
const leader = resolveTabLeader(paragraph, line, slot.left, state);
|
|
21040
|
-
if (nextSlot && leader) {
|
|
21041
|
-
drawTabLeader(
|
|
21042
|
-
ctx,
|
|
21043
|
-
leader,
|
|
21044
|
-
originX + slot.left,
|
|
21045
|
-
originX + nextSlot.left,
|
|
21046
|
-
baselineY
|
|
21047
|
-
);
|
|
21048
|
-
}
|
|
21049
|
-
continue;
|
|
21050
|
-
}
|
|
21051
|
-
const renderedChar = getRenderedChar(char.char, styles);
|
|
21052
|
-
if (hasManualCharacterSpacing) {
|
|
21053
|
-
flushSegment();
|
|
21054
|
-
drawStyledText(
|
|
21055
|
-
ctx,
|
|
21056
|
-
renderedChar,
|
|
21057
|
-
originX + slot.left,
|
|
21058
|
-
baselineY,
|
|
21059
|
-
scale,
|
|
21060
|
-
styles
|
|
21061
|
-
);
|
|
21062
|
-
continue;
|
|
21063
|
-
}
|
|
21064
|
-
if (char.char === " ") {
|
|
21065
|
-
flushSegment();
|
|
21066
|
-
segmentLeft = slot.left;
|
|
21067
|
-
segmentText = renderedChar;
|
|
21068
|
-
flushSegment();
|
|
21069
|
-
continue;
|
|
21070
|
-
}
|
|
21071
|
-
if (segmentLeft === null) {
|
|
21072
|
-
segmentLeft = slot.left;
|
|
21073
|
-
}
|
|
21074
|
-
segmentText += renderedChar;
|
|
21075
|
-
}
|
|
21076
|
-
flushSegment();
|
|
21077
|
-
}
|
|
21078
|
-
function drawFragmentReflection(ctx, fragment, slotByOffset, styles, originX, baselineY, reflection) {
|
|
21079
|
-
const firstChar = fragment.chars.find(
|
|
21080
|
-
(c) => c.char !== "\n" && c.char !== " "
|
|
21081
|
-
);
|
|
21082
|
-
if (!firstChar) return;
|
|
21083
|
-
const firstSlot = slotByOffset.get(firstChar.paragraphOffset);
|
|
21084
|
-
if (!firstSlot) return;
|
|
21085
|
-
const text = fragment.chars.filter((c) => c.char !== "\n" && c.char !== " ").map((c) => styles.allCaps ? c.char.toUpperCase() : c.char).join("");
|
|
21086
|
-
if (!text) return;
|
|
21087
|
-
const scale = styles.characterScale && styles.characterScale > 0 ? styles.characterScale / 100 : 1;
|
|
21088
|
-
const avgAlpha = (reflection.startAlpha + reflection.endAlpha) / 2;
|
|
21089
|
-
const distPx = reflection.distPt * PX_PER_POINT;
|
|
21090
|
-
const reflectY = baselineY + distPx;
|
|
21091
|
-
ctx.save();
|
|
21092
|
-
ctx.globalAlpha = (ctx.globalAlpha ?? 1) * avgAlpha;
|
|
21093
|
-
ctx.shadowColor = "transparent";
|
|
21094
|
-
ctx.shadowBlur = 0;
|
|
21095
|
-
ctx.shadowOffsetX = 0;
|
|
21096
|
-
ctx.shadowOffsetY = 0;
|
|
21097
|
-
ctx.translate(0, 2 * reflectY);
|
|
21098
|
-
ctx.scale(1, -1);
|
|
21099
|
-
const x = originX + firstSlot.left;
|
|
21100
|
-
if (scale === 1) {
|
|
21101
|
-
ctx.fillText(text, x, baselineY);
|
|
21102
|
-
} else {
|
|
21103
|
-
ctx.save();
|
|
21104
|
-
ctx.translate(x, baselineY);
|
|
21105
|
-
ctx.scale(scale, 1);
|
|
21106
|
-
ctx.fillText(text, 0, 0);
|
|
21107
|
-
ctx.restore();
|
|
21108
|
-
}
|
|
21109
|
-
ctx.restore();
|
|
21110
|
-
}
|
|
21111
|
-
function drawTextDecoration(ctx, line, fragment, originX, originY, kind, underlineStyle, underlineColor) {
|
|
21112
|
-
const bounds = resolveFragmentPaintBounds(line, fragment);
|
|
21113
|
-
if (!bounds) return;
|
|
21114
|
-
const y = kind === "underline" ? originY + line.top + line.height - 2 : kind === "doubleStrike" ? originY + line.top + line.height * 0.5 : originY + line.top + line.height * 0.52;
|
|
21115
|
-
const x1 = originX + bounds.left;
|
|
21116
|
-
const x2 = originX + bounds.right;
|
|
21117
|
-
ctx.save();
|
|
21118
|
-
ctx.strokeStyle = underlineColor || ctx.fillStyle;
|
|
21119
|
-
if (kind === "underline") {
|
|
21120
|
-
drawUnderlineWithStyle(ctx, x1, x2, y, underlineStyle);
|
|
21121
|
-
} else if (kind === "doubleStrike") {
|
|
21122
|
-
ctx.beginPath();
|
|
21123
|
-
ctx.lineWidth = 1;
|
|
21124
|
-
ctx.setLineDash([]);
|
|
21125
|
-
ctx.moveTo(x1, y - DOUBLE_STRIKE_OFFSET_PX);
|
|
21126
|
-
ctx.lineTo(x2, y - DOUBLE_STRIKE_OFFSET_PX);
|
|
21127
|
-
ctx.moveTo(x1, y + DOUBLE_STRIKE_OFFSET_PX);
|
|
21128
|
-
ctx.lineTo(x2, y + DOUBLE_STRIKE_OFFSET_PX);
|
|
21129
|
-
ctx.stroke();
|
|
21130
|
-
} else {
|
|
21131
|
-
ctx.beginPath();
|
|
21132
|
-
ctx.lineWidth = 1;
|
|
21133
|
-
ctx.setLineDash([]);
|
|
21134
|
-
ctx.moveTo(x1, y);
|
|
21135
|
-
ctx.lineTo(x2, y);
|
|
21136
|
-
ctx.stroke();
|
|
21137
|
-
}
|
|
21138
|
-
ctx.restore();
|
|
21139
|
-
}
|
|
21140
|
-
function drawUnderlineWithStyle(ctx, x1, x2, y, underlineStyle) {
|
|
21141
|
-
ctx.setLineDash([]);
|
|
21142
|
-
ctx.lineWidth = underlineStyleLineWidthPx(underlineStyle);
|
|
21143
|
-
if (isDoubleUnderlineStyle(underlineStyle)) {
|
|
21144
|
-
ctx.beginPath();
|
|
21145
|
-
ctx.moveTo(x1, y - DOUBLE_UNDERLINE_OFFSET_PX);
|
|
21146
|
-
ctx.lineTo(x2, y - DOUBLE_UNDERLINE_OFFSET_PX);
|
|
21147
|
-
ctx.moveTo(x1, y + DOUBLE_UNDERLINE_OFFSET_PX);
|
|
21148
|
-
ctx.lineTo(x2, y + DOUBLE_UNDERLINE_OFFSET_PX);
|
|
21149
|
-
ctx.stroke();
|
|
21150
|
-
return;
|
|
21151
|
-
}
|
|
21152
|
-
if (isWavyUnderlineStyle(underlineStyle)) {
|
|
21153
|
-
drawWavyLine(ctx, x1, x2, y);
|
|
21154
|
-
return;
|
|
21155
|
-
}
|
|
21156
|
-
const dashArray = underlineStyleDashArray(underlineStyle);
|
|
21157
|
-
if (dashArray) {
|
|
21158
|
-
ctx.setLineDash(dashArray);
|
|
21159
|
-
}
|
|
21160
|
-
ctx.beginPath();
|
|
21161
|
-
ctx.moveTo(x1, y);
|
|
21162
|
-
ctx.lineTo(x2, y);
|
|
21163
|
-
ctx.stroke();
|
|
21164
|
-
ctx.setLineDash([]);
|
|
21165
|
-
}
|
|
21166
|
-
function drawWavyLine(ctx, x1, x2, y) {
|
|
21167
|
-
ctx.beginPath();
|
|
21168
|
-
ctx.moveTo(x1, y);
|
|
21169
|
-
for (let x = x1; x <= x2; x += 1) {
|
|
21170
|
-
const dy = Math.sin((x - x1) / WAVY_UNDERLINE_WAVELENGTH_PX * Math.PI) * WAVY_UNDERLINE_AMPLITUDE_PX;
|
|
21171
|
-
ctx.lineTo(x, y + dy);
|
|
21172
|
-
}
|
|
21173
|
-
ctx.stroke();
|
|
21174
|
-
}
|
|
21175
21233
|
const __vite_import_meta_env__ = { "DEV": false };
|
|
21176
21234
|
function drawVerticalCell(ctx, cell, state, pageIndex, onUpdate, painters) {
|
|
21177
21235
|
const box = {
|
|
@@ -34429,35 +34487,6 @@ function applyDocGridLinePitch(blocks, linePitchPx, mode, docGridType, settings)
|
|
|
34429
34487
|
}
|
|
34430
34488
|
}
|
|
34431
34489
|
}
|
|
34432
|
-
const HEX6_PATTERN = /^[0-9a-fA-F]{6}$/;
|
|
34433
|
-
function stripHashPrefix(color) {
|
|
34434
|
-
return color.trim().replace(/^#/, "");
|
|
34435
|
-
}
|
|
34436
|
-
function normalizeHex6(color) {
|
|
34437
|
-
if (!color) {
|
|
34438
|
-
return null;
|
|
34439
|
-
}
|
|
34440
|
-
const body = stripHashPrefix(color);
|
|
34441
|
-
return HEX6_PATTERN.test(body) ? body.toUpperCase() : null;
|
|
34442
|
-
}
|
|
34443
|
-
function parseHexColorToRgb255(color) {
|
|
34444
|
-
if (!color) {
|
|
34445
|
-
return null;
|
|
34446
|
-
}
|
|
34447
|
-
const normalized = stripHashPrefix(color);
|
|
34448
|
-
if (!HEX6_PATTERN.test(normalized)) {
|
|
34449
|
-
return null;
|
|
34450
|
-
}
|
|
34451
|
-
return [
|
|
34452
|
-
Number.parseInt(normalized.slice(0, 2), 16),
|
|
34453
|
-
Number.parseInt(normalized.slice(2, 4), 16),
|
|
34454
|
-
Number.parseInt(normalized.slice(4, 6), 16)
|
|
34455
|
-
];
|
|
34456
|
-
}
|
|
34457
|
-
function rgb255ToHex(r, g2, b) {
|
|
34458
|
-
const toHex2 = (value) => Math.max(0, Math.min(255, Math.round(value))).toString(16).padStart(2, "0");
|
|
34459
|
-
return `#${toHex2(r)}${toHex2(g2)}${toHex2(b)}`;
|
|
34460
|
-
}
|
|
34461
34490
|
const VML_FRACTION_DENOMINATOR = 65536;
|
|
34462
34491
|
function emuToPx(value) {
|
|
34463
34492
|
const emu = parseOptionalInt$1(value);
|
|
@@ -36782,41 +36811,15 @@ async function importDocxToEditorDocument(buffer, options = {}) {
|
|
|
36782
36811
|
);
|
|
36783
36812
|
const hasAssets = Object.keys(assets.assets).length > 0;
|
|
36784
36813
|
const finalize = (doc2) => {
|
|
36785
|
-
|
|
36786
|
-
|
|
36787
|
-
|
|
36788
|
-
|
|
36789
|
-
|
|
36790
|
-
|
|
36791
|
-
if (docSettings.
|
|
36792
|
-
|
|
36793
|
-
|
|
36794
|
-
allowSpaceOfSameStyleInTable: true
|
|
36795
|
-
};
|
|
36796
|
-
}
|
|
36797
|
-
if (docSettings.autoHyphenation) {
|
|
36798
|
-
doc2.settings = {
|
|
36799
|
-
...doc2.settings ?? {},
|
|
36800
|
-
autoHyphenation: true
|
|
36801
|
-
};
|
|
36802
|
-
}
|
|
36803
|
-
if (docSettings.doNotHyphenateCaps) {
|
|
36804
|
-
doc2.settings = {
|
|
36805
|
-
...doc2.settings ?? {},
|
|
36806
|
-
doNotHyphenateCaps: true
|
|
36807
|
-
};
|
|
36808
|
-
}
|
|
36809
|
-
if (docSettings.consecutiveHyphenLimit !== void 0) {
|
|
36810
|
-
doc2.settings = {
|
|
36811
|
-
...doc2.settings ?? {},
|
|
36812
|
-
consecutiveHyphenLimit: docSettings.consecutiveHyphenLimit
|
|
36813
|
-
};
|
|
36814
|
-
}
|
|
36815
|
-
if (docSettings.hyphenationZone !== void 0) {
|
|
36816
|
-
doc2.settings = {
|
|
36817
|
-
...doc2.settings ?? {},
|
|
36818
|
-
hyphenationZone: docSettings.hyphenationZone
|
|
36819
|
-
};
|
|
36814
|
+
const settingsPatch = {};
|
|
36815
|
+
if (docSettings.defaultTabStop !== void 0) settingsPatch.defaultTabStop = docSettings.defaultTabStop;
|
|
36816
|
+
if (docSettings.allowSpaceOfSameStyleInTable) settingsPatch.allowSpaceOfSameStyleInTable = true;
|
|
36817
|
+
if (docSettings.autoHyphenation) settingsPatch.autoHyphenation = true;
|
|
36818
|
+
if (docSettings.doNotHyphenateCaps) settingsPatch.doNotHyphenateCaps = true;
|
|
36819
|
+
if (docSettings.consecutiveHyphenLimit !== void 0) settingsPatch.consecutiveHyphenLimit = docSettings.consecutiveHyphenLimit;
|
|
36820
|
+
if (docSettings.hyphenationZone !== void 0) settingsPatch.hyphenationZone = docSettings.hyphenationZone;
|
|
36821
|
+
if (Object.keys(settingsPatch).length > 0) {
|
|
36822
|
+
doc2.settings = { ...doc2.settings ?? {}, ...settingsPatch };
|
|
36820
36823
|
}
|
|
36821
36824
|
if (fontTable) {
|
|
36822
36825
|
doc2.fontTable = fontTable;
|
|
@@ -36904,8 +36907,19 @@ function buildEditorComments(ranges, bodies) {
|
|
|
36904
36907
|
}
|
|
36905
36908
|
return order.length > 0 ? { items, order } : void 0;
|
|
36906
36909
|
}
|
|
36907
|
-
function
|
|
36910
|
+
function walkSectionBlocks(sections, visit) {
|
|
36908
36911
|
var _a, _b, _c, _d, _e, _f;
|
|
36912
|
+
for (const section of sections) {
|
|
36913
|
+
section.blocks.forEach(visit);
|
|
36914
|
+
(_a = section.header) == null ? void 0 : _a.forEach(visit);
|
|
36915
|
+
(_b = section.firstPageHeader) == null ? void 0 : _b.forEach(visit);
|
|
36916
|
+
(_c = section.evenPageHeader) == null ? void 0 : _c.forEach(visit);
|
|
36917
|
+
(_d = section.footer) == null ? void 0 : _d.forEach(visit);
|
|
36918
|
+
(_e = section.firstPageFooter) == null ? void 0 : _e.forEach(visit);
|
|
36919
|
+
(_f = section.evenPageFooter) == null ? void 0 : _f.forEach(visit);
|
|
36920
|
+
}
|
|
36921
|
+
}
|
|
36922
|
+
function remapImportedFootnoteRefsInSections(sections, byDocxId) {
|
|
36909
36923
|
const remapBlock = (block) => {
|
|
36910
36924
|
if (block.type === "paragraph") {
|
|
36911
36925
|
block.runs.forEach((run, index) => {
|
|
@@ -36939,18 +36953,9 @@ function remapImportedFootnoteRefsInSections(sections, byDocxId) {
|
|
|
36939
36953
|
}
|
|
36940
36954
|
}
|
|
36941
36955
|
};
|
|
36942
|
-
|
|
36943
|
-
section.blocks.forEach(remapBlock);
|
|
36944
|
-
(_a = section.header) == null ? void 0 : _a.forEach(remapBlock);
|
|
36945
|
-
(_b = section.firstPageHeader) == null ? void 0 : _b.forEach(remapBlock);
|
|
36946
|
-
(_c = section.evenPageHeader) == null ? void 0 : _c.forEach(remapBlock);
|
|
36947
|
-
(_d = section.footer) == null ? void 0 : _d.forEach(remapBlock);
|
|
36948
|
-
(_e = section.firstPageFooter) == null ? void 0 : _e.forEach(remapBlock);
|
|
36949
|
-
(_f = section.evenPageFooter) == null ? void 0 : _f.forEach(remapBlock);
|
|
36950
|
-
}
|
|
36956
|
+
walkSectionBlocks(sections, remapBlock);
|
|
36951
36957
|
}
|
|
36952
36958
|
function remapImportedEndnoteRefsInSections(sections, byDocxId) {
|
|
36953
|
-
var _a, _b, _c, _d, _e, _f;
|
|
36954
36959
|
const remapBlock = (block) => {
|
|
36955
36960
|
if (block.type === "paragraph") {
|
|
36956
36961
|
block.runs.forEach((run, index) => {
|
|
@@ -36984,15 +36989,7 @@ function remapImportedEndnoteRefsInSections(sections, byDocxId) {
|
|
|
36984
36989
|
}
|
|
36985
36990
|
}
|
|
36986
36991
|
};
|
|
36987
|
-
|
|
36988
|
-
section.blocks.forEach(remapBlock);
|
|
36989
|
-
(_a = section.header) == null ? void 0 : _a.forEach(remapBlock);
|
|
36990
|
-
(_b = section.firstPageHeader) == null ? void 0 : _b.forEach(remapBlock);
|
|
36991
|
-
(_c = section.evenPageHeader) == null ? void 0 : _c.forEach(remapBlock);
|
|
36992
|
-
(_d = section.footer) == null ? void 0 : _d.forEach(remapBlock);
|
|
36993
|
-
(_e = section.firstPageFooter) == null ? void 0 : _e.forEach(remapBlock);
|
|
36994
|
-
(_f = section.evenPageFooter) == null ? void 0 : _f.forEach(remapBlock);
|
|
36995
|
-
}
|
|
36992
|
+
walkSectionBlocks(sections, remapBlock);
|
|
36996
36993
|
}
|
|
36997
36994
|
let nextRequestId = 1;
|
|
36998
36995
|
function canUseDocxWorker() {
|
|
@@ -37008,7 +37005,7 @@ function importDocxInWorker(buffer, options = {}) {
|
|
|
37008
37005
|
const worker = new Worker(
|
|
37009
37006
|
new URL(
|
|
37010
37007
|
/* @vite-ignore */
|
|
37011
|
-
"" + new URL("assets/importDocxWorker-
|
|
37008
|
+
"" + new URL("assets/importDocxWorker-D0F0jbcF.js", import.meta.url).href,
|
|
37012
37009
|
import.meta.url
|
|
37013
37010
|
),
|
|
37014
37011
|
{
|
|
@@ -42666,7 +42663,7 @@ export {
|
|
|
42666
42663
|
resolveImageSrc as Z,
|
|
42667
42664
|
listKindForTag as _,
|
|
42668
42665
|
getPageContentWidth as a,
|
|
42669
|
-
|
|
42666
|
+
resolveFloatingObjectRect as a$,
|
|
42670
42667
|
collectInlineRuns as a0,
|
|
42671
42668
|
parseParagraphStyle as a1,
|
|
42672
42669
|
getRunImage as a2,
|
|
@@ -42677,33 +42674,33 @@ export {
|
|
|
42677
42674
|
getCaretRectFromSnapshot as a7,
|
|
42678
42675
|
getParagraphRectFromSnapshot as a8,
|
|
42679
42676
|
createComponent as a9,
|
|
42680
|
-
|
|
42681
|
-
|
|
42682
|
-
|
|
42683
|
-
|
|
42684
|
-
|
|
42685
|
-
|
|
42686
|
-
|
|
42687
|
-
|
|
42688
|
-
|
|
42689
|
-
|
|
42690
|
-
|
|
42691
|
-
|
|
42692
|
-
|
|
42693
|
-
|
|
42694
|
-
|
|
42695
|
-
|
|
42696
|
-
|
|
42697
|
-
|
|
42698
|
-
|
|
42699
|
-
|
|
42700
|
-
|
|
42701
|
-
|
|
42702
|
-
|
|
42703
|
-
|
|
42704
|
-
|
|
42705
|
-
|
|
42706
|
-
|
|
42677
|
+
setPreciseFontPreference as aA,
|
|
42678
|
+
setWelcomeSeen as aB,
|
|
42679
|
+
enablePreciseFontMode as aC,
|
|
42680
|
+
TWIPS_PER_POINT as aD,
|
|
42681
|
+
PX_PER_INCH as aE,
|
|
42682
|
+
TWIPS_PER_INCH as aF,
|
|
42683
|
+
normalizeHex6 as aG,
|
|
42684
|
+
TABLE_CONDITIONAL_FLAG_ATTRIBUTES as aH,
|
|
42685
|
+
TABLE_BORDER_EDGE_KEYS as aI,
|
|
42686
|
+
resolveEffectiveParagraphStyle as aJ,
|
|
42687
|
+
resolveEffectiveTextStyleForParagraph as aK,
|
|
42688
|
+
EMU_PER_PT as aL,
|
|
42689
|
+
OOXML_ROTATION_UNITS as aM,
|
|
42690
|
+
OOXML_PERCENT_DENOMINATOR as aN,
|
|
42691
|
+
parseHexColorToRgb255 as aO,
|
|
42692
|
+
EMU_PER_PX as aP,
|
|
42693
|
+
getRunFootnoteReference as aQ,
|
|
42694
|
+
getRunEndnoteReference as aR,
|
|
42695
|
+
iterateFootnoteReferenceRuns as aS,
|
|
42696
|
+
iterateEndnoteReferenceRuns as aT,
|
|
42697
|
+
imageContentTypeDefaults as aU,
|
|
42698
|
+
getRunFieldChar as aV,
|
|
42699
|
+
getRunFieldInstruction as aW,
|
|
42700
|
+
createEditorRun as aX,
|
|
42701
|
+
JSZip as aY,
|
|
42702
|
+
imageExtensionFromMime as aZ,
|
|
42703
|
+
pxToPt as a_,
|
|
42707
42704
|
CaretOverlay as aa,
|
|
42708
42705
|
Show as ab,
|
|
42709
42706
|
createRenderEffect as ac,
|
|
@@ -42723,144 +42720,153 @@ export {
|
|
|
42723
42720
|
For as aq,
|
|
42724
42721
|
UNDERLINE_STYLE_OPTIONS as ar,
|
|
42725
42722
|
Tabs as as,
|
|
42726
|
-
|
|
42727
|
-
|
|
42728
|
-
|
|
42729
|
-
|
|
42730
|
-
|
|
42731
|
-
|
|
42732
|
-
|
|
42723
|
+
createStore as at,
|
|
42724
|
+
reconcile as au,
|
|
42725
|
+
onMount as av,
|
|
42726
|
+
onCleanup as aw,
|
|
42727
|
+
PluginUiHost as ax,
|
|
42728
|
+
OasisEditorEditor as ay,
|
|
42729
|
+
OasisBrandMark as az,
|
|
42733
42730
|
getPageBodyTop as b,
|
|
42734
|
-
|
|
42735
|
-
|
|
42736
|
-
|
|
42737
|
-
|
|
42731
|
+
findParagraphLocation as b$,
|
|
42732
|
+
getTextBoxFloatingGeometry as b0,
|
|
42733
|
+
getPresetPathSegments as b1,
|
|
42734
|
+
buildListLabels as b2,
|
|
42738
42735
|
PX_PER_POINT as b3,
|
|
42739
42736
|
DEFAULT_FONT_SIZE_PX as b4,
|
|
42740
|
-
|
|
42741
|
-
|
|
42742
|
-
|
|
42743
|
-
|
|
42744
|
-
|
|
42745
|
-
|
|
42746
|
-
|
|
42747
|
-
|
|
42748
|
-
|
|
42749
|
-
|
|
42750
|
-
|
|
42751
|
-
|
|
42752
|
-
|
|
42753
|
-
|
|
42754
|
-
|
|
42755
|
-
|
|
42756
|
-
|
|
42757
|
-
|
|
42758
|
-
|
|
42759
|
-
|
|
42760
|
-
|
|
42761
|
-
|
|
42762
|
-
|
|
42763
|
-
|
|
42764
|
-
|
|
42765
|
-
|
|
42766
|
-
|
|
42767
|
-
|
|
42768
|
-
|
|
42769
|
-
|
|
42770
|
-
|
|
42771
|
-
|
|
42772
|
-
|
|
42773
|
-
|
|
42774
|
-
|
|
42775
|
-
|
|
42776
|
-
|
|
42777
|
-
|
|
42778
|
-
|
|
42779
|
-
|
|
42780
|
-
|
|
42781
|
-
|
|
42782
|
-
|
|
42783
|
-
|
|
42784
|
-
|
|
42785
|
-
|
|
42786
|
-
|
|
42787
|
-
|
|
42788
|
-
|
|
42789
|
-
|
|
42790
|
-
|
|
42791
|
-
|
|
42792
|
-
|
|
42793
|
-
|
|
42794
|
-
|
|
42795
|
-
|
|
42796
|
-
|
|
42797
|
-
|
|
42737
|
+
resolveGradientAxis as b5,
|
|
42738
|
+
isDoubleUnderlineStyle as b6,
|
|
42739
|
+
isWavyUnderlineStyle as b7,
|
|
42740
|
+
underlineStyleLineWidthPx as b8,
|
|
42741
|
+
WAVY_UNDERLINE_WAVELENGTH_PX as b9,
|
|
42742
|
+
collectPdfFontFamilies as bA,
|
|
42743
|
+
outlineFrom as bB,
|
|
42744
|
+
getPageHeaderZoneTop as bC,
|
|
42745
|
+
getPageColumnRects as bD,
|
|
42746
|
+
findFootnoteReference as bE,
|
|
42747
|
+
FOOTNOTE_MARKER_GUTTER_PX as bF,
|
|
42748
|
+
resolveImporterForFile as bG,
|
|
42749
|
+
getDocumentSectionsCanonical as bH,
|
|
42750
|
+
getDocumentParagraphsCanonical as bI,
|
|
42751
|
+
getDocumentParagraphs as bJ,
|
|
42752
|
+
getDocumentPageSettings as bK,
|
|
42753
|
+
getTableCellContentWidthForParagraph as bL,
|
|
42754
|
+
layoutMetricsEpoch as bM,
|
|
42755
|
+
bumpLayoutMetricsEpoch as bN,
|
|
42756
|
+
createCanvasLayoutSnapshotProvider as bO,
|
|
42757
|
+
on as bP,
|
|
42758
|
+
debounce as bQ,
|
|
42759
|
+
unwrap as bR,
|
|
42760
|
+
perfTimer as bS,
|
|
42761
|
+
getRunTextBox as bT,
|
|
42762
|
+
createEditorDocument as bU,
|
|
42763
|
+
resolveResizedDimensions as bV,
|
|
42764
|
+
resolveTextBoxRenderHeight as bW,
|
|
42765
|
+
getToolbarStyleState as bX,
|
|
42766
|
+
getCachedCanvasImage as bY,
|
|
42767
|
+
measureParagraphMinContentWidthPx as bZ,
|
|
42768
|
+
getEditableBlocksForZone as b_,
|
|
42769
|
+
WAVY_UNDERLINE_AMPLITUDE_PX as ba,
|
|
42770
|
+
DOUBLE_UNDERLINE_OFFSET_PX as bb,
|
|
42771
|
+
underlineStyleDashArray as bc,
|
|
42772
|
+
EMPHASIS_GLYPH as bd,
|
|
42773
|
+
rgb255ToHex as be,
|
|
42774
|
+
getImageFloatingGeometry as bf,
|
|
42775
|
+
textStyleToFontSizePt as bg,
|
|
42776
|
+
resolveOpenTypeFeatureTags as bh,
|
|
42777
|
+
resolveDecorationLineY as bi,
|
|
42778
|
+
DOUBLE_STRIKE_OFFSET_PX as bj,
|
|
42779
|
+
resolveListLabel as bk,
|
|
42780
|
+
getListLabelInset as bl,
|
|
42781
|
+
getAlignedListLabelInset as bm,
|
|
42782
|
+
getParagraphBorderInsets as bn,
|
|
42783
|
+
buildSegmentTable as bo,
|
|
42784
|
+
buildCanvasTableLayout as bp,
|
|
42785
|
+
resolveCanvasTableWidth as bq,
|
|
42786
|
+
resolveFloatingTableRect as br,
|
|
42787
|
+
normalizeFamily as bs,
|
|
42788
|
+
ROBOTO_FONT_FILES as bt,
|
|
42789
|
+
loadFontAsset as bu,
|
|
42790
|
+
OFFICE_COMPAT_FONT_FAMILIES as bv,
|
|
42791
|
+
BinaryReader as bw,
|
|
42792
|
+
buildSfnt as bx,
|
|
42793
|
+
defaultFontDecoderRegistry as by,
|
|
42794
|
+
SfntFontProgram as bz,
|
|
42798
42795
|
getPageBodyBottom as c,
|
|
42799
|
-
|
|
42800
|
-
|
|
42801
|
-
|
|
42802
|
-
|
|
42803
|
-
|
|
42804
|
-
|
|
42805
|
-
|
|
42806
|
-
|
|
42807
|
-
|
|
42808
|
-
|
|
42809
|
-
|
|
42810
|
-
|
|
42811
|
-
|
|
42812
|
-
|
|
42813
|
-
|
|
42814
|
-
|
|
42815
|
-
|
|
42816
|
-
|
|
42817
|
-
|
|
42818
|
-
|
|
42819
|
-
|
|
42820
|
-
|
|
42821
|
-
|
|
42822
|
-
|
|
42823
|
-
|
|
42824
|
-
|
|
42825
|
-
|
|
42826
|
-
|
|
42827
|
-
|
|
42828
|
-
|
|
42829
|
-
|
|
42830
|
-
|
|
42831
|
-
|
|
42832
|
-
|
|
42833
|
-
|
|
42834
|
-
|
|
42835
|
-
|
|
42836
|
-
|
|
42837
|
-
|
|
42838
|
-
|
|
42839
|
-
|
|
42840
|
-
|
|
42841
|
-
|
|
42842
|
-
|
|
42843
|
-
|
|
42844
|
-
|
|
42845
|
-
|
|
42846
|
-
|
|
42847
|
-
|
|
42848
|
-
|
|
42849
|
-
|
|
42850
|
-
|
|
42851
|
-
|
|
42852
|
-
|
|
42853
|
-
|
|
42854
|
-
|
|
42855
|
-
|
|
42856
|
-
|
|
42857
|
-
|
|
42858
|
-
|
|
42859
|
-
|
|
42860
|
-
|
|
42861
|
-
|
|
42862
|
-
|
|
42796
|
+
SplitButton as c$,
|
|
42797
|
+
createSectionBoundaryParagraph as c0,
|
|
42798
|
+
normalizePageSettings as c1,
|
|
42799
|
+
DEFAULT_EDITOR_PAGE_SETTINGS as c2,
|
|
42800
|
+
markStart as c3,
|
|
42801
|
+
markEnd as c4,
|
|
42802
|
+
getParagraphEntries as c5,
|
|
42803
|
+
getParagraphById as c6,
|
|
42804
|
+
createEditorFootnote as c7,
|
|
42805
|
+
createFootnoteReferenceRun as c8,
|
|
42806
|
+
renumberFootnotes as c9,
|
|
42807
|
+
createEditorLogger as cA,
|
|
42808
|
+
registerDomStatsSurface as cB,
|
|
42809
|
+
Button as cC,
|
|
42810
|
+
Checkbox as cD,
|
|
42811
|
+
ColorPicker as cE,
|
|
42812
|
+
CommandRegistry as cF,
|
|
42813
|
+
DEFAULT_PALETTE as cG,
|
|
42814
|
+
DialogFooter as cH,
|
|
42815
|
+
FloatingActionButton as cI,
|
|
42816
|
+
GridPicker as cJ,
|
|
42817
|
+
IconButton as cK,
|
|
42818
|
+
Menu as cL,
|
|
42819
|
+
OASIS_BUILTIN_COMMANDS as cM,
|
|
42820
|
+
OASIS_MENU_ITEMS as cN,
|
|
42821
|
+
OASIS_TOOLBAR_ITEMS as cO,
|
|
42822
|
+
OasisEditorAppLazy as cP,
|
|
42823
|
+
OasisEditorContainer as cQ,
|
|
42824
|
+
PluginCollection as cR,
|
|
42825
|
+
Popover as cS,
|
|
42826
|
+
RIBBON_TABS as cT,
|
|
42827
|
+
Select as cU,
|
|
42828
|
+
SelectField as cV,
|
|
42829
|
+
Separator as cW,
|
|
42830
|
+
SidePanel as cX,
|
|
42831
|
+
SidePanelBody as cY,
|
|
42832
|
+
SidePanelFooter as cZ,
|
|
42833
|
+
SidePanelHeader as c_,
|
|
42834
|
+
getHeadingLevel as ca,
|
|
42835
|
+
preciseFontModeVersion as cb,
|
|
42836
|
+
isPreciseFontModeEnabled as cc,
|
|
42837
|
+
resolveNamedTextStyle as cd,
|
|
42838
|
+
togglePreciseFontMode as ce,
|
|
42839
|
+
nextFontSizePt as cf,
|
|
42840
|
+
previousFontSizePt as cg,
|
|
42841
|
+
fontSizePtToPx as ch,
|
|
42842
|
+
createDefaultToolbarPreset as ci,
|
|
42843
|
+
MenuRegistry as cj,
|
|
42844
|
+
createToolbarRegistry as ck,
|
|
42845
|
+
Editor as cl,
|
|
42846
|
+
resolveCommandRef as cm,
|
|
42847
|
+
commandRefName as cn,
|
|
42848
|
+
createOasisEditorClient as co,
|
|
42849
|
+
createEditorZoom as cp,
|
|
42850
|
+
startLongTaskObserver as cq,
|
|
42851
|
+
installGlobalReport as cr,
|
|
42852
|
+
applyStoredPreciseFontPreference as cs,
|
|
42853
|
+
getWelcomeSeen as ct,
|
|
42854
|
+
isLocalFontAccessSupported as cu,
|
|
42855
|
+
EDITOR_SCROLL_PADDING_PX as cv,
|
|
42856
|
+
Toolbar as cw,
|
|
42857
|
+
OasisEditorLoading as cx,
|
|
42858
|
+
I18nProvider as cy,
|
|
42859
|
+
createTranslator as cz,
|
|
42863
42860
|
domTextMeasurer as d,
|
|
42861
|
+
StyleGallery as d0,
|
|
42862
|
+
TextField as d1,
|
|
42863
|
+
Button$1 as d2,
|
|
42864
|
+
buildRibbonTabDefinitions as d3,
|
|
42865
|
+
createEditorCommandBus as d4,
|
|
42866
|
+
createOasisEditor as d5,
|
|
42867
|
+
createOasisEditorContainer as d6,
|
|
42868
|
+
mount as d7,
|
|
42869
|
+
registerToolbarRenderer as d8,
|
|
42864
42870
|
estimateTableBlockHeight as e,
|
|
42865
42871
|
getFootnoteDisplayMarker as f,
|
|
42866
42872
|
getProjectedParagraphBlockHeight as g,
|