oasis-editor 0.0.148 → 0.0.149
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-B1b1iJOQ.js → OasisEditorApp-CmqlSXEk.js} +302 -45
- package/dist/app/controllers/useEditorSurfaceEvents.d.ts +1 -0
- package/dist/assets/importDocxWorker-CpQR2fwx.js +12 -0
- package/dist/core/commands/builtinCommands.d.ts +1 -1
- package/dist/core/commands/publicCommandTypes.d.ts +7 -1
- package/dist/core/commands/text.d.ts +1 -1
- package/dist/core/commands/textEditing.d.ts +3 -1
- package/dist/core/document/clone.d.ts +2 -1
- package/dist/core/math/linear.d.ts +5 -0
- package/dist/core/model/index.d.ts +3 -1
- package/dist/core/model/runKind.d.ts +3 -0
- package/dist/core/model/types/layout.d.ts +2 -0
- package/dist/core/model/types/math.d.ts +95 -0
- package/dist/core/model/types/nodes.d.ts +4 -0
- package/dist/export/docx/text/mathXml.d.ts +3 -0
- package/dist/i18n/locales/en.d.ts +5 -0
- package/dist/i18n/locales/pt-BR.d.ts +5 -0
- package/dist/import/docx/math.d.ts +5 -0
- package/dist/import/docx/runs/types.d.ts +2 -1
- package/dist/{index-CpZO1PF4.js → index-B7V7kbjr.js} +1860 -1285
- package/dist/index.d.ts +1 -0
- package/dist/oasis-editor.css +1 -1
- package/dist/oasis-editor.js +79 -79
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/plugins/internal/essentialsCapabilities.d.ts +4 -1
- package/dist/ui/app/EditorDialogsLayer.d.ts +2 -0
- package/dist/ui/app/createEditorCommandRuntime.d.ts +5 -0
- package/dist/ui/app/createEditorInteractionRuntime.d.ts +1 -0
- package/dist/ui/app/essentials/types.d.ts +1 -0
- package/dist/ui/app/useEditorDialogs.d.ts +11 -0
- package/dist/ui/app/useEditorInteractionWiring.d.ts +1 -0
- package/dist/ui/components/Dialogs/EquationDialog.d.ts +10 -0
- package/dist/ui/math/mathPainter.d.ts +10 -0
- package/package.json +1 -1
- package/dist/assets/importDocxWorker-BLm3QMHu.js +0 -12
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
3
3
|
var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
|
|
4
|
-
import { E as EMPTY_PROJECTION_CONTEXT, d as domTextMeasurer, g as getProjectedParagraphBlockHeight, e as estimateTableBlockHeight, p as projectParagraphLayout, a as getPageBodyBottom, b as getPageBodyTop, c as getPageContentWidth, F as FOOTNOTE_MARKER_GUTTER_PX, f as getParagraphText, h as getBlockParagraphs, i as getRunFootnoteReference, l as listReferencedEndnotes, j as getFootnoteDisplayMarker, k as createProjectionContext, m as getDocumentSections, n as getRunField, o as projectBlocksLayout, q as assertNever, r as cloneRun, s as createSignal, t as createEditorStateFromDocument, u as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, v as fontSizePxToPt, w as probeLocalFontFamilies, x as createEditorParagraphFromRuns, y as isInlineObjectRun, z as stylesEqual, A as cloneStyle, B as createEditorStyledRun, C as cloneParagraphList, D as cloneParagraph, G as getParagraphLength, H as getActiveZone, I as getActiveSectionIndex, J as getParagraphs, K as normalizeSelection, L as positionToParagraphOffset, M as cloneParagraphs, N as paragraphOffsetToPosition, O as findParagraphIndex, P as createCollapsedSelection, Q as isSelectionCollapsed, R as
|
|
4
|
+
import { E as EMPTY_PROJECTION_CONTEXT, d as domTextMeasurer, g as getProjectedParagraphBlockHeight, e as estimateTableBlockHeight, p as projectParagraphLayout, a as getPageBodyBottom, b as getPageBodyTop, c as getPageContentWidth, F as FOOTNOTE_MARKER_GUTTER_PX, f as getParagraphText, h as getBlockParagraphs, i as getRunFootnoteReference, l as listReferencedEndnotes, j as getFootnoteDisplayMarker, k as createProjectionContext, m as getDocumentSections, n as getRunField, o as projectBlocksLayout, q as assertNever, r as cloneRun, s as createSignal, t as createEditorStateFromDocument, u as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, v as fontSizePxToPt, w as probeLocalFontFamilies, x as createEditorParagraphFromRuns, y as isInlineObjectRun, z as stylesEqual, A as cloneStyle, B as createEditorStyledRun, C as cloneParagraphList, D as cloneParagraph, G as getParagraphLength, H as getActiveZone, I as getActiveSectionIndex, J as getParagraphs, K as normalizeSelection, L as positionToParagraphOffset, M as cloneParagraphs, N as paragraphOffsetToPosition, O as findParagraphIndex, P as createCollapsedSelection, Q as isSelectionCollapsed, R as MATH_OBJECT_REPLACEMENT, T as setValueStyle, U as setBooleanStyle, V as parseFontSizePtToPx, W as formatFontSizePt, X as setParagraphStyleValue, Y as createEditorParagraph, Z as cloneBlocks, _ as resolveDefaultParagraphStyleId, $ as findParagraphTablePathLocation, a0 as findParagraphLocation, a1 as resolveTablePath, a2 as buildTableCellLayout, a3 as PT_PER_PX, a4 as createEditorTableCell, a5 as createEditorTableRow, a6 as createEditorTable, a7 as clampPosition, a8 as PX_PER_POINT, a9 as underlineStyleToCssDecorationStyle, aa as resolveImageSrc, ab as listKindForTag, ac as isParagraphTag, ad as collectInlineRuns, ae as parseParagraphStyle, af as getRunImage, ag as InlineShell, ah as BalloonShell, ai as DocumentShell, aj as findParagraphTableLocation, ak as createMemo, al as getCaretRectFromSnapshot, am as getParagraphRectFromSnapshot, an as createComponent, ao as CaretOverlay, ap as Show, aq as createRenderEffect, ar as style, as as setStyleProperty, at as setAttribute, au as memo, av as template, aw as Button, ax as useI18n, ay as createEffect, az as TextField, aA as Dialog, aB as insert, aC as className, aD as Grid, aE as SelectField, aF as StatusText, aG as ColorField, aH as UNDERLINE_STYLE_OPTIONS, aI as Stack, aJ as For, aK as ToggleChip, aL as FormField, aM as Checkbox, aN as FieldGroup, aO as Tabs, aP as NumberField, aQ as parseNumber, aR as createStore, aS as reconcile, aT as RadioGroup, aU as Radio$1, aV as TextAreaField, aW as COMMON_SYMBOLS, aX as getRecentSymbols, aY as SYMBOL_CATEGORIES, aZ as rememberSymbol, a_ as delegateEvents, a$ as EMPTY_EDITOR_MATH_EXPRESSION, b0 as serializeLinearMath, b1 as parseLinearMath, b2 as Text, b3 as SurfaceButton, b4 as onMount, b5 as onCleanup, b6 as CheckIcon, b7 as use, b8 as PluginUiHost, b9 as OasisEditorEditor, ba as OasisBrandMark, bb as setPreciseFontPreference, bc as setWelcomeSeen, bd as enablePreciseFontMode, be as WORD_NS$6, bf as XMLSerializer, bg as DOMParser, bh as WORD14_NS, bi as mergeNestedExtensionMarkup, bj as resolveOpcRelationships, bk as parseOpcRelationships, bl as JSZip, bm as normalizeOpcPartPath, bn as OPC_CONTENT_TYPES_PATH, bo as getOpcRelationshipOwnerPath, bp as serializeOpcRelationships, bq as OPC_ROOT_RELATIONSHIPS_PATH, br as hashDocxPartBytes, bs as parseOpcContentTypes, bt as serializeOpcContentTypes, bu as mergeParagraphPropertiesXmlSource, bv as setEditorRunOoxmlSource, bw as mergeRunOoxmlSourceIntoGeneratedXml, bx as mergeTableCellPropertiesXmlSource, by as mergeTableRowPropertiesXmlSource, bz as mergeTablePropertiesXmlSource, bA as exportEditorDocumentToDocxBlob, bB as exportEditorDocumentToDocx, bC as pxToPt$1, bD as resolveFloatingObjectRect, bE as getTextBoxFloatingGeometry, bF as getPresetPathSegments, bG as buildListLabels, bH as lineDashPatternPt, bI as DEFAULT_FONT_SIZE_PX, bJ as resolveGradientAxis, bK as isDoubleUnderlineStyle, bL as isWavyUnderlineStyle, bM as underlineStyleLineWidthPx, bN as WAVY_UNDERLINE_WAVELENGTH_PX, bO as WAVY_UNDERLINE_AMPLITUDE_PX, bP as DOUBLE_UNDERLINE_OFFSET_PX, bQ as underlineStyleDashArray, bR as resolveEffectiveParagraphStyle, bS as EMPHASIS_GLYPH, bT as parseHexColorToRgb255, bU as rgb255ToHex, bV as getImageFloatingGeometry, bW as resolveEffectiveTextStyleForParagraph, bX as textStyleToFontSizePt, bY as mathDisplayText, bZ as TEXT_BASELINE_RATIO, b_ as resolveTextAlignmentBaselineOffset, b$ as resolveRenderedTextChar, c0 as resolveOpenTypeFeatureTags, c1 as isLowercaseSmallCapsChar, c2 as resolveDecorationLineY, c3 as DOUBLE_STRIKE_OFFSET_PX, c4 as resolveListLabel, c5 as getListLabelInset, c6 as getAlignedListLabelInset, c7 as getParagraphBorderInsets, c8 as buildSegmentTable, c9 as buildCanvasTableLayout, ca as resolveCanvasTableWidth, cb as resolveFloatingTableRect, cc as paragraphBetweenBorderMatches, cd as normalizeFamily, ce as ROBOTO_FONT_FILES, cf as loadFontAsset, cg as getRemotePdfFontFaces, ch as OFFICE_COMPAT_FONT_FAMILIES, ci as BinaryReader, cj as buildSfnt, ck as defaultFontDecoderRegistry, cl as SfntFontProgram, cm as zlibSync, cn as renumberImageCaptionsInDocument, co as collectPdfFontFamilies, cp as outlineFrom, cq as getPageHeaderZoneTop, cr as getPageColumnRects, cs as findFootnoteReference, ct as resolveImporterForFile, cu as roundTo, cv as getDocumentSectionsCanonical, cw as getDocumentParagraphsCanonical, cx as getDocumentParagraphs, cy as getImageCaptionText, cz as isImageCaptionParagraph, cA as updateImageCaptionParagraph, cB as createImageCaptionParagraph, cC as renumberImageCaptionParagraphs, cD as getCaptionSelectionOffset, cE as PX_PER_CM, cF as getDocumentPageSettings, cG as getTableCellContentWidthForParagraph, cH as layoutMetricsEpoch, cI as bumpLayoutMetricsEpoch, cJ as createCanvasLayoutSnapshotProvider, cK as on, cL as debounce, cM as unwrap, cN as perfTimer, cO as prepareDocumentFonts, cP as getRunTextBox, cQ as EMU_PER_PX, cR as createEditorDocument, cS as resolveResizedDimensions, cT as axisSignForDirection, cU as clamp$1, cV as MIN_RESIZE_SIZE_PX, cW as resolveTextBoxRenderHeight, cX as getToolbarStyleState, cY as VERTICAL_HIT_WEIGHT, cZ as getCachedCanvasImage, c_ as measureParagraphMinContentWidthPx, c$ as createSectionBoundaryParagraph, d0 as normalizePageSettings, d1 as DEFAULT_EDITOR_PAGE_SETTINGS, d2 as markStart, d3 as markEnd, d4 as getParagraphEntries, d5 as getParagraphById, d6 as createEditorFootnote, d7 as createFootnoteReferenceRun, d8 as renumberFootnotes, d9 as iterateFootnoteReferenceRuns, da as preciseFontModeVersion, db as isPreciseFontModeEnabled, dc as getRunFieldChar, dd as getRunFieldInstruction, de as getHeadingLevel, df as createEditorRun, dg as TWIPS_PER_INCH, dh as PX_PER_INCH, di as togglePreciseFontMode, dj as nextFontSizePt, dk as previousFontSizePt, dl as fontSizePtToPx, dm as resolveNamedTextStyle, dn as resolveNamedTableStyle, dp as resolveEffectiveTableStyle, dq as createDefaultToolbarPreset, dr as MenuRegistry, ds as createToolbarRegistry, dt as Editor, du as resolveCommandRef, dv as commandRefName, dw as createOasisEditorClient, dx as createEditorZoom, dy as startLongTaskObserver, dz as installGlobalReport, dA as applyStoredPreciseFontPreference, dB as getWelcomeSeen, dC as isLocalFontAccessSupported, dD as EDITOR_SCROLL_PADDING_PX, dE as Toolbar, dF as OasisEditorLoading, dG as I18nProvider, dH as createTranslator, dI as registerDomStatsSurface, dJ as createEditorLogger } from "./index-B7V7kbjr.js";
|
|
5
5
|
function projectHeaderFooterBlocksWithDependencies(blocks, deps, context = {}) {
|
|
6
6
|
const {
|
|
7
7
|
pageIndex,
|
|
@@ -26999,6 +26999,7 @@ function createEditorFocusController() {
|
|
|
26999
26999
|
function createEditorDialogs() {
|
|
27000
27000
|
const [newDocumentDialog, setNewDocumentDialog] = createSignal({ isOpen: false });
|
|
27001
27001
|
const [symbolDialog, setSymbolDialog] = createSignal({ isOpen: false });
|
|
27002
|
+
const [equationDialog, setEquationDialog] = createSignal({ isOpen: false });
|
|
27002
27003
|
const [linkDialog, setLinkDialog] = createSignal({
|
|
27003
27004
|
isOpen: false,
|
|
27004
27005
|
initialHref: ""
|
|
@@ -27132,6 +27133,8 @@ function createEditorDialogs() {
|
|
|
27132
27133
|
setNewDocumentDialog,
|
|
27133
27134
|
symbolDialog,
|
|
27134
27135
|
setSymbolDialog,
|
|
27136
|
+
equationDialog,
|
|
27137
|
+
setEquationDialog,
|
|
27135
27138
|
linkDialog,
|
|
27136
27139
|
setLinkDialog,
|
|
27137
27140
|
imageAltDialog,
|
|
@@ -28113,6 +28116,48 @@ function insertTextAtSelection(state, text, styleOverride) {
|
|
|
28113
28116
|
)
|
|
28114
28117
|
);
|
|
28115
28118
|
}
|
|
28119
|
+
function insertMathAtSelection(state, expression) {
|
|
28120
|
+
const collapsedState = isSelectionCollapsed(state.selection) ? state : deleteSelectionRange(state);
|
|
28121
|
+
const { paragraph, index, offset } = getFocusParagraph(collapsedState);
|
|
28122
|
+
const styles = getStyleAtOffset(paragraph, offset);
|
|
28123
|
+
const insertedRun = {
|
|
28124
|
+
id: `run:${Math.random().toString(36).slice(2, 9)}`,
|
|
28125
|
+
text: MATH_OBJECT_REPLACEMENT,
|
|
28126
|
+
styles,
|
|
28127
|
+
kind: "math",
|
|
28128
|
+
math: expression
|
|
28129
|
+
};
|
|
28130
|
+
const nextParagraph = insertRunsAtOffset(paragraph, offset, [insertedRun]);
|
|
28131
|
+
const paragraphs = getParagraphs(collapsedState).map(
|
|
28132
|
+
(candidate, candidateIndex) => candidateIndex === index ? nextParagraph : candidate
|
|
28133
|
+
);
|
|
28134
|
+
return cloneStateWithParagraphs(
|
|
28135
|
+
collapsedState,
|
|
28136
|
+
paragraphs,
|
|
28137
|
+
withSelection(
|
|
28138
|
+
paragraphOffsetToPosition(
|
|
28139
|
+
nextParagraph,
|
|
28140
|
+
offset + MATH_OBJECT_REPLACEMENT.length
|
|
28141
|
+
)
|
|
28142
|
+
)
|
|
28143
|
+
);
|
|
28144
|
+
}
|
|
28145
|
+
function updateMathRun(state, runId, expression) {
|
|
28146
|
+
let changed = false;
|
|
28147
|
+
const paragraphs = getParagraphs(state).map(
|
|
28148
|
+
(paragraph) => {
|
|
28149
|
+
let paragraphChanged = false;
|
|
28150
|
+
const runs = paragraph.runs.map((run) => {
|
|
28151
|
+
if (run.id !== runId || run.kind !== "math") return run;
|
|
28152
|
+
changed = true;
|
|
28153
|
+
paragraphChanged = true;
|
|
28154
|
+
return { ...run, math: expression, text: MATH_OBJECT_REPLACEMENT };
|
|
28155
|
+
});
|
|
28156
|
+
return paragraphChanged ? { ...paragraph, runs } : paragraph;
|
|
28157
|
+
}
|
|
28158
|
+
);
|
|
28159
|
+
return changed ? cloneStateWithParagraphs(state, paragraphs, state.selection) : state;
|
|
28160
|
+
}
|
|
28116
28161
|
function insertPlainTextAtSelection(state, text, styleOverride) {
|
|
28117
28162
|
if (text.length === 0) {
|
|
28118
28163
|
return state;
|
|
@@ -31757,14 +31802,14 @@ function DropCaret(props) {
|
|
|
31757
31802
|
})
|
|
31758
31803
|
});
|
|
31759
31804
|
}
|
|
31760
|
-
var _tmpl$$
|
|
31805
|
+
var _tmpl$$i = /* @__PURE__ */ template(`<div class=oasis-editor-table-resize-guide>`), _tmpl$2$7 = /* @__PURE__ */ template(`<div class=oasis-editor-table-resize-outline>`), _tmpl$3$3 = /* @__PURE__ */ template(`<img class=oasis-editor-image-ghost>`), _tmpl$4$2 = /* @__PURE__ */ template(`<div class=oasis-editor-table-ghost>`);
|
|
31761
31806
|
function EditorDragLayers(props) {
|
|
31762
31807
|
return [createComponent(Show, {
|
|
31763
31808
|
get when() {
|
|
31764
31809
|
return props.tableResize.resizing();
|
|
31765
31810
|
},
|
|
31766
31811
|
children: (resizing) => (() => {
|
|
31767
|
-
var _el$ = _tmpl$$
|
|
31812
|
+
var _el$ = _tmpl$$i();
|
|
31768
31813
|
createRenderEffect((_p$) => {
|
|
31769
31814
|
var _v$ = !!(resizing().type === "column"), _v$2 = !!(resizing().type === "row"), _v$3 = {
|
|
31770
31815
|
...resizing().type === "column" ? {
|
|
@@ -31795,7 +31840,7 @@ function EditorDragLayers(props) {
|
|
|
31795
31840
|
return props.tableCornerResize.previewRect();
|
|
31796
31841
|
},
|
|
31797
31842
|
children: (rect) => (() => {
|
|
31798
|
-
var _el$2 = _tmpl$2$
|
|
31843
|
+
var _el$2 = _tmpl$2$7();
|
|
31799
31844
|
createRenderEffect((_p$) => {
|
|
31800
31845
|
var _v$4 = `${rect().left}px`, _v$5 = `${rect().top}px`, _v$6 = `${rect().width}px`, _v$7 = `${rect().height}px`;
|
|
31801
31846
|
_v$4 !== _p$.e && setStyleProperty(_el$2, "left", _p$.e = _v$4);
|
|
@@ -32435,11 +32480,11 @@ function useFontDialogController(props) {
|
|
|
32435
32480
|
handleApply
|
|
32436
32481
|
};
|
|
32437
32482
|
}
|
|
32438
|
-
var _tmpl$$
|
|
32483
|
+
var _tmpl$$h = /* @__PURE__ */ template(`<div>`);
|
|
32439
32484
|
function FontPreview(props) {
|
|
32440
32485
|
const t = useI18n();
|
|
32441
32486
|
return (() => {
|
|
32442
|
-
var _el$ = _tmpl$$
|
|
32487
|
+
var _el$ = _tmpl$$h();
|
|
32443
32488
|
insert(_el$, () => t("dialog.font.previewText"));
|
|
32444
32489
|
createRenderEffect((_p$) => {
|
|
32445
32490
|
var _v$ = props.class ?? "oasis-editor-dialog-preview", _v$2 = props.testId, _v$3 = props.style;
|
|
@@ -32455,7 +32500,7 @@ function FontPreview(props) {
|
|
|
32455
32500
|
return _el$;
|
|
32456
32501
|
})();
|
|
32457
32502
|
}
|
|
32458
|
-
var _tmpl$$
|
|
32503
|
+
var _tmpl$$g = /* @__PURE__ */ template(`<div class="oasis-editor-font-dialog-panel oasis-editor-font-dialog-font-panel">`);
|
|
32459
32504
|
function FontTab(props) {
|
|
32460
32505
|
const t = useI18n();
|
|
32461
32506
|
const {
|
|
@@ -32545,7 +32590,7 @@ function FontTab(props) {
|
|
|
32545
32590
|
onChange: (checked) => ctrl.updateFontTab("hidden", checked)
|
|
32546
32591
|
}];
|
|
32547
32592
|
return (() => {
|
|
32548
|
-
var _el$ = _tmpl$$
|
|
32593
|
+
var _el$ = _tmpl$$g();
|
|
32549
32594
|
insert(_el$, createComponent(Grid, {
|
|
32550
32595
|
container: true,
|
|
32551
32596
|
spacing: 1.5,
|
|
@@ -32879,14 +32924,14 @@ function FontTab(props) {
|
|
|
32879
32924
|
return _el$;
|
|
32880
32925
|
})();
|
|
32881
32926
|
}
|
|
32882
|
-
var _tmpl$$
|
|
32927
|
+
var _tmpl$$f = /* @__PURE__ */ template(`<div class=oasis-editor-font-dialog-kerning-line>`), _tmpl$2$6 = /* @__PURE__ */ template(`<div class="oasis-editor-font-dialog-panel oasis-editor-font-dialog-advanced-panel">`);
|
|
32883
32928
|
function AdvancedFontTab(props) {
|
|
32884
32929
|
const t = useI18n();
|
|
32885
32930
|
const {
|
|
32886
32931
|
ctrl
|
|
32887
32932
|
} = props;
|
|
32888
32933
|
return (() => {
|
|
32889
|
-
var _el$ = _tmpl$2$
|
|
32934
|
+
var _el$ = _tmpl$2$6();
|
|
32890
32935
|
insert(_el$, createComponent(FieldGroup, {
|
|
32891
32936
|
"class": "oasis-editor-font-dialog-fieldset",
|
|
32892
32937
|
get legend() {
|
|
@@ -33037,7 +33082,7 @@ function AdvancedFontTab(props) {
|
|
|
33037
33082
|
}), createComponent(Grid, {
|
|
33038
33083
|
size: 12,
|
|
33039
33084
|
get children() {
|
|
33040
|
-
var _el$2 = _tmpl$$
|
|
33085
|
+
var _el$2 = _tmpl$$f();
|
|
33041
33086
|
insert(_el$2, createComponent(Checkbox, {
|
|
33042
33087
|
"class": "oasis-editor-font-dialog-kerning-toggle",
|
|
33043
33088
|
get label() {
|
|
@@ -33317,7 +33362,7 @@ function FontDialog(props) {
|
|
|
33317
33362
|
}
|
|
33318
33363
|
});
|
|
33319
33364
|
}
|
|
33320
|
-
var _tmpl$$
|
|
33365
|
+
var _tmpl$$e = /* @__PURE__ */ template(`<div class=oasis-editor-tab-stops><div class=oasis-editor-tab-stops-actions>`), _tmpl$2$5 = /* @__PURE__ */ template(`<div class=oasis-editor-dialog-footer-split><div class=oasis-editor-dialog-footer-start></div><div class=oasis-editor-dialog-footer-end>`);
|
|
33321
33366
|
function toDraft(stop) {
|
|
33322
33367
|
return {
|
|
33323
33368
|
position: stop.position,
|
|
@@ -33401,7 +33446,7 @@ function TabStopsDialog(props) {
|
|
|
33401
33446
|
},
|
|
33402
33447
|
get footer() {
|
|
33403
33448
|
return (() => {
|
|
33404
|
-
var _el$3 = _tmpl$2$
|
|
33449
|
+
var _el$3 = _tmpl$2$5(), _el$4 = _el$3.firstChild, _el$5 = _el$4.nextSibling;
|
|
33405
33450
|
insert(_el$4, createComponent(Button, {
|
|
33406
33451
|
variant: "secondary",
|
|
33407
33452
|
onClick: () => {
|
|
@@ -33434,7 +33479,7 @@ function TabStopsDialog(props) {
|
|
|
33434
33479
|
})();
|
|
33435
33480
|
},
|
|
33436
33481
|
get children() {
|
|
33437
|
-
var _el$ = _tmpl$$
|
|
33482
|
+
var _el$ = _tmpl$$e(), _el$2 = _el$.firstChild;
|
|
33438
33483
|
insert(_el$, createComponent(For, {
|
|
33439
33484
|
get each() {
|
|
33440
33485
|
return stops();
|
|
@@ -33788,7 +33833,7 @@ function useParagraphDialogController(props) {
|
|
|
33788
33833
|
handleSetDefault
|
|
33789
33834
|
};
|
|
33790
33835
|
}
|
|
33791
|
-
var _tmpl$$
|
|
33836
|
+
var _tmpl$$d = /* @__PURE__ */ template(`<div class=oasis-editor-paragraph-dialog-panel>`), _tmpl$2$4 = /* @__PURE__ */ template(`<div class=oasis-editor-dialog-preview data-testid=editor-paragraph-dialog-preview>`), _tmpl$3$2 = /* @__PURE__ */ template(`<div class=oasis-editor-dialog-footer-split><div class=oasis-editor-dialog-footer-start></div><div class=oasis-editor-dialog-footer-end>`);
|
|
33792
33837
|
function ParagraphDialog(props) {
|
|
33793
33838
|
const t = useI18n();
|
|
33794
33839
|
const [tabsDialogOpen, setTabsDialogOpen] = createSignal(false);
|
|
@@ -33895,7 +33940,7 @@ function ParagraphDialog(props) {
|
|
|
33895
33940
|
}
|
|
33896
33941
|
});
|
|
33897
33942
|
const indentsAndSpacingPanel = (() => {
|
|
33898
|
-
var _el$ = _tmpl$$
|
|
33943
|
+
var _el$ = _tmpl$$d();
|
|
33899
33944
|
insert(_el$, createComponent(FieldGroup, {
|
|
33900
33945
|
"class": "oasis-editor-dialog-fieldset",
|
|
33901
33946
|
get legend() {
|
|
@@ -34365,7 +34410,7 @@ function ParagraphDialog(props) {
|
|
|
34365
34410
|
return _el$;
|
|
34366
34411
|
})();
|
|
34367
34412
|
const lineAndPageBreaksPanel = (() => {
|
|
34368
|
-
var _el$2 = _tmpl$$
|
|
34413
|
+
var _el$2 = _tmpl$$d();
|
|
34369
34414
|
insert(_el$2, createComponent(FieldGroup, {
|
|
34370
34415
|
"class": "oasis-editor-dialog-fieldset",
|
|
34371
34416
|
get legend() {
|
|
@@ -34495,7 +34540,7 @@ function ParagraphDialog(props) {
|
|
|
34495
34540
|
return t("paragraph.preview");
|
|
34496
34541
|
},
|
|
34497
34542
|
get children() {
|
|
34498
|
-
var _el$3 = _tmpl$2$
|
|
34543
|
+
var _el$3 = _tmpl$2$4();
|
|
34499
34544
|
insert(_el$3, () => t("paragraph.previewText"));
|
|
34500
34545
|
createRenderEffect((_$p) => style(_el$3, previewStyle(), _$p));
|
|
34501
34546
|
return _el$3;
|
|
@@ -34718,13 +34763,13 @@ function NumField(label, value, setter, testId, disabled = false, allowNegative
|
|
|
34718
34763
|
"data-testid": testId
|
|
34719
34764
|
});
|
|
34720
34765
|
}
|
|
34721
|
-
var _tmpl$$
|
|
34766
|
+
var _tmpl$$c = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-panel>`);
|
|
34722
34767
|
function TableTabPanel(props) {
|
|
34723
34768
|
const t = useI18n();
|
|
34724
34769
|
const form = () => props.ctrl.form;
|
|
34725
34770
|
const set = props.ctrl.set;
|
|
34726
34771
|
return (() => {
|
|
34727
|
-
var _el$ = _tmpl$$
|
|
34772
|
+
var _el$ = _tmpl$$c();
|
|
34728
34773
|
insert(_el$, createComponent(FieldGroup, {
|
|
34729
34774
|
"class": "oasis-editor-font-dialog-fieldset",
|
|
34730
34775
|
get legend() {
|
|
@@ -35030,13 +35075,13 @@ function TableTabPanel(props) {
|
|
|
35030
35075
|
return _el$;
|
|
35031
35076
|
})();
|
|
35032
35077
|
}
|
|
35033
|
-
var _tmpl$$
|
|
35078
|
+
var _tmpl$$b = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-panel>`);
|
|
35034
35079
|
function RowTabPanel(props) {
|
|
35035
35080
|
const t = useI18n();
|
|
35036
35081
|
const form = () => props.ctrl.form;
|
|
35037
35082
|
const set = props.ctrl.set;
|
|
35038
35083
|
return (() => {
|
|
35039
|
-
var _el$ = _tmpl$$
|
|
35084
|
+
var _el$ = _tmpl$$b();
|
|
35040
35085
|
insert(_el$, createComponent(Grid, {
|
|
35041
35086
|
container: true,
|
|
35042
35087
|
spacing: 1.5,
|
|
@@ -35119,13 +35164,13 @@ function RowTabPanel(props) {
|
|
|
35119
35164
|
return _el$;
|
|
35120
35165
|
})();
|
|
35121
35166
|
}
|
|
35122
|
-
var _tmpl$$
|
|
35167
|
+
var _tmpl$$a = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-panel>`);
|
|
35123
35168
|
function ColumnTabPanel(props) {
|
|
35124
35169
|
const t = useI18n();
|
|
35125
35170
|
const form = () => props.ctrl.form;
|
|
35126
35171
|
const set = props.ctrl.set;
|
|
35127
35172
|
return (() => {
|
|
35128
|
-
var _el$ = _tmpl$$
|
|
35173
|
+
var _el$ = _tmpl$$a();
|
|
35129
35174
|
insert(_el$, createComponent(Grid, {
|
|
35130
35175
|
container: true,
|
|
35131
35176
|
spacing: 1.5,
|
|
@@ -35144,7 +35189,7 @@ function ColumnTabPanel(props) {
|
|
|
35144
35189
|
return _el$;
|
|
35145
35190
|
})();
|
|
35146
35191
|
}
|
|
35147
|
-
var _tmpl$$
|
|
35192
|
+
var _tmpl$$9 = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-cell-preview data-testid=editor-table-properties-cell-preview>`), _tmpl$2$3 = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-panel>`);
|
|
35148
35193
|
function CellTabPanel(props) {
|
|
35149
35194
|
const t = useI18n();
|
|
35150
35195
|
const form = () => props.ctrl.form;
|
|
@@ -35162,7 +35207,7 @@ function CellTabPanel(props) {
|
|
|
35162
35207
|
});
|
|
35163
35208
|
const borderDisabled = () => form().borderStyle === "none";
|
|
35164
35209
|
return (() => {
|
|
35165
|
-
var _el$ = _tmpl$2$
|
|
35210
|
+
var _el$ = _tmpl$2$3();
|
|
35166
35211
|
insert(_el$, createComponent(Grid, {
|
|
35167
35212
|
container: true,
|
|
35168
35213
|
spacing: 1.5,
|
|
@@ -35549,7 +35594,7 @@ function CellTabPanel(props) {
|
|
|
35549
35594
|
})];
|
|
35550
35595
|
}
|
|
35551
35596
|
}), (() => {
|
|
35552
|
-
var _el$2 = _tmpl$$
|
|
35597
|
+
var _el$2 = _tmpl$$9();
|
|
35553
35598
|
createRenderEffect((_$p) => style(_el$2, borderPreview(), _$p));
|
|
35554
35599
|
return _el$2;
|
|
35555
35600
|
})()];
|
|
@@ -35558,13 +35603,13 @@ function CellTabPanel(props) {
|
|
|
35558
35603
|
return _el$;
|
|
35559
35604
|
})();
|
|
35560
35605
|
}
|
|
35561
|
-
var _tmpl$$
|
|
35606
|
+
var _tmpl$$8 = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-panel>`);
|
|
35562
35607
|
function AltTextTabPanel(props) {
|
|
35563
35608
|
const t = useI18n();
|
|
35564
35609
|
const form = () => props.ctrl.form;
|
|
35565
35610
|
const set = props.ctrl.set;
|
|
35566
35611
|
return (() => {
|
|
35567
|
-
var _el$ = _tmpl$$
|
|
35612
|
+
var _el$ = _tmpl$$8();
|
|
35568
35613
|
insert(_el$, createComponent(TextField, {
|
|
35569
35614
|
get label() {
|
|
35570
35615
|
return t("table.altTitle");
|
|
@@ -35676,7 +35721,7 @@ function TablePropertiesDialog(props) {
|
|
|
35676
35721
|
}
|
|
35677
35722
|
});
|
|
35678
35723
|
}
|
|
35679
|
-
var _tmpl$$
|
|
35724
|
+
var _tmpl$$7 = /* @__PURE__ */ template(`<p data-testid=editor-new-document-message>`);
|
|
35680
35725
|
function NewDocumentConfirmationDialog(props) {
|
|
35681
35726
|
const t = useI18n();
|
|
35682
35727
|
return createComponent(Dialog, {
|
|
@@ -35710,13 +35755,13 @@ function NewDocumentConfirmationDialog(props) {
|
|
|
35710
35755
|
});
|
|
35711
35756
|
},
|
|
35712
35757
|
get children() {
|
|
35713
|
-
var _el$ = _tmpl$$
|
|
35758
|
+
var _el$ = _tmpl$$7();
|
|
35714
35759
|
insert(_el$, () => t("dialog.newDocument.message"));
|
|
35715
35760
|
return _el$;
|
|
35716
35761
|
}
|
|
35717
35762
|
});
|
|
35718
35763
|
}
|
|
35719
|
-
var _tmpl$$
|
|
35764
|
+
var _tmpl$$6 = /* @__PURE__ */ template(`<div class=oasis-editor-symbol-dialog-controls><label class=oasis-editor-symbol-dialog-field><span></span><select data-testid=editor-symbol-dialog-font></select></label><label class=oasis-editor-symbol-dialog-field><span></span><select data-testid=editor-symbol-dialog-category><option value=all>`), _tmpl$2$2 = /* @__PURE__ */ template(`<div class=oasis-editor-symbol-dialog-recent><span></span><div class=oasis-editor-symbol-dialog-recent-list>`), _tmpl$3$1 = /* @__PURE__ */ template(`<div class=oasis-editor-symbol-dialog-layout><div class=oasis-editor-symbol-dialog-grid role=grid></div><aside class=oasis-editor-symbol-dialog-preview><span class=oasis-editor-symbol-dialog-preview-label></span><span class=oasis-editor-symbol-dialog-preview-character data-testid=editor-symbol-dialog-preview></span><label class=oasis-editor-symbol-dialog-field><span></span><input data-testid=editor-symbol-dialog-code></label><p class=oasis-editor-symbol-dialog-help>`), _tmpl$4$1 = /* @__PURE__ */ template(`<option>`), _tmpl$5$1 = /* @__PURE__ */ template(`<button type=button class=oasis-editor-symbol-dialog-tile>`), _tmpl$6$1 = /* @__PURE__ */ template(`<button type=button class=oasis-editor-symbol-dialog-tile role=gridcell>`);
|
|
35720
35765
|
const FONT_OPTIONS = ["Segoe UI Symbol", "Arial Unicode MS", "Cambria Math", "Times New Roman"];
|
|
35721
35766
|
function SymbolDialog(props) {
|
|
35722
35767
|
const t = useI18n();
|
|
@@ -35792,7 +35837,7 @@ function SymbolDialog(props) {
|
|
|
35792
35837
|
},
|
|
35793
35838
|
get children() {
|
|
35794
35839
|
return [(() => {
|
|
35795
|
-
var _el$ = _tmpl$$
|
|
35840
|
+
var _el$ = _tmpl$$6(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.nextSibling, _el$5 = _el$2.nextSibling, _el$6 = _el$5.firstChild, _el$7 = _el$6.nextSibling, _el$8 = _el$7.firstChild;
|
|
35796
35841
|
insert(_el$3, () => t("dialog.symbol.font"));
|
|
35797
35842
|
_el$4.addEventListener("change", (event) => {
|
|
35798
35843
|
setFont(event.currentTarget.value);
|
|
@@ -35830,7 +35875,7 @@ function SymbolDialog(props) {
|
|
|
35830
35875
|
return recentSymbols().length > 0;
|
|
35831
35876
|
},
|
|
35832
35877
|
get children() {
|
|
35833
|
-
var _el$1 = _tmpl$2$
|
|
35878
|
+
var _el$1 = _tmpl$2$2(), _el$10 = _el$1.firstChild, _el$11 = _el$10.nextSibling;
|
|
35834
35879
|
insert(_el$10, () => t("dialog.symbol.recent"));
|
|
35835
35880
|
insert(_el$11, createComponent(For, {
|
|
35836
35881
|
get each() {
|
|
@@ -35902,6 +35947,75 @@ function SymbolDialog(props) {
|
|
|
35902
35947
|
});
|
|
35903
35948
|
}
|
|
35904
35949
|
delegateEvents(["input", "click", "dblclick"]);
|
|
35950
|
+
var _tmpl$$5 = /* @__PURE__ */ template(`<div class=oasis-editor-equation-editor><div class=oasis-editor-equation-palette></div><label class=oasis-editor-equation-linear><span></span><textarea data-testid=editor-equation-linear></textarea></label><div class=oasis-editor-equation-preview aria-live=polite data-testid=editor-equation-preview>`), _tmpl$2$1 = /* @__PURE__ */ template(`<button type=button data-testid=editor-equation-template>`);
|
|
35951
|
+
const TEMPLATES = [["\\frac{□}{□}", "\\frac{a}{b}"], ["\\sqrt{□}", "\\sqrt{x}"], ["x^□", "x^{2}"], ["x_□", "x_{i}"], ["∑", "\\sum_{i=1}^{n} i"], ["∫", "∫ f(x) dx"], ["[ ]", "(a+b)"], ["[a b]", "\\matrix{a & b \\ c & d}"]];
|
|
35952
|
+
function EquationDialog(props) {
|
|
35953
|
+
const t = useI18n();
|
|
35954
|
+
const [linear, setLinear] = createSignal("");
|
|
35955
|
+
const [expression, setExpression] = createSignal(EMPTY_EDITOR_MATH_EXPRESSION);
|
|
35956
|
+
createEffect(() => {
|
|
35957
|
+
if (!props.isOpen) return;
|
|
35958
|
+
const initial = props.initial ?? EMPTY_EDITOR_MATH_EXPRESSION;
|
|
35959
|
+
setExpression(initial);
|
|
35960
|
+
setLinear(serializeLinearMath(initial));
|
|
35961
|
+
});
|
|
35962
|
+
const updateLinear = (value) => {
|
|
35963
|
+
setLinear(value);
|
|
35964
|
+
setExpression(parseLinearMath(value));
|
|
35965
|
+
};
|
|
35966
|
+
return createComponent(Dialog, {
|
|
35967
|
+
get isOpen() {
|
|
35968
|
+
return props.isOpen;
|
|
35969
|
+
},
|
|
35970
|
+
get title() {
|
|
35971
|
+
return t("dialog.equation.title");
|
|
35972
|
+
},
|
|
35973
|
+
get onClose() {
|
|
35974
|
+
return props.onClose;
|
|
35975
|
+
},
|
|
35976
|
+
size: "lg",
|
|
35977
|
+
closeOnOverlayClick: false,
|
|
35978
|
+
"class": "oasis-editor-equation-dialog",
|
|
35979
|
+
get footer() {
|
|
35980
|
+
return [createComponent(Button, {
|
|
35981
|
+
variant: "secondary",
|
|
35982
|
+
get onClick() {
|
|
35983
|
+
return props.onClose;
|
|
35984
|
+
},
|
|
35985
|
+
get children() {
|
|
35986
|
+
return t("generic.cancel");
|
|
35987
|
+
}
|
|
35988
|
+
}), createComponent(Button, {
|
|
35989
|
+
variant: "primary",
|
|
35990
|
+
onClick: () => props.onApply(expression()),
|
|
35991
|
+
"data-testid": "editor-equation-apply",
|
|
35992
|
+
get children() {
|
|
35993
|
+
return t("dialog.equation.insert");
|
|
35994
|
+
}
|
|
35995
|
+
})];
|
|
35996
|
+
},
|
|
35997
|
+
get children() {
|
|
35998
|
+
var _el$ = _tmpl$$5(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.firstChild, _el$5 = _el$4.nextSibling, _el$6 = _el$3.nextSibling;
|
|
35999
|
+
insert(_el$2, createComponent(For, {
|
|
36000
|
+
each: TEMPLATES,
|
|
36001
|
+
children: ([label, value]) => (() => {
|
|
36002
|
+
var _el$7 = _tmpl$2$1();
|
|
36003
|
+
_el$7.$$click = () => updateLinear(value);
|
|
36004
|
+
insert(_el$7, label);
|
|
36005
|
+
return _el$7;
|
|
36006
|
+
})()
|
|
36007
|
+
}));
|
|
36008
|
+
insert(_el$4, () => t("dialog.equation.linear"));
|
|
36009
|
+
_el$5.$$input = (event) => updateLinear(event.currentTarget.value);
|
|
36010
|
+
setAttribute(_el$5, "spellcheck", false);
|
|
36011
|
+
insert(_el$6, () => serializeLinearMath(expression()) || t("dialog.equation.empty"));
|
|
36012
|
+
createRenderEffect(() => setAttribute(_el$2, "aria-label", t("dialog.equation.structures")));
|
|
36013
|
+
createRenderEffect(() => _el$5.value = linear());
|
|
36014
|
+
return _el$;
|
|
36015
|
+
}
|
|
36016
|
+
});
|
|
36017
|
+
}
|
|
36018
|
+
delegateEvents(["input", "click"]);
|
|
35905
36019
|
var _tmpl$$4 = /* @__PURE__ */ template(`<div class=oasis-editor-find-replace-dialog><div class=oasis-editor-fr-header></div><div class=oasis-editor-fr-body><div class=oasis-editor-fr-input-group><div class=oasis-editor-fr-input-wrapper></div></div><div class=oasis-editor-fr-input-group>`);
|
|
35906
36020
|
function FindReplaceDialog(props) {
|
|
35907
36021
|
const t = useI18n();
|
|
@@ -36220,7 +36334,9 @@ function EditorDialogsLayer(props) {
|
|
|
36220
36334
|
newDocumentDialog,
|
|
36221
36335
|
setNewDocumentDialog,
|
|
36222
36336
|
symbolDialog,
|
|
36223
|
-
setSymbolDialog
|
|
36337
|
+
setSymbolDialog,
|
|
36338
|
+
equationDialog,
|
|
36339
|
+
setEquationDialog
|
|
36224
36340
|
} = props.dialogs;
|
|
36225
36341
|
return [createComponent(NewDocumentConfirmationDialog, {
|
|
36226
36342
|
get isOpen() {
|
|
@@ -36254,6 +36370,25 @@ function EditorDialogsLayer(props) {
|
|
|
36254
36370
|
});
|
|
36255
36371
|
props.insertSymbol(symbol, fontFamily);
|
|
36256
36372
|
}
|
|
36373
|
+
}), createComponent(EquationDialog, {
|
|
36374
|
+
get isOpen() {
|
|
36375
|
+
return equationDialog().isOpen;
|
|
36376
|
+
},
|
|
36377
|
+
get initial() {
|
|
36378
|
+
return equationDialog().initial;
|
|
36379
|
+
},
|
|
36380
|
+
onClose: () => {
|
|
36381
|
+
setEquationDialog({
|
|
36382
|
+
isOpen: false
|
|
36383
|
+
});
|
|
36384
|
+
props.focusInput();
|
|
36385
|
+
},
|
|
36386
|
+
onApply: (expression) => {
|
|
36387
|
+
setEquationDialog({
|
|
36388
|
+
isOpen: false
|
|
36389
|
+
});
|
|
36390
|
+
props.applyEquation(expression, equationDialog().targetRunId);
|
|
36391
|
+
}
|
|
36257
36392
|
}), createComponent(LinkDialog, {
|
|
36258
36393
|
get isOpen() {
|
|
36259
36394
|
return linkDialog().isOpen;
|
|
@@ -41350,7 +41485,7 @@ function emitFragmentGlyphs(chunkCtx, chars, originX, styles, line, fragment, pa
|
|
|
41350
41485
|
}
|
|
41351
41486
|
}
|
|
41352
41487
|
async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, document2, originX, originY, fontRegistry, drawers) {
|
|
41353
|
-
var _a, _b, _c;
|
|
41488
|
+
var _a, _b, _c, _d;
|
|
41354
41489
|
if (fragment.image) {
|
|
41355
41490
|
if (fragment.image.floating) return;
|
|
41356
41491
|
const slot = line.slots.find((c) => c.offset === fragment.startOffset) ?? line.slots.find((c) => c.offset >= fragment.startOffset);
|
|
@@ -41383,9 +41518,32 @@ async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, do
|
|
|
41383
41518
|
);
|
|
41384
41519
|
return;
|
|
41385
41520
|
}
|
|
41521
|
+
if (fragment.math) {
|
|
41522
|
+
const slot = line.slots.find((c) => c.offset === fragment.startOffset) ?? line.slots.find((c) => c.offset >= fragment.startOffset);
|
|
41523
|
+
if (!slot) return;
|
|
41524
|
+
const styles2 = resolveEffectiveTextStyleForParagraph(
|
|
41525
|
+
fragment.styles,
|
|
41526
|
+
(_a = paragraph.style) == null ? void 0 : _a.styleId,
|
|
41527
|
+
document2.styles
|
|
41528
|
+
);
|
|
41529
|
+
const fontFace2 = fontRegistry.resolveFontFace({
|
|
41530
|
+
fontFamily: "Cambria Math",
|
|
41531
|
+
bold: false,
|
|
41532
|
+
italic: false
|
|
41533
|
+
});
|
|
41534
|
+
writer.drawText(pageIndex, {
|
|
41535
|
+
x: pxToPt$1(originX + slot.left),
|
|
41536
|
+
y: pxToPt$1(originY + line.top + line.height * TEXT_BASELINE_RATIO),
|
|
41537
|
+
text: mathDisplayText(fragment.math),
|
|
41538
|
+
fontSize: textStyleToFontSizePt(styles2),
|
|
41539
|
+
color: styles2.color ?? "#000000",
|
|
41540
|
+
fontResourceName: fontFace2.writerResourceName
|
|
41541
|
+
});
|
|
41542
|
+
return;
|
|
41543
|
+
}
|
|
41386
41544
|
const styles = resolveEffectiveTextStyleForParagraph(
|
|
41387
41545
|
fragment.styles,
|
|
41388
|
-
(
|
|
41546
|
+
(_b = paragraph.style) == null ? void 0 : _b.styleId,
|
|
41389
41547
|
document2.styles
|
|
41390
41548
|
);
|
|
41391
41549
|
if (styles.hidden) return;
|
|
@@ -41471,7 +41629,7 @@ async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, do
|
|
|
41471
41629
|
horizontalScale: styles.characterScale ?? 100,
|
|
41472
41630
|
fontFeatures
|
|
41473
41631
|
};
|
|
41474
|
-
const mainColor = ((
|
|
41632
|
+
const mainColor = ((_c = styles.textFill) == null ? void 0 : _c.type) === "solid" ? styles.textFill.color : ((_d = styles.textFill) == null ? void 0 : _d.type) === "gradient" && styles.textFill.stops[0] ? styles.textFill.stops[0].color : styles.color ?? "#000000";
|
|
41475
41633
|
const gradientShadingName = resolveGradientShadingName(
|
|
41476
41634
|
writer,
|
|
41477
41635
|
pageIndex,
|
|
@@ -51924,6 +52082,27 @@ function createEditorSurfaceEventsImpl(deps) {
|
|
|
51924
52082
|
};
|
|
51925
52083
|
const handleDoubleClickDown = (state, hit, paragraph) => {
|
|
51926
52084
|
dragAnchor = null;
|
|
52085
|
+
let offset = 0;
|
|
52086
|
+
const mathRun = paragraph.runs.find((run) => {
|
|
52087
|
+
const hitRun = run.kind === "math" && hit.paragraphOffset >= offset && hit.paragraphOffset <= offset + run.text.length;
|
|
52088
|
+
offset += run.text.length;
|
|
52089
|
+
return hitRun;
|
|
52090
|
+
});
|
|
52091
|
+
if ((mathRun == null ? void 0 : mathRun.kind) === "math") {
|
|
52092
|
+
const position = paragraphOffsetToPosition(
|
|
52093
|
+
paragraph,
|
|
52094
|
+
hit.paragraphOffset
|
|
52095
|
+
);
|
|
52096
|
+
applyWithZone(
|
|
52097
|
+
state,
|
|
52098
|
+
hit.zone,
|
|
52099
|
+
setSelection(state, { anchor: position, focus: position }),
|
|
52100
|
+
position
|
|
52101
|
+
);
|
|
52102
|
+
stopDragging();
|
|
52103
|
+
deps.openEquationDialog(mathRun.math, mathRun.id);
|
|
52104
|
+
return;
|
|
52105
|
+
}
|
|
51927
52106
|
const word = resolveWordSelection(
|
|
51928
52107
|
getParagraphText(paragraph),
|
|
51929
52108
|
hit.paragraphOffset
|
|
@@ -52788,7 +52967,8 @@ function useEditorInteractionWiring(ctx) {
|
|
|
52788
52967
|
textDrag: {
|
|
52789
52968
|
tryStartTextDrag: textDrag.tryStartTextDrag
|
|
52790
52969
|
},
|
|
52791
|
-
logger: ctx.logger
|
|
52970
|
+
logger: ctx.logger,
|
|
52971
|
+
openEquationDialog: ctx.openEquationDialog
|
|
52792
52972
|
});
|
|
52793
52973
|
const textInput = createEditorTextInput({
|
|
52794
52974
|
state,
|
|
@@ -52965,7 +53145,8 @@ function createEditorInteractionRuntimeImpl(deps) {
|
|
|
52965
53145
|
styleController,
|
|
52966
53146
|
getForcePlainTextPaste,
|
|
52967
53147
|
setForcePlainTextPaste,
|
|
52968
|
-
insertImageFromFile
|
|
53148
|
+
insertImageFromFile,
|
|
53149
|
+
openEquationDialog: deps.openEquationDialog
|
|
52969
53150
|
});
|
|
52970
53151
|
const onEditorMouseDown = (event) => {
|
|
52971
53152
|
if (event.button !== 0) {
|
|
@@ -54846,6 +55027,15 @@ function buildCoreFormattingCommands({
|
|
|
54846
55027
|
typeof payload.fontFamily === "string" ? payload.fontFamily : null
|
|
54847
55028
|
);
|
|
54848
55029
|
}),
|
|
55030
|
+
insertEquation: actionCommand("insertEquation", (p) => {
|
|
55031
|
+
formatting.insertEquation(
|
|
55032
|
+
p
|
|
55033
|
+
);
|
|
55034
|
+
}),
|
|
55035
|
+
updateEquation: actionCommand("updateEquation", (p) => {
|
|
55036
|
+
const payload = p;
|
|
55037
|
+
formatting.updateEquation(payload.runId, payload.expression);
|
|
55038
|
+
}),
|
|
54849
55039
|
pastePlainText: command("pastePlainText", formatting.pastePlainText),
|
|
54850
55040
|
bold: command("bold", formatting.bold, () => ({
|
|
54851
55041
|
isActive: Boolean(s().bold)
|
|
@@ -55073,6 +55263,10 @@ function buildDocumentAndBrowserCommands({
|
|
|
55073
55263
|
"openSymbolDialog",
|
|
55074
55264
|
() => document2.openSymbolDialog()
|
|
55075
55265
|
),
|
|
55266
|
+
openEquationDialog: actionCommand(
|
|
55267
|
+
"openEquationDialog",
|
|
55268
|
+
() => document2.openEquationDialog()
|
|
55269
|
+
),
|
|
55076
55270
|
unlink: actionCommand(
|
|
55077
55271
|
"unlink",
|
|
55078
55272
|
() => link.remove(),
|
|
@@ -55548,6 +55742,7 @@ function buildEssentialsGate(options) {
|
|
|
55548
55742
|
return {
|
|
55549
55743
|
isCommandEnabled: (commandName) => {
|
|
55550
55744
|
if (commandName === "openSymbolDialog") return true;
|
|
55745
|
+
if (commandName === "openEquationDialog") return true;
|
|
55551
55746
|
return !options.isReadOnly() && (commandName !== "insertFootnote" || options.commandsController.canInsertFootnoteCommand());
|
|
55552
55747
|
}
|
|
55553
55748
|
};
|
|
@@ -55809,6 +56004,23 @@ function buildEssentialsFormatting(options) {
|
|
|
55809
56004
|
options.focusInput();
|
|
55810
56005
|
return true;
|
|
55811
56006
|
},
|
|
56007
|
+
insertEquation: (expression) => {
|
|
56008
|
+
options.applyTransactionalState(
|
|
56009
|
+
(current) => options.tableOps.applyTableAwareParagraphEdit(
|
|
56010
|
+
current,
|
|
56011
|
+
(temp) => insertMathAtSelection(temp, expression)
|
|
56012
|
+
)
|
|
56013
|
+
);
|
|
56014
|
+
options.focusInput();
|
|
56015
|
+
return true;
|
|
56016
|
+
},
|
|
56017
|
+
updateEquation: (runId, expression) => {
|
|
56018
|
+
options.applyTransactionalState(
|
|
56019
|
+
(current) => updateMathRun(current, runId, expression)
|
|
56020
|
+
);
|
|
56021
|
+
options.focusInput();
|
|
56022
|
+
return true;
|
|
56023
|
+
},
|
|
55812
56024
|
insertTableOfContents: () => {
|
|
55813
56025
|
options.applyTransactionalState(
|
|
55814
56026
|
(current) => insertTableOfContents(current, buildTocPageResolver(current))
|
|
@@ -55993,6 +56205,7 @@ function buildEssentialsDocument(options) {
|
|
|
55993
56205
|
},
|
|
55994
56206
|
newDocument: () => options.newDocument(),
|
|
55995
56207
|
openSymbolDialog: () => options.openSymbolDialog(),
|
|
56208
|
+
openEquationDialog: () => options.openEquationDialog(),
|
|
55996
56209
|
exportDocx: () => void options.docIO.handleExportDocx(),
|
|
55997
56210
|
exportPdf: () => void options.docIO.handleExportPdf(),
|
|
55998
56211
|
importDocument: () => {
|
|
@@ -57036,7 +57249,28 @@ function createEditorCommandRuntimeImpl(deps) {
|
|
|
57036
57249
|
resetDocument: () => runtimeClient.resetDocument(),
|
|
57037
57250
|
requestConfirmation: () => deps.setNewDocumentDialog({ isOpen: true })
|
|
57038
57251
|
}),
|
|
57039
|
-
openSymbolDialog: () => deps.setSymbolDialog({ isOpen: true })
|
|
57252
|
+
openSymbolDialog: () => deps.setSymbolDialog({ isOpen: true }),
|
|
57253
|
+
openEquationDialog: () => {
|
|
57254
|
+
const focus = deps.state.selection.focus;
|
|
57255
|
+
const paragraph = getDocumentParagraphs(deps.state.document).find(
|
|
57256
|
+
(block) => block.id === focus.paragraphId
|
|
57257
|
+
);
|
|
57258
|
+
if ((paragraph == null ? void 0 : paragraph.type) === "paragraph") {
|
|
57259
|
+
let offset = 0;
|
|
57260
|
+
for (const run of paragraph.runs) {
|
|
57261
|
+
if (run.kind === "math" && focus.offset >= offset && focus.offset <= offset + run.text.length) {
|
|
57262
|
+
deps.setEquationDialog({
|
|
57263
|
+
isOpen: true,
|
|
57264
|
+
initial: run.math,
|
|
57265
|
+
targetRunId: run.id
|
|
57266
|
+
});
|
|
57267
|
+
return;
|
|
57268
|
+
}
|
|
57269
|
+
offset += run.text.length;
|
|
57270
|
+
}
|
|
57271
|
+
}
|
|
57272
|
+
deps.setEquationDialog({ isOpen: true });
|
|
57273
|
+
}
|
|
57040
57274
|
},
|
|
57041
57275
|
externalPlugins: deps.runtimeOptions().plugins,
|
|
57042
57276
|
t: deps.translator,
|
|
@@ -57214,7 +57448,9 @@ function OasisEditorApp(props = {}) {
|
|
|
57214
57448
|
newDocumentDialog,
|
|
57215
57449
|
setNewDocumentDialog,
|
|
57216
57450
|
symbolDialog,
|
|
57217
|
-
setSymbolDialog
|
|
57451
|
+
setSymbolDialog,
|
|
57452
|
+
equationDialog,
|
|
57453
|
+
setEquationDialog
|
|
57218
57454
|
} = createEditorDialogs();
|
|
57219
57455
|
const [welcomeOpen, setWelcomeOpen] = createSignal(false);
|
|
57220
57456
|
const viewportRef = () => focusController.viewportRef;
|
|
@@ -57284,7 +57520,14 @@ function OasisEditorApp(props = {}) {
|
|
|
57284
57520
|
preferredColumnX,
|
|
57285
57521
|
setPreferredColumnX,
|
|
57286
57522
|
documentLayout,
|
|
57287
|
-
canvasSnapshotProvider
|
|
57523
|
+
canvasSnapshotProvider,
|
|
57524
|
+
openEquationDialog: (initial, targetRunId) => {
|
|
57525
|
+
setEquationDialog({
|
|
57526
|
+
isOpen: true,
|
|
57527
|
+
initial,
|
|
57528
|
+
targetRunId
|
|
57529
|
+
});
|
|
57530
|
+
}
|
|
57288
57531
|
});
|
|
57289
57532
|
const {
|
|
57290
57533
|
layoutOptionsOverlay,
|
|
@@ -57336,7 +57579,8 @@ function OasisEditorApp(props = {}) {
|
|
|
57336
57579
|
setImageAltDialog,
|
|
57337
57580
|
setImageCaptionDialog,
|
|
57338
57581
|
setNewDocumentDialog,
|
|
57339
|
-
setSymbolDialog
|
|
57582
|
+
setSymbolDialog,
|
|
57583
|
+
setEquationDialog
|
|
57340
57584
|
});
|
|
57341
57585
|
const {
|
|
57342
57586
|
commandsController,
|
|
@@ -57506,7 +57750,9 @@ function OasisEditorApp(props = {}) {
|
|
|
57506
57750
|
newDocumentDialog,
|
|
57507
57751
|
setNewDocumentDialog,
|
|
57508
57752
|
symbolDialog,
|
|
57509
|
-
setSymbolDialog
|
|
57753
|
+
setSymbolDialog,
|
|
57754
|
+
equationDialog,
|
|
57755
|
+
setEquationDialog
|
|
57510
57756
|
},
|
|
57511
57757
|
findReplace: fr,
|
|
57512
57758
|
fontFamilyOptions: computeFontFamilyOptions2,
|
|
@@ -57534,6 +57780,17 @@ function OasisEditorApp(props = {}) {
|
|
|
57534
57780
|
});
|
|
57535
57781
|
focusInput();
|
|
57536
57782
|
},
|
|
57783
|
+
applyEquation: (expression, targetRunId) => {
|
|
57784
|
+
if (targetRunId) {
|
|
57785
|
+
runtimeEditor().commands.execute("updateEquation", {
|
|
57786
|
+
runId: targetRunId,
|
|
57787
|
+
expression
|
|
57788
|
+
});
|
|
57789
|
+
} else {
|
|
57790
|
+
runtimeEditor().commands.execute("insertEquation", expression);
|
|
57791
|
+
}
|
|
57792
|
+
focusInput();
|
|
57793
|
+
},
|
|
57537
57794
|
closeContextMenu
|
|
57538
57795
|
}), null);
|
|
57539
57796
|
insert(_el$, createComponent(EditorWorkspace, {
|