@lotte-innovate/ui-component-test 0.2.43 → 0.2.44
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,17 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { IAllProps } from '@tinymce/tinymce-react';
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
4
|
-
import 'tinymce/tinymce.js';
|
5
|
-
import 'tinymce/themes/silver/theme.js';
|
6
|
-
import 'tinymce/models/dom/model.js';
|
7
|
-
import 'tinymce/icons/default/icons.js';
|
8
|
-
import 'tinymce/plugins/advlist/plugin.js';
|
9
|
-
import 'tinymce/plugins/code/plugin.js';
|
10
|
-
import 'tinymce/plugins/codesample/plugin.js';
|
11
|
-
import 'tinymce/plugins/link/plugin.js';
|
12
|
-
import 'tinymce/plugins/lists/plugin.js';
|
13
|
-
import 'tinymce/plugins/table/plugin.js';
|
14
|
-
import 'tinymce/plugins/image/plugin.js';
|
15
4
|
export interface EditorProps extends VariantProps<typeof editorVariants> {
|
16
5
|
}
|
17
6
|
declare const editorVariants: (props?: ({
|
@@ -22,23 +22,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
22
22
|
return t;
|
23
23
|
};
|
24
24
|
import { jsx as _jsx } from "react/jsx-runtime";
|
25
|
-
import { forwardRef } from 'react';
|
25
|
+
import { forwardRef, useEffect, useState, } from 'react';
|
26
26
|
import { Editor as EditorUI } from '@tinymce/tinymce-react';
|
27
27
|
import { cva } from 'class-variance-authority';
|
28
28
|
import { scalingVariants } from '../../../lib/constants';
|
29
29
|
import { cn } from '../../../lib/utils/utils';
|
30
30
|
import { marked } from 'marked';
|
31
|
-
import 'tinymce/tinymce.js';
|
32
|
-
import 'tinymce/themes/silver/theme.js';
|
33
|
-
import 'tinymce/models/dom/model.js';
|
34
|
-
import 'tinymce/icons/default/icons.js';
|
35
|
-
import 'tinymce/plugins/advlist/plugin.js';
|
36
|
-
import 'tinymce/plugins/code/plugin.js';
|
37
|
-
import 'tinymce/plugins/codesample/plugin.js';
|
38
|
-
import 'tinymce/plugins/link/plugin.js';
|
39
|
-
import 'tinymce/plugins/lists/plugin.js';
|
40
|
-
import 'tinymce/plugins/table/plugin.js';
|
41
|
-
import 'tinymce/plugins/image/plugin.js';
|
42
31
|
var editorVariants = cva('', {
|
43
32
|
variants: {
|
44
33
|
scaling: __assign({}, scalingVariants),
|
@@ -55,6 +44,26 @@ var editorVariants = cva('', {
|
|
55
44
|
});
|
56
45
|
export var Editor = forwardRef(function (_a, ref) {
|
57
46
|
var className = _a.className, size = _a.size, scaling = _a.scaling, props = __rest(_a, ["className", "size", "scaling"]);
|
47
|
+
var _b = useState(false), isClient = _b[0], setIsClient = _b[1];
|
48
|
+
useEffect(function () {
|
49
|
+
if (typeof window !== 'undefined') {
|
50
|
+
require('tinymce/tinymce.js');
|
51
|
+
require('tinymce/themes/silver/theme.js');
|
52
|
+
require('tinymce/models/dom/model.js');
|
53
|
+
require('tinymce/icons/default/icons.js');
|
54
|
+
require('tinymce/plugins/advlist/plugin.js');
|
55
|
+
require('tinymce/plugins/code/plugin.js');
|
56
|
+
require('tinymce/plugins/codesample/plugin.js');
|
57
|
+
require('tinymce/plugins/link/plugin.js');
|
58
|
+
require('tinymce/plugins/lists/plugin.js');
|
59
|
+
require('tinymce/plugins/table/plugin.js');
|
60
|
+
require('tinymce/plugins/image/plugin.js');
|
61
|
+
setIsClient(true);
|
62
|
+
}
|
63
|
+
}, []);
|
64
|
+
if (!isClient) {
|
65
|
+
return null;
|
66
|
+
}
|
58
67
|
return (_jsx("div", { className: cn(editorVariants({ size: size, scaling: scaling }), className), ref: ref, children: _jsx(EditorUI, __assign({ init: {
|
59
68
|
base_url: 'tinymce',
|
60
69
|
width: '100%',
|
@@ -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 i,useEffect as n}from"react";import{Editor as r}from"@tinymce/tinymce-react";import{cva as o}from"class-variance-authority";import{scalingVariants as s}from"../../constants.mjs";import{cn as l}from"../../utils/utils.mjs";import{marked as a}from"marked";var c=function(){return c=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},c.apply(this,arguments)},u=function(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(i[n[r]]=e[n[r]])}return i},m=o("",{variants:{scaling:c({},s),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,o){var s=t.className,p=t.size,d=t.scaling,f=u(t,["className","size","scaling"]),g=i(!1),y=g[0],b=g[1];return n((function(){"undefined"!=typeof window&&(require("tinymce/tinymce.js"),require("tinymce/themes/silver/theme.js"),require("tinymce/models/dom/model.js"),require("tinymce/icons/default/icons.js"),require("tinymce/plugins/advlist/plugin.js"),require("tinymce/plugins/code/plugin.js"),require("tinymce/plugins/codesample/plugin.js"),require("tinymce/plugins/link/plugin.js"),require("tinymce/plugins/lists/plugin.js"),require("tinymce/plugins/table/plugin.js"),require("tinymce/plugins/image/plugin.js"),b(!0))}),[]),y?e("div",{className:l(m({size:p,scaling:d}),s),ref:o,children:e(r,c({init:{base_url:"tinymce",width:"100%",height:"100%",plugins:"link table lists code codesample",menubar:!1,toolbar:"blocks | bold italic forecolor strikethrough | hr blockquote | bullist numlist outdent indent | table image link | inlinecode codeformat codesample markdown",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"}),i=a(t);e.setContent(i)}})}}},f))}):null}));p.displayName="Editor";export{p as Editor,p as default};
|
3
3
|
//# sourceMappingURL=index.mjs.map
|