@flogeez/angular-tiptap-editor 3.8.0 → 3.9.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.
@@ -132,6 +132,8 @@ export declare class AngularTiptapEditorComponent implements AfterViewInit, OnDe
132
132
  private _wordCount;
133
133
  private _isDragOver;
134
134
  private _editorFullyInitialized;
135
+ /** Technical config the current editor was created with, see `technicalConfig()` */
136
+ private editorTechnicalConfig;
135
137
  private _hoveredBlock;
136
138
  private lastEmittedHtml;
137
139
  readonly editor: import("@angular/core").Signal<Editor | null>;
@@ -262,6 +264,11 @@ export declare class AngularTiptapEditorComponent implements AfterViewInit, OnDe
262
264
  constructor();
263
265
  ngAfterViewInit(): void;
264
266
  ngOnDestroy(): void;
267
+ /**
268
+ * Settings that require re-creating the editor when they change.
269
+ * Each computed compares by value, so a new reference means a real change.
270
+ */
271
+ private technicalConfig;
265
272
  private initEditor;
266
273
  toggleEditMode(event: Event): void;
267
274
  private updateCharacterCount;
@@ -20,11 +20,20 @@ export declare class AteBlockControlsComponent implements AfterViewInit, OnDestr
20
20
  private lastValidRect;
21
21
  private tippyInstance;
22
22
  private updateTimeout;
23
+ private glideFrame;
23
24
  constructor();
24
25
  ngAfterViewInit(): void;
25
26
  ngOnDestroy(): void;
26
27
  private initTippy;
27
28
  private updateMenu;
29
+ /** While scrolling, the controls follow their block every frame: a glide would make them trail behind it */
30
+ private onScroll;
31
+ /**
32
+ * Moves the controls without gliding until the position settles (two frames after the last call).
33
+ * Tippy only skips the move transition on its very first show: the controls are never unmounted
34
+ * afterwards, so they would otherwise glide in from wherever they were last shown.
35
+ */
36
+ private withoutGlide;
28
37
  private showTippy;
29
38
  private hideTippy;
30
39
  private getSelectionRect;
@@ -1,5 +1,14 @@
1
1
  import { Extension } from "@tiptap/core";
2
+ import { EditorState } from "@tiptap/pm/state";
3
+ import { EditorView } from "@tiptap/pm/view";
2
4
  import { Node } from "@tiptap/pm/model";
5
+ export declare const ATE_BLOCK_DRAG_MIME = "application/x-ate-block-drag";
6
+ interface PosRange {
7
+ from: number;
8
+ to: number;
9
+ }
10
+ export declare function endAteBlockDrag(view: EditorView): void;
11
+ export declare function ateMultiBlockSelection(state: EditorState, blockPos: number): PosRange | null;
3
12
  export interface AteBlockControlsOptions {
4
13
  onHover?: (data: {
5
14
  node: Node;
@@ -8,3 +17,4 @@ export interface AteBlockControlsOptions {
8
17
  } | null) => void;
9
18
  }
10
19
  export declare const AteBlockControlsExtension: Extension<AteBlockControlsOptions, any>;
20
+ export {};
@@ -1,6 +1,12 @@
1
1
  import { Editor } from "@tiptap/core";
2
2
  import { AteResizeOptions, AteImageUploadOptions, AteImageUploadHandler, AteImageSrcResolver, AteImageUploadResult, AteImageData, AteImageRejection, AteImageSource, AteImageValidationReason } from "../models/ate-image.model";
3
3
  import * as i0 from "@angular/core";
4
+ /** An image position followed through document changes, see `trackSelectedImage` */
5
+ interface AteTrackedImage {
6
+ /** Current position of the image, or `null` when no image was selected */
7
+ pos: () => number | null;
8
+ stop: () => void;
9
+ }
4
10
  export declare class AteImageService {
5
11
  onImageUploadedCallback?: (result: AteImageUploadResult) => void;
6
12
  onImageRejectedCallback?: (rejection: AteImageRejection) => void;
@@ -79,7 +85,14 @@ export declare class AteImageService {
79
85
  /** Select file and replace currently selected image */
80
86
  selectAndReplaceImage(editor: Editor, options?: AteImageUploadOptions): Promise<void>;
81
87
  /** Internal helper used by replacement logic */
82
- uploadAndReplaceImage(editor: Editor, file: File, options?: AteImageUploadOptions, source?: AteImageSource): Promise<void>;
88
+ uploadAndReplaceImage(editor: Editor, file: File, options?: AteImageUploadOptions, source?: AteImageSource, target?: AteTrackedImage): Promise<void>;
89
+ /**
90
+ * Remembers the selected image and follows its position through the transactions
91
+ * dispatched until `stop()` (e.g. while the file picker is open and the image uploads).
92
+ */
93
+ private trackSelectedImage;
94
+ /** Replaces the image at `pos` with `imageData` (keeping its other attributes) and selects it */
95
+ private replaceImageAt;
83
96
  /**
84
97
  * Handle image drop event.
85
98
  * Calculates the position from coordinates and sets the selection accordingly.
@@ -92,3 +105,4 @@ export declare class AteImageService {
92
105
  static ɵfac: i0.ɵɵFactoryDeclaration<AteImageService, never>;
93
106
  static ɵprov: i0.ɵɵInjectableDeclaration<AteImageService>;
94
107
  }
108
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flogeez/angular-tiptap-editor",
3
- "version": "3.8.0",
3
+ "version": "3.9.0",
4
4
  "description": "A modern, customizable rich-text editor for Angular (18+), built with Tiptap and featuring complete internationalization support",
5
5
  "keywords": [
6
6
  "angular",
@@ -40,3 +40,16 @@
40
40
  .ProseMirror .has-text-align-justify {
41
41
  text-align: justify;
42
42
  }
43
+
44
+ .ate-block-dragging > .prosemirror-dropcursor-block,
45
+ .ate-block-dragging > .prosemirror-dropcursor-inline {
46
+ display: none;
47
+ }
48
+
49
+ .ProseMirror > .ate-block-drop-before {
50
+ box-shadow: 0 -2px 0 0 var(--ate-primary, #2563eb);
51
+ }
52
+
53
+ .ProseMirror > .ate-block-drop-after {
54
+ box-shadow: 0 2px 0 0 var(--ate-primary, #2563eb);
55
+ }
package/styles/index.css CHANGED
@@ -40,3 +40,16 @@
40
40
  .ProseMirror .has-text-align-justify {
41
41
  text-align: justify;
42
42
  }
43
+
44
+ .ate-block-dragging > .prosemirror-dropcursor-block,
45
+ .ate-block-dragging > .prosemirror-dropcursor-inline {
46
+ display: none;
47
+ }
48
+
49
+ .ProseMirror > .ate-block-drop-before {
50
+ box-shadow: 0 -2px 0 0 var(--ate-primary, #2563eb);
51
+ }
52
+
53
+ .ProseMirror > .ate-block-drop-after {
54
+ box-shadow: 0 2px 0 0 var(--ate-primary, #2563eb);
55
+ }