hanbiro-react16-sdk 1.0.21 → 1.0.23

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.
Files changed (38) hide show
  1. package/dist/components/ChatAIDraft/EmptyState.d.ts +6 -0
  2. package/dist/components/ChatAIDraft/EmptyState.js +220 -0
  3. package/dist/components/ChatAIDraft/List.js +55 -18
  4. package/dist/components/ChatAIDraft/SettingPopper.d.ts +5 -4
  5. package/dist/components/ChatAIDraft/SettingPopper.js +235 -79
  6. package/dist/components/ChatAIDraft/constants.d.ts +4 -0
  7. package/dist/components/ChatAIDraft/constants.js +18 -0
  8. package/dist/components/ChatAIDraft/index.d.ts +5 -8
  9. package/dist/components/ChatAIDraft/index.js +80 -48
  10. package/dist/components/index.d.ts +1 -1
  11. package/dist/hanbiro-react16-sdk.style.css +39 -2
  12. package/dist/hanbiro-react16-sdk.umd.js +7213 -3
  13. package/dist/index.js +2 -2
  14. package/dist/node_modules/prop-types/index.js +1 -2
  15. package/dist/node_modules/react-feather/dist/icons/align-justify.js +86 -0
  16. package/dist/node_modules/react-feather/dist/icons/{send.js → arrow-up.js} +10 -10
  17. package/dist/node_modules/react-feather/dist/icons/award.js +72 -0
  18. package/dist/node_modules/react-feather/dist/icons/check.js +68 -0
  19. package/dist/node_modules/react-feather/dist/icons/chevron-down.js +68 -0
  20. package/dist/node_modules/react-feather/dist/icons/compass.js +72 -0
  21. package/dist/node_modules/react-feather/dist/icons/file-text.js +82 -0
  22. package/dist/node_modules/react-feather/dist/icons/frown.js +82 -0
  23. package/dist/node_modules/react-feather/dist/icons/heart.js +68 -0
  24. package/dist/node_modules/react-feather/dist/icons/message-circle.js +68 -0
  25. package/dist/node_modules/react-feather/dist/icons/message-square.js +68 -0
  26. package/dist/node_modules/react-feather/dist/icons/scissors.js +89 -0
  27. package/dist/node_modules/react-feather/dist/icons/smile.js +82 -0
  28. package/dist/node_modules/react-feather/dist/icons/thumbs-up.js +68 -0
  29. package/dist/node_modules/react-feather/dist/icons/zap.js +68 -0
  30. package/package.json +1 -1
  31. package/dist/components/TinyMceEditor/index.js +0 -181
  32. package/dist/components/TinyMceEditor/scrollStyle.js +0 -40
  33. package/dist/components/TinyMceEditor/useEditor.js +0 -120
  34. package/dist/node_modules/@tinymce/tinymce-react/lib/es2015/main/ts/ScriptLoader2.js +0 -148
  35. package/dist/node_modules/@tinymce/tinymce-react/lib/es2015/main/ts/TinyMCE.js +0 -7
  36. package/dist/node_modules/@tinymce/tinymce-react/lib/es2015/main/ts/Utils.js +0 -103
  37. package/dist/node_modules/@tinymce/tinymce-react/lib/es2015/main/ts/components/Editor.js +0 -353
  38. package/dist/node_modules/@tinymce/tinymce-react/lib/es2015/main/ts/components/EditorPropTypes.js +0 -102
@@ -1,120 +0,0 @@
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
- };
@@ -1,148 +0,0 @@
1
- import { uuid } from "./Utils.js";
2
- var __assign = function() {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var injectScriptTag = function(doc, item, handler) {
14
- var _a, _b;
15
- var scriptTag = doc.createElement("script");
16
- scriptTag.referrerPolicy = "origin";
17
- scriptTag.type = "application/javascript";
18
- scriptTag.id = item.id;
19
- scriptTag.src = item.src;
20
- scriptTag.async = (_a = item.async) !== null && _a !== void 0 ? _a : false;
21
- scriptTag.defer = (_b = item.defer) !== null && _b !== void 0 ? _b : false;
22
- var loadHandler = function() {
23
- scriptTag.removeEventListener("load", loadHandler);
24
- scriptTag.removeEventListener("error", errorHandler);
25
- handler(item.src);
26
- };
27
- var errorHandler = function(err) {
28
- scriptTag.removeEventListener("load", loadHandler);
29
- scriptTag.removeEventListener("error", errorHandler);
30
- handler(item.src, err);
31
- };
32
- scriptTag.addEventListener("load", loadHandler);
33
- scriptTag.addEventListener("error", errorHandler);
34
- if (doc.head) {
35
- doc.head.appendChild(scriptTag);
36
- }
37
- };
38
- var createDocumentScriptLoader = function(doc) {
39
- var lookup = {};
40
- var scriptLoadOrErrorHandler = function(src, err) {
41
- var item = lookup[src];
42
- item.done = true;
43
- item.error = err;
44
- for (var _i = 0, _a = item.handlers; _i < _a.length; _i++) {
45
- var h = _a[_i];
46
- h(src, err);
47
- }
48
- item.handlers = [];
49
- };
50
- var loadScripts = function(items, success, failure) {
51
- var failureOrLog = function(err) {
52
- return failure !== void 0 ? failure(err) : console.error(err);
53
- };
54
- if (items.length === 0) {
55
- failureOrLog(new Error("At least one script must be provided"));
56
- return;
57
- }
58
- var successCount = 0;
59
- var failed = false;
60
- var loaded = function(_src, err) {
61
- if (failed) {
62
- return;
63
- }
64
- if (err) {
65
- failed = true;
66
- failureOrLog(err);
67
- } else if (++successCount === items.length) {
68
- success();
69
- }
70
- };
71
- for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
72
- var item = items_1[_i];
73
- var existing = lookup[item.src];
74
- if (existing) {
75
- if (existing.done) {
76
- loaded(item.src, existing.error);
77
- } else {
78
- existing.handlers.push(loaded);
79
- }
80
- } else {
81
- var id = uuid("tiny-");
82
- lookup[item.src] = {
83
- id,
84
- src: item.src,
85
- done: false,
86
- error: null,
87
- handlers: [loaded]
88
- };
89
- injectScriptTag(doc, __assign({ id }, item), scriptLoadOrErrorHandler);
90
- }
91
- }
92
- };
93
- var deleteScripts = function() {
94
- var _a;
95
- for (var _i = 0, _b = Object.values(lookup); _i < _b.length; _i++) {
96
- var item = _b[_i];
97
- var scriptTag = doc.getElementById(item.id);
98
- if (scriptTag != null && scriptTag.tagName === "SCRIPT") {
99
- (_a = scriptTag.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(scriptTag);
100
- }
101
- }
102
- lookup = {};
103
- };
104
- var getDocument = function() {
105
- return doc;
106
- };
107
- return {
108
- loadScripts,
109
- deleteScripts,
110
- getDocument
111
- };
112
- };
113
- var createScriptLoader = function() {
114
- var cache = [];
115
- var getDocumentScriptLoader = function(doc) {
116
- var loader = cache.find(function(l) {
117
- return l.getDocument() === doc;
118
- });
119
- if (loader === void 0) {
120
- loader = createDocumentScriptLoader(doc);
121
- cache.push(loader);
122
- }
123
- return loader;
124
- };
125
- var loadList = function(doc, items, delay, success, failure) {
126
- var doLoad = function() {
127
- return getDocumentScriptLoader(doc).loadScripts(items, success, failure);
128
- };
129
- if (delay > 0) {
130
- setTimeout(doLoad, delay);
131
- } else {
132
- doLoad();
133
- }
134
- };
135
- var reinitialize = function() {
136
- for (var loader = cache.pop(); loader != null; loader = cache.pop()) {
137
- loader.deleteScripts();
138
- }
139
- };
140
- return {
141
- loadList,
142
- reinitialize
143
- };
144
- };
145
- var ScriptLoader = createScriptLoader();
146
- export {
147
- ScriptLoader
148
- };
@@ -1,7 +0,0 @@
1
- var getTinymce = function(view) {
2
- var global = view;
3
- return global && global.tinymce ? global.tinymce : null;
4
- };
5
- export {
6
- getTinymce
7
- };
@@ -1,103 +0,0 @@
1
- import { eventPropTypes } from "./components/EditorPropTypes.js";
2
- var isFunction = function(x) {
3
- return typeof x === "function";
4
- };
5
- var isEventProp = function(name) {
6
- return name in eventPropTypes;
7
- };
8
- var eventAttrToEventName = function(attrName) {
9
- return attrName.substr(2);
10
- };
11
- var configHandlers2 = function(handlerLookup, on, off, adapter, prevProps, props, boundHandlers) {
12
- var prevEventKeys = Object.keys(prevProps).filter(isEventProp);
13
- var currEventKeys = Object.keys(props).filter(isEventProp);
14
- var removedKeys = prevEventKeys.filter(function(key) {
15
- return props[key] === void 0;
16
- });
17
- var addedKeys = currEventKeys.filter(function(key) {
18
- return prevProps[key] === void 0;
19
- });
20
- removedKeys.forEach(function(key) {
21
- var eventName = eventAttrToEventName(key);
22
- var wrappedHandler = boundHandlers[eventName];
23
- off(eventName, wrappedHandler);
24
- delete boundHandlers[eventName];
25
- });
26
- addedKeys.forEach(function(key) {
27
- var wrappedHandler = adapter(handlerLookup, key);
28
- var eventName = eventAttrToEventName(key);
29
- boundHandlers[eventName] = wrappedHandler;
30
- on(eventName, wrappedHandler);
31
- });
32
- };
33
- var configHandlers = function(editor, prevProps, props, boundHandlers, lookup) {
34
- return configHandlers2(
35
- lookup,
36
- editor.on.bind(editor),
37
- editor.off.bind(editor),
38
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
39
- function(handlerLookup, key) {
40
- return function(e) {
41
- var _a;
42
- return (_a = handlerLookup(key)) === null || _a === void 0 ? void 0 : _a(e, editor);
43
- };
44
- },
45
- prevProps,
46
- props,
47
- boundHandlers
48
- );
49
- };
50
- var unique = 0;
51
- var uuid = function(prefix) {
52
- var time = Date.now();
53
- var random = Math.floor(Math.random() * 1e9);
54
- unique++;
55
- return prefix + "_" + random + unique + String(time);
56
- };
57
- var isTextareaOrInput = function(element) {
58
- return element !== null && (element.tagName.toLowerCase() === "textarea" || element.tagName.toLowerCase() === "input");
59
- };
60
- var normalizePluginArray = function(plugins) {
61
- if (typeof plugins === "undefined" || plugins === "") {
62
- return [];
63
- }
64
- return Array.isArray(plugins) ? plugins : plugins.split(" ");
65
- };
66
- var mergePlugins = function(initPlugins, inputPlugins) {
67
- return normalizePluginArray(initPlugins).concat(normalizePluginArray(inputPlugins));
68
- };
69
- var isBeforeInputEventAvailable = function() {
70
- return window.InputEvent && typeof InputEvent.prototype.getTargetRanges === "function";
71
- };
72
- var isInDoc = function(elem) {
73
- if (!("isConnected" in Node.prototype)) {
74
- var current = elem;
75
- var parent_1 = elem.parentNode;
76
- while (parent_1 != null) {
77
- current = parent_1;
78
- parent_1 = current.parentNode;
79
- }
80
- return current === elem.ownerDocument;
81
- }
82
- return elem.isConnected;
83
- };
84
- var setMode = function(editor, mode) {
85
- if (editor !== void 0) {
86
- if (editor.mode != null && typeof editor.mode === "object" && typeof editor.mode.set === "function") {
87
- editor.mode.set(mode);
88
- } else {
89
- editor.setMode(mode);
90
- }
91
- }
92
- };
93
- export {
94
- configHandlers,
95
- configHandlers2,
96
- isBeforeInputEventAvailable,
97
- isFunction,
98
- isInDoc,
99
- isTextareaOrInput,
100
- mergePlugins,
101
- setMode,
102
- uuid
103
- };