@contentful/field-editor-rich-text 3.16.10 → 3.16.12
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/cjs/ContentfulEditorProvider.js +8 -8
- package/dist/cjs/RichTextEditor.js +6 -4
- package/dist/cjs/SdkProvider.js +4 -2
- package/dist/cjs/SyncEditorChanges.js +4 -2
- package/dist/cjs/Toolbar/_tests_/toolbar.test.js +6 -4
- package/dist/cjs/Toolbar/components/EmbedEntityWidget.js +4 -2
- package/dist/cjs/Toolbar/components/EmbeddedEntityDropdownButton.js +4 -2
- package/dist/cjs/Toolbar/components/StickyToolbarWrapper.js +1 -1
- package/dist/cjs/Toolbar/index.js +5 -3
- package/dist/cjs/__fixtures__/FakeSdk.js +3 -3
- package/dist/cjs/__fixtures__/asset/index.js +5 -5
- package/dist/cjs/__fixtures__/entry/index.js +3 -3
- package/dist/cjs/__fixtures__/fixtures.js +3 -1
- package/dist/cjs/dialogs/HypelinkDialog/HyperlinkDialog.js +17 -15
- package/dist/cjs/dialogs/openRichTextDialog.js +4 -2
- package/dist/cjs/dialogs/renderRichTextDialog.js +3 -1
- package/dist/cjs/helpers/__tests__/removeInternalMarks.test.js +1 -1
- package/dist/cjs/helpers/editor.js +42 -42
- package/dist/cjs/helpers/environment.js +3 -3
- package/dist/cjs/helpers/formatDateAndTime.js +3 -3
- package/dist/cjs/helpers/nodeFactory.js +6 -6
- package/dist/cjs/helpers/sdkNavigatorSlideIn.js +1 -1
- package/dist/cjs/helpers/transformers.js +5 -5
- package/dist/cjs/helpers/validations.js +5 -5
- package/dist/cjs/index.js +6 -4
- package/dist/cjs/internal/constants.js +3 -1
- package/dist/cjs/internal/hooks.js +7 -5
- package/dist/cjs/internal/misc.js +12 -10
- package/dist/cjs/internal/queries.js +107 -105
- package/dist/cjs/internal/transforms.js +49 -47
- package/dist/cjs/plugins/Break/createExitBreakPlugin.test.js +1 -1
- package/dist/cjs/plugins/Break/createSoftBreakPlugin.test.js +1 -1
- package/dist/cjs/plugins/CommandPalette/components/CommandList.js +9 -7
- package/dist/cjs/plugins/CommandPalette/components/CommandPrompt.js +3 -1
- package/dist/cjs/plugins/CommandPalette/hooks/useCommandList.js +3 -1
- package/dist/cjs/plugins/CommandPalette/onKeyDown.spec.js +5 -3
- package/dist/cjs/plugins/CommandPalette/useCommands.js +2 -2
- package/dist/cjs/plugins/EmbeddedEntityBlock/LinkedEntityBlock.js +6 -4
- package/dist/cjs/plugins/EmbeddedEntityBlock/index.js +3 -3
- package/dist/cjs/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.js +7 -5
- package/dist/cjs/plugins/EmbeddedEntityInline/LinkedEntityInline.js +6 -4
- package/dist/cjs/plugins/EmbeddedResourceBlock/LinkedResourceBlock.js +2 -2
- package/dist/cjs/plugins/EmbeddedResourceInline/FetchingWrappedResourceInlineCard.js +7 -5
- package/dist/cjs/plugins/EmbeddedResourceInline/LinkedResourceInline.js +2 -2
- package/dist/cjs/plugins/Heading/components/Heading.js +3 -1
- package/dist/cjs/plugins/Heading/components/ToolbarHeadingButton.js +3 -1
- package/dist/cjs/plugins/Heading/createHeadingPlugin.js +1 -1
- package/dist/cjs/plugins/Hr/index.js +8 -6
- package/dist/cjs/plugins/Hyperlink/HyperlinkModal.js +7 -5
- package/dist/cjs/plugins/Hyperlink/components/EntityHyperlink.js +6 -4
- package/dist/cjs/plugins/Hyperlink/components/LinkPopover.js +4 -2
- package/dist/cjs/plugins/Hyperlink/components/ResourceHyperlink.js +6 -4
- package/dist/cjs/plugins/Hyperlink/components/ToolbarHyperlinkButton.js +3 -1
- package/dist/cjs/plugins/Hyperlink/components/UrlHyperlink.js +4 -2
- package/dist/cjs/plugins/Hyperlink/components/linkHandlers.js +3 -3
- package/dist/cjs/plugins/Hyperlink/createHyperlinkPlugin.js +4 -2
- package/dist/cjs/plugins/Hyperlink/useEntityInfo.js +3 -3
- package/dist/cjs/plugins/Hyperlink/useResourceEntityInfo.js +5 -3
- package/dist/cjs/plugins/Hyperlink/utils.js +4 -4
- package/dist/cjs/plugins/List/__tests__/insertListBreak.test.js +1 -1
- package/dist/cjs/plugins/List/__tests__/insertListFragment.test.js +1 -1
- package/dist/cjs/plugins/List/components/List.js +6 -4
- package/dist/cjs/plugins/List/components/ListItem.js +3 -1
- package/dist/cjs/plugins/List/components/ToolbarListButton.js +3 -1
- package/dist/cjs/plugins/List/insertListBreak.js +2 -2
- package/dist/cjs/plugins/List/insertListFragment.js +1 -1
- package/dist/cjs/plugins/List/onKeyDownList.js +1 -1
- package/dist/cjs/plugins/List/transforms/moveListItemDown.js +1 -1
- package/dist/cjs/plugins/List/transforms/moveListItems.js +1 -1
- package/dist/cjs/plugins/List/transforms/moveListItems.test.js +1 -1
- package/dist/cjs/plugins/List/transforms/toggleList.js +3 -3
- package/dist/cjs/plugins/List/transforms/toggleList.spec.js +9 -9
- package/dist/cjs/plugins/List/transforms/unwrapList.js +1 -1
- package/dist/cjs/plugins/List/utils.js +11 -11
- package/dist/cjs/plugins/List/withList.js +1 -1
- package/dist/cjs/plugins/Marks/Bold.js +6 -4
- package/dist/cjs/plugins/Marks/Code.js +6 -4
- package/dist/cjs/plugins/Marks/Italic.js +6 -4
- package/dist/cjs/plugins/Marks/Subscript.js +7 -5
- package/dist/cjs/plugins/Marks/Superscript.js +7 -5
- package/dist/cjs/plugins/Marks/Underline.js +3 -1
- package/dist/cjs/plugins/Marks/components/MarkToolbarButton.js +5 -3
- package/dist/cjs/plugins/Marks/helpers.js +4 -4
- package/dist/cjs/plugins/Normalizer/createNormalizerPlugin.test.js +3 -3
- package/dist/cjs/plugins/Normalizer/utils.js +3 -3
- package/dist/cjs/plugins/Normalizer/withNormalizer.js +2 -2
- package/dist/cjs/plugins/Paragraph/Paragraph.js +3 -1
- package/dist/cjs/plugins/Paragraph/createParagraphPlugin.js +1 -1
- package/dist/cjs/plugins/PasteHTML/createPasteHTMLPlugin.js +5 -5
- package/dist/cjs/plugins/Quote/components/Quote.js +3 -1
- package/dist/cjs/plugins/Quote/components/ToolbarQuoteButton.js +3 -1
- package/dist/cjs/plugins/Quote/toggleQuote.js +4 -4
- package/dist/cjs/plugins/Quote/withQuote.js +2 -2
- package/dist/cjs/plugins/Table/__tests__/helpers.test.js +1 -1
- package/dist/cjs/plugins/Table/actions/addColumn.js +4 -4
- package/dist/cjs/plugins/Table/actions/addRow.js +3 -3
- package/dist/cjs/plugins/Table/components/Cell.js +3 -1
- package/dist/cjs/plugins/Table/components/HeaderCell.js +3 -1
- package/dist/cjs/plugins/Table/components/Row.js +3 -1
- package/dist/cjs/plugins/Table/components/Table.js +3 -1
- package/dist/cjs/plugins/Table/components/TableActions.js +6 -4
- package/dist/cjs/plugins/Table/components/ToolbarButton.js +3 -1
- package/dist/cjs/plugins/Table/createTablePlugin.js +1 -1
- package/dist/cjs/plugins/Table/helpers.js +12 -12
- package/dist/cjs/plugins/Table/insertTableFragment.js +1 -1
- package/dist/cjs/plugins/Table/onKeyDownTable.js +2 -2
- package/dist/cjs/plugins/Table/tableTracking.js +6 -6
- package/dist/cjs/plugins/Text/__tests__/createTextPlugin.test.js +2 -2
- package/dist/cjs/plugins/Text/createTextPlugin.js +3 -3
- package/dist/cjs/plugins/Tracking/createTrackingPlugin.js +4 -4
- package/dist/cjs/plugins/Tracking/utils.js +3 -1
- package/dist/cjs/plugins/index.js +3 -3
- package/dist/cjs/plugins/shared/EmbeddedBlockToolbarIcon.js +7 -5
- package/dist/cjs/plugins/shared/EmbeddedBlockUtil.js +5 -5
- package/dist/cjs/plugins/shared/EmbeddedInlineToolbarIcon.js +4 -2
- package/dist/cjs/plugins/shared/EmbeddedInlineUtil.js +4 -4
- package/dist/cjs/plugins/shared/FetchingWrappedAssetCard.js +6 -4
- package/dist/cjs/plugins/shared/FetchingWrappedEntryCard.js +7 -5
- package/dist/cjs/plugins/shared/FetchingWrappedResourceCard.js +6 -4
- package/dist/cjs/plugins/shared/LinkedBlockWrapper.js +1 -1
- package/dist/cjs/plugins/shared/LinkedInlineWrapper.js +4 -2
- package/dist/cjs/plugins/shared/ResourceNewBadge.js +3 -1
- package/dist/cjs/plugins/shared/ToolbarButton.js +4 -2
- package/dist/cjs/plugins/shared/__tests__/FetchingWrappedAssetCard.test.js +4 -2
- package/dist/cjs/plugins/shared/__tests__/FetchingWrappedEntryCard.test.js +4 -2
- package/dist/cjs/plugins/shared/__tests__/FetchingWrappedResourceCard.test.js +9 -7
- package/dist/cjs/test-utils/validation.js +3 -3
- package/dist/esm/ContentfulEditorProvider.js +1 -1
- package/dist/esm/RichTextEditor.js +3 -3
- package/dist/esm/SdkProvider.js +1 -1
- package/dist/esm/SyncEditorChanges.js +1 -1
- package/dist/esm/Toolbar/_tests_/toolbar.test.js +3 -3
- package/dist/esm/Toolbar/components/EmbedEntityWidget.js +1 -1
- package/dist/esm/Toolbar/components/EmbeddedEntityDropdownButton.js +1 -1
- package/dist/esm/Toolbar/components/StickyToolbarWrapper.js +1 -1
- package/dist/esm/Toolbar/index.js +2 -2
- package/dist/esm/__fixtures__/FakeSdk.js +3 -3
- package/dist/esm/dialogs/HypelinkDialog/HyperlinkDialog.js +11 -11
- package/dist/esm/dialogs/openRichTextDialog.js +1 -1
- package/dist/esm/helpers/__tests__/removeInternalMarks.test.js +1 -1
- package/dist/esm/helpers/editor.js +3 -3
- package/dist/esm/helpers/sdkNavigatorSlideIn.js +1 -1
- package/dist/esm/plugins/Break/createExitBreakPlugin.test.js +1 -1
- package/dist/esm/plugins/Break/createSoftBreakPlugin.test.js +1 -1
- package/dist/esm/plugins/CommandPalette/components/CommandList.js +6 -6
- package/dist/esm/plugins/CommandPalette/onKeyDown.spec.js +2 -2
- package/dist/esm/plugins/CommandPalette/useCommands.js +2 -2
- package/dist/esm/plugins/EmbeddedEntityBlock/LinkedEntityBlock.js +3 -3
- package/dist/esm/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.js +4 -4
- package/dist/esm/plugins/EmbeddedEntityInline/LinkedEntityInline.js +3 -3
- package/dist/esm/plugins/EmbeddedResourceBlock/LinkedResourceBlock.js +2 -2
- package/dist/esm/plugins/EmbeddedResourceInline/FetchingWrappedResourceInlineCard.js +4 -4
- package/dist/esm/plugins/EmbeddedResourceInline/LinkedResourceInline.js +2 -2
- package/dist/esm/plugins/Heading/createHeadingPlugin.js +1 -1
- package/dist/esm/plugins/Hyperlink/HyperlinkModal.js +4 -4
- package/dist/esm/plugins/Hyperlink/components/EntityHyperlink.js +3 -3
- package/dist/esm/plugins/Hyperlink/components/LinkPopover.js +1 -1
- package/dist/esm/plugins/Hyperlink/components/ResourceHyperlink.js +3 -3
- package/dist/esm/plugins/Hyperlink/components/UrlHyperlink.js +1 -1
- package/dist/esm/plugins/Hyperlink/createHyperlinkPlugin.js +1 -1
- package/dist/esm/plugins/Hyperlink/useEntityInfo.js +3 -3
- package/dist/esm/plugins/Hyperlink/useResourceEntityInfo.js +2 -2
- package/dist/esm/plugins/Hyperlink/utils.js +1 -1
- package/dist/esm/plugins/List/__tests__/insertListBreak.test.js +1 -1
- package/dist/esm/plugins/List/__tests__/insertListFragment.test.js +1 -1
- package/dist/esm/plugins/List/insertListBreak.js +2 -2
- package/dist/esm/plugins/List/insertListFragment.js +1 -1
- package/dist/esm/plugins/List/onKeyDownList.js +1 -1
- package/dist/esm/plugins/List/transforms/moveListItemDown.js +1 -1
- package/dist/esm/plugins/List/transforms/moveListItems.js +1 -1
- package/dist/esm/plugins/List/transforms/moveListItems.test.js +1 -1
- package/dist/esm/plugins/List/transforms/toggleList.js +3 -3
- package/dist/esm/plugins/List/transforms/toggleList.spec.js +9 -9
- package/dist/esm/plugins/List/transforms/unwrapList.js +1 -1
- package/dist/esm/plugins/List/utils.js +1 -1
- package/dist/esm/plugins/List/withList.js +1 -1
- package/dist/esm/plugins/Marks/components/MarkToolbarButton.js +2 -2
- package/dist/esm/plugins/Marks/helpers.js +1 -1
- package/dist/esm/plugins/Normalizer/createNormalizerPlugin.test.js +3 -3
- package/dist/esm/plugins/Normalizer/withNormalizer.js +2 -2
- package/dist/esm/plugins/Paragraph/createParagraphPlugin.js +1 -1
- package/dist/esm/plugins/PasteHTML/createPasteHTMLPlugin.js +1 -1
- package/dist/esm/plugins/Quote/toggleQuote.js +1 -1
- package/dist/esm/plugins/Quote/withQuote.js +2 -2
- package/dist/esm/plugins/Table/__tests__/helpers.test.js +1 -1
- package/dist/esm/plugins/Table/actions/addColumn.js +1 -1
- package/dist/esm/plugins/Table/createTablePlugin.js +1 -1
- package/dist/esm/plugins/Table/insertTableFragment.js +1 -1
- package/dist/esm/plugins/Table/onKeyDownTable.js +2 -2
- package/dist/esm/plugins/Table/tableTracking.js +6 -6
- package/dist/esm/plugins/Text/__tests__/createTextPlugin.test.js +2 -2
- package/dist/esm/plugins/Text/createTextPlugin.js +3 -3
- package/dist/esm/plugins/Tracking/createTrackingPlugin.js +1 -1
- package/dist/esm/plugins/shared/EmbeddedBlockToolbarIcon.js +1 -1
- package/dist/esm/plugins/shared/EmbeddedBlockUtil.js +5 -5
- package/dist/esm/plugins/shared/EmbeddedInlineToolbarIcon.js +1 -1
- package/dist/esm/plugins/shared/EmbeddedInlineUtil.js +4 -4
- package/dist/esm/plugins/shared/FetchingWrappedAssetCard.js +3 -3
- package/dist/esm/plugins/shared/FetchingWrappedEntryCard.js +4 -4
- package/dist/esm/plugins/shared/FetchingWrappedResourceCard.js +3 -3
- package/dist/esm/plugins/shared/LinkedBlockWrapper.js +1 -1
- package/dist/esm/plugins/shared/LinkedInlineWrapper.js +1 -1
- package/dist/esm/plugins/shared/ToolbarButton.js +1 -1
- package/dist/esm/plugins/shared/__tests__/FetchingWrappedAssetCard.test.js +1 -1
- package/dist/esm/plugins/shared/__tests__/FetchingWrappedEntryCard.test.js +1 -1
- package/dist/esm/plugins/shared/__tests__/FetchingWrappedResourceCard.test.js +6 -6
- package/dist/esm/test-utils/validation.js +3 -3
- package/package.json +5 -5
|
@@ -51,7 +51,7 @@ describe('insert fragment', ()=>{
|
|
|
51
51
|
const render = (children)=>(0, _testutils.jsx)("editor", null, children, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
52
52
|
for (const t of tests){
|
|
53
53
|
test(t.title, ()=>{
|
|
54
|
-
const { editor
|
|
54
|
+
const { editor } = (0, _testutils.createTestEditor)({
|
|
55
55
|
input: render(t.input)
|
|
56
56
|
});
|
|
57
57
|
editor.insertFragment(t.fragment);
|
|
@@ -9,11 +9,11 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
ListUL: function() {
|
|
13
|
-
return ListUL;
|
|
14
|
-
},
|
|
15
12
|
ListOL: function() {
|
|
16
13
|
return ListOL;
|
|
14
|
+
},
|
|
15
|
+
ListUL: function() {
|
|
16
|
+
return ListUL;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
const _react = _interop_require_wildcard(require("react"));
|
|
@@ -46,7 +46,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
46
46
|
if (cache && cache.has(obj)) {
|
|
47
47
|
return cache.get(obj);
|
|
48
48
|
}
|
|
49
|
-
var newObj = {
|
|
49
|
+
var newObj = {
|
|
50
|
+
__proto__: null
|
|
51
|
+
};
|
|
50
52
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
51
53
|
for(var key in obj){
|
|
52
54
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -37,7 +37,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
37
37
|
if (cache && cache.has(obj)) {
|
|
38
38
|
return cache.get(obj);
|
|
39
39
|
}
|
|
40
|
-
var newObj = {
|
|
40
|
+
var newObj = {
|
|
41
|
+
__proto__: null
|
|
42
|
+
};
|
|
41
43
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
42
44
|
for(var key in obj){
|
|
43
45
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -39,7 +39,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
39
39
|
if (cache && cache.has(obj)) {
|
|
40
40
|
return cache.get(obj);
|
|
41
41
|
}
|
|
42
|
-
var newObj = {
|
|
42
|
+
var newObj = {
|
|
43
|
+
__proto__: null
|
|
44
|
+
};
|
|
43
45
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
44
46
|
for(var key in obj){
|
|
45
47
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -18,7 +18,7 @@ const listBreak = (editor)=>{
|
|
|
18
18
|
const res = (0, _platelist.getListItemEntry)(editor, {});
|
|
19
19
|
let moved;
|
|
20
20
|
if (res) {
|
|
21
|
-
const { list
|
|
21
|
+
const { list, listItem } = res;
|
|
22
22
|
const childNode = listItem[0].children[0];
|
|
23
23
|
if ((0, _platecommon.isBlockAboveEmpty)(editor) && listItem[0].children.length === 1 && _richtexttypes.TEXT_CONTAINERS.includes(childNode.type)) {
|
|
24
24
|
moved = (0, _platelist.moveListItemUp)(editor, {
|
|
@@ -52,7 +52,7 @@ const listBreak = (editor)=>{
|
|
|
52
52
|
return false;
|
|
53
53
|
};
|
|
54
54
|
const insertListBreak = (editor)=>{
|
|
55
|
-
const { insertBreak
|
|
55
|
+
const { insertBreak } = editor;
|
|
56
56
|
return ()=>{
|
|
57
57
|
if (listBreak(editor)) return;
|
|
58
58
|
insertBreak();
|
|
@@ -17,7 +17,7 @@ function _interop_require_default(obj) {
|
|
|
17
17
|
default: obj
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
const onKeyDownList = (editor, { type
|
|
20
|
+
const onKeyDownList = (editor, { type, options: { hotkey } })=>(e)=>{
|
|
21
21
|
if (e.key === 'Tab' && editor.selection) {
|
|
22
22
|
const listSelected = (0, _queries.getAboveNode)(editor, {
|
|
23
23
|
at: editor.selection,
|
|
@@ -12,7 +12,7 @@ const _platelist = require("@udecode/plate-list");
|
|
|
12
12
|
const _internal = require("../../../internal");
|
|
13
13
|
const _queries = require("../../../internal/queries");
|
|
14
14
|
const _transforms = require("../../../internal/transforms");
|
|
15
|
-
const moveListItemDown = (editor, { list
|
|
15
|
+
const moveListItemDown = (editor, { list, listItem })=>{
|
|
16
16
|
const [listNode] = list;
|
|
17
17
|
const [, listItemPath] = listItem;
|
|
18
18
|
let previousListItemPath;
|
|
@@ -12,7 +12,7 @@ const _platelist = require("@udecode/plate-list");
|
|
|
12
12
|
const _internal = require("../../../internal");
|
|
13
13
|
const _queries = require("../../../internal/queries");
|
|
14
14
|
const _moveListItemDown = require("./moveListItemDown");
|
|
15
|
-
const moveListItems = (editor, { increase =true
|
|
15
|
+
const moveListItems = (editor, { increase = true, at = editor.selection ?? undefined } = {})=>{
|
|
16
16
|
const _nodes = (0, _queries.getNodeEntries)(editor, {
|
|
17
17
|
at,
|
|
18
18
|
match: {
|
|
@@ -8,7 +8,7 @@ describe('moving list items (up/down)', ()=>{
|
|
|
8
8
|
const renderEditor = (children)=>(0, _testutils.jsx)("editor", null, children, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
9
9
|
const assertTab = (t, shift = false)=>{
|
|
10
10
|
test(t.title, ()=>{
|
|
11
|
-
const { editor
|
|
11
|
+
const { editor } = (0, _testutils.createTestEditor)({
|
|
12
12
|
input: renderEditor(t.input)
|
|
13
13
|
});
|
|
14
14
|
(0, _moveListItems.moveListItems)(editor, {
|
|
@@ -19,14 +19,14 @@ const listTypes = [
|
|
|
19
19
|
_richtexttypes.BLOCKS.UL_LIST,
|
|
20
20
|
_richtexttypes.BLOCKS.OL_LIST
|
|
21
21
|
];
|
|
22
|
-
const toggleList = (editor, { type
|
|
22
|
+
const toggleList = (editor, { type })=>(0, _internal.withoutNormalizing)(editor, ()=>{
|
|
23
23
|
if (!editor.selection) {
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
if ((0, _queries.isRangeCollapsed)(editor.selection) || !(0, _queries.isRangeAcrossBlocks)(editor)) {
|
|
27
27
|
const res = (0, _platelist.getListItemEntry)(editor);
|
|
28
28
|
if (res) {
|
|
29
|
-
const { list
|
|
29
|
+
const { list } = res;
|
|
30
30
|
if (list[0].type !== type) {
|
|
31
31
|
(0, _transforms.setNodes)(editor, {
|
|
32
32
|
type
|
|
@@ -69,7 +69,7 @@ const toggleList = (editor, { type })=>(0, _internal.withoutNormalizing)(editor
|
|
|
69
69
|
if (listTypes.includes(commonEntry[0].type) || commonEntry[0].type === _richtexttypes.BLOCKS.LIST_ITEM) {
|
|
70
70
|
let listType = commonEntry[0].type;
|
|
71
71
|
if (commonEntry[0].type === _richtexttypes.BLOCKS.LIST_ITEM) {
|
|
72
|
-
listType = (
|
|
72
|
+
listType = (0, _queries.getParentNode)(editor, commonEntry[1])?.[0]?.type;
|
|
73
73
|
}
|
|
74
74
|
if (listType !== type) {
|
|
75
75
|
const startList = (0, _queries.findNode)(editor, {
|
|
@@ -9,7 +9,7 @@ describe('toggle on', ()=>{
|
|
|
9
9
|
it('should turn a p to list', ()=>{
|
|
10
10
|
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, "1", (0, _testutils.jsx)("cursor", null)));
|
|
11
11
|
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1", (0, _testutils.jsx)("cursor", null)))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
12
|
-
const { editor
|
|
12
|
+
const { editor } = (0, _testutils.createTestEditor)({
|
|
13
13
|
input
|
|
14
14
|
});
|
|
15
15
|
(0, _toggleList.toggleList)(editor, {
|
|
@@ -23,7 +23,7 @@ describe('toggle on', ()=>{
|
|
|
23
23
|
it('should turn a p with a selection to list', ()=>{
|
|
24
24
|
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, "Planetas ", (0, _testutils.jsx)("anchor", null), "mori in", (0, _testutils.jsx)("focus", null), " gandavum!"));
|
|
25
25
|
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "Planetas ", (0, _testutils.jsx)("anchor", null), "mori in", (0, _testutils.jsx)("focus", null), " gandavum!"))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
26
|
-
const { editor
|
|
26
|
+
const { editor } = (0, _testutils.createTestEditor)({
|
|
27
27
|
input
|
|
28
28
|
});
|
|
29
29
|
(0, _toggleList.toggleList)(editor, {
|
|
@@ -37,7 +37,7 @@ describe('toggle on', ()=>{
|
|
|
37
37
|
it('should turn multiple p to list', ()=>{
|
|
38
38
|
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("anchor", null), "1"), (0, _testutils.jsx)("hp", null, "2"), (0, _testutils.jsx)("hp", null, "3", (0, _testutils.jsx)("focus", null)));
|
|
39
39
|
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("anchor", null), "1")), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "2")), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "3", (0, _testutils.jsx)("focus", null)))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
40
|
-
const { editor
|
|
40
|
+
const { editor } = (0, _testutils.createTestEditor)({
|
|
41
41
|
input
|
|
42
42
|
});
|
|
43
43
|
(0, _toggleList.toggleList)(editor, {
|
|
@@ -53,7 +53,7 @@ describe('toggle off', ()=>{
|
|
|
53
53
|
it('should split a simple list to two', ()=>{
|
|
54
54
|
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1")), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "2", (0, _testutils.jsx)("cursor", null))), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "3"))));
|
|
55
55
|
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1"))), (0, _testutils.jsx)("hp", null, "2", (0, _testutils.jsx)("cursor", null)), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "3"))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
56
|
-
const { editor
|
|
56
|
+
const { editor } = (0, _testutils.createTestEditor)({
|
|
57
57
|
input
|
|
58
58
|
});
|
|
59
59
|
(0, _toggleList.toggleList)(editor, {
|
|
@@ -67,7 +67,7 @@ describe('toggle off', ()=>{
|
|
|
67
67
|
it('should split a nested list', ()=>{
|
|
68
68
|
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "11")), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "12", (0, _testutils.jsx)("cursor", null))), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "13"))))));
|
|
69
69
|
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "11"))))), (0, _testutils.jsx)("hp", null, "12", (0, _testutils.jsx)("cursor", null)), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "13"))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
70
|
-
const { editor
|
|
70
|
+
const { editor } = (0, _testutils.createTestEditor)({
|
|
71
71
|
input
|
|
72
72
|
});
|
|
73
73
|
(0, _toggleList.toggleList)(editor, {
|
|
@@ -81,7 +81,7 @@ describe('toggle off', ()=>{
|
|
|
81
81
|
it('should turn a list to multiple p', ()=>{
|
|
82
82
|
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("anchor", null), "1")), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "2")), (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "3", (0, _testutils.jsx)("focus", null)))));
|
|
83
83
|
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("anchor", null), "1"), (0, _testutils.jsx)("hp", null, "2"), (0, _testutils.jsx)("hp", null, "3", (0, _testutils.jsx)("focus", null)));
|
|
84
|
-
const { editor
|
|
84
|
+
const { editor } = (0, _testutils.createTestEditor)({
|
|
85
85
|
input
|
|
86
86
|
});
|
|
87
87
|
(0, _toggleList.toggleList)(editor, {
|
|
@@ -97,7 +97,7 @@ describe('toggle over', ()=>{
|
|
|
97
97
|
it('should toggle different list types', ()=>{
|
|
98
98
|
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1", (0, _testutils.jsx)("cursor", null)))));
|
|
99
99
|
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hol", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1"))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
100
|
-
const { editor
|
|
100
|
+
const { editor } = (0, _testutils.createTestEditor)({
|
|
101
101
|
input
|
|
102
102
|
});
|
|
103
103
|
(0, _toggleList.toggleList)(editor, {
|
|
@@ -111,7 +111,7 @@ describe('toggle over', ()=>{
|
|
|
111
111
|
it('should only toggle the nested list', ()=>{
|
|
112
112
|
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "11", (0, _testutils.jsx)("cursor", null)))))));
|
|
113
113
|
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "1"), (0, _testutils.jsx)("hol", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "11", (0, _testutils.jsx)("cursor", null)))))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
114
|
-
const { editor
|
|
114
|
+
const { editor } = (0, _testutils.createTestEditor)({
|
|
115
115
|
input
|
|
116
116
|
});
|
|
117
117
|
(0, _toggleList.toggleList)(editor, {
|
|
@@ -125,7 +125,7 @@ describe('toggle over', ()=>{
|
|
|
125
125
|
it('should only toggle everything that is selected', ()=>{
|
|
126
126
|
const input = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("anchor", null), "1"), (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "11", (0, _testutils.jsx)("focus", null)))))));
|
|
127
127
|
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hol", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("anchor", null), "1"), (0, _testutils.jsx)("hol", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "11", (0, _testutils.jsx)("focus", null)))))), (0, _testutils.jsx)("hp", null, (0, _testutils.jsx)("htext", null)));
|
|
128
|
-
const { editor
|
|
128
|
+
const { editor } = (0, _testutils.createTestEditor)({
|
|
129
129
|
input
|
|
130
130
|
});
|
|
131
131
|
(0, _toggleList.toggleList)(editor, {
|
|
@@ -18,7 +18,7 @@ function hasUnliftedListItems(editor, at) {
|
|
|
18
18
|
match: (node, path)=>(0, _queries.isElement)(node) && node.type === _richtexttypes.BLOCKS.LIST_ITEM && path.length >= 2
|
|
19
19
|
}).next().done;
|
|
20
20
|
}
|
|
21
|
-
const unwrapList = (editor, { at
|
|
21
|
+
const unwrapList = (editor, { at } = {})=>{
|
|
22
22
|
(0, _internal.withoutNormalizing)(editor, ()=>{
|
|
23
23
|
do {
|
|
24
24
|
(0, _transforms.liftNodes)(editor, {
|
|
@@ -9,26 +9,26 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
+
firstNodeIsNotList: function() {
|
|
13
|
+
return firstNodeIsNotList;
|
|
14
|
+
},
|
|
12
15
|
hasListAsDirectParent: function() {
|
|
13
16
|
return hasListAsDirectParent;
|
|
14
17
|
},
|
|
15
|
-
|
|
16
|
-
return
|
|
18
|
+
insertParagraphAsChild: function() {
|
|
19
|
+
return insertParagraphAsChild;
|
|
20
|
+
},
|
|
21
|
+
isListTypeActive: function() {
|
|
22
|
+
return isListTypeActive;
|
|
17
23
|
},
|
|
18
24
|
isNonEmptyListItem: function() {
|
|
19
25
|
return isNonEmptyListItem;
|
|
20
26
|
},
|
|
21
|
-
|
|
22
|
-
return
|
|
23
|
-
},
|
|
24
|
-
insertParagraphAsChild: function() {
|
|
25
|
-
return insertParagraphAsChild;
|
|
27
|
+
normalizeOrphanedListItem: function() {
|
|
28
|
+
return normalizeOrphanedListItem;
|
|
26
29
|
},
|
|
27
30
|
replaceNodeWithListItems: function() {
|
|
28
31
|
return replaceNodeWithListItems;
|
|
29
|
-
},
|
|
30
|
-
isListTypeActive: function() {
|
|
31
|
-
return isListTypeActive;
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
const _richtexttypes = require("@contentful/rich-text-types");
|
|
@@ -98,7 +98,7 @@ const replaceNodeWithListItems = (editor, entry)=>{
|
|
|
98
98
|
});
|
|
99
99
|
};
|
|
100
100
|
const isListTypeActive = (editor, type)=>{
|
|
101
|
-
const { selection
|
|
101
|
+
const { selection } = editor;
|
|
102
102
|
if (!selection) {
|
|
103
103
|
return false;
|
|
104
104
|
}
|
|
@@ -14,7 +14,7 @@ const _insertListBreak = require("./insertListBreak");
|
|
|
14
14
|
const _insertListFragment = require("./insertListFragment");
|
|
15
15
|
const validLiChildrenTypes = _richtexttypes.LIST_ITEM_BLOCKS;
|
|
16
16
|
const withList = (editor)=>{
|
|
17
|
-
const { deleteForward
|
|
17
|
+
const { deleteForward, deleteFragment } = editor;
|
|
18
18
|
editor.deleteForward = (unit)=>{
|
|
19
19
|
if ((0, _platelist.deleteForwardList)(editor)) return;
|
|
20
20
|
deleteForward(unit);
|
|
@@ -9,12 +9,12 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
ToolbarBoldButton: function() {
|
|
13
|
-
return ToolbarBoldButton;
|
|
14
|
-
},
|
|
15
12
|
Bold: function() {
|
|
16
13
|
return Bold;
|
|
17
14
|
},
|
|
15
|
+
ToolbarBoldButton: function() {
|
|
16
|
+
return ToolbarBoldButton;
|
|
17
|
+
},
|
|
18
18
|
createBoldPlugin: function() {
|
|
19
19
|
return createBoldPlugin;
|
|
20
20
|
}
|
|
@@ -48,7 +48,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
48
48
|
if (cache && cache.has(obj)) {
|
|
49
49
|
return cache.get(obj);
|
|
50
50
|
}
|
|
51
|
-
var newObj = {
|
|
51
|
+
var newObj = {
|
|
52
|
+
__proto__: null
|
|
53
|
+
};
|
|
52
54
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
53
55
|
for(var key in obj){
|
|
54
56
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -9,15 +9,15 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
+
Code: function() {
|
|
13
|
+
return Code;
|
|
14
|
+
},
|
|
12
15
|
ToolbarCodeButton: function() {
|
|
13
16
|
return ToolbarCodeButton;
|
|
14
17
|
},
|
|
15
18
|
ToolbarDropdownCodeButton: function() {
|
|
16
19
|
return ToolbarDropdownCodeButton;
|
|
17
20
|
},
|
|
18
|
-
Code: function() {
|
|
19
|
-
return Code;
|
|
20
|
-
},
|
|
21
21
|
createCodePlugin: function() {
|
|
22
22
|
return createCodePlugin;
|
|
23
23
|
}
|
|
@@ -50,7 +50,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
50
50
|
if (cache && cache.has(obj)) {
|
|
51
51
|
return cache.get(obj);
|
|
52
52
|
}
|
|
53
|
-
var newObj = {
|
|
53
|
+
var newObj = {
|
|
54
|
+
__proto__: null
|
|
55
|
+
};
|
|
54
56
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
55
57
|
for(var key in obj){
|
|
56
58
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -9,12 +9,12 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
ToolbarItalicButton: function() {
|
|
13
|
-
return ToolbarItalicButton;
|
|
14
|
-
},
|
|
15
12
|
Italic: function() {
|
|
16
13
|
return Italic;
|
|
17
14
|
},
|
|
15
|
+
ToolbarItalicButton: function() {
|
|
16
|
+
return ToolbarItalicButton;
|
|
17
|
+
},
|
|
18
18
|
createItalicPlugin: function() {
|
|
19
19
|
return createItalicPlugin;
|
|
20
20
|
}
|
|
@@ -48,7 +48,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
48
48
|
if (cache && cache.has(obj)) {
|
|
49
49
|
return cache.get(obj);
|
|
50
50
|
}
|
|
51
|
-
var newObj = {
|
|
51
|
+
var newObj = {
|
|
52
|
+
__proto__: null
|
|
53
|
+
};
|
|
52
54
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
53
55
|
for(var key in obj){
|
|
54
56
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -9,14 +9,14 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
|
|
13
|
-
return
|
|
12
|
+
Subscript: function() {
|
|
13
|
+
return Subscript;
|
|
14
14
|
},
|
|
15
15
|
ToolbarDropdownSubscriptButton: function() {
|
|
16
16
|
return ToolbarDropdownSubscriptButton;
|
|
17
17
|
},
|
|
18
|
-
|
|
19
|
-
return
|
|
18
|
+
ToolbarSubscriptButton: function() {
|
|
19
|
+
return ToolbarSubscriptButton;
|
|
20
20
|
},
|
|
21
21
|
createSubscriptPlugin: function() {
|
|
22
22
|
return createSubscriptPlugin;
|
|
@@ -50,7 +50,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
50
50
|
if (cache && cache.has(obj)) {
|
|
51
51
|
return cache.get(obj);
|
|
52
52
|
}
|
|
53
|
-
var newObj = {
|
|
53
|
+
var newObj = {
|
|
54
|
+
__proto__: null
|
|
55
|
+
};
|
|
54
56
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
55
57
|
for(var key in obj){
|
|
56
58
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -9,14 +9,14 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
|
|
13
|
-
return
|
|
12
|
+
Superscript: function() {
|
|
13
|
+
return Superscript;
|
|
14
14
|
},
|
|
15
15
|
ToolbarDropdownSuperscriptButton: function() {
|
|
16
16
|
return ToolbarDropdownSuperscriptButton;
|
|
17
17
|
},
|
|
18
|
-
|
|
19
|
-
return
|
|
18
|
+
ToolbarSuperscriptButton: function() {
|
|
19
|
+
return ToolbarSuperscriptButton;
|
|
20
20
|
},
|
|
21
21
|
createSuperscriptPlugin: function() {
|
|
22
22
|
return createSuperscriptPlugin;
|
|
@@ -50,7 +50,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
50
50
|
if (cache && cache.has(obj)) {
|
|
51
51
|
return cache.get(obj);
|
|
52
52
|
}
|
|
53
|
-
var newObj = {
|
|
53
|
+
var newObj = {
|
|
54
|
+
__proto__: null
|
|
55
|
+
};
|
|
54
56
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
55
57
|
for(var key in obj){
|
|
56
58
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -47,7 +47,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
47
47
|
if (cache && cache.has(obj)) {
|
|
48
48
|
return cache.get(obj);
|
|
49
49
|
}
|
|
50
|
-
var newObj = {
|
|
50
|
+
var newObj = {
|
|
51
|
+
__proto__: null
|
|
52
|
+
};
|
|
51
53
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
52
54
|
for(var key in obj){
|
|
53
55
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -43,7 +43,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
43
43
|
if (cache && cache.has(obj)) {
|
|
44
44
|
return cache.get(obj);
|
|
45
45
|
}
|
|
46
|
-
var newObj = {
|
|
46
|
+
var newObj = {
|
|
47
|
+
__proto__: null
|
|
48
|
+
};
|
|
47
49
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
48
50
|
for(var key in obj){
|
|
49
51
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -67,8 +69,8 @@ const styles = {
|
|
|
67
69
|
color: _f36tokens.default.blue600
|
|
68
70
|
})
|
|
69
71
|
};
|
|
70
|
-
const createMarkToolbarButton = ({ mark
|
|
71
|
-
const Mark = ({ isDisabled
|
|
72
|
+
const createMarkToolbarButton = ({ mark, title, icon })=>{
|
|
73
|
+
const Mark = ({ isDisabled })=>{
|
|
72
74
|
const editor = (0, _ContentfulEditorProvider.useContentfulEditor)();
|
|
73
75
|
const handleClick = _react.useCallback(()=>{
|
|
74
76
|
if (!editor?.selection) return;
|
|
@@ -9,11 +9,11 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
toggleMarkAndDeactivateConflictingMarks: function() {
|
|
13
|
-
return toggleMarkAndDeactivateConflictingMarks;
|
|
14
|
-
},
|
|
15
12
|
buildMarkEventHandler: function() {
|
|
16
13
|
return buildMarkEventHandler;
|
|
14
|
+
},
|
|
15
|
+
toggleMarkAndDeactivateConflictingMarks: function() {
|
|
16
|
+
return toggleMarkAndDeactivateConflictingMarks;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
const _richtexttypes = require("@contentful/rich-text-types");
|
|
@@ -36,7 +36,7 @@ const toggleMarkAndDeactivateConflictingMarks = (editor, mark)=>{
|
|
|
36
36
|
clear
|
|
37
37
|
});
|
|
38
38
|
};
|
|
39
|
-
const buildMarkEventHandler = (type)=>(editor, { options: { hotkey
|
|
39
|
+
const buildMarkEventHandler = (type)=>(editor, { options: { hotkey } })=>(event)=>{
|
|
40
40
|
if (editor.selection && hotkey && (0, _ishotkey.default)(hotkey, event)) {
|
|
41
41
|
event.preventDefault();
|
|
42
42
|
const isActive = (0, _queries.isMarkActive)(editor, type);
|
|
@@ -24,7 +24,7 @@ describe('Normalizer', ()=>{
|
|
|
24
24
|
const expected = (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hp", null, "List item"))));
|
|
25
25
|
describe('rule.match', ()=>{
|
|
26
26
|
it('matches elements of type "plugin.type" by default', ()=>{
|
|
27
|
-
const { editor
|
|
27
|
+
const { editor } = (0, _testutils.createTestEditor)({
|
|
28
28
|
input,
|
|
29
29
|
plugins: [
|
|
30
30
|
(0, _testutils.mockPlugin)({
|
|
@@ -54,7 +54,7 @@ describe('Normalizer', ()=>{
|
|
|
54
54
|
});
|
|
55
55
|
describe('rule.transform', ()=>{
|
|
56
56
|
it('works with conditional transformation', ()=>{
|
|
57
|
-
const { editor
|
|
57
|
+
const { editor } = (0, _testutils.createTestEditor)({
|
|
58
58
|
input: (0, _testutils.jsx)("editor", null, (0, _testutils.jsx)("hul", null, (0, _testutils.jsx)("hli", null, (0, _testutils.jsx)("hembed", {
|
|
59
59
|
type: "Entry",
|
|
60
60
|
id: "embedded-entry"
|
|
@@ -91,7 +91,7 @@ describe('Normalizer', ()=>{
|
|
|
91
91
|
});
|
|
92
92
|
describe('rule.validChildren', ()=>{
|
|
93
93
|
it('supports custom functions', ()=>{
|
|
94
|
-
const { editor
|
|
94
|
+
const { editor } = (0, _testutils.createTestEditor)({
|
|
95
95
|
input,
|
|
96
96
|
plugins: [
|
|
97
97
|
(0, _testutils.mockPlugin)({
|
|
@@ -12,11 +12,11 @@ _export(exports, {
|
|
|
12
12
|
NormalizerError: function() {
|
|
13
13
|
return NormalizerError;
|
|
14
14
|
},
|
|
15
|
-
createValidatorFromTypes: function() {
|
|
16
|
-
return createValidatorFromTypes;
|
|
17
|
-
},
|
|
18
15
|
createTransformerFromObject: function() {
|
|
19
16
|
return createTransformerFromObject;
|
|
17
|
+
},
|
|
18
|
+
createValidatorFromTypes: function() {
|
|
19
|
+
return createValidatorFromTypes;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
const _queries = require("../../internal/queries");
|
|
@@ -22,7 +22,7 @@ function _interop_require_default(obj) {
|
|
|
22
22
|
const withNormalizer = (editor)=>{
|
|
23
23
|
const rules = _baseRules.baseRules;
|
|
24
24
|
for (const p of editor.plugins){
|
|
25
|
-
const { normalizer: _rules
|
|
25
|
+
const { normalizer: _rules } = p;
|
|
26
26
|
if (!_rules) {
|
|
27
27
|
continue;
|
|
28
28
|
}
|
|
@@ -61,7 +61,7 @@ const withNormalizer = (editor)=>{
|
|
|
61
61
|
tr(editor, entry);
|
|
62
62
|
});
|
|
63
63
|
};
|
|
64
|
-
const { normalizeNode
|
|
64
|
+
const { normalizeNode } = editor;
|
|
65
65
|
editor.normalizeNode = (entry)=>{
|
|
66
66
|
const [node, path] = entry;
|
|
67
67
|
const children = (0, _queries.getChildren)(entry);
|
|
@@ -38,7 +38,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
38
38
|
if (cache && cache.has(obj)) {
|
|
39
39
|
return cache.get(obj);
|
|
40
40
|
}
|
|
41
|
-
var newObj = {
|
|
41
|
+
var newObj = {
|
|
42
|
+
__proto__: null
|
|
43
|
+
};
|
|
42
44
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
43
45
|
for(var key in obj){
|
|
44
46
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -20,7 +20,7 @@ function _interop_require_default(obj) {
|
|
|
20
20
|
default: obj
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
const buildParagraphKeyDownHandler = (editor, { options: { hotkey
|
|
23
|
+
const buildParagraphKeyDownHandler = (editor, { options: { hotkey } })=>(event)=>{
|
|
24
24
|
if (editor.selection && hotkey && (0, _ishotkey.default)(hotkey, event)) {
|
|
25
25
|
(0, _editor.toggleElement)(editor, {
|
|
26
26
|
activeType: _richtexttypes.BLOCKS.PARAGRAPH,
|
|
@@ -9,14 +9,14 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
|
|
13
|
-
return
|
|
12
|
+
createPasteHTMLPlugin: function() {
|
|
13
|
+
return createPasteHTMLPlugin;
|
|
14
14
|
},
|
|
15
15
|
ensureXSlateFragment: function() {
|
|
16
16
|
return ensureXSlateFragment;
|
|
17
17
|
},
|
|
18
|
-
|
|
19
|
-
return
|
|
18
|
+
getSlateFragmentAttribute: function() {
|
|
19
|
+
return getSlateFragmentAttribute;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
const _platecommon = require("@udecode/plate-common");
|
|
@@ -44,7 +44,7 @@ const ensureXSlateFragment = (dataTransfer)=>{
|
|
|
44
44
|
const createPasteHTMLPlugin = ()=>({
|
|
45
45
|
key: 'PasteHTMLPlugin',
|
|
46
46
|
withOverrides: (editor)=>{
|
|
47
|
-
const { insertData
|
|
47
|
+
const { insertData } = editor;
|
|
48
48
|
editor.insertData = (data)=>insertData(ensureXSlateFragment(data));
|
|
49
49
|
return editor;
|
|
50
50
|
},
|
|
@@ -37,7 +37,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
37
37
|
if (cache && cache.has(obj)) {
|
|
38
38
|
return cache.get(obj);
|
|
39
39
|
}
|
|
40
|
-
var newObj = {
|
|
40
|
+
var newObj = {
|
|
41
|
+
__proto__: null
|
|
42
|
+
};
|
|
41
43
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
42
44
|
for(var key in obj){
|
|
43
45
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|