oasis-editor 0.0.6 → 0.0.8
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-Co_pXhKM.js → OasisEditorApp-PbwiUucf.js} +62 -6
- package/dist/assets/{importDocxWorker-CtfvrAfg.js → importDocxWorker-DbiKelzX.js} +1 -1
- package/dist/core/plugin.d.ts +4 -0
- package/dist/import/docx/settings.d.ts +4 -0
- package/dist/{index-BYewCj77.js → index-BlQocUZB.js} +466 -89
- package/dist/index.d.ts +5 -2
- package/dist/oasis-editor.css +1 -1
- package/dist/oasis-editor.js +21 -19
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/ui/OasisEditorApp.d.ts +1 -1
- package/dist/ui/OasisEditorAppProps.d.ts +2 -0
- package/dist/ui/app/EditorWorkspace.d.ts +2 -1
- package/dist/ui/app/useEditorUiOptions.d.ts +1 -0
- package/dist/ui/components/Toolbar/Toolbar.d.ts +2 -1
- package/dist/ui/components/Toolbar/ribbon/RibbonGroup.d.ts +8 -0
- package/dist/ui/components/Toolbar/ribbon/RibbonPanel.d.ts +9 -0
- package/dist/ui/components/Toolbar/ribbon/RibbonRow.d.ts +7 -0
- package/dist/ui/components/Toolbar/ribbon/RibbonTabs.d.ts +8 -0
- package/dist/ui/components/Toolbar/ribbon/ribbonModel.d.ts +21 -0
- package/dist/ui/components/Toolbar/schema/items.d.ts +9 -0
- package/dist/ui/shells/DocumentShell.d.ts +2 -1
- 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 createEditorStyledRun, b as getParagraphLength, d as getParagraphText, e as getActiveZone, f as getDocumentSections, h as getActiveSectionIndex, p as positionToParagraphOffset, i as paragraphOffsetToPosition, j as clampPosition, k as findParagraphIndex, l as createCollapsedSelection, m as isSelectionCollapsed, o as createEditorParagraph, q as getBlockParagraphs, r as findParagraphTableLocation, s as buildTableCellLayout, t as createEditorTableCell, u as createEditorTable, v as createEditorTableRow, w as underlineStyleToCssDecorationStyle, x as resolveImageSrc, y as createEditorFootnote, z as createFootnoteReferenceRun, A as renumberFootnotes, B as iterateFootnoteReferenceRuns, C as getFootnoteDisplayMarker, D as createSignal, E as createEffect, F as onCleanup, G as buildCanvasLayoutSnapshot, H as on, I as onMount, J as debounce, K as unwrap, L as getDocumentParagraphs, M as getDocumentSectionsCanonical, N as createEditorDocument, O as getPageContentWidth, P as getDocumentPageSettings, Q as getTableCellContentWidthForParagraph, R as resolveResizedDimensions, S as resolveTextBoxRenderHeight, T as resolveEffectiveParagraphStyle, U as resolveEffectiveTextStyleForParagraph, V as iterateEndnoteReferenceRuns, W as JSZip, X as imageContentTypeDefaults, Y as imageExtensionFromMime, Z as pxToPt$1, _ as textStyleToFontSizePt, $ as PX_PER_POINT, a0 as DEFAULT_FONT_SIZE_PX, a1 as isDoubleUnderlineStyle, a2 as isWavyUnderlineStyle, a3 as underlineStyleLineWidthPx, a4 as underlineStyleDashArray, a5 as getListLabelInset, a6 as getParagraphBorderInsets, a7 as buildSegmentTable, a8 as buildCanvasTableLayout, a9 as normalizeFamily, aa as ROBOTO_FONT_FILES, ab as loadFontAsset, ac as OFFICE_COMPAT_FONT_FAMILIES, ad as buildSfnt, ae as defaultFontDecoderRegistry, af as SfntFontProgram, ag as collectPdfFontFamilies, ah as projectDocumentLayout, ai as getPageHeaderZoneTop, aj as getPageBodyTop, ak as findFootnoteReference, al as FOOTNOTE_MARKER_GUTTER_PX, am as resolveImporterForFile, an as createEditorStateFromDocument, ao as getDocumentParagraphsCanonical, ap as getToolbarStyleState, aq as STANDARD_FONT_SIZES_PT, ar as fontSizePxToPt, as as probeLocalFontFamilies, at as createInitialEditorState, au as parseFontSizePtToPx, av as formatFontSizePt, aw as listKindForTag, ax as isParagraphTag, ay as collectInlineRuns, az as parseParagraphStyle, aA as t, aB as preciseFontModeVersion, aC as isPreciseFontModeEnabled, aD as togglePreciseFontMode, aE as createDefaultToolbarPreset, aF as defaultMenuItems, aG as MenuRegistry, aH as createToolbarRegistry, aI as Editor, aJ as resolveCommandRef, aK as commandRefName, aL as InlineShell, aM as BalloonShell, aN as DocumentShell, aO as createMemo, aP as getCaretRectFromSnapshot, aQ as getParagraphRectFromSnapshot, aR as createComponent, aS as CaretOverlay, aT as Show, aU as createRenderEffect, aV as style, aW as setAttribute, aX as setStyleProperty, aY as memo, aZ as template, a_ as insert, a$ as use, b0 as addEventListener, b1 as Dialog, b2 as delegateEvents, b3 as className, b4 as For, b5 as UNDERLINE_STYLE_OPTIONS, b6 as Tabs, b7 as measureParagraphMinContentWidthPx, b8 as getEditableBlocksForZone, b9 as findParagraphLocation, ba as createSectionBoundaryParagraph, bb as normalizePageSettings, bc as DEFAULT_EDITOR_PAGE_SETTINGS, bd as markStart, be as markEnd, bf as getParagraphEntries, bg as getParagraphById, bh as PluginUiHost, bi as OasisEditorEditor, bj as perfTimer, bk as OasisBrandMark, bl as setPreciseFontPreference, bm as setWelcomeSeen, bn as enablePreciseFontMode, bo as createOasisEditorClient, bp as setLocale, bq as startLongTaskObserver, br as installGlobalReport, bs as applyStoredPreciseFontPreference, bt as getWelcomeSeen, bu as isLocalFontAccessSupported, bv as EDITOR_SCROLL_PADDING_PX, bw as Toolbar, bx as OasisEditorLoading, by as createEditorLogger, bz as getCachedCanvasImage, bA as registerDomStatsSurface } from "./index-
|
|
4
|
+
import { n as normalizeSelection, g as getParagraphs, c as createEditorParagraphFromRuns, a as createEditorStyledRun, b as getParagraphLength, d as getParagraphText, e as getActiveZone, f as getDocumentSections, h as getActiveSectionIndex, p as positionToParagraphOffset, i as paragraphOffsetToPosition, j as clampPosition, k as findParagraphIndex, l as createCollapsedSelection, m as isSelectionCollapsed, o as createEditorParagraph, q as getBlockParagraphs, r as findParagraphTableLocation, s as buildTableCellLayout, t as createEditorTableCell, u as createEditorTable, v as createEditorTableRow, w as underlineStyleToCssDecorationStyle, x as resolveImageSrc, y as createEditorFootnote, z as createFootnoteReferenceRun, A as renumberFootnotes, B as iterateFootnoteReferenceRuns, C as getFootnoteDisplayMarker, D as createSignal, E as createEffect, F as onCleanup, G as buildCanvasLayoutSnapshot, H as on, I as onMount, J as debounce, K as unwrap, L as getDocumentParagraphs, M as getDocumentSectionsCanonical, N as createEditorDocument, O as getPageContentWidth, P as getDocumentPageSettings, Q as getTableCellContentWidthForParagraph, R as resolveResizedDimensions, S as resolveTextBoxRenderHeight, T as resolveEffectiveParagraphStyle, U as resolveEffectiveTextStyleForParagraph, V as iterateEndnoteReferenceRuns, W as JSZip, X as imageContentTypeDefaults, Y as imageExtensionFromMime, Z as pxToPt$1, _ as textStyleToFontSizePt, $ as PX_PER_POINT, a0 as DEFAULT_FONT_SIZE_PX, a1 as isDoubleUnderlineStyle, a2 as isWavyUnderlineStyle, a3 as underlineStyleLineWidthPx, a4 as underlineStyleDashArray, a5 as getListLabelInset, a6 as getParagraphBorderInsets, a7 as buildSegmentTable, a8 as buildCanvasTableLayout, a9 as normalizeFamily, aa as ROBOTO_FONT_FILES, ab as loadFontAsset, ac as OFFICE_COMPAT_FONT_FAMILIES, ad as buildSfnt, ae as defaultFontDecoderRegistry, af as SfntFontProgram, ag as collectPdfFontFamilies, ah as projectDocumentLayout, ai as getPageHeaderZoneTop, aj as getPageBodyTop, ak as findFootnoteReference, al as FOOTNOTE_MARKER_GUTTER_PX, am as resolveImporterForFile, an as createEditorStateFromDocument, ao as getDocumentParagraphsCanonical, ap as getToolbarStyleState, aq as STANDARD_FONT_SIZES_PT, ar as fontSizePxToPt, as as probeLocalFontFamilies, at as createInitialEditorState, au as parseFontSizePtToPx, av as formatFontSizePt, aw as listKindForTag, ax as isParagraphTag, ay as collectInlineRuns, az as parseParagraphStyle, aA as t, aB as preciseFontModeVersion, aC as isPreciseFontModeEnabled, aD as togglePreciseFontMode, aE as createDefaultToolbarPreset, aF as defaultMenuItems, aG as MenuRegistry, aH as createToolbarRegistry, aI as Editor, aJ as resolveCommandRef, aK as commandRefName, aL as InlineShell, aM as BalloonShell, aN as DocumentShell, aO as createMemo, aP as getCaretRectFromSnapshot, aQ as getParagraphRectFromSnapshot, aR as createComponent, aS as CaretOverlay, aT as Show, aU as createRenderEffect, aV as style, aW as setAttribute, aX as setStyleProperty, aY as memo, aZ as template, a_ as insert, a$ as use, b0 as addEventListener, b1 as Dialog, b2 as delegateEvents, b3 as className, b4 as For, b5 as UNDERLINE_STYLE_OPTIONS, b6 as Tabs, b7 as measureParagraphMinContentWidthPx, b8 as getEditableBlocksForZone, b9 as findParagraphLocation, ba as createSectionBoundaryParagraph, bb as normalizePageSettings, bc as DEFAULT_EDITOR_PAGE_SETTINGS, bd as markStart, be as markEnd, bf as getParagraphEntries, bg as getParagraphById, bh as PluginUiHost, bi as OasisEditorEditor, bj as perfTimer, bk as OasisBrandMark, bl as setPreciseFontPreference, bm as setWelcomeSeen, bn as enablePreciseFontMode, bo as createOasisEditorClient, bp as setLocale, bq as startLongTaskObserver, br as installGlobalReport, bs as applyStoredPreciseFontPreference, bt as getWelcomeSeen, bu as isLocalFontAccessSupported, bv as EDITOR_SCROLL_PADDING_PX, bw as Toolbar, bx as OasisEditorLoading, by as createEditorLogger, bz as getCachedCanvasImage, bA as registerDomStatsSurface } from "./index-BlQocUZB.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) {
|
|
@@ -9206,17 +9206,53 @@ function buildDocumentRelationshipsXml(hasNumbering, hasSettings, images, hyperl
|
|
|
9206
9206
|
}
|
|
9207
9207
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${PACKAGE_REL_NS}">${rels}</Relationships>`;
|
|
9208
9208
|
}
|
|
9209
|
-
function buildSettingsXml(hasEvenAndOddHeaders, defaultTabStop) {
|
|
9209
|
+
function buildSettingsXml(hasEvenAndOddHeaders, defaultTabStop, footnoteSettings, endnoteSettings) {
|
|
9210
9210
|
const parts = [];
|
|
9211
9211
|
const defaultTabStopTwips = pointsToTwips(defaultTabStop);
|
|
9212
9212
|
if (defaultTabStopTwips !== null) {
|
|
9213
9213
|
parts.push(`<w:defaultTabStop w:val="${defaultTabStopTwips}"/>`);
|
|
9214
9214
|
}
|
|
9215
|
+
const footnotePr = serializeNoteSettings("footnotePr", footnoteSettings);
|
|
9216
|
+
if (footnotePr) {
|
|
9217
|
+
parts.push(footnotePr);
|
|
9218
|
+
}
|
|
9219
|
+
const endnotePr = serializeNoteSettings("endnotePr", endnoteSettings);
|
|
9220
|
+
if (endnotePr) {
|
|
9221
|
+
parts.push(endnotePr);
|
|
9222
|
+
}
|
|
9215
9223
|
if (hasEvenAndOddHeaders) {
|
|
9216
9224
|
parts.push("<w:evenAndOddHeaders/>");
|
|
9217
9225
|
}
|
|
9218
9226
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:settings xmlns:w="${WORD_NS$1}">${parts.join("")}</w:settings>`;
|
|
9219
9227
|
}
|
|
9228
|
+
const NOTE_NUMBER_FORMATS = {
|
|
9229
|
+
decimal: "decimal",
|
|
9230
|
+
lowerRoman: "lowerRoman",
|
|
9231
|
+
upperRoman: "upperRoman",
|
|
9232
|
+
lowerLetter: "lowerLetter",
|
|
9233
|
+
upperLetter: "upperLetter",
|
|
9234
|
+
symbol: "symbol"
|
|
9235
|
+
};
|
|
9236
|
+
const NOTE_RESTARTS = {
|
|
9237
|
+
continuous: "continuous",
|
|
9238
|
+
eachSection: "eachSect"
|
|
9239
|
+
};
|
|
9240
|
+
function serializeNoteSettings(tagName, settings) {
|
|
9241
|
+
if (!settings) return null;
|
|
9242
|
+
const parts = [];
|
|
9243
|
+
if (settings.numberFormat) {
|
|
9244
|
+
parts.push(
|
|
9245
|
+
`<w:numFmt w:val="${NOTE_NUMBER_FORMATS[settings.numberFormat]}"/>`
|
|
9246
|
+
);
|
|
9247
|
+
}
|
|
9248
|
+
if (settings.startAt !== void 0) {
|
|
9249
|
+
parts.push(`<w:numStart w:val="${Math.max(1, settings.startAt)}"/>`);
|
|
9250
|
+
}
|
|
9251
|
+
if (settings.restart) {
|
|
9252
|
+
parts.push(`<w:numRestart w:val="${NOTE_RESTARTS[settings.restart]}"/>`);
|
|
9253
|
+
}
|
|
9254
|
+
return parts.length > 0 ? `<w:${tagName}>${parts.join("")}</w:${tagName}>` : null;
|
|
9255
|
+
}
|
|
9220
9256
|
function buildPartRelationshipsXml(images, hyperlinks) {
|
|
9221
9257
|
let rels = "";
|
|
9222
9258
|
for (const hyperlink of hyperlinks) {
|
|
@@ -9229,7 +9265,7 @@ function buildPartRelationshipsXml(images, hyperlinks) {
|
|
|
9229
9265
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="${PACKAGE_REL_NS}">${rels}</Relationships>`;
|
|
9230
9266
|
}
|
|
9231
9267
|
async function exportEditorDocumentToDocx(document2) {
|
|
9232
|
-
var _a, _b;
|
|
9268
|
+
var _a, _b, _c, _d, _e, _f;
|
|
9233
9269
|
const zip = new JSZip();
|
|
9234
9270
|
const numberingContext = buildNumberingContext(document2);
|
|
9235
9271
|
const buildState = {
|
|
@@ -9309,7 +9345,7 @@ async function exportEditorDocumentToDocx(document2) {
|
|
|
9309
9345
|
return (((_a2 = section.evenPageHeader) == null ? void 0 : _a2.length) ?? 0) > 0 || (((_b2 = section.evenPageFooter) == null ? void 0 : _b2.length) ?? 0) > 0;
|
|
9310
9346
|
}
|
|
9311
9347
|
);
|
|
9312
|
-
const hasDocumentSettings = hasEvenAndOddHeaders || ((_a = document2.settings) == null ? void 0 : _a.defaultTabStop) !== void 0;
|
|
9348
|
+
const hasDocumentSettings = hasEvenAndOddHeaders || ((_a = document2.settings) == null ? void 0 : _a.defaultTabStop) !== void 0 || ((_b = document2.footnotes) == null ? void 0 : _b.settings) !== void 0 || ((_c = document2.endnotes) == null ? void 0 : _c.settings) !== void 0;
|
|
9313
9349
|
const allImages = [
|
|
9314
9350
|
...bodyContext.images,
|
|
9315
9351
|
...parts.flatMap((part) => part.context.images)
|
|
@@ -9387,7 +9423,12 @@ async function exportEditorDocumentToDocx(document2) {
|
|
|
9387
9423
|
if (hasDocumentSettings) {
|
|
9388
9424
|
zip.file(
|
|
9389
9425
|
"word/settings.xml",
|
|
9390
|
-
buildSettingsXml(
|
|
9426
|
+
buildSettingsXml(
|
|
9427
|
+
hasEvenAndOddHeaders,
|
|
9428
|
+
(_d = document2.settings) == null ? void 0 : _d.defaultTabStop,
|
|
9429
|
+
(_e = document2.footnotes) == null ? void 0 : _e.settings,
|
|
9430
|
+
(_f = document2.endnotes) == null ? void 0 : _f.settings
|
|
9431
|
+
)
|
|
9391
9432
|
);
|
|
9392
9433
|
}
|
|
9393
9434
|
for (const part of parts) {
|
|
@@ -40702,7 +40743,10 @@ function useEditorRuntimePlugins(options) {
|
|
|
40702
40743
|
testId: item.id,
|
|
40703
40744
|
command: item.command,
|
|
40704
40745
|
iconName: item.icon,
|
|
40705
|
-
|
|
40746
|
+
tab: item.tab ?? "plugins",
|
|
40747
|
+
group: item.group ?? "general",
|
|
40748
|
+
row: item.row ?? 1,
|
|
40749
|
+
order: item.order
|
|
40706
40750
|
};
|
|
40707
40751
|
toolbarRegistry.register(contributed);
|
|
40708
40752
|
contributedToolbarIds.push(item.id);
|
|
@@ -40866,6 +40910,10 @@ function createEditorUiOptions(ctx) {
|
|
|
40866
40910
|
showMenubar: () => ui().showMenubar ?? true,
|
|
40867
40911
|
showToolbar: () => ui().showToolbar ?? true,
|
|
40868
40912
|
showOutline: () => ui().showOutline ?? true,
|
|
40913
|
+
toolbarView: () => {
|
|
40914
|
+
var _a;
|
|
40915
|
+
return ((_a = ui().toolbar) == null ? void 0 : _a.view) ?? "ribbon";
|
|
40916
|
+
},
|
|
40869
40917
|
toolbarLayout: () => {
|
|
40870
40918
|
var _a;
|
|
40871
40919
|
return ((_a = ui().toolbar) == null ? void 0 : _a.layout) ?? "overflow";
|
|
@@ -44895,6 +44943,9 @@ function EditorWorkspace(props) {
|
|
|
44895
44943
|
get showOutline() {
|
|
44896
44944
|
return props.showOutline();
|
|
44897
44945
|
},
|
|
44946
|
+
get toolbarView() {
|
|
44947
|
+
return props.toolbarView();
|
|
44948
|
+
},
|
|
44898
44949
|
get toolbarLayout() {
|
|
44899
44950
|
return props.toolbarLayout();
|
|
44900
44951
|
},
|
|
@@ -45161,6 +45212,7 @@ function OasisEditorApp(props = {}) {
|
|
|
45161
45212
|
showMenubar,
|
|
45162
45213
|
showToolbar,
|
|
45163
45214
|
showOutline,
|
|
45215
|
+
toolbarView,
|
|
45164
45216
|
toolbarLayout,
|
|
45165
45217
|
isReadOnly,
|
|
45166
45218
|
useComposedShell,
|
|
@@ -45794,6 +45846,9 @@ function OasisEditorApp(props = {}) {
|
|
|
45794
45846
|
return createComponent(Toolbar, {
|
|
45795
45847
|
host: toolbarHost,
|
|
45796
45848
|
registry: toolbarRegistry,
|
|
45849
|
+
get view() {
|
|
45850
|
+
return toolbarView();
|
|
45851
|
+
},
|
|
45797
45852
|
get layout() {
|
|
45798
45853
|
return toolbarLayout();
|
|
45799
45854
|
}
|
|
@@ -45845,6 +45900,7 @@ function OasisEditorApp(props = {}) {
|
|
|
45845
45900
|
showMenubar,
|
|
45846
45901
|
showToolbar,
|
|
45847
45902
|
showOutline,
|
|
45903
|
+
toolbarView,
|
|
45848
45904
|
toolbarLayout,
|
|
45849
45905
|
isReadOnly,
|
|
45850
45906
|
viewportHeight: () => ui().viewportHeight,
|