@phuong-tran-redoc/document-engine-angular 0.0.26 → 0.0.28
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { HostBinding, Input, Directive, inject, Injectable,
|
|
2
|
+
import { HostBinding, Input, Directive, inject, Injectable, ElementRef, ViewEncapsulation, ChangeDetectionStrategy, Component, EventEmitter, Output, ChangeDetectorRef, InjectionToken, HostListener, forwardRef, ContentChildren, ViewChild, ViewChildren, NgZone, ViewContainerRef, EnvironmentInjector, NgModule, ApplicationRef, createComponent, Renderer2 } from '@angular/core';
|
|
3
3
|
import { Extension, Editor } from '@tiptap/core';
|
|
4
4
|
import Blockquote from '@tiptap/extension-blockquote';
|
|
5
5
|
import Bold from '@tiptap/extension-bold';
|
|
@@ -533,21 +533,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImpo
|
|
|
533
533
|
}], ctorParameters: () => [] });
|
|
534
534
|
|
|
535
535
|
class IconComponent {
|
|
536
|
-
name
|
|
537
|
-
|
|
536
|
+
set name(value) {
|
|
537
|
+
const svgContent = this.iconRegistry.getIconString(value);
|
|
538
|
+
const hostElement = this.elementRef.nativeElement;
|
|
539
|
+
// Set innerHTML to render SVG
|
|
540
|
+
hostElement.innerHTML = svgContent;
|
|
541
|
+
// this.cdr.markForCheck();
|
|
542
|
+
}
|
|
543
|
+
// private cdr = inject(ChangeDetectorRef);
|
|
538
544
|
elementRef = inject(ElementRef);
|
|
539
545
|
iconRegistry = inject(IconRegistryService);
|
|
540
|
-
ngOnChanges(changes) {
|
|
541
|
-
if (changes['name']) {
|
|
542
|
-
const svgContent = this.iconRegistry.getIconString(this.name);
|
|
543
|
-
const hostElement = this.elementRef.nativeElement;
|
|
544
|
-
// Set innerHTML to render SVG
|
|
545
|
-
hostElement.innerHTML = svgContent;
|
|
546
|
-
this.cdr.markForCheck();
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
546
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: IconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
550
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.10", type: IconComponent, isStandalone: true, selector: "document-engine-icon", inputs: { name: "name" },
|
|
547
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.10", type: IconComponent, isStandalone: true, selector: "document-engine-icon", inputs: { name: "name" }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
551
548
|
}
|
|
552
549
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: IconComponent, decorators: [{
|
|
553
550
|
type: Component,
|
|
@@ -4819,7 +4816,7 @@ class EditorBubbleMenuComponent {
|
|
|
4819
4816
|
this.addDocumentClickHandler();
|
|
4820
4817
|
}
|
|
4821
4818
|
ngAfterViewInit() {
|
|
4822
|
-
const bubbleElement = this.bubbleElement?.nativeElement;
|
|
4819
|
+
// const bubbleElement = this.bubbleElement?.nativeElement;
|
|
4823
4820
|
// if (bubbleElement) {
|
|
4824
4821
|
// this.focusTrap.attach(bubbleElement);
|
|
4825
4822
|
// }
|
|
@@ -4985,6 +4982,9 @@ class EditorBubbleMenuComponent {
|
|
|
4985
4982
|
this.currentViewId = viewId;
|
|
4986
4983
|
// Activate new view
|
|
4987
4984
|
this.activateView(this.currentViewRef);
|
|
4985
|
+
// Trigger change detection for the child component to render immediately
|
|
4986
|
+
// This is especially important for Angular v14 compatibility
|
|
4987
|
+
this.cdr.markForCheck();
|
|
4988
4988
|
// Mark bubble as visible for transition handling
|
|
4989
4989
|
const bubbleElement = this.bubbleElement?.nativeElement;
|
|
4990
4990
|
if (bubbleElement && this.config.target?.requireFocus) {
|
|
@@ -6102,10 +6102,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImpo
|
|
|
6102
6102
|
args: ['attr.data-drag-handle']
|
|
6103
6103
|
}] } });
|
|
6104
6104
|
|
|
6105
|
+
/**
|
|
6106
|
+
* Injection token for HTML preprocessor function.
|
|
6107
|
+
* Use this token to provide a custom function that processes HTML content
|
|
6108
|
+
* before it's set into the TipTap editor.
|
|
6109
|
+
*
|
|
6110
|
+
* This is optional - if not provided, the editor will use the HTML content as-is.
|
|
6111
|
+
*
|
|
6112
|
+
* @example
|
|
6113
|
+
* ```typescript
|
|
6114
|
+
* // In your component or module providers
|
|
6115
|
+
* {
|
|
6116
|
+
* provide: EDITOR_HTML_PREPROCESSOR,
|
|
6117
|
+
* useValue: (html: string) => {
|
|
6118
|
+
* // Your custom preprocessing logic
|
|
6119
|
+
* return html.replace(/old/g, 'new');
|
|
6120
|
+
* }
|
|
6121
|
+
* }
|
|
6122
|
+
* ```
|
|
6123
|
+
*/
|
|
6124
|
+
const EDITOR_HTML_PREPROCESSOR = new InjectionToken('EDITOR_HTML_PREPROCESSOR');
|
|
6125
|
+
|
|
6105
6126
|
class TiptapEditorDirective {
|
|
6106
6127
|
elRef = inject(ElementRef);
|
|
6107
6128
|
renderer = inject(Renderer2);
|
|
6108
6129
|
changeDetectorRef = inject(ChangeDetectorRef);
|
|
6130
|
+
htmlPreprocessor = inject(EDITOR_HTML_PREPROCESSOR, { optional: true });
|
|
6109
6131
|
_editor;
|
|
6110
6132
|
initialEditableState;
|
|
6111
6133
|
set editor(editor) {
|
|
@@ -6132,7 +6154,12 @@ class TiptapEditorDirective {
|
|
|
6132
6154
|
// Writes a new value to the element.
|
|
6133
6155
|
// This methods is called when programmatic changes from model to view are requested.
|
|
6134
6156
|
writeValue(value) {
|
|
6135
|
-
|
|
6157
|
+
// Apply preprocessor if value is a string (HTML) and preprocessor is available
|
|
6158
|
+
let processedValue = value;
|
|
6159
|
+
if (typeof value === 'string' && this.htmlPreprocessor) {
|
|
6160
|
+
processedValue = this.htmlPreprocessor(value);
|
|
6161
|
+
}
|
|
6162
|
+
this.editor.chain().setContent(processedValue, { emitUpdate: false }).run();
|
|
6136
6163
|
}
|
|
6137
6164
|
// Registers a callback function that is called when the control's value changes in the UI.
|
|
6138
6165
|
registerOnChange(fn) {
|
|
@@ -6179,7 +6206,9 @@ class TiptapEditorDirective {
|
|
|
6179
6206
|
editor.setOptions({ element: this.elRef.nativeElement });
|
|
6180
6207
|
// update content to the editor
|
|
6181
6208
|
if (innerHTML) {
|
|
6182
|
-
|
|
6209
|
+
// Apply preprocessor to initial content if available
|
|
6210
|
+
const processedContent = this.htmlPreprocessor ? this.htmlPreprocessor(innerHTML) : innerHTML;
|
|
6211
|
+
editor.chain().setContent(processedContent, { emitUpdate: false }).run();
|
|
6183
6212
|
}
|
|
6184
6213
|
// register blur handler to update `touched` property
|
|
6185
6214
|
editor.on('blur', () => {
|
|
@@ -6281,5 +6310,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImpo
|
|
|
6281
6310
|
* Generated bundle index. Do not edit.
|
|
6282
6311
|
*/
|
|
6283
6312
|
|
|
6284
|
-
export { ARCHIVE, ARROW_DROP_DOWN, AngularRenderer, ButtonDirective, CHECK, CLEAR_ALL, CLOSE, CODE, CharacterCountComponent, CheckboxComponent, ColorPickerComponent, ColorPickerViewComponent, DEFAULT, DEFAULT_TOOLBAR_STATE, DESCRIPTION, DYNAMIC_FORM, DocumentEditorComponent, DocumentEditorModule, DocumentEngineKit, DynamicFieldsViewComponent, EDIT, EditorBubbleMenuComponent, EditorCapabilities, ErrorMessageComponent, EventManager, FORMAT_ALIGN_CENTER, FORMAT_ALIGN_JUSTIFY, FORMAT_ALIGN_LEFT, FORMAT_ALIGN_RIGHT, FORMAT_BOLD, FORMAT_CLEAR, FORMAT_COLOR_FILL, FORMAT_COLOR_TEXT, FORMAT_INDENT_DECREASE, FORMAT_INDENT_INCREASE, FORMAT_ITALIC, FORMAT_LINE_SPACING, FORMAT_LIST_BULLETED, FORMAT_LIST_NUMBERED, FORMAT_QUOTE, FORMAT_SIZE, FORMAT_STRIKETHROUGH, FORMAT_UNDERLINE, FocusTrapService, FooterComponent, INSERT_PAGE_BREAK, IconComponent, IconRegistryService, ImageInsertViewComponent, InputDirective, LINK, LINK_OFF, LabelDirective, LinkEditViewComponent, LinkMainViewComponent, LinkPropertiesViewComponent, MARKDOWN, MATCH_CASE, PHOTO, PRINT, PopoverDirective, REDO, RESTRICT_EDIT, SEARCH, SEARCH_OFF, SETTINGS, SPECIAL_CHARACTER, SUBSCRIPT, SUPERSCRIPT, SelectComponent, SelectLabelDirective, SelectOptionDirective, SpecialCharactersViewComponent, TABLE_CELL_PROPERTY, TABLE_COLUMN, TABLE_MERGE_CELL, TABLE_PROPERTY, TABLE_ROW, TABLE_ROWS, TableCellStyleViewComponent, TableCreateViewComponent, TableMainViewComponent, TableStyleViewComponent, TemplateViewComponent, TiptapBubbleMenuDirective, TiptapDraggableDirective, TiptapEditorDirective, TiptapFloatingMenuDirective, ToggleGroupComponent, ToggleOptionDirective, ToolbarBubbleMenuComponent, ToolbarComponent, ToolbarService, UNDO, VERTICAL_ALIGN_BOTTOM, VERTICAL_ALIGN_CENTER, VERTICAL_ALIGN_TOP, buildToolbarState, selectionChangeHandler, shouldShowFnFactory, urlValidator };
|
|
6313
|
+
export { ARCHIVE, ARROW_DROP_DOWN, AngularRenderer, ButtonDirective, CHECK, CLEAR_ALL, CLOSE, CODE, CharacterCountComponent, CheckboxComponent, ColorPickerComponent, ColorPickerViewComponent, DEFAULT, DEFAULT_TOOLBAR_STATE, DESCRIPTION, DYNAMIC_FORM, DocumentEditorComponent, DocumentEditorModule, DocumentEngineKit, DynamicFieldsViewComponent, EDIT, EDITOR_HTML_PREPROCESSOR, EditorBubbleMenuComponent, EditorCapabilities, ErrorMessageComponent, EventManager, FORMAT_ALIGN_CENTER, FORMAT_ALIGN_JUSTIFY, FORMAT_ALIGN_LEFT, FORMAT_ALIGN_RIGHT, FORMAT_BOLD, FORMAT_CLEAR, FORMAT_COLOR_FILL, FORMAT_COLOR_TEXT, FORMAT_INDENT_DECREASE, FORMAT_INDENT_INCREASE, FORMAT_ITALIC, FORMAT_LINE_SPACING, FORMAT_LIST_BULLETED, FORMAT_LIST_NUMBERED, FORMAT_QUOTE, FORMAT_SIZE, FORMAT_STRIKETHROUGH, FORMAT_UNDERLINE, FocusTrapService, FooterComponent, INSERT_PAGE_BREAK, IconComponent, IconRegistryService, ImageInsertViewComponent, InputDirective, LINK, LINK_OFF, LabelDirective, LinkEditViewComponent, LinkMainViewComponent, LinkPropertiesViewComponent, MARKDOWN, MATCH_CASE, PHOTO, PRINT, PopoverDirective, REDO, RESTRICT_EDIT, SEARCH, SEARCH_OFF, SETTINGS, SPECIAL_CHARACTER, SUBSCRIPT, SUPERSCRIPT, SelectComponent, SelectLabelDirective, SelectOptionDirective, SpecialCharactersViewComponent, TABLE_CELL_PROPERTY, TABLE_COLUMN, TABLE_MERGE_CELL, TABLE_PROPERTY, TABLE_ROW, TABLE_ROWS, TableCellStyleViewComponent, TableCreateViewComponent, TableMainViewComponent, TableStyleViewComponent, TemplateViewComponent, TiptapBubbleMenuDirective, TiptapDraggableDirective, TiptapEditorDirective, TiptapFloatingMenuDirective, ToggleGroupComponent, ToggleOptionDirective, ToolbarBubbleMenuComponent, ToolbarComponent, ToolbarService, UNDO, VERTICAL_ALIGN_BOTTOM, VERTICAL_ALIGN_CENTER, VERTICAL_ALIGN_TOP, buildToolbarState, selectionChangeHandler, shouldShowFnFactory, urlValidator };
|
|
6285
6314
|
//# sourceMappingURL=phuong-tran-redoc-document-engine-angular.mjs.map
|