@seafile/seafile-editor 1.0.2 → 1.0.3
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.
|
@@ -12,6 +12,7 @@ var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/c
|
|
|
12
12
|
var _react = _interopRequireDefault(require("react"));
|
|
13
13
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
14
|
var _codemirror = require("codemirror");
|
|
15
|
+
var _view = require("@codemirror/view");
|
|
15
16
|
var _langMarkdown = require("@codemirror/lang-markdown");
|
|
16
17
|
var _languageData = require("@codemirror/language-data");
|
|
17
18
|
require("./code-mirror.css");
|
|
@@ -37,7 +38,7 @@ var SeafileCodeMirror = /*#__PURE__*/function (_React$Component) {
|
|
|
37
38
|
_this.view.focus();
|
|
38
39
|
};
|
|
39
40
|
_this.scrollIntoView = function (pos) {
|
|
40
|
-
|
|
41
|
+
_view.EditorView.scrollIntoView(pos);
|
|
41
42
|
};
|
|
42
43
|
_this.setCodeMirrorRef = function (ref) {
|
|
43
44
|
_this.codeMirrorRef = ref;
|
|
@@ -51,11 +52,11 @@ var SeafileCodeMirror = /*#__PURE__*/function (_React$Component) {
|
|
|
51
52
|
var _this$props = this.props,
|
|
52
53
|
initialValue = _this$props.initialValue,
|
|
53
54
|
autoFocus = _this$props.autoFocus;
|
|
54
|
-
this.view = new
|
|
55
|
+
this.view = new _view.EditorView({
|
|
55
56
|
doc: initialValue,
|
|
56
57
|
extensions: [_codemirror.basicSetup, (0, _langMarkdown.markdown)({
|
|
57
58
|
codeLanguages: _languageData.languages
|
|
58
|
-
}),
|
|
59
|
+
}), _view.EditorView.updateListener.of(function (viewUpdate) {
|
|
59
60
|
_this2.onValueChanged(viewUpdate);
|
|
60
61
|
})],
|
|
61
62
|
parent: this.codeMirrorRef
|
|
@@ -26,7 +26,7 @@ var reconciledSlateNodes = function reconciledSlateNodes(nodes) {
|
|
|
26
26
|
// md string --> md ast --> slate ast
|
|
27
27
|
// https://github.com/syntax-tree/mdast
|
|
28
28
|
var mdStringToSlate = function mdStringToSlate(mdString) {
|
|
29
|
-
if (!mdString) return (0, _core.generateDefaultParagraph)();
|
|
29
|
+
if (!mdString) return [(0, _core.generateDefaultParagraph)()];
|
|
30
30
|
var content = mdString;
|
|
31
31
|
if (typeof mdString === 'number') {
|
|
32
32
|
content = mdString + '';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seafile/seafile-editor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -79,6 +79,7 @@
|
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"@codemirror/lang-markdown": "6.2.3",
|
|
81
81
|
"@codemirror/language-data": "6.3.1",
|
|
82
|
+
"@codemirror/view": "6.22.1",
|
|
82
83
|
"@seafile/react-image-lightbox": "2.0.2",
|
|
83
84
|
"classnames": "2.3.2",
|
|
84
85
|
"codemirror": "6.0.1",
|