@seafile/sdoc-editor 0.1.28-beta5 → 0.1.28-beta7

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.
@@ -172,7 +172,13 @@ var getElementDiffValue = function getElementDiffValue(currentContent, oldConten
172
172
  * oldValue: last version document
173
173
  * return { value: [], change: [] }
174
174
  */
175
- export var getDiff = function getDiff(currentValue, oldValue) {
175
+ export var getDiff = function getDiff() {
176
+ var currentValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
177
+ children: []
178
+ };
179
+ var oldValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
180
+ children: []
181
+ };
176
182
  var currentVersion = currentValue.version,
177
183
  currentContent = currentValue.children;
178
184
  var oldVersion = oldValue.version,
@@ -38,7 +38,7 @@ var ObjectUtils = /*#__PURE__*/function () {
38
38
  }
39
39
  return comparisonKeys.some(function (key) {
40
40
  if (_this.iterable(source[key])) {
41
- return _this.isObjectChanged(source[key], comparison[key]);
41
+ return _this.isObjectChanged(source[key], comparison[key], notIncludeKeys);
42
42
  } else {
43
43
  return source[key] !== comparison[key];
44
44
  }
@@ -47,7 +47,7 @@ var ObjectUtils = /*#__PURE__*/function () {
47
47
  }, {
48
48
  key: "isSameObject",
49
49
  value: function isSameObject(source, comparison) {
50
- var notIncludeKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
50
+ var notIncludeKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
51
51
  if (!source || !comparison) return false;
52
52
  return !this.isObjectChanged(source, comparison, notIncludeKeys);
53
53
  }
@@ -76,7 +76,10 @@ var DiffViewer = /*#__PURE__*/function (_Component) {
76
76
  };
77
77
  var currentContent = _props.currentContent,
78
78
  lastContent = _props.lastContent;
79
- _this.diff = getDiff(currentContent, lastContent);
79
+ _this.diff = currentContent ? getDiff(currentContent, lastContent) : {
80
+ value: [],
81
+ changes: []
82
+ };
80
83
  _this.editor = withNodeId(editor);
81
84
  return _this;
82
85
  }
@@ -18,7 +18,6 @@ var Index = /*#__PURE__*/function (_Component) {
18
18
  var _this$props = this.props,
19
19
  currentContent = _this$props.currentContent,
20
20
  lastContent = _this$props.lastContent;
21
- if (!currentContent) return null;
22
21
  if (!lastContent) {
23
22
  return /*#__PURE__*/React.createElement(HistoryVersionViewer, {
24
23
  document: currentContent
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.1.28beta5",
3
+ "version": "0.1.28beta7",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",