lakelib 0.1.11 → 0.1.12
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/lake.css +279 -214
- package/dist/lake.min.js +48 -31
- package/dist/lake.min.js.map +1 -1
- package/lib/lake.css +279 -214
- package/lib/lake.js +2956 -2710
- package/lib/lake.js.map +1 -1
- package/lib/types/boxes/hr.d.ts +1 -1
- package/lib/types/boxes/video.d.ts +2 -0
- package/lib/types/css/index.d.ts +5 -3
- package/lib/types/editor.d.ts +3 -9
- package/lib/types/i18n/en-US/index.d.ts +8 -0
- package/lib/types/i18n/ja/index.d.ts +8 -0
- package/lib/types/i18n/ko/index.d.ts +8 -0
- package/lib/types/i18n/types.d.ts +52 -0
- package/lib/types/i18n/zh-CN/index.d.ts +8 -0
- package/lib/types/managers/box-manager.d.ts +0 -2
- package/lib/types/managers/selection.d.ts +6 -0
- package/lib/types/models/box.d.ts +2 -4
- package/lib/types/plugins/video.d.ts +3 -0
- package/lib/types/storage/box-instances.d.ts +1 -1
- package/lib/types/types/box-toolbar.d.ts +9 -0
- package/lib/types/ui/box-resizer.d.ts +19 -0
- package/lib/types/ui/box-toolbar.d.ts +3 -15
- package/lib/types/ui/button.d.ts +1 -0
- package/package.json +1 -1
package/lib/types/boxes/hr.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BoxComponent } from '../types/box';
|
|
2
2
|
export declare const hrBox: BoxComponent;
|
package/lib/types/css/index.d.ts
CHANGED
|
@@ -5,6 +5,9 @@ import './mark.css';
|
|
|
5
5
|
import './button.css';
|
|
6
6
|
import './dropdown.css';
|
|
7
7
|
import './popup.css';
|
|
8
|
+
import './resizer.css';
|
|
9
|
+
import './toolbar.css';
|
|
10
|
+
import './box-toolbar.css';
|
|
8
11
|
import './format-painter.css';
|
|
9
12
|
import './heading.css';
|
|
10
13
|
import './list.css';
|
|
@@ -12,9 +15,8 @@ import './block-quote.css';
|
|
|
12
15
|
import './table.css';
|
|
13
16
|
import './box.css';
|
|
14
17
|
import './hr.css';
|
|
18
|
+
import './video.css';
|
|
19
|
+
import './code-block.css';
|
|
15
20
|
import './image.css';
|
|
16
21
|
import './file.css';
|
|
17
|
-
import './code-block.css';
|
|
18
22
|
import './link-popup.css';
|
|
19
|
-
import './toolbar.css';
|
|
20
|
-
import './box-toolbar.css';
|
package/lib/types/editor.d.ts
CHANGED
|
@@ -2,9 +2,6 @@ import EventEmitter from 'eventemitter3';
|
|
|
2
2
|
import { NativeNode } from './types/native';
|
|
3
3
|
import { TranslationFunctions } from './i18n/types';
|
|
4
4
|
import { Nodes } from './models/nodes';
|
|
5
|
-
import { Box } from './models/box';
|
|
6
|
-
import { insertBox } from './operations/insert-box';
|
|
7
|
-
import { removeBox } from './operations/remove-box';
|
|
8
5
|
import { Selection } from './managers/selection';
|
|
9
6
|
import { Command } from './managers/command';
|
|
10
7
|
import { History } from './managers/history';
|
|
@@ -12,7 +9,7 @@ import { Keystroke } from './managers/keystroke';
|
|
|
12
9
|
import { BoxManager } from './managers/box-manager';
|
|
13
10
|
import { Plugin } from './managers/plugin';
|
|
14
11
|
import { Toolbar } from './ui/toolbar';
|
|
15
|
-
type
|
|
12
|
+
type MessageCallback = (type: 'success' | 'error' | 'warning', message: string) => void;
|
|
16
13
|
type Config = {
|
|
17
14
|
value: string;
|
|
18
15
|
readonly: boolean;
|
|
@@ -22,7 +19,7 @@ type Config = {
|
|
|
22
19
|
indentWithTab: boolean;
|
|
23
20
|
lang: string;
|
|
24
21
|
minChangeSize: number;
|
|
25
|
-
onMessage:
|
|
22
|
+
onMessage: MessageCallback;
|
|
26
23
|
[name: string]: any;
|
|
27
24
|
};
|
|
28
25
|
type EditorConfig = {
|
|
@@ -36,7 +33,7 @@ type EditorConfig = {
|
|
|
36
33
|
indentWithTab?: boolean;
|
|
37
34
|
lang?: string;
|
|
38
35
|
minChangeSize?: number;
|
|
39
|
-
onMessage?:
|
|
36
|
+
onMessage?: MessageCallback;
|
|
40
37
|
[name: string]: any;
|
|
41
38
|
};
|
|
42
39
|
export declare class Editor {
|
|
@@ -89,9 +86,6 @@ export declare class Editor {
|
|
|
89
86
|
scrollToCaret(): void;
|
|
90
87
|
setValue(value: string): void;
|
|
91
88
|
getValue(): string;
|
|
92
|
-
selectBox(box: Box | Nodes): void;
|
|
93
|
-
insertBox(boxName: Parameters<typeof insertBox>[1], boxValue?: Parameters<typeof insertBox>[2]): Box;
|
|
94
|
-
removeBox(box?: Box | Nodes | null): ReturnType<typeof removeBox>;
|
|
95
89
|
render(): void;
|
|
96
90
|
unmount(): void;
|
|
97
91
|
}
|
|
@@ -25,6 +25,7 @@ declare const _default: {
|
|
|
25
25
|
formatPainter: string;
|
|
26
26
|
link: string;
|
|
27
27
|
hr: string;
|
|
28
|
+
video: string;
|
|
28
29
|
codeBlock: string;
|
|
29
30
|
heading: string;
|
|
30
31
|
heading1: string;
|
|
@@ -68,6 +69,13 @@ declare const _default: {
|
|
|
68
69
|
download: string;
|
|
69
70
|
remove: string;
|
|
70
71
|
};
|
|
72
|
+
video: {
|
|
73
|
+
embed: string;
|
|
74
|
+
remove: string;
|
|
75
|
+
description: string;
|
|
76
|
+
url: string;
|
|
77
|
+
urlError: string;
|
|
78
|
+
};
|
|
71
79
|
codeBlock: {
|
|
72
80
|
langType: string;
|
|
73
81
|
};
|
|
@@ -25,6 +25,7 @@ declare const _default: {
|
|
|
25
25
|
formatPainter: string;
|
|
26
26
|
link: string;
|
|
27
27
|
hr: string;
|
|
28
|
+
video: string;
|
|
28
29
|
codeBlock: string;
|
|
29
30
|
heading: string;
|
|
30
31
|
heading1: string;
|
|
@@ -68,6 +69,13 @@ declare const _default: {
|
|
|
68
69
|
download: string;
|
|
69
70
|
remove: string;
|
|
70
71
|
};
|
|
72
|
+
video: {
|
|
73
|
+
embed: string;
|
|
74
|
+
remove: string;
|
|
75
|
+
description: string;
|
|
76
|
+
url: string;
|
|
77
|
+
urlError: string;
|
|
78
|
+
};
|
|
71
79
|
codeBlock: {
|
|
72
80
|
langType: string;
|
|
73
81
|
};
|
|
@@ -25,6 +25,7 @@ declare const _default: {
|
|
|
25
25
|
formatPainter: string;
|
|
26
26
|
link: string;
|
|
27
27
|
hr: string;
|
|
28
|
+
video: string;
|
|
28
29
|
codeBlock: string;
|
|
29
30
|
heading: string;
|
|
30
31
|
heading1: string;
|
|
@@ -68,6 +69,13 @@ declare const _default: {
|
|
|
68
69
|
download: string;
|
|
69
70
|
remove: string;
|
|
70
71
|
};
|
|
72
|
+
video: {
|
|
73
|
+
embed: string;
|
|
74
|
+
remove: string;
|
|
75
|
+
description: string;
|
|
76
|
+
url: string;
|
|
77
|
+
urlError: string;
|
|
78
|
+
};
|
|
71
79
|
codeBlock: {
|
|
72
80
|
langType: string;
|
|
73
81
|
};
|
|
@@ -106,6 +106,10 @@ type RootTranslation = {
|
|
|
106
106
|
* Horizontal line
|
|
107
107
|
*/
|
|
108
108
|
hr: string;
|
|
109
|
+
/**
|
|
110
|
+
* Video
|
|
111
|
+
*/
|
|
112
|
+
video: string;
|
|
109
113
|
/**
|
|
110
114
|
* Code block
|
|
111
115
|
*/
|
|
@@ -257,6 +261,28 @@ type RootTranslation = {
|
|
|
257
261
|
*/
|
|
258
262
|
remove: string;
|
|
259
263
|
};
|
|
264
|
+
video: {
|
|
265
|
+
/**
|
|
266
|
+
* Embed video
|
|
267
|
+
*/
|
|
268
|
+
embed: string;
|
|
269
|
+
/**
|
|
270
|
+
* Delete
|
|
271
|
+
*/
|
|
272
|
+
remove: string;
|
|
273
|
+
/**
|
|
274
|
+
* Paste a link to embed a video from YouTube.
|
|
275
|
+
*/
|
|
276
|
+
description: string;
|
|
277
|
+
/**
|
|
278
|
+
* Link
|
|
279
|
+
*/
|
|
280
|
+
url: string;
|
|
281
|
+
/**
|
|
282
|
+
* Please enter a valid link.
|
|
283
|
+
*/
|
|
284
|
+
urlError: string;
|
|
285
|
+
};
|
|
260
286
|
codeBlock: {
|
|
261
287
|
/**
|
|
262
288
|
* Select language
|
|
@@ -366,6 +392,10 @@ export type TranslationFunctions = {
|
|
|
366
392
|
* Horizontal line
|
|
367
393
|
*/
|
|
368
394
|
hr: () => LocalizedString;
|
|
395
|
+
/**
|
|
396
|
+
* Video
|
|
397
|
+
*/
|
|
398
|
+
video: () => LocalizedString;
|
|
369
399
|
/**
|
|
370
400
|
* Code block
|
|
371
401
|
*/
|
|
@@ -517,6 +547,28 @@ export type TranslationFunctions = {
|
|
|
517
547
|
*/
|
|
518
548
|
remove: () => LocalizedString;
|
|
519
549
|
};
|
|
550
|
+
video: {
|
|
551
|
+
/**
|
|
552
|
+
* Embed video
|
|
553
|
+
*/
|
|
554
|
+
embed: () => LocalizedString;
|
|
555
|
+
/**
|
|
556
|
+
* Delete
|
|
557
|
+
*/
|
|
558
|
+
remove: () => LocalizedString;
|
|
559
|
+
/**
|
|
560
|
+
* Paste a link to embed a video from YouTube.
|
|
561
|
+
*/
|
|
562
|
+
description: () => LocalizedString;
|
|
563
|
+
/**
|
|
564
|
+
* Link
|
|
565
|
+
*/
|
|
566
|
+
url: () => LocalizedString;
|
|
567
|
+
/**
|
|
568
|
+
* Please enter a valid link.
|
|
569
|
+
*/
|
|
570
|
+
urlError: () => LocalizedString;
|
|
571
|
+
};
|
|
520
572
|
codeBlock: {
|
|
521
573
|
/**
|
|
522
574
|
* Select language
|
|
@@ -25,6 +25,7 @@ declare const _default: {
|
|
|
25
25
|
formatPainter: string;
|
|
26
26
|
link: string;
|
|
27
27
|
hr: string;
|
|
28
|
+
video: string;
|
|
28
29
|
codeBlock: string;
|
|
29
30
|
heading: string;
|
|
30
31
|
heading1: string;
|
|
@@ -68,6 +69,13 @@ declare const _default: {
|
|
|
68
69
|
download: string;
|
|
69
70
|
remove: string;
|
|
70
71
|
};
|
|
72
|
+
video: {
|
|
73
|
+
embed: string;
|
|
74
|
+
remove: string;
|
|
75
|
+
description: string;
|
|
76
|
+
url: string;
|
|
77
|
+
urlError: string;
|
|
78
|
+
};
|
|
71
79
|
codeBlock: {
|
|
72
80
|
langType: string;
|
|
73
81
|
};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { BoxComponent } from '../types/box';
|
|
2
2
|
import { Nodes } from '../models/nodes';
|
|
3
|
-
import { Box } from '../models/box';
|
|
4
3
|
export declare class BoxManager {
|
|
5
4
|
add(component: BoxComponent): void;
|
|
6
5
|
remove(name: string): void;
|
|
7
6
|
getNames(): string[];
|
|
8
|
-
getInstances(container: Nodes): Map<number, Box>;
|
|
9
7
|
rectifyInstances(container: Nodes): void;
|
|
10
8
|
renderAll(container: Nodes): void;
|
|
11
9
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AppliedItem } from '../types/object';
|
|
2
2
|
import { Nodes } from '../models/nodes';
|
|
3
3
|
import { Range } from '../models/range';
|
|
4
|
+
import { Box } from '../models/box';
|
|
4
5
|
import { insertBookmark } from '../operations/insert-bookmark';
|
|
5
6
|
import { toBookmark } from '../operations/to-bookmark';
|
|
6
7
|
import { insertNode } from '../operations/insert-node';
|
|
@@ -14,6 +15,8 @@ import { addMark } from '../operations/add-mark';
|
|
|
14
15
|
import { removeMark } from '../operations/remove-mark';
|
|
15
16
|
import { fixList } from '../operations/fix-list';
|
|
16
17
|
import { insertLink } from '../operations/insert-link';
|
|
18
|
+
import { insertBox } from '../operations/insert-box';
|
|
19
|
+
import { removeBox } from '../operations/remove-box';
|
|
17
20
|
export declare class Selection {
|
|
18
21
|
private selection;
|
|
19
22
|
container: Nodes;
|
|
@@ -37,4 +40,7 @@ export declare class Selection {
|
|
|
37
40
|
removeMark(value?: Parameters<typeof removeMark>[1]): ReturnType<typeof removeMark>;
|
|
38
41
|
fixList(): ReturnType<typeof fixList>;
|
|
39
42
|
insertLink(value: Parameters<typeof insertLink>[1]): ReturnType<typeof insertLink>;
|
|
43
|
+
selectBox(box: Box | Nodes): void;
|
|
44
|
+
insertBox(boxName: Parameters<typeof insertBox>[1], boxValue?: Parameters<typeof insertBox>[2]): Box;
|
|
45
|
+
removeBox(box?: Box | Nodes | null): ReturnType<typeof removeBox>;
|
|
40
46
|
}
|
|
@@ -2,9 +2,8 @@ import EventEmitter from 'eventemitter3';
|
|
|
2
2
|
import type { Editor } from '../editor';
|
|
3
3
|
import { NativeNode } from '../types/native';
|
|
4
4
|
import { BoxType, BoxValue } from '../types/box';
|
|
5
|
+
import { BoxToolbarItem } from '../types/box-toolbar';
|
|
5
6
|
import { Nodes } from './nodes';
|
|
6
|
-
type CleanupFunction = () => void;
|
|
7
|
-
type SetupFunction = () => CleanupFunction | void;
|
|
8
7
|
export declare class Box {
|
|
9
8
|
node: Nodes;
|
|
10
9
|
event: EventEmitter;
|
|
@@ -20,9 +19,8 @@ export declare class Box {
|
|
|
20
19
|
setData(key: string, value: any): void;
|
|
21
20
|
getEditor(): Editor | undefined;
|
|
22
21
|
getContainer(): Nodes;
|
|
23
|
-
|
|
22
|
+
setToolbar(items: ('|' | BoxToolbarItem)[]): void;
|
|
24
23
|
render(): void;
|
|
25
24
|
unmount(): void;
|
|
26
25
|
getHTML(): string;
|
|
27
26
|
}
|
|
28
|
-
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Box } from '../models/box';
|
|
2
|
-
export declare
|
|
2
|
+
export declare function getInstanceMap(id: number): Map<number, Box>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Nodes } from '../models/nodes';
|
|
1
2
|
import type { Box } from '../models/box';
|
|
2
3
|
import { TranslationFunctions } from '../i18n/types';
|
|
3
4
|
import { DropdownItem } from './dropdown';
|
|
@@ -19,3 +20,11 @@ export type BoxToolbarDropdownItem = DropdownItem & {
|
|
|
19
20
|
onSelect: (box: Box, value: string) => void;
|
|
20
21
|
};
|
|
21
22
|
export type BoxToolbarItem = BoxToolbarButtonItem | BoxToolbarDropdownItem;
|
|
23
|
+
export type BoxToolbarPlacement = 'top' | 'bottom';
|
|
24
|
+
export type BoxToolbarConfig = {
|
|
25
|
+
root: Nodes;
|
|
26
|
+
box: Box;
|
|
27
|
+
items: ('|' | BoxToolbarItem)[];
|
|
28
|
+
locale?: TranslationFunctions;
|
|
29
|
+
placement?: BoxToolbarPlacement;
|
|
30
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Nodes } from '../models/nodes';
|
|
2
|
+
import { Box } from '../models/box';
|
|
3
|
+
type BoxResizerConfig = {
|
|
4
|
+
root: Nodes;
|
|
5
|
+
box: Box;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
onResize?: (width: number, height: number) => void;
|
|
9
|
+
onStop: (width: number, height: number) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare class BoxResizer {
|
|
12
|
+
private config;
|
|
13
|
+
private root;
|
|
14
|
+
private box;
|
|
15
|
+
constructor(config: BoxResizerConfig);
|
|
16
|
+
private bindEvents;
|
|
17
|
+
render(): void;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -1,26 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { NativeNode } from '../types/native';
|
|
3
|
-
import { BoxToolbarItem } from '../types/box-toolbar';
|
|
1
|
+
import { BoxToolbarConfig } from '../types/box-toolbar';
|
|
4
2
|
import { Nodes } from '../models/nodes';
|
|
5
|
-
import { Box } from '../models/box';
|
|
6
|
-
type ToolbarPlacement = 'top' | 'bottom';
|
|
7
|
-
type ToolbarConfig = {
|
|
8
|
-
root: string | Nodes | NativeNode;
|
|
9
|
-
editor: Editor;
|
|
10
|
-
box: Box;
|
|
11
|
-
items: (string | BoxToolbarItem)[];
|
|
12
|
-
placement?: ToolbarPlacement;
|
|
13
|
-
};
|
|
14
3
|
export declare class BoxToolbar {
|
|
15
4
|
private root;
|
|
16
|
-
private editor;
|
|
17
5
|
private box;
|
|
18
6
|
private items;
|
|
7
|
+
private locale;
|
|
19
8
|
private placement;
|
|
20
9
|
private buttonItemList;
|
|
21
10
|
private dropdownItemList;
|
|
22
11
|
container: Nodes;
|
|
23
|
-
constructor(config:
|
|
12
|
+
constructor(config: BoxToolbarConfig);
|
|
24
13
|
private appendDivider;
|
|
25
14
|
private appendButton;
|
|
26
15
|
private appendDropdown;
|
|
@@ -28,4 +17,3 @@ export declare class BoxToolbar {
|
|
|
28
17
|
render(): void;
|
|
29
18
|
unmount(): void;
|
|
30
19
|
}
|
|
31
|
-
export {};
|
package/lib/types/ui/button.d.ts
CHANGED