@aeriz/wysiwyg 1.0.5 → 2.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/LICENSE +201 -201
- package/README.md +82 -573
- package/angular/README.md +10 -4
- package/angular/aeriz-editor.directive.ts +40 -18
- package/dist/adapters/jquery.cjs +1 -1
- package/dist/adapters/jquery.js +14 -14
- package/dist/adapters/shared.cjs +1 -1
- package/dist/adapters/shared.js +59 -56
- package/dist/adapters/vue.cjs +1 -1
- package/dist/adapters/vue.js +64 -56
- package/dist/adapters/vue2.cjs +1 -1
- package/dist/adapters/vue2.js +24 -17
- package/dist/adapters/wc.cjs +1 -1
- package/dist/adapters/wc.js +108 -72
- package/dist/aeriz-wysiwyg-adapter.js +24 -32
- package/dist/aeriz-wysiwyg-adapter.min.js +1 -1
- package/dist/aeriz-wysiwyg-highlight.js +964 -0
- package/dist/aeriz-wysiwyg-highlight.min.js +5 -0
- package/dist/aeriz-wysiwyg-jquery.js +25 -32
- package/dist/aeriz-wysiwyg-jquery.min.js +1 -1
- package/dist/aeriz-wysiwyg-wc.js +80 -43
- package/dist/aeriz-wysiwyg-wc.min.js +1 -1
- package/dist/aeriz-wysiwyg.cjs +3525 -1744
- package/dist/aeriz-wysiwyg.css +2104 -1904
- package/dist/aeriz-wysiwyg.esm.js +3525 -1744
- package/dist/aeriz-wysiwyg.esm.min.js +4840 -3581
- package/dist/aeriz-wysiwyg.js +3525 -1744
- package/dist/aeriz-wysiwyg.min.cjs +51 -46
- package/dist/aeriz-wysiwyg.min.css +1 -1
- package/dist/aeriz-wysiwyg.min.js +51 -46
- package/dist/highlight.cjs +5 -0
- package/dist/highlight.js +895 -0
- package/dist/server.cjs +24 -19
- package/dist/server.js +612 -251
- package/dist-types/adapters/shared.d.ts +0 -8
- package/dist-types/adapters/shared.d.ts.map +1 -1
- package/dist-types/adapters/vue.d.ts +62 -21
- package/dist-types/adapters/vue.d.ts.map +1 -1
- package/dist-types/adapters/vue2.d.ts +33 -14
- package/dist-types/adapters/vue2.d.ts.map +1 -1
- package/dist-types/adapters/wc.d.ts +15 -6
- package/dist-types/adapters/wc.d.ts.map +1 -1
- package/dist-types/cjs/adapters/shared.d.cts +0 -8
- package/dist-types/cjs/adapters/vue.d.cts +62 -21
- package/dist-types/cjs/adapters/vue2.d.cts +33 -14
- package/dist-types/cjs/adapters/wc.d.cts +15 -6
- package/dist-types/cjs/core/AerizEditor.d.cts +204 -48
- package/dist-types/cjs/core/AerizViewer.d.cts +7 -0
- package/dist-types/cjs/core/block-meta.d.cts +40 -0
- package/dist-types/cjs/core/block-tracker.d.cts +64 -0
- package/dist-types/cjs/core/blocks.d.cts +39 -4
- package/dist-types/cjs/core/fonts.d.cts +33 -46
- package/dist-types/cjs/core/history.d.cts +28 -10
- package/dist-types/cjs/core/html-to-blocks.d.cts +10 -0
- package/dist-types/cjs/core/i18n.d.cts +44 -0
- package/dist-types/cjs/core/import-html.d.cts +0 -13
- package/dist-types/cjs/core/insert-fragment.d.cts +21 -0
- package/dist-types/cjs/core/paste-clean.d.cts +36 -0
- package/dist-types/cjs/core/sanitize-dom.d.cts +21 -0
- package/dist-types/cjs/core/sanitize-html.d.cts +8 -0
- package/dist-types/cjs/core/sanitize-policy.d.cts +22 -0
- package/dist-types/cjs/core/selection.d.cts +5 -0
- package/dist-types/cjs/core/table-grid.d.cts +87 -0
- package/dist-types/cjs/core/table-ops.d.cts +2 -22
- package/dist-types/cjs/highlight/index.d.cts +5 -0
- package/dist-types/cjs/index.d.cts +19 -11
- package/dist-types/cjs/server/index.d.cts +4 -5
- package/dist-types/cjs/types/index.d.cts +63 -15
- package/dist-types/cjs/ui/Toolbar.d.cts +10 -0
- package/dist-types/cjs/ui/doc-tools.d.cts +58 -0
- package/dist-types/cjs/ui/popovers.d.cts +14 -25
- package/dist-types/core/AerizEditor.d.ts +204 -48
- package/dist-types/core/AerizEditor.d.ts.map +1 -1
- package/dist-types/core/AerizViewer.d.ts +7 -0
- package/dist-types/core/AerizViewer.d.ts.map +1 -1
- package/dist-types/core/block-meta.d.ts +40 -0
- package/dist-types/core/block-meta.d.ts.map +1 -1
- package/dist-types/core/block-policy.d.ts.map +1 -1
- package/dist-types/core/block-tracker.d.ts +64 -0
- package/dist-types/core/block-tracker.d.ts.map +1 -0
- package/dist-types/core/blocks.d.ts +39 -4
- package/dist-types/core/blocks.d.ts.map +1 -1
- package/dist-types/core/fonts.d.ts +33 -46
- package/dist-types/core/fonts.d.ts.map +1 -1
- package/dist-types/core/history.d.ts +28 -10
- package/dist-types/core/history.d.ts.map +1 -1
- package/dist-types/core/html-mini.d.ts.map +1 -1
- package/dist-types/core/html-to-blocks.d.ts +10 -0
- package/dist-types/core/html-to-blocks.d.ts.map +1 -0
- package/dist-types/core/i18n.d.ts +44 -0
- package/dist-types/core/i18n.d.ts.map +1 -1
- package/dist-types/core/import-html.d.ts +0 -13
- package/dist-types/core/import-html.d.ts.map +1 -1
- package/dist-types/core/import-markdown.d.ts.map +1 -1
- package/dist-types/core/insert-fragment.d.ts +21 -0
- package/dist-types/core/insert-fragment.d.ts.map +1 -0
- package/dist-types/core/markdown-export.d.ts.map +1 -1
- package/dist-types/core/paste-clean.d.ts +36 -0
- package/dist-types/core/paste-clean.d.ts.map +1 -0
- package/dist-types/core/render-string.d.ts.map +1 -1
- package/dist-types/core/sanitize-dom.d.ts +21 -0
- package/dist-types/core/sanitize-dom.d.ts.map +1 -0
- package/dist-types/core/sanitize-html.d.ts +8 -0
- package/dist-types/core/sanitize-html.d.ts.map +1 -0
- package/dist-types/core/sanitize-policy.d.ts +22 -0
- package/dist-types/core/sanitize-policy.d.ts.map +1 -0
- package/dist-types/core/selection.d.ts +5 -0
- package/dist-types/core/selection.d.ts.map +1 -1
- package/dist-types/core/snapshot.d.ts.map +1 -1
- package/dist-types/core/table-grid.d.ts +87 -0
- package/dist-types/core/table-grid.d.ts.map +1 -0
- package/dist-types/core/table-ops.d.ts +2 -22
- package/dist-types/core/table-ops.d.ts.map +1 -1
- package/dist-types/highlight/index.d.ts +5 -0
- package/dist-types/highlight/index.d.ts.map +1 -0
- package/dist-types/index.d.ts +19 -11
- package/dist-types/index.d.ts.map +1 -1
- package/dist-types/server/index.d.ts +4 -5
- package/dist-types/server/index.d.ts.map +1 -1
- package/dist-types/types/index.d.ts +63 -15
- package/dist-types/types/index.d.ts.map +1 -1
- package/dist-types/ui/Toolbar.d.ts +10 -0
- package/dist-types/ui/Toolbar.d.ts.map +1 -1
- package/dist-types/ui/doc-tools.d.ts +58 -0
- package/dist-types/ui/doc-tools.d.ts.map +1 -0
- package/dist-types/ui/icons.d.ts.map +1 -1
- package/dist-types/ui/popovers.d.ts +14 -25
- package/dist-types/ui/popovers.d.ts.map +1 -1
- package/package.json +70 -5
package/angular/README.md
CHANGED
|
@@ -88,13 +88,19 @@ export class AppModule {}
|
|
|
88
88
|
| `toolbar` | `ToolbarConfig \| false` | 툴바 구성. `false` 면 숨김 |
|
|
89
89
|
| `theme` | `'light' \| 'dark'` | 테마 |
|
|
90
90
|
| `locale` | `'en' \| 'ko' \| 'ja' \| 'zh'` | UI 언어 |
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
93
|
-
| `
|
|
94
|
-
| `
|
|
91
|
+
| `htmlStyles` | `'inline' \| 'class'` | 출력 HTML 의 서식 방식 |
|
|
92
|
+
| `readOnly` | `boolean` | 읽기 전용. 폼의 `disable()` 도 이 값으로 이어진다 |
|
|
93
|
+
| `height` | `number \| string` | 에디터 높이 (숫자는 px) |
|
|
94
|
+
| `statusBar` | `boolean` | 아래 상태 표시줄 |
|
|
95
|
+
| `ariaLabel` | `string` | 본문의 접근성 이름 |
|
|
96
|
+
| `upload` | `UploadOptions` | 그림 · 파일 올리기 (`{ url, headers, handler, maxSize }`) |
|
|
97
|
+
| `fonts` | `FontFamily[]` | 글꼴 목록 |
|
|
98
|
+
| `fontSizes` | `number[]` | 글자 크기 목록 (pt) |
|
|
99
|
+
| `highlighter` | `CodeHighlighter` | 코드 색칠기 (`@aeriz/wysiwyg/highlight`) |
|
|
95
100
|
| `(valueChange)` | `string` | 본문 변경 |
|
|
96
101
|
| `(stateChange)` | `EditorState` | 블록/선택 상태 변경 |
|
|
97
102
|
| `(ready)` | `AerizEditor` | 인스턴스 생성 완료 |
|
|
103
|
+
| `(error)` | `{ error, code }` | 올리기 실패 같은 오류 (`code`: `'upload'` · `'paste'`) |
|
|
98
104
|
|
|
99
105
|
## 성능 메모
|
|
100
106
|
|
|
@@ -33,14 +33,17 @@ import type {
|
|
|
33
33
|
AerizEditor,
|
|
34
34
|
AerizViewer,
|
|
35
35
|
BlockSnapshot,
|
|
36
|
+
EditorErrorCode,
|
|
36
37
|
EditorState,
|
|
38
|
+
CodeHighlighter,
|
|
39
|
+
FontFamily,
|
|
37
40
|
ToolbarConfig,
|
|
41
|
+
UploadOptions,
|
|
38
42
|
} from '@aeriz/wysiwyg';
|
|
39
43
|
|
|
40
44
|
type Theme = 'light' | 'dark';
|
|
41
45
|
type Locale = 'en' | 'ko' | 'ja' | 'zh';
|
|
42
46
|
type HtmlStyles = 'inline' | 'class';
|
|
43
|
-
type UploadFn = (file: File) => Promise<string>;
|
|
44
47
|
|
|
45
48
|
/**
|
|
46
49
|
* 에디터 디렉티브.
|
|
@@ -76,21 +79,27 @@ export class AerizEditorDirective
|
|
|
76
79
|
@Input() locale?: Locale;
|
|
77
80
|
/** `getHTML()` · `(valueChange)` 출력 전략. 기본 `'inline'`. */
|
|
78
81
|
@Input() htmlStyles?: HtmlStyles;
|
|
79
|
-
@Input()
|
|
80
|
-
@Input()
|
|
81
|
-
/**
|
|
82
|
-
@Input()
|
|
83
|
-
@Input()
|
|
82
|
+
@Input() statusBar?: boolean;
|
|
83
|
+
@Input() ariaLabel?: string;
|
|
84
|
+
/** 읽기 전용. 폼 컨트롤의 `disable()` 도 같은 효과다. */
|
|
85
|
+
@Input() readOnly?: boolean;
|
|
86
|
+
@Input() height?: number | string;
|
|
87
|
+
@Input() upload?: UploadOptions;
|
|
88
|
+
@Input() fonts?: FontFamily[];
|
|
89
|
+
@Input() highlighter?: CodeHighlighter;
|
|
90
|
+
@Input() fontSizes?: number[];
|
|
84
91
|
|
|
85
92
|
@Output() valueChange = new EventEmitter<string>();
|
|
86
93
|
@Output() stateChange = new EventEmitter<EditorState>();
|
|
87
94
|
@Output() ready = new EventEmitter<AerizEditor>();
|
|
95
|
+
@Output() error = new EventEmitter<{ error: Error; code: EditorErrorCode }>();
|
|
88
96
|
|
|
89
97
|
private controller: AerizEditorController | null = null;
|
|
90
98
|
/** 에디터가 들고 있는 값. ngModel / [value] 양쪽의 단일 출처. */
|
|
91
99
|
private current = '';
|
|
92
100
|
private onChangeFn: (value: string) => void = () => undefined;
|
|
93
101
|
private onTouchedFn: () => void = () => undefined;
|
|
102
|
+
private disabled = false;
|
|
94
103
|
|
|
95
104
|
constructor(
|
|
96
105
|
private readonly host: ElementRef<HTMLElement>,
|
|
@@ -142,10 +151,10 @@ export class AerizEditorDirective
|
|
|
142
151
|
this.onTouchedFn = fn;
|
|
143
152
|
}
|
|
144
153
|
|
|
154
|
+
/** 폼 컨트롤 `disable()` → 읽기 전용. */
|
|
145
155
|
setDisabledState(isDisabled: boolean): void {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
if (content) content.contentEditable = isDisabled ? 'false' : 'true';
|
|
156
|
+
this.disabled = isDisabled;
|
|
157
|
+
this.controller?.update(this.buildProps());
|
|
149
158
|
}
|
|
150
159
|
|
|
151
160
|
// ─── 내부 ────────────────────────────────────────────────────────────
|
|
@@ -168,16 +177,29 @@ export class AerizEditorDirective
|
|
|
168
177
|
onReady: (editor: AerizEditor) => {
|
|
169
178
|
this.zone.run(() => this.ready.emit(editor));
|
|
170
179
|
},
|
|
180
|
+
onError: (error: Error, context: { code: EditorErrorCode }) => {
|
|
181
|
+
this.zone.run(() => this.error.emit({ error, code: context.code }));
|
|
182
|
+
},
|
|
171
183
|
};
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
184
|
+
// 입력 이름이 곧 에디터 옵션 이름이다 — 다른 프레임워크 어댑터와 같다.
|
|
185
|
+
const inputs = {
|
|
186
|
+
placeholder: this.placeholder,
|
|
187
|
+
toolbar: this.toolbar,
|
|
188
|
+
theme: this.theme,
|
|
189
|
+
locale: this.locale,
|
|
190
|
+
htmlStyles: this.htmlStyles,
|
|
191
|
+
statusBar: this.statusBar,
|
|
192
|
+
ariaLabel: this.ariaLabel,
|
|
193
|
+
readOnly: this.readOnly || this.disabled || undefined,
|
|
194
|
+
height: this.height,
|
|
195
|
+
upload: this.upload,
|
|
196
|
+
fonts: this.fonts,
|
|
197
|
+
highlighter: this.highlighter,
|
|
198
|
+
fontSizes: this.fontSizes,
|
|
199
|
+
};
|
|
200
|
+
for (const [key, value] of Object.entries(inputs)) {
|
|
201
|
+
if (value !== undefined) (props as Record<string, unknown>)[key] = value;
|
|
202
|
+
}
|
|
181
203
|
return props;
|
|
182
204
|
}
|
|
183
205
|
}
|
package/dist/adapters/jquery.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./shared.cjs"),f=new WeakMap,d=new WeakMap;function c(t,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./shared.cjs"),f=new WeakMap,d=new WeakMap;function c(t,n,s){const a=t[0],e=a?f.get(a):void 0;switch(n){case"getHTML":return(e==null?void 0:e.editor.getHTML())??"";case"getBlocks":return(e==null?void 0:e.editor.getBlocks())??[];case"setHTML":return t.each((u,i)=>{var r;(r=f.get(i))==null||r.editor.setHTML(String(s[0]??""))}),t;case"update":return t.each((u,i)=>{var r;(r=f.get(i))==null||r.update(s[0]??{})}),t;case"focus":return e==null||e.editor.focus(),t;case"instance":return(e==null?void 0:e.editor)??null;case"destroy":return t.each((u,i)=>{const r=f.get(i);r&&(r.destroy(),f.delete(i))}),t;default:throw new Error(`aerizEditor: 알 수 없는 명령 "${n}"`)}}function y(t,n,s){const a=t[0],e=a?d.get(a):void 0;switch(n){case"getHTML":return(e==null?void 0:e.viewer.getHTML())??"";case"getBlocks":return(e==null?void 0:e.viewer.getBlocks())??[];case"update":return t.each((u,i)=>{var r;(r=d.get(i))==null||r.update(s[0]??{})}),t;case"instance":return(e==null?void 0:e.viewer)??null;case"destroy":return t.each((u,i)=>{const r=d.get(i);r&&(r.destroy(),d.delete(i))}),t;default:throw new Error(`aerizViewer: 알 수 없는 명령 "${n}"`)}}function p(t,...n){if(typeof t=="string")return c(this,t,n);const s=t??{};return this.each((a,e)=>{const u=f.get(e);if(u){u.update(s);return}f.set(e,h.createEditorController(e,s))}),this}function o(t,...n){if(typeof t=="string")return y(this,t,n);const s=t??{};return this.each((a,e)=>{const u=d.get(e);if(u){u.update(s);return}d.set(e,h.createViewerController(e,s))}),this}function w(t){if(!t||typeof t.fn!="object")throw new TypeError("registerAerizJQuery: jQuery 객체가 필요합니다.");t.fn.aerizEditor||(t.fn.aerizEditor=p),t.fn.aerizViewer||(t.fn.aerizViewer=o)}const g=globalThis.jQuery;g&&w(g);exports.registerAerizJQuery=w;
|
package/dist/adapters/jquery.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createEditorController as w, createViewerController as h } from "./shared.js";
|
|
2
|
-
const f = /* @__PURE__ */ new WeakMap(),
|
|
2
|
+
const f = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap();
|
|
3
3
|
function c(t, n, s) {
|
|
4
4
|
const a = t[0], e = a ? f.get(a) : void 0;
|
|
5
5
|
switch (n) {
|
|
6
6
|
case "getHTML":
|
|
7
7
|
return (e == null ? void 0 : e.editor.getHTML()) ?? "";
|
|
8
8
|
case "getBlocks":
|
|
9
|
-
return (e == null ? void 0 : e.editor.
|
|
9
|
+
return (e == null ? void 0 : e.editor.getBlocks()) ?? [];
|
|
10
10
|
case "setHTML":
|
|
11
11
|
return t.each((u, i) => {
|
|
12
12
|
var r;
|
|
@@ -31,7 +31,7 @@ function c(t, n, s) {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
function y(t, n, s) {
|
|
34
|
-
const a = t[0], e = a ?
|
|
34
|
+
const a = t[0], e = a ? g.get(a) : void 0;
|
|
35
35
|
switch (n) {
|
|
36
36
|
case "getHTML":
|
|
37
37
|
return (e == null ? void 0 : e.viewer.getHTML()) ?? "";
|
|
@@ -40,14 +40,14 @@ function y(t, n, s) {
|
|
|
40
40
|
case "update":
|
|
41
41
|
return t.each((u, i) => {
|
|
42
42
|
var r;
|
|
43
|
-
(r =
|
|
43
|
+
(r = g.get(i)) == null || r.update(s[0] ?? {});
|
|
44
44
|
}), t;
|
|
45
45
|
case "instance":
|
|
46
46
|
return (e == null ? void 0 : e.viewer) ?? null;
|
|
47
47
|
case "destroy":
|
|
48
48
|
return t.each((u, i) => {
|
|
49
|
-
const r =
|
|
50
|
-
r && (r.destroy(),
|
|
49
|
+
const r = g.get(i);
|
|
50
|
+
r && (r.destroy(), g.delete(i));
|
|
51
51
|
}), t;
|
|
52
52
|
default:
|
|
53
53
|
throw new Error(`aerizViewer: 알 수 없는 명령 "${n}"`);
|
|
@@ -66,26 +66,26 @@ function p(t, ...n) {
|
|
|
66
66
|
f.set(e, w(e, s));
|
|
67
67
|
}), this;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function o(t, ...n) {
|
|
70
70
|
if (typeof t == "string")
|
|
71
71
|
return y(this, t, n);
|
|
72
72
|
const s = t ?? {};
|
|
73
73
|
return this.each((a, e) => {
|
|
74
|
-
const u =
|
|
74
|
+
const u = g.get(e);
|
|
75
75
|
if (u) {
|
|
76
76
|
u.update(s);
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
|
-
|
|
79
|
+
g.set(e, h(e, s));
|
|
80
80
|
}), this;
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function v(t) {
|
|
83
83
|
if (!t || typeof t.fn != "object")
|
|
84
84
|
throw new TypeError("registerAerizJQuery: jQuery 객체가 필요합니다.");
|
|
85
|
-
t.fn.aerizEditor || (t.fn.aerizEditor = p), t.fn.aerizViewer || (t.fn.aerizViewer =
|
|
85
|
+
t.fn.aerizEditor || (t.fn.aerizEditor = p), t.fn.aerizViewer || (t.fn.aerizViewer = o);
|
|
86
86
|
}
|
|
87
|
-
const
|
|
88
|
-
|
|
87
|
+
const d = globalThis.jQuery;
|
|
88
|
+
d && v(d);
|
|
89
89
|
export {
|
|
90
|
-
|
|
90
|
+
v as registerAerizJQuery
|
|
91
91
|
};
|
package/dist/adapters/shared.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("@aeriz/wysiwyg"),T=new Set(["value","onChange","onStateChange","onReady","onDestroy"]);function L(i,o,e){const n={element:i,onChange:e};for(const[r,f]of Object.entries(o))f===void 0||T.has(r)||(n[r]=f);const c=o.value??o.initialHTML;return c!==void 0&&(n.initialHTML=c),n}const k=["upload","htmlStyles","onError"],w=["locale","statusBar","height","ariaLabel","fonts","fontSizes","highlighter"];function C(i,o){return i===o?!0:typeof i!="object"||typeof o!="object"||!i||!o?!1:JSON.stringify(i)===JSON.stringify(o)}function M(i,o){return i===o?!0:i===!1||o===!1||i===void 0||o===void 0||i.sticky!==o.sticky||i.items.length!==o.items.length?!1:i.items.every((e,n)=>e===o.items[n])}function H(i,o){let e=o,n="",c=!1,r=!1;const f=l=>{var s;n=l,!c&&((s=e.onChange)==null||s.call(e,l))};let t,d=null,u;const O=l=>{const s=u;for(const a of k)l[a]===void 0?delete s[a]:s[a]=l[a]},h=(l,s)=>{var v;const a=s!==void 0?{...l,value:s}:l;u=L(i,a,f),t=new g.AerizEditor(u),n=t.getHTML(),d=t.onStateChange(S=>{var m;return(m=e.onStateChange)==null?void 0:m.call(e,S)}),(v=e.onReady)==null||v.call(e,t)},y=()=>{var l;(l=e.onDestroy)==null||l.call(e,t),d==null||d(),d=null,t.destroy()};return h(e),{get editor(){return t},update(l){if(r)return;const s=e;if(e=l,!M(l.toolbar,s.toolbar)||w.some(a=>!C(l[a],s[a]))){const a=l.value??t.getHTML();y(),h(l,a);return}if(O(l),l.theme!==s.theme&&l.theme!==void 0&&t.setTheme(l.theme),!!l.readOnly!=!!s.readOnly&&t.setReadOnly(!!l.readOnly),l.placeholder!==s.placeholder&&(l.placeholder===void 0?delete t.content.dataset.placeholder:t.content.dataset.placeholder=l.placeholder),l.value!==void 0&&l.value!==n&&l.value!==t.getHTML()){c=!0;try{t.setHTML(l.value)}finally{c=!1}n=l.value}},destroy(){r||(r=!0,y())}}}function E(i,o){const e={element:i};return o.blocks!==void 0?e.initialBlocks=o.blocks:o.html!==void 0&&(e.initialHTML=o.html),o.theme!==void 0&&(e.theme=o.theme),o.htmlStyles!==void 0&&(e.htmlStyles=o.htmlStyles),e}function R(i,o){var f;let e=o,n=!1;const c=E(i,o),r=new g.AerizViewer(c);return(f=e.onReady)==null||f.call(e,r),{viewer:r,update(t){if(n)return;const d=e;e=t,t.theme!==d.theme&&t.theme!==void 0&&r.setTheme(t.theme),t.htmlStyles===void 0?delete c.htmlStyles:c.htmlStyles=t.htmlStyles,t.blocks!==void 0?t.blocks!==d.blocks&&r.setBlocks(t.blocks):t.html!==void 0&&t.html!==d.html&&t.html!==r.getHTML()&&r.setHTML(t.html)},destroy(){var t;n||(n=!0,(t=e.onDestroy)==null||t.call(e,r),r.destroy())}}}exports.createEditorController=H;exports.createViewerController=R;
|
package/dist/adapters/shared.js
CHANGED
|
@@ -1,87 +1,90 @@
|
|
|
1
|
-
import { AerizViewer as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
1
|
+
import { AerizViewer as S, AerizEditor as L } from "@aeriz/wysiwyg";
|
|
2
|
+
const T = /* @__PURE__ */ new Set(["value", "onChange", "onStateChange", "onReady", "onDestroy"]);
|
|
3
|
+
function k(o, i, e) {
|
|
4
|
+
const n = { element: o, onChange: e };
|
|
5
|
+
for (const [r, c] of Object.entries(i))
|
|
6
|
+
c === void 0 || T.has(r) || (n[r] = c);
|
|
7
|
+
const f = i.value ?? i.initialHTML;
|
|
8
|
+
return f !== void 0 && (n.initialHTML = f), n;
|
|
7
9
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return
|
|
10
|
+
const H = ["upload", "htmlStyles", "onError"], M = ["locale", "statusBar", "height", "ariaLabel", "fonts", "fontSizes", "highlighter"];
|
|
11
|
+
function C(o, i) {
|
|
12
|
+
return o === i ? !0 : typeof o != "object" || typeof i != "object" || !o || !i ? !1 : JSON.stringify(o) === JSON.stringify(i);
|
|
11
13
|
}
|
|
12
|
-
function
|
|
13
|
-
return
|
|
14
|
+
function w(o, i) {
|
|
15
|
+
return o === i ? !0 : o === !1 || i === !1 || o === void 0 || i === void 0 || o.sticky !== i.sticky || o.items.length !== i.items.length ? !1 : o.items.every((e, n) => e === i.items[n]);
|
|
14
16
|
}
|
|
15
|
-
function
|
|
16
|
-
let
|
|
17
|
+
function E(o, i) {
|
|
18
|
+
let e = i, n = "", f = !1, r = !1;
|
|
17
19
|
const c = (l) => {
|
|
18
20
|
var s;
|
|
19
|
-
|
|
21
|
+
n = l, !f && ((s = e.onChange) == null || s.call(e, l));
|
|
20
22
|
};
|
|
21
|
-
let
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
let t, d = null, h;
|
|
24
|
+
const O = (l) => {
|
|
25
|
+
const s = h;
|
|
26
|
+
for (const a of H)
|
|
27
|
+
l[a] === void 0 ? delete s[a] : s[a] = l[a];
|
|
28
|
+
}, u = (l, s) => {
|
|
29
|
+
var v;
|
|
30
|
+
const a = s !== void 0 ? { ...l, value: s } : l;
|
|
31
|
+
h = k(o, a, c), t = new L(h), n = t.getHTML(), d = t.onStateChange((g) => {
|
|
32
|
+
var y;
|
|
33
|
+
return (y = e.onStateChange) == null ? void 0 : y.call(e, g);
|
|
34
|
+
}), (v = e.onReady) == null || v.call(e, t);
|
|
35
|
+
}, m = () => {
|
|
32
36
|
var l;
|
|
33
|
-
(l =
|
|
37
|
+
(l = e.onDestroy) == null || l.call(e, t), d == null || d(), d = null, t.destroy();
|
|
34
38
|
};
|
|
35
|
-
return
|
|
39
|
+
return u(e), {
|
|
36
40
|
get editor() {
|
|
37
|
-
return
|
|
41
|
+
return t;
|
|
38
42
|
},
|
|
39
43
|
update(l) {
|
|
40
|
-
if (
|
|
41
|
-
const s =
|
|
42
|
-
if (
|
|
43
|
-
const
|
|
44
|
-
|
|
44
|
+
if (r) return;
|
|
45
|
+
const s = e;
|
|
46
|
+
if (e = l, !w(l.toolbar, s.toolbar) || M.some((a) => !C(l[a], s[a]))) {
|
|
47
|
+
const a = l.value ?? t.getHTML();
|
|
48
|
+
m(), u(l, a);
|
|
45
49
|
return;
|
|
46
50
|
}
|
|
47
|
-
if (
|
|
48
|
-
|
|
51
|
+
if (O(l), l.theme !== s.theme && l.theme !== void 0 && t.setTheme(l.theme), !!l.readOnly != !!s.readOnly && t.setReadOnly(!!l.readOnly), l.placeholder !== s.placeholder && (l.placeholder === void 0 ? delete t.content.dataset.placeholder : t.content.dataset.placeholder = l.placeholder), l.value !== void 0 && l.value !== n && l.value !== t.getHTML()) {
|
|
52
|
+
f = !0;
|
|
49
53
|
try {
|
|
50
|
-
|
|
54
|
+
t.setHTML(l.value);
|
|
51
55
|
} finally {
|
|
52
|
-
|
|
56
|
+
f = !1;
|
|
53
57
|
}
|
|
54
|
-
|
|
58
|
+
n = l.value;
|
|
55
59
|
}
|
|
56
60
|
},
|
|
57
61
|
destroy() {
|
|
58
|
-
|
|
62
|
+
r || (r = !0, m());
|
|
59
63
|
}
|
|
60
64
|
};
|
|
61
65
|
}
|
|
62
|
-
function
|
|
63
|
-
const
|
|
64
|
-
return
|
|
66
|
+
function R(o, i) {
|
|
67
|
+
const e = { element: o };
|
|
68
|
+
return i.blocks !== void 0 ? e.initialBlocks = i.blocks : i.html !== void 0 && (e.initialHTML = i.html), i.theme !== void 0 && (e.theme = i.theme), i.htmlStyles !== void 0 && (e.htmlStyles = i.htmlStyles), e;
|
|
65
69
|
}
|
|
66
|
-
function
|
|
70
|
+
function N(o, i) {
|
|
67
71
|
var c;
|
|
68
|
-
let
|
|
69
|
-
const
|
|
70
|
-
return (c =
|
|
71
|
-
viewer:
|
|
72
|
-
update(
|
|
73
|
-
if (
|
|
74
|
-
const
|
|
75
|
-
|
|
72
|
+
let e = i, n = !1;
|
|
73
|
+
const f = R(o, i), r = new S(f);
|
|
74
|
+
return (c = e.onReady) == null || c.call(e, r), {
|
|
75
|
+
viewer: r,
|
|
76
|
+
update(t) {
|
|
77
|
+
if (n) return;
|
|
78
|
+
const d = e;
|
|
79
|
+
e = t, t.theme !== d.theme && t.theme !== void 0 && r.setTheme(t.theme), t.htmlStyles === void 0 ? delete f.htmlStyles : f.htmlStyles = t.htmlStyles, t.blocks !== void 0 ? t.blocks !== d.blocks && r.setBlocks(t.blocks) : t.html !== void 0 && t.html !== d.html && t.html !== r.getHTML() && r.setHTML(t.html);
|
|
76
80
|
},
|
|
77
81
|
destroy() {
|
|
78
|
-
var
|
|
79
|
-
|
|
82
|
+
var t;
|
|
83
|
+
n || (n = !0, (t = e.onDestroy) == null || t.call(e, r), r.destroy());
|
|
80
84
|
}
|
|
81
85
|
};
|
|
82
86
|
}
|
|
83
87
|
export {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
y as htmlToBlocks
|
|
88
|
+
E as createEditorController,
|
|
89
|
+
N as createViewerController
|
|
87
90
|
};
|
package/dist/adapters/vue.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("vue"),s=require("./shared.cjs"),f=d.defineComponent({name:"AerizEditor",props:{modelValue:{type:String,default:void 0},initialHTML:{type:String,default:void 0},placeholder:{type:String,default:void 0},toolbar:{type:[Object,Boolean],default:void 0},theme:{type:String,default:void 0},locale:{type:String,default:void 0},htmlStyles:{type:String,default:void 0},statusBar:{type:Boolean,default:void 0},ariaLabel:{type:String,default:void 0},readOnly:{type:Boolean,default:void 0},height:{type:[Number,String],default:void 0},upload:{type:Object,default:void 0},fonts:{type:Array,default:void 0},highlighter:{type:Object,default:void 0},fontSizes:{type:Array,default:void 0}},emits:{"update:modelValue":t=>typeof t=="string",change:t=>typeof t=="string","state-change":t=>!0,ready:t=>!0,error:(t,a)=>!0},setup(t,{emit:a,expose:l}){const n=d.ref(null);let e=null;const r=()=>{const o={onChange:i=>{a("update:modelValue",i),a("change",i)},onStateChange:i=>a("state-change",i),onReady:i=>a("ready",i),onError:(i,u)=>a("error",i,u)};for(const[i,u]of Object.entries(t))u===void 0||i==="modelValue"||(o[i]=u);return t.modelValue!==void 0&&(o.value=t.modelValue),o};return d.onMounted(()=>{n.value&&(e=s.createEditorController(n.value,r()))}),d.watch(()=>({...t}),()=>e==null?void 0:e.update(r()),{flush:"post"}),d.onBeforeUnmount(()=>{e==null||e.destroy(),e=null}),l({get editor(){return(e==null?void 0:e.editor)??null},getHTML:()=>(e==null?void 0:e.editor.getHTML())??"",setHTML:o=>e==null?void 0:e.editor.setHTML(o),focus:()=>e==null?void 0:e.editor.focus()}),()=>d.h("div",{ref:n})}}),y=d.defineComponent({name:"AerizViewer",props:{blocks:{type:Array,default:void 0},html:{type:String,default:void 0},theme:{type:String,default:void 0},htmlStyles:{type:String,default:void 0}},emits:{ready:t=>!0},setup(t,{emit:a,expose:l}){const n=d.ref(null);let e=null;const r=()=>{const o={onReady:i=>a("ready",i)};return t.blocks!==void 0&&(o.blocks=t.blocks),t.html!==void 0&&(o.html=t.html),t.theme!==void 0&&(o.theme=t.theme),t.htmlStyles!==void 0&&(o.htmlStyles=t.htmlStyles),o};return d.onMounted(()=>{n.value&&(e=s.createViewerController(n.value,r()))}),d.watch(()=>({...t}),()=>e==null?void 0:e.update(r()),{flush:"post"}),d.onBeforeUnmount(()=>{e==null||e.destroy(),e=null}),l({get viewer(){return(e==null?void 0:e.viewer)??null}}),()=>d.h("div",{ref:n})}}),v={install(t){t.component("AerizEditor",f),t.component("AerizViewer",y)}};exports.AerizEditor=f;exports.AerizViewer=y;exports.AerizWysiwygPlugin=v;
|
package/dist/adapters/vue.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { createEditorController as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as l, ref as f, onMounted as y, watch as s, onBeforeUnmount as v, h } from "vue";
|
|
2
|
+
import { createEditorController as g, createViewerController as m } from "./shared.js";
|
|
3
|
+
const p = l({
|
|
4
4
|
name: "AerizEditor",
|
|
5
5
|
props: {
|
|
6
6
|
/** `v-model` 바인딩 값 (HTML). */
|
|
@@ -17,48 +17,56 @@ const U = u({
|
|
|
17
17
|
locale: { type: String, default: void 0 },
|
|
18
18
|
/** `getHTML()` · `onChange` 출력 전략. 기본 `'inline'`. */
|
|
19
19
|
htmlStyles: { type: String, default: void 0 },
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
statusBar: { type: Boolean, default: void 0 },
|
|
21
|
+
ariaLabel: { type: String, default: void 0 },
|
|
22
|
+
readOnly: { type: Boolean, default: void 0 },
|
|
23
|
+
height: { type: [Number, String], default: void 0 },
|
|
24
|
+
upload: { type: Object, default: void 0 },
|
|
25
|
+
fonts: { type: Array, default: void 0 },
|
|
26
|
+
highlighter: { type: Object, default: void 0 },
|
|
27
|
+
fontSizes: { type: Array, default: void 0 }
|
|
24
28
|
},
|
|
25
29
|
emits: {
|
|
26
|
-
"update:modelValue": (
|
|
27
|
-
change: (
|
|
28
|
-
"state-change": (
|
|
29
|
-
ready: (
|
|
30
|
+
"update:modelValue": (t) => typeof t == "string",
|
|
31
|
+
change: (t) => typeof t == "string",
|
|
32
|
+
"state-change": (t) => !0,
|
|
33
|
+
ready: (t) => !0,
|
|
34
|
+
error: (t, o) => !0
|
|
30
35
|
},
|
|
31
|
-
setup(
|
|
32
|
-
const
|
|
33
|
-
let
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
onChange: (
|
|
37
|
-
|
|
36
|
+
setup(t, { emit: o, expose: n }) {
|
|
37
|
+
const a = f(null);
|
|
38
|
+
let e = null;
|
|
39
|
+
const u = () => {
|
|
40
|
+
const d = {
|
|
41
|
+
onChange: (i) => {
|
|
42
|
+
o("update:modelValue", i), o("change", i);
|
|
38
43
|
},
|
|
39
|
-
onStateChange: (
|
|
40
|
-
onReady: (
|
|
44
|
+
onStateChange: (i) => o("state-change", i),
|
|
45
|
+
onReady: (i) => o("ready", i),
|
|
46
|
+
onError: (i, r) => o("error", i, r)
|
|
41
47
|
};
|
|
42
|
-
|
|
48
|
+
for (const [i, r] of Object.entries(t))
|
|
49
|
+
r === void 0 || i === "modelValue" || (d[i] = r);
|
|
50
|
+
return t.modelValue !== void 0 && (d.value = t.modelValue), d;
|
|
43
51
|
};
|
|
44
|
-
return
|
|
45
|
-
|
|
46
|
-
}),
|
|
47
|
-
() => ({ ...
|
|
48
|
-
() =>
|
|
52
|
+
return y(() => {
|
|
53
|
+
a.value && (e = g(a.value, u()));
|
|
54
|
+
}), s(
|
|
55
|
+
() => ({ ...t }),
|
|
56
|
+
() => e == null ? void 0 : e.update(u()),
|
|
49
57
|
{ flush: "post" }
|
|
50
|
-
),
|
|
51
|
-
|
|
58
|
+
), v(() => {
|
|
59
|
+
e == null || e.destroy(), e = null;
|
|
52
60
|
}), n({
|
|
53
61
|
get editor() {
|
|
54
|
-
return (
|
|
62
|
+
return (e == null ? void 0 : e.editor) ?? null;
|
|
55
63
|
},
|
|
56
|
-
getHTML: () => (
|
|
57
|
-
setHTML: (
|
|
58
|
-
focus: () =>
|
|
59
|
-
}), () =>
|
|
64
|
+
getHTML: () => (e == null ? void 0 : e.editor.getHTML()) ?? "",
|
|
65
|
+
setHTML: (d) => e == null ? void 0 : e.editor.setHTML(d),
|
|
66
|
+
focus: () => e == null ? void 0 : e.editor.focus()
|
|
67
|
+
}), () => h("div", { ref: a });
|
|
60
68
|
}
|
|
61
|
-
}), S =
|
|
69
|
+
}), S = l({
|
|
62
70
|
name: "AerizViewer",
|
|
63
71
|
props: {
|
|
64
72
|
/** 표시할 블록 상태. `html` 보다 우선한다. */
|
|
@@ -73,38 +81,38 @@ const U = u({
|
|
|
73
81
|
htmlStyles: { type: String, default: void 0 }
|
|
74
82
|
},
|
|
75
83
|
emits: {
|
|
76
|
-
ready: (
|
|
84
|
+
ready: (t) => !0
|
|
77
85
|
},
|
|
78
|
-
setup(
|
|
79
|
-
const
|
|
80
|
-
let
|
|
81
|
-
const
|
|
82
|
-
const
|
|
83
|
-
onReady: (
|
|
86
|
+
setup(t, { emit: o, expose: n }) {
|
|
87
|
+
const a = f(null);
|
|
88
|
+
let e = null;
|
|
89
|
+
const u = () => {
|
|
90
|
+
const d = {
|
|
91
|
+
onReady: (i) => o("ready", i)
|
|
84
92
|
};
|
|
85
|
-
return
|
|
93
|
+
return t.blocks !== void 0 && (d.blocks = t.blocks), t.html !== void 0 && (d.html = t.html), t.theme !== void 0 && (d.theme = t.theme), t.htmlStyles !== void 0 && (d.htmlStyles = t.htmlStyles), d;
|
|
86
94
|
};
|
|
87
|
-
return
|
|
88
|
-
|
|
89
|
-
}),
|
|
90
|
-
() => ({ ...
|
|
91
|
-
() =>
|
|
95
|
+
return y(() => {
|
|
96
|
+
a.value && (e = m(a.value, u()));
|
|
97
|
+
}), s(
|
|
98
|
+
() => ({ ...t }),
|
|
99
|
+
() => e == null ? void 0 : e.update(u()),
|
|
92
100
|
{ flush: "post" }
|
|
93
|
-
),
|
|
94
|
-
|
|
101
|
+
), v(() => {
|
|
102
|
+
e == null || e.destroy(), e = null;
|
|
95
103
|
}), n({
|
|
96
104
|
get viewer() {
|
|
97
|
-
return (
|
|
105
|
+
return (e == null ? void 0 : e.viewer) ?? null;
|
|
98
106
|
}
|
|
99
|
-
}), () =>
|
|
107
|
+
}), () => h("div", { ref: a });
|
|
100
108
|
}
|
|
101
|
-
}),
|
|
102
|
-
install(
|
|
103
|
-
|
|
109
|
+
}), A = {
|
|
110
|
+
install(t) {
|
|
111
|
+
t.component("AerizEditor", p), t.component("AerizViewer", S);
|
|
104
112
|
}
|
|
105
113
|
};
|
|
106
114
|
export {
|
|
107
|
-
|
|
115
|
+
p as AerizEditor,
|
|
108
116
|
S as AerizViewer,
|
|
109
|
-
|
|
117
|
+
A as AerizWysiwygPlugin
|
|
110
118
|
};
|
package/dist/adapters/vue2.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./shared.cjs");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./shared.cjs");function l(e,t){e.$watch(()=>({...e.$props}),t,{deep:!1})}const n={name:"AerizEditor",props:{value:{type:String,default:void 0},initialHTML:{type:String,default:void 0},placeholder:{type:String,default:void 0},toolbar:{type:[Object,Boolean],default:void 0},theme:{type:String,default:void 0},locale:{type:String,default:void 0},htmlStyles:{type:String,default:void 0},statusBar:{type:Boolean,default:void 0},ariaLabel:{type:String,default:void 0},readOnly:{type:Boolean,default:void 0},height:{type:[Number,String],default:void 0},upload:{type:Object,default:void 0},fonts:{type:Array,default:void 0},highlighter:{type:Object,default:void 0},fontSizes:{type:Array,default:void 0}},data(){return{aerizController:null}},methods:{aerizProps(){const e=this.$props,t={onChange:r=>{this.$emit("input",r),this.$emit("change",r)},onStateChange:r=>this.$emit("state-change",r),onReady:r=>this.$emit("ready",r),onError:(r,i)=>this.$emit("error",r,i)};for(const[r,i]of Object.entries(e))i!==void 0&&(t[r]=i);return t},getEditor(){var e;return((e=this.aerizController)==null?void 0:e.editor)??null},getHTML(){var e;return((e=this.aerizController)==null?void 0:e.editor.getHTML())??""},setHTML(e){var t;(t=this.aerizController)==null||t.editor.setHTML(e)},focus(){var e;(e=this.aerizController)==null||e.editor.focus()}},mounted(){this.aerizController=o.createEditorController(this.$el,this.aerizProps()),l(this,()=>{var e;return(e=this.aerizController)==null?void 0:e.update(this.aerizProps())})},beforeDestroy(){var e;(e=this.aerizController)==null||e.destroy(),this.aerizController=null},render(e){return e("div")}},a={name:"AerizViewer",props:{blocks:{type:Array,default:void 0},html:{type:String,default:void 0},theme:{type:String,default:void 0},htmlStyles:{type:String,default:void 0}},data(){return{aerizController:null}},methods:{aerizProps(){const e=this.$props,t={onReady:r=>this.$emit("ready",r)};return e.blocks!==void 0&&(t.blocks=e.blocks),e.html!==void 0&&(t.html=e.html),e.theme!==void 0&&(t.theme=e.theme),e.htmlStyles!==void 0&&(t.htmlStyles=e.htmlStyles),t},getViewer(){var e;return((e=this.aerizController)==null?void 0:e.viewer)??null}},mounted(){this.aerizController=o.createViewerController(this.$el,this.aerizProps()),l(this,()=>{var e;return(e=this.aerizController)==null?void 0:e.update(this.aerizProps())})},beforeDestroy(){var e;(e=this.aerizController)==null||e.destroy(),this.aerizController=null},render(e){return e("div")}},s={install(e){e.component("AerizEditor",n),e.component("AerizViewer",a)}};exports.AerizEditor=n;exports.AerizViewer=a;exports.AerizWysiwygPlugin=s;
|