@phuong-tran-redoc/document-engine-angular 0.0.27 → 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.
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { OnInit, OnChanges, OnDestroy, EventEmitter, SimpleChanges, Type, Injector, ElementRef, AfterViewInit, Renderer2, ChangeDetectorRef, AfterContentInit, QueryList } from '@angular/core';
2
+ import { OnInit, OnChanges, OnDestroy, EventEmitter, SimpleChanges, Type, Injector, ElementRef, InjectionToken, AfterViewInit, Renderer2, ChangeDetectorRef, AfterContentInit, QueryList } from '@angular/core';
3
3
  import { IndentOptions, DynamicFieldOptions, DynamicFieldCategory as DynamicFieldCategory$1, RestrictedEditingOptions, TextCaseType, ListStyleType, Color, DynamicFieldItem as DynamicFieldItem$1 } from '@phuong-tran-redoc/document-engine-core';
4
4
  import { BlockquoteOptions } from '@tiptap/extension-blockquote';
5
5
  import { BoldOptions } from '@tiptap/extension-bold';
@@ -735,10 +735,48 @@ declare class TiptapDraggableDirective {
735
735
  static ɵdir: i0.ɵɵDirectiveDeclaration<TiptapDraggableDirective, "[tiptapDraggable]", never, {}, {}, never, never, true, never>;
736
736
  }
737
737
 
738
+ /**
739
+ * Type definition for HTML preprocessor function.
740
+ * Allows clients to transform HTML content before it's set into the editor.
741
+ *
742
+ * @param html - The raw HTML string to be processed
743
+ * @returns The processed HTML string that will be set into the editor
744
+ *
745
+ * @example
746
+ * ```typescript
747
+ * const myPreprocessor: EditorHtmlPreprocessor = (html: string) => {
748
+ * // Remove all script tags for security
749
+ * return html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
750
+ * };
751
+ * ```
752
+ */
753
+ type EditorHtmlPreprocessor = (html: string) => string;
754
+ /**
755
+ * Injection token for HTML preprocessor function.
756
+ * Use this token to provide a custom function that processes HTML content
757
+ * before it's set into the TipTap editor.
758
+ *
759
+ * This is optional - if not provided, the editor will use the HTML content as-is.
760
+ *
761
+ * @example
762
+ * ```typescript
763
+ * // In your component or module providers
764
+ * {
765
+ * provide: EDITOR_HTML_PREPROCESSOR,
766
+ * useValue: (html: string) => {
767
+ * // Your custom preprocessing logic
768
+ * return html.replace(/old/g, 'new');
769
+ * }
770
+ * }
771
+ * ```
772
+ */
773
+ declare const EDITOR_HTML_PREPROCESSOR: InjectionToken<EditorHtmlPreprocessor>;
774
+
738
775
  declare class TiptapEditorDirective implements OnInit, AfterViewInit, ControlValueAccessor {
739
776
  protected elRef: ElementRef<HTMLElement>;
740
777
  protected renderer: Renderer2;
741
778
  protected changeDetectorRef: ChangeDetectorRef;
779
+ protected htmlPreprocessor: EditorHtmlPreprocessor | null;
742
780
  private _editor?;
743
781
  private initialEditableState?;
744
782
  set editor(editor: Editor);
@@ -1701,5 +1739,5 @@ declare class EditorBubbleMenuComponent implements OnInit, AfterViewInit, OnDest
1701
1739
  static ɵcmp: i0.ɵɵComponentDeclaration<EditorBubbleMenuComponent, "document-engine-editor-bubble-menu", never, { "editor": { "alias": "editor"; "required": false; }; "config": { "alias": "config"; "required": false; }; }, {}, never, never, true, never>;
1702
1740
  }
1703
1741
 
1704
- 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 };
1705
- export type { BubbleMenuProps, BubbleMenuViewConfig, BubbleMenuViewContent, BubbleTarget, ButtonType, DocumentEngineConfig, DynamicFieldCategory, DynamicFieldItem, EditorBubbleMenuConfig, HeadingLevel, IconButton, OutsideHandler, SelectButton, SelectOption, TableCreateViewData, TemplateItem, ToolbarBubbleMenuConfig, ToolbarButton, ToolbarState };
1742
+ 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 };
1743
+ export type { BubbleMenuProps, BubbleMenuViewConfig, BubbleMenuViewContent, BubbleTarget, ButtonType, DocumentEngineConfig, DynamicFieldCategory, DynamicFieldItem, EditorBubbleMenuConfig, EditorHtmlPreprocessor, HeadingLevel, IconButton, OutsideHandler, SelectButton, SelectOption, TableCreateViewData, TemplateItem, ToolbarBubbleMenuConfig, ToolbarButton, ToolbarState };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phuong-tran-redoc/document-engine-angular",
3
- "version": "0.0.27",
3
+ "version": "0.0.28",
4
4
  "type": "commonjs",
5
5
  "license": "MIT",
6
6
  "author": "Duc Phuong (Jack) <tdp99.business@gmail.com>",
@@ -26,7 +26,7 @@
26
26
  "dependencies": {
27
27
  "tslib": "^2.3.0",
28
28
  "@floating-ui/dom": "^1.7.4",
29
- "@phuong-tran-redoc/document-engine-core": "0.0.27"
29
+ "@phuong-tran-redoc/document-engine-core": "0.0.28"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "rxjs": "^7.5.0",
@@ -1,5 +1,5 @@
1
1
  .document-engine-document-editor__toolbar {
2
- padding: 0.5rem 1rem;
2
+ padding: 0.25rem 1rem;
3
3
  background-color: var(--card);
4
4
 
5
5
  border-top-left-radius: 0.75rem;