@richscripts/richtexteditor 2.4.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 (184) hide show
  1. package/README.md +360 -0
  2. package/admin/index.d.ts +100 -0
  3. package/admin/index.js +94 -0
  4. package/angular/component.ts +284 -0
  5. package/angular/index.d.ts +80 -0
  6. package/angular/index.ts +24 -0
  7. package/headless/index.d.ts +65 -0
  8. package/headless/index.js +272 -0
  9. package/index.d.ts +1412 -0
  10. package/integrations/shared.d.ts +138 -0
  11. package/integrations/shared.js +5182 -0
  12. package/package.json +130 -0
  13. package/react/index.d.ts +104 -0
  14. package/react/index.js +310 -0
  15. package/richtexteditor/CHANGELOG.md +1876 -0
  16. package/richtexteditor/all_plugins.js +31125 -0
  17. package/richtexteditor/all_plugins.min.js +78 -0
  18. package/richtexteditor/lang/rte-lang-af.js +193 -0
  19. package/richtexteditor/lang/rte-lang-ar.js +193 -0
  20. package/richtexteditor/lang/rte-lang-bg.js +193 -0
  21. package/richtexteditor/lang/rte-lang-bn.js +193 -0
  22. package/richtexteditor/lang/rte-lang-bs.js +193 -0
  23. package/richtexteditor/lang/rte-lang-ca.js +193 -0
  24. package/richtexteditor/lang/rte-lang-cs.js +193 -0
  25. package/richtexteditor/lang/rte-lang-cy.js +193 -0
  26. package/richtexteditor/lang/rte-lang-da.js +193 -0
  27. package/richtexteditor/lang/rte-lang-de.js +193 -0
  28. package/richtexteditor/lang/rte-lang-el.js +193 -0
  29. package/richtexteditor/lang/rte-lang-en.js +6 -0
  30. package/richtexteditor/lang/rte-lang-es.js +193 -0
  31. package/richtexteditor/lang/rte-lang-et.js +193 -0
  32. package/richtexteditor/lang/rte-lang-fa.js +193 -0
  33. package/richtexteditor/lang/rte-lang-fi.js +193 -0
  34. package/richtexteditor/lang/rte-lang-fil.js +193 -0
  35. package/richtexteditor/lang/rte-lang-fj.js +193 -0
  36. package/richtexteditor/lang/rte-lang-fr.js +193 -0
  37. package/richtexteditor/lang/rte-lang-ga.js +193 -0
  38. package/richtexteditor/lang/rte-lang-gu.js +193 -0
  39. package/richtexteditor/lang/rte-lang-he.js +193 -0
  40. package/richtexteditor/lang/rte-lang-hi.js +193 -0
  41. package/richtexteditor/lang/rte-lang-hr.js +193 -0
  42. package/richtexteditor/lang/rte-lang-ht.js +193 -0
  43. package/richtexteditor/lang/rte-lang-hu.js +193 -0
  44. package/richtexteditor/lang/rte-lang-id.js +193 -0
  45. package/richtexteditor/lang/rte-lang-is.js +193 -0
  46. package/richtexteditor/lang/rte-lang-it.js +193 -0
  47. package/richtexteditor/lang/rte-lang-ja.js +193 -0
  48. package/richtexteditor/lang/rte-lang-kn.js +193 -0
  49. package/richtexteditor/lang/rte-lang-ko.js +193 -0
  50. package/richtexteditor/lang/rte-lang-lt.js +193 -0
  51. package/richtexteditor/lang/rte-lang-lv.js +193 -0
  52. package/richtexteditor/lang/rte-lang-mg.js +193 -0
  53. package/richtexteditor/lang/rte-lang-mi.js +193 -0
  54. package/richtexteditor/lang/rte-lang-ml.js +193 -0
  55. package/richtexteditor/lang/rte-lang-mr.js +193 -0
  56. package/richtexteditor/lang/rte-lang-ms.js +193 -0
  57. package/richtexteditor/lang/rte-lang-mt.js +193 -0
  58. package/richtexteditor/lang/rte-lang-mww.js +193 -0
  59. package/richtexteditor/lang/rte-lang-nb.js +193 -0
  60. package/richtexteditor/lang/rte-lang-nl.js +193 -0
  61. package/richtexteditor/lang/rte-lang-otq.js +193 -0
  62. package/richtexteditor/lang/rte-lang-pa.js +193 -0
  63. package/richtexteditor/lang/rte-lang-pl.js +193 -0
  64. package/richtexteditor/lang/rte-lang-pt-pt.js +193 -0
  65. package/richtexteditor/lang/rte-lang-pt.js +193 -0
  66. package/richtexteditor/lang/rte-lang-ro.js +193 -0
  67. package/richtexteditor/lang/rte-lang-ru.js +193 -0
  68. package/richtexteditor/lang/rte-lang-sk.js +193 -0
  69. package/richtexteditor/lang/rte-lang-sl.js +193 -0
  70. package/richtexteditor/lang/rte-lang-sm.js +193 -0
  71. package/richtexteditor/lang/rte-lang-sr-Cyrl.js +193 -0
  72. package/richtexteditor/lang/rte-lang-sr-Latn.js +193 -0
  73. package/richtexteditor/lang/rte-lang-sv.js +193 -0
  74. package/richtexteditor/lang/rte-lang-sw.js +193 -0
  75. package/richtexteditor/lang/rte-lang-ta.js +193 -0
  76. package/richtexteditor/lang/rte-lang-te.js +193 -0
  77. package/richtexteditor/lang/rte-lang-th.js +193 -0
  78. package/richtexteditor/lang/rte-lang-tlh-Latn.js +193 -0
  79. package/richtexteditor/lang/rte-lang-tlh-Piqd.js +193 -0
  80. package/richtexteditor/lang/rte-lang-to.js +193 -0
  81. package/richtexteditor/lang/rte-lang-tr.js +193 -0
  82. package/richtexteditor/lang/rte-lang-ty.js +193 -0
  83. package/richtexteditor/lang/rte-lang-uk.js +193 -0
  84. package/richtexteditor/lang/rte-lang-ur.js +193 -0
  85. package/richtexteditor/lang/rte-lang-vi.js +193 -0
  86. package/richtexteditor/lang/rte-lang-yua.js +193 -0
  87. package/richtexteditor/lang/rte-lang-zh-Hans.js +193 -0
  88. package/richtexteditor/lang/rte-lang-zh-Hant.js +193 -0
  89. package/richtexteditor/lang/rte-lang.js +1 -0
  90. package/richtexteditor/plugins/-combine-plugin.txt +2 -0
  91. package/richtexteditor/plugins/-combine-plugins.bat +20 -0
  92. package/richtexteditor/plugins/a11yenhance.js +90 -0
  93. package/richtexteditor/plugins/accessibilitychecker.js +579 -0
  94. package/richtexteditor/plugins/aitoolkit.css +15830 -0
  95. package/richtexteditor/plugins/aitoolkit.js +19171 -0
  96. package/richtexteditor/plugins/all_plugins.js +31125 -0
  97. package/richtexteditor/plugins/all_plugins.min.js +78 -0
  98. package/richtexteditor/plugins/autoembed.js +174 -0
  99. package/richtexteditor/plugins/blocktypes.js +175 -0
  100. package/richtexteditor/plugins/bookmarkcard.js +226 -0
  101. package/richtexteditor/plugins/charlimit.js +195 -0
  102. package/richtexteditor/plugins/comments.js +672 -0
  103. package/richtexteditor/plugins/contentminimap.js +369 -0
  104. package/richtexteditor/plugins/crdt-engine.js +8905 -0
  105. package/richtexteditor/plugins/crdt-engine.min.js +5 -0
  106. package/richtexteditor/plugins/dialoga11y.js +174 -0
  107. package/richtexteditor/plugins/dictation.js +268 -0
  108. package/richtexteditor/plugins/documentimport.js +369 -0
  109. package/richtexteditor/plugins/documentoutline.js +341 -0
  110. package/richtexteditor/plugins/emailtoolkit.js +165 -0
  111. package/richtexteditor/plugins/emojiautocomplete.js +241 -0
  112. package/richtexteditor/plugins/foldheadings.js +181 -0
  113. package/richtexteditor/plugins/ghostcomplete.js +297 -0
  114. package/richtexteditor/plugins/html2pdf.js +158 -0
  115. package/richtexteditor/plugins/imageeditor.js +159 -0
  116. package/richtexteditor/plugins/insertcode.js +319 -0
  117. package/richtexteditor/plugins/insertemoji.js +229 -0
  118. package/richtexteditor/plugins/insertgallery.js +362 -0
  119. package/richtexteditor/plugins/inserttemplate.js +261 -0
  120. package/richtexteditor/plugins/localdraft.js +213 -0
  121. package/richtexteditor/plugins/markdownexport.js +110 -0
  122. package/richtexteditor/plugins/mathdialog.js +153 -0
  123. package/richtexteditor/plugins/mentionplugin.js +534 -0
  124. package/richtexteditor/plugins/mermaiddiagram.js +294 -0
  125. package/richtexteditor/plugins/readabilitystats.js +148 -0
  126. package/richtexteditor/plugins/readaloud.js +243 -0
  127. package/richtexteditor/plugins/restrictedediting.js +208 -0
  128. package/richtexteditor/plugins/revisionhistory.js +670 -0
  129. package/richtexteditor/plugins/samples/insertcode_v1.js +76 -0
  130. package/richtexteditor/plugins/slashcommand.js +705 -0
  131. package/richtexteditor/plugins/smartchips.js +250 -0
  132. package/richtexteditor/plugins/spellcheck.js +181 -0
  133. package/richtexteditor/plugins/todolist.js +137 -0
  134. package/richtexteditor/plugins/trackedchanges.js +658 -0
  135. package/richtexteditor/plugins/tui.image-editor/fabric.min.js +8 -0
  136. package/richtexteditor/plugins/tui.image-editor/note.txt +5 -0
  137. package/richtexteditor/plugins/tui.image-editor/svg/icon-a.svg +235 -0
  138. package/richtexteditor/plugins/tui.image-editor/svg/icon-b.svg +224 -0
  139. package/richtexteditor/plugins/tui.image-editor/svg/icon-c.svg +224 -0
  140. package/richtexteditor/plugins/tui.image-editor/svg/icon-d.svg +224 -0
  141. package/richtexteditor/plugins/tui.image-editor/tui-code-snippet.min.js +7 -0
  142. package/richtexteditor/plugins/tui.image-editor/tui-color-picker.min.css +6 -0
  143. package/richtexteditor/plugins/tui.image-editor/tui-color-picker.min.js +7 -0
  144. package/richtexteditor/plugins/tui.image-editor/tui-image-editor.min.css +7 -0
  145. package/richtexteditor/plugins/tui.image-editor/tui-image-editor.min.js +15 -0
  146. package/richtexteditor/plugins/typewriter.js +203 -0
  147. package/richtexteditor/plugins/wordexport.js +0 -0
  148. package/richtexteditor/plugins/yjscollab.js +693 -0
  149. package/richtexteditor/plugins/zz_richtextbox_dialog_style.js +335 -0
  150. package/richtexteditor/rte-config.js +933 -0
  151. package/richtexteditor/rte.js +943 -0
  152. package/richtexteditor/rte_mobile.css +234 -0
  153. package/richtexteditor/rte_theme_default.css +4819 -0
  154. package/richtexteditor/runtime/colorpicker_more_ns.htm +2613 -0
  155. package/richtexteditor/runtime/help.htm +162 -0
  156. package/richtexteditor/runtime/images/1x1.gif +0 -0
  157. package/richtexteditor/runtime/images/cpie_Color.cur +0 -0
  158. package/richtexteditor/runtime/images/cpie_GradientPositionDark.gif +0 -0
  159. package/richtexteditor/runtime/images/cpie_GradientPositionLight.gif +0 -0
  160. package/richtexteditor/runtime/images/cpie_VerticalPosition.gif +0 -0
  161. package/richtexteditor/runtime/images/cpie_WebSafe.gif +0 -0
  162. package/richtexteditor/runtime/images/cpie_gradients.png +0 -0
  163. package/richtexteditor/runtime/images/cpns_Color.cur +0 -0
  164. package/richtexteditor/runtime/images/cpns_ColorSpace1.png +0 -0
  165. package/richtexteditor/runtime/images/cpns_ColorSpace2.png +0 -0
  166. package/richtexteditor/runtime/images/cpns_GradientPositionDark.gif +0 -0
  167. package/richtexteditor/runtime/images/cpns_GradientPositionLight.gif +0 -0
  168. package/richtexteditor/runtime/images/cpns_Vertical1.png +0 -0
  169. package/richtexteditor/runtime/images/cpns_Vertical2.png +0 -0
  170. package/richtexteditor/runtime/images/cpns_VerticalPosition.gif +0 -0
  171. package/richtexteditor/runtime/images/cpns_WebSafe.gif +0 -0
  172. package/richtexteditor/runtime/images/cpns_gradients.png +0 -0
  173. package/richtexteditor/runtime/images/cpns_hue2.png +0 -0
  174. package/richtexteditor/runtime/images/formbn.gif +0 -0
  175. package/richtexteditor/runtime/images/multiclavier.gif +0 -0
  176. package/richtexteditor/runtime/richtexteditor_content.css +362 -0
  177. package/richtexteditor/runtime/richtexteditor_preview.css +302 -0
  178. package/richtexteditor/runtime/richtexteditor_preview.js +1 -0
  179. package/server/index.d.ts +21 -0
  180. package/server/index.js +23 -0
  181. package/svelte/index.d.ts +19 -0
  182. package/svelte/index.js +59 -0
  183. package/vue/index.d.ts +94 -0
  184. package/vue/index.js +291 -0
@@ -0,0 +1,284 @@
1
+ import {
2
+ AfterViewInit,
3
+ Component,
4
+ ElementRef,
5
+ EventEmitter,
6
+ Input,
7
+ OnChanges,
8
+ OnDestroy,
9
+ Output,
10
+ SimpleChanges,
11
+ ViewChild
12
+ } from "@angular/core";
13
+ import type {
14
+ RichTextEditorAccessibilityResult,
15
+ RichTextEditorAiToolkit,
16
+ RichTextEditorCollab,
17
+ RichTextEditorComments,
18
+ RichTextEditorDictation,
19
+ RichTextEditorDocumentMetrics,
20
+ RichTextEditorDocumentOutlineItem,
21
+ RichTextEditorFootnoteItem,
22
+ RichTextEditorInstance,
23
+ RichTextEditorMentions,
24
+ RichTextEditorPageSetup,
25
+ RichTextEditorReviewLedger,
26
+ RichTextEditorRevisionHistory,
27
+ RichTextEditorSlashCommands,
28
+ RichTextEditorStructuredDocument,
29
+ RichTextEditorStructuredInput,
30
+ RichTextEditorTableOfContentsItem,
31
+ RichTextEditorTableOfContentsOptions,
32
+ RichTextEditorTextStatistics,
33
+ RichTextEditorValueFormat
34
+ } from "../index";
35
+ import * as shared from "../integrations/shared";
36
+
37
+ export interface RichTextEditorAngularChangeEvent {
38
+ editor: RichTextEditorInstance;
39
+ value: string | RichTextEditorStructuredDocument;
40
+ }
41
+
42
+ @Component({
43
+ selector: "rich-text-editor",
44
+ standalone: true,
45
+ template: '<div #host class="rte-angular-host"></div>',
46
+ styles: [`
47
+ :host {
48
+ display: block;
49
+ min-height: 360px;
50
+ }
51
+
52
+ .rte-angular-host {
53
+ min-height: 360px;
54
+ }
55
+ `]
56
+ })
57
+ export class RichTextEditorAngularComponent implements AfterViewInit, OnChanges, OnDestroy {
58
+ @Input() assetBasePath = "/richtexteditor";
59
+ @Input() autoload = true;
60
+ @Input() config: Record<string, unknown> = {};
61
+ @Input() value?: RichTextEditorStructuredInput;
62
+ @Input() valueFormat: RichTextEditorValueFormat = "html";
63
+
64
+ @Output() change = new EventEmitter<RichTextEditorAngularChangeEvent>();
65
+ @Output() error = new EventEmitter<Error>();
66
+ @Output() ready = new EventEmitter<RichTextEditorInstance>();
67
+
68
+ @ViewChild("host", { static: true }) hostRef!: ElementRef<HTMLDivElement>;
69
+
70
+ private changeHandler: (() => void) | null = null;
71
+ private editor: RichTextEditorInstance | null = null;
72
+
73
+ async ngAfterViewInit(): Promise<void> {
74
+ try {
75
+ if (this.autoload === false) {
76
+ shared.installStructuredContentBridge();
77
+ } else {
78
+ await shared.loadRichTextEditorAssets({ basePath: this.assetBasePath });
79
+ }
80
+
81
+ this.editor = shared.createEditor(this.hostRef.nativeElement, this.config || {});
82
+
83
+ if (this.value !== undefined) {
84
+ this.syncEditor(this.value);
85
+ }
86
+
87
+ this.changeHandler = () => {
88
+ if (!this.editor) {
89
+ return;
90
+ }
91
+
92
+ this.change.emit({
93
+ editor: this.editor,
94
+ value: shared.getEditorValue(this.editor, this.valueFormat)
95
+ });
96
+ };
97
+
98
+ this.editor.attachEvent("change", this.changeHandler);
99
+ this.ready.emit(this.editor);
100
+ } catch (loadError) {
101
+ this.error.emit(loadError as Error);
102
+ }
103
+ }
104
+
105
+ ngOnChanges(changes: SimpleChanges): void {
106
+ if (!this.editor) {
107
+ return;
108
+ }
109
+
110
+ if (changes["value"] || changes["valueFormat"]) {
111
+ this.syncEditor(this.value);
112
+ }
113
+ }
114
+
115
+ ngOnDestroy(): void {
116
+ if (this.editor) {
117
+ if (this.changeHandler && typeof this.editor.detachEvent === "function") {
118
+ this.editor.detachEvent("change", this.changeHandler);
119
+ }
120
+ // Tear down instance-level global listeners so unmounting doesn't leak.
121
+ if (typeof this.editor.destroy === "function") {
122
+ try { this.editor.destroy(); } catch (e) { /* ignore */ }
123
+ }
124
+ }
125
+
126
+ this.hostRef.nativeElement.innerHTML = "";
127
+ this.editor = null;
128
+ this.changeHandler = null;
129
+ }
130
+
131
+ focus(): void {
132
+ if (this.editor) {
133
+ this.editor.focus();
134
+ }
135
+ }
136
+
137
+ getEditor(): RichTextEditorInstance | null {
138
+ return this.editor;
139
+ }
140
+
141
+ getHTMLCode(): string {
142
+ return this.editor ? this.editor.getHTMLCode() : "";
143
+ }
144
+
145
+ setHTMLCode(value: string): void {
146
+ if (this.editor) {
147
+ this.editor.setHTMLCode(value || "");
148
+ }
149
+ }
150
+
151
+ getJSON(): RichTextEditorStructuredDocument | null {
152
+ return this.editor ? this.editor.getJSON() : null;
153
+ }
154
+
155
+ setJSON(value: RichTextEditorStructuredInput): void {
156
+ if (this.editor) {
157
+ this.editor.setJSON(value);
158
+ }
159
+ }
160
+
161
+ getTextStatistics(): RichTextEditorTextStatistics | null {
162
+ if (!this.editor || typeof this.editor.getTextStatistics !== "function") {
163
+ return null;
164
+ }
165
+ return this.editor.getTextStatistics();
166
+ }
167
+
168
+ getSelectionStatistics(): RichTextEditorTextStatistics | null {
169
+ if (!this.editor || typeof this.editor.getSelectionStatistics !== "function") {
170
+ return null;
171
+ }
172
+ return this.editor.getSelectionStatistics();
173
+ }
174
+
175
+ getDocumentMetrics(): RichTextEditorDocumentMetrics | null {
176
+ if (!this.editor || typeof this.editor.getDocumentMetrics !== "function") {
177
+ return null;
178
+ }
179
+ return this.editor.getDocumentMetrics();
180
+ }
181
+
182
+ getDocumentPageSetup(): RichTextEditorPageSetup | null {
183
+ if (!this.editor || typeof this.editor.getDocumentPageSetup !== "function") {
184
+ return null;
185
+ }
186
+ return this.editor.getDocumentPageSetup();
187
+ }
188
+
189
+ setDocumentPageSetup(pageSetup: RichTextEditorPageSetup | null): RichTextEditorAngularComponent | null {
190
+ if (!this.editor || typeof this.editor.setDocumentPageSetup !== "function") {
191
+ return null;
192
+ }
193
+ this.editor.setDocumentPageSetup(pageSetup);
194
+ return this;
195
+ }
196
+
197
+ getDocumentOutline(): RichTextEditorDocumentOutlineItem[] {
198
+ if (!this.editor) {
199
+ return [];
200
+ }
201
+ return shared.getDocumentOutline(this.editor.getJSON());
202
+ }
203
+
204
+ getFootnotes(): RichTextEditorFootnoteItem[] {
205
+ if (!this.editor) {
206
+ return [];
207
+ }
208
+ return shared.getFootnotes(this.editor.getJSON());
209
+ }
210
+
211
+ getTableOfContents(options?: RichTextEditorTableOfContentsOptions): RichTextEditorTableOfContentsItem[] {
212
+ if (!this.editor) {
213
+ return [];
214
+ }
215
+ return shared.getTableOfContents(this.editor.getJSON(), options);
216
+ }
217
+
218
+ syncTableOfContents(options?: RichTextEditorTableOfContentsOptions): RichTextEditorStructuredDocument | null {
219
+ if (!this.editor) {
220
+ return null;
221
+ }
222
+ var documentModel = shared.syncTableOfContents(this.editor.getJSON(), options);
223
+ this.editor.setJSON(documentModel);
224
+ return documentModel;
225
+ }
226
+
227
+ auditAccessibility(): RichTextEditorAccessibilityResult | null {
228
+ if (!this.editor) {
229
+ return null;
230
+ }
231
+ return shared.auditAccessibility(this.editor.getJSON());
232
+ }
233
+
234
+ getAiToolkit(): RichTextEditorAiToolkit | null | undefined {
235
+ return this.getPluginNamespace("aiToolkit");
236
+ }
237
+
238
+ getDictation(): RichTextEditorDictation | null | undefined {
239
+ return this.getPluginNamespace("dictation");
240
+ }
241
+
242
+ getRevisionHistory(): RichTextEditorRevisionHistory | null | undefined {
243
+ return this.getPluginNamespace("revisionHistory");
244
+ }
245
+
246
+ getCollab(): RichTextEditorCollab | null | undefined {
247
+ return this.getPluginNamespace("collab");
248
+ }
249
+
250
+ getSlashCommands(): RichTextEditorSlashCommands | null | undefined {
251
+ return this.getPluginNamespace("slashCommands");
252
+ }
253
+
254
+ getMentions(): RichTextEditorMentions | null | undefined {
255
+ return this.getPluginNamespace("mentions");
256
+ }
257
+
258
+ getComments(): RichTextEditorComments | null | undefined {
259
+ return this.getPluginNamespace("comments");
260
+ }
261
+
262
+ getReviewLedger(): RichTextEditorReviewLedger | null | undefined {
263
+ return this.getPluginNamespace("reviewLedger");
264
+ }
265
+
266
+ private getPluginNamespace<T>(name: string): T | null | undefined {
267
+ if (!this.editor) {
268
+ return null;
269
+ }
270
+
271
+ return (this.editor as unknown as Record<string, T | undefined>)[name];
272
+ }
273
+
274
+ private syncEditor(nextValue: RichTextEditorStructuredInput | undefined): void {
275
+ if (!this.editor || nextValue === undefined) {
276
+ return;
277
+ }
278
+
279
+ var nextHtml = shared.normalizeStructuredContent(nextValue);
280
+ if (this.editor.getHTMLCode() !== nextHtml) {
281
+ shared.setEditorValue(this.editor, nextValue, this.valueFormat);
282
+ }
283
+ }
284
+ }
@@ -0,0 +1,80 @@
1
+ import type {
2
+ RichTextEditorAccessibilityResult,
3
+ RichTextEditorAiToolkit,
4
+ RichTextEditorCollab,
5
+ RichTextEditorComments,
6
+ RichTextEditorDictation,
7
+ RichTextEditorDocumentMetrics,
8
+ RichTextEditorDocumentOutlineItem,
9
+ RichTextEditorFootnoteItem,
10
+ RichTextEditorInstance,
11
+ RichTextEditorMentions,
12
+ RichTextEditorPageSetup,
13
+ RichTextEditorReviewLedger,
14
+ RichTextEditorRevisionHistory,
15
+ RichTextEditorSlashCommands,
16
+ RichTextEditorStructuredDocument,
17
+ RichTextEditorStructuredInput,
18
+ RichTextEditorTableOfContentsItem,
19
+ RichTextEditorTableOfContentsOptions,
20
+ RichTextEditorTextStatistics,
21
+ RichTextEditorValueFormat
22
+ } from "../index";
23
+
24
+ export interface RichTextEditorAngularChangeEvent {
25
+ editor: RichTextEditorInstance;
26
+ value: string | RichTextEditorStructuredDocument;
27
+ }
28
+
29
+ export declare class RichTextEditorAngularComponent {
30
+ assetBasePath: string;
31
+ autoload: boolean;
32
+ config: Record<string, unknown>;
33
+ value?: RichTextEditorStructuredInput;
34
+ valueFormat: RichTextEditorValueFormat;
35
+
36
+ focus(): void;
37
+ getEditor(): RichTextEditorInstance | null;
38
+ getHTMLCode(): string;
39
+ setHTMLCode(value: string): void;
40
+ getJSON(): RichTextEditorStructuredDocument | null;
41
+ setJSON(value: RichTextEditorStructuredInput): void;
42
+ getTextStatistics(): RichTextEditorTextStatistics | null;
43
+ getSelectionStatistics(): RichTextEditorTextStatistics | null;
44
+ getDocumentMetrics(): RichTextEditorDocumentMetrics | null;
45
+ getDocumentPageSetup(): RichTextEditorPageSetup | null;
46
+ setDocumentPageSetup(pageSetup: RichTextEditorPageSetup | null): RichTextEditorAngularComponent | null;
47
+ getDocumentOutline(): RichTextEditorDocumentOutlineItem[];
48
+ getFootnotes(): RichTextEditorFootnoteItem[];
49
+ getTableOfContents(options?: RichTextEditorTableOfContentsOptions): RichTextEditorTableOfContentsItem[];
50
+ syncTableOfContents(options?: RichTextEditorTableOfContentsOptions): RichTextEditorStructuredDocument | null;
51
+ auditAccessibility(): RichTextEditorAccessibilityResult | null;
52
+
53
+ getAiToolkit(): RichTextEditorAiToolkit | null | undefined;
54
+ getDictation(): RichTextEditorDictation | null | undefined;
55
+ getRevisionHistory(): RichTextEditorRevisionHistory | null | undefined;
56
+ getCollab(): RichTextEditorCollab | null | undefined;
57
+ getSlashCommands(): RichTextEditorSlashCommands | null | undefined;
58
+ getMentions(): RichTextEditorMentions | null | undefined;
59
+ getComments(): RichTextEditorComments | null | undefined;
60
+ getReviewLedger(): RichTextEditorReviewLedger | null | undefined;
61
+ }
62
+
63
+ export {
64
+ auditAccessibility,
65
+ createStructuredContent,
66
+ createStructuredDocument,
67
+ fromMarkdown,
68
+ getDocumentPageSetup,
69
+ getDocumentMetrics,
70
+ getDocumentOutline,
71
+ getFootnotes,
72
+ getTableOfContents,
73
+ getTextStatistics,
74
+ loadRichTextEditorAssets,
75
+ renderHTML,
76
+ setDocumentPageSetup,
77
+ syncTableOfContents,
78
+ toMarkdown,
79
+ validateStructuredContent
80
+ } from "../integrations/shared";
@@ -0,0 +1,24 @@
1
+ export {
2
+ RichTextEditorAngularComponent,
3
+ type RichTextEditorAngularChangeEvent
4
+ } from "./component";
5
+
6
+ export {
7
+ auditAccessibility,
8
+ auditLinks,
9
+ createStructuredContent,
10
+ createStructuredDocument,
11
+ fromMarkdown,
12
+ getDocumentPageSetup,
13
+ getDocumentMetrics,
14
+ getDocumentOutline,
15
+ getFootnotes,
16
+ getTableOfContents,
17
+ getTextStatistics,
18
+ loadRichTextEditorAssets,
19
+ renderHTML,
20
+ setDocumentPageSetup,
21
+ syncTableOfContents,
22
+ toMarkdown,
23
+ validateStructuredContent
24
+ } from "../integrations/shared";
@@ -0,0 +1,65 @@
1
+ // Type definitions for richtexteditor/headless
2
+
3
+ export interface HeadlessEditorOptions {
4
+ /** Initial HTML content. */
5
+ value?: string;
6
+ /** Partial RichTextEditor config, merged over the default config. */
7
+ config?: Record<string, any>;
8
+ /** Keep the word/character status counter (off by default in headless mode). */
9
+ showStatistics?: boolean;
10
+ /** Base path used to load rte.js + assets. Defaults to "/richtexteditor". */
11
+ assetBasePath?: string;
12
+ /** Skip asset auto-loading (assets already present on the page). */
13
+ autoload?: boolean;
14
+ }
15
+
16
+ export type HeadlessFormat =
17
+ | "bold" | "italic" | "underline" | "strike" | "strikethrough"
18
+ | "subscript" | "superscript" | "ul" | "ol"
19
+ | "justifyleft" | "justifycenter" | "justifyright" | "justifyfull"
20
+ | "h1" | "h2" | "h3" | "h4" | "h5" | "h6"
21
+ | "p" | "paragraph" | "blockquote" | "pre";
22
+
23
+ export interface HeadlessState {
24
+ [key: string]: boolean;
25
+ canUndo: boolean;
26
+ canRedo: boolean;
27
+ }
28
+
29
+ export type HeadlessEventName = "update" | "change" | "selectionchange" | "focus" | "blur";
30
+
31
+ export interface HeadlessController {
32
+ /** The underlying RichTextEditor instance (escape hatch). */
33
+ readonly editor: any;
34
+ /** Dispatch a command. Block types use run("formatblock", "h1"). Chainable. */
35
+ run(command: string, value?: string): this;
36
+ cmd(command: string, value?: string): this;
37
+ /** Is a format active at the current selection? */
38
+ isActive(name: HeadlessFormat | string): boolean;
39
+ /** Is a command currently enabled (e.g. "undo")? */
40
+ can(command: string): boolean;
41
+ /** Snapshot of active formatting (+ canUndo/canRedo) for binding a toolbar. */
42
+ state(keys?: string[]): HeadlessState;
43
+ on(event: HeadlessEventName, cb: (...args: any[]) => void): this;
44
+ off(event: HeadlessEventName, cb?: (...args: any[]) => void): this;
45
+ getHTML(): string;
46
+ setHTML(html: string): this;
47
+ getText(): string;
48
+ setText(text: string): this;
49
+ getMarkdown(): string;
50
+ setMarkdown(markdown: string): this;
51
+ getJSON(): any;
52
+ getStatistics(): { words: number; characters: number } | null;
53
+ isEmpty(): boolean;
54
+ focus(): this;
55
+ destroy(): this;
56
+ }
57
+
58
+ /** Load assets, mount a chrome-less editor, and resolve to a controller. */
59
+ export function createHeadlessEditor(
60
+ element: string | HTMLElement,
61
+ options?: HeadlessEditorOptions
62
+ ): Promise<HeadlessController>;
63
+
64
+ export const STATE_MAP: Record<string, { kind: "state" | "block"; q: string }>;
65
+ export const DEFAULT_STATE_KEYS: string[];