hanbiro-react16-sdk 1.0.17 → 1.0.19
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 +2 -19
- package/dist/_virtual/_commonjsHelpers.js +6 -0
- package/dist/_virtual/index.js +4 -0
- package/dist/components/ChatAIDraft/CustomAIIcon.js +63 -0
- package/dist/components/ChatAIDraft/List.js +151 -0
- package/dist/components/ChatAIDraft/SettingPopper.js +225 -0
- package/dist/components/ChatAIDraft/TypingText.js +39 -0
- package/dist/components/ChatAIDraft/helper.js +121 -0
- package/dist/components/ChatAIDraft/index.js +281 -0
- package/dist/components/CountryFlag/flags/CNFlag.js +27 -0
- package/dist/components/CountryFlag/flags/DEFlag.js +21 -0
- package/dist/components/CountryFlag/flags/ESFlag.js +457 -0
- package/dist/components/CountryFlag/flags/FRFlag.js +21 -0
- package/dist/components/CountryFlag/flags/IDFlag.js +21 -0
- package/dist/components/CountryFlag/flags/ITFlag.js +21 -0
- package/dist/components/CountryFlag/flags/JPFlag.js +21 -0
- package/dist/components/CountryFlag/flags/KRFlag.js +39 -0
- package/dist/components/CountryFlag/flags/NLFlag.js +21 -0
- package/dist/components/CountryFlag/flags/PTFlag.js +139 -0
- package/dist/components/CountryFlag/flags/RUFlag.js +21 -0
- package/dist/components/CountryFlag/flags/SAFlag.js +24 -0
- package/dist/components/CountryFlag/flags/THFlag.js +21 -0
- package/dist/components/CountryFlag/flags/TWFlag.js +28 -0
- package/dist/components/CountryFlag/flags/USFlag.js +34 -0
- package/dist/components/CountryFlag/flags/VNFlag.js +29 -0
- package/dist/components/CountryFlag/index.js +73 -0
- package/dist/components/LoadingCircular/index.js +37 -0
- package/dist/components/LoadingContainer/index.js +53 -0
- package/dist/components/TinyMceEditor/index.js +181 -0
- package/dist/components/TinyMceEditor/scrollStyle.js +40 -0
- package/dist/components/TinyMceEditor/useEditor.js +120 -0
- package/dist/components/Tooltip/index.js +172 -0
- package/dist/constants/index.js +85 -0
- package/dist/hanbiro-react16-sdk.style.css +1 -1
- package/dist/hanbiro-react16-sdk.umd.js +2 -9679
- package/dist/index.d.ts +1 -0
- package/dist/index.js +23 -0
- package/dist/node_modules/@tinymce/tinymce-react/lib/es2015/main/ts/ScriptLoader2.js +148 -0
- package/dist/node_modules/@tinymce/tinymce-react/lib/es2015/main/ts/TinyMCE.js +7 -0
- package/dist/node_modules/@tinymce/tinymce-react/lib/es2015/main/ts/Utils.js +103 -0
- package/dist/node_modules/@tinymce/tinymce-react/lib/es2015/main/ts/components/Editor.js +353 -0
- package/dist/node_modules/@tinymce/tinymce-react/lib/es2015/main/ts/components/EditorPropTypes.js +102 -0
- package/dist/node_modules/axios/index.js +38 -0
- package/dist/node_modules/axios/lib/adapters/adapters.js +71 -0
- package/dist/node_modules/axios/lib/adapters/fetch.js +272 -0
- package/dist/node_modules/axios/lib/adapters/xhr.js +153 -0
- package/dist/node_modules/axios/lib/axios.js +50 -0
- package/dist/node_modules/axios/lib/cancel/CancelToken.js +99 -0
- package/dist/node_modules/axios/lib/cancel/CanceledError.js +20 -0
- package/dist/node_modules/axios/lib/cancel/isCancel.js +6 -0
- package/dist/node_modules/axios/lib/core/Axios.js +220 -0
- package/dist/node_modules/axios/lib/core/AxiosError.js +76 -0
- package/dist/node_modules/axios/lib/core/AxiosHeaders.js +238 -0
- package/dist/node_modules/axios/lib/core/InterceptorManager.js +66 -0
- package/dist/node_modules/axios/lib/core/buildFullPath.js +12 -0
- package/dist/node_modules/axios/lib/core/dispatchRequest.js +48 -0
- package/dist/node_modules/axios/lib/core/mergeConfig.js +100 -0
- package/dist/node_modules/axios/lib/core/settle.js +20 -0
- package/dist/node_modules/axios/lib/core/transformData.js +17 -0
- package/dist/node_modules/axios/lib/defaults/index.js +120 -0
- package/dist/node_modules/axios/lib/defaults/transitional.js +9 -0
- package/dist/node_modules/axios/lib/env/data.js +4 -0
- package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +34 -0
- package/dist/node_modules/axios/lib/helpers/HttpStatusCode.js +77 -0
- package/dist/node_modules/axios/lib/helpers/bind.js +8 -0
- package/dist/node_modules/axios/lib/helpers/buildURL.js +32 -0
- package/dist/node_modules/axios/lib/helpers/combineURLs.js +6 -0
- package/dist/node_modules/axios/lib/helpers/composeSignals.js +41 -0
- package/dist/node_modules/axios/lib/helpers/cookies.js +49 -0
- package/dist/node_modules/axios/lib/helpers/formDataToJSON.js +54 -0
- package/dist/node_modules/axios/lib/helpers/isAbsoluteURL.js +9 -0
- package/dist/node_modules/axios/lib/helpers/isAxiosError.js +7 -0
- package/dist/node_modules/axios/lib/helpers/isURLSameOrigin.js +11 -0
- package/dist/node_modules/axios/lib/helpers/null.js +4 -0
- package/dist/node_modules/axios/lib/helpers/parseHeaders.js +47 -0
- package/dist/node_modules/axios/lib/helpers/parseProtocol.js +7 -0
- package/dist/node_modules/axios/lib/helpers/progressEventReducer.js +44 -0
- package/dist/node_modules/axios/lib/helpers/resolveConfig.js +52 -0
- package/dist/node_modules/axios/lib/helpers/speedometer.js +36 -0
- package/dist/node_modules/axios/lib/helpers/spread.js +8 -0
- package/dist/node_modules/axios/lib/helpers/throttle.js +35 -0
- package/dist/node_modules/axios/lib/helpers/toFormData.js +120 -0
- package/dist/node_modules/axios/lib/helpers/toURLEncodedForm.js +33 -0
- package/dist/node_modules/axios/lib/helpers/trackStream.js +169 -0
- package/dist/node_modules/axios/lib/helpers/validator.js +70 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/Blob.js +4 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/FormData.js +4 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +5 -0
- package/dist/node_modules/axios/lib/platform/browser/index.js +15 -0
- package/dist/node_modules/axios/lib/platform/common/utils.js +15 -0
- package/dist/node_modules/axios/lib/platform/index.js +22 -0
- package/dist/node_modules/axios/lib/utils.js +429 -0
- package/dist/node_modules/marked/lib/marked.esm.js +2169 -0
- package/dist/node_modules/prop-types/factoryWithThrowingShims.js +51 -0
- package/dist/node_modules/prop-types/index.js +12 -0
- package/dist/node_modules/prop-types/lib/ReactPropTypesSecret.js +5 -0
- package/dist/node_modules/react-feather/dist/icons/copy.js +75 -0
- package/dist/node_modules/react-feather/dist/icons/send.js +73 -0
- package/dist/node_modules/react-feather/dist/icons/settings.js +72 -0
- package/dist/node_modules/uuid/dist/esm-browser/native.js +7 -0
- package/dist/node_modules/uuid/dist/esm-browser/rng.js +14 -0
- package/dist/node_modules/uuid/dist/esm-browser/stringify.js +10 -0
- package/dist/node_modules/uuid/dist/esm-browser/v4.js +16 -0
- package/dist/utils/axiosAPI.js +89 -0
- package/dist/utils/url.js +54 -0
- package/package.json +2 -1
- package/dist/hanbiro-react16-sdk.es.js +0 -7910
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
21
|
+
import React__default from "react";
|
|
22
|
+
import LoadingContainer from "../LoadingContainer/index.js";
|
|
23
|
+
import { scrollStyle } from "./scrollStyle.js";
|
|
24
|
+
import { Editor } from "../../node_modules/@tinymce/tinymce-react/lib/es2015/main/ts/components/Editor.js";
|
|
25
|
+
import useEditor from "./useEditor.js";
|
|
26
|
+
class TinyMceEditor extends React__default.Component {
|
|
27
|
+
constructor(props) {
|
|
28
|
+
super(props);
|
|
29
|
+
__publicField(this, "editorRef", null);
|
|
30
|
+
// Các hàm public được expose ra (tương tự như useImperativeHandle trước đó)
|
|
31
|
+
__publicField(this, "getContent", () => {
|
|
32
|
+
var _a;
|
|
33
|
+
const editorContent = ((_a = this.editorRef) == null ? void 0 : _a.getContent()) || "";
|
|
34
|
+
return {
|
|
35
|
+
content: editorContent
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
__publicField(this, "getRawContent", () => {
|
|
39
|
+
var _a;
|
|
40
|
+
const editorContent = ((_a = this.editorRef) == null ? void 0 : _a.getContent()) || "";
|
|
41
|
+
return editorContent;
|
|
42
|
+
});
|
|
43
|
+
__publicField(this, "handleEditorChange", (content) => {
|
|
44
|
+
if (this.props.onChange) {
|
|
45
|
+
this.props.onChange(content);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
this.state = {
|
|
49
|
+
showEditor: false
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
render() {
|
|
53
|
+
const {
|
|
54
|
+
value,
|
|
55
|
+
isSimple = false,
|
|
56
|
+
disabled = false,
|
|
57
|
+
height = 550,
|
|
58
|
+
skin = "tinymce-5",
|
|
59
|
+
onClick,
|
|
60
|
+
style,
|
|
61
|
+
lang = "en",
|
|
62
|
+
placeholder = "",
|
|
63
|
+
options,
|
|
64
|
+
noImage = false
|
|
65
|
+
} = this.props;
|
|
66
|
+
const { showEditor } = this.state;
|
|
67
|
+
const {
|
|
68
|
+
defaultPlugins,
|
|
69
|
+
defaultToolbar,
|
|
70
|
+
imageUploadBasePath,
|
|
71
|
+
imageUploadUrl,
|
|
72
|
+
supportImageTypes,
|
|
73
|
+
fontfamily,
|
|
74
|
+
setupFunction,
|
|
75
|
+
filePickerHandle,
|
|
76
|
+
defaultFontSize
|
|
77
|
+
} = useEditor({
|
|
78
|
+
isSimple,
|
|
79
|
+
noImage
|
|
80
|
+
});
|
|
81
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
82
|
+
"div",
|
|
83
|
+
{
|
|
84
|
+
style: __spreadValues({
|
|
85
|
+
position: "relative",
|
|
86
|
+
borderRadius: 1,
|
|
87
|
+
height
|
|
88
|
+
}, style)
|
|
89
|
+
},
|
|
90
|
+
/* @__PURE__ */ React__default.createElement("style", null, `
|
|
91
|
+
.tox.tox-tinymce {
|
|
92
|
+
border-radius: 4px;
|
|
93
|
+
}
|
|
94
|
+
`),
|
|
95
|
+
!showEditor && /* @__PURE__ */ React__default.createElement(
|
|
96
|
+
LoadingContainer,
|
|
97
|
+
{
|
|
98
|
+
style: {
|
|
99
|
+
position: "absolute",
|
|
100
|
+
top: 0,
|
|
101
|
+
left: 0,
|
|
102
|
+
right: 0,
|
|
103
|
+
zIndex: 12,
|
|
104
|
+
background: "#ffffff",
|
|
105
|
+
border: "1px solid var(--border-main)",
|
|
106
|
+
borderRadius: 4,
|
|
107
|
+
height: (options == null ? void 0 : options.height) || height
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
/* @__PURE__ */ React__default.createElement(
|
|
112
|
+
Editor,
|
|
113
|
+
{
|
|
114
|
+
disabled,
|
|
115
|
+
onEditorChange: this.handleEditorChange,
|
|
116
|
+
value,
|
|
117
|
+
onInit: (evt, editor) => {
|
|
118
|
+
this.setState({ showEditor: true });
|
|
119
|
+
this.editorRef = editor;
|
|
120
|
+
},
|
|
121
|
+
onClick,
|
|
122
|
+
plugins: defaultPlugins,
|
|
123
|
+
init: __spreadProps(__spreadValues({
|
|
124
|
+
text_patterns: false,
|
|
125
|
+
placeholder,
|
|
126
|
+
indent: false,
|
|
127
|
+
skin,
|
|
128
|
+
visual: false,
|
|
129
|
+
promotion: false,
|
|
130
|
+
language: lang || "en",
|
|
131
|
+
// language_url: language
|
|
132
|
+
// ? `${process.env.PUBLIC_URL || ""}/js/tinymce/langs/${language}.js`
|
|
133
|
+
// : undefined,
|
|
134
|
+
branding: false,
|
|
135
|
+
elementpath: false,
|
|
136
|
+
height,
|
|
137
|
+
menubar: !isSimple,
|
|
138
|
+
verify_html: true,
|
|
139
|
+
toolbar: defaultToolbar,
|
|
140
|
+
toolbar_mode: "sliding",
|
|
141
|
+
images_upload_base_path: imageUploadBasePath,
|
|
142
|
+
images_upload_url: imageUploadUrl,
|
|
143
|
+
images_upload_credentials: true,
|
|
144
|
+
automatic_uploads: true,
|
|
145
|
+
images_file_types: supportImageTypes,
|
|
146
|
+
font_family_formats: fontfamily,
|
|
147
|
+
paste_data_images: true,
|
|
148
|
+
a11y_advanced_options: true,
|
|
149
|
+
image_advtab: true,
|
|
150
|
+
file_picker_types: "file image media",
|
|
151
|
+
file_picker_callback: filePickerHandle,
|
|
152
|
+
forced_root_block_attrs: { style: "margin: 0;" },
|
|
153
|
+
font_size_formats: "6pt 8pt 9pt 10pt 11pt 12pt 14pt 16pt 18pt 20pt 22pt 24pt 26pt 28pt 36pt 48pt 72pt"
|
|
154
|
+
}, noImage && {
|
|
155
|
+
invalid_elements: "img"
|
|
156
|
+
}), {
|
|
157
|
+
content_style: `
|
|
158
|
+
${scrollStyle}
|
|
159
|
+
[data-mce-placeholder]::before {
|
|
160
|
+
color: rgba(0, 23, 55, 0.42) !important;
|
|
161
|
+
}
|
|
162
|
+
body {
|
|
163
|
+
font-family: ${"Helvetica,Arial,sans-serif"};
|
|
164
|
+
font-size: ${defaultFontSize}pt;
|
|
165
|
+
line-height: unset;
|
|
166
|
+
background: var(--background-softGrey);
|
|
167
|
+
color: var(--text-primary);
|
|
168
|
+
}`,
|
|
169
|
+
setup: setupFunction,
|
|
170
|
+
relative_urls: false,
|
|
171
|
+
remove_script_host: false,
|
|
172
|
+
document_base_url: "/"
|
|
173
|
+
})
|
|
174
|
+
}
|
|
175
|
+
)
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
export {
|
|
180
|
+
TinyMceEditor as default
|
|
181
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const scrollStyle = `
|
|
2
|
+
::-webkit-scrollbar,
|
|
3
|
+
*::-webkit-scrollbar {
|
|
4
|
+
width: 8px;
|
|
5
|
+
height: 8px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
*::-webkit-scrollbar-track {
|
|
9
|
+
background: transparent;
|
|
10
|
+
backdrop-filter: blur(6px);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
::-webkit-scrollbar-thumb,
|
|
14
|
+
*::-webkit-scrollbar-thumb {
|
|
15
|
+
background: #e0e0e0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
::-webkit-scrollbar-thumb:focus,
|
|
19
|
+
*::-webkit-scrollbar-thumb:focus {
|
|
20
|
+
background: #bdbdbd;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
::-webkit-scrollbar-thumb:active,
|
|
24
|
+
*::-webkit-scrollbar-thumb:active {
|
|
25
|
+
background: #bdbdbd;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
::-webkit-scrollbar-thumb:hover,
|
|
29
|
+
*::-webkit-scrollbar-thumb:hover {
|
|
30
|
+
background: #bdbdbd;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
::-webkit-scrollbar-corner,
|
|
34
|
+
*::-webkit-scrollbar-corner {
|
|
35
|
+
background-color: transparent;
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
export {
|
|
39
|
+
scrollStyle
|
|
40
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { getBaseUrl } from "../../utils/url.js";
|
|
2
|
+
const useEditor = (options) => {
|
|
3
|
+
const { isSimple, noImage } = options;
|
|
4
|
+
const fontSize = 13;
|
|
5
|
+
const fontType = void 0;
|
|
6
|
+
const fontWeight = 0;
|
|
7
|
+
const lang = "en";
|
|
8
|
+
const imageUploadBasePath = getBaseUrl();
|
|
9
|
+
const supportImageTypes = "jpeg,JPEG,jpg,JPG,jpe,JPE,jfi,jif,jfif,png,PNG,gif,GIF,bmp,BMP,webp,WEBP";
|
|
10
|
+
const fontfamily = (() => {
|
|
11
|
+
const baseFonts = "Andale Mono=andale mono,times; Arial=arial,helvetica,sans-serif; Arial Black=arial black,avant garde; Book Antiqua=book antiqua,palatino; Comic Sans MS=comic sans ms,sans-serif; Courier New=courier new,courier; Georgia=georgia,palatino; Helvetica=helvetica; Impact=impact,chicago; Symbol=symbol; Tahoma=tahoma,arial,helvetica,sans-serif; Terminal=terminal,monaco; Times New Roman=times new roman,times; Trebuchet MS=trebuchet ms,geneva; Verdana=verdana,geneva; Webdings=webdings; Wingdings=wingdings,zapf dingbats;";
|
|
12
|
+
const localeFonts = {
|
|
13
|
+
ko: '맑은고딕=Malgun Gothic;돋움="돋움",Dotum;돋움체="돋움체",DotumChe;굴림="굴림",Gulim;굴림체="굴림체",GulimChe;바탕="바탕",Batang;바탕체="바탕체",BatangChe;궁서="궁서",Gungseo;',
|
|
14
|
+
en: "MS PGothic=MS PGothic,Sans-serif;Meiryo UI=Meiryo UI,Sans-serif;HiraKakuProN-W3=HiraKakuProN-W3;MS PMincho=MS PMincho,Sans-serif;MS Gothic=MS Gothic,Sans-serif;MS Mincho=MS Mincho,Sans-serif;",
|
|
15
|
+
ch: "Microsoft YaHei=Microsoft YaHei,Sans-serif;"
|
|
16
|
+
};
|
|
17
|
+
return localeFonts[lang] + baseFonts;
|
|
18
|
+
})();
|
|
19
|
+
const imageUploadUrl = (() => {
|
|
20
|
+
let locationInfo = window.location;
|
|
21
|
+
const { hostname } = locationInfo;
|
|
22
|
+
if (hostname === "localhost" || hostname === "127.0.0.1") {
|
|
23
|
+
return `${imageUploadBasePath}/ngw/app/lib/tinymce/plugins/jbimages/ci/index.php?upload/dropupload`;
|
|
24
|
+
} else {
|
|
25
|
+
return `${imageUploadBasePath}/ngw/app/lib/tinymce/plugins/jbimages/ci/index.php?upload/dropupload`;
|
|
26
|
+
}
|
|
27
|
+
})();
|
|
28
|
+
let defaultPlugins;
|
|
29
|
+
let defaultToolbar = [];
|
|
30
|
+
if (isSimple) {
|
|
31
|
+
defaultPlugins = "hanbiroclip";
|
|
32
|
+
defaultToolbar = [
|
|
33
|
+
"fontfamily fontsize",
|
|
34
|
+
"bold italic underline",
|
|
35
|
+
"forecolor backcolor",
|
|
36
|
+
"bullist numlist",
|
|
37
|
+
"emoticons"
|
|
38
|
+
];
|
|
39
|
+
} else {
|
|
40
|
+
defaultPlugins = "checklist lists link image table code codesample insertdatetime emoticons fullscreen wordcount hanbiroclip";
|
|
41
|
+
defaultToolbar = [
|
|
42
|
+
"fontfamily fontsize styles",
|
|
43
|
+
"align lineheight checklist",
|
|
44
|
+
"bold italic underline",
|
|
45
|
+
"forecolor backcolor",
|
|
46
|
+
"bullist numlist",
|
|
47
|
+
"link image table",
|
|
48
|
+
"code codesample",
|
|
49
|
+
"insertdatetime emoticons",
|
|
50
|
+
"fullscreen",
|
|
51
|
+
"removeformat"
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
const setupFunction = (ed) => {
|
|
55
|
+
ed.on("init", () => {
|
|
56
|
+
setTimeout(() => {
|
|
57
|
+
const editorBody = ed == null ? void 0 : ed.getBody();
|
|
58
|
+
const style = [];
|
|
59
|
+
{
|
|
60
|
+
ed.execCommand("FontSize", false, fontSize);
|
|
61
|
+
style.push(`font-size: ${fontSize}pt;`);
|
|
62
|
+
}
|
|
63
|
+
if ((style == null ? void 0 : style.length) > 0) {
|
|
64
|
+
editorBody == null ? void 0 : editorBody.setAttribute("style", style.join(" "));
|
|
65
|
+
}
|
|
66
|
+
if (Number(fontWeight)) {
|
|
67
|
+
ed.execCommand("Bold");
|
|
68
|
+
}
|
|
69
|
+
}, 0);
|
|
70
|
+
});
|
|
71
|
+
if (noImage) {
|
|
72
|
+
ed.on("BeforeSetContent", (e) => {
|
|
73
|
+
if (/<img[\s\S]*?>/i.test(e == null ? void 0 : e.content)) {
|
|
74
|
+
ed.windowManager.alert("Image is not allowed!");
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const filePickerHandle = function(cb) {
|
|
80
|
+
const input = document.createElement("input");
|
|
81
|
+
input.setAttribute("type", "file");
|
|
82
|
+
input.setAttribute("accept", "image/*");
|
|
83
|
+
input.onchange = function(event) {
|
|
84
|
+
const fileInput = event.target;
|
|
85
|
+
const file = fileInput.files && fileInput.files[0];
|
|
86
|
+
if (file) {
|
|
87
|
+
const reader = new FileReader();
|
|
88
|
+
reader.onload = function() {
|
|
89
|
+
const id = "blobid" + (/* @__PURE__ */ new Date()).getTime();
|
|
90
|
+
const blobCache = window.tinymce.activeEditor.editorUpload.blobCache;
|
|
91
|
+
const result = reader.result;
|
|
92
|
+
if (result && typeof result === "string") {
|
|
93
|
+
const base64 = result.split(",")[1];
|
|
94
|
+
const blobInfo = blobCache.create(id, file, base64);
|
|
95
|
+
blobCache.add(blobInfo);
|
|
96
|
+
cb(blobInfo.blobUri(), { title: file.name });
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
reader.readAsDataURL(file);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
input.click();
|
|
103
|
+
};
|
|
104
|
+
return {
|
|
105
|
+
defaultPlugins,
|
|
106
|
+
defaultToolbar: defaultToolbar == null ? void 0 : defaultToolbar.join(" | "),
|
|
107
|
+
imageUploadBasePath,
|
|
108
|
+
imageUploadUrl,
|
|
109
|
+
supportImageTypes,
|
|
110
|
+
fontfamily,
|
|
111
|
+
setupFunction,
|
|
112
|
+
filePickerHandle,
|
|
113
|
+
defaultFontType: fontType,
|
|
114
|
+
defaultFontSize: fontSize,
|
|
115
|
+
isFontWeightBold: Number(fontWeight) === 1
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
export {
|
|
119
|
+
useEditor as default
|
|
120
|
+
};
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
21
|
+
import * as React from "react";
|
|
22
|
+
import * as ReactDOM from "react-dom";
|
|
23
|
+
const ARROW_SIZE = 6;
|
|
24
|
+
const GAP = 4;
|
|
25
|
+
class Tooltip extends React.Component {
|
|
26
|
+
constructor(props) {
|
|
27
|
+
super(props);
|
|
28
|
+
__publicField(this, "triggerRef");
|
|
29
|
+
__publicField(this, "tooltipRef");
|
|
30
|
+
__publicField(this, "enterTimer", null);
|
|
31
|
+
__publicField(this, "leaveTimer", null);
|
|
32
|
+
__publicField(this, "handleMouseEnter", () => {
|
|
33
|
+
if (this.leaveTimer) {
|
|
34
|
+
clearTimeout(this.leaveTimer);
|
|
35
|
+
this.leaveTimer = null;
|
|
36
|
+
}
|
|
37
|
+
const { enterDelay } = this.props;
|
|
38
|
+
this.enterTimer = setTimeout(() => {
|
|
39
|
+
this.setState({ visible: true }, () => {
|
|
40
|
+
const coords = this.computeCoords();
|
|
41
|
+
this.setState({ coords });
|
|
42
|
+
});
|
|
43
|
+
}, enterDelay);
|
|
44
|
+
});
|
|
45
|
+
__publicField(this, "handleMouseLeave", () => {
|
|
46
|
+
if (this.enterTimer) {
|
|
47
|
+
clearTimeout(this.enterTimer);
|
|
48
|
+
this.enterTimer = null;
|
|
49
|
+
}
|
|
50
|
+
const { leaveDelay } = this.props;
|
|
51
|
+
this.leaveTimer = setTimeout(() => {
|
|
52
|
+
this.setState({ visible: false });
|
|
53
|
+
}, leaveDelay);
|
|
54
|
+
});
|
|
55
|
+
this.state = {
|
|
56
|
+
visible: false,
|
|
57
|
+
coords: { top: 0, left: 0 }
|
|
58
|
+
};
|
|
59
|
+
this.triggerRef = React.createRef();
|
|
60
|
+
this.tooltipRef = React.createRef();
|
|
61
|
+
}
|
|
62
|
+
computeCoords() {
|
|
63
|
+
const { placement, disablePortal } = this.props;
|
|
64
|
+
if (!this.triggerRef.current || !this.tooltipRef.current) {
|
|
65
|
+
return { top: 0, left: 0 };
|
|
66
|
+
}
|
|
67
|
+
const triggerRect = this.triggerRef.current.getBoundingClientRect();
|
|
68
|
+
const tooltipRect = this.tooltipRef.current.getBoundingClientRect();
|
|
69
|
+
const offset = ARROW_SIZE + GAP;
|
|
70
|
+
let top = 0;
|
|
71
|
+
let left = 0;
|
|
72
|
+
if (disablePortal) {
|
|
73
|
+
switch (placement) {
|
|
74
|
+
case "top":
|
|
75
|
+
top = -tooltipRect.height - offset;
|
|
76
|
+
left = triggerRect.width / 2 - tooltipRect.width / 2;
|
|
77
|
+
break;
|
|
78
|
+
case "bottom":
|
|
79
|
+
top = triggerRect.height + offset;
|
|
80
|
+
left = triggerRect.width / 2 - tooltipRect.width / 2;
|
|
81
|
+
break;
|
|
82
|
+
case "left":
|
|
83
|
+
top = triggerRect.height / 2 - tooltipRect.height / 2;
|
|
84
|
+
left = -tooltipRect.width - offset;
|
|
85
|
+
break;
|
|
86
|
+
case "right":
|
|
87
|
+
top = triggerRect.height / 2 - tooltipRect.height / 2;
|
|
88
|
+
left = triggerRect.width + offset;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
} else {
|
|
92
|
+
switch (placement) {
|
|
93
|
+
case "top":
|
|
94
|
+
top = triggerRect.top - tooltipRect.height - offset;
|
|
95
|
+
left = triggerRect.left + triggerRect.width / 2 - tooltipRect.width / 2;
|
|
96
|
+
break;
|
|
97
|
+
case "bottom":
|
|
98
|
+
top = triggerRect.bottom + offset;
|
|
99
|
+
left = triggerRect.left + triggerRect.width / 2 - tooltipRect.width / 2;
|
|
100
|
+
break;
|
|
101
|
+
case "left":
|
|
102
|
+
top = triggerRect.top + triggerRect.height / 2 - tooltipRect.height / 2;
|
|
103
|
+
left = triggerRect.left - tooltipRect.width - offset;
|
|
104
|
+
break;
|
|
105
|
+
case "right":
|
|
106
|
+
top = triggerRect.top + triggerRect.height / 2 - tooltipRect.height / 2;
|
|
107
|
+
left = triggerRect.right + offset;
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return { top, left };
|
|
112
|
+
}
|
|
113
|
+
componentWillUnmount() {
|
|
114
|
+
if (this.enterTimer) clearTimeout(this.enterTimer);
|
|
115
|
+
if (this.leaveTimer) clearTimeout(this.leaveTimer);
|
|
116
|
+
}
|
|
117
|
+
renderTooltip() {
|
|
118
|
+
const { title, placement, className, style, zIndex, disablePortal } = this.props;
|
|
119
|
+
const { visible, coords } = this.state;
|
|
120
|
+
if (!title) return null;
|
|
121
|
+
const positionStyle = disablePortal ? { position: "absolute" } : { position: "fixed" };
|
|
122
|
+
const tooltipEl = /* @__PURE__ */ React.createElement(
|
|
123
|
+
"div",
|
|
124
|
+
{
|
|
125
|
+
ref: this.tooltipRef,
|
|
126
|
+
role: "tooltip",
|
|
127
|
+
className: [
|
|
128
|
+
"hb-tooltip",
|
|
129
|
+
`hb-tooltip--${placement}`,
|
|
130
|
+
visible ? "hb-tooltip--visible" : "",
|
|
131
|
+
className || ""
|
|
132
|
+
].filter(Boolean).join(" "),
|
|
133
|
+
style: __spreadValues(__spreadProps(__spreadValues({}, positionStyle), {
|
|
134
|
+
top: coords.top,
|
|
135
|
+
left: coords.left,
|
|
136
|
+
zIndex
|
|
137
|
+
}), style)
|
|
138
|
+
},
|
|
139
|
+
/* @__PURE__ */ React.createElement("div", { className: "hb-tooltip__arrow" }),
|
|
140
|
+
/* @__PURE__ */ React.createElement("div", { className: "hb-tooltip__content" }, title)
|
|
141
|
+
);
|
|
142
|
+
if (disablePortal) {
|
|
143
|
+
return tooltipEl;
|
|
144
|
+
}
|
|
145
|
+
return ReactDOM.createPortal(tooltipEl, document.body);
|
|
146
|
+
}
|
|
147
|
+
render() {
|
|
148
|
+
const { children } = this.props;
|
|
149
|
+
return /* @__PURE__ */ React.createElement(
|
|
150
|
+
"span",
|
|
151
|
+
{
|
|
152
|
+
ref: this.triggerRef,
|
|
153
|
+
className: "hb-tooltip-wrapper",
|
|
154
|
+
onMouseEnter: this.handleMouseEnter,
|
|
155
|
+
onMouseLeave: this.handleMouseLeave,
|
|
156
|
+
style: { display: "inline-flex" }
|
|
157
|
+
},
|
|
158
|
+
children,
|
|
159
|
+
this.renderTooltip()
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
__publicField(Tooltip, "defaultProps", {
|
|
164
|
+
placement: "top",
|
|
165
|
+
disablePortal: false,
|
|
166
|
+
enterDelay: 100,
|
|
167
|
+
leaveDelay: 0,
|
|
168
|
+
zIndex: 1500
|
|
169
|
+
});
|
|
170
|
+
export {
|
|
171
|
+
Tooltip as default
|
|
172
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
const AI_LANG_FLAGS = [
|
|
2
|
+
{
|
|
3
|
+
label: "English",
|
|
4
|
+
value: "en",
|
|
5
|
+
flagCode: "us"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
label: "Korean",
|
|
9
|
+
value: "ko",
|
|
10
|
+
flagCode: "kr"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
label: "Vietnamese",
|
|
14
|
+
value: "vi",
|
|
15
|
+
flagCode: "vn"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
label: "Indonesian",
|
|
19
|
+
value: "id",
|
|
20
|
+
flagCode: "id"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: "Chinese-Traditional",
|
|
24
|
+
value: "zh-cht",
|
|
25
|
+
flagCode: "cn"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
label: "Chinese-Simplified",
|
|
29
|
+
value: "zh-chs",
|
|
30
|
+
flagCode: "cn"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
label: "Japanese",
|
|
34
|
+
value: "ja",
|
|
35
|
+
flagCode: "jp"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label: "Thai",
|
|
39
|
+
value: "th",
|
|
40
|
+
flagCode: "th"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: "Spanish",
|
|
44
|
+
value: "es",
|
|
45
|
+
flagCode: "es"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: "French",
|
|
49
|
+
value: "fr",
|
|
50
|
+
flagCode: "fr"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
label: "German",
|
|
54
|
+
value: "de",
|
|
55
|
+
flagCode: "de"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
label: "Italian",
|
|
59
|
+
value: "it",
|
|
60
|
+
flagCode: "it"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
label: "Dutch",
|
|
64
|
+
value: "nl",
|
|
65
|
+
flagCode: "nl"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
label: "Portuguese",
|
|
69
|
+
value: "pt",
|
|
70
|
+
flagCode: "pt"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
label: "Arabic",
|
|
74
|
+
value: "ar",
|
|
75
|
+
flagCode: "sa"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
label: "Russian",
|
|
79
|
+
value: "ru",
|
|
80
|
+
flagCode: "ru"
|
|
81
|
+
}
|
|
82
|
+
];
|
|
83
|
+
export {
|
|
84
|
+
AI_LANG_FLAGS
|
|
85
|
+
};
|