@seafile/sdoc-editor 0.4.1 → 0.4.2

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.
@@ -86,9 +86,9 @@ const FileLink = _ref => {
86
86
  // eslint-disable-next-line react-hooks/exhaustive-deps
87
87
  }, []);
88
88
  let style = {};
89
- if (element.ADD) {
89
+ if (element.add) {
90
90
  style = _objectSpread({}, ADDED_STYLE);
91
- } else if (element.DELETE) {
91
+ } else if (element.delete) {
92
92
  style = _objectSpread({}, DELETED_STYLE);
93
93
  }
94
94
  if (style.computed_background_color) {
@@ -13,6 +13,7 @@ import { IMAGE_BORDER_TYPE } from './constants';
13
13
  import { ADDED_STYLE, DELETED_STYLE, IMAGE_BLOCK } from '../../constants';
14
14
  import imagePlaceholder from '../../../assets/images/image-placeholder.png';
15
15
  const Image = _ref => {
16
+ var _imageRef$current, _imageRef$current2;
16
17
  let {
17
18
  element,
18
19
  editor,
@@ -228,11 +229,11 @@ const Image = _ref => {
228
229
  }), isResizing && /*#__PURE__*/React.createElement("span", {
229
230
  className: "image-size",
230
231
  contentEditable: false
231
- }, /*#__PURE__*/React.createElement("span", null, t('Width'), ':', parseInt(movingWidth || imageRef.current.clientWidth)), /*#__PURE__*/React.createElement("span", null, "\xA0\xA0"), /*#__PURE__*/React.createElement("span", null, t('Height'), ':', imageRef.current.clientHeight))), nodeEntry[0].type === IMAGE_BLOCK && show_caption && /*#__PURE__*/React.createElement("input", {
232
+ }, /*#__PURE__*/React.createElement("span", null, t('Width'), ':', parseInt(movingWidth || ((_imageRef$current = imageRef.current) === null || _imageRef$current === void 0 ? void 0 : _imageRef$current.clientWidth))), /*#__PURE__*/React.createElement("span", null, "\xA0\xA0"), /*#__PURE__*/React.createElement("span", null, t('Height'), ':', imageRef.current.clientHeight))), nodeEntry[0].type === IMAGE_BLOCK && show_caption && /*#__PURE__*/React.createElement("input", {
232
233
  id: "sdoc-image-caption-input",
233
234
  className: "sdoc-image-caption-input-wrapper",
234
235
  style: {
235
- width: (data === null || data === void 0 ? void 0 : data.width) || imageRef.current.clientWidth
236
+ width: (data === null || data === void 0 ? void 0 : data.width) || ((_imageRef$current2 = imageRef.current) === null || _imageRef$current2 === void 0 ? void 0 : _imageRef$current2.clientWidth)
236
237
  },
237
238
  placeholder: t('Insert_caption'),
238
239
  value: caption,
@@ -267,8 +268,11 @@ export function renderImage(props, editor) {
267
268
  if (leaf && leaf.computed_background_color) {
268
269
  style['backgroundColor'] = leaf.computed_background_color;
269
270
  }
270
- if (element.ADD || element.DELETE) {
271
- style = Object.assign({}, style, element.ADD ? ADDED_STYLE : DELETED_STYLE);
271
+ if (element.add || element.delete) {
272
+ style = Object.assign({}, style, element.add ? ADDED_STYLE : DELETED_STYLE);
273
+ if (style.computed_background_color) {
274
+ style['backgroundColor'] = style.computed_background_color;
275
+ }
272
276
  }
273
277
  return /*#__PURE__*/React.createElement(SdocImage, Object.assign({}, props, {
274
278
  style: style,
@@ -88,9 +88,9 @@ const SdocFileLink = _ref => {
88
88
  // eslint-disable-next-line react-hooks/exhaustive-deps
89
89
  }, []);
90
90
  let style = {};
91
- if (element.ADD) {
91
+ if (element.add) {
92
92
  style = _objectSpread({}, ADDED_STYLE);
93
- } else if (element.DELETE) {
93
+ } else if (element.delete) {
94
94
  style = _objectSpread({}, DELETED_STYLE);
95
95
  }
96
96
  if (style.computed_background_color) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",