zs_library 0.3.13 → 0.3.14
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 +4 -0
- package/dist/components/{Desktop → desktop}/context/config/context.d.ts +3 -3
- package/dist/components/{Desktop → desktop}/index.d.ts +2 -2
- package/dist/components/{Desktop/Items/GroupItem.d.ts → desktop/items/group-item.d.ts} +1 -1
- package/dist/components/{Desktop/Sortable.d.ts → desktop/sortable.d.ts} +2 -2
- package/dist/components/dock/dock-desktop.d.ts +8 -0
- package/dist/components/dock/dock-mobile.d.ts +10 -0
- package/dist/components/dock/index.d.ts +18 -0
- package/dist/components/dock/utils.d.ts +2 -0
- package/dist/components/index.d.ts +3 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +1102 -943
- package/dist/index.umd.js +97 -97
- package/dist/zs_library.css +1 -0
- package/package.json +114 -116
- package/dist/components/Editor/components/BlockTools/MediaAndEmbed/Image/index.d.ts +0 -146
- package/dist/components/Editor/components/BlockTools/MediaAndEmbed/Image/types/types.d.ts +0 -172
- package/dist/components/Editor/components/BlockTools/MediaAndEmbed/Image/ui.d.ts +0 -132
- package/dist/components/Editor/components/BlockTools/MediaAndEmbed/Image/uploader.d.ts +0 -60
- package/dist/components/Editor/components/BlockTools/MediaAndEmbed/Image/utils/dom.d.ts +0 -10
- package/dist/components/Editor/components/BlockTools/MediaAndEmbed/Image/utils/isPromise.d.ts +0 -7
- package/dist/components/Editor/components/BlockTools/TextAndTypography/Alert/index.d.ts +0 -238
- package/dist/components/Editor/components/BlockTools/TextAndTypography/Delimiter/index.d.ts +0 -270
- package/dist/components/Editor/components/BlockTools/TextAndTypography/Header/index.d.ts +0 -249
- package/dist/components/Editor/components/BlockTools/TextAndTypography/Paragraph/index.d.ts +0 -189
- package/dist/components/Editor/components/BlockTools/TextAndTypography/Paragraph/utils/makeFragment.d.ts +0 -7
- package/dist/components/Editor/components/BlockTools/TextAndTypography/Quote/index.d.ts +0 -282
- package/dist/components/Editor/components/BlockTuneTools/Delete/index.d.ts +0 -33
- package/dist/components/Editor/components/BlockTuneTools/MoveDown/index.d.ts +0 -37
- package/dist/components/Editor/components/BlockTuneTools/MoveUp/index.d.ts +0 -37
- package/dist/components/Editor/index.d.ts +0 -9
- package/dist/style.css +0 -1
- /package/dist/components/{Desktop → desktop}/config.d.ts +0 -0
- /package/dist/components/{Desktop → desktop}/context/config/hooks.d.ts +0 -0
- /package/dist/components/{Desktop → desktop}/context/state/context.d.ts +0 -0
- /package/dist/components/{Desktop → desktop}/context/state/hooks.d.ts +0 -0
- /package/dist/components/{Desktop/ContextMenu → desktop/context-menu}/index.d.ts +0 -0
- /package/dist/components/{Desktop/Items/Modal/GroupItemModal.d.ts → desktop/items/modal/group-item-modal.d.ts} +0 -0
- /package/dist/components/{Desktop/Items/Modal/InfoModal.d.ts → desktop/items/modal/info-modal.d.ts} +0 -0
- /package/dist/components/{Desktop/Items/SortableItem.d.ts → desktop/items/sortable-item.d.ts} +0 -0
- /package/dist/components/{Desktop → desktop}/style.d.ts +0 -0
- /package/dist/components/{Desktop → desktop}/theme.d.ts +0 -0
- /package/dist/components/{Desktop → desktop}/types.d.ts +0 -0
- /package/dist/components/{Desktop → desktop}/utils.d.ts +0 -0
- /package/dist/components/{MdEditor → md-editor}/i18n/index.d.ts +0 -0
- /package/dist/components/{MdEditor → md-editor}/i18n/zh_CN.d.ts +0 -0
- /package/dist/components/{MdEditor → md-editor}/index.d.ts +0 -0
- /package/dist/components/{MdEditor → md-editor}/preview.d.ts +0 -0
- /package/dist/components/{MdEditor → md-editor}/style.d.ts +0 -0
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
import { API, BlockTune, PasteEvent } from '@editorjs/editorjs';
|
|
2
|
-
/**
|
|
3
|
-
* @description Tool's input and output data format
|
|
4
|
-
*/
|
|
5
|
-
export interface HeaderData {
|
|
6
|
-
/** Header's content */
|
|
7
|
-
text: string;
|
|
8
|
-
/** Header's level from 1 to 6 */
|
|
9
|
-
level: number;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* @description Tool's config from Editor
|
|
13
|
-
*/
|
|
14
|
-
export interface HeaderConfig {
|
|
15
|
-
/** Block's placeholder */
|
|
16
|
-
placeholder?: string;
|
|
17
|
-
/** Heading levels */
|
|
18
|
-
levels?: number[];
|
|
19
|
-
/** Default level */
|
|
20
|
-
defaultLevel?: number;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* @description Heading level information
|
|
24
|
-
*/
|
|
25
|
-
interface Level {
|
|
26
|
-
/** Level number */
|
|
27
|
-
number: number;
|
|
28
|
-
/** HTML tag corresponding with level number */
|
|
29
|
-
tag: string;
|
|
30
|
-
/** Icon */
|
|
31
|
-
svg: string;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* @description Constructor arguments for Header
|
|
35
|
-
*/
|
|
36
|
-
interface ConstructorArgs {
|
|
37
|
-
/** Previously saved data */
|
|
38
|
-
data: HeaderData | {};
|
|
39
|
-
/** User config for the tool */
|
|
40
|
-
config: HeaderConfig;
|
|
41
|
-
/** Editor.js API */
|
|
42
|
-
api: API;
|
|
43
|
-
/** Read-only mode flag */
|
|
44
|
-
readOnly: boolean;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Header block for the Editor.js.
|
|
48
|
-
*
|
|
49
|
-
* @author CodeX (team@ifmo.su)
|
|
50
|
-
* @copyright CodeX 2018
|
|
51
|
-
* @license MIT
|
|
52
|
-
* @version 2.0.0
|
|
53
|
-
*/
|
|
54
|
-
export default class Header {
|
|
55
|
-
/**
|
|
56
|
-
* Render plugin`s main Element and fill it with saved data
|
|
57
|
-
*
|
|
58
|
-
* @param {{data: HeaderData, config: HeaderConfig, api: object}}
|
|
59
|
-
* data — previously saved data
|
|
60
|
-
* config - user config for Tool
|
|
61
|
-
* api - Editor.js API
|
|
62
|
-
* readOnly - read only mode flag
|
|
63
|
-
*/
|
|
64
|
-
/**
|
|
65
|
-
* Editor.js API
|
|
66
|
-
* @private
|
|
67
|
-
*/
|
|
68
|
-
private api;
|
|
69
|
-
/**
|
|
70
|
-
* Read-only mode flag
|
|
71
|
-
* @private
|
|
72
|
-
*/
|
|
73
|
-
private readOnly;
|
|
74
|
-
/**
|
|
75
|
-
* Tool's settings passed from Editor
|
|
76
|
-
* @private
|
|
77
|
-
*/
|
|
78
|
-
private _settings;
|
|
79
|
-
/**
|
|
80
|
-
* Block's data
|
|
81
|
-
* @private
|
|
82
|
-
*/
|
|
83
|
-
private _data;
|
|
84
|
-
/**
|
|
85
|
-
* Main Block wrapper
|
|
86
|
-
* @private
|
|
87
|
-
*/
|
|
88
|
-
private _element;
|
|
89
|
-
constructor({ data, config, api, readOnly }: ConstructorArgs);
|
|
90
|
-
/**
|
|
91
|
-
* Styles
|
|
92
|
-
*/
|
|
93
|
-
private get _CSS();
|
|
94
|
-
/**
|
|
95
|
-
* Check if data is valid
|
|
96
|
-
*
|
|
97
|
-
* @param {any} data - data to check
|
|
98
|
-
* @returns {data is HeaderData}
|
|
99
|
-
* @private
|
|
100
|
-
*/
|
|
101
|
-
isHeaderData(data: HeaderData): data is HeaderData;
|
|
102
|
-
/**
|
|
103
|
-
* Normalize input data
|
|
104
|
-
*
|
|
105
|
-
* @param {HeaderData} data - saved data to process
|
|
106
|
-
*
|
|
107
|
-
* @returns {HeaderData}
|
|
108
|
-
* @private
|
|
109
|
-
*/
|
|
110
|
-
normalizeData(data: HeaderData | {}): HeaderData;
|
|
111
|
-
/**
|
|
112
|
-
* Return Tool's view
|
|
113
|
-
*
|
|
114
|
-
* @returns {HTMLHeadingElement}
|
|
115
|
-
* @public
|
|
116
|
-
*/
|
|
117
|
-
render(): HTMLHeadingElement;
|
|
118
|
-
/**
|
|
119
|
-
* Returns header block tunes config
|
|
120
|
-
*
|
|
121
|
-
* @returns {Array}
|
|
122
|
-
*/
|
|
123
|
-
renderSettings(): BlockTune[];
|
|
124
|
-
/**
|
|
125
|
-
* Callback for Block's settings buttons
|
|
126
|
-
*
|
|
127
|
-
* @param {number} level - level to set
|
|
128
|
-
*/
|
|
129
|
-
setLevel(level: number): void;
|
|
130
|
-
/**
|
|
131
|
-
* Method that specified how to merge two Text blocks.
|
|
132
|
-
* Called by Editor.js by backspace at the beginning of the Block
|
|
133
|
-
*
|
|
134
|
-
* @param {HeaderData} data - saved data to merger with current block
|
|
135
|
-
* @public
|
|
136
|
-
*/
|
|
137
|
-
merge(data: HeaderData): void;
|
|
138
|
-
/**
|
|
139
|
-
* Validate Text block data:
|
|
140
|
-
* - check for emptiness
|
|
141
|
-
*
|
|
142
|
-
* @param {HeaderData} blockData — data received after saving
|
|
143
|
-
* @returns {boolean} false if saved data is not correct, otherwise true
|
|
144
|
-
* @public
|
|
145
|
-
*/
|
|
146
|
-
validate(blockData: HeaderData): boolean;
|
|
147
|
-
/**
|
|
148
|
-
* Extract Tool's data from the view
|
|
149
|
-
*
|
|
150
|
-
* @param {HTMLHeadingElement} toolsContent - Text tools rendered view
|
|
151
|
-
* @returns {HeaderData} - saved data
|
|
152
|
-
* @public
|
|
153
|
-
*/
|
|
154
|
-
save(toolsContent: HTMLHeadingElement): HeaderData;
|
|
155
|
-
/**
|
|
156
|
-
* Allow Header to be converted to/from other blocks
|
|
157
|
-
*/
|
|
158
|
-
static get conversionConfig(): {
|
|
159
|
-
export: string;
|
|
160
|
-
import: string;
|
|
161
|
-
};
|
|
162
|
-
/**
|
|
163
|
-
* Sanitizer Rules
|
|
164
|
-
*/
|
|
165
|
-
static get sanitize(): {
|
|
166
|
-
level: boolean;
|
|
167
|
-
text: {};
|
|
168
|
-
};
|
|
169
|
-
/**
|
|
170
|
-
* Returns true to notify core that read-only is supported
|
|
171
|
-
*
|
|
172
|
-
* @returns {boolean}
|
|
173
|
-
*/
|
|
174
|
-
static get isReadOnlySupported(): boolean;
|
|
175
|
-
/**
|
|
176
|
-
* Get current Tools`s data
|
|
177
|
-
*
|
|
178
|
-
* @returns {HeaderData} Current data
|
|
179
|
-
* @private
|
|
180
|
-
*/
|
|
181
|
-
get data(): HeaderData;
|
|
182
|
-
/**
|
|
183
|
-
* Store data in plugin:
|
|
184
|
-
* - at the this._data property
|
|
185
|
-
* - at the HTML
|
|
186
|
-
*
|
|
187
|
-
* @param {HeaderData} data — data to set
|
|
188
|
-
* @private
|
|
189
|
-
*/
|
|
190
|
-
set data(data: HeaderData);
|
|
191
|
-
/**
|
|
192
|
-
* Get tag for target level
|
|
193
|
-
* By default returns second-leveled header
|
|
194
|
-
*
|
|
195
|
-
* @returns {HTMLElement}
|
|
196
|
-
*/
|
|
197
|
-
getTag(): HTMLHeadingElement;
|
|
198
|
-
/**
|
|
199
|
-
* Get current level
|
|
200
|
-
*
|
|
201
|
-
* @returns {level}
|
|
202
|
-
*/
|
|
203
|
-
get currentLevel(): Level;
|
|
204
|
-
/**
|
|
205
|
-
* Return default level
|
|
206
|
-
*
|
|
207
|
-
* @returns {level}
|
|
208
|
-
*/
|
|
209
|
-
get defaultLevel(): Level;
|
|
210
|
-
/**
|
|
211
|
-
* @typedef {object} level
|
|
212
|
-
* @property {number} number - level number
|
|
213
|
-
* @property {string} tag - tag corresponds with level number
|
|
214
|
-
* @property {string} svg - icon
|
|
215
|
-
*/
|
|
216
|
-
/**
|
|
217
|
-
* Available header levels
|
|
218
|
-
*
|
|
219
|
-
* @returns {level[]}
|
|
220
|
-
*/
|
|
221
|
-
get levels(): Level[];
|
|
222
|
-
/**
|
|
223
|
-
* Handle H1-H6 tags on paste to substitute it with header Tool
|
|
224
|
-
*
|
|
225
|
-
* @param {PasteEvent} event - event with pasted content
|
|
226
|
-
*/
|
|
227
|
-
onPaste(event: PasteEvent): void;
|
|
228
|
-
/**
|
|
229
|
-
* Used by Editor.js paste handling API.
|
|
230
|
-
* Provides configuration to handle H1-H6 tags.
|
|
231
|
-
*
|
|
232
|
-
* @returns {{handler: (function(HTMLElement): {text: string}), tags: string[]}}
|
|
233
|
-
*/
|
|
234
|
-
static get pasteConfig(): {
|
|
235
|
-
tags: string[];
|
|
236
|
-
};
|
|
237
|
-
/**
|
|
238
|
-
* Get Tool toolbox settings
|
|
239
|
-
* icon - Tool icon's SVG
|
|
240
|
-
* title - title to show in toolbox
|
|
241
|
-
*
|
|
242
|
-
* @returns {{icon: string, title: string}}
|
|
243
|
-
*/
|
|
244
|
-
static get toolbox(): {
|
|
245
|
-
icon: string;
|
|
246
|
-
title: string;
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
export {};
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import { API, ConversionConfig, HTMLPasteEvent, PasteConfig, SanitizerConfig, ToolConfig, ToolboxConfig } from '@editorjs/editorjs';
|
|
2
|
-
/**
|
|
3
|
-
* Base Paragraph Block for the Editor.js.
|
|
4
|
-
* Represents a regular text block
|
|
5
|
-
*
|
|
6
|
-
* @author CodeX (team@codex.so)
|
|
7
|
-
* @copyright CodeX 2018
|
|
8
|
-
* @license The MIT License (MIT)
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* @typedef {object} ParagraphConfig
|
|
12
|
-
* @property {string} placeholder - placeholder for the empty paragraph
|
|
13
|
-
* @property {boolean} preserveBlank - Whether or not to keep blank paragraphs when saving editor data
|
|
14
|
-
*/
|
|
15
|
-
export interface ParagraphConfig extends ToolConfig {
|
|
16
|
-
/**
|
|
17
|
-
* Placeholder for the empty paragraph
|
|
18
|
-
*/
|
|
19
|
-
placeholder?: string;
|
|
20
|
-
/**
|
|
21
|
-
* Whether or not to keep blank paragraphs when saving editor data
|
|
22
|
-
*/
|
|
23
|
-
preserveBlank?: boolean;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* @typedef {object} ParagraphData
|
|
27
|
-
* @description Tool's input and output data format
|
|
28
|
-
* @property {string} text — Paragraph's content. Can include HTML tags: <a><b><i>
|
|
29
|
-
*/
|
|
30
|
-
export interface ParagraphData {
|
|
31
|
-
/**
|
|
32
|
-
* Paragraph's content
|
|
33
|
-
*/
|
|
34
|
-
text: string;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* @typedef {object} ParagraphParams
|
|
38
|
-
* @description Constructor params for the Paragraph tool, use to pass initial data and settings
|
|
39
|
-
* @property {ParagraphData} data - Preload data for the paragraph.
|
|
40
|
-
* @property {ParagraphConfig} config - The configuration for the paragraph.
|
|
41
|
-
* @property {API} api - The Editor.js API.
|
|
42
|
-
* @property {boolean} readOnly - Is paragraph is read-only.
|
|
43
|
-
*/
|
|
44
|
-
interface ParagraphParams {
|
|
45
|
-
/**
|
|
46
|
-
* Initial data for the paragraph
|
|
47
|
-
*/
|
|
48
|
-
data: ParagraphData;
|
|
49
|
-
/**
|
|
50
|
-
* Paragraph tool configuration
|
|
51
|
-
*/
|
|
52
|
-
config: ParagraphConfig;
|
|
53
|
-
/**
|
|
54
|
-
* Editor.js API
|
|
55
|
-
*/
|
|
56
|
-
api: API;
|
|
57
|
-
/**
|
|
58
|
-
* Is paragraph read-only.
|
|
59
|
-
*/
|
|
60
|
-
readOnly: boolean;
|
|
61
|
-
}
|
|
62
|
-
export default class Paragraph {
|
|
63
|
-
/**
|
|
64
|
-
* Default placeholder for Paragraph Tool
|
|
65
|
-
*
|
|
66
|
-
* @returns {string}
|
|
67
|
-
* @class
|
|
68
|
-
*/
|
|
69
|
-
static get DEFAULT_PLACEHOLDER(): string;
|
|
70
|
-
/**
|
|
71
|
-
* The Editor.js API
|
|
72
|
-
*/
|
|
73
|
-
api: API;
|
|
74
|
-
/**
|
|
75
|
-
* Is Paragraph Tool read-only
|
|
76
|
-
*/
|
|
77
|
-
readOnly: boolean;
|
|
78
|
-
/**
|
|
79
|
-
* Paragraph Tool's CSS classes
|
|
80
|
-
*/
|
|
81
|
-
private _CSS;
|
|
82
|
-
/**
|
|
83
|
-
* Placeholder for Paragraph Tool
|
|
84
|
-
*/
|
|
85
|
-
private _placeholder;
|
|
86
|
-
/**
|
|
87
|
-
* Paragraph's data
|
|
88
|
-
*/
|
|
89
|
-
private _data;
|
|
90
|
-
/**
|
|
91
|
-
* Paragraph's main Element
|
|
92
|
-
*/
|
|
93
|
-
private _element;
|
|
94
|
-
/**
|
|
95
|
-
* Whether or not to keep blank paragraphs when saving editor data
|
|
96
|
-
*/
|
|
97
|
-
private _preserveBlank;
|
|
98
|
-
/**
|
|
99
|
-
* Render plugin`s main Element and fill it with saved data
|
|
100
|
-
*
|
|
101
|
-
* @param {object} params - constructor params
|
|
102
|
-
* @param {ParagraphData} params.data - previously saved data
|
|
103
|
-
* @param {ParagraphConfig} params.config - user config for Tool
|
|
104
|
-
* @param {object} params.api - editor.js api
|
|
105
|
-
* @param {boolean} readOnly - read only mode flag
|
|
106
|
-
*/
|
|
107
|
-
constructor({ data, config, api, readOnly }: ParagraphParams);
|
|
108
|
-
/**
|
|
109
|
-
* Check if text content is empty and set empty string to inner html.
|
|
110
|
-
* We need this because some browsers (e.g. Safari) insert <br> into empty contenteditanle elements
|
|
111
|
-
*
|
|
112
|
-
* @param {KeyboardEvent} e - key up event
|
|
113
|
-
*/
|
|
114
|
-
onKeyUp(e: KeyboardEvent): void;
|
|
115
|
-
/**
|
|
116
|
-
* Create Tool's view
|
|
117
|
-
*
|
|
118
|
-
* @returns {HTMLDivElement}
|
|
119
|
-
* @private
|
|
120
|
-
*/
|
|
121
|
-
drawView(): HTMLDivElement;
|
|
122
|
-
/**
|
|
123
|
-
* Return Tool's view
|
|
124
|
-
*
|
|
125
|
-
* @returns {HTMLDivElement}
|
|
126
|
-
*/
|
|
127
|
-
render(): HTMLDivElement;
|
|
128
|
-
/**
|
|
129
|
-
* Method that specified how to merge two Text blocks.
|
|
130
|
-
* Called by Editor.js by backspace at the beginning of the Block
|
|
131
|
-
*
|
|
132
|
-
* @param {ParagraphData} data
|
|
133
|
-
* @public
|
|
134
|
-
*/
|
|
135
|
-
merge(data: ParagraphData): void;
|
|
136
|
-
/**
|
|
137
|
-
* Validate Paragraph block data:
|
|
138
|
-
* - check for emptiness
|
|
139
|
-
*
|
|
140
|
-
* @param {ParagraphData} savedData — data received after saving
|
|
141
|
-
* @returns {boolean} false if saved data is not correct, otherwise true
|
|
142
|
-
* @public
|
|
143
|
-
*/
|
|
144
|
-
validate(savedData: ParagraphData): boolean;
|
|
145
|
-
/**
|
|
146
|
-
* Extract Tool's data from the view
|
|
147
|
-
*
|
|
148
|
-
* @param {HTMLDivElement} toolsContent - Paragraph tools rendered view
|
|
149
|
-
* @returns {ParagraphData} - saved data
|
|
150
|
-
* @public
|
|
151
|
-
*/
|
|
152
|
-
save(toolsContent: HTMLDivElement): ParagraphData;
|
|
153
|
-
/**
|
|
154
|
-
* On paste callback fired from Editor.
|
|
155
|
-
*
|
|
156
|
-
* @param {HTMLPasteEvent} event - event with pasted data
|
|
157
|
-
*/
|
|
158
|
-
onPaste(event: HTMLPasteEvent): void;
|
|
159
|
-
/**
|
|
160
|
-
* Enable Conversion Toolbar. Paragraph can be converted to/from other tools
|
|
161
|
-
* @returns {ConversionConfig}
|
|
162
|
-
*/
|
|
163
|
-
static get conversionConfig(): ConversionConfig;
|
|
164
|
-
/**
|
|
165
|
-
* Sanitizer rules
|
|
166
|
-
* @returns {SanitizerConfig} - Edtior.js sanitizer config
|
|
167
|
-
*/
|
|
168
|
-
static get sanitize(): SanitizerConfig;
|
|
169
|
-
/**
|
|
170
|
-
* Returns true to notify the core that read-only mode is supported
|
|
171
|
-
*
|
|
172
|
-
* @returns {boolean}
|
|
173
|
-
*/
|
|
174
|
-
static get isReadOnlySupported(): boolean;
|
|
175
|
-
/**
|
|
176
|
-
* Used by Editor paste handling API.
|
|
177
|
-
* Provides configuration to handle P tags.
|
|
178
|
-
*
|
|
179
|
-
* @returns {PasteConfig} - Paragraph Paste Setting
|
|
180
|
-
*/
|
|
181
|
-
static get pasteConfig(): PasteConfig;
|
|
182
|
-
/**
|
|
183
|
-
* Icon and title for displaying at the Toolbox
|
|
184
|
-
*
|
|
185
|
-
* @returns {ToolboxConfig} - Paragraph Toolbox Setting
|
|
186
|
-
*/
|
|
187
|
-
static get toolbox(): ToolboxConfig;
|
|
188
|
-
}
|
|
189
|
-
export {};
|
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
import { API, BlockAPI, BlockTool, ToolConfig } from '@editorjs/editorjs';
|
|
2
|
-
import { MenuConfig } from '@editorjs/editorjs/types/tools';
|
|
3
|
-
/**
|
|
4
|
-
* @typedef {object} QuoteConfig
|
|
5
|
-
* @description Quote Tool`s initial configuration
|
|
6
|
-
* @property {string} quotePlaceholder - placeholder to show in quote`s text input
|
|
7
|
-
* @property {string} captionPlaceholder - placeholder to show in quote`s caption input
|
|
8
|
-
* @property {'center'|'left'} defaultAlignment - alignment to use as default
|
|
9
|
-
*/
|
|
10
|
-
export interface QuoteConfig extends ToolConfig {
|
|
11
|
-
/**
|
|
12
|
-
* Placeholder text to display in the quote's text input.
|
|
13
|
-
*/
|
|
14
|
-
quotePlaceholder: string;
|
|
15
|
-
/**
|
|
16
|
-
* Placeholder text to display in the quote's caption input.
|
|
17
|
-
*/
|
|
18
|
-
captionPlaceholder: string;
|
|
19
|
-
/**
|
|
20
|
-
* Default alignment for the quote.
|
|
21
|
-
*/
|
|
22
|
-
defaultAlignment: Alignment;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* @typedef {object} QuoteData
|
|
26
|
-
* @description Quote Tool`s input and output data
|
|
27
|
-
* @property {string} text - quote`s text
|
|
28
|
-
* @property {string} caption - quote`s caption
|
|
29
|
-
* @property {'center'|'left'} alignment - quote`s alignment
|
|
30
|
-
*/
|
|
31
|
-
export interface QuoteData {
|
|
32
|
-
/**
|
|
33
|
-
* The text of the quote.
|
|
34
|
-
*/
|
|
35
|
-
text: string;
|
|
36
|
-
/**
|
|
37
|
-
* The caption for the quote.
|
|
38
|
-
*/
|
|
39
|
-
caption: string;
|
|
40
|
-
/**
|
|
41
|
-
* The alignment of the quote.
|
|
42
|
-
*/
|
|
43
|
-
alignment: Alignment;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* @typedef {object} QuoteParams
|
|
47
|
-
* @description Constructor params for the Quote tool, use to pass initial data and settings
|
|
48
|
-
* @property {QuoteData} data - Preload data for the quote.
|
|
49
|
-
* @property {QuoteConfig} config - The configuration for the quote.
|
|
50
|
-
* @property {API} api - The Editor.js API.
|
|
51
|
-
* @property {boolean} readOnly - Is quote is read-only.
|
|
52
|
-
* @property {BlockAPI} block - BlockAPI object of Quote.
|
|
53
|
-
*/
|
|
54
|
-
interface QuoteParams {
|
|
55
|
-
/**
|
|
56
|
-
* Initial data for the quote
|
|
57
|
-
*/
|
|
58
|
-
data: QuoteData;
|
|
59
|
-
/**
|
|
60
|
-
* Quote tool configuration
|
|
61
|
-
*/
|
|
62
|
-
config: QuoteConfig;
|
|
63
|
-
/**
|
|
64
|
-
* Editor.js API
|
|
65
|
-
*/
|
|
66
|
-
api: API;
|
|
67
|
-
/**
|
|
68
|
-
* Is quote read-only.
|
|
69
|
-
*/
|
|
70
|
-
readOnly: boolean;
|
|
71
|
-
/**
|
|
72
|
-
* BlockAPI object of Quote.
|
|
73
|
-
*/
|
|
74
|
-
block: BlockAPI;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* @typedef {object} QuoteCSS
|
|
78
|
-
* @description CSS classes names
|
|
79
|
-
* @property {string} block - Editor.js CSS Class for block
|
|
80
|
-
* @property {string} wrapper - Quote CSS Class
|
|
81
|
-
*/
|
|
82
|
-
interface QuoteCSS {
|
|
83
|
-
/**
|
|
84
|
-
* Editor.js CSS Class for block
|
|
85
|
-
*/
|
|
86
|
-
baseClass: string;
|
|
87
|
-
/**
|
|
88
|
-
* Quote CSS Class
|
|
89
|
-
*/
|
|
90
|
-
wrapper: string;
|
|
91
|
-
/**
|
|
92
|
-
* Quote CSS Class
|
|
93
|
-
*/
|
|
94
|
-
input: string;
|
|
95
|
-
/**
|
|
96
|
-
* Quote CSS Class
|
|
97
|
-
*/
|
|
98
|
-
text: string;
|
|
99
|
-
/**
|
|
100
|
-
* Quote CSS Class
|
|
101
|
-
*/
|
|
102
|
-
caption: string;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* @typedef {Enum} Alignment
|
|
106
|
-
* @description Enum for Quote Alignment
|
|
107
|
-
*/
|
|
108
|
-
declare enum Alignment {
|
|
109
|
-
Left = "left",
|
|
110
|
-
Center = "center"
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* @class Quote
|
|
114
|
-
* @classdesc Quote Tool for Editor.js
|
|
115
|
-
* @property {QuoteData} data - Tool`s input and output data
|
|
116
|
-
* @propert {API} api - Editor.js API instance
|
|
117
|
-
*/
|
|
118
|
-
export default class Quote implements BlockTool {
|
|
119
|
-
/**
|
|
120
|
-
* The Editor.js API
|
|
121
|
-
*/
|
|
122
|
-
api: API;
|
|
123
|
-
/**
|
|
124
|
-
* Is Quote Tool read-only
|
|
125
|
-
*/
|
|
126
|
-
readOnly: boolean;
|
|
127
|
-
/**
|
|
128
|
-
* Placeholder for Quote Tool
|
|
129
|
-
*/
|
|
130
|
-
private _quotePlaceholder;
|
|
131
|
-
/**
|
|
132
|
-
* Current quote element
|
|
133
|
-
*/
|
|
134
|
-
private _block;
|
|
135
|
-
/**
|
|
136
|
-
* Caption placeholder for Quote Tool
|
|
137
|
-
*/
|
|
138
|
-
private _captionPlaceholder;
|
|
139
|
-
/**
|
|
140
|
-
* Quote's data
|
|
141
|
-
*/
|
|
142
|
-
private _data;
|
|
143
|
-
/**
|
|
144
|
-
* Quote Tool's CSS classes
|
|
145
|
-
*/
|
|
146
|
-
private _CSS;
|
|
147
|
-
/**
|
|
148
|
-
* Render plugin`s main Element and fill it with saved data
|
|
149
|
-
*
|
|
150
|
-
* @param {object} params - constructor params
|
|
151
|
-
* @param {QuoteData} params.data - previously saved data
|
|
152
|
-
* @param {QuoteConfig} params.config - user config for Tool
|
|
153
|
-
* @param {API} params.api - editor.js api
|
|
154
|
-
* @param {boolean} params.readOnly - read only mode flag
|
|
155
|
-
*/
|
|
156
|
-
constructor({ data, config, api, readOnly, block }: QuoteParams);
|
|
157
|
-
/**
|
|
158
|
-
* Notify core that read-only mode is supported
|
|
159
|
-
*
|
|
160
|
-
* @returns {boolean}
|
|
161
|
-
*/
|
|
162
|
-
static get isReadOnlySupported(): boolean;
|
|
163
|
-
/**
|
|
164
|
-
* Get Tool toolbox settings
|
|
165
|
-
* icon - Tool icon's SVG
|
|
166
|
-
* title - title to show in toolbox
|
|
167
|
-
*
|
|
168
|
-
* @returns {{icon: string, title: string}}
|
|
169
|
-
*/
|
|
170
|
-
static get toolbox(): {
|
|
171
|
-
icon: string;
|
|
172
|
-
title: "Quote";
|
|
173
|
-
};
|
|
174
|
-
/**
|
|
175
|
-
* Empty Quote is not empty Block
|
|
176
|
-
*
|
|
177
|
-
* @public
|
|
178
|
-
* @returns {boolean}
|
|
179
|
-
*/
|
|
180
|
-
static get contentless(): boolean;
|
|
181
|
-
/**
|
|
182
|
-
* Allow to press Enter inside the Quote
|
|
183
|
-
*
|
|
184
|
-
* @public
|
|
185
|
-
* @returns {boolean}
|
|
186
|
-
*/
|
|
187
|
-
static get enableLineBreaks(): boolean;
|
|
188
|
-
/**
|
|
189
|
-
* Default placeholder for quote text
|
|
190
|
-
*
|
|
191
|
-
* @public
|
|
192
|
-
* @returns {string}
|
|
193
|
-
*/
|
|
194
|
-
static get DEFAULT_QUOTE_PLACEHOLDER(): string;
|
|
195
|
-
/**
|
|
196
|
-
* Default placeholder for quote caption
|
|
197
|
-
*
|
|
198
|
-
* @public
|
|
199
|
-
* @returns {string}
|
|
200
|
-
*/
|
|
201
|
-
static get DEFAULT_CAPTION_PLACEHOLDER(): string;
|
|
202
|
-
/**
|
|
203
|
-
* Default quote alignment
|
|
204
|
-
*
|
|
205
|
-
* @public
|
|
206
|
-
* @returns {string}
|
|
207
|
-
*/
|
|
208
|
-
static get DEFAULT_ALIGNMENT(): Alignment;
|
|
209
|
-
/**
|
|
210
|
-
* Allow Quote to be converted to/from other blocks
|
|
211
|
-
*/
|
|
212
|
-
static get conversionConfig(): {
|
|
213
|
-
/**
|
|
214
|
-
* To create Quote data from string, simple fill 'text' property
|
|
215
|
-
*/
|
|
216
|
-
import: string;
|
|
217
|
-
/**
|
|
218
|
-
* To create string from Quote data, concatenate text and caption
|
|
219
|
-
*
|
|
220
|
-
* @param {QuoteData} quoteData
|
|
221
|
-
* @returns {string}
|
|
222
|
-
*/
|
|
223
|
-
export: (quoteData: QuoteData) => string;
|
|
224
|
-
};
|
|
225
|
-
/**
|
|
226
|
-
* Tool`s styles
|
|
227
|
-
*
|
|
228
|
-
* @returns {QuoteCSS}
|
|
229
|
-
*/
|
|
230
|
-
get CSS(): QuoteCSS;
|
|
231
|
-
/**
|
|
232
|
-
* Tool`s settings properties
|
|
233
|
-
*
|
|
234
|
-
* @returns {*[]}
|
|
235
|
-
*/
|
|
236
|
-
get settings(): {
|
|
237
|
-
name: Alignment;
|
|
238
|
-
icon: string;
|
|
239
|
-
}[];
|
|
240
|
-
/**
|
|
241
|
-
* Create Quote Tool container with inputs
|
|
242
|
-
*
|
|
243
|
-
* @returns {Element}
|
|
244
|
-
*/
|
|
245
|
-
render(): HTMLElement;
|
|
246
|
-
/**
|
|
247
|
-
* Extract Quote data from Quote Tool element
|
|
248
|
-
*
|
|
249
|
-
* @param {HTMLDivElement} quoteElement - element to save
|
|
250
|
-
* @returns {QuoteData}
|
|
251
|
-
*/
|
|
252
|
-
save(quoteElement: HTMLDivElement): QuoteData;
|
|
253
|
-
/**
|
|
254
|
-
* Sanitizer rules
|
|
255
|
-
*/
|
|
256
|
-
static get sanitize(): {
|
|
257
|
-
text: {
|
|
258
|
-
br: boolean;
|
|
259
|
-
};
|
|
260
|
-
caption: {
|
|
261
|
-
br: boolean;
|
|
262
|
-
};
|
|
263
|
-
alignment: {};
|
|
264
|
-
};
|
|
265
|
-
/**
|
|
266
|
-
* Create wrapper for Tool`s settings buttons:
|
|
267
|
-
* 1. Left alignment
|
|
268
|
-
* 2. Center alignment
|
|
269
|
-
*
|
|
270
|
-
* @returns {MenuConfig}
|
|
271
|
-
*
|
|
272
|
-
*/
|
|
273
|
-
renderSettings(): HTMLElement | MenuConfig;
|
|
274
|
-
/**
|
|
275
|
-
* Toggle quote`s alignment
|
|
276
|
-
*
|
|
277
|
-
* @param {string} tune - alignment
|
|
278
|
-
* @private
|
|
279
|
-
*/
|
|
280
|
-
_toggleTune(tune: Alignment): void;
|
|
281
|
-
}
|
|
282
|
-
export {};
|