@plait/text-plugins 0.91.0 → 0.92.0-next.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.
- package/index.d.ts +85 -5
- package/package.json +1 -1
- package/align/align-editor.d.ts +0 -6
- package/align/index.d.ts +0 -1
- package/constant/index.d.ts +0 -2
- package/link/index.d.ts +0 -2
- package/link/link-editor.d.ts +0 -8
- package/link/with-link.d.ts +0 -2
- package/mark/constant.d.ts +0 -1
- package/mark/index.d.ts +0 -4
- package/mark/mark.editor.d.ts +0 -14
- package/mark/types.d.ts +0 -29
- package/mark/with-marks.d.ts +0 -4
- package/public-api.d.ts +0 -6
- package/text-transforms.d.ts +0 -10
- package/utils/clipboard.d.ts +0 -1
- package/utils/common.d.ts +0 -1
- package/utils/index.d.ts +0 -3
- package/utils/marks.d.ts +0 -3
package/index.d.ts
CHANGED
|
@@ -1,5 +1,85 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { Alignment, CustomElement, CustomText } from '@plait/common';
|
|
2
|
+
import * as slate from 'slate';
|
|
3
|
+
import { Editor, Element, Location, BaseEditor, BaseRange } from 'slate';
|
|
4
|
+
import { PlaitElement, PlaitBoard } from '@plait/core';
|
|
5
|
+
|
|
6
|
+
declare const AlignEditor: {
|
|
7
|
+
isActive(editor: Editor, alignment: Alignment): boolean;
|
|
8
|
+
setAlign(editor: Editor, alignment: Alignment): void;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
declare enum MarkTypes {
|
|
12
|
+
bold = "bold",
|
|
13
|
+
italic = "italic",
|
|
14
|
+
underline = "underlined",
|
|
15
|
+
strike = "strike",
|
|
16
|
+
color = "color",
|
|
17
|
+
fontSize = "font-size"
|
|
18
|
+
}
|
|
19
|
+
declare const MarkProps: MarkTypes[];
|
|
20
|
+
declare enum FontSizes {
|
|
21
|
+
'fontSize12' = "12",
|
|
22
|
+
'fontSize13' = "13",
|
|
23
|
+
'fontSize14' = "14",
|
|
24
|
+
'fontSize15' = "15",
|
|
25
|
+
'fontSize16' = "16",
|
|
26
|
+
'fontSize18' = "18",
|
|
27
|
+
'fontSize20' = "20",
|
|
28
|
+
'fontSize24' = "24",
|
|
29
|
+
'fontSize28' = "28",
|
|
30
|
+
'fontSize32' = "32",
|
|
31
|
+
'fontSize40' = "40",
|
|
32
|
+
'fontSize48' = "48"
|
|
33
|
+
}
|
|
34
|
+
declare const HOTKEYS: {
|
|
35
|
+
'mod+b': MarkTypes;
|
|
36
|
+
'mod+i': MarkTypes;
|
|
37
|
+
'mod+u': MarkTypes;
|
|
38
|
+
'mod+shift+x': MarkTypes;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
declare const DEFAULT_FONT_SIZE = 14;
|
|
42
|
+
|
|
43
|
+
interface MarkEditor extends Editor {
|
|
44
|
+
removeMark: (key: string, shouldChange?: boolean) => void;
|
|
45
|
+
}
|
|
46
|
+
declare const PlaitMarkEditor: {
|
|
47
|
+
getMarks(editor: Editor): any;
|
|
48
|
+
getMarksByElement(element: Element): any;
|
|
49
|
+
isMarkActive(editor: Editor, format: MarkTypes): boolean | undefined;
|
|
50
|
+
toggleMark(editor: Editor, format: MarkTypes): void;
|
|
51
|
+
setFontSizeMark(editor: Editor, size: FontSizes, defaultSize?: number): void;
|
|
52
|
+
setColorMark(editor: Editor, color: string | null, defaultTextColor?: string): void;
|
|
53
|
+
};
|
|
54
|
+
declare function setSelection(editor: Editor): void;
|
|
55
|
+
|
|
56
|
+
declare const withMark: <T extends Editor & MarkEditor>(editor: T) => T;
|
|
57
|
+
declare const markShortcuts: (editor: Editor, event: KeyboardEvent) => void;
|
|
58
|
+
|
|
59
|
+
declare const LinkEditor: {
|
|
60
|
+
wrapLink(editor: Editor, text: string, url: string): void;
|
|
61
|
+
unwrapLink(editor: Editor, at?: Location): void;
|
|
62
|
+
isLinkActive(editor: Editor): boolean;
|
|
63
|
+
getLinkElement(editor: Editor): slate.NodeEntry<CustomElement>;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
declare const withLink: <T extends Editor>(editor: T) => T;
|
|
67
|
+
|
|
68
|
+
declare const getTextFromClipboard: (data: DataTransfer | null) => string | slate.BaseElement;
|
|
69
|
+
|
|
70
|
+
declare function isUrl(string: string): boolean;
|
|
71
|
+
|
|
72
|
+
declare const getTextMarksByElement: (element: PlaitElement) => Omit<CustomText, "text">;
|
|
73
|
+
|
|
74
|
+
declare const TEXT_DEFAULT_HEIGHT = 20;
|
|
75
|
+
declare const CLIPBOARD_FORMAT_KEY = "x-plait-text-fragment";
|
|
76
|
+
|
|
77
|
+
declare const TextTransforms: {
|
|
78
|
+
setTextAlign: (board: PlaitBoard, align: Alignment, editors?: BaseEditor[]) => void;
|
|
79
|
+
setTextColor: (board: PlaitBoard, color: string | null, textSelection?: BaseRange, editors?: BaseEditor[]) => void;
|
|
80
|
+
setFontSize: (board: PlaitBoard, size: FontSizes, defaultFontSize: number | ((element: PlaitElement) => number | undefined), editors?: BaseEditor[]) => void;
|
|
81
|
+
setTextMarks: (board: PlaitBoard, mark: MarkTypes, editors?: BaseEditor[]) => void;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export { AlignEditor, CLIPBOARD_FORMAT_KEY, DEFAULT_FONT_SIZE, FontSizes, HOTKEYS, LinkEditor, MarkProps, MarkTypes, PlaitMarkEditor, TEXT_DEFAULT_HEIGHT, TextTransforms, getTextFromClipboard, getTextMarksByElement, isUrl, markShortcuts, setSelection, withLink, withMark };
|
|
85
|
+
export type { MarkEditor };
|
package/package.json
CHANGED
package/align/align-editor.d.ts
DELETED
package/align/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './align-editor';
|
package/constant/index.d.ts
DELETED
package/link/index.d.ts
DELETED
package/link/link-editor.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { CustomElement } from '@plait/common';
|
|
2
|
-
import { Editor, Location } from 'slate';
|
|
3
|
-
export declare const LinkEditor: {
|
|
4
|
-
wrapLink(editor: Editor, text: string, url: string): void;
|
|
5
|
-
unwrapLink(editor: Editor, at?: Location): void;
|
|
6
|
-
isLinkActive(editor: Editor): boolean;
|
|
7
|
-
getLinkElement(editor: Editor): import("slate").NodeEntry<CustomElement>;
|
|
8
|
-
};
|
package/link/with-link.d.ts
DELETED
package/mark/constant.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const DEFAULT_FONT_SIZE = 14;
|
package/mark/index.d.ts
DELETED
package/mark/mark.editor.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Editor, Element } from 'slate';
|
|
2
|
-
import { FontSizes, MarkTypes } from './types';
|
|
3
|
-
export interface MarkEditor extends Editor {
|
|
4
|
-
removeMark: (key: string, shouldChange?: boolean) => void;
|
|
5
|
-
}
|
|
6
|
-
export declare const PlaitMarkEditor: {
|
|
7
|
-
getMarks(editor: Editor): any;
|
|
8
|
-
getMarksByElement(element: Element): any;
|
|
9
|
-
isMarkActive(editor: Editor, format: MarkTypes): boolean | undefined;
|
|
10
|
-
toggleMark(editor: Editor, format: MarkTypes): void;
|
|
11
|
-
setFontSizeMark(editor: Editor, size: FontSizes, defaultSize?: number): void;
|
|
12
|
-
setColorMark(editor: Editor, color: string | null, defaultTextColor?: string): void;
|
|
13
|
-
};
|
|
14
|
-
export declare function setSelection(editor: Editor): void;
|
package/mark/types.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export declare enum MarkTypes {
|
|
2
|
-
bold = "bold",
|
|
3
|
-
italic = "italic",
|
|
4
|
-
underline = "underlined",
|
|
5
|
-
strike = "strike",
|
|
6
|
-
color = "color",
|
|
7
|
-
fontSize = "font-size"
|
|
8
|
-
}
|
|
9
|
-
export declare const MarkProps: MarkTypes[];
|
|
10
|
-
export declare enum FontSizes {
|
|
11
|
-
'fontSize12' = "12",
|
|
12
|
-
'fontSize13' = "13",
|
|
13
|
-
'fontSize14' = "14",
|
|
14
|
-
'fontSize15' = "15",
|
|
15
|
-
'fontSize16' = "16",
|
|
16
|
-
'fontSize18' = "18",
|
|
17
|
-
'fontSize20' = "20",
|
|
18
|
-
'fontSize24' = "24",
|
|
19
|
-
'fontSize28' = "28",
|
|
20
|
-
'fontSize32' = "32",
|
|
21
|
-
'fontSize40' = "40",
|
|
22
|
-
'fontSize48' = "48"
|
|
23
|
-
}
|
|
24
|
-
export declare const HOTKEYS: {
|
|
25
|
-
'mod+b': MarkTypes;
|
|
26
|
-
'mod+i': MarkTypes;
|
|
27
|
-
'mod+u': MarkTypes;
|
|
28
|
-
'mod+shift+x': MarkTypes;
|
|
29
|
-
};
|
package/mark/with-marks.d.ts
DELETED
package/public-api.d.ts
DELETED
package/text-transforms.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { PlaitBoard, PlaitElement } from '@plait/core';
|
|
2
|
-
import { BaseEditor, BaseRange } from 'slate';
|
|
3
|
-
import { FontSizes, MarkTypes } from './mark/types';
|
|
4
|
-
import { Alignment } from '@plait/common';
|
|
5
|
-
export declare const TextTransforms: {
|
|
6
|
-
setTextAlign: (board: PlaitBoard, align: Alignment, editors?: BaseEditor[]) => void;
|
|
7
|
-
setTextColor: (board: PlaitBoard, color: string | null, textSelection?: BaseRange, editors?: BaseEditor[]) => void;
|
|
8
|
-
setFontSize: (board: PlaitBoard, size: FontSizes, defaultFontSize: number | ((element: PlaitElement) => number | undefined), editors?: BaseEditor[]) => void;
|
|
9
|
-
setTextMarks: (board: PlaitBoard, mark: MarkTypes, editors?: BaseEditor[]) => void;
|
|
10
|
-
};
|
package/utils/clipboard.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getTextFromClipboard: (data: DataTransfer | null) => string | import("slate").BaseElement;
|
package/utils/common.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isUrl(string: string): boolean;
|
package/utils/index.d.ts
DELETED
package/utils/marks.d.ts
DELETED