@seafile/seafile-editor 1.0.82 → 1.0.83
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.
|
@@ -53,6 +53,9 @@ const withCodeBlock = editor => {
|
|
|
53
53
|
if (node.type === _elementTypes.CODE_BLOCK) {
|
|
54
54
|
const codeLineArr = node.children.map(line => line);
|
|
55
55
|
data.splice(index, 1, ...codeLineArr);
|
|
56
|
+
// Paste the copied content in place in code_block
|
|
57
|
+
} else if (node.type === _elementTypes.CODE_LINE) {
|
|
58
|
+
data.splice(index, 1, node);
|
|
56
59
|
}
|
|
57
60
|
});
|
|
58
61
|
const insertCodeLines = data.map(node => {
|
|
@@ -65,6 +68,12 @@ const withCodeBlock = editor => {
|
|
|
65
68
|
|
|
66
69
|
// Current focus code-line string not empty
|
|
67
70
|
const string = _slate.Editor.string(newEditor, newEditor.selection.focus.path);
|
|
71
|
+
// Paste the copied content in place in code_block
|
|
72
|
+
if (insertCodeLines.length === 1 && _slate.Range.isExpanded(newEditor.selection)) {
|
|
73
|
+
const text = _slate.Node.string(insertCodeLines[0]);
|
|
74
|
+
insertText(text);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
68
77
|
if (string.length !== 0 && _slate.Range.isCollapsed(newEditor.selection)) {
|
|
69
78
|
const [node, ...restNode] = insertCodeLines;
|
|
70
79
|
const text = _slate.Node.string(node);
|
|
@@ -18,7 +18,7 @@ const withHtml = editor => {
|
|
|
18
18
|
newEditor.insertData = data => {
|
|
19
19
|
// If the text is a link and is not within the code_block block, it is processed as link
|
|
20
20
|
const text = data.getData('text/plain') || '';
|
|
21
|
-
if ((0, _isUrl.default)(text) && !(0, _helpers.isInCodeBlock)(newEditor)) {
|
|
21
|
+
if (text.trim() && (0, _isUrl.default)(text.trim()) && !(0, _helpers.isInCodeBlock)(newEditor)) {
|
|
22
22
|
insertData(data);
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
@@ -110,7 +110,7 @@ var _formula = _interopRequireDefault(require("./formula"));
|
|
|
110
110
|
var _column = _interopRequireDefault(require("./column"));
|
|
111
111
|
var _markdown = _interopRequireDefault(require("./markdown"));
|
|
112
112
|
var _html = _interopRequireDefault(require("./html"));
|
|
113
|
-
const Plugins = [_paragraph.default, _textStyle.default, _header.default, _image.default, _link.default,
|
|
113
|
+
const Plugins = [_paragraph.default, _textStyle.default, _header.default, _image.default, _link.default, _checkList.default, _list.default, _codeBlock.default, _table.default, _blockquote.default, _formula.default, _markdown.default, _html.default, _column.default,
|
|
114
114
|
// put at the end
|
|
115
115
|
_nodeId.default];
|
|
116
116
|
var _default = exports.default = Plugins;
|
|
@@ -7,6 +7,47 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.formatSlateToMd = void 0;
|
|
8
8
|
var _slate = require("slate");
|
|
9
9
|
var _isPunctuationMark = _interopRequireDefault(require("../../utils/is-punctuation-mark"));
|
|
10
|
+
const formatInlineChildren = children => {
|
|
11
|
+
return children.reduce((ret, item, index) => {
|
|
12
|
+
if (index === 0) return [item];
|
|
13
|
+
let prev = ret[ret.length - 1];
|
|
14
|
+
if (prev.type === item.type && item.type === 'text') {
|
|
15
|
+
prev = {
|
|
16
|
+
type: 'text',
|
|
17
|
+
value: prev.value + item.value
|
|
18
|
+
};
|
|
19
|
+
} else if (prev.type === item.type && item.type === 'strong') {
|
|
20
|
+
const prevChild = prev.children[0];
|
|
21
|
+
const nextChild = item.children[0];
|
|
22
|
+
prev.children = [{
|
|
23
|
+
type: 'text',
|
|
24
|
+
value: prevChild.value + nextChild.value
|
|
25
|
+
}];
|
|
26
|
+
} else if (prev.type === item.type && item.type === 'emphasis') {
|
|
27
|
+
const prevChild = prev.children[0];
|
|
28
|
+
const nextChild = item.children[0];
|
|
29
|
+
if (prevChild.type === nextChild.type && prevChild.type === 'text') {
|
|
30
|
+
prev.children = [{
|
|
31
|
+
type: 'text',
|
|
32
|
+
value: prevChild.value + nextChild.value
|
|
33
|
+
}];
|
|
34
|
+
} else if (prevChild.type === nextChild.type && prevChild.type === 'strong') {
|
|
35
|
+
prev.children = [{
|
|
36
|
+
type: 'strong',
|
|
37
|
+
children: [{
|
|
38
|
+
type: 'text',
|
|
39
|
+
value: prevChild.children[0].value + nextChild.children[0].value
|
|
40
|
+
}]
|
|
41
|
+
}];
|
|
42
|
+
} else {
|
|
43
|
+
ret.push(item);
|
|
44
|
+
}
|
|
45
|
+
} else {
|
|
46
|
+
ret.push(item);
|
|
47
|
+
}
|
|
48
|
+
return ret;
|
|
49
|
+
}, []);
|
|
50
|
+
};
|
|
10
51
|
const generateDefaultText = value => {
|
|
11
52
|
return {
|
|
12
53
|
type: 'text',
|
|
@@ -117,7 +158,9 @@ const transformNodeWithInlineChildren = node => {
|
|
|
117
158
|
}
|
|
118
159
|
const result = [];
|
|
119
160
|
children.forEach(item => transformInlineChildren(result, item));
|
|
120
|
-
|
|
161
|
+
|
|
162
|
+
// format result
|
|
163
|
+
return formatInlineChildren(result.flat());
|
|
121
164
|
};
|
|
122
165
|
const transformHeader = node => {
|
|
123
166
|
const level = node.type.replace('header', '');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seafile/seafile-editor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.83",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"push-translate": "tx push -s",
|
|
10
10
|
"pull-translate": "tx pull -f",
|
|
11
11
|
"start": "export NODE_ENV=development LOG_ENV=rc && node dev-server.js",
|
|
12
|
-
"
|
|
13
|
-
"prepublishOnly": "npm run clean && npm run
|
|
12
|
+
"pub:dist": "export BABEL_ENV=production && ./node_modules/.bin/babel src --out-dir dist --copy-files",
|
|
13
|
+
"prepublishOnly": "npm run clean && npm run pub:dist",
|
|
14
14
|
"lint-fix": "eslint --fix --ext .js,.jsx src/"
|
|
15
15
|
},
|
|
16
16
|
"keywords": [ ],
|
package/readme.md
CHANGED
|
@@ -187,4 +187,34 @@ processor.process(string).then(result => {
|
|
|
187
187
|
```
|
|
188
188
|
|
|
189
189
|
|
|
190
|
+
## 🖥 Environment Support
|
|
191
|
+
|
|
192
|
+
* Modern browsers
|
|
193
|
+
* Software built-in browser
|
|
194
|
+
|
|
195
|
+
### Modern browsers
|
|
196
|
+
|
|
197
|
+
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Safari |
|
|
198
|
+
| --- | --- | --- | --- |
|
|
199
|
+
| Edge | false | last 2 versions | false |
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
### Software built-in browser
|
|
203
|
+
|
|
204
|
+
**Mac OS**
|
|
205
|
+
|
|
206
|
+
| software | browser | version | internal | isSupport |
|
|
207
|
+
|-|-|-|-|-|
|
|
208
|
+
|<img src="./assets/imgs/wechat.png" width='16'> WeChat| Chrome |107.0.0.0| AppleWebKit/537.36 |false|
|
|
209
|
+
|<img src="./assets/imgs/wecom.png" width='16'> WeCom|Safari||AppleWebKit/605.1.15 |false|
|
|
210
|
+
|
|
211
|
+
**Windows OS**
|
|
212
|
+
> windows 11
|
|
213
|
+
|
|
214
|
+
| software | browser | version | internal | isSupport |
|
|
215
|
+
|-|-|-|-|-|
|
|
216
|
+
|<img src="./assets/imgs/wechat.png" width='16'> WeChat| Chrome |106.0.0.0| AppleWebKit/537.36 |false|
|
|
217
|
+
|<img src="./assets/imgs/wecom.png" width='16'> WeCom|Chrome|108.0.5993.119|AppleWebKit/537.36 |false|
|
|
218
|
+
|
|
219
|
+
|
|
190
220
|
|