oasis-editor 0.0.42 → 0.0.43
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-Cx-3bgIC.js → OasisEditorApp-BOjvnIF_.js} +9 -18
- package/dist/assets/{importDocxWorker-CMMv6C-7.js → importDocxWorker-BFWGoKvI.js} +1 -1
- package/dist/core/units.d.ts +18 -0
- package/dist/export/docx/text/constants.d.ts +1 -2
- package/dist/export/pdf/units.d.ts +1 -0
- package/dist/import/docx/runs/units.d.ts +3 -4
- package/dist/import/docx/units.d.ts +3 -2
- package/dist/{index-CTh8mekn.js → index-Cgq5T30U.js} +223 -223
- package/dist/layoutProjection/constants.d.ts +1 -2
- package/dist/oasis-editor.js +54 -54
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/ui/components/Ruler/rulerGeometry.d.ts +2 -2
- package/dist/ui/textMeasurement/constants.d.ts +1 -2
- 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, q as createEditorParagraph, r as getBlockParagraphs, s as findParagraphTableLocation, t as buildTableCellLayout, u as createEditorTableCell, v as createEditorTableRow, w as createEditorTable, x as underlineStyleToCssDecorationStyle, y as resolveImageSrc, z as createEditorFootnote, A as createFootnoteReferenceRun, B as renumberFootnotes, C as iterateFootnoteReferenceRuns, D as getFootnoteDisplayMarker,
|
|
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 createEditorParagraph, r as getBlockParagraphs, s as findParagraphTableLocation, t as buildTableCellLayout, P as PT_PER_PX, u as createEditorTableCell, v as createEditorTableRow, w as createEditorTable, x as underlineStyleToCssDecorationStyle, y as resolveImageSrc, z as createEditorFootnote, A as createFootnoteReferenceRun, B as renumberFootnotes, C as iterateFootnoteReferenceRuns, D as getFootnoteDisplayMarker, F as createSignal, G as createEffect, H as onCleanup, I as buildCanvasLayoutSnapshot, J as on, K as onMount, L as debounce, M as unwrap, N as getDocumentParagraphs, O as getDocumentSectionsCanonical, Q as createEditorDocument, R as getPageContentWidth, S as getDocumentPageSettings, T as getTableCellContentWidthForParagraph, U as resolveResizedDimensions, 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 JSZip, a2 as imageContentTypeDefaults, 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 listKindForTag, aM as isParagraphTag, aN as collectInlineRuns, aO as parseParagraphStyle, aP as getCachedCanvasImage, aQ as getHeadingLevel, aR as preciseFontModeVersion, aS as isPreciseFontModeEnabled, aT as togglePreciseFontMode, aU as nextFontSizePt, aV as previousFontSizePt, aW as fontSizePtToPx, aX as createDefaultToolbarPreset, aY as MenuRegistry, aZ as createToolbarRegistry, a_ as Editor, a$ as resolveCommandRef, b0 as commandRefName, b1 as InlineShell, b2 as BalloonShell, b3 as DocumentShell, b4 as createMemo, b5 as getCaretRectFromSnapshot, b6 as getParagraphRectFromSnapshot, b7 as createComponent, b8 as CaretOverlay, b9 as Show, ba as createRenderEffect, bb as style, bc as setAttribute, bd as setStyleProperty, be as memo, bf as template, bg as useI18n, bh as insert, bi as use, bj as addEventListener, bk as Dialog, bl as delegateEvents, bm as className, bn as For, bo as UNDERLINE_STYLE_OPTIONS, bp as Tabs, bq as measureParagraphMinContentWidthPx, br as getEditableBlocksForZone, bs as findParagraphLocation, bt as createSectionBoundaryParagraph, bu as normalizePageSettings, bv as DEFAULT_EDITOR_PAGE_SETTINGS, bw as markStart, bx as markEnd, by as getParagraphEntries, bz as getParagraphById, bA as PluginUiHost, bB as OasisEditorEditor, bC as perfTimer, bD as OasisBrandMark, bE as setPreciseFontPreference, bF as setWelcomeSeen, bG as enablePreciseFontMode, bH as createOasisEditorClient, bI as createEditorZoom, bJ as startLongTaskObserver, bK as installGlobalReport, bL as applyStoredPreciseFontPreference, bM as getWelcomeSeen, bN as isLocalFontAccessSupported, bO as EDITOR_SCROLL_PADDING_PX, bP as Toolbar, bQ as OasisEditorLoading, bR as I18nProvider, bS as createEditorLogger, bT as createTranslator, bU as registerDomStatsSurface } from "./index-Cgq5T30U.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) {
|
|
@@ -1252,7 +1252,6 @@ function moveSelectedImageToPosition(state, targetPosition) {
|
|
|
1252
1252
|
withSelection(paragraphOffsetToPosition(insertedParagraph, insertedOffset))
|
|
1253
1253
|
);
|
|
1254
1254
|
}
|
|
1255
|
-
const EMU_PER_PX$1 = 9525;
|
|
1256
1255
|
const MIN_TEXT_BOX_SIZE_PX = 24;
|
|
1257
1256
|
function getSelectedTextBoxRun(state) {
|
|
1258
1257
|
return getSelectedObjectRun(state, (run) => Boolean(run.textBox));
|
|
@@ -1266,7 +1265,7 @@ function shiftFloatingForResize(floating, widthDelta, heightDelta, growsFromWest
|
|
|
1266
1265
|
...next,
|
|
1267
1266
|
positionH: {
|
|
1268
1267
|
...h ?? {},
|
|
1269
|
-
offset: ((h == null ? void 0 : h.offset) ?? 0) - widthDelta * EMU_PER_PX
|
|
1268
|
+
offset: ((h == null ? void 0 : h.offset) ?? 0) - widthDelta * EMU_PER_PX
|
|
1270
1269
|
}
|
|
1271
1270
|
};
|
|
1272
1271
|
}
|
|
@@ -1278,7 +1277,7 @@ function shiftFloatingForResize(floating, widthDelta, heightDelta, growsFromWest
|
|
|
1278
1277
|
...next,
|
|
1279
1278
|
positionV: {
|
|
1280
1279
|
...v ?? {},
|
|
1281
|
-
offset: ((v == null ? void 0 : v.offset) ?? 0) - heightDelta * EMU_PER_PX
|
|
1280
|
+
offset: ((v == null ? void 0 : v.offset) ?? 0) - heightDelta * EMU_PER_PX
|
|
1282
1281
|
}
|
|
1283
1282
|
};
|
|
1284
1283
|
}
|
|
@@ -2882,7 +2881,7 @@ function parseWidthToPt(value) {
|
|
|
2882
2881
|
}
|
|
2883
2882
|
if (trimmed.endsWith("px")) {
|
|
2884
2883
|
const parsed2 = Number.parseFloat(trimmed.slice(0, -2));
|
|
2885
|
-
return Number.isFinite(parsed2) ? parsed2 *
|
|
2884
|
+
return Number.isFinite(parsed2) ? parsed2 * PT_PER_PX : null;
|
|
2886
2885
|
}
|
|
2887
2886
|
if (!/^[+-]?\d+(\.\d+)?$/.test(trimmed)) {
|
|
2888
2887
|
return null;
|
|
@@ -7572,9 +7571,6 @@ const WORD_NS$1 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main"
|
|
|
7572
7571
|
const PACKAGE_REL_NS = "http://schemas.openxmlformats.org/package/2006/relationships";
|
|
7573
7572
|
const OFFICE_REL_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
7574
7573
|
const WORD14_NS = "http://schemas.microsoft.com/office/word/2010/wordml";
|
|
7575
|
-
const TWIPS_PER_INCH$1 = 1440;
|
|
7576
|
-
const PX_PER_INCH$1 = 96;
|
|
7577
|
-
const TWIPS_PER_POINT = 20;
|
|
7578
7574
|
function escapeXml(text) {
|
|
7579
7575
|
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
7580
7576
|
}
|
|
@@ -7582,19 +7578,19 @@ function pxToTwips(value, fallback) {
|
|
|
7582
7578
|
if (!Number.isFinite(value)) {
|
|
7583
7579
|
return fallback;
|
|
7584
7580
|
}
|
|
7585
|
-
return Math.max(0, Math.round(value / PX_PER_INCH
|
|
7581
|
+
return Math.max(0, Math.round(value / PX_PER_INCH * TWIPS_PER_INCH));
|
|
7586
7582
|
}
|
|
7587
7583
|
function toTwips(value) {
|
|
7588
7584
|
if (value === void 0 || value === null || !Number.isFinite(value)) {
|
|
7589
7585
|
return null;
|
|
7590
7586
|
}
|
|
7591
|
-
return Math.round(value / PX_PER_INCH
|
|
7587
|
+
return Math.round(value / PX_PER_INCH * TWIPS_PER_INCH);
|
|
7592
7588
|
}
|
|
7593
7589
|
function toHalfPoints(value) {
|
|
7594
7590
|
if (value === void 0 || value === null || !Number.isFinite(value)) {
|
|
7595
7591
|
return null;
|
|
7596
7592
|
}
|
|
7597
|
-
return Math.round(value / PX_PER_INCH
|
|
7593
|
+
return Math.round(value / PX_PER_INCH * 72 * 2);
|
|
7598
7594
|
}
|
|
7599
7595
|
function pointsToTwips(value) {
|
|
7600
7596
|
if (value === void 0 || value === null || !Number.isFinite(value)) {
|
|
@@ -8336,8 +8332,6 @@ function serializeParagraphProperties(paragraph, numberingInfo, styles, override
|
|
|
8336
8332
|
}
|
|
8337
8333
|
return parts.length > 0 ? `<w:pPr>${parts.join("")}</w:pPr>` : "";
|
|
8338
8334
|
}
|
|
8339
|
-
const EMU_PER_PX = 9525;
|
|
8340
|
-
const EMU_PER_PT = 12700;
|
|
8341
8335
|
const DOCX_HIGHLIGHT_COLORS = {
|
|
8342
8336
|
black: [0, 0, 0],
|
|
8343
8337
|
blue: [0, 0, 255],
|
|
@@ -10757,7 +10751,7 @@ function drawListPrefix(writer, pageIndex, paragraph, line, document2, originX,
|
|
|
10757
10751
|
});
|
|
10758
10752
|
const labelInset = getListLabelInset(paragraph, document2.styles);
|
|
10759
10753
|
const fontSizePt = textStyleToFontSizePt(styles);
|
|
10760
|
-
const estimatedLabelWidthPx = prefix.length * fontSizePt * 0.62 *
|
|
10754
|
+
const estimatedLabelWidthPx = prefix.length * fontSizePt * 0.62 * PX_PER_POINT;
|
|
10761
10755
|
const alignedInset = getAlignedListLabelInset(
|
|
10762
10756
|
paragraph,
|
|
10763
10757
|
document2.styles,
|
|
@@ -40981,9 +40975,6 @@ function createEditorLayoutOptionsController(deps) {
|
|
|
40981
40975
|
}
|
|
40982
40976
|
const DEFAULT_TOC_MAX_LEVEL = 3;
|
|
40983
40977
|
const TOC_INSTRUCTION = ' TOC \\o "1-3" \\h \\z \\u ';
|
|
40984
|
-
const PX_TO_PT = 72 / 96;
|
|
40985
|
-
const TWIPS_PER_INCH = 1440;
|
|
40986
|
-
const PX_PER_INCH = 96;
|
|
40987
40978
|
const twipsToPx = (twips) => Math.round(twips / TWIPS_PER_INCH * PX_PER_INCH);
|
|
40988
40979
|
function collectTocHeadings(state, maxLevel = DEFAULT_TOC_MAX_LEVEL) {
|
|
40989
40980
|
var _a;
|
|
@@ -41020,7 +41011,7 @@ function buildEntryParagraph(heading, pageNumber, rightTabPositionPt) {
|
|
|
41020
41011
|
function rightTabPositionForSection(section) {
|
|
41021
41012
|
const { width, margins } = section.pageSettings;
|
|
41022
41013
|
const contentWidthPx = Math.max(0, width - margins.left - margins.right);
|
|
41023
|
-
return Math.round(contentWidthPx *
|
|
41014
|
+
return Math.round(contentWidthPx * PT_PER_PX * 100) / 100;
|
|
41024
41015
|
}
|
|
41025
41016
|
function buildStartMarkerParagraph() {
|
|
41026
41017
|
return makeParagraph([
|