@seafile/sdoc-editor 0.1.14-beta → 0.1.15
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/basic-sdk/editor.js +0 -1
- package/dist/basic-sdk/extension/core/queries/index.js +6 -0
- package/dist/basic-sdk/extension/plugins/blockquote/helpers.js +3 -3
- package/dist/basic-sdk/extension/plugins/blockquote/plugin.js +5 -5
- package/dist/basic-sdk/extension/plugins/code-block/plugin.js +2 -16
- package/dist/basic-sdk/extension/plugins/header/menu/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/link/plugin.js +14 -13
- package/dist/basic-sdk/extension/plugins/list/plugin/index.js +2 -0
- package/dist/basic-sdk/extension/plugins/list/plugin/insert-fragment-list.js +191 -0
- package/dist/basic-sdk/extension/utils/index.js +9 -0
- package/dist/components/doc-operations/index.js +3 -20
- package/dist/utils/index.js +0 -11
- package/package.json +1 -1
package/dist/basic-sdk/editor.js
CHANGED
|
@@ -82,7 +82,6 @@ var SDocEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
82
82
|
renderLeaf: function renderLeaf(props) {
|
|
83
83
|
return _renderLeaf(props, _this2.editor);
|
|
84
84
|
},
|
|
85
|
-
onDOMBeforeInput: function onDOMBeforeInput(event) {},
|
|
86
85
|
onKeyDown: this.eventProxy.onKeyDown
|
|
87
86
|
})))));
|
|
88
87
|
}
|
|
@@ -35,6 +35,12 @@ export var getNode = function getNode(editor, path) {
|
|
|
35
35
|
export var getNodeType = function getNodeType(node) {
|
|
36
36
|
return Element.isElement(node) ? node.type : '';
|
|
37
37
|
};
|
|
38
|
+
export var getNodes = function getNodes(node, options) {
|
|
39
|
+
return Node.nodes(node, options);
|
|
40
|
+
};
|
|
41
|
+
export var getCommonNode = function getCommonNode(root, path, ancestor) {
|
|
42
|
+
return Node.common(root, path, ancestor);
|
|
43
|
+
};
|
|
38
44
|
export var getSelectedNodeByType = function getSelectedNodeByType(editor, type) {
|
|
39
45
|
var match = function match(n) {
|
|
40
46
|
return getNodeType(n) === type;
|
|
@@ -8,18 +8,18 @@ export var isMenuDisabled = function isMenuDisabled(editor) {
|
|
|
8
8
|
match: function match(n) {
|
|
9
9
|
var type = getNodeType(n);
|
|
10
10
|
|
|
11
|
-
//
|
|
11
|
+
// Only available for p and blockquote
|
|
12
12
|
if (type === 'paragraph') return true;
|
|
13
13
|
if (type === 'blockquote') return true;
|
|
14
14
|
return false;
|
|
15
15
|
},
|
|
16
16
|
universal: true,
|
|
17
|
-
mode: 'highest' //
|
|
17
|
+
mode: 'highest' // Match top level
|
|
18
18
|
}),
|
|
19
19
|
_Editor$nodes2 = _slicedToArray(_Editor$nodes, 1),
|
|
20
20
|
nodeEntry = _Editor$nodes2[0];
|
|
21
21
|
|
|
22
|
-
//
|
|
22
|
+
// Match to p blockquote, do not disable
|
|
23
23
|
if (nodeEntry) {
|
|
24
24
|
return false;
|
|
25
25
|
}
|
|
@@ -23,13 +23,13 @@ var withBlockquote = function withBlockquote(editor) {
|
|
|
23
23
|
var quotePath = ReactEditor.findPath(editor, quoteElem);
|
|
24
24
|
var quoteEndLocation = Editor.end(editor, quotePath);
|
|
25
25
|
if (Point.equals(quoteEndLocation, selection.focus)) {
|
|
26
|
-
//
|
|
26
|
+
// Cursor is at the end of blockquote
|
|
27
27
|
var str = Node.string(quoteElem);
|
|
28
|
-
// blockquote
|
|
28
|
+
// The last of the blockquote text is \n;
|
|
29
29
|
if (str && str.slice(-1) === '\n') {
|
|
30
|
-
//
|
|
30
|
+
// Step 1: Remove the last \n
|
|
31
31
|
editor.deleteBackward('character');
|
|
32
|
-
//
|
|
32
|
+
// Step 2: Insert a paragraph
|
|
33
33
|
var p = generateEmptyElement(PARAGRAPH);
|
|
34
34
|
Transforms.insertNodes(newEditor, p, {
|
|
35
35
|
mode: 'highest'
|
|
@@ -38,7 +38,7 @@ var withBlockquote = function withBlockquote(editor) {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
//
|
|
41
|
+
// In other cases, insert a newline
|
|
42
42
|
insertText('\n');
|
|
43
43
|
};
|
|
44
44
|
return newEditor;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import {
|
|
2
|
+
import { Transforms, Node } from '@seafile/slate';
|
|
3
3
|
import { getSelectedNodeByType, getNodeType, isLastNode, genEmptyParagraph } from '../../core';
|
|
4
4
|
import { CODE_BLOCK } from '../../constants';
|
|
5
5
|
var getLastTextLineBeforeSelection = function getLastTextLineBeforeSelection(codeNode, editor) {
|
|
@@ -15,8 +15,7 @@ var getLastTextLineBeforeSelection = function getLastTextLineBeforeSelection(cod
|
|
|
15
15
|
};
|
|
16
16
|
var withCodeBlock = function withCodeBlock(editor) {
|
|
17
17
|
var insertBreak = editor.insertBreak,
|
|
18
|
-
normalizeNode = editor.normalizeNode
|
|
19
|
-
insertData = editor.insertData;
|
|
18
|
+
normalizeNode = editor.normalizeNode;
|
|
20
19
|
var newEditor = editor;
|
|
21
20
|
|
|
22
21
|
// Rewrite insertBreak
|
|
@@ -71,19 +70,6 @@ var withCodeBlock = function withCodeBlock(editor) {
|
|
|
71
70
|
// Perform default behavior
|
|
72
71
|
return normalizeNode([node, path]);
|
|
73
72
|
};
|
|
74
|
-
|
|
75
|
-
// Rewrite insertData - Paste text
|
|
76
|
-
newEditor.insertData = function (data) {
|
|
77
|
-
var codeNode = getSelectedNodeByType(newEditor, CODE_BLOCK);
|
|
78
|
-
if (codeNode == null) {
|
|
79
|
-
insertData(data); // Perform default insertData
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Gets the text and inserts it into the code block
|
|
84
|
-
var text = data.getData('text/plain');
|
|
85
|
-
Editor.insertText(newEditor, text);
|
|
86
|
-
};
|
|
87
73
|
return newEditor;
|
|
88
74
|
};
|
|
89
75
|
export default withCodeBlock;
|
|
@@ -38,7 +38,7 @@ var HeaderMenu = /*#__PURE__*/function (_React$Component) {
|
|
|
38
38
|
};
|
|
39
39
|
_this.onToggleClick = function (event) {
|
|
40
40
|
event.stopPropagation();
|
|
41
|
-
event.nativeEvent.stopImmediatePropagation
|
|
41
|
+
event.nativeEvent.stopImmediatePropagation;
|
|
42
42
|
var isShowHeaderPopover = !_this.state.isShowHeaderPopover;
|
|
43
43
|
if (isShowHeaderPopover) {
|
|
44
44
|
_this.setState({
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import {
|
|
2
|
+
import { Transforms, Node } from '@seafile/slate';
|
|
3
3
|
import isUrl from 'is-url';
|
|
4
|
-
import {
|
|
4
|
+
import { genLinkNode } from './helpers';
|
|
5
5
|
import { getNodeType } from '../../core';
|
|
6
|
+
import { isImage } from '../../utils';
|
|
6
7
|
var withLink = function withLink(editor) {
|
|
7
8
|
var normalizeNode = editor.normalizeNode,
|
|
8
9
|
isInline = editor.isInline,
|
|
@@ -17,22 +18,22 @@ var withLink = function withLink(editor) {
|
|
|
17
18
|
}
|
|
18
19
|
return isInline(elem);
|
|
19
20
|
};
|
|
20
|
-
|
|
21
|
-
// Rewrite insertData, Paste insert link
|
|
22
21
|
newEditor.insertData = function (data) {
|
|
22
|
+
// Paste content from sdoc document
|
|
23
|
+
if (newEditor.insertFragmentData(data)) return;
|
|
24
|
+
|
|
25
|
+
// Paste content from other document
|
|
23
26
|
var text = data.getData('text/plain');
|
|
24
|
-
if (!isUrl(text)) {
|
|
25
|
-
//
|
|
27
|
+
if (!isUrl(text) && !isImage(text)) {
|
|
28
|
+
// not a link content
|
|
26
29
|
insertData(data);
|
|
27
30
|
return;
|
|
28
31
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var selectedText = Editor.string(newEditor, selection); // Gets the selected text
|
|
35
|
-
insertLink(newEditor, selectedText, text);
|
|
32
|
+
var link = genLinkNode(text, text);
|
|
33
|
+
Transforms.insertNodes(newEditor, [link, {
|
|
34
|
+
text: ' '
|
|
35
|
+
}]);
|
|
36
|
+
return;
|
|
36
37
|
};
|
|
37
38
|
|
|
38
39
|
// Rewrite normalizeNode
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { insertBreakList } from './insert-break-list';
|
|
2
2
|
import { onTabHandle } from './on-tab-handle';
|
|
3
3
|
import { normalizeList } from './normalize-list';
|
|
4
|
+
import { insertFragmentList } from './insert-fragment-list';
|
|
4
5
|
var withList = function withList(editor) {
|
|
5
6
|
var insertBreak = editor.insertBreak,
|
|
6
7
|
deleteBackWord = editor.deleteBackWord,
|
|
@@ -28,6 +29,7 @@ var withList = function withList(editor) {
|
|
|
28
29
|
if (onTabHandle(newEditor, event)) return;
|
|
29
30
|
handleTab && handleTab();
|
|
30
31
|
};
|
|
32
|
+
newEditor.insertFragment = insertFragmentList(newEditor);
|
|
31
33
|
newEditor.normalizeNode = normalizeList(editor);
|
|
32
34
|
return newEditor;
|
|
33
35
|
};
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _toArray from "@babel/runtime/helpers/esm/toArray";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
+
import { Element, Path, Transforms, Node, Editor } from '@seafile/slate';
|
|
5
|
+
import { LIST_ITEM, LIST_LIC } from '../../../constants';
|
|
6
|
+
import { findNode, getCommonNode, getNode, getNodes } from '../../../core';
|
|
7
|
+
import { getListTypes } from '../queries';
|
|
8
|
+
var isListRoot = function isListRoot(node) {
|
|
9
|
+
return Element.isElement(node) && getListTypes().includes(node.type);
|
|
10
|
+
};
|
|
11
|
+
var getFirstAncestorOfType = function getFirstAncestorOfType(root, entry, _ref) {
|
|
12
|
+
var type = _ref.type;
|
|
13
|
+
var ancestor = Path.parent(entry[1]);
|
|
14
|
+
while (getNode(root, ancestor).type !== type) {
|
|
15
|
+
ancestor = Path.parent(ancestor);
|
|
16
|
+
}
|
|
17
|
+
return [getNode(root, ancestor), ancestor];
|
|
18
|
+
};
|
|
19
|
+
var findListItemsWithContent = function findListItemsWithContent(first) {
|
|
20
|
+
var prev = null;
|
|
21
|
+
var node = first;
|
|
22
|
+
while (isListRoot(node) || node.type === LIST_ITEM && node.children[0].type !== LIST_LIC) {
|
|
23
|
+
prev = node;
|
|
24
|
+
var _node$children = _slicedToArray(node.children, 1);
|
|
25
|
+
node = _node$children[0];
|
|
26
|
+
}
|
|
27
|
+
return prev ? prev.children : [node];
|
|
28
|
+
};
|
|
29
|
+
var trimList = function trimList(listRoot) {
|
|
30
|
+
if (!isListRoot(listRoot)) {
|
|
31
|
+
return [listRoot];
|
|
32
|
+
}
|
|
33
|
+
var _texts = Node.texts(listRoot);
|
|
34
|
+
var textEntries = Array.from(_texts);
|
|
35
|
+
var commonAncestorEntry = textEntries.reduce(function (commonAncestor, textEntry) {
|
|
36
|
+
return Path.isAncestor(commonAncestor[1], textEntry[1]) ? commonAncestor : getCommonNode(listRoot, textEntry[1], commonAncestor[1]);
|
|
37
|
+
}, getFirstAncestorOfType(listRoot, textEntries[0], {
|
|
38
|
+
type: LIST_ITEM
|
|
39
|
+
}));
|
|
40
|
+
|
|
41
|
+
// is ul/ol: return children
|
|
42
|
+
// is not ul/ol
|
|
43
|
+
var _ref2 = isListRoot(commonAncestorEntry[0]) ? commonAncestorEntry[0].children : [commonAncestorEntry[0]],
|
|
44
|
+
_ref3 = _toArray(_ref2),
|
|
45
|
+
first = _ref3[0],
|
|
46
|
+
rest = _ref3.slice(1);
|
|
47
|
+
return [].concat(_toConsumableArray(findListItemsWithContent(first)), _toConsumableArray(rest));
|
|
48
|
+
};
|
|
49
|
+
var wrapNodeIntoListItem = function wrapNodeIntoListItem(node) {
|
|
50
|
+
return node.type === LIST_ITEM ? node : {
|
|
51
|
+
type: LIST_ITEM,
|
|
52
|
+
children: [node]
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
var isSingleLic = function isSingleLic(fragment) {
|
|
56
|
+
var isFragmentOnlyListRoot = fragment.length === 1 && isListRoot(fragment[0]);
|
|
57
|
+
return isFragmentOnlyListRoot && _toConsumableArray(getNodes({
|
|
58
|
+
children: fragment
|
|
59
|
+
})).filter(function (entry) {
|
|
60
|
+
return Element.isElement(entry[0]);
|
|
61
|
+
}).filter(function (_ref4) {
|
|
62
|
+
var _ref5 = _slicedToArray(_ref4, 1),
|
|
63
|
+
node = _ref5[0];
|
|
64
|
+
return node.type === LIST_LIC;
|
|
65
|
+
}).length === 1;
|
|
66
|
+
};
|
|
67
|
+
export var getTextAndListItemNodes = function getTextAndListItemNodes(editor, fragment, liEntry, licEntry) {
|
|
68
|
+
var _liEntry = _slicedToArray(liEntry, 2),
|
|
69
|
+
liPath = _liEntry[1];
|
|
70
|
+
var _licEntry = _slicedToArray(licEntry, 2),
|
|
71
|
+
licNode = _licEntry[0],
|
|
72
|
+
licPath = _licEntry[1];
|
|
73
|
+
var isEmptyNode = !Node.string(licNode);
|
|
74
|
+
// format copied fragment
|
|
75
|
+
// first: lic, path: [...liPath, 0, 0]
|
|
76
|
+
// rest: children, path: [...liPath, 1, 0]
|
|
77
|
+
var _fragment$flatMap$map = fragment.flatMap(trimList).map(wrapNodeIntoListItem),
|
|
78
|
+
_fragment$flatMap$map2 = _toArray(_fragment$flatMap$map),
|
|
79
|
+
first = _fragment$flatMap$map2[0],
|
|
80
|
+
rest = _fragment$flatMap$map2.slice(1);
|
|
81
|
+
var textNode = null;
|
|
82
|
+
var listItemNodes = [];
|
|
83
|
+
if (isListRoot(fragment[0])) {
|
|
84
|
+
if (isSingleLic(fragment)) {
|
|
85
|
+
textNode = first;
|
|
86
|
+
listItemNodes = rest;
|
|
87
|
+
} else if (isEmptyNode) {
|
|
88
|
+
var li = getNode(editor, liPath);
|
|
89
|
+
var _li$children = _toArray(li.children),
|
|
90
|
+
currentSubLists = _li$children.slice(1); // old
|
|
91
|
+
|
|
92
|
+
var _first$children = _toArray(first.children),
|
|
93
|
+
newLic = _first$children[0],
|
|
94
|
+
newSubLists = _first$children.slice(1); // copied
|
|
95
|
+
// insert copied contents
|
|
96
|
+
Transforms.insertNodes(editor, newLic, {
|
|
97
|
+
at: Path.next(licPath),
|
|
98
|
+
select: true
|
|
99
|
+
});
|
|
100
|
+
Transforms.removeNodes(editor, {
|
|
101
|
+
at: licPath
|
|
102
|
+
});
|
|
103
|
+
if (newSubLists.length) {
|
|
104
|
+
if (currentSubLists.length) {
|
|
105
|
+
var path = [].concat(_toConsumableArray(liPath), [1, 0]);
|
|
106
|
+
Transforms.insertNodes(editor, newSubLists[0].children, {
|
|
107
|
+
at: path,
|
|
108
|
+
select: true
|
|
109
|
+
});
|
|
110
|
+
} else {
|
|
111
|
+
Transforms.insertNodes(editor, newSubLists, {
|
|
112
|
+
at: Path.next(licPath),
|
|
113
|
+
select: true
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
textNode = {
|
|
118
|
+
text: ''
|
|
119
|
+
};
|
|
120
|
+
listItemNodes = rest;
|
|
121
|
+
} else {
|
|
122
|
+
textNode = {
|
|
123
|
+
text: ''
|
|
124
|
+
};
|
|
125
|
+
listItemNodes = [first].concat(_toConsumableArray(rest));
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
textNode = first;
|
|
129
|
+
listItemNodes = rest;
|
|
130
|
+
return {
|
|
131
|
+
textNode: textNode,
|
|
132
|
+
listItemNodes: listItemNodes
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
textNode: textNode,
|
|
137
|
+
listItemNodes: listItemNodes
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
export var insertFragmentList = function insertFragmentList(editor) {
|
|
141
|
+
var _insertFragment = editor.insertFragment;
|
|
142
|
+
return function (fragment) {
|
|
143
|
+
Editor.withoutNormalizing(editor, function () {
|
|
144
|
+
var liEntry = findNode(editor, {
|
|
145
|
+
match: {
|
|
146
|
+
type: LIST_ITEM
|
|
147
|
+
},
|
|
148
|
+
mode: 'lowest'
|
|
149
|
+
});
|
|
150
|
+
if (!liEntry) {
|
|
151
|
+
var nodes = isListRoot(fragment) ? [{
|
|
152
|
+
text: ''
|
|
153
|
+
}].concat(_toConsumableArray(fragment)) : fragment;
|
|
154
|
+
return _insertFragment(nodes);
|
|
155
|
+
}
|
|
156
|
+
Transforms.insertFragment(editor, [{
|
|
157
|
+
text: ''
|
|
158
|
+
}]); // need ' '
|
|
159
|
+
|
|
160
|
+
liEntry = findNode(editor, {
|
|
161
|
+
match: {
|
|
162
|
+
type: LIST_ITEM
|
|
163
|
+
},
|
|
164
|
+
mode: 'lowest'
|
|
165
|
+
});
|
|
166
|
+
var licEntry = findNode(editor, {
|
|
167
|
+
match: {
|
|
168
|
+
type: LIST_LIC
|
|
169
|
+
},
|
|
170
|
+
mode: 'lowest'
|
|
171
|
+
});
|
|
172
|
+
if (!licEntry) {
|
|
173
|
+
var _nodes = isListRoot(fragment) ? [{
|
|
174
|
+
text: ''
|
|
175
|
+
}].concat(_toConsumableArray(fragment)) : fragment;
|
|
176
|
+
return _insertFragment(_nodes);
|
|
177
|
+
}
|
|
178
|
+
var _getTextAndListItemNo = getTextAndListItemNodes(editor, fragment, liEntry, licEntry),
|
|
179
|
+
textNode = _getTextAndListItemNo.textNode,
|
|
180
|
+
listItemNodes = _getTextAndListItemNo.listItemNodes;
|
|
181
|
+
Transforms.insertFragment(editor, [textNode]);
|
|
182
|
+
var _liEntry2 = liEntry,
|
|
183
|
+
_liEntry3 = _slicedToArray(_liEntry2, 2),
|
|
184
|
+
liPath = _liEntry3[1];
|
|
185
|
+
return Transforms.insertNodes(editor, listItemNodes, {
|
|
186
|
+
at: Path.next(liPath),
|
|
187
|
+
select: true
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import isUrl from 'is-url';
|
|
2
|
+
export var IMAGE_TYPES = ['png', 'jpg', 'gif'];
|
|
3
|
+
export var isImage = function isImage(url) {
|
|
4
|
+
if (!url) return false;
|
|
5
|
+
if (!isUrl(url)) return false;
|
|
6
|
+
var suffix = url.split('.')[1]; // http://xx/mm/*.png
|
|
7
|
+
if (!suffix) return false;
|
|
8
|
+
return IMAGE_TYPES.includes(suffix.toLowerCase());
|
|
9
|
+
};
|
|
@@ -4,42 +4,25 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
|
4
4
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
5
|
import React, { Fragment } from 'react';
|
|
6
6
|
import CollaboratorsOperation from './collaborators-operation';
|
|
7
|
-
import context from '../../context';
|
|
8
|
-
import { encodePath } from '../../utils';
|
|
9
7
|
import './style.css';
|
|
10
8
|
var DocOperations = /*#__PURE__*/function (_React$Component) {
|
|
11
9
|
_inherits(DocOperations, _React$Component);
|
|
12
10
|
var _super = _createSuper(DocOperations);
|
|
13
11
|
function DocOperations() {
|
|
14
|
-
var _this;
|
|
15
12
|
_classCallCheck(this, DocOperations);
|
|
16
|
-
|
|
17
|
-
args[_key] = arguments[_key];
|
|
18
|
-
}
|
|
19
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
20
|
-
_this.toggleHistory = function (event) {
|
|
21
|
-
event.stopPropagation();
|
|
22
|
-
event.nativeEvent.stopImmediatePropagation();
|
|
23
|
-
var siteRoot = context.getSetting('siteRoot');
|
|
24
|
-
var repoID = context.getSetting('repoID');
|
|
25
|
-
var docPath = context.getSetting('docPath');
|
|
26
|
-
window.location.href = siteRoot + 'repo/file_revisions/' + repoID + '/?p=' + encodePath(docPath);
|
|
27
|
-
};
|
|
28
|
-
return _this;
|
|
13
|
+
return _super.apply(this, arguments);
|
|
29
14
|
}
|
|
30
15
|
_createClass(DocOperations, [{
|
|
31
16
|
key: "render",
|
|
32
17
|
value: function render() {
|
|
33
|
-
var docPerm = context.getSetting('docPerm');
|
|
34
18
|
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
35
19
|
className: "doc-ops"
|
|
36
20
|
}, /*#__PURE__*/React.createElement("span", {
|
|
37
21
|
className: "op-item"
|
|
38
22
|
}, /*#__PURE__*/React.createElement("i", {
|
|
39
23
|
className: "iconfont icon-share"
|
|
40
|
-
})),
|
|
41
|
-
className: "op-item"
|
|
42
|
-
onClick: this.toggleHistory
|
|
24
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
25
|
+
className: "op-item"
|
|
43
26
|
}, /*#__PURE__*/React.createElement("i", {
|
|
44
27
|
className: "iconfont icon-history"
|
|
45
28
|
})), /*#__PURE__*/React.createElement(CollaboratorsOperation, null), /*#__PURE__*/React.createElement("span", {
|
package/dist/utils/index.js
CHANGED
|
@@ -18,15 +18,4 @@ export var generateDefaultDocContent = function generateDefaultDocContent() {
|
|
|
18
18
|
}]
|
|
19
19
|
};
|
|
20
20
|
return defaultValue;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// IE8 not support map, so use push
|
|
24
|
-
export var encodePath = function encodePath(path) {
|
|
25
|
-
if (!path) return '';
|
|
26
|
-
var path_arr = path.split('/');
|
|
27
|
-
var path_arr_ = [];
|
|
28
|
-
for (var i = 0, len = path_arr.length; i < len; i++) {
|
|
29
|
-
path_arr_.push(encodeURIComponent(path_arr[i]));
|
|
30
|
-
}
|
|
31
|
-
return path_arr_.join('/');
|
|
32
21
|
};
|