oasis-editor 0.0.114 → 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-XloOiKSu.js → OasisEditorApp-C1dyjJoH.js} +197 -365
- package/dist/core/decorationGeometry.d.ts +10 -0
- package/dist/core/gradientAxis.d.ts +11 -0
- package/dist/core/textStyleMappings.d.ts +2 -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-CwpzM--5.js → index-Cq3YFYX2.js} +833 -866
- package/dist/oasis-editor.js +50 -50
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/ui/canvas/CanvasTableLayout.d.ts +12 -63
- 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);
|
|
@@ -17843,17 +17843,8 @@ function drawStackedParagraph(ctx, paragraph, state, box, startColumn, columnsRt
|
|
|
17843
17843
|
ctx.restore();
|
|
17844
17844
|
return endColumnRight;
|
|
17845
17845
|
}
|
|
17846
|
-
const NO_WRAP_WIDTH_PX = 1e5;
|
|
17847
|
-
function resolveCellVerticalMode(cell) {
|
|
17848
|
-
var _a, _b, _c;
|
|
17849
|
-
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;
|
|
17850
|
-
return resolveVerticalMode(direction);
|
|
17851
|
-
}
|
|
17852
|
-
const DEFAULT_TABLE_ROW_HEIGHT = 14;
|
|
17853
17846
|
const DEFAULT_CELL_PADDING_TOP_BOTTOM_PX = 0;
|
|
17854
17847
|
const DEFAULT_CELL_PADDING_LEFT_RIGHT_PX = 7.2;
|
|
17855
|
-
const MIN_TABLE_CELL_CONTENT_WIDTH_PX = 24;
|
|
17856
|
-
const MIN_TABLE_CELL_CONTENT_HEIGHT_PX = 1;
|
|
17857
17848
|
function toPx(value) {
|
|
17858
17849
|
return value * PX_PER_POINT;
|
|
17859
17850
|
}
|
|
@@ -17872,51 +17863,6 @@ function parseDimensionToPx(value) {
|
|
|
17872
17863
|
const parsed = Number.parseFloat(trimmed);
|
|
17873
17864
|
return Number.isFinite(parsed) ? parsed : null;
|
|
17874
17865
|
}
|
|
17875
|
-
function resolveCanvasTableWidth(table, contentWidth) {
|
|
17876
|
-
var _a;
|
|
17877
|
-
const raw = (_a = table.style) == null ? void 0 : _a.width;
|
|
17878
|
-
if (typeof raw === "number") return Math.max(24, toPx(raw));
|
|
17879
|
-
if (typeof raw === "string" && raw.trim().endsWith("%")) {
|
|
17880
|
-
const value = Number.parseFloat(raw.trim().slice(0, -1));
|
|
17881
|
-
if (Number.isFinite(value))
|
|
17882
|
-
return Math.max(24, contentWidth * (value / 100));
|
|
17883
|
-
}
|
|
17884
|
-
return contentWidth;
|
|
17885
|
-
}
|
|
17886
|
-
function resolveTableIndentLeft(table) {
|
|
17887
|
-
var _a;
|
|
17888
|
-
const raw = (_a = table.style) == null ? void 0 : _a.indentLeft;
|
|
17889
|
-
return typeof raw === "number" && Number.isFinite(raw) ? toPx(raw) : 0;
|
|
17890
|
-
}
|
|
17891
|
-
function resolveTableCellSpacingPx(table) {
|
|
17892
|
-
var _a;
|
|
17893
|
-
const px = parseDimensionToPx((_a = table.style) == null ? void 0 : _a.cellSpacing);
|
|
17894
|
-
return px !== null && px > 0 ? px : 0;
|
|
17895
|
-
}
|
|
17896
|
-
function lineNaturalWidth(line) {
|
|
17897
|
-
if (line.slots.length < 2) return 0;
|
|
17898
|
-
return line.slots[line.slots.length - 1].left - line.slots[0].left;
|
|
17899
|
-
}
|
|
17900
|
-
function applyFitTextScale(paragraph, scalePercent) {
|
|
17901
|
-
return {
|
|
17902
|
-
...paragraph,
|
|
17903
|
-
runs: paragraph.runs.map((run) => {
|
|
17904
|
-
var _a;
|
|
17905
|
-
const existing = (_a = run.styles) == null ? void 0 : _a.characterScale;
|
|
17906
|
-
const combined = typeof existing === "number" && existing > 0 ? existing * scalePercent / 100 : scalePercent;
|
|
17907
|
-
return { ...run, styles: { ...run.styles, characterScale: combined } };
|
|
17908
|
-
})
|
|
17909
|
-
};
|
|
17910
|
-
}
|
|
17911
|
-
function resolveTableLeftOffset(table, tableWidth, contentWidth) {
|
|
17912
|
-
var _a;
|
|
17913
|
-
const align = (_a = table.style) == null ? void 0 : _a.align;
|
|
17914
|
-
if (align === "center" || align === "right") {
|
|
17915
|
-
const slack = Math.max(0, contentWidth - tableWidth);
|
|
17916
|
-
return align === "center" ? slack / 2 : slack;
|
|
17917
|
-
}
|
|
17918
|
-
return resolveTableIndentLeft(table);
|
|
17919
|
-
}
|
|
17920
17866
|
function resolveDefaultBorder() {
|
|
17921
17867
|
return { width: 1, color: "#6f6f6f", type: "solid" };
|
|
17922
17868
|
}
|
|
@@ -17945,6 +17891,17 @@ function resolveCellPadding(cell) {
|
|
|
17945
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;
|
|
17946
17892
|
return { top, right, bottom, left };
|
|
17947
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
|
+
}
|
|
17948
17905
|
function fitImagesToCellWidth(paragraph, maxImageWidthPx) {
|
|
17949
17906
|
if (!Number.isFinite(maxImageWidthPx) || maxImageWidthPx <= 0) {
|
|
17950
17907
|
return paragraph;
|
|
@@ -17968,116 +17925,87 @@ function fitImagesToCellWidth(paragraph, maxImageWidthPx) {
|
|
|
17968
17925
|
if (!changed) return paragraph;
|
|
17969
17926
|
return { ...paragraph, runs };
|
|
17970
17927
|
}
|
|
17971
|
-
function
|
|
17972
|
-
|
|
17973
|
-
|
|
17974
|
-
|
|
17975
|
-
|
|
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));
|
|
17976
17947
|
}
|
|
17977
|
-
|
|
17978
|
-
|
|
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;
|
|
17979
17966
|
}
|
|
17980
|
-
return
|
|
17967
|
+
return resolveTableIndentLeft(table);
|
|
17981
17968
|
}
|
|
17982
|
-
|
|
17983
|
-
|
|
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;
|
|
17984
17982
|
const {
|
|
17985
|
-
table
|
|
17983
|
+
table,
|
|
17984
|
+
sourceTable,
|
|
17985
|
+
tableEntries,
|
|
17986
|
+
columnOffsets,
|
|
17987
|
+
cellSpacingPx,
|
|
17988
|
+
visualColumnCount,
|
|
17989
|
+
effectiveRowStyles,
|
|
17986
17990
|
state,
|
|
17987
|
-
pageIndex
|
|
17988
|
-
originX,
|
|
17989
|
-
originY,
|
|
17990
|
-
contentWidth,
|
|
17991
|
-
estimatedHeight
|
|
17991
|
+
pageIndex
|
|
17992
17992
|
} = options;
|
|
17993
|
-
const table = {
|
|
17994
|
-
...sourceTable,
|
|
17995
|
-
style: resolveEffectiveTableStyle(sourceTable, state.document.styles)
|
|
17996
|
-
};
|
|
17997
|
-
const tableWidth = resolveCanvasTableWidth(table, contentWidth);
|
|
17998
|
-
const tableLeft = originX + resolveTableLeftOffset(table, tableWidth, contentWidth);
|
|
17999
|
-
const cellSpacingPx = resolveTableCellSpacingPx(table);
|
|
18000
|
-
const tableEntries = buildTableCellLayout(table);
|
|
18001
17993
|
const unsupported = [];
|
|
18002
|
-
const visualColumnCount = Math.max(
|
|
18003
|
-
1,
|
|
18004
|
-
...tableEntries.map(
|
|
18005
|
-
(entry) => entry.visualColumnIndex + Math.max(1, entry.colSpan)
|
|
18006
|
-
)
|
|
18007
|
-
);
|
|
18008
|
-
const columnsWidthBudget = Math.max(
|
|
18009
|
-
visualColumnCount,
|
|
18010
|
-
tableWidth - (visualColumnCount + 1) * cellSpacingPx
|
|
18011
|
-
);
|
|
18012
|
-
let resolvedColumnWidths = [];
|
|
18013
|
-
if (table.gridCols && table.gridCols.length >= visualColumnCount) {
|
|
18014
|
-
const gridTotalWidth = table.gridCols.reduce((a, b) => a + b, 0);
|
|
18015
|
-
const scale = gridTotalWidth > 0 ? columnsWidthBudget / gridTotalWidth : 1;
|
|
18016
|
-
resolvedColumnWidths = table.gridCols.map((w) => w * scale);
|
|
18017
|
-
} else {
|
|
18018
|
-
const baseCellWidth = columnsWidthBudget / visualColumnCount;
|
|
18019
|
-
resolvedColumnWidths = Array(visualColumnCount).fill(baseCellWidth);
|
|
18020
|
-
for (const entry of tableEntries) {
|
|
18021
|
-
if (Math.max(1, entry.colSpan) !== 1) continue;
|
|
18022
|
-
const cell = (_a = table.rows[entry.rowIndex]) == null ? void 0 : _a.cells[entry.cellIndex];
|
|
18023
|
-
if (!cell || resolveCellVerticalMode(cell) !== "stack") continue;
|
|
18024
|
-
let glyphWidth = 0;
|
|
18025
|
-
for (const block of cell.blocks) {
|
|
18026
|
-
if (block.type !== "paragraph") continue;
|
|
18027
|
-
glyphWidth = Math.max(
|
|
18028
|
-
glyphWidth,
|
|
18029
|
-
estimateStackedColumnWidth(block, state)
|
|
18030
|
-
);
|
|
18031
|
-
}
|
|
18032
|
-
if (glyphWidth <= 0) continue;
|
|
18033
|
-
const padding = resolveCellPadding(cell);
|
|
18034
|
-
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;
|
|
18035
|
-
const col = entry.visualColumnIndex;
|
|
18036
|
-
if (needed > (resolvedColumnWidths[col] ?? 0)) {
|
|
18037
|
-
resolvedColumnWidths[col] = needed;
|
|
18038
|
-
}
|
|
18039
|
-
}
|
|
18040
|
-
}
|
|
18041
|
-
const columnOffsets = [cellSpacingPx];
|
|
18042
|
-
for (let i = 0; i < resolvedColumnWidths.length; i++) {
|
|
18043
|
-
columnOffsets[i + 1] = columnOffsets[i] + resolvedColumnWidths[i] + cellSpacingPx;
|
|
18044
|
-
}
|
|
18045
17994
|
const cellEntriesByKey = new Map(
|
|
18046
17995
|
tableEntries.map(
|
|
18047
17996
|
(entry) => [`${entry.rowIndex}:${entry.cellIndex}`, entry]
|
|
18048
17997
|
)
|
|
18049
17998
|
);
|
|
18050
|
-
const effectiveRowStyles = table.rows.map((row, rowIndex) => {
|
|
18051
|
-
const entry = tableEntries.find(
|
|
18052
|
-
(candidate) => candidate.rowIndex === rowIndex
|
|
18053
|
-
);
|
|
18054
|
-
return entry ? resolveEffectiveTableCellFormatting({
|
|
18055
|
-
table: sourceTable,
|
|
18056
|
-
rowIndex,
|
|
18057
|
-
cellIndex: entry.cellIndex,
|
|
18058
|
-
visualColumnIndex: entry.visualColumnIndex,
|
|
18059
|
-
columnCount: visualColumnCount,
|
|
18060
|
-
styles: state.document.styles
|
|
18061
|
-
}).rowStyle : row.style;
|
|
18062
|
-
});
|
|
18063
17999
|
const prepared = [];
|
|
18064
18000
|
for (let rowIndex = 0; rowIndex < table.rows.length; rowIndex += 1) {
|
|
18065
18001
|
const row = table.rows[rowIndex];
|
|
18066
|
-
if ((
|
|
18067
|
-
|
|
18068
|
-
}
|
|
18069
|
-
if (((_h = (_g = effectiveRowStyles[rowIndex]) == null ? void 0 : _g.revision) == null ? void 0 : _h.type) === "delete") {
|
|
18070
|
-
continue;
|
|
18071
|
-
}
|
|
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;
|
|
18072
18004
|
for (let cellIndex = 0; cellIndex < row.cells.length; cellIndex += 1) {
|
|
18073
18005
|
const sourceCell = row.cells[cellIndex];
|
|
18074
|
-
if (((
|
|
18075
|
-
continue;
|
|
18076
|
-
}
|
|
18006
|
+
if (((_e = (_d = sourceCell.style) == null ? void 0 : _d.revision) == null ? void 0 : _e.type) === "delete") continue;
|
|
18077
18007
|
const entry = cellEntriesByKey.get(`${rowIndex}:${cellIndex}`);
|
|
18078
|
-
if (!entry)
|
|
18079
|
-
continue;
|
|
18080
|
-
}
|
|
18008
|
+
if (!entry) continue;
|
|
18081
18009
|
const formatting = resolveEffectiveTableCellFormatting({
|
|
18082
18010
|
table: sourceTable,
|
|
18083
18011
|
rowIndex,
|
|
@@ -18099,36 +18027,25 @@ function buildCanvasTableLayout(options) {
|
|
|
18099
18027
|
};
|
|
18100
18028
|
const effectiveRow = formatting.rowStyle;
|
|
18101
18029
|
const rowSpan = Math.max(1, cell.rowSpan ?? 1);
|
|
18102
|
-
if (rowSpan > 1)
|
|
18103
|
-
|
|
18104
|
-
}
|
|
18105
|
-
if (cell.vMerge === "continue" || cell.vMerge === "restart") {
|
|
18030
|
+
if (rowSpan > 1) unsupported.push("unsupported:v-span");
|
|
18031
|
+
if (cell.vMerge === "continue" || cell.vMerge === "restart")
|
|
18106
18032
|
unsupported.push("unsupported:v-merge");
|
|
18107
|
-
}
|
|
18108
18033
|
const visualCol = entry.visualColumnIndex;
|
|
18109
18034
|
const colSpan = Math.max(1, entry.colSpan);
|
|
18110
18035
|
const width = Math.max(
|
|
18111
18036
|
1,
|
|
18112
|
-
(columnOffsets[visualCol + colSpan] ??
|
|
18037
|
+
(columnOffsets[visualCol + colSpan] ?? 0) - (columnOffsets[visualCol] ?? 0) - cellSpacingPx
|
|
18113
18038
|
);
|
|
18114
18039
|
const padding = resolveCellPadding(cell);
|
|
18115
|
-
const logicalLeft = ((
|
|
18116
|
-
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;
|
|
18117
18042
|
const borders = {
|
|
18118
|
-
top: resolveBorder((
|
|
18119
|
-
right: resolveBorder(((
|
|
18120
|
-
bottom: resolveBorder((
|
|
18121
|
-
left: resolveBorder(((
|
|
18122
|
-
...((
|
|
18123
|
-
|
|
18124
|
-
cell.style.borderTopLeftToBottomRight
|
|
18125
|
-
)
|
|
18126
|
-
} : {},
|
|
18127
|
-
...((_v = cell.style) == null ? void 0 : _v.borderTopRightToBottomLeft) ? {
|
|
18128
|
-
topRightToBottomLeft: resolveBorder(
|
|
18129
|
-
cell.style.borderTopRightToBottomLeft
|
|
18130
|
-
)
|
|
18131
|
-
} : {}
|
|
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) } : {}
|
|
18132
18049
|
};
|
|
18133
18050
|
const contentWidthPx = Math.max(
|
|
18134
18051
|
MIN_TABLE_CELL_CONTENT_WIDTH_PX,
|
|
@@ -18137,10 +18054,10 @@ function buildCanvasTableLayout(options) {
|
|
|
18137
18054
|
const verticalMode = resolveCellVerticalMode(cell);
|
|
18138
18055
|
const isRotated = verticalMode === "rotate-cw" || verticalMode === "rotate-ccw";
|
|
18139
18056
|
const isStacked = verticalMode === "stack";
|
|
18140
|
-
const isFitText = !!((
|
|
18057
|
+
const isFitText = !!((_r = cell.style) == null ? void 0 : _r.fitText) && !isRotated && !isStacked;
|
|
18141
18058
|
const explicitRowHeightPx = parseDimensionToPx(effectiveRow.height);
|
|
18142
18059
|
const hasExplicitRowHeight = explicitRowHeightPx !== null && explicitRowHeightPx > 0;
|
|
18143
|
-
const wrapWidth = isRotated || ((
|
|
18060
|
+
const wrapWidth = isRotated || ((_s = cell.style) == null ? void 0 : _s.noWrap) ? isRotated && hasExplicitRowHeight ? Math.max(
|
|
18144
18061
|
MIN_TABLE_CELL_CONTENT_WIDTH_PX,
|
|
18145
18062
|
explicitRowHeightPx - borders.top.width - borders.bottom.width - padding.top - padding.bottom
|
|
18146
18063
|
) : NO_WRAP_WIDTH_PX : contentWidthPx;
|
|
@@ -18156,7 +18073,7 @@ function buildCanvasTableLayout(options) {
|
|
|
18156
18073
|
state.document.styles,
|
|
18157
18074
|
NO_WRAP_WIDTH_PX,
|
|
18158
18075
|
void 0,
|
|
18159
|
-
(
|
|
18076
|
+
(_t = state.document.settings) == null ? void 0 : _t.defaultTabStop
|
|
18160
18077
|
);
|
|
18161
18078
|
const naturalWidth = noWrapProjected.lines.length > 0 ? lineNaturalWidth(noWrapProjected.lines[0]) : 0;
|
|
18162
18079
|
if (naturalWidth > 0 && contentWidthPx > 0) {
|
|
@@ -18182,7 +18099,7 @@ function buildCanvasTableLayout(options) {
|
|
|
18182
18099
|
spacingBefore,
|
|
18183
18100
|
spacingAfter
|
|
18184
18101
|
});
|
|
18185
|
-
const paragraphStyleSize = ((
|
|
18102
|
+
const paragraphStyleSize = ((_v = (_u = paragraph.runs[0]) == null ? void 0 : _u.styles) == null ? void 0 : _v.fontSize) ?? DEFAULT_FONT_SIZE_PX;
|
|
18186
18103
|
contentNaturalHeightPx = Math.max(
|
|
18187
18104
|
contentNaturalHeightPx,
|
|
18188
18105
|
hasExplicitRowHeight ? paragraphStyleSize * 1.25 : stackLength
|
|
@@ -18196,13 +18113,13 @@ function buildCanvasTableLayout(options) {
|
|
|
18196
18113
|
state.document.styles,
|
|
18197
18114
|
wrapWidth,
|
|
18198
18115
|
void 0,
|
|
18199
|
-
(
|
|
18116
|
+
(_w = state.document.settings) == null ? void 0 : _w.defaultTabStop
|
|
18200
18117
|
);
|
|
18201
18118
|
const linesBottom = projected.lines.length > 0 ? Math.max(...projected.lines.map((line) => line.top + line.height)) : 1;
|
|
18202
18119
|
let effectiveSpacingBefore = spacingBefore;
|
|
18203
18120
|
if (!isRotated && projectedParagraphs.length > 0) {
|
|
18204
18121
|
const previous = projectedParagraphs[projectedParagraphs.length - 1];
|
|
18205
|
-
if (((
|
|
18122
|
+
if (((_x = state.document.settings) == null ? void 0 : _x.allowSpaceOfSameStyleInTable) && shouldCollapseContextualSpacing(
|
|
18206
18123
|
previous.paragraph,
|
|
18207
18124
|
paragraph,
|
|
18208
18125
|
state.document.styles
|
|
@@ -18210,10 +18127,7 @@ function buildCanvasTableLayout(options) {
|
|
|
18210
18127
|
const removedAfter = previous.spacingAfter;
|
|
18211
18128
|
previous.height = Math.max(1, previous.height - removedAfter);
|
|
18212
18129
|
previous.spacingAfter = 0;
|
|
18213
|
-
contentNaturalHeightPx = Math.max(
|
|
18214
|
-
0,
|
|
18215
|
-
contentNaturalHeightPx - removedAfter
|
|
18216
|
-
);
|
|
18130
|
+
contentNaturalHeightPx = Math.max(0, contentNaturalHeightPx - removedAfter);
|
|
18217
18131
|
effectiveSpacingBefore = 0;
|
|
18218
18132
|
} else {
|
|
18219
18133
|
const collapsed = Math.min(previous.spacingAfter, spacingBefore);
|
|
@@ -18258,15 +18172,13 @@ function buildCanvasTableLayout(options) {
|
|
|
18258
18172
|
contentNaturalHeightPx += paragraphHeight;
|
|
18259
18173
|
}
|
|
18260
18174
|
}
|
|
18261
|
-
if ((
|
|
18175
|
+
if ((_y = cell.style) == null ? void 0 : _y.hideMark) {
|
|
18262
18176
|
const allEmpty = cell.blocks.every(
|
|
18263
18177
|
(para) => para.runs.every(
|
|
18264
18178
|
(run) => (run.kind === "text" || run.kind === void 0) && (!run.text || run.text.length === 0)
|
|
18265
18179
|
)
|
|
18266
18180
|
);
|
|
18267
|
-
if (allEmpty)
|
|
18268
|
-
contentNaturalHeightPx = 0;
|
|
18269
|
-
}
|
|
18181
|
+
if (allEmpty) contentNaturalHeightPx = 0;
|
|
18270
18182
|
}
|
|
18271
18183
|
prepared.push({
|
|
18272
18184
|
rowIndex,
|
|
@@ -18285,21 +18197,24 @@ function buildCanvasTableLayout(options) {
|
|
|
18285
18197
|
});
|
|
18286
18198
|
}
|
|
18287
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;
|
|
18288
18206
|
const rowCount = Math.max(1, table.rows.length);
|
|
18289
|
-
const explicitRowHeights = table.rows.map((row) => {
|
|
18207
|
+
const explicitRowHeights = table.rows.map((row, rowIndex) => {
|
|
18290
18208
|
var _a2;
|
|
18291
|
-
const rowIndex = table.rows.indexOf(row);
|
|
18292
18209
|
const effective = effectiveRowStyles[rowIndex];
|
|
18293
|
-
if ((effective == null ? void 0 : effective.hidden) || ((_a2 = effective == null ? void 0 : effective.revision) == null ? void 0 : _a2.type) === "delete")
|
|
18294
|
-
return 0;
|
|
18295
|
-
}
|
|
18210
|
+
if ((effective == null ? void 0 : effective.hidden) || ((_a2 = effective == null ? void 0 : effective.revision) == null ? void 0 : _a2.type) === "delete") return 0;
|
|
18296
18211
|
const explicit = parseDimensionToPx(effective == null ? void 0 : effective.height);
|
|
18297
18212
|
return explicit !== null && explicit > 0 ? explicit : null;
|
|
18298
18213
|
});
|
|
18299
|
-
const fallbackPerRow = estimatedHeight > 0 ? estimatedHeight / rowCount : DEFAULT_TABLE_ROW_HEIGHT;
|
|
18214
|
+
const fallbackPerRow = estimatedHeight > 0 ? estimatedHeight / rowCount : DEFAULT_TABLE_ROW_HEIGHT$1;
|
|
18300
18215
|
const rowHeights = [];
|
|
18301
18216
|
for (let rowIndex = 0; rowIndex < table.rows.length; rowIndex += 1) {
|
|
18302
|
-
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") {
|
|
18303
18218
|
rowHeights[rowIndex] = 0;
|
|
18304
18219
|
continue;
|
|
18305
18220
|
}
|
|
@@ -18314,12 +18229,22 @@ function buildCanvasTableLayout(options) {
|
|
|
18314
18229
|
const baseFloor = explicit !== null ? explicit : Math.max(1, fallbackPerRow * 0.25);
|
|
18315
18230
|
rowHeights[rowIndex] = Math.max(baseFloor, measured, 1);
|
|
18316
18231
|
}
|
|
18317
|
-
|
|
18318
|
-
|
|
18319
|
-
|
|
18320
|
-
|
|
18321
|
-
|
|
18322
|
-
|
|
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;
|
|
18323
18248
|
const cells = [];
|
|
18324
18249
|
for (const cellEntry of prepared) {
|
|
18325
18250
|
const {
|
|
@@ -18354,11 +18279,7 @@ function buildCanvasTableLayout(options) {
|
|
|
18354
18279
|
0
|
|
18355
18280
|
);
|
|
18356
18281
|
let paragraphCursorY = 0;
|
|
18357
|
-
const verticalContentOffset = cellEntry.verticalMode === "horizontal" ? resolveVerticalContentOffset(
|
|
18358
|
-
cell,
|
|
18359
|
-
contentHeightPx,
|
|
18360
|
-
cellEntry.contentNaturalHeightPx
|
|
18361
|
-
) : 0;
|
|
18282
|
+
const verticalContentOffset = cellEntry.verticalMode === "horizontal" ? resolveVerticalContentOffset(cell, contentHeightPx, cellEntry.contentNaturalHeightPx) : 0;
|
|
18362
18283
|
const paragraphs = [];
|
|
18363
18284
|
for (const projected of cellEntry.projectedParagraphs) {
|
|
18364
18285
|
paragraphs.push({
|
|
@@ -18383,21 +18304,132 @@ function buildCanvasTableLayout(options) {
|
|
|
18383
18304
|
contentTop,
|
|
18384
18305
|
contentWidth: contentWidthPx,
|
|
18385
18306
|
contentHeight: contentHeightPx,
|
|
18386
|
-
shading: (
|
|
18307
|
+
shading: (_a = cell.style) == null ? void 0 : _a.shading,
|
|
18387
18308
|
anchorPosition,
|
|
18388
18309
|
padding,
|
|
18389
18310
|
borders,
|
|
18390
18311
|
paragraphs,
|
|
18391
18312
|
verticalMode: cellEntry.verticalMode,
|
|
18392
|
-
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)
|
|
18393
18314
|
});
|
|
18394
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
|
+
});
|
|
18395
18428
|
return {
|
|
18396
18429
|
tableId: table.id,
|
|
18397
18430
|
left: tableLeft,
|
|
18398
18431
|
top: originY,
|
|
18399
18432
|
width: tableWidth,
|
|
18400
|
-
// Total height includes the leading/trailing/inter-row cell-spacing gaps.
|
|
18401
18433
|
height: rowHeights.reduce((sum, current) => sum + current, 0) + (rowHeights.length + 1) * cellSpacingPx,
|
|
18402
18434
|
rowHeights,
|
|
18403
18435
|
cells,
|
|
@@ -18413,45 +18445,6 @@ function PageBreak(props) {
|
|
|
18413
18445
|
return _el$;
|
|
18414
18446
|
})();
|
|
18415
18447
|
}
|
|
18416
|
-
const HEX6_PATTERN = /^[0-9a-fA-F]{6}$/;
|
|
18417
|
-
function stripHashPrefix(color) {
|
|
18418
|
-
return color.trim().replace(/^#/, "");
|
|
18419
|
-
}
|
|
18420
|
-
function normalizeHex6(color) {
|
|
18421
|
-
if (!color) {
|
|
18422
|
-
return null;
|
|
18423
|
-
}
|
|
18424
|
-
const body = stripHashPrefix(color);
|
|
18425
|
-
return HEX6_PATTERN.test(body) ? body.toUpperCase() : null;
|
|
18426
|
-
}
|
|
18427
|
-
function parseHexColorToRgb255(color) {
|
|
18428
|
-
if (!color) {
|
|
18429
|
-
return null;
|
|
18430
|
-
}
|
|
18431
|
-
const normalized = stripHashPrefix(color);
|
|
18432
|
-
if (!HEX6_PATTERN.test(normalized)) {
|
|
18433
|
-
return null;
|
|
18434
|
-
}
|
|
18435
|
-
return [
|
|
18436
|
-
Number.parseInt(normalized.slice(0, 2), 16),
|
|
18437
|
-
Number.parseInt(normalized.slice(2, 4), 16),
|
|
18438
|
-
Number.parseInt(normalized.slice(4, 6), 16)
|
|
18439
|
-
];
|
|
18440
|
-
}
|
|
18441
|
-
function rgb255ToHex(r, g2, b) {
|
|
18442
|
-
const toHex2 = (value) => Math.max(0, Math.min(255, Math.round(value))).toString(16).padStart(2, "0");
|
|
18443
|
-
return `#${toHex2(r)}${toHex2(g2)}${toHex2(b)}`;
|
|
18444
|
-
}
|
|
18445
|
-
const imageCache = /* @__PURE__ */ new Map();
|
|
18446
|
-
function getCachedCanvasImage(src, onUpdate) {
|
|
18447
|
-
const cached = imageCache.get(src);
|
|
18448
|
-
if (cached) return cached;
|
|
18449
|
-
const img = new Image();
|
|
18450
|
-
img.src = src;
|
|
18451
|
-
img.onload = onUpdate;
|
|
18452
|
-
imageCache.set(src, img);
|
|
18453
|
-
return img;
|
|
18454
|
-
}
|
|
18455
18448
|
const listLabelsCache = /* @__PURE__ */ new WeakMap();
|
|
18456
18449
|
function resolveListPrefix(paragraph, document2) {
|
|
18457
18450
|
let labels = listLabelsCache.get(document2);
|
|
@@ -19986,7 +19979,7 @@ function buildPresetPath(preset, x, y, width, height) {
|
|
|
19986
19979
|
}
|
|
19987
19980
|
return path;
|
|
19988
19981
|
}
|
|
19989
|
-
const DEG_TO_RAD = Math.PI / 180;
|
|
19982
|
+
const DEG_TO_RAD$1 = Math.PI / 180;
|
|
19990
19983
|
const CANVAS_DASH_DASHED = [5, 3];
|
|
19991
19984
|
const CANVAS_DASH_DOTTED = [1, 3];
|
|
19992
19985
|
function drawEdge(ctx, border, x1, y1, x2, y2) {
|
|
@@ -20203,7 +20196,7 @@ function paintTextBox(ctx, textBox, state, x, y, width, height, pageIndex, onUpd
|
|
|
20203
20196
|
if (rotation) {
|
|
20204
20197
|
ctx.save();
|
|
20205
20198
|
ctx.translate(x + width / 2, y + height / 2);
|
|
20206
|
-
ctx.rotate(rotation * DEG_TO_RAD);
|
|
20199
|
+
ctx.rotate(rotation * DEG_TO_RAD$1);
|
|
20207
20200
|
ctx.translate(-(x + width / 2), -(y + height / 2));
|
|
20208
20201
|
}
|
|
20209
20202
|
drawTextBoxShape(ctx, textBox, x, y, width, height);
|
|
@@ -20375,6 +20368,259 @@ function collectInlineTextBoxesFromLines(options) {
|
|
|
20375
20368
|
}
|
|
20376
20369
|
return inlineTextBoxes;
|
|
20377
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
|
+
}
|
|
20378
20624
|
function underlineStyleToCssDecorationStyle(underlineStyle) {
|
|
20379
20625
|
switch (underlineStyle) {
|
|
20380
20626
|
case "double":
|
|
@@ -20451,6 +20697,12 @@ function resolveOpenTypeFeatureTags(style2, fontSizePt) {
|
|
|
20451
20697
|
}
|
|
20452
20698
|
return Array.from(tags).sort();
|
|
20453
20699
|
}
|
|
20700
|
+
const EMPHASIS_GLYPH = {
|
|
20701
|
+
dot: "•",
|
|
20702
|
+
comma: "‚",
|
|
20703
|
+
circle: "○",
|
|
20704
|
+
underDot: "•"
|
|
20705
|
+
};
|
|
20454
20706
|
function underlineStyleDashArray(underlineStyle) {
|
|
20455
20707
|
switch (underlineStyle) {
|
|
20456
20708
|
case "dotted":
|
|
@@ -20474,75 +20726,100 @@ function underlineStyleDashArray(underlineStyle) {
|
|
|
20474
20726
|
}
|
|
20475
20727
|
const DOUBLE_STRIKE_OFFSET_PX = 1.3;
|
|
20476
20728
|
const DOUBLE_UNDERLINE_OFFSET_PX = 1.5;
|
|
20477
|
-
function
|
|
20478
|
-
|
|
20479
|
-
|
|
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;
|
|
20480
20733
|
}
|
|
20481
|
-
|
|
20482
|
-
const
|
|
20483
|
-
|
|
20484
|
-
|
|
20485
|
-
|
|
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;
|
|
20740
|
+
ctx.save();
|
|
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();
|
|
20753
|
+
} else {
|
|
20754
|
+
ctx.beginPath();
|
|
20755
|
+
ctx.lineWidth = 1;
|
|
20756
|
+
ctx.setLineDash([]);
|
|
20757
|
+
ctx.moveTo(x1, y);
|
|
20758
|
+
ctx.lineTo(x2, y);
|
|
20759
|
+
ctx.stroke();
|
|
20760
|
+
}
|
|
20761
|
+
ctx.restore();
|
|
20762
|
+
}
|
|
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();
|
|
20486
20773
|
return;
|
|
20487
20774
|
}
|
|
20488
|
-
|
|
20489
|
-
|
|
20490
|
-
options.metricFamily,
|
|
20491
|
-
options.fontSize,
|
|
20492
|
-
options.bold,
|
|
20493
|
-
options.italic
|
|
20494
|
-
].join("|");
|
|
20495
|
-
if (loggedCanvasFontKeys.has(key)) {
|
|
20775
|
+
if (isWavyUnderlineStyle(underlineStyle)) {
|
|
20776
|
+
drawWavyLine(ctx, x1, x2, y);
|
|
20496
20777
|
return;
|
|
20497
20778
|
}
|
|
20498
|
-
|
|
20499
|
-
|
|
20500
|
-
|
|
20501
|
-
const fontCheck = typeof document !== "undefined" && document.fonts ? document.fonts.check(
|
|
20502
|
-
`${style2}${weight} ${options.fontSize}px "${options.metricFamily}"`
|
|
20503
|
-
) : "unavailable";
|
|
20504
|
-
canvasTextLogger.info("font:use", {
|
|
20505
|
-
...options,
|
|
20506
|
-
fontCheck,
|
|
20507
|
-
documentFontsStatus: typeof document !== "undefined" && document.fonts ? document.fonts.status : "unavailable"
|
|
20508
|
-
});
|
|
20509
|
-
}
|
|
20510
|
-
function resolveTabLeader(paragraph, line, tabLeft, state) {
|
|
20511
|
-
var _a;
|
|
20512
|
-
const paragraphStyle = resolveEffectiveParagraphStyle(
|
|
20513
|
-
paragraph.style,
|
|
20514
|
-
state.document.styles
|
|
20515
|
-
);
|
|
20516
|
-
const tabs = paragraphStyle.tabs ?? [];
|
|
20517
|
-
if (tabs.length === 0) {
|
|
20518
|
-
return void 0;
|
|
20779
|
+
const dashArray = underlineStyleDashArray(underlineStyle);
|
|
20780
|
+
if (dashArray) {
|
|
20781
|
+
ctx.setLineDash(dashArray);
|
|
20519
20782
|
}
|
|
20520
|
-
|
|
20521
|
-
|
|
20522
|
-
|
|
20523
|
-
|
|
20783
|
+
ctx.beginPath();
|
|
20784
|
+
ctx.moveTo(x1, y);
|
|
20785
|
+
ctx.lineTo(x2, y);
|
|
20786
|
+
ctx.stroke();
|
|
20787
|
+
ctx.setLineDash([]);
|
|
20524
20788
|
}
|
|
20525
|
-
function
|
|
20526
|
-
|
|
20527
|
-
|
|
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);
|
|
20528
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;
|
|
20529
20804
|
ctx.save();
|
|
20530
|
-
ctx.
|
|
20531
|
-
ctx.
|
|
20532
|
-
|
|
20533
|
-
|
|
20534
|
-
|
|
20535
|
-
|
|
20536
|
-
|
|
20537
|
-
|
|
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);
|
|
20538
20816
|
}
|
|
20539
|
-
const leaderY = leader === "underscore" ? y + 2 : y;
|
|
20540
|
-
ctx.beginPath();
|
|
20541
|
-
ctx.moveTo(x1, leaderY);
|
|
20542
|
-
ctx.lineTo(x2, leaderY);
|
|
20543
|
-
ctx.stroke();
|
|
20544
20817
|
ctx.restore();
|
|
20545
20818
|
}
|
|
20819
|
+
function clamp01(value) {
|
|
20820
|
+
if (!Number.isFinite(value) || value < 0) return 0;
|
|
20821
|
+
return value > 1 ? 1 : value;
|
|
20822
|
+
}
|
|
20546
20823
|
function drawImageFragment(ctx, img, image, x, y) {
|
|
20547
20824
|
const { width, height, crop, fillMode, rotation, flipH, flipV } = image;
|
|
20548
20825
|
const hasTransform = Boolean(rotation) || Boolean(flipH) || Boolean(flipV);
|
|
@@ -20555,9 +20832,7 @@ function drawImageFragment(ctx, img, image, x, y) {
|
|
|
20555
20832
|
ctx.save();
|
|
20556
20833
|
if (hasTransform) {
|
|
20557
20834
|
ctx.translate(x + width / 2, y + height / 2);
|
|
20558
|
-
if (rotation)
|
|
20559
|
-
ctx.rotate(rotation * DEG_TO_RAD);
|
|
20560
|
-
}
|
|
20835
|
+
if (rotation) ctx.rotate(rotation * DEG_TO_RAD$1);
|
|
20561
20836
|
ctx.scale(flipH ? -1 : 1, flipV ? -1 : 1);
|
|
20562
20837
|
ctx.translate(-(x + width / 2), -(y + height / 2));
|
|
20563
20838
|
}
|
|
@@ -20589,19 +20864,11 @@ function drawImageFragment(ctx, img, image, x, y) {
|
|
|
20589
20864
|
}
|
|
20590
20865
|
ctx.save();
|
|
20591
20866
|
ctx.translate(x + width / 2, y + height / 2);
|
|
20592
|
-
if (rotation)
|
|
20593
|
-
ctx.rotate(rotation * DEG_TO_RAD);
|
|
20594
|
-
}
|
|
20867
|
+
if (rotation) ctx.rotate(rotation * DEG_TO_RAD$1);
|
|
20595
20868
|
ctx.scale(flipH ? -1 : 1, flipV ? -1 : 1);
|
|
20596
20869
|
ctx.drawImage(img, sx, sy, sw, sh, -width / 2, -height / 2, width, height);
|
|
20597
20870
|
ctx.restore();
|
|
20598
20871
|
}
|
|
20599
|
-
function clamp01(value) {
|
|
20600
|
-
if (!Number.isFinite(value) || value < 0) {
|
|
20601
|
-
return 0;
|
|
20602
|
-
}
|
|
20603
|
-
return value > 1 ? 1 : value;
|
|
20604
|
-
}
|
|
20605
20872
|
function drawFloatingImagesForParagraph(options) {
|
|
20606
20873
|
const {
|
|
20607
20874
|
ctx,
|
|
@@ -20621,13 +20888,9 @@ function drawFloatingImagesForParagraph(options) {
|
|
|
20621
20888
|
);
|
|
20622
20889
|
for (const fragment of line.fragments) {
|
|
20623
20890
|
const image = fragment.image;
|
|
20624
|
-
if (!(image == null ? void 0 : image.floating))
|
|
20625
|
-
continue;
|
|
20626
|
-
}
|
|
20891
|
+
if (!(image == null ? void 0 : image.floating)) continue;
|
|
20627
20892
|
const isBehind = Boolean(image.floating.behindDoc);
|
|
20628
|
-
if (layer === "behind" !== isBehind)
|
|
20629
|
-
continue;
|
|
20630
|
-
}
|
|
20893
|
+
if (layer === "behind" !== isBehind) continue;
|
|
20631
20894
|
const slot = slotByOffset.get(fragment.startOffset);
|
|
20632
20895
|
const anchorLeft = contentLeft + ((slot == null ? void 0 : slot.left) ?? 0);
|
|
20633
20896
|
const lineTop = paragraphTop + line.top;
|
|
@@ -20649,6 +20912,115 @@ function drawFloatingImagesForParagraph(options) {
|
|
|
20649
20912
|
}
|
|
20650
20913
|
}
|
|
20651
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
|
+
}
|
|
20652
21024
|
function drawParagraph(ctx, paragraph, lines, state, originX, originY, onUpdate, painters, pageIndex = 0) {
|
|
20653
21025
|
var _a, _b, _c, _d;
|
|
20654
21026
|
for (const line of lines) {
|
|
@@ -20688,9 +21060,7 @@ function drawParagraph(ctx, paragraph, lines, state, originX, originY, onUpdate,
|
|
|
20688
21060
|
(_c = paragraph.style) == null ? void 0 : _c.styleId,
|
|
20689
21061
|
state.document.styles
|
|
20690
21062
|
);
|
|
20691
|
-
if (styles.hidden)
|
|
20692
|
-
continue;
|
|
20693
|
-
}
|
|
21063
|
+
if (styles.hidden) continue;
|
|
20694
21064
|
const fontSize = styles.fontSize ?? DEFAULT_FONT_SIZE_PX;
|
|
20695
21065
|
const metricFamily = resolveMetricCompatibleFamily(
|
|
20696
21066
|
styles.fontFamily ?? "Calibri"
|
|
@@ -20708,43 +21078,15 @@ function drawParagraph(ctx, paragraph, lines, state, originX, originY, onUpdate,
|
|
|
20708
21078
|
italic: Boolean(styles.italic),
|
|
20709
21079
|
sample: fragment.text.slice(0, 80)
|
|
20710
21080
|
});
|
|
20711
|
-
ctx.fillStyle = resolveCanvasTextFill(
|
|
20712
|
-
ctx,
|
|
20713
|
-
styles,
|
|
20714
|
-
line,
|
|
20715
|
-
fragment,
|
|
20716
|
-
originX,
|
|
20717
|
-
originY
|
|
20718
|
-
);
|
|
21081
|
+
ctx.fillStyle = resolveCanvasTextFill(ctx, styles, line, fragment, originX, originY);
|
|
20719
21082
|
if (styles.shading) {
|
|
20720
|
-
drawFragmentShading(
|
|
20721
|
-
ctx,
|
|
20722
|
-
line,
|
|
20723
|
-
fragment,
|
|
20724
|
-
originX,
|
|
20725
|
-
originY,
|
|
20726
|
-
styles.shading
|
|
20727
|
-
);
|
|
21083
|
+
drawFragmentShading(ctx, line, fragment, originX, originY, styles.shading);
|
|
20728
21084
|
}
|
|
20729
21085
|
if (styles.highlight) {
|
|
20730
|
-
drawFragmentHighlight(
|
|
20731
|
-
ctx,
|
|
20732
|
-
line,
|
|
20733
|
-
fragment,
|
|
20734
|
-
originX,
|
|
20735
|
-
originY,
|
|
20736
|
-
styles.highlight
|
|
20737
|
-
);
|
|
21086
|
+
drawFragmentHighlight(ctx, line, fragment, originX, originY, styles.highlight);
|
|
20738
21087
|
}
|
|
20739
21088
|
if (styles.textBorder) {
|
|
20740
|
-
drawFragmentBorder(
|
|
20741
|
-
ctx,
|
|
20742
|
-
line,
|
|
20743
|
-
fragment,
|
|
20744
|
-
originX,
|
|
20745
|
-
originY,
|
|
20746
|
-
styles.textBorder
|
|
20747
|
-
);
|
|
21089
|
+
drawFragmentBorder(ctx, line, fragment, originX, originY, styles.textBorder);
|
|
20748
21090
|
}
|
|
20749
21091
|
if (fragment.image && !fragment.image.floating) {
|
|
20750
21092
|
const slot = slotByOffset.get(fragment.startOffset);
|
|
@@ -20831,14 +21173,7 @@ function drawParagraph(ctx, paragraph, lines, state, originX, originY, onUpdate,
|
|
|
20831
21173
|
drawTextDecoration(ctx, line, fragment, originX, originY, "strike");
|
|
20832
21174
|
}
|
|
20833
21175
|
if (styles.doubleStrike) {
|
|
20834
|
-
drawTextDecoration(
|
|
20835
|
-
ctx,
|
|
20836
|
-
line,
|
|
20837
|
-
fragment,
|
|
20838
|
-
originX,
|
|
20839
|
-
originY,
|
|
20840
|
-
"doubleStrike"
|
|
20841
|
-
);
|
|
21176
|
+
drawTextDecoration(ctx, line, fragment, originX, originY, "doubleStrike");
|
|
20842
21177
|
}
|
|
20843
21178
|
if (styles.emphasisMark) {
|
|
20844
21179
|
drawFragmentEmphasis(
|
|
@@ -20855,9 +21190,7 @@ function drawParagraph(ctx, paragraph, lines, state, originX, originY, onUpdate,
|
|
|
20855
21190
|
ctx.restore();
|
|
20856
21191
|
}
|
|
20857
21192
|
if (line.trailingHyphen) {
|
|
20858
|
-
const lastFragment = [...line.fragments].reverse().find(
|
|
20859
|
-
(fragment) => fragment.text && !fragment.image && !fragment.textBox
|
|
20860
|
-
);
|
|
21193
|
+
const lastFragment = [...line.fragments].reverse().find((f) => f.text && !f.image && !f.textBox);
|
|
20861
21194
|
const endSlot = slotByOffset.get(line.endOffset) ?? line.slots[line.slots.length - 1];
|
|
20862
21195
|
if (lastFragment && endSlot) {
|
|
20863
21196
|
const styles = resolveEffectiveTextStyleForParagraph(
|
|
@@ -20897,377 +21230,6 @@ function drawParagraph(ctx, paragraph, lines, state, originX, originY, onUpdate,
|
|
|
20897
21230
|
}
|
|
20898
21231
|
}
|
|
20899
21232
|
}
|
|
20900
|
-
function drawFragmentColorRect(ctx, line, fragment, originX, originY, color, alpha) {
|
|
20901
|
-
const bounds = resolveFragmentPaintBounds(line, fragment);
|
|
20902
|
-
if (!bounds) return;
|
|
20903
|
-
ctx.save();
|
|
20904
|
-
if (alpha !== void 0) ctx.globalAlpha = alpha;
|
|
20905
|
-
ctx.fillStyle = color;
|
|
20906
|
-
ctx.fillRect(
|
|
20907
|
-
originX + bounds.left,
|
|
20908
|
-
originY + line.top + 2,
|
|
20909
|
-
Math.max(0, bounds.right - bounds.left),
|
|
20910
|
-
Math.max(2, line.height - 4)
|
|
20911
|
-
);
|
|
20912
|
-
ctx.restore();
|
|
20913
|
-
}
|
|
20914
|
-
function drawFragmentHighlight(ctx, line, fragment, originX, originY, color) {
|
|
20915
|
-
drawFragmentColorRect(ctx, line, fragment, originX, originY, color, 0.35);
|
|
20916
|
-
}
|
|
20917
|
-
function resolveFragmentPaintBounds(line, fragment) {
|
|
20918
|
-
const slotByOffset = new Map(
|
|
20919
|
-
line.slots.map((slot) => [slot.offset, slot])
|
|
20920
|
-
);
|
|
20921
|
-
const slots = fragment.chars.filter((char) => char.char !== "\n").map((char) => slotByOffset.get(char.paragraphOffset)).filter((slot) => Boolean(slot));
|
|
20922
|
-
if (slots.length === 0) return null;
|
|
20923
|
-
const first = slots[0];
|
|
20924
|
-
const last = slots[slots.length - 1];
|
|
20925
|
-
const nextSlot = slotByOffset.get(last.offset + 1);
|
|
20926
|
-
if (nextSlot) {
|
|
20927
|
-
return { left: first.left, right: nextSlot.left };
|
|
20928
|
-
}
|
|
20929
|
-
const lastSlotIndex = line.slots.findIndex(
|
|
20930
|
-
(slot) => slot.offset === last.offset
|
|
20931
|
-
);
|
|
20932
|
-
const followingSlot = lastSlotIndex >= 0 ? line.slots[lastSlotIndex + 1] : void 0;
|
|
20933
|
-
return {
|
|
20934
|
-
left: first.left,
|
|
20935
|
-
right: (followingSlot == null ? void 0 : followingSlot.left) ?? last.left + Math.max(8, line.height * 0.45)
|
|
20936
|
-
};
|
|
20937
|
-
}
|
|
20938
|
-
function drawFragmentShading(ctx, line, fragment, originX, originY, color) {
|
|
20939
|
-
drawFragmentColorRect(ctx, line, fragment, originX, originY, color);
|
|
20940
|
-
}
|
|
20941
|
-
function getRenderedChar(char, styles) {
|
|
20942
|
-
return styles.allCaps ? char.toUpperCase() : char;
|
|
20943
|
-
}
|
|
20944
|
-
function drawScaledText(ctx, text, x, y, scale) {
|
|
20945
|
-
if (scale === 1) {
|
|
20946
|
-
ctx.fillText(text, x, y);
|
|
20947
|
-
return;
|
|
20948
|
-
}
|
|
20949
|
-
ctx.save();
|
|
20950
|
-
ctx.translate(x, y);
|
|
20951
|
-
ctx.scale(scale, 1);
|
|
20952
|
-
ctx.fillText(text, 0, 0);
|
|
20953
|
-
ctx.restore();
|
|
20954
|
-
}
|
|
20955
|
-
function resolveCanvasTextFill(ctx, styles, line, fragment, originX, originY) {
|
|
20956
|
-
const fill = styles.textFill;
|
|
20957
|
-
if (!fill) return styles.color ?? "#000000";
|
|
20958
|
-
if (fill.type === "solid") return fill.color;
|
|
20959
|
-
if (fill.stops.length < 2) return styles.color ?? "#000000";
|
|
20960
|
-
const bounds = resolveFragmentPaintBounds(line, fragment);
|
|
20961
|
-
if (!bounds) return fill.stops[0].color;
|
|
20962
|
-
const x0 = originX + bounds.left;
|
|
20963
|
-
const x1 = originX + bounds.right;
|
|
20964
|
-
const y0 = originY + line.top;
|
|
20965
|
-
const y1 = originY + line.top + line.height;
|
|
20966
|
-
const cx = (x0 + x1) / 2;
|
|
20967
|
-
const cy = (y0 + y1) / 2;
|
|
20968
|
-
const angleDeg = fill.angle ?? 0;
|
|
20969
|
-
const rad = angleDeg * DEG_TO_RAD;
|
|
20970
|
-
const dx = Math.cos(rad) * (x1 - x0) / 2;
|
|
20971
|
-
const dy = Math.sin(rad) * (y1 - y0) / 2;
|
|
20972
|
-
const gradient = ctx.createLinearGradient(cx - dx, cy - dy, cx + dx, cy + dy);
|
|
20973
|
-
for (const stop of fill.stops) {
|
|
20974
|
-
gradient.addColorStop(stop.position, hexToRgba(stop.color, stop.alpha ?? 1));
|
|
20975
|
-
}
|
|
20976
|
-
return gradient;
|
|
20977
|
-
}
|
|
20978
|
-
function drawStyledText(ctx, text, x, y, scale, styles) {
|
|
20979
|
-
const hasEffects = styles.outline || styles.shadow || styles.textShadow || styles.glow || styles.emboss || styles.imprint || styles.textOutline || styles.reflection;
|
|
20980
|
-
if (!hasEffects) {
|
|
20981
|
-
drawScaledText(ctx, text, x, y, scale);
|
|
20982
|
-
return;
|
|
20983
|
-
}
|
|
20984
|
-
if (styles.emboss || styles.imprint) {
|
|
20985
|
-
const offset = styles.imprint ? 1 : -1;
|
|
20986
|
-
ctx.save();
|
|
20987
|
-
ctx.shadowColor = "transparent";
|
|
20988
|
-
ctx.fillStyle = "rgba(255,255,255,0.75)";
|
|
20989
|
-
drawScaledText(ctx, text, x + offset, y + offset, scale);
|
|
20990
|
-
ctx.restore();
|
|
20991
|
-
}
|
|
20992
|
-
ctx.save();
|
|
20993
|
-
if (styles.textShadow) {
|
|
20994
|
-
const ts = styles.textShadow;
|
|
20995
|
-
const dirRad = ts.dirDeg * DEG_TO_RAD;
|
|
20996
|
-
const distPx = ts.distPt * PX_PER_POINT;
|
|
20997
|
-
ctx.shadowColor = hexToRgba(ts.color, ts.alpha ?? 1);
|
|
20998
|
-
ctx.shadowBlur = ts.blurPt * PX_PER_POINT;
|
|
20999
|
-
ctx.shadowOffsetX = Math.cos(dirRad) * distPx;
|
|
21000
|
-
ctx.shadowOffsetY = Math.sin(dirRad) * distPx;
|
|
21001
|
-
} else if (styles.glow) {
|
|
21002
|
-
const gl = styles.glow;
|
|
21003
|
-
ctx.shadowColor = hexToRgba(gl.color, gl.alpha ?? 0.7);
|
|
21004
|
-
ctx.shadowBlur = gl.radiusPt * PX_PER_POINT;
|
|
21005
|
-
ctx.shadowOffsetX = 0;
|
|
21006
|
-
ctx.shadowOffsetY = 0;
|
|
21007
|
-
} else if (styles.shadow) {
|
|
21008
|
-
ctx.shadowColor = "rgba(0,0,0,0.45)";
|
|
21009
|
-
ctx.shadowOffsetX = 1;
|
|
21010
|
-
ctx.shadowOffsetY = 1;
|
|
21011
|
-
ctx.shadowBlur = 1;
|
|
21012
|
-
}
|
|
21013
|
-
if (styles.textOutline) {
|
|
21014
|
-
ctx.strokeStyle = styles.textOutline.color ?? ctx.fillStyle;
|
|
21015
|
-
ctx.lineWidth = styles.textOutline.widthPt * PX_PER_POINT;
|
|
21016
|
-
drawScaledText(ctx, text, x, y, scale);
|
|
21017
|
-
if (scale === 1) {
|
|
21018
|
-
ctx.strokeText(text, x, y);
|
|
21019
|
-
} else {
|
|
21020
|
-
ctx.save();
|
|
21021
|
-
ctx.translate(x, y);
|
|
21022
|
-
ctx.scale(scale, 1);
|
|
21023
|
-
ctx.strokeText(text, 0, 0);
|
|
21024
|
-
ctx.restore();
|
|
21025
|
-
}
|
|
21026
|
-
} else if (styles.outline) {
|
|
21027
|
-
ctx.strokeStyle = ctx.fillStyle;
|
|
21028
|
-
ctx.lineWidth = 0.75;
|
|
21029
|
-
if (scale === 1) {
|
|
21030
|
-
ctx.strokeText(text, x, y);
|
|
21031
|
-
} else {
|
|
21032
|
-
ctx.translate(x, y);
|
|
21033
|
-
ctx.scale(scale, 1);
|
|
21034
|
-
ctx.strokeText(text, 0, 0);
|
|
21035
|
-
}
|
|
21036
|
-
} else {
|
|
21037
|
-
drawScaledText(ctx, text, x, y, scale);
|
|
21038
|
-
}
|
|
21039
|
-
ctx.restore();
|
|
21040
|
-
if (styles.reflection) {
|
|
21041
|
-
const ref = styles.reflection;
|
|
21042
|
-
const distPx = ref.distPt * PX_PER_POINT;
|
|
21043
|
-
const avgAlpha = Math.max(
|
|
21044
|
-
0,
|
|
21045
|
-
Math.min(1, (ref.startAlpha + ref.endAlpha) / 2)
|
|
21046
|
-
);
|
|
21047
|
-
ctx.save();
|
|
21048
|
-
ctx.shadowColor = "transparent";
|
|
21049
|
-
ctx.globalAlpha = avgAlpha;
|
|
21050
|
-
if (ref.blurPt > 0 && "filter" in ctx) {
|
|
21051
|
-
ctx.filter = `blur(${ref.blurPt * PX_PER_POINT}px)`;
|
|
21052
|
-
}
|
|
21053
|
-
ctx.translate(0, 2 * y + distPx);
|
|
21054
|
-
ctx.scale(1, -1);
|
|
21055
|
-
drawScaledText(ctx, text, x, y, scale);
|
|
21056
|
-
ctx.restore();
|
|
21057
|
-
}
|
|
21058
|
-
}
|
|
21059
|
-
function drawFragmentBorder(ctx, line, fragment, originX, originY, border) {
|
|
21060
|
-
if (border.type === "none" || border.width <= 0) return;
|
|
21061
|
-
const bounds = resolveFragmentPaintBounds(line, fragment);
|
|
21062
|
-
if (!bounds) return;
|
|
21063
|
-
const edge = { ...border, width: Math.max(0.5, border.width * PX_PER_POINT) };
|
|
21064
|
-
drawBorderBox(
|
|
21065
|
-
ctx,
|
|
21066
|
-
originX + bounds.left,
|
|
21067
|
-
originY + line.top + 1,
|
|
21068
|
-
Math.max(0, bounds.right - bounds.left),
|
|
21069
|
-
Math.max(2, line.height - 2),
|
|
21070
|
-
{ top: edge, right: edge, bottom: edge, left: edge }
|
|
21071
|
-
);
|
|
21072
|
-
}
|
|
21073
|
-
const EMPHASIS_GLYPH = {
|
|
21074
|
-
dot: "•",
|
|
21075
|
-
comma: "‚",
|
|
21076
|
-
circle: "○",
|
|
21077
|
-
underDot: "•"
|
|
21078
|
-
};
|
|
21079
|
-
function drawFragmentEmphasis(ctx, line, fragment, slotByOffset, originX, originY, mark, color) {
|
|
21080
|
-
if (mark === "none") return;
|
|
21081
|
-
const glyph = EMPHASIS_GLYPH[mark];
|
|
21082
|
-
if (!glyph) return;
|
|
21083
|
-
const below = mark === "underDot";
|
|
21084
|
-
const y = below ? originY + line.top + line.height + 1 : originY + line.top + 2;
|
|
21085
|
-
ctx.save();
|
|
21086
|
-
ctx.fillStyle = color;
|
|
21087
|
-
ctx.textAlign = "center";
|
|
21088
|
-
ctx.textBaseline = below ? "top" : "bottom";
|
|
21089
|
-
ctx.font = `400 ${Math.max(6, line.height * 0.35)}px Calibri`;
|
|
21090
|
-
for (const char of fragment.chars) {
|
|
21091
|
-
if (char.char === "\n" || char.char === " " || char.char === " ") continue;
|
|
21092
|
-
const slot = slotByOffset.get(char.paragraphOffset);
|
|
21093
|
-
const nextSlot = slotByOffset.get(char.paragraphOffset + 1);
|
|
21094
|
-
if (!slot) continue;
|
|
21095
|
-
const centerX = nextSlot ? (slot.left + nextSlot.left) / 2 : slot.left + line.height * 0.25;
|
|
21096
|
-
ctx.fillText(glyph, originX + centerX, y);
|
|
21097
|
-
}
|
|
21098
|
-
ctx.restore();
|
|
21099
|
-
}
|
|
21100
|
-
function drawTextFragment(ctx, paragraph, line, fragment, slotByOffset, state, styles, originX, baselineY) {
|
|
21101
|
-
const scale = styles.characterScale && styles.characterScale > 0 ? styles.characterScale / 100 : 1;
|
|
21102
|
-
const hasManualCharacterSpacing = styles.characterSpacing !== void 0 && styles.characterSpacing !== null && styles.characterSpacing !== 0;
|
|
21103
|
-
let segmentText = "";
|
|
21104
|
-
let segmentLeft = null;
|
|
21105
|
-
const flushSegment = () => {
|
|
21106
|
-
if (!segmentText || segmentLeft === null) {
|
|
21107
|
-
segmentText = "";
|
|
21108
|
-
segmentLeft = null;
|
|
21109
|
-
return;
|
|
21110
|
-
}
|
|
21111
|
-
drawStyledText(
|
|
21112
|
-
ctx,
|
|
21113
|
-
segmentText,
|
|
21114
|
-
originX + segmentLeft,
|
|
21115
|
-
baselineY,
|
|
21116
|
-
scale,
|
|
21117
|
-
styles
|
|
21118
|
-
);
|
|
21119
|
-
segmentText = "";
|
|
21120
|
-
segmentLeft = null;
|
|
21121
|
-
};
|
|
21122
|
-
for (const char of fragment.chars) {
|
|
21123
|
-
if (char.char === "\n") {
|
|
21124
|
-
flushSegment();
|
|
21125
|
-
continue;
|
|
21126
|
-
}
|
|
21127
|
-
const slot = slotByOffset.get(char.paragraphOffset);
|
|
21128
|
-
if (!slot) {
|
|
21129
|
-
flushSegment();
|
|
21130
|
-
continue;
|
|
21131
|
-
}
|
|
21132
|
-
if (char.char === " ") {
|
|
21133
|
-
flushSegment();
|
|
21134
|
-
const nextSlot = slotByOffset.get(char.paragraphOffset + 1);
|
|
21135
|
-
const leader = resolveTabLeader(paragraph, line, slot.left, state);
|
|
21136
|
-
if (nextSlot && leader) {
|
|
21137
|
-
drawTabLeader(
|
|
21138
|
-
ctx,
|
|
21139
|
-
leader,
|
|
21140
|
-
originX + slot.left,
|
|
21141
|
-
originX + nextSlot.left,
|
|
21142
|
-
baselineY
|
|
21143
|
-
);
|
|
21144
|
-
}
|
|
21145
|
-
continue;
|
|
21146
|
-
}
|
|
21147
|
-
const renderedChar = getRenderedChar(char.char, styles);
|
|
21148
|
-
if (hasManualCharacterSpacing) {
|
|
21149
|
-
flushSegment();
|
|
21150
|
-
drawStyledText(
|
|
21151
|
-
ctx,
|
|
21152
|
-
renderedChar,
|
|
21153
|
-
originX + slot.left,
|
|
21154
|
-
baselineY,
|
|
21155
|
-
scale,
|
|
21156
|
-
styles
|
|
21157
|
-
);
|
|
21158
|
-
continue;
|
|
21159
|
-
}
|
|
21160
|
-
if (char.char === " ") {
|
|
21161
|
-
flushSegment();
|
|
21162
|
-
segmentLeft = slot.left;
|
|
21163
|
-
segmentText = renderedChar;
|
|
21164
|
-
flushSegment();
|
|
21165
|
-
continue;
|
|
21166
|
-
}
|
|
21167
|
-
if (segmentLeft === null) {
|
|
21168
|
-
segmentLeft = slot.left;
|
|
21169
|
-
}
|
|
21170
|
-
segmentText += renderedChar;
|
|
21171
|
-
}
|
|
21172
|
-
flushSegment();
|
|
21173
|
-
}
|
|
21174
|
-
function drawFragmentReflection(ctx, fragment, slotByOffset, styles, originX, baselineY, reflection) {
|
|
21175
|
-
const firstChar = fragment.chars.find(
|
|
21176
|
-
(c) => c.char !== "\n" && c.char !== " "
|
|
21177
|
-
);
|
|
21178
|
-
if (!firstChar) return;
|
|
21179
|
-
const firstSlot = slotByOffset.get(firstChar.paragraphOffset);
|
|
21180
|
-
if (!firstSlot) return;
|
|
21181
|
-
const text = fragment.chars.filter((c) => c.char !== "\n" && c.char !== " ").map((c) => styles.allCaps ? c.char.toUpperCase() : c.char).join("");
|
|
21182
|
-
if (!text) return;
|
|
21183
|
-
const scale = styles.characterScale && styles.characterScale > 0 ? styles.characterScale / 100 : 1;
|
|
21184
|
-
const avgAlpha = (reflection.startAlpha + reflection.endAlpha) / 2;
|
|
21185
|
-
const distPx = reflection.distPt * PX_PER_POINT;
|
|
21186
|
-
const reflectY = baselineY + distPx;
|
|
21187
|
-
ctx.save();
|
|
21188
|
-
ctx.globalAlpha = (ctx.globalAlpha ?? 1) * avgAlpha;
|
|
21189
|
-
ctx.shadowColor = "transparent";
|
|
21190
|
-
ctx.shadowBlur = 0;
|
|
21191
|
-
ctx.shadowOffsetX = 0;
|
|
21192
|
-
ctx.shadowOffsetY = 0;
|
|
21193
|
-
ctx.translate(0, 2 * reflectY);
|
|
21194
|
-
ctx.scale(1, -1);
|
|
21195
|
-
const x = originX + firstSlot.left;
|
|
21196
|
-
if (scale === 1) {
|
|
21197
|
-
ctx.fillText(text, x, baselineY);
|
|
21198
|
-
} else {
|
|
21199
|
-
ctx.save();
|
|
21200
|
-
ctx.translate(x, baselineY);
|
|
21201
|
-
ctx.scale(scale, 1);
|
|
21202
|
-
ctx.fillText(text, 0, 0);
|
|
21203
|
-
ctx.restore();
|
|
21204
|
-
}
|
|
21205
|
-
ctx.restore();
|
|
21206
|
-
}
|
|
21207
|
-
function drawTextDecoration(ctx, line, fragment, originX, originY, kind, underlineStyle, underlineColor) {
|
|
21208
|
-
const bounds = resolveFragmentPaintBounds(line, fragment);
|
|
21209
|
-
if (!bounds) return;
|
|
21210
|
-
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;
|
|
21211
|
-
const x1 = originX + bounds.left;
|
|
21212
|
-
const x2 = originX + bounds.right;
|
|
21213
|
-
ctx.save();
|
|
21214
|
-
ctx.strokeStyle = underlineColor || ctx.fillStyle;
|
|
21215
|
-
if (kind === "underline") {
|
|
21216
|
-
drawUnderlineWithStyle(ctx, x1, x2, y, underlineStyle);
|
|
21217
|
-
} else if (kind === "doubleStrike") {
|
|
21218
|
-
ctx.beginPath();
|
|
21219
|
-
ctx.lineWidth = 1;
|
|
21220
|
-
ctx.setLineDash([]);
|
|
21221
|
-
ctx.moveTo(x1, y - DOUBLE_STRIKE_OFFSET_PX);
|
|
21222
|
-
ctx.lineTo(x2, y - DOUBLE_STRIKE_OFFSET_PX);
|
|
21223
|
-
ctx.moveTo(x1, y + DOUBLE_STRIKE_OFFSET_PX);
|
|
21224
|
-
ctx.lineTo(x2, y + DOUBLE_STRIKE_OFFSET_PX);
|
|
21225
|
-
ctx.stroke();
|
|
21226
|
-
} else {
|
|
21227
|
-
ctx.beginPath();
|
|
21228
|
-
ctx.lineWidth = 1;
|
|
21229
|
-
ctx.setLineDash([]);
|
|
21230
|
-
ctx.moveTo(x1, y);
|
|
21231
|
-
ctx.lineTo(x2, y);
|
|
21232
|
-
ctx.stroke();
|
|
21233
|
-
}
|
|
21234
|
-
ctx.restore();
|
|
21235
|
-
}
|
|
21236
|
-
function drawUnderlineWithStyle(ctx, x1, x2, y, underlineStyle) {
|
|
21237
|
-
ctx.setLineDash([]);
|
|
21238
|
-
ctx.lineWidth = underlineStyleLineWidthPx(underlineStyle);
|
|
21239
|
-
if (isDoubleUnderlineStyle(underlineStyle)) {
|
|
21240
|
-
ctx.beginPath();
|
|
21241
|
-
ctx.moveTo(x1, y - DOUBLE_UNDERLINE_OFFSET_PX);
|
|
21242
|
-
ctx.lineTo(x2, y - DOUBLE_UNDERLINE_OFFSET_PX);
|
|
21243
|
-
ctx.moveTo(x1, y + DOUBLE_UNDERLINE_OFFSET_PX);
|
|
21244
|
-
ctx.lineTo(x2, y + DOUBLE_UNDERLINE_OFFSET_PX);
|
|
21245
|
-
ctx.stroke();
|
|
21246
|
-
return;
|
|
21247
|
-
}
|
|
21248
|
-
if (isWavyUnderlineStyle(underlineStyle)) {
|
|
21249
|
-
drawWavyLine(ctx, x1, x2, y);
|
|
21250
|
-
return;
|
|
21251
|
-
}
|
|
21252
|
-
const dashArray = underlineStyleDashArray(underlineStyle);
|
|
21253
|
-
if (dashArray) {
|
|
21254
|
-
ctx.setLineDash(dashArray);
|
|
21255
|
-
}
|
|
21256
|
-
ctx.beginPath();
|
|
21257
|
-
ctx.moveTo(x1, y);
|
|
21258
|
-
ctx.lineTo(x2, y);
|
|
21259
|
-
ctx.stroke();
|
|
21260
|
-
ctx.setLineDash([]);
|
|
21261
|
-
}
|
|
21262
|
-
function drawWavyLine(ctx, x1, x2, y) {
|
|
21263
|
-
ctx.beginPath();
|
|
21264
|
-
ctx.moveTo(x1, y);
|
|
21265
|
-
for (let x = x1; x <= x2; x += 1) {
|
|
21266
|
-
const dy = Math.sin((x - x1) / WAVY_UNDERLINE_WAVELENGTH_PX * Math.PI) * WAVY_UNDERLINE_AMPLITUDE_PX;
|
|
21267
|
-
ctx.lineTo(x, y + dy);
|
|
21268
|
-
}
|
|
21269
|
-
ctx.stroke();
|
|
21270
|
-
}
|
|
21271
21233
|
const __vite_import_meta_env__ = { "DEV": false };
|
|
21272
21234
|
function drawVerticalCell(ctx, cell, state, pageIndex, onUpdate, painters) {
|
|
21273
21235
|
const box = {
|
|
@@ -42766,140 +42728,145 @@ export {
|
|
|
42766
42728
|
OasisEditorEditor as ay,
|
|
42767
42729
|
OasisBrandMark as az,
|
|
42768
42730
|
getPageBodyTop as b,
|
|
42769
|
-
|
|
42731
|
+
findParagraphLocation as b$,
|
|
42770
42732
|
getTextBoxFloatingGeometry as b0,
|
|
42771
42733
|
getPresetPathSegments as b1,
|
|
42772
42734
|
buildListLabels as b2,
|
|
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
|
-
|
|
42798
|
-
|
|
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
|
-
|
|
42735
|
+
PX_PER_POINT as b3,
|
|
42736
|
+
DEFAULT_FONT_SIZE_PX as b4,
|
|
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,
|
|
42833
42795
|
getPageBodyBottom as c,
|
|
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
|
-
|
|
42863
|
-
|
|
42864
|
-
|
|
42865
|
-
|
|
42866
|
-
|
|
42867
|
-
|
|
42868
|
-
|
|
42869
|
-
|
|
42870
|
-
|
|
42871
|
-
|
|
42872
|
-
|
|
42873
|
-
|
|
42874
|
-
|
|
42875
|
-
|
|
42876
|
-
|
|
42877
|
-
|
|
42878
|
-
|
|
42879
|
-
|
|
42880
|
-
|
|
42881
|
-
|
|
42882
|
-
|
|
42883
|
-
|
|
42884
|
-
|
|
42885
|
-
|
|
42886
|
-
|
|
42887
|
-
|
|
42888
|
-
|
|
42889
|
-
|
|
42890
|
-
|
|
42891
|
-
|
|
42892
|
-
|
|
42893
|
-
|
|
42894
|
-
|
|
42895
|
-
|
|
42896
|
-
|
|
42897
|
-
|
|
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,
|
|
42898
42860
|
domTextMeasurer as d,
|
|
42899
|
-
|
|
42900
|
-
|
|
42901
|
-
|
|
42902
|
-
|
|
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,
|
|
42903
42870
|
estimateTableBlockHeight as e,
|
|
42904
42871
|
getFootnoteDisplayMarker as f,
|
|
42905
42872
|
getProjectedParagraphBlockHeight as g,
|