oasis-editor 0.0.60 → 0.0.62
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-BQ5KeU1o.js → OasisEditorApp-BG3tA5Y-.js} +1 -1
- package/dist/{index-DiZU2BUt.js → index-BNRIgieX.js} +78 -78
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +1 -1
- package/dist/ui/canvas/canvasFloatingReaders.d.ts +87 -0
- package/dist/ui/canvas/canvasInlineReaders.d.ts +62 -0
- 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 createEditorParagraph, r as getBlockParagraphs, s as createEditorFootnote, t as createFootnoteReferenceRun, u as renumberFootnotes, v as iterateFootnoteReferenceRuns, w as getFootnoteDisplayMarker, x as findParagraphTableLocation, y as buildTableCellLayout, z as createSignal, A as createEffect, B as onCleanup, C as buildCanvasLayoutSnapshot, D as on, F as onMount, G as debounce, H as unwrap, I as getDocumentParagraphs, P as PT_PER_PX, J as createEditorTableCell, K as createEditorTableRow, L as createEditorTable, M as getDocumentSectionsCanonical, N as createEditorDocument, O as getPageContentWidth, Q as getDocumentPageSettings, R as getTableCellContentWidthForParagraph, S as resolveResizedDimensions, T as resolveImageSrc, U as resolveTextBoxRenderHeight, V as TWIPS_PER_POINT, W as PX_PER_INCH, X as TWIPS_PER_INCH, Y as resolveEffectiveParagraphStyle, Z as resolveEffectiveTextStyleForParagraph, _ as EMU_PER_PT, $ as iterateEndnoteReferenceRuns, a0 as imageContentTypeDefaults, a1 as JSZip, a2 as imageExtensionFromMime, a3 as pxToPt$1, a4 as resolveFloatingObjectRect, a5 as getTextBoxFloatingGeometry, a6 as getPresetPathSegments, a7 as projectBlocksLayout, a8 as buildListLabels, a9 as textStyleToFontSizePt, aa as PX_PER_POINT, ab as DEFAULT_FONT_SIZE_PX, ac as isDoubleUnderlineStyle, ad as isWavyUnderlineStyle, ae as underlineStyleLineWidthPx, af as underlineStyleDashArray, ag as resolveListLabel, ah as getListLabelInset, ai as getAlignedListLabelInset, aj as getParagraphBorderInsets, ak as buildSegmentTable, al as buildCanvasTableLayout, am as normalizeFamily, an as ROBOTO_FONT_FILES, ao as loadFontAsset, ap as OFFICE_COMPAT_FONT_FAMILIES, aq as buildSfnt, ar as defaultFontDecoderRegistry, as as SfntFontProgram, at as collectPdfFontFamilies, au as projectDocumentLayout, av as getPageHeaderZoneTop, aw as getPageBodyTop, ax as getPageColumnRects, ay as findFootnoteReference, az as FOOTNOTE_MARKER_GUTTER_PX, aA as resolveImporterForFile, aB as createEditorStateFromDocument, aC as getDocumentParagraphsCanonical, aD as getToolbarStyleState, aE as STANDARD_FONT_SIZES_PT, aF as fontSizePxToPt, aG as probeLocalFontFamilies, aH as createInitialEditorState, aI as parseFontSizePtToPx, aJ as formatFontSizePt, aK as underlineStyleToCssDecorationStyle, 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-
|
|
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 createEditorFootnote, t as createFootnoteReferenceRun, u as renumberFootnotes, v as iterateFootnoteReferenceRuns, w as getFootnoteDisplayMarker, x as findParagraphTableLocation, y as buildTableCellLayout, z as createSignal, A as createEffect, B as onCleanup, C as buildCanvasLayoutSnapshot, D as on, F as onMount, G as debounce, H as unwrap, I as getDocumentParagraphs, P as PT_PER_PX, J as createEditorTableCell, K as createEditorTableRow, L as createEditorTable, M as getDocumentSectionsCanonical, N as createEditorDocument, O as getPageContentWidth, Q as getDocumentPageSettings, R as getTableCellContentWidthForParagraph, S as resolveResizedDimensions, T as resolveImageSrc, U as resolveTextBoxRenderHeight, V as TWIPS_PER_POINT, W as PX_PER_INCH, X as TWIPS_PER_INCH, Y as resolveEffectiveParagraphStyle, Z as resolveEffectiveTextStyleForParagraph, _ as EMU_PER_PT, $ as iterateEndnoteReferenceRuns, a0 as imageContentTypeDefaults, a1 as JSZip, a2 as imageExtensionFromMime, a3 as pxToPt$1, a4 as resolveFloatingObjectRect, a5 as getTextBoxFloatingGeometry, a6 as getPresetPathSegments, a7 as projectBlocksLayout, a8 as buildListLabels, a9 as textStyleToFontSizePt, aa as PX_PER_POINT, ab as DEFAULT_FONT_SIZE_PX, ac as isDoubleUnderlineStyle, ad as isWavyUnderlineStyle, ae as underlineStyleLineWidthPx, af as underlineStyleDashArray, ag as resolveListLabel, ah as getListLabelInset, ai as getAlignedListLabelInset, aj as getParagraphBorderInsets, ak as buildSegmentTable, al as buildCanvasTableLayout, am as normalizeFamily, an as ROBOTO_FONT_FILES, ao as loadFontAsset, ap as OFFICE_COMPAT_FONT_FAMILIES, aq as buildSfnt, ar as defaultFontDecoderRegistry, as as SfntFontProgram, at as collectPdfFontFamilies, au as projectDocumentLayout, av as getPageHeaderZoneTop, aw as getPageBodyTop, ax as getPageColumnRects, ay as findFootnoteReference, az as FOOTNOTE_MARKER_GUTTER_PX, aA as resolveImporterForFile, aB as createEditorStateFromDocument, aC as getDocumentParagraphsCanonical, aD as getToolbarStyleState, aE as STANDARD_FONT_SIZES_PT, aF as fontSizePxToPt, aG as probeLocalFontFamilies, aH as createInitialEditorState, aI as parseFontSizePtToPx, aJ as formatFontSizePt, aK as underlineStyleToCssDecorationStyle, 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-BNRIgieX.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) {
|
|
@@ -2483,7 +2483,7 @@ function OasisEditorAppLazy(props = {}) {
|
|
|
2483
2483
|
onCleanup(() => {
|
|
2484
2484
|
cancelled = true;
|
|
2485
2485
|
});
|
|
2486
|
-
import("./OasisEditorApp-
|
|
2486
|
+
import("./OasisEditorApp-BG3tA5Y-.js").then((m) => {
|
|
2487
2487
|
cancelled = true;
|
|
2488
2488
|
setProgress(1);
|
|
2489
2489
|
setTimeout(() => setApp(() => m.OasisEditorApp), 180);
|
|
@@ -15077,83 +15077,6 @@ function resolveTextBoxRenderHeight(textBox, state, pageIndex) {
|
|
|
15077
15077
|
}
|
|
15078
15078
|
return measureTextBoxNaturalHeight(textBox, state, pageIndex);
|
|
15079
15079
|
}
|
|
15080
|
-
function getCanvasPageElements(surface) {
|
|
15081
|
-
const pages = Array.from(
|
|
15082
|
-
surface.querySelectorAll(
|
|
15083
|
-
'[data-renderer="canvas"][data-page-index]'
|
|
15084
|
-
)
|
|
15085
|
-
);
|
|
15086
|
-
return pages.sort((a, b) => {
|
|
15087
|
-
const left = Number(a.dataset.pageIndex ?? "0");
|
|
15088
|
-
const right = Number(b.dataset.pageIndex ?? "0");
|
|
15089
|
-
return left - right;
|
|
15090
|
-
});
|
|
15091
|
-
}
|
|
15092
|
-
function collectInlineImagesFromLines(options) {
|
|
15093
|
-
const inlineImages = [];
|
|
15094
|
-
for (const line of options.lines) {
|
|
15095
|
-
for (const fragment of line.fragments) {
|
|
15096
|
-
if (!fragment.image || fragment.image.floating) {
|
|
15097
|
-
continue;
|
|
15098
|
-
}
|
|
15099
|
-
const imageStartOffset = fragment.startOffset;
|
|
15100
|
-
const imageEndOffset = fragment.endOffset > imageStartOffset ? fragment.endOffset : imageStartOffset + 1;
|
|
15101
|
-
const slot = line.slots.find((candidate) => candidate.offset === imageStartOffset) ?? line.slots.find((candidate) => candidate.offset >= imageStartOffset);
|
|
15102
|
-
if (!slot) {
|
|
15103
|
-
continue;
|
|
15104
|
-
}
|
|
15105
|
-
inlineImages.push({
|
|
15106
|
-
paragraphId: options.paragraphId,
|
|
15107
|
-
paragraphIndex: options.paragraphIndex,
|
|
15108
|
-
zone: options.zone,
|
|
15109
|
-
footnoteId: options.footnoteId,
|
|
15110
|
-
pageIndex: options.pageIndex,
|
|
15111
|
-
startOffset: imageStartOffset,
|
|
15112
|
-
endOffset: imageEndOffset,
|
|
15113
|
-
left: options.lineLeftOffset + slot.left,
|
|
15114
|
-
top: options.lineTopOffset + line.top + line.height - fragment.image.height,
|
|
15115
|
-
width: fragment.image.width,
|
|
15116
|
-
height: fragment.image.height,
|
|
15117
|
-
rotation: fragment.image.rotation
|
|
15118
|
-
});
|
|
15119
|
-
}
|
|
15120
|
-
}
|
|
15121
|
-
return inlineImages;
|
|
15122
|
-
}
|
|
15123
|
-
function collectInlineTextBoxesFromLines(options) {
|
|
15124
|
-
const inlineTextBoxes = [];
|
|
15125
|
-
for (const line of options.lines) {
|
|
15126
|
-
for (const fragment of line.fragments) {
|
|
15127
|
-
if (!fragment.textBox || fragment.textBox.floating) {
|
|
15128
|
-
continue;
|
|
15129
|
-
}
|
|
15130
|
-
const startOffset = fragment.startOffset;
|
|
15131
|
-
const endOffset = fragment.endOffset > startOffset ? fragment.endOffset : startOffset + 1;
|
|
15132
|
-
const slot = line.slots.find((candidate) => candidate.offset === startOffset) ?? line.slots.find((candidate) => candidate.offset >= startOffset);
|
|
15133
|
-
if (!slot) {
|
|
15134
|
-
continue;
|
|
15135
|
-
}
|
|
15136
|
-
const height = options.resolveHeight(
|
|
15137
|
-
fragment.textBox
|
|
15138
|
-
);
|
|
15139
|
-
inlineTextBoxes.push({
|
|
15140
|
-
paragraphId: options.paragraphId,
|
|
15141
|
-
paragraphIndex: options.paragraphIndex,
|
|
15142
|
-
zone: options.zone,
|
|
15143
|
-
footnoteId: options.footnoteId,
|
|
15144
|
-
pageIndex: options.pageIndex,
|
|
15145
|
-
startOffset,
|
|
15146
|
-
endOffset,
|
|
15147
|
-
left: options.lineLeftOffset + slot.left,
|
|
15148
|
-
top: options.lineTopOffset + line.top + line.height - height,
|
|
15149
|
-
width: fragment.textBox.width,
|
|
15150
|
-
height,
|
|
15151
|
-
rotation: fragment.textBox.rotation
|
|
15152
|
-
});
|
|
15153
|
-
}
|
|
15154
|
-
}
|
|
15155
|
-
return inlineTextBoxes;
|
|
15156
|
-
}
|
|
15157
15080
|
function resolveFloatingTopLeft(floating, opts) {
|
|
15158
15081
|
const emuToPx2 = (value) => value === void 0 ? 0 : value / EMU_PER_PX;
|
|
15159
15082
|
const h = floating.positionH;
|
|
@@ -15258,6 +15181,83 @@ function collectFloatingTextBoxesFromLines(options) {
|
|
|
15258
15181
|
}
|
|
15259
15182
|
return result;
|
|
15260
15183
|
}
|
|
15184
|
+
function collectInlineImagesFromLines(options) {
|
|
15185
|
+
const inlineImages = [];
|
|
15186
|
+
for (const line of options.lines) {
|
|
15187
|
+
for (const fragment of line.fragments) {
|
|
15188
|
+
if (!fragment.image || fragment.image.floating) {
|
|
15189
|
+
continue;
|
|
15190
|
+
}
|
|
15191
|
+
const imageStartOffset = fragment.startOffset;
|
|
15192
|
+
const imageEndOffset = fragment.endOffset > imageStartOffset ? fragment.endOffset : imageStartOffset + 1;
|
|
15193
|
+
const slot = line.slots.find((candidate) => candidate.offset === imageStartOffset) ?? line.slots.find((candidate) => candidate.offset >= imageStartOffset);
|
|
15194
|
+
if (!slot) {
|
|
15195
|
+
continue;
|
|
15196
|
+
}
|
|
15197
|
+
inlineImages.push({
|
|
15198
|
+
paragraphId: options.paragraphId,
|
|
15199
|
+
paragraphIndex: options.paragraphIndex,
|
|
15200
|
+
zone: options.zone,
|
|
15201
|
+
footnoteId: options.footnoteId,
|
|
15202
|
+
pageIndex: options.pageIndex,
|
|
15203
|
+
startOffset: imageStartOffset,
|
|
15204
|
+
endOffset: imageEndOffset,
|
|
15205
|
+
left: options.lineLeftOffset + slot.left,
|
|
15206
|
+
top: options.lineTopOffset + line.top + line.height - fragment.image.height,
|
|
15207
|
+
width: fragment.image.width,
|
|
15208
|
+
height: fragment.image.height,
|
|
15209
|
+
rotation: fragment.image.rotation
|
|
15210
|
+
});
|
|
15211
|
+
}
|
|
15212
|
+
}
|
|
15213
|
+
return inlineImages;
|
|
15214
|
+
}
|
|
15215
|
+
function collectInlineTextBoxesFromLines(options) {
|
|
15216
|
+
const inlineTextBoxes = [];
|
|
15217
|
+
for (const line of options.lines) {
|
|
15218
|
+
for (const fragment of line.fragments) {
|
|
15219
|
+
if (!fragment.textBox || fragment.textBox.floating) {
|
|
15220
|
+
continue;
|
|
15221
|
+
}
|
|
15222
|
+
const startOffset = fragment.startOffset;
|
|
15223
|
+
const endOffset = fragment.endOffset > startOffset ? fragment.endOffset : startOffset + 1;
|
|
15224
|
+
const slot = line.slots.find((candidate) => candidate.offset === startOffset) ?? line.slots.find((candidate) => candidate.offset >= startOffset);
|
|
15225
|
+
if (!slot) {
|
|
15226
|
+
continue;
|
|
15227
|
+
}
|
|
15228
|
+
const height = options.resolveHeight(
|
|
15229
|
+
fragment.textBox
|
|
15230
|
+
);
|
|
15231
|
+
inlineTextBoxes.push({
|
|
15232
|
+
paragraphId: options.paragraphId,
|
|
15233
|
+
paragraphIndex: options.paragraphIndex,
|
|
15234
|
+
zone: options.zone,
|
|
15235
|
+
footnoteId: options.footnoteId,
|
|
15236
|
+
pageIndex: options.pageIndex,
|
|
15237
|
+
startOffset,
|
|
15238
|
+
endOffset,
|
|
15239
|
+
left: options.lineLeftOffset + slot.left,
|
|
15240
|
+
top: options.lineTopOffset + line.top + line.height - height,
|
|
15241
|
+
width: fragment.textBox.width,
|
|
15242
|
+
height,
|
|
15243
|
+
rotation: fragment.textBox.rotation
|
|
15244
|
+
});
|
|
15245
|
+
}
|
|
15246
|
+
}
|
|
15247
|
+
return inlineTextBoxes;
|
|
15248
|
+
}
|
|
15249
|
+
function getCanvasPageElements(surface) {
|
|
15250
|
+
const pages = Array.from(
|
|
15251
|
+
surface.querySelectorAll(
|
|
15252
|
+
'[data-renderer="canvas"][data-page-index]'
|
|
15253
|
+
)
|
|
15254
|
+
);
|
|
15255
|
+
return pages.sort((a, b) => {
|
|
15256
|
+
const left = Number(a.dataset.pageIndex ?? "0");
|
|
15257
|
+
const right = Number(b.dataset.pageIndex ?? "0");
|
|
15258
|
+
return left - right;
|
|
15259
|
+
});
|
|
15260
|
+
}
|
|
15261
15261
|
function buildVerticalCellSnapshotLines(options) {
|
|
15262
15262
|
const box = {
|
|
15263
15263
|
x: options.cell.contentLeft,
|
package/dist/oasis-editor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b2, bV, bW, bX, bY, bZ, bk, b_, b3, a_, b$, c0, c1, b1, c2, aY, c3, c4, c5, c6, c7, bQ, c8, c9, ca, cb, cc, cd, ce, cf, cg, ch, ci, bp, cj, bP, ck, bX as bX2, c0 as c02, c2 as c22, cb as cb2, cd as cd2, ci as ci2, cl, b0, aX, cm, cn, co, aZ, cp, cq, a$ } from "./index-
|
|
1
|
+
import { b2, bV, bW, bX, bY, bZ, bk, b_, b3, a_, b$, c0, c1, b1, c2, aY, c3, c4, c5, c6, c7, bQ, c8, c9, ca, cb, cc, cd, ce, cf, cg, ch, ci, bp, cj, bP, ck, bX as bX2, c0 as c02, c2 as c22, cb as cb2, cd as cd2, ci as ci2, cl, b0, aX, cm, cn, co, aZ, cp, cq, a$ } from "./index-BNRIgieX.js";
|
|
2
2
|
export {
|
|
3
3
|
b2 as BalloonShell,
|
|
4
4
|
bV as Button,
|