@seafile/seafile-editor 1.0.2 → 1.0.4
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/constants/event-types.js +2 -8
- package/dist/constants/hot-keys.js +1 -7
- package/dist/containers/article-info/index.js +24 -34
- package/dist/containers/custom/get-event-transfer.js +10 -16
- package/dist/containers/custom/set-event-transfer.js +10 -16
- package/dist/containers/hotkeys-helper/classify-hotkeys.js +20 -25
- package/dist/containers/hotkeys-helper/index.js +32 -35
- package/dist/containers/loading/index.js +11 -32
- package/dist/containers/outline/index.js +41 -51
- package/dist/containers/outline/outline-item.js +15 -21
- package/dist/editors/plain-markdown-editor/code-mirror.js +51 -75
- package/dist/editors/plain-markdown-editor/index.js +90 -107
- package/dist/editors/simple-slate-editor /index.js +43 -57
- package/dist/editors/simple-slate-editor /with-props-editor.js +4 -10
- package/dist/editors/slate-editor/editor-help/index.js +24 -37
- package/dist/editors/slate-editor/index.js +50 -64
- package/dist/editors/slate-editor/with-props-editor.js +4 -10
- package/dist/editors/slate-viewer/index.js +25 -31
- package/dist/extension/commons/element-popover/index.js +30 -55
- package/dist/extension/commons/index.js +3 -26
- package/dist/extension/commons/menu/index.js +4 -21
- package/dist/extension/commons/menu/menu-drop-down.js +50 -63
- package/dist/extension/commons/menu/menu-group.js +4 -11
- package/dist/extension/commons/menu/menu-item.js +25 -30
- package/dist/extension/commons/tooltip/index.js +14 -19
- package/dist/extension/constants/element-types.js +22 -28
- package/dist/extension/constants/index.js +15 -37
- package/dist/extension/constants/keyboard.js +3 -9
- package/dist/extension/constants/menus-config.js +118 -105
- package/dist/extension/core/index.js +3 -38
- package/dist/extension/core/queries/index.js +209 -304
- package/dist/extension/core/transforms/focus-editor.js +7 -13
- package/dist/extension/core/transforms/index.js +4 -49
- package/dist/extension/core/transforms/move-children.js +18 -25
- package/dist/extension/core/transforms/remove-node-children.js +8 -27
- package/dist/extension/core/transforms/replace-node-children.js +14 -19
- package/dist/extension/core/utils/index.js +36 -44
- package/dist/extension/editor.js +8 -15
- package/dist/extension/index.js +7 -48
- package/dist/extension/plugins/blockquote/helpers.js +38 -57
- package/dist/extension/plugins/blockquote/index.js +8 -15
- package/dist/extension/plugins/blockquote/menu/index.js +20 -25
- package/dist/extension/plugins/blockquote/plugin.js +35 -41
- package/dist/extension/plugins/blockquote/render-elem.js +9 -14
- package/dist/extension/plugins/check-list/helper.js +14 -24
- package/dist/extension/plugins/check-list/index.js +10 -17
- package/dist/extension/plugins/check-list/menu/index.js +21 -29
- package/dist/extension/plugins/check-list/plugin.js +24 -26
- package/dist/extension/plugins/check-list/render-elem.js +22 -28
- package/dist/extension/plugins/clear-format/helpers.js +25 -47
- package/dist/extension/plugins/clear-format/menu/index.js +22 -29
- package/dist/extension/plugins/code-block/helpers.js +74 -126
- package/dist/extension/plugins/code-block/index.js +10 -18
- package/dist/extension/plugins/code-block/menu/index.js +20 -27
- package/dist/extension/plugins/code-block/plugin.js +123 -144
- package/dist/extension/plugins/code-block/render-elem/constant.js +15 -11
- package/dist/extension/plugins/code-block/render-elem/index.js +30 -39
- package/dist/extension/plugins/code-block/render-elem/language-selector.js +19 -27
- package/dist/extension/plugins/formula/helper.js +39 -45
- package/dist/extension/plugins/formula/index.js +10 -17
- package/dist/extension/plugins/formula/menu/formula-modal.js +37 -52
- package/dist/extension/plugins/formula/menu/index.js +34 -50
- package/dist/extension/plugins/formula/plugin.js +12 -14
- package/dist/extension/plugins/formula/render-elem.js +27 -33
- package/dist/extension/plugins/header/helper.js +35 -48
- package/dist/extension/plugins/header/index.js +10 -17
- package/dist/extension/plugins/header/menu/index.js +52 -66
- package/dist/extension/plugins/header/plugin.js +72 -83
- package/dist/extension/plugins/header/render-elem.js +15 -20
- package/dist/extension/plugins/image/helper.js +28 -37
- package/dist/extension/plugins/image/index.js +10 -17
- package/dist/extension/plugins/image/menu/image-menu-dialog.js +31 -42
- package/dist/extension/plugins/image/menu/image-menu-popover.js +35 -67
- package/dist/extension/plugins/image/menu/index.js +24 -34
- package/dist/extension/plugins/image/plugin.js +18 -18
- package/dist/extension/plugins/image/render-element/image-previewer.js +32 -42
- package/dist/extension/plugins/image/render-element/index.js +58 -74
- package/dist/extension/plugins/index.js +18 -94
- package/dist/extension/plugins/link/helper.js +102 -139
- package/dist/extension/plugins/link/index.js +10 -17
- package/dist/extension/plugins/link/menu/index.js +46 -62
- package/dist/extension/plugins/link/menu/link-modal.js +67 -87
- package/dist/extension/plugins/link/plugin.js +52 -56
- package/dist/extension/plugins/link/render-elem/index.js +39 -54
- package/dist/extension/plugins/link/render-elem/link-popover.js +38 -42
- package/dist/extension/plugins/list/constant.js +2 -8
- package/dist/extension/plugins/list/helpers.js +40 -54
- package/dist/extension/plugins/list/index.js +10 -17
- package/dist/extension/plugins/list/menu/index.js +23 -33
- package/dist/extension/plugins/list/plugin/index.js +28 -31
- package/dist/extension/plugins/list/plugin/insert-break-list.js +9 -15
- package/dist/extension/plugins/list/plugin/insert-fragment-list.js +86 -109
- package/dist/extension/plugins/list/plugin/normalize-list.js +31 -42
- package/dist/extension/plugins/list/plugin/on-tab-handle.js +35 -34
- package/dist/extension/plugins/list/queries/index.js +22 -30
- package/dist/extension/plugins/list/render-elem/index.js +27 -27
- package/dist/extension/plugins/list/transforms/index.js +11 -75
- package/dist/extension/plugins/list/transforms/insert-list-item.js +38 -47
- package/dist/extension/plugins/list/transforms/move-list-item-down.js +22 -32
- package/dist/extension/plugins/list/transforms/move-list-item-up.js +45 -56
- package/dist/extension/plugins/list/transforms/move-list-items-to-list.js +25 -31
- package/dist/extension/plugins/list/transforms/move-list-items.js +37 -44
- package/dist/extension/plugins/list/transforms/normalize-list-item.js +57 -81
- package/dist/extension/plugins/list/transforms/normalize-nested-list.js +17 -26
- package/dist/extension/plugins/list/transforms/remove-first-list-item.js +12 -19
- package/dist/extension/plugins/list/transforms/transforms-to-list.js +60 -84
- package/dist/extension/plugins/list/transforms/unwrap-list.js +20 -29
- package/dist/extension/plugins/node-id/constants.js +9 -15
- package/dist/extension/plugins/node-id/helpers.js +33 -35
- package/dist/extension/plugins/node-id/index.js +4 -11
- package/dist/extension/plugins/node-id/with-node-id.js +18 -26
- package/dist/extension/plugins/paragraph/helper.js +7 -13
- package/dist/extension/plugins/paragraph/index.js +8 -15
- package/dist/extension/plugins/paragraph/plugin.js +25 -27
- package/dist/extension/plugins/paragraph/render-elem.js +9 -14
- package/dist/extension/plugins/table/constant.js +3 -9
- package/dist/extension/plugins/table/helper.js +133 -154
- package/dist/extension/plugins/table/index.js +11 -19
- package/dist/extension/plugins/table/menu/index.js +26 -38
- package/dist/extension/plugins/table/menu/table-operator.js +62 -77
- package/dist/extension/plugins/table/menu/table-size-selector.js +41 -62
- package/dist/extension/plugins/table/model.js +39 -41
- package/dist/extension/plugins/table/plugin.js +95 -102
- package/dist/extension/plugins/table/render-elem/context-menu.js +42 -65
- package/dist/extension/plugins/table/render-elem/index.js +85 -93
- package/dist/extension/plugins/table/table-operations.js +101 -118
- package/dist/extension/plugins/text-style/helpers.js +18 -28
- package/dist/extension/plugins/text-style/index.js +8 -15
- package/dist/extension/plugins/text-style/menu/index.js +19 -25
- package/dist/extension/plugins/text-style/plugin.js +16 -21
- package/dist/extension/plugins/text-style/render-elem.js +28 -33
- package/dist/extension/render/render-element.js +26 -47
- package/dist/extension/render/render-leaf.js +9 -18
- package/dist/extension/toolbar/header-toolbar/index.js +66 -84
- package/dist/extension/toolbar/index.js +2 -13
- package/dist/extension/toolbar/user-help/shortcut-dialog.js +108 -131
- package/dist/hooks/use-mathjax.js +9 -20
- package/dist/hooks/use-scroll-context.js +7 -12
- package/dist/hooks/use-selection-update.js +9 -21
- package/dist/index.js +9 -80
- package/dist/pages/markdown-editor.js +30 -43
- package/dist/pages/markdown-view.js +25 -37
- package/dist/pages/rich-markdown-editor.js +54 -67
- package/dist/pages/simple-editor.js +29 -42
- package/dist/slate-convert/html-to-slate/constants.js +26 -32
- package/dist/slate-convert/html-to-slate/helper.js +1 -7
- package/dist/slate-convert/html-to-slate/index.js +44 -51
- package/dist/slate-convert/html-to-slate/rules/blockquote.js +10 -15
- package/dist/slate-convert/html-to-slate/rules/check-list.js +10 -15
- package/dist/slate-convert/html-to-slate/rules/code-block.js +40 -51
- package/dist/slate-convert/html-to-slate/rules/header.js +11 -16
- package/dist/slate-convert/html-to-slate/rules/image.js +10 -15
- package/dist/slate-convert/html-to-slate/rules/index.js +11 -18
- package/dist/slate-convert/html-to-slate/rules/link.js +11 -16
- package/dist/slate-convert/html-to-slate/rules/list.js +21 -26
- package/dist/slate-convert/html-to-slate/rules/paragraph.js +10 -15
- package/dist/slate-convert/html-to-slate/rules/table.js +14 -19
- package/dist/slate-convert/html-to-slate/rules/text.js +14 -19
- package/dist/slate-convert/index.js +8 -34
- package/dist/slate-convert/md-to-html/index.js +26 -31
- package/dist/slate-convert/md-to-html/sanitize-schema.js +5 -12
- package/dist/slate-convert/md-to-slate/index.js +17 -23
- package/dist/slate-convert/md-to-slate/transform.js +183 -175
- package/dist/slate-convert/slate-to-md/index.js +14 -20
- package/dist/slate-convert/slate-to-md/transform.js +76 -87
- package/dist/utils/common.js +8 -15
- package/dist/utils/deserialize-html.js +118 -166
- package/dist/utils/dom-utils.js +18 -22
- package/dist/utils/event-bus.js +27 -47
- package/dist/utils/event-handler.js +29 -38
- package/dist/utils/object-utils.js +39 -62
- package/package.json +5 -4
|
@@ -1,34 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _deepCopy = _interopRequireDefault(require("deep-copy"));
|
|
11
|
-
var _slugid = _interopRequireDefault(require("slugid"));
|
|
12
|
-
var OPERATION = _interopRequireWildcard(require("./constants"));
|
|
13
|
-
var _objectUtils = _interopRequireDefault(require("../../../utils/object-utils"));
|
|
14
|
-
var decorateOperation = exports.decorateOperation = function decorateOperation(operation) {
|
|
15
|
-
var newOperation = (0, _deepCopy.default)(operation);
|
|
16
|
-
var type = newOperation.type;
|
|
1
|
+
import deepCopy from 'deep-copy';
|
|
2
|
+
import slugid from 'slugid';
|
|
3
|
+
import * as OPERATION from './constants';
|
|
4
|
+
import ObjectUtils from '../../../utils/object-utils';
|
|
5
|
+
export const decorateOperation = operation => {
|
|
6
|
+
let newOperation = deepCopy(operation);
|
|
7
|
+
const {
|
|
8
|
+
type
|
|
9
|
+
} = newOperation;
|
|
17
10
|
switch (type) {
|
|
18
11
|
case OPERATION.INSERT_NODE:
|
|
19
12
|
{
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
let {
|
|
14
|
+
node
|
|
15
|
+
} = newOperation;
|
|
16
|
+
if (!node.id) node.id = slugid.nice(); // generate an id for insert node
|
|
22
17
|
break;
|
|
23
18
|
}
|
|
24
19
|
case OPERATION.SPLIT_NODE:
|
|
25
20
|
{
|
|
26
21
|
// child: split [7, 0] -> [[7, 0],[7, 1]]
|
|
27
22
|
// parent: split [[7, 0], [7, 1]] -> [[7], [8]]
|
|
28
|
-
|
|
29
|
-
properties =
|
|
23
|
+
const {
|
|
24
|
+
properties = {}
|
|
25
|
+
} = newOperation;
|
|
30
26
|
// need generate a new id for new node
|
|
31
|
-
properties.id =
|
|
27
|
+
properties.id = slugid.nice();
|
|
32
28
|
break;
|
|
33
29
|
}
|
|
34
30
|
default:
|
|
@@ -38,29 +34,31 @@ var decorateOperation = exports.decorateOperation = function decorateOperation(o
|
|
|
38
34
|
}
|
|
39
35
|
return newOperation;
|
|
40
36
|
};
|
|
41
|
-
|
|
42
|
-
if (!
|
|
43
|
-
if (
|
|
44
|
-
return
|
|
45
|
-
|
|
37
|
+
export const replaceNodeId = node => {
|
|
38
|
+
if (!ObjectUtils.isObject(node)) return node;
|
|
39
|
+
if (ObjectUtils.hasProperty(node, 'children')) {
|
|
40
|
+
return {
|
|
41
|
+
...node,
|
|
42
|
+
id: slugid.nice(),
|
|
46
43
|
children: replacePastedDataId(node.children)
|
|
47
|
-
}
|
|
44
|
+
};
|
|
48
45
|
}
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
return {
|
|
47
|
+
...node,
|
|
48
|
+
id: slugid.nice()
|
|
49
|
+
};
|
|
52
50
|
};
|
|
53
|
-
|
|
51
|
+
export const replacePastedDataId = pastedData => {
|
|
54
52
|
// If children is malformed, return a list of correct child nodes
|
|
55
|
-
if (
|
|
53
|
+
if (ObjectUtils.isObject(pastedData)) {
|
|
56
54
|
return replaceNodeId(pastedData);
|
|
57
55
|
}
|
|
58
56
|
if (!Array.isArray(pastedData)) return [{
|
|
59
|
-
id:
|
|
57
|
+
id: slugid.nice(),
|
|
60
58
|
text: ''
|
|
61
59
|
}];
|
|
62
|
-
return pastedData.map(
|
|
63
|
-
item.id =
|
|
60
|
+
return pastedData.map(item => {
|
|
61
|
+
item.id = slugid.nice();
|
|
64
62
|
if (item.children) {
|
|
65
63
|
item.children = replacePastedDataId(item.children);
|
|
66
64
|
}
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _withNodeId = _interopRequireDefault(require("./with-node-id"));
|
|
9
|
-
var NodeIdPlugin = {
|
|
10
|
-
editorPlugin: _withNodeId.default
|
|
1
|
+
import withNodeId from './with-node-id';
|
|
2
|
+
const NodeIdPlugin = {
|
|
3
|
+
editorPlugin: withNodeId
|
|
11
4
|
};
|
|
12
|
-
|
|
5
|
+
export default NodeIdPlugin;
|
|
@@ -1,39 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
9
|
-
var _helpers = require("./helpers");
|
|
10
|
-
var catchSlateFragment = /data-slate-fragment="(.+?)"/m;
|
|
11
|
-
var getSlateFragmentAttribute = function getSlateFragmentAttribute(dataTransfer) {
|
|
12
|
-
var htmlData = dataTransfer.getData('text/html');
|
|
13
|
-
var _ref = htmlData.match(catchSlateFragment) || [],
|
|
14
|
-
_ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
15
|
-
fragment = _ref2[1];
|
|
1
|
+
import { decorateOperation, replacePastedDataId } from './helpers';
|
|
2
|
+
const catchSlateFragment = /data-slate-fragment="(.+?)"/m;
|
|
3
|
+
const getSlateFragmentAttribute = dataTransfer => {
|
|
4
|
+
const htmlData = dataTransfer.getData('text/html');
|
|
5
|
+
const [, fragment] = htmlData.match(catchSlateFragment) || [];
|
|
16
6
|
return fragment;
|
|
17
7
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
const withNodeId = editor => {
|
|
9
|
+
const {
|
|
10
|
+
apply
|
|
11
|
+
} = editor;
|
|
12
|
+
const newEditor = editor;
|
|
13
|
+
newEditor.apply = op => {
|
|
14
|
+
const newOp = decorateOperation(op);
|
|
23
15
|
apply(newOp);
|
|
24
16
|
};
|
|
25
17
|
|
|
26
18
|
// rewrite insert fragment data
|
|
27
|
-
newEditor.insertFragmentData =
|
|
28
|
-
|
|
19
|
+
newEditor.insertFragmentData = data => {
|
|
20
|
+
const fragment = data.getData('application/x-slate-fragment') || getSlateFragmentAttribute(data);
|
|
29
21
|
if (fragment) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
const decoded = decodeURIComponent(window.atob(fragment));
|
|
23
|
+
const parsed = JSON.parse(decoded);
|
|
24
|
+
const newData = replacePastedDataId(parsed);
|
|
33
25
|
newEditor.insertFragment(newData);
|
|
34
26
|
return newEditor;
|
|
35
27
|
}
|
|
36
28
|
};
|
|
37
29
|
return newEditor;
|
|
38
30
|
};
|
|
39
|
-
|
|
31
|
+
export default withNodeId;
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.transformToParagraph = void 0;
|
|
7
|
-
var _slate = require("slate");
|
|
8
|
-
var _elementTypes = require("../../constants/element-types");
|
|
9
|
-
var _core = require("../../core");
|
|
10
|
-
var transformToParagraph = exports.transformToParagraph = function transformToParagraph(editor, focusLocation) {
|
|
1
|
+
import { Transforms } from 'slate';
|
|
2
|
+
import { PARAGRAPH } from '../../constants/element-types';
|
|
3
|
+
import { focusEditor } from '../../core';
|
|
4
|
+
export const transformToParagraph = (editor, focusLocation) => {
|
|
11
5
|
if (!editor.selection) return;
|
|
12
|
-
|
|
13
|
-
type:
|
|
6
|
+
Transforms.setNodes(editor, {
|
|
7
|
+
type: PARAGRAPH
|
|
14
8
|
});
|
|
15
|
-
|
|
9
|
+
focusEditor(editor, focusLocation);
|
|
16
10
|
};
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _elementTypes = require("../../constants/element-types");
|
|
9
|
-
var _plugin = _interopRequireDefault(require("./plugin"));
|
|
10
|
-
var _renderElem = _interopRequireDefault(require("./render-elem"));
|
|
11
|
-
var ParagraphPlugin = {
|
|
12
|
-
type: _elementTypes.PARAGRAPH,
|
|
1
|
+
import { PARAGRAPH } from '../../constants/element-types';
|
|
2
|
+
import withParagraph from './plugin';
|
|
3
|
+
import renderParagraph from './render-elem';
|
|
4
|
+
const ParagraphPlugin = {
|
|
5
|
+
type: PARAGRAPH,
|
|
13
6
|
nodeType: 'element',
|
|
14
|
-
editorPlugin:
|
|
15
|
-
renderElements: [
|
|
7
|
+
editorPlugin: withParagraph,
|
|
8
|
+
renderElements: [renderParagraph]
|
|
16
9
|
};
|
|
17
|
-
|
|
10
|
+
export default ParagraphPlugin;
|
|
@@ -1,42 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
newEditor.deleteBackward = function (unit) {
|
|
14
|
-
var selection = newEditor.selection;
|
|
1
|
+
import { Editor, Node, Range, Transforms } from 'slate';
|
|
2
|
+
import { getPrevNode, getSelectedNodeEntryByType, isStartPoint } from '../../core';
|
|
3
|
+
import { CHECK_LIST_ITEM, PARAGRAPH } from '../../constants/element-types';
|
|
4
|
+
const withParagraph = editor => {
|
|
5
|
+
const {
|
|
6
|
+
deleteBackward
|
|
7
|
+
} = editor;
|
|
8
|
+
const newEditor = editor;
|
|
9
|
+
newEditor.deleteBackward = unit => {
|
|
10
|
+
const {
|
|
11
|
+
selection
|
|
12
|
+
} = newEditor;
|
|
15
13
|
if (!selection) {
|
|
16
14
|
deleteBackward(unit);
|
|
17
15
|
return;
|
|
18
16
|
}
|
|
19
|
-
|
|
17
|
+
const selectedParagraphNodeEntry = getSelectedNodeEntryByType(newEditor, PARAGRAPH);
|
|
20
18
|
if (selectedParagraphNodeEntry) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
const isCollapsed = Range.isCollapsed(selection);
|
|
20
|
+
const isCursorAtStartOfLine = isStartPoint(editor, selection.anchor, selection);
|
|
21
|
+
const previousNodeEntry = getPrevNode(newEditor);
|
|
22
|
+
const isCheckListAtPrevious = previousNodeEntry && previousNodeEntry[0].type === CHECK_LIST_ITEM;
|
|
25
23
|
// If cursor is at start of line and previous node is check list,remove the paragraph
|
|
26
24
|
// instead of delete backward, which fix the bug that the check list will be removed when user
|
|
27
25
|
// press backspace at start of line.
|
|
28
26
|
if (isCollapsed && isCursorAtStartOfLine && isCheckListAtPrevious) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
const focusPoint = Editor.end(newEditor, previousNodeEntry[1]);
|
|
28
|
+
const selectedParagraphText = Node.string(selectedParagraphNodeEntry[0]);
|
|
29
|
+
const checkListText = Node.string(previousNodeEntry[0]);
|
|
30
|
+
const newCheckListText = checkListText + selectedParagraphText;
|
|
31
|
+
Transforms.insertText(newEditor, newCheckListText, {
|
|
34
32
|
at: previousNodeEntry[1]
|
|
35
33
|
});
|
|
36
|
-
|
|
34
|
+
Transforms.removeNodes(newEditor, {
|
|
37
35
|
at: selectedParagraphNodeEntry[1]
|
|
38
36
|
});
|
|
39
|
-
|
|
37
|
+
Transforms.select(newEditor, focusPoint);
|
|
40
38
|
return;
|
|
41
39
|
}
|
|
42
40
|
}
|
|
@@ -44,4 +42,4 @@ var withParagraph = function withParagraph(editor) {
|
|
|
44
42
|
};
|
|
45
43
|
return newEditor;
|
|
46
44
|
};
|
|
47
|
-
|
|
45
|
+
export default withParagraph;
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var renderParagraph = function renderParagraph(_ref) {
|
|
10
|
-
var element = _ref.element,
|
|
11
|
-
attributes = _ref.attributes,
|
|
12
|
-
children = _ref.children;
|
|
13
|
-
return /*#__PURE__*/_react.default.createElement("p", Object.assign({
|
|
1
|
+
import React from 'react';
|
|
2
|
+
const renderParagraph = _ref => {
|
|
3
|
+
let {
|
|
4
|
+
element,
|
|
5
|
+
attributes,
|
|
6
|
+
children
|
|
7
|
+
} = _ref;
|
|
8
|
+
return /*#__PURE__*/React.createElement("p", Object.assign({
|
|
14
9
|
"data-id": element.id,
|
|
15
10
|
"data-root": "true"
|
|
16
11
|
}, attributes), children);
|
|
17
12
|
};
|
|
18
|
-
|
|
13
|
+
export default renderParagraph;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.TABLE_ROW_NODE_NAME = exports.TABLE_CELL_NODE_NAME = exports.TABLE_BODY_NODE_NAME = void 0;
|
|
7
|
-
var TABLE_CELL_NODE_NAME = exports.TABLE_CELL_NODE_NAME = 'td';
|
|
8
|
-
var TABLE_ROW_NODE_NAME = exports.TABLE_ROW_NODE_NAME = 'tr';
|
|
9
|
-
var TABLE_BODY_NODE_NAME = exports.TABLE_BODY_NODE_NAME = 'tbody';
|
|
1
|
+
export const TABLE_CELL_NODE_NAME = 'td';
|
|
2
|
+
export const TABLE_ROW_NODE_NAME = 'tr';
|
|
3
|
+
export const TABLE_BODY_NODE_NAME = 'tbody';
|