@sovann72-dev/lynqify-ui 1.0.13 → 1.0.15
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/dist/components/RichTextEditor/Extension/Videos/VideoNodeView.d.ts +44 -0
- package/dist/components/RichTextEditor/Extension/Videos/types.d.ts +15 -1
- package/dist/components/RichTextEditor/Extension/Videos/video.extension.d.ts +2 -8
- package/dist/lynqify-ui.js +2325 -2246
- package/package.json +1 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { NodeViewRendererProps } from '@tiptap/core';
|
|
2
|
+
import { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
3
|
+
import { NodeView } from '@tiptap/pm/view';
|
|
4
|
+
import { VideoExtensionOptions } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* Encapsulates the complex DOM and event logic for the Video extension's NodeView.
|
|
7
|
+
* This is a 'Deep Module' that hides implementation details of resizing, dragging,
|
|
8
|
+
* and playback management from the main extension definition.
|
|
9
|
+
*
|
|
10
|
+
* Implements the raw ProseMirror NodeView interface rather than the Tiptap helper class
|
|
11
|
+
* to maintain full control over the DOM and avoid unnecessary Tiptap-specific overhead.
|
|
12
|
+
*/
|
|
13
|
+
export declare class VideoNodeView implements NodeView {
|
|
14
|
+
dom: HTMLElement;
|
|
15
|
+
media: HTMLVideoElement | HTMLAudioElement | HTMLIFrameElement;
|
|
16
|
+
container: HTMLElement;
|
|
17
|
+
private editor;
|
|
18
|
+
private node;
|
|
19
|
+
private getPos;
|
|
20
|
+
private options;
|
|
21
|
+
private sharedDragPlaybackTime;
|
|
22
|
+
constructor(props: NodeViewRendererProps, options: VideoExtensionOptions, sharedDragPlaybackTime: {
|
|
23
|
+
value: number | null;
|
|
24
|
+
});
|
|
25
|
+
private setupStyles;
|
|
26
|
+
private setupMedia;
|
|
27
|
+
private onLoadedMetadata;
|
|
28
|
+
private setupEvents;
|
|
29
|
+
private togglePlayback;
|
|
30
|
+
private onDragStart;
|
|
31
|
+
private createDragGhost;
|
|
32
|
+
private onDragEnd;
|
|
33
|
+
private setupDragHandle;
|
|
34
|
+
private setupResizeHandles;
|
|
35
|
+
private initResize;
|
|
36
|
+
private syncStyles;
|
|
37
|
+
private syncTracks;
|
|
38
|
+
syncAttrs(attrs: Record<string, any>): void;
|
|
39
|
+
update(node: ProseMirrorNode): boolean;
|
|
40
|
+
selectNode(): void;
|
|
41
|
+
deselectNode(): void;
|
|
42
|
+
stopEvent(event: Event): boolean;
|
|
43
|
+
destroy(): void;
|
|
44
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NodeViewRendererOptions } from '@tiptap/core';
|
|
1
2
|
export interface SubtitleTrack {
|
|
2
3
|
src: string;
|
|
3
4
|
label: string;
|
|
@@ -16,7 +17,20 @@ export interface VideoAttributes {
|
|
|
16
17
|
muted?: boolean;
|
|
17
18
|
subtitles?: SubtitleTrack[];
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Defines the static configuration options passed when initializing the extension in the editor.
|
|
22
|
+
* Extends NodeViewRendererOptions to satisfy Tiptap's NodeView interface requirements.
|
|
23
|
+
*/
|
|
24
|
+
export interface VideoExtensionOptions extends Partial<NodeViewRendererOptions> {
|
|
20
25
|
inline: boolean;
|
|
21
26
|
HTMLAttributes: Record<string, any>;
|
|
27
|
+
resizeHandleClass?: string;
|
|
28
|
+
resizeBorderClass?: string;
|
|
29
|
+
resizeHandleStyle?: Record<string, string>;
|
|
30
|
+
resizeBorderStyle?: Record<string, string>;
|
|
31
|
+
onUpload?: (file: File) => Promise<string>;
|
|
32
|
+
onVideoResolved?: (attrs: {
|
|
33
|
+
videoWidth: number;
|
|
34
|
+
videoHeight: number;
|
|
35
|
+
}) => void;
|
|
22
36
|
}
|
|
@@ -3,22 +3,16 @@ import { VideoAttributes, VideoExtensionOptions } from './types';
|
|
|
3
3
|
declare module '@tiptap/core' {
|
|
4
4
|
interface Commands<ReturnType> {
|
|
5
5
|
video: {
|
|
6
|
-
/**
|
|
7
|
-
* Inserts a new video or audio node into the document at the current selection.
|
|
8
|
-
*/
|
|
9
6
|
setVideo: (options: Partial<VideoAttributes> & {
|
|
10
7
|
src: string;
|
|
11
8
|
}) => ReturnType;
|
|
12
|
-
/**
|
|
13
|
-
* Updates the attributes (e.g., toggling autoplay, changing width) of the currently selected video node.
|
|
14
|
-
*/
|
|
15
9
|
updateVideo: (options: Partial<VideoAttributes>) => ReturnType;
|
|
16
10
|
};
|
|
17
11
|
}
|
|
18
12
|
}
|
|
19
13
|
/**
|
|
20
14
|
* Tiptap extension for rendering and managing video and audio content.
|
|
21
|
-
*
|
|
22
|
-
*
|
|
15
|
+
* Follows the 'Deep Module' philosophy by delegating complex DOM logic to VideoNodeView
|
|
16
|
+
* and providing simple hooks (onUpload, onVideoResolved) for advanced behaviors.
|
|
23
17
|
*/
|
|
24
18
|
export declare const Video: Node<VideoExtensionOptions, any>;
|