lakelib 0.1.2 → 0.1.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/lake.css +20 -16
- package/dist/lake.min.js +22 -22
- package/dist/lake.min.js.map +1 -1
- package/lib/lake.css +20 -16
- package/lib/lake.js +1353 -1330
- package/lib/lake.js.map +1 -1
- package/lib/types/editor.d.ts +4 -0
- package/lib/types/i18n/index.d.ts +2 -2
- package/lib/types/types/dropdown.d.ts +3 -2
- package/lib/types/types/toolbar.d.ts +3 -2
- package/lib/types/ui/dropdown.d.ts +4 -1
- package/lib/types/ui/link-popup.d.ts +8 -1
- package/package.json +1 -1
package/lib/types/editor.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import EventEmitter from 'eventemitter3';
|
|
2
2
|
import { NativeNode } from './types/native';
|
|
3
|
+
import { TranslationFunctions } from './i18n/types';
|
|
3
4
|
import { Nodes } from './models/nodes';
|
|
4
5
|
import { Box } from './models/box';
|
|
5
6
|
import { insertBox } from './operations/insert-box';
|
|
@@ -17,6 +18,7 @@ type Config = {
|
|
|
17
18
|
spellcheck: boolean;
|
|
18
19
|
tabIndex: number;
|
|
19
20
|
indentWithTab: boolean;
|
|
21
|
+
lang: string;
|
|
20
22
|
minChangeSize: number;
|
|
21
23
|
[name: string]: any;
|
|
22
24
|
};
|
|
@@ -28,6 +30,7 @@ type EditorConfig = {
|
|
|
28
30
|
spellcheck?: boolean;
|
|
29
31
|
tabIndex?: number;
|
|
30
32
|
indentWithTab?: boolean;
|
|
33
|
+
lang?: string;
|
|
31
34
|
minChangeSize?: number;
|
|
32
35
|
[name: string]: any;
|
|
33
36
|
};
|
|
@@ -64,6 +67,7 @@ export declare class Editor {
|
|
|
64
67
|
private bindInputEvents;
|
|
65
68
|
private bindHistoryEvents;
|
|
66
69
|
private bindFocusEvents;
|
|
70
|
+
get locale(): TranslationFunctions;
|
|
67
71
|
rectifyContent(): void;
|
|
68
72
|
commitUnsavedInputData(): void;
|
|
69
73
|
prepareOperation(): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { TranslationFunctions } from './types';
|
|
2
|
-
export declare const locale: TranslationFunctions;
|
|
1
|
+
import type { Locales, TranslationFunctions } from './types';
|
|
2
|
+
export declare const i18nObject: (locale: Locales) => TranslationFunctions;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { TranslationFunctions } from '../i18n/types';
|
|
1
2
|
export type DropdownMenuItem = {
|
|
2
3
|
value: string;
|
|
3
4
|
icon?: string;
|
|
4
|
-
text: string;
|
|
5
|
+
text: string | ((locale: TranslationFunctions) => string);
|
|
5
6
|
};
|
|
6
7
|
export type DropdownItem = {
|
|
7
8
|
name: string;
|
|
@@ -9,7 +10,7 @@ export type DropdownItem = {
|
|
|
9
10
|
accentIcon?: string;
|
|
10
11
|
downIcon?: string;
|
|
11
12
|
defaultValue: string;
|
|
12
|
-
tooltip: string;
|
|
13
|
+
tooltip: string | ((locale: TranslationFunctions) => string);
|
|
13
14
|
width: string;
|
|
14
15
|
menuType: 'list' | 'color';
|
|
15
16
|
menuItems: DropdownMenuItem[];
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { Editor } from '../editor';
|
|
2
|
+
import { TranslationFunctions } from '../i18n/types';
|
|
2
3
|
import { DropdownItem } from './dropdown';
|
|
3
4
|
import { AppliedItem } from './object';
|
|
4
5
|
export type ToolbarButtonItem = {
|
|
5
6
|
name: string;
|
|
6
7
|
type: 'button';
|
|
7
8
|
icon?: string;
|
|
8
|
-
tooltip: string;
|
|
9
|
+
tooltip: string | ((locale: TranslationFunctions) => string);
|
|
9
10
|
isSelected?: (appliedItems: AppliedItem[]) => boolean;
|
|
10
11
|
isDisabled?: (AppliedItems: AppliedItem[]) => boolean;
|
|
11
12
|
onClick: (editor: Editor, value: string) => void;
|
|
@@ -21,7 +22,7 @@ export type ToolbarUploadItem = {
|
|
|
21
22
|
name: string;
|
|
22
23
|
type: 'upload';
|
|
23
24
|
icon?: string;
|
|
24
|
-
tooltip: string;
|
|
25
|
+
tooltip: string | ((locale: TranslationFunctions) => string);
|
|
25
26
|
accept?: string;
|
|
26
27
|
multiple?: boolean;
|
|
27
28
|
};
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
+
import { TranslationFunctions } from '../i18n/types';
|
|
1
2
|
import { DropdownItem, DropdownMenuItem } from '../types/dropdown';
|
|
2
3
|
import { Nodes } from '../models/nodes';
|
|
3
4
|
export type DropdownConfig = DropdownItem & {
|
|
4
5
|
root: Nodes;
|
|
6
|
+
locale?: TranslationFunctions;
|
|
5
7
|
tabIndex?: number;
|
|
6
8
|
onSelect: (value: string) => void;
|
|
7
9
|
};
|
|
8
10
|
export declare class Dropdown {
|
|
9
11
|
private config;
|
|
10
12
|
private root;
|
|
13
|
+
private locale;
|
|
11
14
|
node: Nodes;
|
|
12
15
|
constructor(config: DropdownConfig);
|
|
13
16
|
static getValue(node: Nodes): string[];
|
|
14
17
|
static setValue(node: Nodes, value: string[]): void;
|
|
15
|
-
static getMenuMap(menuItems: DropdownMenuItem[]): Map<string, string>;
|
|
18
|
+
static getMenuMap(menuItems: DropdownMenuItem[], locale: TranslationFunctions): Map<string, string>;
|
|
16
19
|
private updateColorAccent;
|
|
17
20
|
private apppendMenuItems;
|
|
18
21
|
private documentClickListener;
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import EventEmitter from 'eventemitter3';
|
|
2
|
+
import { TranslationFunctions } from '../i18n/types';
|
|
2
3
|
import { Nodes } from '../models/nodes';
|
|
4
|
+
type LinkPopupConfig = {
|
|
5
|
+
root: Nodes;
|
|
6
|
+
locale?: TranslationFunctions;
|
|
7
|
+
};
|
|
3
8
|
export declare class LinkPopup {
|
|
4
9
|
private linkNode;
|
|
5
10
|
private root;
|
|
11
|
+
private locale;
|
|
6
12
|
container: Nodes;
|
|
7
13
|
event: EventEmitter;
|
|
8
|
-
constructor(
|
|
14
|
+
constructor(config: LinkPopupConfig);
|
|
9
15
|
private writeClipboardText;
|
|
10
16
|
private appendCopyButton;
|
|
11
17
|
private appendOpenButton;
|
|
@@ -19,3 +25,4 @@ export declare class LinkPopup {
|
|
|
19
25
|
show(linkNode: Nodes): void;
|
|
20
26
|
hide(): void;
|
|
21
27
|
}
|
|
28
|
+
export {};
|