@webiny/app-admin 5.23.1 → 5.24.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/base/Admin.d.ts +1 -8
  2. package/base/Base.d.ts +1 -1
  3. package/base/plugins/AddGraphQLQuerySelection.d.ts +2 -2
  4. package/base/providers/ApolloProvider.d.ts +9 -3
  5. package/base/providers/TelemetryProvider.d.ts +2 -4
  6. package/base/providers/TelemetryProvider.js +5 -0
  7. package/base/providers/UiStateProvider.d.ts +1 -3
  8. package/base/providers/ViewCompositionProvider.d.ts +2 -4
  9. package/base/ui/Menu.d.ts +6 -1
  10. package/base/ui/Menu.js +87 -25
  11. package/base/ui/Navigation.d.ts +3 -5
  12. package/base/ui/Navigation.js +9 -26
  13. package/base/ui/Search.d.ts +2 -5
  14. package/base/ui/Tags.d.ts +1 -1
  15. package/base/ui/UserMenu.d.ts +2 -5
  16. package/components/AdminLayout.d.ts +1 -2
  17. package/components/AppInstaller/AppInstaller.d.ts +2 -4
  18. package/components/AppInstaller/Sidebar.d.ts +8 -6
  19. package/components/AppInstaller/Sidebar.js +9 -9
  20. package/components/AppInstaller/styled.d.ts +4 -4
  21. package/components/AppInstaller/useInstaller.d.ts +26 -9
  22. package/components/AppInstaller/useInstaller.js +42 -34
  23. package/components/EmptyView.d.ts +4 -4
  24. package/components/FileManager/BottomInfoBar/SupportedFileTypes.d.ts +5 -4
  25. package/components/FileManager/BottomInfoBar/SupportedFileTypes.js +2 -1
  26. package/components/FileManager/BottomInfoBar/UploadStatus.d.ts +5 -4
  27. package/components/FileManager/BottomInfoBar.d.ts +4 -2
  28. package/components/FileManager/DropFilesHere.d.ts +4 -3
  29. package/components/FileManager/DropFilesHere.js +5 -2
  30. package/components/FileManager/File.d.ts +7 -8
  31. package/components/FileManager/File.js +11 -5
  32. package/components/FileManager/FileDetails/Name.d.ts +7 -5
  33. package/components/FileManager/FileDetails/Name.js +2 -2
  34. package/components/FileManager/FileDetails/Tags.d.ts +7 -5
  35. package/components/FileManager/FileDetails/Tags.js +4 -2
  36. package/components/FileManager/FileDetails.d.ts +6 -8
  37. package/components/FileManager/FileDetails.js +14 -2
  38. package/components/FileManager/FileManagerContext.d.ts +12 -9
  39. package/components/FileManager/FileManagerContext.js +9 -7
  40. package/components/FileManager/FileManagerView.d.ts +2 -10
  41. package/components/FileManager/FileManagerView.js +19 -8
  42. package/components/FileManager/LeftSidebar.d.ts +6 -5
  43. package/components/FileManager/LeftSidebar.js +4 -4
  44. package/components/FileManager/NoPermissionView.d.ts +2 -2
  45. package/components/FileManager/NoResults.d.ts +3 -2
  46. package/components/FileManager/NoResults.js +5 -2
  47. package/components/FileManager/getFileTypePlugin.d.ts +4 -1
  48. package/components/FileManager/getFileTypePlugin.js +5 -0
  49. package/components/FileManager/getFileUploader.d.ts +2 -1
  50. package/components/FileManager/outputFileSelectionError.d.ts +4 -1
  51. package/components/FileManager/outputFileSelectionError.js +5 -0
  52. package/components/FileManager/types.d.ts +49 -0
  53. package/components/FileManager/types.js +1 -0
  54. package/components/FileManager.d.ts +15 -10
  55. package/components/FileManager.js +15 -12
  56. package/components/FloatingActionButton.d.ts +2 -2
  57. package/components/MultiImageUpload.d.ts +13 -4
  58. package/components/MultiImageUpload.js +15 -4
  59. package/components/OverlayLayout/OverlayLayout.d.ts +9 -12
  60. package/components/Permissions/StyledComponents.d.ts +6 -4
  61. package/components/RichTextEditor/RichTextEditor.d.ts +2 -2
  62. package/components/RichTextEditor/tools/header/index.d.ts +33 -34
  63. package/components/RichTextEditor/tools/header/index.js +2 -3
  64. package/components/RichTextEditor/tools/image/index.d.ts +36 -13
  65. package/components/RichTextEditor/tools/image/index.js +4 -2
  66. package/components/RichTextEditor/tools/image/tunes.d.ts +12 -15
  67. package/components/RichTextEditor/tools/image/tunes.js +2 -1
  68. package/components/RichTextEditor/tools/image/types.d.ts +29 -0
  69. package/components/RichTextEditor/tools/image/types.js +1 -0
  70. package/components/RichTextEditor/tools/image/ui.d.ts +33 -26
  71. package/components/RichTextEditor/tools/image/ui.js +24 -11
  72. package/components/RichTextEditor/tools/paragraph/index.d.ts +31 -31
  73. package/components/RichTextEditor/tools/paragraph/index.js +11 -15
  74. package/components/RichTextEditor/tools/textColor/index.d.ts +22 -21
  75. package/components/RichTextEditor/tools/textColor/index.js +3 -1
  76. package/components/Routes.d.ts +2 -2
  77. package/components/SearchUI.d.ts +4 -4
  78. package/components/SimpleForm/SimpleForm.d.ts +7 -9
  79. package/components/SimpleUI/InputField.d.ts +3 -3
  80. package/components/SimpleUI/InputField.js +18 -18
  81. package/components/SingleImageUpload.d.ts +4 -9
  82. package/components/SingleImageUpload.js +2 -1
  83. package/components/SplitView/SplitView.d.ts +5 -5
  84. package/hooks/useConfirmationDialog.d.ts +6 -5
  85. package/hooks/useConfirmationDialog.js +1 -2
  86. package/hooks/useDialog.d.ts +8 -3
  87. package/hooks/useDialog.js +1 -1
  88. package/hooks/useSnackbar.d.ts +6 -3
  89. package/package.json +17 -14
  90. package/plugins/FileManagerFileTypePlugin.d.ts +1 -1
  91. package/plugins/MenuPlugin.d.ts +3 -3
  92. package/plugins/fileManager/fileImage/DeleteAction.d.ts +6 -2
  93. package/plugins/fileManager/fileImage/EditAction.d.ts +7 -6
  94. package/plugins/fileManager/fileImage/EditAction.js +18 -9
  95. package/plugins/globalSearch/SearchBar.d.ts +13 -0
  96. package/plugins/globalSearch/SearchBar.js +5 -0
  97. package/plugins/globalSearch/SearchBarDropdown.d.ts +16 -1
  98. package/plugins/globalSearch/index.d.ts +2 -1
  99. package/plugins/globalSearch/styled.d.ts +3 -3
  100. package/plugins/index.d.ts +2 -1
  101. package/types.d.ts +8 -6
  102. package/ui/UIElement.d.ts +1 -1
  103. package/ui/UIView.d.ts +1 -1
  104. package/ui/elements/AccordionElement.d.ts +5 -5
  105. package/ui/elements/AccordionElement.js +4 -0
  106. package/ui/elements/ButtonElement.d.ts +3 -3
  107. package/ui/elements/ButtonGroupElement.d.ts +2 -2
  108. package/ui/elements/NavigationMenuElement.d.ts +5 -1
  109. package/ui/elements/NavigationMenuElement.js +3 -2
  110. package/ui/elements/PlaceholderElement.d.ts +2 -1
  111. package/ui/elements/SmallButtonElement.d.ts +1 -1
  112. package/ui/elements/TypographyElement.d.ts +1 -1
  113. package/ui/elements/form/FileManagerElement/styled.d.ts +9 -9
  114. package/ui/elements/form/FileManagerElement.d.ts +4 -3
  115. package/ui/elements/form/FormElement.d.ts +5 -5
  116. package/ui/elements/form/FormFieldElement.d.ts +6 -5
  117. package/ui/elements/form/FormFieldElement.js +5 -5
  118. package/ui/elements/form/InputElement.d.ts +1 -0
  119. package/ui/views/AdminView/HeaderSectionCenterElement.d.ts +2 -2
  120. package/ui/views/AdminView/HeaderSectionLeftElement.d.ts +2 -2
  121. package/ui/views/AdminView/HeaderSectionRightElement.d.ts +2 -2
  122. package/ui/views/AdminView/components/Hamburger.d.ts +2 -2
  123. package/ui/views/AdminView/components/Snackbar.d.ts +2 -2
  124. package/ui/views/FormView/FormContainerElement.d.ts +2 -2
  125. package/ui/views/FormView/FormFooterElement.d.ts +3 -3
  126. package/ui/views/FormView/FormHeaderElement.d.ts +2 -2
  127. package/ui/views/FormView.d.ts +1 -1
  128. package/ui/views/FormView.js +4 -2
  129. package/ui/views/OverlayView/ContentElement.d.ts +2 -2
  130. package/ui/views/OverlayView/HeaderElement.d.ts +5 -5
  131. package/ui/views/OverlayView/useOverlayView.d.ts +4 -5
  132. package/ui/views/OverlayView/useOverlayView.js +2 -2
  133. package/ui/views/OverlayView.d.ts +4 -6
  134. package/ui/views/SplitView/SplitViewPanelElement.d.ts +3 -3
  135. package/ui/views/SplitView.d.ts +1 -1
@@ -1,16 +1,17 @@
1
- declare type Tune = {
2
- name: string;
3
- icon: string;
4
- title: string;
5
- action?: Function;
6
- };
1
+ import { API } from "@editorjs/editorjs";
2
+ import { ImageToolData, Tune, TuneOnChangeCallable } from "./types";
3
+ interface TunesParams {
4
+ api: API;
5
+ actions: Tune[];
6
+ onChange: TuneOnChangeCallable;
7
+ }
7
8
  /**
8
9
  * Working with Block Tunes
9
10
  */
10
11
  export default class Tunes {
11
12
  private api;
12
- private actions;
13
- private onChange;
13
+ private readonly actions;
14
+ private readonly onChange;
14
15
  private buttons;
15
16
  /**
16
17
  * @param {object} tune - image tool Tunes managers
@@ -18,11 +19,7 @@ export default class Tunes {
18
19
  * @param {object} tune.actions - list of user defined tunes
19
20
  * @param {Function} tune.onChange - tune toggling callback
20
21
  */
21
- constructor({ api, actions, onChange }: {
22
- api: any;
23
- actions: any;
24
- onChange: any;
25
- });
22
+ constructor({ api, actions, onChange }: TunesParams);
26
23
  /**
27
24
  * Available Image tunes
28
25
  *
@@ -46,13 +43,13 @@ export default class Tunes {
46
43
  * @param {ImageToolData} toolData - generate Elements of tunes
47
44
  * @returns {Element}
48
45
  */
49
- render(toolData: any): any;
46
+ render(toolData: ImageToolData): HTMLElement;
50
47
  /**
51
48
  * Clicks to one of the tunes
52
49
  *
53
50
  * @param {string} tuneName - clicked tune name
54
51
  * @param {Function} customFunction - function to execute on click
55
52
  */
56
- tuneClicked(tuneName: any, customFunction: any): boolean;
53
+ tuneClicked(tuneName: string, customFunction?: TuneOnChangeCallable): boolean;
57
54
  }
58
55
  export {};
@@ -83,7 +83,8 @@ var Tunes = /*#__PURE__*/function () {
83
83
  _this.tuneClicked(tune.name, tune.action);
84
84
  });
85
85
  el.dataset.tune = tune.name;
86
- el.classList.toggle(_this.CSS.buttonActive, toolData[tune.name]);
86
+ var name = tune.name;
87
+ el.classList.toggle(_this.CSS.buttonActive, !!toolData[name]);
87
88
 
88
89
  _this.buttons.push(el);
89
90
 
@@ -0,0 +1,29 @@
1
+ export interface TuneOnChangeCallable {
2
+ (tune: string): boolean | void;
3
+ }
4
+ export interface Tune {
5
+ name: string;
6
+ icon: string;
7
+ title: string;
8
+ action?: TuneOnChangeCallable;
9
+ }
10
+ export interface ImageToolData {
11
+ caption: string;
12
+ file: string;
13
+ }
14
+ export interface ImageToolFile {
15
+ src: string;
16
+ }
17
+ export interface GetFileSourceCallable {
18
+ (file: ImageToolFile | string): string;
19
+ }
20
+ export interface OnSelectFileCallable {
21
+ (file: ImageToolFile): string;
22
+ }
23
+ export interface ImageToolConfig {
24
+ getFileSrc: GetFileSourceCallable;
25
+ onSelectFile: OnSelectFileCallable;
26
+ captionPlaceholder?: string;
27
+ actions: Tune[];
28
+ context: Record<string, any>;
29
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,17 @@
1
+ import { API } from "@editorjs/editorjs";
2
+ import { ImageToolConfig, ImageToolData } from "./types";
3
+ interface OnSelectFileCallable {
4
+ (): void;
5
+ }
6
+ interface UiStatus {
7
+ [key: string]: string;
8
+ }
9
+ interface UiParams {
10
+ api: API;
11
+ config: ImageToolConfig;
12
+ onSelectFile: OnSelectFileCallable;
13
+ readOnly: boolean;
14
+ }
1
15
  /**
2
16
  * Class for working with UI:
3
17
  * - rendering base structure
@@ -7,9 +21,9 @@
7
21
  export default class Ui {
8
22
  private api;
9
23
  private config;
10
- private readOnly;
11
- private onSelectFile;
12
- nodes: {
24
+ private readonly readOnly;
25
+ private readonly onSelectFile;
26
+ readonly nodes: {
13
27
  wrapper: HTMLElement;
14
28
  imageContainer: HTMLElement;
15
29
  fileButton: HTMLElement;
@@ -17,18 +31,13 @@ export default class Ui {
17
31
  caption: HTMLElement;
18
32
  };
19
33
  /**
20
- * @param {object} ui - image tool Ui module
21
- * @param {object} ui.api - Editor.js API
22
- * @param {ImageConfig} ui.config - user config
23
- * @param {Function} ui.onSelectFile - callback for clicks on Select file button
24
- * @param {boolean} ui.readOnly - read-only mode flag
34
+ * @param ui - image tool Ui module
35
+ * @param ui.api - Editor.js API
36
+ * @param ui.config - user config
37
+ * @param ui.onSelectFile - callback for clicks on Select file button
38
+ * @param ui.readOnly - read-only mode flag
25
39
  */
26
- constructor({ api, config, onSelectFile, readOnly }: {
27
- api: any;
28
- config: any;
29
- onSelectFile: any;
30
- readOnly: any;
31
- });
40
+ constructor({ api, config, onSelectFile, readOnly }: UiParams);
32
41
  /**
33
42
  * CSS classes
34
43
  *
@@ -53,44 +62,41 @@ export default class Ui {
53
62
  *
54
63
  * @returns {{EMPTY: string, UPLOADING: string, FILLED: string}}
55
64
  */
56
- static get status(): {
57
- EMPTY: string;
58
- FILLED: string;
59
- };
65
+ static get status(): UiStatus;
60
66
  /**
61
67
  * Renders tool UI
62
68
  *
63
69
  * @param {ImageToolData} toolData - saved tool data
64
70
  * @returns {Element}
65
71
  */
66
- render(toolData: any): HTMLElement;
72
+ render(toolData: ImageToolData): HTMLElement;
67
73
  /**
68
74
  * Creates upload-file button
69
75
  *
70
76
  * @returns {Element}
71
77
  */
72
- createFileButton(): any;
78
+ createFileButton(): HTMLElement;
73
79
  /**
74
80
  * Shows an image
75
81
  *
76
82
  * @param {string} url - image source
77
83
  * @returns {void}
78
84
  */
79
- fillImage(url: any): void;
85
+ fillImage(url: string): void;
80
86
  /**
81
87
  * Shows caption input
82
88
  *
83
89
  * @param {string} text - caption text
84
90
  * @returns {void}
85
91
  */
86
- fillCaption(text: any): void;
92
+ fillCaption(text: string): void;
87
93
  /**
88
94
  * Changes UI status
89
95
  *
90
96
  * @param {string} status - see {@link Ui.status} constants
91
97
  * @returns {void}
92
98
  */
93
- toggleStatus(status: any): void;
99
+ toggleStatus(status: string): void;
94
100
  /**
95
101
  * Apply visual representation of activated tune
96
102
  *
@@ -98,7 +104,7 @@ export default class Ui {
98
104
  * @param {boolean} status - true for enable, false for disable
99
105
  * @returns {void}
100
106
  */
101
- applyTune(tuneName: any, status: any): void;
107
+ applyTune(tuneName: string, status: boolean): void;
102
108
  }
103
109
  /**
104
110
  * Helper for making Elements with attributes
@@ -106,6 +112,7 @@ export default class Ui {
106
112
  * @param {string} tagName - new Element tag name
107
113
  * @param {Array|string} classNames - list or name of CSS class
108
114
  * @param {object} attributes - any attributes
109
- * @returns {Element}
115
+ * @returns {HTMLElement}
110
116
  */
111
- export declare const make: (tagName: any, classNames?: any, attributes?: {}) => any;
117
+ export declare const make: (tagName: string, classNames?: string[] | string, attributes?: Record<string, string | number | boolean>) => HTMLElement;
118
+ export {};
@@ -11,11 +11,11 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
11
11
  */
12
12
  var Ui = /*#__PURE__*/function () {
13
13
  /**
14
- * @param {object} ui - image tool Ui module
15
- * @param {object} ui.api - Editor.js API
16
- * @param {ImageConfig} ui.config - user config
17
- * @param {Function} ui.onSelectFile - callback for clicks on Select file button
18
- * @param {boolean} ui.readOnly - read-only mode flag
14
+ * @param ui - image tool Ui module
15
+ * @param ui.api - Editor.js API
16
+ * @param ui.config - user config
17
+ * @param ui.onSelectFile - callback for clicks on Select file button
18
+ * @param ui.readOnly - read-only mode flag
19
19
  */
20
20
  function Ui(_ref) {
21
21
  var api = _ref.api,
@@ -204,9 +204,11 @@ var Ui = /*#__PURE__*/function () {
204
204
  }, {
205
205
  key: "fillCaption",
206
206
  value: function fillCaption(text) {
207
- if (this.nodes.caption) {
208
- this.nodes.caption.innerHTML = text;
207
+ if (!this.nodes.caption) {
208
+ return;
209
209
  }
210
+
211
+ this.nodes.caption.innerHTML = text;
210
212
  }
211
213
  /**
212
214
  * Changes UI status
@@ -219,9 +221,12 @@ var Ui = /*#__PURE__*/function () {
219
221
  key: "toggleStatus",
220
222
  value: function toggleStatus(status) {
221
223
  for (var statusType in Ui.status) {
222
- if (Object.prototype.hasOwnProperty.call(Ui.status, statusType)) {
223
- this.nodes.wrapper.classList.toggle("".concat(this.CSS.wrapper, "--").concat(Ui.status[statusType]), status === Ui.status[statusType]);
224
+ if (Object.prototype.hasOwnProperty.call(Ui.status, statusType) === false) {
225
+ continue;
224
226
  }
227
+
228
+ var newStatus = Ui.status[statusType];
229
+ this.nodes.wrapper.classList.toggle("".concat(this.CSS.wrapper, "--").concat(newStatus), status === newStatus);
225
230
  }
226
231
  }
227
232
  /**
@@ -255,14 +260,14 @@ var Ui = /*#__PURE__*/function () {
255
260
  * @param {string} tagName - new Element tag name
256
261
  * @param {Array|string} classNames - list or name of CSS class
257
262
  * @param {object} attributes - any attributes
258
- * @returns {Element}
263
+ * @returns {HTMLElement}
259
264
  */
260
265
 
261
266
 
262
267
  export { Ui as default };
263
268
  export var make = function make(tagName) {
264
269
  var classNames = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
265
- var attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
270
+ var attributes = arguments.length > 2 ? arguments[2] : undefined;
266
271
  var el = document.createElement(tagName);
267
272
 
268
273
  if (Array.isArray(classNames)) {
@@ -273,7 +278,15 @@ export var make = function make(tagName) {
273
278
  el.classList.add(classNames);
274
279
  }
275
280
 
281
+ if (!attributes) {
282
+ return el;
283
+ }
284
+
276
285
  for (var attrName in attributes) {
286
+ /**
287
+ * Unfortunately it is a problem to map attributes to element because element is complaining
288
+ * that attrName is a string, which cannot index the HTMLElement
289
+ */
277
290
  el[attrName] = attributes[attrName];
278
291
  }
279
292
 
@@ -1,31 +1,32 @@
1
- import { API } from "@editorjs/editorjs";
1
+ import { PasteEvent } from "@editorjs/editorjs";
2
2
  import { Alignment, TextAlign } from "../utils";
3
3
  /**
4
4
  * @typedef {object} ParagraphConfig
5
5
  * @property {string} placeholder - placeholder for the empty paragraph
6
6
  * @property {boolean} preserveBlank - Whether or not to keep blank paragraphs when saving editor data`
7
7
  */
8
- declare type ParagraphConfig = {
8
+ interface ParagraphConfig {
9
9
  placeholder: string;
10
10
  preserveBlank: boolean;
11
11
  typography?: Typography;
12
- };
12
+ }
13
13
  /**
14
14
  * @typedef {Object} ParagraphData
15
15
  * @description Tool's input and output data format
16
16
  * @property {String} text — Paragraph's content. Can include HTML tags: <a><b><i>
17
17
  */
18
- declare type ParagraphData = {
18
+ interface ParagraphData {
19
19
  text: string;
20
20
  textAlign: TextAlign;
21
- };
22
- declare type Typography = {
21
+ className?: string;
22
+ }
23
+ interface Typography {
23
24
  [key: string]: {
24
25
  label: string;
25
26
  component: string;
26
27
  className: string;
27
28
  };
28
- };
29
+ }
29
30
  interface ParagraphArgs {
30
31
  data: ParagraphData;
31
32
  config: ParagraphConfig;
@@ -33,17 +34,16 @@ interface ParagraphArgs {
33
34
  readOnly: boolean;
34
35
  }
35
36
  declare class Paragraph {
36
- api: API;
37
- readOnly: boolean;
38
- _CSS: any;
39
- _settings: any;
40
- _data: any;
41
- _element: any;
42
- _placeholder: string;
43
- _preserveBlank: boolean;
44
- alignments: Alignment[];
45
- settingsButtons: HTMLElement[];
46
- typography: Typography;
37
+ private readonly api;
38
+ private readonly readOnly;
39
+ private readonly _CSS;
40
+ private _data;
41
+ private readonly _element;
42
+ private readonly _placeholder;
43
+ private readonly _preserveBlank;
44
+ private readonly alignments;
45
+ private readonly settingsButtons;
46
+ private readonly typography;
47
47
  /**
48
48
  * Render plugin`s main Element and fill it with saved data
49
49
  *
@@ -87,7 +87,7 @@ declare class Paragraph {
87
87
  * @returns {ParagraphData} Current data
88
88
  * @private
89
89
  */
90
- get data(): any;
90
+ get data(): ParagraphData;
91
91
  /**
92
92
  * Store data in plugin:
93
93
  * - at the this._data property
@@ -96,7 +96,7 @@ declare class Paragraph {
96
96
  * @param {ParagraphData} data — data to set
97
97
  * @private
98
98
  */
99
- set data(data: any);
99
+ set data(data: ParagraphData);
100
100
  /**
101
101
  * Used by Editor paste handling API.
102
102
  * Provides configuration to handle P tags.
@@ -127,7 +127,7 @@ declare class Paragraph {
127
127
  *
128
128
  * @param {KeyboardEvent} e - key up event
129
129
  */
130
- onKeyUp(e: any): void;
130
+ onKeyUp(e: KeyboardEvent): void;
131
131
  /**
132
132
  * Create Tool's view
133
133
  * @return {HTMLElement}
@@ -139,7 +139,7 @@ declare class Paragraph {
139
139
  *
140
140
  * @returns {HTMLDivElement}
141
141
  */
142
- render(): any;
142
+ render(): HTMLDivElement;
143
143
  /**
144
144
  * Create Block's settings block
145
145
  *
@@ -152,7 +152,7 @@ declare class Paragraph {
152
152
  * @param {ParagraphData} data
153
153
  * @public
154
154
  */
155
- merge(data: any): void;
155
+ merge(data: ParagraphData): void;
156
156
  /**
157
157
  * Validate Paragraph block data:
158
158
  * - check for emptiness
@@ -161,17 +161,17 @@ declare class Paragraph {
161
161
  * @returns {boolean} false if saved data is not correct, otherwise true
162
162
  * @public
163
163
  */
164
- validate(savedData: any): boolean;
164
+ validate(savedData: ParagraphData): boolean;
165
165
  /**
166
166
  * Extract Tool's data from the view
167
167
  * @param {HTMLDivElement} toolsContent - Paragraph tools rendered view
168
168
  * @returns {ParagraphData} - saved data
169
169
  * @public
170
170
  */
171
- save(toolsContent: any): {
172
- text: any;
171
+ save(toolsContent: HTMLElement): {
172
+ text: string;
173
173
  textAlign: TextAlign.START;
174
- className: any;
174
+ className: string;
175
175
  };
176
176
  /**
177
177
  * Extract textAlign from className
@@ -179,19 +179,19 @@ declare class Paragraph {
179
179
  * @param {string} className - heading element className
180
180
  * @returns {TextAlign} textAlign
181
181
  */
182
- getTextAlign(className: any): TextAlign.START;
182
+ getTextAlign(className: string): TextAlign.START;
183
183
  /**
184
184
  * On paste callback fired from Editor.
185
185
  *
186
186
  * @param {PasteEvent} event - event with pasted data
187
187
  */
188
- onPaste(event: any): void;
188
+ onPaste(event: PasteEvent): void;
189
189
  /**
190
190
  * Callback for Block's settings buttons
191
191
  *
192
192
  * @param {number} alignment - level to set
193
193
  */
194
- setAlignment(alignment: any): void;
194
+ setAlignment(alignment: Alignment): void;
195
195
  /**
196
196
  * Callback for Block's settings buttons
197
197
  *
@@ -206,6 +206,6 @@ declare class Paragraph {
206
206
  * @returns {HeaderData}
207
207
  * @private
208
208
  */
209
- normalizeData(data: any): any;
209
+ normalizeData(data?: Partial<ParagraphData>): ParagraphData;
210
210
  }
211
211
  export default Paragraph;
@@ -4,13 +4,10 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
4
  import _createClass from "@babel/runtime/helpers/createClass";
5
5
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
6
6
  import { ALIGNMENTS, TextAlign, ALIGNMENT_ICONS } from "../utils";
7
- /**
8
- * @typedef {object} ParagraphConfig
9
- * @property {string} placeholder - placeholder for the empty paragraph
10
- * @property {boolean} preserveBlank - Whether or not to keep blank paragraphs when saving editor data`
11
- */
12
7
 
13
8
  var Paragraph = /*#__PURE__*/function () {
9
+ // private readonly _settings: any;
10
+
14
11
  /**
15
12
  * Render plugin`s main Element and fill it with saved data
16
13
  *
@@ -34,8 +31,6 @@ var Paragraph = /*#__PURE__*/function () {
34
31
 
35
32
  _defineProperty(this, "_CSS", void 0);
36
33
 
37
- _defineProperty(this, "_settings", void 0);
38
-
39
34
  _defineProperty(this, "_data", void 0);
40
35
 
41
36
  _defineProperty(this, "_element", void 0);
@@ -74,8 +69,9 @@ var Paragraph = /*#__PURE__*/function () {
74
69
  this._element = this.drawView();
75
70
  this._preserveBlank = config.preserveBlank !== undefined ? config.preserveBlank : false;
76
71
  this.settingsButtons = [];
77
- this.alignments = ALIGNMENTS;
78
- this.data = this.normalizeData(data);
72
+ this.alignments = ALIGNMENTS; // Call the `data` setter, to properly render the view element.
73
+
74
+ this.data = this._data;
79
75
  }
80
76
  /**
81
77
  * Default placeholder for Paragraph Tool
@@ -320,9 +316,9 @@ var Paragraph = /*#__PURE__*/function () {
320
316
  }, {
321
317
  key: "merge",
322
318
  value: function merge(data) {
323
- this.data = {
319
+ this.data = _objectSpread(_objectSpread({}, this.data), {}, {
324
320
  text: this.data.text + data.text
325
- };
321
+ });
326
322
  }
327
323
  /**
328
324
  * Validate Paragraph block data:
@@ -382,10 +378,10 @@ var Paragraph = /*#__PURE__*/function () {
382
378
  }, {
383
379
  key: "onPaste",
384
380
  value: function onPaste(event) {
385
- var data = {
386
- text: event.detail.data.innerHTML
387
- };
388
- this.data = data;
381
+ var detail = event.detail;
382
+ this.data = _objectSpread(_objectSpread({}, this.data), {}, {
383
+ text: detail.data.innerHTML
384
+ });
389
385
  }
390
386
  /**
391
387
  * Callback for Block's settings buttons
@@ -1,20 +1,22 @@
1
1
  import { API } from "@editorjs/editorjs";
2
- declare class TextColorTool {
3
- _state: boolean;
4
- color: string;
2
+ interface Config {
3
+ themeColors: string[];
4
+ }
5
+ interface TextColorToolParams {
5
6
  api: API;
6
- tag: string;
7
- class: string;
8
- colorPicker: HTMLDivElement;
9
- button: HTMLButtonElement;
10
- config: {
11
- themeColors: string[];
12
- };
13
- _CSS: any;
14
- constructor({ api, config }: {
15
- api: any;
16
- config: any;
17
- });
7
+ config: Config;
8
+ }
9
+ declare class TextColorTool {
10
+ private _state;
11
+ private color;
12
+ private readonly api;
13
+ private readonly tag;
14
+ private readonly class;
15
+ private colorPicker;
16
+ private button;
17
+ private readonly config;
18
+ private readonly _CSS;
19
+ constructor({ api, config }: TextColorToolParams);
18
20
  static get isInline(): boolean;
19
21
  /**
20
22
  * Sanitize method returns rules to let Editor know which HTML tags it should respect.
@@ -35,19 +37,18 @@ declare class TextColorTool {
35
37
  /**
36
38
  * Finally, when button is pressed Editor calls
37
39
  * surround method of the tool with Range object as an argument.
38
- * @param range
39
40
  */
40
- surround(range: any): void;
41
- wrap(range: any): void;
42
- unwrap(range: any): void;
43
- showActions(mark: any): void;
41
+ surround(range: Range): void;
42
+ wrap(range: Range): void;
43
+ unwrap(range: Range): void;
44
+ showActions(mark: HTMLElement): void;
44
45
  hideActions(): void;
45
46
  /**
46
47
  * CheckState method of each Inline Tool is called by Editor with current `Selection`
47
48
  * when user selects some text
48
49
  */
49
50
  checkState(): void;
50
- convertToHex(color: any): string;
51
+ convertToHex(color: string): string;
51
52
  clear(): void;
52
53
  }
53
54
  export default TextColorTool;
@@ -113,7 +113,6 @@ var TextColorTool = /*#__PURE__*/function () {
113
113
  /**
114
114
  * Finally, when button is pressed Editor calls
115
115
  * surround method of the tool with Range object as an argument.
116
- * @param range
117
116
  */
118
117
 
119
118
  }, {
@@ -213,6 +212,9 @@ var TextColorTool = /*#__PURE__*/function () {
213
212
  // so markup added by Inline Tool will be removed on pasting or on saving.
214
213
  // We need this config so that `class` & `style` attributes will remain intact for "span".
215
214
  return {
215
+ /**
216
+ * TODO: figure out the element type
217
+ */
216
218
  span: function span(el) {
217
219
  // Respect `class` and `style` attributes if this condition is meet.
218
220
  if (el.classList.contains(COLOR_TOOL_CLASS)) {
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  interface RoutesProps {
3
3
  routes: JSX.Element[];
4
4
  }
5
- export declare const Routes: (props: RoutesProps) => JSX.Element;
5
+ export declare const Routes: React.FC<RoutesProps>;
6
6
  export {};
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
2
- export declare type SearchProps = {
1
+ import React from "react";
2
+ export interface SearchProps {
3
3
  value: string;
4
4
  onChange: (value: string) => void;
5
5
  inputPlaceholder?: string;
6
- };
7
- declare const Search: ({ value, onChange, inputPlaceholder }: SearchProps) => JSX.Element;
6
+ }
7
+ declare const Search: React.FC<SearchProps>;
8
8
  export default Search;
@@ -1,21 +1,19 @@
1
1
  import * as React from "react";
2
- declare const title: string;
3
- declare const icon: string;
4
2
  export declare const SimpleForm: (props: {
5
3
  children: React.ReactNode;
6
4
  "data-testid"?: string;
7
5
  noElevation?: boolean;
8
6
  className?: string;
9
7
  }) => JSX.Element;
10
- export declare const SimpleFormHeader: (props: {
8
+ interface SimpleFormHeaderProps {
11
9
  title: React.ReactNode;
12
10
  icon?: React.ReactElement<any>;
13
11
  children?: React.ReactNode;
14
- }) => JSX.Element;
15
- export declare const SimpleFormFooter: (props: {
12
+ }
13
+ export declare const SimpleFormHeader: React.FC<SimpleFormHeaderProps>;
14
+ interface SimpleFormFooterProps {
16
15
  children: React.ReactNode;
17
- }) => JSX.Element;
18
- export declare const SimpleFormContent: (props: {
19
- children: any;
20
- }) => any;
16
+ }
17
+ export declare const SimpleFormFooter: React.FC<SimpleFormFooterProps>;
18
+ export declare const SimpleFormContent: React.FC;
21
19
  export {};
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
- declare type InputBoxProps = {
2
+ interface InputBoxProps {
3
3
  value?: string | number;
4
4
  onChange?: (value: any) => void;
5
5
  defaultValue?: string | number;
6
6
  [key: string]: any;
7
- };
8
- declare const _default: React.MemoExoticComponent<({ className, value, onChange, label, description, validation, defaultValue, ...props }: InputBoxProps) => JSX.Element>;
7
+ }
8
+ declare const _default: React.NamedExoticComponent<InputBoxProps>;
9
9
  export default _default;