@seafile/sdoc-editor 1.0.212-alph-0.1.3 → 1.0.212-alph-0.1.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.
|
@@ -66,7 +66,6 @@ const RevisionEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
66
66
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
67
67
|
}), [editorRef]);
|
|
68
68
|
if (isShowChanges) {
|
|
69
|
-
console.log('isShowchange', isShowChanges);
|
|
70
69
|
return /*#__PURE__*/_react.default.createElement(_views.RevisionDiffViewer, {
|
|
71
70
|
editor: editor,
|
|
72
71
|
revisionContent: revisionContent,
|
|
@@ -13,6 +13,7 @@ var _constants = require("../constants");
|
|
|
13
13
|
var _eventBus = _interopRequireDefault(require("../utils/event-bus"));
|
|
14
14
|
var _outlineItem = _interopRequireDefault(require("./outline-item"));
|
|
15
15
|
var _tooltip = _interopRequireDefault(require("../../components/tooltip"));
|
|
16
|
+
var _context = _interopRequireDefault(require("../../context"));
|
|
16
17
|
require("./style.css");
|
|
17
18
|
const getOutlineSetting = () => {
|
|
18
19
|
const currentValue = localStorage.getItem(_constants.SDOC_STORAGE);
|
|
@@ -37,6 +38,7 @@ const SDocOutline = _ref => {
|
|
|
37
38
|
t
|
|
38
39
|
} = _ref;
|
|
39
40
|
const [isShown, setIsShown] = (0, _react.useState)(false);
|
|
41
|
+
const isSdocRevision = _context.default.getSetting('isSdocRevision');
|
|
40
42
|
const updateOutlineState = (0, _react.useCallback)(state => {
|
|
41
43
|
setIsShown(state);
|
|
42
44
|
setOutlineSetting(state);
|
|
@@ -73,12 +75,19 @@ const SDocOutline = _ref => {
|
|
|
73
75
|
className: "mt-4 text-secondary"
|
|
74
76
|
}, t('Headings_you_add_to_the_document_will_appear_here')), list.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
|
|
75
77
|
className: "sdoc-outline-list-container"
|
|
76
|
-
}, list.map((item, index) => {
|
|
78
|
+
}, !isSdocRevision && list.map((item, index) => {
|
|
77
79
|
console.log(item, index);
|
|
78
80
|
return /*#__PURE__*/_react.default.createElement(_outlineItem.default, {
|
|
79
81
|
key: index,
|
|
80
82
|
item: item
|
|
81
83
|
});
|
|
84
|
+
}), isSdocRevision && list.map((item, index) => {
|
|
85
|
+
console.log(item, index);
|
|
86
|
+
return /*#__PURE__*/_react.default.createElement(_outlineItem.default, {
|
|
87
|
+
key: index,
|
|
88
|
+
item: item,
|
|
89
|
+
isSdocRevision: isSdocRevision
|
|
90
|
+
});
|
|
82
91
|
})))), !isShown && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
83
92
|
id: "sdoc-outline-menu",
|
|
84
93
|
className: "sdoc-outline-menu sdocfont sdoc-table-of-content-outline",
|
|
@@ -9,6 +9,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/es
|
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
var _constants = require("../constants");
|
|
12
|
+
var _constants2 = require("../extension/constants");
|
|
12
13
|
class OutlineItem extends _react.default.PureComponent {
|
|
13
14
|
constructor(props) {
|
|
14
15
|
super(props);
|
|
@@ -66,7 +67,8 @@ class OutlineItem extends _react.default.PureComponent {
|
|
|
66
67
|
render() {
|
|
67
68
|
const {
|
|
68
69
|
item,
|
|
69
|
-
isDisplayHorizontalBar
|
|
70
|
+
isDisplayHorizontalBar,
|
|
71
|
+
isSdocRevision
|
|
70
72
|
} = this.props;
|
|
71
73
|
const {
|
|
72
74
|
type,
|
|
@@ -91,7 +93,24 @@ class OutlineItem extends _react.default.PureComponent {
|
|
|
91
93
|
onClick: this.onItemClick,
|
|
92
94
|
onMouseOver: this.onMouseOver,
|
|
93
95
|
onMouseOut: this.onMouseOut
|
|
94
|
-
}, children.map(child => child.text || child.title).join('')
|
|
96
|
+
}, !isSdocRevision && children.map(child => child.text || child.title).join(''), isSdocRevision && children.map(child => {
|
|
97
|
+
let style = {};
|
|
98
|
+
if (child.add) {
|
|
99
|
+
style = {
|
|
100
|
+
..._constants2.ADDED_STYLE
|
|
101
|
+
};
|
|
102
|
+
} else if (child.delete) {
|
|
103
|
+
style = {
|
|
104
|
+
..._constants2.DELETED_STYLE
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
if (style.computed_background_color) {
|
|
108
|
+
style['backgroundColor'] = style.computed_background_color;
|
|
109
|
+
}
|
|
110
|
+
const text = child.text || child.title;
|
|
111
|
+
console.log(style, text);
|
|
112
|
+
return `<span style=${style}>${text}<span>`;
|
|
113
|
+
}).join(''));
|
|
95
114
|
}
|
|
96
115
|
}
|
|
97
116
|
var _default = exports.default = OutlineItem;
|