lakelib 0.0.1
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/LICENSE +21 -0
- package/README.md +32 -0
- package/dist/codemirror.min.js +1 -0
- package/dist/lake-all.css +1328 -0
- package/dist/lake-all.min.js +84 -0
- package/dist/lake.css +907 -0
- package/dist/lake.min.js +75 -0
- package/lib/lake.css +907 -0
- package/lib/lake.js +8315 -0
- package/lib/types/boxes/code-block.d.ts +2 -0
- package/lib/types/boxes/hr.d.ts +2 -0
- package/lib/types/boxes/image.d.ts +3 -0
- package/lib/types/codemirror.d.ts +8 -0
- package/lib/types/config/element-rules.d.ts +1 -0
- package/lib/types/config/menu-items.d.ts +9 -0
- package/lib/types/config/tag-names.d.ts +6 -0
- package/lib/types/config/toolbar-items.d.ts +2 -0
- package/lib/types/css/index.d.ts +15 -0
- package/lib/types/editor.d.ts +73 -0
- package/lib/types/elements/bookmark.d.ts +2 -0
- package/lib/types/elements/box.d.ts +2 -0
- package/lib/types/icons/index.d.ts +1 -0
- package/lib/types/index.d.ts +29 -0
- package/lib/types/managers/box-manager.d.ts +13 -0
- package/lib/types/managers/command.d.ts +11 -0
- package/lib/types/managers/history.d.ts +26 -0
- package/lib/types/managers/keystroke.d.ts +12 -0
- package/lib/types/managers/plugin.d.ts +9 -0
- package/lib/types/managers/selection.d.ts +41 -0
- package/lib/types/models/box.d.ts +28 -0
- package/lib/types/models/fragment.d.ts +7 -0
- package/lib/types/models/nodes.d.ts +96 -0
- package/lib/types/models/range.d.ts +53 -0
- package/lib/types/operations/add-mark.d.ts +3 -0
- package/lib/types/operations/delete-contents.d.ts +2 -0
- package/lib/types/operations/fix-list.d.ts +2 -0
- package/lib/types/operations/insert-bookmark.d.ts +6 -0
- package/lib/types/operations/insert-box.d.ts +4 -0
- package/lib/types/operations/insert-contents.d.ts +2 -0
- package/lib/types/operations/insert-fragment.d.ts +2 -0
- package/lib/types/operations/insert-link.d.ts +3 -0
- package/lib/types/operations/insert-node.d.ts +4 -0
- package/lib/types/operations/remove-box.d.ts +3 -0
- package/lib/types/operations/remove-mark.d.ts +2 -0
- package/lib/types/operations/set-blocks.d.ts +3 -0
- package/lib/types/operations/split-block.d.ts +3 -0
- package/lib/types/operations/split-marks.d.ts +3 -0
- package/lib/types/operations/to-bookmark.d.ts +6 -0
- package/lib/types/parsers/html-parser.d.ts +14 -0
- package/lib/types/parsers/text-parser.d.ts +6 -0
- package/lib/types/plugins/align.d.ts +3 -0
- package/lib/types/plugins/arrow-keys.d.ts +3 -0
- package/lib/types/plugins/backspace-key.d.ts +3 -0
- package/lib/types/plugins/block-quote.d.ts +3 -0
- package/lib/types/plugins/bold.d.ts +3 -0
- package/lib/types/plugins/code-block.d.ts +3 -0
- package/lib/types/plugins/code.d.ts +3 -0
- package/lib/types/plugins/copy.d.ts +3 -0
- package/lib/types/plugins/cut.d.ts +3 -0
- package/lib/types/plugins/delete-key.d.ts +3 -0
- package/lib/types/plugins/enter-key.d.ts +3 -0
- package/lib/types/plugins/font-color.d.ts +3 -0
- package/lib/types/plugins/font-family.d.ts +3 -0
- package/lib/types/plugins/font-size.d.ts +3 -0
- package/lib/types/plugins/format-painter.d.ts +3 -0
- package/lib/types/plugins/heading.d.ts +3 -0
- package/lib/types/plugins/highlight.d.ts +3 -0
- package/lib/types/plugins/hr.d.ts +3 -0
- package/lib/types/plugins/image.d.ts +3 -0
- package/lib/types/plugins/indent.d.ts +3 -0
- package/lib/types/plugins/italic.d.ts +3 -0
- package/lib/types/plugins/link.d.ts +3 -0
- package/lib/types/plugins/list.d.ts +3 -0
- package/lib/types/plugins/markdown.d.ts +3 -0
- package/lib/types/plugins/paste.d.ts +3 -0
- package/lib/types/plugins/redo.d.ts +3 -0
- package/lib/types/plugins/remove-format.d.ts +3 -0
- package/lib/types/plugins/select-all.d.ts +3 -0
- package/lib/types/plugins/shift-enter-key.d.ts +3 -0
- package/lib/types/plugins/strikethrough.d.ts +3 -0
- package/lib/types/plugins/subscript.d.ts +3 -0
- package/lib/types/plugins/superscript.d.ts +3 -0
- package/lib/types/plugins/tab-key.d.ts +3 -0
- package/lib/types/plugins/underline.d.ts +3 -0
- package/lib/types/plugins/undo.d.ts +3 -0
- package/lib/types/plugins/unlink.d.ts +3 -0
- package/lib/types/storage/box-instances.d.ts +2 -0
- package/lib/types/storage/boxes.d.ts +2 -0
- package/lib/types/storage/editors.d.ts +2 -0
- package/lib/types/types/box.d.ts +15 -0
- package/lib/types/types/native.d.ts +33 -0
- package/lib/types/types/node.d.ts +1 -0
- package/lib/types/types/object.d.ts +21 -0
- package/lib/types/types/request.d.ts +20 -0
- package/lib/types/types/toolbar.d.ts +40 -0
- package/lib/types/ui/link-popup.d.ts +16 -0
- package/lib/types/ui/toolbar.d.ts +30 -0
- package/lib/types/ui/upload.d.ts +10 -0
- package/lib/types/utils/append-deepest.d.ts +2 -0
- package/lib/types/utils/camel-case.d.ts +1 -0
- package/lib/types/utils/change-tag-name.d.ts +2 -0
- package/lib/types/utils/debug.d.ts +1 -0
- package/lib/types/utils/denormalize-value.d.ts +1 -0
- package/lib/types/utils/encode.d.ts +1 -0
- package/lib/types/utils/fix-numbered-list.d.ts +2 -0
- package/lib/types/utils/for-each.d.ts +5 -0
- package/lib/types/utils/get-css.d.ts +1 -0
- package/lib/types/utils/get-deepest.d.ts +2 -0
- package/lib/types/utils/in-string.d.ts +1 -0
- package/lib/types/utils/index.d.ts +26 -0
- package/lib/types/utils/merge-nodes.d.ts +5 -0
- package/lib/types/utils/morph.d.ts +56 -0
- package/lib/types/utils/normalize-value.d.ts +1 -0
- package/lib/types/utils/parse-style.d.ts +2 -0
- package/lib/types/utils/query.d.ts +3 -0
- package/lib/types/utils/remove-br.d.ts +2 -0
- package/lib/types/utils/remove-zws.d.ts +2 -0
- package/lib/types/utils/request.d.ts +27 -0
- package/lib/types/utils/safe-template.d.ts +1 -0
- package/lib/types/utils/set-block-indent.d.ts +2 -0
- package/lib/types/utils/split-nodes.d.ts +5 -0
- package/lib/types/utils/template.d.ts +1 -0
- package/lib/types/utils/to-hex.d.ts +1 -0
- package/lib/types/utils/to-node-list.d.ts +2 -0
- package/lib/types/utils/wrap-node-list.d.ts +2 -0
- package/package.json +81 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getElementRules(): any;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ToolbarMenuItem } from '../types/toolbar';
|
|
2
|
+
export declare const headingMenuItems: ToolbarMenuItem[];
|
|
3
|
+
export declare const listMenuItems: ToolbarMenuItem[];
|
|
4
|
+
export declare const alignMenuItems: ToolbarMenuItem[];
|
|
5
|
+
export declare const indentMenuItems: ToolbarMenuItem[];
|
|
6
|
+
export declare const fontFamilyMenuItems: ToolbarMenuItem[];
|
|
7
|
+
export declare const fontSizeMenuItems: ToolbarMenuItem[];
|
|
8
|
+
export declare const moreStyleMenuItems: ToolbarMenuItem[];
|
|
9
|
+
export declare const colorMenuItems: ToolbarMenuItem[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const blockTagNames: Set<string>;
|
|
2
|
+
export declare const markTagNames: Set<string>;
|
|
3
|
+
export declare const voidTagNames: Set<string>;
|
|
4
|
+
export declare const headingTagNames: Set<string>;
|
|
5
|
+
export declare const listTagNames: Set<string>;
|
|
6
|
+
export declare const tableTagNames: Set<string>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import './custom-properties.css';
|
|
2
|
+
import './core.css';
|
|
3
|
+
import './mark.css';
|
|
4
|
+
import './format-painter.css';
|
|
5
|
+
import './heading.css';
|
|
6
|
+
import './list.css';
|
|
7
|
+
import './block-quote.css';
|
|
8
|
+
import './table.css';
|
|
9
|
+
import './box.css';
|
|
10
|
+
import './hr.css';
|
|
11
|
+
import './image.css';
|
|
12
|
+
import './code-block.css';
|
|
13
|
+
import './popup.css';
|
|
14
|
+
import './link-popup.css';
|
|
15
|
+
import './toolbar.css';
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import EventEmitter from 'eventemitter3';
|
|
2
|
+
import { NativeNode } from './types/native';
|
|
3
|
+
import { UploadRequestMethod } from './types/request';
|
|
4
|
+
import { Nodes } from './models/nodes';
|
|
5
|
+
import { insertBox } from './operations/insert-box';
|
|
6
|
+
import { removeBox } from './operations/remove-box';
|
|
7
|
+
import { Selection } from './managers/selection';
|
|
8
|
+
import { Command } from './managers/command';
|
|
9
|
+
import { History } from './managers/history';
|
|
10
|
+
import { Keystroke } from './managers/keystroke';
|
|
11
|
+
import { BoxManager } from './managers/box-manager';
|
|
12
|
+
import { Plugin } from './managers/plugin';
|
|
13
|
+
type EditorConfig = {
|
|
14
|
+
root: string | Nodes | NativeNode;
|
|
15
|
+
value?: string;
|
|
16
|
+
readonly?: boolean;
|
|
17
|
+
spellcheck?: boolean;
|
|
18
|
+
minChangeSize?: number;
|
|
19
|
+
imageRequestMethod?: UploadRequestMethod;
|
|
20
|
+
imageRequestAction?: string;
|
|
21
|
+
imageRequestTypes?: string[];
|
|
22
|
+
};
|
|
23
|
+
declare const defaultConfig: {
|
|
24
|
+
value: string;
|
|
25
|
+
readonly: boolean;
|
|
26
|
+
spellcheck: boolean;
|
|
27
|
+
minChangeSize: number;
|
|
28
|
+
imageRequestMethod: UploadRequestMethod;
|
|
29
|
+
imageRequestAction: string;
|
|
30
|
+
imageRequestTypes: string[];
|
|
31
|
+
};
|
|
32
|
+
export declare class Editor {
|
|
33
|
+
static version: string;
|
|
34
|
+
static box: BoxManager;
|
|
35
|
+
static plugin: Plugin;
|
|
36
|
+
private unsavedInputData;
|
|
37
|
+
private beforeunloadListener;
|
|
38
|
+
private selectionchangeListener;
|
|
39
|
+
private clickListener;
|
|
40
|
+
private mouseoverListener;
|
|
41
|
+
private resizeListener;
|
|
42
|
+
root: Nodes;
|
|
43
|
+
config: typeof defaultConfig;
|
|
44
|
+
containerWrapper: Nodes;
|
|
45
|
+
container: Nodes;
|
|
46
|
+
overlayContainer: Nodes;
|
|
47
|
+
popupContainer: Nodes;
|
|
48
|
+
isComposing: boolean;
|
|
49
|
+
readonly: boolean;
|
|
50
|
+
event: EventEmitter;
|
|
51
|
+
selection: Selection;
|
|
52
|
+
command: Command;
|
|
53
|
+
history: History;
|
|
54
|
+
keystroke: Keystroke;
|
|
55
|
+
box: BoxManager;
|
|
56
|
+
constructor(config: EditorConfig);
|
|
57
|
+
private inputInBoxStrip;
|
|
58
|
+
private bindInputEvents;
|
|
59
|
+
private bindHistoryEvents;
|
|
60
|
+
commitUnsavedInputData(): void;
|
|
61
|
+
prepareOperation(): void;
|
|
62
|
+
commitOperation(): void;
|
|
63
|
+
focus(): void;
|
|
64
|
+
blur(): void;
|
|
65
|
+
setValue(value: string): void;
|
|
66
|
+
getValue(): string;
|
|
67
|
+
insertBox(boxName: Parameters<typeof insertBox>[1], boxValue?: Parameters<typeof insertBox>[2]): ReturnType<typeof insertBox>;
|
|
68
|
+
removeBox(): ReturnType<typeof removeBox>;
|
|
69
|
+
innerWidth(): number;
|
|
70
|
+
render(): void;
|
|
71
|
+
unmount(): void;
|
|
72
|
+
}
|
|
73
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const icons: Map<string, string>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import './css';
|
|
2
|
+
import './elements/box';
|
|
3
|
+
import './elements/bookmark';
|
|
4
|
+
import { BoxComponent } from './types/box';
|
|
5
|
+
import { ToolbarItem, ToolbarMenuItem } from './types/toolbar';
|
|
6
|
+
import { icons } from './icons';
|
|
7
|
+
import * as Utils from './utils';
|
|
8
|
+
import { Nodes } from './models/nodes';
|
|
9
|
+
import { Fragment } from './models/fragment';
|
|
10
|
+
import { Range } from './models/range';
|
|
11
|
+
import { Box } from './models/box';
|
|
12
|
+
import { HTMLParser } from './parsers/html-parser';
|
|
13
|
+
import { TextParser } from './parsers/text-parser';
|
|
14
|
+
import { insertBookmark } from './operations/insert-bookmark';
|
|
15
|
+
import { toBookmark } from './operations/to-bookmark';
|
|
16
|
+
import { insertNode } from './operations/insert-node';
|
|
17
|
+
import { insertFragment } from './operations/insert-fragment';
|
|
18
|
+
import { insertContents } from './operations/insert-contents';
|
|
19
|
+
import { deleteContents } from './operations/delete-contents';
|
|
20
|
+
import { setBlocks } from './operations/set-blocks';
|
|
21
|
+
import { splitBlock } from './operations/split-block';
|
|
22
|
+
import { splitMarks } from './operations/split-marks';
|
|
23
|
+
import { addMark } from './operations/add-mark';
|
|
24
|
+
import { removeMark } from './operations/remove-mark';
|
|
25
|
+
import { fixList } from './operations/fix-list';
|
|
26
|
+
import { insertLink } from './operations/insert-link';
|
|
27
|
+
import { Editor } from './editor';
|
|
28
|
+
import { Toolbar } from './ui/toolbar';
|
|
29
|
+
export { Editor, Toolbar, ToolbarItem, ToolbarMenuItem, BoxComponent, icons, Utils, Nodes, Fragment, Range, Box, HTMLParser, TextParser, insertBookmark, toBookmark, insertNode, insertFragment, insertContents, deleteContents, setBlocks, splitBlock, splitMarks, addMark, removeMark, fixList, insertLink, };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Editor } from '../editor';
|
|
2
|
+
import { BoxComponent } from '../types/box';
|
|
3
|
+
import { Nodes } from '../models/nodes';
|
|
4
|
+
import { Box } from '../models/box';
|
|
5
|
+
export declare class BoxManager {
|
|
6
|
+
add(component: BoxComponent): void;
|
|
7
|
+
remove(name: string): void;
|
|
8
|
+
getNames(): string[];
|
|
9
|
+
getInstances(editor: Editor): Map<number, Box>;
|
|
10
|
+
rectifyInstances(editor: Editor): void;
|
|
11
|
+
findAll(editor: Editor): Nodes;
|
|
12
|
+
renderAll(editor: Editor): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import EventEmitter from 'eventemitter3';
|
|
2
|
+
type CommandHandler = (...data: any[]) => void;
|
|
3
|
+
export declare class Command {
|
|
4
|
+
private commandMap;
|
|
5
|
+
event: EventEmitter;
|
|
6
|
+
constructor();
|
|
7
|
+
add(name: string, handler: CommandHandler): void;
|
|
8
|
+
getNames(): string[];
|
|
9
|
+
execute(name: string, ...data: any[]): void;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import EventEmitter from 'eventemitter3';
|
|
2
|
+
import { Selection } from './selection';
|
|
3
|
+
export declare class History {
|
|
4
|
+
private selection;
|
|
5
|
+
private container;
|
|
6
|
+
private list;
|
|
7
|
+
private index;
|
|
8
|
+
private canSave;
|
|
9
|
+
limit: number;
|
|
10
|
+
event: EventEmitter;
|
|
11
|
+
constructor(selection: Selection);
|
|
12
|
+
private removeBookmark;
|
|
13
|
+
private getValue;
|
|
14
|
+
private addIdToBoxes;
|
|
15
|
+
private removeIdfromBoxes;
|
|
16
|
+
private morphContainer;
|
|
17
|
+
private cloneContainer;
|
|
18
|
+
get count(): number;
|
|
19
|
+
get canUndo(): boolean;
|
|
20
|
+
get canRedo(): boolean;
|
|
21
|
+
undo(): void;
|
|
22
|
+
redo(): void;
|
|
23
|
+
continue(): void;
|
|
24
|
+
pause(): void;
|
|
25
|
+
save(): void;
|
|
26
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Nodes } from '../models/nodes';
|
|
2
|
+
export declare class Keystroke {
|
|
3
|
+
private container;
|
|
4
|
+
private keydownEventList;
|
|
5
|
+
private keyupEventList;
|
|
6
|
+
constructor(container: Nodes);
|
|
7
|
+
private normalizeType;
|
|
8
|
+
setKeydown(type: string, listener: EventListener): void;
|
|
9
|
+
setKeyup(type: string, listener: EventListener): void;
|
|
10
|
+
keydown(type: string): void;
|
|
11
|
+
keyup(type: string): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AppliedItem } from '../types/object';
|
|
2
|
+
import { Nodes } from '../models/nodes';
|
|
3
|
+
import { Range } from '../models/range';
|
|
4
|
+
import { insertBookmark } from '../operations/insert-bookmark';
|
|
5
|
+
import { toBookmark } from '../operations/to-bookmark';
|
|
6
|
+
import { insertNode } from '../operations/insert-node';
|
|
7
|
+
import { insertFragment } from '../operations/insert-fragment';
|
|
8
|
+
import { insertContents } from '../operations/insert-contents';
|
|
9
|
+
import { deleteContents } from '../operations/delete-contents';
|
|
10
|
+
import { setBlocks } from '../operations/set-blocks';
|
|
11
|
+
import { splitBlock } from '../operations/split-block';
|
|
12
|
+
import { splitMarks } from '../operations/split-marks';
|
|
13
|
+
import { addMark } from '../operations/add-mark';
|
|
14
|
+
import { removeMark } from '../operations/remove-mark';
|
|
15
|
+
import { fixList } from '../operations/fix-list';
|
|
16
|
+
import { insertLink } from '../operations/insert-link';
|
|
17
|
+
export declare class Selection {
|
|
18
|
+
private selection;
|
|
19
|
+
container: Nodes;
|
|
20
|
+
range: Range;
|
|
21
|
+
appliedItems: AppliedItem[];
|
|
22
|
+
constructor(container: Nodes);
|
|
23
|
+
private getRangeFromNativeSelection;
|
|
24
|
+
addRangeToNativeSelection(): void;
|
|
25
|
+
syncByRange(): void;
|
|
26
|
+
synByBookmark(): void;
|
|
27
|
+
getAppliedItems(): AppliedItem[];
|
|
28
|
+
insertBookmark(): ReturnType<typeof insertBookmark>;
|
|
29
|
+
toBookmark(bookmark: Parameters<typeof toBookmark>[1]): ReturnType<typeof toBookmark>;
|
|
30
|
+
insertNode(node: Parameters<typeof insertNode>[1]): ReturnType<typeof insertNode>;
|
|
31
|
+
insertFragment(fragment: Parameters<typeof insertFragment>[1]): ReturnType<typeof insertFragment>;
|
|
32
|
+
insertContents(value: Parameters<typeof insertContents>[1]): ReturnType<typeof insertContents>;
|
|
33
|
+
deleteContents(): ReturnType<typeof deleteContents>;
|
|
34
|
+
setBlocks(value: Parameters<typeof setBlocks>[1]): ReturnType<typeof setBlocks>;
|
|
35
|
+
splitBlock(): ReturnType<typeof splitBlock>;
|
|
36
|
+
splitMarks(removeEmptyMark?: Parameters<typeof splitMarks>[1]): ReturnType<typeof splitMarks>;
|
|
37
|
+
addMark(value: Parameters<typeof addMark>[1]): ReturnType<typeof addMark>;
|
|
38
|
+
removeMark(value?: Parameters<typeof removeMark>[1]): ReturnType<typeof removeMark>;
|
|
39
|
+
fixList(): ReturnType<typeof fixList>;
|
|
40
|
+
insertLink(value: Parameters<typeof insertLink>[1]): ReturnType<typeof insertLink>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import EventEmitter from 'eventemitter3';
|
|
2
|
+
import type { Editor } from '../editor';
|
|
3
|
+
import { NativeNode } from '../types/native';
|
|
4
|
+
import { BoxType, BoxValue } from '../types/box';
|
|
5
|
+
import { Nodes } from './nodes';
|
|
6
|
+
type CleanupFunction = () => void;
|
|
7
|
+
type SetupFunction = () => CleanupFunction | void;
|
|
8
|
+
export declare class Box {
|
|
9
|
+
node: Nodes;
|
|
10
|
+
event: EventEmitter;
|
|
11
|
+
constructor(node: string | Nodes | NativeNode);
|
|
12
|
+
private addFramework;
|
|
13
|
+
get type(): BoxType;
|
|
14
|
+
get name(): string;
|
|
15
|
+
get value(): BoxValue;
|
|
16
|
+
set value(value: BoxValue);
|
|
17
|
+
updateValue(valueKey: string, valueValue: string): void;
|
|
18
|
+
updateValue(valueKey: BoxValue): void;
|
|
19
|
+
getData(key: string): any;
|
|
20
|
+
setData(key: string, value: any): void;
|
|
21
|
+
getEditor(): Editor | undefined;
|
|
22
|
+
getContainer(): Nodes;
|
|
23
|
+
useEffect(setup: SetupFunction): void;
|
|
24
|
+
render(): void;
|
|
25
|
+
unmount(): void;
|
|
26
|
+
getHTML(): string;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { KeyValue } from '../types/object';
|
|
2
|
+
import { NativeNode } from '../types/native';
|
|
3
|
+
import { NodePath } from '../types/node';
|
|
4
|
+
type EachCallback = (element: NativeNode, index: number) => boolean | void;
|
|
5
|
+
type EachElementCallback = (element: Element, index: number) => boolean | void;
|
|
6
|
+
type EventItem = {
|
|
7
|
+
type: string;
|
|
8
|
+
listener: EventListener;
|
|
9
|
+
};
|
|
10
|
+
export declare class Nodes {
|
|
11
|
+
private nodeList;
|
|
12
|
+
length: number;
|
|
13
|
+
constructor(node?: NativeNode | NativeNode[] | null);
|
|
14
|
+
get id(): number;
|
|
15
|
+
get name(): string;
|
|
16
|
+
get isElement(): boolean;
|
|
17
|
+
get isText(): boolean;
|
|
18
|
+
get isBlock(): boolean;
|
|
19
|
+
get isMark(): boolean;
|
|
20
|
+
get isVoid(): boolean;
|
|
21
|
+
get isHeading(): boolean;
|
|
22
|
+
get isList(): boolean;
|
|
23
|
+
get isTable(): boolean;
|
|
24
|
+
get isBookmark(): boolean;
|
|
25
|
+
get isBox(): boolean;
|
|
26
|
+
get isInlineBox(): boolean;
|
|
27
|
+
get isBlockBox(): boolean;
|
|
28
|
+
get isContainer(): boolean;
|
|
29
|
+
get isOutside(): boolean;
|
|
30
|
+
get isInside(): boolean;
|
|
31
|
+
get isTopInside(): boolean;
|
|
32
|
+
get isContentEditable(): boolean;
|
|
33
|
+
get isIndivisible(): boolean;
|
|
34
|
+
get isEmpty(): boolean;
|
|
35
|
+
isSibling(target: Nodes): boolean;
|
|
36
|
+
get(index: number): NativeNode;
|
|
37
|
+
getAll(): NativeNode[];
|
|
38
|
+
eq(index: number): Nodes;
|
|
39
|
+
each(callback: EachCallback): this;
|
|
40
|
+
eachElement(callback: EachElementCallback): this;
|
|
41
|
+
reverse(): Nodes;
|
|
42
|
+
matches(selector: string): boolean;
|
|
43
|
+
find(selector: string | NodePath): Nodes;
|
|
44
|
+
closest(selector: string): Nodes;
|
|
45
|
+
closestBlock(): Nodes;
|
|
46
|
+
closestOperableBlock(): Nodes;
|
|
47
|
+
closestContainer(): Nodes;
|
|
48
|
+
parent(): Nodes;
|
|
49
|
+
prev(): Nodes;
|
|
50
|
+
next(): Nodes;
|
|
51
|
+
first(): Nodes;
|
|
52
|
+
last(): Nodes;
|
|
53
|
+
index(): number;
|
|
54
|
+
path(): NodePath;
|
|
55
|
+
children(): Nodes[];
|
|
56
|
+
getWalker(): Generator<Nodes>;
|
|
57
|
+
on(type: string, listener: EventListener): this;
|
|
58
|
+
off(type?: string, listener?: EventListener): this;
|
|
59
|
+
emit(type: string, event?: Event): this;
|
|
60
|
+
getEventListeners(index: number): EventItem[];
|
|
61
|
+
focus(): this;
|
|
62
|
+
blur(): this;
|
|
63
|
+
clone(deep?: boolean): Nodes;
|
|
64
|
+
hasAttr(attributeName: string): boolean;
|
|
65
|
+
attr(attributeName: string): string;
|
|
66
|
+
attr(attributeName: string, value: string): this;
|
|
67
|
+
attr(attributeName: KeyValue): this;
|
|
68
|
+
removeAttr(attributeName: string): this;
|
|
69
|
+
hasClass(className: string): boolean;
|
|
70
|
+
addClass(className: string | string[]): this;
|
|
71
|
+
removeClass(className: string | string[]): this;
|
|
72
|
+
computedCSS(propertyName: string): string;
|
|
73
|
+
css(propertyName: string): string;
|
|
74
|
+
css(propertyName: KeyValue): this;
|
|
75
|
+
css(propertyName: string, value: string): this;
|
|
76
|
+
width(): number;
|
|
77
|
+
height(): number;
|
|
78
|
+
show(displayType?: string): this;
|
|
79
|
+
hide(): this;
|
|
80
|
+
html(): string;
|
|
81
|
+
html(value: string): this;
|
|
82
|
+
text(): string;
|
|
83
|
+
text(value: string): this;
|
|
84
|
+
outerHTML(): string;
|
|
85
|
+
empty(): this;
|
|
86
|
+
prepend(content: string | NativeNode | DocumentFragment | Nodes): this;
|
|
87
|
+
append(content: string | NativeNode | DocumentFragment | Nodes): this;
|
|
88
|
+
before(content: string | NativeNode | DocumentFragment | Nodes): this;
|
|
89
|
+
after(content: string | NativeNode | DocumentFragment | Nodes): this;
|
|
90
|
+
replaceWith(newContent: string | NativeNode | Nodes): this;
|
|
91
|
+
remove(keepChildren?: boolean): this;
|
|
92
|
+
splitText(offset: number): Nodes;
|
|
93
|
+
toString(): string;
|
|
94
|
+
debug(): void;
|
|
95
|
+
}
|
|
96
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { NativeRange } from '../types/native';
|
|
2
|
+
import { Nodes } from './nodes';
|
|
3
|
+
export declare class Range {
|
|
4
|
+
private range;
|
|
5
|
+
constructor(range?: NativeRange);
|
|
6
|
+
get startNode(): Nodes;
|
|
7
|
+
get startOffset(): number;
|
|
8
|
+
get endNode(): Nodes;
|
|
9
|
+
get endOffset(): number;
|
|
10
|
+
get commonAncestor(): Nodes;
|
|
11
|
+
get isCollapsed(): boolean;
|
|
12
|
+
get isBox(): boolean;
|
|
13
|
+
get isBoxLeft(): boolean;
|
|
14
|
+
get isBoxCenter(): boolean;
|
|
15
|
+
get isBoxRight(): boolean;
|
|
16
|
+
get isInsideBox(): boolean;
|
|
17
|
+
get isInoperative(): boolean;
|
|
18
|
+
get(): NativeRange;
|
|
19
|
+
comparePoint(node: Nodes, offset: number): number;
|
|
20
|
+
compareBeforeNode(node: Nodes): number;
|
|
21
|
+
compareAfterNode(node: Nodes): number;
|
|
22
|
+
intersectsNode(node: Nodes): boolean;
|
|
23
|
+
setStart(node: Nodes, offset: number): void;
|
|
24
|
+
setStartBefore(node: Nodes): void;
|
|
25
|
+
setStartAfter(node: Nodes): void;
|
|
26
|
+
setEnd(node: Nodes, offset: number): void;
|
|
27
|
+
setEndBefore(node: Nodes): void;
|
|
28
|
+
setEndAfter(node: Nodes): void;
|
|
29
|
+
collapseToStart(): void;
|
|
30
|
+
collapseToEnd(): void;
|
|
31
|
+
selectNode(node: Nodes): void;
|
|
32
|
+
selectNodeContents(node: Nodes): void;
|
|
33
|
+
selectBox(boxNode: Nodes): void;
|
|
34
|
+
selectBoxLeft(boxNode: Nodes): void;
|
|
35
|
+
selectBoxRight(boxNode: Nodes): void;
|
|
36
|
+
shrinkBefore(node: Nodes): void;
|
|
37
|
+
shrinkAfter(node: Nodes): void;
|
|
38
|
+
shrink(): void;
|
|
39
|
+
adaptBox(): void;
|
|
40
|
+
adaptTable(): void;
|
|
41
|
+
adaptBlock(): void;
|
|
42
|
+
adapt(): void;
|
|
43
|
+
getPrevNode(): Nodes;
|
|
44
|
+
getNextNode(): Nodes;
|
|
45
|
+
getBoxes(): Nodes[];
|
|
46
|
+
getBlocks(): Nodes[];
|
|
47
|
+
getMarks(hasText?: boolean): Nodes[];
|
|
48
|
+
getLeftText(): string;
|
|
49
|
+
getRightText(): string;
|
|
50
|
+
clone(): Range;
|
|
51
|
+
cloneContents(): DocumentFragment;
|
|
52
|
+
debug(): void;
|
|
53
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Nodes } from '../models/nodes';
|
|
2
|
+
export declare class HTMLParser {
|
|
3
|
+
private rules;
|
|
4
|
+
private source;
|
|
5
|
+
constructor(content: string | Nodes, rules?: any);
|
|
6
|
+
private parseHTML;
|
|
7
|
+
private static matchRule;
|
|
8
|
+
private static getOpenTagString;
|
|
9
|
+
private static getClosedTagString;
|
|
10
|
+
private static getTrimmedText;
|
|
11
|
+
getHTML(): string;
|
|
12
|
+
getNodeList(): Nodes[];
|
|
13
|
+
getFragment(): DocumentFragment;
|
|
14
|
+
}
|