@contentful/field-editor-rich-text 3.10.1 → 3.11.0
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/RichTextEditor.js +3 -3
- package/dist/cjs/SyncEditorChanges.js +2 -2
- package/dist/cjs/Toolbar/_tests_/toolbar.test.js +4 -4
- package/dist/cjs/internal/constants.js +2 -2
- package/dist/cjs/internal/hooks.js +4 -4
- package/dist/cjs/internal/misc.js +7 -7
- package/dist/cjs/internal/queries.js +48 -48
- package/dist/cjs/internal/transforms.js +25 -25
- package/dist/cjs/plugins/Hyperlink/utils.js +2 -2
- package/dist/cjs/plugins/List/insertListBreak.js +6 -6
- package/dist/cjs/plugins/List/insertListFragment.js +2 -2
- package/dist/cjs/plugins/PasteHTML/createPasteHTMLPlugin.js +2 -2
- package/dist/cjs/plugins/Quote/shouldResetQuote.js +2 -2
- package/dist/cjs/test-utils/mockPlugin.js +2 -2
- package/dist/cjs/test-utils/setEmptyDataAttribute.js +2 -2
- package/dist/esm/RichTextEditor.js +1 -1
- package/dist/esm/SyncEditorChanges.js +1 -1
- package/dist/esm/Toolbar/_tests_/toolbar.test.js +1 -1
- package/dist/esm/internal/constants.js +1 -1
- package/dist/esm/internal/hooks.js +1 -1
- package/dist/esm/internal/misc.js +1 -1
- package/dist/esm/internal/queries.js +1 -1
- package/dist/esm/internal/transforms.js +1 -1
- package/dist/esm/plugins/Hyperlink/utils.js +1 -1
- package/dist/esm/plugins/List/insertListBreak.js +1 -1
- package/dist/esm/plugins/List/insertListFragment.js +1 -1
- package/dist/esm/plugins/PasteHTML/createPasteHTMLPlugin.js +1 -1
- package/dist/esm/plugins/Quote/shouldResetQuote.js +1 -1
- package/dist/esm/test-utils/mockPlugin.js +1 -1
- package/dist/esm/test-utils/setEmptyDataAttribute.js +1 -1
- package/dist/types/helpers/editor.d.ts +1 -1
- package/dist/types/internal/hooks.d.ts +1 -1
- package/dist/types/internal/misc.d.ts +3 -24
- package/dist/types/internal/queries.d.ts +4 -4
- package/dist/types/internal/transforms.d.ts +2 -2
- package/dist/types/internal/types/editor.d.ts +3 -3
- package/dist/types/internal/types/plugins.d.ts +1 -1
- package/dist/types/plugins/List/onKeyDownList.d.ts +1 -1
- package/dist/types/plugins/index.d.ts +1 -1
- package/dist/types/plugins/shared/EmbeddedBlockUtil.d.ts +1 -1
- package/dist/types/test-utils/createEditor.d.ts +1 -22
- package/dist/types/test-utils/jsx.d.ts +3 -3
- package/package.json +17 -17
|
@@ -20,7 +20,7 @@ const _react = _interop_require_wildcard(require("react"));
|
|
|
20
20
|
const _fieldeditorreference = require("@contentful/field-editor-reference");
|
|
21
21
|
const _fieldeditorshared = require("@contentful/field-editor-shared");
|
|
22
22
|
const _richtexttypes = _interop_require_wildcard(require("@contentful/rich-text-types"));
|
|
23
|
-
const
|
|
23
|
+
const _platecommon = require("@udecode/plate-common");
|
|
24
24
|
const _emotion = require("emotion");
|
|
25
25
|
const _fastdeepequal = _interop_require_default(require("fast-deep-equal"));
|
|
26
26
|
const _noop = _interop_require_default(require("lodash/noop"));
|
|
@@ -106,7 +106,7 @@ const ConnectedRichTextEditor = (props)=>{
|
|
|
106
106
|
}, _react.createElement("div", {
|
|
107
107
|
className: _RichTextEditorstyles.styles.root,
|
|
108
108
|
"data-test-id": "rich-text-editor"
|
|
109
|
-
}, _react.createElement(
|
|
109
|
+
}, _react.createElement(_platecommon.PlateProvider, {
|
|
110
110
|
id: id,
|
|
111
111
|
initialValue: initialValue,
|
|
112
112
|
plugins: plugins,
|
|
@@ -118,7 +118,7 @@ const ConnectedRichTextEditor = (props)=>{
|
|
|
118
118
|
})), _react.createElement(_SyncEditorChanges.SyncEditorChanges, {
|
|
119
119
|
incomingValue: initialValue,
|
|
120
120
|
onChange: props.onChange
|
|
121
|
-
}), _react.createElement(
|
|
121
|
+
}), _react.createElement(_platecommon.Plate, {
|
|
122
122
|
id: id,
|
|
123
123
|
editableProps: {
|
|
124
124
|
className: classNames,
|
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "SyncEditorChanges", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _react = _interop_require_wildcard(require("react"));
|
|
12
|
-
const
|
|
12
|
+
const _platecommon = require("@udecode/plate-common");
|
|
13
13
|
const _fastdeepequal = _interop_require_default(require("fast-deep-equal"));
|
|
14
14
|
const _callbacks = require("./helpers/callbacks");
|
|
15
15
|
const _hooks = require("./internal/hooks");
|
|
@@ -74,7 +74,7 @@ const useAcceptIncomingChanges = (incomingValue)=>{
|
|
|
74
74
|
};
|
|
75
75
|
const useOnValueChanged = (onChange)=>{
|
|
76
76
|
const editor = (0, _hooks.usePlateSelectors)().editor();
|
|
77
|
-
const setEditorOnChange = (0,
|
|
77
|
+
const setEditorOnChange = (0, _platecommon.usePlateActions)().onChange();
|
|
78
78
|
_react.useEffect(()=>{
|
|
79
79
|
const cb = (0, _callbacks.createOnChangeCallback)(onChange);
|
|
80
80
|
setEditorOnChange({
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
const _react = _interop_require_wildcard(require("react"));
|
|
6
6
|
const _richtexttypes = require("@contentful/rich-text-types");
|
|
7
7
|
const _react1 = require("@testing-library/react");
|
|
8
|
-
const
|
|
8
|
+
const _platecommon = require("@udecode/plate-common");
|
|
9
9
|
require("@testing-library/jest-dom/extend-expect");
|
|
10
10
|
const _ContentfulEditorProvider = require("../../ContentfulEditorProvider");
|
|
11
11
|
const _SdkProvider = require("../../SdkProvider");
|
|
@@ -85,7 +85,7 @@ describe('Toolbar', ()=>{
|
|
|
85
85
|
test('everything on the toolbar should be disabled', async ()=>{
|
|
86
86
|
const sdk = mockSdk();
|
|
87
87
|
const id = (0, _ContentfulEditorProvider.getContentfulEditorId)(sdk);
|
|
88
|
-
const { getByTestId } = (0, _react1.render)(_react.createElement(
|
|
88
|
+
const { getByTestId } = (0, _react1.render)(_react.createElement(_platecommon.Plate, {
|
|
89
89
|
id: id
|
|
90
90
|
}, _react.createElement(_SdkProvider.SdkProvider, {
|
|
91
91
|
sdk: sdk
|
|
@@ -119,7 +119,7 @@ describe('Toolbar', ()=>{
|
|
|
119
119
|
_richtexttypes.MARKS.SUPERSCRIPT
|
|
120
120
|
]);
|
|
121
121
|
const id = (0, _ContentfulEditorProvider.getContentfulEditorId)(sdk);
|
|
122
|
-
const { queryByTestId } = (0, _react1.render)(_react.createElement(
|
|
122
|
+
const { queryByTestId } = (0, _react1.render)(_react.createElement(_platecommon.Plate, {
|
|
123
123
|
id: id
|
|
124
124
|
}, _react.createElement(_SdkProvider.SdkProvider, {
|
|
125
125
|
sdk: sdk
|
|
@@ -137,7 +137,7 @@ describe('Toolbar', ()=>{
|
|
|
137
137
|
_richtexttypes.MARKS.CODE
|
|
138
138
|
]);
|
|
139
139
|
const id = (0, _ContentfulEditorProvider.getContentfulEditorId)(sdk);
|
|
140
|
-
const { queryByTestId } = (0, _react1.render)(_react.createElement(
|
|
140
|
+
const { queryByTestId } = (0, _react1.render)(_react.createElement(_platecommon.Plate, {
|
|
141
141
|
id: id
|
|
142
142
|
}, _react.createElement(_SdkProvider.SdkProvider, {
|
|
143
143
|
sdk: sdk
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "ELEMENT_DEFAULT", {
|
|
|
8
8
|
return ELEMENT_DEFAULT;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const
|
|
11
|
+
const _platecommon = _interop_require_wildcard(require("@udecode/plate-common"));
|
|
12
12
|
function _getRequireWildcardCache(nodeInterop) {
|
|
13
13
|
if (typeof WeakMap !== "function") return null;
|
|
14
14
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -48,4 +48,4 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
48
48
|
}
|
|
49
49
|
return newObj;
|
|
50
50
|
}
|
|
51
|
-
const ELEMENT_DEFAULT =
|
|
51
|
+
const ELEMENT_DEFAULT = _platecommon.ELEMENT_DEFAULT;
|
|
@@ -22,7 +22,7 @@ _export(exports, {
|
|
|
22
22
|
return usePlateSelectors;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
-
const
|
|
25
|
+
const _platecommon = _interop_require_wildcard(require("@udecode/plate-common"));
|
|
26
26
|
const _slatereact = _interop_require_wildcard(require("slate-react"));
|
|
27
27
|
function _getRequireWildcardCache(nodeInterop) {
|
|
28
28
|
if (typeof WeakMap !== "function") return null;
|
|
@@ -65,11 +65,11 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
65
65
|
}
|
|
66
66
|
const useReadOnly = _slatereact.useReadOnly;
|
|
67
67
|
const usePlateEditorRef = (id)=>{
|
|
68
|
-
return
|
|
68
|
+
return _platecommon.usePlateEditorRef(id);
|
|
69
69
|
};
|
|
70
70
|
const usePlateEditorState = (id)=>{
|
|
71
|
-
return
|
|
71
|
+
return _platecommon.usePlateEditorState(id);
|
|
72
72
|
};
|
|
73
73
|
const usePlateSelectors = (id)=>{
|
|
74
|
-
return
|
|
74
|
+
return _platecommon.usePlateSelectors(id);
|
|
75
75
|
};
|
|
@@ -31,7 +31,7 @@ _export(exports, {
|
|
|
31
31
|
return mockPlugin;
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
|
-
const
|
|
34
|
+
const _platecommon = _interop_require_wildcard(require("@udecode/plate-common"));
|
|
35
35
|
const _transforms = require("./transforms");
|
|
36
36
|
function _getRequireWildcardCache(nodeInterop) {
|
|
37
37
|
if (typeof WeakMap !== "function") return null;
|
|
@@ -73,7 +73,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
73
73
|
return newObj;
|
|
74
74
|
}
|
|
75
75
|
const createPlateEditor = (options = {})=>{
|
|
76
|
-
return
|
|
76
|
+
return _platecommon.createPlateEditor(options);
|
|
77
77
|
};
|
|
78
78
|
const normalizeInitialValue = (options, initialValue)=>{
|
|
79
79
|
const editor = createPlateEditor(options);
|
|
@@ -86,20 +86,20 @@ const normalizeInitialValue = (options, initialValue)=>{
|
|
|
86
86
|
return editor.children;
|
|
87
87
|
};
|
|
88
88
|
const focusEditor = (editor, target)=>{
|
|
89
|
-
|
|
89
|
+
_platecommon.focusEditor(editor, target);
|
|
90
90
|
};
|
|
91
91
|
const blurEditor = (editor)=>{
|
|
92
|
-
|
|
92
|
+
_platecommon.blurEditor(editor);
|
|
93
93
|
};
|
|
94
94
|
const selectEditor = (editor, opts)=>{
|
|
95
|
-
|
|
95
|
+
_platecommon.selectEditor(editor, opts);
|
|
96
96
|
};
|
|
97
97
|
const fromDOMPoint = (editor, domPoint, opts = {
|
|
98
98
|
exactMatch: false,
|
|
99
99
|
suppressThrow: false
|
|
100
100
|
})=>{
|
|
101
|
-
return
|
|
101
|
+
return _platecommon.toSlatePoint(editor, domPoint, opts);
|
|
102
102
|
};
|
|
103
103
|
const mockPlugin = (plugin)=>{
|
|
104
|
-
return
|
|
104
|
+
return _platecommon.mockPlugin(plugin);
|
|
105
105
|
};
|
|
@@ -184,7 +184,7 @@ _export(exports, {
|
|
|
184
184
|
return getLastNodeByLevel;
|
|
185
185
|
}
|
|
186
186
|
});
|
|
187
|
-
const
|
|
187
|
+
const _platecommon = _interop_require_wildcard(require("@udecode/plate-common"));
|
|
188
188
|
const _slate = _interop_require_wildcard(require("slate"));
|
|
189
189
|
function _getRequireWildcardCache(nodeInterop) {
|
|
190
190
|
if (typeof WeakMap !== "function") return null;
|
|
@@ -226,73 +226,73 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
226
226
|
return newObj;
|
|
227
227
|
}
|
|
228
228
|
const getText = (editor, at)=>{
|
|
229
|
-
return
|
|
229
|
+
return _platecommon.getEditorString(editor, at);
|
|
230
230
|
};
|
|
231
231
|
const isText = (value)=>{
|
|
232
|
-
return
|
|
232
|
+
return _platecommon.isText(value);
|
|
233
233
|
};
|
|
234
234
|
const getEndPoint = (editor, at)=>{
|
|
235
|
-
return
|
|
235
|
+
return _platecommon.getEndPoint(editor, at);
|
|
236
236
|
};
|
|
237
237
|
const getStartPoint = (editor, at)=>{
|
|
238
|
-
return
|
|
238
|
+
return _platecommon.getStartPoint(editor, at);
|
|
239
239
|
};
|
|
240
240
|
const isNode = (value)=>{
|
|
241
|
-
return
|
|
241
|
+
return _platecommon.isNode(value);
|
|
242
242
|
};
|
|
243
243
|
const isSelectionAtBlockEnd = (editor, options)=>{
|
|
244
|
-
return
|
|
244
|
+
return _platecommon.isSelectionAtBlockEnd(editor, options);
|
|
245
245
|
};
|
|
246
246
|
const isSelectionAtBlockStart = (editor, options)=>{
|
|
247
|
-
return
|
|
247
|
+
return _platecommon.isSelectionAtBlockStart(editor, options);
|
|
248
248
|
};
|
|
249
249
|
const getBlockAbove = (editor, options)=>{
|
|
250
|
-
return
|
|
250
|
+
return _platecommon.getBlockAbove(editor, options);
|
|
251
251
|
};
|
|
252
252
|
const getNodeEntry = (editor, at, options)=>{
|
|
253
|
-
return
|
|
253
|
+
return _platecommon.getNodeEntry(editor, at, options);
|
|
254
254
|
};
|
|
255
255
|
const getNodeEntries = (editor, options)=>{
|
|
256
|
-
return
|
|
256
|
+
return _platecommon.getNodeEntries(editor, options);
|
|
257
257
|
};
|
|
258
258
|
const getNodeChildren = (root, path, options)=>{
|
|
259
|
-
return
|
|
259
|
+
return _platecommon.getNodeChildren(root, path, options);
|
|
260
260
|
};
|
|
261
261
|
const getParentNode = (editor, at, options)=>{
|
|
262
|
-
return
|
|
262
|
+
return _platecommon.getParentNode(editor, at, options);
|
|
263
263
|
};
|
|
264
264
|
const someNode = (editor, options)=>{
|
|
265
|
-
return
|
|
265
|
+
return _platecommon.someNode(editor, options);
|
|
266
266
|
};
|
|
267
267
|
const getChildren = (entry)=>{
|
|
268
268
|
if (_slate.Text.isText(entry[0])) {
|
|
269
269
|
return [];
|
|
270
270
|
}
|
|
271
|
-
return
|
|
271
|
+
return _platecommon.getChildren(entry);
|
|
272
272
|
};
|
|
273
273
|
const isFirstChild = (path)=>{
|
|
274
|
-
return
|
|
274
|
+
return _platecommon.isFirstChild(path);
|
|
275
275
|
};
|
|
276
276
|
const getDescendantNodeByPath = (root, path)=>{
|
|
277
277
|
return _slate.Node.get(root, path);
|
|
278
278
|
};
|
|
279
279
|
const getNodeDescendants = (root, options)=>{
|
|
280
|
-
return
|
|
280
|
+
return _platecommon.getNodeDescendants(root, {
|
|
281
281
|
...options,
|
|
282
282
|
pass: undefined
|
|
283
283
|
});
|
|
284
284
|
};
|
|
285
285
|
const isRangeCollapsed = (range)=>{
|
|
286
|
-
return
|
|
286
|
+
return _platecommon.isCollapsed(range);
|
|
287
287
|
};
|
|
288
288
|
const isRangeAcrossBlocks = (editor, options)=>{
|
|
289
|
-
return
|
|
289
|
+
return _platecommon.isRangeAcrossBlocks(editor, options);
|
|
290
290
|
};
|
|
291
291
|
const isRangeExpanded = (range)=>{
|
|
292
|
-
return
|
|
292
|
+
return _platecommon.isExpanded(range);
|
|
293
293
|
};
|
|
294
294
|
const getRange = (editor, at, to)=>{
|
|
295
|
-
return
|
|
295
|
+
return _platecommon.getRange(editor, at, to);
|
|
296
296
|
};
|
|
297
297
|
const getRangeEdges = (range)=>{
|
|
298
298
|
return _slate.Range.edges(range);
|
|
@@ -304,46 +304,46 @@ const getRangeEnd = (range)=>{
|
|
|
304
304
|
return _slate.Range.end(range);
|
|
305
305
|
};
|
|
306
306
|
const getAboveNode = (editor, opts)=>{
|
|
307
|
-
return
|
|
307
|
+
return _platecommon.getAboveNode(editor, opts);
|
|
308
308
|
};
|
|
309
309
|
const getNextNode = (editor, opts)=>{
|
|
310
|
-
return
|
|
310
|
+
return _platecommon.getNextNode(editor, opts);
|
|
311
311
|
};
|
|
312
312
|
const getCommonNode = (root, path, another)=>{
|
|
313
|
-
return
|
|
313
|
+
return _platecommon.getCommonNode(root, path, another);
|
|
314
314
|
};
|
|
315
315
|
const getNodeTexts = (root, opts)=>{
|
|
316
|
-
return
|
|
316
|
+
return _platecommon.getNodeTexts(root, opts);
|
|
317
317
|
};
|
|
318
318
|
const findNode = (editor, options)=>{
|
|
319
|
-
return
|
|
319
|
+
return _platecommon.findNode(editor, options);
|
|
320
320
|
};
|
|
321
321
|
const isMarkActive = (editor, type)=>{
|
|
322
|
-
return
|
|
322
|
+
return _platecommon.isMarkActive(editor, type);
|
|
323
323
|
};
|
|
324
324
|
const getMarks = (editor)=>{
|
|
325
|
-
return
|
|
325
|
+
return _platecommon.getMarks(editor);
|
|
326
326
|
};
|
|
327
327
|
const isEditor = (value)=>{
|
|
328
|
-
return
|
|
328
|
+
return _platecommon.isEditor(value);
|
|
329
329
|
};
|
|
330
330
|
const isEditorReadOnly = (editor)=>{
|
|
331
|
-
return
|
|
331
|
+
return _platecommon.isEditorReadOnly(editor);
|
|
332
332
|
};
|
|
333
333
|
const isElement = (value)=>{
|
|
334
|
-
return
|
|
334
|
+
return _platecommon.isElement(value);
|
|
335
335
|
};
|
|
336
336
|
const isBlockNode = (editor, value)=>{
|
|
337
|
-
return
|
|
337
|
+
return _platecommon.isBlock(editor, value);
|
|
338
338
|
};
|
|
339
339
|
const findNodePath = (editor, node)=>{
|
|
340
|
-
return
|
|
340
|
+
return _platecommon.findNodePath(editor, node);
|
|
341
341
|
};
|
|
342
342
|
const isAncestorPath = (path, another)=>{
|
|
343
343
|
return _slate.Path.isAncestor(path, another);
|
|
344
344
|
};
|
|
345
345
|
const isAncestorEmpty = (editor, node)=>{
|
|
346
|
-
return
|
|
346
|
+
return _platecommon.isAncestorEmpty(editor, node);
|
|
347
347
|
};
|
|
348
348
|
const getParentPath = (path)=>{
|
|
349
349
|
return _slate.Path.parent(path);
|
|
@@ -355,7 +355,7 @@ const getPreviousPath = (path)=>{
|
|
|
355
355
|
return _slate.Path.previous(path);
|
|
356
356
|
};
|
|
357
357
|
const getLastChildPath = (nodeEntry)=>{
|
|
358
|
-
return
|
|
358
|
+
return _platecommon.getLastChildPath(nodeEntry);
|
|
359
359
|
};
|
|
360
360
|
const getPathLevels = (path, options)=>{
|
|
361
361
|
return _slate.Path.levels(path, options);
|
|
@@ -364,44 +364,44 @@ const isCommonPath = (path, anotherPath)=>{
|
|
|
364
364
|
return _slate.Path.isCommon(path, anotherPath);
|
|
365
365
|
};
|
|
366
366
|
const isFirstChildPath = (path)=>{
|
|
367
|
-
return
|
|
367
|
+
return _platecommon.isFirstChild(path);
|
|
368
368
|
};
|
|
369
369
|
const isLastChildPath = (entry, childPath)=>{
|
|
370
|
-
return
|
|
370
|
+
return _platecommon.isLastChild(entry, childPath);
|
|
371
371
|
};
|
|
372
372
|
const isChildPath = (path, another)=>{
|
|
373
373
|
return _slate.Path.isChild(path, another);
|
|
374
374
|
};
|
|
375
375
|
const matchNode = (node, path, fn)=>{
|
|
376
|
-
return
|
|
376
|
+
return _platecommon.match(node, path, fn);
|
|
377
377
|
};
|
|
378
378
|
const someHtmlElement = (rootNode, predicate)=>{
|
|
379
|
-
return
|
|
379
|
+
return _platecommon.someHtmlElement(rootNode, predicate);
|
|
380
380
|
};
|
|
381
381
|
const getPointBefore = (editor, at, options)=>{
|
|
382
|
-
return
|
|
382
|
+
return _platecommon.getPointBefore(editor, at, options);
|
|
383
383
|
};
|
|
384
384
|
const getPointAfter = (editor, at, options)=>{
|
|
385
|
-
return
|
|
385
|
+
return _platecommon.getPointAfter(editor, at, options);
|
|
386
386
|
};
|
|
387
387
|
const isEndPoint = (editor, point, at)=>{
|
|
388
|
-
return
|
|
388
|
+
return _platecommon.isEndPoint(editor, point, at);
|
|
389
389
|
};
|
|
390
390
|
const isInline = (editor, value)=>{
|
|
391
|
-
return
|
|
391
|
+
return _platecommon.isInline(editor, value);
|
|
392
392
|
};
|
|
393
393
|
const queryNode = (entry, options)=>{
|
|
394
|
-
return
|
|
394
|
+
return _platecommon.queryNode(entry, options);
|
|
395
395
|
};
|
|
396
396
|
const getPluginType = (editor, key)=>{
|
|
397
|
-
return
|
|
397
|
+
return _platecommon.getPluginType(editor, key);
|
|
398
398
|
};
|
|
399
399
|
const createPathRef = (editor, at)=>{
|
|
400
|
-
return
|
|
400
|
+
return _platecommon.createPathRef(editor, at);
|
|
401
401
|
};
|
|
402
402
|
const match = (obj, path, predicate)=>{
|
|
403
|
-
return
|
|
403
|
+
return _platecommon.match(obj, path, predicate);
|
|
404
404
|
};
|
|
405
405
|
const getLastNodeByLevel = (editor, level)=>{
|
|
406
|
-
return
|
|
406
|
+
return _platecommon.getLastNodeByLevel(editor, level);
|
|
407
407
|
};
|
|
@@ -85,7 +85,7 @@ _export(exports, {
|
|
|
85
85
|
return setEditorValue;
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
|
-
const
|
|
88
|
+
const _platecommon = _interop_require_wildcard(require("@udecode/plate-common"));
|
|
89
89
|
const _queries = require("./queries");
|
|
90
90
|
function _getRequireWildcardCache(nodeInterop) {
|
|
91
91
|
if (typeof WeakMap !== "function") return null;
|
|
@@ -129,79 +129,79 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
129
129
|
const normalize = (editor, options = {
|
|
130
130
|
force: true
|
|
131
131
|
})=>{
|
|
132
|
-
return
|
|
132
|
+
return _platecommon.normalizeEditor(editor, options);
|
|
133
133
|
};
|
|
134
134
|
const withoutNormalizing = (editor, fn)=>{
|
|
135
|
-
return
|
|
135
|
+
return _platecommon.withoutNormalizing(editor, fn);
|
|
136
136
|
};
|
|
137
137
|
const setSelection = (editor, props)=>{
|
|
138
|
-
return
|
|
138
|
+
return _platecommon.setSelection(editor, props);
|
|
139
139
|
};
|
|
140
140
|
const select = (editor, location)=>{
|
|
141
|
-
return
|
|
141
|
+
return _platecommon.select(editor, location);
|
|
142
142
|
};
|
|
143
143
|
const moveSelection = (editor, options)=>{
|
|
144
|
-
return
|
|
144
|
+
return _platecommon.moveSelection(editor, options);
|
|
145
145
|
};
|
|
146
146
|
const moveChildren = (editor, options)=>{
|
|
147
|
-
return
|
|
147
|
+
return _platecommon.moveChildren(editor, options);
|
|
148
148
|
};
|
|
149
149
|
const collapseSelection = (editor, options)=>{
|
|
150
|
-
return
|
|
150
|
+
return _platecommon.collapseSelection(editor, options);
|
|
151
151
|
};
|
|
152
152
|
const setNodes = (editor, attrs, opts)=>{
|
|
153
|
-
|
|
153
|
+
_platecommon.setNodes(editor, attrs, opts);
|
|
154
154
|
};
|
|
155
155
|
const unsetNodes = (editor, props, options)=>{
|
|
156
|
-
|
|
156
|
+
_platecommon.unsetNodes(editor, props, options);
|
|
157
157
|
};
|
|
158
158
|
const insertNodes = (editor, nodes, opts)=>{
|
|
159
|
-
return
|
|
159
|
+
return _platecommon.insertNodes(editor, nodes, opts);
|
|
160
160
|
};
|
|
161
161
|
const splitNodes = (editor, options)=>{
|
|
162
|
-
return
|
|
162
|
+
return _platecommon.splitNodes(editor, options);
|
|
163
163
|
};
|
|
164
164
|
const liftNodes = (editor, options)=>{
|
|
165
|
-
return
|
|
165
|
+
return _platecommon.liftNodes(editor, options);
|
|
166
166
|
};
|
|
167
167
|
const unwrapNodes = (editor, options)=>{
|
|
168
|
-
return
|
|
168
|
+
return _platecommon.unwrapNodes(editor, options);
|
|
169
169
|
};
|
|
170
170
|
const wrapNodes = (editor, element, options)=>{
|
|
171
|
-
return
|
|
171
|
+
return _platecommon.wrapNodes(editor, element, options);
|
|
172
172
|
};
|
|
173
173
|
const toggleNodeType = (editor, options, editorOptions)=>{
|
|
174
|
-
|
|
174
|
+
_platecommon.toggleNodeType(editor, options, editorOptions);
|
|
175
175
|
};
|
|
176
176
|
const removeMark = (editor, type, at)=>{
|
|
177
|
-
|
|
177
|
+
_platecommon.removeMark(editor, {
|
|
178
178
|
key: type,
|
|
179
179
|
at
|
|
180
180
|
});
|
|
181
181
|
};
|
|
182
182
|
const unhangRange = (editor, range, options)=>{
|
|
183
|
-
return
|
|
183
|
+
return _platecommon.unhangRange(editor, range, options);
|
|
184
184
|
};
|
|
185
185
|
const toggleMark = (editor, options)=>{
|
|
186
|
-
return
|
|
186
|
+
return _platecommon.toggleMark(editor, options);
|
|
187
187
|
};
|
|
188
188
|
const addMark = (editor, type, value = true)=>{
|
|
189
|
-
|
|
189
|
+
_platecommon.addMark(editor, type, value);
|
|
190
190
|
};
|
|
191
191
|
const insertText = (editor, text, options)=>{
|
|
192
|
-
return
|
|
192
|
+
return _platecommon.insertText(editor, text, options);
|
|
193
193
|
};
|
|
194
194
|
const deleteText = (editor, opts)=>{
|
|
195
|
-
|
|
195
|
+
_platecommon.deleteText(editor, opts);
|
|
196
196
|
};
|
|
197
197
|
const removeNodes = (editor, opts)=>{
|
|
198
|
-
|
|
198
|
+
_platecommon.removeNodes(editor, opts);
|
|
199
199
|
};
|
|
200
200
|
const moveNodes = (editor, opts)=>{
|
|
201
|
-
|
|
201
|
+
_platecommon.moveNodes(editor, opts);
|
|
202
202
|
};
|
|
203
203
|
const deleteFragment = (editor, options)=>{
|
|
204
|
-
return
|
|
204
|
+
return _platecommon.deleteFragment(editor, options);
|
|
205
205
|
};
|
|
206
206
|
const setEditorValue = (editor, nodes)=>{
|
|
207
207
|
withoutNormalizing(editor, ()=>{
|
|
@@ -17,11 +17,11 @@ _export(exports, {
|
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
const _fieldeditorreference = require("@contentful/field-editor-reference");
|
|
20
|
-
const
|
|
20
|
+
const _platecommon = require("@udecode/plate-common");
|
|
21
21
|
const _queries = require("../../internal/queries");
|
|
22
22
|
const hasText = (editor, entry)=>{
|
|
23
23
|
const [node, path] = entry;
|
|
24
|
-
return !(0,
|
|
24
|
+
return !(0, _platecommon.isAncestorEmpty)(editor, node) && (0, _queries.getText)(editor, path).trim() !== '';
|
|
25
25
|
};
|
|
26
26
|
function truncate(str, length) {
|
|
27
27
|
if (typeof str === 'string' && str.length > length) {
|
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "insertListBreak", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _richtexttypes = require("@contentful/rich-text-types");
|
|
12
|
-
const
|
|
12
|
+
const _platecommon = require("@udecode/plate-common");
|
|
13
13
|
const _platelist = require("@udecode/plate-list");
|
|
14
14
|
const _plateresetnode = require("@udecode/plate-reset-node");
|
|
15
15
|
const _insertListItem = require("./transforms/insertListItem");
|
|
@@ -20,7 +20,7 @@ const listBreak = (editor)=>{
|
|
|
20
20
|
if (res) {
|
|
21
21
|
const { list , listItem } = res;
|
|
22
22
|
const childNode = listItem[0].children[0];
|
|
23
|
-
if ((0,
|
|
23
|
+
if ((0, _platecommon.isBlockAboveEmpty)(editor) && listItem[0].children.length === 1 && _richtexttypes.TEXT_CONTAINERS.includes(childNode.type)) {
|
|
24
24
|
moved = (0, _platelist.moveListItemUp)(editor, {
|
|
25
25
|
list,
|
|
26
26
|
listItem
|
|
@@ -28,15 +28,15 @@ const listBreak = (editor)=>{
|
|
|
28
28
|
if (moved) return true;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
const didReset = (0, _plateresetnode.onKeyDownResetNode)(editor, (0,
|
|
31
|
+
const didReset = (0, _plateresetnode.onKeyDownResetNode)(editor, (0, _platecommon.mockPlugin)({
|
|
32
32
|
options: {
|
|
33
33
|
rules: [
|
|
34
34
|
{
|
|
35
35
|
types: [
|
|
36
|
-
(0,
|
|
36
|
+
(0, _platecommon.getPluginType)(editor, _platelist.ELEMENT_LI)
|
|
37
37
|
],
|
|
38
|
-
defaultType: (0,
|
|
39
|
-
predicate: ()=>!moved && (0,
|
|
38
|
+
defaultType: (0, _platecommon.getPluginType)(editor, _platecommon.ELEMENT_DEFAULT),
|
|
39
|
+
predicate: ()=>!moved && (0, _platecommon.isBlockAboveEmpty)(editor),
|
|
40
40
|
onReset: (_editor)=>(0, _platelist.unwrapList)(_editor)
|
|
41
41
|
}
|
|
42
42
|
]
|
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "insertListFragment", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _richtexttypes = require("@contentful/rich-text-types");
|
|
12
|
-
const
|
|
12
|
+
const _platecommon = require("@udecode/plate-common");
|
|
13
13
|
const _queries = require("../../internal/queries");
|
|
14
14
|
const _transforms = require("../../internal/transforms");
|
|
15
15
|
const getFirstAncestorOfType = (root, entry)=>{
|
|
@@ -64,7 +64,7 @@ const insertListFragment = (editor)=>{
|
|
|
64
64
|
if (!editor.selection) {
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
const liEntry = (0,
|
|
67
|
+
const liEntry = (0, _platecommon.findNode)(editor, {
|
|
68
68
|
match: {
|
|
69
69
|
type: _richtexttypes.BLOCKS.LIST_ITEM
|
|
70
70
|
},
|
|
@@ -19,7 +19,7 @@ _export(exports, {
|
|
|
19
19
|
return createPasteHTMLPlugin;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
const
|
|
22
|
+
const _platecommon = require("@udecode/plate-common");
|
|
23
23
|
const _sanitizeHTML = require("./utils/sanitizeHTML");
|
|
24
24
|
const catchSlateFragment = /data-slate-fragment="(.+?)"/m;
|
|
25
25
|
const getSlateFragmentAttribute = (dataTransfer)=>{
|
|
@@ -50,7 +50,7 @@ const createPasteHTMLPlugin = ()=>({
|
|
|
50
50
|
},
|
|
51
51
|
inject: {
|
|
52
52
|
pluginsByKey: {
|
|
53
|
-
[
|
|
53
|
+
[_platecommon.KEY_DESERIALIZE_HTML]: {
|
|
54
54
|
editor: {
|
|
55
55
|
insertData: {
|
|
56
56
|
format: 'text/html',
|
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "shouldResetQuoteOnBackspace", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _richtexttypes = require("@contentful/rich-text-types");
|
|
12
|
-
const
|
|
12
|
+
const _platecommon = require("@udecode/plate-common");
|
|
13
13
|
const _queries = require("../../internal/queries");
|
|
14
14
|
const shouldResetQuoteOnBackspace = (editor)=>{
|
|
15
15
|
const container = (0, _queries.getAboveNode)(editor, {
|
|
@@ -33,7 +33,7 @@ const shouldResetQuoteOnBackspace = (editor)=>{
|
|
|
33
33
|
if (!quote) {
|
|
34
34
|
return false;
|
|
35
35
|
}
|
|
36
|
-
if ((0,
|
|
36
|
+
if ((0, _platecommon.hasSingleChild)(quote[0]) && (0, _platecommon.isLastChild)(quote, container[1])) {
|
|
37
37
|
return true;
|
|
38
38
|
}
|
|
39
39
|
return false;
|
|
@@ -8,9 +8,9 @@ Object.defineProperty(exports, "mockPlugin", {
|
|
|
8
8
|
return mockPlugin;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const
|
|
11
|
+
const _platecommon = require("@udecode/plate-common");
|
|
12
12
|
const _randomId = require("./randomId");
|
|
13
|
-
const mockPlugin = (p)=>(0,
|
|
13
|
+
const mockPlugin = (p)=>(0, _platecommon.mockPlugin)({
|
|
14
14
|
...p,
|
|
15
15
|
key: p.key || (0, _randomId.randomId)('plugin')
|
|
16
16
|
});
|
|
@@ -8,10 +8,10 @@ Object.defineProperty(exports, "setEmptyDataAttribute", {
|
|
|
8
8
|
return setEmptyDataAttribute;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const
|
|
11
|
+
const _platecommon = require("@udecode/plate-common");
|
|
12
12
|
const _slate = require("slate");
|
|
13
13
|
const setEmptyDataAttribute = (root)=>{
|
|
14
|
-
(0,
|
|
14
|
+
(0, _platecommon.setNodes)(root, {
|
|
15
15
|
data: {}
|
|
16
16
|
}, {
|
|
17
17
|
at: [],
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { EntityProvider } from '@contentful/field-editor-reference';
|
|
3
3
|
import { FieldConnector } from '@contentful/field-editor-shared';
|
|
4
4
|
import * as Contentful from '@contentful/rich-text-types';
|
|
5
|
-
import { Plate, PlateProvider } from '@udecode/plate-
|
|
5
|
+
import { Plate, PlateProvider } from '@udecode/plate-common';
|
|
6
6
|
import { css, cx } from 'emotion';
|
|
7
7
|
import deepEquals from 'fast-deep-equal';
|
|
8
8
|
import noop from 'lodash/noop';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { usePlateActions } from '@udecode/plate-
|
|
2
|
+
import { usePlateActions } from '@udecode/plate-common';
|
|
3
3
|
import equal from 'fast-deep-equal';
|
|
4
4
|
import { createOnChangeCallback } from './helpers/callbacks';
|
|
5
5
|
import { usePlateSelectors } from './internal/hooks';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { MARKS } from '@contentful/rich-text-types';
|
|
3
3
|
import { configure, render, waitFor } from '@testing-library/react';
|
|
4
|
-
import { Plate } from '@udecode/plate-
|
|
4
|
+
import { Plate } from '@udecode/plate-common';
|
|
5
5
|
import '@testing-library/jest-dom/extend-expect';
|
|
6
6
|
import { ContentfulEditorIdProvider, getContentfulEditorId } from '../../ContentfulEditorProvider';
|
|
7
7
|
import { SdkProvider } from '../../SdkProvider';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import * as p from '@udecode/plate-
|
|
1
|
+
import * as p from '@udecode/plate-common';
|
|
2
2
|
export const ELEMENT_DEFAULT = p.ELEMENT_DEFAULT;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getScheduleTooltipContent } from '@contentful/field-editor-reference';
|
|
2
|
-
import { isAncestorEmpty } from '@udecode/plate-
|
|
2
|
+
import { isAncestorEmpty } from '@udecode/plate-common';
|
|
3
3
|
import { getText } from '../../internal/queries';
|
|
4
4
|
export const hasText = (editor, entry)=>{
|
|
5
5
|
const [node, path] = entry;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TEXT_CONTAINERS } from '@contentful/rich-text-types';
|
|
2
|
-
import { ELEMENT_DEFAULT, getPluginType, isBlockAboveEmpty, mockPlugin } from '@udecode/plate-
|
|
2
|
+
import { ELEMENT_DEFAULT, getPluginType, isBlockAboveEmpty, mockPlugin } from '@udecode/plate-common';
|
|
3
3
|
import { getListItemEntry, moveListItemUp, unwrapList, ELEMENT_LI } from '@udecode/plate-list';
|
|
4
4
|
import { onKeyDownResetNode, SIMULATE_BACKSPACE } from '@udecode/plate-reset-node';
|
|
5
5
|
import { insertListItem } from './transforms/insertListItem';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TEXT_CONTAINERS, BLOCKS } from '@contentful/rich-text-types';
|
|
2
|
-
import { findNode } from '@udecode/plate-
|
|
2
|
+
import { findNode } from '@udecode/plate-common';
|
|
3
3
|
import { isBlockNode, isAncestorPath, getCommonNode, getNodeTexts, getParentPath, getDescendantNodeByPath } from '../../internal/queries';
|
|
4
4
|
import { insertNodes } from '../../internal/transforms';
|
|
5
5
|
const getFirstAncestorOfType = (root, entry)=>{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { KEY_DESERIALIZE_HTML } from '@udecode/plate-
|
|
1
|
+
import { KEY_DESERIALIZE_HTML } from '@udecode/plate-common';
|
|
2
2
|
import { sanitizeHTML } from './utils/sanitizeHTML';
|
|
3
3
|
const catchSlateFragment = /data-slate-fragment="(.+?)"/m;
|
|
4
4
|
export const getSlateFragmentAttribute = (dataTransfer)=>{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BLOCKS, TEXT_CONTAINERS } from '@contentful/rich-text-types';
|
|
2
|
-
import { isLastChild, hasSingleChild } from '@udecode/plate-
|
|
2
|
+
import { isLastChild, hasSingleChild } from '@udecode/plate-common';
|
|
3
3
|
import { getAboveNode, getBlockAbove, isAncestorEmpty } from '../../internal/queries';
|
|
4
4
|
export const shouldResetQuoteOnBackspace = (editor)=>{
|
|
5
5
|
const container = getAboveNode(editor, {
|
|
@@ -12,7 +12,7 @@ export declare function isNodeTypeSelected(editor: PlateEditor | null, nodeType:
|
|
|
12
12
|
export declare function moveToTheNextLine(editor: PlateEditor): void;
|
|
13
13
|
export declare function moveToTheNextChar(editor: PlateEditor): void;
|
|
14
14
|
export declare function insertEmptyParagraph(editor: PlateEditor, options?: any): void;
|
|
15
|
-
export declare function getElementFromCurrentSelection(editor: PlateEditor): (import("slate").Path | import("@udecode/
|
|
15
|
+
export declare function getElementFromCurrentSelection(editor: PlateEditor): (import("slate").Path | import("@udecode/slate").ENode<import("@udecode/slate").Value>)[];
|
|
16
16
|
export declare function isList(editor?: PlateEditor): boolean;
|
|
17
17
|
export declare function getTableSize(table: Element): Record<'numRows' | 'numColumns', number> | null;
|
|
18
18
|
interface InsertLinkOptions {
|
|
@@ -1,31 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import * as p from '@udecode/plate-core';
|
|
1
|
+
import * as p from '@udecode/plate-common';
|
|
3
2
|
import * as s from 'slate';
|
|
4
3
|
import type { Value, PlateEditor, Location, PlatePlugin } from './types';
|
|
5
4
|
export type CreatePlateEditorOptions = Omit<p.CreatePlateEditorOptions<Value, PlateEditor>, 'plugins'> & {
|
|
6
5
|
plugins?: PlatePlugin[];
|
|
7
6
|
};
|
|
8
|
-
export declare const createPlateEditor: (options?: CreatePlateEditorOptions) =>
|
|
9
|
-
children: Value;
|
|
10
|
-
operations: p.TOperation<p.TDescendant>[];
|
|
11
|
-
marks: Record<string, any> | null;
|
|
12
|
-
isInline: <N extends p.TElement>(element: N) => boolean;
|
|
13
|
-
isVoid: <N_1 extends p.TElement>(element: N_1) => boolean;
|
|
14
|
-
normalizeNode: <N_2 extends p.TNode>(entry: p.TNodeEntry<N_2>) => void;
|
|
15
|
-
apply: <N_3 extends p.TDescendant>(operation: p.TOperation<N_3>) => void;
|
|
16
|
-
getFragment: <N_4 extends p.TDescendant>() => N_4[];
|
|
17
|
-
insertFragment: <N_5 extends p.TDescendant>(fragment: N_5[]) => void;
|
|
18
|
-
insertNode: <N_6 extends p.TDescendant>(node: N_6 | N_6[]) => void;
|
|
19
|
-
} & p.UnknownObject & Pick<import("slate-history").HistoryEditor, "history" | "undo" | "redo"> & Pick<import("slate-react").ReactEditor, "insertData" | "insertFragmentData" | "setFragmentData" | "insertTextData" | "hasRange"> & {
|
|
20
|
-
key: any;
|
|
21
|
-
id: string;
|
|
22
|
-
plugins: p.WithPlatePlugin<{}, Value, p.PlateEditor<Value>>[];
|
|
23
|
-
pluginsByKey: Record<string, p.WithPlatePlugin<{}, Value, p.PlateEditor<Value>>>;
|
|
24
|
-
prevSelection: s.BaseRange | null;
|
|
25
|
-
blockFactory: (node?: Partial<p.TElement> | undefined, path?: s.Path | undefined) => p.TElement;
|
|
26
|
-
childrenFactory: () => Value;
|
|
27
|
-
currentKeyboardEvent: import("react").KeyboardEvent<Element> | null;
|
|
28
|
-
};
|
|
7
|
+
export declare const createPlateEditor: (options?: CreatePlateEditorOptions) => any;
|
|
29
8
|
/**
|
|
30
9
|
* The only reason for this helper to exist is to run the initial normalization
|
|
31
10
|
* before mounting the Plate editor component which in turn avoids the false
|
|
@@ -55,4 +34,4 @@ export declare const fromDOMPoint: (editor: PlateEditor, domPoint: [Node, number
|
|
|
55
34
|
exactMatch: boolean;
|
|
56
35
|
suppressThrow: boolean;
|
|
57
36
|
}) => s.BasePoint | null | undefined;
|
|
58
|
-
export declare const mockPlugin: (plugin?: Partial<PlatePlugin> | undefined) => p.WithPlatePlugin<
|
|
37
|
+
export declare const mockPlugin: (plugin?: Partial<PlatePlugin> | undefined) => p.WithPlatePlugin<any, p.Value, p.PlateEditor<p.Value>>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Re-exporting Plate/Slate queries (aka selectors) to reduce
|
|
3
3
|
* the blast radius of version upgrades
|
|
4
4
|
*/
|
|
5
|
-
import * as p from '@udecode/plate-
|
|
5
|
+
import * as p from '@udecode/plate-common';
|
|
6
6
|
import * as s from 'slate';
|
|
7
7
|
import type { Value, PlateEditor, Location, Node, NodeEntry, BaseRange, Element, Text, Ancestor, BasePoint, Path } from './types';
|
|
8
8
|
/**
|
|
@@ -16,7 +16,7 @@ export declare const isNode: (value: unknown) => value is Node;
|
|
|
16
16
|
export declare const isSelectionAtBlockEnd: (editor: PlateEditor, options?: p.GetAboveNodeOptions<Value>) => boolean;
|
|
17
17
|
export declare const isSelectionAtBlockStart: (editor: PlateEditor, options?: p.GetAboveNodeOptions<Value>) => boolean;
|
|
18
18
|
export declare const getBlockAbove: (editor: PlateEditor, options?: p.GetAboveNodeOptions<p.Value>) => p.TNodeEntry<p.TElement | p.TEditor> | undefined;
|
|
19
|
-
export declare const getNodeEntry: (editor: PlateEditor, at: Location, options?: s.EditorNodeOptions) => p.TNodeEntry<p.ENode<Value
|
|
19
|
+
export declare const getNodeEntry: (editor: PlateEditor, at: Location, options?: s.EditorNodeOptions) => p.TNodeEntry<p.ENode<Value>> | undefined;
|
|
20
20
|
export declare const getNodeEntries: (editor: PlateEditor, options?: p.GetNodeEntriesOptions) => Generator<p.TNodeEntry<p.ENode<p.Value>>, void, undefined>;
|
|
21
21
|
export declare const getNodeChildren: (root: Ancestor, path: s.Path, options?: s.NodeChildrenOptions | undefined) => Generator<p.TNodeEntry<Text | Element | p.TDescendant>, void, undefined>;
|
|
22
22
|
export declare const getParentNode: (editor: PlateEditor, at: Location, options?: s.EditorParentOptions) => NodeEntry | undefined;
|
|
@@ -45,10 +45,10 @@ export declare const getNodeTexts: (root: Node, opts?: {
|
|
|
45
45
|
} | undefined) => Generator<p.TNodeEntry<p.TText>, void, undefined>;
|
|
46
46
|
export declare const findNode: (editor: PlateEditor, options?: p.FindNodeOptions<p.Value> | undefined) => p.TNodeEntry<p.ENode<p.Value>> | undefined;
|
|
47
47
|
export declare const isMarkActive: (editor: PlateEditor, type: string) => boolean;
|
|
48
|
-
export declare const getMarks: (editor: PlateEditor) =>
|
|
48
|
+
export declare const getMarks: (editor: PlateEditor) => {
|
|
49
49
|
[x: string]: unknown;
|
|
50
50
|
[x: number]: unknown;
|
|
51
|
-
}
|
|
51
|
+
} | null;
|
|
52
52
|
export declare const isEditor: (value: unknown) => value is PlateEditor;
|
|
53
53
|
export declare const isEditorReadOnly: (editor: PlateEditor) => boolean;
|
|
54
54
|
export declare const isElement: (value: unknown) => value is Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as p from '@udecode/plate-
|
|
1
|
+
import * as p from '@udecode/plate-common';
|
|
2
2
|
import * as s from 'slate';
|
|
3
3
|
import { Except } from 'type-fest';
|
|
4
4
|
import { PlateEditor, Node, ToggleNodeTypeOptions, EditorNodesOptions, BaseRange, Value, SelectionMoveOptions, TextInsertTextOptions, Element, SelectionCollapseOptions, Path, Span, BasePoint, Location } from './types';
|
|
@@ -25,7 +25,7 @@ export declare const wrapNodes: (editor: PlateEditor, element: Element, options?
|
|
|
25
25
|
export declare const toggleNodeType: (editor: PlateEditor, options: ToggleNodeTypeOptions, editorOptions?: Omit<EditorNodesOptions, 'match'>) => void;
|
|
26
26
|
export declare const removeMark: (editor: PlateEditor, type: string, at: BaseRange) => void;
|
|
27
27
|
export declare const unhangRange: (editor: PlateEditor, range?: Path | BasePoint | BaseRange | Span | null | undefined, options?: p.UnhangRangeOptions | undefined) => s.BaseRange | undefined;
|
|
28
|
-
export declare const toggleMark: (editor: PlateEditor, options: p.ToggleMarkOptions
|
|
28
|
+
export declare const toggleMark: (editor: PlateEditor, options: p.ToggleMarkOptions) => void;
|
|
29
29
|
export declare const addMark: (editor: PlateEditor, type: string, value?: unknown) => void;
|
|
30
30
|
export declare const insertText: (editor: PlateEditor, text: string, options?: TextInsertTextOptions) => void;
|
|
31
31
|
export declare const deleteText: (editor: PlateEditor, opts?: Parameters<typeof p.deleteText>['1']) => void;
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* https://plate.udecode.io/docs/typescript
|
|
3
3
|
*/
|
|
4
4
|
import { MARKS } from '@contentful/rich-text-types';
|
|
5
|
-
import * as p from '@udecode/plate-
|
|
5
|
+
import * as p from '@udecode/plate-common';
|
|
6
6
|
import * as s from 'slate';
|
|
7
7
|
import * as sr from 'slate-react';
|
|
8
|
-
import { SelectionMoveOptions as SlateSelectionMoveOptions, SelectionCollapseOptions as SlateSelectionCollapseOptions } from 'slate/dist/transforms/selection';
|
|
9
|
-
import { TextInsertTextOptions as SlateTextInsertTextOptions } from 'slate/dist/transforms/text';
|
|
8
|
+
import type { SelectionMoveOptions as SlateSelectionMoveOptions, SelectionCollapseOptions as SlateSelectionCollapseOptions } from 'slate/dist/interfaces/transforms/selection';
|
|
9
|
+
import type { TextInsertTextOptions as SlateTextInsertTextOptions } from 'slate/dist/interfaces/transforms/text';
|
|
10
10
|
import { TrackingPluginActions } from '../../plugins/Tracking';
|
|
11
11
|
export interface Text extends p.TText {
|
|
12
12
|
[MARKS.BOLD]?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SoftBreakRule, ExitBreakRule } from '@udecode/plate-break';
|
|
2
|
-
import * as p from '@udecode/plate-
|
|
2
|
+
import * as p from '@udecode/plate-common';
|
|
3
3
|
import { ResetNodePluginRule } from '@udecode/plate-reset-node';
|
|
4
4
|
import type { NormalizerRule } from '../../plugins/Normalizer';
|
|
5
5
|
import { Value, PlateEditor } from './editor';
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Credit: Modified version of Plate's list plugin
|
|
3
3
|
* See: https://github.com/udecode/plate/blob/main/packages/nodes/list
|
|
4
4
|
*/
|
|
5
|
-
import { HotkeyPlugin } from '@udecode/plate-
|
|
5
|
+
import { HotkeyPlugin } from '@udecode/plate-common';
|
|
6
6
|
import { KeyboardHandler } from '../../internal/types';
|
|
7
7
|
export declare const onKeyDownList: KeyboardHandler<HotkeyPlugin>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
2
|
-
import { PlateProps } from '@udecode/plate-
|
|
2
|
+
import { PlateProps } from '@udecode/plate-common';
|
|
3
3
|
import { PlatePlugin } from '../internal/types';
|
|
4
4
|
import { RichTextTrackingActionHandler } from './Tracking';
|
|
5
5
|
export declare const getPlugins: (sdk: FieldExtensionSDK, onAction: RichTextTrackingActionHandler, restrictedMarks?: string[]) => PlatePlugin[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
2
2
|
import { BLOCKS } from '@contentful/rich-text-types';
|
|
3
|
-
import { HotkeyPlugin } from '@udecode/plate-
|
|
3
|
+
import { HotkeyPlugin } from '@udecode/plate-common';
|
|
4
4
|
import { KeyboardHandler } from '../../internal';
|
|
5
5
|
import { TrackingPluginActions } from '../Tracking';
|
|
6
6
|
export declare function getWithEmbeddedBlockEvents(nodeType: BLOCKS.EMBEDDED_ENTRY | BLOCKS.EMBEDDED_ASSET | BLOCKS.EMBEDDED_RESOURCE, sdk: FieldExtensionSDK): KeyboardHandler<HotkeyPlugin>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
3
2
|
import { PlatePlugin } from '../internal/types';
|
|
4
3
|
import { RichTextTrackingActionHandler } from '../plugins/Tracking';
|
|
@@ -8,26 +7,6 @@ export declare const createTestEditor: (options: {
|
|
|
8
7
|
trackingHandler?: RichTextTrackingActionHandler;
|
|
9
8
|
plugins?: PlatePlugin[];
|
|
10
9
|
}) => {
|
|
11
|
-
editor:
|
|
12
|
-
children: import("../internal").Value;
|
|
13
|
-
operations: import("@udecode/plate-core").TOperation<import("@udecode/plate-core").TDescendant>[];
|
|
14
|
-
marks: Record<string, any> | null;
|
|
15
|
-
isInline: <N extends import("@udecode/plate-core").TElement>(element: N) => boolean;
|
|
16
|
-
isVoid: <N_1 extends import("@udecode/plate-core").TElement>(element: N_1) => boolean;
|
|
17
|
-
normalizeNode: <N_2 extends import("@udecode/plate-core").TNode>(entry: import("@udecode/plate-core").TNodeEntry<N_2>) => void;
|
|
18
|
-
apply: <N_3 extends import("@udecode/plate-core").TDescendant>(operation: import("@udecode/plate-core").TOperation<N_3>) => void;
|
|
19
|
-
getFragment: <N_4 extends import("@udecode/plate-core").TDescendant>() => N_4[];
|
|
20
|
-
insertFragment: <N_5 extends import("@udecode/plate-core").TDescendant>(fragment: N_5[]) => void;
|
|
21
|
-
insertNode: <N_6 extends import("@udecode/plate-core").TDescendant>(node: N_6 | N_6[]) => void;
|
|
22
|
-
} & import("@udecode/plate-core").UnknownObject & Pick<import("slate-history").HistoryEditor, "history" | "undo" | "redo"> & Pick<import("slate-react").ReactEditor, "insertData" | "insertFragmentData" | "setFragmentData" | "insertTextData" | "hasRange"> & {
|
|
23
|
-
key: any;
|
|
24
|
-
id: string;
|
|
25
|
-
plugins: import("@udecode/plate-core").WithPlatePlugin<{}, import("../internal").Value, import("@udecode/plate-core").PlateEditor<import("../internal").Value>>[];
|
|
26
|
-
pluginsByKey: Record<string, import("@udecode/plate-core").WithPlatePlugin<{}, import("../internal").Value, import("@udecode/plate-core").PlateEditor<import("../internal").Value>>>;
|
|
27
|
-
prevSelection: import("slate").BaseRange | null;
|
|
28
|
-
blockFactory: (node?: Partial<import("@udecode/plate-core").TElement> | undefined, path?: import("slate").Path | undefined) => import("@udecode/plate-core").TElement;
|
|
29
|
-
childrenFactory: () => import("../internal").Value;
|
|
30
|
-
currentKeyboardEvent: import("react").KeyboardEvent<Element> | null;
|
|
31
|
-
};
|
|
10
|
+
editor: any;
|
|
32
11
|
normalize: () => void;
|
|
33
12
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Add items as needed. Don't forget to adjust hyperscript.d.ts
|
|
5
5
|
*/
|
|
6
|
-
export declare const jsx: <S extends "text" | "selection" | "
|
|
6
|
+
export declare const jsx: <S extends "text" | "selection" | "fragment" | "editor" | "anchor" | "focus" | "element" | "cursor">(tagName: S, attributes?: Object | undefined, ...children: any[]) => ReturnType<({
|
|
7
7
|
anchor: typeof import("slate-hyperscript/dist/creators").createAnchor;
|
|
8
8
|
cursor: typeof import("slate-hyperscript/dist/creators").createCursor;
|
|
9
9
|
editor: (tagName: string, attributes: {
|
|
@@ -13,7 +13,7 @@ export declare const jsx: <S extends "text" | "selection" | "editor" | "element"
|
|
|
13
13
|
focus: typeof import("slate-hyperscript/dist/creators").createFocus;
|
|
14
14
|
fragment: typeof import("slate-hyperscript/dist/creators").createFragment;
|
|
15
15
|
selection: typeof import("slate-hyperscript/dist/creators").createSelection;
|
|
16
|
-
text: typeof import("slate-hyperscript
|
|
16
|
+
text: typeof import("slate-hyperscript").createText;
|
|
17
17
|
} | {
|
|
18
18
|
anchor: typeof import("slate-hyperscript/dist/creators").createAnchor;
|
|
19
19
|
cursor: typeof import("slate-hyperscript/dist/creators").createCursor;
|
|
@@ -24,5 +24,5 @@ export declare const jsx: <S extends "text" | "selection" | "editor" | "element"
|
|
|
24
24
|
focus: typeof import("slate-hyperscript/dist/creators").createFocus;
|
|
25
25
|
fragment: typeof import("slate-hyperscript/dist/creators").createFragment;
|
|
26
26
|
selection: typeof import("slate-hyperscript/dist/creators").createSelection;
|
|
27
|
-
text: typeof import("slate-hyperscript
|
|
27
|
+
text: typeof import("slate-hyperscript").createText;
|
|
28
28
|
})[S]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-rich-text",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.11.0",
|
|
4
4
|
"source": "./src/index.tsx",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -47,27 +47,27 @@
|
|
|
47
47
|
"@contentful/field-editor-reference": "^5.16.1",
|
|
48
48
|
"@contentful/field-editor-shared": "^1.4.0",
|
|
49
49
|
"@contentful/rich-text-plain-text-renderer": "^16.0.4",
|
|
50
|
-
"@contentful/rich-text-types": "16.
|
|
50
|
+
"@contentful/rich-text-types": "16.3.0",
|
|
51
51
|
"@popperjs/core": "^2.11.5",
|
|
52
|
-
"@udecode/plate-basic-marks": "
|
|
53
|
-
"@udecode/plate-break": "
|
|
54
|
-
"@udecode/plate-core": "
|
|
55
|
-
"@udecode/plate-list": "
|
|
56
|
-
"@udecode/plate-paragraph": "
|
|
57
|
-
"@udecode/plate-reset-node": "
|
|
58
|
-
"@udecode/plate-select": "
|
|
59
|
-
"@udecode/plate-serializer-docx": "
|
|
60
|
-
"@udecode/plate-serializer-html": "
|
|
61
|
-
"@udecode/plate-table": "
|
|
62
|
-
"@udecode/plate-trailing-block": "
|
|
52
|
+
"@udecode/plate-basic-marks": "23.7.0",
|
|
53
|
+
"@udecode/plate-break": "23.7.0",
|
|
54
|
+
"@udecode/plate-core": "23.6.0",
|
|
55
|
+
"@udecode/plate-list": "23.7.0",
|
|
56
|
+
"@udecode/plate-paragraph": "23.7.0",
|
|
57
|
+
"@udecode/plate-reset-node": "23.7.0",
|
|
58
|
+
"@udecode/plate-select": "23.7.0",
|
|
59
|
+
"@udecode/plate-serializer-docx": "23.7.0",
|
|
60
|
+
"@udecode/plate-serializer-html": "23.7.0",
|
|
61
|
+
"@udecode/plate-table": "23.7.0",
|
|
62
|
+
"@udecode/plate-trailing-block": "23.7.0",
|
|
63
63
|
"fast-deep-equal": "^3.1.3",
|
|
64
64
|
"is-hotkey": "^0.2.0",
|
|
65
65
|
"is-plain-obj": "^3.0.0",
|
|
66
66
|
"react-popper": "^2.3.0",
|
|
67
|
-
"slate": "0.
|
|
67
|
+
"slate": "0.94.1",
|
|
68
68
|
"slate-history": "0.66.0",
|
|
69
|
-
"slate-hyperscript": "0.
|
|
70
|
-
"slate-react": "0.
|
|
69
|
+
"slate-hyperscript": "0.77.0",
|
|
70
|
+
"slate-react": "0.98.3"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
73
|
"react": ">=16.14.0",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"prism-react-renderer": "2.0.5",
|
|
82
82
|
"react": ">=16.14.0"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "d9b40e59aa2b23fec2a9679c13496d8c8838cf10"
|
|
85
85
|
}
|