oasis-editor 0.0.7 → 0.0.9
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-Ck4oFAf-.js → OasisEditorApp-kUhRrsHZ.js} +17 -2
- package/dist/core/plugin.d.ts +4 -0
- package/dist/{index-BGcbqj0Q.js → index-D1GDOw-0.js} +447 -124
- 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-D1GDOw-0.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) {
|
|
@@ -40743,7 +40743,10 @@ function useEditorRuntimePlugins(options) {
|
|
|
40743
40743
|
testId: item.id,
|
|
40744
40744
|
command: item.command,
|
|
40745
40745
|
iconName: item.icon,
|
|
40746
|
-
|
|
40746
|
+
tab: item.tab ?? "plugins",
|
|
40747
|
+
group: item.group ?? "general",
|
|
40748
|
+
row: item.row ?? 1,
|
|
40749
|
+
order: item.order
|
|
40747
40750
|
};
|
|
40748
40751
|
toolbarRegistry.register(contributed);
|
|
40749
40752
|
contributedToolbarIds.push(item.id);
|
|
@@ -40907,6 +40910,10 @@ function createEditorUiOptions(ctx) {
|
|
|
40907
40910
|
showMenubar: () => ui().showMenubar ?? true,
|
|
40908
40911
|
showToolbar: () => ui().showToolbar ?? true,
|
|
40909
40912
|
showOutline: () => ui().showOutline ?? true,
|
|
40913
|
+
toolbarView: () => {
|
|
40914
|
+
var _a;
|
|
40915
|
+
return ((_a = ui().toolbar) == null ? void 0 : _a.view) ?? "ribbon";
|
|
40916
|
+
},
|
|
40910
40917
|
toolbarLayout: () => {
|
|
40911
40918
|
var _a;
|
|
40912
40919
|
return ((_a = ui().toolbar) == null ? void 0 : _a.layout) ?? "overflow";
|
|
@@ -44936,6 +44943,9 @@ function EditorWorkspace(props) {
|
|
|
44936
44943
|
get showOutline() {
|
|
44937
44944
|
return props.showOutline();
|
|
44938
44945
|
},
|
|
44946
|
+
get toolbarView() {
|
|
44947
|
+
return props.toolbarView();
|
|
44948
|
+
},
|
|
44939
44949
|
get toolbarLayout() {
|
|
44940
44950
|
return props.toolbarLayout();
|
|
44941
44951
|
},
|
|
@@ -45202,6 +45212,7 @@ function OasisEditorApp(props = {}) {
|
|
|
45202
45212
|
showMenubar,
|
|
45203
45213
|
showToolbar,
|
|
45204
45214
|
showOutline,
|
|
45215
|
+
toolbarView,
|
|
45205
45216
|
toolbarLayout,
|
|
45206
45217
|
isReadOnly,
|
|
45207
45218
|
useComposedShell,
|
|
@@ -45835,6 +45846,9 @@ function OasisEditorApp(props = {}) {
|
|
|
45835
45846
|
return createComponent(Toolbar, {
|
|
45836
45847
|
host: toolbarHost,
|
|
45837
45848
|
registry: toolbarRegistry,
|
|
45849
|
+
get view() {
|
|
45850
|
+
return toolbarView();
|
|
45851
|
+
},
|
|
45838
45852
|
get layout() {
|
|
45839
45853
|
return toolbarLayout();
|
|
45840
45854
|
}
|
|
@@ -45886,6 +45900,7 @@ function OasisEditorApp(props = {}) {
|
|
|
45886
45900
|
showMenubar,
|
|
45887
45901
|
showToolbar,
|
|
45888
45902
|
showOutline,
|
|
45903
|
+
toolbarView,
|
|
45889
45904
|
toolbarLayout,
|
|
45890
45905
|
isReadOnly,
|
|
45891
45906
|
viewportHeight: () => ui().viewportHeight,
|
package/dist/core/plugin.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { JSX } from '../solid-js';
|
|
|
2
2
|
import { EditorState } from '../model.js';
|
|
3
3
|
import { Editor } from '../Editor.js';
|
|
4
4
|
import { CommandRef } from '../commands/CommandRef.js';
|
|
5
|
+
import { RibbonRow, RibbonTabId } from '../../ui/components/Toolbar/schema/items.js';
|
|
5
6
|
|
|
6
7
|
export type Unsubscribe = () => void;
|
|
7
8
|
export interface OasisCommandContext {
|
|
@@ -43,7 +44,10 @@ export interface PluginAction {
|
|
|
43
44
|
id: string;
|
|
44
45
|
command: CommandRef;
|
|
45
46
|
icon?: string;
|
|
47
|
+
tab?: RibbonTabId;
|
|
46
48
|
group?: string;
|
|
49
|
+
row?: RibbonRow;
|
|
50
|
+
order?: number;
|
|
47
51
|
}
|
|
48
52
|
export interface PluginMenuItem extends PluginAction {
|
|
49
53
|
path: string;
|