@jackuait/blok 0.1.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 +190 -0
- package/README.md +23 -0
- package/dist/blok.mjs +5 -0
- package/dist/blok.umd.js +53 -0
- package/dist/bundle-6e604287.mjs +340 -0
- package/dist/codex-7de6c88e.mjs +15668 -0
- package/dist/vendor.LICENSE.txt +545 -0
- package/package.json +108 -0
- package/types/api/block.d.ts +87 -0
- package/types/api/blocks.d.ts +136 -0
- package/types/api/caret.d.ts +67 -0
- package/types/api/events.d.ts +28 -0
- package/types/api/i18n.d.ts +11 -0
- package/types/api/index.d.ts +17 -0
- package/types/api/inline-toolbar.d.ts +15 -0
- package/types/api/listeners.d.ts +32 -0
- package/types/api/notifier.d.ts +14 -0
- package/types/api/readonly.d.ts +17 -0
- package/types/api/sanitizer.d.ts +14 -0
- package/types/api/saver.d.ts +13 -0
- package/types/api/selection.d.ts +41 -0
- package/types/api/styles.d.ts +44 -0
- package/types/api/toolbar.d.ts +26 -0
- package/types/api/tools.d.ts +11 -0
- package/types/api/tooltip.d.ts +30 -0
- package/types/api/ui.d.ts +24 -0
- package/types/block-tunes/block-tune-data.d.ts +1 -0
- package/types/block-tunes/block-tune.d.ts +60 -0
- package/types/block-tunes/index.d.ts +1 -0
- package/types/configs/conversion-config.ts +26 -0
- package/types/configs/editor-config.d.ts +107 -0
- package/types/configs/i18n-config.d.ts +16 -0
- package/types/configs/i18n-dictionary.d.ts +93 -0
- package/types/configs/index.d.ts +7 -0
- package/types/configs/log-levels.d.ts +9 -0
- package/types/configs/paste-config.d.ts +38 -0
- package/types/configs/sanitizer-config.d.ts +43 -0
- package/types/data-formats/block-data.d.ts +23 -0
- package/types/data-formats/block-id.ts +4 -0
- package/types/data-formats/index.d.ts +2 -0
- package/types/data-formats/output-data.d.ts +46 -0
- package/types/events/block/Base.ts +11 -0
- package/types/events/block/BlockAdded.ts +21 -0
- package/types/events/block/BlockChanged.ts +21 -0
- package/types/events/block/BlockMoved.ts +26 -0
- package/types/events/block/BlockRemoved.ts +21 -0
- package/types/events/block/index.ts +44 -0
- package/types/index.d.ts +191 -0
- package/types/tools/adapters/base-tool-adapter.d.ts +76 -0
- package/types/tools/adapters/block-tool-adapter.d.ts +78 -0
- package/types/tools/adapters/block-tune-adapter.d.ts +14 -0
- package/types/tools/adapters/inline-tool-adapter.d.ts +10 -0
- package/types/tools/adapters/tool-factory.d.ts +5 -0
- package/types/tools/adapters/tool-type.ts +18 -0
- package/types/tools/adapters/tools-collection.d.ts +34 -0
- package/types/tools/block-tool-data.d.ts +5 -0
- package/types/tools/block-tool.d.ts +121 -0
- package/types/tools/hook-events.d.ts +23 -0
- package/types/tools/index.d.ts +16 -0
- package/types/tools/inline-tool.d.ts +37 -0
- package/types/tools/menu-config.d.ts +46 -0
- package/types/tools/paste-events.d.ts +52 -0
- package/types/tools/tool-config.d.ts +4 -0
- package/types/tools/tool-settings.d.ts +79 -0
- package/types/tools/tool.d.ts +65 -0
- package/types/utils/popover/hint.d.ts +29 -0
- package/types/utils/popover/index.d.ts +5 -0
- package/types/utils/popover/popover-event.ts +15 -0
- package/types/utils/popover/popover-item-type.ts +13 -0
- package/types/utils/popover/popover-item.d.ts +253 -0
- package/types/utils/popover/popover.d.ts +112 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import {BlockToolData, ToolConfig, ToolboxConfigEntry} from '../tools';
|
|
2
|
+
import {SavedData} from '../data-formats';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @interface BlockAPI Describes Block API methods and properties
|
|
6
|
+
*/
|
|
7
|
+
export interface BlockAPI {
|
|
8
|
+
/**
|
|
9
|
+
* Block unique identifier
|
|
10
|
+
*/
|
|
11
|
+
readonly id: string;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Tool name
|
|
15
|
+
*/
|
|
16
|
+
readonly name: string;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Tool config passed on Editor's initialization
|
|
20
|
+
*/
|
|
21
|
+
readonly config: ToolConfig;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Wrapper of Tool's HTML element
|
|
25
|
+
*/
|
|
26
|
+
readonly holder: HTMLElement;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* True if Block content is empty
|
|
30
|
+
*/
|
|
31
|
+
readonly isEmpty: boolean;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* True if Block is selected with Cross-Block selection
|
|
35
|
+
*/
|
|
36
|
+
readonly selected: boolean;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* True if Block has inputs to be focused
|
|
40
|
+
*/
|
|
41
|
+
readonly focusable: boolean;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Setter sets Block's stretch state
|
|
45
|
+
*
|
|
46
|
+
* Getter returns true if Block is stretched
|
|
47
|
+
*/
|
|
48
|
+
stretched: boolean;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Call Tool method with errors handler under-the-hood
|
|
52
|
+
*
|
|
53
|
+
* @param {string} methodName - method to call
|
|
54
|
+
* @param {object} param - object with parameters
|
|
55
|
+
*
|
|
56
|
+
* @return {void}
|
|
57
|
+
*/
|
|
58
|
+
call(methodName: string, param?: object): void;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Save Block content
|
|
62
|
+
*
|
|
63
|
+
* @return {Promise<void|SavedData>}
|
|
64
|
+
*/
|
|
65
|
+
save(): Promise<void|SavedData>;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Validate Block data
|
|
69
|
+
*
|
|
70
|
+
* @param {BlockToolData} data
|
|
71
|
+
*
|
|
72
|
+
* @return {Promise<boolean>}
|
|
73
|
+
*/
|
|
74
|
+
validate(data: BlockToolData): Promise<boolean>;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Allows to say Editor that Block was changed. Used to manually trigger Editor's 'onChange' callback
|
|
78
|
+
* Can be useful for block changes invisible for editor core.
|
|
79
|
+
*/
|
|
80
|
+
dispatchChange(): void;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Tool could specify several entries to be displayed at the Toolbox (for example, "Heading 1", "Heading 2", "Heading 3")
|
|
84
|
+
* This method returns the entry that is related to the Block (depended on the Block data)
|
|
85
|
+
*/
|
|
86
|
+
getActiveToolboxEntry(): Promise<ToolboxConfigEntry | undefined>
|
|
87
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import {OutputBlockData, OutputData} from '../data-formats/output-data';
|
|
2
|
+
import {BlockToolData, ToolConfig} from '../tools';
|
|
3
|
+
import {BlockAPI} from './block';
|
|
4
|
+
import {BlockTuneData} from '../block-tunes/block-tune-data';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Describes methods to manipulate with Editor`s blocks
|
|
8
|
+
*/
|
|
9
|
+
export interface Blocks {
|
|
10
|
+
/**
|
|
11
|
+
* Remove all blocks from Editor zone
|
|
12
|
+
*/
|
|
13
|
+
clear(): Promise<void>;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Render passed data
|
|
17
|
+
*
|
|
18
|
+
* @param {OutputData} data - saved Block data
|
|
19
|
+
*
|
|
20
|
+
* @returns {Promise<void>}
|
|
21
|
+
*/
|
|
22
|
+
render(data: OutputData): Promise<void>;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Render passed HTML string
|
|
26
|
+
* @param {string} data
|
|
27
|
+
* @return {Promise<void>}
|
|
28
|
+
*/
|
|
29
|
+
renderFromHTML(data: string): Promise<void>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Removes current Block
|
|
33
|
+
* @param {number} index - index of a block to delete
|
|
34
|
+
*/
|
|
35
|
+
delete(index?: number): void;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Moves a block to a new index
|
|
39
|
+
* @param {number} toIndex - index where the block is moved to
|
|
40
|
+
* @param {number} fromIndex - block to move
|
|
41
|
+
*/
|
|
42
|
+
move(toIndex: number, fromIndex?: number): void;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Returns Block API object by passed Block index
|
|
46
|
+
* @param {number} index
|
|
47
|
+
*/
|
|
48
|
+
getBlockByIndex(index: number): BlockAPI | undefined;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Returns Block API object by passed Block id
|
|
52
|
+
* @param id - id of the block
|
|
53
|
+
*/
|
|
54
|
+
getById(id: string): BlockAPI | null;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Returns current Block index
|
|
58
|
+
* @returns {number}
|
|
59
|
+
*/
|
|
60
|
+
getCurrentBlockIndex(): number;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Returns the index of Block by id;
|
|
64
|
+
*/
|
|
65
|
+
getBlockIndex(blockId: string): number | undefined;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Get Block API object by html element
|
|
69
|
+
*
|
|
70
|
+
* @param element - html element to get Block by
|
|
71
|
+
*/
|
|
72
|
+
getBlockByElement(element: HTMLElement): BlockAPI | undefined;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Returns Blocks count
|
|
76
|
+
* @return {number}
|
|
77
|
+
*/
|
|
78
|
+
getBlocksCount(): number;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Insert new Block and return inserted Block API
|
|
82
|
+
*
|
|
83
|
+
* @param {string} type — Tool name
|
|
84
|
+
* @param {BlockToolData} data — Tool data to insert
|
|
85
|
+
* @param {ToolConfig} config — Tool config
|
|
86
|
+
* @param {number?} index — index where to insert new Block
|
|
87
|
+
* @param {boolean?} needToFocus - flag to focus inserted Block
|
|
88
|
+
* @param {boolean?} replace - should the existed Block on that index be replaced or not
|
|
89
|
+
* @param {string} id — An optional id for the new block. If omitted then the new id will be generated
|
|
90
|
+
*/
|
|
91
|
+
insert(
|
|
92
|
+
type?: string,
|
|
93
|
+
data?: BlockToolData,
|
|
94
|
+
config?: ToolConfig,
|
|
95
|
+
index?: number,
|
|
96
|
+
needToFocus?: boolean,
|
|
97
|
+
replace?: boolean,
|
|
98
|
+
id?: string,
|
|
99
|
+
): BlockAPI;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Inserts several Blocks to specified index
|
|
103
|
+
*/
|
|
104
|
+
insertMany(
|
|
105
|
+
blocks: OutputBlockData[],
|
|
106
|
+
index?: number,
|
|
107
|
+
): BlockAPI[];
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Creates data of an empty block with a passed type.
|
|
112
|
+
*
|
|
113
|
+
* @param toolName - block tool name
|
|
114
|
+
*/
|
|
115
|
+
composeBlockData(toolName: string): Promise<BlockToolData>
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Updates block data by id
|
|
119
|
+
*
|
|
120
|
+
* @param id - id of the block to update
|
|
121
|
+
* @param data - (optional) the new data. Can be partial.
|
|
122
|
+
* @param tunes - (optional) tune data
|
|
123
|
+
*/
|
|
124
|
+
update(id: string, data?: Partial<BlockToolData>, tunes?: {[name: string]: BlockTuneData}): Promise<BlockAPI>;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Converts block to another type. Both blocks should provide the conversionConfig.
|
|
128
|
+
*
|
|
129
|
+
* @param id - id of the existed block to convert. Should provide 'conversionConfig.export' method
|
|
130
|
+
* @param newType - new block type. Should provide 'conversionConfig.import' method
|
|
131
|
+
* @param dataOverrides - optional data overrides for the new block
|
|
132
|
+
*
|
|
133
|
+
* @throws Error if conversion is not possible
|
|
134
|
+
*/
|
|
135
|
+
convert(id: string, newType: string, dataOverrides?: BlockToolData): Promise<BlockAPI>;
|
|
136
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { BlockAPI } from "./block";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Describes Editor`s caret API
|
|
5
|
+
*/
|
|
6
|
+
export interface Caret {
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Sets caret to the first Block
|
|
10
|
+
*
|
|
11
|
+
* @param {string} position - position where to set caret
|
|
12
|
+
* @param {number} offset - caret offset
|
|
13
|
+
*
|
|
14
|
+
* @return {boolean}
|
|
15
|
+
*/
|
|
16
|
+
setToFirstBlock(position?: 'end'|'start'|'default', offset?: number): boolean;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Sets caret to the last Block
|
|
20
|
+
*
|
|
21
|
+
* @param {string} position - position where to set caret
|
|
22
|
+
* @param {number} offset - caret offset
|
|
23
|
+
*
|
|
24
|
+
* @return {boolean}
|
|
25
|
+
*/
|
|
26
|
+
setToLastBlock(position?: 'end'|'start'|'default', offset?: number): boolean;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Sets caret to the previous Block
|
|
30
|
+
*
|
|
31
|
+
* @param {string} position - position where to set caret
|
|
32
|
+
* @param {number} offset - caret offset
|
|
33
|
+
*
|
|
34
|
+
* @return {boolean}
|
|
35
|
+
*/
|
|
36
|
+
setToPreviousBlock(position?: 'end'|'start'|'default', offset?: number): boolean;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Sets caret to the next Block
|
|
40
|
+
*
|
|
41
|
+
* @param {string} position - position where to set caret
|
|
42
|
+
* @param {number} offset - caret offset
|
|
43
|
+
*
|
|
44
|
+
* @return {boolean}
|
|
45
|
+
*/
|
|
46
|
+
setToNextBlock(position?: 'end'|'start'|'default', offset?: number): boolean;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Sets caret to the Block by passed index
|
|
50
|
+
*
|
|
51
|
+
* @param blockOrIdOrIndex - BlockAPI or Block id or Block index
|
|
52
|
+
* @param position - position where to set caret
|
|
53
|
+
* @param offset - caret offset
|
|
54
|
+
*
|
|
55
|
+
* @return {boolean}
|
|
56
|
+
*/
|
|
57
|
+
setToBlock(blockOrIdOrIndex: BlockAPI | BlockAPI['id'] | number, position?: 'end'|'start'|'default', offset?: number): boolean;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Sets caret to the Editor
|
|
61
|
+
*
|
|
62
|
+
* @param {boolean} atEnd - if true, set Caret to the end of the Editor
|
|
63
|
+
*
|
|
64
|
+
* @return {boolean}
|
|
65
|
+
*/
|
|
66
|
+
focus(atEnd?: boolean): boolean;
|
|
67
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Describes Editor`s events API
|
|
3
|
+
*/
|
|
4
|
+
export interface Events {
|
|
5
|
+
/**
|
|
6
|
+
* Emits event
|
|
7
|
+
*
|
|
8
|
+
* @param {string} eventName
|
|
9
|
+
* @param {any} data
|
|
10
|
+
*/
|
|
11
|
+
emit(eventName: string, data: any): void;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Unsubscribe from event
|
|
15
|
+
*
|
|
16
|
+
* @param {string} eventName
|
|
17
|
+
* @param {(data: any) => void} callback
|
|
18
|
+
*/
|
|
19
|
+
off(eventName: string, callback: (data?: any) => void): void;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Subscribe to event
|
|
23
|
+
*
|
|
24
|
+
* @param {string} eventName
|
|
25
|
+
* @param {(data: any) => void} callback
|
|
26
|
+
*/
|
|
27
|
+
on(eventName: string, callback: (data?: any) => void): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Describes Editor`s I18n API
|
|
3
|
+
*/
|
|
4
|
+
export interface I18n {
|
|
5
|
+
/**
|
|
6
|
+
* Perform translation with automatically added namespace like `tools.${toolName}` or `blockTunes.${tuneName}`
|
|
7
|
+
*
|
|
8
|
+
* @param dictKey - what to translate
|
|
9
|
+
*/
|
|
10
|
+
t(dictKey: string): string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from './blocks';
|
|
2
|
+
export * from './events';
|
|
3
|
+
export * from './listeners';
|
|
4
|
+
export * from './sanitizer';
|
|
5
|
+
export * from './saver';
|
|
6
|
+
export * from './selection';
|
|
7
|
+
export * from './styles';
|
|
8
|
+
export * from './caret';
|
|
9
|
+
export * from './toolbar';
|
|
10
|
+
export * from './notifier';
|
|
11
|
+
export * from './tooltip';
|
|
12
|
+
export * from './inline-toolbar';
|
|
13
|
+
export * from './block';
|
|
14
|
+
export * from './readonly';
|
|
15
|
+
export * from './i18n';
|
|
16
|
+
export * from './ui';
|
|
17
|
+
export * from './tools';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Describes Editor`s listeners API
|
|
3
|
+
*/
|
|
4
|
+
export interface Listeners {
|
|
5
|
+
/**
|
|
6
|
+
* Subscribe to event dispatched on passed element. Returns listener id.
|
|
7
|
+
*
|
|
8
|
+
* @param {Element} element
|
|
9
|
+
* @param {string} eventType
|
|
10
|
+
* @param {(event: Event) => void}handler
|
|
11
|
+
* @param {boolean} useCapture
|
|
12
|
+
*/
|
|
13
|
+
on(element: Element, eventType: string, handler: (event?: Event) => void, useCapture?: boolean): string | undefined;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Unsubscribe from event dispatched on passed element
|
|
17
|
+
*
|
|
18
|
+
* @param {Element} element
|
|
19
|
+
* @param {string} eventType
|
|
20
|
+
* @param {(event: Event) => void}handler
|
|
21
|
+
* @param {boolean} useCapture
|
|
22
|
+
*/
|
|
23
|
+
off(element: Element, eventType: string, handler: (event?: Event) => void, useCapture?: boolean): void;
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Unsubscribe from event dispatched by the listener id
|
|
28
|
+
*
|
|
29
|
+
* @param id - id of the listener to remove
|
|
30
|
+
*/
|
|
31
|
+
offById(id: string): void;
|
|
32
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {ConfirmNotifierOptions, NotifierOptions, PromptNotifierOptions} from 'codex-notifier';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Notifier API
|
|
5
|
+
*/
|
|
6
|
+
export interface Notifier {
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Show web notification
|
|
10
|
+
*
|
|
11
|
+
* @param {NotifierOptions | ConfirmNotifierOptions | PromptNotifierOptions}
|
|
12
|
+
*/
|
|
13
|
+
show: (options: NotifierOptions | ConfirmNotifierOptions | PromptNotifierOptions) => void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ReadOnly API
|
|
3
|
+
*/
|
|
4
|
+
export interface ReadOnly {
|
|
5
|
+
/**
|
|
6
|
+
* Set or toggle read-only state
|
|
7
|
+
*
|
|
8
|
+
* @param {Boolean|undefined} state - set or toggle state
|
|
9
|
+
* @returns {Promise<boolean>} current value
|
|
10
|
+
*/
|
|
11
|
+
toggle: (state?: boolean) => Promise<boolean>;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Contains current read-only state
|
|
15
|
+
*/
|
|
16
|
+
isEnabled: boolean;
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {SanitizerConfig} from '../index';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Describes Editor`s sanitizer API
|
|
5
|
+
*/
|
|
6
|
+
export interface Sanitizer {
|
|
7
|
+
/**
|
|
8
|
+
* Clean taint string with html and returns clean string
|
|
9
|
+
*
|
|
10
|
+
* @param {string} taintString
|
|
11
|
+
* @param {SanitizerConfig} config - configuration for sanitizer
|
|
12
|
+
*/
|
|
13
|
+
clean(taintString: string, config: SanitizerConfig): string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {OutputData} from '../data-formats/output-data';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Describes Editor`s saver API
|
|
5
|
+
*/
|
|
6
|
+
export interface Saver {
|
|
7
|
+
/**
|
|
8
|
+
* Saves Editors data and returns promise with it
|
|
9
|
+
*
|
|
10
|
+
* @returns {Promise<OutputData>}
|
|
11
|
+
*/
|
|
12
|
+
save(): Promise<OutputData>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Describes methods for work with Selections
|
|
3
|
+
*/
|
|
4
|
+
export interface Selection {
|
|
5
|
+
/**
|
|
6
|
+
* Looks ahead from selection and find passed tag with class name
|
|
7
|
+
* @param {string} tagName - tag to find
|
|
8
|
+
* @param {string} className - tag's class name
|
|
9
|
+
* @return {HTMLElement|null}
|
|
10
|
+
*/
|
|
11
|
+
findParentTag(tagName: string, className?: string): HTMLElement|null;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Expand selection to passed tag
|
|
15
|
+
* @param {HTMLElement} node - tag that should contain selection
|
|
16
|
+
*/
|
|
17
|
+
expandToTag(node: HTMLElement): void;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Sets fake background.
|
|
21
|
+
* Allows to imitate selection while focus moved away
|
|
22
|
+
*/
|
|
23
|
+
setFakeBackground(): void;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Removes fake background
|
|
27
|
+
*/
|
|
28
|
+
removeFakeBackground(): void;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Save selection range.
|
|
32
|
+
* Allows to save selection to be able to temporally move focus away.
|
|
33
|
+
* Might be useful for inline tools
|
|
34
|
+
*/
|
|
35
|
+
save(): void;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Restore saved selection range
|
|
39
|
+
*/
|
|
40
|
+
restore(): void;
|
|
41
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Describes styles API
|
|
3
|
+
*/
|
|
4
|
+
export interface Styles {
|
|
5
|
+
/**
|
|
6
|
+
* Main Editor`s block styles
|
|
7
|
+
*/
|
|
8
|
+
block: string;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Styles for Inline Toolbar button
|
|
12
|
+
*/
|
|
13
|
+
inlineToolButton: string;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Styles for active Inline Toolbar button
|
|
17
|
+
*/
|
|
18
|
+
inlineToolButtonActive: string;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Styles for inputs
|
|
22
|
+
*/
|
|
23
|
+
input: string;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Loader styles
|
|
27
|
+
*/
|
|
28
|
+
loader: string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Styles for Settings box buttons
|
|
32
|
+
*/
|
|
33
|
+
settingsButton: string;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Styles for active Settings box buttons
|
|
37
|
+
*/
|
|
38
|
+
settingsButtonActive: string;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Styles for buttons
|
|
42
|
+
*/
|
|
43
|
+
button: string;
|
|
44
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Describes Toolbar API methods
|
|
3
|
+
*/
|
|
4
|
+
export interface Toolbar {
|
|
5
|
+
/**
|
|
6
|
+
* Closes Toolbar
|
|
7
|
+
*/
|
|
8
|
+
close(): void;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Opens Toolbar
|
|
12
|
+
*/
|
|
13
|
+
open(): void;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Toggles Block Setting of the current block
|
|
17
|
+
* @param {boolean} openingState — opening state of Block Setting
|
|
18
|
+
*/
|
|
19
|
+
toggleBlockSettings(openingState?: boolean): void;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Toggle toolbox
|
|
23
|
+
* @param {boolean} openingState — opening state of the toolbox
|
|
24
|
+
*/
|
|
25
|
+
toggleToolbox(openingState?: boolean): void;
|
|
26
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BlockToolAdapter } from '../tools/adapters/block-tool-adapter';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Describes methods for accessing installed Editor tools
|
|
5
|
+
*/
|
|
6
|
+
export interface Tools {
|
|
7
|
+
/**
|
|
8
|
+
* Returns all available Block Tools
|
|
9
|
+
*/
|
|
10
|
+
getBlockTools(): BlockToolAdapter[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tooltip API
|
|
3
|
+
*/
|
|
4
|
+
import {TooltipContent, TooltipOptions} from '../../src/components/utils/tooltip';
|
|
5
|
+
|
|
6
|
+
export interface Tooltip {
|
|
7
|
+
/**
|
|
8
|
+
* Show tooltip
|
|
9
|
+
*
|
|
10
|
+
* @param {HTMLElement} element
|
|
11
|
+
* @param {TooltipContent} content
|
|
12
|
+
* @param {TooltipOptions} options
|
|
13
|
+
*/
|
|
14
|
+
show: (element: HTMLElement, content: TooltipContent, options?: TooltipOptions) => void;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Hides tooltip
|
|
18
|
+
*/
|
|
19
|
+
hide: () => void;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Decorator for showing Tooltip by mouseenter/mouseleave
|
|
23
|
+
*
|
|
24
|
+
* @param {HTMLElement} element
|
|
25
|
+
* @param {TooltipContent} content
|
|
26
|
+
* @param {TooltipOptions} options
|
|
27
|
+
*/
|
|
28
|
+
onHover: (element: HTMLElement, content: TooltipContent, options?: TooltipOptions) => void;
|
|
29
|
+
|
|
30
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Describes API module allowing to access some Editor UI elements and methods
|
|
3
|
+
*/
|
|
4
|
+
export interface Ui {
|
|
5
|
+
/**
|
|
6
|
+
* Allows accessing some Editor UI elements
|
|
7
|
+
*/
|
|
8
|
+
nodes: UiNodes,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Allows accessing some Editor UI elements
|
|
13
|
+
*/
|
|
14
|
+
export interface UiNodes {
|
|
15
|
+
/**
|
|
16
|
+
* Top-level editor instance wrapper
|
|
17
|
+
*/
|
|
18
|
+
wrapper: HTMLElement,
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Element that holds all the Blocks
|
|
22
|
+
*/
|
|
23
|
+
redactor: HTMLElement,
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type BlockTuneData = any;
|