@ebl-vue/editorjs 2.31.8
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 +244 -0
- package/dist/editorjs.mjs +11242 -0
- package/dist/editorjs.umd.js +51 -0
- package/dist/vendor.LICENSE.txt +462 -0
- package/package.json +80 -0
- package/types/api/block.d.ts +87 -0
- package/types/api/blocks.d.ts +160 -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 +70 -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 +118 -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 +190 -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 +15 -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 +66 -0
- package/types/tools/menu-config.d.ts +54 -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 +91 -0
- package/types/tools/tool.d.ts +60 -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 +248 -0
- package/types/utils/popover/popover.d.ts +101 -0
|
@@ -0,0 +1,160 @@
|
|
|
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
|
+
* Swaps two Blocks
|
|
39
|
+
* @param {number} fromIndex - block to swap
|
|
40
|
+
* @param {number} toIndex - block to swap with
|
|
41
|
+
* @deprecated — use 'move' instead
|
|
42
|
+
*/
|
|
43
|
+
swap(fromIndex: number, toIndex: number): void;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Moves a block to a new index
|
|
47
|
+
* @param {number} toIndex - index where the block is moved to
|
|
48
|
+
* @param {number} fromIndex - block to move
|
|
49
|
+
*/
|
|
50
|
+
move(toIndex: number, fromIndex?: number): void;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Returns Block API object by passed Block index
|
|
54
|
+
* @param {number} index
|
|
55
|
+
*/
|
|
56
|
+
getBlockByIndex(index: number): BlockAPI | undefined;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Returns Block API object by passed Block id
|
|
60
|
+
* @param id - id of the block
|
|
61
|
+
*/
|
|
62
|
+
getById(id: string): BlockAPI | null;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Returns current Block index
|
|
66
|
+
* @returns {number}
|
|
67
|
+
*/
|
|
68
|
+
getCurrentBlockIndex(): number;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Returns the index of Block by id;
|
|
72
|
+
*/
|
|
73
|
+
getBlockIndex(blockId: string): number;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Get Block API object by html element
|
|
77
|
+
*
|
|
78
|
+
* @param element - html element to get Block by
|
|
79
|
+
*/
|
|
80
|
+
getBlockByElement(element: HTMLElement): BlockAPI | undefined;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Mark Block as stretched
|
|
84
|
+
* @param {number} index - Block to mark
|
|
85
|
+
* @param {boolean} status - stretch status
|
|
86
|
+
*
|
|
87
|
+
* @deprecated Use BlockAPI interface to stretch Blocks
|
|
88
|
+
*/
|
|
89
|
+
stretchBlock(index: number, status?: boolean): void;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Returns Blocks count
|
|
93
|
+
* @return {number}
|
|
94
|
+
*/
|
|
95
|
+
getBlocksCount(): number;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Insert new Initial Block after current Block
|
|
99
|
+
*
|
|
100
|
+
* @deprecated
|
|
101
|
+
*/
|
|
102
|
+
insertNewBlock(): void;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Insert new Block and return inserted Block API
|
|
106
|
+
*
|
|
107
|
+
* @param {string} type — Tool name
|
|
108
|
+
* @param {BlockToolData} data — Tool data to insert
|
|
109
|
+
* @param {ToolConfig} config — Tool config
|
|
110
|
+
* @param {number?} index — index where to insert new Block
|
|
111
|
+
* @param {boolean?} needToFocus - flag to focus inserted Block
|
|
112
|
+
* @param {boolean?} replace - should the existed Block on that index be replaced or not
|
|
113
|
+
* @param {string} id — An optional id for the new block. If omitted then the new id will be generated
|
|
114
|
+
*/
|
|
115
|
+
insert(
|
|
116
|
+
type?: string,
|
|
117
|
+
data?: BlockToolData,
|
|
118
|
+
config?: ToolConfig,
|
|
119
|
+
index?: number,
|
|
120
|
+
needToFocus?: boolean,
|
|
121
|
+
replace?: boolean,
|
|
122
|
+
id?: string,
|
|
123
|
+
): BlockAPI;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Inserts several Blocks to specified index
|
|
127
|
+
*/
|
|
128
|
+
insertMany(
|
|
129
|
+
blocks: OutputBlockData[],
|
|
130
|
+
index?: number,
|
|
131
|
+
): BlockAPI[];
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Creates data of an empty block with a passed type.
|
|
136
|
+
*
|
|
137
|
+
* @param toolName - block tool name
|
|
138
|
+
*/
|
|
139
|
+
composeBlockData(toolName: string): Promise<BlockToolData>
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Updates block data by id
|
|
143
|
+
*
|
|
144
|
+
* @param id - id of the block to update
|
|
145
|
+
* @param data - (optional) the new data. Can be partial.
|
|
146
|
+
* @param tunes - (optional) tune data
|
|
147
|
+
*/
|
|
148
|
+
update(id: string, data?: Partial<BlockToolData>, tunes?: {[name: string]: BlockTuneData}): Promise<BlockAPI>;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Converts block to another type. Both blocks should provide the conversionConfig.
|
|
152
|
+
*
|
|
153
|
+
* @param id - id of the existed block to convert. Should provide 'conversionConfig.export' method
|
|
154
|
+
* @param newType - new block type. Should provide 'conversionConfig.import' method
|
|
155
|
+
* @param dataOverrides - optional data overrides for the new block
|
|
156
|
+
*
|
|
157
|
+
* @throws Error if conversion is not possible
|
|
158
|
+
*/
|
|
159
|
+
convert(id: string, newType: string, dataOverrides?: BlockToolData): Promise<BlockAPI>;
|
|
160
|
+
}
|
|
@@ -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;
|
|
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 immitate 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 usefull 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 'codex-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;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {API, BlockAPI, SanitizerConfig, ToolConfig} from '../index';
|
|
2
|
+
import { BlockTuneData } from './block-tune-data';
|
|
3
|
+
import { MenuConfig } from '../tools';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Describes BLockTune blueprint
|
|
7
|
+
*/
|
|
8
|
+
export interface BlockTune {
|
|
9
|
+
/**
|
|
10
|
+
* Returns BlockTune's UI.
|
|
11
|
+
* Should return either MenuConfig (recommended) (@see https://editorjs.io/menu-config/)
|
|
12
|
+
* or HTMLElement (UI consitency is not guaranteed)
|
|
13
|
+
*/
|
|
14
|
+
render(): HTMLElement | MenuConfig;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Method called on Tool render. Pass Tool content as an argument.
|
|
18
|
+
*
|
|
19
|
+
* You can wrap Tool's content with any wrapper you want to provide Tune's UI
|
|
20
|
+
*
|
|
21
|
+
* @param {HTMLElement} pluginsContent — Tool's content wrapper
|
|
22
|
+
*/
|
|
23
|
+
wrap?(pluginsContent: HTMLElement): HTMLElement;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Called on Tool's saving. Should return any data Tune needs to save
|
|
27
|
+
*
|
|
28
|
+
* @return {BlockTuneData}
|
|
29
|
+
*/
|
|
30
|
+
save?(): BlockTuneData;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Describes BlockTune class constructor function
|
|
35
|
+
*/
|
|
36
|
+
export interface BlockTuneConstructable {
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Flag show Tool is Block Tune
|
|
40
|
+
*/
|
|
41
|
+
isTune: boolean;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Tune's sanitize configuration
|
|
45
|
+
*/
|
|
46
|
+
sanitize?: SanitizerConfig;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @constructor
|
|
50
|
+
*
|
|
51
|
+
* @param config - Block Tune config
|
|
52
|
+
*/
|
|
53
|
+
new(config: {
|
|
54
|
+
api: API,
|
|
55
|
+
config?: ToolConfig,
|
|
56
|
+
block: BlockAPI,
|
|
57
|
+
data: BlockTuneData,
|
|
58
|
+
}): BlockTune;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Tune`s prepare method. Can be async
|
|
62
|
+
* @param data
|
|
63
|
+
*/
|
|
64
|
+
prepare?(): Promise<void> | void;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Tune`s reset method to clean up anything set by prepare. Can be async
|
|
68
|
+
*/
|
|
69
|
+
reset?(): void | Promise<void>;
|
|
70
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './block-tune';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { BlockToolData, ToolConfig } from '../tools';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Config allows Tool to specify how it can be converted into/from another Tool
|
|
5
|
+
*/
|
|
6
|
+
export interface ConversionConfig {
|
|
7
|
+
/**
|
|
8
|
+
* How to import string to this Tool.
|
|
9
|
+
*
|
|
10
|
+
* Can be a String or Function:
|
|
11
|
+
*
|
|
12
|
+
* 1. String — the key of Tool data object to fill it with imported string on render.
|
|
13
|
+
* 2. Function — method that accepts importing string and composes Tool data to render.
|
|
14
|
+
*/
|
|
15
|
+
import?: ((data: string, config: ToolConfig) => BlockToolData) | string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* How to export this Tool to make other Block.
|
|
19
|
+
*
|
|
20
|
+
* Can be a String or Function:
|
|
21
|
+
*
|
|
22
|
+
* 1. String — which property of saved Tool data should be used as exported string.
|
|
23
|
+
* 2. Function — accepts saved Tool data and create a string to export
|
|
24
|
+
*/
|
|
25
|
+
export?: ((data: BlockToolData) => string) | string;
|
|
26
|
+
}
|