oasis-editor 0.0.67 → 0.0.68
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-KBzB35kG.js → OasisEditorApp-BPAQvDNb.js} +17 -2
- package/dist/core/model/index.d.ts +2 -0
- package/dist/core/model/runKind.d.ts +40 -0
- package/dist/{index-CH7dSKgO.js → index-IphSPayO.js} +5 -5
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +4 -4
- package/package.json +1 -1
|
@@ -1,7 +1,22 @@
|
|
|
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 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-
|
|
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-IphSPayO.js";
|
|
5
|
+
function getRunKind(run) {
|
|
6
|
+
if (run.footnoteReference) return "footnoteReference";
|
|
7
|
+
if (run.endnoteReference) return "endnoteReference";
|
|
8
|
+
if (run.fieldChar) return "fieldChar";
|
|
9
|
+
if (run.fieldInstruction !== void 0) return "fieldInstruction";
|
|
10
|
+
if (run.field) return "field";
|
|
11
|
+
if (run.textBox) return "textBox";
|
|
12
|
+
if (run.image) return "image";
|
|
13
|
+
if (run.sym) return "sym";
|
|
14
|
+
return "text";
|
|
15
|
+
}
|
|
16
|
+
function isInlineObjectRun(run) {
|
|
17
|
+
const kind = getRunKind(run);
|
|
18
|
+
return kind === "image" || kind === "textBox";
|
|
19
|
+
}
|
|
5
20
|
function getSelectedObjectRun(state, predicate) {
|
|
6
21
|
const normalized = normalizeSelection(state);
|
|
7
22
|
if (normalized.isCollapsed || normalized.startIndex !== normalized.endIndex || normalized.endParagraphOffset - normalized.startParagraphOffset !== 1) {
|
|
@@ -504,7 +519,7 @@ function sliceRuns(paragraph, startOffset, endOffset) {
|
|
|
504
519
|
const overlapStart = Math.max(start, runStart);
|
|
505
520
|
const overlapEnd = Math.min(end, runEnd);
|
|
506
521
|
if (overlapStart < overlapEnd) {
|
|
507
|
-
const isObjectRun2 =
|
|
522
|
+
const isObjectRun2 = isInlineObjectRun(run);
|
|
508
523
|
const piece = {
|
|
509
524
|
id: `run:${Math.random().toString(36).slice(2, 9)}`,
|
|
510
525
|
text: isObjectRun2 ? "" : run.text.slice(overlapStart - runStart, overlapEnd - runStart)
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
export type { EditorUnderlineStyle, EditorLigatures, EditorNumberSpacing, EditorNumberForm, EditorTextLanguage, EditorBorderStyle, EditorTabStop, EditorParagraphListStyle, EditorImageCrop, EditorImageFillMode, EditorImageFloatingPosition, EditorImageFloatingLayout, EditorImageRunData, EditorWrapPolygonPoint, EditorFieldData, EditorFieldChar, EditorFootnoteReferenceData, EditorEndnoteReferenceData, EditorRevision, EditorAsset, EditorFootnoteNumberFormat, EditorFootnoteRestart, EditorDocxWidthValue, EditorTableLayout, EditorTableRowHeightRule, } from './types/primitives.js';
|
|
10
10
|
export type { EditorTextStyle, EditorParagraphStyle, EditorTableStyle, EditorTableConditionalFormat, EditorConditionalRowStyle, EditorNamedStyle, } from './types/styles.js';
|
|
11
11
|
export type { EditorTextRun, EditorTextBoxShape, EditorTextBoxBody, EditorTextBoxData, EditorDropCap, EditorParagraphNode, EditorTableCellStyle, EditorTableCellNode, EditorTableRowStyle, EditorTableRowNode, EditorTableNode, EditorBlockNode, } from './types/nodes.js';
|
|
12
|
+
export type { RunKind, RunVisitor } from './runKind.js';
|
|
13
|
+
export { getRunKind, isInlineObjectRun, visitRun } from './runKind.js';
|
|
12
14
|
export type { EditorFootnote } from './types/documentFootnotes.js';
|
|
13
15
|
export type { EditorEndnote } from './types/documentEndnotes.js';
|
|
14
16
|
export type { EditorBookmark, EditorBookmarkAnchor, EditorBookmarks, } from './types/documentBookmarks.js';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { EditorTextRun } from './types/nodes.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Discriminated classification of an {@link EditorTextRun}.
|
|
5
|
+
*
|
|
6
|
+
* `EditorTextRun` is a flat bag of optional fields (`image`, `textBox`,
|
|
7
|
+
* `field`, …) with no discriminant, so adding a new inline object means every
|
|
8
|
+
* dispatch site has to remember to handle it (O1). `getRunKind` derives the
|
|
9
|
+
* effective kind once, in the canonical precedence the DOCX serializer uses
|
|
10
|
+
* (`export/docx/text/runXml.ts`), and `visitRun` turns that into an exhaustive
|
|
11
|
+
* dispatch — a missing branch is a compile error.
|
|
12
|
+
*
|
|
13
|
+
* This is purely derived from the existing fields; it does not change the wire
|
|
14
|
+
* shape. It is the safe first step before migrating `EditorTextRun` itself to a
|
|
15
|
+
* discriminated union.
|
|
16
|
+
*/
|
|
17
|
+
export type RunKind = "footnoteReference" | "endnoteReference" | "fieldChar" | "fieldInstruction" | "field" | "textBox" | "image" | "sym" | "text";
|
|
18
|
+
/**
|
|
19
|
+
* Classifies a run by its highest-precedence object field. The order mirrors
|
|
20
|
+
* `serializeRun` so callers that switch on the kind agree with export.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getRunKind(run: EditorTextRun): RunKind;
|
|
23
|
+
/** True for runs that carry an inline object replacement (image or text box). */
|
|
24
|
+
export declare function isInlineObjectRun(run: EditorTextRun): boolean;
|
|
25
|
+
export interface RunVisitor<R> {
|
|
26
|
+
text(run: EditorTextRun): R;
|
|
27
|
+
image(run: EditorTextRun): R;
|
|
28
|
+
textBox(run: EditorTextRun): R;
|
|
29
|
+
field(run: EditorTextRun): R;
|
|
30
|
+
fieldChar(run: EditorTextRun): R;
|
|
31
|
+
fieldInstruction(run: EditorTextRun): R;
|
|
32
|
+
footnoteReference(run: EditorTextRun): R;
|
|
33
|
+
endnoteReference(run: EditorTextRun): R;
|
|
34
|
+
sym(run: EditorTextRun): R;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Exhaustive dispatch over a run's kind. Adding a `RunKind` variant forces every
|
|
38
|
+
* `RunVisitor` to grow the matching method (compile error otherwise).
|
|
39
|
+
*/
|
|
40
|
+
export declare function visitRun<R>(run: EditorTextRun, visitor: RunVisitor<R>): R;
|
|
@@ -2483,7 +2483,7 @@ function OasisEditorAppLazy(props = {}) {
|
|
|
2483
2483
|
onCleanup(() => {
|
|
2484
2484
|
cancelled = true;
|
|
2485
2485
|
});
|
|
2486
|
-
import("./OasisEditorApp-
|
|
2486
|
+
import("./OasisEditorApp-BPAQvDNb.js").then((m) => {
|
|
2487
2487
|
cancelled = true;
|
|
2488
2488
|
setProgress(1);
|
|
2489
2489
|
setTimeout(() => setApp(() => m.OasisEditorApp), 180);
|
|
@@ -3001,6 +3001,10 @@ function createStore(...[store, options]) {
|
|
|
3001
3001
|
}
|
|
3002
3002
|
return [wrappedStore, setStore];
|
|
3003
3003
|
}
|
|
3004
|
+
function assertNever(value, label = "value") {
|
|
3005
|
+
const tag = value && typeof value === "object" && "type" in value ? value.type : value;
|
|
3006
|
+
throw new Error(`Unhandled ${label}: ${String(tag)}`);
|
|
3007
|
+
}
|
|
3004
3008
|
const EDITOR_ASSET_REF_PREFIX = "asset:";
|
|
3005
3009
|
function asRequired(value) {
|
|
3006
3010
|
return value;
|
|
@@ -3353,10 +3357,6 @@ function getDocumentSectionsCanonical(document2) {
|
|
|
3353
3357
|
function getDocumentSections(document2) {
|
|
3354
3358
|
return getDocumentSectionsCanonical(document2);
|
|
3355
3359
|
}
|
|
3356
|
-
function assertNever(value, label = "value") {
|
|
3357
|
-
const tag = value && typeof value === "object" && "type" in value ? value.type : value;
|
|
3358
|
-
throw new Error(`Unhandled ${label}: ${String(tag)}`);
|
|
3359
|
-
}
|
|
3360
3360
|
function getBlockParagraphs(block) {
|
|
3361
3361
|
switch (block.type) {
|
|
3362
3362
|
case "paragraph":
|
package/dist/oasis-editor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b3, bW, bX, bY, bZ, b_, bl, b$, b4, a$, c0, c1, c2, b2, c3, aZ, c4, c5, c6, c7, c8, bR, c9, ca, cb, cc, cd, ce, cf, cg, ch, ci, cj, bq, ck, bQ, cl, bY as bY2, c1 as c12, c3 as c32, cc as cc2, ce as ce2, cj as cj2, cm, b1, aY, cn, co, cp, a_, cq, cr, b0 } from "./index-
|
|
1
|
+
import { b3, bW, bX, bY, bZ, b_, bl, b$, b4, a$, c0, c1, c2, b2, c3, aZ, c4, c5, c6, c7, c8, bR, c9, ca, cb, cc, cd, ce, cf, cg, ch, ci, cj, bq, ck, bQ, cl, bY as bY2, c1 as c12, c3 as c32, cc as cc2, ce as ce2, cj as cj2, cm, b1, aY, cn, co, cp, a_, cq, cr, b0 } from "./index-IphSPayO.js";
|
|
2
2
|
export {
|
|
3
3
|
b3 as BalloonShell,
|
|
4
4
|
bW as Button,
|