oasis-editor 0.0.31 → 0.0.33

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.
@@ -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 createEditorTable, w as createEditorTableRow, x as underlineStyleToCssDecorationStyle, y as resolveImageSrc, z as createEditorFootnote, A as createFootnoteReferenceRun, B as renumberFootnotes, C as iterateFootnoteReferenceRuns, D as getFootnoteDisplayMarker, E as createSignal, F as createEffect, G as onCleanup, H as buildCanvasLayoutSnapshot, I as on, J as onMount, K as debounce, L as unwrap, M as getDocumentParagraphs, N as getDocumentSectionsCanonical, O as createEditorDocument, P as getPageContentWidth, Q as getDocumentPageSettings, R as getTableCellContentWidthForParagraph, S as resolveResizedDimensions, T as resolveTextBoxRenderHeight, U as resolveEffectiveParagraphStyle, V as resolveEffectiveTextStyleForParagraph, W as iterateEndnoteReferenceRuns, X as JSZip, Y as imageContentTypeDefaults, Z as imageExtensionFromMime, _ as pxToPt$1, $ as buildSegmentTable, a0 as buildCanvasTableLayout, a1 as resolveFloatingObjectRect, a2 as getTextBoxFloatingGeometry, a3 as getPresetPathSegments, a4 as projectBlocksLayout, a5 as buildListLabels, a6 as textStyleToFontSizePt, a7 as PX_PER_POINT, a8 as DEFAULT_FONT_SIZE_PX, a9 as isDoubleUnderlineStyle, aa as isWavyUnderlineStyle, ab as underlineStyleLineWidthPx, ac as underlineStyleDashArray, ad as resolveListLabel, ae as getListLabelInset, af as getAlignedListLabelInset, ag as getParagraphBorderInsets, ah as normalizeFamily, ai as ROBOTO_FONT_FILES, aj as loadFontAsset, ak as OFFICE_COMPAT_FONT_FAMILIES, al as buildSfnt, am as defaultFontDecoderRegistry, an as SfntFontProgram, ao as collectPdfFontFamilies, ap as projectDocumentLayout, aq as getPageHeaderZoneTop, ar as getPageBodyTop, as as getPageColumnRects, at as findFootnoteReference, au as FOOTNOTE_MARKER_GUTTER_PX, av as resolveImporterForFile, aw as createEditorStateFromDocument, ax as getDocumentParagraphsCanonical, ay as getToolbarStyleState, az as STANDARD_FONT_SIZES_PT, aA as fontSizePxToPt, aB as probeLocalFontFamilies, aC as createInitialEditorState, aD as parseFontSizePtToPx, aE as formatFontSizePt, aF as listKindForTag, aG as isParagraphTag, aH as collectInlineRuns, aI as parseParagraphStyle, aJ as t, aK as getHeadingLevel, aL as preciseFontModeVersion, aM as isPreciseFontModeEnabled, aN as togglePreciseFontMode, aO as nextFontSizePt, aP as previousFontSizePt, aQ as fontSizePtToPx, aR as createDefaultToolbarPreset, aS as defaultMenuItems, aT as MenuRegistry, aU as createToolbarRegistry, aV as Editor, aW as resolveCommandRef, aX as commandRefName, aY as InlineShell, aZ as BalloonShell, a_ as DocumentShell, a$ as createMemo, b0 as getCaretRectFromSnapshot, b1 as getParagraphRectFromSnapshot, b2 as createComponent, b3 as CaretOverlay, b4 as Show, b5 as createRenderEffect, b6 as style, b7 as setAttribute, b8 as setStyleProperty, b9 as memo, ba as template, bb as insert, bc as use, bd as addEventListener, be as Dialog, bf as delegateEvents, bg as className, bh as For, bi as UNDERLINE_STYLE_OPTIONS, bj as Tabs, bk as measureParagraphMinContentWidthPx, bl as getEditableBlocksForZone, bm as findParagraphLocation, bn as createSectionBoundaryParagraph, bo as normalizePageSettings, bp as DEFAULT_EDITOR_PAGE_SETTINGS, bq as markStart, br as markEnd, bs as getParagraphEntries, bt as getParagraphById, bu as PluginUiHost, bv as OasisEditorEditor, bw as perfTimer, bx as OasisBrandMark, by as setPreciseFontPreference, bz as setWelcomeSeen, bA as enablePreciseFontMode, bB as createOasisEditorClient, bC as setLocale, bD as createEditorZoom, bE as startLongTaskObserver, bF as installGlobalReport, bG as applyStoredPreciseFontPreference, bH as getWelcomeSeen, bI as isLocalFontAccessSupported, bJ as EDITOR_SCROLL_PADDING_PX, bK as Toolbar, bL as OasisEditorLoading, bM as createEditorLogger, bN as getCachedCanvasImage, bO as registerDomStatsSurface } from "./index-BYqaCJUC.js";
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, E as createSignal, F as createEffect, G as onCleanup, H as buildCanvasLayoutSnapshot, I as on, J as onMount, K as debounce, L as unwrap, M as getDocumentParagraphs, N as getDocumentSectionsCanonical, O as createEditorDocument, P as getPageContentWidth, Q as getDocumentPageSettings, R as getTableCellContentWidthForParagraph, S as resolveResizedDimensions, T as resolveTextBoxRenderHeight, U as resolveEffectiveParagraphStyle, V as resolveEffectiveTextStyleForParagraph, W as iterateEndnoteReferenceRuns, X as JSZip, Y as imageContentTypeDefaults, Z as imageExtensionFromMime, _ as pxToPt$1, $ as buildSegmentTable, a0 as buildCanvasTableLayout, a1 as resolveFloatingObjectRect, a2 as getTextBoxFloatingGeometry, a3 as getPresetPathSegments, a4 as projectBlocksLayout, a5 as buildListLabels, a6 as textStyleToFontSizePt, a7 as PX_PER_POINT, a8 as DEFAULT_FONT_SIZE_PX, a9 as isDoubleUnderlineStyle, aa as isWavyUnderlineStyle, ab as underlineStyleLineWidthPx, ac as underlineStyleDashArray, ad as resolveListLabel, ae as getListLabelInset, af as getAlignedListLabelInset, ag as getParagraphBorderInsets, ah as normalizeFamily, ai as ROBOTO_FONT_FILES, aj as loadFontAsset, ak as OFFICE_COMPAT_FONT_FAMILIES, al as buildSfnt, am as defaultFontDecoderRegistry, an as SfntFontProgram, ao as collectPdfFontFamilies, ap as projectDocumentLayout, aq as getPageHeaderZoneTop, ar as getPageBodyTop, as as getPageColumnRects, at as findFootnoteReference, au as FOOTNOTE_MARKER_GUTTER_PX, av as resolveImporterForFile, aw as createEditorStateFromDocument, ax as getDocumentParagraphsCanonical, ay as getToolbarStyleState, az as STANDARD_FONT_SIZES_PT, aA as fontSizePxToPt, aB as probeLocalFontFamilies, aC as createInitialEditorState, aD as parseFontSizePtToPx, aE as formatFontSizePt, aF as listKindForTag, aG as isParagraphTag, aH as collectInlineRuns, aI as parseParagraphStyle, aJ as getHeadingLevel, aK as preciseFontModeVersion, aL as isPreciseFontModeEnabled, aM as togglePreciseFontMode, aN as nextFontSizePt, aO as previousFontSizePt, aP as fontSizePtToPx, aQ as createDefaultToolbarPreset, aR as MenuRegistry, aS as createToolbarRegistry, aT as Editor, aU as resolveCommandRef, aV as commandRefName, aW as InlineShell, aX as BalloonShell, aY as DocumentShell, aZ as createMemo, a_ as getCaretRectFromSnapshot, a$ as getParagraphRectFromSnapshot, b0 as createComponent, b1 as CaretOverlay, b2 as Show, b3 as createRenderEffect, b4 as style, b5 as setAttribute, b6 as setStyleProperty, b7 as memo, b8 as template, b9 as useI18n, ba as insert, bb as use, bc as addEventListener, bd as Dialog, be as delegateEvents, bf as className, bg as For, bh as UNDERLINE_STYLE_OPTIONS, bi as Tabs, bj as measureParagraphMinContentWidthPx, bk as getEditableBlocksForZone, bl as findParagraphLocation, bm as createSectionBoundaryParagraph, bn as normalizePageSettings, bo as DEFAULT_EDITOR_PAGE_SETTINGS, bp as markStart, bq as markEnd, br as getParagraphEntries, bs as getParagraphById, bt as PluginUiHost, bu as OasisEditorEditor, bv as perfTimer, bw as OasisBrandMark, bx as setPreciseFontPreference, by as setWelcomeSeen, bz as enablePreciseFontMode, bA as createOasisEditorClient, bB as createEditorZoom, bC as startLongTaskObserver, bD as installGlobalReport, bE as applyStoredPreciseFontPreference, bF as getWelcomeSeen, bG as isLocalFontAccessSupported, bH as EDITOR_SCROLL_PADDING_PX, bI as Toolbar, bJ as OasisEditorLoading, bK as I18nProvider, bL as createEditorLogger, bM as createTranslator, bN as getCachedCanvasImage, bO as registerDomStatsSurface } from "./index-CDi9hs5T.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) {
@@ -5765,49 +5765,48 @@ function deleteItem(db, storeName, key) {
5765
5765
  }
5766
5766
  });
5767
5767
  }
5768
- const DB_NAME = "oasis-editor-db";
5769
- const STORE_NAME = "documents";
5770
- const DOCUMENT_KEY = "current-document";
5768
+ const DEFAULT_DB_NAME = "oasis-editor-db";
5769
+ const DEFAULT_STORE_NAME = "documents";
5770
+ const DEFAULT_DOCUMENT_KEY = "current-document";
5771
5771
  const DB_VERSION = 1;
5772
- class PersistenceService {
5773
- constructor() {
5774
- __publicField(this, "db", null);
5775
- }
5776
- async getDB() {
5777
- if (this.db) {
5778
- return this.db;
5779
- }
5780
- this.db = await openDB({
5781
- name: DB_NAME,
5772
+ function createIndexedDbPersistence(options = {}) {
5773
+ const dbName = options.dbName ?? DEFAULT_DB_NAME;
5774
+ const storeName = options.storeName ?? DEFAULT_STORE_NAME;
5775
+ const documentKey = options.key ?? DEFAULT_DOCUMENT_KEY;
5776
+ let db = null;
5777
+ async function getDB() {
5778
+ if (db) {
5779
+ return db;
5780
+ }
5781
+ db = await openDB({
5782
+ name: dbName,
5782
5783
  version: DB_VERSION,
5783
- onUpgrade: (db) => {
5784
- if (!db.objectStoreNames.contains(STORE_NAME)) {
5785
- db.createObjectStore(STORE_NAME);
5784
+ onUpgrade: (database) => {
5785
+ if (!database.objectStoreNames.contains(storeName)) {
5786
+ database.createObjectStore(storeName);
5786
5787
  }
5787
5788
  }
5788
5789
  });
5789
- return this.db;
5790
- }
5791
- async saveDocument(doc) {
5792
- const db = await this.getDB();
5793
- await putItem(db, STORE_NAME, DOCUMENT_KEY, doc);
5794
- }
5795
- async loadDocument() {
5796
- const db = await this.getDB();
5797
- return await getItem(db, STORE_NAME, DOCUMENT_KEY);
5798
- }
5799
- async clearDocument() {
5800
- const db = await this.getDB();
5801
- await deleteItem(db, STORE_NAME, DOCUMENT_KEY);
5790
+ return db;
5802
5791
  }
5803
- close() {
5804
- if (this.db) {
5805
- this.db.close();
5806
- this.db = null;
5792
+ return {
5793
+ async saveDocument(doc) {
5794
+ await putItem(await getDB(), storeName, documentKey, doc);
5795
+ },
5796
+ async loadDocument() {
5797
+ return getItem(await getDB(), storeName, documentKey);
5798
+ },
5799
+ async clearDocument() {
5800
+ await deleteItem(await getDB(), storeName, documentKey);
5801
+ },
5802
+ close() {
5803
+ if (db) {
5804
+ db.close();
5805
+ db = null;
5806
+ }
5807
5807
  }
5808
- }
5808
+ };
5809
5809
  }
5810
- const persistenceService = new PersistenceService();
5811
5810
  function findMatchesInDocument(doc, searchTerm, options = {}) {
5812
5811
  if (!searchTerm) return [];
5813
5812
  const matches = [];
@@ -8808,13 +8807,13 @@ function buildSrcRect(crop) {
8808
8807
  }
8809
8808
  const toUnits = (value) => value ? Math.round(value * OOXML_PERCENT_DENOMINATOR) : 0;
8810
8809
  const l = toUnits(crop.left);
8811
- const t2 = toUnits(crop.top);
8810
+ const t = toUnits(crop.top);
8812
8811
  const r = toUnits(crop.right);
8813
8812
  const b = toUnits(crop.bottom);
8814
- if (l === 0 && t2 === 0 && r === 0 && b === 0) {
8813
+ if (l === 0 && t === 0 && r === 0 && b === 0) {
8815
8814
  return "";
8816
8815
  }
8817
- return `<a:srcRect l="${l}" t="${t2}" r="${r}" b="${b}"/>`;
8816
+ return `<a:srcRect l="${l}" t="${t}" r="${r}" b="${b}"/>`;
8818
8817
  }
8819
8818
  function buildAnchorBool(value, fallback) {
8820
8819
  return value ?? fallback ? "1" : "0";
@@ -40572,6 +40571,7 @@ function parseEditorClipboardHtmlWithDom(html) {
40572
40571
  return paragraphs;
40573
40572
  }
40574
40573
  function createEditorContextMenuClipboard(deps) {
40574
+ const t = deps.t;
40575
40575
  const programmaticCopy = async () => {
40576
40576
  var _a;
40577
40577
  const state = deps.state();
@@ -41964,6 +41964,361 @@ function createEditorEssentialsRuntimePlugin(options) {
41964
41964
  table: essentialsTable
41965
41965
  });
41966
41966
  }
41967
+ const defaultMenuItems = [
41968
+ // File
41969
+ {
41970
+ id: "file_new",
41971
+ path: "File/New",
41972
+ labelKey: "menu.file.new",
41973
+ shortcut: "Ctrl+N",
41974
+ hidden: true,
41975
+ icon: "file-plus"
41976
+ },
41977
+ {
41978
+ id: "file_import",
41979
+ path: "File/Import",
41980
+ labelKey: "toolbar.import",
41981
+ shortcut: "Ctrl+O",
41982
+ command: "importDocument",
41983
+ icon: "upload"
41984
+ },
41985
+ {
41986
+ id: "file_save",
41987
+ path: "File/Save",
41988
+ labelKey: "generic.save",
41989
+ shortcut: "Ctrl+S",
41990
+ hidden: true,
41991
+ icon: "save"
41992
+ },
41993
+ {
41994
+ id: "file_export",
41995
+ path: "File/Export",
41996
+ labelKey: "menu.file.export",
41997
+ icon: "download"
41998
+ },
41999
+ {
42000
+ id: "file_export_pdf",
42001
+ path: "File/Export/PDF",
42002
+ command: "exportPdf",
42003
+ icon: "file-down"
42004
+ },
42005
+ {
42006
+ id: "file_export_docx",
42007
+ path: "File/Export/DOCX",
42008
+ command: "exportDocx",
42009
+ icon: "file-text"
42010
+ },
42011
+ { id: "file_export_html", path: "File/Export/HTML", hidden: true },
42012
+ { id: "file_export_md", path: "File/Export/MD", hidden: true },
42013
+ {
42014
+ id: "file_print",
42015
+ path: "File/Print",
42016
+ labelKey: "menu.file.print",
42017
+ shortcut: "Ctrl+P",
42018
+ command: "print",
42019
+ icon: "printer"
42020
+ },
42021
+ // Edit
42022
+ {
42023
+ id: "edit_undo",
42024
+ path: "Edit/Undo",
42025
+ labelKey: "toolbar.undo",
42026
+ shortcut: "Ctrl+Z",
42027
+ command: "undo",
42028
+ icon: "undo-2"
42029
+ },
42030
+ {
42031
+ id: "edit_redo",
42032
+ path: "Edit/Redo",
42033
+ labelKey: "toolbar.redo",
42034
+ shortcut: "Ctrl+Y",
42035
+ command: "redo",
42036
+ icon: "redo-2"
42037
+ },
42038
+ {
42039
+ id: "edit_cut",
42040
+ path: "Edit/Cut",
42041
+ labelKey: "menu.edit.cut",
42042
+ shortcut: "Ctrl+X",
42043
+ hidden: true
42044
+ },
42045
+ {
42046
+ id: "edit_copy",
42047
+ path: "Edit/Copy",
42048
+ labelKey: "menu.edit.copy",
42049
+ shortcut: "Ctrl+C",
42050
+ command: "copy",
42051
+ icon: "copy"
42052
+ },
42053
+ {
42054
+ id: "edit_paste",
42055
+ path: "Edit/Paste",
42056
+ labelKey: "menu.edit.paste",
42057
+ shortcut: "Ctrl+V",
42058
+ hidden: true
42059
+ },
42060
+ {
42061
+ id: "edit_find",
42062
+ path: "Edit/Find & Replace",
42063
+ labelKey: "find.title",
42064
+ shortcut: "Ctrl+F",
42065
+ command: "find",
42066
+ icon: "search"
42067
+ },
42068
+ {
42069
+ id: "edit_selectAll",
42070
+ path: "Edit/Select All",
42071
+ labelKey: "menu.edit.selectAll",
42072
+ shortcut: "Ctrl+A",
42073
+ hidden: true
42074
+ },
42075
+ // View
42076
+ {
42077
+ id: "view_outline",
42078
+ path: "View/Show Outline",
42079
+ labelKey: "menu.view.outline",
42080
+ hidden: true
42081
+ },
42082
+ { id: "view_ruler", path: "View/Show Ruler", hidden: true },
42083
+ {
42084
+ id: "view_margins",
42085
+ path: "View/Show Margins",
42086
+ labelKey: "menu.view.margins",
42087
+ command: "toggleShowMargins",
42088
+ icon: (host) => host.commands.state("toggleShowMargins").isActive ? "check-square" : "square"
42089
+ },
42090
+ {
42091
+ id: "view_paragraph_marks",
42092
+ path: "View/Show Paragraph Marks",
42093
+ labelKey: "menu.view.paragraphMarks",
42094
+ command: "toggleShowParagraphMarks",
42095
+ icon: (host) => host.commands.state("toggleShowParagraphMarks").isActive ? "check-square" : "square"
42096
+ },
42097
+ {
42098
+ id: "view_precise_fonts",
42099
+ path: "View/Precise Fonts",
42100
+ labelKey: "menu.view.preciseFonts",
42101
+ command: "togglePreciseFonts",
42102
+ icon: (host) => host.commands.state("togglePreciseFonts").isActive ? "check-square" : "square"
42103
+ },
42104
+ {
42105
+ id: "view_fullscreen",
42106
+ path: "View/Full Screen",
42107
+ labelKey: "menu.view.fullscreen",
42108
+ hidden: true
42109
+ },
42110
+ { id: "view_zoom", path: "View/Zoom", labelKey: "status.zoom", hidden: true },
42111
+ { id: "view_zoom_50", path: "View/Zoom/50%", hidden: true },
42112
+ { id: "view_zoom_75", path: "View/Zoom/75%", hidden: true },
42113
+ { id: "view_zoom_100", path: "View/Zoom/100%", hidden: true },
42114
+ { id: "view_zoom_125", path: "View/Zoom/125%", hidden: true },
42115
+ { id: "view_zoom_150", path: "View/Zoom/150%", hidden: true },
42116
+ { id: "view_zoom_200", path: "View/Zoom/200%", hidden: true },
42117
+ // Insert
42118
+ {
42119
+ id: "insert_image",
42120
+ path: "Insert/Image",
42121
+ labelKey: "toolbar.image",
42122
+ command: "insertImage",
42123
+ icon: "image"
42124
+ },
42125
+ {
42126
+ id: "insert_image_caption",
42127
+ path: "Insert/Image Caption",
42128
+ labelKey: "toolbar.imageCaption",
42129
+ command: "insertImageCaption",
42130
+ icon: "subtitles"
42131
+ },
42132
+ {
42133
+ id: "insert_table",
42134
+ path: "Insert/Table",
42135
+ labelKey: "toolbar.table",
42136
+ command: { name: "insertTable", payload: { rows: 3, cols: 3 } },
42137
+ icon: "table"
42138
+ },
42139
+ {
42140
+ id: "insert_link",
42141
+ path: "Insert/Link",
42142
+ labelKey: "toolbar.link",
42143
+ command: "link",
42144
+ icon: "link"
42145
+ },
42146
+ {
42147
+ id: "insert_footnote",
42148
+ path: "Insert/Footnote",
42149
+ labelKey: "toolbar.footnote",
42150
+ shortcut: "Ctrl+Alt+F",
42151
+ command: "insertFootnote",
42152
+ icon: "footnote"
42153
+ },
42154
+ {
42155
+ id: "insert_toc",
42156
+ path: "Insert/Table of Contents",
42157
+ labelKey: "menu.insert.toc",
42158
+ command: "insertTableOfContents",
42159
+ icon: "list"
42160
+ },
42161
+ {
42162
+ id: "insert_toc_update",
42163
+ path: "Insert/Update Table of Contents",
42164
+ labelKey: "menu.insert.updateToc",
42165
+ command: "updateTableOfContents",
42166
+ icon: "refresh-cw"
42167
+ },
42168
+ { id: "insert_hr", path: "Insert/Horizontal Rule", hidden: true },
42169
+ {
42170
+ id: "insert_pageBreak",
42171
+ path: "Insert/Page Break",
42172
+ labelKey: "metric.pageBreak",
42173
+ command: "pageBreak",
42174
+ icon: "file-minus"
42175
+ },
42176
+ { id: "insert_specialChar", path: "Insert/Special Character", hidden: true },
42177
+ { id: "insert_comment", path: "Insert/Comment", hidden: true },
42178
+ // Format
42179
+ {
42180
+ id: "format_text",
42181
+ path: "Format/Text",
42182
+ labelKey: "menu.format.text",
42183
+ icon: "type"
42184
+ },
42185
+ {
42186
+ id: "format_text_bold",
42187
+ path: "Format/Text/Bold",
42188
+ labelKey: "toolbar.bold",
42189
+ shortcut: "Ctrl+B",
42190
+ command: "bold",
42191
+ icon: "bold"
42192
+ },
42193
+ {
42194
+ id: "format_text_italic",
42195
+ path: "Format/Text/Italic",
42196
+ labelKey: "toolbar.italic",
42197
+ shortcut: "Ctrl+I",
42198
+ command: "italic",
42199
+ icon: "italic"
42200
+ },
42201
+ {
42202
+ id: "format_text_underline",
42203
+ path: "Format/Text/Underline",
42204
+ labelKey: "toolbar.underline",
42205
+ shortcut: "Ctrl+U",
42206
+ command: "underline",
42207
+ icon: "underline"
42208
+ },
42209
+ {
42210
+ id: "format_text_strike",
42211
+ path: "Format/Text/Strikethrough",
42212
+ labelKey: "toolbar.strike",
42213
+ command: "strike",
42214
+ icon: "strikethrough"
42215
+ },
42216
+ {
42217
+ id: "format_paragraphStyles",
42218
+ path: "Format/Paragraph styles",
42219
+ labelKey: "toolbar.style",
42220
+ hidden: true
42221
+ },
42222
+ {
42223
+ id: "format_align",
42224
+ path: "Format/Align",
42225
+ labelKey: "menu.format.align",
42226
+ icon: "align-left"
42227
+ },
42228
+ {
42229
+ id: "format_align_left",
42230
+ path: "Format/Align/Left",
42231
+ labelKey: "toolbar.alignLeft",
42232
+ command: "alignLeft",
42233
+ icon: "align-left"
42234
+ },
42235
+ {
42236
+ id: "format_align_center",
42237
+ path: "Format/Align/Center",
42238
+ labelKey: "toolbar.alignCenter",
42239
+ command: "alignCenter",
42240
+ icon: "align-center"
42241
+ },
42242
+ {
42243
+ id: "format_align_right",
42244
+ path: "Format/Align/Right",
42245
+ labelKey: "toolbar.alignRight",
42246
+ command: "alignRight",
42247
+ icon: "align-right"
42248
+ },
42249
+ {
42250
+ id: "format_align_justify",
42251
+ path: "Format/Align/Justify",
42252
+ labelKey: "toolbar.justify",
42253
+ command: "alignJustify",
42254
+ icon: "align-justify"
42255
+ },
42256
+ { id: "format_lineSpacing", path: "Format/Line spacing", hidden: true },
42257
+ {
42258
+ id: "format_lists",
42259
+ path: "Format/Lists",
42260
+ labelKey: "menu.format.lists",
42261
+ icon: "list"
42262
+ },
42263
+ {
42264
+ id: "format_lists_bullet",
42265
+ path: "Format/Lists/Bullet List",
42266
+ labelKey: "toolbar.bulletList",
42267
+ command: "bulletList",
42268
+ icon: "list"
42269
+ },
42270
+ {
42271
+ id: "format_lists_numbered",
42272
+ path: "Format/Lists/Numbered List",
42273
+ labelKey: "toolbar.numberedList",
42274
+ command: "orderedList",
42275
+ icon: "list-ordered"
42276
+ },
42277
+ { id: "format_clear", path: "Format/Clear formatting", hidden: true },
42278
+ // Layout
42279
+ {
42280
+ id: "layout_orientation",
42281
+ path: "Layout/Orientation",
42282
+ labelKey: "section.orientation",
42283
+ icon: "layout"
42284
+ },
42285
+ {
42286
+ id: "layout_orientation_portrait",
42287
+ path: "Layout/Orientation/Portrait",
42288
+ labelKey: "section.portrait",
42289
+ command: { name: "setOrientation", payload: "portrait" },
42290
+ icon: (host) => host.commands.state("toggleOrientation").isActive ? "" : "check"
42291
+ },
42292
+ {
42293
+ id: "layout_orientation_landscape",
42294
+ path: "Layout/Orientation/Landscape",
42295
+ labelKey: "section.landscape",
42296
+ command: { name: "setOrientation", payload: "landscape" },
42297
+ icon: (host) => host.commands.state("toggleOrientation").isActive ? "check" : ""
42298
+ },
42299
+ // Tools
42300
+ {
42301
+ id: "tools_wordcount",
42302
+ path: "Tools/Word count",
42303
+ labelKey: "menu.tools.wordcount",
42304
+ hidden: true
42305
+ },
42306
+ { id: "tools_spelling", hidden: true, path: "Tools/Spelling" },
42307
+ { id: "tools_preferences", path: "Tools/Preferences", hidden: true },
42308
+ // Help
42309
+ {
42310
+ id: "help_shortcuts",
42311
+ path: "Help/Keyboard shortcuts",
42312
+ labelKey: "menu.help.shortcuts",
42313
+ hidden: true
42314
+ },
42315
+ {
42316
+ id: "help_about",
42317
+ path: "Help/About",
42318
+ labelKey: "menu.help.about",
42319
+ hidden: true
42320
+ }
42321
+ ];
41967
42322
  function useEditorRuntimePlugins(options) {
41968
42323
  var _a, _b;
41969
42324
  const runtimePlugins = [
@@ -41974,7 +42329,7 @@ function useEditorRuntimePlugins(options) {
41974
42329
  const contributedMenuIds = [];
41975
42330
  const toolbarRegistry = createToolbarRegistry();
41976
42331
  const menuRegistry = new MenuRegistry();
41977
- for (const item of createDefaultToolbarPreset()) {
42332
+ for (const item of createDefaultToolbarPreset(options.t)) {
41978
42333
  toolbarRegistry.register(item);
41979
42334
  }
41980
42335
  for (const item of defaultMenuItems) {
@@ -42116,6 +42471,7 @@ function useEditorRuntimeBootstrap(ctx) {
42116
42471
  } = useEditorRuntimePlugins({
42117
42472
  essentialsPlugin,
42118
42473
  externalPlugins: ctx.externalPlugins,
42474
+ t: ctx.t,
42119
42475
  customizeToolbar: ctx.customizeToolbar,
42120
42476
  customizeMenubar: ctx.customizeMenubar
42121
42477
  });
@@ -42403,6 +42759,7 @@ function EditorDragLayers(props) {
42403
42759
  }
42404
42760
  var _tmpl$$d = /* @__PURE__ */ template(`<div class=oasis-editor-dialog-input-group><label class=oasis-editor-dialog-label></label><input type=text class=oasis-editor-dialog-input data-testid=editor-link-dialog-input>`), _tmpl$2$8 = /* @__PURE__ */ template(`<button class="oasis-editor-dialog-button oasis-editor-dialog-button-secondary"data-testid=editor-link-dialog-cancel>`), _tmpl$3$6 = /* @__PURE__ */ template(`<button class="oasis-editor-dialog-button oasis-editor-dialog-button-primary"data-testid=editor-link-dialog-apply>`);
42405
42761
  function LinkDialog(props) {
42762
+ const t = useI18n();
42406
42763
  const [href, setHref] = createSignal(props.initialHref);
42407
42764
  let inputRef;
42408
42765
  createEffect(() => {
@@ -42454,6 +42811,7 @@ function LinkDialog(props) {
42454
42811
  delegateEvents(["input", "keydown", "click"]);
42455
42812
  var _tmpl$$c = /* @__PURE__ */ template(`<div class=oasis-editor-dialog-input-group><label class=oasis-editor-dialog-label></label><input type=text class=oasis-editor-dialog-input>`), _tmpl$2$7 = /* @__PURE__ */ template(`<button class="oasis-editor-dialog-button oasis-editor-dialog-button-secondary">`), _tmpl$3$5 = /* @__PURE__ */ template(`<button class="oasis-editor-dialog-button oasis-editor-dialog-button-primary">`);
42456
42813
  function ImageAltDialog(props) {
42814
+ const t = useI18n();
42457
42815
  const [alt, setAlt] = createSignal(props.initialAlt);
42458
42816
  let inputRef;
42459
42817
  createEffect(() => {
@@ -42505,6 +42863,7 @@ function ImageAltDialog(props) {
42505
42863
  delegateEvents(["input", "keydown", "click"]);
42506
42864
  var _tmpl$$b = /* @__PURE__ */ template(`<div class=oasis-editor-dialog-input-group><label class=oasis-editor-dialog-label></label><input type=text class=oasis-editor-dialog-input>`), _tmpl$2$6 = /* @__PURE__ */ template(`<button class="oasis-editor-dialog-button oasis-editor-dialog-button-secondary">`), _tmpl$3$4 = /* @__PURE__ */ template(`<button class="oasis-editor-dialog-button oasis-editor-dialog-button-primary">`);
42507
42865
  function ImageCaptionDialog(props) {
42866
+ const t = useI18n();
42508
42867
  const [caption, setCaption] = createSignal(props.initialCaption);
42509
42868
  let inputRef;
42510
42869
  createEffect(() => {
@@ -42770,6 +43129,7 @@ function buildFontDialogApplyValues(font, advanced) {
42770
43129
  };
42771
43130
  }
42772
43131
  function useFontDialogController(props) {
43132
+ const t = useI18n();
42773
43133
  const [activeTab, setActiveTab] = createSignal("font");
42774
43134
  const [fontTabValues, setFontTabValues] = createSignal(
42775
43135
  createFontTabValuesFromInitial(props.initial)
@@ -42873,6 +43233,7 @@ function useFontDialogController(props) {
42873
43233
  }
42874
43234
  var _tmpl$$a = /* @__PURE__ */ template(`<div>`);
42875
43235
  function FontPreview(props) {
43236
+ const t = useI18n();
42876
43237
  return (() => {
42877
43238
  var _el$ = _tmpl$$a();
42878
43239
  insert(_el$, () => t("dialog.font.previewText"));
@@ -42892,6 +43253,7 @@ function FontPreview(props) {
42892
43253
  }
42893
43254
  var _tmpl$$9 = /* @__PURE__ */ template(`<div class="oasis-editor-font-dialog-panel oasis-editor-font-dialog-font-panel"><div class=oasis-editor-dialog-row><div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><input class=oasis-editor-dialog-input data-testid=editor-font-dialog-family-filter></div></div><div class=oasis-editor-dialog-row><div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><select class=oasis-editor-dialog-input data-testid=editor-font-dialog-family><option value>—</option></select></div><div class="oasis-editor-dialog-input-group oasis-editor-font-dialog-size-group"><label class=oasis-editor-dialog-label></label><select class=oasis-editor-dialog-input data-testid=editor-font-dialog-size><option value>—</option></select></div></div><div class=oasis-editor-dialog-row><div class="oasis-editor-dialog-input-group oasis-editor-font-dialog-custom-size-group"><label class=oasis-editor-dialog-label></label><input class=oasis-editor-dialog-input data-testid=editor-font-dialog-custom-size><span class=oasis-editor-dialog-help-text></span></div><div class="oasis-editor-dialog-input-group oasis-editor-font-dialog-style-list-group"><label class=oasis-editor-dialog-label></label><select class=oasis-editor-dialog-input data-testid=editor-font-dialog-style-list><option value=regular></option><option value=italic></option><option value=bold></option><option value=boldItalic></option></select></div></div><div class="oasis-editor-dialog-row oasis-editor-font-dialog-color-row"><div class="oasis-editor-dialog-input-group oasis-editor-font-dialog-color-mode-group"><label class=oasis-editor-dialog-label></label><select class=oasis-editor-dialog-input data-testid=editor-font-dialog-color-mode><option value=automatic></option><option value=custom></option></select><input type=color class=oasis-editor-dialog-color data-testid=editor-font-dialog-color></div><div class=oasis-editor-dialog-input-group><label class=oasis-editor-dialog-label></label><input type=color class=oasis-editor-dialog-color data-testid=editor-font-dialog-highlight></div><div class=oasis-editor-dialog-input-group><label class=oasis-editor-dialog-label></label><input type=color class=oasis-editor-dialog-color data-testid=editor-font-dialog-shading></div></div><div class=oasis-editor-dialog-row><div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><select class=oasis-editor-dialog-input data-testid=editor-font-dialog-underline-style><option value=none></option></select></div><div class=oasis-editor-dialog-input-group><label class=oasis-editor-dialog-label></label><input type=color class=oasis-editor-dialog-color data-testid=editor-font-dialog-underline-color></div></div><div class=oasis-editor-dialog-row><div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><div class=oasis-editor-dialog-style-row><label class=oasis-editor-dialog-style-toggle><input type=checkbox data-testid=editor-font-dialog-bold><span style=font-weight:700></span></label><label class=oasis-editor-dialog-style-toggle><input type=checkbox data-testid=editor-font-dialog-italic><span style=font-style:italic></span></label><label class=oasis-editor-dialog-style-toggle><input type=checkbox data-testid=editor-font-dialog-underline><span style=text-decoration:underline></span></label><label class=oasis-editor-dialog-style-toggle><input type=checkbox data-testid=editor-font-dialog-strike><span style=text-decoration:line-through></span></label><label class=oasis-editor-dialog-style-toggle><input type=checkbox data-testid=editor-font-dialog-double-strike><span></span></label><label class=oasis-editor-dialog-style-toggle><input type=checkbox data-testid=editor-font-dialog-superscript><span></span></label><label class=oasis-editor-dialog-style-toggle><input type=checkbox data-testid=editor-font-dialog-subscript><span></span></label><label class=oasis-editor-dialog-style-toggle><input type=checkbox data-testid=editor-font-dialog-small-caps><span></span></label><label class=oasis-editor-dialog-style-toggle><input type=checkbox data-testid=editor-font-dialog-all-caps><span></span></label><label class=oasis-editor-dialog-style-toggle><input type=checkbox data-testid=editor-font-dialog-hidden><span></span></label></div></div></div><div class=oasis-editor-dialog-input-group><label class=oasis-editor-dialog-label>`), _tmpl$2$5 = /* @__PURE__ */ template(`<option>`);
42894
43255
  function FontTab(props) {
43256
+ const t = useI18n();
42895
43257
  const {
42896
43258
  ctrl
42897
43259
  } = props;
@@ -43057,6 +43419,7 @@ function FontTab(props) {
43057
43419
  delegateEvents(["input"]);
43058
43420
  var _tmpl$$8 = /* @__PURE__ */ template(`<div class="oasis-editor-font-dialog-panel oasis-editor-font-dialog-advanced-panel"><fieldset class=oasis-editor-font-dialog-fieldset><legend></legend><div class=oasis-editor-font-dialog-word-row><label class=oasis-editor-dialog-label></label><select class=oasis-editor-dialog-input data-testid=editor-font-dialog-advanced-scale></select></div><div class=oasis-editor-font-dialog-word-row><label class=oasis-editor-dialog-label></label><select class=oasis-editor-dialog-input data-testid=editor-font-dialog-advanced-spacing-mode><option value=normal></option><option value=expanded></option><option value=condensed></option></select><label class="oasis-editor-dialog-label oasis-editor-font-dialog-by-label"></label><input class="oasis-editor-dialog-input oasis-editor-font-dialog-small-input"data-testid=editor-font-dialog-advanced-spacing-amount></div><div class=oasis-editor-font-dialog-word-row><label class=oasis-editor-dialog-label></label><select class=oasis-editor-dialog-input data-testid=editor-font-dialog-advanced-position-mode><option value=normal></option><option value=raised></option><option value=lowered></option></select><label class="oasis-editor-dialog-label oasis-editor-font-dialog-by-label"></label><input class="oasis-editor-dialog-input oasis-editor-font-dialog-small-input"data-testid=editor-font-dialog-advanced-position-amount></div><div class="oasis-editor-font-dialog-word-row oasis-editor-font-dialog-kerning-row"><label class="oasis-editor-dialog-style-toggle oasis-editor-font-dialog-kerning-toggle"><input type=checkbox data-testid=editor-font-dialog-advanced-kerning-enabled><span></span></label><input class="oasis-editor-dialog-input oasis-editor-font-dialog-kerning-input"data-testid=editor-font-dialog-advanced-kerning><span class="oasis-editor-dialog-help-text oasis-editor-font-dialog-kerning-suffix"></span></div></fieldset><fieldset class=oasis-editor-font-dialog-fieldset><legend></legend><div class=oasis-editor-font-dialog-word-row><label class=oasis-editor-dialog-label></label><select class=oasis-editor-dialog-input data-testid=editor-font-dialog-advanced-ligatures><option value></option><option value=none></option><option value=standard></option><option value=contextual></option><option value=historical></option><option value=standardContextual></option></select></div><div class=oasis-editor-font-dialog-word-row><label class=oasis-editor-dialog-label></label><select class=oasis-editor-dialog-input data-testid=editor-font-dialog-advanced-number-spacing><option value></option><option value=proportional></option><option value=tabular></option></select></div><div class=oasis-editor-font-dialog-word-row><label class=oasis-editor-dialog-label></label><select class=oasis-editor-dialog-input data-testid=editor-font-dialog-advanced-number-form><option value></option><option value=lining></option><option value=oldStyle></option></select></div><div class=oasis-editor-font-dialog-word-row><label class=oasis-editor-dialog-label></label><select class=oasis-editor-dialog-input data-testid=editor-font-dialog-advanced-stylistic-set><option value></option></select></div><label class="oasis-editor-dialog-style-toggle oasis-editor-font-dialog-contextual-toggle"><input type=checkbox data-testid=editor-font-dialog-advanced-contextual-alternates><span></span></label></fieldset><fieldset class=oasis-editor-font-dialog-fieldset><legend></legend></fieldset><p class=oasis-editor-dialog-help-text data-testid=editor-font-dialog-advanced-placeholder>`), _tmpl$2$4 = /* @__PURE__ */ template(`<option>%`), _tmpl$3$3 = /* @__PURE__ */ template(`<option>`);
43059
43421
  function AdvancedFontTab(props) {
43422
+ const t = useI18n();
43060
43423
  const {
43061
43424
  ctrl
43062
43425
  } = props;
@@ -43171,6 +43534,7 @@ function AdvancedFontTab(props) {
43171
43534
  delegateEvents(["input"]);
43172
43535
  var _tmpl$$7 = /* @__PURE__ */ template(`<button class="oasis-editor-dialog-button oasis-editor-dialog-button-secondary"data-testid=editor-font-dialog-cancel>`), _tmpl$2$3 = /* @__PURE__ */ template(`<button class="oasis-editor-dialog-button oasis-editor-dialog-button-primary"data-testid=editor-font-dialog-apply>`);
43173
43536
  function FontDialog(props) {
43537
+ const t = useI18n();
43174
43538
  const ctrl = useFontDialogController(props);
43175
43539
  return createComponent(Dialog, {
43176
43540
  get isOpen() {
@@ -43239,6 +43603,7 @@ function parseNumber$1(value) {
43239
43603
  return Number.isFinite(num) ? num : null;
43240
43604
  }
43241
43605
  function ParagraphDialog(props) {
43606
+ const t = useI18n();
43242
43607
  const [align, setAlign] = createSignal("");
43243
43608
  const [indentLeft, setIndentLeft] = createSignal("");
43244
43609
  const [indentRight, setIndentRight] = createSignal("");
@@ -43523,6 +43888,7 @@ function resolveBorder(style2, widthValue, colorValue) {
43523
43888
  };
43524
43889
  }
43525
43890
  function TablePropertiesDialog(props) {
43891
+ const t = useI18n();
43526
43892
  const [activeTab, setActiveTab] = createSignal("table");
43527
43893
  const [tableWidth, setTableWidth] = createSignal("");
43528
43894
  const [tableWidthUnit, setTableWidthUnit] = createSignal("points");
@@ -43843,6 +44209,7 @@ function TablePropertiesDialog(props) {
43843
44209
  delegateEvents(["input", "click"]);
43844
44210
  var _tmpl$$4 = /* @__PURE__ */ template(`<div class=oasis-editor-find-replace-dialog><div class=oasis-editor-fr-header><span></span><button class=oasis-editor-fr-close><i data-lucide=x></i></button></div><div class=oasis-editor-fr-body><div class=oasis-editor-fr-input-group><div class=oasis-editor-fr-input-wrapper><input type=text autofocus class=oasis-editor-fr-input><span class=oasis-editor-fr-counter></span></div><div class=oasis-editor-fr-actions><button><i data-lucide=chevron-up></i></button><button><i data-lucide=chevron-down></i></button></div></div><div class=oasis-editor-fr-input-group><input type=text class=oasis-editor-fr-input><div class=oasis-editor-fr-actions><button class=oasis-editor-fr-btn-text></button><button class=oasis-editor-fr-btn-text></button></div></div><div class=oasis-editor-fr-options><label class=oasis-editor-fr-checkbox><input type=checkbox><span></span></label><label class=oasis-editor-fr-checkbox><input type=checkbox><span>`);
43845
44211
  function FindReplaceDialog(props) {
44212
+ const t = useI18n();
43846
44213
  const {
43847
44214
  fr
43848
44215
  } = props;
@@ -46476,6 +46843,7 @@ function useEditorTransactions(ctx) {
46476
46843
  }
46477
46844
  var _tmpl$$1 = /* @__PURE__ */ template(`<div class=oasis-editor-welcome-overlay role=dialog aria-modal=true aria-labelledby=oasis-editor-welcome-title><div class=oasis-editor-welcome-card><h2 id=oasis-editor-welcome-title class=oasis-editor-welcome-title></h2><p class=oasis-editor-welcome-body></p><p class=oasis-editor-welcome-note></p><div class=oasis-editor-welcome-actions><button class="oasis-editor-dialog-button oasis-editor-dialog-button-secondary"data-testid=editor-welcome-skip></button><button class="oasis-editor-dialog-button oasis-editor-dialog-button-primary"data-testid=editor-welcome-enable>`);
46478
46845
  function WelcomeOverlay(props) {
46846
+ const t = useI18n();
46479
46847
  const handleEnable = () => {
46480
46848
  void enablePreciseFontMode();
46481
46849
  setWelcomeSeen();
@@ -46516,9 +46884,7 @@ function OasisEditorApp(props = {}) {
46516
46884
  const documentOptions = () => props.document ?? {};
46517
46885
  const runtimeOptions = () => props.runtime ?? {};
46518
46886
  syncCanvasDebugApiVisibility();
46519
- createEffect(() => {
46520
- setLocale(ui().locale ?? "pt-BR");
46521
- });
46887
+ const translator = createTranslator(() => ui().locale ?? "pt-BR");
46522
46888
  const logger = createEditorLogger("app");
46523
46889
  const {
46524
46890
  state,
@@ -46617,6 +46983,9 @@ function OasisEditorApp(props = {}) {
46617
46983
  isImporting: isImportInProgress,
46618
46984
  zoomFactor: zoom.zoomFactor
46619
46985
  });
46986
+ const fallbackPersistence = createIndexedDbPersistence({
46987
+ key: documentOptions().persistenceKey
46988
+ });
46620
46989
  const {
46621
46990
  status: persistenceStatus
46622
46991
  } = useEditorPersistence(state, (loadedDoc) => {
@@ -46628,7 +46997,7 @@ function OasisEditorApp(props = {}) {
46628
46997
  resetEditorChromeState();
46629
46998
  }, {
46630
46999
  enabled: documentOptions().persistenceEnabled ?? false,
46631
- persistence: documentOptions().persistence ?? persistenceService,
47000
+ persistence: documentOptions().persistence ?? fallbackPersistence,
46632
47001
  logger
46633
47002
  });
46634
47003
  let forcePlainTextPaste = false;
@@ -46915,6 +47284,7 @@ function OasisEditorApp(props = {}) {
46915
47284
  }
46916
47285
  },
46917
47286
  externalPlugins: runtimeOptions().plugins,
47287
+ t: translator,
46918
47288
  customizeToolbar: runtimeOptions().customizeToolbar,
46919
47289
  customizeMenubar: runtimeOptions().customizeMenubar,
46920
47290
  initialDocument: getStateSnapshot().document,
@@ -46945,7 +47315,7 @@ function OasisEditorApp(props = {}) {
46945
47315
  focusInput();
46946
47316
  },
46947
47317
  saveDocument: async () => {
46948
- const persistence = documentOptions().persistence ?? persistenceService;
47318
+ const persistence = documentOptions().persistence ?? fallbackPersistence;
46949
47319
  await persistence.saveDocument(cloneState(getStateSnapshot()).document);
46950
47320
  },
46951
47321
  getSelection: () => cloneState(getStateSnapshot()).selection,
@@ -47081,6 +47451,7 @@ function OasisEditorApp(props = {}) {
47081
47451
  const contextMenuClipboard = createEditorContextMenuClipboard({
47082
47452
  state: () => state,
47083
47453
  isReadOnly,
47454
+ t: translator,
47084
47455
  logger,
47085
47456
  setContextMenu,
47086
47457
  clearPreferredColumn,
@@ -47178,137 +47549,140 @@ function OasisEditorApp(props = {}) {
47178
47549
  textBoxOps.stopTextBoxResize();
47179
47550
  stopIconObserver();
47180
47551
  });
47181
- return (() => {
47182
- var _el$ = _tmpl$();
47183
- setStyleProperty(_el$, "--oasis-editor-gutter-x", `${EDITOR_SCROLL_PADDING_PX}px`);
47184
- insert(_el$, createComponent(Show, {
47185
- get when() {
47186
- return memo(() => !!(!useComposedShell() && showChrome()))() && showToolbar();
47187
- },
47188
- get children() {
47189
- return createComponent(Toolbar, {
47190
- host: toolbarHost,
47191
- registry: toolbarRegistry,
47192
- get view() {
47193
- return toolbarView();
47194
- },
47195
- get layout() {
47196
- return toolbarLayout();
47197
- }
47198
- });
47199
- }
47200
- }), null);
47201
- insert(_el$, createComponent(EditorDialogsLayer, {
47202
- dialogs: {
47203
- linkDialog,
47204
- setLinkDialog,
47205
- imageAltDialog,
47206
- setImageAltDialog,
47207
- imageCaptionDialog,
47208
- setImageCaptionDialog,
47209
- contextMenu,
47210
- setContextMenu,
47211
- fontDialog,
47212
- setFontDialog,
47213
- paragraphDialog,
47214
- setParagraphDialog,
47215
- tablePropertiesDialog,
47216
- setTablePropertiesDialog
47217
- },
47218
- findReplace: fr,
47219
- fontFamilyOptions: computeFontFamilyOptions2,
47220
- fontSizeOptions: computeFontSizeOptions2,
47221
- contextMenuItems: buildContextMenuItems,
47222
- focusInput,
47223
- get applyLinkCommand() {
47224
- return commandsController.applyLinkCommand;
47225
- },
47226
- get applyImageAltCommand() {
47227
- return commandsController.applyImageAltCommand;
47228
- },
47229
- get applyImageCaptionCommand() {
47230
- return commandsController.applyImageCaptionCommand;
47231
- },
47232
- applyFontDialogValues,
47233
- applyParagraphDialogValues,
47234
- applyTablePropertiesDialogValues,
47235
- closeContextMenu
47236
- }), null);
47237
- insert(_el$, createComponent(EditorWorkspace, {
47238
- useComposedShell,
47239
- shellComponent,
47240
- state: () => state,
47241
- toolbarHost,
47242
- runtimeEditor,
47243
- persistenceStatus,
47244
- toolbarRegistry,
47245
- menuRegistry,
47246
- showChrome,
47247
- showTitleBar,
47248
- showMenubar,
47249
- showToolbar,
47250
- showOutline,
47251
- toolbarView,
47252
- toolbarLayout,
47253
- isReadOnly,
47254
- viewportHeight: () => ui().viewportHeight,
47255
- measuredBlockHeights,
47256
- measuredParagraphLayouts,
47257
- showFloatingTableToolbar: () => !isReadOnly() && commandStateOf("tableContext").value !== null,
47258
- layout: editorLayoutProps,
47259
- overlays: editorOverlayProps,
47260
- refs: editorRefs,
47261
- surfaceHandlers: editorSurfaceHandlers,
47262
- inputHandlers: editorInputHandlers,
47263
- fileHandlers: editorFileHandlers
47264
- }), null);
47265
- insert(_el$, createComponent(EditorDragLayers, {
47266
- state,
47267
- get surfaceRef() {
47268
- return surfaceRef();
47269
- },
47270
- tableResize,
47271
- imageOps,
47272
- tableDrag,
47273
- textDrag
47274
- }), null);
47275
- insert(_el$, createComponent(Show, {
47276
- get when() {
47277
- return initialLoading() || !runtimeReady();
47278
- },
47279
- get children() {
47280
- return createComponent(OasisEditorLoading, {
47281
- get label() {
47282
- return loadingLabel();
47283
- },
47284
- get ["class"]() {
47285
- var _a2;
47286
- return (_a2 = loadingOptions()) == null ? void 0 : _a2.class;
47287
- },
47288
- get style() {
47289
- var _a2;
47290
- return (_a2 = loadingOptions()) == null ? void 0 : _a2.style;
47291
- }
47292
- });
47293
- }
47294
- }), null);
47295
- insert(_el$, createComponent(WelcomeOverlay, {
47296
- get isOpen() {
47297
- return memo(() => !!(welcomeOpen() && !initialLoading()))() && runtimeReady();
47298
- },
47299
- onClose: () => setWelcomeOpen(false)
47300
- }), null);
47301
- createRenderEffect((_p$) => {
47302
- var _v$ = !!useComposedShell(), _v$2 = !!isReadOnly();
47303
- _v$ !== _p$.e && _el$.classList.toggle("oasis-editor-docs", _p$.e = _v$);
47304
- _v$2 !== _p$.t && _el$.classList.toggle("oasis-editor-read-only", _p$.t = _v$2);
47305
- return _p$;
47306
- }, {
47307
- e: void 0,
47308
- t: void 0
47309
- });
47310
- return _el$;
47311
- })();
47552
+ return createComponent(I18nProvider, {
47553
+ translator,
47554
+ get children() {
47555
+ var _el$ = _tmpl$();
47556
+ setStyleProperty(_el$, "--oasis-editor-gutter-x", `${EDITOR_SCROLL_PADDING_PX}px`);
47557
+ insert(_el$, createComponent(Show, {
47558
+ get when() {
47559
+ return memo(() => !!(!useComposedShell() && showChrome()))() && showToolbar();
47560
+ },
47561
+ get children() {
47562
+ return createComponent(Toolbar, {
47563
+ host: toolbarHost,
47564
+ registry: toolbarRegistry,
47565
+ get view() {
47566
+ return toolbarView();
47567
+ },
47568
+ get layout() {
47569
+ return toolbarLayout();
47570
+ }
47571
+ });
47572
+ }
47573
+ }), null);
47574
+ insert(_el$, createComponent(EditorDialogsLayer, {
47575
+ dialogs: {
47576
+ linkDialog,
47577
+ setLinkDialog,
47578
+ imageAltDialog,
47579
+ setImageAltDialog,
47580
+ imageCaptionDialog,
47581
+ setImageCaptionDialog,
47582
+ contextMenu,
47583
+ setContextMenu,
47584
+ fontDialog,
47585
+ setFontDialog,
47586
+ paragraphDialog,
47587
+ setParagraphDialog,
47588
+ tablePropertiesDialog,
47589
+ setTablePropertiesDialog
47590
+ },
47591
+ findReplace: fr,
47592
+ fontFamilyOptions: computeFontFamilyOptions2,
47593
+ fontSizeOptions: computeFontSizeOptions2,
47594
+ contextMenuItems: buildContextMenuItems,
47595
+ focusInput,
47596
+ get applyLinkCommand() {
47597
+ return commandsController.applyLinkCommand;
47598
+ },
47599
+ get applyImageAltCommand() {
47600
+ return commandsController.applyImageAltCommand;
47601
+ },
47602
+ get applyImageCaptionCommand() {
47603
+ return commandsController.applyImageCaptionCommand;
47604
+ },
47605
+ applyFontDialogValues,
47606
+ applyParagraphDialogValues,
47607
+ applyTablePropertiesDialogValues,
47608
+ closeContextMenu
47609
+ }), null);
47610
+ insert(_el$, createComponent(EditorWorkspace, {
47611
+ useComposedShell,
47612
+ shellComponent,
47613
+ state: () => state,
47614
+ toolbarHost,
47615
+ runtimeEditor,
47616
+ persistenceStatus,
47617
+ toolbarRegistry,
47618
+ menuRegistry,
47619
+ showChrome,
47620
+ showTitleBar,
47621
+ showMenubar,
47622
+ showToolbar,
47623
+ showOutline,
47624
+ toolbarView,
47625
+ toolbarLayout,
47626
+ isReadOnly,
47627
+ viewportHeight: () => ui().viewportHeight,
47628
+ measuredBlockHeights,
47629
+ measuredParagraphLayouts,
47630
+ showFloatingTableToolbar: () => !isReadOnly() && commandStateOf("tableContext").value !== null,
47631
+ layout: editorLayoutProps,
47632
+ overlays: editorOverlayProps,
47633
+ refs: editorRefs,
47634
+ surfaceHandlers: editorSurfaceHandlers,
47635
+ inputHandlers: editorInputHandlers,
47636
+ fileHandlers: editorFileHandlers
47637
+ }), null);
47638
+ insert(_el$, createComponent(EditorDragLayers, {
47639
+ state,
47640
+ get surfaceRef() {
47641
+ return surfaceRef();
47642
+ },
47643
+ tableResize,
47644
+ imageOps,
47645
+ tableDrag,
47646
+ textDrag
47647
+ }), null);
47648
+ insert(_el$, createComponent(Show, {
47649
+ get when() {
47650
+ return initialLoading() || !runtimeReady();
47651
+ },
47652
+ get children() {
47653
+ return createComponent(OasisEditorLoading, {
47654
+ get label() {
47655
+ return loadingLabel();
47656
+ },
47657
+ get ["class"]() {
47658
+ var _a2;
47659
+ return (_a2 = loadingOptions()) == null ? void 0 : _a2.class;
47660
+ },
47661
+ get style() {
47662
+ var _a2;
47663
+ return (_a2 = loadingOptions()) == null ? void 0 : _a2.style;
47664
+ }
47665
+ });
47666
+ }
47667
+ }), null);
47668
+ insert(_el$, createComponent(WelcomeOverlay, {
47669
+ get isOpen() {
47670
+ return memo(() => !!(welcomeOpen() && !initialLoading()))() && runtimeReady();
47671
+ },
47672
+ onClose: () => setWelcomeOpen(false)
47673
+ }), null);
47674
+ createRenderEffect((_p$) => {
47675
+ var _v$ = !!useComposedShell(), _v$2 = !!isReadOnly();
47676
+ _v$ !== _p$.e && _el$.classList.toggle("oasis-editor-docs", _p$.e = _v$);
47677
+ _v$2 !== _p$.t && _el$.classList.toggle("oasis-editor-read-only", _p$.t = _v$2);
47678
+ return _p$;
47679
+ }, {
47680
+ e: void 0,
47681
+ t: void 0
47682
+ });
47683
+ return _el$;
47684
+ }
47685
+ });
47312
47686
  }
47313
47687
  export {
47314
47688
  OasisEditorApp