@crashbytes/contentful-richtext-editor 1.0.6 → 1.0.8
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/components/ContentfulEditor.stories.d.ts +18 -0
- package/dist/components/Toolbar.stories.d.ts +10 -0
- package/dist/index.esm.js +445 -368
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +445 -368
- package/dist/index.js.map +1 -1
- package/dist/testData/samples.d.ts +11 -0
- package/dist/utils/contentfulTransform.stories.d.ts +6 -0
- package/package.json +16 -10
package/dist/index.esm.js
CHANGED
|
@@ -11679,7 +11679,7 @@ function ruleFromNode(dom) {
|
|
|
11679
11679
|
}
|
|
11680
11680
|
return null;
|
|
11681
11681
|
}
|
|
11682
|
-
const isInline
|
|
11682
|
+
const isInline = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;
|
|
11683
11683
|
function readDOMChange(view, from, to, typeOver, addedNodes) {
|
|
11684
11684
|
let compositionID = view.input.compositionPendingChanges || (view.composing ? view.input.compositionID : 0);
|
|
11685
11685
|
view.input.compositionPendingChanges = 0;
|
|
@@ -11724,7 +11724,7 @@ function readDOMChange(view, from, to, typeOver, addedNodes) {
|
|
|
11724
11724
|
if (change)
|
|
11725
11725
|
view.input.domChangeCount++;
|
|
11726
11726
|
if ((ios && view.input.lastIOSEnter > Date.now() - 225 || android) &&
|
|
11727
|
-
addedNodes.some(n => n.nodeType == 1 && !isInline
|
|
11727
|
+
addedNodes.some(n => n.nodeType == 1 && !isInline.test(n.nodeName)) &&
|
|
11728
11728
|
(!change || change.endA >= change.endB) &&
|
|
11729
11729
|
view.someProp("handleKeyDown", f => f(view, keyEvent(13, "Enter")))) {
|
|
11730
11730
|
view.input.lastIOSEnter = 0;
|
|
@@ -26589,289 +26589,350 @@ const ContentfulToolbar = ({ editor, onEmbedEntry, onEmbedAsset, disabledFeature
|
|
|
26589
26589
|
}, autoFocus: true }), jsx("button", { onClick: handleLinkSubmit, children: "\u2713" }), jsx("button", { onClick: () => setShowLinkInput(false), children: "\u2717" })] }))] }))] }), jsx("div", { className: "contentful-toolbar__separator" }), jsxs("div", { className: "contentful-toolbar__group", children: [!isDisabled('lists') && (jsxs(Fragment$1, { children: [jsx("button", { className: `contentful-toolbar__button ${editor.isActive('bulletList') ? 'contentful-toolbar__button--active' : ''}`, onClick: () => editor.chain().focus().toggleBulletList().run(), title: "Bullet List", children: "\u2022 \u2261" }), jsx("button", { className: `contentful-toolbar__button ${editor.isActive('orderedList') ? 'contentful-toolbar__button--active' : ''}`, onClick: () => editor.chain().focus().toggleOrderedList().run(), title: "Numbered List", children: "1. \u2261" })] })), !isDisabled('quote') && (jsx("button", { className: `contentful-toolbar__button ${editor.isActive('blockquote') ? 'contentful-toolbar__button--active' : ''}`, onClick: () => editor.chain().focus().toggleBlockquote().run(), title: "Quote", children: "\"" })), jsx("button", { className: "contentful-toolbar__button", onClick: () => editor.chain().focus().setHorizontalRule().run(), title: "Horizontal Rule", children: "\u2014" }), !isDisabled('table') && (jsx("button", { className: "contentful-toolbar__button", onClick: insertTable, title: "Insert Table", children: "\u229E" }))] }), jsx("div", { className: "contentful-toolbar__separator" }), jsx("div", { className: "contentful-toolbar__group contentful-toolbar__group--right", children: !isDisabled('embed') && (jsxs("div", { className: "contentful-toolbar__embed-dropdown", children: [jsx("button", { className: "contentful-toolbar__embed-button", children: "+ Embed \u25BC" }), jsxs("div", { className: "contentful-toolbar__embed-menu", children: [onEmbedEntry && (jsx("button", { className: "contentful-toolbar__embed-option", onClick: onEmbedEntry, children: "Entry" })), onEmbedAsset && (jsx("button", { className: "contentful-toolbar__embed-option", onClick: onEmbedAsset, children: "Media" }))] })] })) })] }));
|
|
26590
26590
|
};
|
|
26591
26591
|
|
|
26592
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
26593
|
-
|
|
26594
26592
|
var dist = {};
|
|
26595
26593
|
|
|
26596
26594
|
var blocks = {};
|
|
26597
26595
|
|
|
26598
|
-
|
|
26599
|
-
blocks.BLOCKS = void 0;
|
|
26600
|
-
/**
|
|
26601
|
-
* Map of all Contentful block types. Blocks contain inline or block nodes.
|
|
26602
|
-
*/
|
|
26603
|
-
var BLOCKS;
|
|
26604
|
-
(function (BLOCKS) {
|
|
26605
|
-
BLOCKS["DOCUMENT"] = "document";
|
|
26606
|
-
BLOCKS["PARAGRAPH"] = "paragraph";
|
|
26607
|
-
BLOCKS["HEADING_1"] = "heading-1";
|
|
26608
|
-
BLOCKS["HEADING_2"] = "heading-2";
|
|
26609
|
-
BLOCKS["HEADING_3"] = "heading-3";
|
|
26610
|
-
BLOCKS["HEADING_4"] = "heading-4";
|
|
26611
|
-
BLOCKS["HEADING_5"] = "heading-5";
|
|
26612
|
-
BLOCKS["HEADING_6"] = "heading-6";
|
|
26613
|
-
BLOCKS["OL_LIST"] = "ordered-list";
|
|
26614
|
-
BLOCKS["UL_LIST"] = "unordered-list";
|
|
26615
|
-
BLOCKS["LIST_ITEM"] = "list-item";
|
|
26616
|
-
BLOCKS["HR"] = "hr";
|
|
26617
|
-
BLOCKS["QUOTE"] = "blockquote";
|
|
26618
|
-
BLOCKS["EMBEDDED_ENTRY"] = "embedded-entry-block";
|
|
26619
|
-
BLOCKS["EMBEDDED_ASSET"] = "embedded-asset-block";
|
|
26620
|
-
BLOCKS["EMBEDDED_RESOURCE"] = "embedded-resource-block";
|
|
26621
|
-
BLOCKS["TABLE"] = "table";
|
|
26622
|
-
BLOCKS["TABLE_ROW"] = "table-row";
|
|
26623
|
-
BLOCKS["TABLE_CELL"] = "table-cell";
|
|
26624
|
-
BLOCKS["TABLE_HEADER_CELL"] = "table-header-cell";
|
|
26625
|
-
})(BLOCKS || (blocks.BLOCKS = BLOCKS = {}));
|
|
26626
|
-
|
|
26627
|
-
var inlines = {};
|
|
26628
|
-
|
|
26629
|
-
Object.defineProperty(inlines, "__esModule", { value: true });
|
|
26630
|
-
inlines.INLINES = void 0;
|
|
26631
|
-
/**
|
|
26632
|
-
* Map of all Contentful inline types. Inline contain inline or text nodes.
|
|
26633
|
-
*
|
|
26634
|
-
* @note This should be kept in alphabetical order since the
|
|
26635
|
-
* [validation package](https://github.com/contentful/content-stack/tree/master/packages/validation)
|
|
26636
|
-
* relies on the values being in a predictable order.
|
|
26637
|
-
*/
|
|
26638
|
-
var INLINES;
|
|
26639
|
-
(function (INLINES) {
|
|
26640
|
-
INLINES["ASSET_HYPERLINK"] = "asset-hyperlink";
|
|
26641
|
-
INLINES["EMBEDDED_ENTRY"] = "embedded-entry-inline";
|
|
26642
|
-
INLINES["EMBEDDED_RESOURCE"] = "embedded-resource-inline";
|
|
26643
|
-
INLINES["ENTRY_HYPERLINK"] = "entry-hyperlink";
|
|
26644
|
-
INLINES["HYPERLINK"] = "hyperlink";
|
|
26645
|
-
INLINES["RESOURCE_HYPERLINK"] = "resource-hyperlink";
|
|
26646
|
-
})(INLINES || (inlines.INLINES = INLINES = {}));
|
|
26596
|
+
var hasRequiredBlocks;
|
|
26647
26597
|
|
|
26648
|
-
|
|
26598
|
+
function requireBlocks () {
|
|
26599
|
+
if (hasRequiredBlocks) return blocks;
|
|
26600
|
+
hasRequiredBlocks = 1;
|
|
26601
|
+
Object.defineProperty(blocks, "__esModule", { value: true });
|
|
26602
|
+
blocks.BLOCKS = void 0;
|
|
26603
|
+
/**
|
|
26604
|
+
* Map of all Contentful block types. Blocks contain inline or block nodes.
|
|
26605
|
+
*/
|
|
26606
|
+
var BLOCKS;
|
|
26607
|
+
(function (BLOCKS) {
|
|
26608
|
+
BLOCKS["DOCUMENT"] = "document";
|
|
26609
|
+
BLOCKS["PARAGRAPH"] = "paragraph";
|
|
26610
|
+
BLOCKS["HEADING_1"] = "heading-1";
|
|
26611
|
+
BLOCKS["HEADING_2"] = "heading-2";
|
|
26612
|
+
BLOCKS["HEADING_3"] = "heading-3";
|
|
26613
|
+
BLOCKS["HEADING_4"] = "heading-4";
|
|
26614
|
+
BLOCKS["HEADING_5"] = "heading-5";
|
|
26615
|
+
BLOCKS["HEADING_6"] = "heading-6";
|
|
26616
|
+
BLOCKS["OL_LIST"] = "ordered-list";
|
|
26617
|
+
BLOCKS["UL_LIST"] = "unordered-list";
|
|
26618
|
+
BLOCKS["LIST_ITEM"] = "list-item";
|
|
26619
|
+
BLOCKS["HR"] = "hr";
|
|
26620
|
+
BLOCKS["QUOTE"] = "blockquote";
|
|
26621
|
+
BLOCKS["EMBEDDED_ENTRY"] = "embedded-entry-block";
|
|
26622
|
+
BLOCKS["EMBEDDED_ASSET"] = "embedded-asset-block";
|
|
26623
|
+
BLOCKS["EMBEDDED_RESOURCE"] = "embedded-resource-block";
|
|
26624
|
+
BLOCKS["TABLE"] = "table";
|
|
26625
|
+
BLOCKS["TABLE_ROW"] = "table-row";
|
|
26626
|
+
BLOCKS["TABLE_CELL"] = "table-cell";
|
|
26627
|
+
BLOCKS["TABLE_HEADER_CELL"] = "table-header-cell";
|
|
26628
|
+
})(BLOCKS || (blocks.BLOCKS = BLOCKS = {}));
|
|
26629
|
+
|
|
26630
|
+
return blocks;
|
|
26631
|
+
}
|
|
26649
26632
|
|
|
26650
|
-
|
|
26651
|
-
marks.MARKS = void 0;
|
|
26652
|
-
/**
|
|
26653
|
-
* Map of all Contentful marks.
|
|
26654
|
-
*/
|
|
26655
|
-
var MARKS;
|
|
26656
|
-
(function (MARKS) {
|
|
26657
|
-
MARKS["BOLD"] = "bold";
|
|
26658
|
-
MARKS["ITALIC"] = "italic";
|
|
26659
|
-
MARKS["UNDERLINE"] = "underline";
|
|
26660
|
-
MARKS["CODE"] = "code";
|
|
26661
|
-
MARKS["SUPERSCRIPT"] = "superscript";
|
|
26662
|
-
MARKS["SUBSCRIPT"] = "subscript";
|
|
26663
|
-
MARKS["STRIKETHROUGH"] = "strikethrough";
|
|
26664
|
-
})(MARKS || (marks.MARKS = MARKS = {}));
|
|
26633
|
+
var inlines = {};
|
|
26665
26634
|
|
|
26666
|
-
var
|
|
26635
|
+
var hasRequiredInlines;
|
|
26667
26636
|
|
|
26668
|
-
|
|
26669
|
-
|
|
26670
|
-
|
|
26671
|
-
|
|
26672
|
-
|
|
26673
|
-
ar[i] = from[i];
|
|
26674
|
-
}
|
|
26675
|
-
}
|
|
26676
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
26677
|
-
};
|
|
26678
|
-
var _a;
|
|
26679
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26680
|
-
exports.V1_MARKS = exports.V1_NODE_TYPES = exports.TEXT_CONTAINERS = exports.HEADINGS = exports.CONTAINERS = exports.VOID_BLOCKS = exports.TABLE_BLOCKS = exports.LIST_ITEM_BLOCKS = exports.TOP_LEVEL_BLOCKS = void 0;
|
|
26681
|
-
var blocks_1 = blocks;
|
|
26682
|
-
var inlines_1 = inlines;
|
|
26683
|
-
var marks_1 = marks;
|
|
26637
|
+
function requireInlines () {
|
|
26638
|
+
if (hasRequiredInlines) return inlines;
|
|
26639
|
+
hasRequiredInlines = 1;
|
|
26640
|
+
Object.defineProperty(inlines, "__esModule", { value: true });
|
|
26641
|
+
inlines.INLINES = void 0;
|
|
26684
26642
|
/**
|
|
26685
|
-
*
|
|
26686
|
-
* Only these block types can be the direct children of the document.
|
|
26687
|
-
*/
|
|
26688
|
-
exports.TOP_LEVEL_BLOCKS = [
|
|
26689
|
-
blocks_1.BLOCKS.PARAGRAPH,
|
|
26690
|
-
blocks_1.BLOCKS.HEADING_1,
|
|
26691
|
-
blocks_1.BLOCKS.HEADING_2,
|
|
26692
|
-
blocks_1.BLOCKS.HEADING_3,
|
|
26693
|
-
blocks_1.BLOCKS.HEADING_4,
|
|
26694
|
-
blocks_1.BLOCKS.HEADING_5,
|
|
26695
|
-
blocks_1.BLOCKS.HEADING_6,
|
|
26696
|
-
blocks_1.BLOCKS.OL_LIST,
|
|
26697
|
-
blocks_1.BLOCKS.UL_LIST,
|
|
26698
|
-
blocks_1.BLOCKS.HR,
|
|
26699
|
-
blocks_1.BLOCKS.QUOTE,
|
|
26700
|
-
blocks_1.BLOCKS.EMBEDDED_ENTRY,
|
|
26701
|
-
blocks_1.BLOCKS.EMBEDDED_ASSET,
|
|
26702
|
-
blocks_1.BLOCKS.EMBEDDED_RESOURCE,
|
|
26703
|
-
blocks_1.BLOCKS.TABLE,
|
|
26704
|
-
];
|
|
26705
|
-
/**
|
|
26706
|
-
* Array of all allowed block types inside list items
|
|
26707
|
-
*/
|
|
26708
|
-
exports.LIST_ITEM_BLOCKS = [
|
|
26709
|
-
blocks_1.BLOCKS.PARAGRAPH,
|
|
26710
|
-
blocks_1.BLOCKS.HEADING_1,
|
|
26711
|
-
blocks_1.BLOCKS.HEADING_2,
|
|
26712
|
-
blocks_1.BLOCKS.HEADING_3,
|
|
26713
|
-
blocks_1.BLOCKS.HEADING_4,
|
|
26714
|
-
blocks_1.BLOCKS.HEADING_5,
|
|
26715
|
-
blocks_1.BLOCKS.HEADING_6,
|
|
26716
|
-
blocks_1.BLOCKS.OL_LIST,
|
|
26717
|
-
blocks_1.BLOCKS.UL_LIST,
|
|
26718
|
-
blocks_1.BLOCKS.HR,
|
|
26719
|
-
blocks_1.BLOCKS.QUOTE,
|
|
26720
|
-
blocks_1.BLOCKS.EMBEDDED_ENTRY,
|
|
26721
|
-
blocks_1.BLOCKS.EMBEDDED_ASSET,
|
|
26722
|
-
blocks_1.BLOCKS.EMBEDDED_RESOURCE,
|
|
26723
|
-
];
|
|
26724
|
-
exports.TABLE_BLOCKS = [
|
|
26725
|
-
blocks_1.BLOCKS.TABLE,
|
|
26726
|
-
blocks_1.BLOCKS.TABLE_ROW,
|
|
26727
|
-
blocks_1.BLOCKS.TABLE_CELL,
|
|
26728
|
-
blocks_1.BLOCKS.TABLE_HEADER_CELL,
|
|
26729
|
-
];
|
|
26730
|
-
/**
|
|
26731
|
-
* Array of all void block types
|
|
26732
|
-
*/
|
|
26733
|
-
exports.VOID_BLOCKS = [
|
|
26734
|
-
blocks_1.BLOCKS.HR,
|
|
26735
|
-
blocks_1.BLOCKS.EMBEDDED_ENTRY,
|
|
26736
|
-
blocks_1.BLOCKS.EMBEDDED_ASSET,
|
|
26737
|
-
blocks_1.BLOCKS.EMBEDDED_RESOURCE,
|
|
26738
|
-
];
|
|
26739
|
-
/**
|
|
26740
|
-
* Dictionary of all container block types, and the set block types they accept as children.
|
|
26643
|
+
* Map of all Contentful inline types. Inline contain inline or text nodes.
|
|
26741
26644
|
*
|
|
26742
|
-
*
|
|
26645
|
+
* @note This should be kept in alphabetical order since the
|
|
26646
|
+
* [validation package](https://github.com/contentful/content-stack/tree/master/packages/validation)
|
|
26647
|
+
* relies on the values being in a predictable order.
|
|
26743
26648
|
*/
|
|
26744
|
-
|
|
26745
|
-
|
|
26746
|
-
|
|
26747
|
-
|
|
26748
|
-
|
|
26749
|
-
|
|
26750
|
-
|
|
26751
|
-
|
|
26752
|
-
|
|
26753
|
-
|
|
26754
|
-
|
|
26755
|
-
|
|
26756
|
-
|
|
26757
|
-
|
|
26758
|
-
|
|
26759
|
-
|
|
26760
|
-
|
|
26761
|
-
|
|
26762
|
-
|
|
26763
|
-
|
|
26764
|
-
|
|
26765
|
-
|
|
26766
|
-
* Array of all block types that may contain text and inline nodes.
|
|
26767
|
-
*/
|
|
26768
|
-
exports.TEXT_CONTAINERS = __spreadArray([blocks_1.BLOCKS.PARAGRAPH], exports.HEADINGS, true);
|
|
26769
|
-
/**
|
|
26770
|
-
* Node types before `tables` release.
|
|
26771
|
-
*/
|
|
26772
|
-
exports.V1_NODE_TYPES = [
|
|
26773
|
-
blocks_1.BLOCKS.DOCUMENT,
|
|
26774
|
-
blocks_1.BLOCKS.PARAGRAPH,
|
|
26775
|
-
blocks_1.BLOCKS.HEADING_1,
|
|
26776
|
-
blocks_1.BLOCKS.HEADING_2,
|
|
26777
|
-
blocks_1.BLOCKS.HEADING_3,
|
|
26778
|
-
blocks_1.BLOCKS.HEADING_4,
|
|
26779
|
-
blocks_1.BLOCKS.HEADING_5,
|
|
26780
|
-
blocks_1.BLOCKS.HEADING_6,
|
|
26781
|
-
blocks_1.BLOCKS.OL_LIST,
|
|
26782
|
-
blocks_1.BLOCKS.UL_LIST,
|
|
26783
|
-
blocks_1.BLOCKS.LIST_ITEM,
|
|
26784
|
-
blocks_1.BLOCKS.HR,
|
|
26785
|
-
blocks_1.BLOCKS.QUOTE,
|
|
26786
|
-
blocks_1.BLOCKS.EMBEDDED_ENTRY,
|
|
26787
|
-
blocks_1.BLOCKS.EMBEDDED_ASSET,
|
|
26788
|
-
inlines_1.INLINES.HYPERLINK,
|
|
26789
|
-
inlines_1.INLINES.ENTRY_HYPERLINK,
|
|
26790
|
-
inlines_1.INLINES.ASSET_HYPERLINK,
|
|
26791
|
-
inlines_1.INLINES.EMBEDDED_ENTRY,
|
|
26792
|
-
'text',
|
|
26793
|
-
];
|
|
26649
|
+
var INLINES;
|
|
26650
|
+
(function (INLINES) {
|
|
26651
|
+
INLINES["ASSET_HYPERLINK"] = "asset-hyperlink";
|
|
26652
|
+
INLINES["EMBEDDED_ENTRY"] = "embedded-entry-inline";
|
|
26653
|
+
INLINES["EMBEDDED_RESOURCE"] = "embedded-resource-inline";
|
|
26654
|
+
INLINES["ENTRY_HYPERLINK"] = "entry-hyperlink";
|
|
26655
|
+
INLINES["HYPERLINK"] = "hyperlink";
|
|
26656
|
+
INLINES["RESOURCE_HYPERLINK"] = "resource-hyperlink";
|
|
26657
|
+
})(INLINES || (inlines.INLINES = INLINES = {}));
|
|
26658
|
+
|
|
26659
|
+
return inlines;
|
|
26660
|
+
}
|
|
26661
|
+
|
|
26662
|
+
var marks = {};
|
|
26663
|
+
|
|
26664
|
+
var hasRequiredMarks;
|
|
26665
|
+
|
|
26666
|
+
function requireMarks () {
|
|
26667
|
+
if (hasRequiredMarks) return marks;
|
|
26668
|
+
hasRequiredMarks = 1;
|
|
26669
|
+
Object.defineProperty(marks, "__esModule", { value: true });
|
|
26670
|
+
marks.MARKS = void 0;
|
|
26794
26671
|
/**
|
|
26795
|
-
*
|
|
26672
|
+
* Map of all Contentful marks.
|
|
26796
26673
|
*/
|
|
26797
|
-
|
|
26674
|
+
var MARKS;
|
|
26675
|
+
(function (MARKS) {
|
|
26676
|
+
MARKS["BOLD"] = "bold";
|
|
26677
|
+
MARKS["ITALIC"] = "italic";
|
|
26678
|
+
MARKS["UNDERLINE"] = "underline";
|
|
26679
|
+
MARKS["CODE"] = "code";
|
|
26680
|
+
MARKS["SUPERSCRIPT"] = "superscript";
|
|
26681
|
+
MARKS["SUBSCRIPT"] = "subscript";
|
|
26682
|
+
MARKS["STRIKETHROUGH"] = "strikethrough";
|
|
26683
|
+
})(MARKS || (marks.MARKS = MARKS = {}));
|
|
26798
26684
|
|
|
26799
|
-
|
|
26685
|
+
return marks;
|
|
26686
|
+
}
|
|
26687
|
+
|
|
26688
|
+
var schemaConstraints = {};
|
|
26689
|
+
|
|
26690
|
+
var hasRequiredSchemaConstraints;
|
|
26691
|
+
|
|
26692
|
+
function requireSchemaConstraints () {
|
|
26693
|
+
if (hasRequiredSchemaConstraints) return schemaConstraints;
|
|
26694
|
+
hasRequiredSchemaConstraints = 1;
|
|
26695
|
+
(function (exports) {
|
|
26696
|
+
var __spreadArray = (schemaConstraints && schemaConstraints.__spreadArray) || function (to, from, pack) {
|
|
26697
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
26698
|
+
if (ar || !(i in from)) {
|
|
26699
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
26700
|
+
ar[i] = from[i];
|
|
26701
|
+
}
|
|
26702
|
+
}
|
|
26703
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
26704
|
+
};
|
|
26705
|
+
var _a;
|
|
26706
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26707
|
+
exports.V1_MARKS = exports.V1_NODE_TYPES = exports.TEXT_CONTAINERS = exports.HEADINGS = exports.CONTAINERS = exports.VOID_BLOCKS = exports.TABLE_BLOCKS = exports.LIST_ITEM_BLOCKS = exports.TOP_LEVEL_BLOCKS = void 0;
|
|
26708
|
+
var blocks_1 = requireBlocks();
|
|
26709
|
+
var inlines_1 = requireInlines();
|
|
26710
|
+
var marks_1 = requireMarks();
|
|
26711
|
+
/**
|
|
26712
|
+
* Array of all top level block types.
|
|
26713
|
+
* Only these block types can be the direct children of the document.
|
|
26714
|
+
*/
|
|
26715
|
+
exports.TOP_LEVEL_BLOCKS = [
|
|
26716
|
+
blocks_1.BLOCKS.PARAGRAPH,
|
|
26717
|
+
blocks_1.BLOCKS.HEADING_1,
|
|
26718
|
+
blocks_1.BLOCKS.HEADING_2,
|
|
26719
|
+
blocks_1.BLOCKS.HEADING_3,
|
|
26720
|
+
blocks_1.BLOCKS.HEADING_4,
|
|
26721
|
+
blocks_1.BLOCKS.HEADING_5,
|
|
26722
|
+
blocks_1.BLOCKS.HEADING_6,
|
|
26723
|
+
blocks_1.BLOCKS.OL_LIST,
|
|
26724
|
+
blocks_1.BLOCKS.UL_LIST,
|
|
26725
|
+
blocks_1.BLOCKS.HR,
|
|
26726
|
+
blocks_1.BLOCKS.QUOTE,
|
|
26727
|
+
blocks_1.BLOCKS.EMBEDDED_ENTRY,
|
|
26728
|
+
blocks_1.BLOCKS.EMBEDDED_ASSET,
|
|
26729
|
+
blocks_1.BLOCKS.EMBEDDED_RESOURCE,
|
|
26730
|
+
blocks_1.BLOCKS.TABLE,
|
|
26731
|
+
];
|
|
26732
|
+
/**
|
|
26733
|
+
* Array of all allowed block types inside list items
|
|
26734
|
+
*/
|
|
26735
|
+
exports.LIST_ITEM_BLOCKS = [
|
|
26736
|
+
blocks_1.BLOCKS.PARAGRAPH,
|
|
26737
|
+
blocks_1.BLOCKS.HEADING_1,
|
|
26738
|
+
blocks_1.BLOCKS.HEADING_2,
|
|
26739
|
+
blocks_1.BLOCKS.HEADING_3,
|
|
26740
|
+
blocks_1.BLOCKS.HEADING_4,
|
|
26741
|
+
blocks_1.BLOCKS.HEADING_5,
|
|
26742
|
+
blocks_1.BLOCKS.HEADING_6,
|
|
26743
|
+
blocks_1.BLOCKS.OL_LIST,
|
|
26744
|
+
blocks_1.BLOCKS.UL_LIST,
|
|
26745
|
+
blocks_1.BLOCKS.HR,
|
|
26746
|
+
blocks_1.BLOCKS.QUOTE,
|
|
26747
|
+
blocks_1.BLOCKS.EMBEDDED_ENTRY,
|
|
26748
|
+
blocks_1.BLOCKS.EMBEDDED_ASSET,
|
|
26749
|
+
blocks_1.BLOCKS.EMBEDDED_RESOURCE,
|
|
26750
|
+
];
|
|
26751
|
+
exports.TABLE_BLOCKS = [
|
|
26752
|
+
blocks_1.BLOCKS.TABLE,
|
|
26753
|
+
blocks_1.BLOCKS.TABLE_ROW,
|
|
26754
|
+
blocks_1.BLOCKS.TABLE_CELL,
|
|
26755
|
+
blocks_1.BLOCKS.TABLE_HEADER_CELL,
|
|
26756
|
+
];
|
|
26757
|
+
/**
|
|
26758
|
+
* Array of all void block types
|
|
26759
|
+
*/
|
|
26760
|
+
exports.VOID_BLOCKS = [
|
|
26761
|
+
blocks_1.BLOCKS.HR,
|
|
26762
|
+
blocks_1.BLOCKS.EMBEDDED_ENTRY,
|
|
26763
|
+
blocks_1.BLOCKS.EMBEDDED_ASSET,
|
|
26764
|
+
blocks_1.BLOCKS.EMBEDDED_RESOURCE,
|
|
26765
|
+
];
|
|
26766
|
+
/**
|
|
26767
|
+
* Dictionary of all container block types, and the set block types they accept as children.
|
|
26768
|
+
*
|
|
26769
|
+
* Note: This does not include `[BLOCKS.DOCUMENT]: TOP_LEVEL_BLOCKS`
|
|
26770
|
+
*/
|
|
26771
|
+
exports.CONTAINERS = (_a = {},
|
|
26772
|
+
_a[blocks_1.BLOCKS.OL_LIST] = [blocks_1.BLOCKS.LIST_ITEM],
|
|
26773
|
+
_a[blocks_1.BLOCKS.UL_LIST] = [blocks_1.BLOCKS.LIST_ITEM],
|
|
26774
|
+
_a[blocks_1.BLOCKS.LIST_ITEM] = exports.LIST_ITEM_BLOCKS,
|
|
26775
|
+
_a[blocks_1.BLOCKS.QUOTE] = [blocks_1.BLOCKS.PARAGRAPH],
|
|
26776
|
+
_a[blocks_1.BLOCKS.TABLE] = [blocks_1.BLOCKS.TABLE_ROW],
|
|
26777
|
+
_a[blocks_1.BLOCKS.TABLE_ROW] = [blocks_1.BLOCKS.TABLE_CELL, blocks_1.BLOCKS.TABLE_HEADER_CELL],
|
|
26778
|
+
_a[blocks_1.BLOCKS.TABLE_CELL] = [blocks_1.BLOCKS.PARAGRAPH, blocks_1.BLOCKS.UL_LIST, blocks_1.BLOCKS.OL_LIST],
|
|
26779
|
+
_a[blocks_1.BLOCKS.TABLE_HEADER_CELL] = [blocks_1.BLOCKS.PARAGRAPH],
|
|
26780
|
+
_a);
|
|
26781
|
+
/**
|
|
26782
|
+
* Array of all heading levels
|
|
26783
|
+
*/
|
|
26784
|
+
exports.HEADINGS = [
|
|
26785
|
+
blocks_1.BLOCKS.HEADING_1,
|
|
26786
|
+
blocks_1.BLOCKS.HEADING_2,
|
|
26787
|
+
blocks_1.BLOCKS.HEADING_3,
|
|
26788
|
+
blocks_1.BLOCKS.HEADING_4,
|
|
26789
|
+
blocks_1.BLOCKS.HEADING_5,
|
|
26790
|
+
blocks_1.BLOCKS.HEADING_6,
|
|
26791
|
+
];
|
|
26792
|
+
/**
|
|
26793
|
+
* Array of all block types that may contain text and inline nodes.
|
|
26794
|
+
*/
|
|
26795
|
+
exports.TEXT_CONTAINERS = __spreadArray([blocks_1.BLOCKS.PARAGRAPH], exports.HEADINGS, true);
|
|
26796
|
+
/**
|
|
26797
|
+
* Node types before `tables` release.
|
|
26798
|
+
*/
|
|
26799
|
+
exports.V1_NODE_TYPES = [
|
|
26800
|
+
blocks_1.BLOCKS.DOCUMENT,
|
|
26801
|
+
blocks_1.BLOCKS.PARAGRAPH,
|
|
26802
|
+
blocks_1.BLOCKS.HEADING_1,
|
|
26803
|
+
blocks_1.BLOCKS.HEADING_2,
|
|
26804
|
+
blocks_1.BLOCKS.HEADING_3,
|
|
26805
|
+
blocks_1.BLOCKS.HEADING_4,
|
|
26806
|
+
blocks_1.BLOCKS.HEADING_5,
|
|
26807
|
+
blocks_1.BLOCKS.HEADING_6,
|
|
26808
|
+
blocks_1.BLOCKS.OL_LIST,
|
|
26809
|
+
blocks_1.BLOCKS.UL_LIST,
|
|
26810
|
+
blocks_1.BLOCKS.LIST_ITEM,
|
|
26811
|
+
blocks_1.BLOCKS.HR,
|
|
26812
|
+
blocks_1.BLOCKS.QUOTE,
|
|
26813
|
+
blocks_1.BLOCKS.EMBEDDED_ENTRY,
|
|
26814
|
+
blocks_1.BLOCKS.EMBEDDED_ASSET,
|
|
26815
|
+
inlines_1.INLINES.HYPERLINK,
|
|
26816
|
+
inlines_1.INLINES.ENTRY_HYPERLINK,
|
|
26817
|
+
inlines_1.INLINES.ASSET_HYPERLINK,
|
|
26818
|
+
inlines_1.INLINES.EMBEDDED_ENTRY,
|
|
26819
|
+
'text',
|
|
26820
|
+
];
|
|
26821
|
+
/**
|
|
26822
|
+
* Marks before `superscript` & `subscript` release.
|
|
26823
|
+
*/
|
|
26824
|
+
exports.V1_MARKS = [marks_1.MARKS.BOLD, marks_1.MARKS.CODE, marks_1.MARKS.ITALIC, marks_1.MARKS.UNDERLINE];
|
|
26825
|
+
|
|
26826
|
+
} (schemaConstraints));
|
|
26827
|
+
return schemaConstraints;
|
|
26828
|
+
}
|
|
26800
26829
|
|
|
26801
26830
|
var types = {};
|
|
26802
26831
|
|
|
26803
|
-
|
|
26832
|
+
var hasRequiredTypes;
|
|
26833
|
+
|
|
26834
|
+
function requireTypes () {
|
|
26835
|
+
if (hasRequiredTypes) return types;
|
|
26836
|
+
hasRequiredTypes = 1;
|
|
26837
|
+
Object.defineProperty(types, "__esModule", { value: true });
|
|
26838
|
+
|
|
26839
|
+
return types;
|
|
26840
|
+
}
|
|
26804
26841
|
|
|
26805
26842
|
var nodeTypes = {};
|
|
26806
26843
|
|
|
26807
|
-
|
|
26844
|
+
var hasRequiredNodeTypes;
|
|
26845
|
+
|
|
26846
|
+
function requireNodeTypes () {
|
|
26847
|
+
if (hasRequiredNodeTypes) return nodeTypes;
|
|
26848
|
+
hasRequiredNodeTypes = 1;
|
|
26849
|
+
Object.defineProperty(nodeTypes, "__esModule", { value: true });
|
|
26850
|
+
|
|
26851
|
+
return nodeTypes;
|
|
26852
|
+
}
|
|
26808
26853
|
|
|
26809
26854
|
var emptyDocument = {};
|
|
26810
26855
|
|
|
26811
|
-
|
|
26812
|
-
|
|
26813
|
-
|
|
26814
|
-
|
|
26815
|
-
|
|
26816
|
-
|
|
26817
|
-
|
|
26818
|
-
|
|
26819
|
-
|
|
26820
|
-
|
|
26821
|
-
|
|
26822
|
-
|
|
26823
|
-
|
|
26824
|
-
|
|
26825
|
-
|
|
26826
|
-
|
|
26827
|
-
|
|
26828
|
-
|
|
26829
|
-
|
|
26830
|
-
|
|
26831
|
-
|
|
26832
|
-
|
|
26833
|
-
|
|
26834
|
-
|
|
26835
|
-
}
|
|
26856
|
+
var hasRequiredEmptyDocument;
|
|
26857
|
+
|
|
26858
|
+
function requireEmptyDocument () {
|
|
26859
|
+
if (hasRequiredEmptyDocument) return emptyDocument;
|
|
26860
|
+
hasRequiredEmptyDocument = 1;
|
|
26861
|
+
Object.defineProperty(emptyDocument, "__esModule", { value: true });
|
|
26862
|
+
emptyDocument.EMPTY_DOCUMENT = void 0;
|
|
26863
|
+
var blocks_1 = requireBlocks();
|
|
26864
|
+
/**
|
|
26865
|
+
* A rich text document considered to be empty.
|
|
26866
|
+
* Any other document structure than this is not considered empty.
|
|
26867
|
+
*/
|
|
26868
|
+
emptyDocument.EMPTY_DOCUMENT = {
|
|
26869
|
+
nodeType: blocks_1.BLOCKS.DOCUMENT,
|
|
26870
|
+
data: {},
|
|
26871
|
+
content: [
|
|
26872
|
+
{
|
|
26873
|
+
nodeType: blocks_1.BLOCKS.PARAGRAPH,
|
|
26874
|
+
data: {},
|
|
26875
|
+
content: [
|
|
26876
|
+
{
|
|
26877
|
+
nodeType: 'text',
|
|
26878
|
+
value: '',
|
|
26879
|
+
marks: [],
|
|
26880
|
+
data: {},
|
|
26881
|
+
},
|
|
26882
|
+
],
|
|
26883
|
+
},
|
|
26884
|
+
],
|
|
26885
|
+
};
|
|
26886
|
+
|
|
26887
|
+
return emptyDocument;
|
|
26888
|
+
}
|
|
26836
26889
|
|
|
26837
26890
|
var helpers = {};
|
|
26838
26891
|
|
|
26839
|
-
|
|
26840
|
-
|
|
26841
|
-
|
|
26842
|
-
|
|
26843
|
-
|
|
26844
|
-
|
|
26845
|
-
|
|
26846
|
-
|
|
26847
|
-
|
|
26848
|
-
|
|
26849
|
-
|
|
26850
|
-
|
|
26851
|
-
|
|
26852
|
-
|
|
26853
|
-
|
|
26854
|
-
|
|
26855
|
-
|
|
26856
|
-
|
|
26857
|
-
|
|
26858
|
-
|
|
26859
|
-
|
|
26860
|
-
|
|
26861
|
-
|
|
26862
|
-
|
|
26863
|
-
|
|
26864
|
-
|
|
26865
|
-
|
|
26866
|
-
|
|
26867
|
-
|
|
26868
|
-
|
|
26869
|
-
|
|
26870
|
-
|
|
26871
|
-
|
|
26872
|
-
|
|
26873
|
-
|
|
26874
|
-
|
|
26892
|
+
var hasRequiredHelpers;
|
|
26893
|
+
|
|
26894
|
+
function requireHelpers () {
|
|
26895
|
+
if (hasRequiredHelpers) return helpers;
|
|
26896
|
+
hasRequiredHelpers = 1;
|
|
26897
|
+
Object.defineProperty(helpers, "__esModule", { value: true });
|
|
26898
|
+
helpers.isInline = isInline;
|
|
26899
|
+
helpers.isBlock = isBlock;
|
|
26900
|
+
helpers.isText = isText;
|
|
26901
|
+
var blocks_1 = requireBlocks();
|
|
26902
|
+
var inlines_1 = requireInlines();
|
|
26903
|
+
/**
|
|
26904
|
+
* Tiny replacement for Object.values(object).includes(key) to
|
|
26905
|
+
* avoid including CoreJS polyfills
|
|
26906
|
+
*/
|
|
26907
|
+
function hasValue(obj, value) {
|
|
26908
|
+
for (var _i = 0, _a = Object.keys(obj); _i < _a.length; _i++) {
|
|
26909
|
+
var key = _a[_i];
|
|
26910
|
+
if (value === obj[key]) {
|
|
26911
|
+
return true;
|
|
26912
|
+
}
|
|
26913
|
+
}
|
|
26914
|
+
return false;
|
|
26915
|
+
}
|
|
26916
|
+
/**
|
|
26917
|
+
* Checks if the node is an instance of Inline.
|
|
26918
|
+
*/
|
|
26919
|
+
function isInline(node) {
|
|
26920
|
+
return hasValue(inlines_1.INLINES, node.nodeType);
|
|
26921
|
+
}
|
|
26922
|
+
/**
|
|
26923
|
+
* Checks if the node is an instance of Block.
|
|
26924
|
+
*/
|
|
26925
|
+
function isBlock(node) {
|
|
26926
|
+
return hasValue(blocks_1.BLOCKS, node.nodeType);
|
|
26927
|
+
}
|
|
26928
|
+
/**
|
|
26929
|
+
* Checks if the node is an instance of Text.
|
|
26930
|
+
*/
|
|
26931
|
+
function isText(node) {
|
|
26932
|
+
return node.nodeType === 'text';
|
|
26933
|
+
}
|
|
26934
|
+
|
|
26935
|
+
return helpers;
|
|
26875
26936
|
}
|
|
26876
26937
|
|
|
26877
26938
|
function commonjsRequire(path) {
|
|
@@ -26880,63 +26941,80 @@ function commonjsRequire(path) {
|
|
|
26880
26941
|
|
|
26881
26942
|
var schemas = {};
|
|
26882
26943
|
|
|
26883
|
-
|
|
26884
|
-
schemas.getSchemaWithNodeType = getSchemaWithNodeType;
|
|
26885
|
-
function getSchemaWithNodeType(nodeType) {
|
|
26886
|
-
try {
|
|
26887
|
-
return commonjsRequire("./generated/".concat(nodeType, ".json"));
|
|
26888
|
-
}
|
|
26889
|
-
catch (error) {
|
|
26890
|
-
throw new Error("Schema for nodeType \"".concat(nodeType, "\" was not found."));
|
|
26891
|
-
}
|
|
26892
|
-
}
|
|
26944
|
+
var hasRequiredSchemas;
|
|
26893
26945
|
|
|
26894
|
-
|
|
26895
|
-
|
|
26896
|
-
|
|
26897
|
-
|
|
26898
|
-
|
|
26899
|
-
|
|
26946
|
+
function requireSchemas () {
|
|
26947
|
+
if (hasRequiredSchemas) return schemas;
|
|
26948
|
+
hasRequiredSchemas = 1;
|
|
26949
|
+
Object.defineProperty(schemas, "__esModule", { value: true });
|
|
26950
|
+
schemas.getSchemaWithNodeType = getSchemaWithNodeType;
|
|
26951
|
+
function getSchemaWithNodeType(nodeType) {
|
|
26952
|
+
try {
|
|
26953
|
+
return commonjsRequire("./generated/".concat(nodeType, ".json"));
|
|
26900
26954
|
}
|
|
26901
|
-
|
|
26902
|
-
|
|
26903
|
-
|
|
26904
|
-
|
|
26905
|
-
}));
|
|
26906
|
-
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
26907
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26908
|
-
}) : function(o, v) {
|
|
26909
|
-
o["default"] = v;
|
|
26910
|
-
});
|
|
26911
|
-
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
26912
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
26913
|
-
};
|
|
26914
|
-
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
|
|
26915
|
-
if (mod && mod.__esModule) return mod;
|
|
26916
|
-
var result = {};
|
|
26917
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
26918
|
-
__setModuleDefault(result, mod);
|
|
26919
|
-
return result;
|
|
26920
|
-
};
|
|
26921
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26922
|
-
exports.getSchemaWithNodeType = exports.helpers = exports.EMPTY_DOCUMENT = exports.MARKS = exports.INLINES = exports.BLOCKS = void 0;
|
|
26923
|
-
var blocks_1 = blocks;
|
|
26924
|
-
Object.defineProperty(exports, "BLOCKS", { enumerable: true, get: function () { return blocks_1.BLOCKS; } });
|
|
26925
|
-
var inlines_1 = inlines;
|
|
26926
|
-
Object.defineProperty(exports, "INLINES", { enumerable: true, get: function () { return inlines_1.INLINES; } });
|
|
26927
|
-
var marks_1 = marks;
|
|
26928
|
-
Object.defineProperty(exports, "MARKS", { enumerable: true, get: function () { return marks_1.MARKS; } });
|
|
26929
|
-
__exportStar(schemaConstraints, exports);
|
|
26930
|
-
__exportStar(types, exports);
|
|
26931
|
-
__exportStar(nodeTypes, exports);
|
|
26932
|
-
var emptyDocument_1 = emptyDocument;
|
|
26933
|
-
Object.defineProperty(exports, "EMPTY_DOCUMENT", { enumerable: true, get: function () { return emptyDocument_1.EMPTY_DOCUMENT; } });
|
|
26934
|
-
var helpers$1 = __importStar(helpers);
|
|
26935
|
-
exports.helpers = helpers$1;
|
|
26936
|
-
var schemas_1 = schemas;
|
|
26937
|
-
Object.defineProperty(exports, "getSchemaWithNodeType", { enumerable: true, get: function () { return schemas_1.getSchemaWithNodeType; } });
|
|
26955
|
+
catch (error) {
|
|
26956
|
+
throw new Error("Schema for nodeType \"".concat(nodeType, "\" was not found."));
|
|
26957
|
+
}
|
|
26958
|
+
}
|
|
26938
26959
|
|
|
26939
|
-
|
|
26960
|
+
return schemas;
|
|
26961
|
+
}
|
|
26962
|
+
|
|
26963
|
+
var hasRequiredDist;
|
|
26964
|
+
|
|
26965
|
+
function requireDist () {
|
|
26966
|
+
if (hasRequiredDist) return dist;
|
|
26967
|
+
hasRequiredDist = 1;
|
|
26968
|
+
(function (exports) {
|
|
26969
|
+
var __createBinding = (dist && dist.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
26970
|
+
if (k2 === undefined) k2 = k;
|
|
26971
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
26972
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
26973
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
26974
|
+
}
|
|
26975
|
+
Object.defineProperty(o, k2, desc);
|
|
26976
|
+
}) : (function(o, m, k, k2) {
|
|
26977
|
+
if (k2 === undefined) k2 = k;
|
|
26978
|
+
o[k2] = m[k];
|
|
26979
|
+
}));
|
|
26980
|
+
var __setModuleDefault = (dist && dist.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
26981
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26982
|
+
}) : function(o, v) {
|
|
26983
|
+
o["default"] = v;
|
|
26984
|
+
});
|
|
26985
|
+
var __exportStar = (dist && dist.__exportStar) || function(m, exports) {
|
|
26986
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
26987
|
+
};
|
|
26988
|
+
var __importStar = (dist && dist.__importStar) || function (mod) {
|
|
26989
|
+
if (mod && mod.__esModule) return mod;
|
|
26990
|
+
var result = {};
|
|
26991
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
26992
|
+
__setModuleDefault(result, mod);
|
|
26993
|
+
return result;
|
|
26994
|
+
};
|
|
26995
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26996
|
+
exports.getSchemaWithNodeType = exports.helpers = exports.EMPTY_DOCUMENT = exports.MARKS = exports.INLINES = exports.BLOCKS = void 0;
|
|
26997
|
+
var blocks_1 = requireBlocks();
|
|
26998
|
+
Object.defineProperty(exports, "BLOCKS", { enumerable: true, get: function () { return blocks_1.BLOCKS; } });
|
|
26999
|
+
var inlines_1 = requireInlines();
|
|
27000
|
+
Object.defineProperty(exports, "INLINES", { enumerable: true, get: function () { return inlines_1.INLINES; } });
|
|
27001
|
+
var marks_1 = requireMarks();
|
|
27002
|
+
Object.defineProperty(exports, "MARKS", { enumerable: true, get: function () { return marks_1.MARKS; } });
|
|
27003
|
+
__exportStar(requireSchemaConstraints(), exports);
|
|
27004
|
+
__exportStar(requireTypes(), exports);
|
|
27005
|
+
__exportStar(requireNodeTypes(), exports);
|
|
27006
|
+
var emptyDocument_1 = requireEmptyDocument();
|
|
27007
|
+
Object.defineProperty(exports, "EMPTY_DOCUMENT", { enumerable: true, get: function () { return emptyDocument_1.EMPTY_DOCUMENT; } });
|
|
27008
|
+
var helpers = __importStar(requireHelpers());
|
|
27009
|
+
exports.helpers = helpers;
|
|
27010
|
+
var schemas_1 = requireSchemas();
|
|
27011
|
+
Object.defineProperty(exports, "getSchemaWithNodeType", { enumerable: true, get: function () { return schemas_1.getSchemaWithNodeType; } });
|
|
27012
|
+
|
|
27013
|
+
} (dist));
|
|
27014
|
+
return dist;
|
|
27015
|
+
}
|
|
27016
|
+
|
|
27017
|
+
var distExports = requireDist();
|
|
26940
27018
|
|
|
26941
27019
|
/**
|
|
26942
27020
|
* Converts a Contentful Rich Text Document to Tiptap JSON format
|
|
@@ -26945,97 +27023,97 @@ const contentfulToTiptap = (document) => {
|
|
|
26945
27023
|
const convertNode = (node) => {
|
|
26946
27024
|
var _a, _b, _c, _d, _e;
|
|
26947
27025
|
switch (node.nodeType) {
|
|
26948
|
-
case
|
|
27026
|
+
case distExports.BLOCKS.DOCUMENT:
|
|
26949
27027
|
return {
|
|
26950
27028
|
type: 'doc',
|
|
26951
27029
|
content: node.content.map(child => convertNode(child)).flat(),
|
|
26952
27030
|
};
|
|
26953
|
-
case
|
|
27031
|
+
case distExports.BLOCKS.PARAGRAPH:
|
|
26954
27032
|
return {
|
|
26955
27033
|
type: 'paragraph',
|
|
26956
27034
|
content: node.content ? node.content.map(child => convertNode(child)).flat() : [],
|
|
26957
27035
|
};
|
|
26958
|
-
case
|
|
27036
|
+
case distExports.BLOCKS.HEADING_1:
|
|
26959
27037
|
return {
|
|
26960
27038
|
type: 'heading',
|
|
26961
27039
|
attrs: { level: 1 },
|
|
26962
27040
|
content: node.content.map(child => convertNode(child)).flat(),
|
|
26963
27041
|
};
|
|
26964
|
-
case
|
|
27042
|
+
case distExports.BLOCKS.HEADING_2:
|
|
26965
27043
|
return {
|
|
26966
27044
|
type: 'heading',
|
|
26967
27045
|
attrs: { level: 2 },
|
|
26968
27046
|
content: node.content.map(child => convertNode(child)).flat(),
|
|
26969
27047
|
};
|
|
26970
|
-
case
|
|
27048
|
+
case distExports.BLOCKS.HEADING_3:
|
|
26971
27049
|
return {
|
|
26972
27050
|
type: 'heading',
|
|
26973
27051
|
attrs: { level: 3 },
|
|
26974
27052
|
content: node.content.map(child => convertNode(child)).flat(),
|
|
26975
27053
|
};
|
|
26976
|
-
case
|
|
27054
|
+
case distExports.BLOCKS.HEADING_4:
|
|
26977
27055
|
return {
|
|
26978
27056
|
type: 'heading',
|
|
26979
27057
|
attrs: { level: 4 },
|
|
26980
27058
|
content: node.content.map(child => convertNode(child)).flat(),
|
|
26981
27059
|
};
|
|
26982
|
-
case
|
|
27060
|
+
case distExports.BLOCKS.HEADING_5:
|
|
26983
27061
|
return {
|
|
26984
27062
|
type: 'heading',
|
|
26985
27063
|
attrs: { level: 5 },
|
|
26986
27064
|
content: node.content.map(child => convertNode(child)).flat(),
|
|
26987
27065
|
};
|
|
26988
|
-
case
|
|
27066
|
+
case distExports.BLOCKS.HEADING_6:
|
|
26989
27067
|
return {
|
|
26990
27068
|
type: 'heading',
|
|
26991
27069
|
attrs: { level: 6 },
|
|
26992
27070
|
content: node.content.map(child => convertNode(child)).flat(),
|
|
26993
27071
|
};
|
|
26994
|
-
case
|
|
27072
|
+
case distExports.BLOCKS.UL_LIST:
|
|
26995
27073
|
return {
|
|
26996
27074
|
type: 'bulletList',
|
|
26997
27075
|
content: node.content.map(child => convertNode(child)).flat(),
|
|
26998
27076
|
};
|
|
26999
|
-
case
|
|
27077
|
+
case distExports.BLOCKS.OL_LIST:
|
|
27000
27078
|
return {
|
|
27001
27079
|
type: 'orderedList',
|
|
27002
27080
|
content: node.content.map(child => convertNode(child)).flat(),
|
|
27003
27081
|
};
|
|
27004
|
-
case
|
|
27082
|
+
case distExports.BLOCKS.LIST_ITEM:
|
|
27005
27083
|
return {
|
|
27006
27084
|
type: 'listItem',
|
|
27007
27085
|
content: node.content.map(child => convertNode(child)).flat(),
|
|
27008
27086
|
};
|
|
27009
|
-
case
|
|
27087
|
+
case distExports.BLOCKS.QUOTE:
|
|
27010
27088
|
return {
|
|
27011
27089
|
type: 'blockquote',
|
|
27012
27090
|
content: node.content.map(child => convertNode(child)).flat(),
|
|
27013
27091
|
};
|
|
27014
|
-
case
|
|
27092
|
+
case distExports.BLOCKS.HR:
|
|
27015
27093
|
return {
|
|
27016
27094
|
type: 'horizontalRule',
|
|
27017
27095
|
};
|
|
27018
|
-
case
|
|
27096
|
+
case distExports.BLOCKS.TABLE:
|
|
27019
27097
|
return {
|
|
27020
27098
|
type: 'table',
|
|
27021
27099
|
content: node.content.map(child => convertNode(child)).flat(),
|
|
27022
27100
|
};
|
|
27023
|
-
case
|
|
27101
|
+
case distExports.BLOCKS.TABLE_ROW:
|
|
27024
27102
|
return {
|
|
27025
27103
|
type: 'tableRow',
|
|
27026
27104
|
content: node.content.map(child => convertNode(child)).flat(),
|
|
27027
27105
|
};
|
|
27028
|
-
case
|
|
27106
|
+
case distExports.BLOCKS.TABLE_CELL:
|
|
27029
27107
|
return {
|
|
27030
27108
|
type: 'tableCell',
|
|
27031
27109
|
content: node.content.map(child => convertNode(child)).flat(),
|
|
27032
27110
|
};
|
|
27033
|
-
case
|
|
27111
|
+
case distExports.BLOCKS.TABLE_HEADER_CELL:
|
|
27034
27112
|
return {
|
|
27035
27113
|
type: 'tableHeader',
|
|
27036
27114
|
content: node.content.map(child => convertNode(child)).flat(),
|
|
27037
27115
|
};
|
|
27038
|
-
case
|
|
27116
|
+
case distExports.INLINES.HYPERLINK:
|
|
27039
27117
|
return {
|
|
27040
27118
|
type: 'text',
|
|
27041
27119
|
text: node.content.map(child => child.nodeType === 'text' ? child.value : '').join(''),
|
|
@@ -27046,7 +27124,7 @@ const contentfulToTiptap = (document) => {
|
|
|
27046
27124
|
},
|
|
27047
27125
|
],
|
|
27048
27126
|
};
|
|
27049
|
-
case
|
|
27127
|
+
case distExports.BLOCKS.EMBEDDED_ENTRY:
|
|
27050
27128
|
return {
|
|
27051
27129
|
type: 'paragraph',
|
|
27052
27130
|
content: [
|
|
@@ -27057,7 +27135,7 @@ const contentfulToTiptap = (document) => {
|
|
|
27057
27135
|
},
|
|
27058
27136
|
],
|
|
27059
27137
|
};
|
|
27060
|
-
case
|
|
27138
|
+
case distExports.BLOCKS.EMBEDDED_ASSET:
|
|
27061
27139
|
return {
|
|
27062
27140
|
type: 'paragraph',
|
|
27063
27141
|
content: [
|
|
@@ -27072,13 +27150,13 @@ const contentfulToTiptap = (document) => {
|
|
|
27072
27150
|
const textNode = node;
|
|
27073
27151
|
const marks = ((_e = textNode.marks) === null || _e === void 0 ? void 0 : _e.map(mark => {
|
|
27074
27152
|
switch (mark.type) {
|
|
27075
|
-
case
|
|
27153
|
+
case distExports.MARKS.BOLD:
|
|
27076
27154
|
return { type: 'bold' };
|
|
27077
|
-
case
|
|
27155
|
+
case distExports.MARKS.ITALIC:
|
|
27078
27156
|
return { type: 'italic' };
|
|
27079
|
-
case
|
|
27157
|
+
case distExports.MARKS.UNDERLINE:
|
|
27080
27158
|
return { type: 'underline' };
|
|
27081
|
-
case
|
|
27159
|
+
case distExports.MARKS.CODE:
|
|
27082
27160
|
return { type: 'code' };
|
|
27083
27161
|
default:
|
|
27084
27162
|
return null;
|
|
@@ -27108,27 +27186,27 @@ const tiptapToContentful = (tiptapDoc) => {
|
|
|
27108
27186
|
switch (node.type) {
|
|
27109
27187
|
case 'doc':
|
|
27110
27188
|
return {
|
|
27111
|
-
nodeType:
|
|
27189
|
+
nodeType: distExports.BLOCKS.DOCUMENT,
|
|
27112
27190
|
data: {},
|
|
27113
27191
|
content: (_a = node.content) === null || _a === void 0 ? void 0 : _a.map((child) => convertNode(child)),
|
|
27114
27192
|
};
|
|
27115
27193
|
case 'paragraph':
|
|
27116
27194
|
return {
|
|
27117
|
-
nodeType:
|
|
27195
|
+
nodeType: distExports.BLOCKS.PARAGRAPH,
|
|
27118
27196
|
data: {},
|
|
27119
27197
|
content: (_b = node.content) === null || _b === void 0 ? void 0 : _b.map((child) => convertNode(child)),
|
|
27120
27198
|
};
|
|
27121
27199
|
case 'heading':
|
|
27122
27200
|
const level = ((_c = node.attrs) === null || _c === void 0 ? void 0 : _c.level) || 1;
|
|
27123
27201
|
const headingTypes = {
|
|
27124
|
-
1:
|
|
27125
|
-
2:
|
|
27126
|
-
3:
|
|
27127
|
-
4:
|
|
27128
|
-
5:
|
|
27129
|
-
6:
|
|
27202
|
+
1: distExports.BLOCKS.HEADING_1,
|
|
27203
|
+
2: distExports.BLOCKS.HEADING_2,
|
|
27204
|
+
3: distExports.BLOCKS.HEADING_3,
|
|
27205
|
+
4: distExports.BLOCKS.HEADING_4,
|
|
27206
|
+
5: distExports.BLOCKS.HEADING_5,
|
|
27207
|
+
6: distExports.BLOCKS.HEADING_6,
|
|
27130
27208
|
};
|
|
27131
|
-
const headingType = headingTypes[level] ||
|
|
27209
|
+
const headingType = headingTypes[level] || distExports.BLOCKS.HEADING_1;
|
|
27132
27210
|
return {
|
|
27133
27211
|
nodeType: headingType,
|
|
27134
27212
|
data: {},
|
|
@@ -27136,55 +27214,55 @@ const tiptapToContentful = (tiptapDoc) => {
|
|
|
27136
27214
|
};
|
|
27137
27215
|
case 'bulletList':
|
|
27138
27216
|
return {
|
|
27139
|
-
nodeType:
|
|
27217
|
+
nodeType: distExports.BLOCKS.UL_LIST,
|
|
27140
27218
|
data: {},
|
|
27141
27219
|
content: (_e = node.content) === null || _e === void 0 ? void 0 : _e.map((child) => convertNode(child)),
|
|
27142
27220
|
};
|
|
27143
27221
|
case 'orderedList':
|
|
27144
27222
|
return {
|
|
27145
|
-
nodeType:
|
|
27223
|
+
nodeType: distExports.BLOCKS.OL_LIST,
|
|
27146
27224
|
data: {},
|
|
27147
27225
|
content: (_f = node.content) === null || _f === void 0 ? void 0 : _f.map((child) => convertNode(child)),
|
|
27148
27226
|
};
|
|
27149
27227
|
case 'listItem':
|
|
27150
27228
|
return {
|
|
27151
|
-
nodeType:
|
|
27229
|
+
nodeType: distExports.BLOCKS.LIST_ITEM,
|
|
27152
27230
|
data: {},
|
|
27153
27231
|
content: (_g = node.content) === null || _g === void 0 ? void 0 : _g.map((child) => convertNode(child)),
|
|
27154
27232
|
};
|
|
27155
27233
|
case 'blockquote':
|
|
27156
27234
|
return {
|
|
27157
|
-
nodeType:
|
|
27235
|
+
nodeType: distExports.BLOCKS.QUOTE,
|
|
27158
27236
|
data: {},
|
|
27159
27237
|
content: (_h = node.content) === null || _h === void 0 ? void 0 : _h.map((child) => convertNode(child)),
|
|
27160
27238
|
};
|
|
27161
27239
|
case 'horizontalRule':
|
|
27162
27240
|
return {
|
|
27163
|
-
nodeType:
|
|
27241
|
+
nodeType: distExports.BLOCKS.HR,
|
|
27164
27242
|
data: {},
|
|
27165
27243
|
content: [],
|
|
27166
27244
|
};
|
|
27167
27245
|
case 'table':
|
|
27168
27246
|
return {
|
|
27169
|
-
nodeType:
|
|
27247
|
+
nodeType: distExports.BLOCKS.TABLE,
|
|
27170
27248
|
data: {},
|
|
27171
27249
|
content: (_j = node.content) === null || _j === void 0 ? void 0 : _j.map((child) => convertNode(child)),
|
|
27172
27250
|
};
|
|
27173
27251
|
case 'tableRow':
|
|
27174
27252
|
return {
|
|
27175
|
-
nodeType:
|
|
27253
|
+
nodeType: distExports.BLOCKS.TABLE_ROW,
|
|
27176
27254
|
data: {},
|
|
27177
27255
|
content: (_k = node.content) === null || _k === void 0 ? void 0 : _k.map((child) => convertNode(child)),
|
|
27178
27256
|
};
|
|
27179
27257
|
case 'tableCell':
|
|
27180
27258
|
return {
|
|
27181
|
-
nodeType:
|
|
27259
|
+
nodeType: distExports.BLOCKS.TABLE_CELL,
|
|
27182
27260
|
data: {},
|
|
27183
27261
|
content: (_l = node.content) === null || _l === void 0 ? void 0 : _l.map((child) => convertNode(child)),
|
|
27184
27262
|
};
|
|
27185
27263
|
case 'tableHeader':
|
|
27186
27264
|
return {
|
|
27187
|
-
nodeType:
|
|
27265
|
+
nodeType: distExports.BLOCKS.TABLE_HEADER_CELL,
|
|
27188
27266
|
data: {},
|
|
27189
27267
|
content: (_m = node.content) === null || _m === void 0 ? void 0 : _m.map((child) => convertNode(child)),
|
|
27190
27268
|
};
|
|
@@ -27192,13 +27270,13 @@ const tiptapToContentful = (tiptapDoc) => {
|
|
|
27192
27270
|
const marks = ((_o = node.marks) === null || _o === void 0 ? void 0 : _o.map((mark) => {
|
|
27193
27271
|
switch (mark.type) {
|
|
27194
27272
|
case 'bold':
|
|
27195
|
-
return { type:
|
|
27273
|
+
return { type: distExports.MARKS.BOLD };
|
|
27196
27274
|
case 'italic':
|
|
27197
|
-
return { type:
|
|
27275
|
+
return { type: distExports.MARKS.ITALIC };
|
|
27198
27276
|
case 'underline':
|
|
27199
|
-
return { type:
|
|
27277
|
+
return { type: distExports.MARKS.UNDERLINE };
|
|
27200
27278
|
case 'code':
|
|
27201
|
-
return { type:
|
|
27279
|
+
return { type: distExports.MARKS.CODE };
|
|
27202
27280
|
case 'link':
|
|
27203
27281
|
return null; // Links are handled separately
|
|
27204
27282
|
default:
|
|
@@ -27209,7 +27287,7 @@ const tiptapToContentful = (tiptapDoc) => {
|
|
|
27209
27287
|
const linkMark = (_p = node.marks) === null || _p === void 0 ? void 0 : _p.find((mark) => mark.type === 'link');
|
|
27210
27288
|
if (linkMark) {
|
|
27211
27289
|
return {
|
|
27212
|
-
nodeType:
|
|
27290
|
+
nodeType: distExports.INLINES.HYPERLINK,
|
|
27213
27291
|
data: {
|
|
27214
27292
|
uri: ((_q = linkMark.attrs) === null || _q === void 0 ? void 0 : _q.href) || '',
|
|
27215
27293
|
},
|
|
@@ -27232,7 +27310,7 @@ const tiptapToContentful = (tiptapDoc) => {
|
|
|
27232
27310
|
default:
|
|
27233
27311
|
console.warn(`Unknown Tiptap node type: ${node.type}`);
|
|
27234
27312
|
return {
|
|
27235
|
-
nodeType:
|
|
27313
|
+
nodeType: distExports.BLOCKS.PARAGRAPH,
|
|
27236
27314
|
data: {},
|
|
27237
27315
|
content: [],
|
|
27238
27316
|
};
|
|
@@ -27247,7 +27325,7 @@ const validateContentfulDocument = (document) => {
|
|
|
27247
27325
|
if (!document || typeof document !== 'object') {
|
|
27248
27326
|
return false;
|
|
27249
27327
|
}
|
|
27250
|
-
if (document.nodeType !==
|
|
27328
|
+
if (document.nodeType !== distExports.BLOCKS.DOCUMENT) {
|
|
27251
27329
|
return false;
|
|
27252
27330
|
}
|
|
27253
27331
|
if (!Array.isArray(document.content)) {
|
|
@@ -27259,11 +27337,11 @@ const validateContentfulDocument = (document) => {
|
|
|
27259
27337
|
* Creates an empty Contentful document
|
|
27260
27338
|
*/
|
|
27261
27339
|
const createEmptyDocument = () => ({
|
|
27262
|
-
nodeType:
|
|
27340
|
+
nodeType: distExports.BLOCKS.DOCUMENT,
|
|
27263
27341
|
data: {},
|
|
27264
27342
|
content: [
|
|
27265
27343
|
{
|
|
27266
|
-
nodeType:
|
|
27344
|
+
nodeType: distExports.BLOCKS.PARAGRAPH,
|
|
27267
27345
|
data: {},
|
|
27268
27346
|
content: [],
|
|
27269
27347
|
},
|
|
@@ -27296,10 +27374,9 @@ const ContentfulRichTextEditor = ({ initialValue, onChange, onEmbedEntry, onEmbe
|
|
|
27296
27374
|
},
|
|
27297
27375
|
},
|
|
27298
27376
|
}));
|
|
27299
|
-
//
|
|
27300
|
-
|
|
27301
|
-
|
|
27302
|
-
}
|
|
27377
|
+
// Always add underline extension to schema to support content with underline marks
|
|
27378
|
+
// The availableMarks prop only controls toolbar visibility, not schema support
|
|
27379
|
+
extensions.push(Underline);
|
|
27303
27380
|
// Add other extensions
|
|
27304
27381
|
extensions.push(Link.configure({
|
|
27305
27382
|
openOnClick: false,
|