@seafile/sdoc-editor 3.0.264 → 3.0.265

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.
@@ -41,6 +41,9 @@ var INTERNAL_EVENT = exports.INTERNAL_EVENT = {
41
41
  INSERT_ELEMENT: 'insert_element',
42
42
  OUTLINE_STATE_CHANGED: 'outline_state_changed',
43
43
  RELOAD_IMAGE: 'reload_image',
44
+ IMAGE_PREVIEWER_OPENED: 'image_previewer_opened',
45
+ IMAGE_PREVIEWER_CLOSED: 'image_previewer_closed',
46
+ CLOSE_IMAGE_PREVIEWER: 'close_image_previewer',
44
47
  ARTICLE_CLICK: 'hidden_comment',
45
48
  UNSEEN_NOTIFICATIONS_COUNT: 'unseen_notifications_count',
46
49
  CLOSE_CALLOUT_COLOR_PICKER: 'close_callout_color_picker',
@@ -13,6 +13,8 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inhe
13
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
14
14
  var _react = _interopRequireDefault(require("react"));
15
15
  var _reactImageLightbox = _interopRequireDefault(require("@seafile/react-image-lightbox"));
16
+ var _constants = require("../../../../constants");
17
+ var _eventBus = _interopRequireDefault(require("../../../../utils/event-bus"));
16
18
  var _helpers = require("../helpers");
17
19
  require("@seafile/react-image-lightbox/style.css");
18
20
  var ImagePreviewer = /*#__PURE__*/function (_React$Component) {
@@ -20,6 +22,12 @@ var ImagePreviewer = /*#__PURE__*/function (_React$Component) {
20
22
  var _this;
21
23
  (0, _classCallCheck2["default"])(this, ImagePreviewer);
22
24
  _this = (0, _callSuper2["default"])(this, ImagePreviewer, [props]);
25
+ (0, _defineProperty2["default"])(_this, "closeImagePreviewer", function () {
26
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
27
+ editor = _ref.editor;
28
+ if (editor !== _this.props.editor) return;
29
+ _this.props.toggleImagePreviewer();
30
+ });
23
31
  (0, _defineProperty2["default"])(_this, "getImageNodes", function (nodes) {
24
32
  var nodeIndex = 0;
25
33
  var list = [];
@@ -67,6 +75,24 @@ var ImagePreviewer = /*#__PURE__*/function (_React$Component) {
67
75
  }
68
76
  (0, _inherits2["default"])(ImagePreviewer, _React$Component);
69
77
  return (0, _createClass2["default"])(ImagePreviewer, [{
78
+ key: "componentDidMount",
79
+ value: function componentDidMount() {
80
+ var eventBus = _eventBus["default"].getInstance();
81
+ this.unsubscribeCloseImagePreviewer = eventBus.subscribe(_constants.INTERNAL_EVENT.CLOSE_IMAGE_PREVIEWER, this.closeImagePreviewer);
82
+ eventBus.dispatch(_constants.INTERNAL_EVENT.IMAGE_PREVIEWER_OPENED, {
83
+ editor: this.props.editor
84
+ });
85
+ }
86
+ }, {
87
+ key: "componentWillUnmount",
88
+ value: function componentWillUnmount() {
89
+ this.unsubscribeCloseImagePreviewer();
90
+ var eventBus = _eventBus["default"].getInstance();
91
+ eventBus.dispatch(_constants.INTERNAL_EVENT.IMAGE_PREVIEWER_CLOSED, {
92
+ editor: this.props.editor
93
+ });
94
+ }
95
+ }, {
70
96
  key: "render",
71
97
  value: function render() {
72
98
  var _this2 = this;
@@ -1,3 +1,8 @@
1
+ .sdoc-table-header {
2
+ background-color: #fafafa;
3
+ font-weight: bold;
4
+ }
5
+
1
6
  /* type1 */
2
7
  .sdoc-table-body-3f495d {
3
8
  background-color: #f1f3f6;
@@ -70,10 +70,10 @@ var TableCell = function TableCell(_ref) {
70
70
  style.display = 'none';
71
71
  }
72
72
  if (rowIndex === 0) {
73
- style.borderTop = '1px solid #ddd';
73
+ style.borderTop = '1px solid #ccc';
74
74
  }
75
75
  if (cellIndex === 0) {
76
- style.borderLeft = '1px solid #ddd';
76
+ style.borderLeft = '1px solid #ccc';
77
77
  }
78
78
  var _element$rowspan = element.rowspan,
79
79
  rowspan = _element$rowspan === void 0 ? 1 : _element$rowspan,
@@ -167,7 +167,9 @@ var TableCell = function TableCell(_ref) {
167
167
  }, [cellIndex, editor, eventBus, rowIndex, tableEntry, tableId]);
168
168
  return /*#__PURE__*/_react["default"].createElement("div", Object.assign({}, attributes, {
169
169
  style: (0, _objectSpread2["default"])({}, style),
170
- className: (0, _classnames2["default"])('table-cell', attributes.className, highlightClass, (0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, _constants3.CELL_SELECTED, isSelected), 'cell-light-height-left-border', isSelectedFirstCell), 'cell-light-height-right-border', isSelectedLastCell), 'cell-light-height-top-border', isSelectedFirstRow), 'cell-light-height-bottom-border', isSelectedLastRow)),
170
+ className: (0, _classnames2["default"])('table-cell', attributes.className, highlightClass, (0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])({
171
+ 'sdoc-table-header': rowIndex === 0
172
+ }, _constants3.CELL_SELECTED, isSelected), 'cell-light-height-left-border', isSelectedFirstCell), 'cell-light-height-right-border', isSelectedLastCell), 'cell-light-height-top-border', isSelectedFirstRow), 'cell-light-height-bottom-border', isSelectedLastRow)),
171
173
  "data-id": element.id,
172
174
  "row-index": rowIndex,
173
175
  "cell-index": cellIndex,
@@ -215,10 +217,10 @@ function renderTableCell(props) {
215
217
  style.display = 'none';
216
218
  }
217
219
  if (rowIndex === 0) {
218
- style.borderTop = '1px solid #ddd';
220
+ style.borderTop = '1px solid #ccc';
219
221
  }
220
222
  if (cellIndex === 0) {
221
- style.borderLeft = '1px solid #ddd';
223
+ style.borderLeft = '1px solid #ccc';
222
224
  }
223
225
  var _element$rowspan2 = element.rowspan,
224
226
  rowspan = _element$rowspan2 === void 0 ? 1 : _element$rowspan2,
@@ -227,7 +229,9 @@ function renderTableCell(props) {
227
229
  style.gridArea = "".concat(rowIndex + 1, " / ").concat(cellIndex + 1, " / span ").concat(rowspan, " / span ").concat(colspan);
228
230
  return /*#__PURE__*/_react["default"].createElement("div", Object.assign({}, attributes, {
229
231
  style: (0, _objectSpread2["default"])({}, style),
230
- className: (0, _classnames2["default"])('table-cell', highlightClass, attributes.className),
232
+ className: (0, _classnames2["default"])('table-cell', highlightClass, attributes.className, {
233
+ 'sdoc-table-header': rowIndex === 0
234
+ }),
231
235
  "data-id": element.id
232
236
  }), /*#__PURE__*/_react["default"].createElement("div", {
233
237
  className: "sdoc-cell-container"
@@ -4,6 +4,9 @@
4
4
  height: auto;
5
5
  display: flex;
6
6
  align-items: center;
7
+ cursor: default;
8
+ -webkit-user-select: none;
9
+ user-select: none;
7
10
  }
8
11
 
9
12
  .video-loading-placeholder .video-file-icon {
@@ -73,6 +73,10 @@ var Video = function Video(_ref) {
73
73
  var handleVideoLoad = function handleVideoLoad() {
74
74
  setIsLoaded(true);
75
75
  };
76
+ var onLoadingPlaceholderInteraction = (0, _react.useCallback)(function (event) {
77
+ event.preventDefault();
78
+ event.stopPropagation();
79
+ }, []);
76
80
  var onClickVideo = (0, _react.useCallback)(function (e) {
77
81
  e.preventDefault();
78
82
  e.stopPropagation();
@@ -223,7 +227,10 @@ var Video = function Video(_ref) {
223
227
  // eslint-disable-next-line react-hooks/exhaustive-deps
224
228
  }, [isSelected]);
225
229
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, !isLoaded && /*#__PURE__*/_react["default"].createElement("div", {
226
- className: "video-loading-placeholder"
230
+ className: "video-loading-placeholder",
231
+ contentEditable: false,
232
+ onPointerDown: onLoadingPlaceholderInteraction,
233
+ onClick: onLoadingPlaceholderInteraction
227
234
  }, /*#__PURE__*/_react["default"].createElement("img", {
228
235
  className: "video-file-icon",
229
236
  src: (0, _helpers.videoFileIcon)(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "3.0.264",
3
+ "version": "3.0.265",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -70,5 +70,5 @@
70
70
  "publishConfig": {
71
71
  "access": "public"
72
72
  },
73
- "gitHead": "5d040d976de924d4974613af7ac7e040252438d4"
73
+ "gitHead": "a2a49ce2e6bad553fa6aa637cb9ce5ec446a6248"
74
74
  }