@lotte-innovate/ui-component-test 0.2.49 → 0.2.50
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/lib/components/Editor/index.js +13 -79
- package/dist/lib/components/Editor/index.mjs +1 -1
- package/dist/lib/tsconfig.tsbuildinfo +1 -1
- package/dist/lib/utils/useLoadTinyMCE.d.ts +1 -0
- package/dist/lib/utils/useLoadTinyMCE.js +139 -0
- package/dist/lib/utils/useLoadTinyMCE.mjs +2 -0
- package/dist/lib/utils/useLoadTinyMCE.mjs.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -10,42 +10,6 @@ var __assign = (this && this.__assign) || function () {
|
|
10
10
|
};
|
11
11
|
return __assign.apply(this, arguments);
|
12
12
|
};
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
20
|
-
});
|
21
|
-
};
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
24
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
26
|
-
function step(op) {
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
31
|
-
switch (op[0]) {
|
32
|
-
case 0: case 1: t = op; break;
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
36
|
-
default:
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
41
|
-
if (t[2]) _.ops.pop();
|
42
|
-
_.trys.pop(); continue;
|
43
|
-
}
|
44
|
-
op = body.call(thisArg, _);
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
47
|
-
}
|
48
|
-
};
|
49
13
|
var __rest = (this && this.__rest) || function (s, e) {
|
50
14
|
var t = {};
|
51
15
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
@@ -61,6 +25,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
61
25
|
import { forwardRef, useEffect, useState, } from 'react';
|
62
26
|
import { Editor as EditorUI } from '@tinymce/tinymce-react';
|
63
27
|
import { cva } from 'class-variance-authority';
|
28
|
+
import { loadTinyMCE } from '../../../lib/utils/useLoadTinyMCE';
|
64
29
|
import { scalingVariants } from '../../../lib/constants';
|
65
30
|
import { cn } from '../../../lib/utils/utils';
|
66
31
|
import { marked } from 'marked';
|
@@ -83,46 +48,6 @@ export var Editor = forwardRef(function (_a, ref) {
|
|
83
48
|
var _b = useState(false), isClient = _b[0], setIsClient = _b[1];
|
84
49
|
useEffect(function () {
|
85
50
|
if (typeof window !== 'undefined') {
|
86
|
-
var loadTinyMCE = function () { return __awaiter(void 0, void 0, void 0, function () {
|
87
|
-
return __generator(this, function (_a) {
|
88
|
-
switch (_a.label) {
|
89
|
-
case 0: return [4 /*yield*/, import('tinymce/tinymce.js')];
|
90
|
-
case 1:
|
91
|
-
_a.sent();
|
92
|
-
return [4 /*yield*/, import('tinymce/themes/silver/theme.js')];
|
93
|
-
case 2:
|
94
|
-
_a.sent();
|
95
|
-
return [4 /*yield*/, import('tinymce/models/dom/model.js')];
|
96
|
-
case 3:
|
97
|
-
_a.sent();
|
98
|
-
return [4 /*yield*/, import('tinymce/icons/default/icons.js')];
|
99
|
-
case 4:
|
100
|
-
_a.sent();
|
101
|
-
return [4 /*yield*/, import('tinymce/plugins/advlist/plugin.js')];
|
102
|
-
case 5:
|
103
|
-
_a.sent();
|
104
|
-
return [4 /*yield*/, import('tinymce/plugins/code/plugin.js')];
|
105
|
-
case 6:
|
106
|
-
_a.sent();
|
107
|
-
return [4 /*yield*/, import('tinymce/plugins/codesample/plugin.js')];
|
108
|
-
case 7:
|
109
|
-
_a.sent();
|
110
|
-
return [4 /*yield*/, import('tinymce/plugins/link/plugin.js')];
|
111
|
-
case 8:
|
112
|
-
_a.sent();
|
113
|
-
return [4 /*yield*/, import('tinymce/plugins/lists/plugin.js')];
|
114
|
-
case 9:
|
115
|
-
_a.sent();
|
116
|
-
return [4 /*yield*/, import('tinymce/plugins/table/plugin.js')];
|
117
|
-
case 10:
|
118
|
-
_a.sent();
|
119
|
-
return [4 /*yield*/, import('tinymce/plugins/image/plugin.js')];
|
120
|
-
case 11:
|
121
|
-
_a.sent();
|
122
|
-
return [2 /*return*/];
|
123
|
-
}
|
124
|
-
});
|
125
|
-
}); };
|
126
51
|
loadTinyMCE().then(function () {
|
127
52
|
setIsClient(true);
|
128
53
|
});
|
@@ -135,9 +60,18 @@ export var Editor = forwardRef(function (_a, ref) {
|
|
135
60
|
base_url: 'tinymce',
|
136
61
|
width: '100%',
|
137
62
|
height: '100%',
|
138
|
-
|
139
|
-
|
140
|
-
|
63
|
+
promotion: false,
|
64
|
+
plugins: 'preview importcss searchreplace autolink autosave save directionality code visualblocks visualchars fullscreen image link media template codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists wordcount charmap quickbars accordion',
|
65
|
+
menubar: 'file edit view insert format tools table',
|
66
|
+
toolbar: 'undo redo | accordion accordionremove | blocks fontfamily fontsize | bold italic underline strikethrough | align numlist bullist | link image | table media | lineheight outdent indent| forecolor backcolor removeformat | charmap | code fullscreen preview | save print | pagebreak anchor codesample | ltr rtl',
|
67
|
+
autosave_ask_before_unload: true,
|
68
|
+
autosave_interval: '30s',
|
69
|
+
autosave_restore_when_empty: false,
|
70
|
+
autosave_retention: '2m',
|
71
|
+
image_advtab: true,
|
72
|
+
image_caption: true,
|
73
|
+
quickbars_selection_toolbar: 'bold italic | quicklink h2 h3 blockquote quickimage quicktable',
|
74
|
+
toolbar_mode: 'sliding',
|
141
75
|
content_style: 'body { font-family:Noto Sans KR, sans-serif, Nunito Sans, Helvetica Neue, Helvetica }',
|
142
76
|
setup: function (editor) {
|
143
77
|
editor.ui.registry.addButton('inlinecode', {
|
@@ -1,3 +1,3 @@
|
|
1
1
|
"use client";
|
2
|
-
import{jsx as
|
2
|
+
import{jsx as e}from"react/jsx-runtime";import{forwardRef as t,useState as o,useEffect as i}from"react";import{Editor as a}from"@tinymce/tinymce-react";import{cva as r}from"class-variance-authority";import{loadTinyMCE as n}from"../../utils/useLoadTinyMCE.mjs";import{scalingVariants as l}from"../../constants.mjs";import{cn as s}from"../../utils/utils.mjs";import{marked as c}from"marked";var m=function(){return m=Object.assign||function(e){for(var t,o=1,i=arguments.length;o<i;o++)for(var a in t=arguments[o])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},m.apply(this,arguments)},u=function(e,t){var o={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(o[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(o[i[a]]=e[i[a]])}return o},d=r("",{variants:{scaling:m({},l),size:{small:"w-[500px] h-[350px]",medium:"w-[550px] h-[400px]",large:"w-[600px] h-[450px]"}},defaultVariants:{scaling:"100%",size:"medium"}}),p=t((function(t,r){var l=t.className,p=t.size,f=t.scaling,b=u(t,["className","size","scaling"]),g=o(!1),v=g[0],h=g[1];return i((function(){"undefined"!=typeof window&&n().then((function(){h(!0)}))}),[]),v?e("div",{className:s(d({size:p,scaling:f}),l),ref:r,children:e(a,m({init:{base_url:"tinymce",width:"100%",height:"100%",promotion:!1,plugins:"preview importcss searchreplace autolink autosave save directionality code visualblocks visualchars fullscreen image link media template codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists wordcount charmap quickbars accordion",menubar:"file edit view insert format tools table",toolbar:"undo redo | accordion accordionremove | blocks fontfamily fontsize | bold italic underline strikethrough | align numlist bullist | link image | table media | lineheight outdent indent| forecolor backcolor removeformat | charmap | code fullscreen preview | save print | pagebreak anchor codesample | ltr rtl",autosave_ask_before_unload:!0,autosave_interval:"30s",autosave_restore_when_empty:!1,autosave_retention:"2m",image_advtab:!0,image_caption:!0,quickbars_selection_toolbar:"bold italic | quicklink h2 h3 blockquote quickimage quicktable",toolbar_mode:"sliding",content_style:"body { font-family:Noto Sans KR, sans-serif, Nunito Sans, Helvetica Neue, Helvetica }",setup:function(e){e.ui.registry.addButton("inlinecode",{icon:"sourcecode",tooltip:"Inline code",onAction:function(){e.formatter.toggle("code")}}),e.on("init",(function(){e.formatter.register("code",{inline:"code",remove:"all"})})),e.ui.registry.addButton("markdown",{text:"Markdown",onAction:function(){var t=e.getContent({format:"text"}),o=c(t);e.setContent(o)}})}}},b))}):null}));p.displayName="Editor";export{p as Editor,p as default};
|
3
3
|
//# sourceMappingURL=index.mjs.map
|