@lax-wp/editor 0.0.2 → 0.0.3
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/redline/RedlineItem.d.ts +37 -0
- package/dist/components/redline/RedlinePanel.d.ts +1 -0
- package/dist/components/redline/index.d.ts +3 -0
- package/dist/components/toolbar/EditModeSelector.d.ts +1 -0
- package/dist/components/toolbar/ToolbarSelector.d.ts +5 -0
- package/dist/components/toolbar/insert/ColumnsLayoutSelector.d.ts +1 -0
- package/dist/config/editorConfig.d.ts +5 -0
- package/dist/constants/ColumnLayout.d.ts +4 -0
- package/dist/constants/Extensions.d.ts +50 -0
- package/dist/constants/Toolbar.d.ts +20 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/contexts/ToolbarContext.d.ts +3 -0
- package/dist/editor.css +1 -1
- package/dist/extensions/PageColumn.d.ts +10 -0
- package/dist/extensions/Redline.d.ts +23 -0
- package/dist/extensions/Signature.d.ts +20 -0
- package/dist/extensions/VariableTable.d.ts +15 -0
- package/dist/extensions/index.d.ts +1 -1
- package/dist/extensions/marks/AIDeletion.d.ts +28 -0
- package/dist/extensions/marks/AIInsertion.d.ts +29 -0
- package/dist/extensions/marks/UserDeletion.d.ts +28 -0
- package/dist/extensions/marks/UserInsertion.d.ts +29 -0
- package/dist/extensions/marks/index.d.ts +8 -0
- package/dist/extensions/node/SignatureDragOverlay.d.ts +6 -0
- package/dist/extensions/node/SignatureNode.d.ts +17 -0
- package/dist/extensions/node/SignatureNodeView.d.ts +3 -0
- package/dist/extensions/node/index.d.ts +3 -0
- package/dist/extensions/plugins/FormatChangePlugin.d.ts +29 -0
- package/dist/extensions/plugins/MarkClickPlugin.d.ts +7 -0
- package/dist/extensions/plugins/MarkHighlightPlugin.d.ts +18 -0
- package/dist/extensions/plugins/RedlinePlugin.d.ts +44 -0
- package/dist/hooks/useInsertOptionMethods.d.ts +3 -0
- package/dist/hooks/useRedline.d.ts +16 -0
- package/dist/hooks/useTableMethods.d.ts +3 -0
- package/dist/hooks/useTiptapEditorState.d.ts +2 -0
- package/dist/index.es.js +8162 -5932
- package/dist/index.umd.js +71 -56
- package/dist/types/extensions/Table.d.ts +10 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Mark } from '@tiptap/core';
|
|
2
|
+
export interface AIInsertionOptions {
|
|
3
|
+
HTMLAttributes: Record<string, string>;
|
|
4
|
+
}
|
|
5
|
+
export interface AIInsertionAttributes {
|
|
6
|
+
userId: string;
|
|
7
|
+
userName: string;
|
|
8
|
+
timestamp: string;
|
|
9
|
+
formatChanges?: string;
|
|
10
|
+
}
|
|
11
|
+
declare module '@tiptap/core' {
|
|
12
|
+
interface Commands<ReturnType> {
|
|
13
|
+
aiInsertion: {
|
|
14
|
+
/**
|
|
15
|
+
* Set AI insertion mark
|
|
16
|
+
*/
|
|
17
|
+
setAIInsertion: (attributes: AIInsertionAttributes) => ReturnType;
|
|
18
|
+
/**
|
|
19
|
+
* Toggle AI insertion mark
|
|
20
|
+
*/
|
|
21
|
+
toggleAIInsertion: (attributes: AIInsertionAttributes) => ReturnType;
|
|
22
|
+
/**
|
|
23
|
+
* Unset AI insertion mark
|
|
24
|
+
*/
|
|
25
|
+
unsetAIInsertion: () => ReturnType;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export declare const AIInsertion: Mark<AIInsertionOptions, any>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Mark } from '@tiptap/core';
|
|
2
|
+
export interface UserDeletionOptions {
|
|
3
|
+
HTMLAttributes: Record<string, string>;
|
|
4
|
+
}
|
|
5
|
+
export interface UserDeletionAttributes {
|
|
6
|
+
userId: string;
|
|
7
|
+
userName: string;
|
|
8
|
+
timestamp: string;
|
|
9
|
+
}
|
|
10
|
+
declare module '@tiptap/core' {
|
|
11
|
+
interface Commands<ReturnType> {
|
|
12
|
+
userDeletion: {
|
|
13
|
+
/**
|
|
14
|
+
* Set user deletion mark
|
|
15
|
+
*/
|
|
16
|
+
setUserDeletion: (attributes: UserDeletionAttributes) => ReturnType;
|
|
17
|
+
/**
|
|
18
|
+
* Toggle user deletion mark
|
|
19
|
+
*/
|
|
20
|
+
toggleUserDeletion: (attributes: UserDeletionAttributes) => ReturnType;
|
|
21
|
+
/**
|
|
22
|
+
* Unset user deletion mark
|
|
23
|
+
*/
|
|
24
|
+
unsetUserDeletion: () => ReturnType;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export declare const UserDeletion: Mark<UserDeletionOptions, any>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Mark } from '@tiptap/core';
|
|
2
|
+
export interface UserInsertionOptions {
|
|
3
|
+
HTMLAttributes: Record<string, string>;
|
|
4
|
+
}
|
|
5
|
+
export interface UserInsertionAttributes {
|
|
6
|
+
userId: string;
|
|
7
|
+
userName: string;
|
|
8
|
+
timestamp: string;
|
|
9
|
+
formatChanges?: string;
|
|
10
|
+
}
|
|
11
|
+
declare module '@tiptap/core' {
|
|
12
|
+
interface Commands<ReturnType> {
|
|
13
|
+
userInsertion: {
|
|
14
|
+
/**
|
|
15
|
+
* Set user insertion mark
|
|
16
|
+
*/
|
|
17
|
+
setUserInsertion: (attributes: UserInsertionAttributes) => ReturnType;
|
|
18
|
+
/**
|
|
19
|
+
* Toggle user insertion mark
|
|
20
|
+
*/
|
|
21
|
+
toggleUserInsertion: (attributes: UserInsertionAttributes) => ReturnType;
|
|
22
|
+
/**
|
|
23
|
+
* Unset user insertion mark
|
|
24
|
+
*/
|
|
25
|
+
unsetUserInsertion: () => ReturnType;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export declare const UserInsertion: Mark<UserInsertionOptions, any>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { UserInsertion } from './UserInsertion';
|
|
2
|
+
export { UserDeletion } from './UserDeletion';
|
|
3
|
+
export { AIInsertion } from './AIInsertion';
|
|
4
|
+
export { AIDeletion } from './AIDeletion';
|
|
5
|
+
export type { UserInsertionAttributes } from './UserInsertion';
|
|
6
|
+
export type { UserDeletionAttributes } from './UserDeletion';
|
|
7
|
+
export type { AIInsertionAttributes } from './AIInsertion';
|
|
8
|
+
export type { AIDeletionAttributes } from './AIDeletion';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface SignatureNodeProps {
|
|
3
|
+
id?: string;
|
|
4
|
+
selected?: boolean;
|
|
5
|
+
onSelect?: () => void;
|
|
6
|
+
onDelete?: () => void;
|
|
7
|
+
onUpload?: (file: File) => void;
|
|
8
|
+
onResize?: (dimensions: {
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
}) => void;
|
|
12
|
+
signatureUrl?: string;
|
|
13
|
+
width?: number;
|
|
14
|
+
height?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare const SignatureNode: React.FC<SignatureNodeProps>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
import { PluginKey } from 'prosemirror-state';
|
|
3
|
+
/**
|
|
4
|
+
* FormatChangePlugin - Tracks formatting changes to existing text
|
|
5
|
+
*
|
|
6
|
+
* This plugin detects when formatting (bold, italic, colors, etc.) is applied
|
|
7
|
+
* to existing text and marks it using the existing userInsertion/aiInsertion marks
|
|
8
|
+
* with an additional 'formatChanges' attribute.
|
|
9
|
+
*
|
|
10
|
+
* Key Features:
|
|
11
|
+
* - Reuses existing redline marks (no new mark types needed)
|
|
12
|
+
* - Stores format changes as JSON in the mark attributes
|
|
13
|
+
* - Only tracks format changes on existing text (not new insertions)
|
|
14
|
+
* - Respects redline mode (user/ai) from editor storage
|
|
15
|
+
*
|
|
16
|
+
* Format Change Data Structure:
|
|
17
|
+
* {
|
|
18
|
+
* "bold": { "old": false, "new": true },
|
|
19
|
+
* "color": { "old": "#000000", "new": "#FF0000" }
|
|
20
|
+
* }
|
|
21
|
+
*/
|
|
22
|
+
export interface FormatChangeData {
|
|
23
|
+
[formatType: string]: {
|
|
24
|
+
old: string | boolean | null;
|
|
25
|
+
new: string | boolean | null;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export declare const FormatChangePluginKey: PluginKey<any>;
|
|
29
|
+
export declare const FormatChangePlugin: Extension<any, any>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
/**
|
|
3
|
+
* Plugin to handle clicks on redline marks
|
|
4
|
+
* When a user clicks on a tracked change mark in the editor,
|
|
5
|
+
* this plugin dispatches a custom event to activate the corresponding redline item
|
|
6
|
+
*/
|
|
7
|
+
export declare const MarkClickPlugin: Extension<any, any>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
export interface MarkHighlightPluginState {
|
|
3
|
+
activeMarkTimestamp: string | null;
|
|
4
|
+
activeMarkUserId: string | null;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Plugin to highlight the active redline mark in the editor
|
|
8
|
+
* When a redline item is clicked in the panel, this plugin adds visual highlighting
|
|
9
|
+
* to the corresponding mark in the editor
|
|
10
|
+
*/
|
|
11
|
+
export declare const MarkHighlightPlugin: Extension<any, any>;
|
|
12
|
+
declare module '@tiptap/core' {
|
|
13
|
+
interface Commands<ReturnType> {
|
|
14
|
+
markHighlightPlugin: {
|
|
15
|
+
highlightMark: (timestamp: string | null, userId: string | null) => ReturnType;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
/**
|
|
3
|
+
* Entity performing the change (user or AI)
|
|
4
|
+
*/
|
|
5
|
+
export interface RedlineEntity {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Configuration options for the Redline plugin
|
|
11
|
+
*/
|
|
12
|
+
export interface RedlineOptions {
|
|
13
|
+
isActive: boolean;
|
|
14
|
+
mode: 'user' | 'ai';
|
|
15
|
+
currentEntity: RedlineEntity;
|
|
16
|
+
}
|
|
17
|
+
declare module '@tiptap/core' {
|
|
18
|
+
interface Commands<ReturnType> {
|
|
19
|
+
redline: {
|
|
20
|
+
/**
|
|
21
|
+
* Toggle redline tracking mode
|
|
22
|
+
* @param active - Whether to enable change tracking
|
|
23
|
+
* @param mode - Track changes for 'user' or 'ai'
|
|
24
|
+
*/
|
|
25
|
+
toggleRedlineMode: (active: boolean, mode?: 'user' | 'ai') => ReturnType;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Redline Plugin - Track Changes for Collaborative Editing
|
|
31
|
+
*
|
|
32
|
+
* Features:
|
|
33
|
+
* - Tracks insertions with underline marks
|
|
34
|
+
* - Tracks deletions with strikethrough marks
|
|
35
|
+
* - Supports both user and AI changes
|
|
36
|
+
* - Implements mark cancellation (delete insertion = remove, type over deletion = remove)
|
|
37
|
+
* - Automatic mark merging for consecutive edits
|
|
38
|
+
* - Keyboard-first approach (intercepts Backspace/Delete keys)
|
|
39
|
+
*
|
|
40
|
+
* Architecture:
|
|
41
|
+
* 1. Keymap Plugin: Handles Backspace/Delete keys → adds deletion marks
|
|
42
|
+
* 2. AppendTransaction Plugin: Handles text insertions → adds insertion marks
|
|
43
|
+
*/
|
|
44
|
+
export declare const RedlinePlugin: Extension<RedlineOptions, any>;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export declare const useInsertOptionMethods: () => {
|
|
2
2
|
handleInsertLineBreak: () => void;
|
|
3
3
|
handleInsertCodeBlock: () => void;
|
|
4
|
+
handleInsertCustomColumn: (count: number, showDividers?: boolean) => void;
|
|
5
|
+
handleToggleColumnDividers: () => void;
|
|
6
|
+
handleInsertSignature: () => void;
|
|
4
7
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { RedlineChange } from '@/components/redline';
|
|
2
|
+
export declare const useRedline: () => {
|
|
3
|
+
changes: RedlineChange[];
|
|
4
|
+
acceptChange: (id: string) => void;
|
|
5
|
+
rejectChange: (id: string) => void;
|
|
6
|
+
acceptAllChanges: () => void;
|
|
7
|
+
rejectAllChanges: () => void;
|
|
8
|
+
navigateToChange: (position: number, timestamp?: string, userId?: string) => void;
|
|
9
|
+
scanChanges: () => void;
|
|
10
|
+
addComment: (changeId: string, commentText: string) => void;
|
|
11
|
+
editComment: (changeId: string, commentId: string, newText: string) => void;
|
|
12
|
+
deleteComment: (changeId: string, commentId: string) => void;
|
|
13
|
+
findChangeByMark: (timestamp: string, userId: string) => RedlineChange | null;
|
|
14
|
+
highlightMark: (timestamp: string, userId: string) => void;
|
|
15
|
+
clearMarkHighlight: () => void;
|
|
16
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { InsertTableUsingDataProps } from "@/types/extensions/Table";
|
|
1
2
|
export declare const useTableMethods: () => {
|
|
2
3
|
handleInsertTable: (rows: number, cols: number, withHeaderRow: boolean) => void;
|
|
3
4
|
handleInsertRowAbove: () => void;
|
|
@@ -9,4 +10,6 @@ export declare const useTableMethods: () => {
|
|
|
9
10
|
handleMergeCells: () => void;
|
|
10
11
|
handleSplitCell: () => void;
|
|
11
12
|
handleDeleteTable: () => void;
|
|
13
|
+
handleInsertTableFromData: ({ tableType, data, columns, options }: InsertTableUsingDataProps) => void;
|
|
14
|
+
handleUpdateTableValues: (variableTableData: Record<string, Record<string, unknown | undefined | null>[]>) => void;
|
|
12
15
|
};
|