oasis-editor 0.0.153 → 0.0.154
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-DjlntWNK.js → OasisEditorApp-BfdBu3ui.js} +501 -12
- package/dist/assets/importDocxWorker-DpJa1l2G.js +12 -0
- package/dist/core/commands/builtinCommands.d.ts +1 -1
- package/dist/core/commands/design.d.ts +11 -0
- package/dist/core/commands/publicCommandTypes.d.ts +11 -1
- package/dist/core/model/index.d.ts +1 -1
- package/dist/core/model/types/document.d.ts +43 -0
- package/dist/core/model/types/layout.d.ts +2 -0
- package/dist/core/pluginUiTypes.d.ts +1 -1
- package/dist/export/docx/docxDocumentXml.d.ts +1 -1
- package/dist/export/docx/docxPackageXml.d.ts +2 -2
- package/dist/export/docx/themeXml.d.ts +3 -0
- package/dist/export/pdf/OasisPdfWriter.d.ts +1 -0
- package/dist/export/pdf/draw/drawPageBackground.d.ts +2 -1
- package/dist/export/pdf/writer/PdfContentStream.d.ts +1 -0
- package/dist/export/pdf/writer/pdfTypes.d.ts +1 -0
- package/dist/i18n/locales/en.d.ts +26 -0
- package/dist/i18n/locales/pt-BR.d.ts +26 -0
- package/dist/import/docx/sectionProperties.d.ts +2 -1
- package/dist/import/docx/theme.d.ts +2 -0
- package/dist/{index-D_-RY5pS.js → index-DQLjp1z0.js} +1199 -410
- package/dist/oasis-editor.css +1 -1
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/plugins/internal/createEssentialsPlugin.d.ts +1 -1
- package/dist/plugins/internal/essentialsCapabilities.d.ts +16 -1
- package/dist/plugins/internal/essentialsCommandGroups/design.d.ts +8 -0
- package/dist/ui/app/essentials/design.d.ts +4 -0
- package/dist/ui/app/essentials/types.d.ts +2 -0
- package/dist/ui/components/Toolbar/DesignGallery.d.ts +16 -0
- package/package.json +1 -1
- package/dist/assets/importDocxWorker-Ddoy1WwF.js +0 -12
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
3
3
|
var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
|
|
4
|
-
import { E as EMPTY_PROJECTION_CONTEXT, d as domTextMeasurer, g as getProjectedParagraphBlockHeight, e as estimateTableBlockHeight, p as projectParagraphLayout, a as getPageBodyBottom, b as getPageBodyTop, c as getPageContentWidth, F as FOOTNOTE_MARKER_GUTTER_PX, f as getParagraphText, h as getBlockParagraphs, i as getRunFootnoteReference, l as listReferencedEndnotes, j as getFootnoteDisplayMarker, k as createProjectionContext, m as getDocumentSections, n as getRunField, o as projectBlocksLayout, q as assertNever, r as cloneRun, s as createSignal, t as createEditorStateFromDocument, u as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, v as fontSizePxToPt, w as probeLocalFontFamilies, x as createEditorParagraphFromRuns, y as isInlineObjectRun, z as stylesEqual, A as cloneStyle, B as createEditorStyledRun, C as cloneParagraphList, D as cloneParagraph, G as getParagraphLength, H as getActiveZone, I as getActiveSectionIndex, J as getParagraphs, K as normalizeSelection, L as positionToParagraphOffset, M as cloneParagraphs, N as paragraphOffsetToPosition, O as findParagraphIndex, P as createCollapsedSelection, Q as isSelectionCollapsed, R as MATH_OBJECT_REPLACEMENT, T as setValueStyle, U as setBooleanStyle, V as parseFontSizePtToPx, W as formatFontSizePt, X as setParagraphStyleValue, Y as createEditorParagraph, Z as cloneBlocks, _ as resolveDefaultParagraphStyleId, $ as findParagraphTablePathLocation, a0 as findParagraphLocation, a1 as resolveTablePath, a2 as buildTableCellLayout, a3 as PT_PER_PX, a4 as createEditorTableCell, a5 as createEditorTableRow, a6 as createEditorTable, a7 as clampPosition, a8 as PX_PER_POINT, a9 as underlineStyleToCssDecorationStyle, aa as resolveImageSrc, ab as listKindForTag, ac as isParagraphTag, ad as collectInlineRuns, ae as parseParagraphStyle, af as getRunImage, ag as InlineShell, ah as BalloonShell, ai as DocumentShell, aj as findParagraphTableLocation, ak as createMemo, al as getCaretRectFromSnapshot, am as getParagraphRectFromSnapshot, an as createComponent, ao as CaretOverlay, ap as Show, aq as createRenderEffect, ar as style, as as setStyleProperty, at as setAttribute, au as memo, av as template, aw as Button, ax as useI18n, ay as createEffect, az as TextField, aA as Dialog, aB as insert, aC as className, aD as Grid, aE as SelectField, aF as StatusText, aG as ColorField, aH as UNDERLINE_STYLE_OPTIONS, aI as Stack, aJ as For, aK as ToggleChip, aL as FormField, aM as Checkbox, aN as FieldGroup, aO as Tabs, aP as NumberField, aQ as parseNumber, aR as createStore, aS as reconcile, aT as RadioGroup, aU as Radio$1, aV as TextAreaField, aW as COMMON_SYMBOLS, aX as getRecentSymbols, aY as SYMBOL_CATEGORIES, aZ as rememberSymbol, a_ as delegateEvents, a$ as EMPTY_EDITOR_MATH_EXPRESSION, b0 as serializeLinearMath, b1 as parseLinearMath, b2 as Text, b3 as SurfaceButton, b4 as onMount, b5 as onCleanup, b6 as CheckIcon, b7 as use, b8 as PluginUiHost, b9 as OasisEditorEditor, ba as OasisBrandMark, bb as setPreciseFontPreference, bc as setWelcomeSeen, bd as enablePreciseFontMode, be as WORD_NS$6, bf as XMLSerializer, bg as DOMParser, bh as WORD14_NS, bi as mergeNestedExtensionMarkup, bj as resolveOpcRelationships, bk as parseOpcRelationships, bl as JSZip, bm as normalizeOpcPartPath, bn as OPC_CONTENT_TYPES_PATH, bo as getOpcRelationshipOwnerPath, bp as serializeOpcRelationships, bq as OPC_ROOT_RELATIONSHIPS_PATH, br as hashDocxPartBytes, bs as parseOpcContentTypes, bt as serializeOpcContentTypes, bu as mergeParagraphPropertiesXmlSource, bv as setEditorRunOoxmlSource, bw as mergeRunOoxmlSourceIntoGeneratedXml, bx as mergeTableCellPropertiesXmlSource, by as mergeTableRowPropertiesXmlSource, bz as mergeTablePropertiesXmlSource, bA as exportEditorDocumentToDocxBlob, bB as exportEditorDocumentToDocx, bC as pxToPt$1, bD as resolveFloatingObjectRect, bE as getTextBoxFloatingGeometry, bF as getPresetPathSegments, bG as buildListLabels, bH as lineDashPatternPt, bI as DEFAULT_FONT_SIZE_PX, bJ as resolveGradientAxis, bK as isDoubleUnderlineStyle, bL as isWavyUnderlineStyle, bM as underlineStyleLineWidthPx, bN as WAVY_UNDERLINE_WAVELENGTH_PX, bO as WAVY_UNDERLINE_AMPLITUDE_PX, bP as DOUBLE_UNDERLINE_OFFSET_PX, bQ as underlineStyleDashArray, bR as resolveEffectiveParagraphStyle, bS as EMPHASIS_GLYPH, bT as parseHexColorToRgb255, bU as rgb255ToHex, bV as getImageFloatingGeometry, bW as resolveEffectiveTextStyleForParagraph, bX as textStyleToFontSizePt, bY as mathDisplayText, bZ as TEXT_BASELINE_RATIO, b_ as resolveTextAlignmentBaselineOffset, b$ as resolveRenderedTextChar, c0 as resolveOpenTypeFeatureTags, c1 as isLowercaseSmallCapsChar, c2 as resolveDecorationLineY, c3 as DOUBLE_STRIKE_OFFSET_PX, c4 as resolveListLabel, c5 as getListLabelInset, c6 as getAlignedListLabelInset, c7 as getParagraphBorderInsets, c8 as buildSegmentTable, c9 as buildCanvasTableLayout, ca as resolveCanvasTableWidth, cb as resolveFloatingTableRect, cc as paragraphBetweenBorderMatches, cd as normalizeFamily, ce as ROBOTO_FONT_FILES, cf as loadFontAsset, cg as getRemotePdfFontFaces, ch as OFFICE_COMPAT_FONT_FAMILIES, ci as BinaryReader, cj as buildSfnt, ck as defaultFontDecoderRegistry, cl as SfntFontProgram, cm as zlibSync, cn as renumberImageCaptionsInDocument, co as collectPdfFontFamilies, cp as outlineFrom, cq as getPageHeaderZoneTop, cr as getPageColumnRects, cs as findFootnoteReference, ct as resolveImporterForFile, cu as roundTo, cv as getDocumentSectionsCanonical, cw as getDocumentParagraphsCanonical, cx as getDocumentParagraphs, cy as getImageCaptionText, cz as isImageCaptionParagraph, cA as updateImageCaptionParagraph, cB as createImageCaptionParagraph, cC as renumberImageCaptionParagraphs, cD as getCaptionSelectionOffset, cE as PX_PER_CM, cF as getDocumentPageSettings, cG as getTableCellContentWidthForParagraph, cH as layoutMetricsEpoch, cI as bumpLayoutMetricsEpoch, cJ as createCanvasLayoutSnapshotProvider, cK as on, cL as debounce, cM as unwrap, cN as perfTimer, cO as prepareDocumentFonts, cP as getRunTextBox, cQ as EMU_PER_PX, cR as createEditorDocument, cS as resolveResizedDimensions, cT as axisSignForDirection, cU as clamp$1, cV as MIN_RESIZE_SIZE_PX, cW as resolveTextBoxRenderHeight, cX as getToolbarStyleState, cY as VERTICAL_HIT_WEIGHT, cZ as getCachedCanvasImage, c_ as measureParagraphMinContentWidthPx, c$ as createSectionBoundaryParagraph, d0 as normalizePageSettings, d1 as DEFAULT_EDITOR_PAGE_SETTINGS, d2 as markStart, d3 as markEnd, d4 as getParagraphEntries, d5 as getParagraphById, d6 as createEditorFootnote, d7 as createFootnoteReferenceRun, d8 as renumberFootnotes, d9 as iterateFootnoteReferenceRuns, da as preciseFontModeVersion, db as isPreciseFontModeEnabled, dc as getRunFieldChar, dd as getRunFieldInstruction, de as getHeadingLevel, df as createEditorRun, dg as TWIPS_PER_INCH, dh as PX_PER_INCH, di as togglePreciseFontMode, dj as nextFontSizePt, dk as previousFontSizePt, dl as fontSizePtToPx, dm as resolveNamedTextStyle, dn as resolveNamedTableStyle, dp as resolveEffectiveTableStyle, dq as createDefaultToolbarPreset, dr as MenuRegistry, ds as createToolbarRegistry, dt as Editor, du as resolveCommandRef, dv as commandRefName, dw as createOasisEditorClient, dx as createEditorZoom, dy as startLongTaskObserver, dz as installGlobalReport, dA as applyStoredPreciseFontPreference, dB as getWelcomeSeen, dC as isLocalFontAccessSupported, dD as EDITOR_SCROLL_PADDING_PX, dE as Toolbar, dF as OasisEditorLoading, dG as I18nProvider, dH as createTranslator, dI as registerDomStatsSurface, dJ as createEditorLogger } from "./index-
|
|
4
|
+
import { E as EMPTY_PROJECTION_CONTEXT, d as domTextMeasurer, g as getProjectedParagraphBlockHeight, e as estimateTableBlockHeight, p as projectParagraphLayout, a as getPageBodyBottom, b as getPageBodyTop, c as getPageContentWidth, F as FOOTNOTE_MARKER_GUTTER_PX, f as getParagraphText, h as getBlockParagraphs, i as getRunFootnoteReference, l as listReferencedEndnotes, j as getFootnoteDisplayMarker, k as createProjectionContext, m as getDocumentSections, n as getRunField, o as projectBlocksLayout, q as assertNever, r as cloneRun, s as createSignal, t as createEditorStateFromDocument, u as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, v as fontSizePxToPt, w as probeLocalFontFamilies, x as createEditorParagraphFromRuns, y as isInlineObjectRun, z as stylesEqual, A as cloneStyle, B as createEditorStyledRun, C as cloneParagraphList, D as cloneParagraph, G as getParagraphLength, H as getActiveZone, I as getActiveSectionIndex, J as getParagraphs, K as normalizeSelection, L as positionToParagraphOffset, M as cloneParagraphs, N as paragraphOffsetToPosition, O as findParagraphIndex, P as createCollapsedSelection, Q as isSelectionCollapsed, R as MATH_OBJECT_REPLACEMENT, T as setValueStyle, U as setBooleanStyle, V as parseFontSizePtToPx, W as formatFontSizePt, X as setParagraphStyleValue, Y as createEditorParagraph, Z as cloneBlocks, _ as resolveDefaultParagraphStyleId, $ as findParagraphTablePathLocation, a0 as findParagraphLocation, a1 as resolveTablePath, a2 as buildTableCellLayout, a3 as PT_PER_PX, a4 as createEditorTableCell, a5 as createEditorTableRow, a6 as createEditorTable, a7 as clampPosition, a8 as PX_PER_POINT, a9 as underlineStyleToCssDecorationStyle, aa as resolveImageSrc, ab as listKindForTag, ac as isParagraphTag, ad as collectInlineRuns, ae as parseParagraphStyle, af as getRunImage, ag as InlineShell, ah as BalloonShell, ai as DocumentShell, aj as findParagraphTableLocation, ak as createMemo, al as getCaretRectFromSnapshot, am as getParagraphRectFromSnapshot, an as createComponent, ao as CaretOverlay, ap as Show, aq as createRenderEffect, ar as style, as as setStyleProperty, at as setAttribute, au as memo, av as template, aw as Button, ax as useI18n, ay as createEffect, az as TextField, aA as Dialog, aB as insert, aC as className, aD as Grid, aE as SelectField, aF as StatusText, aG as ColorField, aH as UNDERLINE_STYLE_OPTIONS, aI as Stack, aJ as For, aK as ToggleChip, aL as FormField, aM as Checkbox, aN as FieldGroup, aO as Tabs, aP as NumberField, aQ as parseNumber, aR as createStore, aS as reconcile, aT as RadioGroup, aU as Radio$1, aV as TextAreaField, aW as COMMON_SYMBOLS, aX as getRecentSymbols, aY as SYMBOL_CATEGORIES, aZ as rememberSymbol, a_ as delegateEvents, a$ as EMPTY_EDITOR_MATH_EXPRESSION, b0 as serializeLinearMath, b1 as parseLinearMath, b2 as Text, b3 as SurfaceButton, b4 as onMount, b5 as onCleanup, b6 as CheckIcon, b7 as use, b8 as PluginUiHost, b9 as OasisEditorEditor, ba as OasisBrandMark, bb as setPreciseFontPreference, bc as setWelcomeSeen, bd as enablePreciseFontMode, be as WORD_NS$6, bf as XMLSerializer, bg as DOMParser, bh as WORD14_NS, bi as mergeNestedExtensionMarkup, bj as resolveOpcRelationships, bk as parseOpcRelationships, bl as JSZip, bm as normalizeOpcPartPath, bn as OPC_CONTENT_TYPES_PATH, bo as getOpcRelationshipOwnerPath, bp as serializeOpcRelationships, bq as OPC_ROOT_RELATIONSHIPS_PATH, br as hashDocxPartBytes, bs as parseOpcContentTypes, bt as serializeOpcContentTypes, bu as mergeParagraphPropertiesXmlSource, bv as setEditorRunOoxmlSource, bw as mergeRunOoxmlSourceIntoGeneratedXml, bx as mergeTableCellPropertiesXmlSource, by as mergeTableRowPropertiesXmlSource, bz as mergeTablePropertiesXmlSource, bA as exportEditorDocumentToDocxBlob, bB as exportEditorDocumentToDocx, bC as pxToPt$1, bD as resolveFloatingObjectRect, bE as getTextBoxFloatingGeometry, bF as getPresetPathSegments, bG as buildListLabels, bH as lineDashPatternPt, bI as DEFAULT_FONT_SIZE_PX, bJ as resolveGradientAxis, bK as isDoubleUnderlineStyle, bL as isWavyUnderlineStyle, bM as underlineStyleLineWidthPx, bN as WAVY_UNDERLINE_WAVELENGTH_PX, bO as WAVY_UNDERLINE_AMPLITUDE_PX, bP as DOUBLE_UNDERLINE_OFFSET_PX, bQ as underlineStyleDashArray, bR as resolveEffectiveParagraphStyle, bS as EMPHASIS_GLYPH, bT as parseHexColorToRgb255, bU as rgb255ToHex, bV as getImageFloatingGeometry, bW as resolveEffectiveTextStyleForParagraph, bX as textStyleToFontSizePt, bY as mathDisplayText, bZ as TEXT_BASELINE_RATIO, b_ as resolveTextAlignmentBaselineOffset, b$ as resolveRenderedTextChar, c0 as resolveOpenTypeFeatureTags, c1 as isLowercaseSmallCapsChar, c2 as resolveDecorationLineY, c3 as DOUBLE_STRIKE_OFFSET_PX, c4 as resolveListLabel, c5 as getListLabelInset, c6 as getAlignedListLabelInset, c7 as getParagraphBorderInsets, c8 as buildSegmentTable, c9 as buildCanvasTableLayout, ca as resolveCanvasTableWidth, cb as resolveFloatingTableRect, cc as paragraphBetweenBorderMatches, cd as normalizeFamily, ce as ROBOTO_FONT_FILES, cf as loadFontAsset, cg as getRemotePdfFontFaces, ch as OFFICE_COMPAT_FONT_FAMILIES, ci as BinaryReader, cj as buildSfnt, ck as defaultFontDecoderRegistry, cl as SfntFontProgram, cm as zlibSync, cn as renumberImageCaptionsInDocument, co as collectPdfFontFamilies, cp as outlineFrom, cq as getPageHeaderZoneTop, cr as getPageColumnRects, cs as findFootnoteReference, ct as resolveImporterForFile, cu as roundTo, cv as getDocumentSectionsCanonical, cw as getDocumentParagraphsCanonical, cx as getDocumentParagraphs, cy as getImageCaptionText, cz as isImageCaptionParagraph, cA as updateImageCaptionParagraph, cB as createImageCaptionParagraph, cC as renumberImageCaptionParagraphs, cD as getCaptionSelectionOffset, cE as PX_PER_CM, cF as getDocumentPageSettings, cG as getTableCellContentWidthForParagraph, cH as layoutMetricsEpoch, cI as bumpLayoutMetricsEpoch, cJ as createCanvasLayoutSnapshotProvider, cK as on, cL as debounce, cM as unwrap, cN as perfTimer, cO as prepareDocumentFonts, cP as getRunTextBox, cQ as EMU_PER_PX, cR as createEditorDocument, cS as resolveResizedDimensions, cT as axisSignForDirection, cU as clamp$1, cV as MIN_RESIZE_SIZE_PX, cW as resolveTextBoxRenderHeight, cX as getToolbarStyleState, cY as VERTICAL_HIT_WEIGHT, cZ as getCachedCanvasImage, c_ as measureParagraphMinContentWidthPx, c$ as createSectionBoundaryParagraph, d0 as normalizePageSettings, d1 as DEFAULT_EDITOR_PAGE_SETTINGS, d2 as markStart, d3 as markEnd, d4 as getParagraphEntries, d5 as getParagraphById, d6 as createEditorFootnote, d7 as createFootnoteReferenceRun, d8 as renumberFootnotes, d9 as iterateFootnoteReferenceRuns, da as preciseFontModeVersion, db as isPreciseFontModeEnabled, dc as getRunFieldChar, dd as getRunFieldInstruction, de as getHeadingLevel, df as createEditorRun, dg as TWIPS_PER_INCH, dh as PX_PER_INCH, di as togglePreciseFontMode, dj as nextFontSizePt, dk as previousFontSizePt, dl as fontSizePtToPx, dm as resolveNamedTextStyle, dn as resolveNamedTableStyle, dp as resolveEffectiveTableStyle, dq as createDefaultToolbarPreset, dr as MenuRegistry, ds as createToolbarRegistry, dt as Editor, du as resolveCommandRef, dv as commandRefName, dw as createOasisEditorClient, dx as createEditorZoom, dy as startLongTaskObserver, dz as installGlobalReport, dA as applyStoredPreciseFontPreference, dB as getWelcomeSeen, dC as isLocalFontAccessSupported, dD as EDITOR_SCROLL_PADDING_PX, dE as Toolbar, dF as OasisEditorLoading, dG as I18nProvider, dH as createTranslator, dI as registerDomStatsSurface, dJ as createEditorLogger } from "./index-DQLjp1z0.js";
|
|
5
5
|
function projectHeaderFooterBlocksWithDependencies(blocks, deps, context = {}) {
|
|
6
6
|
const {
|
|
7
7
|
pageIndex,
|
|
@@ -353,7 +353,7 @@ function calculateTotalPages(context, projectHeaderFooterVariant) {
|
|
|
353
353
|
}
|
|
354
354
|
function projectAllPages(context, totalPages, projectHeaderFooterVariant, reservedHeightByPageIndex) {
|
|
355
355
|
const allPages = [];
|
|
356
|
-
for (const section of context.sections) {
|
|
356
|
+
for (const [sectionIndex, section] of context.sections.entries()) {
|
|
357
357
|
const contentWidth = getPageContentWidth(section.pageSettings);
|
|
358
358
|
const sectionHeaderBlocks = projectTallestHeaderVariant(
|
|
359
359
|
section,
|
|
@@ -392,6 +392,7 @@ function projectAllPages(context, totalPages, projectHeaderFooterVariant, reserv
|
|
|
392
392
|
allPages.pop();
|
|
393
393
|
}
|
|
394
394
|
for (const page of sectionPages) {
|
|
395
|
+
page.sectionIndex = sectionIndex;
|
|
395
396
|
const pageIndexInSection = page.index - sectionPageOffset;
|
|
396
397
|
const pageContentWidth = getPageContentWidth(page.pageSettings);
|
|
397
398
|
const headerBlocks = projectHeaderFooterVariant(
|
|
@@ -29002,6 +29003,7 @@ function insertSectionBreakAtSelection(state, breakType) {
|
|
|
29002
29003
|
id: newSectionId,
|
|
29003
29004
|
blocks: [secondParagraph, ...afterBlocks],
|
|
29004
29005
|
pageSettings: { ...section.pageSettings },
|
|
29006
|
+
pageBorder: section.pageBorder ? { ...section.pageBorder } : section.pageBorder,
|
|
29005
29007
|
header: section.header ? cloneBlocks(section.header) : void 0,
|
|
29006
29008
|
footer: section.footer ? cloneBlocks(section.footer) : void 0,
|
|
29007
29009
|
breakType
|
|
@@ -42247,14 +42249,86 @@ async function drawBlockList(writer, pageIndex, blocks, document2, originX, orig
|
|
|
42247
42249
|
cursorY += Math.max(0, block.estimatedHeight);
|
|
42248
42250
|
}
|
|
42249
42251
|
}
|
|
42250
|
-
function drawPageBackground(writer, pageIndex, width, height) {
|
|
42252
|
+
async function drawPageBackground(writer, pageIndex, width, height, design, pageBorder, document2) {
|
|
42251
42253
|
writer.drawRect(pageIndex, {
|
|
42252
42254
|
x: 0,
|
|
42253
42255
|
y: 0,
|
|
42254
42256
|
width,
|
|
42255
42257
|
height,
|
|
42256
|
-
fill: "#ffffff"
|
|
42258
|
+
fill: (design == null ? void 0 : design.pageColor) || "#ffffff"
|
|
42257
42259
|
});
|
|
42260
|
+
if (pageBorder) {
|
|
42261
|
+
const d = pageBorder.distance ?? 12;
|
|
42262
|
+
const dashArray = pageBorder.style === "dashed" ? [6, 4] : pageBorder.style === "dotted" ? [1, 3] : void 0;
|
|
42263
|
+
writer.drawRect(pageIndex, {
|
|
42264
|
+
x: d,
|
|
42265
|
+
y: d,
|
|
42266
|
+
width: width - 2 * d,
|
|
42267
|
+
height: height - 2 * d,
|
|
42268
|
+
fill: void 0,
|
|
42269
|
+
stroke: pageBorder.color,
|
|
42270
|
+
lineWidth: pageBorder.width,
|
|
42271
|
+
...dashArray ? { dashArray } : {}
|
|
42272
|
+
});
|
|
42273
|
+
if (pageBorder.style === "double") {
|
|
42274
|
+
const inner = d + pageBorder.width * 2;
|
|
42275
|
+
writer.drawRect(pageIndex, {
|
|
42276
|
+
x: inner,
|
|
42277
|
+
y: inner,
|
|
42278
|
+
width: width - 2 * inner,
|
|
42279
|
+
height: height - 2 * inner,
|
|
42280
|
+
stroke: pageBorder.color,
|
|
42281
|
+
lineWidth: pageBorder.width
|
|
42282
|
+
});
|
|
42283
|
+
}
|
|
42284
|
+
}
|
|
42285
|
+
const watermark = design == null ? void 0 : design.watermark;
|
|
42286
|
+
if ((watermark == null ? void 0 : watermark.kind) === "text" && watermark.text) {
|
|
42287
|
+
writer.saveGraphicsState(pageIndex);
|
|
42288
|
+
writer.rotateAbout(
|
|
42289
|
+
pageIndex,
|
|
42290
|
+
width / 2,
|
|
42291
|
+
height / 2,
|
|
42292
|
+
watermark.rotation ?? -45
|
|
42293
|
+
);
|
|
42294
|
+
writer.setOpacity(pageIndex, watermark.opacity ?? 0.25);
|
|
42295
|
+
writer.drawText(pageIndex, {
|
|
42296
|
+
x: width / 2,
|
|
42297
|
+
y: height / 2,
|
|
42298
|
+
text: watermark.text,
|
|
42299
|
+
fontSize: watermark.fontSize ?? 48,
|
|
42300
|
+
color: watermark.color ?? "#94a3b8"
|
|
42301
|
+
});
|
|
42302
|
+
writer.restoreGraphicsState(pageIndex);
|
|
42303
|
+
} else if ((watermark == null ? void 0 : watermark.kind) === "image" && watermark.src && document2) {
|
|
42304
|
+
const image = {
|
|
42305
|
+
src: watermark.src,
|
|
42306
|
+
width: 360,
|
|
42307
|
+
height: 180
|
|
42308
|
+
};
|
|
42309
|
+
const resourceName = await registerPdfImageRun(writer, document2, image);
|
|
42310
|
+
if (resourceName) {
|
|
42311
|
+
const scale = watermark.scale ?? 1;
|
|
42312
|
+
const imageWidth = image.width * scale;
|
|
42313
|
+
const imageHeight = image.height * scale;
|
|
42314
|
+
writer.saveGraphicsState(pageIndex);
|
|
42315
|
+
writer.rotateAbout(
|
|
42316
|
+
pageIndex,
|
|
42317
|
+
width / 2,
|
|
42318
|
+
height / 2,
|
|
42319
|
+
watermark.rotation ?? -45
|
|
42320
|
+
);
|
|
42321
|
+
writer.setOpacity(pageIndex, watermark.opacity ?? 0.25);
|
|
42322
|
+
writer.drawImage(pageIndex, {
|
|
42323
|
+
resourceName,
|
|
42324
|
+
x: (width - imageWidth) / 2,
|
|
42325
|
+
y: (height - imageHeight) / 2,
|
|
42326
|
+
width: imageWidth,
|
|
42327
|
+
height: imageHeight
|
|
42328
|
+
});
|
|
42329
|
+
writer.restoreGraphicsState(pageIndex);
|
|
42330
|
+
}
|
|
42331
|
+
}
|
|
42258
42332
|
}
|
|
42259
42333
|
const BASE14_HELVETICA_FACES = [
|
|
42260
42334
|
{
|
|
@@ -42775,6 +42849,13 @@ class PdfContentStream {
|
|
|
42775
42849
|
restoreGraphicsState() {
|
|
42776
42850
|
this.page.commands.push("Q");
|
|
42777
42851
|
}
|
|
42852
|
+
setOpacity(opacity) {
|
|
42853
|
+
var _a;
|
|
42854
|
+
const clamped = Math.max(0, Math.min(1, opacity));
|
|
42855
|
+
const name2 = `GSOpacity${Math.round(clamped * 100)}`;
|
|
42856
|
+
((_a = this.page).graphicsStateOpacities ?? (_a.graphicsStateOpacities = /* @__PURE__ */ new Map())).set(name2, clamped);
|
|
42857
|
+
this.page.commands.push(`/${name2} gs`);
|
|
42858
|
+
}
|
|
42778
42859
|
// Concatenates a clockwise rotation (in degrees, matching the canvas/editor
|
|
42779
42860
|
// convention) about a top-left-origin point onto the current CTM. Must sit
|
|
42780
42861
|
// inside a saveGraphicsState/restoreGraphicsState pair.
|
|
@@ -44530,6 +44611,7 @@ function countOutlineDescendants(node) {
|
|
|
44530
44611
|
);
|
|
44531
44612
|
}
|
|
44532
44613
|
function serializePdfDocument(pages, fonts, images, shadings, namedDestinations = [], outlineItems = [], documentInfo) {
|
|
44614
|
+
var _a;
|
|
44533
44615
|
const objects = [];
|
|
44534
44616
|
const addObject = (body) => {
|
|
44535
44617
|
const id = objects.length + 1;
|
|
@@ -44541,6 +44623,19 @@ function serializePdfDocument(pages, fonts, images, shadings, namedDestinations
|
|
|
44541
44623
|
const { resourceXml: fontResourceXml } = fonts.buildFontObjects(addObject);
|
|
44542
44624
|
const imageObjectIds = images.buildImageObjects(addObject);
|
|
44543
44625
|
const shadingObjectIds = shadings.buildShadingObjects(addObject);
|
|
44626
|
+
const graphicsStateObjectIds = /* @__PURE__ */ new Map();
|
|
44627
|
+
for (const page of pages) {
|
|
44628
|
+
for (const [name2, opacity] of page.graphicsStateOpacities ?? []) {
|
|
44629
|
+
if (!graphicsStateObjectIds.has(name2)) {
|
|
44630
|
+
graphicsStateObjectIds.set(
|
|
44631
|
+
name2,
|
|
44632
|
+
addObject(
|
|
44633
|
+
`<< /Type /ExtGState /ca ${formatNumber(opacity)} /CA ${formatNumber(opacity)} >>`
|
|
44634
|
+
)
|
|
44635
|
+
);
|
|
44636
|
+
}
|
|
44637
|
+
}
|
|
44638
|
+
}
|
|
44544
44639
|
const pageObjectIds = [];
|
|
44545
44640
|
for (const page of pages) {
|
|
44546
44641
|
const stream = `${page.commands.join("\n")}
|
|
@@ -44556,6 +44651,10 @@ function serializePdfDocument(pages, fonts, images, shadings, namedDestinations
|
|
|
44556
44651
|
return objectId ? `/${resourceName} ${objectId} 0 R` : "";
|
|
44557
44652
|
}).filter(Boolean).join(" ");
|
|
44558
44653
|
const shadingResourceDictXml = shadingResourceXml ? ` /Shading << ${shadingResourceXml} >>` : "";
|
|
44654
|
+
const graphicsStateResourceXml = Array.from(
|
|
44655
|
+
((_a = page.graphicsStateOpacities) == null ? void 0 : _a.keys()) ?? []
|
|
44656
|
+
).map((name2) => `/${name2} ${graphicsStateObjectIds.get(name2)} 0 R`).join(" ");
|
|
44657
|
+
const graphicsStateDictXml = graphicsStateResourceXml ? ` /ExtGState << ${graphicsStateResourceXml} >>` : "";
|
|
44559
44658
|
const annotationObjectIds = page.annotations.map((annotation) => {
|
|
44560
44659
|
const x1 = annotation.x;
|
|
44561
44660
|
const x2 = annotation.x + annotation.width;
|
|
@@ -44579,7 +44678,7 @@ function serializePdfDocument(pages, fonts, images, shadings, namedDestinations
|
|
|
44579
44678
|
"<< /Type /Page",
|
|
44580
44679
|
`/Parent ${pagesObjectId} 0 R`,
|
|
44581
44680
|
`/MediaBox [0 0 ${formatNumber(page.width)} ${formatNumber(page.height)}]`,
|
|
44582
|
-
`/Resources << /Font << ${fontResourceXml} >>${xObjectResourceXml}${shadingResourceDictXml} >>`,
|
|
44681
|
+
`/Resources << /Font << ${fontResourceXml} >>${xObjectResourceXml}${shadingResourceDictXml}${graphicsStateDictXml} >>`,
|
|
44583
44682
|
`/Contents ${contentObjectId} 0 R${annotsXml}`,
|
|
44584
44683
|
">>"
|
|
44585
44684
|
].join("\n")
|
|
@@ -44730,7 +44829,8 @@ class OasisPdfWriter {
|
|
|
44730
44829
|
commands: [],
|
|
44731
44830
|
imageResourceNames: /* @__PURE__ */ new Set(),
|
|
44732
44831
|
shadingResourceNames: /* @__PURE__ */ new Set(),
|
|
44733
|
-
annotations: []
|
|
44832
|
+
annotations: [],
|
|
44833
|
+
graphicsStateOpacities: /* @__PURE__ */ new Map()
|
|
44734
44834
|
};
|
|
44735
44835
|
this.pages.push(page);
|
|
44736
44836
|
this.streams.push(
|
|
@@ -44761,6 +44861,10 @@ class OasisPdfWriter {
|
|
|
44761
44861
|
var _a;
|
|
44762
44862
|
(_a = this.streams[pageIndex]) == null ? void 0 : _a.restoreGraphicsState();
|
|
44763
44863
|
}
|
|
44864
|
+
setOpacity(pageIndex, opacity) {
|
|
44865
|
+
var _a;
|
|
44866
|
+
(_a = this.streams[pageIndex]) == null ? void 0 : _a.setOpacity(opacity);
|
|
44867
|
+
}
|
|
44764
44868
|
rotateAbout(pageIndex, centerX, centerY, degrees) {
|
|
44765
44869
|
var _a;
|
|
44766
44870
|
(_a = this.streams[pageIndex]) == null ? void 0 : _a.rotateAbout(centerX, centerY, degrees);
|
|
@@ -44902,6 +45006,7 @@ function registerBookmarkDestinations(writer, pageIndex, originX, bookmarkNamesB
|
|
|
44902
45006
|
};
|
|
44903
45007
|
}
|
|
44904
45008
|
async function exportEditorDocumentToPdf(document2) {
|
|
45009
|
+
var _a, _b;
|
|
44905
45010
|
document2 = renumberImageCaptionsInDocument(document2);
|
|
44906
45011
|
const fontRegistry = new PdfFontRegistry();
|
|
44907
45012
|
const fontFamilies = collectPdfFontFamilies(document2);
|
|
@@ -44928,7 +45033,15 @@ async function exportEditorDocumentToPdf(document2) {
|
|
|
44928
45033
|
const width = Math.max(1, pxToPt$1(page.pageSettings.width));
|
|
44929
45034
|
const height = Math.max(1, pxToPt$1(page.pageSettings.height));
|
|
44930
45035
|
const pageIndex = writer.addPage({ width, height });
|
|
44931
|
-
drawPageBackground(
|
|
45036
|
+
await drawPageBackground(
|
|
45037
|
+
writer,
|
|
45038
|
+
pageIndex,
|
|
45039
|
+
width,
|
|
45040
|
+
height,
|
|
45041
|
+
document2.design,
|
|
45042
|
+
(_b = (_a = document2.sections) == null ? void 0 : _a[page.sectionIndex ?? 0]) == null ? void 0 : _b.pageBorder,
|
|
45043
|
+
document2
|
|
45044
|
+
);
|
|
44932
45045
|
const originX = page.pageSettings.margins.left + page.pageSettings.margins.gutter;
|
|
44933
45046
|
const contentWidth = getPageContentWidth(page.pageSettings);
|
|
44934
45047
|
await drawBlockList(
|
|
@@ -45038,7 +45151,15 @@ async function exportEditorDocumentToPdf(document2) {
|
|
|
45038
45151
|
}
|
|
45039
45152
|
if (writer.getPageCount() === 0) {
|
|
45040
45153
|
const pageIndex = writer.addPage({ width: 612, height: 792 });
|
|
45041
|
-
drawPageBackground(
|
|
45154
|
+
await drawPageBackground(
|
|
45155
|
+
writer,
|
|
45156
|
+
pageIndex,
|
|
45157
|
+
612,
|
|
45158
|
+
792,
|
|
45159
|
+
document2.design,
|
|
45160
|
+
void 0,
|
|
45161
|
+
document2
|
|
45162
|
+
);
|
|
45042
45163
|
}
|
|
45043
45164
|
return writer.toArrayBuffer();
|
|
45044
45165
|
}
|
|
@@ -55215,6 +55336,230 @@ function createEditorKeyboardBinding(deps) {
|
|
|
55215
55336
|
};
|
|
55216
55337
|
return { handleKeyDown };
|
|
55217
55338
|
}
|
|
55339
|
+
const THEME_VALUES = {
|
|
55340
|
+
oasis: { color: "#0f766e", heading: "#115e59", body: "#1f2937" },
|
|
55341
|
+
office: { color: "#4472c4", heading: "#2f5597", body: "#1f2937" },
|
|
55342
|
+
facet: { color: "#8064a2", heading: "#604a7b", body: "#262626" },
|
|
55343
|
+
integral: { color: "#70ad47", heading: "#548235", body: "#1f2937" },
|
|
55344
|
+
ion: { color: "#ed7d31", heading: "#c55a11", body: "#262626" },
|
|
55345
|
+
retrospect: { color: "#5b9bd5", heading: "#2f75b5", body: "#1f2937" }
|
|
55346
|
+
};
|
|
55347
|
+
const COLOR_VALUES = {
|
|
55348
|
+
oasis: { color: "#0f766e", heading: "#115e59" },
|
|
55349
|
+
office: { color: "#4472c4", heading: "#2f5597" },
|
|
55350
|
+
monochrome: { color: "#374151", heading: "#111827" },
|
|
55351
|
+
warm: { color: "#c2410c", heading: "#9a3412" }
|
|
55352
|
+
};
|
|
55353
|
+
const FONT_VALUES = {
|
|
55354
|
+
aptos: ["Aptos, sans-serif", "Aptos Display, sans-serif"],
|
|
55355
|
+
calibri: ["Calibri, sans-serif", "Calibri Light, sans-serif"],
|
|
55356
|
+
georgia: ["Georgia, serif", "Georgia, serif"],
|
|
55357
|
+
garamond: ["Garamond, serif", "Garamond, serif"]
|
|
55358
|
+
};
|
|
55359
|
+
function updateSemanticStyles(state, theme) {
|
|
55360
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
55361
|
+
const values = THEME_VALUES[theme];
|
|
55362
|
+
const styles = state.document.styles ?? {};
|
|
55363
|
+
const nextStyles = Object.fromEntries(
|
|
55364
|
+
Object.entries(styles).map(([id, style2]) => {
|
|
55365
|
+
if (!/^(normal|title|subtitle|heading[1-9]|quote|intensequote)$/i.test(id))
|
|
55366
|
+
return [id, style2];
|
|
55367
|
+
const isHeading = /^heading[1-9]$/i.test(id) || /title|quote/i.test(id);
|
|
55368
|
+
return [
|
|
55369
|
+
id,
|
|
55370
|
+
{
|
|
55371
|
+
...style2,
|
|
55372
|
+
textStyle: {
|
|
55373
|
+
...style2.textStyle ?? {},
|
|
55374
|
+
color: isHeading ? values.heading : values.body,
|
|
55375
|
+
...isHeading ? { fontFamily: "Aptos Display, sans-serif" } : { fontFamily: "Aptos, sans-serif" }
|
|
55376
|
+
}
|
|
55377
|
+
}
|
|
55378
|
+
];
|
|
55379
|
+
})
|
|
55380
|
+
);
|
|
55381
|
+
return {
|
|
55382
|
+
...state,
|
|
55383
|
+
document: {
|
|
55384
|
+
...state.document,
|
|
55385
|
+
design: {
|
|
55386
|
+
...state.document.design ?? {},
|
|
55387
|
+
themeId: theme,
|
|
55388
|
+
colorSchemeId: theme,
|
|
55389
|
+
themeData: {
|
|
55390
|
+
...((_a = state.document.design) == null ? void 0 : _a.themeData) ?? {},
|
|
55391
|
+
sourceXml: void 0,
|
|
55392
|
+
colors: {
|
|
55393
|
+
...((_c = (_b = state.document.design) == null ? void 0 : _b.themeData) == null ? void 0 : _c.colors) ?? {},
|
|
55394
|
+
accent1: values.color,
|
|
55395
|
+
accent2: values.heading,
|
|
55396
|
+
dk2: values.body
|
|
55397
|
+
},
|
|
55398
|
+
fonts: {
|
|
55399
|
+
...((_e = (_d = state.document.design) == null ? void 0 : _d.themeData) == null ? void 0 : _e.fonts) ?? {},
|
|
55400
|
+
major: {
|
|
55401
|
+
...((_h = (_g = (_f = state.document.design) == null ? void 0 : _f.themeData) == null ? void 0 : _g.fonts) == null ? void 0 : _h.major) ?? {},
|
|
55402
|
+
majorHAnsi: "Aptos Display"
|
|
55403
|
+
},
|
|
55404
|
+
minor: {
|
|
55405
|
+
...((_k = (_j = (_i = state.document.design) == null ? void 0 : _i.themeData) == null ? void 0 : _j.fonts) == null ? void 0 : _k.minor) ?? {},
|
|
55406
|
+
minorHAnsi: "Aptos"
|
|
55407
|
+
}
|
|
55408
|
+
}
|
|
55409
|
+
}
|
|
55410
|
+
},
|
|
55411
|
+
styles: nextStyles
|
|
55412
|
+
}
|
|
55413
|
+
};
|
|
55414
|
+
}
|
|
55415
|
+
function setDocumentDesign(state, patch) {
|
|
55416
|
+
const design = { ...state.document.design ?? {}, ...patch };
|
|
55417
|
+
return { ...state, document: { ...state.document, design } };
|
|
55418
|
+
}
|
|
55419
|
+
function setDocumentFontScheme(state, value) {
|
|
55420
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
55421
|
+
const [body, heading] = FONT_VALUES[value] ?? FONT_VALUES.aptos;
|
|
55422
|
+
const styles = Object.fromEntries(
|
|
55423
|
+
Object.entries(state.document.styles ?? {}).map(([id, style2]) => {
|
|
55424
|
+
if (!/^(normal|title|subtitle|heading[1-9]|quote|intensequote)$/i.test(id))
|
|
55425
|
+
return [id, style2];
|
|
55426
|
+
return [
|
|
55427
|
+
id,
|
|
55428
|
+
{
|
|
55429
|
+
...style2,
|
|
55430
|
+
textStyle: {
|
|
55431
|
+
...style2.textStyle ?? {},
|
|
55432
|
+
fontFamily: /^heading|title|quote/i.test(id) ? heading : body
|
|
55433
|
+
}
|
|
55434
|
+
}
|
|
55435
|
+
];
|
|
55436
|
+
})
|
|
55437
|
+
);
|
|
55438
|
+
return {
|
|
55439
|
+
...state,
|
|
55440
|
+
document: {
|
|
55441
|
+
...state.document,
|
|
55442
|
+
design: {
|
|
55443
|
+
...state.document.design ?? {},
|
|
55444
|
+
fontSchemeId: value,
|
|
55445
|
+
themeData: {
|
|
55446
|
+
...((_a = state.document.design) == null ? void 0 : _a.themeData) ?? {},
|
|
55447
|
+
sourceXml: void 0,
|
|
55448
|
+
fonts: {
|
|
55449
|
+
...((_c = (_b = state.document.design) == null ? void 0 : _b.themeData) == null ? void 0 : _c.fonts) ?? {},
|
|
55450
|
+
major: {
|
|
55451
|
+
...((_f = (_e = (_d = state.document.design) == null ? void 0 : _d.themeData) == null ? void 0 : _e.fonts) == null ? void 0 : _f.major) ?? {},
|
|
55452
|
+
majorHAnsi: heading.split(",")[0].trim()
|
|
55453
|
+
},
|
|
55454
|
+
minor: {
|
|
55455
|
+
...((_i = (_h = (_g = state.document.design) == null ? void 0 : _g.themeData) == null ? void 0 : _h.fonts) == null ? void 0 : _i.minor) ?? {},
|
|
55456
|
+
minorHAnsi: body.split(",")[0].trim()
|
|
55457
|
+
}
|
|
55458
|
+
}
|
|
55459
|
+
}
|
|
55460
|
+
},
|
|
55461
|
+
styles
|
|
55462
|
+
}
|
|
55463
|
+
};
|
|
55464
|
+
}
|
|
55465
|
+
function setDocumentParagraphSpacing(state, value) {
|
|
55466
|
+
const spacing = {
|
|
55467
|
+
compact: [0, 4],
|
|
55468
|
+
tight: [0, 6],
|
|
55469
|
+
open: [0, 10],
|
|
55470
|
+
relaxed: [4, 12]
|
|
55471
|
+
};
|
|
55472
|
+
const [before, after] = spacing[value] ?? spacing.open;
|
|
55473
|
+
const styles = Object.fromEntries(
|
|
55474
|
+
Object.entries(state.document.styles ?? {}).map(([id, style2]) => {
|
|
55475
|
+
if (!/^(normal|title|subtitle|heading[1-9]|quote|intensequote)$/i.test(id))
|
|
55476
|
+
return [id, style2];
|
|
55477
|
+
return [
|
|
55478
|
+
id,
|
|
55479
|
+
{
|
|
55480
|
+
...style2,
|
|
55481
|
+
paragraphStyle: {
|
|
55482
|
+
...style2.paragraphStyle ?? {},
|
|
55483
|
+
spacingBefore: before,
|
|
55484
|
+
spacingAfter: after
|
|
55485
|
+
}
|
|
55486
|
+
}
|
|
55487
|
+
];
|
|
55488
|
+
})
|
|
55489
|
+
);
|
|
55490
|
+
return {
|
|
55491
|
+
...state,
|
|
55492
|
+
document: {
|
|
55493
|
+
...state.document,
|
|
55494
|
+
design: { ...state.document.design ?? {}, paragraphSpacingId: value },
|
|
55495
|
+
styles
|
|
55496
|
+
}
|
|
55497
|
+
};
|
|
55498
|
+
}
|
|
55499
|
+
function applyDocumentTheme(state, theme) {
|
|
55500
|
+
return updateSemanticStyles(state, theme);
|
|
55501
|
+
}
|
|
55502
|
+
function setDocumentColorScheme(state, value) {
|
|
55503
|
+
var _a, _b, _c;
|
|
55504
|
+
const colors = COLOR_VALUES[value] ?? COLOR_VALUES.oasis;
|
|
55505
|
+
const styles = Object.fromEntries(
|
|
55506
|
+
Object.entries(state.document.styles ?? {}).map(([id, style2]) => {
|
|
55507
|
+
if (!/^(normal|title|subtitle|heading[1-9]|quote|intensequote)$/i.test(id))
|
|
55508
|
+
return [id, style2];
|
|
55509
|
+
const heading = /^heading[1-9]$/i.test(id) || /title|quote/i.test(id);
|
|
55510
|
+
return [
|
|
55511
|
+
id,
|
|
55512
|
+
{
|
|
55513
|
+
...style2,
|
|
55514
|
+
textStyle: {
|
|
55515
|
+
...style2.textStyle ?? {},
|
|
55516
|
+
color: heading ? colors.heading : colors.color
|
|
55517
|
+
}
|
|
55518
|
+
}
|
|
55519
|
+
];
|
|
55520
|
+
})
|
|
55521
|
+
);
|
|
55522
|
+
return {
|
|
55523
|
+
...state,
|
|
55524
|
+
document: {
|
|
55525
|
+
...state.document,
|
|
55526
|
+
styles,
|
|
55527
|
+
design: {
|
|
55528
|
+
...state.document.design ?? {},
|
|
55529
|
+
colorSchemeId: value,
|
|
55530
|
+
themeData: {
|
|
55531
|
+
...((_a = state.document.design) == null ? void 0 : _a.themeData) ?? {},
|
|
55532
|
+
sourceXml: void 0,
|
|
55533
|
+
colors: {
|
|
55534
|
+
...((_c = (_b = state.document.design) == null ? void 0 : _b.themeData) == null ? void 0 : _c.colors) ?? {},
|
|
55535
|
+
accent1: colors.color,
|
|
55536
|
+
accent2: colors.heading
|
|
55537
|
+
}
|
|
55538
|
+
}
|
|
55539
|
+
}
|
|
55540
|
+
}
|
|
55541
|
+
};
|
|
55542
|
+
}
|
|
55543
|
+
function setDocumentPageColor(state, color) {
|
|
55544
|
+
return setDocumentDesign(state, { pageColor: color });
|
|
55545
|
+
}
|
|
55546
|
+
function setDocumentWatermark(state, watermark) {
|
|
55547
|
+
return setDocumentDesign(state, { watermark });
|
|
55548
|
+
}
|
|
55549
|
+
function setDocumentPageBorder(state, border) {
|
|
55550
|
+
const sections = (state.document.sections ?? []).map((section) => ({
|
|
55551
|
+
...section,
|
|
55552
|
+
pageBorder: border
|
|
55553
|
+
}));
|
|
55554
|
+
return {
|
|
55555
|
+
...state,
|
|
55556
|
+
document: {
|
|
55557
|
+
...state.document,
|
|
55558
|
+
sections,
|
|
55559
|
+
design: { ...state.document.design ?? {} }
|
|
55560
|
+
}
|
|
55561
|
+
};
|
|
55562
|
+
}
|
|
55218
55563
|
function connectEditorClientHost(controller, deps) {
|
|
55219
55564
|
const snapshot = () => deps.cloneState(deps.getStateSnapshot());
|
|
55220
55565
|
controller.connectHost({
|
|
@@ -55228,7 +55573,20 @@ function connectEditorClientHost(controller, deps) {
|
|
|
55228
55573
|
},
|
|
55229
55574
|
applyTransactionalState: deps.applyTransactionalState,
|
|
55230
55575
|
resetDocument: () => {
|
|
55231
|
-
|
|
55576
|
+
var _a;
|
|
55577
|
+
let next = createInitialEditorState();
|
|
55578
|
+
try {
|
|
55579
|
+
const raw = (_a = globalThis.localStorage) == null ? void 0 : _a.getItem("oasis-design-default");
|
|
55580
|
+
if (raw) {
|
|
55581
|
+
const design = JSON.parse(
|
|
55582
|
+
raw
|
|
55583
|
+
);
|
|
55584
|
+
if (design.themeId) next = applyDocumentTheme(next, design.themeId);
|
|
55585
|
+
next = setDocumentDesign(next, design);
|
|
55586
|
+
}
|
|
55587
|
+
} catch {
|
|
55588
|
+
}
|
|
55589
|
+
deps.applyState(next);
|
|
55232
55590
|
deps.resetEditorChromeState();
|
|
55233
55591
|
deps.focusInput();
|
|
55234
55592
|
},
|
|
@@ -56012,6 +56370,78 @@ function buildTableCommands({
|
|
|
56012
56370
|
})
|
|
56013
56371
|
};
|
|
56014
56372
|
}
|
|
56373
|
+
function buildDesignCommands({
|
|
56374
|
+
design,
|
|
56375
|
+
actionCommand
|
|
56376
|
+
}) {
|
|
56377
|
+
return {
|
|
56378
|
+
applyDocumentTheme: actionCommand(
|
|
56379
|
+
"applyDocumentTheme",
|
|
56380
|
+
(p) => design.applyTheme(String(p)),
|
|
56381
|
+
() => {
|
|
56382
|
+
var _a;
|
|
56383
|
+
return { value: (_a = design.getDesign()) == null ? void 0 : _a.themeId };
|
|
56384
|
+
}
|
|
56385
|
+
),
|
|
56386
|
+
setDocumentColorScheme: actionCommand(
|
|
56387
|
+
"setDocumentColorScheme",
|
|
56388
|
+
(p) => design.setColorScheme(String(p)),
|
|
56389
|
+
() => {
|
|
56390
|
+
var _a;
|
|
56391
|
+
return { value: (_a = design.getDesign()) == null ? void 0 : _a.colorSchemeId };
|
|
56392
|
+
}
|
|
56393
|
+
),
|
|
56394
|
+
setDocumentFontScheme: actionCommand(
|
|
56395
|
+
"setDocumentFontScheme",
|
|
56396
|
+
(p) => design.setFontScheme(String(p)),
|
|
56397
|
+
() => {
|
|
56398
|
+
var _a;
|
|
56399
|
+
return { value: (_a = design.getDesign()) == null ? void 0 : _a.fontSchemeId };
|
|
56400
|
+
}
|
|
56401
|
+
),
|
|
56402
|
+
setDocumentParagraphSpacing: actionCommand(
|
|
56403
|
+
"setDocumentParagraphSpacing",
|
|
56404
|
+
(p) => design.setParagraphSpacing(String(p)),
|
|
56405
|
+
() => {
|
|
56406
|
+
var _a;
|
|
56407
|
+
return { value: (_a = design.getDesign()) == null ? void 0 : _a.paragraphSpacingId };
|
|
56408
|
+
}
|
|
56409
|
+
),
|
|
56410
|
+
setDocumentEffects: actionCommand(
|
|
56411
|
+
"setDocumentEffects",
|
|
56412
|
+
(p) => design.setEffects(String(p)),
|
|
56413
|
+
() => {
|
|
56414
|
+
var _a;
|
|
56415
|
+
return { value: (_a = design.getDesign()) == null ? void 0 : _a.effectsId };
|
|
56416
|
+
}
|
|
56417
|
+
),
|
|
56418
|
+
setDocumentPageColor: actionCommand(
|
|
56419
|
+
"setDocumentPageColor",
|
|
56420
|
+
(p) => design.setPageColor(p ?? null),
|
|
56421
|
+
() => {
|
|
56422
|
+
var _a;
|
|
56423
|
+
return { value: (_a = design.getDesign()) == null ? void 0 : _a.pageColor };
|
|
56424
|
+
}
|
|
56425
|
+
),
|
|
56426
|
+
setDocumentWatermark: actionCommand(
|
|
56427
|
+
"setDocumentWatermark",
|
|
56428
|
+
(p) => design.setWatermark(p ?? null),
|
|
56429
|
+
() => {
|
|
56430
|
+
var _a;
|
|
56431
|
+
return { value: (_a = design.getDesign()) == null ? void 0 : _a.watermark };
|
|
56432
|
+
}
|
|
56433
|
+
),
|
|
56434
|
+
setDocumentPageBorder: actionCommand(
|
|
56435
|
+
"setDocumentPageBorder",
|
|
56436
|
+
(p) => design.setPageBorder(p ?? null),
|
|
56437
|
+
() => ({ value: design.getPageBorder() })
|
|
56438
|
+
),
|
|
56439
|
+
setDocumentDesignDefault: actionCommand(
|
|
56440
|
+
"setDocumentDesignDefault",
|
|
56441
|
+
() => design.setDefault()
|
|
56442
|
+
)
|
|
56443
|
+
};
|
|
56444
|
+
}
|
|
56015
56445
|
function createEssentialsPlugin(deps) {
|
|
56016
56446
|
const command = createCommandBuilder(deps.gate.isCommandEnabled);
|
|
56017
56447
|
const valueCommand = createValueCommandBuilder(deps.gate.isCommandEnabled);
|
|
@@ -56050,6 +56480,10 @@ function createEssentialsPlugin(deps) {
|
|
|
56050
56480
|
gate: deps.gate,
|
|
56051
56481
|
table: deps.table,
|
|
56052
56482
|
actionCommand
|
|
56483
|
+
}),
|
|
56484
|
+
...buildDesignCommands({
|
|
56485
|
+
design: deps.design,
|
|
56486
|
+
actionCommand
|
|
56053
56487
|
})
|
|
56054
56488
|
}
|
|
56055
56489
|
};
|
|
@@ -56442,17 +56876,31 @@ const SHAPE_DEFAULT_HEIGHT = 100;
|
|
|
56442
56876
|
const SHAPE_DEFAULT_FILL = "#4472C4";
|
|
56443
56877
|
const SHAPE_DEFAULT_BORDER_COLOR = "#2F528F";
|
|
56444
56878
|
const SHAPE_DEFAULT_BORDER_WIDTH_PT = 1;
|
|
56879
|
+
function shapeColorsForDesign(state) {
|
|
56880
|
+
var _a;
|
|
56881
|
+
switch ((_a = state.document.design) == null ? void 0 : _a.effectsId) {
|
|
56882
|
+
case "flat":
|
|
56883
|
+
return { fill: "#e2e8f0", border: "#64748b" };
|
|
56884
|
+
case "intense":
|
|
56885
|
+
return { fill: "#0f766e", border: "#115e59" };
|
|
56886
|
+
case "moderate":
|
|
56887
|
+
return { fill: "#5b9bd5", border: "#2f75b5" };
|
|
56888
|
+
default:
|
|
56889
|
+
return { fill: SHAPE_DEFAULT_FILL, border: SHAPE_DEFAULT_BORDER_COLOR };
|
|
56890
|
+
}
|
|
56891
|
+
}
|
|
56445
56892
|
function insertShapeAtSelection(state, preset) {
|
|
56446
56893
|
const collapsedState = isSelectionCollapsed(state.selection) ? state : deleteSelectionRange(state);
|
|
56447
56894
|
const { paragraph, index, offset } = getFocusParagraph(collapsedState);
|
|
56895
|
+
const shapeColors = shapeColorsForDesign(collapsedState);
|
|
56448
56896
|
const textBox = {
|
|
56449
56897
|
width: SHAPE_DEFAULT_WIDTH,
|
|
56450
56898
|
height: SHAPE_DEFAULT_HEIGHT,
|
|
56451
56899
|
blocks: [createEditorParagraph("")],
|
|
56452
56900
|
shape: {
|
|
56453
56901
|
preset,
|
|
56454
|
-
fill:
|
|
56455
|
-
borderColor:
|
|
56902
|
+
fill: shapeColors.fill,
|
|
56903
|
+
borderColor: shapeColors.border,
|
|
56456
56904
|
borderWidthPt: SHAPE_DEFAULT_BORDER_WIDTH_PT
|
|
56457
56905
|
},
|
|
56458
56906
|
floating: wrapPresetToFloating(void 0, "front")
|
|
@@ -56957,6 +57405,46 @@ function buildEssentialsTable(options) {
|
|
|
56957
57405
|
insert: (rows, cols) => options.tableOps.insertTableCommand(rows, cols)
|
|
56958
57406
|
};
|
|
56959
57407
|
}
|
|
57408
|
+
const DEFAULT_DESIGN_KEY = "oasis-design-default";
|
|
57409
|
+
function buildEssentialsDesign(options) {
|
|
57410
|
+
const apply = (producer) => options.applyTransactionalState(producer);
|
|
57411
|
+
return {
|
|
57412
|
+
applyTheme: (theme) => apply((state) => applyDocumentTheme(state, theme)),
|
|
57413
|
+
setColorScheme: (value) => apply((state) => setDocumentColorScheme(state, value)),
|
|
57414
|
+
setFontScheme: (value) => apply((state) => setDocumentFontScheme(state, value)),
|
|
57415
|
+
setParagraphSpacing: (value) => apply((state) => setDocumentParagraphSpacing(state, value)),
|
|
57416
|
+
setEffects: (value) => apply(
|
|
57417
|
+
(state) => {
|
|
57418
|
+
var _a;
|
|
57419
|
+
return setDocumentDesign(state, {
|
|
57420
|
+
effectsId: value,
|
|
57421
|
+
themeData: {
|
|
57422
|
+
...((_a = state.document.design) == null ? void 0 : _a.themeData) ?? {},
|
|
57423
|
+
sourceXml: void 0,
|
|
57424
|
+
effectsXml: void 0
|
|
57425
|
+
}
|
|
57426
|
+
});
|
|
57427
|
+
}
|
|
57428
|
+
),
|
|
57429
|
+
setPageColor: (value) => apply((state) => setDocumentPageColor(state, value)),
|
|
57430
|
+
setWatermark: (value) => apply((state) => setDocumentWatermark(state, value)),
|
|
57431
|
+
setPageBorder: (value) => apply((state) => setDocumentPageBorder(state, value)),
|
|
57432
|
+
setDefault: () => {
|
|
57433
|
+
var _a;
|
|
57434
|
+
const design = options.state().document.design;
|
|
57435
|
+
if (design)
|
|
57436
|
+
(_a = globalThis.localStorage) == null ? void 0 : _a.setItem(
|
|
57437
|
+
DEFAULT_DESIGN_KEY,
|
|
57438
|
+
JSON.stringify(design)
|
|
57439
|
+
);
|
|
57440
|
+
},
|
|
57441
|
+
getDesign: () => options.state().document.design,
|
|
57442
|
+
getPageBorder: () => {
|
|
57443
|
+
var _a, _b;
|
|
57444
|
+
return (_b = (_a = options.state().document.sections) == null ? void 0 : _a.find((section) => section.pageBorder)) == null ? void 0 : _b.pageBorder;
|
|
57445
|
+
}
|
|
57446
|
+
};
|
|
57447
|
+
}
|
|
56960
57448
|
function createEditorEssentialsRuntimePlugin(options) {
|
|
56961
57449
|
return createEssentialsPlugin({
|
|
56962
57450
|
gate: buildEssentialsGate(options),
|
|
@@ -56970,7 +57458,8 @@ function createEditorEssentialsRuntimePlugin(options) {
|
|
|
56970
57458
|
browser: buildEssentialsBrowser(),
|
|
56971
57459
|
paragraph: buildEssentialsParagraph(options),
|
|
56972
57460
|
section: buildEssentialsSection(options),
|
|
56973
|
-
table: buildEssentialsTable(options)
|
|
57461
|
+
table: buildEssentialsTable(options),
|
|
57462
|
+
design: buildEssentialsDesign(options)
|
|
56974
57463
|
});
|
|
56975
57464
|
}
|
|
56976
57465
|
const defaultMenuItems = [
|