@seafile/sea-email-editor 0.0.1
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.
- package/README.md +1 -0
- package/dist/assets/icons/align-center.svg +1 -0
- package/dist/assets/icons/align-left.svg +1 -0
- package/dist/assets/icons/align-right.svg +1 -0
- package/dist/assets/icons/arrow-down.svg +1 -0
- package/dist/assets/icons/arrow-right.svg +1 -0
- package/dist/assets/icons/arrow-up.svg +1 -0
- package/dist/assets/icons/bold.svg +1 -0
- package/dist/assets/icons/callout-color.svg +1 -0
- package/dist/assets/icons/check-mark-option.svg +3 -0
- package/dist/assets/icons/check-square.svg +1 -0
- package/dist/assets/icons/clear-format.svg +1 -0
- package/dist/assets/icons/close.svg +3 -0
- package/dist/assets/icons/code-block.svg +1 -0
- package/dist/assets/icons/image.svg +1 -0
- package/dist/assets/icons/inline-code.svg +1 -0
- package/dist/assets/icons/insert.svg +1 -0
- package/dist/assets/icons/italic.svg +1 -0
- package/dist/assets/icons/link.svg +1 -0
- package/dist/assets/icons/more.svg +1 -0
- package/dist/assets/icons/ol.svg +1 -0
- package/dist/assets/icons/quote.svg +1 -0
- package/dist/assets/icons/rename.svg +4 -0
- package/dist/assets/icons/strikethrough.svg +1 -0
- package/dist/assets/icons/table.svg +1 -0
- package/dist/assets/icons/ul.svg +1 -0
- package/dist/assets/icons/underline.svg +1 -0
- package/dist/assets/icons/unlink.svg +1 -0
- package/dist/components/browser-tip/index.css +18 -0
- package/dist/components/browser-tip/index.js +28 -0
- package/dist/components/centered-loading.js +23 -0
- package/dist/components/icon/index.css +7 -0
- package/dist/components/icon/index.js +30 -0
- package/dist/components/icon-button/index.css +33 -0
- package/dist/components/icon-button/index.js +71 -0
- package/dist/components/index.js +92 -0
- package/dist/components/loading/index.css +54 -0
- package/dist/components/loading/index.js +15 -0
- package/dist/components/modal/index.css +0 -0
- package/dist/components/modal/index.js +27 -0
- package/dist/components/modal-header/index.css +22 -0
- package/dist/components/modal-header/index.js +36 -0
- package/dist/components/option/index.css +20 -0
- package/dist/components/option/index.js +39 -0
- package/dist/components/options-editor/container/index.css +49 -0
- package/dist/components/options-editor/container/index.js +122 -0
- package/dist/components/options-editor/index.css +26 -0
- package/dist/components/options-editor/index.js +70 -0
- package/dist/components/options-editor/options/index.css +5 -0
- package/dist/components/options-editor/options/index.js +138 -0
- package/dist/components/options-editor/options/option/index.css +54 -0
- package/dist/components/options-editor/options/option/index.js +138 -0
- package/dist/components/popover/index.js +85 -0
- package/dist/components/popover/utils.js +76 -0
- package/dist/components/search-input/index.css +52 -0
- package/dist/components/search-input/index.js +148 -0
- package/dist/components/selector-display/index.css +86 -0
- package/dist/components/selector-display/index.js +66 -0
- package/dist/components/toolbar/index.js +20 -0
- package/dist/components/toolbar/toolbar-group/index.css +13 -0
- package/dist/components/toolbar/toolbar-group/index.js +22 -0
- package/dist/components/toolbar/toolbar-item/index.css +3 -0
- package/dist/components/toolbar/toolbar-item/index.js +53 -0
- package/dist/components/tooltip/index.css +68 -0
- package/dist/components/tooltip/index.js +46 -0
- package/dist/components/tooltip/shortcut-key/index.css +7 -0
- package/dist/components/tooltip/shortcut-key/index.js +20 -0
- package/dist/constants/event-types.js +25 -0
- package/dist/constants/index.js +40 -0
- package/dist/constants/key-codes.js +104 -0
- package/dist/editor/index.css +44 -0
- package/dist/editor/index.js +50 -0
- package/dist/editor/main/index.css +19 -0
- package/dist/editor/main/index.js +166 -0
- package/dist/editor/with-props-editor.js +20 -0
- package/dist/extension/commons/dropdown-menu-item/index.css +52 -0
- package/dist/extension/commons/dropdown-menu-item/index.js +62 -0
- package/dist/extension/commons/index.js +5 -0
- package/dist/extension/commons/insert-element-dialog/index.js +91 -0
- package/dist/extension/commons/menu/index.js +3 -0
- package/dist/extension/commons/menu/menu-drop-down.js +98 -0
- package/dist/extension/commons/menu-shortcut-indicator/index.js +24 -0
- package/dist/extension/commons/menu-shortcut-indicator/style.css +18 -0
- package/dist/extension/constants/element-default-style.js +78 -0
- package/dist/extension/constants/element-types.js +33 -0
- package/dist/extension/constants/index.js +63 -0
- package/dist/extension/constants/keyboard.js +33 -0
- package/dist/extension/constants/menus-config.js +142 -0
- package/dist/extension/core/index.js +38 -0
- package/dist/extension/core/queries/index.js +507 -0
- package/dist/extension/core/transforms/focus-editor.js +18 -0
- package/dist/extension/core/transforms/index.js +49 -0
- package/dist/extension/core/transforms/move-children.js +35 -0
- package/dist/extension/core/transforms/remove-node-children.js +19 -0
- package/dist/extension/core/transforms/replace-node-children.js +24 -0
- package/dist/extension/core/utils/index.js +120 -0
- package/dist/extension/event-transfer/get-event-transfer.js +38 -0
- package/dist/extension/event-transfer/set-event-transfer.js +36 -0
- package/dist/extension/highlight/index.js +20 -0
- package/dist/extension/highlight/normalize-tokens.js +94 -0
- package/dist/extension/highlight/prismjs.js +27 -0
- package/dist/extension/highlight/set-node-decorations.js +81 -0
- package/dist/extension/highlight/use-highlight.js +20 -0
- package/dist/extension/index.js +67 -0
- package/dist/extension/plugins/blockquote/helpers.js +68 -0
- package/dist/extension/plugins/blockquote/index.js +18 -0
- package/dist/extension/plugins/blockquote/menu/index.js +35 -0
- package/dist/extension/plugins/blockquote/plugin.js +154 -0
- package/dist/extension/plugins/blockquote/render-elem.js +29 -0
- package/dist/extension/plugins/check-list/helper.js +34 -0
- package/dist/extension/plugins/check-list/index.js +19 -0
- package/dist/extension/plugins/check-list/menu/index.js +39 -0
- package/dist/extension/plugins/check-list/plugin.js +92 -0
- package/dist/extension/plugins/check-list/render-elem.js +61 -0
- package/dist/extension/plugins/clear-format/helpers.js +51 -0
- package/dist/extension/plugins/clear-format/menu/index.js +35 -0
- package/dist/extension/plugins/code-block/helpers.js +140 -0
- package/dist/extension/plugins/code-block/index.js +20 -0
- package/dist/extension/plugins/code-block/menu/index.js +59 -0
- package/dist/extension/plugins/code-block/plugin.js +288 -0
- package/dist/extension/plugins/code-block/render-elem/constant.js +22 -0
- package/dist/extension/plugins/code-block/render-elem/index.js +89 -0
- package/dist/extension/plugins/code-block/render-elem/language-selector/index.css +18 -0
- package/dist/extension/plugins/code-block/render-elem/language-selector/index.js +38 -0
- package/dist/extension/plugins/formula/formula.css +22 -0
- package/dist/extension/plugins/formula/helper.js +80 -0
- package/dist/extension/plugins/formula/index.js +19 -0
- package/dist/extension/plugins/formula/menu/formula-modal.js +98 -0
- package/dist/extension/plugins/formula/menu/index.js +35 -0
- package/dist/extension/plugins/formula/plugin.js +22 -0
- package/dist/extension/plugins/formula/render-elem.js +64 -0
- package/dist/extension/plugins/header/helper.js +55 -0
- package/dist/extension/plugins/header/index.js +19 -0
- package/dist/extension/plugins/header/menu/index.js +72 -0
- package/dist/extension/plugins/header/plugin.js +155 -0
- package/dist/extension/plugins/header/render-elem.js +39 -0
- package/dist/extension/plugins/html/index.js +13 -0
- package/dist/extension/plugins/html/plugin.js +69 -0
- package/dist/extension/plugins/image/helper.js +131 -0
- package/dist/extension/plugins/image/index.js +19 -0
- package/dist/extension/plugins/image/menu/image-menu-dialog.js +92 -0
- package/dist/extension/plugins/image/menu/index.css +3 -0
- package/dist/extension/plugins/image/menu/index.js +103 -0
- package/dist/extension/plugins/image/plugin.js +56 -0
- package/dist/extension/plugins/image/render-element/image-previewer.js +89 -0
- package/dist/extension/plugins/image/render-element/index.js +141 -0
- package/dist/extension/plugins/image/render-element/style.css +68 -0
- package/dist/extension/plugins/index.js +116 -0
- package/dist/extension/plugins/link/helper.js +258 -0
- package/dist/extension/plugins/link/index.js +19 -0
- package/dist/extension/plugins/link/menu/index.js +92 -0
- package/dist/extension/plugins/link/menu/link-modal.js +169 -0
- package/dist/extension/plugins/link/plugin.js +172 -0
- package/dist/extension/plugins/link/render-elem/index.css +12 -0
- package/dist/extension/plugins/link/render-elem/index.js +103 -0
- package/dist/extension/plugins/link/render-elem/link-op-menu/index.css +33 -0
- package/dist/extension/plugins/link/render-elem/link-op-menu/index.js +89 -0
- package/dist/extension/plugins/list/constant.js +8 -0
- package/dist/extension/plugins/list/helpers.js +102 -0
- package/dist/extension/plugins/list/index.js +19 -0
- package/dist/extension/plugins/list/menu/index.js +41 -0
- package/dist/extension/plugins/list/plugin/index.js +80 -0
- package/dist/extension/plugins/list/plugin/insert-break-list.js +29 -0
- package/dist/extension/plugins/list/plugin/insert-fragment-list.js +179 -0
- package/dist/extension/plugins/list/plugin/normalize-list.js +79 -0
- package/dist/extension/plugins/list/plugin/on-tab-handle.js +63 -0
- package/dist/extension/plugins/list/plugin/shortcut.js +69 -0
- package/dist/extension/plugins/list/queries/index.js +52 -0
- package/dist/extension/plugins/list/render-elem/index.js +68 -0
- package/dist/extension/plugins/list/transforms/index.js +75 -0
- package/dist/extension/plugins/list/transforms/insert-list-item.js +98 -0
- package/dist/extension/plugins/list/transforms/move-list-item-down.js +50 -0
- package/dist/extension/plugins/list/transforms/move-list-item-up.js +124 -0
- package/dist/extension/plugins/list/transforms/move-list-items-to-list.js +63 -0
- package/dist/extension/plugins/list/transforms/move-list-items.js +73 -0
- package/dist/extension/plugins/list/transforms/normalize-list-item.js +110 -0
- package/dist/extension/plugins/list/transforms/normalize-nested-list.js +38 -0
- package/dist/extension/plugins/list/transforms/remove-first-list-item.js +24 -0
- package/dist/extension/plugins/list/transforms/transforms-to-list.js +131 -0
- package/dist/extension/plugins/list/transforms/unwrap-list.js +48 -0
- package/dist/extension/plugins/markdown/index.js +12 -0
- package/dist/extension/plugins/markdown/plugin.js +257 -0
- package/dist/extension/plugins/node-id/constants.js +24 -0
- package/dist/extension/plugins/node-id/helpers.js +78 -0
- package/dist/extension/plugins/node-id/index.js +12 -0
- package/dist/extension/plugins/node-id/with-node-id.js +37 -0
- package/dist/extension/plugins/p/helper.js +17 -0
- package/dist/extension/plugins/p/index.js +17 -0
- package/dist/extension/plugins/p/plugin.js +141 -0
- package/dist/extension/plugins/p/render-elem.js +29 -0
- package/dist/extension/plugins/paragraph/helper.js +17 -0
- package/dist/extension/plugins/paragraph/index.js +17 -0
- package/dist/extension/plugins/paragraph/plugin.js +141 -0
- package/dist/extension/plugins/paragraph/render-elem.js +29 -0
- package/dist/extension/plugins/table/constant.js +24 -0
- package/dist/extension/plugins/table/context-menu/horizontal-align-popover/index.css +3 -0
- package/dist/extension/plugins/table/context-menu/horizontal-align-popover/index.js +64 -0
- package/dist/extension/plugins/table/context-menu/index.css +13 -0
- package/dist/extension/plugins/table/context-menu/index.js +152 -0
- package/dist/extension/plugins/table/context-menu/insert-table-element/index.css +27 -0
- package/dist/extension/plugins/table/context-menu/insert-table-element/index.js +113 -0
- package/dist/extension/plugins/table/helper.js +333 -0
- package/dist/extension/plugins/table/index.js +21 -0
- package/dist/extension/plugins/table/menu/index.js +61 -0
- package/dist/extension/plugins/table/menu/table-operator.js +97 -0
- package/dist/extension/plugins/table/menu/table-size-selector/index.css +27 -0
- package/dist/extension/plugins/table/menu/table-size-selector/index.js +98 -0
- package/dist/extension/plugins/table/model.js +102 -0
- package/dist/extension/plugins/table/plugin.js +351 -0
- package/dist/extension/plugins/table/render-elem/index.css +64 -0
- package/dist/extension/plugins/table/render-elem/index.js +252 -0
- package/dist/extension/plugins/table/table-operations.js +323 -0
- package/dist/extension/plugins/text-style/helpers.js +57 -0
- package/dist/extension/plugins/text-style/index.js +17 -0
- package/dist/extension/plugins/text-style/menu/index.js +37 -0
- package/dist/extension/plugins/text-style/plugin.js +38 -0
- package/dist/extension/plugins/text-style/render-elem.js +63 -0
- package/dist/extension/render/render-element.js +115 -0
- package/dist/extension/render/render-leaf.js +22 -0
- package/dist/extension/toolbar/index.css +16 -0
- package/dist/extension/toolbar/index.js +89 -0
- package/dist/extension/toolbar/insert-toolbar.js +78 -0
- package/dist/hooks/use-attachments.js +38 -0
- package/dist/hooks/use-container-style.js +50 -0
- package/dist/hooks/use-mathjax.js +46 -0
- package/dist/hooks/use-scroll-context.js +20 -0
- package/dist/hooks/use-selection-update.js +20 -0
- package/dist/hooks/user-link-click.js +52 -0
- package/dist/index.js +9 -0
- package/dist/intl/ReactIntlUniversal.js +310 -0
- package/dist/intl/constants.js +21 -0
- package/dist/intl/index.js +33 -0
- package/dist/locale/index.js +11 -0
- package/dist/locale/lang/en.json +83 -0
- package/dist/slate-convert/html-to-slate/constants.js +146 -0
- package/dist/slate-convert/html-to-slate/helper.js +106 -0
- package/dist/slate-convert/html-to-slate/index.js +138 -0
- package/dist/slate-convert/html-to-slate/rules/blockquote.js +26 -0
- package/dist/slate-convert/html-to-slate/rules/br.js +29 -0
- package/dist/slate-convert/html-to-slate/rules/check-list.js +29 -0
- package/dist/slate-convert/html-to-slate/rules/code-block.js +95 -0
- package/dist/slate-convert/html-to-slate/rules/header.js +26 -0
- package/dist/slate-convert/html-to-slate/rules/image.js +31 -0
- package/dist/slate-convert/html-to-slate/rules/index.js +20 -0
- package/dist/slate-convert/html-to-slate/rules/link.js +31 -0
- package/dist/slate-convert/html-to-slate/rules/list.js +74 -0
- package/dist/slate-convert/html-to-slate/rules/p.js +37 -0
- package/dist/slate-convert/html-to-slate/rules/paragraph.js +37 -0
- package/dist/slate-convert/html-to-slate/rules/table.js +64 -0
- package/dist/slate-convert/html-to-slate/rules/text.js +71 -0
- package/dist/slate-convert/index.js +20 -0
- package/dist/slate-convert/slate-to-html/index.js +143 -0
- package/dist/utils/common.js +46 -0
- package/dist/utils/deserialize-html.js +219 -0
- package/dist/utils/dom-utils.js +57 -0
- package/dist/utils/dom.js +133 -0
- package/dist/utils/event-bus.js +40 -0
- package/dist/utils/event-handler.js +44 -0
- package/dist/utils/get-browser-Info.js +35 -0
- package/dist/utils/hotkey.js +45 -0
- package/dist/utils/is-punctuation-mark.js +50 -0
- package/dist/utils/object-utils.js +56 -0
- package/dist/utils/search.js +20 -0
- package/dist/utils/translate.js +18 -0
- package/dist/utils/type-detection.js +42 -0
- package/package.json +177 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _reactstrap = require("reactstrap");
|
|
11
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
|
+
var _translate = require("../../utils/translate");
|
|
13
|
+
require("./index.css");
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
const Tooltip = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
className,
|
|
18
|
+
isShowConfirmTip = false,
|
|
19
|
+
confirmTip,
|
|
20
|
+
placement,
|
|
21
|
+
children,
|
|
22
|
+
...props
|
|
23
|
+
} = _ref;
|
|
24
|
+
const customizeProps = (0, _react.useMemo)(() => {
|
|
25
|
+
return {
|
|
26
|
+
hideArrow: true,
|
|
27
|
+
fade: true,
|
|
28
|
+
placement,
|
|
29
|
+
className: (0, _classnames.default)('sea-email-tooltip', className, placement, {
|
|
30
|
+
'sea-email-tooltip-with-confirm-tip': isShowConfirmTip
|
|
31
|
+
}),
|
|
32
|
+
...props
|
|
33
|
+
};
|
|
34
|
+
}, [className, placement, isShowConfirmTip, props]);
|
|
35
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactstrap.UncontrolledTooltip, {
|
|
36
|
+
...customizeProps,
|
|
37
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
38
|
+
className: "sea-email-tooltip-text",
|
|
39
|
+
children: children
|
|
40
|
+
}), isShowConfirmTip && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
41
|
+
className: "sea-email-tooltip-confirm-text",
|
|
42
|
+
children: confirmTip || (0, _translate.gettext)('Got it')
|
|
43
|
+
})]
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
var _default = exports.default = Tooltip;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
require("./index.css");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
const ShortcutKey = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
children
|
|
14
|
+
} = _ref;
|
|
15
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
16
|
+
className: "sea-email-tooltip-shortcut-key",
|
|
17
|
+
children: children
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
var _default = exports.default = ShortcutKey;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.INTERNAL_EVENTS = exports.EXTERNAL_EVENTS = void 0;
|
|
7
|
+
const INTERNAL_EVENTS = exports.INTERNAL_EVENTS = {
|
|
8
|
+
ON_MOUSE_ENTER_BLOCK: 'on_mouse_enter_block',
|
|
9
|
+
ON_OPEN_LINK_MODAL: 'on_open_link_modal',
|
|
10
|
+
ON_CLOSE_LINK_POPOVER: 'on_close_link_popover',
|
|
11
|
+
ON_OPEN_FORMULA_DIALOG: 'on_open_formula_dialog',
|
|
12
|
+
ON_SELECT_ALL_CELL: 'on_select_all_cell',
|
|
13
|
+
ON_TOGGLE_IMAGE_POPOVER: 'on_toggle_image_popover',
|
|
14
|
+
OUTLINE_STATE_CHANGED: 'outline_state_changed',
|
|
15
|
+
RESIZE_ARTICLE: 'resize_article',
|
|
16
|
+
INSERT_ELEMENT: 'insert_element'
|
|
17
|
+
};
|
|
18
|
+
const EXTERNAL_EVENTS = exports.EXTERNAL_EVENTS = {
|
|
19
|
+
ON_HELP_INFO_TOGGLE: 'on_help_info_toggle',
|
|
20
|
+
ON_ARTICLE_INFO_TOGGLE: 'on_article_info_toggle',
|
|
21
|
+
ON_LINK_CLICK: 'on_link_click',
|
|
22
|
+
ON_INSERT_IMAGE: 'on_insert_image',
|
|
23
|
+
INSERT_ATTACHMENTS: 'insert_attachments',
|
|
24
|
+
CLEAR_ARTICLE: 'clear_article'
|
|
25
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
var _exportNames = {
|
|
8
|
+
KeyCodes: true
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(exports, "KeyCodes", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _keyCodes.default;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
var _keyCodes = _interopRequireDefault(require("./key-codes"));
|
|
17
|
+
var _eventTypes = require("./event-types");
|
|
18
|
+
Object.keys(_eventTypes).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
21
|
+
if (key in exports && exports[key] === _eventTypes[key]) return;
|
|
22
|
+
Object.defineProperty(exports, key, {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () {
|
|
25
|
+
return _eventTypes[key];
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
var _translate = require("../utils/translate");
|
|
30
|
+
Object.keys(_translate).forEach(function (key) {
|
|
31
|
+
if (key === "default" || key === "__esModule") return;
|
|
32
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
33
|
+
if (key in exports && exports[key] === _translate[key]) return;
|
|
34
|
+
Object.defineProperty(exports, key, {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () {
|
|
37
|
+
return _translate[key];
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
Backspace: 8,
|
|
5
|
+
Tab: 9,
|
|
6
|
+
Enter: 13,
|
|
7
|
+
Shift: 16,
|
|
8
|
+
Ctrl: 17,
|
|
9
|
+
Alt: 18,
|
|
10
|
+
PauseBreak: 19,
|
|
11
|
+
CapsLock: 20,
|
|
12
|
+
Escape: 27,
|
|
13
|
+
Esc: 27,
|
|
14
|
+
Space: 32,
|
|
15
|
+
PageUp: 33,
|
|
16
|
+
PageDown: 34,
|
|
17
|
+
End: 35,
|
|
18
|
+
Home: 36,
|
|
19
|
+
LeftArrow: 37,
|
|
20
|
+
UpArrow: 38,
|
|
21
|
+
RightArrow: 39,
|
|
22
|
+
DownArrow: 40,
|
|
23
|
+
Insert: 45,
|
|
24
|
+
Delete: 46,
|
|
25
|
+
0: 48,
|
|
26
|
+
1: 49,
|
|
27
|
+
2: 50,
|
|
28
|
+
3: 51,
|
|
29
|
+
4: 52,
|
|
30
|
+
5: 53,
|
|
31
|
+
6: 54,
|
|
32
|
+
7: 55,
|
|
33
|
+
8: 56,
|
|
34
|
+
9: 57,
|
|
35
|
+
a: 65,
|
|
36
|
+
b: 66,
|
|
37
|
+
c: 67,
|
|
38
|
+
d: 68,
|
|
39
|
+
e: 69,
|
|
40
|
+
f: 70,
|
|
41
|
+
g: 71,
|
|
42
|
+
h: 72,
|
|
43
|
+
i: 73,
|
|
44
|
+
j: 74,
|
|
45
|
+
k: 75,
|
|
46
|
+
l: 76,
|
|
47
|
+
m: 77,
|
|
48
|
+
n: 78,
|
|
49
|
+
o: 79,
|
|
50
|
+
p: 80,
|
|
51
|
+
q: 81,
|
|
52
|
+
r: 82,
|
|
53
|
+
s: 83,
|
|
54
|
+
t: 84,
|
|
55
|
+
u: 85,
|
|
56
|
+
v: 86,
|
|
57
|
+
w: 87,
|
|
58
|
+
x: 88,
|
|
59
|
+
y: 89,
|
|
60
|
+
z: 90,
|
|
61
|
+
LeftWindowKey: 91,
|
|
62
|
+
RightWindowKey: 92,
|
|
63
|
+
SelectKey: 93,
|
|
64
|
+
NumPad0: 96,
|
|
65
|
+
NumPad1: 97,
|
|
66
|
+
NumPad2: 98,
|
|
67
|
+
NumPad3: 99,
|
|
68
|
+
NumPad4: 100,
|
|
69
|
+
NumPad5: 101,
|
|
70
|
+
NumPad6: 102,
|
|
71
|
+
NumPad7: 103,
|
|
72
|
+
NumPad8: 104,
|
|
73
|
+
NumPad9: 105,
|
|
74
|
+
Multiply: 106,
|
|
75
|
+
Add: 107,
|
|
76
|
+
Subtract: 109,
|
|
77
|
+
DecimalPoint: 110,
|
|
78
|
+
Divide: 111,
|
|
79
|
+
F1: 112,
|
|
80
|
+
F2: 113,
|
|
81
|
+
F3: 114,
|
|
82
|
+
F4: 115,
|
|
83
|
+
F5: 116,
|
|
84
|
+
F6: 117,
|
|
85
|
+
F7: 118,
|
|
86
|
+
F8: 119,
|
|
87
|
+
F9: 120,
|
|
88
|
+
F10: 121,
|
|
89
|
+
F12: 123,
|
|
90
|
+
NumLock: 144,
|
|
91
|
+
ScrollLock: 145,
|
|
92
|
+
SemiColon: 186,
|
|
93
|
+
EqualSign: 187,
|
|
94
|
+
Comma: 188,
|
|
95
|
+
Dash: 189,
|
|
96
|
+
Period: 190,
|
|
97
|
+
ForwardSlash: 191,
|
|
98
|
+
GraveAccent: 192,
|
|
99
|
+
OpenBracket: 219,
|
|
100
|
+
BackSlash: 220,
|
|
101
|
+
CloseBracket: 221,
|
|
102
|
+
SingleQuote: 222,
|
|
103
|
+
ChineseInputMethod: 229
|
|
104
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
body {
|
|
2
|
+
--sea-email-body-color: #212529;
|
|
3
|
+
--sea-email-body-secondary-color: #666;
|
|
4
|
+
--sea-email-body-bg: #fff;
|
|
5
|
+
--sea-email-body-secondary-bg: #f5f5f5;
|
|
6
|
+
--sea-email-emphasis-color: #303133;
|
|
7
|
+
--sea-email-border-color: rgba(0, 40, 100, .12);
|
|
8
|
+
--sea-email-border-secondary-color: #eee;
|
|
9
|
+
--sea-email-border-tertiary-color: #eaeaea;
|
|
10
|
+
--sea-email-tertiary-color: #fff;
|
|
11
|
+
--sea-email-tertiary-color-rgb: 255, 255, 255;
|
|
12
|
+
--sea-email-header-bg: #f8fafd;
|
|
13
|
+
--sea-email-header-secondary-bg: #f5f5f5;
|
|
14
|
+
--sea-email-header-tertiary-bg: #f0f0f0;
|
|
15
|
+
--sea-email-toolbar-bg: #fff;
|
|
16
|
+
--sea-email-toolbar-secondary-bg: #fcfcfc;
|
|
17
|
+
--sea-email-nav-hover-bg: #f0f0f0;
|
|
18
|
+
--sea-email-nav-active-bg: #f5f5f5;
|
|
19
|
+
--sea-email-wiki-nav-hover-bg: #efefef;
|
|
20
|
+
--sea-email-wiki-nav-active-bg: #ededea;
|
|
21
|
+
--sea-email-th-bg: #f9f9f9;
|
|
22
|
+
--sea-email-th-secondary-bg: #fafafa;
|
|
23
|
+
--sea-email-th-tertiary-bg: #f7f7f7;
|
|
24
|
+
--sea-email-th-quartus-bg: #ededed;
|
|
25
|
+
--sea-email-th-fifth-bg: #e3e3e3;
|
|
26
|
+
--sea-email-tr-active-bg: #f2f4f6;
|
|
27
|
+
--sea-email-tr-active-secondary-bg: #dbecfa;
|
|
28
|
+
--sea-email-tr-hover-bg: #f5f5f5;
|
|
29
|
+
--sea-email-icon-color: #666;
|
|
30
|
+
--sea-email-icon-secondary-color: #999;
|
|
31
|
+
--sea-email-icon-hover-color: #333;
|
|
32
|
+
--sea-email-hover-bg: #efefef;
|
|
33
|
+
--sea-email-hover-secondary-bg: #e5e5e5;
|
|
34
|
+
--sea-email-hover-tertiary-bg: #dbdbdb;
|
|
35
|
+
--sea-email-bg-color: #f5f5f5;
|
|
36
|
+
--sea-email-bg-secondary-color: #f0f0f0;
|
|
37
|
+
--sea-email-dropdown-link-bg: #20a0ff;
|
|
38
|
+
--sea-email-dropdown-secondary-bg: #f2f2f2;
|
|
39
|
+
--sea-email-dropdown-tertiary-bg: #f5f5f5;
|
|
40
|
+
--sea-email-popover-bg: #fff;
|
|
41
|
+
--sea-email-placeholder-color: #495057;
|
|
42
|
+
--sea-email-option-bg-color: rgba(0, 0, 0, 0.04);
|
|
43
|
+
--sea-email-disabled-color: #bdbdbd;
|
|
44
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _slateConvert = require("../slate-convert");
|
|
11
|
+
var _locale = require("../locale");
|
|
12
|
+
var _intl = _interopRequireDefault(require("../intl"));
|
|
13
|
+
var _main = _interopRequireDefault(require("./main"));
|
|
14
|
+
require("./index.css");
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
const SeaEmailEditor = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
value: initValue,
|
|
19
|
+
options = {},
|
|
20
|
+
...rest
|
|
21
|
+
} = _ref;
|
|
22
|
+
const [isLoading, setLoading] = (0, _react.useState)(true);
|
|
23
|
+
const [value, setValue] = (0, _react.useState)();
|
|
24
|
+
|
|
25
|
+
// init lang
|
|
26
|
+
(0, _react.useEffect)(() => {
|
|
27
|
+
let lang = (options === null || options === void 0 ? void 0 : options.lang) || 'en';
|
|
28
|
+
if (lang.toLowerCase() === 'zh-cn') {
|
|
29
|
+
lang = 'zh-cn';
|
|
30
|
+
}
|
|
31
|
+
if (!_locale.LOCALES[lang]) {
|
|
32
|
+
lang = 'en';
|
|
33
|
+
}
|
|
34
|
+
_intl.default.init({
|
|
35
|
+
currentLocale: lang,
|
|
36
|
+
locales: _locale.LOCALES
|
|
37
|
+
});
|
|
38
|
+
}, [options.lang]);
|
|
39
|
+
(0, _react.useEffect)(() => {
|
|
40
|
+
setValue((0, _slateConvert.deserializeHtml)(initValue));
|
|
41
|
+
setLoading(false);
|
|
42
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
43
|
+
}, []);
|
|
44
|
+
if (isLoading) return null;
|
|
45
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_main.default, {
|
|
46
|
+
value: value,
|
|
47
|
+
...rest
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
var _default = exports.default = SeaEmailEditor;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.sea-email-editor {
|
|
2
|
+
height: 100%;
|
|
3
|
+
width: 100%;
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
border: 1px solid #0028641f;
|
|
8
|
+
border-radius: 3px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.sea-email-editor .sea-email-editor-content {
|
|
12
|
+
flex: 1;
|
|
13
|
+
width: 100%;
|
|
14
|
+
padding: 10px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.sea-email-editor .sea-email-editor-content *:first-child {
|
|
18
|
+
outline: none;
|
|
19
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _slateReact = require("slate-react");
|
|
11
|
+
var _slate = require("slate");
|
|
12
|
+
var _slateHistory = require("slate-history");
|
|
13
|
+
var _slugid = require("slugid");
|
|
14
|
+
var _extension = require("@/extension");
|
|
15
|
+
var _eventBus = _interopRequireDefault(require("@/utils/event-bus"));
|
|
16
|
+
var _eventHandler = _interopRequireDefault(require("@/utils/event-handler"));
|
|
17
|
+
var _withPropsEditor = _interopRequireDefault(require("../with-props-editor"));
|
|
18
|
+
var _core = require("@/extension/core");
|
|
19
|
+
var _common = require("@/utils/common");
|
|
20
|
+
var _useAttachments = _interopRequireDefault(require("@/hooks/use-attachments"));
|
|
21
|
+
var _userLinkClick = _interopRequireDefault(require("@/hooks/user-link-click"));
|
|
22
|
+
var _slateConvert = require("../../slate-convert");
|
|
23
|
+
require("./index.css");
|
|
24
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
+
const Main = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
26
|
+
var _editor$api;
|
|
27
|
+
let {
|
|
28
|
+
autoFocus = true,
|
|
29
|
+
value,
|
|
30
|
+
editorApi,
|
|
31
|
+
onSave,
|
|
32
|
+
onChange,
|
|
33
|
+
onLinkClick
|
|
34
|
+
} = _ref;
|
|
35
|
+
const [slateValue, setSlateValue] = (0, _react.useState)(value);
|
|
36
|
+
const focusRangeRef = (0, _react.useRef)(null);
|
|
37
|
+
const editor = (0, _react.useMemo)(() => {
|
|
38
|
+
const _editor = _extension.Plugins.reduce((editor, pluginItem) => {
|
|
39
|
+
const withPlugin = pluginItem.editorPlugin;
|
|
40
|
+
if (withPlugin) {
|
|
41
|
+
return withPlugin(editor);
|
|
42
|
+
}
|
|
43
|
+
return editor;
|
|
44
|
+
}, (0, _slateHistory.withHistory)((0, _slateReact.withReact)((0, _slate.createEditor)())));
|
|
45
|
+
_editor._id = (0, _slugid.nice)();
|
|
46
|
+
return (0, _withPropsEditor.default)(_editor, {
|
|
47
|
+
editorApi,
|
|
48
|
+
onSave
|
|
49
|
+
});
|
|
50
|
+
}, [editorApi, onSave]);
|
|
51
|
+
const eventProxy = (0, _react.useMemo)(() => {
|
|
52
|
+
return new _eventHandler.default(editor);
|
|
53
|
+
}, [editor]);
|
|
54
|
+
(0, _useAttachments.default)(editor);
|
|
55
|
+
(0, _userLinkClick.default)(editor._id, editor === null || editor === void 0 ? void 0 : (_editor$api = editor.api) === null || _editor$api === void 0 ? void 0 : _editor$api.server, onLinkClick);
|
|
56
|
+
const decorate = (0, _extension.useHighlight)(editor);
|
|
57
|
+
const handleChange = (0, _react.useCallback)(value => {
|
|
58
|
+
setSlateValue(value);
|
|
59
|
+
if (!editor.hasMovedSelection && editor.selection && _slate.Range.isCollapsed(editor.selection)) {
|
|
60
|
+
const isAtStart = _slate.Editor.isStart(editor, editor.selection.anchor, _slate.Editor.start(editor, []));
|
|
61
|
+
if (!isAtStart) editor.hasMovedSelection = true;
|
|
62
|
+
}
|
|
63
|
+
if (editor.forceNormalize) return;
|
|
64
|
+
const operations = editor.operations;
|
|
65
|
+
const modifyOps = operations.filter(o => o.type !== 'set_selection');
|
|
66
|
+
if (modifyOps.length > 0) {
|
|
67
|
+
onChange && onChange((0, _slateConvert.slateToHtml)(value));
|
|
68
|
+
}
|
|
69
|
+
const eventBus = _eventBus.default.getInstance();
|
|
70
|
+
eventBus.dispatch('change');
|
|
71
|
+
}, [editor, onChange]);
|
|
72
|
+
const focusNode = (0, _react.useCallback)((editor, focusRange) => {
|
|
73
|
+
const [firstNode] = editor.children;
|
|
74
|
+
if (!firstNode) return;
|
|
75
|
+
if (focusRange && focusRange !== null && focusRange !== void 0 && focusRange.anchor) {
|
|
76
|
+
const startOfFirstNode = _slate.Editor.start(editor, focusRange.anchor.path);
|
|
77
|
+
const range = {
|
|
78
|
+
anchor: startOfFirstNode,
|
|
79
|
+
focus: startOfFirstNode
|
|
80
|
+
};
|
|
81
|
+
(0, _core.focusEditor)(editor, range);
|
|
82
|
+
setTimeout(() => (0, _core.focusEditor)(editor, focusRange), 0);
|
|
83
|
+
focusRangeRef.current = null;
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const [firstNodeFirstChild] = firstNode.children;
|
|
87
|
+
if (firstNodeFirstChild) {
|
|
88
|
+
const startOfFirstNode = _slate.Editor.start(editor, [0, 0]);
|
|
89
|
+
const range = {
|
|
90
|
+
anchor: startOfFirstNode,
|
|
91
|
+
focus: startOfFirstNode
|
|
92
|
+
};
|
|
93
|
+
(0, _core.focusEditor)(editor, range);
|
|
94
|
+
}
|
|
95
|
+
}, []);
|
|
96
|
+
|
|
97
|
+
// useMount: focus editor
|
|
98
|
+
(0, _react.useEffect)(() => {
|
|
99
|
+
editor.forceNormalize = true;
|
|
100
|
+
_slate.Editor.normalize(editor, {
|
|
101
|
+
force: true
|
|
102
|
+
});
|
|
103
|
+
const timer = setTimeout(() => {
|
|
104
|
+
editor.forceNormalize = false;
|
|
105
|
+
if (!autoFocus) return;
|
|
106
|
+
focusNode(editor);
|
|
107
|
+
}, 300);
|
|
108
|
+
return () => {
|
|
109
|
+
editor.forceNormalize = false;
|
|
110
|
+
clearTimeout(timer);
|
|
111
|
+
};
|
|
112
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
113
|
+
}, []);
|
|
114
|
+
(0, _react.useEffect)(() => {
|
|
115
|
+
if (!autoFocus) return;
|
|
116
|
+
focusNode(editor, focusRangeRef.current);
|
|
117
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
118
|
+
}, []);
|
|
119
|
+
|
|
120
|
+
// willUnmount
|
|
121
|
+
(0, _react.useEffect)(() => {
|
|
122
|
+
return () => {
|
|
123
|
+
editor.selection = null;
|
|
124
|
+
editor.history = {
|
|
125
|
+
redos: [],
|
|
126
|
+
undos: []
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
130
|
+
}, []);
|
|
131
|
+
(0, _react.useImperativeHandle)(ref, () => {
|
|
132
|
+
return {
|
|
133
|
+
getEditor: () => editor
|
|
134
|
+
};
|
|
135
|
+
}, [editor]);
|
|
136
|
+
const onEditorClick = (0, _react.useCallback)(() => {
|
|
137
|
+
// Focus at start of document, when document is empty
|
|
138
|
+
const isDoEmpty = (0, _common.isDocumentEmpty)(editor);
|
|
139
|
+
if (isDoEmpty) {
|
|
140
|
+
focusNode(editor);
|
|
141
|
+
}
|
|
142
|
+
}, [editor, focusNode]);
|
|
143
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
144
|
+
className: "sea-email-editor",
|
|
145
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_extension.Toolbar, {
|
|
146
|
+
editor: editor
|
|
147
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
148
|
+
className: "sea-email-editor-content",
|
|
149
|
+
onClick: onEditorClick,
|
|
150
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_slateReact.Slate, {
|
|
151
|
+
editor: editor,
|
|
152
|
+
initialValue: slateValue,
|
|
153
|
+
onChange: handleChange,
|
|
154
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_extension.SetNodeToDecorations, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_slateReact.Editable, {
|
|
155
|
+
readOnly: false,
|
|
156
|
+
decorate: decorate,
|
|
157
|
+
renderElement: _extension.renderElement,
|
|
158
|
+
renderLeaf: _extension.renderLeaf,
|
|
159
|
+
onKeyDown: eventProxy.onKeyDown,
|
|
160
|
+
onCopy: eventProxy.onCopy
|
|
161
|
+
})]
|
|
162
|
+
})
|
|
163
|
+
})]
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
var _default = exports.default = Main;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
const withPropsEditor = function (editor) {
|
|
8
|
+
let props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
9
|
+
let newEditor = editor;
|
|
10
|
+
if (props.editorApi) {
|
|
11
|
+
newEditor.api = props.editorApi;
|
|
12
|
+
}
|
|
13
|
+
if (props.onSave) {
|
|
14
|
+
newEditor.onSave = props.onSave;
|
|
15
|
+
}
|
|
16
|
+
newEditor.isImageUploadOnly = props.isImageUploadOnly === undefined ? true : Boolean(props.isImageUploadOnly);
|
|
17
|
+
newEditor.isSupportMultipleFiles = Boolean(props.isSupportMultipleFiles);
|
|
18
|
+
return newEditor;
|
|
19
|
+
};
|
|
20
|
+
var _default = exports.default = withPropsEditor;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/* insert element dropdown item */
|
|
2
|
+
.sf-dropdown-item-with-left-icon .sf-dropdown-item-content .sf-dropdown-item-content-icon {
|
|
3
|
+
color: #444;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.sf-link-dropdown-menu-item .sf-dropdown-item-content{
|
|
7
|
+
justify-content: space-between;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.sea-email-dropdown-menu-item-relative {
|
|
11
|
+
position: relative;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.sea-email-dropdown-menu .sf-dropdown-item-right-icon {
|
|
15
|
+
color: #999;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.sea-email-dropdown-menu .sf-dropdown-item-with-left-icon {
|
|
19
|
+
min-height:32px;
|
|
20
|
+
padding: 3px 12px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.sea-email-dropdown-menu .sea-email-dropdown-menu-item {
|
|
24
|
+
align-items: center;
|
|
25
|
+
display: flex;
|
|
26
|
+
height: 30px;
|
|
27
|
+
-webkit-user-select: none;
|
|
28
|
+
-ms-user-select: none;
|
|
29
|
+
user-select: none;
|
|
30
|
+
width: 100%
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.sea-email-dropdown-menu .sea-email-dropdown-menu-item .sf-dropdown-item-content {
|
|
34
|
+
align-items: center;
|
|
35
|
+
display: flex;
|
|
36
|
+
flex: 1 1;
|
|
37
|
+
font-size: 14px
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.sea-email-dropdown-menu .sea-email-dropdown-menu-item .iconfont {
|
|
41
|
+
font-size: 12px;
|
|
42
|
+
line-height: 12px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.sea-email-dropdown-menu .sf-dropdown-item-right-icon {
|
|
46
|
+
color: #999;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.sea-email-dropdown-menu .sf-dropdown-item-content .sf-dropdown-item-content-icon {
|
|
50
|
+
margin-right: 10px;
|
|
51
|
+
vertical-align: 1px;
|
|
52
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _constants = require("@/constants");
|
|
11
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
|
+
var _menuShortcutIndicator = _interopRequireDefault(require("../menu-shortcut-indicator"));
|
|
13
|
+
require("./index.css");
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
const DropdownMenuItem = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
16
|
+
const {
|
|
17
|
+
disabled,
|
|
18
|
+
onClick,
|
|
19
|
+
menuConfig,
|
|
20
|
+
children,
|
|
21
|
+
className,
|
|
22
|
+
shortcut,
|
|
23
|
+
isHidden,
|
|
24
|
+
onMousedown
|
|
25
|
+
} = props;
|
|
26
|
+
const {
|
|
27
|
+
iconClass
|
|
28
|
+
} = menuConfig;
|
|
29
|
+
const [isShowChildren, setShowChildren] = (0, _react.useState)(false);
|
|
30
|
+
|
|
31
|
+
// onMount
|
|
32
|
+
(0, _react.useEffect)(() => {
|
|
33
|
+
setShowChildren(!isShowChildren);
|
|
34
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
+
}, []);
|
|
36
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
37
|
+
className: (0, _classnames.default)('sea-email-dropdown-menu-item', className, {
|
|
38
|
+
'disabled': disabled,
|
|
39
|
+
'sf-dropdown-item-with-left-icon': iconClass,
|
|
40
|
+
'sf-link-dropdown-menu-item': shortcut,
|
|
41
|
+
'sea-email-dropdown-menu-item-hidden': isHidden
|
|
42
|
+
}),
|
|
43
|
+
id: menuConfig.id || '',
|
|
44
|
+
onClick: disabled ? () => {} : onClick || (() => {}),
|
|
45
|
+
ref: ref,
|
|
46
|
+
onMouseDown: onMousedown,
|
|
47
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
48
|
+
className: "sf-dropdown-item-content",
|
|
49
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
50
|
+
className: "sf-dropdown-item-left",
|
|
51
|
+
children: [iconClass && /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
52
|
+
className: (0, _classnames.default)(iconClass, 'sf-dropdown-item-content-icon')
|
|
53
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
54
|
+
children: (0, _constants.gettext)(menuConfig.text)
|
|
55
|
+
})]
|
|
56
|
+
}), shortcut && /*#__PURE__*/(0, _jsxRuntime.jsx)(_menuShortcutIndicator.default, {
|
|
57
|
+
shortcuts: shortcut
|
|
58
|
+
})]
|
|
59
|
+
}), isShowChildren && children]
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
var _default = exports.default = DropdownMenuItem;
|