@sovann72-dev/lynqify-ui 1.0.0 → 1.0.2
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/NoteEditor/BatchImageGalleryNodeView.d.ts +19 -0
- package/dist/components/RichTextEditor/Extension/Image/ImageResize/constants/index.d.ts +22 -0
- package/dist/components/RichTextEditor/Extension/Image/ImageResize/controllers/image-node-view.d.ts +38 -0
- package/dist/components/RichTextEditor/Extension/Image/ImageResize/controllers/position-controller.d.ts +12 -0
- package/dist/components/RichTextEditor/Extension/Image/ImageResize/controllers/resize-controller.d.ts +13 -0
- package/dist/components/RichTextEditor/Extension/Image/ImageResize/image-resize.d.ts +22 -0
- package/dist/components/RichTextEditor/Extension/Image/ImageResize/index.d.ts +4 -0
- package/dist/components/RichTextEditor/Extension/Image/ImageResize/types/index.d.ts +20 -0
- package/dist/components/RichTextEditor/Extension/Image/ImageResize/utils/attribute-parser.d.ts +4 -0
- package/dist/components/RichTextEditor/Extension/Image/ImageResize/utils/clamp-width.d.ts +6 -0
- package/dist/components/RichTextEditor/Extension/Image/ImageResize/utils/index.d.ts +7 -0
- package/dist/components/RichTextEditor/Extension/Image/ImageResize/utils/resize-handler.d.ts +12 -0
- package/dist/components/RichTextEditor/Extension/Image/ImageResize/utils/style-manager.d.ts +6 -0
- package/dist/components/RichTextEditor/Extension/Indent/backspace.indent.handlers.d.ts +18 -0
- package/dist/components/RichTextEditor/Extension/Indent/indent.extension.d.ts +26 -0
- package/dist/components/RichTextEditor/Extension/Indent/indent.handlers.d.ts +16 -0
- package/{src/components/RichTextEditor/Extension/Indent/indent.types.ts → dist/components/RichTextEditor/Extension/Indent/indent.types.d.ts} +10 -35
- package/dist/components/RichTextEditor/Extension/Indent/indent.utils.d.ts +8 -0
- package/dist/components/RichTextEditor/Extension/Indent/outdent.handlers.d.ts +6 -0
- package/dist/components/RichTextEditor/Extension/Indent/shifttab.indent.handlers.d.ts +18 -0
- package/dist/components/RichTextEditor/Extension/Indent/tab.indent.handlers.d.ts +21 -0
- package/dist/components/RichTextEditor/Extension/List/custom-list-item.extension.d.ts +17 -0
- package/dist/components/RichTextEditor/Extension/List/dynamic-bullet-styling.extension.d.ts +2 -0
- package/dist/components/RichTextEditor/Extension/batch-segment-images.extension.d.ts +19 -0
- package/dist/components/RichTextEditor/Extension/batch-segment-images.types.d.ts +33 -0
- package/dist/components/RichTextEditor/Extension/custom-image.extension.d.ts +4 -0
- package/dist/components/RichTextEditor/Extension/custom-link.extension.d.ts +3 -0
- package/dist/components/RichTextEditor/Extension/custom-mention.extension.d.ts +3 -0
- package/dist/components/RichTextEditor/Extension/custom-paragraph.extension.d.ts +6 -0
- package/dist/components/RichTextEditor/Extension/extensions.d.ts +4 -0
- package/dist/components/RichTextEditor/Extension/file-filtering.extension.d.ts +1 -0
- package/dist/components/RichTextEditor/Extension/list-indent-integration.extension.d.ts +2 -0
- package/dist/components/RichTextEditor/Extension/mentionstorage.extension.d.ts +9 -0
- package/dist/components/RichTextEditor/Extension/tiptap-extension-fontsize.d.ts +21 -0
- package/dist/components/RichTextEditor/Extension/tiptap-extension-lineheight.d.ts +21 -0
- package/{src/index.ts → dist/index.d.ts} +9 -17
- package/dist/lynqify-ui.js +3806 -0
- package/dist/lynqify-ui.umd.cjs +53 -0
- package/package.json +60 -31
- package/src/components/RichTextEditor/Extension/Indent/backspace.indent.handlers.ts +0 -77
- package/src/components/RichTextEditor/Extension/Indent/indent.extension.ts +0 -285
- package/src/components/RichTextEditor/Extension/Indent/indent.handlers.ts +0 -121
- package/src/components/RichTextEditor/Extension/Indent/indent.utils.ts +0 -8
- package/src/components/RichTextEditor/Extension/Indent/outdent.handlers.ts +0 -71
- package/src/components/RichTextEditor/Extension/Indent/shifttab.indent.handlers.ts +0 -133
- package/src/components/RichTextEditor/Extension/Indent/tab.indent.handlers.ts +0 -103
- package/src/components/RichTextEditor/Extension/List/custom-list-item.extension.ts +0 -107
- package/src/components/RichTextEditor/Extension/List/dynamic-bullet-styling.extension.ts +0 -40
- package/src/components/RichTextEditor/Extension/batch-segment-images.extension.ts +0 -486
- package/src/components/RichTextEditor/Extension/batch-segment-images.types.ts +0 -35
- package/src/components/RichTextEditor/Extension/custom-image.extension.ts +0 -18
- package/src/components/RichTextEditor/Extension/custom-link.extension.ts +0 -58
- package/src/components/RichTextEditor/Extension/custom-mention.extension.ts +0 -29
- package/src/components/RichTextEditor/Extension/custom-paragraph.extension.ts +0 -46
- package/src/components/RichTextEditor/Extension/extensions.ts +0 -118
- package/src/components/RichTextEditor/Extension/file-filtering.extension.ts +0 -0
- package/src/components/RichTextEditor/Extension/list-indent-integration.extension.ts +0 -125
- package/src/components/RichTextEditor/Extension/mentionstorage.extension.ts +0 -10
- package/src/components/RichTextEditor/Extension/tiptap-extension-fontsize.ts +0 -73
- package/src/components/RichTextEditor/Extension/tiptap-extension-lineheight.ts +0 -73
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface BatchImage {
|
|
3
|
+
id: string;
|
|
4
|
+
src: string;
|
|
5
|
+
alt?: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
}
|
|
8
|
+
interface BatchImageGalleryProps {
|
|
9
|
+
batchId: string;
|
|
10
|
+
images: BatchImage[];
|
|
11
|
+
maxImageAmount?: number;
|
|
12
|
+
height?: number;
|
|
13
|
+
focusedImageIndex: number | null;
|
|
14
|
+
onAdd: () => void;
|
|
15
|
+
onDelete: (index: number) => void;
|
|
16
|
+
onImageClick: (image: BatchImage) => void;
|
|
17
|
+
}
|
|
18
|
+
declare const BatchImageGalleryNodeView: React.FC<BatchImageGalleryProps>;
|
|
19
|
+
export default BatchImageGalleryNodeView;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const CONSTANTS: {
|
|
2
|
+
readonly MOBILE_BREAKPOINT: 768;
|
|
3
|
+
readonly ICON_SIZE: "24px";
|
|
4
|
+
readonly CONTROLLER_HEIGHT: "25px";
|
|
5
|
+
readonly DOT_SIZE: {
|
|
6
|
+
readonly MOBILE: 16;
|
|
7
|
+
readonly DESKTOP: 9;
|
|
8
|
+
};
|
|
9
|
+
readonly DOT_POSITION: {
|
|
10
|
+
readonly MOBILE: "-8px";
|
|
11
|
+
readonly DESKTOP: "-4px";
|
|
12
|
+
};
|
|
13
|
+
readonly COLORS: {
|
|
14
|
+
readonly BORDER: "#6C6C6C";
|
|
15
|
+
readonly BACKGROUND: "rgba(255, 255, 255, 1)";
|
|
16
|
+
};
|
|
17
|
+
readonly ICONS: {
|
|
18
|
+
readonly LEFT: "https://fonts.gstatic.com/s/i/short-term/release/materialsymbolsoutlined/format_align_left/default/20px.svg";
|
|
19
|
+
readonly CENTER: "https://fonts.gstatic.com/s/i/short-term/release/materialsymbolsoutlined/format_align_center/default/20px.svg";
|
|
20
|
+
readonly RIGHT: "https://fonts.gstatic.com/s/i/short-term/release/materialsymbolsoutlined/format_align_right/default/20px.svg";
|
|
21
|
+
};
|
|
22
|
+
};
|
package/dist/components/RichTextEditor/Extension/Image/ImageResize/controllers/image-node-view.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ResizeLimits } from '../types';
|
|
2
|
+
interface NodeViewContext {
|
|
3
|
+
node: any;
|
|
4
|
+
editor: any;
|
|
5
|
+
view: any;
|
|
6
|
+
getPos: (() => number) | undefined;
|
|
7
|
+
}
|
|
8
|
+
export declare class ImageNodeView {
|
|
9
|
+
private context;
|
|
10
|
+
private elements;
|
|
11
|
+
private inline;
|
|
12
|
+
private resizeLimitsRef;
|
|
13
|
+
private resizeEventName?;
|
|
14
|
+
private handleResizeEvent?;
|
|
15
|
+
constructor(context: NodeViewContext, inline: boolean, resizeLimits?: ResizeLimits, resizeEventName?: string);
|
|
16
|
+
destroy(): void;
|
|
17
|
+
updateResizeLimits(newLimits: ResizeLimits): void;
|
|
18
|
+
private createElements;
|
|
19
|
+
private clearContainerBorder;
|
|
20
|
+
private dispatchNodeView;
|
|
21
|
+
private removeResizeElements;
|
|
22
|
+
private setupImageAttributes;
|
|
23
|
+
private setupDOMStructure;
|
|
24
|
+
/**
|
|
25
|
+
* Applies min/max width limits to the container and image.
|
|
26
|
+
* Enforces configured limits on initial render and when container style is re-applied.
|
|
27
|
+
*/
|
|
28
|
+
private applyResizeLimits;
|
|
29
|
+
private createPositionController;
|
|
30
|
+
private createResizeHandler;
|
|
31
|
+
private setupContainerClick;
|
|
32
|
+
private setupContentClick;
|
|
33
|
+
initialize(): {
|
|
34
|
+
dom: HTMLElement;
|
|
35
|
+
destroy: () => void;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ImageElements } from '../types';
|
|
2
|
+
export declare class PositionController {
|
|
3
|
+
private elements;
|
|
4
|
+
private inline;
|
|
5
|
+
private dispatchNodeView;
|
|
6
|
+
constructor(elements: ImageElements, inline: boolean, dispatchNodeView: () => void);
|
|
7
|
+
private createControllerIcon;
|
|
8
|
+
private handleLeftClick;
|
|
9
|
+
private handleCenterClick;
|
|
10
|
+
private handleRightClick;
|
|
11
|
+
createPositionControls(): PositionController;
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ImageElements, ResizeLimits } from '../types';
|
|
2
|
+
export declare class ResizeController {
|
|
3
|
+
private elements;
|
|
4
|
+
private dispatchNodeView;
|
|
5
|
+
private getResizeLimits;
|
|
6
|
+
private state;
|
|
7
|
+
constructor(elements: ImageElements, dispatchNodeView: () => void, getResizeLimits?: () => ResizeLimits);
|
|
8
|
+
private handleMouseMove;
|
|
9
|
+
private handleMouseUp;
|
|
10
|
+
private handleTouchMove;
|
|
11
|
+
private handleTouchEnd;
|
|
12
|
+
createResizeHandle(index: number): HTMLElement;
|
|
13
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ImageOptions } from '@tiptap/extension-image';
|
|
2
|
+
import { Node } from '@tiptap/core';
|
|
3
|
+
declare module '@tiptap/core' {
|
|
4
|
+
interface Commands<ReturnType> {
|
|
5
|
+
imageResize: {
|
|
6
|
+
setResizableImage: (options: {
|
|
7
|
+
src: string;
|
|
8
|
+
alt?: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
width?: number;
|
|
11
|
+
height?: number;
|
|
12
|
+
containerStyle?: string;
|
|
13
|
+
}) => ReturnType;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export interface ImageResizeOptions extends ImageOptions {
|
|
18
|
+
inline: boolean;
|
|
19
|
+
minWidth?: number;
|
|
20
|
+
maxWidth?: number;
|
|
21
|
+
}
|
|
22
|
+
export declare const ImageResize: Node<ImageResizeOptions, any>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface ResizeState {
|
|
2
|
+
isResizing: boolean;
|
|
3
|
+
startX: number;
|
|
4
|
+
startWidth: number;
|
|
5
|
+
}
|
|
6
|
+
export interface ResizeLimits {
|
|
7
|
+
minWidth?: number;
|
|
8
|
+
maxWidth?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface PositionController {
|
|
11
|
+
element: HTMLElement;
|
|
12
|
+
leftController: HTMLElement;
|
|
13
|
+
centerController?: HTMLElement;
|
|
14
|
+
rightController: HTMLElement;
|
|
15
|
+
}
|
|
16
|
+
export interface ImageElements {
|
|
17
|
+
wrapper: HTMLElement;
|
|
18
|
+
container: HTMLElement;
|
|
19
|
+
img: HTMLImageElement;
|
|
20
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const IMAGE_RESIZE_EVENT = "image-resize-limit-update";
|
|
2
|
+
export declare class ResizeHandler {
|
|
3
|
+
private editorElement;
|
|
4
|
+
private currentMaxWidth;
|
|
5
|
+
private resizeTimeout;
|
|
6
|
+
private rafId;
|
|
7
|
+
constructor(editorElement: HTMLElement);
|
|
8
|
+
private measureContainerWidth;
|
|
9
|
+
private handleResize;
|
|
10
|
+
getCurrentMaxWidth(): number | undefined;
|
|
11
|
+
destroy(): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ShortcutHandler } from './indent.types';
|
|
2
|
+
/**
|
|
3
|
+
* WHY: When the cursor is at the very start of an indented text block,
|
|
4
|
+
* Backspace should visually un-indent the line rather than delete backwards.
|
|
5
|
+
* This mirrors how Google Docs treats Backspace at the start of an indented line.
|
|
6
|
+
*/
|
|
7
|
+
export declare const handleBackspaceOutdentAtLineStart: ShortcutHandler;
|
|
8
|
+
/**
|
|
9
|
+
* WHY: An empty indented line has no meaningful content to merge with the previous block.
|
|
10
|
+
* Deleting it entirely (rather than joining it) keeps the document structure clean.
|
|
11
|
+
*/
|
|
12
|
+
export declare const handleBackspaceDeleteEmptyIndentedLine: ShortcutHandler;
|
|
13
|
+
/**
|
|
14
|
+
* WHY: Backspace on an empty unindented paragraph right after a list would normally
|
|
15
|
+
* cause ProseMirror to merge the paragraph into the last list item, which is confusing.
|
|
16
|
+
* We delete the empty paragraph outright to prevent that unwanted merge.
|
|
17
|
+
*/
|
|
18
|
+
export declare const handleBackspaceDeleteEmptyParagraphAfterList: ShortcutHandler;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/react';
|
|
2
|
+
type IndentOptions = {
|
|
3
|
+
types: string[];
|
|
4
|
+
};
|
|
5
|
+
declare module '@tiptap/core' {
|
|
6
|
+
interface Commands<ReturnType> {
|
|
7
|
+
indent: {
|
|
8
|
+
indent: () => ReturnType;
|
|
9
|
+
outdent: () => ReturnType;
|
|
10
|
+
outdentShiftTab: () => ReturnType;
|
|
11
|
+
increaseIndent: () => ReturnType;
|
|
12
|
+
decreaseIndent: () => ReturnType;
|
|
13
|
+
_handleEnterKeyDown: () => ReturnType;
|
|
14
|
+
_handleSpaceKeyDown: () => ReturnType;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Adds Google-Doc-style indentation to paragraphs, headings, and lists.
|
|
20
|
+
*
|
|
21
|
+
* Indentation is stored as a `data-indent` attribute and rendered as
|
|
22
|
+
* `padding-left` on the node. Structural list nesting (sinkListItem / liftListItem)
|
|
23
|
+
* is handled separately by the List extension and is not affected by this attribute.
|
|
24
|
+
*/
|
|
25
|
+
export declare const IndentExtension: Extension<IndentOptions, any>;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IndentHandler } from './indent.types';
|
|
2
|
+
/**
|
|
3
|
+
* Multi-node selection handler: bulk-bump indent on all selected nodes.
|
|
4
|
+
* Triggers when >1 indentable node (text or list) exists in the selection range.
|
|
5
|
+
*/
|
|
6
|
+
export declare const handleIndentMultiNodeSelection: IndentHandler;
|
|
7
|
+
/**
|
|
8
|
+
* List handler: single-item lists get visual indent bump, multi-item lists get structural sink.
|
|
9
|
+
* Walks up the ancestor tree from cursor to find the nearest enclosing list.
|
|
10
|
+
*/
|
|
11
|
+
export declare const handleIndentList: IndentHandler;
|
|
12
|
+
/**
|
|
13
|
+
* Text node handler: bump indent on plain paragraphs and headings (not inside a list).
|
|
14
|
+
* Only triggers on a blinking cursor (TextSelection).
|
|
15
|
+
*/
|
|
16
|
+
export declare const handleIndentTextNode: IndentHandler;
|
|
@@ -1,63 +1,38 @@
|
|
|
1
|
-
|
|
1
|
+
import { CommandProps } from '@tiptap/react';
|
|
2
2
|
export { isListParent, isList, isTextNode } from './indent.utils';
|
|
3
|
-
|
|
4
3
|
/**
|
|
5
4
|
* The data snapshot passed into every keyboard-shortcut handler.
|
|
6
5
|
* Resolved once per keypress so each handler receives a stable, consistent view
|
|
7
6
|
* of the editor state — no handler can accidentally observe mid-chain mutations.
|
|
8
7
|
*/
|
|
9
8
|
export interface ShortcutContext {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
editor: any;
|
|
10
|
+
state: any;
|
|
11
|
+
view: any;
|
|
12
|
+
$from: any;
|
|
13
|
+
$to: any;
|
|
14
|
+
selectionIsEmpty: boolean;
|
|
15
|
+
currentNode: any;
|
|
17
16
|
}
|
|
18
|
-
|
|
19
17
|
/**
|
|
20
18
|
* A single link in a Chain of Responsibility for keyboard shortcuts.
|
|
21
19
|
* Returns `true` if this handler consumed the event (chain stops),
|
|
22
20
|
* or `false` to pass control to the next handler in the chain.
|
|
23
21
|
*/
|
|
24
22
|
export type ShortcutHandler = (context: ShortcutContext) => boolean;
|
|
25
|
-
|
|
26
23
|
/**
|
|
27
24
|
* Runs each handler in order. Stops and returns `true` as soon as one
|
|
28
25
|
* handler claims the event. Returns `false` if no handler matched.
|
|
29
26
|
*/
|
|
30
|
-
export function runChain(handlers: ShortcutHandler[], context: ShortcutContext): boolean
|
|
31
|
-
for (const handler of handlers) {
|
|
32
|
-
if (handler(context)) {
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* CommandProps is provided by TipTap's addCommands.
|
|
41
|
-
* Contains transaction, state, dispatch, and helper chains/commands.
|
|
42
|
-
*/
|
|
43
|
-
import type { CommandProps } from '@tiptap/react';
|
|
44
|
-
|
|
27
|
+
export declare function runChain(handlers: ShortcutHandler[], context: ShortcutContext): boolean;
|
|
45
28
|
/**
|
|
46
29
|
* A single link in a Chain of Responsibility for indent commands.
|
|
47
30
|
* Returns `true` if this handler consumed the command (chain stops),
|
|
48
31
|
* or `false` to pass control to the next handler in the chain.
|
|
49
32
|
*/
|
|
50
33
|
export type IndentHandler = (commands: CommandProps) => boolean;
|
|
51
|
-
|
|
52
34
|
/**
|
|
53
35
|
* Runs each indent handler in order. Stops and returns `true` as soon as one
|
|
54
36
|
* handler claims the command. Returns `false` if no handler matched.
|
|
55
37
|
*/
|
|
56
|
-
export function runIndentChain(handlers: IndentHandler[], commands: CommandProps): boolean
|
|
57
|
-
let index = 0;
|
|
58
|
-
for (const handler of handlers) {
|
|
59
|
-
index = index++;
|
|
60
|
-
if (handler(commands)) return true;
|
|
61
|
-
}
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
38
|
+
export declare function runIndentChain(handlers: IndentHandler[], commands: CommandProps): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Predicates that classify ProseMirror node types used throughout the indent logic.
|
|
3
|
+
* Kept as plain functions (not constants/enums) so TypeScript infers the correct
|
|
4
|
+
* string-narrowing type when used in conditional branches.
|
|
5
|
+
*/
|
|
6
|
+
export declare const isListParent: (name: string) => name is "bulletList" | "orderedList";
|
|
7
|
+
export declare const isList: (name: string) => name is "listItem";
|
|
8
|
+
export declare const isTextNode: (name: string) => name is "paragraph" | "heading";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ShortcutHandler } from './indent.types';
|
|
2
|
+
/**
|
|
3
|
+
* WHY: When a user highlights across multiple lines or list items,
|
|
4
|
+
* we want to bulk-decrease their indentation level or lift them structurally out of nesting.
|
|
5
|
+
*/
|
|
6
|
+
export declare const handleOutdentMultiNodeSelection: ShortcutHandler;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ShortcutHandler } from './indent.types';
|
|
2
|
+
/**
|
|
3
|
+
* WHY: When a user highlights across multiple lines or list items,
|
|
4
|
+
* we want to bulk-decrease their indentation level or lift them structurally out of nesting.
|
|
5
|
+
*/
|
|
6
|
+
export declare const handleShiftTabMultiNodeSelection: ShortcutHandler;
|
|
7
|
+
/**
|
|
8
|
+
* WHY: A list item at the outermost structural level (no enclosing parent list) with no visual
|
|
9
|
+
* indent has nothing to reduce. Without this guard, the event falls through to TipTap's List
|
|
10
|
+
* extension which calls liftListItem and ejects the item out of the list entirely.
|
|
11
|
+
*/
|
|
12
|
+
export declare const handleShiftTabInTopLevelListItem: ShortcutHandler;
|
|
13
|
+
/**
|
|
14
|
+
* WHY: An empty trailing paragraph after a list has no indent to reduce, so Shift-Tab
|
|
15
|
+
* falls through all handlers and the browser steals focus. We intercept and move the
|
|
16
|
+
* cursor into the last list item instead, which matches the user's intent of "go back in."
|
|
17
|
+
*/
|
|
18
|
+
export declare const handleShiftTabFromEmptyParagraphAfterList: ShortcutHandler;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ShortcutHandler } from './indent.types';
|
|
2
|
+
/**
|
|
3
|
+
* WHY: When a user highlights across multiple lines or list items,
|
|
4
|
+
* we want to bulk-increase their indentation level as a group.
|
|
5
|
+
*/
|
|
6
|
+
export declare const handleTabMultiNodeSelection: ShortcutHandler;
|
|
7
|
+
/**
|
|
8
|
+
* WHY: If a user has highlighted a specific word or phrase inside a single text line,
|
|
9
|
+
* pressing Tab shouldn't move the entire line layout. It should just overwrite the text with a \t.
|
|
10
|
+
*/
|
|
11
|
+
export declare const handleTabSingleNodeTextSelection: ShortcutHandler;
|
|
12
|
+
/**
|
|
13
|
+
* WHY: If the user is currently typing inside a List Item but they haven't highlighted anything,
|
|
14
|
+
* let the List extension handle indenting structurally.
|
|
15
|
+
*/
|
|
16
|
+
export declare const handleTabInsideListItem: ShortcutHandler;
|
|
17
|
+
/**
|
|
18
|
+
* WHY: If the cursor is right in the middle of a sentence, inject a literal Tab character.
|
|
19
|
+
* We only block-indent the whole line if the cursor is at the very beginning.
|
|
20
|
+
*/
|
|
21
|
+
export declare const handleTabMidTextCursor: ShortcutHandler;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
|
+
import { BulletListOptions, OrderedListOptions, ListItemOptions } from '@tiptap/extension-list';
|
|
3
|
+
/**
|
|
4
|
+
* Custom List Extensions: Indent Attribute Support
|
|
5
|
+
*
|
|
6
|
+
* Extends TipTap list nodes (BulletList, OrderedList, ListItem) with indent attributes.
|
|
7
|
+
*
|
|
8
|
+
* Per FR-020: ListItem receives transferred indent from paragraph
|
|
9
|
+
* Per FR-021: Paragraph children inside lists must NOT have indent
|
|
10
|
+
* Per FR-022: List-level indent separate from item indent
|
|
11
|
+
* Per FR-030: Backward compatibility via attribute defaults
|
|
12
|
+
*
|
|
13
|
+
* @see specs/001-richtext-indent-lists/data-model.md
|
|
14
|
+
*/
|
|
15
|
+
export declare const CustomBulletList: Node<BulletListOptions, any>;
|
|
16
|
+
export declare const CustomOrderedList: Node<OrderedListOptions, any>;
|
|
17
|
+
export declare const CustomListItem: Node<ListItemOptions, any>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
|
+
import { BatchImage, BatchSegmentImagesOptions } from './batch-segment-images.types';
|
|
3
|
+
export type { BatchImage, BatchSegmentImagesOptions };
|
|
4
|
+
declare module '@tiptap/core' {
|
|
5
|
+
interface Commands<ReturnType> {
|
|
6
|
+
batchSegmentImages: {
|
|
7
|
+
insertBatchImages: ({ batchId, images, }: {
|
|
8
|
+
batchId: string;
|
|
9
|
+
images: BatchImage[];
|
|
10
|
+
}) => ReturnType;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
interface Storage {
|
|
14
|
+
batchSegmentImages: {
|
|
15
|
+
imageRegistry: Map<string, BatchImage[]>;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export declare const BatchSegmentImagesExtension: Node<BatchSegmentImagesOptions, any>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
export interface BatchImage {
|
|
3
|
+
id: string;
|
|
4
|
+
src: string;
|
|
5
|
+
alt?: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface BatchSegmentImagesOptions {
|
|
9
|
+
initialImageRegistry?: Map<string, BatchImage[]>;
|
|
10
|
+
maxImageAmount?: number;
|
|
11
|
+
height?: number;
|
|
12
|
+
onAdd?: (params: {
|
|
13
|
+
position: 'last';
|
|
14
|
+
batchId: string;
|
|
15
|
+
currentImages: BatchImage[];
|
|
16
|
+
getPos: () => number | undefined;
|
|
17
|
+
editor: Editor;
|
|
18
|
+
}) => void;
|
|
19
|
+
onRemove?: (params: {
|
|
20
|
+
index: number;
|
|
21
|
+
imageId: string;
|
|
22
|
+
batchId: string;
|
|
23
|
+
getPos: () => number | undefined;
|
|
24
|
+
editor: Editor;
|
|
25
|
+
}) => void;
|
|
26
|
+
onImageClick?: (params: {
|
|
27
|
+
imageId: string;
|
|
28
|
+
batchId: string;
|
|
29
|
+
src: string;
|
|
30
|
+
getPos: () => number | undefined;
|
|
31
|
+
editor: Editor;
|
|
32
|
+
}) => void;
|
|
33
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Node, Extension, Mark } from '@tiptap/core';
|
|
2
|
+
import { BoldOptions } from '@tiptap/extension-bold';
|
|
3
|
+
export declare const ALL_EXTENSIONS: ( Node<any, any> | Extension<any, any> | Mark<BoldOptions, any>)[];
|
|
4
|
+
export declare const BASE_EXTENSIONS: ( Node<any, any> | Extension<any, any> | Mark<BoldOptions, any>)[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
type FontSizeOptions = {
|
|
3
|
+
types: string[];
|
|
4
|
+
getStyle: (fontSize: string) => string;
|
|
5
|
+
};
|
|
6
|
+
declare module '@tiptap/core' {
|
|
7
|
+
interface Commands<ReturnType> {
|
|
8
|
+
fontSize: {
|
|
9
|
+
/**
|
|
10
|
+
* Set the font size attribute
|
|
11
|
+
*/
|
|
12
|
+
setFontSize: (size: string) => ReturnType;
|
|
13
|
+
/**
|
|
14
|
+
* Unset the font size attribute
|
|
15
|
+
*/
|
|
16
|
+
unsetFontSize: () => ReturnType;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export declare const FontSize: Extension<FontSizeOptions, any>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
type LineHeightOptions = {
|
|
3
|
+
types: string[];
|
|
4
|
+
getStyle: (lineHeight: string) => string;
|
|
5
|
+
};
|
|
6
|
+
declare module '@tiptap/core' {
|
|
7
|
+
interface Commands<ReturnType> {
|
|
8
|
+
lineHeight: {
|
|
9
|
+
/**
|
|
10
|
+
* Set the line height attribute
|
|
11
|
+
*/
|
|
12
|
+
setLineHeight: (lineHeight: string) => ReturnType;
|
|
13
|
+
/**
|
|
14
|
+
* Unset the line height attribute
|
|
15
|
+
*/
|
|
16
|
+
unsetLineHeight: () => ReturnType;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export declare const LineHeight: Extension<LineHeightOptions, any>;
|
|
21
|
+
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export * from './components/RichTextEditor/Extension/extensions';
|
|
2
|
-
|
|
3
|
-
// Tiptap Extensions
|
|
2
|
+
export { Editor, type EditorEvents, useEditor, EditorContent } from '@tiptap/react';
|
|
4
3
|
export { default as Bold } from '@tiptap/extension-bold';
|
|
5
4
|
export { default as Color } from '@tiptap/extension-color';
|
|
6
5
|
export { default as Document } from '@tiptap/extension-document';
|
|
@@ -11,14 +10,7 @@ export { default as Highlight } from '@tiptap/extension-highlight';
|
|
|
11
10
|
export { default as Image } from '@tiptap/extension-image';
|
|
12
11
|
export { default as Italic } from '@tiptap/extension-italic';
|
|
13
12
|
export { default as Link } from '@tiptap/extension-link';
|
|
14
|
-
export {
|
|
15
|
-
BulletList,
|
|
16
|
-
OrderedList,
|
|
17
|
-
ListItem,
|
|
18
|
-
ListKeymap,
|
|
19
|
-
TaskList,
|
|
20
|
-
TaskItem,
|
|
21
|
-
} from '@tiptap/extension-list';
|
|
13
|
+
export { BulletList, OrderedList, ListItem, ListKeymap, TaskList, TaskItem, } from '@tiptap/extension-list';
|
|
22
14
|
export { default as Mention } from '@tiptap/extension-mention';
|
|
23
15
|
export { default as Paragraph } from '@tiptap/extension-paragraph';
|
|
24
16
|
export { Table, TableCell, TableHeader, TableRow } from '@tiptap/extension-table';
|
|
@@ -27,16 +19,16 @@ export { default as TextAlign } from '@tiptap/extension-text-align';
|
|
|
27
19
|
export { TextStyle } from '@tiptap/extension-text-style';
|
|
28
20
|
export { default as Underline } from '@tiptap/extension-underline';
|
|
29
21
|
export { CharacterCount, Placeholder, UndoRedo as History } from '@tiptap/extensions';
|
|
30
|
-
|
|
31
|
-
// Internal Extensions
|
|
32
22
|
export { CustomParagraph } from './components/RichTextEditor/Extension/custom-paragraph.extension';
|
|
23
|
+
export { CustomLink } from './components/RichTextEditor/Extension/custom-link.extension';
|
|
33
24
|
export { IndentExtension } from './components/RichTextEditor/Extension/Indent/indent.extension';
|
|
34
|
-
export {
|
|
35
|
-
CustomListItem,
|
|
36
|
-
CustomBulletList,
|
|
37
|
-
CustomOrderedList,
|
|
38
|
-
} from './components/RichTextEditor/Extension/List/custom-list-item.extension';
|
|
25
|
+
export { CustomListItem, CustomBulletList, CustomOrderedList, } from './components/RichTextEditor/Extension/List/custom-list-item.extension';
|
|
39
26
|
export { DynamicBulletStyling } from './components/RichTextEditor/Extension/List/dynamic-bullet-styling.extension';
|
|
40
27
|
export { ListIndentIntegration } from './components/RichTextEditor/Extension/list-indent-integration.extension';
|
|
41
28
|
export { FontSize } from './components/RichTextEditor/Extension/tiptap-extension-fontsize';
|
|
42
29
|
export { LineHeight } from './components/RichTextEditor/Extension/tiptap-extension-lineheight';
|
|
30
|
+
export { MentionStorage } from './components/RichTextEditor/Extension/mentionstorage.extension';
|
|
31
|
+
export { BatchSegmentImagesExtension } from './components/RichTextEditor/Extension/batch-segment-images.extension';
|
|
32
|
+
export { ImageResize } from './components/RichTextEditor/Extension/Image/ImageResize';
|
|
33
|
+
export type { ResizeLimits } from './components/RichTextEditor/Extension/Image/ImageResize';
|
|
34
|
+
export type { BatchImage, BatchSegmentImagesOptions, } from './components/RichTextEditor/Extension/batch-segment-images.types';
|