@nanahoshi/mona-ui 0.1.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 (134) hide show
  1. package/README.md +25 -0
  2. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +590 -0
  3. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +168 -0
  4. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +220 -0
  5. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +225 -0
  6. package/fesm2022/nanahoshi-mona-ui-button.mjs +497 -0
  7. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +1569 -0
  8. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +339 -0
  9. package/fesm2022/nanahoshi-mona-ui-chip.mjs +453 -0
  10. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +200 -0
  11. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +853 -0
  12. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +923 -0
  13. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +495 -0
  14. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +686 -0
  15. package/fesm2022/nanahoshi-mona-ui-common.mjs +642 -0
  16. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +485 -0
  17. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +132 -0
  18. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +460 -0
  19. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +659 -0
  20. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +828 -0
  21. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +523 -0
  22. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +615 -0
  23. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +701 -0
  24. package/fesm2022/nanahoshi-mona-ui-editor.mjs +1400 -0
  25. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +245 -0
  26. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +170 -0
  27. package/fesm2022/nanahoshi-mona-ui-filter.mjs +680 -0
  28. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-cell.component-B9SQH5N-.mjs +105 -0
  29. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DlLwcCFT.mjs +42 -0
  30. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-Dgea-O0X.mjs +130 -0
  31. package/fesm2022/nanahoshi-mona-ui-grid-grid-toggle.component-DIUutx9s.mjs +773 -0
  32. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DRHycGIh.mjs +240 -0
  33. package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-C3eZIaJK.mjs +5374 -0
  34. package/fesm2022/nanahoshi-mona-ui-grid.mjs +2 -0
  35. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +87 -0
  36. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +154 -0
  37. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1356 -0
  38. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2263 -0
  39. package/fesm2022/nanahoshi-mona-ui-internal.mjs +379 -0
  40. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +630 -0
  41. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +527 -0
  42. package/fesm2022/nanahoshi-mona-ui-list.mjs +4 -0
  43. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +966 -0
  44. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +641 -0
  45. package/fesm2022/nanahoshi-mona-ui-notification.mjs +536 -0
  46. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +597 -0
  47. package/fesm2022/nanahoshi-mona-ui-pager.mjs +790 -0
  48. package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +83 -0
  49. package/fesm2022/nanahoshi-mona-ui-popover.mjs +325 -0
  50. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +1559 -0
  51. package/fesm2022/nanahoshi-mona-ui-popup.mjs +1321 -0
  52. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +294 -0
  53. package/fesm2022/nanahoshi-mona-ui-query.mjs +175 -0
  54. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +339 -0
  55. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +565 -0
  56. package/fesm2022/nanahoshi-mona-ui-slider.mjs +1049 -0
  57. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +636 -0
  58. package/fesm2022/nanahoshi-mona-ui-splitter.mjs +843 -0
  59. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +537 -0
  60. package/fesm2022/nanahoshi-mona-ui-switch.mjs +308 -0
  61. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +664 -0
  62. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +111 -0
  63. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +369 -0
  64. package/fesm2022/nanahoshi-mona-ui-theme.mjs +314 -0
  65. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +450 -0
  66. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +723 -0
  67. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +716 -0
  68. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +733 -0
  69. package/fesm2022/nanahoshi-mona-ui-window.mjs +1329 -0
  70. package/fesm2022/nanahoshi-mona-ui.mjs +9 -0
  71. package/package.json +289 -0
  72. package/types/nanahoshi-mona-ui-auto-complete.d.ts +223 -0
  73. package/types/nanahoshi-mona-ui-avatar.d.ts +642 -0
  74. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +70 -0
  75. package/types/nanahoshi-mona-ui-button-group.d.ts +77 -0
  76. package/types/nanahoshi-mona-ui-button.d.ts +111 -0
  77. package/types/nanahoshi-mona-ui-calendar.d.ts +262 -0
  78. package/types/nanahoshi-mona-ui-check-box.d.ts +133 -0
  79. package/types/nanahoshi-mona-ui-chip.d.ts +130 -0
  80. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +113 -0
  81. package/types/nanahoshi-mona-ui-color-gradient.d.ts +201 -0
  82. package/types/nanahoshi-mona-ui-color-palette.d.ts +102 -0
  83. package/types/nanahoshi-mona-ui-color-picker.d.ts +156 -0
  84. package/types/nanahoshi-mona-ui-combo-box.d.ts +232 -0
  85. package/types/nanahoshi-mona-ui-common.d.ts +386 -0
  86. package/types/nanahoshi-mona-ui-contextmenu.d.ts +129 -0
  87. package/types/nanahoshi-mona-ui-date-input.d.ts +60 -0
  88. package/types/nanahoshi-mona-ui-date-picker.d.ts +177 -0
  89. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +199 -0
  90. package/types/nanahoshi-mona-ui-dialog.d.ts +261 -0
  91. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +159 -0
  92. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +219 -0
  93. package/types/nanahoshi-mona-ui-dropdowns.d.ts +176 -0
  94. package/types/nanahoshi-mona-ui-editor.d.ts +113 -0
  95. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +87 -0
  96. package/types/nanahoshi-mona-ui-fieldset.d.ts +68 -0
  97. package/types/nanahoshi-mona-ui-filter.d.ts +115 -0
  98. package/types/nanahoshi-mona-ui-grid.d.ts +1114 -0
  99. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +25 -0
  100. package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +28 -0
  101. package/types/nanahoshi-mona-ui-internal-list.d.ts +269 -0
  102. package/types/nanahoshi-mona-ui-internal-tree.d.ts +391 -0
  103. package/types/nanahoshi-mona-ui-internal.d.ts +136 -0
  104. package/types/nanahoshi-mona-ui-list-box.d.ts +225 -0
  105. package/types/nanahoshi-mona-ui-list-view.d.ts +188 -0
  106. package/types/nanahoshi-mona-ui-list.d.ts +1 -0
  107. package/types/nanahoshi-mona-ui-menubar.d.ts +198 -0
  108. package/types/nanahoshi-mona-ui-multi-select.d.ts +247 -0
  109. package/types/nanahoshi-mona-ui-notification.d.ts +106 -0
  110. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +161 -0
  111. package/types/nanahoshi-mona-ui-pager.d.ts +238 -0
  112. package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -0
  113. package/types/nanahoshi-mona-ui-popover.d.ts +130 -0
  114. package/types/nanahoshi-mona-ui-popup-menu.d.ts +412 -0
  115. package/types/nanahoshi-mona-ui-popup.d.ts +485 -0
  116. package/types/nanahoshi-mona-ui-progress-bar.d.ts +139 -0
  117. package/types/nanahoshi-mona-ui-query.d.ts +89 -0
  118. package/types/nanahoshi-mona-ui-radio-button.d.ts +128 -0
  119. package/types/nanahoshi-mona-ui-scroll-view.d.ts +166 -0
  120. package/types/nanahoshi-mona-ui-slider.d.ts +305 -0
  121. package/types/nanahoshi-mona-ui-split-button.d.ts +182 -0
  122. package/types/nanahoshi-mona-ui-splitter.d.ts +70 -0
  123. package/types/nanahoshi-mona-ui-stepper.d.ts +173 -0
  124. package/types/nanahoshi-mona-ui-switch.d.ts +125 -0
  125. package/types/nanahoshi-mona-ui-tabs.d.ts +158 -0
  126. package/types/nanahoshi-mona-ui-text-area.d.ts +42 -0
  127. package/types/nanahoshi-mona-ui-text-box.d.ts +164 -0
  128. package/types/nanahoshi-mona-ui-theme.d.ts +23 -0
  129. package/types/nanahoshi-mona-ui-time-picker.d.ts +184 -0
  130. package/types/nanahoshi-mona-ui-time-selector.d.ts +143 -0
  131. package/types/nanahoshi-mona-ui-tooltip.d.ts +130 -0
  132. package/types/nanahoshi-mona-ui-tree-view.d.ts +274 -0
  133. package/types/nanahoshi-mona-ui-window.d.ts +295 -0
  134. package/types/nanahoshi-mona-ui.d.ts +2 -0
@@ -0,0 +1,1400 @@
1
+ import * as i0 from '@angular/core';
2
+ import { signal, Injectable, computed, inject, Component, DOCUMENT, output, ChangeDetectionStrategy, viewChild, input, effect, untracked } from '@angular/core';
3
+ import * as i1 from '@angular/forms';
4
+ import { FormsModule, FormGroup, FormControl, Validators, ReactiveFormsModule } from '@angular/forms';
5
+ import { ImmutableSet, any, List } from '@mirei/ts-collections';
6
+ import { Extension, Editor } from '@tiptap/core';
7
+ import { Color } from '@tiptap/extension-color';
8
+ import { FontFamily } from '@tiptap/extension-font-family';
9
+ import { Highlight } from '@tiptap/extension-highlight';
10
+ import { Link } from '@tiptap/extension-link';
11
+ import { Subscript } from '@tiptap/extension-subscript';
12
+ import { Superscript } from '@tiptap/extension-superscript';
13
+ import { Table } from '@tiptap/extension-table';
14
+ import { TableCell } from '@tiptap/extension-table-cell';
15
+ import { TableHeader } from '@tiptap/extension-table-header';
16
+ import { TableRow } from '@tiptap/extension-table-row';
17
+ import { TaskItem } from '@tiptap/extension-task-item';
18
+ import { TaskList } from '@tiptap/extension-task-list';
19
+ import { TextAlign } from '@tiptap/extension-text-align';
20
+ import { TextStyle } from '@tiptap/extension-text-style';
21
+ import { Underline } from '@tiptap/extension-underline';
22
+ import { StarterKit } from '@tiptap/starter-kit';
23
+ import { Subject } from 'rxjs';
24
+ import { Image } from '@tiptap/extension-image';
25
+ import { TextSelection, AllSelection } from '@tiptap/pm/state';
26
+ import { ButtonDirective } from '@nanahoshi/mona-ui/button';
27
+ import { ButtonGroupComponent } from '@nanahoshi/mona-ui/button-group';
28
+ import { ColorPickerComponent, ColorPickerValueTemplateDirective } from '@nanahoshi/mona-ui/color-picker';
29
+ import { DropdownListComponent } from '@nanahoshi/mona-ui/dropdown-list';
30
+ import { DropdownItemTemplateDirective } from '@nanahoshi/mona-ui/dropdowns';
31
+ import { WindowComponent } from '@nanahoshi/mona-ui/window';
32
+ import { NumericTextBoxComponent } from '@nanahoshi/mona-ui/numeric-text-box';
33
+ import { TextBoxComponent } from '@nanahoshi/mona-ui/text-box';
34
+ import { DialogService } from '@nanahoshi/mona-ui/dialog';
35
+ import { PopoverComponent } from '@nanahoshi/mona-ui/popover';
36
+
37
+ const ExtendedImage = Image.extend({
38
+ name: "extendedImage",
39
+ addAttributes() {
40
+ return {
41
+ width: {
42
+ default: null,
43
+ parseHTML: (element) => element.getAttribute("width"),
44
+ renderHTML: (attributes) => attributes["width"] ? { width: attributes["width"] } : {}
45
+ },
46
+ height: {
47
+ default: null,
48
+ parseHTML: (element) => element.getAttribute("height"),
49
+ renderHTML: (attributes) => attributes["height"] ? { height: attributes["height"] } : {}
50
+ }
51
+ };
52
+ }
53
+ });
54
+
55
+ const FontSize = Extension.create({
56
+ name: "fontSize",
57
+ addOptions() {
58
+ return {
59
+ types: ["textStyle"],
60
+ getStyle: (fontSize) => {
61
+ return `font-size: ${fontSize}`;
62
+ }
63
+ };
64
+ },
65
+ addGlobalAttributes() {
66
+ return [
67
+ {
68
+ types: this.options.types,
69
+ attributes: {
70
+ fontSize: {
71
+ default: null,
72
+ parseHTML: element => element.style.fontSize.replace(/['"]+/g, ""),
73
+ renderHTML: attributes => {
74
+ if (!attributes["fontSize"]) {
75
+ return {};
76
+ }
77
+ return {
78
+ style: this.options.getStyle(attributes["fontSize"])
79
+ };
80
+ }
81
+ }
82
+ }
83
+ }
84
+ ];
85
+ },
86
+ addCommands() {
87
+ return {
88
+ setFontSize: fontSize => ({ chain }) => {
89
+ return chain().setMark("textStyle", { fontSize }).run();
90
+ },
91
+ unsetFontSize: () => ({ chain }) => {
92
+ return chain().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run();
93
+ }
94
+ };
95
+ }
96
+ });
97
+
98
+ /**
99
+ * Indent extension for Tiptap v3
100
+ * Port of the well-known v2 example, updated for @tiptap/core@3 and @tiptap/pm.
101
+ */
102
+ const clamp = (val, min, max) => {
103
+ if (val < min)
104
+ return min;
105
+ if (val > max)
106
+ return max;
107
+ return val;
108
+ };
109
+ var IndentProps;
110
+ (function (IndentProps) {
111
+ IndentProps[IndentProps["min"] = 0] = "min";
112
+ IndentProps[IndentProps["max"] = 210] = "max";
113
+ IndentProps[IndentProps["more"] = 30] = "more";
114
+ IndentProps[IndentProps["less"] = -30] = "less";
115
+ })(IndentProps || (IndentProps = {}));
116
+ /**
117
+ * Helpers for list detection (kept simple here).
118
+ * If you want to support more list types, extend these.
119
+ */
120
+ const isBulletListNode = (name) => name === "bulletList" || name === "bullet_list";
121
+ const isOrderedListNode = (name) => name === "orderedList" || name === "ordered_list";
122
+ const isTaskListNode = (name) => name === "taskList" || name === "task_list";
123
+ const isListNodeName = (name) => isBulletListNode(name) || isOrderedListNode(name) || isTaskListNode(name);
124
+ /**
125
+ * Update the `indent` attribute of the node at `pos` by `delta` pixels.
126
+ */
127
+ const setNodeIndentMarkup = (tr, pos, delta) => {
128
+ const doc = tr.doc;
129
+ if (!doc)
130
+ return tr;
131
+ const node = doc.nodeAt(pos);
132
+ if (!node)
133
+ return tr;
134
+ const minIndent = IndentProps.min;
135
+ const maxIndent = IndentProps.max;
136
+ const currentIndent = node.attrs.indent ?? 0;
137
+ const indent = clamp(currentIndent + delta, minIndent, maxIndent);
138
+ if (indent === currentIndent)
139
+ return tr;
140
+ const nodeAttrs = {
141
+ ...node.attrs,
142
+ indent
143
+ };
144
+ return tr.setNodeMarkup(pos, node.type, nodeAttrs, node.marks);
145
+ };
146
+ /**
147
+ * Apply indent delta to all matching blocks in the current selection.
148
+ */
149
+ const updateIndentLevel = (tr, delta, options) => {
150
+ const { doc, selection } = tr;
151
+ if (!doc || !selection)
152
+ return tr;
153
+ if (!(selection instanceof TextSelection || selection instanceof AllSelection)) {
154
+ return tr;
155
+ }
156
+ const { from, to } = selection;
157
+ doc.nodesBetween(from, to, (node, pos) => {
158
+ const nodeName = node.type.name;
159
+ // Only apply to configured types (typically paragraph + heading)
160
+ if (options.types.includes(nodeName)) {
161
+ tr = setNodeIndentMarkup(tr, pos, delta);
162
+ return false;
163
+ }
164
+ // Don’t traverse into lists (you might want to handle list indentation differently)
165
+ if (isListNodeName(nodeName)) {
166
+ return false;
167
+ }
168
+ return true;
169
+ });
170
+ return tr;
171
+ };
172
+ const Indent = Extension.create({
173
+ name: "indent",
174
+ /**
175
+ * Tiptap v3 uses `addOptions` instead of `defaultOptions`.
176
+ */
177
+ addOptions() {
178
+ return {
179
+ types: ["paragraph", "heading"],
180
+ indentLevels: [0, 30, 60, 90, 120, 150, 180, 210],
181
+ defaultIndentLevel: 0
182
+ };
183
+ },
184
+ /**
185
+ * Attach a global `indent` attribute to the configured node types.
186
+ * Stored as a pixel value and rendered as `margin-left`.
187
+ */
188
+ addGlobalAttributes() {
189
+ return [
190
+ {
191
+ types: this.options.types,
192
+ attributes: {
193
+ indent: {
194
+ default: this.options.defaultIndentLevel,
195
+ renderHTML: attributes => {
196
+ const indent = attributes["indent"] ?? this.options.defaultIndentLevel;
197
+ if (!indent || indent === 0) {
198
+ return {};
199
+ }
200
+ return {
201
+ style: `margin-left: ${indent}px;`
202
+ };
203
+ },
204
+ parseHTML: element => {
205
+ const raw = element.style.marginLeft;
206
+ const parsed = raw ? parseInt(raw, 10) : NaN;
207
+ return Number.isNaN(parsed) ? this.options.defaultIndentLevel : parsed;
208
+ }
209
+ }
210
+ }
211
+ }
212
+ ];
213
+ },
214
+ addCommands() {
215
+ return {
216
+ indent: () => ({ tr, state, dispatch }) => {
217
+ const { selection } = state;
218
+ // Keep current selection intact
219
+ tr = tr.setSelection(selection);
220
+ tr = updateIndentLevel(tr, IndentProps.more, this.options);
221
+ if (tr.docChanged && dispatch) {
222
+ dispatch(tr);
223
+ return true;
224
+ }
225
+ return false;
226
+ },
227
+ outdent: () => ({ tr, state, dispatch }) => {
228
+ const { selection } = state;
229
+ tr = tr.setSelection(selection);
230
+ tr = updateIndentLevel(tr, IndentProps.less, this.options);
231
+ if (tr.docChanged && dispatch) {
232
+ dispatch(tr);
233
+ return true;
234
+ }
235
+ return false;
236
+ }
237
+ };
238
+ },
239
+ /**
240
+ * Default keyboard shortcuts:
241
+ * - Tab → indent()
242
+ * - Shift-Tab → outdent()
243
+ */
244
+ addKeyboardShortcuts() {
245
+ const indentCommand = () => this.editor.commands.indent();
246
+ const outdentCommand = () => this.editor.commands.outdent();
247
+ return {
248
+ Tab: indentCommand,
249
+ "Shift-Tab": outdentCommand
250
+ };
251
+ }
252
+ });
253
+
254
+ class EditorService {
255
+ constructor() {
256
+ this.#defaultSettings = {
257
+ alignment: true,
258
+ blockquote: true,
259
+ bold: true,
260
+ code: true,
261
+ fontColor: true,
262
+ fontFamily: true,
263
+ fontHighlight: true,
264
+ fontList: [],
265
+ fontSize: true,
266
+ headings: true,
267
+ history: true,
268
+ horizontalRule: true,
269
+ image: true,
270
+ indent: true,
271
+ italic: true,
272
+ link: true,
273
+ list: true,
274
+ strikethrough: true,
275
+ subscript: true,
276
+ superscript: true,
277
+ table: true,
278
+ taskList: true,
279
+ underline: true
280
+ };
281
+ this.#state = signal({}, /* @ts-ignore */
282
+ ...(ngDevMode ? [{ debugName: "#state" }] : /* istanbul ignore next */ []));
283
+ this.blur$ = new Subject();
284
+ this.create$ = new Subject();
285
+ this.focus$ = new Subject();
286
+ this.fontSizes = signal(ImmutableSet.create([
287
+ "10px",
288
+ "12px",
289
+ "14px",
290
+ "16px",
291
+ "18px",
292
+ "20px",
293
+ "24px",
294
+ "32px",
295
+ "36px",
296
+ "48px",
297
+ "60px",
298
+ "72px"
299
+ ]), /* @ts-ignore */
300
+ ...(ngDevMode ? [{ debugName: "fontSizes" }] : /* istanbul ignore next */ []));
301
+ this.fonts = signal(ImmutableSet.create([
302
+ "Arial",
303
+ "Comic Sans MS",
304
+ "Courier New",
305
+ "Georgia",
306
+ "Impact",
307
+ "Lucida Console",
308
+ "Lucida Sans Unicode",
309
+ "Palatino Linotype",
310
+ "Tahoma",
311
+ "Times New Roman",
312
+ "Trebuchet MS",
313
+ "Verdana"
314
+ ]), /* @ts-ignore */
315
+ ...(ngDevMode ? [{ debugName: "fonts" }] : /* istanbul ignore next */ []));
316
+ this.state = this.#state.asReadonly();
317
+ this.selectionUpdate$ = new Subject();
318
+ this.settings = signal({}, /* @ts-ignore */
319
+ ...(ngDevMode ? [{ debugName: "settings" }] : /* istanbul ignore next */ []));
320
+ this.update$ = new Subject();
321
+ }
322
+ #defaultSettings;
323
+ #state;
324
+ #editor;
325
+ destroy() {
326
+ this.#editor.destroy();
327
+ }
328
+ setupEditor(element, settings) {
329
+ if (this.#editor) {
330
+ this.#editor.destroy();
331
+ }
332
+ const editorSettings = { ...this.#defaultSettings, ...settings };
333
+ if (editorSettings.fontList && any(editorSettings.fontList)) {
334
+ this.fonts.set(ImmutableSet.create(editorSettings.fontList));
335
+ }
336
+ this.#editor = new Editor({
337
+ element,
338
+ extensions: this.getExtensionsFromSettings(editorSettings),
339
+ content: ``,
340
+ onBlur: () => this.blur$.next(),
341
+ onCreate: ({ editor }) => {
342
+ this.#state.set(editor.state);
343
+ this.settings.set(editorSettings);
344
+ this.create$.next();
345
+ },
346
+ onFocus: () => this.focus$.next(),
347
+ onSelectionUpdate: () => this.selectionUpdate$.next(),
348
+ onTransaction: tx => this.#state.set(tx.editor.state),
349
+ onUpdate: () => this.update$.next()
350
+ });
351
+ }
352
+ get editor() {
353
+ return this.#editor;
354
+ }
355
+ getExtensionsFromSettings(settings) {
356
+ const extensions = new List();
357
+ extensions.add(TextStyle);
358
+ const customizedStarterKit = this.getCustomizedStarterKitExtension(settings);
359
+ extensions.add(customizedStarterKit);
360
+ if (settings.alignment) {
361
+ extensions.add(TextAlign.configure({
362
+ types: ["paragraph", "heading"]
363
+ }));
364
+ }
365
+ if (settings.fontColor) {
366
+ extensions.add(Color);
367
+ }
368
+ if (settings.fontFamily) {
369
+ extensions.add(FontFamily);
370
+ }
371
+ if (settings.fontHighlight) {
372
+ extensions.add(Highlight.configure({ multicolor: true }));
373
+ }
374
+ if (settings.fontSize) {
375
+ extensions.add(FontSize);
376
+ }
377
+ if (settings.image) {
378
+ extensions.add(ExtendedImage);
379
+ }
380
+ if (settings.indent) {
381
+ extensions.add(Indent);
382
+ }
383
+ if (settings.link) {
384
+ extensions.add(Link.configure({
385
+ openOnClick: "whenNotEditable",
386
+ autolink: true
387
+ }));
388
+ }
389
+ if (settings.subscript) {
390
+ extensions.add(Subscript);
391
+ }
392
+ if (settings.superscript) {
393
+ extensions.add(Superscript);
394
+ }
395
+ if (settings.underline) {
396
+ extensions.add(Underline);
397
+ }
398
+ if (settings.table) {
399
+ extensions.add(Table.configure({
400
+ resizable: true
401
+ }));
402
+ extensions.add(TableHeader);
403
+ extensions.add(TableRow);
404
+ extensions.add(TableCell);
405
+ }
406
+ if (settings.taskList) {
407
+ extensions.add(TaskList);
408
+ extensions.add(TaskItem.configure({
409
+ nested: true
410
+ }));
411
+ }
412
+ return extensions.toArray();
413
+ }
414
+ getCustomizedStarterKitExtension(settings) {
415
+ let starterKit = StarterKit;
416
+ if (!settings.bold) {
417
+ starterKit = starterKit.configure({ bold: false });
418
+ }
419
+ if (!settings.italic) {
420
+ starterKit = starterKit.configure({ italic: false });
421
+ }
422
+ if (!settings.strikethrough) {
423
+ starterKit = starterKit.configure({ strike: false });
424
+ }
425
+ if (!settings.history) {
426
+ starterKit = starterKit.configure({ undoRedo: false });
427
+ }
428
+ if (!settings.blockquote) {
429
+ starterKit = starterKit.configure({ blockquote: false });
430
+ }
431
+ if (!settings.list) {
432
+ starterKit = starterKit.configure({ bulletList: false, orderedList: false, listItem: false });
433
+ }
434
+ if (!settings.headings) {
435
+ starterKit = starterKit.configure({ heading: false });
436
+ }
437
+ if (!settings.horizontalRule) {
438
+ starterKit = starterKit.configure({ horizontalRule: false });
439
+ }
440
+ if (!settings.code) {
441
+ starterKit = starterKit.configure({ code: false });
442
+ }
443
+ return starterKit;
444
+ }
445
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
446
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorService }); }
447
+ }
448
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorService, decorators: [{
449
+ type: Injectable
450
+ }] });
451
+
452
+ class EditorBasicTextStylesComponent {
453
+ constructor() {
454
+ this.anyToolVisible = computed(() => {
455
+ return (this.boldVisible() ||
456
+ this.italicVisible() ||
457
+ this.underlineVisible() ||
458
+ this.strikeThroughVisible() ||
459
+ this.subscriptVisible() ||
460
+ this.superscriptVisible());
461
+ }, /* @ts-ignore */
462
+ ...(ngDevMode ? [{ debugName: "anyToolVisible" }] : /* istanbul ignore next */ []));
463
+ this.boldSelected = computed(() => {
464
+ this.editorService.state();
465
+ return this.editorService.editor.isActive("bold");
466
+ }, /* @ts-ignore */
467
+ ...(ngDevMode ? [{ debugName: "boldSelected" }] : /* istanbul ignore next */ []));
468
+ this.boldVisible = computed(() => {
469
+ return this.editorService.settings().bold;
470
+ }, /* @ts-ignore */
471
+ ...(ngDevMode ? [{ debugName: "boldVisible" }] : /* istanbul ignore next */ []));
472
+ this.editorService = inject(EditorService);
473
+ this.italicSelected = computed(() => {
474
+ this.editorService.state();
475
+ return this.editorService.editor.isActive("italic");
476
+ }, /* @ts-ignore */
477
+ ...(ngDevMode ? [{ debugName: "italicSelected" }] : /* istanbul ignore next */ []));
478
+ this.italicVisible = computed(() => {
479
+ return this.editorService.settings().italic;
480
+ }, /* @ts-ignore */
481
+ ...(ngDevMode ? [{ debugName: "italicVisible" }] : /* istanbul ignore next */ []));
482
+ this.strikeThroughSelected = computed(() => {
483
+ this.editorService.state();
484
+ return this.editorService.editor.isActive("strike");
485
+ }, /* @ts-ignore */
486
+ ...(ngDevMode ? [{ debugName: "strikeThroughSelected" }] : /* istanbul ignore next */ []));
487
+ this.strikeThroughVisible = computed(() => {
488
+ return this.editorService.settings().strikethrough;
489
+ }, /* @ts-ignore */
490
+ ...(ngDevMode ? [{ debugName: "strikeThroughVisible" }] : /* istanbul ignore next */ []));
491
+ this.subscriptSelected = computed(() => {
492
+ this.editorService.state();
493
+ return this.editorService.editor.isActive("subscript");
494
+ }, /* @ts-ignore */
495
+ ...(ngDevMode ? [{ debugName: "subscriptSelected" }] : /* istanbul ignore next */ []));
496
+ this.subscriptVisible = computed(() => {
497
+ return this.editorService.settings().subscript;
498
+ }, /* @ts-ignore */
499
+ ...(ngDevMode ? [{ debugName: "subscriptVisible" }] : /* istanbul ignore next */ []));
500
+ this.superscriptSelected = computed(() => {
501
+ this.editorService.state();
502
+ return this.editorService.editor.isActive("superscript");
503
+ }, /* @ts-ignore */
504
+ ...(ngDevMode ? [{ debugName: "superscriptSelected" }] : /* istanbul ignore next */ []));
505
+ this.superscriptVisible = computed(() => {
506
+ return this.editorService.settings().superscript;
507
+ }, /* @ts-ignore */
508
+ ...(ngDevMode ? [{ debugName: "superscriptVisible" }] : /* istanbul ignore next */ []));
509
+ this.underlineSelected = computed(() => {
510
+ this.editorService.state();
511
+ return this.editorService.editor.isActive("underline");
512
+ }, /* @ts-ignore */
513
+ ...(ngDevMode ? [{ debugName: "underlineSelected" }] : /* istanbul ignore next */ []));
514
+ this.underlineVisible = computed(() => {
515
+ return this.editorService.settings().underline;
516
+ }, /* @ts-ignore */
517
+ ...(ngDevMode ? [{ debugName: "underlineVisible" }] : /* istanbul ignore next */ []));
518
+ }
519
+ onBoldToggle() {
520
+ if (this.boldSelected()) {
521
+ this.editorService.editor.chain().focus().unsetBold().run();
522
+ }
523
+ else {
524
+ this.editorService.editor.chain().focus().setBold().run();
525
+ }
526
+ }
527
+ onItalicToggle() {
528
+ if (this.italicSelected()) {
529
+ this.editorService.editor.chain().focus().unsetItalic().run();
530
+ }
531
+ else {
532
+ this.editorService.editor.chain().focus().setItalic().run();
533
+ }
534
+ }
535
+ onStrikeThroughToggle() {
536
+ if (this.strikeThroughSelected()) {
537
+ this.editorService.editor.chain().focus().unsetStrike().run();
538
+ }
539
+ else {
540
+ this.editorService.editor.chain().focus().setStrike().run();
541
+ }
542
+ }
543
+ onSubscriptToggle() {
544
+ if (this.subscriptSelected()) {
545
+ this.editorService.editor.chain().focus().unsetSubscript().run();
546
+ }
547
+ else {
548
+ this.editorService.editor.chain().focus().setSubscript().run();
549
+ }
550
+ }
551
+ onSuperscriptToggle() {
552
+ if (this.superscriptSelected()) {
553
+ this.editorService.editor.chain().focus().unsetSuperscript().run();
554
+ }
555
+ else {
556
+ this.editorService.editor.chain().focus().setSuperscript().run();
557
+ }
558
+ }
559
+ onUnderlineToggle() {
560
+ if (this.underlineSelected()) {
561
+ this.editorService.editor.chain().focus().unsetUnderline().run();
562
+ }
563
+ else {
564
+ this.editorService.editor.chain().focus().setUnderline().run();
565
+ }
566
+ }
567
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorBasicTextStylesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
568
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: EditorBasicTextStylesComponent, isStandalone: true, selector: "mona-editor-basic-text-styles", ngImport: i0, template: "@if (anyToolVisible()) {\n <mona-button-group selection=\"multiple\">\n @if (boldVisible()) {\n <button monaButton [selected]=\"boldSelected()\" (click)=\"onBoldToggle()\" title=\"Bold\">\n <i class=\"ri-bold\"></i>\n </button>\n }\n @if (italicVisible()) {\n <button monaButton [selected]=\"italicSelected()\" (click)=\"onItalicToggle()\" title=\"Italic\">\n <i class=\"ri-italic\"></i>\n </button>\n }\n @if (underlineVisible()) {\n <button monaButton [selected]=\"underlineSelected()\" (click)=\"onUnderlineToggle()\" title=\"Underline\">\n <i class=\"ri-underline\"></i>\n </button>\n }\n @if (strikeThroughVisible()) {\n <button\n monaButton\n [selected]=\"strikeThroughSelected()\"\n (click)=\"onStrikeThroughToggle()\"\n title=\"Strikethrough\">\n <i class=\"ri-strikethrough\"></i>\n </button>\n }\n @if (subscriptVisible()) {\n <button monaButton [selected]=\"subscriptSelected()\" (click)=\"onSubscriptToggle()\" title=\"Subscript\">\n <i class=\"ri-subscript\"></i>\n </button>\n }\n @if (superscriptVisible()) {\n <button monaButton [selected]=\"superscriptSelected()\" (click)=\"onSuperscriptToggle()\" title=\"Superscript\">\n <i class=\"ri-superscript\"></i>\n </button>\n }\n </mona-button-group>\n}\n", styles: [""], dependencies: [{ kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "lookChange", "selectedChange"] }, { kind: "component", type: ButtonGroupComponent, selector: "mona-button-group", inputs: ["allowEmpty", "aria-label", "disabled", "look", "rounded", "selection", "size", "class"], outputs: ["buttonClick", "disabledChange", "selectionChange"] }] }); }
569
+ }
570
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorBasicTextStylesComponent, decorators: [{
571
+ type: Component,
572
+ args: [{ selector: "mona-editor-basic-text-styles", imports: [ButtonDirective, ButtonGroupComponent], template: "@if (anyToolVisible()) {\n <mona-button-group selection=\"multiple\">\n @if (boldVisible()) {\n <button monaButton [selected]=\"boldSelected()\" (click)=\"onBoldToggle()\" title=\"Bold\">\n <i class=\"ri-bold\"></i>\n </button>\n }\n @if (italicVisible()) {\n <button monaButton [selected]=\"italicSelected()\" (click)=\"onItalicToggle()\" title=\"Italic\">\n <i class=\"ri-italic\"></i>\n </button>\n }\n @if (underlineVisible()) {\n <button monaButton [selected]=\"underlineSelected()\" (click)=\"onUnderlineToggle()\" title=\"Underline\">\n <i class=\"ri-underline\"></i>\n </button>\n }\n @if (strikeThroughVisible()) {\n <button\n monaButton\n [selected]=\"strikeThroughSelected()\"\n (click)=\"onStrikeThroughToggle()\"\n title=\"Strikethrough\">\n <i class=\"ri-strikethrough\"></i>\n </button>\n }\n @if (subscriptVisible()) {\n <button monaButton [selected]=\"subscriptSelected()\" (click)=\"onSubscriptToggle()\" title=\"Subscript\">\n <i class=\"ri-subscript\"></i>\n </button>\n }\n @if (superscriptVisible()) {\n <button monaButton [selected]=\"superscriptSelected()\" (click)=\"onSuperscriptToggle()\" title=\"Superscript\">\n <i class=\"ri-superscript\"></i>\n </button>\n }\n </mona-button-group>\n}\n" }]
573
+ }] });
574
+
575
+ class EditorBlockquoteComponent {
576
+ constructor() {
577
+ this.#editorService = inject(EditorService);
578
+ this.blockquoteSelected = computed(() => {
579
+ this.#editorService.state();
580
+ return this.#editorService.editor.isActive("blockquote");
581
+ }, /* @ts-ignore */
582
+ ...(ngDevMode ? [{ debugName: "blockquoteSelected" }] : /* istanbul ignore next */ []));
583
+ }
584
+ #editorService;
585
+ onBlockquoteToggle() {
586
+ if (this.blockquoteSelected()) {
587
+ this.#editorService.editor.chain().focus().unsetBlockquote().run();
588
+ }
589
+ else {
590
+ this.#editorService.editor.chain().focus().setBlockquote().run();
591
+ }
592
+ }
593
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorBlockquoteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
594
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: EditorBlockquoteComponent, isStandalone: true, selector: "mona-editor-blockquote", ngImport: i0, template: "<button monaButton [selected]=\"blockquoteSelected()\" (click)=\"onBlockquoteToggle()\" title=\"Quotation\">\n <i class=\"ri-double-quotes-r\"></i>\n</button>\n", styles: [""], dependencies: [{ kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "lookChange", "selectedChange"] }] }); }
595
+ }
596
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorBlockquoteComponent, decorators: [{
597
+ type: Component,
598
+ args: [{ selector: "mona-editor-blockquote", imports: [ButtonDirective], template: "<button monaButton [selected]=\"blockquoteSelected()\" (click)=\"onBlockquoteToggle()\" title=\"Quotation\">\n <i class=\"ri-double-quotes-r\"></i>\n</button>\n" }]
599
+ }] });
600
+
601
+ class EditorCodeBlockComponent {
602
+ constructor() {
603
+ this.#editorService = inject(EditorService);
604
+ this.codeBlockSelected = computed(() => {
605
+ this.#editorService.state();
606
+ return this.#editorService.editor.isActive("codeBlock");
607
+ }, /* @ts-ignore */
608
+ ...(ngDevMode ? [{ debugName: "codeBlockSelected" }] : /* istanbul ignore next */ []));
609
+ }
610
+ #editorService;
611
+ onCodeBlockClick() {
612
+ this.#editorService.editor.chain().toggleCodeBlock().run();
613
+ }
614
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorCodeBlockComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
615
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: EditorCodeBlockComponent, isStandalone: true, selector: "mona-editor-code-block", ngImport: i0, template: "<button monaButton [selected]=\"codeBlockSelected()\" (click)=\"onCodeBlockClick()\">\n <i class=\"ri-code-s-slash-line\"></i>\n</button>\n", styles: [""], dependencies: [{ kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "lookChange", "selectedChange"] }] }); }
616
+ }
617
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorCodeBlockComponent, decorators: [{
618
+ type: Component,
619
+ args: [{ selector: "mona-editor-code-block", imports: [ButtonDirective], template: "<button monaButton [selected]=\"codeBlockSelected()\" (click)=\"onCodeBlockClick()\">\n <i class=\"ri-code-s-slash-line\"></i>\n</button>\n" }]
620
+ }] });
621
+
622
+ const htmlColorCode = (name, document) => {
623
+ const canvas = document.createElement("canvas");
624
+ const context = canvas.getContext("2d");
625
+ if (!context) {
626
+ return "";
627
+ }
628
+ context.fillStyle = name;
629
+ return context.fillStyle;
630
+ };
631
+
632
+ class EditorFontColorComponent {
633
+ constructor() {
634
+ this.#document = inject(DOCUMENT);
635
+ this.#editorService = inject(EditorService);
636
+ this.#lastColor = "";
637
+ this.selectedColor = computed(() => {
638
+ this.#editorService.state();
639
+ const attributes = this.#editorService.editor.getAttributes("textStyle");
640
+ const color = attributes["color"] || this.#lastColor;
641
+ return htmlColorCode(color, this.#document);
642
+ }, /* @ts-ignore */
643
+ ...(ngDevMode ? [{ debugName: "selectedColor" }] : /* istanbul ignore next */ []));
644
+ }
645
+ #document;
646
+ #editorService;
647
+ #lastColor;
648
+ onColorChange(color) {
649
+ if (color) {
650
+ this.#editorService.editor.chain().focus().setColor(color).run();
651
+ this.#lastColor = color;
652
+ }
653
+ else {
654
+ this.#editorService.editor.chain().focus().unsetColor().run();
655
+ }
656
+ }
657
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorFontColorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
658
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: EditorFontColorComponent, isStandalone: true, selector: "mona-editor-font-color", ngImport: i0, template: "<mona-color-picker view=\"gradient\" [value]=\"selectedColor()\" (valueChange)=\"onColorChange($event)\" title=\"Color\">\n <ng-template monaColorPickerValueTemplate let-color>\n <div class=\"mona-editor-font-color-value\">\n <i class=\"ri-font-family\"></i>\n <span class=\"mona-editor-font-color-preview\" [style.background-color]=\"color\"></span>\n </div>\n </ng-template>\n</mona-color-picker>\n", styles: [".mona-editor-font-color-value{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.125rem;padding-left:.375rem;font-size:14px}.mona-editor-font-color-preview{width:100%;display:flex;height:2px}\n"], dependencies: [{ kind: "component", type: ColorPickerComponent, selector: "mona-color-picker", inputs: ["closeOnSelect", "columns", "disabled", "invalid", "opacity", "palette", "readonly", "rounded", "showClearButton", "size", "view", "required", "touched", "value"], outputs: ["touch", "valueChange"] }, { kind: "directive", type: ColorPickerValueTemplateDirective, selector: "ng-template[monaColorPickerValueTemplate]" }] }); }
659
+ }
660
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorFontColorComponent, decorators: [{
661
+ type: Component,
662
+ args: [{ selector: "mona-editor-font-color", imports: [ColorPickerComponent, ColorPickerValueTemplateDirective], template: "<mona-color-picker view=\"gradient\" [value]=\"selectedColor()\" (valueChange)=\"onColorChange($event)\" title=\"Color\">\n <ng-template monaColorPickerValueTemplate let-color>\n <div class=\"mona-editor-font-color-value\">\n <i class=\"ri-font-family\"></i>\n <span class=\"mona-editor-font-color-preview\" [style.background-color]=\"color\"></span>\n </div>\n </ng-template>\n</mona-color-picker>\n", styles: [".mona-editor-font-color-value{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.125rem;padding-left:.375rem;font-size:14px}.mona-editor-font-color-preview{width:100%;display:flex;height:2px}\n"] }]
663
+ }] });
664
+
665
+ class EditorFontFamilyComponent {
666
+ constructor() {
667
+ this.editorService = inject(EditorService);
668
+ this.selectedFontFamily = computed(() => {
669
+ this.editorService.state();
670
+ return (this.editorService
671
+ .fonts()
672
+ .firstOrDefault(ff => this.editorService.editor.isActive("textStyle", { fontFamily: ff })) ?? null);
673
+ }, /* @ts-ignore */
674
+ ...(ngDevMode ? [{ debugName: "selectedFontFamily" }] : /* istanbul ignore next */ []));
675
+ }
676
+ ngOnInit() {
677
+ const defaultFontFamily = this.editorService.fonts().first();
678
+ this.editorService.editor.chain().focus().setFontFamily(defaultFontFamily).run();
679
+ }
680
+ onFontFamilyChange(fontFamily) {
681
+ this.editorService.editor.chain().focus().setFontFamily(fontFamily).run();
682
+ }
683
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorFontFamilyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
684
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: EditorFontFamilyComponent, isStandalone: true, selector: "mona-editor-font-family", ngImport: i0, template: "<mona-dropdown-list\r\n [data]=\"editorService.fonts()\"\r\n [ngModel]=\"selectedFontFamily()\"\r\n (ngModelChange)=\"onFontFamilyChange($event)\"\r\n title=\"Select font family\">\r\n <ng-template monaDropDownListItemTemplate let-font>\r\n <span [style.font-family]=\"font\">{{ font }}</span>\r\n </ng-template>\r\n</mona-dropdown-list>\r\n", styles: ["mona-dropdown-list{width:12em}\n"], dependencies: [{ kind: "component", type: DropdownListComponent, selector: "mona-dropdown-list", inputs: ["aria-label", "aria-labelledby", "data", "disabled", "itemDisabled", "invalid", "loading", "placeholder", "popupClass", "popupHeight", "popupWidth", "readonly", "required", "rounded", "showClearButton", "size", "textField", "touched", "class", "valueField", "value"], outputs: ["close", "closed", "disabledChange", "open", "opened", "touch", "valueChange"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: DropdownItemTemplateDirective, selector: " ng-template[monaDropDownItemTemplate], ng-template[monaAutoCompleteItemTemplate], ng-template[monaDropDownListItemTemplate], ng-template[monaComboBoxItemTemplate], ng-template[monaMultiSelectItemTemplate] " }] }); }
685
+ }
686
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorFontFamilyComponent, decorators: [{
687
+ type: Component,
688
+ args: [{ selector: "mona-editor-font-family", imports: [DropdownListComponent, FormsModule, DropdownItemTemplateDirective], template: "<mona-dropdown-list\r\n [data]=\"editorService.fonts()\"\r\n [ngModel]=\"selectedFontFamily()\"\r\n (ngModelChange)=\"onFontFamilyChange($event)\"\r\n title=\"Select font family\">\r\n <ng-template monaDropDownListItemTemplate let-font>\r\n <span [style.font-family]=\"font\">{{ font }}</span>\r\n </ng-template>\r\n</mona-dropdown-list>\r\n", styles: ["mona-dropdown-list{width:12em}\n"] }]
689
+ }] });
690
+
691
+ class EditorFontHighlightComponent {
692
+ constructor() {
693
+ this.#editorService = inject(EditorService);
694
+ this.#lastColor = "";
695
+ this.selectedColor = computed(() => {
696
+ const state = this.#editorService.state();
697
+ if (state.selection.empty) {
698
+ const marks = state.storedMarks || state.selection.$from.marks();
699
+ const highlightMark = marks.find(mark => mark.type.name === "highlight");
700
+ return highlightMark ? highlightMark.attrs["color"] : this.#lastColor;
701
+ }
702
+ else {
703
+ const node = state.doc.nodeAt(state.selection.from);
704
+ if (node) {
705
+ const highlightMark = node.marks.find(mark => mark.type.name === "highlight");
706
+ return highlightMark ? highlightMark.attrs["color"] : this.#lastColor;
707
+ }
708
+ return "";
709
+ }
710
+ }, /* @ts-ignore */
711
+ ...(ngDevMode ? [{ debugName: "selectedColor" }] : /* istanbul ignore next */ []));
712
+ }
713
+ #editorService;
714
+ #lastColor;
715
+ onColorChange(color) {
716
+ if (color) {
717
+ this.#editorService.editor.chain().focus().setHighlight({ color }).run();
718
+ this.#lastColor = color;
719
+ }
720
+ else {
721
+ this.#editorService.editor.chain().focus().unsetHighlight().run();
722
+ }
723
+ }
724
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorFontHighlightComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
725
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: EditorFontHighlightComponent, isStandalone: true, selector: "mona-editor-font-highlight", ngImport: i0, template: "<mona-color-picker\n view=\"gradient\"\n [value]=\"selectedColor()\"\n (valueChange)=\"onColorChange($event)\"\n title=\"Background color\">\n <ng-template monaColorPickerValueTemplate let-color>\n <div class=\"mona-editor-font-highlight-value\">\n <i class=\"ri-drop-fill\"></i>\n <span class=\"mona-editor-font-highlight-preview\" [style.background-color]=\"color\"></span>\n </div>\n </ng-template>\n</mona-color-picker>\n", styles: [".mona-editor-font-highlight-value{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.125rem;padding-left:.375rem;font-size:14px}.mona-editor-font-highlight-preview{width:100%;display:flex;height:2px}\n"], dependencies: [{ kind: "component", type: ColorPickerComponent, selector: "mona-color-picker", inputs: ["closeOnSelect", "columns", "disabled", "invalid", "opacity", "palette", "readonly", "rounded", "showClearButton", "size", "view", "required", "touched", "value"], outputs: ["touch", "valueChange"] }, { kind: "directive", type: ColorPickerValueTemplateDirective, selector: "ng-template[monaColorPickerValueTemplate]" }] }); }
726
+ }
727
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorFontHighlightComponent, decorators: [{
728
+ type: Component,
729
+ args: [{ selector: "mona-editor-font-highlight", imports: [ColorPickerComponent, ColorPickerValueTemplateDirective], template: "<mona-color-picker\n view=\"gradient\"\n [value]=\"selectedColor()\"\n (valueChange)=\"onColorChange($event)\"\n title=\"Background color\">\n <ng-template monaColorPickerValueTemplate let-color>\n <div class=\"mona-editor-font-highlight-value\">\n <i class=\"ri-drop-fill\"></i>\n <span class=\"mona-editor-font-highlight-preview\" [style.background-color]=\"color\"></span>\n </div>\n </ng-template>\n</mona-color-picker>\n", styles: [".mona-editor-font-highlight-value{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.125rem;padding-left:.375rem;font-size:14px}.mona-editor-font-highlight-preview{width:100%;display:flex;height:2px}\n"] }]
730
+ }] });
731
+
732
+ class EditorFontSizeComponent {
733
+ constructor() {
734
+ this.editorService = inject(EditorService);
735
+ this.selectedFontSize = computed(() => {
736
+ this.editorService.state();
737
+ return (this.editorService
738
+ .fontSizes()
739
+ .firstOrDefault(fs => this.editorService.editor.isActive("textStyle", { fontSize: fs })) ?? null);
740
+ }, /* @ts-ignore */
741
+ ...(ngDevMode ? [{ debugName: "selectedFontSize" }] : /* istanbul ignore next */ []));
742
+ }
743
+ ngOnInit() {
744
+ // this.#editorService.editor.chain().focus().setFontSize(this.selectedFontSize().value).run();
745
+ }
746
+ onFontSizeChange(fontSize) {
747
+ this.editorService.editor.chain().focus().setFontSize(fontSize).run();
748
+ }
749
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorFontSizeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
750
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: EditorFontSizeComponent, isStandalone: true, selector: "mona-editor-font-size", ngImport: i0, template: "<mona-dropdown-list\r\n [data]=\"editorService.fontSizes()\"\r\n placeholder=\"Font Size\"\r\n [ngModel]=\"selectedFontSize()\"\r\n (ngModelChange)=\"onFontSizeChange($event)\"\r\n title=\"Select font size\"></mona-dropdown-list>\r\n", styles: ["mona-dropdown-list{width:8em}\n"], dependencies: [{ kind: "component", type: DropdownListComponent, selector: "mona-dropdown-list", inputs: ["aria-label", "aria-labelledby", "data", "disabled", "itemDisabled", "invalid", "loading", "placeholder", "popupClass", "popupHeight", "popupWidth", "readonly", "required", "rounded", "showClearButton", "size", "textField", "touched", "class", "valueField", "value"], outputs: ["close", "closed", "disabledChange", "open", "opened", "touch", "valueChange"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
751
+ }
752
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorFontSizeComponent, decorators: [{
753
+ type: Component,
754
+ args: [{ selector: "mona-editor-font-size", imports: [DropdownListComponent, FormsModule], template: "<mona-dropdown-list\r\n [data]=\"editorService.fontSizes()\"\r\n placeholder=\"Font Size\"\r\n [ngModel]=\"selectedFontSize()\"\r\n (ngModelChange)=\"onFontSizeChange($event)\"\r\n title=\"Select font size\"></mona-dropdown-list>\r\n", styles: ["mona-dropdown-list{width:8em}\n"] }]
755
+ }] });
756
+
757
+ var HeadingType;
758
+ (function (HeadingType) {
759
+ HeadingType[HeadingType["Heading1"] = 1] = "Heading1";
760
+ HeadingType[HeadingType["Heading2"] = 2] = "Heading2";
761
+ HeadingType[HeadingType["Heading3"] = 3] = "Heading3";
762
+ HeadingType[HeadingType["Heading4"] = 4] = "Heading4";
763
+ HeadingType[HeadingType["Heading5"] = 5] = "Heading5";
764
+ HeadingType[HeadingType["Heading6"] = 6] = "Heading6";
765
+ HeadingType[HeadingType["Paragraph"] = 7] = "Paragraph";
766
+ })(HeadingType || (HeadingType = {}));
767
+
768
+ class EditorHeadingsComponent {
769
+ constructor() {
770
+ this.#editorService = inject(EditorService);
771
+ this.HeadingType = HeadingType;
772
+ this.headingsDropdownListData = [
773
+ { text: "Paragraph", value: HeadingType.Paragraph },
774
+ { text: "Heading 1", value: HeadingType.Heading1 },
775
+ { text: "Heading 2", value: HeadingType.Heading2 },
776
+ { text: "Heading 3", value: HeadingType.Heading3 },
777
+ { text: "Heading 4", value: HeadingType.Heading4 },
778
+ { text: "Heading 5", value: HeadingType.Heading5 },
779
+ { text: "Heading 6", value: HeadingType.Heading6 }
780
+ ];
781
+ this.selectedHeadingsDropdownItem = computed(() => {
782
+ const state = this.#editorService.state();
783
+ const node = state.selection.$from.node();
784
+ if (node && node.type.name === "heading") {
785
+ return this.headingsDropdownListData.find(item => item.value === node.attrs["level"]);
786
+ }
787
+ return this.headingsDropdownListData.find(item => item.value === HeadingType.Paragraph);
788
+ }, /* @ts-ignore */
789
+ ...(ngDevMode ? [{ debugName: "selectedHeadingsDropdownItem" }] : /* istanbul ignore next */ []));
790
+ }
791
+ #editorService;
792
+ onFormatChange(headingItem) {
793
+ if (headingItem.value === HeadingType.Paragraph) {
794
+ this.#editorService.editor.chain().focus().setParagraph().run();
795
+ }
796
+ else {
797
+ this.#editorService.editor.chain().focus().setHeading({ level: headingItem.value }).run();
798
+ }
799
+ }
800
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorHeadingsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
801
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: EditorHeadingsComponent, isStandalone: true, selector: "mona-editor-headings", ngImport: i0, template: "<mona-dropdown-list\r\n [data]=\"headingsDropdownListData\"\r\n [ngModel]=\"selectedHeadingsDropdownItem()\"\r\n (ngModelChange)=\"onFormatChange($event)\"\r\n textField=\"text\"\r\n valueField=\"value\"\r\n title=\"Format\">\r\n <ng-template monaDropDownListItemTemplate let-dataItem>\r\n @switch (dataItem.value) {\r\n @case (HeadingType.Heading1) {\r\n <h1>{{ dataItem.text }}</h1>\r\n }\r\n @case (HeadingType.Heading2) {\r\n <h2>{{ dataItem.text }}</h2>\r\n }\r\n @case (HeadingType.Heading3) {\r\n <h3>{{ dataItem.text }}</h3>\r\n }\r\n @case (HeadingType.Heading4) {\r\n <h4>{{ dataItem.text }}</h4>\r\n }\r\n @case (HeadingType.Heading5) {\r\n <h5>{{ dataItem.text }}</h5>\r\n }\r\n @case (HeadingType.Heading6) {\r\n <h6>{{ dataItem.text }}</h6>\r\n }\r\n @case (HeadingType.Paragraph) {\r\n <p>{{ dataItem.text }}</p>\r\n }\r\n @default {\r\n <p>{{ dataItem.text }}</p>\r\n }\r\n }\r\n </ng-template>\r\n</mona-dropdown-list>\r\n", styles: ["mona-dropdown-list{width:12em}\n"], dependencies: [{ kind: "component", type: DropdownListComponent, selector: "mona-dropdown-list", inputs: ["aria-label", "aria-labelledby", "data", "disabled", "itemDisabled", "invalid", "loading", "placeholder", "popupClass", "popupHeight", "popupWidth", "readonly", "required", "rounded", "showClearButton", "size", "textField", "touched", "class", "valueField", "value"], outputs: ["close", "closed", "disabledChange", "open", "opened", "touch", "valueChange"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: DropdownItemTemplateDirective, selector: " ng-template[monaDropDownItemTemplate], ng-template[monaAutoCompleteItemTemplate], ng-template[monaDropDownListItemTemplate], ng-template[monaComboBoxItemTemplate], ng-template[monaMultiSelectItemTemplate] " }] }); }
802
+ }
803
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorHeadingsComponent, decorators: [{
804
+ type: Component,
805
+ args: [{ selector: "mona-editor-headings", imports: [DropdownListComponent, FormsModule, DropdownItemTemplateDirective], template: "<mona-dropdown-list\r\n [data]=\"headingsDropdownListData\"\r\n [ngModel]=\"selectedHeadingsDropdownItem()\"\r\n (ngModelChange)=\"onFormatChange($event)\"\r\n textField=\"text\"\r\n valueField=\"value\"\r\n title=\"Format\">\r\n <ng-template monaDropDownListItemTemplate let-dataItem>\r\n @switch (dataItem.value) {\r\n @case (HeadingType.Heading1) {\r\n <h1>{{ dataItem.text }}</h1>\r\n }\r\n @case (HeadingType.Heading2) {\r\n <h2>{{ dataItem.text }}</h2>\r\n }\r\n @case (HeadingType.Heading3) {\r\n <h3>{{ dataItem.text }}</h3>\r\n }\r\n @case (HeadingType.Heading4) {\r\n <h4>{{ dataItem.text }}</h4>\r\n }\r\n @case (HeadingType.Heading5) {\r\n <h5>{{ dataItem.text }}</h5>\r\n }\r\n @case (HeadingType.Heading6) {\r\n <h6>{{ dataItem.text }}</h6>\r\n }\r\n @case (HeadingType.Paragraph) {\r\n <p>{{ dataItem.text }}</p>\r\n }\r\n @default {\r\n <p>{{ dataItem.text }}</p>\r\n }\r\n }\r\n </ng-template>\r\n</mona-dropdown-list>\r\n", styles: ["mona-dropdown-list{width:12em}\n"] }]
806
+ }] });
807
+
808
+ class EditorHistoryComponent {
809
+ constructor() {
810
+ this.#editorService = inject(EditorService);
811
+ this.redoDisabled = computed(() => {
812
+ this.#editorService.state();
813
+ return !this.#editorService.editor.can().redo();
814
+ }, /* @ts-ignore */
815
+ ...(ngDevMode ? [{ debugName: "redoDisabled" }] : /* istanbul ignore next */ []));
816
+ this.undoDisabled = computed(() => {
817
+ this.#editorService.state();
818
+ return !this.#editorService.editor.can().undo();
819
+ }, /* @ts-ignore */
820
+ ...(ngDevMode ? [{ debugName: "undoDisabled" }] : /* istanbul ignore next */ []));
821
+ }
822
+ #editorService;
823
+ onRedoClick() {
824
+ this.#editorService.editor.chain().focus().redo().run();
825
+ }
826
+ onUndoClick() {
827
+ this.#editorService.editor.chain().focus().undo().run();
828
+ }
829
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorHistoryComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
830
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: EditorHistoryComponent, isStandalone: true, selector: "mona-editor-history", ngImport: i0, template: "<mona-button-group selection=\"single\">\n <button monaButton [disabled]=\"undoDisabled()\" (click)=\"onUndoClick()\" title=\"Undo\">\n <i class=\"ri-arrow-go-back-line\"></i>\n </button>\n <button monaButton [disabled]=\"redoDisabled()\" (click)=\"onRedoClick()\" title=\"Redo\">\n <i class=\"ri-arrow-go-forward-line\"></i>\n </button>\n</mona-button-group>\n", styles: [""], dependencies: [{ kind: "component", type: ButtonGroupComponent, selector: "mona-button-group", inputs: ["allowEmpty", "aria-label", "disabled", "look", "rounded", "selection", "size", "class"], outputs: ["buttonClick", "disabledChange", "selectionChange"] }, { kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "lookChange", "selectedChange"] }] }); }
831
+ }
832
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorHistoryComponent, decorators: [{
833
+ type: Component,
834
+ args: [{ selector: "mona-editor-history", imports: [ButtonGroupComponent, ButtonDirective], template: "<mona-button-group selection=\"single\">\n <button monaButton [disabled]=\"undoDisabled()\" (click)=\"onUndoClick()\" title=\"Undo\">\n <i class=\"ri-arrow-go-back-line\"></i>\n </button>\n <button monaButton [disabled]=\"redoDisabled()\" (click)=\"onRedoClick()\" title=\"Redo\">\n <i class=\"ri-arrow-go-forward-line\"></i>\n </button>\n</mona-button-group>\n" }]
835
+ }] });
836
+
837
+ class EditorHorizontalRuleComponent {
838
+ #editorService = inject(EditorService);
839
+ onHorizontalRuleClick() {
840
+ this.#editorService.editor.chain().focus().setHorizontalRule().run();
841
+ }
842
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorHorizontalRuleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
843
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: EditorHorizontalRuleComponent, isStandalone: true, selector: "mona-editor-horizontal-rule", ngImport: i0, template: "<button monaButton (click)=\"onHorizontalRuleClick()\" title=\"Add horizontal line\">\n <i class=\"ri-subtract-line\"></i>\n</button>\n", styles: [""], dependencies: [{ kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "lookChange", "selectedChange"] }] }); }
844
+ }
845
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorHorizontalRuleComponent, decorators: [{
846
+ type: Component,
847
+ args: [{ selector: "mona-editor-horizontal-rule", imports: [ButtonDirective], template: "<button monaButton (click)=\"onHorizontalRuleClick()\" title=\"Add horizontal line\">\n <i class=\"ri-subtract-line\"></i>\n</button>\n" }]
848
+ }] });
849
+
850
+ class EditorImageInserterComponent {
851
+ constructor() {
852
+ this.imageForm = new FormGroup({
853
+ altText: new FormControl(""),
854
+ height: new FormControl(null),
855
+ link: new FormControl("", { nonNullable: true, validators: [Validators.required] }),
856
+ width: new FormControl(null)
857
+ });
858
+ this.cancel = output();
859
+ this.insert = output();
860
+ }
861
+ onCancel() {
862
+ this.cancel.emit();
863
+ }
864
+ onImageInsert() {
865
+ this.insert.emit({
866
+ altText: this.imageForm.controls.altText.value ?? "",
867
+ height: this.imageForm.controls.height.value,
868
+ link: this.imageForm.controls.link.value,
869
+ width: this.imageForm.controls.width.value
870
+ });
871
+ }
872
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorImageInserterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
873
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: EditorImageInserterComponent, isStandalone: true, selector: "mona-editor-image-inserter", outputs: { cancel: "cancel", insert: "insert" }, ngImport: i0, template: "<form [formGroup]=\"imageForm\">\r\n <div class=\"editor-image-inserter-row\">\r\n <div class=\"editor-image-inserter-row-label\">Image URL</div>\r\n <mona-text-box formControlName=\"link\"></mona-text-box>\r\n </div>\r\n <div class=\"editor-image-inserter-row\">\r\n <div class=\"editor-image-inserter-row-label\">Alt Text</div>\r\n <mona-text-box formControlName=\"altText\"></mona-text-box>\r\n </div>\r\n <div class=\"editor-image-inserter-row\">\r\n <div class=\"editor-image-inserter-row-label\">Width (px)</div>\r\n <mona-numeric-text-box formControlName=\"width\"></mona-numeric-text-box>\r\n </div>\r\n <div class=\"editor-image-inserter-row\">\r\n <div class=\"editor-image-inserter-row-label\">Height (px)</div>\r\n <mona-numeric-text-box formControlName=\"height\"></mona-numeric-text-box>\r\n </div>\r\n <div class=\"editor-image-inserter-actions\">\r\n <button monaButton [disabled]=\"!imageForm.valid\" (click)=\"onImageInsert()\">Insert</button>\r\n <button monaButton [look]=\"'secondary'\" (click)=\"onCancel()\">Cancel</button>\r\n </div>\r\n</form>\r\n", styles: ["form{display:flex;flex-direction:column;gap:.375rem;padding-top:.5rem}.editor-image-inserter-row{display:flex;flex-direction:column;justify-content:center;padding:0 .5rem}.editor-image-inserter-row-label{margin-bottom:.125rem;padding-left:.125rem;font-size:.875em;font-weight:600}.editor-image-inserter-actions{display:flex;justify-content:flex-end;gap:.25rem;padding:.25rem .5rem;background:var(--mona-background-dark);border-top:1px solid var(--mona-border-color)}\n"], dependencies: [{ kind: "component", type: TextBoxComponent, selector: "mona-text-box", inputs: ["clearButton", "disabled", "inputAttributes", "inputClass", "inputStyle", "invalid", "placeholder", "readonly", "required", "rounded", "size", "touched", "type", "class", "value"], outputs: ["inputBlur", "inputFocus", "touch", "valueChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "lookChange", "selectedChange"] }, { kind: "component", type: NumericTextBoxComponent, selector: "mona-numeric-text-box", inputs: ["aria-label", "decimals", "disabled", "formatter", "maxValue", "minValue", "nullable", "readonly", "required", "invalid", "rounded", "size", "spinners", "step", "tabindex", "touched", "class", "value"], outputs: ["inputBlur", "inputFocus", "inputFocusOut", "touch", "valueChange"] }] }); }
874
+ }
875
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorImageInserterComponent, decorators: [{
876
+ type: Component,
877
+ args: [{ selector: "mona-editor-image-inserter", imports: [TextBoxComponent, ReactiveFormsModule, ButtonDirective, NumericTextBoxComponent], template: "<form [formGroup]=\"imageForm\">\r\n <div class=\"editor-image-inserter-row\">\r\n <div class=\"editor-image-inserter-row-label\">Image URL</div>\r\n <mona-text-box formControlName=\"link\"></mona-text-box>\r\n </div>\r\n <div class=\"editor-image-inserter-row\">\r\n <div class=\"editor-image-inserter-row-label\">Alt Text</div>\r\n <mona-text-box formControlName=\"altText\"></mona-text-box>\r\n </div>\r\n <div class=\"editor-image-inserter-row\">\r\n <div class=\"editor-image-inserter-row-label\">Width (px)</div>\r\n <mona-numeric-text-box formControlName=\"width\"></mona-numeric-text-box>\r\n </div>\r\n <div class=\"editor-image-inserter-row\">\r\n <div class=\"editor-image-inserter-row-label\">Height (px)</div>\r\n <mona-numeric-text-box formControlName=\"height\"></mona-numeric-text-box>\r\n </div>\r\n <div class=\"editor-image-inserter-actions\">\r\n <button monaButton [disabled]=\"!imageForm.valid\" (click)=\"onImageInsert()\">Insert</button>\r\n <button monaButton [look]=\"'secondary'\" (click)=\"onCancel()\">Cancel</button>\r\n </div>\r\n</form>\r\n", styles: ["form{display:flex;flex-direction:column;gap:.375rem;padding-top:.5rem}.editor-image-inserter-row{display:flex;flex-direction:column;justify-content:center;padding:0 .5rem}.editor-image-inserter-row-label{margin-bottom:.125rem;padding-left:.125rem;font-size:.875em;font-weight:600}.editor-image-inserter-actions{display:flex;justify-content:flex-end;gap:.25rem;padding:.25rem .5rem;background:var(--mona-background-dark);border-top:1px solid var(--mona-border-color)}\n"] }]
878
+ }], propDecorators: { cancel: [{ type: i0.Output, args: ["cancel"] }], insert: [{ type: i0.Output, args: ["insert"] }] } });
879
+
880
+ class EditorImageComponent {
881
+ constructor() {
882
+ this.#editorService = inject(EditorService);
883
+ this.inserterVisible = signal(false, /* @ts-ignore */
884
+ ...(ngDevMode ? [{ debugName: "inserterVisible" }] : /* istanbul ignore next */ []));
885
+ }
886
+ #editorService;
887
+ onDisplayInserterClick() {
888
+ this.inserterVisible.set(true);
889
+ }
890
+ onImageInsert(event) {
891
+ this.insertImage(event);
892
+ this.closeInserter();
893
+ }
894
+ onInsertCancel() {
895
+ this.closeInserter();
896
+ }
897
+ onInserterClose() {
898
+ this.closeInserter();
899
+ }
900
+ closeInserter() {
901
+ this.inserterVisible.set(false);
902
+ }
903
+ insertImage(event) {
904
+ this.#editorService.editor
905
+ .chain()
906
+ .setImage({
907
+ src: event.link,
908
+ alt: event.altText,
909
+ title: event.altText
910
+ })
911
+ .updateAttributes("extendedImage", {
912
+ width: event.width,
913
+ height: event.height
914
+ })
915
+ .run();
916
+ }
917
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorImageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
918
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: EditorImageComponent, isStandalone: true, selector: "mona-editor-image", ngImport: i0, template: "<button monaButton (click)=\"onDisplayInserterClick()\" title=\"Insert image\">\n <i class=\"ri-image-add-line\"></i>\n</button>\n\n@if (inserterVisible()) {\n <mona-window [width]=\"400\" [height]=\"316\" [modal]=\"false\" [title]=\"'Insert Image'\" (close)=\"onInserterClose()\">\n <mona-editor-image-inserter\n (insert)=\"onImageInsert($event)\"\n (cancel)=\"onInsertCancel()\"></mona-editor-image-inserter>\n </mona-window>\n}\n", styles: [""], dependencies: [{ kind: "component", type: WindowComponent, selector: "mona-window", inputs: ["closable", "closeOnEscape", "draggable", "focusedElement", "height", "left", "look", "maxHeight", "maxWidth", "maximizable", "minHeight", "minWidth", "minimizable", "modal", "resizable", "rounded", "title", "top", "width"], outputs: ["close", "closed", "dragEnd", "dragStart", "heightChange", "leftChange", "topChange", "widthChange"] }, { kind: "component", type: EditorImageInserterComponent, selector: "mona-editor-image-inserter", outputs: ["cancel", "insert"] }, { kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "lookChange", "selectedChange"] }] }); }
919
+ }
920
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorImageComponent, decorators: [{
921
+ type: Component,
922
+ args: [{ selector: "mona-editor-image", imports: [WindowComponent, EditorImageInserterComponent, ButtonDirective], template: "<button monaButton (click)=\"onDisplayInserterClick()\" title=\"Insert image\">\n <i class=\"ri-image-add-line\"></i>\n</button>\n\n@if (inserterVisible()) {\n <mona-window [width]=\"400\" [height]=\"316\" [modal]=\"false\" [title]=\"'Insert Image'\" (close)=\"onInserterClose()\">\n <mona-editor-image-inserter\n (insert)=\"onImageInsert($event)\"\n (cancel)=\"onInsertCancel()\"></mona-editor-image-inserter>\n </mona-window>\n}\n" }]
923
+ }] });
924
+
925
+ class EditorIndentComponent {
926
+ constructor() {
927
+ this.#editorService = inject(EditorService);
928
+ this.indentDisabled = computed(() => {
929
+ this.#editorService.state();
930
+ return !this.#editorService.editor.can().indent();
931
+ }, /* @ts-ignore */
932
+ ...(ngDevMode ? [{ debugName: "indentDisabled" }] : /* istanbul ignore next */ []));
933
+ this.outdentDisabled = computed(() => {
934
+ this.#editorService.state();
935
+ return !this.#editorService.editor.can().outdent();
936
+ }, /* @ts-ignore */
937
+ ...(ngDevMode ? [{ debugName: "outdentDisabled" }] : /* istanbul ignore next */ []));
938
+ }
939
+ #editorService;
940
+ onIndentClick() {
941
+ this.#editorService.editor.chain().focus().indent().run();
942
+ }
943
+ onOutdentClick() {
944
+ this.#editorService.editor.chain().focus().outdent().run();
945
+ }
946
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorIndentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
947
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: EditorIndentComponent, isStandalone: true, selector: "mona-editor-indent", ngImport: i0, template: "<mona-button-group selection=\"single\">\n <button monaButton [disabled]=\"indentDisabled()\" (click)=\"onIndentClick()\" title=\"Indent\">\n <i class=\"ri-indent-increase\"></i>\n </button>\n <button monaButton [disabled]=\"outdentDisabled()\" (click)=\"onOutdentClick()\" title=\"Outdent\">\n <i class=\"ri-indent-decrease\"></i>\n </button>\n</mona-button-group>\n", styles: [""], dependencies: [{ kind: "component", type: ButtonGroupComponent, selector: "mona-button-group", inputs: ["allowEmpty", "aria-label", "disabled", "look", "rounded", "selection", "size", "class"], outputs: ["buttonClick", "disabledChange", "selectionChange"] }, { kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "lookChange", "selectedChange"] }] }); }
948
+ }
949
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorIndentComponent, decorators: [{
950
+ type: Component,
951
+ args: [{ selector: "mona-editor-indent", imports: [ButtonGroupComponent, ButtonDirective], template: "<mona-button-group selection=\"single\">\n <button monaButton [disabled]=\"indentDisabled()\" (click)=\"onIndentClick()\" title=\"Indent\">\n <i class=\"ri-indent-increase\"></i>\n </button>\n <button monaButton [disabled]=\"outdentDisabled()\" (click)=\"onOutdentClick()\" title=\"Outdent\">\n <i class=\"ri-indent-decrease\"></i>\n </button>\n</mona-button-group>\n" }]
952
+ }] });
953
+
954
+ class EditorLinkComponent {
955
+ constructor() {
956
+ this.#dialogService = inject(DialogService);
957
+ this.#editorService = inject(EditorService);
958
+ this.linkSelected = computed(() => {
959
+ this.#editorService.state();
960
+ return this.#editorService.editor.isActive("link");
961
+ }, /* @ts-ignore */
962
+ ...(ngDevMode ? [{ debugName: "linkSelected" }] : /* istanbul ignore next */ []));
963
+ this.unlinkDisabled = computed(() => {
964
+ this.#editorService.state();
965
+ return !this.#editorService.editor.isActive("link");
966
+ }, /* @ts-ignore */
967
+ ...(ngDevMode ? [{ debugName: "unlinkDisabled" }] : /* istanbul ignore next */ []));
968
+ }
969
+ #dialogService;
970
+ #editorService;
971
+ onLinkDialogDisplay() {
972
+ const link = this.#editorService.editor.getAttributes("link")["href"] ?? "";
973
+ const dialogRef = this.#dialogService.show({
974
+ title: "Insert Link",
975
+ type: "info",
976
+ // inputType: "string",
977
+ text: "Enter the URL"
978
+ // value: link
979
+ });
980
+ // dialogRef.result.pipe(take(1)).subscribe(result => this.setLink(result.value as string));
981
+ }
982
+ onUnlinkClick() {
983
+ this.#editorService.editor.chain().focus().unsetLink().run();
984
+ }
985
+ setLink(url) {
986
+ if (!url) {
987
+ this.#editorService.editor.chain().focus().unsetLink().run();
988
+ return;
989
+ }
990
+ this.#editorService.editor.chain().focus().extendMarkRange("link").setLink({ href: url }).run();
991
+ }
992
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorLinkComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
993
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: EditorLinkComponent, isStandalone: true, selector: "mona-editor-link", ngImport: i0, template: "<mona-button-group selection=\"single\">\n <button monaButton [selected]=\"linkSelected()\" (click)=\"onLinkDialogDisplay()\" title=\"Insert Link\">\n <i class=\"ri-link-m\"></i>\n </button>\n <button monaButton [disabled]=\"unlinkDisabled()\" (click)=\"onUnlinkClick()\" title=\"Remove Link\">\n <i class=\"ri-link-unlink-m\"></i>\n </button>\n</mona-button-group>\n", styles: [""], dependencies: [{ kind: "component", type: ButtonGroupComponent, selector: "mona-button-group", inputs: ["allowEmpty", "aria-label", "disabled", "look", "rounded", "selection", "size", "class"], outputs: ["buttonClick", "disabledChange", "selectionChange"] }, { kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "lookChange", "selectedChange"] }] }); }
994
+ }
995
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorLinkComponent, decorators: [{
996
+ type: Component,
997
+ args: [{ selector: "mona-editor-link", imports: [ButtonGroupComponent, ButtonDirective], template: "<mona-button-group selection=\"single\">\n <button monaButton [selected]=\"linkSelected()\" (click)=\"onLinkDialogDisplay()\" title=\"Insert Link\">\n <i class=\"ri-link-m\"></i>\n </button>\n <button monaButton [disabled]=\"unlinkDisabled()\" (click)=\"onUnlinkClick()\" title=\"Remove Link\">\n <i class=\"ri-link-unlink-m\"></i>\n </button>\n</mona-button-group>\n" }]
998
+ }] });
999
+
1000
+ class EditorListComponent {
1001
+ constructor() {
1002
+ this.#editorService = inject(EditorService);
1003
+ this.orderedListSelected = computed(() => {
1004
+ this.#editorService.state();
1005
+ return this.#editorService.editor.isActive("orderedList");
1006
+ }, /* @ts-ignore */
1007
+ ...(ngDevMode ? [{ debugName: "orderedListSelected" }] : /* istanbul ignore next */ []));
1008
+ this.unorderedListSelected = computed(() => {
1009
+ this.#editorService.state();
1010
+ return this.#editorService.editor.isActive("bulletList");
1011
+ }, /* @ts-ignore */
1012
+ ...(ngDevMode ? [{ debugName: "unorderedListSelected" }] : /* istanbul ignore next */ []));
1013
+ }
1014
+ #editorService;
1015
+ onOrderedListToggle() {
1016
+ this.#editorService.editor.chain().focus().toggleOrderedList().run();
1017
+ }
1018
+ onUnorderedListToggle() {
1019
+ this.#editorService.editor.chain().focus().toggleBulletList().run();
1020
+ }
1021
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1022
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: EditorListComponent, isStandalone: true, selector: "mona-editor-list", ngImport: i0, template: "<mona-button-group selection=\"single\">\n <button\n monaButton\n [selected]=\"unorderedListSelected()\"\n (click)=\"onUnorderedListToggle()\"\n title=\"Insert unordered list\">\n <i class=\"ri-list-unordered\"></i>\n </button>\n <button monaButton [selected]=\"orderedListSelected()\" (click)=\"onOrderedListToggle()\" title=\"Insert ordered list\">\n <i class=\"ri-list-ordered-2\"></i>\n </button>\n</mona-button-group>\n", styles: [""], dependencies: [{ kind: "component", type: ButtonGroupComponent, selector: "mona-button-group", inputs: ["allowEmpty", "aria-label", "disabled", "look", "rounded", "selection", "size", "class"], outputs: ["buttonClick", "disabledChange", "selectionChange"] }, { kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "lookChange", "selectedChange"] }] }); }
1023
+ }
1024
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorListComponent, decorators: [{
1025
+ type: Component,
1026
+ args: [{ selector: "mona-editor-list", imports: [ButtonGroupComponent, ButtonDirective], template: "<mona-button-group selection=\"single\">\n <button\n monaButton\n [selected]=\"unorderedListSelected()\"\n (click)=\"onUnorderedListToggle()\"\n title=\"Insert unordered list\">\n <i class=\"ri-list-unordered\"></i>\n </button>\n <button monaButton [selected]=\"orderedListSelected()\" (click)=\"onOrderedListToggle()\" title=\"Insert ordered list\">\n <i class=\"ri-list-ordered-2\"></i>\n </button>\n</mona-button-group>\n" }]
1027
+ }] });
1028
+
1029
+ class EditorTableCreatorComponent {
1030
+ constructor() {
1031
+ this.highlightedCell = { row: 0, col: 0 };
1032
+ this.insert = output();
1033
+ }
1034
+ onCellClick(row, col) {
1035
+ this.insert.emit({ row, col });
1036
+ this.highlightedCell = { row: 0, col: 0 };
1037
+ }
1038
+ onCellMouseEnter(row, col) {
1039
+ this.highlightedCell = { row, col };
1040
+ }
1041
+ onCellMouseLeave() {
1042
+ this.highlightedCell = { row: 0, col: 0 };
1043
+ }
1044
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorTableCreatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1045
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: EditorTableCreatorComponent, isStandalone: true, selector: "mona-editor-table-creator", outputs: { insert: "insert" }, ngImport: i0, template: "<div class=\"mona-editor-table-creator\" (mouseleave)=\"onCellMouseLeave()\">\n @for (rx of [1, 2, 3, 4, 5, 6, 7, 8]; track rx) {\n @for (cx of [1, 2, 3, 4, 5, 6, 7, 8]; track cx) {\n <div\n class=\"mona-editor-table-creator-cell\"\n [style.background-color]=\"\n rx <= highlightedCell.row && cx <= highlightedCell.col\n ? 'var(--mona-primary)'\n : 'var(--mona-background-lighter)'\n \"\n (click)=\"onCellClick(rx, cx)\"\n (mouseenter)=\"onCellMouseEnter(rx, cx)\"></div>\n }\n }\n</div>\n", styles: [".mona-editor-table-creator{display:grid;grid-template-columns:repeat(8,1fr);column-gap:.125rem;row-gap:.125rem;padding:.25rem}.mona-editor-table-creator-cell{display:flex;border:1px solid var(--mona-border-color);width:24px;height:24px;background:var(--mona-background-lighter)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1046
+ }
1047
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorTableCreatorComponent, decorators: [{
1048
+ type: Component,
1049
+ args: [{ selector: "mona-editor-table-creator", imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"mona-editor-table-creator\" (mouseleave)=\"onCellMouseLeave()\">\n @for (rx of [1, 2, 3, 4, 5, 6, 7, 8]; track rx) {\n @for (cx of [1, 2, 3, 4, 5, 6, 7, 8]; track cx) {\n <div\n class=\"mona-editor-table-creator-cell\"\n [style.background-color]=\"\n rx <= highlightedCell.row && cx <= highlightedCell.col\n ? 'var(--mona-primary)'\n : 'var(--mona-background-lighter)'\n \"\n (click)=\"onCellClick(rx, cx)\"\n (mouseenter)=\"onCellMouseEnter(rx, cx)\"></div>\n }\n }\n</div>\n", styles: [".mona-editor-table-creator{display:grid;grid-template-columns:repeat(8,1fr);column-gap:.125rem;row-gap:.125rem;padding:.25rem}.mona-editor-table-creator-cell{display:flex;border:1px solid var(--mona-border-color);width:24px;height:24px;background:var(--mona-background-lighter)}\n"] }]
1050
+ }], propDecorators: { insert: [{ type: i0.Output, args: ["insert"] }] } });
1051
+
1052
+ class EditorTableComponent {
1053
+ constructor() {
1054
+ this.#editorService = inject(EditorService);
1055
+ this.addColumnBeforeDisabled = computed(() => {
1056
+ this.#editorService.state();
1057
+ const isTable = this.#editorService.editor.isActive("table");
1058
+ const canAddColumnBefore = this.#editorService.editor.can().addColumnBefore();
1059
+ return !isTable || !canAddColumnBefore;
1060
+ }, /* @ts-ignore */
1061
+ ...(ngDevMode ? [{ debugName: "addColumnBeforeDisabled" }] : /* istanbul ignore next */ []));
1062
+ this.addColumnAfterDisabled = computed(() => {
1063
+ this.#editorService.state();
1064
+ const isTable = this.#editorService.editor.isActive("table");
1065
+ const canAddColumnAfter = this.#editorService.editor.can().addColumnAfter();
1066
+ return !isTable || !canAddColumnAfter;
1067
+ }, /* @ts-ignore */
1068
+ ...(ngDevMode ? [{ debugName: "addColumnAfterDisabled" }] : /* istanbul ignore next */ []));
1069
+ this.addRowBeforeDisabled = computed(() => {
1070
+ this.#editorService.state();
1071
+ const isTable = this.#editorService.editor.isActive("table");
1072
+ const canAddRowBefore = this.#editorService.editor.can().addRowBefore();
1073
+ return !isTable || !canAddRowBefore;
1074
+ }, /* @ts-ignore */
1075
+ ...(ngDevMode ? [{ debugName: "addRowBeforeDisabled" }] : /* istanbul ignore next */ []));
1076
+ this.addRowAfterDisabled = computed(() => {
1077
+ this.#editorService.state();
1078
+ const isTable = this.#editorService.editor.isActive("table");
1079
+ const canAddRowAfter = this.#editorService.editor.can().addRowAfter();
1080
+ return !isTable || !canAddRowAfter;
1081
+ }, /* @ts-ignore */
1082
+ ...(ngDevMode ? [{ debugName: "addRowAfterDisabled" }] : /* istanbul ignore next */ []));
1083
+ this.deleteColumnDisabled = computed(() => {
1084
+ this.#editorService.state();
1085
+ const isTable = this.#editorService.editor.isActive("table");
1086
+ const canDeleteColumn = this.#editorService.editor.can().deleteColumn();
1087
+ return !isTable || !canDeleteColumn;
1088
+ }, /* @ts-ignore */
1089
+ ...(ngDevMode ? [{ debugName: "deleteColumnDisabled" }] : /* istanbul ignore next */ []));
1090
+ this.deleteRowDisabled = computed(() => {
1091
+ this.#editorService.state();
1092
+ const isTable = this.#editorService.editor.isActive("table");
1093
+ const canDeleteRow = this.#editorService.editor.can().deleteRow();
1094
+ return !isTable || !canDeleteRow;
1095
+ }, /* @ts-ignore */
1096
+ ...(ngDevMode ? [{ debugName: "deleteRowDisabled" }] : /* istanbul ignore next */ []));
1097
+ this.deleteTableDisabled = computed(() => {
1098
+ this.#editorService.state();
1099
+ const isTable = this.#editorService.editor.isActive("table");
1100
+ const canDeleteTable = this.#editorService.editor.can().deleteTable();
1101
+ return !isTable || !canDeleteTable;
1102
+ }, /* @ts-ignore */
1103
+ ...(ngDevMode ? [{ debugName: "deleteTableDisabled" }] : /* istanbul ignore next */ []));
1104
+ this.mergeCellsDisabled = computed(() => {
1105
+ this.#editorService.state();
1106
+ const isTable = this.#editorService.editor.isActive("table");
1107
+ const canMergeCells = this.#editorService.editor.can().mergeCells();
1108
+ return !isTable || !canMergeCells;
1109
+ }, /* @ts-ignore */
1110
+ ...(ngDevMode ? [{ debugName: "mergeCellsDisabled" }] : /* istanbul ignore next */ []));
1111
+ this.popover = viewChild("popoverComponent", /* @ts-ignore */
1112
+ ...(ngDevMode ? [{ debugName: "popover" }] : /* istanbul ignore next */ []));
1113
+ this.splitCellDisabled = computed(() => {
1114
+ this.#editorService.state();
1115
+ const isTable = this.#editorService.editor.isActive("table");
1116
+ const canSplitCell = this.#editorService.editor.can().splitCell();
1117
+ return !isTable || !canSplitCell;
1118
+ }, /* @ts-ignore */
1119
+ ...(ngDevMode ? [{ debugName: "splitCellDisabled" }] : /* istanbul ignore next */ []));
1120
+ this.toggleHeaderRowDisabled = computed(() => {
1121
+ this.#editorService.state();
1122
+ const isTable = this.#editorService.editor.isActive("table");
1123
+ const canToggleHeaderRow = this.#editorService.editor.can().toggleHeaderRow();
1124
+ return !isTable || !canToggleHeaderRow;
1125
+ }, /* @ts-ignore */
1126
+ ...(ngDevMode ? [{ debugName: "toggleHeaderRowDisabled" }] : /* istanbul ignore next */ []));
1127
+ }
1128
+ #editorService;
1129
+ onAddColumnBeforeClick() {
1130
+ this.#editorService.editor.chain().focus().addColumnBefore().run();
1131
+ }
1132
+ onAddColumnAfterClick() {
1133
+ this.#editorService.editor.chain().focus().addColumnAfter().run();
1134
+ }
1135
+ onAddRowBeforeClick() {
1136
+ this.#editorService.editor.chain().focus().addRowBefore().run();
1137
+ }
1138
+ onAddRowAfterClick() {
1139
+ this.#editorService.editor.chain().focus().addRowAfter().run();
1140
+ }
1141
+ onDeleteColumnClick() {
1142
+ this.#editorService.editor.chain().focus().deleteColumn().run();
1143
+ }
1144
+ onDeleteRowClick() {
1145
+ this.#editorService.editor.chain().focus().deleteRow().run();
1146
+ }
1147
+ onDeleteTableClick() {
1148
+ this.#editorService.editor.chain().focus().deleteTable().run();
1149
+ }
1150
+ onMergeCellsClick() {
1151
+ this.#editorService.editor.chain().focus().mergeCells().run();
1152
+ }
1153
+ onSplitCellClick() {
1154
+ this.#editorService.editor.chain().focus().splitCell().run();
1155
+ }
1156
+ onTableInsert(event) {
1157
+ this.popover()?.close();
1158
+ this.#editorService.editor.commands.insertTable({
1159
+ rows: event.row,
1160
+ cols: event.col
1161
+ });
1162
+ }
1163
+ onToggleHeaderRow() {
1164
+ this.#editorService.editor.chain().focus().toggleHeaderRow().run();
1165
+ }
1166
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1167
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: EditorTableComponent, isStandalone: true, selector: "mona-editor-table", viewQueries: [{ propertyName: "popover", first: true, predicate: ["popoverComponent"], descendants: true, isSignal: true }], ngImport: i0, template: "<mona-button-group selection=\"single\">\n <button monaButton title=\"Insert table\" #insertTableButton>\n <i class=\"ri-grid-line\"></i>\n </button>\n <button\n monaButton\n [disabled]=\"addColumnBeforeDisabled()\"\n (click)=\"onAddColumnBeforeClick()\"\n title=\"Add column before\">\n <i class=\"ri-insert-column-left\"></i>\n </button>\n <button monaButton [disabled]=\"addColumnAfterDisabled()\" (click)=\"onAddColumnAfterClick()\" title=\"Add column after\">\n <i class=\"ri-insert-column-right\"></i>\n </button>\n <button monaButton [disabled]=\"addRowBeforeDisabled()\" (click)=\"onAddRowBeforeClick()\" title=\"Add row before\">\n <i class=\"ri-insert-row-top\"></i>\n </button>\n <button monaButton [disabled]=\"addRowAfterDisabled()\" (click)=\"onAddRowAfterClick()\" title=\"Add row after\">\n <i class=\"ri-insert-row-bottom\"></i>\n </button>\n <button monaButton [disabled]=\"deleteColumnDisabled()\" (click)=\"onDeleteColumnClick()\" title=\"Delete column\">\n <i class=\"ri-delete-column\"></i>\n </button>\n <button monaButton [disabled]=\"deleteRowDisabled()\" (click)=\"onDeleteRowClick()\" title=\"Delete row\">\n <i class=\"ri-delete-row\"></i>\n </button>\n <button monaButton [disabled]=\"mergeCellsDisabled()\" (click)=\"onMergeCellsClick()\" title=\"Merge selected cells\">\n <i class=\"ri-merge-cells-horizontal\"></i>\n </button>\n <button monaButton [disabled]=\"splitCellDisabled()\" (click)=\"onSplitCellClick()\" title=\"Split cell\">\n <i class=\"ri-split-cells-horizontal\"></i>\n </button>\n <button monaButton [disabled]=\"toggleHeaderRowDisabled()\" (click)=\"onToggleHeaderRow()\" title=\"Toggle header row\">\n <i class=\"ri-table-line\"></i>\n </button>\n <button monaButton [disabled]=\"deleteTableDisabled()\" (click)=\"onDeleteTableClick()\" title=\"Delete table\">\n <i class=\"ri-close-large-line\"></i>\n </button>\n</mona-button-group>\n\n<mona-popover [target]=\"insertTableButton\" position=\"bottom\" #popoverComponent>\n <mona-editor-table-creator (insert)=\"onTableInsert($event)\"></mona-editor-table-creator>\n</mona-popover>\n", styles: [""], dependencies: [{ kind: "component", type: ButtonGroupComponent, selector: "mona-button-group", inputs: ["allowEmpty", "aria-label", "disabled", "look", "rounded", "selection", "size", "class"], outputs: ["buttonClick", "disabledChange", "selectionChange"] }, { kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "lookChange", "selectedChange"] }, { kind: "component", type: PopoverComponent, selector: "mona-popover", inputs: ["displayArrow", "position", "rounded", "target", "title", "trigger"], outputs: ["hide", "hidden", "show", "shown"], exportAs: ["monaPopover"] }, { kind: "component", type: EditorTableCreatorComponent, selector: "mona-editor-table-creator", outputs: ["insert"] }] }); }
1168
+ }
1169
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorTableComponent, decorators: [{
1170
+ type: Component,
1171
+ args: [{ selector: "mona-editor-table", imports: [ButtonGroupComponent, ButtonDirective, PopoverComponent, EditorTableCreatorComponent], template: "<mona-button-group selection=\"single\">\n <button monaButton title=\"Insert table\" #insertTableButton>\n <i class=\"ri-grid-line\"></i>\n </button>\n <button\n monaButton\n [disabled]=\"addColumnBeforeDisabled()\"\n (click)=\"onAddColumnBeforeClick()\"\n title=\"Add column before\">\n <i class=\"ri-insert-column-left\"></i>\n </button>\n <button monaButton [disabled]=\"addColumnAfterDisabled()\" (click)=\"onAddColumnAfterClick()\" title=\"Add column after\">\n <i class=\"ri-insert-column-right\"></i>\n </button>\n <button monaButton [disabled]=\"addRowBeforeDisabled()\" (click)=\"onAddRowBeforeClick()\" title=\"Add row before\">\n <i class=\"ri-insert-row-top\"></i>\n </button>\n <button monaButton [disabled]=\"addRowAfterDisabled()\" (click)=\"onAddRowAfterClick()\" title=\"Add row after\">\n <i class=\"ri-insert-row-bottom\"></i>\n </button>\n <button monaButton [disabled]=\"deleteColumnDisabled()\" (click)=\"onDeleteColumnClick()\" title=\"Delete column\">\n <i class=\"ri-delete-column\"></i>\n </button>\n <button monaButton [disabled]=\"deleteRowDisabled()\" (click)=\"onDeleteRowClick()\" title=\"Delete row\">\n <i class=\"ri-delete-row\"></i>\n </button>\n <button monaButton [disabled]=\"mergeCellsDisabled()\" (click)=\"onMergeCellsClick()\" title=\"Merge selected cells\">\n <i class=\"ri-merge-cells-horizontal\"></i>\n </button>\n <button monaButton [disabled]=\"splitCellDisabled()\" (click)=\"onSplitCellClick()\" title=\"Split cell\">\n <i class=\"ri-split-cells-horizontal\"></i>\n </button>\n <button monaButton [disabled]=\"toggleHeaderRowDisabled()\" (click)=\"onToggleHeaderRow()\" title=\"Toggle header row\">\n <i class=\"ri-table-line\"></i>\n </button>\n <button monaButton [disabled]=\"deleteTableDisabled()\" (click)=\"onDeleteTableClick()\" title=\"Delete table\">\n <i class=\"ri-close-large-line\"></i>\n </button>\n</mona-button-group>\n\n<mona-popover [target]=\"insertTableButton\" position=\"bottom\" #popoverComponent>\n <mona-editor-table-creator (insert)=\"onTableInsert($event)\"></mona-editor-table-creator>\n</mona-popover>\n" }]
1172
+ }], propDecorators: { popover: [{ type: i0.ViewChild, args: ["popoverComponent", { isSignal: true }] }] } });
1173
+
1174
+ class EditorTaskListComponent {
1175
+ constructor() {
1176
+ this.#editorService = inject(EditorService);
1177
+ this.taskSelected = computed(() => {
1178
+ this.#editorService.state();
1179
+ return this.#editorService.editor.isActive("taskItem");
1180
+ }, /* @ts-ignore */
1181
+ ...(ngDevMode ? [{ debugName: "taskSelected" }] : /* istanbul ignore next */ []));
1182
+ }
1183
+ #editorService;
1184
+ onTaskToggle() {
1185
+ this.#editorService.editor.chain().focus().toggleTaskList().run();
1186
+ }
1187
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorTaskListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1188
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: EditorTaskListComponent, isStandalone: true, selector: "mona-editor-task-list", ngImport: i0, template: "<button monaButton [selected]=\"taskSelected()\" (click)=\"onTaskToggle()\" title=\"Insert task list\">\n <i class=\"ri-checkbox-fill\"></i>\n</button>\n", styles: [""], dependencies: [{ kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "lookChange", "selectedChange"] }] }); }
1189
+ }
1190
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorTaskListComponent, decorators: [{
1191
+ type: Component,
1192
+ args: [{ selector: "mona-editor-task-list", imports: [ButtonDirective], template: "<button monaButton [selected]=\"taskSelected()\" (click)=\"onTaskToggle()\" title=\"Insert task list\">\n <i class=\"ri-checkbox-fill\"></i>\n</button>\n" }]
1193
+ }] });
1194
+
1195
+ class EditorTextAlignmentsComponent {
1196
+ constructor() {
1197
+ this.#editorService = inject(EditorService);
1198
+ this.alignCenterSelected = computed(() => {
1199
+ this.#editorService.state();
1200
+ return this.#editorService.editor.isActive({ textAlign: "center" });
1201
+ }, /* @ts-ignore */
1202
+ ...(ngDevMode ? [{ debugName: "alignCenterSelected" }] : /* istanbul ignore next */ []));
1203
+ this.alignJustifySelected = computed(() => {
1204
+ this.#editorService.state();
1205
+ return this.#editorService.editor.isActive({ textAlign: "justify" });
1206
+ }, /* @ts-ignore */
1207
+ ...(ngDevMode ? [{ debugName: "alignJustifySelected" }] : /* istanbul ignore next */ []));
1208
+ this.alignLeftSelected = computed(() => {
1209
+ this.#editorService.state();
1210
+ return this.#editorService.editor.isActive({ textAlign: "left" });
1211
+ }, /* @ts-ignore */
1212
+ ...(ngDevMode ? [{ debugName: "alignLeftSelected" }] : /* istanbul ignore next */ []));
1213
+ this.alignRightSelected = computed(() => {
1214
+ this.#editorService.state();
1215
+ return this.#editorService.editor.isActive({ textAlign: "right" });
1216
+ }, /* @ts-ignore */
1217
+ ...(ngDevMode ? [{ debugName: "alignRightSelected" }] : /* istanbul ignore next */ []));
1218
+ }
1219
+ #editorService;
1220
+ onAlignCenter() {
1221
+ if (this.alignCenterSelected()) {
1222
+ this.#editorService.editor.chain().focus().unsetTextAlign().run();
1223
+ }
1224
+ else {
1225
+ this.#editorService.editor.chain().focus().setTextAlign("center").run();
1226
+ }
1227
+ }
1228
+ onAlignJustify() {
1229
+ if (this.alignJustifySelected()) {
1230
+ this.#editorService.editor.chain().focus().unsetTextAlign().run();
1231
+ }
1232
+ else {
1233
+ this.#editorService.editor.chain().focus().setTextAlign("justify").run();
1234
+ }
1235
+ }
1236
+ onAlignLeft() {
1237
+ if (this.alignLeftSelected()) {
1238
+ this.#editorService.editor.chain().focus().unsetTextAlign().run();
1239
+ }
1240
+ else {
1241
+ this.#editorService.editor.chain().focus().setTextAlign("left").run();
1242
+ }
1243
+ }
1244
+ onAlignRight() {
1245
+ if (this.alignRightSelected()) {
1246
+ this.#editorService.editor.chain().focus().unsetTextAlign().run();
1247
+ }
1248
+ else {
1249
+ this.#editorService.editor.chain().focus().setTextAlign("right").run();
1250
+ }
1251
+ }
1252
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorTextAlignmentsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1253
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: EditorTextAlignmentsComponent, isStandalone: true, selector: "mona-editor-text-alignments", ngImport: i0, template: "<mona-button-group selection=\"single\">\r\n <button monaButton [selected]=\"alignLeftSelected()\" (click)=\"onAlignLeft()\" title=\"Align text left\">\r\n <i class=\"ri-align-left\"></i>\r\n </button>\r\n <button monaButton [selected]=\"alignCenterSelected()\" (click)=\"onAlignCenter()\" title=\"Center text\">\r\n <i class=\"ri-align-center\"></i>\r\n </button>\r\n <button monaButton [selected]=\"alignRightSelected()\" (click)=\"onAlignRight()\" title=\"Align text right\">\r\n <i class=\"ri-align-right\"></i>\r\n </button>\r\n <button monaButton [selected]=\"alignJustifySelected()\" (click)=\"onAlignJustify()\" title=\"Justify\">\r\n <i class=\"ri-align-justify\"></i>\r\n </button>\r\n</mona-button-group>\r\n", styles: [""], dependencies: [{ kind: "component", type: ButtonGroupComponent, selector: "mona-button-group", inputs: ["allowEmpty", "aria-label", "disabled", "look", "rounded", "selection", "size", "class"], outputs: ["buttonClick", "disabledChange", "selectionChange"] }, { kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "lookChange", "selectedChange"] }] }); }
1254
+ }
1255
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorTextAlignmentsComponent, decorators: [{
1256
+ type: Component,
1257
+ args: [{ selector: "mona-editor-text-alignments", imports: [ButtonGroupComponent, ButtonDirective], template: "<mona-button-group selection=\"single\">\r\n <button monaButton [selected]=\"alignLeftSelected()\" (click)=\"onAlignLeft()\" title=\"Align text left\">\r\n <i class=\"ri-align-left\"></i>\r\n </button>\r\n <button monaButton [selected]=\"alignCenterSelected()\" (click)=\"onAlignCenter()\" title=\"Center text\">\r\n <i class=\"ri-align-center\"></i>\r\n </button>\r\n <button monaButton [selected]=\"alignRightSelected()\" (click)=\"onAlignRight()\" title=\"Align text right\">\r\n <i class=\"ri-align-right\"></i>\r\n </button>\r\n <button monaButton [selected]=\"alignJustifySelected()\" (click)=\"onAlignJustify()\" title=\"Justify\">\r\n <i class=\"ri-align-justify\"></i>\r\n </button>\r\n</mona-button-group>\r\n" }]
1258
+ }] });
1259
+
1260
+ class EditorComponent {
1261
+ constructor() {
1262
+ this.editorContainer = viewChild.required("editorContainer", /* @ts-ignore */
1263
+ ...(ngDevMode ? [{ debugName: "editorContainer" }] : /* istanbul ignore next */ []));
1264
+ this.editorService = inject(EditorService);
1265
+ /**
1266
+ * Emits when the editor loses focus.
1267
+ */
1268
+ this.blur = output();
1269
+ /**
1270
+ * Emits when the editor is created for the first time and is ready to be used.
1271
+ */
1272
+ this.create = output();
1273
+ /**
1274
+ * Emits when the editor gains focus.
1275
+ */
1276
+ this.focus = output();
1277
+ /**
1278
+ * Emits when the selection of the editor changes.
1279
+ */
1280
+ this.selectionUpdate = output();
1281
+ /**
1282
+ * Emits when the content of the editor changes.
1283
+ */
1284
+ this.update = output();
1285
+ /**
1286
+ * The initial content of the editor.
1287
+ * Accepted values are:
1288
+ * - A string representing the HTML content.
1289
+ * - A {@link JSONContent} representing the content.
1290
+ */
1291
+ this.content = input(/* @ts-ignore */
1292
+ ...(ngDevMode ? [undefined, { debugName: "content" }] : /* istanbul ignore next */ []));
1293
+ /**
1294
+ * The settings of the editor.
1295
+ */
1296
+ this.settings = input({}, /* @ts-ignore */
1297
+ ...(ngDevMode ? [{ debugName: "settings" }] : /* istanbul ignore next */ []));
1298
+ effect(() => {
1299
+ const settings = this.settings();
1300
+ untracked(() => {
1301
+ this.editorService.setupEditor(this.editorContainer().nativeElement, settings);
1302
+ });
1303
+ });
1304
+ effect(() => {
1305
+ const content = this.content() ?? "";
1306
+ untracked(() => {
1307
+ this.loadEditorContent(content);
1308
+ });
1309
+ });
1310
+ }
1311
+ ngOnDestroy() {
1312
+ this.editorService.destroy();
1313
+ }
1314
+ ngOnInit() {
1315
+ this.setSubscriptions();
1316
+ }
1317
+ loadEditorContent(content) {
1318
+ if (typeof content === "string") {
1319
+ this.editorService.editor.commands.setContent(content);
1320
+ }
1321
+ else {
1322
+ this.editorService.editor.commands.setContent({
1323
+ type: "doc",
1324
+ content: [content]
1325
+ });
1326
+ }
1327
+ }
1328
+ setSubscriptions() {
1329
+ this.editorService.blur$.subscribe(() => {
1330
+ this.blur.emit();
1331
+ });
1332
+ this.editorService.create$.subscribe(() => {
1333
+ this.create.emit();
1334
+ });
1335
+ this.editorService.focus$.subscribe(() => {
1336
+ this.focus.emit();
1337
+ });
1338
+ this.editorService.selectionUpdate$.subscribe(() => {
1339
+ this.selectionUpdate.emit();
1340
+ });
1341
+ this.editorService.update$.subscribe(() => {
1342
+ this.update.emit({
1343
+ html: this.html,
1344
+ json: this.json
1345
+ });
1346
+ });
1347
+ }
1348
+ /**
1349
+ * Returns the HTML content of the editor.
1350
+ * It can be used to save the content of the editor in a database and restore it later.
1351
+ */
1352
+ get html() {
1353
+ return this.editorService.editor.getHTML();
1354
+ }
1355
+ /**
1356
+ * Returns the JSON content of the editor in the {@link JSONContent} format.
1357
+ * It can be used to save the content of the editor in a database and restore it later.
1358
+ */
1359
+ get json() {
1360
+ return this.editorService.editor.getJSON();
1361
+ }
1362
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1363
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: EditorComponent, isStandalone: true, selector: "mona-editor", inputs: { content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: false, transformFunction: null }, settings: { classPropertyName: "settings", publicName: "settings", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { blur: "blur", create: "create", focus: "focus", selectionUpdate: "selectionUpdate", update: "update" }, host: { classAttribute: "mona-editor" }, providers: [EditorService], viewQueries: [{ propertyName: "editorContainer", first: true, predicate: ["editorContainer"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"mona-editor-toolbar\">\n <mona-editor-basic-text-styles></mona-editor-basic-text-styles>\n @if (editorService.settings().headings) {\n <mona-editor-headings></mona-editor-headings>\n }\n @if (editorService.settings().alignment) {\n <mona-editor-text-alignments></mona-editor-text-alignments>\n }\n @if (editorService.settings().fontSize) {\n <mona-editor-font-size></mona-editor-font-size>\n }\n @if (editorService.settings().fontFamily) {\n <mona-editor-font-family></mona-editor-font-family>\n }\n @if (editorService.settings().fontColor) {\n <mona-editor-font-color></mona-editor-font-color>\n }\n @if (editorService.settings().fontHighlight) {\n <mona-editor-font-highlight></mona-editor-font-highlight>\n }\n @if (editorService.settings().blockquote) {\n <mona-editor-blockquote></mona-editor-blockquote>\n }\n @if (editorService.settings().code) {\n <mona-editor-code-block></mona-editor-code-block>\n }\n @if (editorService.settings().link) {\n <mona-editor-link></mona-editor-link>\n }\n @if (editorService.settings().list) {\n <mona-editor-list></mona-editor-list>\n }\n @if (editorService.settings().taskList) {\n <mona-editor-task-list></mona-editor-task-list>\n }\n @if (editorService.settings().indent) {\n <mona-editor-indent></mona-editor-indent>\n }\n @if (editorService.settings().history) {\n <mona-editor-history></mona-editor-history>\n }\n @if (editorService.settings().horizontalRule) {\n <mona-editor-horizontal-rule></mona-editor-horizontal-rule>\n }\n @if (editorService.settings().image) {\n <mona-editor-image></mona-editor-image>\n }\n @if (editorService.settings().table) {\n <mona-editor-table></mona-editor-table>\n }\n</div>\n<div class=\"mona-editor-container\" #editorContainer></div>\n", styles: [".mona-editor-toolbar{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-start;gap:.25rem;padding:.25rem}.mona-editor-toolbar button{width:1.875rem;height:1.875rem}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "component", type: EditorBasicTextStylesComponent, selector: "mona-editor-basic-text-styles" }, { kind: "component", type: EditorHeadingsComponent, selector: "mona-editor-headings" }, { kind: "component", type: EditorTextAlignmentsComponent, selector: "mona-editor-text-alignments" }, { kind: "component", type: EditorFontSizeComponent, selector: "mona-editor-font-size" }, { kind: "component", type: EditorFontColorComponent, selector: "mona-editor-font-color" }, { kind: "component", type: EditorFontHighlightComponent, selector: "mona-editor-font-highlight" }, { kind: "component", type: EditorBlockquoteComponent, selector: "mona-editor-blockquote" }, { kind: "component", type: EditorLinkComponent, selector: "mona-editor-link" }, { kind: "component", type: EditorListComponent, selector: "mona-editor-list" }, { kind: "component", type: EditorIndentComponent, selector: "mona-editor-indent" }, { kind: "component", type: EditorHistoryComponent, selector: "mona-editor-history" }, { kind: "component", type: EditorFontFamilyComponent, selector: "mona-editor-font-family" }, { kind: "component", type: EditorHorizontalRuleComponent, selector: "mona-editor-horizontal-rule" }, { kind: "component", type: EditorTaskListComponent, selector: "mona-editor-task-list" }, { kind: "component", type: EditorImageComponent, selector: "mona-editor-image" }, { kind: "component", type: EditorTableComponent, selector: "mona-editor-table" }, { kind: "component", type: EditorCodeBlockComponent, selector: "mona-editor-code-block" }] }); }
1364
+ }
1365
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: EditorComponent, decorators: [{
1366
+ type: Component,
1367
+ args: [{ selector: "mona-editor", imports: [
1368
+ FormsModule,
1369
+ EditorBasicTextStylesComponent,
1370
+ EditorHeadingsComponent,
1371
+ EditorTextAlignmentsComponent,
1372
+ EditorFontSizeComponent,
1373
+ EditorFontColorComponent,
1374
+ EditorFontHighlightComponent,
1375
+ EditorBlockquoteComponent,
1376
+ EditorLinkComponent,
1377
+ EditorListComponent,
1378
+ EditorIndentComponent,
1379
+ EditorHistoryComponent,
1380
+ EditorFontFamilyComponent,
1381
+ EditorHorizontalRuleComponent,
1382
+ EditorTaskListComponent,
1383
+ EditorImageComponent,
1384
+ EditorTableComponent,
1385
+ EditorCodeBlockComponent
1386
+ ], providers: [EditorService], host: {
1387
+ class: "mona-editor"
1388
+ }, template: "<div class=\"mona-editor-toolbar\">\n <mona-editor-basic-text-styles></mona-editor-basic-text-styles>\n @if (editorService.settings().headings) {\n <mona-editor-headings></mona-editor-headings>\n }\n @if (editorService.settings().alignment) {\n <mona-editor-text-alignments></mona-editor-text-alignments>\n }\n @if (editorService.settings().fontSize) {\n <mona-editor-font-size></mona-editor-font-size>\n }\n @if (editorService.settings().fontFamily) {\n <mona-editor-font-family></mona-editor-font-family>\n }\n @if (editorService.settings().fontColor) {\n <mona-editor-font-color></mona-editor-font-color>\n }\n @if (editorService.settings().fontHighlight) {\n <mona-editor-font-highlight></mona-editor-font-highlight>\n }\n @if (editorService.settings().blockquote) {\n <mona-editor-blockquote></mona-editor-blockquote>\n }\n @if (editorService.settings().code) {\n <mona-editor-code-block></mona-editor-code-block>\n }\n @if (editorService.settings().link) {\n <mona-editor-link></mona-editor-link>\n }\n @if (editorService.settings().list) {\n <mona-editor-list></mona-editor-list>\n }\n @if (editorService.settings().taskList) {\n <mona-editor-task-list></mona-editor-task-list>\n }\n @if (editorService.settings().indent) {\n <mona-editor-indent></mona-editor-indent>\n }\n @if (editorService.settings().history) {\n <mona-editor-history></mona-editor-history>\n }\n @if (editorService.settings().horizontalRule) {\n <mona-editor-horizontal-rule></mona-editor-horizontal-rule>\n }\n @if (editorService.settings().image) {\n <mona-editor-image></mona-editor-image>\n }\n @if (editorService.settings().table) {\n <mona-editor-table></mona-editor-table>\n }\n</div>\n<div class=\"mona-editor-container\" #editorContainer></div>\n", styles: [".mona-editor-toolbar{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-start;gap:.25rem;padding:.25rem}.mona-editor-toolbar button{width:1.875rem;height:1.875rem}\n"] }]
1389
+ }], ctorParameters: () => [], propDecorators: { editorContainer: [{ type: i0.ViewChild, args: ["editorContainer", { isSignal: true }] }], blur: [{ type: i0.Output, args: ["blur"] }], create: [{ type: i0.Output, args: ["create"] }], focus: [{ type: i0.Output, args: ["focus"] }], selectionUpdate: [{ type: i0.Output, args: ["selectionUpdate"] }], update: [{ type: i0.Output, args: ["update"] }], content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: false }] }], settings: [{ type: i0.Input, args: [{ isSignal: true, alias: "settings", required: false }] }] } });
1390
+
1391
+ /*
1392
+ * Public API Surface of @nanahoshi/mona-ui/editor
1393
+ */
1394
+
1395
+ /**
1396
+ * Generated bundle index. Do not edit.
1397
+ */
1398
+
1399
+ export { EditorComponent };
1400
+ //# sourceMappingURL=nanahoshi-mona-ui-editor.mjs.map