@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,310 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _intlMessageformat = _interopRequireDefault(require("intl-messageformat"));
|
|
11
|
+
var _escapeHtml = _interopRequireDefault(require("escape-html"));
|
|
12
|
+
var _invariant = _interopRequireDefault(require("invariant"));
|
|
13
|
+
var _lodash = _interopRequireDefault(require("lodash.merge"));
|
|
14
|
+
var constants = _interopRequireWildcard(require("./constants"));
|
|
15
|
+
if (!String.prototype.defaultMessage) {
|
|
16
|
+
const defaultMessage = function (msg) {
|
|
17
|
+
return this || msg || '';
|
|
18
|
+
};
|
|
19
|
+
// eslint-disable-next-line no-extend-native
|
|
20
|
+
String.prototype.defaultMessage = defaultMessage;
|
|
21
|
+
// eslint-disable-next-line no-extend-native
|
|
22
|
+
String.prototype.d = defaultMessage;
|
|
23
|
+
}
|
|
24
|
+
class ReactIntlUniversal {
|
|
25
|
+
constructor() {
|
|
26
|
+
this.options = {
|
|
27
|
+
currentLocale: null,
|
|
28
|
+
// Current locale such as 'en-US'
|
|
29
|
+
locales: {},
|
|
30
|
+
// app locale data like { "en-US": { "key1": "value1" }, "zh-CN": { "key1": "值1" } }
|
|
31
|
+
// eslint-disable-next-line
|
|
32
|
+
warningHandler: function () {
|
|
33
|
+
return console.warn(...arguments);
|
|
34
|
+
},
|
|
35
|
+
// ability to accumulate missing messages using third party services
|
|
36
|
+
escapeHtml: true,
|
|
37
|
+
// disable escape html in variable mode
|
|
38
|
+
fallbackLocale: null,
|
|
39
|
+
// Locale to use if a key is not found in the current locale
|
|
40
|
+
debug: false,
|
|
41
|
+
// If debugger mode is on, the message will be wrapped by a span
|
|
42
|
+
dataKey: 'data-i18n-key' // If debugger mode is on, the message will be wrapped by a span with this data key
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Get the formatted message by key
|
|
48
|
+
* @param {string} key The string representing key in locale data file
|
|
49
|
+
* @param {Object} variables Variables in message
|
|
50
|
+
* @returns {string} message
|
|
51
|
+
*/
|
|
52
|
+
_getFormattedMessage(key, variables) {
|
|
53
|
+
if (this.options.intlGetHook) {
|
|
54
|
+
try {
|
|
55
|
+
this.options.intlGetHook(key, this.options.currentLocale);
|
|
56
|
+
} catch (e) {
|
|
57
|
+
// eslint-disable-next-line
|
|
58
|
+
console.log('intl get hook error: ', e);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
(0, _invariant.default)(key, 'key is required');
|
|
62
|
+
const {
|
|
63
|
+
locales,
|
|
64
|
+
currentLocale,
|
|
65
|
+
formats
|
|
66
|
+
} = this.options;
|
|
67
|
+
|
|
68
|
+
// 1. check if the locale data and key exists
|
|
69
|
+
if (!locales || !locales[currentLocale]) {
|
|
70
|
+
let errorMsg = `react-intl-universal locales data "${currentLocale}" not exists.`;
|
|
71
|
+
if (!currentLocale) {
|
|
72
|
+
errorMsg += ' More info: https://github.com/alibaba/react-intl-universal/issues/144#issuecomment-1345193138';
|
|
73
|
+
}
|
|
74
|
+
this.options.warningHandler(errorMsg);
|
|
75
|
+
return '';
|
|
76
|
+
}
|
|
77
|
+
let msg = this.getDescendantProp(locales[currentLocale], key);
|
|
78
|
+
if (msg == null) {
|
|
79
|
+
if (this.options.fallbackLocale) {
|
|
80
|
+
msg = this.getDescendantProp(locales[this.options.fallbackLocale], key);
|
|
81
|
+
if (msg == null) {
|
|
82
|
+
this.options.warningHandler(`react-intl-universal key "${key}" not defined in ${currentLocale} or the fallback locale, ${this.options.fallbackLocale}`);
|
|
83
|
+
return '';
|
|
84
|
+
}
|
|
85
|
+
} else {
|
|
86
|
+
this.options.warningHandler(`react-intl-universal key "${key}" not defined in ${currentLocale}`);
|
|
87
|
+
return '';
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// 2. handle security issue for variables
|
|
92
|
+
if (variables) {
|
|
93
|
+
variables = Object.assign({}, variables);
|
|
94
|
+
// HTML message with variables. Escape it to avoid XSS attack.
|
|
95
|
+
for (let i in variables) {
|
|
96
|
+
let value = variables[i];
|
|
97
|
+
if (this.options.escapeHtml === true && (typeof value === 'string' || value instanceof String) && value.indexOf('<') >= 0) {
|
|
98
|
+
value = (0, _escapeHtml.default)(value);
|
|
99
|
+
}
|
|
100
|
+
variables[i] = value;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// 3. resolve variables
|
|
105
|
+
try {
|
|
106
|
+
let finalMsg;
|
|
107
|
+
if (variables) {
|
|
108
|
+
// format message with variables
|
|
109
|
+
const msgFormatter = new _intlMessageformat.default(msg, currentLocale, formats);
|
|
110
|
+
finalMsg = msgFormatter.format(variables);
|
|
111
|
+
} else {
|
|
112
|
+
// no variables, just return the message
|
|
113
|
+
finalMsg = msg;
|
|
114
|
+
}
|
|
115
|
+
return finalMsg;
|
|
116
|
+
} catch (err) {
|
|
117
|
+
this.options.warningHandler(`react-intl-universal format message failed for key='${key}'.`, err.message);
|
|
118
|
+
return msg;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Get the formatted message by key
|
|
124
|
+
* @param {string} key The string representing key in locale data file
|
|
125
|
+
* @param {Object} [variables] Variables in message
|
|
126
|
+
* @returns {string} message
|
|
127
|
+
*/
|
|
128
|
+
get(key, variables) {
|
|
129
|
+
const msg = this._getFormattedMessage(key, variables);
|
|
130
|
+
return this.options.debug ? this._getSpanElementMessage(key, msg) : msg;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Get the formatted html message by key.
|
|
135
|
+
* @param {string} key The string representing key in locale data file
|
|
136
|
+
* @param {Object} [variables] Variables in message
|
|
137
|
+
* @returns {React.ReactElement} html message
|
|
138
|
+
*/
|
|
139
|
+
getHTML(key, variables) {
|
|
140
|
+
let msg = this._getFormattedMessage(key, variables);
|
|
141
|
+
if (msg) {
|
|
142
|
+
return this._getSpanElementMessage(key, msg);
|
|
143
|
+
}
|
|
144
|
+
return '';
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* As same as get(...) API
|
|
149
|
+
* @param {Object} options
|
|
150
|
+
* @param {string} options.id
|
|
151
|
+
* @param {string} options.defaultMessage
|
|
152
|
+
* @param {Object} variables Variables in message
|
|
153
|
+
* @returns {string} message
|
|
154
|
+
*/
|
|
155
|
+
formatMessage(messageDescriptor, variables) {
|
|
156
|
+
const {
|
|
157
|
+
id,
|
|
158
|
+
defaultMessage
|
|
159
|
+
} = messageDescriptor;
|
|
160
|
+
return this.get(id, variables).defaultMessage(defaultMessage);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* As same as getHTML(...) API
|
|
165
|
+
* @param {Object} options
|
|
166
|
+
* @param {string} options.id
|
|
167
|
+
* @param {React.Element} options.defaultMessage
|
|
168
|
+
* @param {Object} variables Variables in message
|
|
169
|
+
* @returns {React.Element} message
|
|
170
|
+
*/
|
|
171
|
+
formatHTMLMessage(messageDescriptor, variables) {
|
|
172
|
+
const {
|
|
173
|
+
id,
|
|
174
|
+
defaultMessage
|
|
175
|
+
} = messageDescriptor;
|
|
176
|
+
return this.getHTML(id, variables).defaultMessage(defaultMessage);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Helper: determine user's locale via URL, cookie, localStorage, and browser's language.
|
|
181
|
+
* You may not need this API, if you have other rules to determine user's locale.
|
|
182
|
+
* @param {string} options.urlLocaleKey URL's query Key to determine locale. Example: if URL=http://localhost?lang=en-US, then set it 'lang'
|
|
183
|
+
* @param {string} options.cookieLocaleKey Cookie's Key to determine locale. Example: if cookie=lang:en-US, then set it 'lang'
|
|
184
|
+
* @param {string} options.localStorageLocaleKey LocalStorage's Key to determine locale such as 'lang'
|
|
185
|
+
* @returns {string} determined locale such as 'en-US'
|
|
186
|
+
*/
|
|
187
|
+
determineLocale() {
|
|
188
|
+
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
189
|
+
return this.getLocaleFromURL(options) || this.getLocaleFromCookie(options) || this.getLocaleFromLocalStorage(options) || this.getLocaleFromBrowser();
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Change current locale
|
|
194
|
+
* @param {string} newLocale Current locale such as 'en-US'
|
|
195
|
+
*/
|
|
196
|
+
changeCurrentLocale(newLocale) {
|
|
197
|
+
if (!this.options.locales || !this.options.locales[newLocale]) {
|
|
198
|
+
let errorMsg = `react-intl-universal locales data "${newLocale}" not exists.`;
|
|
199
|
+
if (!this.options.locales) {
|
|
200
|
+
errorMsg += 'You should call init function first.';
|
|
201
|
+
}
|
|
202
|
+
this.options.warningHandler(errorMsg);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
this.options.currentLocale = newLocale;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Initialize properties and load CLDR locale data according to currentLocale
|
|
210
|
+
* @param {Object} options
|
|
211
|
+
* @param {string} options.currentLocale Current locale such as 'en-US'
|
|
212
|
+
* @param {any} options.locales App locale data like {"en-US":{"key1":"value1"},"zh-CN":{"key1":"值1"}}
|
|
213
|
+
* @param {boolean} [options.debug] debug mode
|
|
214
|
+
* @returns {Promise}
|
|
215
|
+
*/
|
|
216
|
+
init() {
|
|
217
|
+
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
218
|
+
(0, _invariant.default)(options.currentLocale, 'options.currentLocale is required');
|
|
219
|
+
(0, _invariant.default)(options.locales, 'options.locales is required');
|
|
220
|
+
Object.assign(this.options, options);
|
|
221
|
+
this.options.formats = Object.assign({}, this.options.formats, constants.defaultFormats);
|
|
222
|
+
return new Promise((resolve, reject) => {
|
|
223
|
+
// init() will not load external common locale data anymore.
|
|
224
|
+
// But, it still return a Promise for backward compatibility.
|
|
225
|
+
resolve();
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Get the inital options
|
|
231
|
+
*/
|
|
232
|
+
getInitOptions() {
|
|
233
|
+
return this.options;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Load more locales after init
|
|
238
|
+
*/
|
|
239
|
+
load(locales) {
|
|
240
|
+
(0, _lodash.default)(this.options.locales, locales);
|
|
241
|
+
}
|
|
242
|
+
getLocaleFromCookie(options) {
|
|
243
|
+
const {
|
|
244
|
+
cookieLocaleKey
|
|
245
|
+
} = options;
|
|
246
|
+
if (cookieLocaleKey && typeof document !== 'undefined') {
|
|
247
|
+
const cookies = document.cookie.split(';'); // Split on semicolon only
|
|
248
|
+
const cookieObj = {};
|
|
249
|
+
cookies.forEach(cookie => {
|
|
250
|
+
const [key, value] = cookie.trim().split('='); // Trim leading/trailing spaces
|
|
251
|
+
if (key) {
|
|
252
|
+
cookieObj[key] = decodeURIComponent(value); // cookie values may be URL-encoded
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
return cookieObj[cookieLocaleKey];
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
getLocaleFromLocalStorage(options) {
|
|
259
|
+
const {
|
|
260
|
+
localStorageLocaleKey
|
|
261
|
+
} = options;
|
|
262
|
+
if (localStorageLocaleKey && window.localStorage) {
|
|
263
|
+
return localStorage.getItem(localStorageLocaleKey);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
getLocaleFromURL(options) {
|
|
267
|
+
const {
|
|
268
|
+
urlLocaleKey
|
|
269
|
+
} = options;
|
|
270
|
+
if (urlLocaleKey) {
|
|
271
|
+
let query = window.location.search.split('?');
|
|
272
|
+
if (query.length >= 2) {
|
|
273
|
+
const params = new URLSearchParams(query[1]);
|
|
274
|
+
if (params.has(urlLocaleKey)) {
|
|
275
|
+
return params.get(urlLocaleKey);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
getDescendantProp(locale, key) {
|
|
281
|
+
if (locale[key]) {
|
|
282
|
+
return locale[key];
|
|
283
|
+
}
|
|
284
|
+
const msg = key.split('.').reduce(function (a, b) {
|
|
285
|
+
return a !== undefined ? a[b] : a;
|
|
286
|
+
}, locale);
|
|
287
|
+
return msg;
|
|
288
|
+
}
|
|
289
|
+
getLocaleFromBrowser() {
|
|
290
|
+
return navigator.language || navigator.userLanguage;
|
|
291
|
+
}
|
|
292
|
+
_getSpanElementMessage(key, msg) {
|
|
293
|
+
const options = {
|
|
294
|
+
dangerouslySetInnerHTML: {
|
|
295
|
+
__html: msg
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
if (this.options.debug) {
|
|
299
|
+
options[this.options.dataKey] = key;
|
|
300
|
+
}
|
|
301
|
+
const el = /*#__PURE__*/_react.default.createElement('span', options);
|
|
302
|
+
// when key exists, it should still return element if there's defaultMessage() after getHTML()
|
|
303
|
+
const defaultMessage = () => el;
|
|
304
|
+
return Object.assign({
|
|
305
|
+
defaultMessage: defaultMessage,
|
|
306
|
+
d: defaultMessage
|
|
307
|
+
}, el);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
var _default = exports.default = ReactIntlUniversal;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultFormats = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Currency code list
|
|
9
|
+
* https://www.currency-iso.org/en/home/tables/table-a1.html
|
|
10
|
+
*/
|
|
11
|
+
const currency = ['AFN', 'EUR', 'ALL', 'DZD', 'USD', 'AOA', 'XCD', 'ARS', 'AMD', 'AWG', 'AUD', 'AZN', 'BSD', 'BHD', 'BDT', 'BBD', 'BYN', 'BZD', 'XOF', 'BMD', 'INR', 'BTN', 'BOB', 'BOV', 'BAM', 'BWP', 'NOK', 'BRL', 'BND', 'BGN', 'BIF', 'CVE', 'KHR', 'XAF', 'CAD', 'KYD', 'CLP', 'CLF', 'CNY', 'COP', 'COU', 'KMF', 'CDF', 'NZD', 'CRC', 'HRK', 'CUP', 'CUC', 'ANG', 'CZK', 'DKK', 'DJF', 'DOP', 'EGP', 'SVC', 'ERN', 'ETB', 'FKP', 'FJD', 'XPF', 'GMD', 'GEL', 'GHS', 'GIP', 'GTQ', 'GBP', 'GNF', 'GYD', 'HTG', 'HNL', 'HKD', 'HUF', 'ISK', 'IDR', 'XDR', 'IRR', 'IQD', 'ILS', 'JMD', 'JPY', 'JOD', 'KZT', 'KES', 'KPW', 'KRW', 'KWD', 'KGS', 'LAK', 'LBP', 'LSL', 'ZAR', 'LRD', 'LYD', 'CHF', 'MOP', 'MKD', 'MGA', 'MWK', 'MYR', 'MVR', 'MRO', 'MUR', 'XUA', 'MXN', 'MXV', 'MDL', 'MNT', 'MAD', 'MZN', 'MMK', 'NAD', 'NPR', 'NIO', 'NGN', 'OMR', 'PKR', 'PAB', 'PGK', 'PYG', 'PEN', 'PHP', 'PLN', 'QAR', 'RON', 'RUB', 'RWF', 'SHP', 'WST', 'STD', 'SAR', 'RSD', 'SCR', 'SLL', 'SGD', 'XSU', 'SBD', 'SOS', 'SSP', 'LKR', 'SDG', 'SRD', 'SZL', 'SEK', 'CHE', 'CHW', 'SYP', 'TWD', 'TJS', 'TZS', 'THB', 'TOP', 'TTD', 'TND', 'TRY', 'TMT', 'UGX', 'UAH', 'AED', 'USN', 'UYU', 'UYI', 'UZS', 'VUV', 'VEF', 'VND', 'YER', 'ZMW', 'ZWL', 'XBA', 'XBB', 'XBC', 'XBD', 'XTS', 'XXX', 'XAU', 'XPD', 'XPT', 'XAG'];
|
|
12
|
+
const numberFormat = {};
|
|
13
|
+
for (var i = 0; i < currency.length; i++) {
|
|
14
|
+
numberFormat[currency[i]] = {
|
|
15
|
+
style: 'currency',
|
|
16
|
+
currency: currency[i]
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const defaultFormats = exports.defaultFormats = {
|
|
20
|
+
number: numberFormat
|
|
21
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "ReactIntlUniversal", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _ReactIntlUniversal.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
exports.load = exports.init = exports.getLocaleFromURL = exports.getLocaleFromLocalStorage = exports.getLocaleFromCookie = exports.getLocaleFromBrowser = exports.getInitOptions = exports.getHTML = exports.getDescendantProp = exports.get = exports.formatMessage = exports.formatHTMLMessage = exports.determineLocale = exports.default = exports.changeCurrentLocale = void 0;
|
|
14
|
+
var _ReactIntlUniversal = _interopRequireDefault(require("./ReactIntlUniversal"));
|
|
15
|
+
const defaultInstance = exports.default = new _ReactIntlUniversal.default();
|
|
16
|
+
// resolved by CommonJS module loader
|
|
17
|
+
defaultInstance.ReactIntlUniversal = _ReactIntlUniversal.default;
|
|
18
|
+
// react pattern: https://github.com/facebook/react/blob/main/packages/react/src/React.js
|
|
19
|
+
const get = exports.get = defaultInstance.get.bind(defaultInstance);
|
|
20
|
+
const getHTML = exports.getHTML = defaultInstance.getHTML.bind(defaultInstance);
|
|
21
|
+
const formatMessage = exports.formatMessage = defaultInstance.formatMessage.bind(defaultInstance);
|
|
22
|
+
const formatHTMLMessage = exports.formatHTMLMessage = defaultInstance.formatHTMLMessage.bind(defaultInstance);
|
|
23
|
+
const determineLocale = exports.determineLocale = defaultInstance.determineLocale.bind(defaultInstance);
|
|
24
|
+
const changeCurrentLocale = exports.changeCurrentLocale = defaultInstance.changeCurrentLocale.bind(defaultInstance);
|
|
25
|
+
const init = exports.init = defaultInstance.init.bind(defaultInstance);
|
|
26
|
+
const getInitOptions = exports.getInitOptions = defaultInstance.getInitOptions.bind(defaultInstance);
|
|
27
|
+
const load = exports.load = defaultInstance.load.bind(defaultInstance);
|
|
28
|
+
const getLocaleFromCookie = exports.getLocaleFromCookie = defaultInstance.getLocaleFromCookie.bind(defaultInstance);
|
|
29
|
+
const getLocaleFromLocalStorage = exports.getLocaleFromLocalStorage = defaultInstance.getLocaleFromLocalStorage.bind(defaultInstance);
|
|
30
|
+
const getLocaleFromURL = exports.getLocaleFromURL = defaultInstance.getLocaleFromURL.bind(defaultInstance);
|
|
31
|
+
const getDescendantProp = exports.getDescendantProp = defaultInstance.getDescendantProp.bind(defaultInstance);
|
|
32
|
+
const getLocaleFromBrowser = exports.getLocaleFromBrowser = defaultInstance.getLocaleFromBrowser.bind(defaultInstance);
|
|
33
|
+
// resolved by ECMAScript module loader
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.LOCALES = void 0;
|
|
8
|
+
var _en = _interopRequireDefault(require("./lang/en.json"));
|
|
9
|
+
const LOCALES = exports.LOCALES = {
|
|
10
|
+
'en': _en.default
|
|
11
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Bold": "Bold",
|
|
3
|
+
"Italic": "Italic",
|
|
4
|
+
"Code": "Code",
|
|
5
|
+
"Header one": "Heading 1",
|
|
6
|
+
"Header two": "Heading 2",
|
|
7
|
+
"Header three": "Heading 3",
|
|
8
|
+
"Header four": "Heading 4",
|
|
9
|
+
"Header five": "Heading 5",
|
|
10
|
+
"Header six": "Heading 6",
|
|
11
|
+
"Paragraph": "Paragraph",
|
|
12
|
+
"Quote": "Quote",
|
|
13
|
+
"Ordered list": "Ordered list",
|
|
14
|
+
"Unordered list": "Unordered list",
|
|
15
|
+
"Check list item": "Check list item",
|
|
16
|
+
"Insert image": "Insert image",
|
|
17
|
+
"Insert formula": "Insert formula",
|
|
18
|
+
"Formula": "Formula",
|
|
19
|
+
"Inline code": "Inline code",
|
|
20
|
+
"Code block": "Code block",
|
|
21
|
+
"Insert link": "Insert link",
|
|
22
|
+
"Insert table": "Insert table",
|
|
23
|
+
"Save": "Save",
|
|
24
|
+
"Invalid url": "Invalid URL",
|
|
25
|
+
"Link address": "Link address",
|
|
26
|
+
"Image address": "Image address",
|
|
27
|
+
"Submit": "Submit",
|
|
28
|
+
"Cancel": "Cancel",
|
|
29
|
+
"Help": "Help",
|
|
30
|
+
"Delete table": "Delete table",
|
|
31
|
+
"Column": "Column",
|
|
32
|
+
"Row": "Row",
|
|
33
|
+
"Insert row before": "Insert row before",
|
|
34
|
+
"Insert row after": "Insert row after",
|
|
35
|
+
"Insert column before": "Insert column before",
|
|
36
|
+
"Insert column after": "Insert column after",
|
|
37
|
+
"Delete row": "Delete row",
|
|
38
|
+
"Delete column": "Delete column",
|
|
39
|
+
"Insert row": "Insert row",
|
|
40
|
+
"Insert column": "Insert column",
|
|
41
|
+
"Set align": "Set align",
|
|
42
|
+
"Left": "Left",
|
|
43
|
+
"Center": "Center",
|
|
44
|
+
"Right": "Right",
|
|
45
|
+
"Edit": "Edit",
|
|
46
|
+
"Copy": "Copy",
|
|
47
|
+
"Copied": "Copied",
|
|
48
|
+
"Internal link": "Internal link",
|
|
49
|
+
"Copy_internal link": "Internal link has been copied to clipboard",
|
|
50
|
+
"Internal link desc": "An internal link is a link to a file or folder that can be accessed by users with read permission to the file or folder.",
|
|
51
|
+
"Insert network image": "Insert network image",
|
|
52
|
+
"Upload local image": "Upload local image",
|
|
53
|
+
"Add link": "Add link",
|
|
54
|
+
"Link title": "Link title",
|
|
55
|
+
"Delete": "Delete",
|
|
56
|
+
"Empty": "Empty",
|
|
57
|
+
"Width": "Width",
|
|
58
|
+
"Height": "Height",
|
|
59
|
+
"Full screen": "Full screen",
|
|
60
|
+
"Size": "Size",
|
|
61
|
+
"Clear format": "Clear format",
|
|
62
|
+
"Image address invalid": "Image address invalid",
|
|
63
|
+
"Link address required": "Link address required",
|
|
64
|
+
"Link address invalid": "Link address invalid",
|
|
65
|
+
"Link title required": "Link title required",
|
|
66
|
+
"Blank title not allowed": "Blank title not allowed",
|
|
67
|
+
"Font_style": "Font style",
|
|
68
|
+
"Open link": "Open link",
|
|
69
|
+
"Image is uploading": "Image is uploading",
|
|
70
|
+
"Image loading failed": "Image loading failed",
|
|
71
|
+
"Insert below": "Insert below",
|
|
72
|
+
"Insert above": "Insert above",
|
|
73
|
+
"Insert on the right": "Insert on the right",
|
|
74
|
+
"Insert on the left": "Insert on the left",
|
|
75
|
+
"Row(s)": "row(s)",
|
|
76
|
+
"Column(s)": "column(s)",
|
|
77
|
+
"Insert": "Insert",
|
|
78
|
+
"Horizontal align": "Horizontal align",
|
|
79
|
+
"Underline": "Underline",
|
|
80
|
+
"Row number": "Row number",
|
|
81
|
+
"Column number": "Column number",
|
|
82
|
+
"Copy link": "Copy link"
|
|
83
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "BLOCKQUOTE", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _elementTypes.BLOCKQUOTE;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "BR", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _elementTypes.BR;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "CHECK_LIST_ITEM", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _elementTypes.CHECK_LIST_ITEM;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "CODE_BLOCK", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _elementTypes.CODE_BLOCK;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "CODE_LINE", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _elementTypes.CODE_LINE;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "HEADER1", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _elementTypes.HEADER1;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "HEADER2", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _elementTypes.HEADER2;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "HEADER3", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _elementTypes.HEADER3;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "HEADER4", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _elementTypes.HEADER4;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "HEADER5", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _elementTypes.HEADER5;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "HEADER6", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return _elementTypes.HEADER6;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
exports.HEADER_TYPE_MAP = exports.HEADER_LIST = void 0;
|
|
73
|
+
Object.defineProperty(exports, "IMAGE", {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function () {
|
|
76
|
+
return _elementTypes.IMAGE;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
exports.INLINE_LEVEL_TYPES = void 0;
|
|
80
|
+
Object.defineProperty(exports, "LINK", {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
get: function () {
|
|
83
|
+
return _elementTypes.LINK;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
Object.defineProperty(exports, "LIST_ITEM", {
|
|
87
|
+
enumerable: true,
|
|
88
|
+
get: function () {
|
|
89
|
+
return _elementTypes.LIST_ITEM;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
Object.defineProperty(exports, "ORDERED_LIST", {
|
|
93
|
+
enumerable: true,
|
|
94
|
+
get: function () {
|
|
95
|
+
return _elementTypes.ORDERED_LIST;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
Object.defineProperty(exports, "P", {
|
|
99
|
+
enumerable: true,
|
|
100
|
+
get: function () {
|
|
101
|
+
return _elementTypes.P;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
Object.defineProperty(exports, "PARAGRAPH", {
|
|
105
|
+
enumerable: true,
|
|
106
|
+
get: function () {
|
|
107
|
+
return _elementTypes.PARAGRAPH;
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
Object.defineProperty(exports, "TABLE", {
|
|
111
|
+
enumerable: true,
|
|
112
|
+
get: function () {
|
|
113
|
+
return _elementTypes.TABLE;
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
Object.defineProperty(exports, "TABLE_CELL", {
|
|
117
|
+
enumerable: true,
|
|
118
|
+
get: function () {
|
|
119
|
+
return _elementTypes.TABLE_CELL;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
Object.defineProperty(exports, "TABLE_ROW", {
|
|
123
|
+
enumerable: true,
|
|
124
|
+
get: function () {
|
|
125
|
+
return _elementTypes.TABLE_ROW;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
exports.TOP_LEVEL_TYPES = void 0;
|
|
129
|
+
Object.defineProperty(exports, "UNORDERED_LIST", {
|
|
130
|
+
enumerable: true,
|
|
131
|
+
get: function () {
|
|
132
|
+
return _elementTypes.UNORDERED_LIST;
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
var _elementTypes = require("../../extension/constants/element-types");
|
|
136
|
+
const TOP_LEVEL_TYPES = exports.TOP_LEVEL_TYPES = [_elementTypes.BLOCKQUOTE, _elementTypes.HEADER1, _elementTypes.HEADER2, _elementTypes.HEADER3, _elementTypes.HEADER4, _elementTypes.HEADER5, _elementTypes.HEADER6, _elementTypes.ORDERED_LIST, _elementTypes.UNORDERED_LIST, _elementTypes.CHECK_LIST_ITEM, _elementTypes.PARAGRAPH, _elementTypes.CODE_BLOCK, _elementTypes.TABLE];
|
|
137
|
+
const INLINE_LEVEL_TYPES = exports.INLINE_LEVEL_TYPES = [_elementTypes.IMAGE, _elementTypes.LINK];
|
|
138
|
+
const HEADER_LIST = exports.HEADER_LIST = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6'];
|
|
139
|
+
const HEADER_TYPE_MAP = exports.HEADER_TYPE_MAP = {
|
|
140
|
+
H1: _elementTypes.HEADER1,
|
|
141
|
+
H2: _elementTypes.HEADER2,
|
|
142
|
+
H3: _elementTypes.HEADER3,
|
|
143
|
+
H4: _elementTypes.HEADER4,
|
|
144
|
+
H5: _elementTypes.HEADER5,
|
|
145
|
+
H6: _elementTypes.HEADER6
|
|
146
|
+
};
|