lakelib 0.2.6 → 0.3.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/README.md +3 -3
- package/dist/lake.css +377 -363
- package/dist/lake.min.js +40 -40
- package/dist/lake.min.js.map +1 -1
- package/lib/css/index.d.ts +0 -11
- package/lib/i18n/en-US/index.d.ts +24 -0
- package/lib/i18n/ja/index.d.ts +24 -0
- package/lib/i18n/ko/index.d.ts +24 -0
- package/lib/i18n/types.d.ts +182 -2
- package/lib/i18n/zh-CN/index.d.ts +24 -0
- package/lib/index.d.ts +8 -8
- package/lib/lake.css +126 -112
- package/lib/lake.js +5674 -4655
- package/lib/lake.js.map +1 -1
- package/lib/managers/command.d.ts +4 -4
- package/lib/managers/selection.d.ts +6 -10
- package/lib/operations/insert-block.d.ts +3 -0
- package/lib/operations/insert-contents.d.ts +4 -0
- package/lib/operations/split-block.d.ts +1 -1
- package/lib/operations/split-marks.d.ts +1 -1
- package/lib/plugins/align.d.ts +1 -1
- package/lib/plugins/arrow-keys.d.ts +1 -1
- package/lib/plugins/backspace-key.d.ts +1 -1
- package/lib/plugins/block-quote.d.ts +1 -1
- package/lib/plugins/bold.d.ts +1 -1
- package/lib/plugins/code-block/code-block-box.d.ts +4 -0
- package/lib/plugins/code-block/index.d.ts +5 -0
- package/lib/plugins/code.d.ts +1 -1
- package/lib/plugins/copy.d.ts +1 -1
- package/lib/plugins/cut.d.ts +1 -1
- package/lib/plugins/delete-key.d.ts +1 -1
- package/lib/plugins/drop.d.ts +1 -1
- package/lib/plugins/emoji/emoji-box.d.ts +4 -0
- package/lib/plugins/emoji/index.d.ts +5 -0
- package/lib/plugins/enter-key.d.ts +1 -1
- package/lib/plugins/equation/equation-box.d.ts +4 -0
- package/lib/plugins/equation/index.d.ts +5 -0
- package/lib/plugins/escape-key.d.ts +1 -1
- package/lib/plugins/file/file-box.d.ts +4 -0
- package/lib/plugins/file/index.d.ts +5 -0
- package/lib/plugins/font-color.d.ts +1 -1
- package/lib/plugins/font-family.d.ts +1 -1
- package/lib/plugins/font-size.d.ts +1 -1
- package/lib/plugins/format-painter.d.ts +1 -1
- package/lib/plugins/heading.d.ts +1 -1
- package/lib/plugins/highlight.d.ts +1 -1
- package/lib/plugins/hr/hr-box.d.ts +4 -0
- package/lib/plugins/hr/index.d.ts +5 -0
- package/lib/{boxes/image.d.ts → plugins/image/image-box.d.ts} +2 -1
- package/lib/plugins/image/index.d.ts +5 -0
- package/lib/plugins/indent.d.ts +1 -1
- package/lib/plugins/italic.d.ts +1 -1
- package/lib/plugins/{link.d.ts → link/index.d.ts} +1 -1
- package/lib/plugins/link/insert-link.d.ts +3 -0
- package/lib/{ui → plugins/link}/link-popup.d.ts +3 -2
- package/lib/plugins/list.d.ts +1 -1
- package/lib/plugins/markdown.d.ts +1 -1
- package/lib/plugins/mention/index.d.ts +5 -0
- package/lib/plugins/mention/mention-box.d.ts +4 -0
- package/lib/{ui → plugins/mention}/mention-menu.d.ts +4 -3
- package/lib/plugins/paste.d.ts +1 -1
- package/lib/plugins/redo.d.ts +1 -1
- package/lib/plugins/remove-format.d.ts +1 -1
- package/lib/plugins/select-all.d.ts +1 -1
- package/lib/plugins/shift-enter-key.d.ts +1 -1
- package/lib/plugins/{mention.d.ts → slash/index.d.ts} +1 -1
- package/lib/{config → plugins/slash}/slash-items.d.ts +1 -1
- package/lib/{ui → plugins/slash}/slash-menu.d.ts +5 -4
- package/lib/{types/slash.d.ts → plugins/slash/types.d.ts} +2 -2
- package/lib/plugins/special-character.d.ts +1 -1
- package/lib/plugins/strikethrough.d.ts +1 -1
- package/lib/plugins/subscript.d.ts +1 -1
- package/lib/plugins/superscript.d.ts +1 -1
- package/lib/plugins/tab-key.d.ts +1 -1
- package/lib/plugins/table/delete-column.d.ts +2 -0
- package/lib/plugins/table/delete-row.d.ts +2 -0
- package/lib/plugins/table/delete-table.d.ts +2 -0
- package/lib/plugins/{slash.d.ts → table/index.d.ts} +2 -1
- package/lib/plugins/table/insert-column.d.ts +4 -0
- package/lib/plugins/table/insert-row.d.ts +4 -0
- package/lib/plugins/table/insert-table.d.ts +3 -0
- package/lib/plugins/table/merge-cells.d.ts +3 -0
- package/lib/plugins/table/split-cell.d.ts +3 -0
- package/lib/plugins/table/utils.d.ts +6 -0
- package/lib/plugins/underline.d.ts +1 -1
- package/lib/plugins/undo.d.ts +1 -1
- package/lib/plugins/unlink.d.ts +1 -1
- package/lib/plugins/video/index.d.ts +5 -0
- package/lib/plugins/video/video-box.d.ts +4 -0
- package/lib/storage/editors.d.ts +1 -1
- package/lib/types/dropdown.d.ts +1 -0
- package/lib/types/native.d.ts +0 -8
- package/lib/types/node.d.ts +12 -0
- package/lib/types/object.d.ts +0 -24
- package/lib/types/selection.d.ts +14 -0
- package/lib/types/toolbar.d.ts +5 -5
- package/lib/ui/toolbar.d.ts +2 -2
- package/lib/utils/indent-block.d.ts +2 -0
- package/lib/utils/remove-empty-marks.d.ts +2 -0
- package/lib/utils/unsafe-template.d.ts +1 -0
- package/lib/utils/visible-info.d.ts +10 -0
- package/package.json +14 -13
- package/lib/boxes/code-block.d.ts +0 -3
- package/lib/boxes/emoji.d.ts +0 -3
- package/lib/boxes/equation.d.ts +0 -3
- package/lib/boxes/file.d.ts +0 -3
- package/lib/boxes/hr.d.ts +0 -3
- package/lib/boxes/mention.d.ts +0 -3
- package/lib/boxes/video.d.ts +0 -3
- package/lib/operations/fix-list.d.ts +0 -2
- package/lib/operations/insert-fragment.d.ts +0 -3
- package/lib/operations/insert-link.d.ts +0 -3
- package/lib/operations/insert-node.d.ts +0 -3
- package/lib/plugins/code-block.d.ts +0 -3
- package/lib/plugins/emoji.d.ts +0 -3
- package/lib/plugins/equation.d.ts +0 -3
- package/lib/plugins/file.d.ts +0 -3
- package/lib/plugins/hr.d.ts +0 -3
- package/lib/plugins/image.d.ts +0 -3
- package/lib/plugins/video.d.ts +0 -3
- package/lib/utils/index.d.ts +0 -33
- package/lib/utils/is-visible.d.ts +0 -8
- package/lib/utils/safe-template.d.ts +0 -1
- package/lib/utils/set-block-indent.d.ts +0 -2
- /package/lib/{types/mention.d.ts → plugins/mention/types.d.ts} +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { KeyValue } from './object';
|
|
2
|
+
import type { Nodes } from '../models/nodes';
|
|
3
|
+
export type ActiveItem = {
|
|
4
|
+
node: Nodes;
|
|
5
|
+
name: string;
|
|
6
|
+
attributes: KeyValue;
|
|
7
|
+
styles: KeyValue;
|
|
8
|
+
};
|
|
9
|
+
export type SelectionState = {
|
|
10
|
+
activeItems: ActiveItem[];
|
|
11
|
+
disabledNameMap?: Map<string, boolean>;
|
|
12
|
+
selectedNameMap?: Map<string, boolean>;
|
|
13
|
+
selectedValuesMap?: Map<string, string[]>;
|
|
14
|
+
};
|
package/lib/types/toolbar.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import type { Editor } from '../editor';
|
|
2
2
|
import { TranslationFunctions } from '../i18n/types';
|
|
3
3
|
import { DropdownItem } from './dropdown';
|
|
4
|
-
import {
|
|
4
|
+
import { ActiveItem } from './selection';
|
|
5
5
|
export type ToolbarButtonItem = {
|
|
6
6
|
name: string;
|
|
7
7
|
type: 'button';
|
|
8
8
|
icon?: string;
|
|
9
9
|
tooltip: string | ((locale: TranslationFunctions) => string);
|
|
10
|
-
isSelected?: (
|
|
11
|
-
isDisabled?: (
|
|
10
|
+
isSelected?: (activeItems: ActiveItem[]) => boolean;
|
|
11
|
+
isDisabled?: (activeItems: ActiveItem[]) => boolean;
|
|
12
12
|
onClick: (editor: Editor, value: string) => void;
|
|
13
13
|
};
|
|
14
14
|
export type ToolbarDropdownItem = DropdownItem & {
|
|
15
15
|
name: string;
|
|
16
16
|
type: 'dropdown';
|
|
17
|
-
selectedValues?: (
|
|
18
|
-
isDisabled?: (
|
|
17
|
+
selectedValues?: (activeItems: ActiveItem[]) => string[];
|
|
18
|
+
isDisabled?: (activeItems: ActiveItem[]) => boolean;
|
|
19
19
|
onSelect: (editor: Editor, value: string) => void;
|
|
20
20
|
};
|
|
21
21
|
export type ToolbarUploadItem = {
|
package/lib/ui/toolbar.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Editor } from '../editor';
|
|
2
|
-
import { SelectionState } from '../types/
|
|
2
|
+
import { SelectionState } from '../types/selection';
|
|
3
3
|
import { ToolbarItem } from '../types/toolbar';
|
|
4
4
|
import { Nodes } from '../models/nodes';
|
|
5
5
|
type ToolbarPlacement = 'top' | 'bottom';
|
|
@@ -22,7 +22,7 @@ export declare class Toolbar {
|
|
|
22
22
|
private appendNormalButton;
|
|
23
23
|
private appendDropdown;
|
|
24
24
|
private appendUploadButton;
|
|
25
|
-
updateState(state
|
|
25
|
+
updateState(state?: SelectionState): void;
|
|
26
26
|
render(editor: Editor): void;
|
|
27
27
|
unmount(): void;
|
|
28
28
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function unsafeTemplate(strings: TemplateStringsArray, ...keys: any[]): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Nodes } from '../models/nodes';
|
|
2
|
+
import { Range } from '../models/range';
|
|
3
|
+
type VisibleType = -1 | 0 | 1;
|
|
4
|
+
export declare function visibleInfo(target: Nodes | Range): {
|
|
5
|
+
left: VisibleType;
|
|
6
|
+
right: VisibleType;
|
|
7
|
+
top: VisibleType;
|
|
8
|
+
bottom: VisibleType;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lakelib",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Lake is a browser-based rich text editor designed for creating content like blogs, comments, and emails.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rich text",
|
|
@@ -37,41 +37,42 @@
|
|
|
37
37
|
"typesafe-i18n": "^5.26.2"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
+
"@rollup/plugin-alias": "^5.1.1",
|
|
40
41
|
"@rollup/plugin-commonjs": "^28.0.1",
|
|
41
42
|
"@rollup/plugin-json": "^6.1.0",
|
|
42
43
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
43
44
|
"@rollup/plugin-terser": "^0.4.4",
|
|
44
45
|
"@rollup/plugin-typescript": "^12.1.1",
|
|
45
|
-
"@types/chai": "^
|
|
46
|
-
"@types/mocha": "^10.0.
|
|
46
|
+
"@types/chai": "^5.0.1",
|
|
47
|
+
"@types/mocha": "^10.0.10",
|
|
47
48
|
"@types/sinon": "^17.0.3",
|
|
48
49
|
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
49
50
|
"@typescript-eslint/parser": "^7.18.0",
|
|
50
|
-
"chai": "^
|
|
51
|
+
"chai": "^5.1.2",
|
|
51
52
|
"conventional-changelog-cli": "^5.0.0",
|
|
52
53
|
"eslint": "^8.57.1",
|
|
53
54
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
54
55
|
"eslint-config-prettier": "^9.1.0",
|
|
55
|
-
"execa": "^9.
|
|
56
|
+
"execa": "^9.5.1",
|
|
56
57
|
"express": "^4.21.1",
|
|
57
58
|
"katex": "^0.16.11",
|
|
58
59
|
"lake-codemirror": "^2.0.0",
|
|
59
|
-
"mocha": "^10.
|
|
60
|
+
"mocha": "^10.8.2",
|
|
60
61
|
"multer": "1.4.5-lts.1",
|
|
61
|
-
"npm-run-all2": "^7.0.
|
|
62
|
+
"npm-run-all2": "^7.0.1",
|
|
62
63
|
"picocolors": "^1.1.1",
|
|
63
64
|
"prompts": "^2.4.2",
|
|
64
|
-
"puppeteer": "^23.
|
|
65
|
+
"puppeteer": "^23.10.0",
|
|
65
66
|
"rimraf": "^6.0.1",
|
|
66
|
-
"rollup": "^4.
|
|
67
|
-
"rollup-plugin-import-css": "^3.5.
|
|
67
|
+
"rollup": "^4.28.0",
|
|
68
|
+
"rollup-plugin-import-css": "^3.5.7",
|
|
68
69
|
"rollup-plugin-svg-import": "^3.0.0",
|
|
69
70
|
"semver": "^7.6.3",
|
|
70
71
|
"simple-git-hooks": "^2.11.1",
|
|
71
72
|
"sinon": "^19.0.2",
|
|
72
|
-
"sort-package-json": "^2.
|
|
73
|
-
"tslib": "^2.8.
|
|
74
|
-
"typescript": "^5.
|
|
73
|
+
"sort-package-json": "^2.12.0",
|
|
74
|
+
"tslib": "^2.8.1",
|
|
75
|
+
"typescript": "^5.7.2",
|
|
75
76
|
"wait-on": "^8.0.1"
|
|
76
77
|
},
|
|
77
78
|
"scripts": {
|
package/lib/boxes/emoji.d.ts
DELETED
package/lib/boxes/equation.d.ts
DELETED
package/lib/boxes/file.d.ts
DELETED
package/lib/boxes/hr.d.ts
DELETED
package/lib/boxes/mention.d.ts
DELETED
package/lib/boxes/video.d.ts
DELETED
package/lib/plugins/emoji.d.ts
DELETED
package/lib/plugins/file.d.ts
DELETED
package/lib/plugins/hr.d.ts
DELETED
package/lib/plugins/image.d.ts
DELETED
package/lib/plugins/video.d.ts
DELETED
package/lib/utils/index.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export * from './template';
|
|
2
|
-
export * from './safe-template';
|
|
3
|
-
export * from './camel-case';
|
|
4
|
-
export * from './in-string';
|
|
5
|
-
export * from './encode';
|
|
6
|
-
export * from './to-base64';
|
|
7
|
-
export * from './from-base64';
|
|
8
|
-
export * from './to-hex';
|
|
9
|
-
export * from './parse-style';
|
|
10
|
-
export * from './normalize-value';
|
|
11
|
-
export * from './denormalize-value';
|
|
12
|
-
export * from './modifier-text';
|
|
13
|
-
export * from './file-size';
|
|
14
|
-
export * from './get-css';
|
|
15
|
-
export * from './to-node-list';
|
|
16
|
-
export * from './query';
|
|
17
|
-
export * from './split-nodes';
|
|
18
|
-
export * from './merge-nodes';
|
|
19
|
-
export * from './wrap-node-list';
|
|
20
|
-
export * from './get-deep-element';
|
|
21
|
-
export * from './remove-zws';
|
|
22
|
-
export * from './change-tag-name';
|
|
23
|
-
export * from './fix-numbered-list';
|
|
24
|
-
export * from './append-break';
|
|
25
|
-
export * from './remove-break';
|
|
26
|
-
export * from './set-block-indent';
|
|
27
|
-
export * from './morph';
|
|
28
|
-
export * from './is-visible';
|
|
29
|
-
export * from './scroll-to-node';
|
|
30
|
-
export * from './get-box';
|
|
31
|
-
export * from './request';
|
|
32
|
-
export * from './upload-file';
|
|
33
|
-
export * from './debug';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function safeTemplate(strings: TemplateStringsArray, ...keys: any[]): string;
|
|
File without changes
|