@harbour-enterprises/superdoc 0.20.0-next.8 → 0.20.0-next.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{PdfViewer-BoDHZ2nW.es.js → PdfViewer-BZlsmhsJ.es.js} +1 -1
- package/dist/chunks/{PdfViewer-Ch0v9vA6.cjs → PdfViewer-BqGjx7hC.cjs} +1 -1
- package/dist/chunks/{index-BWPWqVxp.es.js → index-4GToG3C3.es.js} +2 -2
- package/dist/chunks/{index-DFOT300M.cjs → index-DPzgGSfg.cjs} +2 -2
- package/dist/chunks/{super-editor.es-BQ6kZTNg.cjs → super-editor.es-BkxUKZfn.cjs} +309 -574
- package/dist/chunks/{super-editor.es-sBfWb5tn.es.js → super-editor.es-DqX3Ipsk.es.js} +309 -574
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-C91Sr_5w.js → converter-C6YOTAXG.js} +64 -8
- package/dist/super-editor/chunks/{docx-zipper-Cl7LYpt6.js → docx-zipper-CSiwWpmr.js} +1 -1
- package/dist/super-editor/chunks/{editor-a7cQT9Dw.js → editor-chVid4VD.js} +247 -568
- package/dist/super-editor/chunks/{toolbar-DiNFtCKr.js → toolbar-ancqgN0p.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/src/core/super-converter/helpers.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v2/importer/imageImporter.d.ts +1 -0
- package/dist/super-editor/src/extensions/block-node/block-node.d.ts +30 -5
- package/dist/super-editor/src/extensions/bold/bold.d.ts +20 -0
- package/dist/super-editor/src/extensions/bullet-list/bullet-list.d.ts +12 -0
- package/dist/super-editor/src/extensions/color/color.d.ts +26 -0
- package/dist/super-editor/src/extensions/content-block/content-block.d.ts +30 -0
- package/dist/super-editor/src/extensions/custom-selection/custom-selection.d.ts +16 -0
- package/dist/super-editor/src/extensions/document/document.d.ts +26 -0
- package/dist/super-editor/src/extensions/dropcursor/dropcursor.d.ts +26 -0
- package/dist/super-editor/src/extensions/font-family/font-family.d.ts +29 -0
- package/dist/super-editor/src/extensions/font-size/font-size.d.ts +21 -0
- package/dist/super-editor/src/extensions/format-commands/format-commands.d.ts +9 -0
- package/dist/super-editor/src/extensions/gapcursor/gapcursor.d.ts +9 -0
- package/dist/super-editor/src/extensions/heading/heading.d.ts +12 -6
- package/dist/super-editor/src/extensions/highlight/highlight.d.ts +20 -0
- package/dist/super-editor/src/extensions/history/history.d.ts +7 -15
- package/dist/super-editor/src/extensions/image/image.d.ts +78 -0
- package/dist/super-editor/src/extensions/image/imageHelpers/index.d.ts +1 -0
- package/dist/super-editor/src/extensions/image/imageHelpers/rotation.d.ts +4 -0
- package/dist/super-editor/src/extensions/italic/italic.d.ts +10 -0
- package/dist/super-editor/src/extensions/line-break/line-break.d.ts +43 -0
- package/dist/super-editor/src/extensions/line-height/line-height.d.ts +22 -0
- package/dist/super-editor/src/extensions/link/link.d.ts +53 -25
- package/dist/super-editor/src/extensions/linked-styles/linked-styles.d.ts +9 -0
- package/dist/super-editor/src/extensions/list-item/list-item.d.ts +48 -0
- package/dist/super-editor/src/extensions/mention/mention.d.ts +26 -0
- package/dist/super-editor/src/extensions/noderesizer/noderesizer.d.ts +14 -0
- package/dist/super-editor/src/extensions/ordered-list/ordered-list.d.ts +35 -0
- package/dist/super-editor/src/extensions/page-number/page-number.d.ts +52 -0
- package/dist/super-editor/src/extensions/paragraph/paragraph.d.ts +49 -0
- package/dist/super-editor/src/extensions/placeholder/placeholder.d.ts +15 -0
- package/dist/super-editor/src/extensions/popover-plugin/popover-plugin.d.ts +9 -0
- package/dist/super-editor/src/extensions/run-item/run-item.d.ts +24 -0
- package/dist/super-editor/src/extensions/search/search.d.ts +11 -2
- package/dist/super-editor/src/extensions/shape-container/shape-container.d.ts +29 -0
- package/dist/super-editor/src/extensions/shape-textbox/shape-textbox.d.ts +26 -0
- package/dist/super-editor/src/extensions/slash-menu/slash-menu.d.ts +9 -0
- package/dist/super-editor/src/extensions/strike/strike.d.ts +10 -0
- package/dist/super-editor/src/extensions/structured-content/document-section.d.ts +46 -27
- package/dist/super-editor/src/extensions/structured-content/structured-content-block.d.ts +26 -0
- package/dist/super-editor/src/extensions/structured-content/structured-content.d.ts +26 -0
- package/dist/super-editor/src/extensions/tab/tab.d.ts +25 -0
- package/dist/super-editor/src/extensions/table/table.d.ts +112 -121
- package/dist/super-editor/src/extensions/table-cell/table-cell.d.ts +41 -0
- package/dist/super-editor/src/extensions/table-header/table-header.d.ts +22 -0
- package/dist/super-editor/src/extensions/table-row/table-row.d.ts +28 -0
- package/dist/super-editor/src/extensions/text/text.d.ts +14 -0
- package/dist/super-editor/src/extensions/text-align/text-align.d.ts +22 -0
- package/dist/super-editor/src/extensions/text-indent/text-indent.d.ts +19 -10
- package/dist/super-editor/src/extensions/text-style/text-style.d.ts +20 -0
- package/dist/super-editor/src/extensions/text-transform/text-transform.d.ts +20 -0
- package/dist/super-editor/src/extensions/underline/underline.d.ts +25 -0
- package/dist/super-editor/src/tests/helpers/editor-test-utils.d.ts +14 -0
- package/dist/super-editor/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +309 -574
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -12,9 +12,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
12
12
|
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _ListItemNodeView_instances, init_fn2, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _DocumentSectionView_instances, init_fn3, addToolTip_fn;
|
|
13
13
|
import * as Y from "yjs";
|
|
14
14
|
import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
|
|
15
|
-
import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as InputRule, ah as kebabCase, ai as findParentNodeClosestToPos, aj as getListItemStyleDefinitions, ak as docxNumberigHelpers, al as parseIndentElement, am as combineIndents, an as StepMap, ao as SelectionRange, ap as Transform, aq as isInTable$1, ar as generateDocxRandomId, as as insertNewRelationship, at as updateDOMAttributes, au as htmlHandler } from "./converter-
|
|
15
|
+
import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as InputRule, ah as kebabCase, ai as findParentNodeClosestToPos, aj as getListItemStyleDefinitions, ak as docxNumberigHelpers, al as parseIndentElement, am as combineIndents, an as StepMap, ao as SelectionRange, ap as Transform, aq as isInTable$1, ar as generateDocxRandomId, as as insertNewRelationship, at as updateDOMAttributes, au as htmlHandler } from "./converter-C6YOTAXG.js";
|
|
16
16
|
import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
|
|
17
|
-
import { D as DocxZipper } from "./docx-zipper-
|
|
17
|
+
import { D as DocxZipper } from "./docx-zipper-CSiwWpmr.js";
|
|
18
18
|
var GOOD_LEAF_SIZE = 200;
|
|
19
19
|
var RopeSequence = function RopeSequence2() {
|
|
20
20
|
};
|
|
@@ -7683,12 +7683,6 @@ const History = Extension.create({
|
|
|
7683
7683
|
name: "history",
|
|
7684
7684
|
addOptions() {
|
|
7685
7685
|
return {
|
|
7686
|
-
/**
|
|
7687
|
-
* @typedef {Object} HistoryOptions
|
|
7688
|
-
* @category Options
|
|
7689
|
-
* @property {number} [depth=100] - Maximum undo/redo steps to remember
|
|
7690
|
-
* @property {number} [newGroupDelay=500] - Milliseconds to wait before starting a new history group
|
|
7691
|
-
*/
|
|
7692
7686
|
depth: 100,
|
|
7693
7687
|
newGroupDelay: 500
|
|
7694
7688
|
};
|
|
@@ -7707,9 +7701,8 @@ const History = Extension.create({
|
|
|
7707
7701
|
/**
|
|
7708
7702
|
* Undo the last action
|
|
7709
7703
|
* @category Command
|
|
7710
|
-
* @returns {Function} Command function
|
|
7711
7704
|
* @example
|
|
7712
|
-
* undo()
|
|
7705
|
+
* editor.commands.undo()
|
|
7713
7706
|
* @note Groups changes within the newGroupDelay window
|
|
7714
7707
|
*/
|
|
7715
7708
|
undo: () => ({ state, dispatch, tr }) => {
|
|
@@ -7723,9 +7716,8 @@ const History = Extension.create({
|
|
|
7723
7716
|
/**
|
|
7724
7717
|
* Redo the last undone action
|
|
7725
7718
|
* @category Command
|
|
7726
|
-
* @returns {Function} Command function
|
|
7727
7719
|
* @example
|
|
7728
|
-
* redo()
|
|
7720
|
+
* editor.commands.redo()
|
|
7729
7721
|
* @note Only available after an undo action
|
|
7730
7722
|
*/
|
|
7731
7723
|
redo: () => ({ state, dispatch, tr }) => {
|
|
@@ -14705,6 +14697,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14705
14697
|
return result;
|
|
14706
14698
|
} catch (error) {
|
|
14707
14699
|
this.emit("exception", { error, editor: this });
|
|
14700
|
+
console.error(error);
|
|
14708
14701
|
}
|
|
14709
14702
|
}
|
|
14710
14703
|
/**
|
|
@@ -14728,6 +14721,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14728
14721
|
this.converter.footerEditors.length = 0;
|
|
14729
14722
|
} catch (error) {
|
|
14730
14723
|
this.emit("exception", { error, editor: this });
|
|
14724
|
+
console.error(error);
|
|
14731
14725
|
}
|
|
14732
14726
|
}
|
|
14733
14727
|
/**
|
|
@@ -15425,6 +15419,7 @@ endCollaboration_fn = function() {
|
|
|
15425
15419
|
if (this.options.ydoc) this.options.ydoc.destroy();
|
|
15426
15420
|
} catch (error) {
|
|
15427
15421
|
this.emit("exception", { error, editor: this });
|
|
15422
|
+
console.error(error);
|
|
15428
15423
|
}
|
|
15429
15424
|
};
|
|
15430
15425
|
/**
|
|
@@ -15459,11 +15454,6 @@ const Color = Extension.create({
|
|
|
15459
15454
|
name: "color",
|
|
15460
15455
|
addOptions() {
|
|
15461
15456
|
return {
|
|
15462
|
-
/**
|
|
15463
|
-
* @typedef {Object} ColorOptions
|
|
15464
|
-
* @category Options
|
|
15465
|
-
* @property {string[]} [types=['textStyle']] - Mark types to add color support to
|
|
15466
|
-
*/
|
|
15467
15457
|
types: ["textStyle"]
|
|
15468
15458
|
};
|
|
15469
15459
|
},
|
|
@@ -15472,10 +15462,6 @@ const Color = Extension.create({
|
|
|
15472
15462
|
{
|
|
15473
15463
|
types: this.options.types,
|
|
15474
15464
|
attributes: {
|
|
15475
|
-
/**
|
|
15476
|
-
* @category Attribute
|
|
15477
|
-
* @param {ColorValue} [color] - Text color value
|
|
15478
|
-
*/
|
|
15479
15465
|
color: {
|
|
15480
15466
|
default: null,
|
|
15481
15467
|
parseDOM: (el) => el.style.color?.replace(/['"]+/g, ""),
|
|
@@ -15494,16 +15480,17 @@ const Color = Extension.create({
|
|
|
15494
15480
|
* Set text color
|
|
15495
15481
|
* @category Command
|
|
15496
15482
|
* @param {ColorValue} color - Color value to apply
|
|
15497
|
-
* @returns {Function} Command function
|
|
15498
15483
|
* @example
|
|
15499
15484
|
* // Set to red using hex
|
|
15500
|
-
* setColor('#ff0000')
|
|
15485
|
+
* editor.commands.setColor('#ff0000')
|
|
15501
15486
|
*
|
|
15487
|
+
* @example
|
|
15502
15488
|
* // Set using rgb
|
|
15503
|
-
* setColor('rgb(255, 0, 0)')
|
|
15489
|
+
* editor.commands.setColor('rgb(255, 0, 0)')
|
|
15504
15490
|
*
|
|
15491
|
+
* @example
|
|
15505
15492
|
* // Set using named color
|
|
15506
|
-
* setColor('blue')
|
|
15493
|
+
* editor.commands.setColor('blue')
|
|
15507
15494
|
* @note Preserves other text styling attributes
|
|
15508
15495
|
*/
|
|
15509
15496
|
setColor: (color) => ({ chain }) => {
|
|
@@ -15512,9 +15499,8 @@ const Color = Extension.create({
|
|
|
15512
15499
|
/**
|
|
15513
15500
|
* Remove text color
|
|
15514
15501
|
* @category Command
|
|
15515
|
-
* @returns {Function} Command function
|
|
15516
15502
|
* @example
|
|
15517
|
-
* unsetColor()
|
|
15503
|
+
* editor.commands.unsetColor()
|
|
15518
15504
|
* @note Removes color while preserving other text styles
|
|
15519
15505
|
*/
|
|
15520
15506
|
unsetColor: () => ({ chain }) => {
|
|
@@ -15527,11 +15513,6 @@ const FontFamily = Extension.create({
|
|
|
15527
15513
|
name: "fontFamily",
|
|
15528
15514
|
addOptions() {
|
|
15529
15515
|
return {
|
|
15530
|
-
/**
|
|
15531
|
-
* @typedef {Object} FontFamilyOptions
|
|
15532
|
-
* @category Options
|
|
15533
|
-
* @property {string[]} [types=['textStyle']] - Mark types to add font family support to
|
|
15534
|
-
*/
|
|
15535
15516
|
types: ["textStyle"]
|
|
15536
15517
|
};
|
|
15537
15518
|
},
|
|
@@ -15540,10 +15521,6 @@ const FontFamily = Extension.create({
|
|
|
15540
15521
|
{
|
|
15541
15522
|
types: this.options.types,
|
|
15542
15523
|
attributes: {
|
|
15543
|
-
/**
|
|
15544
|
-
* @category Attribute
|
|
15545
|
-
* @param {FontFamilyValue} [fontFamily] - Font family for text
|
|
15546
|
-
*/
|
|
15547
15524
|
fontFamily: {
|
|
15548
15525
|
default: null,
|
|
15549
15526
|
parseDOM: (el) => el.style.fontFamily?.replace(/['"]+/g, ""),
|
|
@@ -15562,13 +15539,13 @@ const FontFamily = Extension.create({
|
|
|
15562
15539
|
* Set font family
|
|
15563
15540
|
* @category Command
|
|
15564
15541
|
* @param {FontFamilyValue} fontFamily - Font family to apply
|
|
15565
|
-
* @returns {Function} Command function
|
|
15566
15542
|
* @example
|
|
15567
15543
|
* // Set to Arial
|
|
15568
|
-
* setFontFamily('Arial')
|
|
15544
|
+
* editor.commands.setFontFamily('Arial')
|
|
15569
15545
|
*
|
|
15546
|
+
* @example
|
|
15570
15547
|
* // Set to serif font
|
|
15571
|
-
* setFontFamily('Georgia, serif')
|
|
15548
|
+
* editor.commands.setFontFamily('Georgia, serif')
|
|
15572
15549
|
* @note Preserves other text styling attributes
|
|
15573
15550
|
*/
|
|
15574
15551
|
setFontFamily: (fontFamily) => ({ chain }) => {
|
|
@@ -15577,9 +15554,8 @@ const FontFamily = Extension.create({
|
|
|
15577
15554
|
/**
|
|
15578
15555
|
* Remove font family
|
|
15579
15556
|
* @category Command
|
|
15580
|
-
* @returns {Function} Command function
|
|
15581
15557
|
* @example
|
|
15582
|
-
* unsetFontFamily()
|
|
15558
|
+
* editor.commands.unsetFontFamily()
|
|
15583
15559
|
* @note Reverts to default document font
|
|
15584
15560
|
*/
|
|
15585
15561
|
unsetFontFamily: () => ({ chain }) => {
|
|
@@ -15592,12 +15568,6 @@ const FontSize = Extension.create({
|
|
|
15592
15568
|
name: "fontSize",
|
|
15593
15569
|
addOptions() {
|
|
15594
15570
|
return {
|
|
15595
|
-
/**
|
|
15596
|
-
* @typedef {Object} FontSizeOptions
|
|
15597
|
-
* @category Options
|
|
15598
|
-
* @property {string[]} [types=['textStyle', 'tableCell']] - Node/mark types to add font size support to
|
|
15599
|
-
* @property {FontSizeDefaults} [defaults] - Default size configuration
|
|
15600
|
-
*/
|
|
15601
15571
|
types: ["textStyle", "tableCell"],
|
|
15602
15572
|
defaults: {
|
|
15603
15573
|
value: 12,
|
|
@@ -15612,10 +15582,6 @@ const FontSize = Extension.create({
|
|
|
15612
15582
|
{
|
|
15613
15583
|
types: this.options.types,
|
|
15614
15584
|
attributes: {
|
|
15615
|
-
/**
|
|
15616
|
-
* @category Attribute
|
|
15617
|
-
* @param {FontSizeValue} [fontSize] - Font size with unit
|
|
15618
|
-
*/
|
|
15619
15585
|
fontSize: {
|
|
15620
15586
|
default: null,
|
|
15621
15587
|
parseDOM: (el) => el.style.fontSize,
|
|
@@ -15637,16 +15603,10 @@ const FontSize = Extension.create({
|
|
|
15637
15603
|
* Set font size
|
|
15638
15604
|
* @category Command
|
|
15639
15605
|
* @param {FontSizeValue} fontSize - Size to apply (with optional unit)
|
|
15640
|
-
* @returns {Function} Command function
|
|
15641
15606
|
* @example
|
|
15642
|
-
*
|
|
15643
|
-
* setFontSize('
|
|
15644
|
-
*
|
|
15645
|
-
* // Set to 18px
|
|
15646
|
-
* setFontSize('18px')
|
|
15647
|
-
*
|
|
15648
|
-
* // Set without unit (uses default)
|
|
15649
|
-
* setFontSize(16)
|
|
15607
|
+
* editor.commands.setFontSize('14pt')
|
|
15608
|
+
* editor.commands.setFontSize('18px')
|
|
15609
|
+
* editor.commands.setFontSize(16)
|
|
15650
15610
|
* @note Automatically clamps to min/max values
|
|
15651
15611
|
*/
|
|
15652
15612
|
setFontSize: (fontSize) => ({ chain }) => {
|
|
@@ -15668,9 +15628,8 @@ const FontSize = Extension.create({
|
|
|
15668
15628
|
/**
|
|
15669
15629
|
* Remove font size
|
|
15670
15630
|
* @category Command
|
|
15671
|
-
* @returns {Function} Command function
|
|
15672
15631
|
* @example
|
|
15673
|
-
* unsetFontSize()
|
|
15632
|
+
* editor.commands.unsetFontSize()
|
|
15674
15633
|
* @note Reverts to default document size
|
|
15675
15634
|
*/
|
|
15676
15635
|
unsetFontSize: () => ({ chain }) => {
|
|
@@ -15720,13 +15679,9 @@ const TextAlign = Extension.create({
|
|
|
15720
15679
|
* Set text alignment
|
|
15721
15680
|
* @category Command
|
|
15722
15681
|
* @param {string} alignment - Alignment value (left, center, right, justify)
|
|
15723
|
-
* @returns {Function} Command function
|
|
15724
15682
|
* @example
|
|
15725
|
-
*
|
|
15726
|
-
* setTextAlign('
|
|
15727
|
-
*
|
|
15728
|
-
* // Set to justify
|
|
15729
|
-
* setTextAlign('justify')
|
|
15683
|
+
* editor.commands.setTextAlign('center')
|
|
15684
|
+
* editor.commands.setTextAlign('justify')
|
|
15730
15685
|
* @note Applies to all configured node types (heading, paragraph by default)
|
|
15731
15686
|
*/
|
|
15732
15687
|
setTextAlign: (alignment) => ({ commands: commands2 }) => {
|
|
@@ -15737,9 +15692,8 @@ const TextAlign = Extension.create({
|
|
|
15737
15692
|
/**
|
|
15738
15693
|
* Remove text alignment (reset to default)
|
|
15739
15694
|
* @category Command
|
|
15740
|
-
* @returns {Function} Command function
|
|
15741
15695
|
* @example
|
|
15742
|
-
* unsetTextAlign()
|
|
15696
|
+
* editor.commands.unsetTextAlign()
|
|
15743
15697
|
* @note Resets alignment to the default value
|
|
15744
15698
|
*/
|
|
15745
15699
|
unsetTextAlign: () => ({ commands: commands2 }) => {
|
|
@@ -15880,13 +15834,6 @@ const LineHeight = Extension.create({
|
|
|
15880
15834
|
name: "lineHeight",
|
|
15881
15835
|
addOptions() {
|
|
15882
15836
|
return {
|
|
15883
|
-
/**
|
|
15884
|
-
* @typedef {Object} LineHeightOptions
|
|
15885
|
-
* @category Options
|
|
15886
|
-
* @property {string[]} [types=['heading', 'paragraph']] - Block types to add line height support to
|
|
15887
|
-
* @property {Object} [defaults] - Default configuration
|
|
15888
|
-
* @property {string} [defaults.unit=''] - Default unit for line height values
|
|
15889
|
-
*/
|
|
15890
15837
|
types: ["heading", "paragraph"],
|
|
15891
15838
|
defaults: {
|
|
15892
15839
|
unit: ""
|
|
@@ -15898,10 +15845,6 @@ const LineHeight = Extension.create({
|
|
|
15898
15845
|
{
|
|
15899
15846
|
types: this.options.types,
|
|
15900
15847
|
attributes: {
|
|
15901
|
-
/**
|
|
15902
|
-
* @category Attribute
|
|
15903
|
-
* @param {LineHeightValue} [lineHeight] - Line height value
|
|
15904
|
-
*/
|
|
15905
15848
|
lineHeight: {
|
|
15906
15849
|
default: null,
|
|
15907
15850
|
parseDOM: (el) => el.style.lineHeight,
|
|
@@ -15927,16 +15870,10 @@ const LineHeight = Extension.create({
|
|
|
15927
15870
|
* Set line height for blocks
|
|
15928
15871
|
* @category Command
|
|
15929
15872
|
* @param {LineHeightValue} lineHeight - Line height to apply
|
|
15930
|
-
* @returns {Function} Command function
|
|
15931
15873
|
* @example
|
|
15932
|
-
*
|
|
15933
|
-
* setLineHeight(
|
|
15934
|
-
*
|
|
15935
|
-
* // Set to 24px spacing
|
|
15936
|
-
* setLineHeight('24px')
|
|
15937
|
-
*
|
|
15938
|
-
* // Set to double spacing
|
|
15939
|
-
* setLineHeight(2)
|
|
15874
|
+
* editor.commands.setLineHeight(1.5)
|
|
15875
|
+
* editor.commands.setLineHeight('24px')
|
|
15876
|
+
* editor.commands.setLineHeight(2)
|
|
15940
15877
|
* @note Applies to paragraphs and headings
|
|
15941
15878
|
*/
|
|
15942
15879
|
setLineHeight: (lineHeight) => ({ commands: commands2 }) => {
|
|
@@ -15946,9 +15883,8 @@ const LineHeight = Extension.create({
|
|
|
15946
15883
|
/**
|
|
15947
15884
|
* Remove line height
|
|
15948
15885
|
* @category Command
|
|
15949
|
-
* @returns {Function} Command function
|
|
15950
15886
|
* @example
|
|
15951
|
-
* unsetLineHeight()
|
|
15887
|
+
* editor.commands.unsetLineHeight()
|
|
15952
15888
|
* @note Reverts to default line spacing
|
|
15953
15889
|
*/
|
|
15954
15890
|
unsetLineHeight: () => ({ commands: commands2 }) => {
|
|
@@ -15976,9 +15912,8 @@ const FormatCommands = Extension.create({
|
|
|
15976
15912
|
/**
|
|
15977
15913
|
* Clear all formatting (nodes and marks)
|
|
15978
15914
|
* @category Command
|
|
15979
|
-
* @returns {Function} Command function
|
|
15980
15915
|
* @example
|
|
15981
|
-
* clearFormat()
|
|
15916
|
+
* editor.commands.clearFormat()
|
|
15982
15917
|
* @note Removes all marks and resets nodes to default paragraph
|
|
15983
15918
|
*/
|
|
15984
15919
|
clearFormat: () => ({ chain }) => {
|
|
@@ -15987,9 +15922,8 @@ const FormatCommands = Extension.create({
|
|
|
15987
15922
|
/**
|
|
15988
15923
|
* Clear only mark formatting
|
|
15989
15924
|
* @category Command
|
|
15990
|
-
* @returns {Function} Command function
|
|
15991
15925
|
* @example
|
|
15992
|
-
* clearMarksFormat()
|
|
15926
|
+
* editor.commands.clearMarksFormat()
|
|
15993
15927
|
* @note Removes bold, italic, underline, colors, etc. but preserves block structure
|
|
15994
15928
|
*/
|
|
15995
15929
|
clearMarksFormat: () => ({ chain }) => {
|
|
@@ -15998,9 +15932,8 @@ const FormatCommands = Extension.create({
|
|
|
15998
15932
|
/**
|
|
15999
15933
|
* Clear only node formatting
|
|
16000
15934
|
* @category Command
|
|
16001
|
-
* @returns {Function} Command function
|
|
16002
15935
|
* @example
|
|
16003
|
-
* clearNodesFormat()
|
|
15936
|
+
* editor.commands.clearNodesFormat()
|
|
16004
15937
|
* @note Converts headings, lists, etc. to paragraphs but preserves text marks
|
|
16005
15938
|
*/
|
|
16006
15939
|
clearNodesFormat: () => ({ chain }) => {
|
|
@@ -16009,13 +15942,8 @@ const FormatCommands = Extension.create({
|
|
|
16009
15942
|
/**
|
|
16010
15943
|
* Copy format from selection or apply copied format
|
|
16011
15944
|
* @category Command
|
|
16012
|
-
* @returns {Function} Command function
|
|
16013
15945
|
* @example
|
|
16014
|
-
*
|
|
16015
|
-
* copyFormat()
|
|
16016
|
-
*
|
|
16017
|
-
* // Second call: apply copied format to new selection
|
|
16018
|
-
* copyFormat()
|
|
15946
|
+
* editor.commands.copyFormat()
|
|
16019
15947
|
* @note Works like format painter - first click copies, second click applies
|
|
16020
15948
|
*/
|
|
16021
15949
|
copyFormat: () => ({ chain }) => {
|
|
@@ -16428,6 +16356,9 @@ function drawGapCursor(state) {
|
|
|
16428
16356
|
}
|
|
16429
16357
|
const Gapcursor = Extension.create({
|
|
16430
16358
|
name: "gapCursor",
|
|
16359
|
+
addOptions() {
|
|
16360
|
+
return {};
|
|
16361
|
+
},
|
|
16431
16362
|
addPmPlugins() {
|
|
16432
16363
|
return [gapCursor()];
|
|
16433
16364
|
},
|
|
@@ -16768,6 +16699,9 @@ function getCursorPositionRelativeToContainer(view, eventLocation) {
|
|
|
16768
16699
|
const SlashMenuPluginKey = new PluginKey("slashMenu");
|
|
16769
16700
|
const SlashMenu = Extension.create({
|
|
16770
16701
|
name: "slashMenu",
|
|
16702
|
+
addOptions() {
|
|
16703
|
+
return {};
|
|
16704
|
+
},
|
|
16771
16705
|
addPmPlugins() {
|
|
16772
16706
|
if (this.editor.options?.disableContextMenu) {
|
|
16773
16707
|
return [];
|
|
@@ -16905,11 +16839,6 @@ const Document = Node$1.create({
|
|
|
16905
16839
|
},
|
|
16906
16840
|
addAttributes() {
|
|
16907
16841
|
return {
|
|
16908
|
-
/**
|
|
16909
|
-
* @private
|
|
16910
|
-
* @category Attribute
|
|
16911
|
-
* @param {Object} [attributes] - Internal document attributes
|
|
16912
|
-
*/
|
|
16913
16842
|
attributes: {
|
|
16914
16843
|
rendered: false,
|
|
16915
16844
|
"aria-label": "Document node"
|
|
@@ -16921,10 +16850,10 @@ const Document = Node$1.create({
|
|
|
16921
16850
|
/**
|
|
16922
16851
|
* Get document statistics
|
|
16923
16852
|
* @category Command
|
|
16924
|
-
* @returns {Function} Command function
|
|
16925
16853
|
* @example
|
|
16926
16854
|
* // Get word and character count
|
|
16927
|
-
* getDocumentStats()
|
|
16855
|
+
* const stats = editor.commands.getDocumentStats()
|
|
16856
|
+
* console.log(`${stats.words} words, ${stats.characters} characters`)
|
|
16928
16857
|
* @note Returns word count, character count, and paragraph count
|
|
16929
16858
|
*/
|
|
16930
16859
|
getDocumentStats: () => ({ editor }) => {
|
|
@@ -16941,9 +16870,8 @@ const Document = Node$1.create({
|
|
|
16941
16870
|
/**
|
|
16942
16871
|
* Clear entire document
|
|
16943
16872
|
* @category Command
|
|
16944
|
-
* @returns {Function} Command function
|
|
16945
16873
|
* @example
|
|
16946
|
-
* clearDocument()
|
|
16874
|
+
* editor.commands.clearDocument()
|
|
16947
16875
|
* @note Replaces all content with an empty paragraph
|
|
16948
16876
|
*/
|
|
16949
16877
|
clearDocument: () => ({ commands: commands2 }) => {
|
|
@@ -16955,13 +16883,19 @@ const Document = Node$1.create({
|
|
|
16955
16883
|
const Text = Node$1.create({
|
|
16956
16884
|
name: "text",
|
|
16957
16885
|
group: "inline",
|
|
16958
|
-
inline: true
|
|
16886
|
+
inline: true,
|
|
16887
|
+
addOptions() {
|
|
16888
|
+
return {};
|
|
16889
|
+
}
|
|
16959
16890
|
});
|
|
16960
16891
|
const RunItem = Node$1.create({
|
|
16961
16892
|
name: "run",
|
|
16962
16893
|
group: "inline",
|
|
16963
16894
|
content: "text*",
|
|
16964
16895
|
inline: true,
|
|
16896
|
+
addOptions() {
|
|
16897
|
+
return {};
|
|
16898
|
+
},
|
|
16965
16899
|
parseDOM() {
|
|
16966
16900
|
return [{ tag: "run" }];
|
|
16967
16901
|
},
|
|
@@ -16987,14 +16921,6 @@ const BulletList = Node$1.create({
|
|
|
16987
16921
|
},
|
|
16988
16922
|
addOptions() {
|
|
16989
16923
|
return {
|
|
16990
|
-
/**
|
|
16991
|
-
* @typedef {Object} BulletListOptions
|
|
16992
|
-
* @category Options
|
|
16993
|
-
* @property {string} [itemTypeName='listItem'] - Name of the list item node type
|
|
16994
|
-
* @property {Object} [htmlAttributes] - HTML attributes for the ul element
|
|
16995
|
-
* @property {boolean} [keepMarks=true] - Whether to preserve marks when splitting
|
|
16996
|
-
* @property {boolean} [keepAttributes=false] - Whether to preserve attributes when splitting
|
|
16997
|
-
*/
|
|
16998
16924
|
itemTypeName: "listItem",
|
|
16999
16925
|
htmlAttributes: {
|
|
17000
16926
|
"aria-label": "Bullet list node"
|
|
@@ -17012,27 +16938,13 @@ const BulletList = Node$1.create({
|
|
|
17012
16938
|
},
|
|
17013
16939
|
addAttributes() {
|
|
17014
16940
|
return {
|
|
17015
|
-
/**
|
|
17016
|
-
* @category Attribute
|
|
17017
|
-
* @param {string} [list-style-type='bullet'] - List style type for this list
|
|
17018
|
-
*/
|
|
17019
16941
|
"list-style-type": {
|
|
17020
16942
|
default: "bullet",
|
|
17021
16943
|
rendered: false
|
|
17022
16944
|
},
|
|
17023
|
-
/**
|
|
17024
|
-
* @private
|
|
17025
|
-
* @category Attribute
|
|
17026
|
-
* @param {string} [listId] - Internal list identifier for numbering
|
|
17027
|
-
*/
|
|
17028
16945
|
listId: {
|
|
17029
16946
|
rendered: false
|
|
17030
16947
|
},
|
|
17031
|
-
/**
|
|
17032
|
-
* @private
|
|
17033
|
-
* @category Attribute
|
|
17034
|
-
* @param {string} [sdBlockId] - Internal block tracking ID
|
|
17035
|
-
*/
|
|
17036
16948
|
sdBlockId: {
|
|
17037
16949
|
default: null,
|
|
17038
16950
|
keepOnSplit: false,
|
|
@@ -17041,11 +16953,6 @@ const BulletList = Node$1.create({
|
|
|
17041
16953
|
return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
|
|
17042
16954
|
}
|
|
17043
16955
|
},
|
|
17044
|
-
/**
|
|
17045
|
-
* @private
|
|
17046
|
-
* @category Attribute
|
|
17047
|
-
* @param {Object} [attributes] - Additional attributes for the list
|
|
17048
|
-
*/
|
|
17049
16956
|
attributes: {
|
|
17050
16957
|
rendered: false,
|
|
17051
16958
|
keepOnSplit: true
|
|
@@ -17057,10 +16964,9 @@ const BulletList = Node$1.create({
|
|
|
17057
16964
|
/**
|
|
17058
16965
|
* Toggle a bullet list at the current selection
|
|
17059
16966
|
* @category Command
|
|
17060
|
-
* @returns {Function} Command function
|
|
17061
16967
|
* @example
|
|
17062
16968
|
* // Toggle bullet list on selected text
|
|
17063
|
-
* toggleBulletList()
|
|
16969
|
+
* editor.commands.toggleBulletList()
|
|
17064
16970
|
* @note Converts selected paragraphs to list items or removes list formatting
|
|
17065
16971
|
*/
|
|
17066
16972
|
toggleBulletList: () => (params2) => {
|
|
@@ -17179,9 +17085,25 @@ const OrderedList = Node$1.create({
|
|
|
17179
17085
|
},
|
|
17180
17086
|
addCommands() {
|
|
17181
17087
|
return {
|
|
17088
|
+
/**
|
|
17089
|
+
* Toggle ordered list formatting
|
|
17090
|
+
* @category Command
|
|
17091
|
+
* @example
|
|
17092
|
+
* editor.commands.toggleOrderedList()
|
|
17093
|
+
* @note Converts selection to ordered list or back to paragraphs
|
|
17094
|
+
*/
|
|
17182
17095
|
toggleOrderedList: () => (params2) => {
|
|
17183
17096
|
return toggleList(this.type)(params2);
|
|
17184
17097
|
},
|
|
17098
|
+
/**
|
|
17099
|
+
* Restart list node numbering
|
|
17100
|
+
* @category Command
|
|
17101
|
+
* @param {Array} followingNodes - Nodes to restart
|
|
17102
|
+
* @param {number} pos - Starting position
|
|
17103
|
+
* @example
|
|
17104
|
+
* editor.commands.restartListNodes(nodes, position)
|
|
17105
|
+
* @note Resets list numbering for specified nodes
|
|
17106
|
+
*/
|
|
17185
17107
|
restartListNodes: (followingNodes, pos) => ({ tr }) => {
|
|
17186
17108
|
let currentNodePos = pos;
|
|
17187
17109
|
const nodes = followingNodes.map((node) => {
|
|
@@ -17200,8 +17122,11 @@ const OrderedList = Node$1.create({
|
|
|
17200
17122
|
return true;
|
|
17201
17123
|
},
|
|
17202
17124
|
/**
|
|
17203
|
-
*
|
|
17204
|
-
* @
|
|
17125
|
+
* Update ordered list style type based on nesting level
|
|
17126
|
+
* @category Command
|
|
17127
|
+
* @example
|
|
17128
|
+
* editor.commands.updateOrderedListStyleType()
|
|
17129
|
+
* @note Cycles through decimal -> lowerAlpha -> lowerRoman based on depth
|
|
17205
17130
|
*/
|
|
17206
17131
|
updateOrderedListStyleType: () => ({ dispatch, tr }) => {
|
|
17207
17132
|
let list = findParentNode((node) => node.type.name === this.name)(tr.selection);
|
|
@@ -17478,7 +17403,7 @@ const CustomSelection = Extension.create({
|
|
|
17478
17403
|
* @returns {Function} Command function
|
|
17479
17404
|
* @example
|
|
17480
17405
|
* // Restore selection after toolbar interaction
|
|
17481
|
-
* restorePreservedSelection()
|
|
17406
|
+
* editor.commands.restorePreservedSelection()
|
|
17482
17407
|
* @note Used internally to maintain selection when interacting with toolbar
|
|
17483
17408
|
*/
|
|
17484
17409
|
restorePreservedSelection: () => ({ tr, state }) => {
|
|
@@ -17767,6 +17692,9 @@ const LinkedStyles = Extension.create({
|
|
|
17767
17692
|
name: "linkedStyles",
|
|
17768
17693
|
priority: 1,
|
|
17769
17694
|
// We need this plugin to run before the list plugins
|
|
17695
|
+
addOptions() {
|
|
17696
|
+
return {};
|
|
17697
|
+
},
|
|
17770
17698
|
addPmPlugins() {
|
|
17771
17699
|
return [createLinkedStylesPlugin(this.editor)];
|
|
17772
17700
|
},
|
|
@@ -17775,11 +17703,10 @@ const LinkedStyles = Extension.create({
|
|
|
17775
17703
|
/**
|
|
17776
17704
|
* Apply a linked style to the selected paragraphs
|
|
17777
17705
|
* @category Command
|
|
17778
|
-
* @param {
|
|
17779
|
-
* @returns {Function} Command function
|
|
17706
|
+
* @param {LinkedStyle} style - The style object to apply
|
|
17780
17707
|
* @example
|
|
17781
17708
|
* const style = editor.helpers.linkedStyles.getStyleById('Heading1');
|
|
17782
|
-
* setLinkedStyle(style);
|
|
17709
|
+
* editor.commands.setLinkedStyle(style);
|
|
17783
17710
|
* @note Clears existing formatting when applying a style
|
|
17784
17711
|
* @note Works with custom selection preservation
|
|
17785
17712
|
*/
|
|
@@ -17790,16 +17717,12 @@ const LinkedStyles = Extension.create({
|
|
|
17790
17717
|
/**
|
|
17791
17718
|
* Toggle a linked style on the current selection
|
|
17792
17719
|
* @category Command
|
|
17793
|
-
* @param {
|
|
17720
|
+
* @param {LinkedStyle} style - The linked style to apply (with id property)
|
|
17794
17721
|
* @param {string|null} [nodeType=null] - Node type to restrict toggle to (e.g., 'paragraph')
|
|
17795
|
-
* @returns {Function} Command function
|
|
17796
17722
|
* @example
|
|
17797
|
-
* // Toggle a heading style
|
|
17798
17723
|
* const style = editor.helpers.linkedStyles.getStyleById('Heading1');
|
|
17799
|
-
* toggleLinkedStyle(style)
|
|
17800
|
-
*
|
|
17801
|
-
* // Toggle only on paragraph nodes
|
|
17802
|
-
* toggleLinkedStyle(style, 'paragraph')
|
|
17724
|
+
* editor.commands.toggleLinkedStyle(style)
|
|
17725
|
+
* editor.commands.toggleLinkedStyle(style, 'paragraph')
|
|
17803
17726
|
* @note If selection is empty, returns false
|
|
17804
17727
|
* @note Removes style if already applied, applies it if not
|
|
17805
17728
|
*/
|
|
@@ -17827,13 +17750,9 @@ const LinkedStyles = Extension.create({
|
|
|
17827
17750
|
* Apply a linked style by its ID
|
|
17828
17751
|
* @category Command
|
|
17829
17752
|
* @param {string} styleId - The style ID to apply (e.g., 'Heading1')
|
|
17830
|
-
* @returns {Function} Command function
|
|
17831
17753
|
* @example
|
|
17832
|
-
*
|
|
17833
|
-
* setStyleById('
|
|
17834
|
-
*
|
|
17835
|
-
* // Apply a normal style
|
|
17836
|
-
* setStyleById('Normal')
|
|
17754
|
+
* editor.commands.setStyleById('Heading1')
|
|
17755
|
+
* editor.commands.setStyleById('Normal')
|
|
17837
17756
|
* @note Looks up the style from loaded Word styles
|
|
17838
17757
|
*/
|
|
17839
17758
|
setStyleById: (styleId) => (params2) => {
|
|
@@ -18541,12 +18460,6 @@ const Paragraph = OxmlNode.create({
|
|
|
18541
18460
|
inline: false,
|
|
18542
18461
|
addOptions() {
|
|
18543
18462
|
return {
|
|
18544
|
-
/**
|
|
18545
|
-
* @typedef {Object} HeadingOptions
|
|
18546
|
-
* @category Options
|
|
18547
|
-
* @property {number[]} [headingLevels=[1,2,3,4,5,6]] - Supported heading levels
|
|
18548
|
-
* @property {Object} [htmlAttributes] - HTML attributes for paragraph elements
|
|
18549
|
-
*/
|
|
18550
18463
|
headingLevels: [1, 2, 3, 4, 5, 6],
|
|
18551
18464
|
htmlAttributes: {}
|
|
18552
18465
|
};
|
|
@@ -18778,11 +18691,6 @@ const Heading = Extension.create({
|
|
|
18778
18691
|
name: "heading",
|
|
18779
18692
|
addOptions() {
|
|
18780
18693
|
return {
|
|
18781
|
-
/**
|
|
18782
|
-
* @typedef {Object} HeadingOptions
|
|
18783
|
-
* @category Options
|
|
18784
|
-
* @property {number[]} [levels=[1,2,3,4,5,6]] - Supported heading levels
|
|
18785
|
-
*/
|
|
18786
18694
|
levels: [1, 2, 3, 4, 5, 6]
|
|
18787
18695
|
};
|
|
18788
18696
|
},
|
|
@@ -18792,10 +18700,8 @@ const Heading = Extension.create({
|
|
|
18792
18700
|
* Set a heading with specified level
|
|
18793
18701
|
* @category Command
|
|
18794
18702
|
* @param {HeadingAttributes} attributes - Heading attributes including level
|
|
18795
|
-
* @returns {Function} Command function
|
|
18796
18703
|
* @example
|
|
18797
|
-
*
|
|
18798
|
-
* setHeading({ level: 2 })
|
|
18704
|
+
* editor.commands.setHeading({ level: 2 })
|
|
18799
18705
|
* @note Converts current block to heading
|
|
18800
18706
|
*/
|
|
18801
18707
|
setHeading: (attributes) => ({ commands: commands2 }) => {
|
|
@@ -18807,13 +18713,9 @@ const Heading = Extension.create({
|
|
|
18807
18713
|
* Toggle between heading and paragraph
|
|
18808
18714
|
* @category Command
|
|
18809
18715
|
* @param {HeadingAttributes} attributes - Heading attributes including level
|
|
18810
|
-
* @returns {Function} Command function
|
|
18811
18716
|
* @example
|
|
18812
|
-
*
|
|
18813
|
-
* toggleHeading({ level:
|
|
18814
|
-
*
|
|
18815
|
-
* // Toggle heading level 3
|
|
18816
|
-
* toggleHeading({ level: 3 })
|
|
18717
|
+
* editor.commands.toggleHeading({ level: 1 })
|
|
18718
|
+
* editor.commands.toggleHeading({ level: 3 })
|
|
18817
18719
|
* @note Switches between heading and paragraph for the same level
|
|
18818
18720
|
*/
|
|
18819
18721
|
toggleHeading: (attributes) => ({ commands: commands2 }) => {
|
|
@@ -19218,6 +19120,9 @@ const LineBreak = Node$1.create({
|
|
|
19218
19120
|
selectable: false,
|
|
19219
19121
|
content: "",
|
|
19220
19122
|
atom: true,
|
|
19123
|
+
addOptions() {
|
|
19124
|
+
return {};
|
|
19125
|
+
},
|
|
19221
19126
|
parseDOM() {
|
|
19222
19127
|
return [{ tag: "br" }];
|
|
19223
19128
|
},
|
|
@@ -19226,17 +19131,7 @@ const LineBreak = Node$1.create({
|
|
|
19226
19131
|
},
|
|
19227
19132
|
addAttributes() {
|
|
19228
19133
|
return {
|
|
19229
|
-
/**
|
|
19230
|
-
* @private
|
|
19231
|
-
* @category Attribute
|
|
19232
|
-
* @param {string} [lineBreakType] - Type of line break - passthrough in this node
|
|
19233
|
-
*/
|
|
19234
19134
|
lineBreakType: { rendered: false },
|
|
19235
|
-
/**
|
|
19236
|
-
* @private
|
|
19237
|
-
* @category Attribute
|
|
19238
|
-
* @param {string} [clear] - Clear attribute - passthrough in this node
|
|
19239
|
-
*/
|
|
19240
19135
|
clear: { rendered: false }
|
|
19241
19136
|
};
|
|
19242
19137
|
},
|
|
@@ -19245,9 +19140,8 @@ const LineBreak = Node$1.create({
|
|
|
19245
19140
|
/**
|
|
19246
19141
|
* Insert a line break
|
|
19247
19142
|
* @category Command
|
|
19248
|
-
* @returns {Function} Command function
|
|
19249
19143
|
* @example
|
|
19250
|
-
* insertLineBreak()
|
|
19144
|
+
* editor.commands.insertLineBreak()
|
|
19251
19145
|
* @note Creates a soft break within the same paragraph
|
|
19252
19146
|
*/
|
|
19253
19147
|
insertLineBreak: () => ({ commands: commands2 }) => {
|
|
@@ -19264,11 +19158,6 @@ const HardBreak = Node$1.create({
|
|
|
19264
19158
|
atom: true,
|
|
19265
19159
|
addOptions() {
|
|
19266
19160
|
return {
|
|
19267
|
-
/**
|
|
19268
|
-
* @typedef {Object} HardBreakOptions
|
|
19269
|
-
* @category Options
|
|
19270
|
-
* @property {Object} [htmlAttributes] - HTML attributes for the break element
|
|
19271
|
-
*/
|
|
19272
19161
|
htmlAttributes: {
|
|
19273
19162
|
contentEditable: "false",
|
|
19274
19163
|
lineBreakType: "page",
|
|
@@ -19279,35 +19168,15 @@ const HardBreak = Node$1.create({
|
|
|
19279
19168
|
},
|
|
19280
19169
|
addAttributes() {
|
|
19281
19170
|
return {
|
|
19282
|
-
/**
|
|
19283
|
-
* @private
|
|
19284
|
-
* @category Attribute
|
|
19285
|
-
* @param {string} [pageBreakSource] - Source of the page break
|
|
19286
|
-
*/
|
|
19287
19171
|
pageBreakSource: {
|
|
19288
19172
|
rendered: false,
|
|
19289
19173
|
default: null
|
|
19290
19174
|
},
|
|
19291
|
-
/**
|
|
19292
|
-
* @private
|
|
19293
|
-
* @category Attribute
|
|
19294
|
-
* @param {string} [pageBreakType] - Type of page break
|
|
19295
|
-
*/
|
|
19296
19175
|
pageBreakType: {
|
|
19297
19176
|
default: null,
|
|
19298
19177
|
rendered: false
|
|
19299
19178
|
},
|
|
19300
|
-
/**
|
|
19301
|
-
* @private
|
|
19302
|
-
* @category Attribute
|
|
19303
|
-
* @param {string} [lineBreakType] - Type of line break - passthrough in this node
|
|
19304
|
-
*/
|
|
19305
19179
|
lineBreakType: { rendered: false },
|
|
19306
|
-
/**
|
|
19307
|
-
* @private
|
|
19308
|
-
* @category Attribute
|
|
19309
|
-
* @param {string} [clear] - Clear attribute - passthrough in this node
|
|
19310
|
-
*/
|
|
19311
19180
|
clear: { rendered: false }
|
|
19312
19181
|
};
|
|
19313
19182
|
},
|
|
@@ -19333,9 +19202,8 @@ const HardBreak = Node$1.create({
|
|
|
19333
19202
|
/**
|
|
19334
19203
|
* Insert a page break
|
|
19335
19204
|
* @category Command
|
|
19336
|
-
* @returns {Function} Command function
|
|
19337
19205
|
* @example
|
|
19338
|
-
* insertPageBreak()
|
|
19206
|
+
* editor.commands.insertPageBreak()
|
|
19339
19207
|
* @note Forces content to start on a new page when printed
|
|
19340
19208
|
*/
|
|
19341
19209
|
insertPageBreak: () => ({ commands: commands2 }) => {
|
|
@@ -21725,17 +21593,6 @@ const Table = Node$1.create({
|
|
|
21725
21593
|
group: "block",
|
|
21726
21594
|
isolating: true,
|
|
21727
21595
|
tableRole: "table",
|
|
21728
|
-
/**
|
|
21729
|
-
* Table extension options
|
|
21730
|
-
* @category Options
|
|
21731
|
-
* @typedef {Object} TableOptions
|
|
21732
|
-
* @property {Object} [htmlAttributes={'aria-label': 'Table node'}] - Default HTML attributes for all tables
|
|
21733
|
-
* @property {boolean} [resizable=true] - Enable column resizing functionality
|
|
21734
|
-
* @property {number} [handleWidth=5] - Width of resize handles in pixels
|
|
21735
|
-
* @property {number} [cellMinWidth=10] - Minimum cell width constraint in pixels
|
|
21736
|
-
* @property {boolean} [lastColumnResizable=true] - Allow resizing of the last column
|
|
21737
|
-
* @property {boolean} [allowTableNodeSelection=false] - Enable selecting the entire table node
|
|
21738
|
-
*/
|
|
21739
21596
|
addOptions() {
|
|
21740
21597
|
return {
|
|
21741
21598
|
htmlAttributes: {
|
|
@@ -21893,14 +21750,9 @@ const Table = Node$1.create({
|
|
|
21893
21750
|
* Insert a new table into the document
|
|
21894
21751
|
* @category Command
|
|
21895
21752
|
* @param {TableConfig} [config] - Table configuration options
|
|
21896
|
-
* @returns {Function} Command
|
|
21897
21753
|
* @example
|
|
21898
|
-
*
|
|
21899
|
-
* insertTable(
|
|
21900
|
-
*
|
|
21901
|
-
* // Using custom values
|
|
21902
|
-
* insertTable({ rows: 3, cols: 3, withHeaderRow: true })
|
|
21903
|
-
*
|
|
21754
|
+
* editor.commands.insertTable()
|
|
21755
|
+
* editor.commands.insertTable({ rows: 3, cols: 3, withHeaderRow: true })
|
|
21904
21756
|
*/
|
|
21905
21757
|
insertTable: ({ rows = 3, cols = 3, withHeaderRow = false } = {}) => ({ tr, dispatch, editor }) => {
|
|
21906
21758
|
const node = createTable(editor.schema, rows, cols, withHeaderRow);
|
|
@@ -21913,9 +21765,8 @@ const Table = Node$1.create({
|
|
|
21913
21765
|
/**
|
|
21914
21766
|
* Delete the entire table containing the cursor
|
|
21915
21767
|
* @category Command
|
|
21916
|
-
* @returns {Function} Command
|
|
21917
21768
|
* @example
|
|
21918
|
-
* deleteTable()
|
|
21769
|
+
* editor.commands.deleteTable()
|
|
21919
21770
|
*/
|
|
21920
21771
|
deleteTable: () => ({ state, dispatch }) => {
|
|
21921
21772
|
return deleteTable(state, dispatch);
|
|
@@ -21923,9 +21774,8 @@ const Table = Node$1.create({
|
|
|
21923
21774
|
/**
|
|
21924
21775
|
* Add a column before the current column
|
|
21925
21776
|
* @category Command
|
|
21926
|
-
* @returns {Function} Command
|
|
21927
21777
|
* @example
|
|
21928
|
-
* addColumnBefore()
|
|
21778
|
+
* editor.commands.addColumnBefore()
|
|
21929
21779
|
* @note Preserves cell attributes from current column
|
|
21930
21780
|
*/
|
|
21931
21781
|
addColumnBefore: () => ({ state, dispatch, chain }) => {
|
|
@@ -22302,10 +22152,9 @@ const Table = Node$1.create({
|
|
|
22302
22152
|
* Set background color for selected cells
|
|
22303
22153
|
* @category Command
|
|
22304
22154
|
* @param {string} value - Color value (hex with or without #)
|
|
22305
|
-
* @returns {Function} Command
|
|
22306
22155
|
* @example
|
|
22307
|
-
* setCellBackground('#ff0000')
|
|
22308
|
-
* setCellBackground('ff0000')
|
|
22156
|
+
* editor.commands.setCellBackground('#ff0000')
|
|
22157
|
+
* editor.commands.setCellBackground('ff0000')
|
|
22309
22158
|
*/
|
|
22310
22159
|
setCellBackground: (value) => ({ editor, commands: commands2, dispatch }) => {
|
|
22311
22160
|
const { selection } = editor.state;
|
|
@@ -22431,24 +22280,12 @@ const TableHeader = Node$1.create({
|
|
|
22431
22280
|
},
|
|
22432
22281
|
addAttributes() {
|
|
22433
22282
|
return {
|
|
22434
|
-
/**
|
|
22435
|
-
* @category Attribute
|
|
22436
|
-
* @param {number} [colspan=1] - Number of columns this header spans
|
|
22437
|
-
*/
|
|
22438
22283
|
colspan: {
|
|
22439
22284
|
default: 1
|
|
22440
22285
|
},
|
|
22441
|
-
/**
|
|
22442
|
-
* @category Attribute
|
|
22443
|
-
* @param {number} [rowspan=1] - Number of rows this header spans
|
|
22444
|
-
*/
|
|
22445
22286
|
rowspan: {
|
|
22446
22287
|
default: 1
|
|
22447
22288
|
},
|
|
22448
|
-
/**
|
|
22449
|
-
* @category Attribute
|
|
22450
|
-
* @param {number[]} [colwidth] - Column widths array in pixels
|
|
22451
|
-
*/
|
|
22452
22289
|
colwidth: {
|
|
22453
22290
|
default: null,
|
|
22454
22291
|
parseDOM: (element) => {
|
|
@@ -22485,10 +22322,6 @@ const TableRow = Node$1.create({
|
|
|
22485
22322
|
},
|
|
22486
22323
|
addAttributes() {
|
|
22487
22324
|
return {
|
|
22488
|
-
/**
|
|
22489
|
-
* @category Attribute
|
|
22490
|
-
* @param {number} [rowHeight] - Fixed row height in pixels
|
|
22491
|
-
*/
|
|
22492
22325
|
rowHeight: {
|
|
22493
22326
|
renderDOM({ rowHeight }) {
|
|
22494
22327
|
if (!rowHeight) return {};
|
|
@@ -22496,11 +22329,6 @@ const TableRow = Node$1.create({
|
|
|
22496
22329
|
return { style };
|
|
22497
22330
|
}
|
|
22498
22331
|
},
|
|
22499
|
-
/**
|
|
22500
|
-
* Indicates that this row should not be split across pages when paginating/exporting.
|
|
22501
|
-
* @category Attribute
|
|
22502
|
-
* @param {boolean} [cantSplit]
|
|
22503
|
-
*/
|
|
22504
22332
|
cantSplit: {
|
|
22505
22333
|
default: false,
|
|
22506
22334
|
parseDOM() {
|
|
@@ -22512,44 +22340,30 @@ const TableRow = Node$1.create({
|
|
|
22512
22340
|
}
|
|
22513
22341
|
},
|
|
22514
22342
|
/**
|
|
22515
|
-
* @category Attribute
|
|
22516
|
-
* @param {TableRowProperties} [tableRowProperties] - Properties for the table row.
|
|
22517
22343
|
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 377-482
|
|
22518
22344
|
*/
|
|
22519
22345
|
tableRowProperties: { rendered: false },
|
|
22520
22346
|
/**
|
|
22521
|
-
* @category Attribute
|
|
22522
|
-
* @param {string} [rsidDel] - Unique identifier used to track the editing session when the row was deleted from the main document.
|
|
22523
22347
|
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 472
|
|
22524
22348
|
*/
|
|
22525
22349
|
rsidDel: { rendered: false },
|
|
22526
22350
|
/**
|
|
22527
|
-
* @category Attribute
|
|
22528
|
-
* @param {string} [rsidR] - Unique identifier used to track the editing session when the table row was added to the main document.
|
|
22529
22351
|
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 472
|
|
22530
22352
|
*/
|
|
22531
22353
|
rsidR: { rendered: false },
|
|
22532
22354
|
/**
|
|
22533
|
-
* @category Attribute
|
|
22534
|
-
* @param {string} [rsidRPr] - Unique identifier used to track the editing session when the glyph character representing the table row mark was last modified in the main document.
|
|
22535
22355
|
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 473
|
|
22536
22356
|
*/
|
|
22537
22357
|
rsidRPr: { rendered: false },
|
|
22538
22358
|
/**
|
|
22539
|
-
* @category Attribute
|
|
22540
|
-
* @param {string} [rsidTr] - Unique identifier used to track the editing session when the table row's properties were last modified in this document.
|
|
22541
22359
|
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 473
|
|
22542
22360
|
*/
|
|
22543
22361
|
rsidTr: { rendered: false },
|
|
22544
22362
|
/**
|
|
22545
|
-
* @category Attribute
|
|
22546
|
-
* @param {string} [paraId] - A randomly generated unique identifier for the table row.
|
|
22547
22363
|
* @see {@link https://learn.microsoft.com/en-us/openspecs/office_standards/ms-docx/a0e7d2e2-2246-44c6-96e8-1cf009823615}
|
|
22548
22364
|
*/
|
|
22549
22365
|
paraId: { rendered: false },
|
|
22550
22366
|
/**
|
|
22551
|
-
* @category Attribute
|
|
22552
|
-
* @param {string} [textId] - A randomly generated unique identifier for the text of the table row.
|
|
22553
22367
|
* @see {@link https://learn.microsoft.com/en-us/openspecs/office_standards/ms-docx/b7eeddec-7c50-47fb-88b6-1feec3ed832c}
|
|
22554
22368
|
*/
|
|
22555
22369
|
textId: { rendered: false }
|
|
@@ -22576,24 +22390,12 @@ const TableCell = Node$1.create({
|
|
|
22576
22390
|
},
|
|
22577
22391
|
addAttributes() {
|
|
22578
22392
|
return {
|
|
22579
|
-
/**
|
|
22580
|
-
* @category Attribute
|
|
22581
|
-
* @param {number} [colspan=1] - Number of columns this cell spans
|
|
22582
|
-
*/
|
|
22583
22393
|
colspan: {
|
|
22584
22394
|
default: 1
|
|
22585
22395
|
},
|
|
22586
|
-
/**
|
|
22587
|
-
* @category Attribute
|
|
22588
|
-
* @param {number} [rowspan=1] - Number of rows this cell spans
|
|
22589
|
-
*/
|
|
22590
22396
|
rowspan: {
|
|
22591
22397
|
default: 1
|
|
22592
22398
|
},
|
|
22593
|
-
/**
|
|
22594
|
-
* @category Attribute
|
|
22595
|
-
* @param {number[]} [colwidth=[100]] - Column widths array in pixels
|
|
22596
|
-
*/
|
|
22597
22399
|
colwidth: {
|
|
22598
22400
|
default: [100],
|
|
22599
22401
|
parseDOM: (elem) => {
|
|
@@ -22608,10 +22410,6 @@ const TableCell = Node$1.create({
|
|
|
22608
22410
|
};
|
|
22609
22411
|
}
|
|
22610
22412
|
},
|
|
22611
|
-
/**
|
|
22612
|
-
* @category Attribute
|
|
22613
|
-
* @param {CellBackground} [background] - Cell background color configuration
|
|
22614
|
-
*/
|
|
22615
22413
|
background: {
|
|
22616
22414
|
renderDOM({ background }) {
|
|
22617
22415
|
if (!background) return {};
|
|
@@ -22620,10 +22418,6 @@ const TableCell = Node$1.create({
|
|
|
22620
22418
|
return { style };
|
|
22621
22419
|
}
|
|
22622
22420
|
},
|
|
22623
|
-
/**
|
|
22624
|
-
* @category Attribute
|
|
22625
|
-
* @param {string} [verticalAlign] - Vertical content alignment (top, middle, bottom)
|
|
22626
|
-
*/
|
|
22627
22421
|
verticalAlign: {
|
|
22628
22422
|
renderDOM({ verticalAlign }) {
|
|
22629
22423
|
if (!verticalAlign) return {};
|
|
@@ -22631,10 +22425,6 @@ const TableCell = Node$1.create({
|
|
|
22631
22425
|
return { style };
|
|
22632
22426
|
}
|
|
22633
22427
|
},
|
|
22634
|
-
/**
|
|
22635
|
-
* @category Attribute
|
|
22636
|
-
* @param {CellMargins} [cellMargins] - Internal cell padding
|
|
22637
|
-
*/
|
|
22638
22428
|
cellMargins: {
|
|
22639
22429
|
renderDOM({ cellMargins }) {
|
|
22640
22430
|
if (!cellMargins) return {};
|
|
@@ -22647,10 +22437,6 @@ const TableCell = Node$1.create({
|
|
|
22647
22437
|
return { style };
|
|
22648
22438
|
}
|
|
22649
22439
|
},
|
|
22650
|
-
/**
|
|
22651
|
-
* @category Attribute
|
|
22652
|
-
* @param {CellBorders} [borders] - Cell border configuration
|
|
22653
|
-
*/
|
|
22654
22440
|
borders: {
|
|
22655
22441
|
default: () => createCellBorders(),
|
|
22656
22442
|
renderDOM({ borders }) {
|
|
@@ -22665,20 +22451,10 @@ const TableCell = Node$1.create({
|
|
|
22665
22451
|
return { style };
|
|
22666
22452
|
}
|
|
22667
22453
|
},
|
|
22668
|
-
/**
|
|
22669
|
-
* @private
|
|
22670
|
-
* @category Attribute
|
|
22671
|
-
* @param {string} [widthType='auto'] - Internal width type
|
|
22672
|
-
*/
|
|
22673
22454
|
widthType: {
|
|
22674
22455
|
default: "auto",
|
|
22675
22456
|
rendered: false
|
|
22676
22457
|
},
|
|
22677
|
-
/**
|
|
22678
|
-
* @private
|
|
22679
|
-
* @category Attribute
|
|
22680
|
-
* @param {string} [widthUnit='px'] - Internal width unit
|
|
22681
|
-
*/
|
|
22682
22458
|
widthUnit: {
|
|
22683
22459
|
default: "px",
|
|
22684
22460
|
rendered: false
|
|
@@ -24881,6 +24657,19 @@ const findPreviousDomNodeWithClass = (view, pos, className) => {
|
|
|
24881
24657
|
}
|
|
24882
24658
|
return null;
|
|
24883
24659
|
};
|
|
24660
|
+
const getRotationMargins = (w, h, angleDegrees) => {
|
|
24661
|
+
const rad = angleDegrees * (Math.PI / 180);
|
|
24662
|
+
const cos = Math.abs(Math.cos(rad));
|
|
24663
|
+
const sin = Math.abs(Math.sin(rad));
|
|
24664
|
+
const boundingWidth = w * cos + h * sin;
|
|
24665
|
+
const boundingHeight = w * sin + h * cos;
|
|
24666
|
+
const marginLeftRight = Math.round(Math.max(0, (boundingWidth - w) / 2));
|
|
24667
|
+
const marginTopBottom = Math.round(Math.max(0, (boundingHeight - h) / 2));
|
|
24668
|
+
return {
|
|
24669
|
+
horizontal: marginLeftRight,
|
|
24670
|
+
vertical: marginTopBottom
|
|
24671
|
+
};
|
|
24672
|
+
};
|
|
24884
24673
|
const Image = Node$1.create({
|
|
24885
24674
|
name: "image",
|
|
24886
24675
|
group: "inline",
|
|
@@ -24902,10 +24691,6 @@ const Image = Node$1.create({
|
|
|
24902
24691
|
},
|
|
24903
24692
|
addAttributes() {
|
|
24904
24693
|
return {
|
|
24905
|
-
/**
|
|
24906
|
-
* @category Attribute
|
|
24907
|
-
* @param {string} [src] - Image source URL or path
|
|
24908
|
-
*/
|
|
24909
24694
|
src: {
|
|
24910
24695
|
default: null,
|
|
24911
24696
|
renderDOM: ({ src }) => {
|
|
@@ -24914,95 +24699,75 @@ const Image = Node$1.create({
|
|
|
24914
24699
|
};
|
|
24915
24700
|
}
|
|
24916
24701
|
},
|
|
24917
|
-
/**
|
|
24918
|
-
* @category Attribute
|
|
24919
|
-
* @param {string} [alt='Uploaded picture'] - Alternative text for accessibility
|
|
24920
|
-
*/
|
|
24921
24702
|
alt: {
|
|
24922
24703
|
default: "Uploaded picture"
|
|
24923
24704
|
},
|
|
24924
|
-
/**
|
|
24925
|
-
* @category Attribute
|
|
24926
|
-
* @param {string} [id] - Image element ID
|
|
24927
|
-
* @private
|
|
24928
|
-
*/
|
|
24929
24705
|
id: { rendered: false },
|
|
24930
|
-
/**
|
|
24931
|
-
* @category Attribute
|
|
24932
|
-
* @param {string} [title] - Image title/tooltip text
|
|
24933
|
-
*/
|
|
24934
24706
|
title: {
|
|
24935
24707
|
default: null
|
|
24936
24708
|
},
|
|
24937
|
-
/**
|
|
24938
|
-
* @category Attribute
|
|
24939
|
-
* @param {string} [rId] - Relationship ID for Word export
|
|
24940
|
-
* @private
|
|
24941
|
-
*/
|
|
24942
24709
|
rId: {
|
|
24943
24710
|
default: null,
|
|
24944
24711
|
rendered: false
|
|
24945
24712
|
},
|
|
24946
|
-
/**
|
|
24947
|
-
* @category Attribute
|
|
24948
|
-
* @param {Object} [originalPadding] - Original padding values from Word import
|
|
24949
|
-
* @private
|
|
24950
|
-
*/
|
|
24951
24713
|
originalPadding: {
|
|
24952
24714
|
default: null,
|
|
24953
24715
|
rendered: false
|
|
24954
24716
|
},
|
|
24955
|
-
/**
|
|
24956
|
-
* @category Attribute
|
|
24957
|
-
* @param {Object} [originalAttributes] - Original attributes from Word import
|
|
24958
|
-
* @private
|
|
24959
|
-
*/
|
|
24960
24717
|
originalAttributes: { rendered: false },
|
|
24961
|
-
/**
|
|
24962
|
-
* @category Attribute
|
|
24963
|
-
* @param {boolean} [wrapTopAndBottom] - Wrap text above and below image
|
|
24964
|
-
* @private
|
|
24965
|
-
*/
|
|
24966
24718
|
wrapTopAndBottom: { rendered: false },
|
|
24967
|
-
/**
|
|
24968
|
-
* @category Attribute
|
|
24969
|
-
* @param {Object} [anchorData] - Anchor positioning data for Word
|
|
24970
|
-
* @private
|
|
24971
|
-
*/
|
|
24972
24719
|
anchorData: {
|
|
24973
24720
|
default: null,
|
|
24974
24721
|
rendered: false
|
|
24975
24722
|
},
|
|
24723
|
+
isAnchor: { rendered: false },
|
|
24976
24724
|
/**
|
|
24977
24725
|
* @category Attribute
|
|
24978
|
-
* @param {
|
|
24726
|
+
* @param {Object} [transformData] - Transform data for image (turn and flip)
|
|
24727
|
+
* @param {number} [transformData.rotation] - Turn angle in degrees
|
|
24728
|
+
* @param {boolean} [transformData.verticalFlip] - Whether to flip vertically
|
|
24729
|
+
* @param {boolean} [transformData.horizontalFlip] - Whether to flip horizontally
|
|
24730
|
+
* @param {Object} [transformData.sizeExtension] - Size extension for image due to transformation
|
|
24731
|
+
* @param {number} [transformData.sizeExtension.left] - Left size extension for image
|
|
24732
|
+
* @param {number} [transformData.sizeExtension.top] - Top size extension for image
|
|
24733
|
+
* @param {number} [transformData.sizeExtension.right] - Right size extension for image
|
|
24734
|
+
* @param {number} [transformData.sizeExtension.bottom] - Bottom size extension for image
|
|
24735
|
+
*
|
|
24979
24736
|
* @private
|
|
24980
24737
|
*/
|
|
24981
|
-
|
|
24738
|
+
transformData: {
|
|
24739
|
+
default: {},
|
|
24740
|
+
renderDOM: ({ transformData }) => {
|
|
24741
|
+
let style = "";
|
|
24742
|
+
if (transformData?.rotation) {
|
|
24743
|
+
style += `rotate(${Math.round(transformData.rotation)}deg) `;
|
|
24744
|
+
}
|
|
24745
|
+
if (transformData?.verticalFlip) {
|
|
24746
|
+
style += "scaleY(-1) ";
|
|
24747
|
+
}
|
|
24748
|
+
if (transformData?.horizontalFlip) {
|
|
24749
|
+
style += "scaleX(-1) ";
|
|
24750
|
+
}
|
|
24751
|
+
style = style.trim();
|
|
24752
|
+
if (style.length > 0) {
|
|
24753
|
+
return { style: `transform: ${style};` };
|
|
24754
|
+
}
|
|
24755
|
+
return;
|
|
24756
|
+
}
|
|
24757
|
+
},
|
|
24982
24758
|
/**
|
|
24983
24759
|
* @category Attribute
|
|
24984
24760
|
* @param {boolean} [simplePos] - Simple positioning flag
|
|
24985
24761
|
* @private
|
|
24986
24762
|
*/
|
|
24987
24763
|
simplePos: { rendered: false },
|
|
24988
|
-
/**
|
|
24989
|
-
* @category Attribute
|
|
24990
|
-
* @param {string} [wrapText] - Text wrapping style
|
|
24991
|
-
* @private
|
|
24992
|
-
*/
|
|
24993
24764
|
wrapText: { rendered: false },
|
|
24994
24765
|
extension: { rendered: false },
|
|
24995
|
-
/**
|
|
24996
|
-
* @category Attribute
|
|
24997
|
-
* @param {Object} [size] - Image dimensions
|
|
24998
|
-
* @param {number} [size.width] - Width in pixels
|
|
24999
|
-
* @param {number} [size.height] - Height in pixels
|
|
25000
|
-
*/
|
|
25001
24766
|
size: {
|
|
25002
24767
|
default: {},
|
|
25003
24768
|
renderDOM: ({ size, extension }) => {
|
|
25004
24769
|
let style = "";
|
|
25005
|
-
|
|
24770
|
+
let { width, height } = size ?? {};
|
|
25006
24771
|
if (width) style += `width: ${width}px;`;
|
|
25007
24772
|
if (height && ["emf", "wmf"].includes(extension))
|
|
25008
24773
|
style += `height: ${height}px; border: 1px solid black; position: absolute;`;
|
|
@@ -25010,51 +24775,58 @@ const Image = Node$1.create({
|
|
|
25010
24775
|
return { style };
|
|
25011
24776
|
}
|
|
25012
24777
|
},
|
|
25013
|
-
/**
|
|
25014
|
-
* @category Attribute
|
|
25015
|
-
* @param {Object} [padding] - Image padding/margins
|
|
25016
|
-
* @param {number} [padding.left] - Left padding in pixels
|
|
25017
|
-
* @param {number} [padding.top] - Top padding in pixels
|
|
25018
|
-
* @param {number} [padding.bottom] - Bottom padding in pixels
|
|
25019
|
-
* @param {number} [padding.right] - Right padding in pixels
|
|
25020
|
-
*/
|
|
25021
24778
|
padding: {
|
|
25022
24779
|
default: {},
|
|
25023
|
-
renderDOM: ({ padding, marginOffset }) => {
|
|
25024
|
-
|
|
24780
|
+
renderDOM: ({ size = {}, padding, marginOffset, transformData }) => {
|
|
24781
|
+
let { left: left2 = 0, top: top2 = 0, bottom: bottom2 = 0, right: right2 = 0 } = padding ?? {};
|
|
24782
|
+
const { rotation } = transformData ?? {};
|
|
24783
|
+
const { height, width } = size ?? {};
|
|
24784
|
+
if (rotation && height && width) {
|
|
24785
|
+
const { horizontal, vertical } = getRotationMargins(width, height, rotation);
|
|
24786
|
+
left2 += horizontal;
|
|
24787
|
+
right2 += horizontal;
|
|
24788
|
+
top2 += vertical;
|
|
24789
|
+
bottom2 += vertical;
|
|
24790
|
+
}
|
|
25025
24791
|
let style = "";
|
|
25026
|
-
if (left2 &&
|
|
25027
|
-
if (top2 &&
|
|
24792
|
+
if (left2 && marginOffset?.left == null) style += `margin-left: ${left2}px;`;
|
|
24793
|
+
if (top2 && marginOffset?.top == null) style += `margin-top: ${top2}px;`;
|
|
25028
24794
|
if (bottom2) style += `margin-bottom: ${bottom2}px;`;
|
|
25029
24795
|
if (right2) style += `margin-right: ${right2}px;`;
|
|
25030
24796
|
return { style };
|
|
25031
24797
|
}
|
|
25032
24798
|
},
|
|
25033
|
-
/**
|
|
25034
|
-
* @category Attribute
|
|
25035
|
-
* @param {Object} [marginOffset] - Margin offset for anchored images
|
|
25036
|
-
* @param {number} [marginOffset.left] - Left margin offset
|
|
25037
|
-
* @param {number} [marginOffset.top] - Top margin offset
|
|
25038
|
-
*/
|
|
25039
24799
|
marginOffset: {
|
|
25040
24800
|
default: {},
|
|
25041
|
-
renderDOM: ({ marginOffset, anchorData }) => {
|
|
24801
|
+
renderDOM: ({ marginOffset, anchorData, transformData, size }) => {
|
|
24802
|
+
const hasAnchorData = Boolean(anchorData);
|
|
24803
|
+
const hasMarginOffsets = marginOffset?.left != null || marginOffset?.top != null;
|
|
24804
|
+
if (!hasAnchorData && !hasMarginOffsets) return {};
|
|
25042
24805
|
const relativeFromPageV = anchorData?.vRelativeFrom === "page";
|
|
25043
24806
|
const maxMarginV = 500;
|
|
25044
|
-
const
|
|
24807
|
+
const baseLeft = marginOffset?.left ?? 0;
|
|
24808
|
+
const baseTop = marginOffset?.top ?? 0;
|
|
24809
|
+
let rotationLeft = 0;
|
|
24810
|
+
let rotationTop = 0;
|
|
24811
|
+
const { rotation } = transformData ?? {};
|
|
24812
|
+
const { height, width } = size ?? {};
|
|
24813
|
+
if (rotation && height && width) {
|
|
24814
|
+
const { horizontal, vertical } = getRotationMargins(width, height, rotation);
|
|
24815
|
+
rotationLeft = horizontal;
|
|
24816
|
+
rotationTop = vertical;
|
|
24817
|
+
}
|
|
24818
|
+
const left2 = baseLeft + rotationLeft;
|
|
24819
|
+
const top2 = baseTop + rotationTop;
|
|
25045
24820
|
let style = "";
|
|
25046
24821
|
if (left2) style += `margin-left: ${left2}px;`;
|
|
25047
24822
|
if (top2) {
|
|
25048
24823
|
if (relativeFromPageV && top2 >= maxMarginV) style += `margin-top: ${maxMarginV}px;`;
|
|
25049
24824
|
else style += `margin-top: ${top2}px;`;
|
|
25050
24825
|
}
|
|
24826
|
+
if (!style) return {};
|
|
25051
24827
|
return { style };
|
|
25052
24828
|
}
|
|
25053
24829
|
},
|
|
25054
|
-
/**
|
|
25055
|
-
* @category Attribute
|
|
25056
|
-
* @param {string} [style] - Custom inline CSS styles
|
|
25057
|
-
*/
|
|
25058
24830
|
style: {
|
|
25059
24831
|
default: null,
|
|
25060
24832
|
rendered: true,
|
|
@@ -25080,18 +24852,10 @@ const Image = Node$1.create({
|
|
|
25080
24852
|
/**
|
|
25081
24853
|
* Insert an image at the current position
|
|
25082
24854
|
* @category Command
|
|
25083
|
-
* @param {
|
|
25084
|
-
* @param {string} options.src - Image source URL or data URI
|
|
25085
|
-
* @param {string} [options.alt] - Alternative text
|
|
25086
|
-
* @param {string} [options.title] - Image title
|
|
25087
|
-
* @param {Object} [options.size] - Image dimensions
|
|
25088
|
-
* @returns {Function} Command function
|
|
24855
|
+
* @param {ImageInsertOptions} options - Image insertion options
|
|
25089
24856
|
* @example
|
|
25090
|
-
*
|
|
25091
|
-
* setImage({
|
|
25092
|
-
*
|
|
25093
|
-
* // Insert a base64 encoded image
|
|
25094
|
-
* setImage({
|
|
24857
|
+
* editor.commands.setImage({ src: 'https://example.com/image.jpg' })
|
|
24858
|
+
* editor.commands.setImage({
|
|
25095
24859
|
* src: 'data:image/png;base64,...',
|
|
25096
24860
|
* alt: 'Company logo',
|
|
25097
24861
|
* size: { width: 200 }
|
|
@@ -25308,6 +25072,14 @@ const PageNumber = Node$1.create({
|
|
|
25308
25072
|
},
|
|
25309
25073
|
addCommands() {
|
|
25310
25074
|
return {
|
|
25075
|
+
/**
|
|
25076
|
+
* Insert an automatic page number
|
|
25077
|
+
* @category Command
|
|
25078
|
+
* @returns {Function} Command function
|
|
25079
|
+
* @example
|
|
25080
|
+
* editor.commands.addAutoPageNumber()
|
|
25081
|
+
* @note Only works in header/footer contexts
|
|
25082
|
+
*/
|
|
25311
25083
|
addAutoPageNumber: () => ({ tr, dispatch, state, editor }) => {
|
|
25312
25084
|
const { options } = editor;
|
|
25313
25085
|
if (!options.isHeaderOrFooter) return false;
|
|
@@ -25370,6 +25142,14 @@ const TotalPageCount = Node$1.create({
|
|
|
25370
25142
|
},
|
|
25371
25143
|
addCommands() {
|
|
25372
25144
|
return {
|
|
25145
|
+
/**
|
|
25146
|
+
* Insert total page count
|
|
25147
|
+
* @category Command
|
|
25148
|
+
* @returns {Function} Command function
|
|
25149
|
+
* @example
|
|
25150
|
+
* editor.commands.addTotalPageCount()
|
|
25151
|
+
* @note Only works in header/footer contexts
|
|
25152
|
+
*/
|
|
25373
25153
|
addTotalPageCount: () => ({ tr, dispatch, state, editor }) => {
|
|
25374
25154
|
const { options } = editor;
|
|
25375
25155
|
if (!options.isHeaderOrFooter) return false;
|
|
@@ -25636,11 +25416,6 @@ const ContentBlock = Node$1.create({
|
|
|
25636
25416
|
inline: true,
|
|
25637
25417
|
addOptions() {
|
|
25638
25418
|
return {
|
|
25639
|
-
/**
|
|
25640
|
-
* @typedef {Object} ContentBlockOptions
|
|
25641
|
-
* @category Options
|
|
25642
|
-
* @property {Object} [htmlAttributes] - HTML attributes for the block element
|
|
25643
|
-
*/
|
|
25644
25419
|
htmlAttributes: {
|
|
25645
25420
|
contenteditable: false
|
|
25646
25421
|
}
|
|
@@ -25648,10 +25423,6 @@ const ContentBlock = Node$1.create({
|
|
|
25648
25423
|
},
|
|
25649
25424
|
addAttributes() {
|
|
25650
25425
|
return {
|
|
25651
|
-
/**
|
|
25652
|
-
* @category Attribute
|
|
25653
|
-
* @param {boolean} [horizontalRule=false] - Whether this block is a horizontal rule
|
|
25654
|
-
*/
|
|
25655
25426
|
horizontalRule: {
|
|
25656
25427
|
default: false,
|
|
25657
25428
|
renderDOM: ({ horizontalRule }) => {
|
|
@@ -25659,10 +25430,6 @@ const ContentBlock = Node$1.create({
|
|
|
25659
25430
|
return { "data-horizontal-rule": "true" };
|
|
25660
25431
|
}
|
|
25661
25432
|
},
|
|
25662
|
-
/**
|
|
25663
|
-
* @category Attribute
|
|
25664
|
-
* @param {ContentBlockSize} [size] - Size and position of the content block
|
|
25665
|
-
*/
|
|
25666
25433
|
size: {
|
|
25667
25434
|
default: null,
|
|
25668
25435
|
renderDOM: ({ size }) => {
|
|
@@ -25676,10 +25443,6 @@ const ContentBlock = Node$1.create({
|
|
|
25676
25443
|
return { style };
|
|
25677
25444
|
}
|
|
25678
25445
|
},
|
|
25679
|
-
/**
|
|
25680
|
-
* @category Attribute
|
|
25681
|
-
* @param {string} [background] - Background color for the block
|
|
25682
|
-
*/
|
|
25683
25446
|
background: {
|
|
25684
25447
|
default: null,
|
|
25685
25448
|
renderDOM: (attrs) => {
|
|
@@ -25689,19 +25452,9 @@ const ContentBlock = Node$1.create({
|
|
|
25689
25452
|
};
|
|
25690
25453
|
}
|
|
25691
25454
|
},
|
|
25692
|
-
/**
|
|
25693
|
-
* @private
|
|
25694
|
-
* @category Attribute
|
|
25695
|
-
* @param {Object} [drawingContent] - Internal drawing data
|
|
25696
|
-
*/
|
|
25697
25455
|
drawingContent: {
|
|
25698
25456
|
rendered: false
|
|
25699
25457
|
},
|
|
25700
|
-
/**
|
|
25701
|
-
* @private
|
|
25702
|
-
* @category Attribute
|
|
25703
|
-
* @param {Object} [attributes] - Additional internal attributes
|
|
25704
|
-
*/
|
|
25705
25458
|
attributes: {
|
|
25706
25459
|
rendered: false
|
|
25707
25460
|
}
|
|
@@ -25722,9 +25475,8 @@ const ContentBlock = Node$1.create({
|
|
|
25722
25475
|
/**
|
|
25723
25476
|
* Insert a horizontal rule
|
|
25724
25477
|
* @category Command
|
|
25725
|
-
* @returns {Function} Command function
|
|
25726
25478
|
* @example
|
|
25727
|
-
* insertHorizontalRule()
|
|
25479
|
+
* editor.commands.insertHorizontalRule()
|
|
25728
25480
|
* @note Creates a visual separator between content sections
|
|
25729
25481
|
*/
|
|
25730
25482
|
insertHorizontalRule: () => ({ commands: commands2 }) => {
|
|
@@ -25741,13 +25493,13 @@ const ContentBlock = Node$1.create({
|
|
|
25741
25493
|
* Insert a content block
|
|
25742
25494
|
* @category Command
|
|
25743
25495
|
* @param {ContentBlockConfig} config - Block configuration
|
|
25744
|
-
* @returns {Function} Command function
|
|
25745
25496
|
* @example
|
|
25746
25497
|
* // Insert a spacer block
|
|
25747
|
-
* insertContentBlock({ size: { height: 20 } })
|
|
25498
|
+
* editor.commands.insertContentBlock({ size: { height: 20 } })
|
|
25748
25499
|
*
|
|
25500
|
+
* @example
|
|
25749
25501
|
* // Insert a colored divider
|
|
25750
|
-
* insertContentBlock({
|
|
25502
|
+
* editor.commands.insertContentBlock({
|
|
25751
25503
|
* size: { width: '50%', height: 3 },
|
|
25752
25504
|
* background: '#3b82f6'
|
|
25753
25505
|
* })
|
|
@@ -26275,16 +26027,7 @@ const DocumentSection = Node$1.create({
|
|
|
26275
26027
|
},
|
|
26276
26028
|
addAttributes() {
|
|
26277
26029
|
return {
|
|
26278
|
-
/**
|
|
26279
|
-
* @category Attribute
|
|
26280
|
-
* @param {number} [id] - Unique section identifier
|
|
26281
|
-
*/
|
|
26282
26030
|
id: {},
|
|
26283
|
-
/**
|
|
26284
|
-
* @private
|
|
26285
|
-
* @category Attribute
|
|
26286
|
-
* @param {string} [sdBlockId] - Internal block tracking
|
|
26287
|
-
*/
|
|
26288
26031
|
sdBlockId: {
|
|
26289
26032
|
default: null,
|
|
26290
26033
|
keepOnSplit: false,
|
|
@@ -26293,25 +26036,9 @@ const DocumentSection = Node$1.create({
|
|
|
26293
26036
|
return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
|
|
26294
26037
|
}
|
|
26295
26038
|
},
|
|
26296
|
-
/**
|
|
26297
|
-
* @category Attribute
|
|
26298
|
-
* @param {string} [title] - Section display label
|
|
26299
|
-
*/
|
|
26300
26039
|
title: {},
|
|
26301
|
-
/**
|
|
26302
|
-
* @category Attribute
|
|
26303
|
-
* @param {string} [description] - Section metadata
|
|
26304
|
-
*/
|
|
26305
26040
|
description: {},
|
|
26306
|
-
/**
|
|
26307
|
-
* @category Attribute
|
|
26308
|
-
* @param {string} [sectionType] - Business classification (e.g., 'legal', 'pricing')
|
|
26309
|
-
*/
|
|
26310
26041
|
sectionType: {},
|
|
26311
|
-
/**
|
|
26312
|
-
* @category Attribute
|
|
26313
|
-
* @param {boolean} [isLocked=false] - Lock state preventing edits
|
|
26314
|
-
*/
|
|
26315
26042
|
isLocked: { default: false }
|
|
26316
26043
|
};
|
|
26317
26044
|
},
|
|
@@ -26326,10 +26053,9 @@ const DocumentSection = Node$1.create({
|
|
|
26326
26053
|
* Create a lockable content section
|
|
26327
26054
|
* @category Command
|
|
26328
26055
|
* @param {SectionCreate} [options={}] - Section configuration
|
|
26329
|
-
* @returns {Function} Command - true if created, false if position invalid
|
|
26330
26056
|
* @example
|
|
26331
|
-
* createDocumentSection({
|
|
26332
|
-
* id:
|
|
26057
|
+
* editor.commands.createDocumentSection({
|
|
26058
|
+
* id: 1,
|
|
26333
26059
|
* title: 'Terms & Conditions',
|
|
26334
26060
|
* isLocked: true,
|
|
26335
26061
|
* html: '<p>Legal content...</p>'
|
|
@@ -26410,9 +26136,8 @@ const DocumentSection = Node$1.create({
|
|
|
26410
26136
|
/**
|
|
26411
26137
|
* Remove section wrapper at cursor, preserving its content
|
|
26412
26138
|
* @category Command
|
|
26413
|
-
* @returns {Function} Command - true if removed, false if no section at position
|
|
26414
26139
|
* @example
|
|
26415
|
-
* removeSectionAtSelection()
|
|
26140
|
+
* editor.commands.removeSectionAtSelection()
|
|
26416
26141
|
* @note Content stays in document, only section wrapper is removed
|
|
26417
26142
|
*/
|
|
26418
26143
|
removeSectionAtSelection: () => ({ tr, dispatch }) => {
|
|
@@ -26438,9 +26163,8 @@ const DocumentSection = Node$1.create({
|
|
|
26438
26163
|
* Delete section and all its content
|
|
26439
26164
|
* @category Command
|
|
26440
26165
|
* @param {number} id - Section to delete
|
|
26441
|
-
* @returns {Function} Command - true if deleted, false if ID doesn't exist
|
|
26442
26166
|
* @example
|
|
26443
|
-
* removeSectionById(123)
|
|
26167
|
+
* editor.commands.removeSectionById(123)
|
|
26444
26168
|
*/
|
|
26445
26169
|
removeSectionById: (id) => ({ tr, dispatch }) => {
|
|
26446
26170
|
const sections = SectionHelpers.getAllSections(this.editor);
|
|
@@ -26460,9 +26184,8 @@ const DocumentSection = Node$1.create({
|
|
|
26460
26184
|
* Lock section against edits
|
|
26461
26185
|
* @category Command
|
|
26462
26186
|
* @param {number} id - Section to lock
|
|
26463
|
-
* @returns {Function} Command - true if locked, false if ID doesn't exist
|
|
26464
26187
|
* @example
|
|
26465
|
-
* lockSectionById(123)
|
|
26188
|
+
* editor.commands.lockSectionById(123)
|
|
26466
26189
|
*/
|
|
26467
26190
|
lockSectionById: (id) => ({ tr, dispatch }) => {
|
|
26468
26191
|
const sections = SectionHelpers.getAllSections(this.editor);
|
|
@@ -26479,16 +26202,10 @@ const DocumentSection = Node$1.create({
|
|
|
26479
26202
|
* Modify section attributes or content
|
|
26480
26203
|
* @category Command
|
|
26481
26204
|
* @param {SectionUpdate} options - Changes to apply
|
|
26482
|
-
* @returns {Function} Command - true if updated, false if ID doesn't exist
|
|
26483
26205
|
* @example
|
|
26484
|
-
*
|
|
26485
|
-
* updateSectionById({ id: 123,
|
|
26486
|
-
*
|
|
26487
|
-
* // Replace content
|
|
26488
|
-
* updateSectionById({ id: 123, html: '<p>New content</p>' })
|
|
26489
|
-
*
|
|
26490
|
-
* // Both
|
|
26491
|
-
* updateSectionById({
|
|
26206
|
+
* editor.commands.updateSectionById({ id: 123, attrs: { isLocked: false } })
|
|
26207
|
+
* editor.commands.updateSectionById({ id: 123, html: '<p>New content</p>' })
|
|
26208
|
+
* editor.commands.updateSectionById({
|
|
26492
26209
|
* id: 123,
|
|
26493
26210
|
* html: '<p>Updated</p>',
|
|
26494
26211
|
* attrs: { title: 'New Title' }
|
|
@@ -26538,11 +26255,10 @@ const BlockNode = Extension.create({
|
|
|
26538
26255
|
* Replace a block node by its ID with new content
|
|
26539
26256
|
* @category Command
|
|
26540
26257
|
* @param {string} id - The sdBlockId of the node to replace
|
|
26541
|
-
* @param {
|
|
26542
|
-
* @returns {Function} Command function
|
|
26258
|
+
* @param {ProseMirrorNode} contentNode - The replacement ProseMirror node
|
|
26543
26259
|
* @example
|
|
26544
26260
|
* const newParagraph = editor.schema.nodes.paragraph.create({}, editor.schema.text('New content'))
|
|
26545
|
-
* replaceBlockNodeById('block-123', newParagraph)
|
|
26261
|
+
* editor.commands.replaceBlockNodeById('block-123', newParagraph)
|
|
26546
26262
|
* @note The replacement node should have the same type as the original
|
|
26547
26263
|
*/
|
|
26548
26264
|
replaceBlockNodeById: (id, contentNode) => ({ dispatch, tr }) => {
|
|
@@ -26565,9 +26281,8 @@ const BlockNode = Extension.create({
|
|
|
26565
26281
|
* Delete a block node by its ID
|
|
26566
26282
|
* @category Command
|
|
26567
26283
|
* @param {string} id - The sdBlockId of the node to delete
|
|
26568
|
-
* @returns {Function} Command function
|
|
26569
26284
|
* @example
|
|
26570
|
-
* deleteBlockNodeById('block-123')
|
|
26285
|
+
* editor.commands.deleteBlockNodeById('block-123')
|
|
26571
26286
|
* @note Completely removes the node from the document
|
|
26572
26287
|
*/
|
|
26573
26288
|
deleteBlockNodeById: (id) => ({ dispatch, tr }) => {
|
|
@@ -26591,11 +26306,10 @@ const BlockNode = Extension.create({
|
|
|
26591
26306
|
* @category Command
|
|
26592
26307
|
* @param {string} id - The sdBlockId of the node to update
|
|
26593
26308
|
* @param {Object} attrs - Attributes to update
|
|
26594
|
-
* @returns {Function} Command function
|
|
26595
26309
|
* @example
|
|
26596
|
-
* updateBlockNodeAttributes('block-123', { textAlign: 'center' })
|
|
26310
|
+
* editor.commands.updateBlockNodeAttributes('block-123', { textAlign: 'center' })
|
|
26597
26311
|
* @example
|
|
26598
|
-
* updateBlockNodeAttributes('block-123', { indent: { left: 20 } })
|
|
26312
|
+
* editor.commands.updateBlockNodeAttributes('block-123', { indent: { left: 20 } })
|
|
26599
26313
|
* @note Merges new attributes with existing ones
|
|
26600
26314
|
*/
|
|
26601
26315
|
updateBlockNodeAttributes: (id, attrs = {}) => ({ dispatch, tr }) => {
|
|
@@ -26689,7 +26403,7 @@ const BlockNode = Extension.create({
|
|
|
26689
26403
|
key: BlockNodePluginKey,
|
|
26690
26404
|
appendTransaction: (transactions, _oldState, newState) => {
|
|
26691
26405
|
if (hasInitialized && !transactions.some((tr2) => tr2.docChanged)) return null;
|
|
26692
|
-
if (hasInitialized && !checkForNewBlockNodesInTrs(transactions)) return null;
|
|
26406
|
+
if (hasInitialized && !checkForNewBlockNodesInTrs([...transactions])) return null;
|
|
26693
26407
|
const { tr } = newState;
|
|
26694
26408
|
let changed = false;
|
|
26695
26409
|
newState.doc.descendants((node, pos) => {
|
|
@@ -26768,9 +26482,8 @@ const TextStyle = Mark.create({
|
|
|
26768
26482
|
/**
|
|
26769
26483
|
* Remove empty text style marks
|
|
26770
26484
|
* @category Command
|
|
26771
|
-
* @returns {Function} Command function - Removes mark if no attributes present
|
|
26772
26485
|
* @example
|
|
26773
|
-
* removeEmptyTextStyle()
|
|
26486
|
+
* editor.commands.removeEmptyTextStyle()
|
|
26774
26487
|
* @note Cleanup utility to prevent empty span elements
|
|
26775
26488
|
* @note Automatically checks if any style attributes exist before removal
|
|
26776
26489
|
*/
|
|
@@ -26792,10 +26505,6 @@ const Bold = Mark.create({
|
|
|
26792
26505
|
},
|
|
26793
26506
|
addAttributes() {
|
|
26794
26507
|
return {
|
|
26795
|
-
/**
|
|
26796
|
-
* @category Attribute
|
|
26797
|
-
* @param {string} [value] - Bold weight value ('0' renders as normal)
|
|
26798
|
-
*/
|
|
26799
26508
|
value: {
|
|
26800
26509
|
default: null,
|
|
26801
26510
|
renderDOM: (attrs) => {
|
|
@@ -26824,26 +26533,23 @@ const Bold = Mark.create({
|
|
|
26824
26533
|
/**
|
|
26825
26534
|
* Apply bold formatting
|
|
26826
26535
|
* @category Command
|
|
26827
|
-
* @returns {Function} Command
|
|
26828
26536
|
* @example
|
|
26829
|
-
* setBold()
|
|
26537
|
+
* editor.commands.setBold()
|
|
26830
26538
|
* @note '0' renders as normal weight
|
|
26831
26539
|
*/
|
|
26832
26540
|
setBold: () => ({ commands: commands2 }) => commands2.setMark(this.name),
|
|
26833
26541
|
/**
|
|
26834
26542
|
* Remove bold formatting
|
|
26835
26543
|
* @category Command
|
|
26836
|
-
* @returns {Function} Command
|
|
26837
26544
|
* @example
|
|
26838
|
-
* unsetBold()
|
|
26545
|
+
* editor.commands.unsetBold()
|
|
26839
26546
|
*/
|
|
26840
26547
|
unsetBold: () => ({ commands: commands2 }) => commands2.unsetMark(this.name),
|
|
26841
26548
|
/**
|
|
26842
26549
|
* Toggle bold formatting
|
|
26843
26550
|
* @category Command
|
|
26844
|
-
* @returns {Function} Command
|
|
26845
26551
|
* @example
|
|
26846
|
-
* toggleBold()
|
|
26552
|
+
* editor.commands.toggleBold()
|
|
26847
26553
|
*/
|
|
26848
26554
|
toggleBold: () => ({ commands: commands2 }) => commands2.toggleMark(this.name)
|
|
26849
26555
|
};
|
|
@@ -26878,25 +26584,22 @@ const Italic = Mark.create({
|
|
|
26878
26584
|
/**
|
|
26879
26585
|
* Apply italic formatting
|
|
26880
26586
|
* @category Command
|
|
26881
|
-
* @returns {Function} Command
|
|
26882
26587
|
* @example
|
|
26883
|
-
* setItalic()
|
|
26588
|
+
* editor.commands.setItalic()
|
|
26884
26589
|
*/
|
|
26885
26590
|
setItalic: () => ({ commands: commands2 }) => commands2.setMark(this.name),
|
|
26886
26591
|
/**
|
|
26887
26592
|
* Remove italic formatting
|
|
26888
26593
|
* @category Command
|
|
26889
|
-
* @returns {Function} Command
|
|
26890
26594
|
* @example
|
|
26891
|
-
* unsetItalic()
|
|
26595
|
+
* editor.commands.unsetItalic()
|
|
26892
26596
|
*/
|
|
26893
26597
|
unsetItalic: () => ({ commands: commands2 }) => commands2.unsetMark(this.name),
|
|
26894
26598
|
/**
|
|
26895
26599
|
* Toggle italic formatting
|
|
26896
26600
|
* @category Command
|
|
26897
|
-
* @returns {Function} Command
|
|
26898
26601
|
* @example
|
|
26899
|
-
* toggleItalic()
|
|
26602
|
+
* editor.commands.toggleItalic()
|
|
26900
26603
|
*/
|
|
26901
26604
|
toggleItalic: () => ({ commands: commands2 }) => commands2.toggleMark(this.name)
|
|
26902
26605
|
};
|
|
@@ -26980,10 +26683,6 @@ const Highlight = Mark.create({
|
|
|
26980
26683
|
},
|
|
26981
26684
|
addAttributes() {
|
|
26982
26685
|
return {
|
|
26983
|
-
/**
|
|
26984
|
-
* @category Attribute
|
|
26985
|
-
* @param {string} [color] - Background color (CSS color value)
|
|
26986
|
-
*/
|
|
26987
26686
|
color: {
|
|
26988
26687
|
default: null,
|
|
26989
26688
|
parseDOM: (element) => element.getAttribute("data-color") || element.style.backgroundColor,
|
|
@@ -27011,26 +26710,23 @@ const Highlight = Mark.create({
|
|
|
27011
26710
|
* Apply highlight with specified color
|
|
27012
26711
|
* @category Command
|
|
27013
26712
|
* @param {string} color - CSS color value
|
|
27014
|
-
* @returns {Function} Command
|
|
27015
26713
|
* @example
|
|
27016
|
-
* setHighlight('#FFEB3B')
|
|
27017
|
-
* setHighlight('rgba(255, 235, 59, 0.5)')
|
|
26714
|
+
* editor.commands.setHighlight('#FFEB3B')
|
|
26715
|
+
* editor.commands.setHighlight('rgba(255, 235, 59, 0.5)')
|
|
27018
26716
|
*/
|
|
27019
26717
|
setHighlight: (color) => ({ commands: commands2 }) => commands2.setMark(this.name, { color }),
|
|
27020
26718
|
/**
|
|
27021
26719
|
* Remove highlight formatting
|
|
27022
26720
|
* @category Command
|
|
27023
|
-
* @returns {Function} Command
|
|
27024
26721
|
* @example
|
|
27025
|
-
* unsetHighlight()
|
|
26722
|
+
* editor.commands.unsetHighlight()
|
|
27026
26723
|
*/
|
|
27027
26724
|
unsetHighlight: () => ({ commands: commands2 }) => commands2.unsetMark(this.name),
|
|
27028
26725
|
/**
|
|
27029
26726
|
* Toggle highlight formatting
|
|
27030
26727
|
* @category Command
|
|
27031
|
-
* @returns {Function} Command
|
|
27032
26728
|
* @example
|
|
27033
|
-
* toggleHighlight()
|
|
26729
|
+
* editor.commands.toggleHighlight()
|
|
27034
26730
|
*/
|
|
27035
26731
|
toggleHighlight: () => ({ commands: commands2 }) => commands2.toggleMark(this.name)
|
|
27036
26732
|
};
|
|
@@ -27063,9 +26759,8 @@ const Strike = Mark.create({
|
|
|
27063
26759
|
/**
|
|
27064
26760
|
* Apply strikethrough formatting
|
|
27065
26761
|
* @category Command
|
|
27066
|
-
* @returns {Function} Command
|
|
27067
26762
|
* @example
|
|
27068
|
-
* setStrike()
|
|
26763
|
+
* editor.commands.setStrike()
|
|
27069
26764
|
*/
|
|
27070
26765
|
setStrike: () => ({ commands: commands2 }) => {
|
|
27071
26766
|
return commands2.setMark(this.name);
|
|
@@ -27073,9 +26768,8 @@ const Strike = Mark.create({
|
|
|
27073
26768
|
/**
|
|
27074
26769
|
* Remove strikethrough formatting
|
|
27075
26770
|
* @category Command
|
|
27076
|
-
* @returns {Function} Command
|
|
27077
26771
|
* @example
|
|
27078
|
-
* unsetStrike()
|
|
26772
|
+
* editor.commands.unsetStrike()
|
|
27079
26773
|
*/
|
|
27080
26774
|
unsetStrike: () => ({ commands: commands2 }) => {
|
|
27081
26775
|
return commands2.unsetMark(this.name);
|
|
@@ -27083,9 +26777,8 @@ const Strike = Mark.create({
|
|
|
27083
26777
|
/**
|
|
27084
26778
|
* Toggle strikethrough formatting
|
|
27085
26779
|
* @category Command
|
|
27086
|
-
* @returns {Function} Command
|
|
27087
26780
|
* @example
|
|
27088
|
-
* toggleStrike()
|
|
26781
|
+
* editor.commands.toggleStrike()
|
|
27089
26782
|
*/
|
|
27090
26783
|
toggleStrike: () => ({ commands: commands2 }) => {
|
|
27091
26784
|
return commands2.toggleMark(this.name);
|
|
@@ -27105,11 +26798,6 @@ const Link = Mark.create({
|
|
|
27105
26798
|
inclusive: false,
|
|
27106
26799
|
addOptions() {
|
|
27107
26800
|
return {
|
|
27108
|
-
/**
|
|
27109
|
-
* Allowed URL protocols
|
|
27110
|
-
* @type {string[]}
|
|
27111
|
-
* @default ['http', 'https']
|
|
27112
|
-
*/
|
|
27113
26801
|
protocols: ["http", "https"],
|
|
27114
26802
|
htmlAttributes: {
|
|
27115
26803
|
target: null,
|
|
@@ -27208,16 +26896,10 @@ const Link = Mark.create({
|
|
|
27208
26896
|
/**
|
|
27209
26897
|
* Create or update a link
|
|
27210
26898
|
* @category Command
|
|
27211
|
-
* @param {
|
|
27212
|
-
* @param {string} [options.href] - URL for the link
|
|
27213
|
-
* @param {string} [options.text] - Display text (uses selection if omitted)
|
|
27214
|
-
* @returns {Function} Command - Creates link with underline
|
|
26899
|
+
* @param {SetLinkOptions} [options] - Link configuration
|
|
27215
26900
|
* @example
|
|
27216
|
-
*
|
|
27217
|
-
* setLink({
|
|
27218
|
-
*
|
|
27219
|
-
* // Link with custom text
|
|
27220
|
-
* setLink({
|
|
26901
|
+
* editor.commands.setLink({ href: 'https://example.com' })
|
|
26902
|
+
* editor.commands.setLink({
|
|
27221
26903
|
* href: 'https://example.com',
|
|
27222
26904
|
* text: 'Visit Example'
|
|
27223
26905
|
* })
|
|
@@ -27269,9 +26951,8 @@ const Link = Mark.create({
|
|
|
27269
26951
|
/**
|
|
27270
26952
|
* Remove link and associated formatting
|
|
27271
26953
|
* @category Command
|
|
27272
|
-
* @returns {Function} Command - Removes link, underline, and color
|
|
27273
26954
|
* @example
|
|
27274
|
-
* unsetLink()
|
|
26955
|
+
* editor.commands.unsetLink()
|
|
27275
26956
|
* @note Also removes underline and text color
|
|
27276
26957
|
*/
|
|
27277
26958
|
unsetLink: () => ({ chain }) => {
|
|
@@ -27280,16 +26961,10 @@ const Link = Mark.create({
|
|
|
27280
26961
|
/**
|
|
27281
26962
|
* Toggle link on selection
|
|
27282
26963
|
* @category Command
|
|
27283
|
-
* @param {
|
|
27284
|
-
* @param {string} [options.href] - URL for the link
|
|
27285
|
-
* @param {string} [options.text] - Display text
|
|
27286
|
-
* @returns {Function} Command - Creates link if href provided, removes otherwise
|
|
26964
|
+
* @param {SetLinkOptions} [options] - Link configuration
|
|
27287
26965
|
* @example
|
|
27288
|
-
*
|
|
27289
|
-
* toggleLink(
|
|
27290
|
-
*
|
|
27291
|
-
* // Remove link
|
|
27292
|
-
* toggleLink()
|
|
26966
|
+
* editor.commands.toggleLink({ href: 'https://example.com' })
|
|
26967
|
+
* editor.commands.toggleLink()
|
|
27293
26968
|
*/
|
|
27294
26969
|
toggleLink: ({ href, text } = {}) => ({ commands: commands2 }) => {
|
|
27295
26970
|
if (!href) return commands2.unsetLink();
|
|
@@ -30606,6 +30281,9 @@ const Mentions = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-b
|
|
|
30606
30281
|
const popoverPluginKey = new PluginKey("popoverPlugin");
|
|
30607
30282
|
const PopoverPlugin = Extension.create({
|
|
30608
30283
|
name: "popoverPlugin",
|
|
30284
|
+
addOptions() {
|
|
30285
|
+
return {};
|
|
30286
|
+
},
|
|
30609
30287
|
addPmPlugins() {
|
|
30610
30288
|
const popover = new Plugin({
|
|
30611
30289
|
key: popoverPluginKey,
|
|
@@ -32833,12 +32511,11 @@ const Search = Extension.create({
|
|
|
32833
32511
|
addCommands() {
|
|
32834
32512
|
return {
|
|
32835
32513
|
/**
|
|
32836
|
-
*
|
|
32514
|
+
* Navigate to the first search match
|
|
32837
32515
|
* @category Command
|
|
32838
|
-
* @returns {Function} - Command function
|
|
32839
32516
|
* @example
|
|
32840
|
-
* goToFirstMatch()
|
|
32841
|
-
* @note Scrolls
|
|
32517
|
+
* editor.commands.goToFirstMatch()
|
|
32518
|
+
* @note Scrolls editor to the first match from previous search
|
|
32842
32519
|
*/
|
|
32843
32520
|
goToFirstMatch: () => (
|
|
32844
32521
|
/** @returns {boolean} */
|
|
@@ -32854,13 +32531,13 @@ const Search = Extension.create({
|
|
|
32854
32531
|
}
|
|
32855
32532
|
),
|
|
32856
32533
|
/**
|
|
32857
|
-
*
|
|
32534
|
+
* Search for string matches in editor content
|
|
32858
32535
|
* @category Command
|
|
32859
32536
|
* @param {String|RegExp} patternInput - Search string or pattern
|
|
32860
|
-
* @returns {Function} - Command function that returns matches
|
|
32861
32537
|
* @example
|
|
32862
|
-
* search('test string')
|
|
32863
|
-
*
|
|
32538
|
+
* const matches = editor.commands.search('test string')
|
|
32539
|
+
* const regexMatches = editor.commands.search(/test/i)
|
|
32540
|
+
* @note Returns array of SearchMatch objects with positions and IDs
|
|
32864
32541
|
*/
|
|
32865
32542
|
search: (patternInput) => (
|
|
32866
32543
|
/** @returns {SearchMatch[]} */
|
|
@@ -32903,14 +32580,13 @@ const Search = Extension.create({
|
|
|
32903
32580
|
}
|
|
32904
32581
|
),
|
|
32905
32582
|
/**
|
|
32906
|
-
*
|
|
32583
|
+
* Navigate to a specific search match
|
|
32907
32584
|
* @category Command
|
|
32908
|
-
* @param {SearchMatch} match Match
|
|
32909
|
-
* @returns {Function} - Command function
|
|
32585
|
+
* @param {SearchMatch} match - Match object to navigate to
|
|
32910
32586
|
* @example
|
|
32911
|
-
* const
|
|
32912
|
-
* goToSearchResult(
|
|
32913
|
-
* @note Scrolls
|
|
32587
|
+
* const searchResults = editor.commands.search('test string')
|
|
32588
|
+
* editor.commands.goToSearchResult(searchResults[3])
|
|
32589
|
+
* @note Scrolls to match and selects it
|
|
32914
32590
|
*/
|
|
32915
32591
|
goToSearchResult: (match) => (
|
|
32916
32592
|
/** @returns {boolean} */
|
|
@@ -33172,6 +32848,9 @@ const nodeResizer = (nodeNames = ["image"], editor) => {
|
|
|
33172
32848
|
};
|
|
33173
32849
|
const NodeResizer = Extension.create({
|
|
33174
32850
|
name: "nodeResizer",
|
|
32851
|
+
addOptions() {
|
|
32852
|
+
return {};
|
|
32853
|
+
},
|
|
33175
32854
|
addPmPlugins() {
|
|
33176
32855
|
const isHeadless = this.editor.options.isHeadless;
|
|
33177
32856
|
const hasDocument = typeof document !== "undefined";
|