@aeriz/wysiwyg 1.0.4 → 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.
Files changed (132) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +82 -573
  3. package/angular/README.md +10 -4
  4. package/angular/aeriz-editor.directive.ts +40 -18
  5. package/dist/adapters/jquery.cjs +1 -1
  6. package/dist/adapters/jquery.js +14 -14
  7. package/dist/adapters/shared.cjs +1 -1
  8. package/dist/adapters/shared.js +59 -56
  9. package/dist/adapters/vue.cjs +1 -1
  10. package/dist/adapters/vue.js +64 -56
  11. package/dist/adapters/vue2.cjs +1 -1
  12. package/dist/adapters/vue2.js +24 -17
  13. package/dist/adapters/wc.cjs +1 -1
  14. package/dist/adapters/wc.js +108 -72
  15. package/dist/aeriz-wysiwyg-adapter.js +24 -32
  16. package/dist/aeriz-wysiwyg-adapter.min.js +1 -1
  17. package/dist/aeriz-wysiwyg-highlight.js +964 -0
  18. package/dist/aeriz-wysiwyg-highlight.min.js +5 -0
  19. package/dist/aeriz-wysiwyg-jquery.js +25 -32
  20. package/dist/aeriz-wysiwyg-jquery.min.js +1 -1
  21. package/dist/aeriz-wysiwyg-wc.js +80 -43
  22. package/dist/aeriz-wysiwyg-wc.min.js +1 -1
  23. package/dist/aeriz-wysiwyg.cjs +3688 -1757
  24. package/dist/aeriz-wysiwyg.css +2104 -1904
  25. package/dist/aeriz-wysiwyg.esm.js +3688 -1757
  26. package/dist/aeriz-wysiwyg.esm.min.js +4904 -3538
  27. package/dist/aeriz-wysiwyg.js +3688 -1757
  28. package/dist/aeriz-wysiwyg.min.cjs +53 -40
  29. package/dist/aeriz-wysiwyg.min.css +1 -1
  30. package/dist/aeriz-wysiwyg.min.js +53 -40
  31. package/dist/highlight.cjs +5 -0
  32. package/dist/highlight.js +895 -0
  33. package/dist/server.cjs +24 -19
  34. package/dist/server.js +612 -251
  35. package/dist-types/adapters/shared.d.ts +0 -8
  36. package/dist-types/adapters/shared.d.ts.map +1 -1
  37. package/dist-types/adapters/vue.d.ts +62 -21
  38. package/dist-types/adapters/vue.d.ts.map +1 -1
  39. package/dist-types/adapters/vue2.d.ts +33 -14
  40. package/dist-types/adapters/vue2.d.ts.map +1 -1
  41. package/dist-types/adapters/wc.d.ts +15 -6
  42. package/dist-types/adapters/wc.d.ts.map +1 -1
  43. package/dist-types/cjs/adapters/shared.d.cts +0 -8
  44. package/dist-types/cjs/adapters/vue.d.cts +62 -21
  45. package/dist-types/cjs/adapters/vue2.d.cts +33 -14
  46. package/dist-types/cjs/adapters/wc.d.cts +15 -6
  47. package/dist-types/cjs/core/AerizEditor.d.cts +238 -48
  48. package/dist-types/cjs/core/AerizViewer.d.cts +7 -0
  49. package/dist-types/cjs/core/block-meta.d.cts +40 -0
  50. package/dist-types/cjs/core/block-tracker.d.cts +64 -0
  51. package/dist-types/cjs/core/blocks.d.cts +39 -4
  52. package/dist-types/cjs/core/fonts.d.cts +33 -46
  53. package/dist-types/cjs/core/highlight.d.cts +2 -0
  54. package/dist-types/cjs/core/history.d.cts +28 -10
  55. package/dist-types/cjs/core/html-to-blocks.d.cts +10 -0
  56. package/dist-types/cjs/core/i18n.d.cts +44 -0
  57. package/dist-types/cjs/core/import-html.d.cts +0 -13
  58. package/dist-types/cjs/core/insert-fragment.d.cts +21 -0
  59. package/dist-types/cjs/core/paste-clean.d.cts +36 -0
  60. package/dist-types/cjs/core/sanitize-dom.d.cts +21 -0
  61. package/dist-types/cjs/core/sanitize-html.d.cts +8 -0
  62. package/dist-types/cjs/core/sanitize-policy.d.cts +22 -0
  63. package/dist-types/cjs/core/selection.d.cts +5 -0
  64. package/dist-types/cjs/core/table-grid.d.cts +87 -0
  65. package/dist-types/cjs/core/table-ops.d.cts +2 -22
  66. package/dist-types/cjs/highlight/index.d.cts +5 -0
  67. package/dist-types/cjs/index.d.cts +19 -11
  68. package/dist-types/cjs/server/index.d.cts +4 -5
  69. package/dist-types/cjs/types/index.d.cts +63 -15
  70. package/dist-types/cjs/ui/Toolbar.d.cts +10 -0
  71. package/dist-types/cjs/ui/doc-tools.d.cts +58 -0
  72. package/dist-types/cjs/ui/popovers.d.cts +14 -25
  73. package/dist-types/core/AerizEditor.d.ts +238 -48
  74. package/dist-types/core/AerizEditor.d.ts.map +1 -1
  75. package/dist-types/core/AerizViewer.d.ts +7 -0
  76. package/dist-types/core/AerizViewer.d.ts.map +1 -1
  77. package/dist-types/core/block-meta.d.ts +40 -0
  78. package/dist-types/core/block-meta.d.ts.map +1 -1
  79. package/dist-types/core/block-policy.d.ts.map +1 -1
  80. package/dist-types/core/block-tracker.d.ts +64 -0
  81. package/dist-types/core/block-tracker.d.ts.map +1 -0
  82. package/dist-types/core/blocks.d.ts +39 -4
  83. package/dist-types/core/blocks.d.ts.map +1 -1
  84. package/dist-types/core/fonts.d.ts +33 -46
  85. package/dist-types/core/fonts.d.ts.map +1 -1
  86. package/dist-types/core/highlight.d.ts +2 -0
  87. package/dist-types/core/highlight.d.ts.map +1 -1
  88. package/dist-types/core/history.d.ts +28 -10
  89. package/dist-types/core/history.d.ts.map +1 -1
  90. package/dist-types/core/html-mini.d.ts.map +1 -1
  91. package/dist-types/core/html-to-blocks.d.ts +10 -0
  92. package/dist-types/core/html-to-blocks.d.ts.map +1 -0
  93. package/dist-types/core/i18n.d.ts +44 -0
  94. package/dist-types/core/i18n.d.ts.map +1 -1
  95. package/dist-types/core/import-html.d.ts +0 -13
  96. package/dist-types/core/import-html.d.ts.map +1 -1
  97. package/dist-types/core/import-markdown.d.ts.map +1 -1
  98. package/dist-types/core/insert-fragment.d.ts +21 -0
  99. package/dist-types/core/insert-fragment.d.ts.map +1 -0
  100. package/dist-types/core/markdown-export.d.ts.map +1 -1
  101. package/dist-types/core/paste-clean.d.ts +36 -0
  102. package/dist-types/core/paste-clean.d.ts.map +1 -0
  103. package/dist-types/core/render-string.d.ts.map +1 -1
  104. package/dist-types/core/sanitize-dom.d.ts +21 -0
  105. package/dist-types/core/sanitize-dom.d.ts.map +1 -0
  106. package/dist-types/core/sanitize-html.d.ts +8 -0
  107. package/dist-types/core/sanitize-html.d.ts.map +1 -0
  108. package/dist-types/core/sanitize-policy.d.ts +22 -0
  109. package/dist-types/core/sanitize-policy.d.ts.map +1 -0
  110. package/dist-types/core/selection.d.ts +5 -0
  111. package/dist-types/core/selection.d.ts.map +1 -1
  112. package/dist-types/core/snapshot.d.ts.map +1 -1
  113. package/dist-types/core/table-grid.d.ts +87 -0
  114. package/dist-types/core/table-grid.d.ts.map +1 -0
  115. package/dist-types/core/table-ops.d.ts +2 -22
  116. package/dist-types/core/table-ops.d.ts.map +1 -1
  117. package/dist-types/highlight/index.d.ts +5 -0
  118. package/dist-types/highlight/index.d.ts.map +1 -0
  119. package/dist-types/index.d.ts +19 -11
  120. package/dist-types/index.d.ts.map +1 -1
  121. package/dist-types/server/index.d.ts +4 -5
  122. package/dist-types/server/index.d.ts.map +1 -1
  123. package/dist-types/types/index.d.ts +63 -15
  124. package/dist-types/types/index.d.ts.map +1 -1
  125. package/dist-types/ui/Toolbar.d.ts +10 -0
  126. package/dist-types/ui/Toolbar.d.ts.map +1 -1
  127. package/dist-types/ui/doc-tools.d.ts +58 -0
  128. package/dist-types/ui/doc-tools.d.ts.map +1 -0
  129. package/dist-types/ui/icons.d.ts.map +1 -1
  130. package/dist-types/ui/popovers.d.ts +14 -25
  131. package/dist-types/ui/popovers.d.ts.map +1 -1
  132. package/package.json +70 -5
@@ -1,22 +1,30 @@
1
+ /**
2
+ * `@aeriz/wysiwyg` — 브라우저 진입점. 스타일시트를 부수 효과로 불러온다.
3
+ *
4
+ * 여기서 내보내는 것이 공개 API 의 전부다. 에디터 내부(블록 레지스트리 ·
5
+ * 정규화 · HTML 파서 · 로케일 사전) 는 내보내지 않는다 — 내보내면 고칠 때마다
6
+ * 호환이 깨진다. 서버(Node · workerd · Deno) 에서는 CSS 를 끌어오지 않는
7
+ * `@aeriz/wysiwyg/server` 를 쓴다.
8
+ */
1
9
  // (CSS 부수 효과 import 는 타입 선언에서 제거됨 — scripts/strip-css-imports.mjs)
2
10
  export { AerizEditor } from './core/AerizEditor.cjs';
3
- export type { EditorState, EditorStateListener, InlineState, } from './core/AerizEditor.cjs';
11
+ export type { EditorState, EditorStateListener, InlineState } from './core/AerizEditor.cjs';
4
12
  export { AerizViewer } from './core/AerizViewer.cjs';
5
13
  export type { ViewerOptions } from './core/AerizViewer.cjs';
6
- export { ALIGN_CLASS_BY_VALUE, ALL_INLINE_MARKS, BLOCK_ID_ATTR, BLOCK_TYPES, BLOCK_TYPE_BY_KIND, BlockIdRegistry, applyBlockClassNames, applyBlockInlineStyles, assignMissingIds, classifyBlockElement, extractInlineContent, fillInlineContent, findBlockFrom, getBlockLabel, isElementBlank, listBlocks, normalizeContent, placeCaretAtStart, readBlockStyleTheme, renderBlock, renderBlocks, serializeBlock, serializeBlocks, restoreAlignFromClasses, stripEditorOnlyAttrs, stripEditorOnlyNodes, } from './core/blocks.cjs';
7
- export type { BlockStyleTheme } from './core/blocks.cjs';
8
- export type { Block, BlockAttrs, BlockAttrsByKind, BlockIdResolver, BlockKind, BlockMatch, BlockSnapshot, BlockType, BlockquoteAttrs, BulletListAttrs, ClassifyResult, CodeBlockAttrs, FileAttrs, HeadingAttrs, HeadingLevel, HrAttrs, ImageAttrs, ImportedHtmlAttrs, InlineMarkName, LinkCardAttrs, OrderedListAttrs, ParagraphAttrs, Snapshot, TableAttrs, UnknownAttrs, YoutubeAttrs, } from './core/blocks.cjs';
9
- export { getLocale, setLocale, t } from './core/i18n.cjs';
10
- export type { Locale, Strings } from './core/i18n.cjs';
11
- export type { EditorOptions, HtmlStyleMode, SerializeHtmlOptions, ToolbarConfig, ToolbarItem, ToolbarItemName, } from './types/index.cjs';
14
+ export type { EditorErrorCode, EditorOptions, HtmlStyleMode, SerializeHtmlOptions, ToolbarConfig, ToolbarItem, ToolbarItemName, UploadOptions, CodeHighlighter, } from './types/index.cjs';
12
15
  export { DEFAULT_TOOLBAR } from './types/index.cjs';
13
- export { SNAPSHOT_VERSION, snapshotVersionOf, upgradeSnapshot, upgradeSnapshots, } from './core/snapshot.cjs';
14
- export { renderBlockToHTML, renderBlocksToHTML } from './core/render-string.cjs';
16
+ export { DEFAULT_FONTS, DEFAULT_FONT_SIZES } from './core/fonts.cjs';
17
+ export type { FontFamily } from './core/fonts.cjs';
18
+ export type { Locale } from './core/i18n.cjs';
19
+ export { SNAPSHOT_VERSION, upgradeSnapshots } from './core/snapshot.cjs';
20
+ export { renderBlocksToHTML } from './core/render-string.cjs';
15
21
  export type { RenderHtmlOptions } from './core/render-string.cjs';
22
+ export { sanitizeHTML } from './core/sanitize-html.cjs';
23
+ export { htmlToBlocks } from './core/html-to-blocks.cjs';
16
24
  export { blocksToMarkdown } from './core/markdown-export.cjs';
17
25
  export type { MarkdownOptions } from './core/markdown-export.cjs';
26
+ export { markdownToBlocks, markdownToHtml } from './core/import-markdown.cjs';
18
27
  export { blocksToPlainText } from './core/plain-text.cjs';
19
28
  export type { PlainTextOptions } from './core/plain-text.cjs';
20
- export { decodeEntities, escapeAttr, escapeHtml, parseHtmlFragment, serializeNodes, textOf, textWithBlockBreaks, } from './core/html-mini.cjs';
21
- export type { HtmlElementNode, HtmlNode, HtmlText } from './core/html-mini.cjs';
29
+ export type { Block, BlockAttrs, BlockAttrsByKind, BlockKind, BlockSnapshot, BlockquoteAttrs, BulletListAttrs, CodeBlockAttrs, FileAttrs, HeadingAttrs, HeadingLevel, HrAttrs, ImageAttrs, ImportedHtmlAttrs, InlineMarkName, LinkCardAttrs, OrderedListAttrs, ParagraphAttrs, Snapshot, TableAttrs, UnknownAttrs, YoutubeAttrs, } from './core/blocks.cjs';
22
30
  // (소스맵은 CJS 선언 사본에서 제외됨 — scripts/finalize-types.mjs)
@@ -24,14 +24,13 @@
24
24
  * },
25
25
  * };
26
26
  */
27
- export { renderBlockToHTML, renderBlocksToHTML, } from '../core/render-string.cjs';
27
+ export { renderBlocksToHTML } from '../core/render-string.cjs';
28
28
  export type { RenderHtmlOptions } from '../core/render-string.cjs';
29
+ export { sanitizeHTML } from '../core/sanitize-html.cjs';
29
30
  export { blocksToMarkdown } from '../core/markdown-export.cjs';
30
31
  export type { MarkdownOptions } from '../core/markdown-export.cjs';
31
32
  export { blocksToPlainText } from '../core/plain-text.cjs';
32
33
  export type { PlainTextOptions } from '../core/plain-text.cjs';
33
- export { SNAPSHOT_VERSION, snapshotVersionOf, upgradeSnapshot, upgradeSnapshots, } from '../core/snapshot.cjs';
34
- export type { Block, BlockAttrs, BlockAttrsByKind, BlockKind, BlockSnapshot, BlockquoteAttrs, BulletListAttrs, CodeBlockAttrs, FileAttrs, HeadingAttrs, HeadingLevel, HrAttrs, ImageAttrs, ImportedHtmlAttrs, InlineMarkName, LinkCardAttrs, OrderedListAttrs, ParagraphAttrs, Snapshot, TableAttrs, UnknownAttrs, YoutubeAttrs, } from '../core/blocks.cjs';
35
- export { decodeEntities, escapeAttr, escapeHtml, parseHtmlFragment, serializeNodes, textOf, textWithBlockBreaks, } from '../core/html-mini.cjs';
36
- export type { HtmlElementNode, HtmlNode, HtmlText } from '../core/html-mini.cjs';
34
+ export { SNAPSHOT_VERSION, upgradeSnapshots } from '../core/snapshot.cjs';
35
+ export type { BlockAttrs, BlockAttrsByKind, BlockKind, BlockSnapshot, BlockquoteAttrs, BulletListAttrs, CodeBlockAttrs, FileAttrs, HeadingAttrs, HeadingLevel, HrAttrs, ImageAttrs, ImportedHtmlAttrs, InlineMarkName, LinkCardAttrs, OrderedListAttrs, ParagraphAttrs, Snapshot, TableAttrs, UnknownAttrs, YoutubeAttrs, } from '../core/blocks.cjs';
37
36
  // (소스맵은 CJS 선언 사본에서 제외됨 — scripts/finalize-types.mjs)
@@ -1,5 +1,6 @@
1
+ import type { FontFamily } from '../core/fonts.cjs';
1
2
  export type ToolbarItem = ToolbarItemName | '|';
2
- export type ToolbarItemName = 'undo' | 'redo' | 'blockType' | 'fontFamily' | 'fontSize' | 'bold' | 'italic' | 'underline' | 'strike' | 'color' | 'backgroundColor' | 'align' | 'cellBg' | 'tableMenu' | 'codeLang' | 'bulletList' | 'orderedList' | 'blockquote' | 'codeBlock' | 'link' | 'image' | 'table' | 'hr' | 'clearFormat';
3
+ export type ToolbarItemName = 'undo' | 'redo' | 'blockType' | 'fontFamily' | 'fontSize' | 'bold' | 'italic' | 'underline' | 'strike' | 'superscript' | 'subscript' | 'color' | 'backgroundColor' | 'align' | 'cellBg' | 'tableMenu' | 'codeLang' | 'bulletList' | 'orderedList' | 'blockquote' | 'codeBlock' | 'link' | 'image' | 'table' | 'hr' | 'clearFormat' | 'lineHeight' | 'letterSpacing' | 'specialChar' | 'findReplace' | 'source' | 'print' | 'fullscreen';
3
4
  export interface ToolbarConfig {
4
5
  items: ToolbarItem[];
5
6
  sticky?: boolean;
@@ -24,6 +25,12 @@ export interface EditorOptions {
24
25
  element: HTMLElement;
25
26
  initialHTML?: string;
26
27
  placeholder?: string;
28
+ /**
29
+ * 아래쪽 상태바(되돌리기 · 블록 수 · 글자 수) 를 보일지. 기본 `true`.
30
+ */
31
+ statusBar?: boolean;
32
+ /** 본문 편집 영역의 접근성 이름(aria-label). 기본은 로케일의 "본문 편집기". */
33
+ ariaLabel?: string;
27
34
  toolbar?: ToolbarConfig | false;
28
35
  theme?: 'light' | 'dark';
29
36
  /** UI 언어. 'en' / 'ko' / 'ja' / 'zh'. 기본 'ko'. */
@@ -35,27 +42,68 @@ export interface EditorOptions {
35
42
  htmlStyles?: HtmlStyleMode;
36
43
  onChange?: (html: string) => void;
37
44
  /**
38
- * 직접 업로드 핸들러. 우선 적용된다. 미설정 + `imageUploadUrl` 만 있을 때는
39
- * 에디터가 multipart/form-data 로 그 URL 에 POST 한 응답 JSON 의
40
- * `url` 필드를 사용한다.
45
+ * 읽기 전용. 글을 고칠 수 없고 툴바는 인쇄 · 전체 화면만 쓸 수 있다.
46
+ * 나중에 바꾸려면 `editor.setReadOnly()`.
47
+ */
48
+ readOnly?: boolean;
49
+ /**
50
+ * 에디터 높이. 숫자는 px, 문자열은 CSS 값('60vh' 등). 지정하면 본문이 그 안에서
51
+ * 스크롤된다. 지정하지 않으면 부모 높이를 채우고 최소 320px 이다.
41
52
  */
42
- onImageUpload?: (file: File) => Promise<string>;
53
+ height?: number | string;
54
+ /** 그림 · 파일 올리기. 없으면 다이얼로그의 "올리기" 탭이 꺼지고 붙여넣은 그림은 문서에 그대로 담긴다. */
55
+ upload?: UploadOptions;
43
56
  /**
44
- * 서버 이미지 업로드 API URL. 설정 시 이미지 다이얼로그의 "업로드" 탭이
45
- * 활성화된다. 미설정 시 업로드 탭은 비활성 + 툴팁 안내.
57
+ * 에디터 안에서 난 오류(올리기 실패 등). 지정하지 않으면 콘솔에 남긴다.
58
+ * `code` 로 종류를 가린다.
46
59
  */
47
- imageUploadUrl?: string;
60
+ onError?: (error: Error, context: {
61
+ code: EditorErrorCode;
62
+ }) => void;
48
63
  /**
49
- * 파일 첨부 직접 업로드 핸들러. 첨부 다이얼로그의 "업로드" 탭에서 사용.
50
- * 미설정 + `fileUploadUrl` 만 있을 때는 에디터가 multipart/form-data 로
51
- * POST 한 응답 JSON 의 `url` 필드를 사용한다.
64
+ * 코드 블록 색칠기. 없으면 코드는 색 없이 보이고 언어 고르기 버튼도 숨는다.
65
+ * 기본 색칠기는 `import { highlighter } from '@aeriz/wysiwyg/highlight'`.
52
66
  */
53
- onFileUpload?: (file: File) => Promise<string>;
67
+ highlighter?: CodeHighlighter;
54
68
  /**
55
- * 서버 파일 업로드 API URL. 설정 시 파일 첨부 다이얼로그의 "업로드" 탭이
56
- * 활성화된다. 미설정 시 업로드 탭은 비활성 + 툴팁 안내.
69
+ * 글꼴 드롭다운 목록. 기본은 한국 문서에서 쓰는 시스템 글꼴(맑은 고딕 · 굴림 ·
70
+ * 돋움 · 바탕 · 궁서 …) 이며 네트워크를 쓰지 않는다. 웹폰트는 `cssUrl` 을
71
+ * 함께 주면 드롭다운을 처음 열 때 받는다. 이 PC 에 없는 글꼴은 목록에서 빠진다.
72
+ *
73
+ * `{ label: '', stack: '' }` 항목은 "기본 글꼴"(서식 지우기) 이다.
57
74
  */
58
- fileUploadUrl?: string;
75
+ fonts?: ReadonlyArray<FontFamily>;
76
+ /** 글자 크기 드롭다운 목록(pt). 기본 8 ~ 48pt. */
77
+ fontSizes?: ReadonlyArray<number>;
78
+ }
79
+ /** `onError` 의 오류 종류. */
80
+ export type EditorErrorCode = 'upload' | 'paste';
81
+ /**
82
+ * 그림 · 파일 올리기 설정. 둘 중 하나를 준다.
83
+ *
84
+ * - `url` — 그 주소로 `multipart/form-data`(필드 `file`, `kind`) 를 POST 하고,
85
+ * 응답 JSON 의 `url` 을 쓴다. 인증이 필요하면 `headers`.
86
+ * - `handler` — 직접 올리고 주소를 돌려준다 (S3 서명 URL 등).
87
+ */
88
+ /**
89
+ * 코드 블록 색칠기. `highlight` 는 글을 받아 HTML 을 돌려준다. 결과는 `<span class>`
90
+ * 만 남기고 걸러서 넣으므로, 다른 태그나 속성은 무시된다.
91
+ */
92
+ export interface CodeHighlighter {
93
+ /** 언어 고르기 목록. `id` 는 `<code data-language>` 에 저장된다. */
94
+ languages: ReadonlyArray<{
95
+ id: string;
96
+ label: string;
97
+ }>;
98
+ highlight(code: string, languageId: string | undefined): string;
99
+ }
100
+ export interface UploadOptions {
101
+ url?: string;
102
+ /** `url` 로 보낼 때 붙일 헤더. 함수면 보낼 때마다 불러 최신 토큰을 쓴다. */
103
+ headers?: Record<string, string> | (() => Record<string, string>);
104
+ handler?: (file: File, kind: 'image' | 'file') => Promise<string>;
105
+ /** 올릴 수 있는 최대 크기(바이트). 넘으면 올리지 않고 `onError('upload')`. */
106
+ maxSize?: number;
59
107
  }
60
108
  export declare const DEFAULT_TOOLBAR: ToolbarConfig;
61
109
  // (소스맵은 CJS 선언 사본에서 제외됨 — scripts/finalize-types.mjs)
@@ -1,11 +1,21 @@
1
1
  import type { ToolbarConfig, ToolbarItemName } from '../types/index.cjs';
2
2
  export interface ToolbarHandlers {
3
3
  onAction: (name: ToolbarItemName, anchor: HTMLElement) => void;
4
+ /** 툴바에서 Esc — 본문으로 돌아간다. */
5
+ onEscape: () => void;
4
6
  }
5
7
  export declare class Toolbar {
6
8
  readonly element: HTMLDivElement;
7
9
  private buttons;
8
10
  constructor(config: ToolbarConfig, handlers: ToolbarHandlers);
11
+ /** 툴바에 있는 항목 이름들. */
12
+ names(): ToolbarItemName[];
13
+ /** 툴바로 포커스를 옮긴다 (Alt+F10). 마지막으로 머문 버튼, 없으면 첫 버튼. */
14
+ focus(): void;
15
+ /** 소스 보기처럼 툴바 대부분을 잠글 때. `except` 는 계속 쓸 수 있다. */
16
+ setAllEnabled(enabled: boolean, except: ToolbarItemName): void;
17
+ private focusable;
18
+ private handleKeydown;
9
19
  setActive(name: ToolbarItemName, active: boolean): void;
10
20
  setEnabled(name: ToolbarItemName, enabled: boolean): void;
11
21
  /** 조건부 항목을 완전히 숨긴다 (display:none). 허용 블록으로 돌아오면 다시 보임. */
@@ -0,0 +1,58 @@
1
+ /** 줄 간격(%). 한글의 기본값 160% 를 포함한다. */
2
+ export declare const LINE_HEIGHTS: ReadonlyArray<number>;
3
+ /** 자간(em 의 백분율). 한글의 자간 -5% 는 letter-spacing: -0.05em 이다. */
4
+ export declare const LETTER_SPACINGS: ReadonlyArray<number>;
5
+ /** 줄 간격 드롭다운. `current` 는 지금 블록의 line-height(%), 모르면 null. */
6
+ export declare function openLineHeightDropdown(anchor: HTMLElement, onPick: (percent: number) => void, current: number | null): void;
7
+ /** 자간 드롭다운. 값은 em 의 백분율(-5 → -0.05em). */
8
+ export declare function openLetterSpacingDropdown(anchor: HTMLElement, onPick: (percent: number) => void, current: number | null): void;
9
+ /** 특수 문자 표. 고르면 `onPick(char)` — 팝오버는 열어 둔다(여러 개 넣기). */
10
+ export declare function openSpecialCharDropdown(anchor: HTMLElement, onPick: (char: string) => void): void;
11
+ interface Match {
12
+ range: Range;
13
+ }
14
+ /**
15
+ * 본문 안 글자 검색. 블록마다 텍스트 노드를 이어 붙인 문자열에서 찾으므로
16
+ * 굵게 · 색 같은 서식 경계를 넘는 낱말도 찾는다. 블록 경계는 넘지 않는다.
17
+ */
18
+ export declare function findInContent(root: HTMLElement, query: string, matchCase: boolean): Match[];
19
+ export interface FindPanelHost {
20
+ content: HTMLElement;
21
+ /** 바꾸기 전에 부른다 — 이력이 한 단계로 묶이도록. */
22
+ beforeChange(): void;
23
+ /** 바꾼 뒤에 부른다. */
24
+ afterChange(): void;
25
+ }
26
+ /**
27
+ * 찾기 · 바꾸기 패널. 에디터 위쪽에 붙는 작은 막대다 — 모달로 띄우면 찾은
28
+ * 자리를 가린다.
29
+ */
30
+ export declare class FindPanel {
31
+ private readonly host;
32
+ readonly element: HTMLDivElement;
33
+ private readonly findInput;
34
+ private readonly replaceInput;
35
+ private readonly caseBox;
36
+ private readonly status;
37
+ private matches;
38
+ private index;
39
+ constructor(host: FindPanelHost);
40
+ get isOpen(): boolean;
41
+ open(): void;
42
+ close(): void;
43
+ /** 문서가 바뀌면 다시 찾는다 (열려 있을 때만). */
44
+ refresh(): void;
45
+ private search;
46
+ private step;
47
+ private paint;
48
+ private replaceOne;
49
+ private replaceAll;
50
+ }
51
+ /**
52
+ * 문서만 인쇄한다 — 툴바 · 핸들 · 페이지의 다른 부분 없이. 보이지 않는 iframe
53
+ * 에 `getHTML()` 결과(스타일이 인라인으로 들어 있다) 를 넣고 그 창을 인쇄한다.
54
+ * iframe 은 스크립트를 돌리지 않는다(sandbox) — 인쇄만 허용한다.
55
+ */
56
+ export declare function printHtml(html: string, title: string): void;
57
+ export {};
58
+ // (소스맵은 CJS 선언 사본에서 제외됨 — scripts/finalize-types.mjs)
@@ -1,4 +1,7 @@
1
1
  import type { BlockAttrs, BlockKind } from '../core/blocks.cjs';
2
+ import type { FontFamily } from '../core/fonts.cjs';
3
+ /** contentEditable 선택 영역이 사라지지 않도록 mousedown 시 포커스 이동을 막는다. */
4
+ export declare function preserveSelection(el: HTMLElement): void;
2
5
  export declare const COLOR_PALETTE: string[];
3
6
  export declare function openColorPicker(anchor: HTMLElement, onPick: (color: string | null) => void, recents?: ReadonlyArray<string>): void;
4
7
  /**
@@ -12,46 +15,30 @@ export interface BlockTypeChoice {
12
15
  }
13
16
  export declare function openBlockTypeDropdown(anchor: HTMLElement, onPick: (choice: BlockTypeChoice) => void): void;
14
17
  export declare function openAlignDropdown(anchor: HTMLElement, onPick: (value: 'left' | 'center' | 'right' | 'justify') => void): void;
15
- export interface FontFamilyChoice {
16
- id: string;
17
- label: string;
18
- stack: string;
19
- }
20
18
  /**
21
- * 글꼴 선택 드롭다운. 첫 호출 시 모든 글꼴 CSS 를 lazy 로드(Google Fonts +
22
- * Pretendard CDN), 항목 라벨은 각 글꼴 자신으로 미리보기 렌더한다.
23
- *
24
- * - `currentId` 가 지정되면 해당 글꼴 항목에 `aw-popover-item-active` 적용
25
- * - 선택 시 `onPick(choice)` 호출 + 팝오버 닫힘
19
+ * 글꼴 드롭다운. 항목 이름 옆 미리보기('가A') 만 그 글꼴로 그린다.
20
+ * 이 PC 에 없는 글꼴은 확인되는 대로 목록에서 빠진다.
26
21
  */
27
- export declare function openFontFamilyDropdown(anchor: HTMLElement, onPick: (choice: FontFamilyChoice) => void, currentId?: string): void;
22
+ export declare function openFontFamilyDropdown(anchor: HTMLElement, fonts: ReadonlyArray<FontFamily>, onPick: (font: FontFamily) => void, current?: FontFamily | null): void;
28
23
  export interface CodeLanguageChoice {
29
24
  id: string;
30
25
  label: string;
31
26
  }
32
27
  /**
33
- * 코드 블록의 언어 선택 드롭다운. highlight.ts 의 LANGUAGES 를 그대로 노출.
28
+ * 코드 블록의 언어 선택 드롭다운. 색칠기(`highlighter.languages`) 의 목록을 보여 준다.
34
29
  *
35
30
  * - `currentId` 가 일치하는 항목에 active(✓) 표시
36
31
  * - 선택 시 onPick(choice) 호출 + 팝오버 닫힘
37
32
  */
38
- export declare function openCodeLanguageDropdown(anchor: HTMLElement, onPick: (choice: CodeLanguageChoice) => void, currentId?: string): void;
39
- export type TableMenuAction = 'rowAbove' | 'rowBelow' | 'colLeft' | 'colRight' | 'deleteRow' | 'deleteCol';
33
+ export declare function openCodeLanguageDropdown(anchor: HTMLElement, languages: ReadonlyArray<CodeLanguageChoice>, onPick: (choice: CodeLanguageChoice) => void, currentId?: string): void;
34
+ export type TableMenuAction = 'rowAbove' | 'rowBelow' | 'colLeft' | 'colRight' | 'deleteRow' | 'deleteCol' | 'mergeCells' | 'splitCell';
40
35
  /**
41
36
  * 표 편집 드롭다운 — 행/열 추가·삭제. 활성 블록이 table 일 때만 의미가 있어
42
37
  * AerizEditor 가 toolbar 'tableMenu' 항목 클릭 시점에 호출.
43
38
  */
44
- export declare function openTableMenuDropdown(anchor: HTMLElement, onPick: (action: TableMenuAction) => void): void;
45
- export interface FontSizeChoice {
46
- px: number;
47
- }
48
- /**
49
- * 글자 크기 프리셋 드롭다운. FONT_SIZES 의 px 값을 작은 라벨로 나열.
50
- *
51
- * - `currentPx` 가 일치하는 항목에 active 표시
52
- * - 선택 시 `onPick({ px })` 호출 + 팝오버 닫힘
53
- */
54
- export declare function openFontSizeDropdown(anchor: HTMLElement, onPick: (choice: FontSizeChoice) => void, currentPx?: number): void;
39
+ export declare function openTableMenuDropdown(anchor: HTMLElement, onPick: (action: TableMenuAction) => void, disabled?: ReadonlySet<TableMenuAction>): void;
40
+ /** 글자 크기(pt) 드롭다운. `current` 와 같은 항목에 표시. */
41
+ export declare function openFontSizeDropdown(anchor: HTMLElement, sizes: ReadonlyArray<number>, onPick: (pt: number) => void, current?: number | null): void;
55
42
  /**
56
43
  * 기능 미구현 메뉴 항목용 placeholder 드롭다운.
57
44
  * 항목명만 노출하고 "준비 중" 메시지를 보여준다.
@@ -67,4 +54,6 @@ export interface TableSizeChoice {
67
54
  cols: number;
68
55
  }
69
56
  export declare function openTableDropdown(anchor: HTMLElement, onPick: (choice: TableSizeChoice) => void): void;
57
+ export declare function anchorPopover(popover: HTMLElement, anchor: HTMLElement): void;
58
+ export declare function closeAllPopovers(): void;
70
59
  // (소스맵은 CJS 선언 사본에서 제외됨 — scripts/finalize-types.mjs)