@seafile/sdoc-editor 0.1.46 → 0.1.48
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
CHANGED
|
@@ -7,7 +7,7 @@ import React from 'react';
|
|
|
7
7
|
import { Node } from '@seafile/slate';
|
|
8
8
|
import { Editable, Slate, ReactEditor } from '@seafile/slate-react';
|
|
9
9
|
import { Editor } from '@seafile/slate';
|
|
10
|
-
import editor, { renderLeaf
|
|
10
|
+
import editor, { renderLeaf, renderElement, Toolbar } from './extension';
|
|
11
11
|
import { withSocketIO } from './socket';
|
|
12
12
|
import withNodeId from './node-id';
|
|
13
13
|
import SDocOutline from './outline';
|
|
@@ -61,6 +61,12 @@ var SDocEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
_this.eventProxy = new EventProxy(_this.editor);
|
|
64
|
+
_this.renderElement = function (props) {
|
|
65
|
+
return renderElement(props, _this.editor);
|
|
66
|
+
};
|
|
67
|
+
_this.renderLeaf = function (props) {
|
|
68
|
+
return renderLeaf(props, _this.editor);
|
|
69
|
+
};
|
|
64
70
|
return _this;
|
|
65
71
|
}
|
|
66
72
|
_createClass(SDocEditor, [{
|
|
@@ -80,7 +86,6 @@ var SDocEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
80
86
|
}, {
|
|
81
87
|
key: "render",
|
|
82
88
|
value: function render() {
|
|
83
|
-
var _this2 = this;
|
|
84
89
|
var slateValue = this.state.slateValue;
|
|
85
90
|
var config = this.props.config;
|
|
86
91
|
var docUuid = config.docUuid;
|
|
@@ -102,12 +107,8 @@ var SDocEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
102
107
|
}, /*#__PURE__*/React.createElement("div", {
|
|
103
108
|
className: "article"
|
|
104
109
|
}, /*#__PURE__*/React.createElement(Editable, {
|
|
105
|
-
renderElement:
|
|
106
|
-
|
|
107
|
-
},
|
|
108
|
-
renderLeaf: function renderLeaf(props) {
|
|
109
|
-
return _renderLeaf(props, _this2.editor);
|
|
110
|
-
},
|
|
110
|
+
renderElement: this.renderElement,
|
|
111
|
+
renderLeaf: this.renderLeaf,
|
|
111
112
|
onKeyDown: this.eventProxy.onKeyDown,
|
|
112
113
|
onDOMBeforeInput: this.onDOMBeforeInput
|
|
113
114
|
}))))));
|
|
@@ -115,7 +115,9 @@ var OutlineItem = /*#__PURE__*/function (_React$PureComponent2) {
|
|
|
115
115
|
onClick: this.onItemClick,
|
|
116
116
|
onMouseOver: this.onMouseOver,
|
|
117
117
|
onMouseOut: this.onMouseOut
|
|
118
|
-
}, children
|
|
118
|
+
}, children.map(function (child) {
|
|
119
|
+
return child.text;
|
|
120
|
+
}).join(''));
|
|
119
121
|
}
|
|
120
122
|
}]);
|
|
121
123
|
return OutlineItem;
|