@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 CHANGED
@@ -1,5 +1,85 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- /// <amd-module name="@plait/text-plugins" />
5
- export * from './public-api';
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plait/text-plugins",
3
- "version": "0.91.0",
3
+ "version": "0.92.0-next.0",
4
4
  "peerDependencies": {},
5
5
  "dependencies": {
6
6
  "tslib": "^2.3.0"
@@ -1,6 +0,0 @@
1
- import { Alignment } from '@plait/common';
2
- import { Editor } from 'slate';
3
- export declare const AlignEditor: {
4
- isActive(editor: Editor, alignment: Alignment): boolean;
5
- setAlign(editor: Editor, alignment: Alignment): void;
6
- };
package/align/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './align-editor';
@@ -1,2 +0,0 @@
1
- export declare const TEXT_DEFAULT_HEIGHT = 20;
2
- export declare const CLIPBOARD_FORMAT_KEY = "x-plait-text-fragment";
package/link/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './link-editor';
2
- export * from './with-link';
@@ -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
- };
@@ -1,2 +0,0 @@
1
- import { Editor } from 'slate';
2
- export declare const withLink: <T extends Editor>(editor: T) => T;
@@ -1 +0,0 @@
1
- export declare const DEFAULT_FONT_SIZE = 14;
package/mark/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from './types';
2
- export * from './constant';
3
- export * from './mark.editor';
4
- export * from './with-marks';
@@ -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
- };
@@ -1,4 +0,0 @@
1
- import { MarkEditor } from './mark.editor';
2
- import { Editor } from 'slate';
3
- export declare const withMark: <T extends Editor & MarkEditor>(editor: T) => T;
4
- export declare const markShortcuts: (editor: Editor, event: KeyboardEvent) => void;
package/public-api.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export * from './align';
2
- export * from './mark';
3
- export * from './link';
4
- export * from './utils';
5
- export * from './constant';
6
- export * from './text-transforms';
@@ -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
- };
@@ -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
@@ -1,3 +0,0 @@
1
- export * from './clipboard';
2
- export * from './common';
3
- export * from './marks';
package/utils/marks.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { CustomText } from '@plait/common';
2
- import { PlaitElement } from '@plait/core';
3
- export declare const getTextMarksByElement: (element: PlaitElement) => Omit<CustomText, "text">;