oasis-editor 0.0.65 → 0.0.67
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-Bp4TNPC7.js → OasisEditorApp-KBzB35kG.js} +92 -76
- package/dist/assets/{importDocxWorker-BWyqey19.js → importDocxWorker-Bn1fun73.js} +1 -1
- package/dist/core/Editor.d.ts +13 -4
- package/dist/core/assertNever.d.ts +11 -0
- package/dist/{index-DhCqxHGZ.js → index-CH7dSKgO.js} +253 -240
- package/dist/oasis-editor.js +54 -54
- package/dist/oasis-editor.umd.cjs +4 -4
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { n as normalizeSelection, g as getParagraphs, c as createEditorParagraphFromRuns, a as getParagraphLength, b as createEditorRun, d as getDocumentSections, e as createEditorStyledRun, f as getParagraphText, h as getActiveZone, i as getActiveSectionIndex, p as positionToParagraphOffset, j as paragraphOffsetToPosition, k as clampPosition, l as findParagraphIndex, m as createCollapsedSelection, o as isSelectionCollapsed, E as EMU_PER_PX, q as
|
|
4
|
+
import { n as normalizeSelection, g as getParagraphs, c as createEditorParagraphFromRuns, a as getParagraphLength, b as createEditorRun, d as getDocumentSections, e as createEditorStyledRun, f as getParagraphText, h as getActiveZone, i as getActiveSectionIndex, p as positionToParagraphOffset, j as paragraphOffsetToPosition, k as clampPosition, l as findParagraphIndex, m as createCollapsedSelection, o as isSelectionCollapsed, E as EMU_PER_PX, q as assertNever, r as createEditorParagraph, s as getBlockParagraphs, t as createEditorFootnote, u as createFootnoteReferenceRun, v as renumberFootnotes, w as iterateFootnoteReferenceRuns, x as getFootnoteDisplayMarker, y as findParagraphTableLocation, z as buildTableCellLayout, A as createSignal, B as createEffect, C as onCleanup, D as buildCanvasLayoutSnapshot, F as on, G as onMount, H as debounce, I as unwrap, J as getDocumentParagraphs, P as PT_PER_PX, K as createEditorTableCell, L as createEditorTableRow, M as createEditorTable, N as getDocumentSectionsCanonical, O as createEditorDocument, Q as getPageContentWidth, R as getDocumentPageSettings, S as getTableCellContentWidthForParagraph, T as resolveResizedDimensions, U as resolveImageSrc, V as resolveTextBoxRenderHeight, W as TWIPS_PER_POINT, X as PX_PER_INCH, Y as TWIPS_PER_INCH, Z as resolveEffectiveParagraphStyle, _ as resolveEffectiveTextStyleForParagraph, $ as EMU_PER_PT, a0 as iterateEndnoteReferenceRuns, a1 as imageContentTypeDefaults, a2 as JSZip, a3 as imageExtensionFromMime, a4 as pxToPt$1, a5 as resolveFloatingObjectRect, a6 as getTextBoxFloatingGeometry, a7 as getPresetPathSegments, a8 as projectBlocksLayout, a9 as buildListLabels, aa as textStyleToFontSizePt, ab as PX_PER_POINT, ac as DEFAULT_FONT_SIZE_PX, ad as isDoubleUnderlineStyle, ae as isWavyUnderlineStyle, af as underlineStyleLineWidthPx, ag as underlineStyleDashArray, ah as resolveListLabel, ai as getListLabelInset, aj as getAlignedListLabelInset, ak as getParagraphBorderInsets, al as buildSegmentTable, am as buildCanvasTableLayout, an as normalizeFamily, ao as ROBOTO_FONT_FILES, ap as loadFontAsset, aq as OFFICE_COMPAT_FONT_FAMILIES, ar as buildSfnt, as as defaultFontDecoderRegistry, at as SfntFontProgram, au as collectPdfFontFamilies, av as projectDocumentLayout, aw as getPageHeaderZoneTop, ax as getPageBodyTop, ay as getPageColumnRects, az as findFootnoteReference, aA as FOOTNOTE_MARKER_GUTTER_PX, aB as resolveImporterForFile, aC as createEditorStateFromDocument, aD as getDocumentParagraphsCanonical, aE as getToolbarStyleState, aF as STANDARD_FONT_SIZES_PT, aG as fontSizePxToPt, aH as probeLocalFontFamilies, aI as createInitialEditorState, aJ as parseFontSizePtToPx, aK as formatFontSizePt, aL as underlineStyleToCssDecorationStyle, aM as listKindForTag, aN as isParagraphTag, aO as collectInlineRuns, aP as parseParagraphStyle, aQ as getCachedCanvasImage, aR as getHeadingLevel, aS as preciseFontModeVersion, aT as isPreciseFontModeEnabled, aU as togglePreciseFontMode, aV as nextFontSizePt, aW as previousFontSizePt, aX as fontSizePtToPx, aY as createDefaultToolbarPreset, aZ as MenuRegistry, a_ as createToolbarRegistry, a$ as Editor, b0 as resolveCommandRef, b1 as commandRefName, b2 as InlineShell, b3 as BalloonShell, b4 as DocumentShell, b5 as createMemo, b6 as getCaretRectFromSnapshot, b7 as getParagraphRectFromSnapshot, b8 as createComponent, b9 as CaretOverlay, ba as Show, bb as createRenderEffect, bc as style, bd as setAttribute, be as setStyleProperty, bf as memo, bg as template, bh as useI18n, bi as insert, bj as use, bk as addEventListener, bl as Dialog, bm as delegateEvents, bn as className, bo as For, bp as UNDERLINE_STYLE_OPTIONS, bq as Tabs, br as measureParagraphMinContentWidthPx, bs as getEditableBlocksForZone, bt as findParagraphLocation, bu as createSectionBoundaryParagraph, bv as normalizePageSettings, bw as DEFAULT_EDITOR_PAGE_SETTINGS, bx as markStart, by as markEnd, bz as getParagraphEntries, bA as getParagraphById, bB as PluginUiHost, bC as OasisEditorEditor, bD as perfTimer, bE as OasisBrandMark, bF as setPreciseFontPreference, bG as setWelcomeSeen, bH as enablePreciseFontMode, bI as createOasisEditorClient, bJ as createEditorZoom, bK as startLongTaskObserver, bL as installGlobalReport, bM as applyStoredPreciseFontPreference, bN as getWelcomeSeen, bO as isLocalFontAccessSupported, bP as EDITOR_SCROLL_PADDING_PX, bQ as Toolbar, bR as OasisEditorLoading, bS as I18nProvider, bT as createEditorLogger, bU as createTranslator, bV as registerDomStatsSurface } from "./index-CH7dSKgO.js";
|
|
5
5
|
function getSelectedObjectRun(state, predicate) {
|
|
6
6
|
const normalized = normalizeSelection(state);
|
|
7
7
|
if (normalized.isCollapsed || normalized.startIndex !== normalized.endIndex || normalized.endParagraphOffset - normalized.startParagraphOffset !== 1) {
|
|
@@ -1441,60 +1441,67 @@ function resizeSelectedTextBox(state, width, height, options = {}) {
|
|
|
1441
1441
|
);
|
|
1442
1442
|
}
|
|
1443
1443
|
function cloneBlock(block) {
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
style: row.style ? {
|
|
1469
|
-
...row.style,
|
|
1470
|
-
revisionXml: row.style.revisionXml ? [...row.style.revisionXml] : void 0
|
|
1471
|
-
} : void 0,
|
|
1472
|
-
cells: row.cells.map((cell) => ({
|
|
1473
|
-
...cell,
|
|
1474
|
-
colSpan: cell.colSpan ?? void 0,
|
|
1475
|
-
rowSpan: cell.rowSpan ?? void 0,
|
|
1476
|
-
vMerge: cell.vMerge ?? void 0,
|
|
1477
|
-
style: cell.style ? {
|
|
1478
|
-
...cell.style,
|
|
1479
|
-
revisionXml: cell.style.revisionXml ? [...cell.style.revisionXml] : void 0
|
|
1444
|
+
switch (block.type) {
|
|
1445
|
+
case "paragraph":
|
|
1446
|
+
return {
|
|
1447
|
+
...block,
|
|
1448
|
+
runs: block.runs.map((run) => ({
|
|
1449
|
+
...run,
|
|
1450
|
+
styles: run.styles ? { ...run.styles } : void 0,
|
|
1451
|
+
image: run.image ? { ...run.image } : void 0,
|
|
1452
|
+
field: run.field ? { ...run.field } : void 0,
|
|
1453
|
+
revision: run.revision ? { ...run.revision } : void 0,
|
|
1454
|
+
footnoteReference: run.footnoteReference ? { ...run.footnoteReference } : void 0,
|
|
1455
|
+
endnoteReference: run.endnoteReference ? { ...run.endnoteReference } : void 0
|
|
1456
|
+
})),
|
|
1457
|
+
style: block.style ? { ...block.style } : void 0,
|
|
1458
|
+
list: block.list ? { ...block.list } : void 0
|
|
1459
|
+
};
|
|
1460
|
+
case "table":
|
|
1461
|
+
return {
|
|
1462
|
+
...block,
|
|
1463
|
+
style: block.style ? {
|
|
1464
|
+
...block.style,
|
|
1465
|
+
defaultCellMargins: block.style.defaultCellMargins ? { ...block.style.defaultCellMargins } : void 0,
|
|
1466
|
+
floating: block.style.floating ? { ...block.style.floating } : void 0,
|
|
1467
|
+
revisionXml: block.style.revisionXml ? [...block.style.revisionXml] : void 0
|
|
1480
1468
|
} : void 0,
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1469
|
+
tblGridChangeXml: block.tblGridChangeXml,
|
|
1470
|
+
rows: block.rows.map((row) => ({
|
|
1471
|
+
...row,
|
|
1472
|
+
style: row.style ? {
|
|
1473
|
+
...row.style,
|
|
1474
|
+
revisionXml: row.style.revisionXml ? [...row.style.revisionXml] : void 0
|
|
1475
|
+
} : void 0,
|
|
1476
|
+
cells: row.cells.map((cell) => ({
|
|
1477
|
+
...cell,
|
|
1478
|
+
colSpan: cell.colSpan ?? void 0,
|
|
1479
|
+
rowSpan: cell.rowSpan ?? void 0,
|
|
1480
|
+
vMerge: cell.vMerge ?? void 0,
|
|
1481
|
+
style: cell.style ? {
|
|
1482
|
+
...cell.style,
|
|
1483
|
+
revisionXml: cell.style.revisionXml ? [...cell.style.revisionXml] : void 0
|
|
1484
|
+
} : void 0,
|
|
1485
|
+
blocks: cell.blocks.map((paragraph) => ({
|
|
1486
|
+
...paragraph,
|
|
1487
|
+
runs: paragraph.runs.map((run) => ({
|
|
1488
|
+
...run,
|
|
1489
|
+
styles: run.styles ? { ...run.styles } : void 0,
|
|
1490
|
+
image: run.image ? { ...run.image } : void 0,
|
|
1491
|
+
field: run.field ? { ...run.field } : void 0,
|
|
1492
|
+
revision: run.revision ? { ...run.revision } : void 0,
|
|
1493
|
+
footnoteReference: run.footnoteReference ? { ...run.footnoteReference } : void 0,
|
|
1494
|
+
endnoteReference: run.endnoteReference ? { ...run.endnoteReference } : void 0
|
|
1495
|
+
})),
|
|
1496
|
+
style: paragraph.style ? { ...paragraph.style } : void 0,
|
|
1497
|
+
list: paragraph.list ? { ...paragraph.list } : void 0
|
|
1498
|
+
}))
|
|
1499
|
+
}))
|
|
1494
1500
|
}))
|
|
1495
|
-
}
|
|
1496
|
-
|
|
1497
|
-
|
|
1501
|
+
};
|
|
1502
|
+
default:
|
|
1503
|
+
return assertNever(block, "block");
|
|
1504
|
+
}
|
|
1498
1505
|
}
|
|
1499
1506
|
function cloneSection(section) {
|
|
1500
1507
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -8632,19 +8639,24 @@ function serializeRunsWithBoundaries(runs, tokens, context, paragraphStyleId, st
|
|
|
8632
8639
|
function serializeBlocksXml(blocks, context, styles) {
|
|
8633
8640
|
return blocks.map((block) => {
|
|
8634
8641
|
var _a;
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
|
|
8639
|
-
(
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8642
|
+
switch (block.type) {
|
|
8643
|
+
case "paragraph":
|
|
8644
|
+
return serializeParagraphXml(block, context, styles);
|
|
8645
|
+
case "table": {
|
|
8646
|
+
const pageBreakXml = ((_a = block.style) == null ? void 0 : _a.pageBreakBefore) ? '<w:p><w:r><w:br w:type="page"/></w:r></w:p>' : "";
|
|
8647
|
+
return pageBreakXml + serializeTableXml(
|
|
8648
|
+
block,
|
|
8649
|
+
(paragraph, cell) => {
|
|
8650
|
+
var _a2;
|
|
8651
|
+
return serializeParagraphXml(paragraph, context, styles, {
|
|
8652
|
+
align: (_a2 = cell.style) == null ? void 0 : _a2.horizontalAlign
|
|
8653
|
+
});
|
|
8654
|
+
}
|
|
8655
|
+
);
|
|
8656
|
+
}
|
|
8657
|
+
default:
|
|
8658
|
+
return assertNever(block, "block");
|
|
8646
8659
|
}
|
|
8647
|
-
return serializeParagraphXml(block, context, styles);
|
|
8648
8660
|
}).join("");
|
|
8649
8661
|
}
|
|
8650
8662
|
function serializeParagraphXml(paragraph, context, styles, overrides) {
|
|
@@ -9101,16 +9113,21 @@ function visitParagraphDeep(paragraph, callback) {
|
|
|
9101
9113
|
}
|
|
9102
9114
|
function visitBlocks(blocks, callback) {
|
|
9103
9115
|
for (const block of blocks) {
|
|
9104
|
-
|
|
9105
|
-
|
|
9106
|
-
|
|
9107
|
-
|
|
9108
|
-
|
|
9109
|
-
|
|
9110
|
-
|
|
9111
|
-
|
|
9116
|
+
switch (block.type) {
|
|
9117
|
+
case "paragraph":
|
|
9118
|
+
visitParagraphDeep(block, callback);
|
|
9119
|
+
break;
|
|
9120
|
+
case "table":
|
|
9121
|
+
for (const row of block.rows) {
|
|
9122
|
+
for (const cell of row.cells) {
|
|
9123
|
+
for (const paragraph of cell.blocks) {
|
|
9124
|
+
visitParagraphDeep(paragraph, callback);
|
|
9125
|
+
}
|
|
9126
|
+
}
|
|
9112
9127
|
}
|
|
9113
|
-
|
|
9128
|
+
break;
|
|
9129
|
+
default:
|
|
9130
|
+
assertNever(block, "block");
|
|
9114
9131
|
}
|
|
9115
9132
|
}
|
|
9116
9133
|
}
|
|
@@ -42537,8 +42554,7 @@ function createRuntimeCommandHost(options) {
|
|
|
42537
42554
|
const [runtimeReady, setRuntimeReady] = createSignal(false);
|
|
42538
42555
|
const [runtimeEditor, setRuntimeEditor] = createSignal(
|
|
42539
42556
|
new Editor({
|
|
42540
|
-
doc: options.initialDocument
|
|
42541
|
-
plugins: []
|
|
42557
|
+
doc: options.initialDocument
|
|
42542
42558
|
})
|
|
42543
42559
|
);
|
|
42544
42560
|
let disposed = false;
|