@seafile/sdoc-editor 0.2.14 → 0.2.15

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.
@@ -51,7 +51,7 @@
51
51
  .sdoc-editor-container .article .sdoc-image-content {
52
52
  display: flex;
53
53
  flex-direction: column;
54
- align-items: center;
54
+ align-items: start;
55
55
  }
56
56
 
57
57
  .sdoc-editor-container .article .sdoc-image-content :first-child {
@@ -59,8 +59,8 @@
59
59
  }
60
60
 
61
61
  .sdoc-editor-container .article .sdoc-image-content .sdoc-image-caption-input-wrapper {
62
- border: 0px;
63
- width: 120px;
62
+ border: 0;
63
+ outline: none;
64
64
  margin-top: 8px;
65
65
  color: #8A8F8D;
66
66
  background-color: transparent;
@@ -75,24 +75,6 @@
75
75
  background: #f2f2f2;
76
76
  }
77
77
 
78
- .sdoc-code-block-hover-menu-container .hover-menu-container .op-tooltip:hover::after {
79
- position: absolute;
80
- color: #212529;
81
- content: attr(op-item-tooltip);
82
- top: -40px;
83
- left: -20px;
84
- width: 70px;
85
- height: 30px;
86
- display: flex;
87
- justify-content: center;
88
- align-items: center;
89
- background-color: #fff;
90
- border-radius: 3px;
91
- border: 1px solid #e8e8e8;
92
- font-size: 12px;
93
- box-shadow: 0 0 5px #ccc;
94
- }
95
-
96
78
  .sdoc-code-block-hover-menu-container .icon-font {
97
79
  font-size: 12px;
98
80
  color: #444;
@@ -2,6 +2,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
2
  import React, { useCallback, useEffect, useState } from 'react';
3
3
  import { Input } from 'reactstrap';
4
4
  import { withTranslation } from 'react-i18next';
5
+ import Tooltip from '../../../../../components/tooltip';
5
6
  import { ElementPopover } from '../../../commons/';
6
7
  import { genCodeLangs } from '../prismjs';
7
8
  import { getSelectedLangOption } from '../helpers';
@@ -29,6 +30,10 @@ var CodeBlockHoverMenu = function CodeBlockHoverMenu(_ref) {
29
30
  _useState6 = _slicedToArray(_useState5, 2),
30
31
  langsData = _useState6[0],
31
32
  setLangsData = _useState6[1];
33
+ var _useState7 = useState(false),
34
+ _useState8 = _slicedToArray(_useState7, 2),
35
+ isShowTooltip = _useState8[0],
36
+ setIsShowTooltip = _useState8[1];
32
37
  var onHiddenLangsList = useCallback(function (e) {
33
38
  if (!e.target.parentNode.className.includes('sdoc-search-langs')) {
34
39
  setIsShowlangsList(false);
@@ -36,6 +41,7 @@ var CodeBlockHoverMenu = function CodeBlockHoverMenu(_ref) {
36
41
  // eslint-disable-next-line react-hooks/exhaustive-deps
37
42
  }, []);
38
43
  useEffect(function () {
44
+ setIsShowTooltip(true);
39
45
  window.addEventListener('click', onHiddenLangsList);
40
46
  return function () {
41
47
  window.removeEventListener('click', onHiddenLangsList);
@@ -103,37 +109,49 @@ var CodeBlockHoverMenu = function CodeBlockHoverMenu(_ref) {
103
109
  }))), /*#__PURE__*/React.createElement("div", {
104
110
  className: "sdoc-code-block-hover-operation-divider"
105
111
  }), /*#__PURE__*/React.createElement("div", {
112
+ id: "sdoc_code_block_auto_wrap",
106
113
  className: "sdoc-code-block-hover-operation-item"
107
114
  }, /*#__PURE__*/React.createElement("div", {
108
115
  role: "button",
109
- className: "op-item ".concat(white_space === 'normal' ? 'active' : '', " op-tooltip"),
110
- "op-item-tooltip": t('Auto_wrap'),
116
+ className: "op-item ".concat(white_space === 'normal' ? 'active' : ''),
111
117
  onClick: onAutoLineWrap
112
118
  }, /*#__PURE__*/React.createElement("i", {
113
119
  className: "sdocfont sdoc-auto-linefeed icon-font"
114
- }))), /*#__PURE__*/React.createElement("div", {
120
+ })), isShowTooltip && /*#__PURE__*/React.createElement(Tooltip, {
121
+ target: "sdoc_code_block_auto_wrap",
122
+ placement: "top",
123
+ fade: true
124
+ }, t('Auto_wrap'))), /*#__PURE__*/React.createElement("div", {
115
125
  className: "sdoc-code-block-hover-operation-divider"
116
126
  }), /*#__PURE__*/React.createElement("div", {
127
+ id: "sdoc_code_block_copy",
117
128
  className: "sdoc-code-block-hover-operation-item"
118
129
  }, /*#__PURE__*/React.createElement("div", {
119
130
  role: "button",
120
- className: "op-item op-tooltip",
121
- "op-item-tooltip": t('Copy'),
131
+ className: "op-item",
122
132
  onClick: onCopyCodeBlock
123
133
  }, /*#__PURE__*/React.createElement("i", {
124
134
  className: "sdocfont sdoc-copy icon-font"
125
- }))), /*#__PURE__*/React.createElement("div", {
135
+ })), isShowTooltip && /*#__PURE__*/React.createElement(Tooltip, {
136
+ target: "sdoc_code_block_copy",
137
+ placement: "top",
138
+ fade: true
139
+ }, t('Copy'))), /*#__PURE__*/React.createElement("div", {
126
140
  className: "sdoc-code-block-hover-operation-divider"
127
141
  }), /*#__PURE__*/React.createElement("div", {
142
+ id: "sdoc_code_block_delete",
128
143
  className: "sdoc-code-block-hover-operation-item"
129
144
  }, /*#__PURE__*/React.createElement("div", {
130
145
  role: "button",
131
- className: "op-item op-tooltip",
132
- "op-item-tooltip": t('Delete'),
146
+ className: "op-item",
133
147
  onClick: onDelete
134
148
  }, /*#__PURE__*/React.createElement("i", {
135
149
  className: "sdocfont sdoc-delete icon-font"
136
- }))), isShowlangsList && /*#__PURE__*/React.createElement("div", {
150
+ })), isShowTooltip && /*#__PURE__*/React.createElement(Tooltip, {
151
+ target: "sdoc_code_block_delete",
152
+ placement: "top",
153
+ fade: true
154
+ }, t('Delete'))), isShowlangsList && /*#__PURE__*/React.createElement("div", {
137
155
  className: "sdoc-langs-list-container"
138
156
  }, /*#__PURE__*/React.createElement("div", {
139
157
  className: "sdoc-search-langs"
@@ -120,7 +120,9 @@ var ImageHoverMenu = function ImageHoverMenu(_ref) {
120
120
  }, t('Image_border'))), display_type === IMAGE_DISPLAY_TYPE[1] && /*#__PURE__*/React.createElement("span", {
121
121
  id: "sdoc_image_caption",
122
122
  role: "button",
123
- className: classnames('op-item', 'ml-1'),
123
+ className: classnames('op-item', 'ml-1', {
124
+ 'active': (data === null || data === void 0 ? void 0 : data.caption.length) !== 0
125
+ }),
124
126
  onClick: function onClick() {
125
127
  onShowCaption();
126
128
  }
@@ -249,6 +249,9 @@ var Image = function Image(_ref) {
249
249
  contentEditable: false
250
250
  }, /*#__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))), display_type === 'Block' && (isShowCaption || (data === null || data === void 0 ? void 0 : data.caption)) && /*#__PURE__*/React.createElement("input", {
251
251
  className: "sdoc-image-caption-input-wrapper",
252
+ style: {
253
+ width: (data === null || data === void 0 ? void 0 : data.width) || '120px'
254
+ },
252
255
  placeholder: t('Insert_caption'),
253
256
  value: caption,
254
257
  onBlur: onSetCaption,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.2.14",
3
+ "version": "0.2.15",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",