suneditor-react-yoptatech 1.0.0
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 +924 -0
- package/dist/buttons/buttonList.d.ts +3 -0
- package/dist/buttons/buttonList.js +31 -0
- package/dist/components/SunEditor.d.ts +4 -0
- package/dist/components/SunEditor.js +180 -0
- package/dist/data/events.d.ts +2 -0
- package/dist/data/events.js +34 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +32 -0
- package/dist/lang/getLanguage.d.ts +3 -0
- package/dist/lang/getLanguage.js +13 -0
- package/dist/types/SunEditorReactProps.d.ts +69 -0
- package/dist/types/SunEditorReactProps.js +2 -0
- package/dist/types/lang.d.ts +3 -0
- package/dist/types/lang.js +2 -0
- package/dist/types/upload.d.ts +26 -0
- package/dist/types/upload.js +2 -0
- package/package.json +65 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatting = exports.complex = exports.basic = void 0;
|
|
4
|
+
exports.basic = [
|
|
5
|
+
["font", "fontSize"],
|
|
6
|
+
["fontColor"],
|
|
7
|
+
["horizontalRule"],
|
|
8
|
+
["link", "image"],
|
|
9
|
+
];
|
|
10
|
+
exports.complex = [
|
|
11
|
+
["undo", "redo"],
|
|
12
|
+
["font", "fontSize", "formatBlock"],
|
|
13
|
+
["bold", "underline", "italic", "strike", "subscript", "superscript"],
|
|
14
|
+
["removeFormat"],
|
|
15
|
+
"/",
|
|
16
|
+
["fontColor", "hiliteColor"],
|
|
17
|
+
["outdent", "indent"],
|
|
18
|
+
["align", "horizontalRule", "list", "table"],
|
|
19
|
+
["link", "image", "video"],
|
|
20
|
+
["fullScreen", "showBlocks", "codeView"],
|
|
21
|
+
["preview", "print"],
|
|
22
|
+
["save", "template"],
|
|
23
|
+
];
|
|
24
|
+
exports.formatting = [
|
|
25
|
+
["undo", "redo"],
|
|
26
|
+
["bold", "underline", "italic", "strike", "subscript", "superscript"],
|
|
27
|
+
["removeFormat"],
|
|
28
|
+
["outdent", "indent"],
|
|
29
|
+
["fullScreen", "showBlocks", "codeView"],
|
|
30
|
+
["preview", "print"],
|
|
31
|
+
];
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
var react_1 = __importStar(require("react"));
|
|
41
|
+
var plugins_1 = __importDefault(require("suneditor-yoptatech/src/plugins"));
|
|
42
|
+
var suneditor_yoptatech_1 = __importDefault(require("suneditor-yoptatech"));
|
|
43
|
+
var getLanguage_1 = __importDefault(require("../lang/getLanguage"));
|
|
44
|
+
var events_1 = require("../data/events");
|
|
45
|
+
var SunEditor = function (props) {
|
|
46
|
+
var name = props.name, lang = props.lang, _a = props.setOptions, setOptions = _a === void 0 ? {} : _a, placeholder = props.placeholder, _b = props.width, width = _b === void 0 ? "100%" : _b, height = props.height, defaultValue = props.defaultValue, setContents = props.setContents, setDefaultStyle = props.setDefaultStyle, getSunEditorInstance = props.getSunEditorInstance, appendContents = props.appendContents, _c = props.setAllPlugins, setAllPlugins = _c === void 0 ? true : _c, _d = props.disable, disable = _d === void 0 ? false : _d, _e = props.readOnly, readOnly = _e === void 0 ? false : _e, _f = props.hide, hide = _f === void 0 ? false : _f, _g = props.hideToolbar, hideToolbar = _g === void 0 ? false : _g, _h = props.disableToolbar, disableToolbar = _h === void 0 ? false : _h, onChange = props.onChange, autoFocus = props.autoFocus, onBlur = props.onBlur, onLoad = props.onLoad;
|
|
47
|
+
var txtArea = (0, react_1.useRef)(null);
|
|
48
|
+
var editor = (0, react_1.useRef)(null);
|
|
49
|
+
var initialEffect = (0, react_1.useRef)(true);
|
|
50
|
+
(0, react_1.useEffect)(function () {
|
|
51
|
+
var _a;
|
|
52
|
+
var options = __assign(__assign({}, setOptions), { lang: lang ? (0, getLanguage_1.default)(lang) : setOptions.lang, width: width !== null && width !== void 0 ? width : setOptions.width, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : setOptions.placeholder, plugins: (_a = setOptions.plugins) !== null && _a !== void 0 ? _a : (setAllPlugins ? plugins_1.default : undefined), height: height !== null && height !== void 0 ? height : setOptions.height, value: defaultValue !== null && defaultValue !== void 0 ? defaultValue : setOptions.value, defaultStyle: setDefaultStyle !== null && setDefaultStyle !== void 0 ? setDefaultStyle : setOptions.defaultStyle });
|
|
53
|
+
if (name && options.value)
|
|
54
|
+
txtArea.current.value = options.value;
|
|
55
|
+
editor.current = suneditor_yoptatech_1.default.create(txtArea.current, options);
|
|
56
|
+
if (getSunEditorInstance)
|
|
57
|
+
getSunEditorInstance(editor.current);
|
|
58
|
+
editor.current.onload = function (_, reload) {
|
|
59
|
+
if (reload)
|
|
60
|
+
return onLoad === null || onLoad === void 0 ? void 0 : onLoad(reload);
|
|
61
|
+
if (setContents) {
|
|
62
|
+
editor.current.setContents(setContents);
|
|
63
|
+
editor.current.core.focusEdge(null);
|
|
64
|
+
}
|
|
65
|
+
if (appendContents)
|
|
66
|
+
editor.current.appendContents(appendContents);
|
|
67
|
+
if (editor.current.util.isIE)
|
|
68
|
+
editor.current.core._createDefaultRange();
|
|
69
|
+
if (disable)
|
|
70
|
+
editor.current.disable();
|
|
71
|
+
if (readOnly)
|
|
72
|
+
editor.current.readOnly(true);
|
|
73
|
+
if (hide)
|
|
74
|
+
editor.current.hide();
|
|
75
|
+
if (hideToolbar)
|
|
76
|
+
editor.current.toolbar.hide();
|
|
77
|
+
if (disableToolbar)
|
|
78
|
+
editor.current.toolbar.disable();
|
|
79
|
+
if (autoFocus === false)
|
|
80
|
+
editor.current.core.context.element.wysiwyg.blur();
|
|
81
|
+
else if (autoFocus)
|
|
82
|
+
editor.current.core.context.element.wysiwyg.focus();
|
|
83
|
+
return onLoad === null || onLoad === void 0 ? void 0 : onLoad(reload);
|
|
84
|
+
};
|
|
85
|
+
editor.current.onChange = function (content) {
|
|
86
|
+
if (name && txtArea.current)
|
|
87
|
+
txtArea.current.value = content;
|
|
88
|
+
if (onChange)
|
|
89
|
+
onChange(content);
|
|
90
|
+
};
|
|
91
|
+
if (onBlur) {
|
|
92
|
+
editor.current.onBlur = function (e) {
|
|
93
|
+
return onBlur(e, editor.current.getContents(true));
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
events_1.uploadBeforeEvents.forEach(function (event) {
|
|
97
|
+
var value = props[event];
|
|
98
|
+
if (editor.current && value)
|
|
99
|
+
editor.current[event] = function (files, info, _, uploadHandler) { return value(files, info, uploadHandler); };
|
|
100
|
+
});
|
|
101
|
+
events_1.events.forEach(function (event) {
|
|
102
|
+
var value = props[event];
|
|
103
|
+
if (value && editor.current) {
|
|
104
|
+
editor.current[event] = value;
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
return function () {
|
|
108
|
+
if (editor.current)
|
|
109
|
+
editor.current.destroy();
|
|
110
|
+
editor.current = null;
|
|
111
|
+
};
|
|
112
|
+
}, []);
|
|
113
|
+
(0, react_1.useEffect)(function () {
|
|
114
|
+
var _a;
|
|
115
|
+
if (initialEffect.current)
|
|
116
|
+
return;
|
|
117
|
+
(_a = editor.current) === null || _a === void 0 ? void 0 : _a.setOptions({
|
|
118
|
+
lang: (0, getLanguage_1.default)(lang),
|
|
119
|
+
});
|
|
120
|
+
}, [lang]);
|
|
121
|
+
(0, react_1.useEffect)(function () {
|
|
122
|
+
var _a;
|
|
123
|
+
if (initialEffect.current)
|
|
124
|
+
return;
|
|
125
|
+
(_a = editor.current) === null || _a === void 0 ? void 0 : _a.setOptions({
|
|
126
|
+
placeholder: placeholder,
|
|
127
|
+
height: height,
|
|
128
|
+
width: width,
|
|
129
|
+
});
|
|
130
|
+
}, [placeholder, height, width]);
|
|
131
|
+
(0, react_1.useEffect)(function () {
|
|
132
|
+
var _a;
|
|
133
|
+
if (setDefaultStyle && !initialEffect.current)
|
|
134
|
+
(_a = editor.current) === null || _a === void 0 ? void 0 : _a.setDefaultStyle(setDefaultStyle);
|
|
135
|
+
}, [setDefaultStyle]);
|
|
136
|
+
(0, react_1.useEffect)(function () {
|
|
137
|
+
var _a, _b;
|
|
138
|
+
if (!initialEffect.current &&
|
|
139
|
+
setContents !== undefined &&
|
|
140
|
+
!((_a = editor.current) === null || _a === void 0 ? void 0 : _a.core.hasFocus)) {
|
|
141
|
+
(_b = editor.current) === null || _b === void 0 ? void 0 : _b.setContents(setContents);
|
|
142
|
+
}
|
|
143
|
+
}, [setContents]);
|
|
144
|
+
(0, react_1.useEffect)(function () {
|
|
145
|
+
var _a, _b, _c;
|
|
146
|
+
if (!initialEffect.current &&
|
|
147
|
+
appendContents !== undefined &&
|
|
148
|
+
!((_a = editor.current) === null || _a === void 0 ? void 0 : _a.core.hasFocus)) {
|
|
149
|
+
(_b = editor.current) === null || _b === void 0 ? void 0 : _b.appendContents(appendContents);
|
|
150
|
+
(_c = editor.current) === null || _c === void 0 ? void 0 : _c.core.focusEdge(null);
|
|
151
|
+
}
|
|
152
|
+
}, [appendContents]);
|
|
153
|
+
(0, react_1.useEffect)(function () {
|
|
154
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
155
|
+
if (initialEffect.current)
|
|
156
|
+
return;
|
|
157
|
+
(_a = editor.current) === null || _a === void 0 ? void 0 : _a.readOnly(readOnly);
|
|
158
|
+
if (hideToolbar)
|
|
159
|
+
(_b = editor.current) === null || _b === void 0 ? void 0 : _b.toolbar.hide();
|
|
160
|
+
else
|
|
161
|
+
(_c = editor.current) === null || _c === void 0 ? void 0 : _c.toolbar.show();
|
|
162
|
+
if (disableToolbar)
|
|
163
|
+
(_d = editor.current) === null || _d === void 0 ? void 0 : _d.toolbar.disable();
|
|
164
|
+
else
|
|
165
|
+
(_e = editor.current) === null || _e === void 0 ? void 0 : _e.toolbar.enable();
|
|
166
|
+
if (disable)
|
|
167
|
+
(_f = editor.current) === null || _f === void 0 ? void 0 : _f.disable();
|
|
168
|
+
else
|
|
169
|
+
(_g = editor.current) === null || _g === void 0 ? void 0 : _g.enable();
|
|
170
|
+
if (hide)
|
|
171
|
+
(_h = editor.current) === null || _h === void 0 ? void 0 : _h.hide();
|
|
172
|
+
else
|
|
173
|
+
(_j = editor.current) === null || _j === void 0 ? void 0 : _j.show();
|
|
174
|
+
}, [disable, hideToolbar, disableToolbar, hide, readOnly]);
|
|
175
|
+
(0, react_1.useEffect)(function () {
|
|
176
|
+
initialEffect.current = false;
|
|
177
|
+
}, []);
|
|
178
|
+
return (react_1.default.createElement("textarea", __assign({ style: { visibility: "hidden" }, ref: txtArea }, { name: name })));
|
|
179
|
+
};
|
|
180
|
+
exports.default = SunEditor;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const events: readonly ["onMouseDown", "onScroll", "onInput", "onClick", "onKeyUp", "onKeyDown", "onFocus", "onImageUpload", "onAudioUpload", "onVideoUpload", "onImageUploadError", "onVideoUploadError", "onAudioUploadError", "onSave", "onSetToolbarButtons", "imageUploadHandler", "toggleCodeView", "toggleFullScreen", "showInline", "showController", "onCopy", "onCut", "onDrop", "onPaste"];
|
|
2
|
+
export declare const uploadBeforeEvents: readonly ["onImageUploadBefore", "onVideoUploadBefore", "onAudioUploadBefore"];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.uploadBeforeEvents = exports.events = void 0;
|
|
4
|
+
exports.events = [
|
|
5
|
+
"onMouseDown",
|
|
6
|
+
"onScroll",
|
|
7
|
+
"onInput",
|
|
8
|
+
"onClick",
|
|
9
|
+
"onKeyUp",
|
|
10
|
+
"onKeyDown",
|
|
11
|
+
"onFocus",
|
|
12
|
+
"onImageUpload",
|
|
13
|
+
"onAudioUpload",
|
|
14
|
+
"onVideoUpload",
|
|
15
|
+
"onImageUploadError",
|
|
16
|
+
"onVideoUploadError",
|
|
17
|
+
"onAudioUploadError",
|
|
18
|
+
"onSave",
|
|
19
|
+
"onSetToolbarButtons",
|
|
20
|
+
"imageUploadHandler",
|
|
21
|
+
"toggleCodeView",
|
|
22
|
+
"toggleFullScreen",
|
|
23
|
+
"showInline",
|
|
24
|
+
"showController",
|
|
25
|
+
"onCopy",
|
|
26
|
+
"onCut",
|
|
27
|
+
"onDrop",
|
|
28
|
+
"onPaste",
|
|
29
|
+
];
|
|
30
|
+
exports.uploadBeforeEvents = [
|
|
31
|
+
"onImageUploadBefore",
|
|
32
|
+
"onVideoUploadBefore",
|
|
33
|
+
"onAudioUploadBefore",
|
|
34
|
+
];
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.buttonList = void 0;
|
|
30
|
+
var SunEditor_1 = __importDefault(require("./components/SunEditor"));
|
|
31
|
+
exports.buttonList = __importStar(require("./buttons/buttonList"));
|
|
32
|
+
exports.default = SunEditor_1.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var getLanguage = function (lang) {
|
|
4
|
+
switch (typeof lang) {
|
|
5
|
+
case "object":
|
|
6
|
+
return lang;
|
|
7
|
+
case "string":
|
|
8
|
+
return require("suneditor-yoptatech/src/lang/".concat(lang, ".js"));
|
|
9
|
+
default:
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
exports.default = getLanguage;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import SunEditorCore from "suneditor-yoptatech/src/lib/core";
|
|
2
|
+
import { SunEditorOptions } from "suneditor-yoptatech/src/options";
|
|
3
|
+
import lang from "./lang";
|
|
4
|
+
import { UploadBeforeHandler, UploadBeforeReturn, UploadInfo } from "./upload";
|
|
5
|
+
interface SunEditorEventProps {
|
|
6
|
+
onChange?: (content: string) => void;
|
|
7
|
+
onInput?: (event: InputEvent) => void;
|
|
8
|
+
onScroll?: (event: UIEvent) => void;
|
|
9
|
+
onCopy?: (event: ClipboardEvent, clipboardData: ClipboardEvent["clipboardData"]) => boolean;
|
|
10
|
+
onCut?: (event: ClipboardEvent, clipboardData: ClipboardEvent["clipboardData"]) => boolean;
|
|
11
|
+
onClick?: (event: MouseEvent) => void;
|
|
12
|
+
onMouseDown?: (event: MouseEvent) => void;
|
|
13
|
+
onKeyUp?: (event: KeyboardEvent) => void;
|
|
14
|
+
onKeyDown?: (event: KeyboardEvent) => void;
|
|
15
|
+
onFocus?: (event: FocusEvent) => void;
|
|
16
|
+
onBlur?: (event: FocusEvent, editorContents: string) => void;
|
|
17
|
+
onSave?: (contents: string) => void;
|
|
18
|
+
onSetToolbarButtons?: (buttonList: Array<any>) => void;
|
|
19
|
+
onLoad?: (reload: boolean) => void;
|
|
20
|
+
onDrop?: (event: DragEvent, cleanData: string, maxCharCount: boolean) => boolean | Array<any> | void;
|
|
21
|
+
onPaste?: (event: ClipboardEvent, cleanData: string, maxCharCount: boolean) => void;
|
|
22
|
+
onImageUpload?: (targetImgElement: HTMLImageElement, index: number, state: "create" | "update" | "delete", imageInfo: UploadInfo<HTMLImageElement>, remainingFilesCount: number) => void;
|
|
23
|
+
onVideoUpload?: (targetElement: HTMLVideoElement, index: number, state: "create" | "update" | "delete", videoInfo: UploadInfo<HTMLVideoElement>, remainingFilesCount: number) => void;
|
|
24
|
+
onAudioUpload?: (targetElement: HTMLAudioElement, index: number, state: "create" | "update" | "delete", audioInfo: UploadInfo<HTMLAudioElement>, remainingFilesCount: number) => void;
|
|
25
|
+
onImageUploadBefore?: (files: Array<File>, info: object, uploadHandler: UploadBeforeHandler) => UploadBeforeReturn;
|
|
26
|
+
onVideoUploadBefore?: (files: Array<File>, info: object, uploadHandler: UploadBeforeHandler) => UploadBeforeReturn;
|
|
27
|
+
onAudioUploadBefore?: (files: Array<File>, info: object, uploadHandler: UploadBeforeHandler) => UploadBeforeReturn;
|
|
28
|
+
onImageUploadError?: (errorMessage: string, result: any) => void;
|
|
29
|
+
onVideoUploadError?: (errorMessage: string, result: any) => void;
|
|
30
|
+
onAudioUploadError?: (errorMessage: string, result: any) => void;
|
|
31
|
+
toggleCodeView?: (isCodeView: boolean) => void;
|
|
32
|
+
toggleFullScreen?: (isFullScreen: boolean) => void;
|
|
33
|
+
showInline?: (toolbar: Element, context: any) => void;
|
|
34
|
+
showController?: (name: string, controllers: Array<any>) => void;
|
|
35
|
+
imageUploadHandler?: (xmlHttpRequest: XMLHttpRequest, info: {
|
|
36
|
+
isUpdate: boolean;
|
|
37
|
+
linkValue: any;
|
|
38
|
+
element: Element;
|
|
39
|
+
align: any;
|
|
40
|
+
linkNewWindow: any;
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
}) => void;
|
|
43
|
+
onResizeEditor?: (height: number, prevHeight: number) => any;
|
|
44
|
+
}
|
|
45
|
+
interface SunEditorDefaultStateProps {
|
|
46
|
+
defaultValue?: string;
|
|
47
|
+
autoFocus?: boolean;
|
|
48
|
+
setAllPlugins?: boolean;
|
|
49
|
+
getSunEditorInstance?: (sunEditor: SunEditorCore) => void;
|
|
50
|
+
}
|
|
51
|
+
interface SunEditorReactiveProps {
|
|
52
|
+
setDefaultStyle?: string;
|
|
53
|
+
placeholder?: string;
|
|
54
|
+
lang?: lang;
|
|
55
|
+
width?: string;
|
|
56
|
+
height?: string;
|
|
57
|
+
setContents?: string;
|
|
58
|
+
name?: string;
|
|
59
|
+
appendContents?: string;
|
|
60
|
+
hideToolbar?: boolean;
|
|
61
|
+
disableToolbar?: boolean;
|
|
62
|
+
disable?: boolean;
|
|
63
|
+
readOnly?: boolean;
|
|
64
|
+
hide?: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface SunEditorReactProps extends SunEditorEventProps, SunEditorDefaultStateProps, SunEditorReactiveProps {
|
|
67
|
+
setOptions?: SunEditorOptions;
|
|
68
|
+
}
|
|
69
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface UploadInfo<E> {
|
|
2
|
+
index: number;
|
|
3
|
+
name: string;
|
|
4
|
+
size: number;
|
|
5
|
+
select: (...args: any) => any;
|
|
6
|
+
delete: (...args: any) => any;
|
|
7
|
+
element: E;
|
|
8
|
+
src: string;
|
|
9
|
+
}
|
|
10
|
+
type FileInfo = {
|
|
11
|
+
url: string;
|
|
12
|
+
name: string;
|
|
13
|
+
size: number;
|
|
14
|
+
};
|
|
15
|
+
type UploadBeforeResponse = {
|
|
16
|
+
errorMessage?: string;
|
|
17
|
+
result: FileInfo[];
|
|
18
|
+
};
|
|
19
|
+
export type UploadBeforeHandler = {
|
|
20
|
+
(files: File[]): void;
|
|
21
|
+
(errorMessage: string): void;
|
|
22
|
+
(uploadResponse: UploadBeforeResponse): void;
|
|
23
|
+
(): void;
|
|
24
|
+
};
|
|
25
|
+
export type UploadBeforeReturn = boolean | FileList | undefined;
|
|
26
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "suneditor-react-yoptatech",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A React Component for Suneditor",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/yoptacademytech/suneditor-react-yopta"
|
|
8
|
+
},
|
|
9
|
+
"main": "dist/index.js",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "rm -rf ./dist && tsc",
|
|
12
|
+
"lint": "eslint src/.",
|
|
13
|
+
"test": "jest --verbose",
|
|
14
|
+
"test-cov": "jest --verbose --coverage",
|
|
15
|
+
"prepublishOnly": "yarn build",
|
|
16
|
+
"copy": "rm -rf ./build && tsc --outDir build && rm -rf ../suneditor-react-dom/src/build && cp -r build ../suneditor-react-dom/src && rm -rf ../suneditor-react-next/build && cp -r build ../suneditor-react-next"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"editor",
|
|
20
|
+
"wysiwyg",
|
|
21
|
+
"suneditor",
|
|
22
|
+
"text-editor",
|
|
23
|
+
"word",
|
|
24
|
+
"react"
|
|
25
|
+
],
|
|
26
|
+
"author": "Yoptacademy Tech",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@testing-library/jest-dom": "^5.16.5",
|
|
30
|
+
"@testing-library/react": "^14.0.0",
|
|
31
|
+
"@types/jest": "^29.4.0",
|
|
32
|
+
"@types/node": "^18.15.11",
|
|
33
|
+
"@types/react": "^18.0.27",
|
|
34
|
+
"@typescript-eslint/eslint-plugin": "^5.48.2",
|
|
35
|
+
"@typescript-eslint/parser": "^5.48.2",
|
|
36
|
+
"eslint": "^8.32.0",
|
|
37
|
+
"eslint-config-airbnb": "^19.0.4",
|
|
38
|
+
"eslint-config-airbnb-typescript": "^17.0.0",
|
|
39
|
+
"eslint-config-prettier": "^8.6.0",
|
|
40
|
+
"eslint-plugin-import": "^2.27.5",
|
|
41
|
+
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
42
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
43
|
+
"eslint-plugin-react": "^7.32.1",
|
|
44
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
45
|
+
"jest": "^29.4.1",
|
|
46
|
+
"jest-environment-jsdom": "^29.4.1",
|
|
47
|
+
"prettier": "^2.8.3",
|
|
48
|
+
"react": "^18.2.0",
|
|
49
|
+
"react-dom": "^18.2.0",
|
|
50
|
+
"suneditor-yoptatech": "1.0.0",
|
|
51
|
+
"ts-jest": "^29.0.5",
|
|
52
|
+
"typescript": "^5.0.4"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"react": ">= 16.8.0",
|
|
56
|
+
"react-dom": ">= 16.8.0",
|
|
57
|
+
"suneditor-yoptatech": "1.0.0"
|
|
58
|
+
},
|
|
59
|
+
"browserslist": [
|
|
60
|
+
">0.2%",
|
|
61
|
+
"not ie <= 11",
|
|
62
|
+
"not op_mini all"
|
|
63
|
+
],
|
|
64
|
+
"dependencies": {}
|
|
65
|
+
}
|