@stackch/angular-richtext-editor 1.1.1 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { EventEmitter, ElementRef
|
|
2
|
+
import { ChangeDetectorRef, EventEmitter, ElementRef } from '@angular/core';
|
|
3
3
|
import { ControlValueAccessor } from '@angular/forms';
|
|
4
4
|
|
|
5
5
|
declare class StackchRichtextEditorConfig {
|
|
@@ -17,6 +17,10 @@ declare class StackchRichtextEditorConfig {
|
|
|
17
17
|
showRemoveFormat: boolean;
|
|
18
18
|
i18n?: Partial<StackchRichtextEditorI18n>;
|
|
19
19
|
}
|
|
20
|
+
interface StackchRichtextMetrics {
|
|
21
|
+
htmlLength: number;
|
|
22
|
+
textLength: number;
|
|
23
|
+
}
|
|
20
24
|
declare class StackchRichtextEditorI18n {
|
|
21
25
|
placeholder: string;
|
|
22
26
|
undoTitle: string;
|
|
@@ -57,8 +61,15 @@ declare class StackchRichtextEditorI18n {
|
|
|
57
61
|
declare const STACKCH_RTE_I18N_DE: Partial<StackchRichtextEditorI18n>;
|
|
58
62
|
declare const STACKCH_RTE_I18N_FR: Partial<StackchRichtextEditorI18n>;
|
|
59
63
|
declare const STACKCH_RTE_I18N_IT: Partial<StackchRichtextEditorI18n>;
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Abstract base class shared by StackchRichtextEditor (core) and
|
|
66
|
+
* StackchRichtextEditorMaterial (Material variant).
|
|
67
|
+
* Contains all editing logic; concrete subclasses add only the @Component
|
|
68
|
+
* decorator with their own template / styles / toolbar.
|
|
69
|
+
*/
|
|
70
|
+
declare abstract class StackchRichtextEditorBase implements ControlValueAccessor {
|
|
71
|
+
protected cdr: ChangeDetectorRef;
|
|
72
|
+
protected logPrefix: string;
|
|
62
73
|
placeholder: string;
|
|
63
74
|
showToolbar: boolean;
|
|
64
75
|
fonts: string[];
|
|
@@ -70,12 +81,13 @@ declare class StackchRichtextEditor implements ControlValueAccessor {
|
|
|
70
81
|
get disabled(): boolean;
|
|
71
82
|
private _disabled;
|
|
72
83
|
valueChange: EventEmitter<string>;
|
|
84
|
+
metricsChange: EventEmitter<StackchRichtextMetrics>;
|
|
73
85
|
editorRef: ElementRef<HTMLDivElement>;
|
|
74
86
|
constructor(cdr: ChangeDetectorRef);
|
|
75
87
|
config?: Partial<StackchRichtextEditorConfig> | null;
|
|
76
88
|
get cfg(): StackchRichtextEditorConfig;
|
|
77
89
|
get i18n(): StackchRichtextEditorI18n;
|
|
78
|
-
|
|
90
|
+
protected onChange: (value: string) => void;
|
|
79
91
|
onTouched: () => void;
|
|
80
92
|
private savedRange;
|
|
81
93
|
private history;
|
|
@@ -131,6 +143,7 @@ declare class StackchRichtextEditor implements ControlValueAccessor {
|
|
|
131
143
|
onKeyup(_evt: KeyboardEvent): void;
|
|
132
144
|
onPaste(evt: ClipboardEvent): void;
|
|
133
145
|
private emitValue;
|
|
146
|
+
private emitMetrics;
|
|
134
147
|
private cleanupEmptyStylesAndSpans;
|
|
135
148
|
get canUndo(): boolean;
|
|
136
149
|
get canRedo(): boolean;
|
|
@@ -147,22 +160,13 @@ declare class StackchRichtextEditor implements ControlValueAccessor {
|
|
|
147
160
|
private focusEditor;
|
|
148
161
|
private applyInlineStyle;
|
|
149
162
|
private applyInlineStyleSmart;
|
|
150
|
-
private
|
|
151
|
-
private
|
|
152
|
-
private
|
|
153
|
-
private
|
|
154
|
-
private
|
|
155
|
-
private
|
|
156
|
-
private
|
|
157
|
-
private deselectItalicBySplitting;
|
|
158
|
-
private deselectUnderlineBySplitting;
|
|
159
|
-
private cleanupEmptyItalicSpans;
|
|
160
|
-
private cleanupEmptyUnderlineSpans;
|
|
161
|
-
private stripBoldWithin;
|
|
162
|
-
private liftOutOfBoldAncestors;
|
|
163
|
-
private splitOutOfAncestor;
|
|
164
|
-
private cleanupEmptyBoldSpans;
|
|
165
|
-
private maybeUnwrapNormalSpan;
|
|
163
|
+
private applySelectionStyles;
|
|
164
|
+
private collectTextSegments;
|
|
165
|
+
private intersectsRange;
|
|
166
|
+
private applyStylesToSegment;
|
|
167
|
+
private toCssProperty;
|
|
168
|
+
private mergeAdjacentStyledSpans;
|
|
169
|
+
private saveSelectionFromRange;
|
|
166
170
|
private wrapSelectionWith;
|
|
167
171
|
private insertTextAtSelection;
|
|
168
172
|
private updateInlineStates;
|
|
@@ -172,12 +176,14 @@ declare class StackchRichtextEditor implements ControlValueAccessor {
|
|
|
172
176
|
private isNodeBold;
|
|
173
177
|
private isNodeItalic;
|
|
174
178
|
private isNodeUnderline;
|
|
175
|
-
private isItalicCarrier;
|
|
176
|
-
private isUnderlineCarrier;
|
|
177
|
-
private computeBoldActiveForRange;
|
|
178
|
-
private computeItalicActiveForRange;
|
|
179
|
-
private computeUnderlineActiveForRange;
|
|
180
179
|
private removeInlineStyleInRange;
|
|
180
|
+
private pruneDanglingStyleCarriers;
|
|
181
|
+
private elementHasVisibleContent;
|
|
182
|
+
private isolateRangeFromStyleCarriers;
|
|
183
|
+
private selectionHasStyle;
|
|
184
|
+
private findCarrierContainingRange;
|
|
185
|
+
private isStyleCarrier;
|
|
186
|
+
private splitCarrierAroundSelection;
|
|
181
187
|
toggleBold(): void;
|
|
182
188
|
toggleItalic(): void;
|
|
183
189
|
toggleUnderline(): void;
|
|
@@ -190,8 +196,15 @@ declare class StackchRichtextEditor implements ControlValueAccessor {
|
|
|
190
196
|
private applySpacingToSelection;
|
|
191
197
|
private normalizeSpacingSpans;
|
|
192
198
|
private setHeading;
|
|
199
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<StackchRichtextEditorBase, never>;
|
|
200
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<StackchRichtextEditorBase, never, never, { "placeholder": { "alias": "placeholder"; "required": false; }; "showToolbar": { "alias": "showToolbar"; "required": false; }; "fonts": { "alias": "fonts"; "required": false; }; "fontSizes": { "alias": "fontSizes"; "required": false; }; "height": { "alias": "height"; "required": false; }; "minHeight": { "alias": "minHeight"; "required": false; }; "maxHeight": { "alias": "maxHeight"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "config": { "alias": "config"; "required": false; }; }, { "valueChange": "valueChange"; "metricsChange": "metricsChange"; }, never, never, true, never>;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
declare class StackchRichtextEditor extends StackchRichtextEditorBase {
|
|
204
|
+
protected logPrefix: string;
|
|
205
|
+
constructor(cdr: ChangeDetectorRef);
|
|
193
206
|
static ɵfac: i0.ɵɵFactoryDeclaration<StackchRichtextEditor, never>;
|
|
194
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<StackchRichtextEditor, "stackch-richtext-editor", never, {
|
|
207
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<StackchRichtextEditor, "stackch-richtext-editor", never, {}, {}, never, never, true, never>;
|
|
195
208
|
}
|
|
196
209
|
|
|
197
210
|
declare class StackchRichtextEditorToolbar {
|
|
@@ -245,4 +258,5 @@ declare class StackchRichtextEditorToolbar {
|
|
|
245
258
|
static ɵcmp: i0.ɵɵComponentDeclaration<StackchRichtextEditorToolbar, "stackch-richtext-editor-toolbar", never, { "cfg": { "alias": "cfg"; "required": false; }; "i18n": { "alias": "i18n"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "fonts": { "alias": "fonts"; "required": false; }; "fontSizes": { "alias": "fontSizes"; "required": false; }; "isBoldActive": { "alias": "isBoldActive"; "required": false; }; "isItalicActive": { "alias": "isItalicActive"; "required": false; }; "isUnderlineActive": { "alias": "isUnderlineActive"; "required": false; }; "canUndo": { "alias": "canUndo"; "required": false; }; "canRedo": { "alias": "canRedo"; "required": false; }; "uiState": { "alias": "uiState"; "required": false; }; }, { "undo": "undo"; "redo": "redo"; "toggleFontPanel": "toggleFontPanel"; "toggleHeadingMenu": "toggleHeadingMenu"; "toggleSpacingMenu": "toggleSpacingMenu"; "toggleAlignMenu": "toggleAlignMenu"; "toggleColorMenu": "toggleColorMenu"; "toggleListMenu": "toggleListMenu"; "pickFont": "pickFont"; "pickFontSize": "pickFontSize"; "pickAlign": "pickAlign"; "pickList": "pickList"; "pickHeading": "pickHeading"; "pickSpacing": "pickSpacing"; "applyColor": "applyColor"; "applyHighlight": "applyHighlight"; "toggleBold": "toggleBold"; "toggleItalic": "toggleItalic"; "toggleUnderline": "toggleUnderline"; "insertLink": "insertLink"; "removeFormat": "removeFormat"; "saveSelectionRequest": "saveSelectionRequest"; }, never, never, true, never>;
|
|
246
259
|
}
|
|
247
260
|
|
|
248
|
-
export { STACKCH_RTE_I18N_DE, STACKCH_RTE_I18N_FR, STACKCH_RTE_I18N_IT, StackchRichtextEditor, StackchRichtextEditorConfig, StackchRichtextEditorI18n, StackchRichtextEditorToolbar };
|
|
261
|
+
export { STACKCH_RTE_I18N_DE, STACKCH_RTE_I18N_FR, STACKCH_RTE_I18N_IT, StackchRichtextEditor, StackchRichtextEditorBase, StackchRichtextEditorConfig, StackchRichtextEditorI18n, StackchRichtextEditorToolbar };
|
|
262
|
+
export type { StackchRichtextMetrics };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackch/angular-richtext-editor",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Lightweight Angular rich text editor (standalone) with a reusable toolbar: fonts, sizes, colors, lists, alignment, links.",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@angular/common": "^20.3.4",
|