@aeriz/wysiwyg 1.0.3 → 1.0.5
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 +37 -13
- package/dist/adapters/shared.cjs +1 -1
- package/dist/adapters/shared.js +11 -11
- package/dist/aeriz-wysiwyg-adapter.js +1 -1
- package/dist/aeriz-wysiwyg-adapter.min.js +1 -1
- package/dist/aeriz-wysiwyg-jquery.js +1 -1
- package/dist/aeriz-wysiwyg-jquery.min.js +1 -1
- package/dist/aeriz-wysiwyg-wc.js +1 -1
- package/dist/aeriz-wysiwyg-wc.min.js +1 -1
- package/dist/aeriz-wysiwyg.cjs +3924 -1927
- package/dist/aeriz-wysiwyg.css +554 -38
- package/dist/aeriz-wysiwyg.esm.js +3924 -1927
- package/dist/aeriz-wysiwyg.esm.min.js +4372 -2652
- package/dist/aeriz-wysiwyg.js +3924 -1927
- package/dist/aeriz-wysiwyg.min.cjs +48 -38
- package/dist/aeriz-wysiwyg.min.css +1 -1
- package/dist/aeriz-wysiwyg.min.js +48 -38
- package/dist/server.cjs +24 -22
- package/dist/server.js +444 -312
- package/dist-types/adapters/shared.d.ts.map +1 -1
- package/dist-types/cjs/core/AerizEditor.d.cts +214 -7
- package/dist-types/cjs/core/block-meta.d.cts +66 -0
- package/dist-types/cjs/core/block-policy.d.cts +43 -0
- package/dist-types/cjs/core/blocks.d.cts +47 -4
- package/dist-types/cjs/core/highlight.d.cts +2 -0
- package/dist-types/cjs/core/history.d.cts +86 -0
- package/dist-types/cjs/core/i18n.d.cts +12 -0
- package/dist-types/cjs/core/import-html.d.cts +1 -0
- package/dist-types/cjs/core/import-markdown.d.cts +0 -4
- package/dist-types/cjs/core/input-rules.d.cts +46 -0
- package/dist-types/cjs/core/selection.d.cts +46 -0
- package/dist-types/cjs/core/table-ops.d.cts +30 -0
- package/dist-types/cjs/index.d.cts +2 -0
- package/dist-types/core/AerizEditor.d.ts +214 -7
- package/dist-types/core/AerizEditor.d.ts.map +1 -1
- package/dist-types/core/block-meta.d.ts +66 -0
- package/dist-types/core/block-meta.d.ts.map +1 -1
- package/dist-types/core/block-policy.d.ts +43 -0
- package/dist-types/core/block-policy.d.ts.map +1 -0
- package/dist-types/core/blocks.d.ts +47 -4
- package/dist-types/core/blocks.d.ts.map +1 -1
- package/dist-types/core/highlight.d.ts +2 -0
- package/dist-types/core/highlight.d.ts.map +1 -1
- package/dist-types/core/history.d.ts +86 -0
- package/dist-types/core/history.d.ts.map +1 -0
- package/dist-types/core/i18n.d.ts +12 -0
- package/dist-types/core/i18n.d.ts.map +1 -1
- package/dist-types/core/import-html.d.ts +1 -0
- package/dist-types/core/import-html.d.ts.map +1 -1
- package/dist-types/core/import-markdown.d.ts +0 -4
- package/dist-types/core/import-markdown.d.ts.map +1 -1
- package/dist-types/core/input-rules.d.ts +46 -0
- package/dist-types/core/input-rules.d.ts.map +1 -0
- package/dist-types/core/plain-text.d.ts.map +1 -1
- package/dist-types/core/render-string.d.ts.map +1 -1
- package/dist-types/core/selection.d.ts +46 -0
- package/dist-types/core/selection.d.ts.map +1 -0
- package/dist-types/core/snapshot.d.ts.map +1 -1
- package/dist-types/core/table-ops.d.ts +30 -0
- package/dist-types/core/table-ops.d.ts.map +1 -0
- package/dist-types/index.d.ts +2 -0
- package/dist-types/index.d.ts.map +1 -1
- package/dist-types/ui/Toolbar.d.ts.map +1 -1
- package/dist-types/ui/dialogs.d.ts.map +1 -1
- package/dist-types/ui/icons.d.ts.map +1 -1
- package/dist-types/ui/popovers.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -71,18 +71,18 @@ editor.onStateChange(() => viewer.setBlocks(editor.serialize()));
|
|
|
71
71
|
<!-- ✓ 프로덕션 — 특정 버전 고정 (immutable, 가장 긴 캐시) -->
|
|
72
72
|
<link
|
|
73
73
|
rel="stylesheet"
|
|
74
|
-
href="https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@1.0.
|
|
74
|
+
href="https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@1.0.5/dist/aeriz-wysiwyg.min.css"
|
|
75
75
|
/>
|
|
76
|
-
<script src="https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@1.0.
|
|
76
|
+
<script src="https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@1.0.5/dist/aeriz-wysiwyg.min.js"></script>
|
|
77
77
|
|
|
78
78
|
<!-- 1.x 트랙 — 패치만 자동 수신 -->
|
|
79
|
-
<script src="https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@^1.0.
|
|
79
|
+
<script src="https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@^1.0.5/dist/aeriz-wysiwyg.min.js"></script>
|
|
80
80
|
|
|
81
81
|
<!-- 항상 최신 — 프로토타이핑용 (프로덕션 권장 X) -->
|
|
82
82
|
<script src="https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@latest/dist/aeriz-wysiwyg.min.js"></script>
|
|
83
83
|
|
|
84
84
|
<!-- unpkg 미러 -->
|
|
85
|
-
<script src="https://unpkg.com/@aeriz/wysiwyg@1.0.
|
|
85
|
+
<script src="https://unpkg.com/@aeriz/wysiwyg@1.0.5/dist/aeriz-wysiwyg.min.js"></script>
|
|
86
86
|
|
|
87
87
|
<div id="editor"></div>
|
|
88
88
|
<script>
|
|
@@ -99,13 +99,13 @@ editor.onStateChange(() => viewer.setBlocks(editor.serialize()));
|
|
|
99
99
|
```html
|
|
100
100
|
<link
|
|
101
101
|
rel="stylesheet"
|
|
102
|
-
href="https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@1.0.
|
|
102
|
+
href="https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@1.0.5/dist/aeriz-wysiwyg.min.css"
|
|
103
103
|
/>
|
|
104
104
|
<script type="module">
|
|
105
105
|
import {
|
|
106
106
|
AerizEditor,
|
|
107
107
|
AerizViewer,
|
|
108
|
-
} from 'https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@1.0.
|
|
108
|
+
} from 'https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@1.0.5/dist/aeriz-wysiwyg.esm.min.js';
|
|
109
109
|
|
|
110
110
|
new AerizEditor({ element: document.querySelector('#editor') });
|
|
111
111
|
</script>
|
|
@@ -130,12 +130,12 @@ editor.onStateChange(() => viewer.setBlocks(editor.serialize()));
|
|
|
130
130
|
```html
|
|
131
131
|
<link
|
|
132
132
|
rel="stylesheet"
|
|
133
|
-
href="https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@1.0.
|
|
133
|
+
href="https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@1.0.5/dist/aeriz-wysiwyg.min.css"
|
|
134
134
|
/>
|
|
135
135
|
<!-- 1) 코어 먼저 -->
|
|
136
|
-
<script src="https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@1.0.
|
|
136
|
+
<script src="https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@1.0.5/dist/aeriz-wysiwyg.min.js"></script>
|
|
137
137
|
<!-- 2) 필요한 어댑터 -->
|
|
138
|
-
<script src="https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@1.0.
|
|
138
|
+
<script src="https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@1.0.5/dist/aeriz-wysiwyg-wc.min.js"></script>
|
|
139
139
|
|
|
140
140
|
<aeriz-editor theme="dark" placeholder="내용을 입력하세요"></aeriz-editor>
|
|
141
141
|
```
|
|
@@ -144,8 +144,8 @@ jQuery 는 jQuery 자체를 먼저 로드해야 자동 등록됩니다.
|
|
|
144
144
|
|
|
145
145
|
```html
|
|
146
146
|
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
|
|
147
|
-
<script src="https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@1.0.
|
|
148
|
-
<script src="https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@1.0.
|
|
147
|
+
<script src="https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@1.0.5/dist/aeriz-wysiwyg.min.js"></script>
|
|
148
|
+
<script src="https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@1.0.5/dist/aeriz-wysiwyg-jquery.min.js"></script>
|
|
149
149
|
<script>
|
|
150
150
|
$('#editor').aerizEditor({ value: '<p>안녕하세요</p>' });
|
|
151
151
|
</script>
|
|
@@ -162,8 +162,8 @@ React / Vue 어댑터는 IIFE 로 제공하지 않습니다. 소비자 앱의
|
|
|
162
162
|
{
|
|
163
163
|
"imports": {
|
|
164
164
|
"vue": "https://esm.sh/vue@3",
|
|
165
|
-
"@aeriz/wysiwyg": "https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@1.0.
|
|
166
|
-
"@aeriz/wysiwyg/vue": "https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@1.0.
|
|
165
|
+
"@aeriz/wysiwyg": "https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@1.0.5/dist/aeriz-wysiwyg.esm.min.js",
|
|
166
|
+
"@aeriz/wysiwyg/vue": "https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@1.0.5/dist/adapters/vue.js"
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
</script>
|
|
@@ -474,6 +474,30 @@ export default {
|
|
|
474
474
|
|
|
475
475
|
---
|
|
476
476
|
|
|
477
|
+
## 키보드 단축키
|
|
478
|
+
|
|
479
|
+
macOS 는 `Ctrl` 대신 `Cmd`. 전체 목록과 근거는
|
|
480
|
+
[SPEC.md §7](./SPEC.md#7-키보드-단축키--입력-규칙) 에 있습니다.
|
|
481
|
+
|
|
482
|
+
| 동작 | 단축키 |
|
|
483
|
+
| --- | --- |
|
|
484
|
+
| 되돌리기 / 다시 실행 | `Ctrl+Z` / `Ctrl+Shift+Z` · `Ctrl+Y` |
|
|
485
|
+
| 굵게 · 기울임 · 밑줄 · 취소선 | `Ctrl+B` · `Ctrl+I` · `Ctrl+U` · `Ctrl+Shift+X` |
|
|
486
|
+
| **본문**으로 | `Ctrl+Alt+0` |
|
|
487
|
+
| 제목 1~6 | `Ctrl+Alt+1` ~ `Ctrl+Alt+6` |
|
|
488
|
+
| 번호 목록 · 글머리 목록 · 체크리스트 | `Ctrl+Alt+7` · `Ctrl+Alt+8` · `Ctrl+Alt+T` |
|
|
489
|
+
| 인용구 · 코드 블록 | `Ctrl+Alt+9` · `Ctrl+Alt+C` |
|
|
490
|
+
| 블록 이동 / 삭제 | `Ctrl+Shift+↑` `Ctrl+Shift+↓` / `Ctrl+Shift+D` |
|
|
491
|
+
| 표: 다음 / 이전 셀 | `Tab` / `Shift+Tab` (마지막 셀에서 `Tab` → 새 행) |
|
|
492
|
+
| 목록: 들여쓰기 / 내어쓰기 | `Tab` / `Shift+Tab` |
|
|
493
|
+
|
|
494
|
+
**마크다운처럼 입력해도 됩니다.** 블록 맨 앞에서 `# ` `- ` `1. ` `> ` `` ``` ``
|
|
495
|
+
`---` `- [ ] ` 를 치면 그 자리에서 유형이 바뀝니다.
|
|
496
|
+
|
|
497
|
+
> 새로 만들어지는 블록의 기본 유형은 언제나 **본문**입니다. 제목 끝에서
|
|
498
|
+
> `Enter` 를 눌러도 제목이 복제되지 않고 본문이 이어지며, 빈 제목·인용구·
|
|
499
|
+
> 코드 블록에서 `Backspace` 를 누르면 본문으로 돌아옵니다.
|
|
500
|
+
|
|
477
501
|
## 서버 sanitizer 와 함께 쓰기
|
|
478
502
|
|
|
479
503
|
`getHTML()` 은 기본적으로 테마 색을 인라인 `style` 에 베이크합니다 —
|
package/dist/adapters/shared.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("@aeriz/wysiwyg");function v(a){const e=document.createElement("div");e.innerHTML=a,f.normalizeContent(e);const t=new f.BlockIdRegistry;return f.assignMissingIds(e,t),f.serializeBlocks(f.listBlocks(e,o=>t.ensure(o)))}function T(a,e,t){const o={element:a,onChange:t},n=e.value??e.initialHTML;return n!==void 0&&(o.initialHTML=n),e.placeholder!==void 0&&(o.placeholder=e.placeholder),e.toolbar!==void 0&&(o.toolbar=e.toolbar),e.theme!==void 0&&(o.theme=e.theme),e.locale!==void 0&&(o.locale=e.locale),e.htmlStyles!==void 0&&(o.htmlStyles=e.htmlStyles),e.onImageUpload!==void 0&&(o.onImageUpload=e.onImageUpload),e.imageUploadUrl!==void 0&&(o.imageUploadUrl=e.imageUploadUrl),e.onFileUpload!==void 0&&(o.onFileUpload=e.onFileUpload),e.fileUploadUrl!==void 0&&(o.fileUploadUrl=e.fileUploadUrl),o}function w(a,e){return a===e?!0:a===!1||e===!1||a===void 0||e===void 0||a.sticky!==e.sticky||a.items.length!==e.items.length?!1:a.items.every((t,o)=>t===e.items[o])}function M(a,e){let t=e,o="",n=!1,d=!1;const m=l=>{var s;o=l,!n&&((s=t.onChange)==null||s.call(t,l))};let i,c=null,r;const S=l=>{l.onImageUpload===void 0?delete r.onImageUpload:r.onImageUpload=l.onImageUpload,l.imageUploadUrl===void 0?delete r.imageUploadUrl:r.imageUploadUrl=l.imageUploadUrl,l.onFileUpload===void 0?delete r.onFileUpload:r.onFileUpload=l.onFileUpload,l.fileUploadUrl===void 0?delete r.fileUploadUrl:r.fileUploadUrl=l.fileUploadUrl,l.htmlStyles===void 0?delete r.htmlStyles:r.htmlStyles=l.htmlStyles},u=(l,s)=>{var y;const h=s!==void 0?{...l,value:s}:l;r=T(a,h,m),i=new f.AerizEditor(r),o=i.getHTML(),c=i.onStateChange(k=>{var g;return(g=t.onStateChange)==null?void 0:g.call(t,k)}),(y=t.onReady)==null||y.call(t,i)},U=()=>{var l;(l=t.onDestroy)==null||l.call(t,i),c==null||c(),c=null,i.destroy()};return u(t),{get editor(){return i},update(l){if(d)return;const s=t;if(t=l,l.locale!==s.locale||!w(l.toolbar,s.toolbar)){const h=l.value??i.getHTML();U(),u(l,h);return}if(S(l),l.theme!==s.theme&&l.theme!==void 0&&i.setTheme(l.theme),l.placeholder!==s.placeholder&&(l.placeholder===void 0?delete i.content.dataset.placeholder:i.content.dataset.placeholder=l.placeholder),l.value!==void 0&&l.value!==o&&l.value!==i.getHTML()){n=!0;try{i.setHTML(l.value)}finally{n=!1}o=l.value}},destroy(){d||(d=!0,U())}}}function L(a,e){const t={element:a},o=e.blocks??(e.html!==void 0?v(e.html):void 0);return o!==void 0&&(t.initialBlocks=o),e.theme!==void 0&&(t.theme=e.theme),e.htmlStyles!==void 0&&(t.htmlStyles=e.htmlStyles),t}function C(a,e){var m;let t=e,o=!1;const n=L(a,e),d=new f.AerizViewer(n);return(m=t.onReady)==null||m.call(t,d),{viewer:d,update(i){if(o)return;const c=t;t=i,i.theme!==c.theme&&i.theme!==void 0&&d.setTheme(i.theme),i.htmlStyles===void 0?delete n.htmlStyles:n.htmlStyles=i.htmlStyles,i.blocks!==void 0?i.blocks!==c.blocks&&d.setBlocks(i.blocks):i.html!==void 0&&i.html!==c.html&&i.html!==d.getHTML()&&d.setBlocks(v(i.html))},destroy(){var i;o||(o=!0,(i=t.onDestroy)==null||i.call(t,d),d.destroy())}}}exports.createEditorController=M;exports.createViewerController=C;exports.htmlToBlocks=v;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("@aeriz/wysiwyg");function v(a){const e=document.createElement("div");e.innerHTML=a,f.normalizeContent(e,{writableTail:!1});const t=new f.BlockIdRegistry;return f.assignMissingIds(e,t),f.serializeBlocks(f.listBlocks(e,o=>t.ensure(o)))}function T(a,e,t){const o={element:a,onChange:t},n=e.value??e.initialHTML;return n!==void 0&&(o.initialHTML=n),e.placeholder!==void 0&&(o.placeholder=e.placeholder),e.toolbar!==void 0&&(o.toolbar=e.toolbar),e.theme!==void 0&&(o.theme=e.theme),e.locale!==void 0&&(o.locale=e.locale),e.htmlStyles!==void 0&&(o.htmlStyles=e.htmlStyles),e.onImageUpload!==void 0&&(o.onImageUpload=e.onImageUpload),e.imageUploadUrl!==void 0&&(o.imageUploadUrl=e.imageUploadUrl),e.onFileUpload!==void 0&&(o.onFileUpload=e.onFileUpload),e.fileUploadUrl!==void 0&&(o.fileUploadUrl=e.fileUploadUrl),o}function w(a,e){return a===e?!0:a===!1||e===!1||a===void 0||e===void 0||a.sticky!==e.sticky||a.items.length!==e.items.length?!1:a.items.every((t,o)=>t===e.items[o])}function M(a,e){let t=e,o="",n=!1,d=!1;const m=l=>{var s;o=l,!n&&((s=t.onChange)==null||s.call(t,l))};let i,c=null,r;const S=l=>{l.onImageUpload===void 0?delete r.onImageUpload:r.onImageUpload=l.onImageUpload,l.imageUploadUrl===void 0?delete r.imageUploadUrl:r.imageUploadUrl=l.imageUploadUrl,l.onFileUpload===void 0?delete r.onFileUpload:r.onFileUpload=l.onFileUpload,l.fileUploadUrl===void 0?delete r.fileUploadUrl:r.fileUploadUrl=l.fileUploadUrl,l.htmlStyles===void 0?delete r.htmlStyles:r.htmlStyles=l.htmlStyles},u=(l,s)=>{var y;const h=s!==void 0?{...l,value:s}:l;r=T(a,h,m),i=new f.AerizEditor(r),o=i.getHTML(),c=i.onStateChange(k=>{var g;return(g=t.onStateChange)==null?void 0:g.call(t,k)}),(y=t.onReady)==null||y.call(t,i)},U=()=>{var l;(l=t.onDestroy)==null||l.call(t,i),c==null||c(),c=null,i.destroy()};return u(t),{get editor(){return i},update(l){if(d)return;const s=t;if(t=l,l.locale!==s.locale||!w(l.toolbar,s.toolbar)){const h=l.value??i.getHTML();U(),u(l,h);return}if(S(l),l.theme!==s.theme&&l.theme!==void 0&&i.setTheme(l.theme),l.placeholder!==s.placeholder&&(l.placeholder===void 0?delete i.content.dataset.placeholder:i.content.dataset.placeholder=l.placeholder),l.value!==void 0&&l.value!==o&&l.value!==i.getHTML()){n=!0;try{i.setHTML(l.value)}finally{n=!1}o=l.value}},destroy(){d||(d=!0,U())}}}function L(a,e){const t={element:a},o=e.blocks??(e.html!==void 0?v(e.html):void 0);return o!==void 0&&(t.initialBlocks=o),e.theme!==void 0&&(t.theme=e.theme),e.htmlStyles!==void 0&&(t.htmlStyles=e.htmlStyles),t}function C(a,e){var m;let t=e,o=!1;const n=L(a,e),d=new f.AerizViewer(n);return(m=t.onReady)==null||m.call(t,d),{viewer:d,update(i){if(o)return;const c=t;t=i,i.theme!==c.theme&&i.theme!==void 0&&d.setTheme(i.theme),i.htmlStyles===void 0?delete n.htmlStyles:n.htmlStyles=i.htmlStyles,i.blocks!==void 0?i.blocks!==c.blocks&&d.setBlocks(i.blocks):i.html!==void 0&&i.html!==c.html&&i.html!==d.getHTML()&&d.setBlocks(v(i.html))},destroy(){var i;o||(o=!0,(i=t.onDestroy)==null||i.call(t,d),d.destroy())}}}exports.createEditorController=M;exports.createViewerController=C;exports.htmlToBlocks=v;
|
package/dist/adapters/shared.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AerizViewer as k, AerizEditor as T, normalizeContent as L, BlockIdRegistry as M, assignMissingIds as
|
|
1
|
+
import { AerizViewer as k, AerizEditor as T, normalizeContent as L, BlockIdRegistry as M, assignMissingIds as w, serializeBlocks as H, listBlocks as I } from "@aeriz/wysiwyg";
|
|
2
2
|
function y(a) {
|
|
3
3
|
const e = document.createElement("div");
|
|
4
|
-
e.innerHTML = a, L(e);
|
|
4
|
+
e.innerHTML = a, L(e, { writableTail: !1 });
|
|
5
5
|
const t = new M();
|
|
6
|
-
return
|
|
6
|
+
return w(e, t), H(I(e, (o) => t.ensure(o)));
|
|
7
7
|
}
|
|
8
8
|
function B(a, e, t) {
|
|
9
9
|
const o = { element: a, onChange: t }, n = e.value ?? e.initialHTML;
|
|
@@ -14,23 +14,23 @@ function C(a, e) {
|
|
|
14
14
|
}
|
|
15
15
|
function z(a, e) {
|
|
16
16
|
let t = e, o = "", n = !1, d = !1;
|
|
17
|
-
const
|
|
17
|
+
const c = (l) => {
|
|
18
18
|
var s;
|
|
19
19
|
o = l, !n && ((s = t.onChange) == null || s.call(t, l));
|
|
20
20
|
};
|
|
21
|
-
let i,
|
|
21
|
+
let i, f = null, r;
|
|
22
22
|
const g = (l) => {
|
|
23
23
|
l.onImageUpload === void 0 ? delete r.onImageUpload : r.onImageUpload = l.onImageUpload, l.imageUploadUrl === void 0 ? delete r.imageUploadUrl : r.imageUploadUrl = l.imageUploadUrl, l.onFileUpload === void 0 ? delete r.onFileUpload : r.onFileUpload = l.onFileUpload, l.fileUploadUrl === void 0 ? delete r.fileUploadUrl : r.fileUploadUrl = l.fileUploadUrl, l.htmlStyles === void 0 ? delete r.htmlStyles : r.htmlStyles = l.htmlStyles;
|
|
24
24
|
}, h = (l, s) => {
|
|
25
25
|
var U;
|
|
26
26
|
const m = s !== void 0 ? { ...l, value: s } : l;
|
|
27
|
-
r = B(a, m,
|
|
27
|
+
r = B(a, m, c), i = new T(r), o = i.getHTML(), f = i.onStateChange((S) => {
|
|
28
28
|
var u;
|
|
29
29
|
return (u = t.onStateChange) == null ? void 0 : u.call(t, S);
|
|
30
30
|
}), (U = t.onReady) == null || U.call(t, i);
|
|
31
31
|
}, v = () => {
|
|
32
32
|
var l;
|
|
33
|
-
(l = t.onDestroy) == null || l.call(t, i),
|
|
33
|
+
(l = t.onDestroy) == null || l.call(t, i), f == null || f(), f = null, i.destroy();
|
|
34
34
|
};
|
|
35
35
|
return h(t), {
|
|
36
36
|
get editor() {
|
|
@@ -64,15 +64,15 @@ function F(a, e) {
|
|
|
64
64
|
return o !== void 0 && (t.initialBlocks = o), e.theme !== void 0 && (t.theme = e.theme), e.htmlStyles !== void 0 && (t.htmlStyles = e.htmlStyles), t;
|
|
65
65
|
}
|
|
66
66
|
function O(a, e) {
|
|
67
|
-
var
|
|
67
|
+
var c;
|
|
68
68
|
let t = e, o = !1;
|
|
69
69
|
const n = F(a, e), d = new k(n);
|
|
70
|
-
return (
|
|
70
|
+
return (c = t.onReady) == null || c.call(t, d), {
|
|
71
71
|
viewer: d,
|
|
72
72
|
update(i) {
|
|
73
73
|
if (o) return;
|
|
74
|
-
const
|
|
75
|
-
t = i, i.theme !==
|
|
74
|
+
const f = t;
|
|
75
|
+
t = i, i.theme !== f.theme && i.theme !== void 0 && d.setTheme(i.theme), i.htmlStyles === void 0 ? delete n.htmlStyles : n.htmlStyles = i.htmlStyles, i.blocks !== void 0 ? i.blocks !== f.blocks && d.setBlocks(i.blocks) : i.html !== void 0 && i.html !== f.html && i.html !== d.getHTML() && d.setBlocks(y(i.html));
|
|
76
76
|
},
|
|
77
77
|
destroy() {
|
|
78
78
|
var i;
|
|
@@ -3,7 +3,7 @@ var AerizWysiwygAdapter = function(exports, wysiwyg) {
|
|
|
3
3
|
function htmlToBlocks(html) {
|
|
4
4
|
const scratch = document.createElement("div");
|
|
5
5
|
scratch.innerHTML = html;
|
|
6
|
-
wysiwyg.normalizeContent(scratch);
|
|
6
|
+
wysiwyg.normalizeContent(scratch, { writableTail: false });
|
|
7
7
|
const ids = new wysiwyg.BlockIdRegistry();
|
|
8
8
|
wysiwyg.assignMissingIds(scratch, ids);
|
|
9
9
|
return wysiwyg.serializeBlocks(wysiwyg.listBlocks(scratch, (el) => ids.ensure(el)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var AerizWysiwygAdapter=function(m,s){"use strict";function v(a){const e=document.createElement("div");e.innerHTML=a,s.normalizeContent(e);const t=new s.BlockIdRegistry;return s.assignMissingIds(e,t),s.serializeBlocks(s.listBlocks(e,o=>t.ensure(o)))}function k(a,e,t){const o={element:a,onChange:t},n=e.value??e.initialHTML;return n!==void 0&&(o.initialHTML=n),e.placeholder!==void 0&&(o.placeholder=e.placeholder),e.toolbar!==void 0&&(o.toolbar=e.toolbar),e.theme!==void 0&&(o.theme=e.theme),e.locale!==void 0&&(o.locale=e.locale),e.htmlStyles!==void 0&&(o.htmlStyles=e.htmlStyles),e.onImageUpload!==void 0&&(o.onImageUpload=e.onImageUpload),e.imageUploadUrl!==void 0&&(o.imageUploadUrl=e.imageUploadUrl),e.onFileUpload!==void 0&&(o.onFileUpload=e.onFileUpload),e.fileUploadUrl!==void 0&&(o.fileUploadUrl=e.fileUploadUrl),o}function T(a,e){return a===e?!0:a===!1||e===!1||a===void 0||e===void 0||a.sticky!==e.sticky||a.items.length!==e.items.length?!1:a.items.every((t,o)=>t===e.items[o])}function M(a,e){let t=e,o="",n=!1,d=!1;const h=l=>{var c;o=l,!n&&((c=t.onChange)==null||c.call(t,l))};let i,f=null,r;const H=l=>{l.onImageUpload===void 0?delete r.onImageUpload:r.onImageUpload=l.onImageUpload,l.imageUploadUrl===void 0?delete r.imageUploadUrl:r.imageUploadUrl=l.imageUploadUrl,l.onFileUpload===void 0?delete r.onFileUpload:r.onFileUpload=l.onFileUpload,l.fileUploadUrl===void 0?delete r.fileUploadUrl:r.fileUploadUrl=l.fileUploadUrl,l.htmlStyles===void 0?delete r.htmlStyles:r.htmlStyles=l.htmlStyles},U=(l,c)=>{var y;const u=c!==void 0?{...l,value:c}:l;r=k(a,u,h),i=new s.AerizEditor(r),o=i.getHTML(),f=i.onStateChange(I=>{var S;return(S=t.onStateChange)==null?void 0:S.call(t,I)}),(y=t.onReady)==null||y.call(t,i)},g=()=>{var l;(l=t.onDestroy)==null||l.call(t,i),f==null||f(),f=null,i.destroy()};return U(t),{get editor(){return i},update(l){if(d)return;const c=t;if(t=l,l.locale!==c.locale||!T(l.toolbar,c.toolbar)){const u=l.value??i.getHTML();g(),U(l,u);return}if(H(l),l.theme!==c.theme&&l.theme!==void 0&&i.setTheme(l.theme),l.placeholder!==c.placeholder&&(l.placeholder===void 0?delete i.content.dataset.placeholder:i.content.dataset.placeholder=l.placeholder),l.value!==void 0&&l.value!==o&&l.value!==i.getHTML()){n=!0;try{i.setHTML(l.value)}finally{n=!1}o=l.value}},destroy(){d||(d=!0,g())}}}function L(a,e){const t={element:a},o=e.blocks??(e.html!==void 0?v(e.html):void 0);return o!==void 0&&(t.initialBlocks=o),e.theme!==void 0&&(t.theme=e.theme),e.htmlStyles!==void 0&&(t.htmlStyles=e.htmlStyles),t}function C(a,e){var h;let t=e,o=!1;const n=L(a,e),d=new s.AerizViewer(n);return(h=t.onReady)==null||h.call(t,d),{viewer:d,update(i){if(o)return;const f=t;t=i,i.theme!==f.theme&&i.theme!==void 0&&d.setTheme(i.theme),i.htmlStyles===void 0?delete n.htmlStyles:n.htmlStyles=i.htmlStyles,i.blocks!==void 0?i.blocks!==f.blocks&&d.setBlocks(i.blocks):i.html!==void 0&&i.html!==f.html&&i.html!==d.getHTML()&&d.setBlocks(v(i.html))},destroy(){var i;o||(o=!0,(i=t.onDestroy)==null||i.call(t,d),d.destroy())}}}return m.createEditorController=M,m.createViewerController=C,m.htmlToBlocks=v,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"}),m}({},AerizWysiwyg);
|
|
1
|
+
var AerizWysiwygAdapter=function(m,s){"use strict";function v(a){const e=document.createElement("div");e.innerHTML=a,s.normalizeContent(e,{writableTail:!1});const t=new s.BlockIdRegistry;return s.assignMissingIds(e,t),s.serializeBlocks(s.listBlocks(e,o=>t.ensure(o)))}function k(a,e,t){const o={element:a,onChange:t},n=e.value??e.initialHTML;return n!==void 0&&(o.initialHTML=n),e.placeholder!==void 0&&(o.placeholder=e.placeholder),e.toolbar!==void 0&&(o.toolbar=e.toolbar),e.theme!==void 0&&(o.theme=e.theme),e.locale!==void 0&&(o.locale=e.locale),e.htmlStyles!==void 0&&(o.htmlStyles=e.htmlStyles),e.onImageUpload!==void 0&&(o.onImageUpload=e.onImageUpload),e.imageUploadUrl!==void 0&&(o.imageUploadUrl=e.imageUploadUrl),e.onFileUpload!==void 0&&(o.onFileUpload=e.onFileUpload),e.fileUploadUrl!==void 0&&(o.fileUploadUrl=e.fileUploadUrl),o}function T(a,e){return a===e?!0:a===!1||e===!1||a===void 0||e===void 0||a.sticky!==e.sticky||a.items.length!==e.items.length?!1:a.items.every((t,o)=>t===e.items[o])}function M(a,e){let t=e,o="",n=!1,d=!1;const h=l=>{var c;o=l,!n&&((c=t.onChange)==null||c.call(t,l))};let i,f=null,r;const H=l=>{l.onImageUpload===void 0?delete r.onImageUpload:r.onImageUpload=l.onImageUpload,l.imageUploadUrl===void 0?delete r.imageUploadUrl:r.imageUploadUrl=l.imageUploadUrl,l.onFileUpload===void 0?delete r.onFileUpload:r.onFileUpload=l.onFileUpload,l.fileUploadUrl===void 0?delete r.fileUploadUrl:r.fileUploadUrl=l.fileUploadUrl,l.htmlStyles===void 0?delete r.htmlStyles:r.htmlStyles=l.htmlStyles},U=(l,c)=>{var y;const u=c!==void 0?{...l,value:c}:l;r=k(a,u,h),i=new s.AerizEditor(r),o=i.getHTML(),f=i.onStateChange(I=>{var S;return(S=t.onStateChange)==null?void 0:S.call(t,I)}),(y=t.onReady)==null||y.call(t,i)},g=()=>{var l;(l=t.onDestroy)==null||l.call(t,i),f==null||f(),f=null,i.destroy()};return U(t),{get editor(){return i},update(l){if(d)return;const c=t;if(t=l,l.locale!==c.locale||!T(l.toolbar,c.toolbar)){const u=l.value??i.getHTML();g(),U(l,u);return}if(H(l),l.theme!==c.theme&&l.theme!==void 0&&i.setTheme(l.theme),l.placeholder!==c.placeholder&&(l.placeholder===void 0?delete i.content.dataset.placeholder:i.content.dataset.placeholder=l.placeholder),l.value!==void 0&&l.value!==o&&l.value!==i.getHTML()){n=!0;try{i.setHTML(l.value)}finally{n=!1}o=l.value}},destroy(){d||(d=!0,g())}}}function L(a,e){const t={element:a},o=e.blocks??(e.html!==void 0?v(e.html):void 0);return o!==void 0&&(t.initialBlocks=o),e.theme!==void 0&&(t.theme=e.theme),e.htmlStyles!==void 0&&(t.htmlStyles=e.htmlStyles),t}function C(a,e){var h;let t=e,o=!1;const n=L(a,e),d=new s.AerizViewer(n);return(h=t.onReady)==null||h.call(t,d),{viewer:d,update(i){if(o)return;const f=t;t=i,i.theme!==f.theme&&i.theme!==void 0&&d.setTheme(i.theme),i.htmlStyles===void 0?delete n.htmlStyles:n.htmlStyles=i.htmlStyles,i.blocks!==void 0?i.blocks!==f.blocks&&d.setBlocks(i.blocks):i.html!==void 0&&i.html!==f.html&&i.html!==d.getHTML()&&d.setBlocks(v(i.html))},destroy(){var i;o||(o=!0,(i=t.onDestroy)==null||i.call(t,d),d.destroy())}}}return m.createEditorController=M,m.createViewerController=C,m.htmlToBlocks=v,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"}),m}({},AerizWysiwyg);
|
|
@@ -3,7 +3,7 @@ var AerizWysiwygJQuery = function(exports, wysiwyg) {
|
|
|
3
3
|
function htmlToBlocks(html) {
|
|
4
4
|
const scratch = document.createElement("div");
|
|
5
5
|
scratch.innerHTML = html;
|
|
6
|
-
wysiwyg.normalizeContent(scratch);
|
|
6
|
+
wysiwyg.normalizeContent(scratch, { writableTail: false });
|
|
7
7
|
const ids = new wysiwyg.BlockIdRegistry();
|
|
8
8
|
wysiwyg.assignMissingIds(scratch, ids);
|
|
9
9
|
return wysiwyg.serializeBlocks(wysiwyg.listBlocks(scratch, (el) => ids.ensure(el)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var AerizWysiwygJQuery=function(g,c){"use strict";function U(i){const e=document.createElement("div");e.innerHTML=i,c.normalizeContent(e);const t=new c.BlockIdRegistry;return c.assignMissingIds(e,t),c.serializeBlocks(c.listBlocks(e,o=>t.ensure(o)))}function z(i,e,t){const o={element:i,onChange:t},r=e.value??e.initialHTML;return r!==void 0&&(o.initialHTML=r),e.placeholder!==void 0&&(o.placeholder=e.placeholder),e.toolbar!==void 0&&(o.toolbar=e.toolbar),e.theme!==void 0&&(o.theme=e.theme),e.locale!==void 0&&(o.locale=e.locale),e.htmlStyles!==void 0&&(o.htmlStyles=e.htmlStyles),e.onImageUpload!==void 0&&(o.onImageUpload=e.onImageUpload),e.imageUploadUrl!==void 0&&(o.imageUploadUrl=e.imageUploadUrl),e.onFileUpload!==void 0&&(o.onFileUpload=e.onFileUpload),e.fileUploadUrl!==void 0&&(o.fileUploadUrl=e.fileUploadUrl),o}function L(i,e){return i===e?!0:i===!1||e===!1||i===void 0||e===void 0||i.sticky!==e.sticky||i.items.length!==e.items.length?!1:i.items.every((t,o)=>t===e.items[o])}function H(i,e){let t=e,o="",r=!1,d=!1;const s=a=>{var f;o=a,!r&&((f=t.onChange)==null||f.call(t,a))};let l,u=null,n;const Q=a=>{a.onImageUpload===void 0?delete n.onImageUpload:n.onImageUpload=a.onImageUpload,a.imageUploadUrl===void 0?delete n.imageUploadUrl:n.imageUploadUrl=a.imageUploadUrl,a.onFileUpload===void 0?delete n.onFileUpload:n.onFileUpload=a.onFileUpload,a.fileUploadUrl===void 0?delete n.fileUploadUrl:n.fileUploadUrl=a.fileUploadUrl,a.htmlStyles===void 0?delete n.htmlStyles:n.htmlStyles=a.htmlStyles},k=(a,f)=>{var S;const m=f!==void 0?{...a,value:f}:a;n=z(i,m,s),l=new c.AerizEditor(n),o=l.getHTML(),u=l.onStateChange(_=>{var w;return(w=t.onStateChange)==null?void 0:w.call(t,_)}),(S=t.onReady)==null||S.call(t,l)},M=()=>{var a;(a=t.onDestroy)==null||a.call(t,l),u==null||u(),u=null,l.destroy()};return k(t),{get editor(){return l},update(a){if(d)return;const f=t;if(t=a,a.locale!==f.locale||!L(a.toolbar,f.toolbar)){const m=a.value??l.getHTML();M(),k(a,m);return}if(Q(a),a.theme!==f.theme&&a.theme!==void 0&&l.setTheme(a.theme),a.placeholder!==f.placeholder&&(a.placeholder===void 0?delete l.content.dataset.placeholder:l.content.dataset.placeholder=a.placeholder),a.value!==void 0&&a.value!==o&&a.value!==l.getHTML()){r=!0;try{l.setHTML(a.value)}finally{r=!1}o=a.value}},destroy(){d||(d=!0,M())}}}function b(i,e){const t={element:i},o=e.blocks??(e.html!==void 0?U(e.html):void 0);return o!==void 0&&(t.initialBlocks=o),e.theme!==void 0&&(t.theme=e.theme),e.htmlStyles!==void 0&&(t.htmlStyles=e.htmlStyles),t}function B(i,e){var s;let t=e,o=!1;const r=b(i,e),d=new c.AerizViewer(r);return(s=t.onReady)==null||s.call(t,d),{viewer:d,update(l){if(o)return;const u=t;t=l,l.theme!==u.theme&&l.theme!==void 0&&d.setTheme(l.theme),l.htmlStyles===void 0?delete r.htmlStyles:r.htmlStyles=l.htmlStyles,l.blocks!==void 0?l.blocks!==u.blocks&&d.setBlocks(l.blocks):l.html!==void 0&&l.html!==u.html&&l.html!==d.getHTML()&&d.setBlocks(U(l.html))},destroy(){var l;o||(o=!0,(l=t.onDestroy)==null||l.call(t,d),d.destroy())}}}const h=new WeakMap,v=new WeakMap;function E(i,e,t){const o=i[0],r=o?h.get(o):void 0;switch(e){case"getHTML":return(r==null?void 0:r.editor.getHTML())??"";case"getBlocks":return(r==null?void 0:r.editor.serialize())??[];case"setHTML":return i.each((d,s)=>{var l;(l=h.get(s))==null||l.editor.setHTML(String(t[0]??""))}),i;case"update":return i.each((d,s)=>{var l;(l=h.get(s))==null||l.update(t[0]??{})}),i;case"focus":return r==null||r.editor.focus(),i;case"instance":return(r==null?void 0:r.editor)??null;case"destroy":return i.each((d,s)=>{const l=h.get(s);l&&(l.destroy(),h.delete(s))}),i;default:throw new Error(`aerizEditor: 알 수 없는 명령 "${e}"`)}}function I(i,e,t){const o=i[0],r=o?v.get(o):void 0;switch(e){case"getHTML":return(r==null?void 0:r.viewer.getHTML())??"";case"getBlocks":return(r==null?void 0:r.viewer.getBlocks())??[];case"update":return i.each((d,s)=>{var l;(l=v.get(s))==null||l.update(t[0]??{})}),i;case"instance":return(r==null?void 0:r.viewer)??null;case"destroy":return i.each((d,s)=>{const l=v.get(s);l&&(l.destroy(),v.delete(s))}),i;default:throw new Error(`aerizViewer: 알 수 없는 명령 "${e}"`)}}function A(i,...e){if(typeof i=="string")return E(this,i,e);const t=i??{};return this.each((o,r)=>{const d=h.get(r);if(d){d.update(t);return}h.set(r,H(r,t))}),this}function F(i,...e){if(typeof i=="string")return I(this,i,e);const t=i??{};return this.each((o,r)=>{const d=v.get(r);if(d){d.update(t);return}v.set(r,B(r,t))}),this}function y(i){if(!i||typeof i.fn!="object")throw new TypeError("registerAerizJQuery: jQuery 객체가 필요합니다.");i.fn.aerizEditor||(i.fn.aerizEditor=A),i.fn.aerizViewer||(i.fn.aerizViewer=F)}const T=globalThis.jQuery;return T&&y(T),g.registerAerizJQuery=y,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"}),g}({},AerizWysiwyg);
|
|
1
|
+
var AerizWysiwygJQuery=function(g,c){"use strict";function U(i){const e=document.createElement("div");e.innerHTML=i,c.normalizeContent(e,{writableTail:!1});const t=new c.BlockIdRegistry;return c.assignMissingIds(e,t),c.serializeBlocks(c.listBlocks(e,o=>t.ensure(o)))}function z(i,e,t){const o={element:i,onChange:t},r=e.value??e.initialHTML;return r!==void 0&&(o.initialHTML=r),e.placeholder!==void 0&&(o.placeholder=e.placeholder),e.toolbar!==void 0&&(o.toolbar=e.toolbar),e.theme!==void 0&&(o.theme=e.theme),e.locale!==void 0&&(o.locale=e.locale),e.htmlStyles!==void 0&&(o.htmlStyles=e.htmlStyles),e.onImageUpload!==void 0&&(o.onImageUpload=e.onImageUpload),e.imageUploadUrl!==void 0&&(o.imageUploadUrl=e.imageUploadUrl),e.onFileUpload!==void 0&&(o.onFileUpload=e.onFileUpload),e.fileUploadUrl!==void 0&&(o.fileUploadUrl=e.fileUploadUrl),o}function L(i,e){return i===e?!0:i===!1||e===!1||i===void 0||e===void 0||i.sticky!==e.sticky||i.items.length!==e.items.length?!1:i.items.every((t,o)=>t===e.items[o])}function H(i,e){let t=e,o="",r=!1,d=!1;const s=a=>{var f;o=a,!r&&((f=t.onChange)==null||f.call(t,a))};let l,u=null,n;const Q=a=>{a.onImageUpload===void 0?delete n.onImageUpload:n.onImageUpload=a.onImageUpload,a.imageUploadUrl===void 0?delete n.imageUploadUrl:n.imageUploadUrl=a.imageUploadUrl,a.onFileUpload===void 0?delete n.onFileUpload:n.onFileUpload=a.onFileUpload,a.fileUploadUrl===void 0?delete n.fileUploadUrl:n.fileUploadUrl=a.fileUploadUrl,a.htmlStyles===void 0?delete n.htmlStyles:n.htmlStyles=a.htmlStyles},k=(a,f)=>{var S;const m=f!==void 0?{...a,value:f}:a;n=z(i,m,s),l=new c.AerizEditor(n),o=l.getHTML(),u=l.onStateChange(_=>{var w;return(w=t.onStateChange)==null?void 0:w.call(t,_)}),(S=t.onReady)==null||S.call(t,l)},M=()=>{var a;(a=t.onDestroy)==null||a.call(t,l),u==null||u(),u=null,l.destroy()};return k(t),{get editor(){return l},update(a){if(d)return;const f=t;if(t=a,a.locale!==f.locale||!L(a.toolbar,f.toolbar)){const m=a.value??l.getHTML();M(),k(a,m);return}if(Q(a),a.theme!==f.theme&&a.theme!==void 0&&l.setTheme(a.theme),a.placeholder!==f.placeholder&&(a.placeholder===void 0?delete l.content.dataset.placeholder:l.content.dataset.placeholder=a.placeholder),a.value!==void 0&&a.value!==o&&a.value!==l.getHTML()){r=!0;try{l.setHTML(a.value)}finally{r=!1}o=a.value}},destroy(){d||(d=!0,M())}}}function b(i,e){const t={element:i},o=e.blocks??(e.html!==void 0?U(e.html):void 0);return o!==void 0&&(t.initialBlocks=o),e.theme!==void 0&&(t.theme=e.theme),e.htmlStyles!==void 0&&(t.htmlStyles=e.htmlStyles),t}function B(i,e){var s;let t=e,o=!1;const r=b(i,e),d=new c.AerizViewer(r);return(s=t.onReady)==null||s.call(t,d),{viewer:d,update(l){if(o)return;const u=t;t=l,l.theme!==u.theme&&l.theme!==void 0&&d.setTheme(l.theme),l.htmlStyles===void 0?delete r.htmlStyles:r.htmlStyles=l.htmlStyles,l.blocks!==void 0?l.blocks!==u.blocks&&d.setBlocks(l.blocks):l.html!==void 0&&l.html!==u.html&&l.html!==d.getHTML()&&d.setBlocks(U(l.html))},destroy(){var l;o||(o=!0,(l=t.onDestroy)==null||l.call(t,d),d.destroy())}}}const h=new WeakMap,v=new WeakMap;function E(i,e,t){const o=i[0],r=o?h.get(o):void 0;switch(e){case"getHTML":return(r==null?void 0:r.editor.getHTML())??"";case"getBlocks":return(r==null?void 0:r.editor.serialize())??[];case"setHTML":return i.each((d,s)=>{var l;(l=h.get(s))==null||l.editor.setHTML(String(t[0]??""))}),i;case"update":return i.each((d,s)=>{var l;(l=h.get(s))==null||l.update(t[0]??{})}),i;case"focus":return r==null||r.editor.focus(),i;case"instance":return(r==null?void 0:r.editor)??null;case"destroy":return i.each((d,s)=>{const l=h.get(s);l&&(l.destroy(),h.delete(s))}),i;default:throw new Error(`aerizEditor: 알 수 없는 명령 "${e}"`)}}function I(i,e,t){const o=i[0],r=o?v.get(o):void 0;switch(e){case"getHTML":return(r==null?void 0:r.viewer.getHTML())??"";case"getBlocks":return(r==null?void 0:r.viewer.getBlocks())??[];case"update":return i.each((d,s)=>{var l;(l=v.get(s))==null||l.update(t[0]??{})}),i;case"instance":return(r==null?void 0:r.viewer)??null;case"destroy":return i.each((d,s)=>{const l=v.get(s);l&&(l.destroy(),v.delete(s))}),i;default:throw new Error(`aerizViewer: 알 수 없는 명령 "${e}"`)}}function A(i,...e){if(typeof i=="string")return E(this,i,e);const t=i??{};return this.each((o,r)=>{const d=h.get(r);if(d){d.update(t);return}h.set(r,H(r,t))}),this}function F(i,...e){if(typeof i=="string")return I(this,i,e);const t=i??{};return this.each((o,r)=>{const d=v.get(r);if(d){d.update(t);return}v.set(r,B(r,t))}),this}function y(i){if(!i||typeof i.fn!="object")throw new TypeError("registerAerizJQuery: jQuery 객체가 필요합니다.");i.fn.aerizEditor||(i.fn.aerizEditor=A),i.fn.aerizViewer||(i.fn.aerizViewer=F)}const T=globalThis.jQuery;return T&&y(T),g.registerAerizJQuery=y,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"}),g}({},AerizWysiwyg);
|
package/dist/aeriz-wysiwyg-wc.js
CHANGED
|
@@ -6,7 +6,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
6
6
|
function htmlToBlocks(html) {
|
|
7
7
|
const scratch = document.createElement("div");
|
|
8
8
|
scratch.innerHTML = html;
|
|
9
|
-
wysiwyg.normalizeContent(scratch);
|
|
9
|
+
wysiwyg.normalizeContent(scratch, { writableTail: false });
|
|
10
10
|
const ids = new wysiwyg.BlockIdRegistry();
|
|
11
11
|
wysiwyg.assignMissingIds(scratch, ids);
|
|
12
12
|
return wysiwyg.serializeBlocks(wysiwyg.listBlocks(scratch, (el) => ids.ensure(el)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var AerizWysiwygWC=function(u,s){"use strict";var w=Object.defineProperty;var j=(u,s,m)=>s in u?w(u,s,{enumerable:!0,configurable:!0,writable:!0,value:m}):u[s]=m;var f=(u,s,m)=>j(u,typeof s!="symbol"?s+"":s,m);function m(o){const t=document.createElement("div");t.innerHTML=o,s.normalizeContent(t);const e=new s.BlockIdRegistry;return s.assignMissingIds(t,e),s.serializeBlocks(s.listBlocks(t,l=>e.ensure(l)))}function C(o,t,e){const l={element:o,onChange:e},r=t.value??t.initialHTML;return r!==void 0&&(l.initialHTML=r),t.placeholder!==void 0&&(l.placeholder=t.placeholder),t.toolbar!==void 0&&(l.toolbar=t.toolbar),t.theme!==void 0&&(l.theme=t.theme),t.locale!==void 0&&(l.locale=t.locale),t.htmlStyles!==void 0&&(l.htmlStyles=t.htmlStyles),t.onImageUpload!==void 0&&(l.onImageUpload=t.onImageUpload),t.imageUploadUrl!==void 0&&(l.imageUploadUrl=t.imageUploadUrl),t.onFileUpload!==void 0&&(l.onFileUpload=t.onFileUpload),t.fileUploadUrl!==void 0&&(l.fileUploadUrl=t.fileUploadUrl),l}function V(o,t){return o===t?!0:o===!1||t===!1||o===void 0||t===void 0||o.sticky!==t.sticky||o.items.length!==t.items.length?!1:o.items.every((e,l)=>e===t.items[l])}function L(o,t){let e=t,l="",r=!1,a=!1;const v=i=>{var h;l=i,!r&&((h=e.onChange)==null||h.call(e,i))};let n,c=null,d;const g=i=>{i.onImageUpload===void 0?delete d.onImageUpload:d.onImageUpload=i.onImageUpload,i.imageUploadUrl===void 0?delete d.imageUploadUrl:d.imageUploadUrl=i.imageUploadUrl,i.onFileUpload===void 0?delete d.onFileUpload:d.onFileUpload=i.onFileUpload,i.fileUploadUrl===void 0?delete d.fileUploadUrl:d.fileUploadUrl=i.fileUploadUrl,i.htmlStyles===void 0?delete d.htmlStyles:d.htmlStyles=i.htmlStyles},E=(i,h)=>{var A;const U=h!==void 0?{...i,value:h}:i;d=C(o,U,v),n=new s.AerizEditor(d),l=n.getHTML(),c=n.onStateChange(O=>{var S;return(S=e.onStateChange)==null?void 0:S.call(e,O)}),(A=e.onReady)==null||A.call(e,n)},T=()=>{var i;(i=e.onDestroy)==null||i.call(e,n),c==null||c(),c=null,n.destroy()};return E(e),{get editor(){return n},update(i){if(a)return;const h=e;if(e=i,i.locale!==h.locale||!V(i.toolbar,h.toolbar)){const U=i.value??n.getHTML();T(),E(i,U);return}if(g(i),i.theme!==h.theme&&i.theme!==void 0&&n.setTheme(i.theme),i.placeholder!==h.placeholder&&(i.placeholder===void 0?delete n.content.dataset.placeholder:n.content.dataset.placeholder=i.placeholder),i.value!==void 0&&i.value!==l&&i.value!==n.getHTML()){r=!0;try{n.setHTML(i.value)}finally{r=!1}l=i.value}},destroy(){a||(a=!0,T())}}}function M(o,t){const e={element:o},l=t.blocks??(t.html!==void 0?m(t.html):void 0);return l!==void 0&&(e.initialBlocks=l),t.theme!==void 0&&(e.theme=t.theme),t.htmlStyles!==void 0&&(e.htmlStyles=t.htmlStyles),e}function z(o,t){var v;let e=t,l=!1;const r=M(o,t),a=new s.AerizViewer(r);return(v=e.onReady)==null||v.call(e,a),{viewer:a,update(n){if(l)return;const c=e;e=n,n.theme!==c.theme&&n.theme!==void 0&&a.setTheme(n.theme),n.htmlStyles===void 0?delete r.htmlStyles:r.htmlStyles=n.htmlStyles,n.blocks!==void 0?n.blocks!==c.blocks&&a.setBlocks(n.blocks):n.html!==void 0&&n.html!==c.html&&n.html!==a.getHTML()&&a.setBlocks(m(n.html))},destroy(){var n;l||(l=!0,(n=e.onDestroy)==null||n.call(e,a),a.destroy())}}}const F=["light","dark"],H=["en","ko","ja","zh"];function p(o){return o!==null&&F.includes(o)?o:void 0}function I(o){return o!==null&&H.includes(o)?o:void 0}function B(o){if(o===null)return;const t=o.trim();if(t==="")return;if(t==="false"||t==="none")return!1;if(t.startsWith("{")){try{const l=JSON.parse(t);if(l&&typeof l=="object"&&Array.isArray(l.items))return l}catch{}return}const e=t.split(/[\s,]+/).filter(l=>l.length>0);return e.length>0?{items:e}:void 0}function P(o){const t=o.attachInternals;if(typeof t!="function")return null;try{const e=t.call(o);return typeof e=="object"&&e!==null&&typeof e.setFormValue=="function"?e:null}catch{return null}}class b extends HTMLElement{constructor(){super();f(this,"onImageUpload");f(this,"onFileUpload");f(this,"controller",null);f(this,"internals",null);f(this,"pendingValue");f(this,"currentHTML","");this.internals=P(this)}static get observedAttributes(){return["value","placeholder","theme","locale","toolbar","html-styles","image-upload-url","file-upload-url"]}get value(){return this.controller?this.controller.editor.getHTML():this.pendingValue??this.currentHTML}set value(e){this.pendingValue=e,this.applyProps()}get editor(){var e;return((e=this.controller)==null?void 0:e.editor)??null}getBlocks(){var e;return((e=this.controller)==null?void 0:e.editor.serialize())??[]}focus(){var e;(e=this.controller)==null||e.editor.focus()}connectedCallback(){if(!this.controller){if(this.pendingValue===void 0){const e=this.getAttribute("value");e!==null&&(this.pendingValue=e)}this.controller=L(this,this.buildProps()),this.pendingValue=void 0,this.syncFormValue(this.controller.editor.getHTML()),this.dispatchEvent(new CustomEvent("aeriz-ready",{detail:{editor:this.controller.editor},bubbles:!1}))}}disconnectedCallback(){var e;(e=this.controller)==null||e.destroy(),this.controller=null}attributeChangedCallback(e,l,r){e==="value"&&(this.pendingValue=r??""),this.applyProps()}applyProps(){this.controller&&(this.controller.update(this.buildProps()),this.pendingValue=void 0)}buildProps(){const e={onChange:g=>{this.pendingValue=void 0,this.syncFormValue(g),this.dispatchEvent(new CustomEvent("input",{detail:{html:g},bubbles:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{html:g},bubbles:!0}))}};this.pendingValue!==void 0&&(e.value=this.pendingValue);const l=this.getAttribute("placeholder");l!==null&&(e.placeholder=l);const r=p(this.getAttribute("theme"));r!==void 0&&(e.theme=r);const a=I(this.getAttribute("locale"));a!==void 0&&(e.locale=a);const v=B(this.getAttribute("toolbar"));v!==void 0&&(e.toolbar=v);const n=this.getAttribute("html-styles");(n==="class"||n==="inline")&&(e.htmlStyles=n);const c=this.getAttribute("image-upload-url");c!==null&&(e.imageUploadUrl=c);const d=this.getAttribute("file-upload-url");return d!==null&&(e.fileUploadUrl=d),this.onImageUpload&&(e.onImageUpload=this.onImageUpload),this.onFileUpload&&(e.onFileUpload=this.onFileUpload),e}syncFormValue(e){var l;this.currentHTML=e,(l=this.internals)==null||l.setFormValue(e)}}f(b,"formAssociated",!0);class y extends HTMLElement{constructor(){super(...arguments);f(this,"controller",null);f(this,"pendingBlocks")}static get observedAttributes(){return["html","theme"]}get blocks(){var e;return((e=this.controller)==null?void 0:e.viewer.getBlocks())??this.pendingBlocks??[]}set blocks(e){var l;this.pendingBlocks=e,(l=this.controller)==null||l.update(this.buildProps())}get viewer(){var e;return((e=this.controller)==null?void 0:e.viewer)??null}connectedCallback(){this.controller||(this.controller=z(this,this.buildProps()),this.dispatchEvent(new CustomEvent("aeriz-ready",{detail:{viewer:this.controller.viewer},bubbles:!1})))}disconnectedCallback(){var e;(e=this.controller)==null||e.destroy(),this.controller=null}attributeChangedCallback(){var e;(e=this.controller)==null||e.update(this.buildProps())}buildProps(){const e={};this.pendingBlocks!==void 0&&(e.blocks=this.pendingBlocks);const l=this.getAttribute("html");l!==null&&(e.html=l);const r=p(this.getAttribute("theme"));return r!==void 0&&(e.theme=r),e}}function k(o="aeriz"){if(typeof customElements>"u")return;const t=`${o}-editor`,e=`${o}-viewer`;customElements.get(t)||customElements.define(t,b),customElements.get(e)||customElements.define(e,y)}return k(),u.AerizEditorElement=b,u.AerizViewerElement=y,u.defineAerizElements=k,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}),u}({},AerizWysiwyg);
|
|
1
|
+
var AerizWysiwygWC=function(u,s){"use strict";var w=Object.defineProperty;var j=(u,s,m)=>s in u?w(u,s,{enumerable:!0,configurable:!0,writable:!0,value:m}):u[s]=m;var f=(u,s,m)=>j(u,typeof s!="symbol"?s+"":s,m);function m(o){const t=document.createElement("div");t.innerHTML=o,s.normalizeContent(t,{writableTail:!1});const e=new s.BlockIdRegistry;return s.assignMissingIds(t,e),s.serializeBlocks(s.listBlocks(t,l=>e.ensure(l)))}function C(o,t,e){const l={element:o,onChange:e},r=t.value??t.initialHTML;return r!==void 0&&(l.initialHTML=r),t.placeholder!==void 0&&(l.placeholder=t.placeholder),t.toolbar!==void 0&&(l.toolbar=t.toolbar),t.theme!==void 0&&(l.theme=t.theme),t.locale!==void 0&&(l.locale=t.locale),t.htmlStyles!==void 0&&(l.htmlStyles=t.htmlStyles),t.onImageUpload!==void 0&&(l.onImageUpload=t.onImageUpload),t.imageUploadUrl!==void 0&&(l.imageUploadUrl=t.imageUploadUrl),t.onFileUpload!==void 0&&(l.onFileUpload=t.onFileUpload),t.fileUploadUrl!==void 0&&(l.fileUploadUrl=t.fileUploadUrl),l}function V(o,t){return o===t?!0:o===!1||t===!1||o===void 0||t===void 0||o.sticky!==t.sticky||o.items.length!==t.items.length?!1:o.items.every((e,l)=>e===t.items[l])}function L(o,t){let e=t,l="",r=!1,a=!1;const v=i=>{var h;l=i,!r&&((h=e.onChange)==null||h.call(e,i))};let n,c=null,d;const g=i=>{i.onImageUpload===void 0?delete d.onImageUpload:d.onImageUpload=i.onImageUpload,i.imageUploadUrl===void 0?delete d.imageUploadUrl:d.imageUploadUrl=i.imageUploadUrl,i.onFileUpload===void 0?delete d.onFileUpload:d.onFileUpload=i.onFileUpload,i.fileUploadUrl===void 0?delete d.fileUploadUrl:d.fileUploadUrl=i.fileUploadUrl,i.htmlStyles===void 0?delete d.htmlStyles:d.htmlStyles=i.htmlStyles},E=(i,h)=>{var A;const U=h!==void 0?{...i,value:h}:i;d=C(o,U,v),n=new s.AerizEditor(d),l=n.getHTML(),c=n.onStateChange(O=>{var S;return(S=e.onStateChange)==null?void 0:S.call(e,O)}),(A=e.onReady)==null||A.call(e,n)},T=()=>{var i;(i=e.onDestroy)==null||i.call(e,n),c==null||c(),c=null,n.destroy()};return E(e),{get editor(){return n},update(i){if(a)return;const h=e;if(e=i,i.locale!==h.locale||!V(i.toolbar,h.toolbar)){const U=i.value??n.getHTML();T(),E(i,U);return}if(g(i),i.theme!==h.theme&&i.theme!==void 0&&n.setTheme(i.theme),i.placeholder!==h.placeholder&&(i.placeholder===void 0?delete n.content.dataset.placeholder:n.content.dataset.placeholder=i.placeholder),i.value!==void 0&&i.value!==l&&i.value!==n.getHTML()){r=!0;try{n.setHTML(i.value)}finally{r=!1}l=i.value}},destroy(){a||(a=!0,T())}}}function M(o,t){const e={element:o},l=t.blocks??(t.html!==void 0?m(t.html):void 0);return l!==void 0&&(e.initialBlocks=l),t.theme!==void 0&&(e.theme=t.theme),t.htmlStyles!==void 0&&(e.htmlStyles=t.htmlStyles),e}function z(o,t){var v;let e=t,l=!1;const r=M(o,t),a=new s.AerizViewer(r);return(v=e.onReady)==null||v.call(e,a),{viewer:a,update(n){if(l)return;const c=e;e=n,n.theme!==c.theme&&n.theme!==void 0&&a.setTheme(n.theme),n.htmlStyles===void 0?delete r.htmlStyles:r.htmlStyles=n.htmlStyles,n.blocks!==void 0?n.blocks!==c.blocks&&a.setBlocks(n.blocks):n.html!==void 0&&n.html!==c.html&&n.html!==a.getHTML()&&a.setBlocks(m(n.html))},destroy(){var n;l||(l=!0,(n=e.onDestroy)==null||n.call(e,a),a.destroy())}}}const F=["light","dark"],H=["en","ko","ja","zh"];function p(o){return o!==null&&F.includes(o)?o:void 0}function I(o){return o!==null&&H.includes(o)?o:void 0}function B(o){if(o===null)return;const t=o.trim();if(t==="")return;if(t==="false"||t==="none")return!1;if(t.startsWith("{")){try{const l=JSON.parse(t);if(l&&typeof l=="object"&&Array.isArray(l.items))return l}catch{}return}const e=t.split(/[\s,]+/).filter(l=>l.length>0);return e.length>0?{items:e}:void 0}function P(o){const t=o.attachInternals;if(typeof t!="function")return null;try{const e=t.call(o);return typeof e=="object"&&e!==null&&typeof e.setFormValue=="function"?e:null}catch{return null}}class b extends HTMLElement{constructor(){super();f(this,"onImageUpload");f(this,"onFileUpload");f(this,"controller",null);f(this,"internals",null);f(this,"pendingValue");f(this,"currentHTML","");this.internals=P(this)}static get observedAttributes(){return["value","placeholder","theme","locale","toolbar","html-styles","image-upload-url","file-upload-url"]}get value(){return this.controller?this.controller.editor.getHTML():this.pendingValue??this.currentHTML}set value(e){this.pendingValue=e,this.applyProps()}get editor(){var e;return((e=this.controller)==null?void 0:e.editor)??null}getBlocks(){var e;return((e=this.controller)==null?void 0:e.editor.serialize())??[]}focus(){var e;(e=this.controller)==null||e.editor.focus()}connectedCallback(){if(!this.controller){if(this.pendingValue===void 0){const e=this.getAttribute("value");e!==null&&(this.pendingValue=e)}this.controller=L(this,this.buildProps()),this.pendingValue=void 0,this.syncFormValue(this.controller.editor.getHTML()),this.dispatchEvent(new CustomEvent("aeriz-ready",{detail:{editor:this.controller.editor},bubbles:!1}))}}disconnectedCallback(){var e;(e=this.controller)==null||e.destroy(),this.controller=null}attributeChangedCallback(e,l,r){e==="value"&&(this.pendingValue=r??""),this.applyProps()}applyProps(){this.controller&&(this.controller.update(this.buildProps()),this.pendingValue=void 0)}buildProps(){const e={onChange:g=>{this.pendingValue=void 0,this.syncFormValue(g),this.dispatchEvent(new CustomEvent("input",{detail:{html:g},bubbles:!0})),this.dispatchEvent(new CustomEvent("change",{detail:{html:g},bubbles:!0}))}};this.pendingValue!==void 0&&(e.value=this.pendingValue);const l=this.getAttribute("placeholder");l!==null&&(e.placeholder=l);const r=p(this.getAttribute("theme"));r!==void 0&&(e.theme=r);const a=I(this.getAttribute("locale"));a!==void 0&&(e.locale=a);const v=B(this.getAttribute("toolbar"));v!==void 0&&(e.toolbar=v);const n=this.getAttribute("html-styles");(n==="class"||n==="inline")&&(e.htmlStyles=n);const c=this.getAttribute("image-upload-url");c!==null&&(e.imageUploadUrl=c);const d=this.getAttribute("file-upload-url");return d!==null&&(e.fileUploadUrl=d),this.onImageUpload&&(e.onImageUpload=this.onImageUpload),this.onFileUpload&&(e.onFileUpload=this.onFileUpload),e}syncFormValue(e){var l;this.currentHTML=e,(l=this.internals)==null||l.setFormValue(e)}}f(b,"formAssociated",!0);class y extends HTMLElement{constructor(){super(...arguments);f(this,"controller",null);f(this,"pendingBlocks")}static get observedAttributes(){return["html","theme"]}get blocks(){var e;return((e=this.controller)==null?void 0:e.viewer.getBlocks())??this.pendingBlocks??[]}set blocks(e){var l;this.pendingBlocks=e,(l=this.controller)==null||l.update(this.buildProps())}get viewer(){var e;return((e=this.controller)==null?void 0:e.viewer)??null}connectedCallback(){this.controller||(this.controller=z(this,this.buildProps()),this.dispatchEvent(new CustomEvent("aeriz-ready",{detail:{viewer:this.controller.viewer},bubbles:!1})))}disconnectedCallback(){var e;(e=this.controller)==null||e.destroy(),this.controller=null}attributeChangedCallback(){var e;(e=this.controller)==null||e.update(this.buildProps())}buildProps(){const e={};this.pendingBlocks!==void 0&&(e.blocks=this.pendingBlocks);const l=this.getAttribute("html");l!==null&&(e.html=l);const r=p(this.getAttribute("theme"));return r!==void 0&&(e.theme=r),e}}function k(o="aeriz"){if(typeof customElements>"u")return;const t=`${o}-editor`,e=`${o}-viewer`;customElements.get(t)||customElements.define(t,b),customElements.get(e)||customElements.define(e,y)}return k(),u.AerizEditorElement=b,u.AerizViewerElement=y,u.defineAerizElements=k,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}),u}({},AerizWysiwyg);
|