oasis-editor 0.0.112 → 0.0.114
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-p9k7O_1i.js → OasisEditorApp-XloOiKSu.js} +982 -1284
- package/dist/app/controllers/tableOpsMutationCommands.d.ts +8 -1
- package/dist/assets/{importDocxWorker-Bz2kZOBO.js → importDocxWorker-D0F0jbcF.js} +1 -1
- package/dist/core/textStyleMappings.d.ts +2 -0
- package/dist/{index-AX7m_SeX.js → index-CwpzM--5.js} +708 -628
- package/dist/layoutProjection/paginationSegmentEngine.d.ts +40 -0
- package/dist/oasis-editor.js +51 -51
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/text/fonts/opentype/otLayoutCommon.d.ts +6 -0
- package/dist/ui/canvas/canvasBorders.d.ts +1 -0
- package/dist/ui/canvas/canvasFontResolution.d.ts +19 -0
- package/dist/ui/canvas/canvasParagraphPainter.d.ts +1 -1
- package/dist/ui/components/Dialogs/DialogFooter.d.ts +12 -0
- package/dist/ui/components/Dialogs/TextInputDialog.d.ts +16 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { d as domTextMeasurer, g as getProjectedParagraphBlockHeight, e as estimateTableBlockHeight, p as projectParagraphLayout, a as getPageContentWidth, b as getPageBodyTop, c as getPageBodyBottom, l as listReferencedEndnotes, f as getFootnoteDisplayMarker, s as setActiveHyphenation, h as getDocumentSections, i as buildFootnoteReservations, M as MAX_FOOTNOTE_LAYOUT_ITERATIONS, r as reservationSignature, j as applyFootnotesToPages, k as getRunField, m as projectBlocksLayout, v as visitRun, n as assertNever, o as createSignal, q as createEditorStateFromDocument, t as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, u as fontSizePxToPt, w as probeLocalFontFamilies, x as createEditorParagraphFromRuns, y as isInlineObjectRun, z as createEditorStyledRun, A as getParagraphLength, B as getParagraphText, C as getActiveZone, D as getActiveSectionIndex, E as getParagraphs, F as normalizeSelection, G as positionToParagraphOffset, H as paragraphOffsetToPosition, I as clampPosition, J as findParagraphIndex, K as createCollapsedSelection, L as isSelectionCollapsed, N as parseFontSizePtToPx, O as formatFontSizePt, P as createEditorParagraph, Q as getBlockParagraphs, R as findParagraphTableLocation, T as buildTableCellLayout, U as PT_PER_PX, V as createEditorTableCell, W as createEditorTableRow, X as createEditorTable, Y as underlineStyleToCssDecorationStyle, Z as resolveImageSrc, _ as listKindForTag, $ as isParagraphTag, a0 as collectInlineRuns, a1 as parseParagraphStyle, a2 as getRunImage, a3 as InlineShell, a4 as BalloonShell, a5 as DocumentShell, a6 as createMemo, a7 as getCaretRectFromSnapshot, a8 as getParagraphRectFromSnapshot, a9 as createComponent, aa as CaretOverlay, ab as Show, ac as createRenderEffect, ad as style, ae as setAttribute, af as setStyleProperty, ag as memo, ah as template, ai as
|
|
4
|
+
import { d as domTextMeasurer, g as getProjectedParagraphBlockHeight, e as estimateTableBlockHeight, p as projectParagraphLayout, a as getPageContentWidth, b as getPageBodyTop, c as getPageBodyBottom, l as listReferencedEndnotes, f as getFootnoteDisplayMarker, s as setActiveHyphenation, h as getDocumentSections, i as buildFootnoteReservations, M as MAX_FOOTNOTE_LAYOUT_ITERATIONS, r as reservationSignature, j as applyFootnotesToPages, k as getRunField, m as projectBlocksLayout, v as visitRun, n as assertNever, o as createSignal, q as createEditorStateFromDocument, t as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, u as fontSizePxToPt, w as probeLocalFontFamilies, x as createEditorParagraphFromRuns, y as isInlineObjectRun, z as createEditorStyledRun, A as getParagraphLength, B as getParagraphText, C as getActiveZone, D as getActiveSectionIndex, E as getParagraphs, F as normalizeSelection, G as positionToParagraphOffset, H as paragraphOffsetToPosition, I as clampPosition, J as findParagraphIndex, K as createCollapsedSelection, L as isSelectionCollapsed, N as parseFontSizePtToPx, O as formatFontSizePt, P as createEditorParagraph, Q as getBlockParagraphs, R as findParagraphTableLocation, T as buildTableCellLayout, U as PT_PER_PX, V as createEditorTableCell, W as createEditorTableRow, X as createEditorTable, Y as underlineStyleToCssDecorationStyle, Z as resolveImageSrc, _ as listKindForTag, $ as isParagraphTag, a0 as collectInlineRuns, a1 as parseParagraphStyle, a2 as getRunImage, a3 as InlineShell, a4 as BalloonShell, a5 as DocumentShell, a6 as createMemo, a7 as getCaretRectFromSnapshot, a8 as getParagraphRectFromSnapshot, a9 as createComponent, aa as CaretOverlay, ab as Show, ac as createRenderEffect, ad as style, ae as setAttribute, af as setStyleProperty, ag as memo, ah as template, ai as addEventListener, aj as insert, ak as delegateEvents, al as useI18n, am as createEffect, an as use, ao as Dialog, ap as className, aq as For, ar as UNDERLINE_STYLE_OPTIONS, as as Tabs, at as createStore, au as reconcile, av as onMount, aw as onCleanup, ax as PluginUiHost, ay as OasisEditorEditor, az as OasisBrandMark, aA as setPreciseFontPreference, aB as setWelcomeSeen, aC as enablePreciseFontMode, aD as TWIPS_PER_POINT, aE as PX_PER_INCH, aF as TWIPS_PER_INCH, aG as normalizeHex6, aH as TABLE_CONDITIONAL_FLAG_ATTRIBUTES, aI as TABLE_BORDER_EDGE_KEYS, aJ as resolveEffectiveParagraphStyle, aK as resolveEffectiveTextStyleForParagraph, aL as EMU_PER_PT, aM as OOXML_ROTATION_UNITS, aN as OOXML_PERCENT_DENOMINATOR, aO as parseHexColorToRgb255, aP as EMU_PER_PX, aQ as getRunFootnoteReference, aR as getRunEndnoteReference, aS as iterateFootnoteReferenceRuns, aT as iterateEndnoteReferenceRuns, aU as imageContentTypeDefaults, aV as getRunFieldChar, aW as getRunFieldInstruction, aX as createEditorRun, aY as JSZip, aZ as imageExtensionFromMime, a_ as pxToPt$1, a$ as resolveFloatingObjectRect, b0 as getTextBoxFloatingGeometry, b1 as getPresetPathSegments, b2 as buildListLabels, b3 as getImageFloatingGeometry, b4 as textStyleToFontSizePt, b5 as PX_PER_POINT, b6 as DEFAULT_FONT_SIZE_PX, b7 as resolveOpenTypeFeatureTags, b8 as rgb255ToHex, b9 as isDoubleUnderlineStyle, ba as isWavyUnderlineStyle, bb as underlineStyleLineWidthPx, bc as WAVY_UNDERLINE_WAVELENGTH_PX, bd as WAVY_UNDERLINE_AMPLITUDE_PX, be as underlineStyleDashArray, bf as resolveListLabel, bg as getListLabelInset, bh as getAlignedListLabelInset, bi as getParagraphBorderInsets, bj as buildSegmentTable, bk as buildCanvasTableLayout, bl as resolveCanvasTableWidth, bm as resolveFloatingTableRect, bn as normalizeFamily, bo as ROBOTO_FONT_FILES, bp as loadFontAsset, bq as OFFICE_COMPAT_FONT_FAMILIES, br as BinaryReader, bs as buildSfnt, bt as defaultFontDecoderRegistry, bu as SfntFontProgram, bv as collectPdfFontFamilies, bw as outlineFrom, bx as getPageHeaderZoneTop, by as getPageColumnRects, bz as findFootnoteReference, bA as FOOTNOTE_MARKER_GUTTER_PX, bB as resolveImporterForFile, bC as getDocumentSectionsCanonical, bD as getDocumentParagraphsCanonical, bE as getDocumentParagraphs, bF as getDocumentPageSettings, bG as getTableCellContentWidthForParagraph, bH as layoutMetricsEpoch, bI as bumpLayoutMetricsEpoch, bJ as createCanvasLayoutSnapshotProvider, bK as on, bL as debounce, bM as unwrap, bN as perfTimer, bO as getRunTextBox, bP as createEditorDocument, bQ as resolveResizedDimensions, bR as resolveTextBoxRenderHeight, bS as getToolbarStyleState, bT as getCachedCanvasImage, bU as measureParagraphMinContentWidthPx, bV as getEditableBlocksForZone, bW as findParagraphLocation, bX as createSectionBoundaryParagraph, bY as normalizePageSettings, bZ as DEFAULT_EDITOR_PAGE_SETTINGS, b_ as markStart, b$ as markEnd, c0 as getParagraphEntries, c1 as getParagraphById, c2 as createEditorFootnote, c3 as createFootnoteReferenceRun, c4 as renumberFootnotes, c5 as getHeadingLevel, c6 as preciseFontModeVersion, c7 as isPreciseFontModeEnabled, c8 as resolveNamedTextStyle, c9 as togglePreciseFontMode, ca as nextFontSizePt, cb as previousFontSizePt, cc as fontSizePtToPx, cd as createDefaultToolbarPreset, ce as MenuRegistry, cf as createToolbarRegistry, cg as Editor, ch as resolveCommandRef, ci as commandRefName, cj as createOasisEditorClient, ck as createEditorZoom, cl as startLongTaskObserver, cm as installGlobalReport, cn as applyStoredPreciseFontPreference, co as getWelcomeSeen, cp as isLocalFontAccessSupported, cq as EDITOR_SCROLL_PADDING_PX, cr as Toolbar, cs as OasisEditorLoading, ct as I18nProvider, cu as createTranslator, cv as createEditorLogger, cw as registerDomStatsSurface } from "./index-CwpzM--5.js";
|
|
5
5
|
function projectHeaderFooterBlocksWithDependencies(blocks, deps, context = {}) {
|
|
6
6
|
const {
|
|
7
7
|
pageIndex,
|
|
@@ -31142,14 +31142,14 @@ function DropCaret(props) {
|
|
|
31142
31142
|
})
|
|
31143
31143
|
});
|
|
31144
31144
|
}
|
|
31145
|
-
var _tmpl$$
|
|
31145
|
+
var _tmpl$$d = /* @__PURE__ */ template(`<div class=oasis-editor-table-resize-guide>`), _tmpl$2$7 = /* @__PURE__ */ template(`<img class=oasis-editor-image-ghost>`), _tmpl$3$4 = /* @__PURE__ */ template(`<div class=oasis-editor-table-ghost>`);
|
|
31146
31146
|
function EditorDragLayers(props) {
|
|
31147
31147
|
return [createComponent(Show, {
|
|
31148
31148
|
get when() {
|
|
31149
31149
|
return props.tableResize.resizing();
|
|
31150
31150
|
},
|
|
31151
31151
|
children: (resizing) => (() => {
|
|
31152
|
-
var _el$ = _tmpl$$
|
|
31152
|
+
var _el$ = _tmpl$$d();
|
|
31153
31153
|
createRenderEffect((_p$) => {
|
|
31154
31154
|
var _v$ = !!(resizing().type === "column"), _v$2 = !!(resizing().type === "row"), _v$3 = {
|
|
31155
31155
|
...resizing().type === "column" ? {
|
|
@@ -31180,7 +31180,7 @@ function EditorDragLayers(props) {
|
|
|
31180
31180
|
return memo(() => !!props.imageOps.dragging())() && props.imageOps.draggedImageInfo();
|
|
31181
31181
|
},
|
|
31182
31182
|
children: (info) => (() => {
|
|
31183
|
-
var _el$2 = _tmpl$2$
|
|
31183
|
+
var _el$2 = _tmpl$2$7();
|
|
31184
31184
|
createRenderEffect((_p$) => {
|
|
31185
31185
|
var _v$4 = info().src, _v$5 = `${info().width}px`, _v$6 = `${info().height}px`, _v$7 = `${props.imageOps.mousePos().x - info().offsetX}px`, _v$8 = `${props.imageOps.mousePos().y - info().offsetY}px`;
|
|
31186
31186
|
_v$4 !== _p$.e && setAttribute(_el$2, "src", _p$.e = _v$4);
|
|
@@ -31203,7 +31203,7 @@ function EditorDragLayers(props) {
|
|
|
31203
31203
|
return memo(() => !!props.tableDrag.dragging())() && props.tableDrag.draggedTableInfo();
|
|
31204
31204
|
},
|
|
31205
31205
|
children: (info) => (() => {
|
|
31206
|
-
var _el$3 = _tmpl$3$
|
|
31206
|
+
var _el$3 = _tmpl$3$4();
|
|
31207
31207
|
createRenderEffect((_p$) => {
|
|
31208
31208
|
var _v$9 = `${info().width}px`, _v$0 = `${info().height}px`, _v$1 = `${props.tableDrag.mousePos().x - info().offsetX}px`, _v$10 = `${props.tableDrag.mousePos().y - info().offsetY}px`;
|
|
31209
31209
|
_v$9 !== _p$.e && setStyleProperty(_el$3, "width", _p$.e = _v$9);
|
|
@@ -31293,19 +31293,36 @@ function EditorDragLayers(props) {
|
|
|
31293
31293
|
})
|
|
31294
31294
|
})];
|
|
31295
31295
|
}
|
|
31296
|
-
var _tmpl$$
|
|
31297
|
-
function
|
|
31296
|
+
var _tmpl$$c = /* @__PURE__ */ template(`<button class="oasis-editor-dialog-button oasis-editor-dialog-button-secondary">`), _tmpl$2$6 = /* @__PURE__ */ template(`<button class="oasis-editor-dialog-button oasis-editor-dialog-button-primary">`);
|
|
31297
|
+
function DialogFooter(props) {
|
|
31298
|
+
return [(() => {
|
|
31299
|
+
var _el$ = _tmpl$$c();
|
|
31300
|
+
addEventListener(_el$, "click", props.onCancel, true);
|
|
31301
|
+
insert(_el$, () => props.cancelLabel);
|
|
31302
|
+
createRenderEffect(() => setAttribute(_el$, "data-testid", props.cancelTestId));
|
|
31303
|
+
return _el$;
|
|
31304
|
+
})(), (() => {
|
|
31305
|
+
var _el$2 = _tmpl$2$6();
|
|
31306
|
+
addEventListener(_el$2, "click", props.onConfirm, true);
|
|
31307
|
+
insert(_el$2, () => props.confirmLabel);
|
|
31308
|
+
createRenderEffect(() => setAttribute(_el$2, "data-testid", props.confirmTestId));
|
|
31309
|
+
return _el$2;
|
|
31310
|
+
})()];
|
|
31311
|
+
}
|
|
31312
|
+
delegateEvents(["click"]);
|
|
31313
|
+
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>`);
|
|
31314
|
+
function TextInputDialog(props) {
|
|
31298
31315
|
const t = useI18n();
|
|
31299
|
-
const [
|
|
31316
|
+
const [value, setValue] = createSignal(props.initialValue);
|
|
31300
31317
|
let inputRef;
|
|
31301
31318
|
createEffect(() => {
|
|
31302
31319
|
if (props.isOpen) {
|
|
31303
|
-
|
|
31320
|
+
setValue(props.initialValue);
|
|
31304
31321
|
setTimeout(() => inputRef == null ? void 0 : inputRef.focus(), 50);
|
|
31305
31322
|
}
|
|
31306
31323
|
});
|
|
31307
31324
|
const handleConfirm = () => {
|
|
31308
|
-
props.onConfirm(
|
|
31325
|
+
props.onConfirm(value());
|
|
31309
31326
|
props.onClose();
|
|
31310
31327
|
};
|
|
31311
31328
|
return createComponent(Dialog, {
|
|
@@ -31313,142 +31330,148 @@ function LinkDialog(props) {
|
|
|
31313
31330
|
return props.isOpen;
|
|
31314
31331
|
},
|
|
31315
31332
|
get title() {
|
|
31316
|
-
return
|
|
31333
|
+
return props.title;
|
|
31317
31334
|
},
|
|
31318
31335
|
get onClose() {
|
|
31319
31336
|
return props.onClose;
|
|
31320
31337
|
},
|
|
31321
31338
|
get footer() {
|
|
31322
|
-
return
|
|
31323
|
-
|
|
31324
|
-
|
|
31325
|
-
|
|
31326
|
-
|
|
31327
|
-
|
|
31328
|
-
|
|
31329
|
-
|
|
31330
|
-
|
|
31331
|
-
|
|
31332
|
-
|
|
31339
|
+
return createComponent(DialogFooter, {
|
|
31340
|
+
get onCancel() {
|
|
31341
|
+
return props.onClose;
|
|
31342
|
+
},
|
|
31343
|
+
onConfirm: handleConfirm,
|
|
31344
|
+
get cancelLabel() {
|
|
31345
|
+
return t("generic.cancel");
|
|
31346
|
+
},
|
|
31347
|
+
get confirmLabel() {
|
|
31348
|
+
return props.confirmLabel;
|
|
31349
|
+
},
|
|
31350
|
+
get cancelTestId() {
|
|
31351
|
+
var _a2;
|
|
31352
|
+
return (_a2 = props.testIds) == null ? void 0 : _a2.cancel;
|
|
31353
|
+
},
|
|
31354
|
+
get confirmTestId() {
|
|
31355
|
+
var _a2;
|
|
31356
|
+
return (_a2 = props.testIds) == null ? void 0 : _a2.confirm;
|
|
31357
|
+
}
|
|
31358
|
+
});
|
|
31333
31359
|
},
|
|
31334
31360
|
get children() {
|
|
31335
|
-
var _el$ = _tmpl$$
|
|
31336
|
-
insert(_el$2, () =>
|
|
31361
|
+
var _el$ = _tmpl$$b(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
|
|
31362
|
+
insert(_el$2, () => props.label);
|
|
31337
31363
|
_el$3.$$keydown = (e) => e.key === "Enter" && handleConfirm();
|
|
31338
|
-
_el$3.$$input = (e) =>
|
|
31364
|
+
_el$3.$$input = (e) => setValue(e.currentTarget.value);
|
|
31339
31365
|
var _ref$ = inputRef;
|
|
31340
31366
|
typeof _ref$ === "function" ? use(_ref$, _el$3) : inputRef = _el$3;
|
|
31341
|
-
createRenderEffect(() =>
|
|
31342
|
-
|
|
31367
|
+
createRenderEffect((_p$) => {
|
|
31368
|
+
var _a2;
|
|
31369
|
+
var _v$ = props.placeholder, _v$2 = (_a2 = props.testIds) == null ? void 0 : _a2.input;
|
|
31370
|
+
_v$ !== _p$.e && setAttribute(_el$3, "placeholder", _p$.e = _v$);
|
|
31371
|
+
_v$2 !== _p$.t && setAttribute(_el$3, "data-testid", _p$.t = _v$2);
|
|
31372
|
+
return _p$;
|
|
31373
|
+
}, {
|
|
31374
|
+
e: void 0,
|
|
31375
|
+
t: void 0
|
|
31376
|
+
});
|
|
31377
|
+
createRenderEffect(() => _el$3.value = value());
|
|
31343
31378
|
return _el$;
|
|
31344
31379
|
}
|
|
31345
31380
|
});
|
|
31346
31381
|
}
|
|
31347
|
-
delegateEvents(["input", "keydown"
|
|
31348
|
-
|
|
31349
|
-
function ImageAltDialog(props) {
|
|
31382
|
+
delegateEvents(["input", "keydown"]);
|
|
31383
|
+
function LinkDialog(props) {
|
|
31350
31384
|
const t = useI18n();
|
|
31351
|
-
|
|
31352
|
-
|
|
31353
|
-
|
|
31354
|
-
|
|
31355
|
-
|
|
31356
|
-
|
|
31385
|
+
return createComponent(TextInputDialog, {
|
|
31386
|
+
get isOpen() {
|
|
31387
|
+
return props.isOpen;
|
|
31388
|
+
},
|
|
31389
|
+
get title() {
|
|
31390
|
+
return t("dialog.link.title");
|
|
31391
|
+
},
|
|
31392
|
+
get label() {
|
|
31393
|
+
return t("dialog.link.label");
|
|
31394
|
+
},
|
|
31395
|
+
get placeholder() {
|
|
31396
|
+
return t("dialog.link.placeholder");
|
|
31397
|
+
},
|
|
31398
|
+
get initialValue() {
|
|
31399
|
+
return props.initialHref;
|
|
31400
|
+
},
|
|
31401
|
+
get confirmLabel() {
|
|
31402
|
+
return t("generic.apply");
|
|
31403
|
+
},
|
|
31404
|
+
get onClose() {
|
|
31405
|
+
return props.onClose;
|
|
31406
|
+
},
|
|
31407
|
+
get onConfirm() {
|
|
31408
|
+
return props.onConfirm;
|
|
31409
|
+
},
|
|
31410
|
+
testIds: {
|
|
31411
|
+
input: "editor-link-dialog-input",
|
|
31412
|
+
cancel: "editor-link-dialog-cancel",
|
|
31413
|
+
confirm: "editor-link-dialog-apply"
|
|
31357
31414
|
}
|
|
31358
31415
|
});
|
|
31359
|
-
|
|
31360
|
-
|
|
31361
|
-
|
|
31362
|
-
|
|
31363
|
-
return createComponent(Dialog, {
|
|
31416
|
+
}
|
|
31417
|
+
function ImageAltDialog(props) {
|
|
31418
|
+
const t = useI18n();
|
|
31419
|
+
return createComponent(TextInputDialog, {
|
|
31364
31420
|
get isOpen() {
|
|
31365
31421
|
return props.isOpen;
|
|
31366
31422
|
},
|
|
31367
31423
|
get title() {
|
|
31368
31424
|
return t("dialog.imageAlt.title");
|
|
31369
31425
|
},
|
|
31426
|
+
get label() {
|
|
31427
|
+
return t("dialog.imageAlt.label");
|
|
31428
|
+
},
|
|
31429
|
+
get placeholder() {
|
|
31430
|
+
return t("dialog.imageAlt.placeholder");
|
|
31431
|
+
},
|
|
31432
|
+
get initialValue() {
|
|
31433
|
+
return props.initialAlt;
|
|
31434
|
+
},
|
|
31435
|
+
get confirmLabel() {
|
|
31436
|
+
return t("generic.save");
|
|
31437
|
+
},
|
|
31370
31438
|
get onClose() {
|
|
31371
31439
|
return props.onClose;
|
|
31372
31440
|
},
|
|
31373
|
-
get
|
|
31374
|
-
return
|
|
31375
|
-
var _el$4 = _tmpl$2$7();
|
|
31376
|
-
addEventListener(_el$4, "click", props.onClose, true);
|
|
31377
|
-
insert(_el$4, () => t("generic.cancel"));
|
|
31378
|
-
return _el$4;
|
|
31379
|
-
})(), (() => {
|
|
31380
|
-
var _el$5 = _tmpl$3$5();
|
|
31381
|
-
_el$5.$$click = handleConfirm;
|
|
31382
|
-
insert(_el$5, () => t("generic.save"));
|
|
31383
|
-
return _el$5;
|
|
31384
|
-
})()];
|
|
31385
|
-
},
|
|
31386
|
-
get children() {
|
|
31387
|
-
var _el$ = _tmpl$$c(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
|
|
31388
|
-
insert(_el$2, () => t("dialog.imageAlt.label"));
|
|
31389
|
-
_el$3.$$keydown = (e) => e.key === "Enter" && handleConfirm();
|
|
31390
|
-
_el$3.$$input = (e) => setAlt(e.currentTarget.value);
|
|
31391
|
-
var _ref$ = inputRef;
|
|
31392
|
-
typeof _ref$ === "function" ? use(_ref$, _el$3) : inputRef = _el$3;
|
|
31393
|
-
createRenderEffect(() => setAttribute(_el$3, "placeholder", t("dialog.imageAlt.placeholder")));
|
|
31394
|
-
createRenderEffect(() => _el$3.value = alt());
|
|
31395
|
-
return _el$;
|
|
31441
|
+
get onConfirm() {
|
|
31442
|
+
return props.onConfirm;
|
|
31396
31443
|
}
|
|
31397
31444
|
});
|
|
31398
31445
|
}
|
|
31399
|
-
delegateEvents(["input", "keydown", "click"]);
|
|
31400
|
-
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">`);
|
|
31401
31446
|
function ImageCaptionDialog(props) {
|
|
31402
31447
|
const t = useI18n();
|
|
31403
|
-
|
|
31404
|
-
let inputRef;
|
|
31405
|
-
createEffect(() => {
|
|
31406
|
-
if (props.isOpen) {
|
|
31407
|
-
setCaption(props.initialCaption);
|
|
31408
|
-
setTimeout(() => inputRef == null ? void 0 : inputRef.focus(), 50);
|
|
31409
|
-
}
|
|
31410
|
-
});
|
|
31411
|
-
const handleConfirm = () => {
|
|
31412
|
-
props.onConfirm(caption());
|
|
31413
|
-
props.onClose();
|
|
31414
|
-
};
|
|
31415
|
-
return createComponent(Dialog, {
|
|
31448
|
+
return createComponent(TextInputDialog, {
|
|
31416
31449
|
get isOpen() {
|
|
31417
31450
|
return props.isOpen;
|
|
31418
31451
|
},
|
|
31419
31452
|
get title() {
|
|
31420
31453
|
return t("dialog.imageCaption.title");
|
|
31421
31454
|
},
|
|
31455
|
+
get label() {
|
|
31456
|
+
return t("dialog.imageCaption.label");
|
|
31457
|
+
},
|
|
31458
|
+
get placeholder() {
|
|
31459
|
+
return t("dialog.imageCaption.placeholder");
|
|
31460
|
+
},
|
|
31461
|
+
get initialValue() {
|
|
31462
|
+
return props.initialCaption;
|
|
31463
|
+
},
|
|
31464
|
+
get confirmLabel() {
|
|
31465
|
+
return t("generic.save");
|
|
31466
|
+
},
|
|
31422
31467
|
get onClose() {
|
|
31423
31468
|
return props.onClose;
|
|
31424
31469
|
},
|
|
31425
|
-
get
|
|
31426
|
-
return
|
|
31427
|
-
var _el$4 = _tmpl$2$6();
|
|
31428
|
-
addEventListener(_el$4, "click", props.onClose, true);
|
|
31429
|
-
insert(_el$4, () => t("generic.cancel"));
|
|
31430
|
-
return _el$4;
|
|
31431
|
-
})(), (() => {
|
|
31432
|
-
var _el$5 = _tmpl$3$4();
|
|
31433
|
-
_el$5.$$click = handleConfirm;
|
|
31434
|
-
insert(_el$5, () => t("generic.save"));
|
|
31435
|
-
return _el$5;
|
|
31436
|
-
})()];
|
|
31437
|
-
},
|
|
31438
|
-
get children() {
|
|
31439
|
-
var _el$ = _tmpl$$b(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
|
|
31440
|
-
insert(_el$2, () => t("dialog.imageCaption.label"));
|
|
31441
|
-
_el$3.$$keydown = (e) => e.key === "Enter" && handleConfirm();
|
|
31442
|
-
_el$3.$$input = (e) => setCaption(e.currentTarget.value);
|
|
31443
|
-
var _ref$ = inputRef;
|
|
31444
|
-
typeof _ref$ === "function" ? use(_ref$, _el$3) : inputRef = _el$3;
|
|
31445
|
-
createRenderEffect(() => setAttribute(_el$3, "placeholder", t("dialog.imageCaption.placeholder")));
|
|
31446
|
-
createRenderEffect(() => _el$3.value = caption());
|
|
31447
|
-
return _el$;
|
|
31470
|
+
get onConfirm() {
|
|
31471
|
+
return props.onConfirm;
|
|
31448
31472
|
}
|
|
31449
31473
|
});
|
|
31450
31474
|
}
|
|
31451
|
-
delegateEvents(["input", "keydown", "click"]);
|
|
31452
31475
|
const DEFAULT_COLOR = "#111827";
|
|
31453
31476
|
const DEFAULT_HIGHLIGHT = "#fef08a";
|
|
31454
31477
|
const DEFAULT_SHADING = "#fef3c7";
|
|
@@ -32130,7 +32153,7 @@ function FontDialog(props) {
|
|
|
32130
32153
|
});
|
|
32131
32154
|
}
|
|
32132
32155
|
delegateEvents(["click"]);
|
|
32133
|
-
var _tmpl$$6 = /* @__PURE__ */ template(`<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-paragraph-dialog-align><option value=left></option><option value=center></option><option value=right></option><option value=justify>`), _tmpl$2$2 = /* @__PURE__ */ template(`<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 type=number class=oasis-editor-dialog-input step=1 data-testid=editor-paragraph-dialog-indent-left></div><div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><input type=number class=oasis-editor-dialog-input step=1 data-testid=editor-paragraph-dialog-indent-right>`), _tmpl$3$2 = /* @__PURE__ */ template(`<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-paragraph-dialog-special><option value=none></option><option value=firstLine></option><option value=hanging></option></select></div><div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><input type=number class=oasis-editor-dialog-input min=0 step=1 data-testid=editor-paragraph-dialog-special-by>`), _tmpl$4$2 = /* @__PURE__ */ template(`<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 type=number class=oasis-editor-dialog-input min=0 step=1 data-testid=editor-paragraph-dialog-spacing-before></div><div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><input type=number class=oasis-editor-dialog-input min=0 step=1 data-testid=editor-paragraph-dialog-spacing-after></div><div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><input type=number class=oasis-editor-dialog-input min=0.5 step=0.05 data-testid=editor-paragraph-dialog-line-height>`), _tmpl$5$2 = /* @__PURE__ */ template(`<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-paragraph-dialog-border-style><option value=none></option><option value=solid></option><option value=dashed></option><option value=dotted></option></select></div><div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><input type=number class=oasis-editor-dialog-input min=0 step=0.25 data-testid=editor-paragraph-dialog-border-width></div><div class=oasis-editor-dialog-input-group><label class=oasis-editor-dialog-label></label><input type=color class=oasis-editor-dialog-input data-testid=editor-paragraph-dialog-border-color></div><div class=oasis-editor-dialog-input-group><label class=oasis-editor-dialog-label></label><input type=color class=oasis-editor-dialog-input data-testid=editor-paragraph-dialog-shading>`), _tmpl$6$2 = /* @__PURE__ */ template(`<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-paragraph-dialog-border-side-top></label><label class=oasis-editor-dialog-style-toggle><input type=checkbox data-testid=editor-paragraph-dialog-border-side-right></label><label class=oasis-editor-dialog-style-toggle><input type=checkbox data-testid=editor-paragraph-dialog-border-side-bottom></label><label class=oasis-editor-dialog-style-toggle><input type=checkbox data-testid=editor-paragraph-dialog-border-side-left>`), _tmpl$7$1 = /* @__PURE__ */ template(`<div class=oasis-editor-dialog-input-group><label class=oasis-editor-dialog-label></label><div class=oasis-editor-dialog-preview data-testid=editor-paragraph-dialog-preview>`)
|
|
32156
|
+
var _tmpl$$6 = /* @__PURE__ */ template(`<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-paragraph-dialog-align><option value=left></option><option value=center></option><option value=right></option><option value=justify>`), _tmpl$2$2 = /* @__PURE__ */ template(`<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 type=number class=oasis-editor-dialog-input step=1 data-testid=editor-paragraph-dialog-indent-left></div><div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><input type=number class=oasis-editor-dialog-input step=1 data-testid=editor-paragraph-dialog-indent-right>`), _tmpl$3$2 = /* @__PURE__ */ template(`<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-paragraph-dialog-special><option value=none></option><option value=firstLine></option><option value=hanging></option></select></div><div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><input type=number class=oasis-editor-dialog-input min=0 step=1 data-testid=editor-paragraph-dialog-special-by>`), _tmpl$4$2 = /* @__PURE__ */ template(`<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 type=number class=oasis-editor-dialog-input min=0 step=1 data-testid=editor-paragraph-dialog-spacing-before></div><div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><input type=number class=oasis-editor-dialog-input min=0 step=1 data-testid=editor-paragraph-dialog-spacing-after></div><div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><input type=number class=oasis-editor-dialog-input min=0.5 step=0.05 data-testid=editor-paragraph-dialog-line-height>`), _tmpl$5$2 = /* @__PURE__ */ template(`<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-paragraph-dialog-border-style><option value=none></option><option value=solid></option><option value=dashed></option><option value=dotted></option></select></div><div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><input type=number class=oasis-editor-dialog-input min=0 step=0.25 data-testid=editor-paragraph-dialog-border-width></div><div class=oasis-editor-dialog-input-group><label class=oasis-editor-dialog-label></label><input type=color class=oasis-editor-dialog-input data-testid=editor-paragraph-dialog-border-color></div><div class=oasis-editor-dialog-input-group><label class=oasis-editor-dialog-label></label><input type=color class=oasis-editor-dialog-input data-testid=editor-paragraph-dialog-shading>`), _tmpl$6$2 = /* @__PURE__ */ template(`<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-paragraph-dialog-border-side-top></label><label class=oasis-editor-dialog-style-toggle><input type=checkbox data-testid=editor-paragraph-dialog-border-side-right></label><label class=oasis-editor-dialog-style-toggle><input type=checkbox data-testid=editor-paragraph-dialog-border-side-bottom></label><label class=oasis-editor-dialog-style-toggle><input type=checkbox data-testid=editor-paragraph-dialog-border-side-left>`), _tmpl$7$1 = /* @__PURE__ */ template(`<div class=oasis-editor-dialog-input-group><label class=oasis-editor-dialog-label></label><div class=oasis-editor-dialog-preview data-testid=editor-paragraph-dialog-preview>`);
|
|
32134
32157
|
const DEFAULT_BORDER_WIDTH_PT$1 = 0.5;
|
|
32135
32158
|
const DEFAULT_BORDER_COLOR$1 = "#000000";
|
|
32136
32159
|
function parseNumber$1(value) {
|
|
@@ -32258,17 +32281,20 @@ function ParagraphDialog(props) {
|
|
|
32258
32281
|
return props.onClose;
|
|
32259
32282
|
},
|
|
32260
32283
|
get footer() {
|
|
32261
|
-
return
|
|
32262
|
-
|
|
32263
|
-
|
|
32264
|
-
|
|
32265
|
-
|
|
32266
|
-
|
|
32267
|
-
|
|
32268
|
-
|
|
32269
|
-
|
|
32270
|
-
|
|
32271
|
-
|
|
32284
|
+
return createComponent(DialogFooter, {
|
|
32285
|
+
get onCancel() {
|
|
32286
|
+
return props.onClose;
|
|
32287
|
+
},
|
|
32288
|
+
onConfirm: handleApply,
|
|
32289
|
+
get cancelLabel() {
|
|
32290
|
+
return t("generic.cancel");
|
|
32291
|
+
},
|
|
32292
|
+
get confirmLabel() {
|
|
32293
|
+
return t("generic.apply");
|
|
32294
|
+
},
|
|
32295
|
+
cancelTestId: "editor-paragraph-dialog-cancel",
|
|
32296
|
+
confirmTestId: "editor-paragraph-dialog-apply"
|
|
32297
|
+
});
|
|
32272
32298
|
},
|
|
32273
32299
|
get children() {
|
|
32274
32300
|
return [(() => {
|
|
@@ -32400,8 +32426,8 @@ function ParagraphDialog(props) {
|
|
|
32400
32426
|
}
|
|
32401
32427
|
});
|
|
32402
32428
|
}
|
|
32403
|
-
delegateEvents(["input"
|
|
32404
|
-
var _tmpl$$5 = /* @__PURE__ */ template(`<div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><input type=number class=oasis-editor-dialog-input step=1>`), _tmpl$2$1 = /* @__PURE__ */ template(`<label class=oasis-editor-dialog-style-toggle><input type=checkbox>`), _tmpl$3$1 = /* @__PURE__ */ template(`<
|
|
32429
|
+
delegateEvents(["input"]);
|
|
32430
|
+
var _tmpl$$5 = /* @__PURE__ */ template(`<div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><input type=number class=oasis-editor-dialog-input step=1>`), _tmpl$2$1 = /* @__PURE__ */ template(`<label class=oasis-editor-dialog-style-toggle><input type=checkbox>`), _tmpl$3$1 = /* @__PURE__ */ template(`<div class=oasis-editor-dialog-row><label class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><span class=oasis-editor-dialog-label></span><select class=oasis-editor-dialog-input data-testid=editor-table-properties-floating-h-anchor><option value=margin></option><option value=page></option><option value=text></option></select></label><label class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><span class=oasis-editor-dialog-label></span><select class=oasis-editor-dialog-input data-testid=editor-table-properties-floating-v-anchor><option value=margin></option><option value=page></option><option value=text>`), _tmpl$4$1 = /* @__PURE__ */ template(`<div class=oasis-editor-dialog-row><label class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><span class=oasis-editor-dialog-label></span><select class=oasis-editor-dialog-input data-testid=editor-table-properties-floating-x-align><option value></option></select></label><label class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><span class=oasis-editor-dialog-label></span><select class=oasis-editor-dialog-input data-testid=editor-table-properties-floating-y-align><option value>`), _tmpl$5$1 = /* @__PURE__ */ template(`<div class=oasis-editor-dialog-row>`), _tmpl$6$1 = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-panel><fieldset class=oasis-editor-font-dialog-fieldset><legend></legend><div class=oasis-editor-dialog-row><div class=oasis-editor-dialog-input-group><label class=oasis-editor-dialog-label></label><select class=oasis-editor-dialog-input data-testid=editor-table-properties-table-width-unit><option value=points></option><option value=percent></option></select></div></div></fieldset><fieldset class=oasis-editor-font-dialog-fieldset><legend></legend><div class=oasis-editor-dialog-style-row></div><div class=oasis-editor-dialog-row></div></fieldset><fieldset class=oasis-editor-font-dialog-fieldset><legend></legend><div class=oasis-editor-dialog-style-row>`), _tmpl$7 = /* @__PURE__ */ template(`<label class=oasis-editor-dialog-style-toggle><input type=radio name=table-align>`), _tmpl$8 = /* @__PURE__ */ template(`<option>`), _tmpl$9 = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-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><select class=oasis-editor-dialog-input data-testid=editor-table-properties-row-height-rule><option value></option><option value=atLeast></option><option value=exact></option></select></div></div><div class=oasis-editor-dialog-style-row>`), _tmpl$0 = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-panel><div class=oasis-editor-dialog-row>`), _tmpl$1 = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-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><select class=oasis-editor-dialog-input data-testid=editor-table-properties-cell-valign><option value></option><option value=top></option><option value=middle></option><option value=bottom></option></select></div><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-table-properties-cell-direction><option value></option><option value=lrTb>lrTb</option><option value=tbRl>tbRl</option><option value=btLr>btLr</option><option value=lrTbV>lrTbV</option><option value=tbRlV>tbRlV</option></select></div></div><fieldset class=oasis-editor-font-dialog-fieldset><legend></legend><div class=oasis-editor-dialog-style-row></div></fieldset><fieldset class=oasis-editor-font-dialog-fieldset><legend></legend><div class=oasis-editor-dialog-row></div></fieldset><fieldset class=oasis-editor-font-dialog-fieldset><legend></legend><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-table-properties-border-style><option value=none></option><option value=solid></option><option value=dashed></option><option value=dotted></option></select></div><div class=oasis-editor-dialog-input-group><label class=oasis-editor-dialog-label></label><input type=color class=oasis-editor-dialog-input data-testid=editor-table-properties-border-color></div><div class=oasis-editor-dialog-input-group><label class=oasis-editor-dialog-label></label><input type=color class=oasis-editor-dialog-input data-testid=editor-table-properties-shading></div></div><div class=oasis-editor-dialog-style-row></div><div class=oasis-editor-table-properties-cell-preview data-testid=editor-table-properties-cell-preview>`), _tmpl$10 = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-panel><div class=oasis-editor-dialog-input-group><label class=oasis-editor-dialog-label></label><input class=oasis-editor-dialog-input data-testid=editor-table-properties-alt-title></div><div class=oasis-editor-dialog-input-group><label class=oasis-editor-dialog-label></label><textarea class="oasis-editor-dialog-input oasis-editor-table-properties-textarea"data-testid=editor-table-properties-alt-description>`);
|
|
32405
32431
|
const DEFAULT_BORDER_WIDTH_PT = 0.5;
|
|
32406
32432
|
const DEFAULT_BORDER_COLOR = "#000000";
|
|
32407
32433
|
function parseNumber(value) {
|
|
@@ -32423,194 +32449,400 @@ function resolveBorder(style2, widthValue, colorValue) {
|
|
|
32423
32449
|
color: colorValue.trim() || DEFAULT_BORDER_COLOR
|
|
32424
32450
|
};
|
|
32425
32451
|
}
|
|
32426
|
-
function
|
|
32452
|
+
function numericInput(label, value, setter, testId, disabled = false, allowNegative = false) {
|
|
32453
|
+
return (() => {
|
|
32454
|
+
var _el$ = _tmpl$$5(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
|
|
32455
|
+
insert(_el$2, label);
|
|
32456
|
+
_el$3.$$input = (e) => setter(e.currentTarget.value);
|
|
32457
|
+
setAttribute(_el$3, "min", allowNegative ? void 0 : "0");
|
|
32458
|
+
_el$3.disabled = disabled;
|
|
32459
|
+
setAttribute(_el$3, "data-testid", testId);
|
|
32460
|
+
createRenderEffect(() => _el$3.value = value());
|
|
32461
|
+
return _el$;
|
|
32462
|
+
})();
|
|
32463
|
+
}
|
|
32464
|
+
function checkbox(label, checked, setter, testId, disabled = false) {
|
|
32465
|
+
return (() => {
|
|
32466
|
+
var _el$4 = _tmpl$2$1(), _el$5 = _el$4.firstChild;
|
|
32467
|
+
_el$5.addEventListener("change", (e) => setter(e.currentTarget.checked));
|
|
32468
|
+
_el$5.disabled = disabled;
|
|
32469
|
+
setAttribute(_el$5, "data-testid", testId);
|
|
32470
|
+
insert(_el$4, label, null);
|
|
32471
|
+
createRenderEffect(() => _el$5.checked = checked());
|
|
32472
|
+
return _el$4;
|
|
32473
|
+
})();
|
|
32474
|
+
}
|
|
32475
|
+
function TableTabPanel(p) {
|
|
32476
|
+
const t = useI18n();
|
|
32477
|
+
return (() => {
|
|
32478
|
+
var _el$6 = _tmpl$6$1(), _el$7 = _el$6.firstChild, _el$8 = _el$7.firstChild, _el$9 = _el$8.nextSibling, _el$0 = _el$9.firstChild, _el$1 = _el$0.firstChild, _el$10 = _el$1.nextSibling, _el$11 = _el$10.firstChild, _el$12 = _el$11.nextSibling, _el$13 = _el$7.nextSibling, _el$14 = _el$13.firstChild, _el$15 = _el$14.nextSibling, _el$16 = _el$15.nextSibling, _el$17 = _el$13.nextSibling, _el$18 = _el$17.firstChild, _el$19 = _el$18.nextSibling;
|
|
32479
|
+
insert(_el$8, () => t("table.sizeSection"));
|
|
32480
|
+
insert(_el$9, () => numericInput(t("table.preferredWidth"), () => p.form.tableWidth, (v) => p.set("tableWidth", v), "editor-table-properties-table-width"), _el$0);
|
|
32481
|
+
insert(_el$1, () => t("table.measureIn"));
|
|
32482
|
+
_el$10.addEventListener("change", (e) => p.set("tableWidthUnit", e.currentTarget.value));
|
|
32483
|
+
insert(_el$11, () => t("table.points"));
|
|
32484
|
+
insert(_el$12, () => t("table.percent"));
|
|
32485
|
+
insert(_el$14, () => t("table.alignmentSection"));
|
|
32486
|
+
insert(_el$15, () => ["left", "center", "right"].map((align) => (() => {
|
|
32487
|
+
var _el$43 = _tmpl$7(), _el$44 = _el$43.firstChild;
|
|
32488
|
+
_el$44.addEventListener("change", () => p.set("tableAlign", align));
|
|
32489
|
+
setAttribute(_el$44, "data-testid", `editor-table-properties-align-${align}`);
|
|
32490
|
+
insert(_el$43, () => t(`table.align${align[0].toUpperCase()}${align.slice(1)}`), null);
|
|
32491
|
+
createRenderEffect(() => _el$44.checked = p.form.tableAlign === align);
|
|
32492
|
+
return _el$43;
|
|
32493
|
+
})()));
|
|
32494
|
+
insert(_el$16, () => numericInput(t("table.indentFromLeft"), () => p.form.tableIndentLeft, (v) => p.set("tableIndentLeft", v), "editor-table-properties-indent-left"));
|
|
32495
|
+
insert(_el$18, () => t("table.textWrappingSection"));
|
|
32496
|
+
insert(_el$19, () => checkbox(t("table.wrapNone"), () => p.form.tableWrapping === "none", () => p.set("tableWrapping", "none"), "editor-table-properties-wrap-none"), null);
|
|
32497
|
+
insert(_el$19, () => checkbox(t("table.wrapAround"), () => p.form.tableWrapping === "around", () => p.set("tableWrapping", "around"), "editor-table-properties-wrap-around"), null);
|
|
32498
|
+
insert(_el$17, createComponent(Show, {
|
|
32499
|
+
get when() {
|
|
32500
|
+
return p.form.tableWrapping === "around";
|
|
32501
|
+
},
|
|
32502
|
+
get children() {
|
|
32503
|
+
return [(() => {
|
|
32504
|
+
var _el$20 = _tmpl$3$1(), _el$21 = _el$20.firstChild, _el$22 = _el$21.firstChild, _el$23 = _el$22.nextSibling, _el$24 = _el$23.firstChild, _el$25 = _el$24.nextSibling, _el$26 = _el$25.nextSibling, _el$27 = _el$21.nextSibling, _el$28 = _el$27.firstChild, _el$29 = _el$28.nextSibling, _el$30 = _el$29.firstChild, _el$31 = _el$30.nextSibling, _el$32 = _el$31.nextSibling;
|
|
32505
|
+
insert(_el$22, () => t("table.horizontalAnchor"));
|
|
32506
|
+
_el$23.addEventListener("change", (e) => p.set("floatingHorizontalAnchor", e.currentTarget.value));
|
|
32507
|
+
insert(_el$24, () => t("table.anchorMargin"));
|
|
32508
|
+
insert(_el$25, () => t("table.anchorPage"));
|
|
32509
|
+
insert(_el$26, () => t("table.anchorText"));
|
|
32510
|
+
insert(_el$28, () => t("table.verticalAnchor"));
|
|
32511
|
+
_el$29.addEventListener("change", (e) => p.set("floatingVerticalAnchor", e.currentTarget.value));
|
|
32512
|
+
insert(_el$30, () => t("table.anchorMargin"));
|
|
32513
|
+
insert(_el$31, () => t("table.anchorPage"));
|
|
32514
|
+
insert(_el$32, () => t("table.anchorText"));
|
|
32515
|
+
createRenderEffect(() => _el$23.value = p.form.floatingHorizontalAnchor);
|
|
32516
|
+
createRenderEffect(() => _el$29.value = p.form.floatingVerticalAnchor);
|
|
32517
|
+
return _el$20;
|
|
32518
|
+
})(), (() => {
|
|
32519
|
+
var _el$33 = _tmpl$4$1(), _el$34 = _el$33.firstChild, _el$35 = _el$34.firstChild, _el$36 = _el$35.nextSibling, _el$37 = _el$36.firstChild, _el$38 = _el$34.nextSibling, _el$39 = _el$38.firstChild, _el$40 = _el$39.nextSibling, _el$41 = _el$40.firstChild;
|
|
32520
|
+
insert(_el$33, () => numericInput(t("table.positionX"), () => p.form.floatingX, (v) => p.set("floatingX", v), "editor-table-properties-floating-x", Boolean(p.form.floatingXAlign), true), _el$34);
|
|
32521
|
+
insert(_el$33, () => numericInput(t("table.positionY"), () => p.form.floatingY, (v) => p.set("floatingY", v), "editor-table-properties-floating-y", Boolean(p.form.floatingYAlign), true), _el$34);
|
|
32522
|
+
insert(_el$35, () => t("table.horizontalAlignment"));
|
|
32523
|
+
_el$36.addEventListener("change", (e) => p.set("floatingXAlign", e.currentTarget.value));
|
|
32524
|
+
insert(_el$37, () => t("table.explicitOffset"));
|
|
32525
|
+
insert(_el$36, () => ["left", "center", "right", "inside", "outside"].map((value) => (() => {
|
|
32526
|
+
var _el$45 = _tmpl$8();
|
|
32527
|
+
_el$45.value = value;
|
|
32528
|
+
insert(_el$45, value);
|
|
32529
|
+
return _el$45;
|
|
32530
|
+
})()), null);
|
|
32531
|
+
insert(_el$39, () => t("table.verticalAlignment"));
|
|
32532
|
+
_el$40.addEventListener("change", (e) => p.set("floatingYAlign", e.currentTarget.value));
|
|
32533
|
+
insert(_el$41, () => t("table.explicitOffset"));
|
|
32534
|
+
insert(_el$40, () => ["top", "center", "bottom", "inside", "outside"].map((value) => (() => {
|
|
32535
|
+
var _el$46 = _tmpl$8();
|
|
32536
|
+
_el$46.value = value;
|
|
32537
|
+
insert(_el$46, value);
|
|
32538
|
+
return _el$46;
|
|
32539
|
+
})()), null);
|
|
32540
|
+
createRenderEffect(() => _el$36.value = p.form.floatingXAlign);
|
|
32541
|
+
createRenderEffect(() => _el$40.value = p.form.floatingYAlign);
|
|
32542
|
+
return _el$33;
|
|
32543
|
+
})(), (() => {
|
|
32544
|
+
var _el$42 = _tmpl$5$1();
|
|
32545
|
+
insert(_el$42, () => numericInput(t("table.distanceTop"), () => p.form.floatingDistanceTop, (v) => p.set("floatingDistanceTop", v), "editor-table-properties-floating-distance-top"), null);
|
|
32546
|
+
insert(_el$42, () => numericInput(t("table.distanceRight"), () => p.form.floatingDistanceRight, (v) => p.set("floatingDistanceRight", v), "editor-table-properties-floating-distance-right"), null);
|
|
32547
|
+
insert(_el$42, () => numericInput(t("table.distanceBottom"), () => p.form.floatingDistanceBottom, (v) => p.set("floatingDistanceBottom", v), "editor-table-properties-floating-distance-bottom"), null);
|
|
32548
|
+
insert(_el$42, () => numericInput(t("table.distanceLeft"), () => p.form.floatingDistanceLeft, (v) => p.set("floatingDistanceLeft", v), "editor-table-properties-floating-distance-left"), null);
|
|
32549
|
+
return _el$42;
|
|
32550
|
+
})(), memo(() => checkbox(t("table.allowOverlap"), () => p.form.floatingOverlap === "overlap", (value) => p.set("floatingOverlap", value ? "overlap" : "never"), "editor-table-properties-floating-overlap"))];
|
|
32551
|
+
}
|
|
32552
|
+
}), null);
|
|
32553
|
+
createRenderEffect(() => _el$10.value = p.form.tableWidthUnit);
|
|
32554
|
+
return _el$6;
|
|
32555
|
+
})();
|
|
32556
|
+
}
|
|
32557
|
+
function RowTabPanel(p) {
|
|
32558
|
+
const t = useI18n();
|
|
32559
|
+
return (() => {
|
|
32560
|
+
var _el$47 = _tmpl$9(), _el$48 = _el$47.firstChild, _el$49 = _el$48.firstChild, _el$50 = _el$49.firstChild, _el$51 = _el$50.nextSibling, _el$52 = _el$51.firstChild, _el$53 = _el$52.nextSibling, _el$54 = _el$53.nextSibling, _el$55 = _el$48.nextSibling;
|
|
32561
|
+
insert(_el$48, () => numericInput(t("table.rowHeight"), () => p.form.rowHeight, (v) => p.set("rowHeight", v), "editor-table-properties-row-height"), _el$49);
|
|
32562
|
+
insert(_el$50, () => t("table.rowHeightRule"));
|
|
32563
|
+
_el$51.addEventListener("change", (e) => p.set("rowHeightRule", e.currentTarget.value));
|
|
32564
|
+
insert(_el$52, () => t("table.rowAuto"));
|
|
32565
|
+
insert(_el$53, () => t("table.rowAtLeast"));
|
|
32566
|
+
insert(_el$54, () => t("table.rowExactly"));
|
|
32567
|
+
insert(_el$55, () => checkbox(t("table.repeatHeader"), () => p.form.repeatHeader, (v) => p.set("repeatHeader", v), "editor-table-properties-repeat-header"), null);
|
|
32568
|
+
insert(_el$55, () => checkbox(t("table.allowBreakAcrossPages"), () => p.form.allowBreakAcrossPages, (v) => p.set("allowBreakAcrossPages", v), "editor-table-properties-allow-break"), null);
|
|
32569
|
+
insert(_el$55, () => checkbox(t("table.hiddenRow"), () => p.form.hiddenRow, (v) => p.set("hiddenRow", v), "editor-table-properties-hidden-row"), null);
|
|
32570
|
+
createRenderEffect(() => _el$51.value = p.form.rowHeightRule);
|
|
32571
|
+
return _el$47;
|
|
32572
|
+
})();
|
|
32573
|
+
}
|
|
32574
|
+
function ColumnTabPanel(p) {
|
|
32575
|
+
const t = useI18n();
|
|
32576
|
+
return (() => {
|
|
32577
|
+
var _el$56 = _tmpl$0(), _el$57 = _el$56.firstChild;
|
|
32578
|
+
insert(_el$57, () => numericInput(t("table.columnWidth"), () => p.form.columnWidth, (v) => p.set("columnWidth", v), "editor-table-properties-column-width"));
|
|
32579
|
+
return _el$56;
|
|
32580
|
+
})();
|
|
32581
|
+
}
|
|
32582
|
+
function CellTabPanel(p) {
|
|
32427
32583
|
const t = useI18n();
|
|
32428
|
-
const [activeTab, setActiveTab] = createSignal("table");
|
|
32429
|
-
const [tableWidth, setTableWidth] = createSignal("");
|
|
32430
|
-
const [tableWidthUnit, setTableWidthUnit] = createSignal("points");
|
|
32431
|
-
const [tableAlign, setTableAlign] = createSignal("");
|
|
32432
|
-
const [tableIndentLeft, setTableIndentLeft] = createSignal("");
|
|
32433
|
-
const [tableWrapping, setTableWrapping] = createSignal("none");
|
|
32434
|
-
const [floatingHorizontalAnchor, setFloatingHorizontalAnchor] = createSignal("margin");
|
|
32435
|
-
const [floatingVerticalAnchor, setFloatingVerticalAnchor] = createSignal("text");
|
|
32436
|
-
const [floatingX, setFloatingX] = createSignal("");
|
|
32437
|
-
const [floatingY, setFloatingY] = createSignal("");
|
|
32438
|
-
const [floatingXAlign, setFloatingXAlign] = createSignal("");
|
|
32439
|
-
const [floatingYAlign, setFloatingYAlign] = createSignal("");
|
|
32440
|
-
const [floatingDistanceTop, setFloatingDistanceTop] = createSignal("");
|
|
32441
|
-
const [floatingDistanceRight, setFloatingDistanceRight] = createSignal("");
|
|
32442
|
-
const [floatingDistanceBottom, setFloatingDistanceBottom] = createSignal("");
|
|
32443
|
-
const [floatingDistanceLeft, setFloatingDistanceLeft] = createSignal("");
|
|
32444
|
-
const [floatingOverlap, setFloatingOverlap] = createSignal("overlap");
|
|
32445
|
-
const [rowHeight, setRowHeight] = createSignal("");
|
|
32446
|
-
const [rowHeightRule, setRowHeightRule] = createSignal("");
|
|
32447
|
-
const [repeatHeader, setRepeatHeader] = createSignal(false);
|
|
32448
|
-
const [allowBreakAcrossPages, setAllowBreakAcrossPages] = createSignal(true);
|
|
32449
|
-
const [hiddenRow, setHiddenRow] = createSignal(false);
|
|
32450
|
-
const [columnWidth, setColumnWidth] = createSignal("");
|
|
32451
|
-
const [cellWidth, setCellWidth] = createSignal("");
|
|
32452
|
-
const [cellVerticalAlign, setCellVerticalAlign] = createSignal("");
|
|
32453
|
-
const [cellTextDirection, setCellTextDirection] = createSignal("");
|
|
32454
|
-
const [cellNoWrap, setCellNoWrap] = createSignal(false);
|
|
32455
|
-
const [cellFitText, setCellFitText] = createSignal(false);
|
|
32456
|
-
const [cellHideMark, setCellHideMark] = createSignal(false);
|
|
32457
|
-
const [marginTop, setMarginTop] = createSignal("");
|
|
32458
|
-
const [marginRight, setMarginRight] = createSignal("");
|
|
32459
|
-
const [marginBottom, setMarginBottom] = createSignal("");
|
|
32460
|
-
const [marginLeft, setMarginLeft] = createSignal("");
|
|
32461
|
-
const [borderStyle, setBorderStyle] = createSignal("none");
|
|
32462
|
-
const [borderWidth, setBorderWidth] = createSignal("");
|
|
32463
|
-
const [borderColor, setBorderColor] = createSignal("");
|
|
32464
|
-
const [borderTop, setBorderTop] = createSignal(false);
|
|
32465
|
-
const [borderRight, setBorderRight] = createSignal(false);
|
|
32466
|
-
const [borderBottom, setBorderBottom] = createSignal(false);
|
|
32467
|
-
const [borderLeft, setBorderLeft] = createSignal(false);
|
|
32468
|
-
const [borderStart, setBorderStart] = createSignal(false);
|
|
32469
|
-
const [borderEnd, setBorderEnd] = createSignal(false);
|
|
32470
|
-
const [borderTlBr, setBorderTlBr] = createSignal(false);
|
|
32471
|
-
const [borderTrBl, setBorderTrBl] = createSignal(false);
|
|
32472
|
-
const [shading, setShading] = createSignal("");
|
|
32473
|
-
const [altTitle, setAltTitle] = createSignal("");
|
|
32474
|
-
const [altDescription, setAltDescription] = createSignal("");
|
|
32475
|
-
createEffect(() => {
|
|
32476
|
-
if (!props.isOpen) return;
|
|
32477
|
-
setActiveTab(props.initial.activeTab ?? "table");
|
|
32478
|
-
setTableWidth(props.initial.tableWidth);
|
|
32479
|
-
setTableWidthUnit(props.initial.tableWidthUnit);
|
|
32480
|
-
setTableAlign(props.initial.tableAlign);
|
|
32481
|
-
setTableIndentLeft(props.initial.tableIndentLeft);
|
|
32482
|
-
setTableWrapping(props.initial.tableWrapping);
|
|
32483
|
-
setFloatingHorizontalAnchor(props.initial.floatingHorizontalAnchor);
|
|
32484
|
-
setFloatingVerticalAnchor(props.initial.floatingVerticalAnchor);
|
|
32485
|
-
setFloatingX(props.initial.floatingX);
|
|
32486
|
-
setFloatingY(props.initial.floatingY);
|
|
32487
|
-
setFloatingXAlign(props.initial.floatingXAlign);
|
|
32488
|
-
setFloatingYAlign(props.initial.floatingYAlign);
|
|
32489
|
-
setFloatingDistanceTop(props.initial.floatingDistanceTop);
|
|
32490
|
-
setFloatingDistanceRight(props.initial.floatingDistanceRight);
|
|
32491
|
-
setFloatingDistanceBottom(props.initial.floatingDistanceBottom);
|
|
32492
|
-
setFloatingDistanceLeft(props.initial.floatingDistanceLeft);
|
|
32493
|
-
setFloatingOverlap(props.initial.floatingOverlap);
|
|
32494
|
-
setRowHeight(props.initial.rowHeight);
|
|
32495
|
-
setRowHeightRule(props.initial.rowHeightRule);
|
|
32496
|
-
setRepeatHeader(props.initial.repeatHeader);
|
|
32497
|
-
setAllowBreakAcrossPages(props.initial.allowBreakAcrossPages);
|
|
32498
|
-
setHiddenRow(props.initial.hiddenRow);
|
|
32499
|
-
setColumnWidth(props.initial.columnWidth);
|
|
32500
|
-
setCellWidth(props.initial.cellWidth);
|
|
32501
|
-
setCellVerticalAlign(props.initial.cellVerticalAlign);
|
|
32502
|
-
setCellTextDirection(props.initial.cellTextDirection);
|
|
32503
|
-
setCellNoWrap(props.initial.cellNoWrap);
|
|
32504
|
-
setCellFitText(props.initial.cellFitText);
|
|
32505
|
-
setCellHideMark(props.initial.cellHideMark);
|
|
32506
|
-
setMarginTop(props.initial.marginTop);
|
|
32507
|
-
setMarginRight(props.initial.marginRight);
|
|
32508
|
-
setMarginBottom(props.initial.marginBottom);
|
|
32509
|
-
setMarginLeft(props.initial.marginLeft);
|
|
32510
|
-
setBorderStyle(props.initial.borderStyle);
|
|
32511
|
-
setBorderWidth(props.initial.borderWidth);
|
|
32512
|
-
setBorderColor(props.initial.borderColor);
|
|
32513
|
-
setBorderTop(props.initial.borderTop);
|
|
32514
|
-
setBorderRight(props.initial.borderRight);
|
|
32515
|
-
setBorderBottom(props.initial.borderBottom);
|
|
32516
|
-
setBorderLeft(props.initial.borderLeft);
|
|
32517
|
-
setBorderStart(props.initial.borderStart);
|
|
32518
|
-
setBorderEnd(props.initial.borderEnd);
|
|
32519
|
-
setBorderTlBr(props.initial.borderTopLeftToBottomRight);
|
|
32520
|
-
setBorderTrBl(props.initial.borderTopRightToBottomLeft);
|
|
32521
|
-
setShading(props.initial.shading);
|
|
32522
|
-
setAltTitle(props.initial.altTitle);
|
|
32523
|
-
setAltDescription(props.initial.altDescription);
|
|
32524
|
-
});
|
|
32525
32584
|
const borderPreview = createMemo(() => {
|
|
32526
|
-
const border = resolveBorder(borderStyle
|
|
32585
|
+
const border = resolveBorder(p.form.borderStyle, p.form.borderWidth, p.form.borderColor);
|
|
32527
32586
|
const css = border ? `${border.width}pt ${border.type} ${border.color}` : void 0;
|
|
32528
32587
|
return {
|
|
32529
|
-
"background-color": shading
|
|
32530
|
-
"border-top": css && borderTop
|
|
32531
|
-
"border-right": css && borderRight
|
|
32532
|
-
"border-bottom": css && borderBottom
|
|
32533
|
-
"border-left": css && borderLeft
|
|
32588
|
+
"background-color": p.form.shading.trim() || void 0,
|
|
32589
|
+
"border-top": css && p.form.borderTop ? css : "1px solid #dadce0",
|
|
32590
|
+
"border-right": css && p.form.borderRight ? css : "1px solid #dadce0",
|
|
32591
|
+
"border-bottom": css && p.form.borderBottom ? css : "1px solid #dadce0",
|
|
32592
|
+
"border-left": css && p.form.borderLeft ? css : "1px solid #dadce0"
|
|
32534
32593
|
};
|
|
32535
32594
|
});
|
|
32595
|
+
return (() => {
|
|
32596
|
+
var _el$58 = _tmpl$1(), _el$59 = _el$58.firstChild, _el$60 = _el$59.firstChild, _el$61 = _el$60.firstChild, _el$62 = _el$61.nextSibling, _el$63 = _el$62.firstChild, _el$64 = _el$63.nextSibling, _el$65 = _el$64.nextSibling, _el$66 = _el$65.nextSibling, _el$67 = _el$60.nextSibling, _el$68 = _el$67.firstChild, _el$69 = _el$68.nextSibling, _el$70 = _el$69.firstChild, _el$71 = _el$59.nextSibling, _el$72 = _el$71.firstChild, _el$73 = _el$72.nextSibling, _el$74 = _el$71.nextSibling, _el$75 = _el$74.firstChild, _el$76 = _el$75.nextSibling, _el$77 = _el$74.nextSibling, _el$78 = _el$77.firstChild, _el$79 = _el$78.nextSibling, _el$80 = _el$79.firstChild, _el$81 = _el$80.firstChild, _el$82 = _el$81.nextSibling, _el$83 = _el$82.firstChild, _el$84 = _el$83.nextSibling, _el$85 = _el$84.nextSibling, _el$86 = _el$85.nextSibling, _el$87 = _el$80.nextSibling, _el$88 = _el$87.firstChild, _el$89 = _el$88.nextSibling, _el$90 = _el$87.nextSibling, _el$91 = _el$90.firstChild, _el$92 = _el$91.nextSibling, _el$93 = _el$79.nextSibling, _el$94 = _el$93.nextSibling;
|
|
32597
|
+
insert(_el$59, () => numericInput(t("table.cellWidth"), () => p.form.cellWidth, (v) => p.set("cellWidth", v), "editor-table-properties-cell-width"), _el$60);
|
|
32598
|
+
insert(_el$61, () => t("table.verticalAlignment"));
|
|
32599
|
+
_el$62.addEventListener("change", (e) => p.set("cellVerticalAlign", e.currentTarget.value));
|
|
32600
|
+
insert(_el$63, () => t("table.inherit"));
|
|
32601
|
+
insert(_el$64, () => t("table.valignTop"));
|
|
32602
|
+
insert(_el$65, () => t("table.valignMiddle"));
|
|
32603
|
+
insert(_el$66, () => t("table.valignBottom"));
|
|
32604
|
+
insert(_el$68, () => t("table.textDirection"));
|
|
32605
|
+
_el$69.addEventListener("change", (e) => p.set("cellTextDirection", e.currentTarget.value));
|
|
32606
|
+
insert(_el$70, () => t("table.inherit"));
|
|
32607
|
+
insert(_el$72, () => t("table.options"));
|
|
32608
|
+
insert(_el$73, () => checkbox(t("table.noWrap"), () => p.form.cellNoWrap, (v) => p.set("cellNoWrap", v), "editor-table-properties-cell-nowrap"), null);
|
|
32609
|
+
insert(_el$73, () => checkbox(t("table.fitText"), () => p.form.cellFitText, (v) => p.set("cellFitText", v), "editor-table-properties-cell-fit-text"), null);
|
|
32610
|
+
insert(_el$73, () => checkbox(t("table.hideMark"), () => p.form.cellHideMark, (v) => p.set("cellHideMark", v), "editor-table-properties-cell-hide-mark"), null);
|
|
32611
|
+
insert(_el$75, () => t("table.cellMargins"));
|
|
32612
|
+
insert(_el$76, () => numericInput(t("paragraph.borderSideTop"), () => p.form.marginTop, (v) => p.set("marginTop", v), "editor-table-properties-margin-top"), null);
|
|
32613
|
+
insert(_el$76, () => numericInput(t("paragraph.borderSideRight"), () => p.form.marginRight, (v) => p.set("marginRight", v), "editor-table-properties-margin-right"), null);
|
|
32614
|
+
insert(_el$76, () => numericInput(t("paragraph.borderSideBottom"), () => p.form.marginBottom, (v) => p.set("marginBottom", v), "editor-table-properties-margin-bottom"), null);
|
|
32615
|
+
insert(_el$76, () => numericInput(t("paragraph.borderSideLeft"), () => p.form.marginLeft, (v) => p.set("marginLeft", v), "editor-table-properties-margin-left"), null);
|
|
32616
|
+
insert(_el$78, () => t("paragraph.bordersSection"));
|
|
32617
|
+
insert(_el$81, () => t("paragraph.borderStyleLabel"));
|
|
32618
|
+
_el$82.addEventListener("change", (e) => {
|
|
32619
|
+
const next = e.currentTarget.value;
|
|
32620
|
+
p.set("borderStyle", next);
|
|
32621
|
+
if (next === "none") {
|
|
32622
|
+
p.set("borderTop", false);
|
|
32623
|
+
p.set("borderRight", false);
|
|
32624
|
+
p.set("borderBottom", false);
|
|
32625
|
+
p.set("borderLeft", false);
|
|
32626
|
+
p.set("borderStart", false);
|
|
32627
|
+
p.set("borderEnd", false);
|
|
32628
|
+
p.set("borderTlBr", false);
|
|
32629
|
+
p.set("borderTrBl", false);
|
|
32630
|
+
} else if (!p.form.borderTop && !p.form.borderRight && !p.form.borderBottom && !p.form.borderLeft) {
|
|
32631
|
+
p.set("borderTop", true);
|
|
32632
|
+
p.set("borderRight", true);
|
|
32633
|
+
p.set("borderBottom", true);
|
|
32634
|
+
p.set("borderLeft", true);
|
|
32635
|
+
}
|
|
32636
|
+
});
|
|
32637
|
+
insert(_el$83, () => t("paragraph.borderNone"));
|
|
32638
|
+
insert(_el$84, () => t("paragraph.borderSolid"));
|
|
32639
|
+
insert(_el$85, () => t("paragraph.borderDashed"));
|
|
32640
|
+
insert(_el$86, () => t("paragraph.borderDotted"));
|
|
32641
|
+
insert(_el$79, () => numericInput(t("paragraph.borderWidthLabel"), () => p.form.borderWidth, (v) => p.set("borderWidth", v), "editor-table-properties-border-width", p.form.borderStyle === "none"), _el$87);
|
|
32642
|
+
insert(_el$88, () => t("paragraph.borderColorLabel"));
|
|
32643
|
+
_el$89.$$input = (e) => p.set("borderColor", e.currentTarget.value);
|
|
32644
|
+
insert(_el$91, () => t("paragraph.shadingLabel"));
|
|
32645
|
+
_el$92.$$input = (e) => p.set("shading", e.currentTarget.value);
|
|
32646
|
+
insert(_el$93, () => checkbox(t("paragraph.borderSideTop"), () => p.form.borderTop, (v) => p.set("borderTop", v), "editor-table-properties-border-top", p.form.borderStyle === "none"), null);
|
|
32647
|
+
insert(_el$93, () => checkbox(t("paragraph.borderSideRight"), () => p.form.borderRight, (v) => p.set("borderRight", v), "editor-table-properties-border-right", p.form.borderStyle === "none"), null);
|
|
32648
|
+
insert(_el$93, () => checkbox(t("paragraph.borderSideBottom"), () => p.form.borderBottom, (v) => p.set("borderBottom", v), "editor-table-properties-border-bottom", p.form.borderStyle === "none"), null);
|
|
32649
|
+
insert(_el$93, () => checkbox(t("paragraph.borderSideLeft"), () => p.form.borderLeft, (v) => p.set("borderLeft", v), "editor-table-properties-border-left", p.form.borderStyle === "none"), null);
|
|
32650
|
+
insert(_el$93, () => checkbox(t("table.borderStart"), () => p.form.borderStart, (v) => p.set("borderStart", v), "editor-table-properties-border-start", p.form.borderStyle === "none"), null);
|
|
32651
|
+
insert(_el$93, () => checkbox(t("table.borderEnd"), () => p.form.borderEnd, (v) => p.set("borderEnd", v), "editor-table-properties-border-end", p.form.borderStyle === "none"), null);
|
|
32652
|
+
insert(_el$93, () => checkbox(t("table.borderTlBr"), () => p.form.borderTlBr, (v) => p.set("borderTlBr", v), "editor-table-properties-border-tlbr", p.form.borderStyle === "none"), null);
|
|
32653
|
+
insert(_el$93, () => checkbox(t("table.borderTrBl"), () => p.form.borderTrBl, (v) => p.set("borderTrBl", v), "editor-table-properties-border-trbl", p.form.borderStyle === "none"), null);
|
|
32654
|
+
createRenderEffect((_p$) => {
|
|
32655
|
+
var _v$ = p.form.borderStyle === "none", _v$2 = borderPreview();
|
|
32656
|
+
_v$ !== _p$.e && (_el$89.disabled = _p$.e = _v$);
|
|
32657
|
+
_p$.t = style(_el$94, _v$2, _p$.t);
|
|
32658
|
+
return _p$;
|
|
32659
|
+
}, {
|
|
32660
|
+
e: void 0,
|
|
32661
|
+
t: void 0
|
|
32662
|
+
});
|
|
32663
|
+
createRenderEffect(() => _el$62.value = p.form.cellVerticalAlign);
|
|
32664
|
+
createRenderEffect(() => _el$69.value = p.form.cellTextDirection);
|
|
32665
|
+
createRenderEffect(() => _el$82.value = p.form.borderStyle);
|
|
32666
|
+
createRenderEffect(() => _el$89.value = p.form.borderColor || DEFAULT_BORDER_COLOR);
|
|
32667
|
+
createRenderEffect(() => _el$92.value = p.form.shading || "#ffffff");
|
|
32668
|
+
return _el$58;
|
|
32669
|
+
})();
|
|
32670
|
+
}
|
|
32671
|
+
function AltTextTabPanel(p) {
|
|
32672
|
+
const t = useI18n();
|
|
32673
|
+
return (() => {
|
|
32674
|
+
var _el$95 = _tmpl$10(), _el$96 = _el$95.firstChild, _el$97 = _el$96.firstChild, _el$98 = _el$97.nextSibling, _el$99 = _el$96.nextSibling, _el$100 = _el$99.firstChild, _el$101 = _el$100.nextSibling;
|
|
32675
|
+
insert(_el$97, () => t("table.altTitle"));
|
|
32676
|
+
_el$98.$$input = (e) => p.set("altTitle", e.currentTarget.value);
|
|
32677
|
+
insert(_el$100, () => t("table.altDescription"));
|
|
32678
|
+
_el$101.$$input = (e) => p.set("altDescription", e.currentTarget.value);
|
|
32679
|
+
createRenderEffect(() => _el$98.value = p.form.altTitle);
|
|
32680
|
+
createRenderEffect(() => _el$101.value = p.form.altDescription);
|
|
32681
|
+
return _el$95;
|
|
32682
|
+
})();
|
|
32683
|
+
}
|
|
32684
|
+
function TablePropertiesDialog(props) {
|
|
32685
|
+
const t = useI18n();
|
|
32686
|
+
const [form, setForm] = createStore({
|
|
32687
|
+
activeTab: "table",
|
|
32688
|
+
tableWidth: "",
|
|
32689
|
+
tableWidthUnit: "points",
|
|
32690
|
+
tableAlign: "",
|
|
32691
|
+
tableIndentLeft: "",
|
|
32692
|
+
tableWrapping: "none",
|
|
32693
|
+
floatingHorizontalAnchor: "margin",
|
|
32694
|
+
floatingVerticalAnchor: "text",
|
|
32695
|
+
floatingX: "",
|
|
32696
|
+
floatingY: "",
|
|
32697
|
+
floatingXAlign: "",
|
|
32698
|
+
floatingYAlign: "",
|
|
32699
|
+
floatingDistanceTop: "",
|
|
32700
|
+
floatingDistanceRight: "",
|
|
32701
|
+
floatingDistanceBottom: "",
|
|
32702
|
+
floatingDistanceLeft: "",
|
|
32703
|
+
floatingOverlap: "overlap",
|
|
32704
|
+
rowHeight: "",
|
|
32705
|
+
rowHeightRule: "",
|
|
32706
|
+
repeatHeader: false,
|
|
32707
|
+
allowBreakAcrossPages: true,
|
|
32708
|
+
hiddenRow: false,
|
|
32709
|
+
columnWidth: "",
|
|
32710
|
+
cellWidth: "",
|
|
32711
|
+
cellVerticalAlign: "",
|
|
32712
|
+
cellTextDirection: "",
|
|
32713
|
+
cellNoWrap: false,
|
|
32714
|
+
cellFitText: false,
|
|
32715
|
+
cellHideMark: false,
|
|
32716
|
+
marginTop: "",
|
|
32717
|
+
marginRight: "",
|
|
32718
|
+
marginBottom: "",
|
|
32719
|
+
marginLeft: "",
|
|
32720
|
+
borderStyle: "none",
|
|
32721
|
+
borderWidth: "",
|
|
32722
|
+
borderColor: "",
|
|
32723
|
+
borderTop: false,
|
|
32724
|
+
borderRight: false,
|
|
32725
|
+
borderBottom: false,
|
|
32726
|
+
borderLeft: false,
|
|
32727
|
+
borderStart: false,
|
|
32728
|
+
borderEnd: false,
|
|
32729
|
+
borderTlBr: false,
|
|
32730
|
+
borderTrBl: false,
|
|
32731
|
+
shading: "",
|
|
32732
|
+
altTitle: "",
|
|
32733
|
+
altDescription: ""
|
|
32734
|
+
});
|
|
32735
|
+
createEffect(() => {
|
|
32736
|
+
if (!props.isOpen) return;
|
|
32737
|
+
setForm(reconcile({
|
|
32738
|
+
activeTab: props.initial.activeTab ?? "table",
|
|
32739
|
+
tableWidth: props.initial.tableWidth,
|
|
32740
|
+
tableWidthUnit: props.initial.tableWidthUnit,
|
|
32741
|
+
tableAlign: props.initial.tableAlign,
|
|
32742
|
+
tableIndentLeft: props.initial.tableIndentLeft,
|
|
32743
|
+
tableWrapping: props.initial.tableWrapping,
|
|
32744
|
+
floatingHorizontalAnchor: props.initial.floatingHorizontalAnchor,
|
|
32745
|
+
floatingVerticalAnchor: props.initial.floatingVerticalAnchor,
|
|
32746
|
+
floatingX: props.initial.floatingX,
|
|
32747
|
+
floatingY: props.initial.floatingY,
|
|
32748
|
+
floatingXAlign: props.initial.floatingXAlign,
|
|
32749
|
+
floatingYAlign: props.initial.floatingYAlign,
|
|
32750
|
+
floatingDistanceTop: props.initial.floatingDistanceTop,
|
|
32751
|
+
floatingDistanceRight: props.initial.floatingDistanceRight,
|
|
32752
|
+
floatingDistanceBottom: props.initial.floatingDistanceBottom,
|
|
32753
|
+
floatingDistanceLeft: props.initial.floatingDistanceLeft,
|
|
32754
|
+
floatingOverlap: props.initial.floatingOverlap,
|
|
32755
|
+
rowHeight: props.initial.rowHeight,
|
|
32756
|
+
rowHeightRule: props.initial.rowHeightRule,
|
|
32757
|
+
repeatHeader: props.initial.repeatHeader,
|
|
32758
|
+
allowBreakAcrossPages: props.initial.allowBreakAcrossPages,
|
|
32759
|
+
hiddenRow: props.initial.hiddenRow,
|
|
32760
|
+
columnWidth: props.initial.columnWidth,
|
|
32761
|
+
cellWidth: props.initial.cellWidth,
|
|
32762
|
+
cellVerticalAlign: props.initial.cellVerticalAlign,
|
|
32763
|
+
cellTextDirection: props.initial.cellTextDirection,
|
|
32764
|
+
cellNoWrap: props.initial.cellNoWrap,
|
|
32765
|
+
cellFitText: props.initial.cellFitText,
|
|
32766
|
+
cellHideMark: props.initial.cellHideMark,
|
|
32767
|
+
marginTop: props.initial.marginTop,
|
|
32768
|
+
marginRight: props.initial.marginRight,
|
|
32769
|
+
marginBottom: props.initial.marginBottom,
|
|
32770
|
+
marginLeft: props.initial.marginLeft,
|
|
32771
|
+
borderStyle: props.initial.borderStyle,
|
|
32772
|
+
borderWidth: props.initial.borderWidth,
|
|
32773
|
+
borderColor: props.initial.borderColor,
|
|
32774
|
+
borderTop: props.initial.borderTop,
|
|
32775
|
+
borderRight: props.initial.borderRight,
|
|
32776
|
+
borderBottom: props.initial.borderBottom,
|
|
32777
|
+
borderLeft: props.initial.borderLeft,
|
|
32778
|
+
borderStart: props.initial.borderStart,
|
|
32779
|
+
borderEnd: props.initial.borderEnd,
|
|
32780
|
+
borderTlBr: props.initial.borderTopLeftToBottomRight,
|
|
32781
|
+
borderTrBl: props.initial.borderTopRightToBottomLeft,
|
|
32782
|
+
shading: props.initial.shading,
|
|
32783
|
+
altTitle: props.initial.altTitle,
|
|
32784
|
+
altDescription: props.initial.altDescription
|
|
32785
|
+
}));
|
|
32786
|
+
});
|
|
32536
32787
|
const handleApply = () => {
|
|
32537
|
-
const border = resolveBorder(borderStyle
|
|
32788
|
+
const border = resolveBorder(form.borderStyle, form.borderWidth, form.borderColor);
|
|
32538
32789
|
props.onApply({
|
|
32539
|
-
tableWidth: parseWidth(tableWidth
|
|
32540
|
-
tableAlign: tableAlign
|
|
32541
|
-
tableIndentLeft: parseWidth(tableIndentLeft
|
|
32542
|
-
tableFloating: tableWrapping
|
|
32543
|
-
horizontalAnchor: floatingHorizontalAnchor
|
|
32544
|
-
verticalAnchor: floatingVerticalAnchor
|
|
32545
|
-
...floatingXAlign
|
|
32546
|
-
xAlign: floatingXAlign
|
|
32790
|
+
tableWidth: parseWidth(form.tableWidth, form.tableWidthUnit),
|
|
32791
|
+
tableAlign: form.tableAlign || null,
|
|
32792
|
+
tableIndentLeft: parseWidth(form.tableIndentLeft, "points"),
|
|
32793
|
+
tableFloating: form.tableWrapping === "around" ? {
|
|
32794
|
+
horizontalAnchor: form.floatingHorizontalAnchor,
|
|
32795
|
+
verticalAnchor: form.floatingVerticalAnchor,
|
|
32796
|
+
...form.floatingXAlign ? {
|
|
32797
|
+
xAlign: form.floatingXAlign
|
|
32547
32798
|
} : {
|
|
32548
|
-
x: parseNumber(floatingX
|
|
32799
|
+
x: parseNumber(form.floatingX) ?? 0
|
|
32549
32800
|
},
|
|
32550
|
-
...floatingYAlign
|
|
32551
|
-
yAlign: floatingYAlign
|
|
32801
|
+
...form.floatingYAlign ? {
|
|
32802
|
+
yAlign: form.floatingYAlign
|
|
32552
32803
|
} : {
|
|
32553
|
-
y: parseNumber(floatingY
|
|
32804
|
+
y: parseNumber(form.floatingY) ?? 0
|
|
32554
32805
|
},
|
|
32555
|
-
distanceTop: parseNumber(floatingDistanceTop
|
|
32556
|
-
distanceRight: parseNumber(floatingDistanceRight
|
|
32557
|
-
distanceBottom: parseNumber(floatingDistanceBottom
|
|
32558
|
-
distanceLeft: parseNumber(floatingDistanceLeft
|
|
32806
|
+
distanceTop: parseNumber(form.floatingDistanceTop) ?? 0,
|
|
32807
|
+
distanceRight: parseNumber(form.floatingDistanceRight) ?? 0,
|
|
32808
|
+
distanceBottom: parseNumber(form.floatingDistanceBottom) ?? 0,
|
|
32809
|
+
distanceLeft: parseNumber(form.floatingDistanceLeft) ?? 0
|
|
32559
32810
|
} : null,
|
|
32560
|
-
tableOverlap: tableWrapping
|
|
32561
|
-
rowHeight: parseWidth(rowHeight
|
|
32562
|
-
rowHeightRule: rowHeightRule
|
|
32563
|
-
repeatHeader: repeatHeader
|
|
32564
|
-
cantSplit: !allowBreakAcrossPages
|
|
32565
|
-
hiddenRow: hiddenRow
|
|
32566
|
-
columnWidth: parseWidth(columnWidth
|
|
32567
|
-
cellWidth: parseWidth(cellWidth
|
|
32568
|
-
cellVerticalAlign: cellVerticalAlign
|
|
32569
|
-
cellTextDirection: cellTextDirection
|
|
32570
|
-
cellNoWrap: cellNoWrap
|
|
32571
|
-
cellFitText: cellFitText
|
|
32572
|
-
cellHideMark: cellHideMark
|
|
32811
|
+
tableOverlap: form.tableWrapping === "around" ? form.floatingOverlap : null,
|
|
32812
|
+
rowHeight: parseWidth(form.rowHeight, "points"),
|
|
32813
|
+
rowHeightRule: form.rowHeightRule || null,
|
|
32814
|
+
repeatHeader: form.repeatHeader,
|
|
32815
|
+
cantSplit: !form.allowBreakAcrossPages,
|
|
32816
|
+
hiddenRow: form.hiddenRow,
|
|
32817
|
+
columnWidth: parseWidth(form.columnWidth, "points"),
|
|
32818
|
+
cellWidth: parseWidth(form.cellWidth, "points"),
|
|
32819
|
+
cellVerticalAlign: form.cellVerticalAlign || null,
|
|
32820
|
+
cellTextDirection: form.cellTextDirection || null,
|
|
32821
|
+
cellNoWrap: form.cellNoWrap,
|
|
32822
|
+
cellFitText: form.cellFitText,
|
|
32823
|
+
cellHideMark: form.cellHideMark,
|
|
32573
32824
|
margins: {
|
|
32574
|
-
top: parseNumber(marginTop
|
|
32575
|
-
right: parseNumber(marginRight
|
|
32576
|
-
bottom: parseNumber(marginBottom
|
|
32577
|
-
left: parseNumber(marginLeft
|
|
32825
|
+
top: parseNumber(form.marginTop),
|
|
32826
|
+
right: parseNumber(form.marginRight),
|
|
32827
|
+
bottom: parseNumber(form.marginBottom),
|
|
32828
|
+
left: parseNumber(form.marginLeft)
|
|
32578
32829
|
},
|
|
32579
32830
|
borders: {
|
|
32580
|
-
top: borderTop
|
|
32581
|
-
right: borderRight
|
|
32582
|
-
bottom: borderBottom
|
|
32583
|
-
left: borderLeft
|
|
32584
|
-
start: borderStart
|
|
32585
|
-
end: borderEnd
|
|
32586
|
-
topLeftToBottomRight: borderTlBr
|
|
32587
|
-
topRightToBottomLeft: borderTrBl
|
|
32831
|
+
top: form.borderTop ? border : null,
|
|
32832
|
+
right: form.borderRight ? border : null,
|
|
32833
|
+
bottom: form.borderBottom ? border : null,
|
|
32834
|
+
left: form.borderLeft ? border : null,
|
|
32835
|
+
start: form.borderStart ? border : null,
|
|
32836
|
+
end: form.borderEnd ? border : null,
|
|
32837
|
+
topLeftToBottomRight: form.borderTlBr ? border : null,
|
|
32838
|
+
topRightToBottomLeft: form.borderTrBl ? border : null
|
|
32588
32839
|
},
|
|
32589
|
-
shading: shading
|
|
32590
|
-
altTitle: altTitle
|
|
32591
|
-
altDescription: altDescription
|
|
32840
|
+
shading: form.shading.trim() || null,
|
|
32841
|
+
altTitle: form.altTitle.trim() || null,
|
|
32842
|
+
altDescription: form.altDescription.trim() || null
|
|
32592
32843
|
}, props.initial);
|
|
32593
32844
|
props.onClose();
|
|
32594
32845
|
};
|
|
32595
|
-
const numericInput = (label, value, setter, testId, disabled = false, allowNegative = false) => (() => {
|
|
32596
|
-
var _el$ = _tmpl$$5(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
|
|
32597
|
-
insert(_el$2, label);
|
|
32598
|
-
_el$3.$$input = (e) => setter(e.currentTarget.value);
|
|
32599
|
-
setAttribute(_el$3, "min", allowNegative ? void 0 : "0");
|
|
32600
|
-
_el$3.disabled = disabled;
|
|
32601
|
-
setAttribute(_el$3, "data-testid", testId);
|
|
32602
|
-
createRenderEffect(() => _el$3.value = value());
|
|
32603
|
-
return _el$;
|
|
32604
|
-
})();
|
|
32605
|
-
const checkbox = (label, checked, setter, testId, disabled = false) => (() => {
|
|
32606
|
-
var _el$4 = _tmpl$2$1(), _el$5 = _el$4.firstChild;
|
|
32607
|
-
_el$5.addEventListener("change", (e) => setter(e.currentTarget.checked));
|
|
32608
|
-
_el$5.disabled = disabled;
|
|
32609
|
-
setAttribute(_el$5, "data-testid", testId);
|
|
32610
|
-
insert(_el$4, label, null);
|
|
32611
|
-
createRenderEffect(() => _el$5.checked = checked());
|
|
32612
|
-
return _el$4;
|
|
32613
|
-
})();
|
|
32614
32846
|
return createComponent(Dialog, {
|
|
32615
32847
|
get isOpen() {
|
|
32616
32848
|
return props.isOpen;
|
|
@@ -32625,24 +32857,27 @@ function TablePropertiesDialog(props) {
|
|
|
32625
32857
|
"class": "oasis-editor-table-properties-dialog",
|
|
32626
32858
|
bodyClass: "oasis-editor-table-properties-body",
|
|
32627
32859
|
get footer() {
|
|
32628
|
-
return
|
|
32629
|
-
|
|
32630
|
-
|
|
32631
|
-
|
|
32632
|
-
|
|
32633
|
-
|
|
32634
|
-
|
|
32635
|
-
|
|
32636
|
-
|
|
32637
|
-
|
|
32638
|
-
|
|
32860
|
+
return createComponent(DialogFooter, {
|
|
32861
|
+
get onCancel() {
|
|
32862
|
+
return props.onClose;
|
|
32863
|
+
},
|
|
32864
|
+
onConfirm: handleApply,
|
|
32865
|
+
get cancelLabel() {
|
|
32866
|
+
return t("generic.cancel");
|
|
32867
|
+
},
|
|
32868
|
+
get confirmLabel() {
|
|
32869
|
+
return t("generic.ok");
|
|
32870
|
+
},
|
|
32871
|
+
cancelTestId: "editor-table-properties-cancel",
|
|
32872
|
+
confirmTestId: "editor-table-properties-apply"
|
|
32873
|
+
});
|
|
32639
32874
|
},
|
|
32640
32875
|
get children() {
|
|
32641
32876
|
return createComponent(Tabs, {
|
|
32642
32877
|
get value() {
|
|
32643
|
-
return activeTab
|
|
32878
|
+
return form.activeTab;
|
|
32644
32879
|
},
|
|
32645
|
-
onChange:
|
|
32880
|
+
onChange: (tab) => setForm("activeTab", tab),
|
|
32646
32881
|
get ariaLabel() {
|
|
32647
32882
|
return t("table.propertiesTitle");
|
|
32648
32883
|
},
|
|
@@ -32652,212 +32887,49 @@ function TablePropertiesDialog(props) {
|
|
|
32652
32887
|
id: "table",
|
|
32653
32888
|
label: t("table.tabTable"),
|
|
32654
32889
|
testId: "editor-table-properties-tab-table",
|
|
32655
|
-
panel: (
|
|
32656
|
-
|
|
32657
|
-
|
|
32658
|
-
|
|
32659
|
-
insert(_el$11, () => t("table.measureIn"));
|
|
32660
|
-
_el$12.addEventListener("change", (e) => setTableWidthUnit(e.currentTarget.value));
|
|
32661
|
-
insert(_el$13, () => t("table.points"));
|
|
32662
|
-
insert(_el$14, () => t("table.percent"));
|
|
32663
|
-
insert(_el$16, () => t("table.alignmentSection"));
|
|
32664
|
-
insert(_el$17, () => ["left", "center", "right"].map((align) => (() => {
|
|
32665
|
-
var _el$45 = _tmpl$9(), _el$46 = _el$45.firstChild;
|
|
32666
|
-
_el$46.addEventListener("change", () => setTableAlign(align));
|
|
32667
|
-
setAttribute(_el$46, "data-testid", `editor-table-properties-align-${align}`);
|
|
32668
|
-
insert(_el$45, () => t(`table.align${align[0].toUpperCase()}${align.slice(1)}`), null);
|
|
32669
|
-
createRenderEffect(() => _el$46.checked = tableAlign() === align);
|
|
32670
|
-
return _el$45;
|
|
32671
|
-
})()));
|
|
32672
|
-
insert(_el$18, () => numericInput(t("table.indentFromLeft"), tableIndentLeft, setTableIndentLeft, "editor-table-properties-indent-left"));
|
|
32673
|
-
insert(_el$20, () => t("table.textWrappingSection"));
|
|
32674
|
-
insert(_el$21, () => checkbox(t("table.wrapNone"), () => tableWrapping() === "none", () => setTableWrapping("none"), "editor-table-properties-wrap-none"), null);
|
|
32675
|
-
insert(_el$21, () => checkbox(t("table.wrapAround"), () => tableWrapping() === "around", () => setTableWrapping("around"), "editor-table-properties-wrap-around"), null);
|
|
32676
|
-
insert(_el$19, createComponent(Show, {
|
|
32677
|
-
get when() {
|
|
32678
|
-
return tableWrapping() === "around";
|
|
32679
|
-
},
|
|
32680
|
-
get children() {
|
|
32681
|
-
return [(() => {
|
|
32682
|
-
var _el$22 = _tmpl$5$1(), _el$23 = _el$22.firstChild, _el$24 = _el$23.firstChild, _el$25 = _el$24.nextSibling, _el$26 = _el$25.firstChild, _el$27 = _el$26.nextSibling, _el$28 = _el$27.nextSibling, _el$29 = _el$23.nextSibling, _el$30 = _el$29.firstChild, _el$31 = _el$30.nextSibling, _el$32 = _el$31.firstChild, _el$33 = _el$32.nextSibling, _el$34 = _el$33.nextSibling;
|
|
32683
|
-
insert(_el$24, () => t("table.horizontalAnchor"));
|
|
32684
|
-
_el$25.addEventListener("change", (e) => setFloatingHorizontalAnchor(e.currentTarget.value));
|
|
32685
|
-
insert(_el$26, () => t("table.anchorMargin"));
|
|
32686
|
-
insert(_el$27, () => t("table.anchorPage"));
|
|
32687
|
-
insert(_el$28, () => t("table.anchorText"));
|
|
32688
|
-
insert(_el$30, () => t("table.verticalAnchor"));
|
|
32689
|
-
_el$31.addEventListener("change", (e) => setFloatingVerticalAnchor(e.currentTarget.value));
|
|
32690
|
-
insert(_el$32, () => t("table.anchorMargin"));
|
|
32691
|
-
insert(_el$33, () => t("table.anchorPage"));
|
|
32692
|
-
insert(_el$34, () => t("table.anchorText"));
|
|
32693
|
-
createRenderEffect(() => _el$25.value = floatingHorizontalAnchor());
|
|
32694
|
-
createRenderEffect(() => _el$31.value = floatingVerticalAnchor());
|
|
32695
|
-
return _el$22;
|
|
32696
|
-
})(), (() => {
|
|
32697
|
-
var _el$35 = _tmpl$6$1(), _el$36 = _el$35.firstChild, _el$37 = _el$36.firstChild, _el$38 = _el$37.nextSibling, _el$39 = _el$38.firstChild, _el$40 = _el$36.nextSibling, _el$41 = _el$40.firstChild, _el$42 = _el$41.nextSibling, _el$43 = _el$42.firstChild;
|
|
32698
|
-
insert(_el$35, () => numericInput(t("table.positionX"), floatingX, setFloatingX, "editor-table-properties-floating-x", Boolean(floatingXAlign()), true), _el$36);
|
|
32699
|
-
insert(_el$35, () => numericInput(t("table.positionY"), floatingY, setFloatingY, "editor-table-properties-floating-y", Boolean(floatingYAlign()), true), _el$36);
|
|
32700
|
-
insert(_el$37, () => t("table.horizontalAlignment"));
|
|
32701
|
-
_el$38.addEventListener("change", (e) => setFloatingXAlign(e.currentTarget.value));
|
|
32702
|
-
insert(_el$39, () => t("table.explicitOffset"));
|
|
32703
|
-
insert(_el$38, () => ["left", "center", "right", "inside", "outside"].map((value) => (() => {
|
|
32704
|
-
var _el$47 = _tmpl$0();
|
|
32705
|
-
_el$47.value = value;
|
|
32706
|
-
insert(_el$47, value);
|
|
32707
|
-
return _el$47;
|
|
32708
|
-
})()), null);
|
|
32709
|
-
insert(_el$41, () => t("table.verticalAlignment"));
|
|
32710
|
-
_el$42.addEventListener("change", (e) => setFloatingYAlign(e.currentTarget.value));
|
|
32711
|
-
insert(_el$43, () => t("table.explicitOffset"));
|
|
32712
|
-
insert(_el$42, () => ["top", "center", "bottom", "inside", "outside"].map((value) => (() => {
|
|
32713
|
-
var _el$48 = _tmpl$0();
|
|
32714
|
-
_el$48.value = value;
|
|
32715
|
-
insert(_el$48, value);
|
|
32716
|
-
return _el$48;
|
|
32717
|
-
})()), null);
|
|
32718
|
-
createRenderEffect(() => _el$38.value = floatingXAlign());
|
|
32719
|
-
createRenderEffect(() => _el$42.value = floatingYAlign());
|
|
32720
|
-
return _el$35;
|
|
32721
|
-
})(), (() => {
|
|
32722
|
-
var _el$44 = _tmpl$7();
|
|
32723
|
-
insert(_el$44, () => numericInput(t("table.distanceTop"), floatingDistanceTop, setFloatingDistanceTop, "editor-table-properties-floating-distance-top"), null);
|
|
32724
|
-
insert(_el$44, () => numericInput(t("table.distanceRight"), floatingDistanceRight, setFloatingDistanceRight, "editor-table-properties-floating-distance-right"), null);
|
|
32725
|
-
insert(_el$44, () => numericInput(t("table.distanceBottom"), floatingDistanceBottom, setFloatingDistanceBottom, "editor-table-properties-floating-distance-bottom"), null);
|
|
32726
|
-
insert(_el$44, () => numericInput(t("table.distanceLeft"), floatingDistanceLeft, setFloatingDistanceLeft, "editor-table-properties-floating-distance-left"), null);
|
|
32727
|
-
return _el$44;
|
|
32728
|
-
})(), memo(() => checkbox(t("table.allowOverlap"), () => floatingOverlap() === "overlap", (value) => setFloatingOverlap(value ? "overlap" : "never"), "editor-table-properties-floating-overlap"))];
|
|
32729
|
-
}
|
|
32730
|
-
}), null);
|
|
32731
|
-
createRenderEffect(() => _el$12.value = tableWidthUnit());
|
|
32732
|
-
return _el$8;
|
|
32733
|
-
})()
|
|
32890
|
+
panel: createComponent(TableTabPanel, {
|
|
32891
|
+
form,
|
|
32892
|
+
set: setForm
|
|
32893
|
+
})
|
|
32734
32894
|
}, {
|
|
32735
32895
|
id: "row",
|
|
32736
32896
|
label: t("table.tabRow"),
|
|
32737
32897
|
testId: "editor-table-properties-tab-row",
|
|
32738
|
-
panel: (
|
|
32739
|
-
|
|
32740
|
-
|
|
32741
|
-
|
|
32742
|
-
_el$53.addEventListener("change", (e) => setRowHeightRule(e.currentTarget.value));
|
|
32743
|
-
insert(_el$54, () => t("table.rowAuto"));
|
|
32744
|
-
insert(_el$55, () => t("table.rowAtLeast"));
|
|
32745
|
-
insert(_el$56, () => t("table.rowExactly"));
|
|
32746
|
-
insert(_el$57, () => checkbox(t("table.repeatHeader"), repeatHeader, setRepeatHeader, "editor-table-properties-repeat-header"), null);
|
|
32747
|
-
insert(_el$57, () => checkbox(t("table.allowBreakAcrossPages"), allowBreakAcrossPages, setAllowBreakAcrossPages, "editor-table-properties-allow-break"), null);
|
|
32748
|
-
insert(_el$57, () => checkbox(t("table.hiddenRow"), hiddenRow, setHiddenRow, "editor-table-properties-hidden-row"), null);
|
|
32749
|
-
createRenderEffect(() => _el$53.value = rowHeightRule());
|
|
32750
|
-
return _el$49;
|
|
32751
|
-
})()
|
|
32898
|
+
panel: createComponent(RowTabPanel, {
|
|
32899
|
+
form,
|
|
32900
|
+
set: setForm
|
|
32901
|
+
})
|
|
32752
32902
|
}, {
|
|
32753
32903
|
id: "column",
|
|
32754
32904
|
label: t("table.tabColumn"),
|
|
32755
32905
|
testId: "editor-table-properties-tab-column",
|
|
32756
|
-
panel: (
|
|
32757
|
-
|
|
32758
|
-
|
|
32759
|
-
|
|
32760
|
-
})()
|
|
32906
|
+
panel: createComponent(ColumnTabPanel, {
|
|
32907
|
+
form,
|
|
32908
|
+
set: setForm
|
|
32909
|
+
})
|
|
32761
32910
|
}, {
|
|
32762
32911
|
id: "cell",
|
|
32763
32912
|
label: t("table.tabCell"),
|
|
32764
32913
|
testId: "editor-table-properties-tab-cell",
|
|
32765
|
-
panel: (
|
|
32766
|
-
|
|
32767
|
-
|
|
32768
|
-
|
|
32769
|
-
_el$64.addEventListener("change", (e) => setCellVerticalAlign(e.currentTarget.value));
|
|
32770
|
-
insert(_el$65, () => t("table.inherit"));
|
|
32771
|
-
insert(_el$66, () => t("table.valignTop"));
|
|
32772
|
-
insert(_el$67, () => t("table.valignMiddle"));
|
|
32773
|
-
insert(_el$68, () => t("table.valignBottom"));
|
|
32774
|
-
insert(_el$70, () => t("table.textDirection"));
|
|
32775
|
-
_el$71.addEventListener("change", (e) => setCellTextDirection(e.currentTarget.value));
|
|
32776
|
-
insert(_el$72, () => t("table.inherit"));
|
|
32777
|
-
insert(_el$74, () => t("table.options"));
|
|
32778
|
-
insert(_el$75, () => checkbox(t("table.noWrap"), cellNoWrap, setCellNoWrap, "editor-table-properties-cell-nowrap"), null);
|
|
32779
|
-
insert(_el$75, () => checkbox(t("table.fitText"), cellFitText, setCellFitText, "editor-table-properties-cell-fit-text"), null);
|
|
32780
|
-
insert(_el$75, () => checkbox(t("table.hideMark"), cellHideMark, setCellHideMark, "editor-table-properties-cell-hide-mark"), null);
|
|
32781
|
-
insert(_el$77, () => t("table.cellMargins"));
|
|
32782
|
-
insert(_el$78, () => numericInput(t("paragraph.borderSideTop"), marginTop, setMarginTop, "editor-table-properties-margin-top"), null);
|
|
32783
|
-
insert(_el$78, () => numericInput(t("paragraph.borderSideRight"), marginRight, setMarginRight, "editor-table-properties-margin-right"), null);
|
|
32784
|
-
insert(_el$78, () => numericInput(t("paragraph.borderSideBottom"), marginBottom, setMarginBottom, "editor-table-properties-margin-bottom"), null);
|
|
32785
|
-
insert(_el$78, () => numericInput(t("paragraph.borderSideLeft"), marginLeft, setMarginLeft, "editor-table-properties-margin-left"), null);
|
|
32786
|
-
insert(_el$80, () => t("paragraph.bordersSection"));
|
|
32787
|
-
insert(_el$83, () => t("paragraph.borderStyleLabel"));
|
|
32788
|
-
_el$84.addEventListener("change", (e) => {
|
|
32789
|
-
const next = e.currentTarget.value;
|
|
32790
|
-
setBorderStyle(next);
|
|
32791
|
-
if (next === "none") {
|
|
32792
|
-
setBorderTop(false);
|
|
32793
|
-
setBorderRight(false);
|
|
32794
|
-
setBorderBottom(false);
|
|
32795
|
-
setBorderLeft(false);
|
|
32796
|
-
setBorderStart(false);
|
|
32797
|
-
setBorderEnd(false);
|
|
32798
|
-
setBorderTlBr(false);
|
|
32799
|
-
setBorderTrBl(false);
|
|
32800
|
-
} else if (!borderTop() && !borderRight() && !borderBottom() && !borderLeft()) {
|
|
32801
|
-
setBorderTop(true);
|
|
32802
|
-
setBorderRight(true);
|
|
32803
|
-
setBorderBottom(true);
|
|
32804
|
-
setBorderLeft(true);
|
|
32805
|
-
}
|
|
32806
|
-
});
|
|
32807
|
-
insert(_el$85, () => t("paragraph.borderNone"));
|
|
32808
|
-
insert(_el$86, () => t("paragraph.borderSolid"));
|
|
32809
|
-
insert(_el$87, () => t("paragraph.borderDashed"));
|
|
32810
|
-
insert(_el$88, () => t("paragraph.borderDotted"));
|
|
32811
|
-
insert(_el$81, () => numericInput(t("paragraph.borderWidthLabel"), borderWidth, setBorderWidth, "editor-table-properties-border-width", borderStyle() === "none"), _el$89);
|
|
32812
|
-
insert(_el$90, () => t("paragraph.borderColorLabel"));
|
|
32813
|
-
_el$91.$$input = (e) => setBorderColor(e.currentTarget.value);
|
|
32814
|
-
insert(_el$93, () => t("paragraph.shadingLabel"));
|
|
32815
|
-
_el$94.$$input = (e) => setShading(e.currentTarget.value);
|
|
32816
|
-
insert(_el$95, () => checkbox(t("paragraph.borderSideTop"), borderTop, setBorderTop, "editor-table-properties-border-top", borderStyle() === "none"), null);
|
|
32817
|
-
insert(_el$95, () => checkbox(t("paragraph.borderSideRight"), borderRight, setBorderRight, "editor-table-properties-border-right", borderStyle() === "none"), null);
|
|
32818
|
-
insert(_el$95, () => checkbox(t("paragraph.borderSideBottom"), borderBottom, setBorderBottom, "editor-table-properties-border-bottom", borderStyle() === "none"), null);
|
|
32819
|
-
insert(_el$95, () => checkbox(t("paragraph.borderSideLeft"), borderLeft, setBorderLeft, "editor-table-properties-border-left", borderStyle() === "none"), null);
|
|
32820
|
-
insert(_el$95, () => checkbox(t("table.borderStart"), borderStart, setBorderStart, "editor-table-properties-border-start", borderStyle() === "none"), null);
|
|
32821
|
-
insert(_el$95, () => checkbox(t("table.borderEnd"), borderEnd, setBorderEnd, "editor-table-properties-border-end", borderStyle() === "none"), null);
|
|
32822
|
-
insert(_el$95, () => checkbox(t("table.borderTlBr"), borderTlBr, setBorderTlBr, "editor-table-properties-border-tlbr", borderStyle() === "none"), null);
|
|
32823
|
-
insert(_el$95, () => checkbox(t("table.borderTrBl"), borderTrBl, setBorderTrBl, "editor-table-properties-border-trbl", borderStyle() === "none"), null);
|
|
32824
|
-
createRenderEffect((_p$) => {
|
|
32825
|
-
var _v$ = borderStyle() === "none", _v$2 = borderPreview();
|
|
32826
|
-
_v$ !== _p$.e && (_el$91.disabled = _p$.e = _v$);
|
|
32827
|
-
_p$.t = style(_el$96, _v$2, _p$.t);
|
|
32828
|
-
return _p$;
|
|
32829
|
-
}, {
|
|
32830
|
-
e: void 0,
|
|
32831
|
-
t: void 0
|
|
32832
|
-
});
|
|
32833
|
-
createRenderEffect(() => _el$64.value = cellVerticalAlign());
|
|
32834
|
-
createRenderEffect(() => _el$71.value = cellTextDirection());
|
|
32835
|
-
createRenderEffect(() => _el$84.value = borderStyle());
|
|
32836
|
-
createRenderEffect(() => _el$91.value = borderColor() || DEFAULT_BORDER_COLOR);
|
|
32837
|
-
createRenderEffect(() => _el$94.value = shading() || "#ffffff");
|
|
32838
|
-
return _el$60;
|
|
32839
|
-
})()
|
|
32914
|
+
panel: createComponent(CellTabPanel, {
|
|
32915
|
+
form,
|
|
32916
|
+
set: setForm
|
|
32917
|
+
})
|
|
32840
32918
|
}, {
|
|
32841
32919
|
id: "altText",
|
|
32842
32920
|
label: t("table.tabAltText"),
|
|
32843
32921
|
testId: "editor-table-properties-tab-alt-text",
|
|
32844
|
-
panel: (
|
|
32845
|
-
|
|
32846
|
-
|
|
32847
|
-
|
|
32848
|
-
insert(_el$102, () => t("table.altDescription"));
|
|
32849
|
-
_el$103.$$input = (e) => setAltDescription(e.currentTarget.value);
|
|
32850
|
-
createRenderEffect(() => _el$100.value = altTitle());
|
|
32851
|
-
createRenderEffect(() => _el$103.value = altDescription());
|
|
32852
|
-
return _el$97;
|
|
32853
|
-
})()
|
|
32922
|
+
panel: createComponent(AltTextTabPanel, {
|
|
32923
|
+
form,
|
|
32924
|
+
set: setForm
|
|
32925
|
+
})
|
|
32854
32926
|
}];
|
|
32855
32927
|
}
|
|
32856
32928
|
});
|
|
32857
32929
|
}
|
|
32858
32930
|
});
|
|
32859
32931
|
}
|
|
32860
|
-
delegateEvents(["input"
|
|
32932
|
+
delegateEvents(["input"]);
|
|
32861
32933
|
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>`);
|
|
32862
32934
|
function FindReplaceDialog(props) {
|
|
32863
32935
|
const t = useI18n();
|
|
@@ -36158,6 +36230,16 @@ function buildPartContext(blocks, numberingContext, state, document2) {
|
|
|
36158
36230
|
hyperlinkMap
|
|
36159
36231
|
};
|
|
36160
36232
|
}
|
|
36233
|
+
function writeNotePart(zip, partName, part) {
|
|
36234
|
+
if (!part) return;
|
|
36235
|
+
zip.file(`word/${partName}.xml`, part.xml);
|
|
36236
|
+
if (part.partContext.images.length > 0 || part.partContext.hyperlinks.length > 0) {
|
|
36237
|
+
zip.file(
|
|
36238
|
+
`word/_rels/${partName}.xml.rels`,
|
|
36239
|
+
buildPartRelationshipsXml(part.partContext.images, part.partContext.hyperlinks)
|
|
36240
|
+
);
|
|
36241
|
+
}
|
|
36242
|
+
}
|
|
36161
36243
|
async function exportEditorDocumentToDocx(document2) {
|
|
36162
36244
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
36163
36245
|
document2 = renumberImageCaptionsInDocument(document2);
|
|
@@ -36175,18 +36257,23 @@ async function exportEditorDocumentToDocx(document2) {
|
|
|
36175
36257
|
const referencedEndnotes = collectReferencedEndnotesForExport(document2);
|
|
36176
36258
|
const endnoteIdMap = buildEndnoteIdMap(referencedEndnotes);
|
|
36177
36259
|
const hasEndnotes = referencedEndnotes.length > 0;
|
|
36178
|
-
const bodyContext = buildPartContext(
|
|
36179
|
-
sections.flatMap((section) => section.blocks),
|
|
36180
|
-
numberingContext,
|
|
36181
|
-
buildState,
|
|
36182
|
-
document2
|
|
36183
|
-
);
|
|
36184
|
-
bodyContext.footnoteIdMap = footnoteIdMap;
|
|
36185
|
-
bodyContext.endnoteIdMap = endnoteIdMap;
|
|
36186
36260
|
const bookmarkEvents = buildBookmarkExportPlan(document2);
|
|
36187
|
-
bodyContext.bookmarkEventsByParagraph = bookmarkEvents;
|
|
36188
36261
|
const commentPlan = buildCommentExportPlan(document2);
|
|
36189
|
-
|
|
36262
|
+
const annotateContext = (ctx) => {
|
|
36263
|
+
ctx.footnoteIdMap = footnoteIdMap;
|
|
36264
|
+
ctx.endnoteIdMap = endnoteIdMap;
|
|
36265
|
+
ctx.bookmarkEventsByParagraph = bookmarkEvents;
|
|
36266
|
+
ctx.commentEventsByParagraph = commentPlan == null ? void 0 : commentPlan.eventsByParagraph;
|
|
36267
|
+
return ctx;
|
|
36268
|
+
};
|
|
36269
|
+
const bodyContext = annotateContext(
|
|
36270
|
+
buildPartContext(
|
|
36271
|
+
sections.flatMap((section) => section.blocks),
|
|
36272
|
+
numberingContext,
|
|
36273
|
+
buildState,
|
|
36274
|
+
document2
|
|
36275
|
+
)
|
|
36276
|
+
);
|
|
36190
36277
|
const hasComments = commentPlan !== void 0;
|
|
36191
36278
|
const parts = [];
|
|
36192
36279
|
const sectionReferences = sections.map(
|
|
@@ -36204,16 +36291,9 @@ async function exportEditorDocumentToDocx(document2) {
|
|
|
36204
36291
|
const relPrefix = kind === "header" ? "Header" : "Footer";
|
|
36205
36292
|
const path = `${kind}${partIndex}.xml`;
|
|
36206
36293
|
const relId = `rId${relPrefix}${partIndex}`;
|
|
36207
|
-
const context =
|
|
36208
|
-
blocks,
|
|
36209
|
-
numberingContext,
|
|
36210
|
-
buildState,
|
|
36211
|
-
document2
|
|
36294
|
+
const context = annotateContext(
|
|
36295
|
+
buildPartContext(blocks, numberingContext, buildState, document2)
|
|
36212
36296
|
);
|
|
36213
|
-
context.footnoteIdMap = footnoteIdMap;
|
|
36214
|
-
context.endnoteIdMap = endnoteIdMap;
|
|
36215
|
-
context.bookmarkEventsByParagraph = bookmarkEvents;
|
|
36216
|
-
context.commentEventsByParagraph = commentPlan == null ? void 0 : commentPlan.eventsByParagraph;
|
|
36217
36297
|
parts.push({
|
|
36218
36298
|
kind,
|
|
36219
36299
|
type,
|
|
@@ -36362,30 +36442,8 @@ async function exportEditorDocumentToDocx(document2) {
|
|
|
36362
36442
|
);
|
|
36363
36443
|
}
|
|
36364
36444
|
}
|
|
36365
|
-
|
|
36366
|
-
|
|
36367
|
-
if (footnotesPart.partContext.images.length > 0 || footnotesPart.partContext.hyperlinks.length > 0) {
|
|
36368
|
-
zip.file(
|
|
36369
|
-
"word/_rels/footnotes.xml.rels",
|
|
36370
|
-
buildPartRelationshipsXml(
|
|
36371
|
-
footnotesPart.partContext.images,
|
|
36372
|
-
footnotesPart.partContext.hyperlinks
|
|
36373
|
-
)
|
|
36374
|
-
);
|
|
36375
|
-
}
|
|
36376
|
-
}
|
|
36377
|
-
if (endnotesPart) {
|
|
36378
|
-
zip.file("word/endnotes.xml", endnotesPart.xml);
|
|
36379
|
-
if (endnotesPart.partContext.images.length > 0 || endnotesPart.partContext.hyperlinks.length > 0) {
|
|
36380
|
-
zip.file(
|
|
36381
|
-
"word/_rels/endnotes.xml.rels",
|
|
36382
|
-
buildPartRelationshipsXml(
|
|
36383
|
-
endnotesPart.partContext.images,
|
|
36384
|
-
endnotesPart.partContext.hyperlinks
|
|
36385
|
-
)
|
|
36386
|
-
);
|
|
36387
|
-
}
|
|
36388
|
-
}
|
|
36445
|
+
writeNotePart(zip, "footnotes", footnotesPart);
|
|
36446
|
+
writeNotePart(zip, "endnotes", endnotesPart);
|
|
36389
36447
|
if (commentPlan) {
|
|
36390
36448
|
zip.file("word/comments.xml", buildCommentsPartXml(commentPlan));
|
|
36391
36449
|
zip.file(
|
|
@@ -36825,45 +36883,27 @@ function blendColorWithWhite(hex, alpha) {
|
|
|
36825
36883
|
255 + (rgb[2] - 255) * a
|
|
36826
36884
|
);
|
|
36827
36885
|
}
|
|
36828
|
-
function
|
|
36829
|
-
|
|
36830
|
-
|
|
36831
|
-
|
|
36832
|
-
const bounds = resolveFragmentBounds(
|
|
36833
|
-
line,
|
|
36834
|
-
fragment,
|
|
36835
|
-
styles.fontSize ?? DEFAULT_FONT_SIZE_PX
|
|
36836
|
-
);
|
|
36837
|
-
if (!bounds) {
|
|
36838
|
-
return;
|
|
36839
|
-
}
|
|
36840
|
-
writer.drawRect(pageIndex, {
|
|
36886
|
+
function fragmentRectPt(line, fragment, styles, originX, originY, yOffset, heightShrink) {
|
|
36887
|
+
const bounds = resolveFragmentBounds(line, fragment, styles.fontSize ?? DEFAULT_FONT_SIZE_PX);
|
|
36888
|
+
if (!bounds) return null;
|
|
36889
|
+
return {
|
|
36841
36890
|
x: pxToPt$1(originX + bounds.left),
|
|
36842
|
-
y: pxToPt$1(originY + line.top +
|
|
36891
|
+
y: pxToPt$1(originY + line.top + yOffset),
|
|
36843
36892
|
width: pxToPt$1(Math.max(0, bounds.right - bounds.left)),
|
|
36844
|
-
height: pxToPt$1(Math.max(2, line.height -
|
|
36845
|
-
|
|
36846
|
-
|
|
36893
|
+
height: pxToPt$1(Math.max(2, line.height - heightShrink))
|
|
36894
|
+
};
|
|
36895
|
+
}
|
|
36896
|
+
function drawFragmentHighlight(writer, pageIndex, line, fragment, originX, originY, styles) {
|
|
36897
|
+
if (!styles.highlight) return;
|
|
36898
|
+
const rect = fragmentRectPt(line, fragment, styles, originX, originY, 2, 4);
|
|
36899
|
+
if (!rect) return;
|
|
36900
|
+
writer.drawRect(pageIndex, { ...rect, fill: styles.highlight });
|
|
36847
36901
|
}
|
|
36848
36902
|
function drawFragmentShading(writer, pageIndex, line, fragment, originX, originY, styles) {
|
|
36849
|
-
if (!styles.shading)
|
|
36850
|
-
|
|
36851
|
-
|
|
36852
|
-
|
|
36853
|
-
line,
|
|
36854
|
-
fragment,
|
|
36855
|
-
styles.fontSize ?? DEFAULT_FONT_SIZE_PX
|
|
36856
|
-
);
|
|
36857
|
-
if (!bounds) {
|
|
36858
|
-
return;
|
|
36859
|
-
}
|
|
36860
|
-
writer.drawRect(pageIndex, {
|
|
36861
|
-
x: pxToPt$1(originX + bounds.left),
|
|
36862
|
-
y: pxToPt$1(originY + line.top + 2),
|
|
36863
|
-
width: pxToPt$1(Math.max(0, bounds.right - bounds.left)),
|
|
36864
|
-
height: pxToPt$1(Math.max(2, line.height - 4)),
|
|
36865
|
-
fill: styles.shading
|
|
36866
|
-
});
|
|
36903
|
+
if (!styles.shading) return;
|
|
36904
|
+
const rect = fragmentRectPt(line, fragment, styles, originX, originY, 2, 4);
|
|
36905
|
+
if (!rect) return;
|
|
36906
|
+
writer.drawRect(pageIndex, { ...rect, fill: styles.shading });
|
|
36867
36907
|
}
|
|
36868
36908
|
function resolveGradientShadingName(writer, pageIndex, line, fragment, originX, originY, styles) {
|
|
36869
36909
|
const fill = styles.textFill;
|
|
@@ -36903,19 +36943,10 @@ function drawFragmentBorder(writer, pageIndex, line, fragment, originX, originY,
|
|
|
36903
36943
|
if (!border || border.type === "none" || border.width <= 0) {
|
|
36904
36944
|
return;
|
|
36905
36945
|
}
|
|
36906
|
-
const
|
|
36907
|
-
|
|
36908
|
-
fragment,
|
|
36909
|
-
styles.fontSize ?? DEFAULT_FONT_SIZE_PX
|
|
36910
|
-
);
|
|
36911
|
-
if (!bounds) {
|
|
36912
|
-
return;
|
|
36913
|
-
}
|
|
36946
|
+
const rect = fragmentRectPt(line, fragment, styles, originX, originY, 1, 2);
|
|
36947
|
+
if (!rect) return;
|
|
36914
36948
|
writer.drawRect(pageIndex, {
|
|
36915
|
-
|
|
36916
|
-
y: pxToPt$1(originY + line.top + 1),
|
|
36917
|
-
width: pxToPt$1(Math.max(0, bounds.right - bounds.left)),
|
|
36918
|
-
height: pxToPt$1(Math.max(2, line.height - 2)),
|
|
36949
|
+
...rect,
|
|
36919
36950
|
stroke: border.color,
|
|
36920
36951
|
lineWidth: pxToPt$1(Math.max(0.5, border.width * PX_PER_POINT))
|
|
36921
36952
|
});
|
|
@@ -37034,12 +37065,10 @@ function drawUnderlineWithStyle(writer, pageIndex, x1, x2, y, stroke, underlineS
|
|
|
37034
37065
|
drawAt(y, underlineStyleDashArray(underlineStyle));
|
|
37035
37066
|
}
|
|
37036
37067
|
function drawWavyUnderline(writer, pageIndex, x1, x2, y, stroke, lineWidthPx) {
|
|
37037
|
-
const wavelength = 4;
|
|
37038
|
-
const amplitude = 1.5;
|
|
37039
37068
|
let prevX = x1;
|
|
37040
37069
|
let prevY = y;
|
|
37041
37070
|
for (let x = x1; x <= x2; x += 1) {
|
|
37042
|
-
const dy = Math.sin((x - x1) /
|
|
37071
|
+
const dy = Math.sin((x - x1) / WAVY_UNDERLINE_WAVELENGTH_PX * Math.PI) * WAVY_UNDERLINE_AMPLITUDE_PX;
|
|
37043
37072
|
const curY = y + dy;
|
|
37044
37073
|
writer.drawLine(pageIndex, {
|
|
37045
37074
|
x1: pxToPt$1(prevX),
|
|
@@ -37151,6 +37180,100 @@ async function drawInlineTextBoxFragment(writer, pageIndex, line, fragment, docu
|
|
|
37151
37180
|
drawers
|
|
37152
37181
|
);
|
|
37153
37182
|
}
|
|
37183
|
+
function emitTextChunk(ctx, leftPx, text) {
|
|
37184
|
+
const {
|
|
37185
|
+
writer,
|
|
37186
|
+
pageIndex,
|
|
37187
|
+
baselineY,
|
|
37188
|
+
fontSizePt,
|
|
37189
|
+
mainColor,
|
|
37190
|
+
gradientShadingName,
|
|
37191
|
+
styles,
|
|
37192
|
+
baseTextOptions
|
|
37193
|
+
} = ctx;
|
|
37194
|
+
const offsetPt = pxToPt$1(1);
|
|
37195
|
+
if (styles.emboss || styles.imprint) {
|
|
37196
|
+
const dir = styles.imprint ? 1 : -1;
|
|
37197
|
+
writer.drawText(pageIndex, {
|
|
37198
|
+
...baseTextOptions,
|
|
37199
|
+
x: pxToPt$1(leftPx) + offsetPt * dir,
|
|
37200
|
+
y: pxToPt$1(baselineY) + offsetPt * dir,
|
|
37201
|
+
text,
|
|
37202
|
+
color: "#BFBFBF"
|
|
37203
|
+
});
|
|
37204
|
+
}
|
|
37205
|
+
if (styles.glow) {
|
|
37206
|
+
const gl = styles.glow;
|
|
37207
|
+
const r = pxToPt$1(gl.radiusPt * PX_PER_POINT) * 0.5;
|
|
37208
|
+
const glowColor = blendColorWithWhite(gl.color, (gl.alpha ?? 0.5) * 0.4);
|
|
37209
|
+
const dirs = [
|
|
37210
|
+
[r, 0],
|
|
37211
|
+
[-r, 0],
|
|
37212
|
+
[0, r],
|
|
37213
|
+
[0, -r],
|
|
37214
|
+
[r * 0.7, r * 0.7],
|
|
37215
|
+
[-r * 0.7, r * 0.7],
|
|
37216
|
+
[r * 0.7, -r * 0.7],
|
|
37217
|
+
[-r * 0.7, -r * 0.7]
|
|
37218
|
+
];
|
|
37219
|
+
for (const [dx, dy] of dirs) {
|
|
37220
|
+
writer.drawText(pageIndex, {
|
|
37221
|
+
...baseTextOptions,
|
|
37222
|
+
x: pxToPt$1(leftPx) + dx,
|
|
37223
|
+
y: pxToPt$1(baselineY) + dy,
|
|
37224
|
+
text,
|
|
37225
|
+
color: glowColor
|
|
37226
|
+
});
|
|
37227
|
+
}
|
|
37228
|
+
}
|
|
37229
|
+
if (styles.textShadow) {
|
|
37230
|
+
const ts = styles.textShadow;
|
|
37231
|
+
const dirRad = ts.dirDeg * Math.PI / 180;
|
|
37232
|
+
const shadowOffsetPt = pxToPt$1(ts.distPt * PX_PER_POINT);
|
|
37233
|
+
writer.drawText(pageIndex, {
|
|
37234
|
+
...baseTextOptions,
|
|
37235
|
+
x: pxToPt$1(leftPx) + Math.cos(dirRad) * shadowOffsetPt,
|
|
37236
|
+
y: pxToPt$1(baselineY) + Math.sin(dirRad) * shadowOffsetPt,
|
|
37237
|
+
text,
|
|
37238
|
+
color: ts.color
|
|
37239
|
+
});
|
|
37240
|
+
} else if (styles.shadow) {
|
|
37241
|
+
writer.drawText(pageIndex, {
|
|
37242
|
+
...baseTextOptions,
|
|
37243
|
+
x: pxToPt$1(leftPx) + offsetPt,
|
|
37244
|
+
y: pxToPt$1(baselineY) + offsetPt,
|
|
37245
|
+
text,
|
|
37246
|
+
color: "#808080"
|
|
37247
|
+
});
|
|
37248
|
+
}
|
|
37249
|
+
if (styles.reflection) {
|
|
37250
|
+
const ref = styles.reflection;
|
|
37251
|
+
const avgAlpha = (ref.startAlpha + ref.endAlpha) / 2;
|
|
37252
|
+
const refColor = blendColorWithWhite(mainColor, avgAlpha * 0.6);
|
|
37253
|
+
writer.drawText(pageIndex, {
|
|
37254
|
+
...baseTextOptions,
|
|
37255
|
+
x: pxToPt$1(leftPx),
|
|
37256
|
+
y: pxToPt$1(baselineY) + pxToPt$1(ref.distPt * PX_PER_POINT) + fontSizePt,
|
|
37257
|
+
text,
|
|
37258
|
+
color: refColor
|
|
37259
|
+
});
|
|
37260
|
+
}
|
|
37261
|
+
const textOutline = styles.textOutline;
|
|
37262
|
+
writer.drawText(pageIndex, {
|
|
37263
|
+
...baseTextOptions,
|
|
37264
|
+
x: pxToPt$1(leftPx),
|
|
37265
|
+
y: pxToPt$1(baselineY),
|
|
37266
|
+
text,
|
|
37267
|
+
color: mainColor,
|
|
37268
|
+
// A gradient fill paints the glyphs via the shading clip; it supersedes
|
|
37269
|
+
// both the solid color and any outline/stroke render mode.
|
|
37270
|
+
...gradientShadingName ? { gradientShadingName } : textOutline ? {
|
|
37271
|
+
renderMode: 2,
|
|
37272
|
+
strokeColor: textOutline.color ?? mainColor,
|
|
37273
|
+
strokeWidth: textOutline.widthPt
|
|
37274
|
+
} : { renderMode: styles.outline ? 1 : 0 }
|
|
37275
|
+
});
|
|
37276
|
+
}
|
|
37154
37277
|
async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, document2, originX, originY, fontRegistry, drawers) {
|
|
37155
37278
|
var _a2, _b2, _c;
|
|
37156
37279
|
if (fragment.image) {
|
|
@@ -37296,100 +37419,26 @@ async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, do
|
|
|
37296
37419
|
originY,
|
|
37297
37420
|
styles
|
|
37298
37421
|
);
|
|
37299
|
-
const
|
|
37300
|
-
|
|
37301
|
-
|
|
37302
|
-
|
|
37303
|
-
|
|
37304
|
-
|
|
37305
|
-
|
|
37306
|
-
|
|
37307
|
-
|
|
37308
|
-
color: "#BFBFBF"
|
|
37309
|
-
});
|
|
37310
|
-
}
|
|
37311
|
-
if (styles.glow) {
|
|
37312
|
-
const gl = styles.glow;
|
|
37313
|
-
const r = pxToPt$1(gl.radiusPt * PX_PER_POINT) * 0.5;
|
|
37314
|
-
const glowColor = blendColorWithWhite(gl.color, (gl.alpha ?? 0.5) * 0.4);
|
|
37315
|
-
const dirs = [
|
|
37316
|
-
[r, 0],
|
|
37317
|
-
[-r, 0],
|
|
37318
|
-
[0, r],
|
|
37319
|
-
[0, -r],
|
|
37320
|
-
[r * 0.7, r * 0.7],
|
|
37321
|
-
[-r * 0.7, r * 0.7],
|
|
37322
|
-
[r * 0.7, -r * 0.7],
|
|
37323
|
-
[-r * 0.7, -r * 0.7]
|
|
37324
|
-
];
|
|
37325
|
-
for (const [dx, dy] of dirs) {
|
|
37326
|
-
writer.drawText(pageIndex, {
|
|
37327
|
-
...baseTextOptions,
|
|
37328
|
-
x: pxToPt$1(leftPx) + dx,
|
|
37329
|
-
y: pxToPt$1(baselineY) + dy,
|
|
37330
|
-
text: text2,
|
|
37331
|
-
color: glowColor
|
|
37332
|
-
});
|
|
37333
|
-
}
|
|
37334
|
-
}
|
|
37335
|
-
if (styles.textShadow) {
|
|
37336
|
-
const ts = styles.textShadow;
|
|
37337
|
-
const dirRad = ts.dirDeg * Math.PI / 180;
|
|
37338
|
-
const shadowOffsetPt = pxToPt$1(ts.distPt * PX_PER_POINT);
|
|
37339
|
-
writer.drawText(pageIndex, {
|
|
37340
|
-
...baseTextOptions,
|
|
37341
|
-
x: pxToPt$1(leftPx) + Math.cos(dirRad) * shadowOffsetPt,
|
|
37342
|
-
y: pxToPt$1(baselineY) + Math.sin(dirRad) * shadowOffsetPt,
|
|
37343
|
-
text: text2,
|
|
37344
|
-
color: ts.color
|
|
37345
|
-
});
|
|
37346
|
-
} else if (styles.shadow) {
|
|
37347
|
-
writer.drawText(pageIndex, {
|
|
37348
|
-
...baseTextOptions,
|
|
37349
|
-
x: pxToPt$1(leftPx) + offsetPt,
|
|
37350
|
-
y: pxToPt$1(baselineY) + offsetPt,
|
|
37351
|
-
text: text2,
|
|
37352
|
-
color: "#808080"
|
|
37353
|
-
});
|
|
37354
|
-
}
|
|
37355
|
-
if (styles.reflection) {
|
|
37356
|
-
const ref = styles.reflection;
|
|
37357
|
-
const avgAlpha = (ref.startAlpha + ref.endAlpha) / 2;
|
|
37358
|
-
const refColor = blendColorWithWhite(mainColor, avgAlpha * 0.6);
|
|
37359
|
-
writer.drawText(pageIndex, {
|
|
37360
|
-
...baseTextOptions,
|
|
37361
|
-
x: pxToPt$1(leftPx),
|
|
37362
|
-
y: pxToPt$1(baselineY) + pxToPt$1(ref.distPt * PX_PER_POINT) + fontSizePt,
|
|
37363
|
-
text: text2,
|
|
37364
|
-
color: refColor
|
|
37365
|
-
});
|
|
37366
|
-
}
|
|
37367
|
-
const textOutline = styles.textOutline;
|
|
37368
|
-
writer.drawText(pageIndex, {
|
|
37369
|
-
...baseTextOptions,
|
|
37370
|
-
x: pxToPt$1(leftPx),
|
|
37371
|
-
y: pxToPt$1(baselineY),
|
|
37372
|
-
text: text2,
|
|
37373
|
-
color: mainColor,
|
|
37374
|
-
// A gradient fill paints the glyphs via the shading clip; it supersedes
|
|
37375
|
-
// both the solid color and any outline/stroke render mode.
|
|
37376
|
-
...gradientShadingName ? { gradientShadingName } : textOutline ? {
|
|
37377
|
-
renderMode: 2,
|
|
37378
|
-
strokeColor: textOutline.color ?? mainColor,
|
|
37379
|
-
strokeWidth: textOutline.widthPt
|
|
37380
|
-
} : { renderMode: styles.outline ? 1 : 0 }
|
|
37381
|
-
});
|
|
37422
|
+
const chunkCtx = {
|
|
37423
|
+
writer,
|
|
37424
|
+
pageIndex,
|
|
37425
|
+
baselineY,
|
|
37426
|
+
fontSizePt,
|
|
37427
|
+
mainColor,
|
|
37428
|
+
gradientShadingName,
|
|
37429
|
+
styles,
|
|
37430
|
+
baseTextOptions
|
|
37382
37431
|
};
|
|
37383
37432
|
const chunks = paragraphAlign === "justify" ? groupSlotChunksByWhitespace(chars) : groupSlotChunksByOffsetGaps(chars);
|
|
37384
37433
|
for (const chunk of chunks) {
|
|
37385
37434
|
const chunkText = chunk.map((c) => styles.allCaps ? c.char.toUpperCase() : c.char).join("");
|
|
37386
37435
|
if (chunkText.length === 0) continue;
|
|
37387
|
-
|
|
37436
|
+
emitTextChunk(chunkCtx, originX + chunk[0].left, chunkText);
|
|
37388
37437
|
}
|
|
37389
37438
|
if (line.trailingHyphen && fragment.endOffset >= line.endOffset) {
|
|
37390
37439
|
const endSlot = line.slots.find((slot) => slot.offset === line.endOffset) ?? line.slots[line.slots.length - 1];
|
|
37391
37440
|
if (endSlot) {
|
|
37392
|
-
|
|
37441
|
+
emitTextChunk(chunkCtx, originX + endSlot.left, "-");
|
|
37393
37442
|
}
|
|
37394
37443
|
}
|
|
37395
37444
|
if (styles.underline) {
|
|
@@ -38500,6 +38549,16 @@ class PdfContentStream {
|
|
|
38500
38549
|
);
|
|
38501
38550
|
}
|
|
38502
38551
|
}
|
|
38552
|
+
function readU16Array(reader, count) {
|
|
38553
|
+
const array = new Array(count);
|
|
38554
|
+
for (let i = 0; i < count; i += 1) array[i] = reader.u16();
|
|
38555
|
+
return array;
|
|
38556
|
+
}
|
|
38557
|
+
function readU16OffsetArray(reader, count, baseOffset) {
|
|
38558
|
+
const array = new Array(count);
|
|
38559
|
+
for (let i = 0; i < count; i += 1) array[i] = baseOffset + reader.u16();
|
|
38560
|
+
return array;
|
|
38561
|
+
}
|
|
38503
38562
|
function parseCoverage(reader, offset) {
|
|
38504
38563
|
reader.seek(offset);
|
|
38505
38564
|
const format = reader.u16();
|
|
@@ -38537,10 +38596,7 @@ function parseClassDef(reader, offset) {
|
|
|
38537
38596
|
if (format === 1) {
|
|
38538
38597
|
const startGlyph = reader.u16();
|
|
38539
38598
|
const glyphCount = reader.u16();
|
|
38540
|
-
const classes =
|
|
38541
|
-
for (let i = 0; i < glyphCount; i += 1) {
|
|
38542
|
-
classes[i] = reader.u16();
|
|
38543
|
-
}
|
|
38599
|
+
const classes = readU16Array(reader, glyphCount);
|
|
38544
38600
|
return (glyphId) => {
|
|
38545
38601
|
const index = glyphId - startGlyph;
|
|
38546
38602
|
return index >= 0 && index < glyphCount ? classes[index] : 0;
|
|
@@ -38579,10 +38635,7 @@ function parseFeatureList(reader, featureListOffset) {
|
|
|
38579
38635
|
reader.seek(offset);
|
|
38580
38636
|
reader.skip(2);
|
|
38581
38637
|
const lookupIndexCount = reader.u16();
|
|
38582
|
-
const lookupIndices =
|
|
38583
|
-
for (let i = 0; i < lookupIndexCount; i += 1) {
|
|
38584
|
-
lookupIndices[i] = reader.u16();
|
|
38585
|
-
}
|
|
38638
|
+
const lookupIndices = readU16Array(reader, lookupIndexCount);
|
|
38586
38639
|
return { tag, lookupIndices };
|
|
38587
38640
|
});
|
|
38588
38641
|
}
|
|
@@ -38634,6 +38687,26 @@ function parseLayoutTableHeader(reader) {
|
|
|
38634
38687
|
}
|
|
38635
38688
|
return { featureToLookups, lookupListOffset };
|
|
38636
38689
|
}
|
|
38690
|
+
function parseLookupList(reader, lookupListOffset, parseSubtable2) {
|
|
38691
|
+
reader.seek(lookupListOffset);
|
|
38692
|
+
const lookupCount = reader.u16();
|
|
38693
|
+
const lookupOffsets = readU16OffsetArray(reader, lookupCount, lookupListOffset);
|
|
38694
|
+
return lookupOffsets.map((lookupOffset) => {
|
|
38695
|
+
reader.seek(lookupOffset);
|
|
38696
|
+
const lookupType = reader.u16();
|
|
38697
|
+
reader.skip(2);
|
|
38698
|
+
const subtableOffsets = readU16OffsetArray(reader, reader.u16(), lookupOffset);
|
|
38699
|
+
const subtables = [];
|
|
38700
|
+
for (const subtableOffset of subtableOffsets) {
|
|
38701
|
+
try {
|
|
38702
|
+
const subtable = parseSubtable2(reader, subtableOffset, lookupType);
|
|
38703
|
+
if (subtable) subtables.push(subtable);
|
|
38704
|
+
} catch {
|
|
38705
|
+
}
|
|
38706
|
+
}
|
|
38707
|
+
return { lookupType, subtables };
|
|
38708
|
+
});
|
|
38709
|
+
}
|
|
38637
38710
|
function collectLookupIndices(featureToLookups, tags) {
|
|
38638
38711
|
const indices = /* @__PURE__ */ new Set();
|
|
38639
38712
|
for (const tag of tags) {
|
|
@@ -38661,10 +38734,7 @@ function parseSingleSubst(reader, offset) {
|
|
|
38661
38734
|
}
|
|
38662
38735
|
if (format === 2) {
|
|
38663
38736
|
const glyphCount = reader.u16();
|
|
38664
|
-
const substitutes =
|
|
38665
|
-
for (let i = 0; i < glyphCount; i += 1) {
|
|
38666
|
-
substitutes[i] = reader.u16();
|
|
38667
|
-
}
|
|
38737
|
+
const substitutes = readU16Array(reader, glyphCount);
|
|
38668
38738
|
const coverage = parseCoverage(reader, coverageOffset);
|
|
38669
38739
|
return {
|
|
38670
38740
|
apply(glyphs, pos) {
|
|
@@ -38679,24 +38749,22 @@ function parseSingleSubst(reader, offset) {
|
|
|
38679
38749
|
}
|
|
38680
38750
|
return null;
|
|
38681
38751
|
}
|
|
38682
|
-
function
|
|
38752
|
+
function parseGlyphSetArray(reader, offset) {
|
|
38683
38753
|
reader.seek(offset);
|
|
38684
|
-
|
|
38685
|
-
if (format !== 1) return null;
|
|
38754
|
+
if (reader.u16() !== 1) return null;
|
|
38686
38755
|
const coverageOffset = offset + reader.u16();
|
|
38687
|
-
const
|
|
38688
|
-
const
|
|
38689
|
-
|
|
38690
|
-
|
|
38691
|
-
|
|
38692
|
-
const sequences = sequenceOffsets.map((seqOffset) => {
|
|
38693
|
-
reader.seek(seqOffset);
|
|
38694
|
-
const glyphCount = reader.u16();
|
|
38695
|
-
const ids = new Array(glyphCount);
|
|
38696
|
-
for (let i = 0; i < glyphCount; i += 1) ids[i] = reader.u16();
|
|
38697
|
-
return ids;
|
|
38756
|
+
const count = reader.u16();
|
|
38757
|
+
const setOffsets = readU16OffsetArray(reader, count, offset);
|
|
38758
|
+
const sets = setOffsets.map((setOffset) => {
|
|
38759
|
+
reader.seek(setOffset);
|
|
38760
|
+
return readU16Array(reader, reader.u16());
|
|
38698
38761
|
});
|
|
38699
|
-
|
|
38762
|
+
return { coverage: parseCoverage(reader, coverageOffset), sets };
|
|
38763
|
+
}
|
|
38764
|
+
function parseMultipleSubst(reader, offset) {
|
|
38765
|
+
const parsed = parseGlyphSetArray(reader, offset);
|
|
38766
|
+
if (!parsed) return null;
|
|
38767
|
+
const { coverage, sets: sequences } = parsed;
|
|
38700
38768
|
return {
|
|
38701
38769
|
apply(glyphs, pos) {
|
|
38702
38770
|
const glyph = glyphs[pos];
|
|
@@ -38716,23 +38784,9 @@ function parseMultipleSubst(reader, offset) {
|
|
|
38716
38784
|
};
|
|
38717
38785
|
}
|
|
38718
38786
|
function parseAlternateSubst(reader, offset) {
|
|
38719
|
-
reader
|
|
38720
|
-
|
|
38721
|
-
|
|
38722
|
-
const coverageOffset = offset + reader.u16();
|
|
38723
|
-
const altSetCount = reader.u16();
|
|
38724
|
-
const altSetOffsets = new Array(altSetCount);
|
|
38725
|
-
for (let i = 0; i < altSetCount; i += 1) {
|
|
38726
|
-
altSetOffsets[i] = offset + reader.u16();
|
|
38727
|
-
}
|
|
38728
|
-
const altSets = altSetOffsets.map((setOffset) => {
|
|
38729
|
-
reader.seek(setOffset);
|
|
38730
|
-
const glyphCount = reader.u16();
|
|
38731
|
-
const ids = new Array(glyphCount);
|
|
38732
|
-
for (let i = 0; i < glyphCount; i += 1) ids[i] = reader.u16();
|
|
38733
|
-
return ids;
|
|
38734
|
-
});
|
|
38735
|
-
const coverage = parseCoverage(reader, coverageOffset);
|
|
38787
|
+
const parsed = parseGlyphSetArray(reader, offset);
|
|
38788
|
+
if (!parsed) return null;
|
|
38789
|
+
const { coverage, sets: altSets } = parsed;
|
|
38736
38790
|
return {
|
|
38737
38791
|
apply(glyphs, pos) {
|
|
38738
38792
|
const glyph = glyphs[pos];
|
|
@@ -38752,25 +38806,15 @@ function parseLigatureSubst(reader, offset) {
|
|
|
38752
38806
|
if (format !== 1) return null;
|
|
38753
38807
|
const coverageOffset = offset + reader.u16();
|
|
38754
38808
|
const ligSetCount = reader.u16();
|
|
38755
|
-
const ligSetOffsets =
|
|
38756
|
-
for (let i = 0; i < ligSetCount; i += 1) {
|
|
38757
|
-
ligSetOffsets[i] = offset + reader.u16();
|
|
38758
|
-
}
|
|
38809
|
+
const ligSetOffsets = readU16OffsetArray(reader, ligSetCount, offset);
|
|
38759
38810
|
const ligatureSets = ligSetOffsets.map((setOffset) => {
|
|
38760
38811
|
reader.seek(setOffset);
|
|
38761
|
-
const
|
|
38762
|
-
const ligOffsets = new Array(ligCount);
|
|
38763
|
-
for (let i = 0; i < ligCount; i += 1) {
|
|
38764
|
-
ligOffsets[i] = setOffset + reader.u16();
|
|
38765
|
-
}
|
|
38812
|
+
const ligOffsets = readU16OffsetArray(reader, reader.u16(), setOffset);
|
|
38766
38813
|
return ligOffsets.map((ligOffset) => {
|
|
38767
38814
|
reader.seek(ligOffset);
|
|
38768
38815
|
const ligatureGlyph = reader.u16();
|
|
38769
38816
|
const componentCount = reader.u16();
|
|
38770
|
-
const components =
|
|
38771
|
-
for (let i = 0; i < components.length; i += 1) {
|
|
38772
|
-
components[i] = reader.u16();
|
|
38773
|
-
}
|
|
38817
|
+
const components = readU16Array(reader, Math.max(0, componentCount - 1));
|
|
38774
38818
|
return { ligatureGlyph, components };
|
|
38775
38819
|
});
|
|
38776
38820
|
});
|
|
@@ -38829,21 +38873,9 @@ function parseChainContextSubst(reader, offset) {
|
|
|
38829
38873
|
reader.seek(offset);
|
|
38830
38874
|
const format = reader.u16();
|
|
38831
38875
|
if (format === 3) {
|
|
38832
|
-
const
|
|
38833
|
-
const
|
|
38834
|
-
|
|
38835
|
-
backtrackCoverageOffsets[i] = offset + reader.u16();
|
|
38836
|
-
}
|
|
38837
|
-
const inputCount = reader.u16();
|
|
38838
|
-
const inputCoverageOffsets = new Array(inputCount);
|
|
38839
|
-
for (let i = 0; i < inputCount; i += 1) {
|
|
38840
|
-
inputCoverageOffsets[i] = offset + reader.u16();
|
|
38841
|
-
}
|
|
38842
|
-
const lookaheadCount = reader.u16();
|
|
38843
|
-
const lookaheadCoverageOffsets = new Array(lookaheadCount);
|
|
38844
|
-
for (let i = 0; i < lookaheadCount; i += 1) {
|
|
38845
|
-
lookaheadCoverageOffsets[i] = offset + reader.u16();
|
|
38846
|
-
}
|
|
38876
|
+
const backtrackCoverageOffsets = readU16OffsetArray(reader, reader.u16(), offset);
|
|
38877
|
+
const inputCoverageOffsets = readU16OffsetArray(reader, reader.u16(), offset);
|
|
38878
|
+
const lookaheadCoverageOffsets = readU16OffsetArray(reader, reader.u16(), offset);
|
|
38847
38879
|
const substCount = reader.u16();
|
|
38848
38880
|
const records = readSubstLookupRecords(reader, substCount);
|
|
38849
38881
|
const backtrack = backtrackCoverageOffsets.map(
|
|
@@ -38876,10 +38908,7 @@ function parseChainContextSubst(reader, offset) {
|
|
|
38876
38908
|
if (format === 1) {
|
|
38877
38909
|
const coverageOffset = offset + reader.u16();
|
|
38878
38910
|
const ruleSetCount = reader.u16();
|
|
38879
|
-
const ruleSetOffsets =
|
|
38880
|
-
for (let i = 0; i < ruleSetCount; i += 1) {
|
|
38881
|
-
ruleSetOffsets[i] = offset + reader.u16();
|
|
38882
|
-
}
|
|
38911
|
+
const ruleSetOffsets = readU16OffsetArray(reader, ruleSetCount, offset);
|
|
38883
38912
|
const coverage = parseCoverage(reader, coverageOffset);
|
|
38884
38913
|
const ruleSets = ruleSetOffsets.map(
|
|
38885
38914
|
(setOffset) => parseChainRuleSet(reader, setOffset)
|
|
@@ -38933,23 +38962,13 @@ function parseChainContextSubst(reader, offset) {
|
|
|
38933
38962
|
function parseChainRuleSet(reader, setOffset) {
|
|
38934
38963
|
reader.seek(setOffset);
|
|
38935
38964
|
const ruleCount = reader.u16();
|
|
38936
|
-
const ruleOffsets =
|
|
38937
|
-
for (let i = 0; i < ruleCount; i += 1) {
|
|
38938
|
-
ruleOffsets[i] = setOffset + reader.u16();
|
|
38939
|
-
}
|
|
38965
|
+
const ruleOffsets = readU16OffsetArray(reader, ruleCount, setOffset);
|
|
38940
38966
|
return ruleOffsets.map((ruleOffset) => {
|
|
38941
38967
|
reader.seek(ruleOffset);
|
|
38942
|
-
const
|
|
38943
|
-
const
|
|
38944
|
-
|
|
38945
|
-
const
|
|
38946
|
-
const input = new Array(Math.max(0, inputCount - 1));
|
|
38947
|
-
for (let i = 0; i < input.length; i += 1) input[i] = reader.u16();
|
|
38948
|
-
const lookaheadCount = reader.u16();
|
|
38949
|
-
const lookahead = new Array(lookaheadCount);
|
|
38950
|
-
for (let i = 0; i < lookaheadCount; i += 1) lookahead[i] = reader.u16();
|
|
38951
|
-
const substCount = reader.u16();
|
|
38952
|
-
const records = readSubstLookupRecords(reader, substCount);
|
|
38968
|
+
const backtrack = readU16Array(reader, reader.u16());
|
|
38969
|
+
const input = readU16Array(reader, Math.max(0, reader.u16() - 1));
|
|
38970
|
+
const lookahead = readU16Array(reader, reader.u16());
|
|
38971
|
+
const records = readSubstLookupRecords(reader, reader.u16());
|
|
38953
38972
|
return { backtrack, input, lookahead, records };
|
|
38954
38973
|
});
|
|
38955
38974
|
}
|
|
@@ -39026,7 +39045,7 @@ class GsubTable {
|
|
|
39026
39045
|
try {
|
|
39027
39046
|
const reader = new BinaryReader(bytes);
|
|
39028
39047
|
const { featureToLookups, lookupListOffset } = parseLayoutTableHeader(reader);
|
|
39029
|
-
const lookups = parseLookupList
|
|
39048
|
+
const lookups = parseLookupList(reader, lookupListOffset, parseSubtable$1);
|
|
39030
39049
|
return new GsubTable(lookups, featureToLookups);
|
|
39031
39050
|
} catch {
|
|
39032
39051
|
return null;
|
|
@@ -39067,33 +39086,6 @@ class GsubTable {
|
|
|
39067
39086
|
}
|
|
39068
39087
|
}
|
|
39069
39088
|
}
|
|
39070
|
-
function parseLookupList$1(reader, lookupListOffset) {
|
|
39071
|
-
reader.seek(lookupListOffset);
|
|
39072
|
-
const lookupCount = reader.u16();
|
|
39073
|
-
const lookupOffsets = new Array(lookupCount);
|
|
39074
|
-
for (let i = 0; i < lookupCount; i += 1) {
|
|
39075
|
-
lookupOffsets[i] = lookupListOffset + reader.u16();
|
|
39076
|
-
}
|
|
39077
|
-
return lookupOffsets.map((lookupOffset) => {
|
|
39078
|
-
reader.seek(lookupOffset);
|
|
39079
|
-
const lookupType = reader.u16();
|
|
39080
|
-
reader.skip(2);
|
|
39081
|
-
const subTableCount = reader.u16();
|
|
39082
|
-
const subtableOffsets = new Array(subTableCount);
|
|
39083
|
-
for (let i = 0; i < subTableCount; i += 1) {
|
|
39084
|
-
subtableOffsets[i] = lookupOffset + reader.u16();
|
|
39085
|
-
}
|
|
39086
|
-
const subtables = [];
|
|
39087
|
-
for (const subtableOffset of subtableOffsets) {
|
|
39088
|
-
try {
|
|
39089
|
-
const subtable = parseSubtable$1(reader, subtableOffset, lookupType);
|
|
39090
|
-
if (subtable) subtables.push(subtable);
|
|
39091
|
-
} catch {
|
|
39092
|
-
}
|
|
39093
|
-
}
|
|
39094
|
-
return { lookupType, subtables };
|
|
39095
|
-
});
|
|
39096
|
-
}
|
|
39097
39089
|
const X_PLACEMENT = 1;
|
|
39098
39090
|
const Y_PLACEMENT = 2;
|
|
39099
39091
|
const X_ADVANCE = 4;
|
|
@@ -39171,10 +39163,7 @@ function parsePairPos(reader, offset) {
|
|
|
39171
39163
|
const hasSecondAdjustment = (valueFormat2 & X_ADVANCE) !== 0;
|
|
39172
39164
|
if (format === 1) {
|
|
39173
39165
|
const pairSetCount = reader.u16();
|
|
39174
|
-
const pairSetOffsets =
|
|
39175
|
-
for (let i = 0; i < pairSetCount; i += 1) {
|
|
39176
|
-
pairSetOffsets[i] = offset + reader.u16();
|
|
39177
|
-
}
|
|
39166
|
+
const pairSetOffsets = readU16OffsetArray(reader, pairSetCount, offset);
|
|
39178
39167
|
const pairSets = pairSetOffsets.map(
|
|
39179
39168
|
(setOffset) => {
|
|
39180
39169
|
reader.seek(setOffset);
|
|
@@ -39276,33 +39265,6 @@ function parseSubtable(reader, offset, lookupType) {
|
|
|
39276
39265
|
return null;
|
|
39277
39266
|
}
|
|
39278
39267
|
}
|
|
39279
|
-
function parseLookupList(reader, lookupListOffset) {
|
|
39280
|
-
reader.seek(lookupListOffset);
|
|
39281
|
-
const lookupCount = reader.u16();
|
|
39282
|
-
const lookupOffsets = new Array(lookupCount);
|
|
39283
|
-
for (let i = 0; i < lookupCount; i += 1) {
|
|
39284
|
-
lookupOffsets[i] = lookupListOffset + reader.u16();
|
|
39285
|
-
}
|
|
39286
|
-
return lookupOffsets.map((lookupOffset) => {
|
|
39287
|
-
reader.seek(lookupOffset);
|
|
39288
|
-
const lookupType = reader.u16();
|
|
39289
|
-
reader.skip(2);
|
|
39290
|
-
const subTableCount = reader.u16();
|
|
39291
|
-
const subtableOffsets = new Array(subTableCount);
|
|
39292
|
-
for (let i = 0; i < subTableCount; i += 1) {
|
|
39293
|
-
subtableOffsets[i] = lookupOffset + reader.u16();
|
|
39294
|
-
}
|
|
39295
|
-
const subtables = [];
|
|
39296
|
-
for (const subtableOffset of subtableOffsets) {
|
|
39297
|
-
try {
|
|
39298
|
-
const subtable = parseSubtable(reader, subtableOffset, lookupType);
|
|
39299
|
-
if (subtable) subtables.push(subtable);
|
|
39300
|
-
} catch {
|
|
39301
|
-
}
|
|
39302
|
-
}
|
|
39303
|
-
return { lookupType, subtables };
|
|
39304
|
-
});
|
|
39305
|
-
}
|
|
39306
39268
|
class GposTable {
|
|
39307
39269
|
constructor(lookups, featureToLookups) {
|
|
39308
39270
|
this.lookups = lookups;
|
|
@@ -39313,7 +39275,7 @@ class GposTable {
|
|
|
39313
39275
|
try {
|
|
39314
39276
|
const reader = new BinaryReader(bytes);
|
|
39315
39277
|
const { featureToLookups, lookupListOffset } = parseLayoutTableHeader(reader);
|
|
39316
|
-
const lookups = parseLookupList(reader, lookupListOffset);
|
|
39278
|
+
const lookups = parseLookupList(reader, lookupListOffset, parseSubtable);
|
|
39317
39279
|
return new GposTable(lookups, featureToLookups);
|
|
39318
39280
|
} catch {
|
|
39319
39281
|
return null;
|
|
@@ -43417,6 +43379,29 @@ const applyTableAwareParagraphEdit = (current, getTargetBlocks, edit) => {
|
|
|
43417
43379
|
selection: tempResult.selection
|
|
43418
43380
|
};
|
|
43419
43381
|
};
|
|
43382
|
+
function resolveLocationTableMutation(current, getTargetBlocks) {
|
|
43383
|
+
const location = findParagraphTableLocation(
|
|
43384
|
+
current.document,
|
|
43385
|
+
current.selection.focus.paragraphId,
|
|
43386
|
+
getActiveSectionIndex(current)
|
|
43387
|
+
);
|
|
43388
|
+
if (!location) return null;
|
|
43389
|
+
const targetBlocks = getTargetBlocks(current, location.zone).map(cloneBlock);
|
|
43390
|
+
const tableBlock = targetBlocks[location.blockIndex];
|
|
43391
|
+
if (!tableBlock || tableBlock.type !== "table") return null;
|
|
43392
|
+
return { tableBlock, location, targetBlocks };
|
|
43393
|
+
}
|
|
43394
|
+
function commitTableMutation(current, targetBlocks, zone, nextParagraph) {
|
|
43395
|
+
const nextState = updateBlocksInCurrentSection(current, targetBlocks, zone);
|
|
43396
|
+
if (!nextParagraph) return nextState;
|
|
43397
|
+
return {
|
|
43398
|
+
...nextState,
|
|
43399
|
+
selection: {
|
|
43400
|
+
anchor: paragraphOffsetToPosition(nextParagraph, 0),
|
|
43401
|
+
focus: paragraphOffsetToPosition(nextParagraph, 0)
|
|
43402
|
+
}
|
|
43403
|
+
};
|
|
43404
|
+
}
|
|
43420
43405
|
function createTableOpsGuards(deps) {
|
|
43421
43406
|
const canMergeSelectedTableCells = (current) => {
|
|
43422
43407
|
const range = deps.resolveHorizontalTableCellRange(current);
|
|
@@ -43768,18 +43753,7 @@ function createTableCellSpanOperations(deps) {
|
|
|
43768
43753
|
if (!nextParagraph) {
|
|
43769
43754
|
return current;
|
|
43770
43755
|
}
|
|
43771
|
-
|
|
43772
|
-
current,
|
|
43773
|
-
targetBlocks,
|
|
43774
|
-
range.zone
|
|
43775
|
-
);
|
|
43776
|
-
return {
|
|
43777
|
-
...nextState,
|
|
43778
|
-
selection: {
|
|
43779
|
-
anchor: paragraphOffsetToPosition(nextParagraph, 0),
|
|
43780
|
-
focus: paragraphOffsetToPosition(nextParagraph, 0)
|
|
43781
|
-
}
|
|
43782
|
-
};
|
|
43756
|
+
return commitTableMutation(current, targetBlocks, range.zone, nextParagraph);
|
|
43783
43757
|
};
|
|
43784
43758
|
const mergeSelectedTableRows = (current) => {
|
|
43785
43759
|
const range = deps.resolveVerticalTableCellRange(current);
|
|
@@ -43852,18 +43826,7 @@ function createTableCellSpanOperations(deps) {
|
|
|
43852
43826
|
if (!nextParagraph) {
|
|
43853
43827
|
return current;
|
|
43854
43828
|
}
|
|
43855
|
-
|
|
43856
|
-
current,
|
|
43857
|
-
targetBlocks,
|
|
43858
|
-
range.zone
|
|
43859
|
-
);
|
|
43860
|
-
return {
|
|
43861
|
-
...nextState,
|
|
43862
|
-
selection: {
|
|
43863
|
-
anchor: paragraphOffsetToPosition(nextParagraph, 0),
|
|
43864
|
-
focus: paragraphOffsetToPosition(nextParagraph, 0)
|
|
43865
|
-
}
|
|
43866
|
-
};
|
|
43829
|
+
return commitTableMutation(current, targetBlocks, range.zone, nextParagraph);
|
|
43867
43830
|
};
|
|
43868
43831
|
const mergeSelectedTable = (current) => {
|
|
43869
43832
|
if (deps.canMergeSelectedTableCells(current)) {
|
|
@@ -43876,19 +43839,9 @@ function createTableCellSpanOperations(deps) {
|
|
|
43876
43839
|
};
|
|
43877
43840
|
const splitSelectedTableCellVertically = (current) => {
|
|
43878
43841
|
var _a2;
|
|
43879
|
-
const
|
|
43880
|
-
|
|
43881
|
-
|
|
43882
|
-
getActiveSectionIndex(current)
|
|
43883
|
-
);
|
|
43884
|
-
if (!location) {
|
|
43885
|
-
return current;
|
|
43886
|
-
}
|
|
43887
|
-
const targetBlocks = deps.getTargetBlocks(current, location.zone).map(cloneBlock);
|
|
43888
|
-
const tableBlock = targetBlocks[location.blockIndex];
|
|
43889
|
-
if (!tableBlock || tableBlock.type !== "table") {
|
|
43890
|
-
return current;
|
|
43891
|
-
}
|
|
43842
|
+
const mut = resolveLocationTableMutation(current, deps.getTargetBlocks);
|
|
43843
|
+
if (!mut) return current;
|
|
43844
|
+
const { tableBlock, location, targetBlocks } = mut;
|
|
43892
43845
|
const cell = (_a2 = tableBlock.rows[location.rowIndex]) == null ? void 0 : _a2.cells[location.cellIndex];
|
|
43893
43846
|
const span = Math.max(1, (cell == null ? void 0 : cell.rowSpan) ?? 1);
|
|
43894
43847
|
if (!cell || span <= 1 || cell.vMerge !== "restart") {
|
|
@@ -43941,34 +43894,13 @@ function createTableCellSpanOperations(deps) {
|
|
|
43941
43894
|
if (!nextParagraph) {
|
|
43942
43895
|
return current;
|
|
43943
43896
|
}
|
|
43944
|
-
|
|
43945
|
-
current,
|
|
43946
|
-
targetBlocks,
|
|
43947
|
-
location.zone
|
|
43948
|
-
);
|
|
43949
|
-
return {
|
|
43950
|
-
...nextState,
|
|
43951
|
-
selection: {
|
|
43952
|
-
anchor: paragraphOffsetToPosition(nextParagraph, 0),
|
|
43953
|
-
focus: paragraphOffsetToPosition(nextParagraph, 0)
|
|
43954
|
-
}
|
|
43955
|
-
};
|
|
43897
|
+
return commitTableMutation(current, targetBlocks, location.zone, nextParagraph);
|
|
43956
43898
|
};
|
|
43957
43899
|
const splitSelectedTableCell = (current) => {
|
|
43958
43900
|
var _a2;
|
|
43959
|
-
const
|
|
43960
|
-
|
|
43961
|
-
|
|
43962
|
-
getActiveSectionIndex(current)
|
|
43963
|
-
);
|
|
43964
|
-
if (!location) {
|
|
43965
|
-
return current;
|
|
43966
|
-
}
|
|
43967
|
-
const targetBlocks = deps.getTargetBlocks(current, location.zone).map(cloneBlock);
|
|
43968
|
-
const tableBlock = targetBlocks[location.blockIndex];
|
|
43969
|
-
if (!tableBlock || tableBlock.type !== "table") {
|
|
43970
|
-
return current;
|
|
43971
|
-
}
|
|
43901
|
+
const mut = resolveLocationTableMutation(current, deps.getTargetBlocks);
|
|
43902
|
+
if (!mut) return current;
|
|
43903
|
+
const { tableBlock, location, targetBlocks } = mut;
|
|
43972
43904
|
const row = tableBlock.rows[location.rowIndex];
|
|
43973
43905
|
const cell = row == null ? void 0 : row.cells[location.cellIndex];
|
|
43974
43906
|
const span = Math.max(1, (cell == null ? void 0 : cell.colSpan) ?? 1);
|
|
@@ -44015,18 +43947,7 @@ function createTableCellSpanOperations(deps) {
|
|
|
44015
43947
|
if (!nextParagraph) {
|
|
44016
43948
|
return current;
|
|
44017
43949
|
}
|
|
44018
|
-
|
|
44019
|
-
current,
|
|
44020
|
-
targetBlocks,
|
|
44021
|
-
location.zone
|
|
44022
|
-
);
|
|
44023
|
-
return {
|
|
44024
|
-
...nextState,
|
|
44025
|
-
selection: {
|
|
44026
|
-
anchor: paragraphOffsetToPosition(nextParagraph, 0),
|
|
44027
|
-
focus: paragraphOffsetToPosition(nextParagraph, 0)
|
|
44028
|
-
}
|
|
44029
|
-
};
|
|
43950
|
+
return commitTableMutation(current, targetBlocks, location.zone, nextParagraph);
|
|
44030
43951
|
};
|
|
44031
43952
|
const splitSelectedTable = (current) => {
|
|
44032
43953
|
if (deps.canSplitSelectedTableCellVertically(current)) {
|
|
@@ -44049,19 +43970,9 @@ function createTableCellSpanOperations(deps) {
|
|
|
44049
43970
|
function createTableRowColumnOperations(deps) {
|
|
44050
43971
|
const insertSelectedTableRow = (current, direction) => {
|
|
44051
43972
|
var _a2, _b2;
|
|
44052
|
-
const
|
|
44053
|
-
|
|
44054
|
-
|
|
44055
|
-
getActiveSectionIndex(current)
|
|
44056
|
-
);
|
|
44057
|
-
if (!location) {
|
|
44058
|
-
return current;
|
|
44059
|
-
}
|
|
44060
|
-
const targetBlocks = deps.getTargetBlocks(current, location.zone).map(cloneBlock);
|
|
44061
|
-
const tableBlock = targetBlocks[location.blockIndex];
|
|
44062
|
-
if (!tableBlock || tableBlock.type !== "table") {
|
|
44063
|
-
return current;
|
|
44064
|
-
}
|
|
43973
|
+
const mut = resolveLocationTableMutation(current, deps.getTargetBlocks);
|
|
43974
|
+
if (!mut) return current;
|
|
43975
|
+
const { tableBlock, location, targetBlocks } = mut;
|
|
44065
43976
|
const sourceRow = tableBlock.rows[location.rowIndex];
|
|
44066
43977
|
if (!sourceRow) {
|
|
44067
43978
|
return current;
|
|
@@ -44127,25 +44038,7 @@ function createTableRowColumnOperations(deps) {
|
|
|
44127
44038
|
const nextParagraph2 = (targetCell2 == null ? void 0 : targetCell2.blocks[0]) ?? ((_a2 = blankRow.cells.find(
|
|
44128
44039
|
(cell) => cell.vMerge !== "continue" && cell.blocks[0]
|
|
44129
44040
|
)) == null ? void 0 : _a2.blocks[0]) ?? findFirstNavigableParagraphInTable(tableBlock);
|
|
44130
|
-
|
|
44131
|
-
return updateBlocksInCurrentSection(
|
|
44132
|
-
current,
|
|
44133
|
-
targetBlocks,
|
|
44134
|
-
location.zone
|
|
44135
|
-
);
|
|
44136
|
-
}
|
|
44137
|
-
const nextState2 = updateBlocksInCurrentSection(
|
|
44138
|
-
current,
|
|
44139
|
-
targetBlocks,
|
|
44140
|
-
location.zone
|
|
44141
|
-
);
|
|
44142
|
-
return {
|
|
44143
|
-
...nextState2,
|
|
44144
|
-
selection: {
|
|
44145
|
-
anchor: paragraphOffsetToPosition(nextParagraph2, 0),
|
|
44146
|
-
focus: paragraphOffsetToPosition(nextParagraph2, 0)
|
|
44147
|
-
}
|
|
44148
|
-
};
|
|
44041
|
+
return commitTableMutation(current, targetBlocks, location.zone, nextParagraph2);
|
|
44149
44042
|
}
|
|
44150
44043
|
blankRow = createEditorTableRow(
|
|
44151
44044
|
sourceRow.cells.map(
|
|
@@ -44169,36 +44062,12 @@ function createTableRowColumnOperations(deps) {
|
|
|
44169
44062
|
const nextParagraph = (targetCell == null ? void 0 : targetCell.blocks[0]) ?? ((_b2 = blankRow.cells.find(
|
|
44170
44063
|
(cell) => cell.vMerge !== "continue" && cell.blocks[0]
|
|
44171
44064
|
)) == null ? void 0 : _b2.blocks[0]) ?? findFirstNavigableParagraphInTable(tableBlock);
|
|
44172
|
-
|
|
44173
|
-
return updateBlocksInCurrentSection(current, targetBlocks, location.zone);
|
|
44174
|
-
}
|
|
44175
|
-
const nextState = updateBlocksInCurrentSection(
|
|
44176
|
-
current,
|
|
44177
|
-
targetBlocks,
|
|
44178
|
-
location.zone
|
|
44179
|
-
);
|
|
44180
|
-
return {
|
|
44181
|
-
...nextState,
|
|
44182
|
-
selection: {
|
|
44183
|
-
anchor: paragraphOffsetToPosition(nextParagraph, 0),
|
|
44184
|
-
focus: paragraphOffsetToPosition(nextParagraph, 0)
|
|
44185
|
-
}
|
|
44186
|
-
};
|
|
44065
|
+
return commitTableMutation(current, targetBlocks, location.zone, nextParagraph);
|
|
44187
44066
|
};
|
|
44188
44067
|
const deleteSelectedTableRow = (current) => {
|
|
44189
|
-
const
|
|
44190
|
-
|
|
44191
|
-
|
|
44192
|
-
getActiveSectionIndex(current)
|
|
44193
|
-
);
|
|
44194
|
-
if (!location) {
|
|
44195
|
-
return current;
|
|
44196
|
-
}
|
|
44197
|
-
const targetBlocks = deps.getTargetBlocks(current, location.zone).map(cloneBlock);
|
|
44198
|
-
const tableBlock = targetBlocks[location.blockIndex];
|
|
44199
|
-
if (!tableBlock || tableBlock.type !== "table") {
|
|
44200
|
-
return current;
|
|
44201
|
-
}
|
|
44068
|
+
const mut = resolveLocationTableMutation(current, deps.getTargetBlocks);
|
|
44069
|
+
if (!mut) return current;
|
|
44070
|
+
const { tableBlock, location, targetBlocks } = mut;
|
|
44202
44071
|
if (tableBlock.rows.length <= 1 && !current.trackChangesEnabled) {
|
|
44203
44072
|
return current;
|
|
44204
44073
|
}
|
|
@@ -44214,7 +44083,7 @@ function createTableRowColumnOperations(deps) {
|
|
|
44214
44083
|
type: "delete"
|
|
44215
44084
|
}
|
|
44216
44085
|
};
|
|
44217
|
-
return
|
|
44086
|
+
return commitTableMutation(current, targetBlocks, location.zone, null);
|
|
44218
44087
|
}
|
|
44219
44088
|
const blockedByRestartCell = rowToDelete.cells.some(
|
|
44220
44089
|
(cell) => cell.vMerge !== "continue" && Math.max(1, cell.rowSpan ?? 1) > 1
|
|
@@ -44254,37 +44123,13 @@ function createTableRowColumnOperations(deps) {
|
|
|
44254
44123
|
)
|
|
44255
44124
|
) : null;
|
|
44256
44125
|
const nextParagraph = (targetCell == null ? void 0 : targetCell.blocks[0]) ?? findFirstNavigableParagraphInTable(tableBlock);
|
|
44257
|
-
|
|
44258
|
-
return updateBlocksInCurrentSection(current, targetBlocks, location.zone);
|
|
44259
|
-
}
|
|
44260
|
-
const nextState = updateBlocksInCurrentSection(
|
|
44261
|
-
current,
|
|
44262
|
-
targetBlocks,
|
|
44263
|
-
location.zone
|
|
44264
|
-
);
|
|
44265
|
-
return {
|
|
44266
|
-
...nextState,
|
|
44267
|
-
selection: {
|
|
44268
|
-
anchor: paragraphOffsetToPosition(nextParagraph, 0),
|
|
44269
|
-
focus: paragraphOffsetToPosition(nextParagraph, 0)
|
|
44270
|
-
}
|
|
44271
|
-
};
|
|
44126
|
+
return commitTableMutation(current, targetBlocks, location.zone, nextParagraph);
|
|
44272
44127
|
};
|
|
44273
44128
|
const insertSelectedTableColumn = (current, direction) => {
|
|
44274
44129
|
var _a2;
|
|
44275
|
-
const
|
|
44276
|
-
|
|
44277
|
-
|
|
44278
|
-
getActiveSectionIndex(current)
|
|
44279
|
-
);
|
|
44280
|
-
if (!location) {
|
|
44281
|
-
return current;
|
|
44282
|
-
}
|
|
44283
|
-
const targetBlocks = deps.getTargetBlocks(current, location.zone).map(cloneBlock);
|
|
44284
|
-
const tableBlock = targetBlocks[location.blockIndex];
|
|
44285
|
-
if (!tableBlock || tableBlock.type !== "table") {
|
|
44286
|
-
return current;
|
|
44287
|
-
}
|
|
44130
|
+
const mut = resolveLocationTableMutation(current, deps.getTargetBlocks);
|
|
44131
|
+
if (!mut) return current;
|
|
44132
|
+
const { tableBlock, location, targetBlocks } = mut;
|
|
44288
44133
|
const hasHorizontalSpansInTable = tableBlock.rows.some(
|
|
44289
44134
|
(row) => row.cells.some((cell) => Math.max(1, cell.colSpan ?? 1) > 1)
|
|
44290
44135
|
);
|
|
@@ -44355,25 +44200,7 @@ function createTableRowColumnOperations(deps) {
|
|
|
44355
44200
|
const targetRow2 = tableBlock.rows[location.rowIndex];
|
|
44356
44201
|
const targetCell2 = targetRow2 ? findCellAtVisualColumn(targetRow2, insertVisualColumn) : null;
|
|
44357
44202
|
const nextParagraph2 = (targetCell2 == null ? void 0 : targetCell2.blocks[0]) ?? findFirstNavigableParagraphInTable(tableBlock);
|
|
44358
|
-
|
|
44359
|
-
return updateBlocksInCurrentSection(
|
|
44360
|
-
current,
|
|
44361
|
-
targetBlocks,
|
|
44362
|
-
location.zone
|
|
44363
|
-
);
|
|
44364
|
-
}
|
|
44365
|
-
const nextState2 = updateBlocksInCurrentSection(
|
|
44366
|
-
current,
|
|
44367
|
-
targetBlocks,
|
|
44368
|
-
location.zone
|
|
44369
|
-
);
|
|
44370
|
-
return {
|
|
44371
|
-
...nextState2,
|
|
44372
|
-
selection: {
|
|
44373
|
-
anchor: paragraphOffsetToPosition(nextParagraph2, 0),
|
|
44374
|
-
focus: paragraphOffsetToPosition(nextParagraph2, 0)
|
|
44375
|
-
}
|
|
44376
|
-
};
|
|
44203
|
+
return commitTableMutation(current, targetBlocks, location.zone, nextParagraph2);
|
|
44377
44204
|
}
|
|
44378
44205
|
const insertIndex = Math.max(
|
|
44379
44206
|
0,
|
|
@@ -44397,37 +44224,13 @@ function createTableRowColumnOperations(deps) {
|
|
|
44397
44224
|
const targetRow = tableBlock.rows[location.rowIndex];
|
|
44398
44225
|
const targetCell = targetRow == null ? void 0 : targetRow.cells[insertIndex];
|
|
44399
44226
|
const nextParagraph = (targetCell == null ? void 0 : targetCell.blocks[0]) ?? findFirstNavigableParagraphInTable(tableBlock);
|
|
44400
|
-
|
|
44401
|
-
return updateBlocksInCurrentSection(current, targetBlocks, location.zone);
|
|
44402
|
-
}
|
|
44403
|
-
const nextState = updateBlocksInCurrentSection(
|
|
44404
|
-
current,
|
|
44405
|
-
targetBlocks,
|
|
44406
|
-
location.zone
|
|
44407
|
-
);
|
|
44408
|
-
return {
|
|
44409
|
-
...nextState,
|
|
44410
|
-
selection: {
|
|
44411
|
-
anchor: paragraphOffsetToPosition(nextParagraph, 0),
|
|
44412
|
-
focus: paragraphOffsetToPosition(nextParagraph, 0)
|
|
44413
|
-
}
|
|
44414
|
-
};
|
|
44227
|
+
return commitTableMutation(current, targetBlocks, location.zone, nextParagraph);
|
|
44415
44228
|
};
|
|
44416
44229
|
const deleteSelectedTableColumn = (current) => {
|
|
44417
44230
|
var _a2;
|
|
44418
|
-
const
|
|
44419
|
-
|
|
44420
|
-
|
|
44421
|
-
getActiveSectionIndex(current)
|
|
44422
|
-
);
|
|
44423
|
-
if (!location) {
|
|
44424
|
-
return current;
|
|
44425
|
-
}
|
|
44426
|
-
const targetBlocks = deps.getTargetBlocks(current, location.zone).map(cloneBlock);
|
|
44427
|
-
const tableBlock = targetBlocks[location.blockIndex];
|
|
44428
|
-
if (!tableBlock || tableBlock.type !== "table") {
|
|
44429
|
-
return current;
|
|
44430
|
-
}
|
|
44231
|
+
const mut = resolveLocationTableMutation(current, deps.getTargetBlocks);
|
|
44232
|
+
if (!mut) return current;
|
|
44233
|
+
const { tableBlock, location, targetBlocks } = mut;
|
|
44431
44234
|
if (getTableVisualWidth(tableBlock) <= 1) {
|
|
44432
44235
|
return current;
|
|
44433
44236
|
}
|
|
@@ -44449,7 +44252,7 @@ function createTableRowColumnOperations(deps) {
|
|
|
44449
44252
|
};
|
|
44450
44253
|
}
|
|
44451
44254
|
}
|
|
44452
|
-
return
|
|
44255
|
+
return commitTableMutation(current, targetBlocks, location.zone, null);
|
|
44453
44256
|
}
|
|
44454
44257
|
const hasHorizontalSpansInTable = tableBlock.rows.some(
|
|
44455
44258
|
(row) => row.cells.some((cell) => Math.max(1, cell.colSpan ?? 1) > 1)
|
|
@@ -44488,25 +44291,7 @@ function createTableRowColumnOperations(deps) {
|
|
|
44488
44291
|
)
|
|
44489
44292
|
);
|
|
44490
44293
|
const nextParagraph2 = (targetCell2 == null ? void 0 : targetCell2.blocks[0]) ?? findFirstNavigableParagraphInTable(tableBlock);
|
|
44491
|
-
|
|
44492
|
-
return updateBlocksInCurrentSection(
|
|
44493
|
-
current,
|
|
44494
|
-
targetBlocks,
|
|
44495
|
-
location.zone
|
|
44496
|
-
);
|
|
44497
|
-
}
|
|
44498
|
-
const nextState2 = updateBlocksInCurrentSection(
|
|
44499
|
-
current,
|
|
44500
|
-
targetBlocks,
|
|
44501
|
-
location.zone
|
|
44502
|
-
);
|
|
44503
|
-
return {
|
|
44504
|
-
...nextState2,
|
|
44505
|
-
selection: {
|
|
44506
|
-
anchor: paragraphOffsetToPosition(nextParagraph2, 0),
|
|
44507
|
-
focus: paragraphOffsetToPosition(nextParagraph2, 0)
|
|
44508
|
-
}
|
|
44509
|
-
};
|
|
44294
|
+
return commitTableMutation(current, targetBlocks, location.zone, nextParagraph2);
|
|
44510
44295
|
}
|
|
44511
44296
|
if (((_a2 = tableBlock.rows[0]) == null ? void 0 : _a2.cells.length) <= 1) {
|
|
44512
44297
|
return current;
|
|
@@ -44517,21 +44302,7 @@ function createTableRowColumnOperations(deps) {
|
|
|
44517
44302
|
const targetRow = tableBlock.rows[location.rowIndex];
|
|
44518
44303
|
const targetCell = targetRow == null ? void 0 : targetRow.cells[Math.min(location.cellIndex, targetRow.cells.length - 1)];
|
|
44519
44304
|
const nextParagraph = (targetCell == null ? void 0 : targetCell.blocks[0]) ?? findFirstNavigableParagraphInTable(tableBlock);
|
|
44520
|
-
|
|
44521
|
-
return updateBlocksInCurrentSection(current, targetBlocks, location.zone);
|
|
44522
|
-
}
|
|
44523
|
-
const nextState = updateBlocksInCurrentSection(
|
|
44524
|
-
current,
|
|
44525
|
-
targetBlocks,
|
|
44526
|
-
location.zone
|
|
44527
|
-
);
|
|
44528
|
-
return {
|
|
44529
|
-
...nextState,
|
|
44530
|
-
selection: {
|
|
44531
|
-
anchor: paragraphOffsetToPosition(nextParagraph, 0),
|
|
44532
|
-
focus: paragraphOffsetToPosition(nextParagraph, 0)
|
|
44533
|
-
}
|
|
44534
|
-
};
|
|
44305
|
+
return commitTableMutation(current, targetBlocks, location.zone, nextParagraph);
|
|
44535
44306
|
};
|
|
44536
44307
|
return {
|
|
44537
44308
|
insertSelectedTableRow,
|
|
@@ -47248,6 +47019,111 @@ function createEditorSurfaceEvents(deps) {
|
|
|
47248
47019
|
stopDragging();
|
|
47249
47020
|
deps.focusInputAfterPointerSelection();
|
|
47250
47021
|
};
|
|
47022
|
+
const handleZoneTransitionDown = (state, hit, clickDetail) => {
|
|
47023
|
+
if (clickDetail < 2) {
|
|
47024
|
+
dragAnchor = null;
|
|
47025
|
+
stopDragging();
|
|
47026
|
+
deps.focusInputAfterPointerSelection();
|
|
47027
|
+
return;
|
|
47028
|
+
}
|
|
47029
|
+
dragAnchor = null;
|
|
47030
|
+
if (hit.resolvedFromParagraph) {
|
|
47031
|
+
applyWithZone(
|
|
47032
|
+
state,
|
|
47033
|
+
hit.zone,
|
|
47034
|
+
{
|
|
47035
|
+
...state,
|
|
47036
|
+
selection: { anchor: { ...hit.position }, focus: { ...hit.position } }
|
|
47037
|
+
},
|
|
47038
|
+
hit.position
|
|
47039
|
+
);
|
|
47040
|
+
} else {
|
|
47041
|
+
applyWithZone(state, hit.zone, state);
|
|
47042
|
+
}
|
|
47043
|
+
stopDragging();
|
|
47044
|
+
deps.focusInputAfterPointerSelection();
|
|
47045
|
+
};
|
|
47046
|
+
const handleTextBoxDown = (state, hit) => {
|
|
47047
|
+
const textBoxParagraph = deps.getParagraphById(
|
|
47048
|
+
state.document,
|
|
47049
|
+
hit.textBox.paragraphId
|
|
47050
|
+
);
|
|
47051
|
+
if (!textBoxParagraph) {
|
|
47052
|
+
deps.focusInputAfterPointerSelection();
|
|
47053
|
+
return;
|
|
47054
|
+
}
|
|
47055
|
+
dragAnchor = null;
|
|
47056
|
+
const start = paragraphOffsetToPosition(textBoxParagraph, hit.textBox.startOffset);
|
|
47057
|
+
const end = paragraphOffsetToPosition(textBoxParagraph, hit.textBox.endOffset);
|
|
47058
|
+
applyWithZone(state, hit.zone, setSelection(state, { anchor: start, focus: end }), start);
|
|
47059
|
+
stopDragging();
|
|
47060
|
+
deps.focusInputAfterPointerSelection();
|
|
47061
|
+
};
|
|
47062
|
+
const handleImageDown = (state, hit, event) => {
|
|
47063
|
+
const imageParagraph = deps.getParagraphById(
|
|
47064
|
+
state.document,
|
|
47065
|
+
hit.image.paragraphId
|
|
47066
|
+
);
|
|
47067
|
+
if (!imageParagraph) {
|
|
47068
|
+
deps.focusInputAfterPointerSelection();
|
|
47069
|
+
return;
|
|
47070
|
+
}
|
|
47071
|
+
dragAnchor = null;
|
|
47072
|
+
const start = paragraphOffsetToPosition(imageParagraph, hit.image.startOffset);
|
|
47073
|
+
const end = paragraphOffsetToPosition(imageParagraph, hit.image.endOffset);
|
|
47074
|
+
applyWithZone(state, hit.zone, setSelection(state, { anchor: start, focus: end }), start);
|
|
47075
|
+
stopDragging();
|
|
47076
|
+
deps.imageOps.startImageDrag(
|
|
47077
|
+
hit.image.paragraphId,
|
|
47078
|
+
hit.image.startOffset,
|
|
47079
|
+
event,
|
|
47080
|
+
{
|
|
47081
|
+
left: hit.image.left,
|
|
47082
|
+
top: hit.image.top,
|
|
47083
|
+
width: hit.image.width,
|
|
47084
|
+
height: hit.image.height
|
|
47085
|
+
}
|
|
47086
|
+
);
|
|
47087
|
+
deps.focusInputAfterPointerSelection();
|
|
47088
|
+
};
|
|
47089
|
+
const handleShiftClickDown = (state, hit) => {
|
|
47090
|
+
dragAnchor = state.selection.anchor;
|
|
47091
|
+
applyWithZone(
|
|
47092
|
+
state,
|
|
47093
|
+
hit.zone,
|
|
47094
|
+
setSelection(state, { anchor: state.selection.anchor, focus: hit.position }),
|
|
47095
|
+
hit.position
|
|
47096
|
+
);
|
|
47097
|
+
window.addEventListener("mousemove", handleWindowMouseMove);
|
|
47098
|
+
window.addEventListener("mouseup", handleWindowMouseUp);
|
|
47099
|
+
deps.focusInputAfterPointerSelection();
|
|
47100
|
+
};
|
|
47101
|
+
const handleTripleClickDown = (state, hit, paragraph) => {
|
|
47102
|
+
dragAnchor = null;
|
|
47103
|
+
const range = resolveTripleClickParagraphRange(state, paragraph, hit.zone);
|
|
47104
|
+
applyWithZone(
|
|
47105
|
+
state,
|
|
47106
|
+
hit.zone,
|
|
47107
|
+
setSelection(state, { anchor: range.start, focus: range.end }),
|
|
47108
|
+
range.start
|
|
47109
|
+
);
|
|
47110
|
+
stopDragging();
|
|
47111
|
+
deps.focusInputAfterPointerSelection();
|
|
47112
|
+
};
|
|
47113
|
+
const handleDoubleClickDown = (state, hit, paragraph) => {
|
|
47114
|
+
dragAnchor = null;
|
|
47115
|
+
const word = resolveWordSelection(getParagraphText(paragraph), hit.paragraphOffset);
|
|
47116
|
+
const startPos = paragraphOffsetToPosition(paragraph, word.start);
|
|
47117
|
+
const endPos = paragraphOffsetToPosition(paragraph, word.end);
|
|
47118
|
+
applyWithZone(
|
|
47119
|
+
state,
|
|
47120
|
+
hit.zone,
|
|
47121
|
+
setSelection(state, { anchor: startPos, focus: endPos }),
|
|
47122
|
+
startPos
|
|
47123
|
+
);
|
|
47124
|
+
stopDragging();
|
|
47125
|
+
deps.focusInputAfterPointerSelection();
|
|
47126
|
+
};
|
|
47251
47127
|
const handleSurfaceMouseDown = (event) => {
|
|
47252
47128
|
var _a2;
|
|
47253
47129
|
if (event.button !== 0) {
|
|
@@ -47293,155 +47169,27 @@ function createEditorSurfaceEvents(deps) {
|
|
|
47293
47169
|
const paragraph = deps.getParagraphById(state.document, hit.paragraphId);
|
|
47294
47170
|
const isZoneTransition = hit.zone !== (state.activeZone ?? "main");
|
|
47295
47171
|
if (isZoneTransition) {
|
|
47296
|
-
|
|
47297
|
-
dragAnchor = null;
|
|
47298
|
-
stopDragging();
|
|
47299
|
-
deps.focusInputAfterPointerSelection();
|
|
47300
|
-
return;
|
|
47301
|
-
}
|
|
47302
|
-
dragAnchor = null;
|
|
47303
|
-
if (hit.resolvedFromParagraph) {
|
|
47304
|
-
applyWithZone(
|
|
47305
|
-
state,
|
|
47306
|
-
hit.zone,
|
|
47307
|
-
{
|
|
47308
|
-
...state,
|
|
47309
|
-
selection: {
|
|
47310
|
-
anchor: { ...hit.position },
|
|
47311
|
-
focus: { ...hit.position }
|
|
47312
|
-
}
|
|
47313
|
-
},
|
|
47314
|
-
hit.position
|
|
47315
|
-
);
|
|
47316
|
-
} else {
|
|
47317
|
-
applyWithZone(state, hit.zone, state);
|
|
47318
|
-
}
|
|
47319
|
-
stopDragging();
|
|
47320
|
-
deps.focusInputAfterPointerSelection();
|
|
47172
|
+
handleZoneTransitionDown(state, hit, clickDetail);
|
|
47321
47173
|
return;
|
|
47322
47174
|
}
|
|
47323
47175
|
if (hit.textBox) {
|
|
47324
|
-
|
|
47325
|
-
state.document,
|
|
47326
|
-
hit.textBox.paragraphId
|
|
47327
|
-
);
|
|
47328
|
-
if (!textBoxParagraph) {
|
|
47329
|
-
deps.focusInputAfterPointerSelection();
|
|
47330
|
-
return;
|
|
47331
|
-
}
|
|
47332
|
-
dragAnchor = null;
|
|
47333
|
-
const start = paragraphOffsetToPosition(
|
|
47334
|
-
textBoxParagraph,
|
|
47335
|
-
hit.textBox.startOffset
|
|
47336
|
-
);
|
|
47337
|
-
const end = paragraphOffsetToPosition(
|
|
47338
|
-
textBoxParagraph,
|
|
47339
|
-
hit.textBox.endOffset
|
|
47340
|
-
);
|
|
47341
|
-
applyWithZone(
|
|
47342
|
-
state,
|
|
47343
|
-
hit.zone,
|
|
47344
|
-
setSelection(state, {
|
|
47345
|
-
anchor: start,
|
|
47346
|
-
focus: end
|
|
47347
|
-
}),
|
|
47348
|
-
start
|
|
47349
|
-
);
|
|
47350
|
-
stopDragging();
|
|
47351
|
-
deps.focusInputAfterPointerSelection();
|
|
47176
|
+
handleTextBoxDown(state, hit);
|
|
47352
47177
|
return;
|
|
47353
47178
|
}
|
|
47354
47179
|
if (hit.image) {
|
|
47355
|
-
|
|
47356
|
-
state.document,
|
|
47357
|
-
hit.image.paragraphId
|
|
47358
|
-
);
|
|
47359
|
-
if (!imageParagraph) {
|
|
47360
|
-
deps.focusInputAfterPointerSelection();
|
|
47361
|
-
return;
|
|
47362
|
-
}
|
|
47363
|
-
dragAnchor = null;
|
|
47364
|
-
const start = paragraphOffsetToPosition(
|
|
47365
|
-
imageParagraph,
|
|
47366
|
-
hit.image.startOffset
|
|
47367
|
-
);
|
|
47368
|
-
const end = paragraphOffsetToPosition(
|
|
47369
|
-
imageParagraph,
|
|
47370
|
-
hit.image.endOffset
|
|
47371
|
-
);
|
|
47372
|
-
applyWithZone(
|
|
47373
|
-
state,
|
|
47374
|
-
hit.zone,
|
|
47375
|
-
setSelection(state, {
|
|
47376
|
-
anchor: start,
|
|
47377
|
-
focus: end
|
|
47378
|
-
}),
|
|
47379
|
-
start
|
|
47380
|
-
);
|
|
47381
|
-
stopDragging();
|
|
47382
|
-
deps.imageOps.startImageDrag(
|
|
47383
|
-
hit.image.paragraphId,
|
|
47384
|
-
hit.image.startOffset,
|
|
47385
|
-
event,
|
|
47386
|
-
{
|
|
47387
|
-
left: hit.image.left,
|
|
47388
|
-
top: hit.image.top,
|
|
47389
|
-
width: hit.image.width,
|
|
47390
|
-
height: hit.image.height
|
|
47391
|
-
}
|
|
47392
|
-
);
|
|
47393
|
-
deps.focusInputAfterPointerSelection();
|
|
47180
|
+
handleImageDown(state, hit, event);
|
|
47394
47181
|
return;
|
|
47395
47182
|
}
|
|
47396
47183
|
if (event.shiftKey && hit.resolvedFromParagraph) {
|
|
47397
|
-
|
|
47398
|
-
applyWithZone(
|
|
47399
|
-
state,
|
|
47400
|
-
hit.zone,
|
|
47401
|
-
setSelection(state, {
|
|
47402
|
-
anchor: state.selection.anchor,
|
|
47403
|
-
focus: hit.position
|
|
47404
|
-
}),
|
|
47405
|
-
hit.position
|
|
47406
|
-
);
|
|
47407
|
-
window.addEventListener("mousemove", handleWindowMouseMove);
|
|
47408
|
-
window.addEventListener("mouseup", handleWindowMouseUp);
|
|
47409
|
-
deps.focusInputAfterPointerSelection();
|
|
47184
|
+
handleShiftClickDown(state, hit);
|
|
47410
47185
|
return;
|
|
47411
47186
|
}
|
|
47412
47187
|
if (clickDetail >= 3 && paragraph) {
|
|
47413
|
-
|
|
47414
|
-
const range = resolveTripleClickParagraphRange(
|
|
47415
|
-
state,
|
|
47416
|
-
paragraph,
|
|
47417
|
-
hit.zone
|
|
47418
|
-
);
|
|
47419
|
-
applyWithZone(
|
|
47420
|
-
state,
|
|
47421
|
-
hit.zone,
|
|
47422
|
-
setSelection(state, { anchor: range.start, focus: range.end }),
|
|
47423
|
-
range.start
|
|
47424
|
-
);
|
|
47425
|
-
stopDragging();
|
|
47426
|
-
deps.focusInputAfterPointerSelection();
|
|
47188
|
+
handleTripleClickDown(state, hit, paragraph);
|
|
47427
47189
|
return;
|
|
47428
47190
|
}
|
|
47429
47191
|
if (clickDetail === 2 && paragraph) {
|
|
47430
|
-
|
|
47431
|
-
const word = resolveWordSelection(
|
|
47432
|
-
getParagraphText(paragraph),
|
|
47433
|
-
hit.paragraphOffset
|
|
47434
|
-
);
|
|
47435
|
-
const startPos = paragraphOffsetToPosition(paragraph, word.start);
|
|
47436
|
-
const endPos = paragraphOffsetToPosition(paragraph, word.end);
|
|
47437
|
-
applyWithZone(
|
|
47438
|
-
state,
|
|
47439
|
-
hit.zone,
|
|
47440
|
-
setSelection(state, { anchor: startPos, focus: endPos }),
|
|
47441
|
-
startPos
|
|
47442
|
-
);
|
|
47443
|
-
stopDragging();
|
|
47444
|
-
deps.focusInputAfterPointerSelection();
|
|
47192
|
+
handleDoubleClickDown(state, hit, paragraph);
|
|
47445
47193
|
return;
|
|
47446
47194
|
}
|
|
47447
47195
|
if (!hit.resolvedFromParagraph) {
|
|
@@ -49043,6 +48791,30 @@ function createEditorCommandsController(deps) {
|
|
|
49043
48791
|
selectionCollapsed,
|
|
49044
48792
|
selectedImageRun
|
|
49045
48793
|
} = deps;
|
|
48794
|
+
const execState = (next) => {
|
|
48795
|
+
clearPreferredColumn();
|
|
48796
|
+
resetTransactionGrouping();
|
|
48797
|
+
applyState(next);
|
|
48798
|
+
focusInput();
|
|
48799
|
+
};
|
|
48800
|
+
const execText = (producer) => {
|
|
48801
|
+
clearPreferredColumn();
|
|
48802
|
+
resetTransactionGrouping();
|
|
48803
|
+
applySelectionAwareTextCommand(producer);
|
|
48804
|
+
focusInput();
|
|
48805
|
+
};
|
|
48806
|
+
const execParagraph = (producer) => {
|
|
48807
|
+
clearPreferredColumn();
|
|
48808
|
+
resetTransactionGrouping();
|
|
48809
|
+
applySelectionAwareParagraphCommand(producer);
|
|
48810
|
+
focusInput();
|
|
48811
|
+
};
|
|
48812
|
+
const execTransactional = (producer, options) => {
|
|
48813
|
+
clearPreferredColumn();
|
|
48814
|
+
resetTransactionGrouping();
|
|
48815
|
+
applyTransactionalState(producer, options);
|
|
48816
|
+
focusInput();
|
|
48817
|
+
};
|
|
49046
48818
|
const getSelectedParagraphRange = () => {
|
|
49047
48819
|
const normalized = normalizeSelection(state);
|
|
49048
48820
|
return getParagraphs(state).slice(
|
|
@@ -49068,12 +48840,9 @@ function createEditorCommandsController(deps) {
|
|
|
49068
48840
|
if (!selectionTouchesList()) {
|
|
49069
48841
|
return false;
|
|
49070
48842
|
}
|
|
49071
|
-
|
|
49072
|
-
resetTransactionGrouping();
|
|
49073
|
-
applySelectionAwareParagraphCommand(
|
|
48843
|
+
execParagraph(
|
|
49074
48844
|
(current) => direction === "indent" ? indentParagraphList(current) : outdentParagraphList(current)
|
|
49075
48845
|
);
|
|
49076
|
-
focusInput();
|
|
49077
48846
|
return true;
|
|
49078
48847
|
};
|
|
49079
48848
|
const handleListEnter = () => {
|
|
@@ -49146,10 +48915,7 @@ function createEditorCommandsController(deps) {
|
|
|
49146
48915
|
logger.info(
|
|
49147
48916
|
`toggleStyle:${key} at ${sel.anchor.paragraphId}:${sel.anchor.runId}[${sel.anchor.offset}..${sel.focus.offset}]${selectionTableLocation()}`
|
|
49148
48917
|
);
|
|
49149
|
-
|
|
49150
|
-
resetTransactionGrouping();
|
|
49151
|
-
applySelectionAwareTextCommand((current) => toggleTextStyle(current, key));
|
|
49152
|
-
focusInput();
|
|
48918
|
+
execText((current) => toggleTextStyle(current, key));
|
|
49153
48919
|
};
|
|
49154
48920
|
const applyValueStyleCommand = (key, value) => {
|
|
49155
48921
|
if (selectionCollapsed()) {
|
|
@@ -49159,117 +48925,64 @@ function createEditorCommandsController(deps) {
|
|
|
49159
48925
|
logger.info(
|
|
49160
48926
|
`setStyle:${key}=${JSON.stringify(value)} at ${sel.anchor.paragraphId}:${sel.anchor.runId}[${sel.anchor.offset}..${sel.focus.offset}]${selectionTableLocation()}`
|
|
49161
48927
|
);
|
|
49162
|
-
|
|
49163
|
-
resetTransactionGrouping();
|
|
49164
|
-
applySelectionAwareTextCommand(
|
|
49165
|
-
(current) => setTextStyleValue(current, key, value)
|
|
49166
|
-
);
|
|
49167
|
-
focusInput();
|
|
48928
|
+
execText((current) => setTextStyleValue(current, key, value));
|
|
49168
48929
|
};
|
|
49169
48930
|
const applyChangeTextCaseCommand = (mode) => {
|
|
49170
48931
|
if (selectionCollapsed()) {
|
|
49171
48932
|
return;
|
|
49172
48933
|
}
|
|
49173
|
-
|
|
49174
|
-
resetTransactionGrouping();
|
|
49175
|
-
applySelectionAwareTextCommand(
|
|
49176
|
-
(current) => changeSelectedTextCase(current, mode)
|
|
49177
|
-
);
|
|
49178
|
-
focusInput();
|
|
48934
|
+
execText((current) => changeSelectedTextCase(current, mode));
|
|
49179
48935
|
};
|
|
49180
48936
|
const applyClearFormattingCommand = () => {
|
|
49181
48937
|
if (selectionCollapsed()) {
|
|
49182
48938
|
return;
|
|
49183
48939
|
}
|
|
49184
|
-
|
|
49185
|
-
resetTransactionGrouping();
|
|
49186
|
-
applySelectionAwareTextCommand(
|
|
49187
|
-
(current) => clearSelectedTextFormatting(current)
|
|
49188
|
-
);
|
|
49189
|
-
focusInput();
|
|
48940
|
+
execText((current) => clearSelectedTextFormatting(current));
|
|
49190
48941
|
};
|
|
49191
48942
|
const applyParagraphStyleCommand = (key, value) => {
|
|
49192
|
-
|
|
49193
|
-
resetTransactionGrouping();
|
|
49194
|
-
applySelectionAwareParagraphCommand(
|
|
49195
|
-
(current) => setParagraphStyle(current, key, value)
|
|
49196
|
-
);
|
|
49197
|
-
focusInput();
|
|
48943
|
+
execParagraph((current) => setParagraphStyle(current, key, value));
|
|
49198
48944
|
};
|
|
49199
48945
|
const toggleParagraphFlagCommand = (key) => {
|
|
49200
48946
|
const nextValue = !toolbarStyleState()[key];
|
|
49201
48947
|
applyParagraphStyleCommand(key, nextValue ? true : null);
|
|
49202
48948
|
};
|
|
49203
48949
|
const applyParagraphListCommand = (kind) => {
|
|
49204
|
-
|
|
49205
|
-
resetTransactionGrouping();
|
|
49206
|
-
applySelectionAwareParagraphCommand(
|
|
49207
|
-
(current) => toggleParagraphList(current, kind)
|
|
49208
|
-
);
|
|
49209
|
-
focusInput();
|
|
48950
|
+
execParagraph((current) => toggleParagraphList(current, kind));
|
|
49210
48951
|
};
|
|
49211
48952
|
const handleListFormatChange = (format) => {
|
|
49212
|
-
|
|
49213
|
-
resetTransactionGrouping();
|
|
49214
|
-
applySelectionAwareParagraphCommand(
|
|
49215
|
-
(current) => setParagraphListFormat(current, format)
|
|
49216
|
-
);
|
|
49217
|
-
focusInput();
|
|
48953
|
+
execParagraph((current) => setParagraphListFormat(current, format));
|
|
49218
48954
|
};
|
|
49219
48955
|
const handleListStartAtChange = (startAt) => {
|
|
49220
|
-
|
|
49221
|
-
resetTransactionGrouping();
|
|
49222
|
-
applySelectionAwareParagraphCommand(
|
|
49223
|
-
(current) => setParagraphListStartAt(current, startAt)
|
|
49224
|
-
);
|
|
49225
|
-
focusInput();
|
|
48956
|
+
execParagraph((current) => setParagraphListStartAt(current, startAt));
|
|
49226
48957
|
};
|
|
49227
48958
|
const applyInsertSectionBreakCommand = (breakType) => {
|
|
49228
|
-
|
|
49229
|
-
resetTransactionGrouping();
|
|
49230
|
-
applyState(insertSectionBreakAtSelection(state, breakType));
|
|
49231
|
-
focusInput();
|
|
48959
|
+
execState(insertSectionBreakAtSelection(state, breakType));
|
|
49232
48960
|
};
|
|
49233
48961
|
const applyInsertPageBreakCommand = () => {
|
|
49234
|
-
|
|
49235
|
-
resetTransactionGrouping();
|
|
49236
|
-
applyTransactionalState(
|
|
48962
|
+
execTransactional(
|
|
49237
48963
|
(current) => applyTableAwareParagraphEdit2(
|
|
49238
48964
|
current,
|
|
49239
48965
|
(temp) => insertPageBreakAtSelection(temp)
|
|
49240
48966
|
)
|
|
49241
48967
|
);
|
|
49242
|
-
focusInput();
|
|
49243
48968
|
};
|
|
49244
48969
|
const canInsertFootnoteCommand = () => (state.activeZone ?? "main") === "main";
|
|
49245
48970
|
const applyInsertFootnoteCommand = () => {
|
|
49246
48971
|
if (!canInsertFootnoteCommand()) {
|
|
49247
48972
|
return;
|
|
49248
48973
|
}
|
|
49249
|
-
|
|
49250
|
-
resetTransactionGrouping();
|
|
49251
|
-
applyTransactionalState((current) => insertFootnote(current));
|
|
49252
|
-
focusInput();
|
|
48974
|
+
execTransactional((current) => insertFootnote(current));
|
|
49253
48975
|
};
|
|
49254
48976
|
const handleStyleChange = (styleId) => {
|
|
49255
|
-
|
|
49256
|
-
resetTransactionGrouping();
|
|
49257
|
-
applySelectionAwareParagraphCommand(
|
|
48977
|
+
execParagraph(
|
|
49258
48978
|
(current) => setParagraphNamedStyle(current, styleId || null)
|
|
49259
48979
|
);
|
|
49260
|
-
focusInput();
|
|
49261
48980
|
};
|
|
49262
48981
|
const applyUpdateSectionSettingsCommand = (sectionIndex, settings) => {
|
|
49263
|
-
|
|
49264
|
-
resetTransactionGrouping();
|
|
49265
|
-
applyState(updateSectionSettings(state, sectionIndex, settings));
|
|
49266
|
-
focusInput();
|
|
48982
|
+
execState(updateSectionSettings(state, sectionIndex, settings));
|
|
49267
48983
|
};
|
|
49268
48984
|
const applyToggleTrackChangesCommand = () => {
|
|
49269
|
-
|
|
49270
|
-
resetTransactionGrouping();
|
|
49271
|
-
applyState(toggleTrackChanges(state));
|
|
49272
|
-
focusInput();
|
|
48985
|
+
execState(toggleTrackChanges(state));
|
|
49273
48986
|
};
|
|
49274
48987
|
const applyToggleShowMarginsCommand = () => {
|
|
49275
48988
|
applyState({ ...state, showMargins: !state.showMargins });
|
|
@@ -49280,28 +48993,19 @@ function createEditorCommandsController(deps) {
|
|
|
49280
48993
|
focusInput();
|
|
49281
48994
|
};
|
|
49282
48995
|
const applyAcceptRevisionsCommand = () => {
|
|
49283
|
-
|
|
49284
|
-
resetTransactionGrouping();
|
|
49285
|
-
applyState(acceptRevisionsInSelection(state));
|
|
49286
|
-
focusInput();
|
|
48996
|
+
execState(acceptRevisionsInSelection(state));
|
|
49287
48997
|
};
|
|
49288
48998
|
const applyRejectRevisionsCommand = () => {
|
|
49289
|
-
|
|
49290
|
-
resetTransactionGrouping();
|
|
49291
|
-
applyState(rejectRevisionsInSelection(state));
|
|
49292
|
-
focusInput();
|
|
48999
|
+
execState(rejectRevisionsInSelection(state));
|
|
49293
49000
|
};
|
|
49294
49001
|
const applyLinkCommand = (href) => {
|
|
49295
49002
|
const activeLink = getLinkAtSelection(state);
|
|
49296
49003
|
if (selectionCollapsed() && !activeLink) {
|
|
49297
49004
|
return;
|
|
49298
49005
|
}
|
|
49299
|
-
|
|
49300
|
-
resetTransactionGrouping();
|
|
49301
|
-
applyTransactionalState((current) => setLinkAtSelection(current, href), {
|
|
49006
|
+
execTransactional((current) => setLinkAtSelection(current, href), {
|
|
49302
49007
|
mergeKey: MERGE_KEYS.link
|
|
49303
49008
|
});
|
|
49304
|
-
focusInput();
|
|
49305
49009
|
};
|
|
49306
49010
|
const promptForLink = () => {
|
|
49307
49011
|
const activeLink = getLinkAtSelection(state) ?? "";
|
|
@@ -49318,12 +49022,9 @@ function createEditorCommandsController(deps) {
|
|
|
49318
49022
|
if (!run) {
|
|
49319
49023
|
return;
|
|
49320
49024
|
}
|
|
49321
|
-
|
|
49322
|
-
resetTransactionGrouping();
|
|
49323
|
-
applyTransactionalState((current) => setSelectedImageAlt(current, alt), {
|
|
49025
|
+
execTransactional((current) => setSelectedImageAlt(current, alt), {
|
|
49324
49026
|
mergeKey: MERGE_KEYS.imageAlt
|
|
49325
49027
|
});
|
|
49326
|
-
focusInput();
|
|
49327
49028
|
};
|
|
49328
49029
|
const promptForImageAlt = () => {
|
|
49329
49030
|
var _a2;
|
|
@@ -49339,13 +49040,10 @@ function createEditorCommandsController(deps) {
|
|
|
49339
49040
|
if (!run) {
|
|
49340
49041
|
return;
|
|
49341
49042
|
}
|
|
49342
|
-
|
|
49343
|
-
resetTransactionGrouping();
|
|
49344
|
-
applyTransactionalState(
|
|
49043
|
+
execTransactional(
|
|
49345
49044
|
(current) => setSelectedImageCaption(current, caption, deps.imageCaptionLabel()),
|
|
49346
49045
|
{ mergeKey: MERGE_KEYS.imageCaption }
|
|
49347
49046
|
);
|
|
49348
|
-
focusInput();
|
|
49349
49047
|
};
|
|
49350
49048
|
const promptForImageCaption = () => {
|
|
49351
49049
|
const run = selectedImageRun();
|