@searpent/react-image-annotate 2.0.5 → 2.0.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.
Files changed (195) hide show
  1. package/Annotator/examplePhotos.js +6976 -0
  2. package/Annotator/index.js +268 -0
  3. package/Annotator/reducers/combine-reducers.js +14 -0
  4. package/Annotator/reducers/convert-expanding-line-to-polygon.js +73 -0
  5. package/{src/Annotator → Annotator}/reducers/fix-twisted.js +3 -5
  6. package/Annotator/reducers/general-reducer.js +1152 -0
  7. package/Annotator/reducers/get-active-image.js +27 -0
  8. package/Annotator/reducers/get-implied-video-regions.js +180 -0
  9. package/Annotator/reducers/history-handler.js +38 -0
  10. package/Annotator/reducers/image-reducer.js +20 -0
  11. package/Annotator/reducers/video-reducer.js +88 -0
  12. package/ClassSelectionMenu/index.js +135 -0
  13. package/Crosshairs/index.js +53 -0
  14. package/DebugSidebarBox/index.js +20 -0
  15. package/DemoSite/Editor.js +194 -0
  16. package/DemoSite/ErrorBoundaryDialog.js +64 -0
  17. package/DemoSite/index.js +40 -0
  18. package/{src/Editor → Editor}/annotation-plugin/annotation.css +0 -0
  19. package/Editor/annotation-plugin/annotation.js +613 -0
  20. package/Editor/index.js +57 -0
  21. package/{src/Editor → Editor}/tools.js +2 -3
  22. package/FullImageSegmentationAnnotator/index.js +7 -0
  23. package/GroupSelectorSidebarBox/index.js +63 -0
  24. package/HighlightBox/index.js +99 -0
  25. package/HistorySidebarBox/index.js +71 -0
  26. package/ImageCanvas/index.js +429 -0
  27. package/ImageCanvas/region-tools.js +165 -0
  28. package/{src/ImageCanvas → ImageCanvas}/styles.js +12 -8
  29. package/ImageCanvas/use-mouse.js +180 -0
  30. package/ImageCanvas/use-project-box.js +27 -0
  31. package/ImageCanvas/use-wasd-mode.js +62 -0
  32. package/ImageMask/index.js +133 -0
  33. package/ImageMask/load-image.js +25 -0
  34. package/ImageSelectorSidebarBox/index.js +60 -0
  35. package/KeyframeTimeline/get-time-string.js +27 -0
  36. package/KeyframeTimeline/index.js +233 -0
  37. package/KeyframesSelectorSidebarBox/index.js +93 -0
  38. package/LandingPage/index.js +159 -0
  39. package/MainLayout/icon-dictionary.js +104 -0
  40. package/MainLayout/index.js +469 -0
  41. package/{src/MainLayout → MainLayout}/styles.js +6 -7
  42. package/MainLayout/types.js +0 -0
  43. package/MainLayout/use-implied-video-regions.js +13 -0
  44. package/MetadataEditorSidebarBox/index.js +126 -0
  45. package/PageSelector/index.js +69 -0
  46. package/{src/PageSelector → PageSelector}/page-selector.css +18 -0
  47. package/PointDistances/index.js +73 -0
  48. package/PreventScrollToParents/index.js +51 -0
  49. package/RegionLabel/index.js +205 -0
  50. package/{src/RegionLabel → RegionLabel}/styles.js +12 -15
  51. package/RegionSelectAndTransformBoxes/index.js +167 -0
  52. package/RegionSelectorSidebarBox/index.js +248 -0
  53. package/{src/RegionSelectorSidebarBox → RegionSelectorSidebarBox}/styles.js +13 -14
  54. package/RegionShapes/index.js +294 -0
  55. package/RegionTags/index.js +142 -0
  56. package/SettingsDialog/index.js +52 -0
  57. package/SettingsProvider/index.js +58 -0
  58. package/Shortcuts/ShortcutField.js +46 -0
  59. package/Shortcuts/index.js +133 -0
  60. package/ShortcutsManager/index.js +155 -0
  61. package/Sidebar/index.js +69 -0
  62. package/SidebarBoxContainer/index.js +93 -0
  63. package/SmallToolButton/index.js +42 -0
  64. package/TagsSidebarBox/index.js +105 -0
  65. package/TaskDescriptionSidebarBox/index.js +58 -0
  66. package/Theme/index.js +30 -0
  67. package/VideoOrImageCanvasBackground/index.js +151 -0
  68. package/colors.js +14 -0
  69. package/hooks/use-colors.js +101 -0
  70. package/hooks/use-event-callback.js +10 -0
  71. package/hooks/use-exclude-pattern.js +24 -0
  72. package/hooks/use-load-image.js +26 -0
  73. package/hooks/use-window-size.js +46 -0
  74. package/{src/hooks → hooks}/xpattern.js +1 -1
  75. package/index.js +3 -0
  76. package/lib.js +3 -0
  77. package/package.json +1 -1
  78. package/stories.js +5 -0
  79. package/{src/utils → utils}/filter-only-unique.js +1 -1
  80. package/utils/get-from-local-storage.js +7 -0
  81. package/utils/get-hotkey-help-text.js +9 -0
  82. package/utils/get-landmarks-with-transform.js +40 -0
  83. package/utils/photosToImages.js +53 -0
  84. package/utils/regions-to-blocks.js +16 -0
  85. package/utils/set-in-local-storage.js +3 -0
  86. package/.babelrc +0 -6
  87. package/.env +0 -1
  88. package/.flowconfig +0 -2
  89. package/.github/workflows/release-on-master.yml +0 -32
  90. package/.github/workflows/test.yml +0 -16
  91. package/.prettierrc +0 -3
  92. package/.releaserc.js +0 -18
  93. package/.storybook/addons.js +0 -2
  94. package/.storybook/config.js +0 -16
  95. package/LICENSE +0 -21
  96. package/public/favicon.ico +0 -0
  97. package/public/index.html +0 -38
  98. package/src/Annotator/bike-pic.png +0 -0
  99. package/src/Annotator/bike-pic2.png +0 -0
  100. package/src/Annotator/dab-keyframes.story.json +0 -1
  101. package/src/Annotator/examplePhotos.js +0 -7601
  102. package/src/Annotator/index.js +0 -291
  103. package/src/Annotator/index.story.js +0 -807
  104. package/src/Annotator/poses.story.js +0 -150
  105. package/src/Annotator/reducers/combine-reducers.js +0 -7
  106. package/src/Annotator/reducers/convert-expanding-line-to-polygon.js +0 -53
  107. package/src/Annotator/reducers/general-reducer.js +0 -996
  108. package/src/Annotator/reducers/get-active-image.js +0 -21
  109. package/src/Annotator/reducers/get-implied-video-regions.js +0 -115
  110. package/src/Annotator/reducers/history-handler.js +0 -60
  111. package/src/Annotator/reducers/image-reducer.js +0 -23
  112. package/src/Annotator/reducers/video-reducer.js +0 -85
  113. package/src/Annotator/video.story.js +0 -51
  114. package/src/ClassSelectionMenu/index.js +0 -108
  115. package/src/Crosshairs/index.js +0 -64
  116. package/src/DebugSidebarBox/index.js +0 -36
  117. package/src/DemoSite/Editor.js +0 -235
  118. package/src/DemoSite/ErrorBoundaryDialog.js +0 -34
  119. package/src/DemoSite/index.js +0 -41
  120. package/src/DemoSite/index.story.js +0 -10
  121. package/src/DemoSite/simple-segmentation-example.json +0 -572
  122. package/src/Editor/annotation-plugin/annotation.js +0 -515
  123. package/src/Editor/index.js +0 -24
  124. package/src/FullImageSegmentationAnnotator/hard1.story.jpg +0 -0
  125. package/src/FullImageSegmentationAnnotator/hard2.story.jpg +0 -0
  126. package/src/FullImageSegmentationAnnotator/hard3.story.jpg +0 -0
  127. package/src/FullImageSegmentationAnnotator/index.js +0 -7
  128. package/src/FullImageSegmentationAnnotator/index.story.js +0 -177
  129. package/src/FullImageSegmentationAnnotator/orange.story.png +0 -0
  130. package/src/GroupSelectorSidebarBox/index.js +0 -48
  131. package/src/HighlightBox/index.js +0 -143
  132. package/src/HistorySidebarBox/index.js +0 -78
  133. package/src/ImageCanvas/dancing-man.story.jpg +0 -0
  134. package/src/ImageCanvas/index.js +0 -494
  135. package/src/ImageCanvas/index.story.js +0 -314
  136. package/src/ImageCanvas/mouse_mask.story.png +0 -0
  137. package/src/ImageCanvas/region-tools.js +0 -171
  138. package/src/ImageCanvas/seves_desk.story.jpg +0 -0
  139. package/src/ImageCanvas/use-mouse.js +0 -168
  140. package/src/ImageCanvas/use-project-box.js +0 -23
  141. package/src/ImageCanvas/use-wasd-mode.js +0 -50
  142. package/src/ImageMask/index.js +0 -127
  143. package/src/ImageMask/load-image.js +0 -32
  144. package/src/ImageSelectorSidebarBox/index.js +0 -54
  145. package/src/KeyframeTimeline/get-time-string.js +0 -25
  146. package/src/KeyframeTimeline/index.js +0 -223
  147. package/src/KeyframesSelectorSidebarBox/index.js +0 -93
  148. package/src/LandingPage/content.md +0 -57
  149. package/src/LandingPage/github-markdown.css +0 -964
  150. package/src/LandingPage/index.js +0 -147
  151. package/src/MainLayout/icon-dictionary.js +0 -79
  152. package/src/MainLayout/index.js +0 -510
  153. package/src/MainLayout/index.story.js +0 -240
  154. package/src/MainLayout/types.js +0 -164
  155. package/src/MainLayout/use-implied-video-regions.js +0 -17
  156. package/src/MetadataEditorSidebarBox/index.js +0 -98
  157. package/src/PageSelector/index.js +0 -76
  158. package/src/PointDistances/index.js +0 -90
  159. package/src/PreventScrollToParents/index.js +0 -48
  160. package/src/PreventScrollToParents/index.story.js +0 -23
  161. package/src/RegionLabel/index.js +0 -222
  162. package/src/RegionSelectAndTransformBoxes/index.js +0 -234
  163. package/src/RegionSelectorSidebarBox/index.js +0 -216
  164. package/src/RegionShapes/index.js +0 -254
  165. package/src/RegionTags/index.js +0 -134
  166. package/src/SettingsDialog/index.js +0 -58
  167. package/src/SettingsProvider/index.js +0 -48
  168. package/src/Shortcuts/ShortcutField.js +0 -44
  169. package/src/Shortcuts/index.js +0 -129
  170. package/src/ShortcutsManager/index.js +0 -162
  171. package/src/Sidebar/index.js +0 -117
  172. package/src/SidebarBoxContainer/index.js +0 -93
  173. package/src/SmallToolButton/index.js +0 -57
  174. package/src/TagsSidebarBox/index.js +0 -93
  175. package/src/TaskDescriptionSidebarBox/index.js +0 -43
  176. package/src/Theme/index.js +0 -36
  177. package/src/VideoOrImageCanvasBackground/index.js +0 -170
  178. package/src/colors.js +0 -32
  179. package/src/hooks/use-colors.js +0 -74
  180. package/src/hooks/use-event-callback.js +0 -11
  181. package/src/hooks/use-exclude-pattern.js +0 -27
  182. package/src/hooks/use-load-image.js +0 -21
  183. package/src/hooks/use-window-size.js +0 -46
  184. package/src/hooks/xpattern.png +0 -0
  185. package/src/index.js +0 -18
  186. package/src/lib.js +0 -7
  187. package/src/screenshot.png +0 -0
  188. package/src/site.css +0 -5
  189. package/src/stories.js +0 -2
  190. package/src/utils/get-from-local-storage.js +0 -7
  191. package/src/utils/get-hotkey-help-text.js +0 -11
  192. package/src/utils/get-landmarks-with-transform.js +0 -23
  193. package/src/utils/photosToImages.js +0 -40
  194. package/src/utils/regions-to-blocks.js +0 -14
  195. package/src/utils/set-in-local-storage.js +0 -6
@@ -1,515 +0,0 @@
1
- /**
2
- * Build styles
3
- */
4
- require('./annotation.css').toString();
5
-
6
- // Possible classes
7
- // ================
8
-
9
- class Annotation {
10
- /**
11
- * Render plugin`s main Element and fill it with saved data
12
- *
13
- * @param {{data: HeaderData, config: HeaderConfig, api: object}}
14
- * data — previously saved data
15
- * config - user config for Tool
16
- * api - Editor.js API
17
- * readOnly - read only mode flag
18
- */
19
- constructor({ data, config, api, readOnly }) {
20
- this.api = api;
21
- this.readOnly = readOnly;
22
-
23
- /**
24
- * Styles
25
- *
26
- * @type {object}
27
- */
28
- this._CSS = {
29
- block: this.api.styles.block,
30
- settingsButton: this.api.styles.settingsButton,
31
- settingsButtonActive: this.api.styles.settingsButtonActive,
32
- wrapper: 'ce-header'
33
- };
34
-
35
- /**
36
- * Tool's settings passed from Editor
37
- *
38
- * @type {HeaderConfig}
39
- * @private
40
- */
41
- this._settings = config;
42
-
43
- /**
44
- * Block's data
45
- *
46
- * @type {HeaderData}
47
- * @private
48
- */
49
- this._data = this.normalizeData(data);
50
-
51
- /**
52
- * List of settings buttons
53
- *
54
- * @type {HTMLElement[]}
55
- */
56
- this.settingsButtons = [];
57
-
58
- /**
59
- * Main Block wrapper
60
- *
61
- * @type {HTMLElement}
62
- * @private
63
- */
64
- this._element = this.getTag();
65
- }
66
-
67
- /**
68
- * Normalize input data
69
- *
70
- * @param {HeaderData} data - saved data to process
71
- *
72
- * @returns {HeaderData}
73
- * @private
74
- */
75
- normalizeData(data) {
76
- const newData = {};
77
-
78
- if (typeof data !== 'object') {
79
- data = {};
80
- }
81
-
82
- newData.text = data.text || '';
83
- newData.labelName = data.labelName || this.defaultLabel.labelName;
84
-
85
- return newData;
86
- }
87
-
88
- /**
89
- * Return Tool's view
90
- *
91
- * @returns {HTMLHeadingElement}
92
- * @public
93
- */
94
- render() {
95
- return this._element;
96
- }
97
-
98
- /**
99
- * Create Block's settings block
100
- *
101
- * @returns {HTMLElement}
102
- */
103
- renderSettings() {
104
- const holder = document.createElement('DIV');
105
-
106
- // do not add settings button, when only one label is configured
107
- if (this.labels.length <= 1) {
108
- return holder;
109
- }
110
-
111
- /** Add type selectors */
112
- this.labels.forEach(label => {
113
- const selectTypeButton = document.createElement('DIV');
114
-
115
- selectTypeButton.classList.add(this._CSS.settingsButton);
116
-
117
- /**
118
- * Highlight current label button
119
- */
120
- if (this.currentLabel.labelName === label.labelName) {
121
- selectTypeButton.classList.add(this._CSS.settingsButtonActive);
122
- }
123
-
124
- /**
125
- * Add SVG icon
126
- */
127
- selectTypeButton.innerHTML = `${label.labelName}`;
128
-
129
- /**
130
- * Save label to its button
131
- */
132
- selectTypeButton.dataset.labelName = label.labelName;
133
-
134
- /**
135
- * Set up click handler
136
- */
137
- selectTypeButton.addEventListener('click', () => {
138
- this.setLabelName(label.labelName);
139
- });
140
-
141
- /**
142
- * Append settings button to holder
143
- */
144
- holder.appendChild(selectTypeButton);
145
-
146
- /**
147
- * Save settings buttons
148
- */
149
- this.settingsButtons.push(selectTypeButton);
150
- });
151
-
152
- return holder;
153
- }
154
-
155
- /**
156
- * Callback for Block's settings buttons
157
- *
158
- * @param {labelName} labelName - labelName to set
159
- */
160
- setLabelName(labelName) {
161
- this.data = {
162
- labelName,
163
- text: this.data.text
164
- };
165
-
166
- /**
167
- * Highlight button by selected labelName
168
- */
169
- this.settingsButtons.forEach(button => {
170
- button.classList.toggle(
171
- this._CSS.settingsButtonActive,
172
- button.dataset.labelName === labelName
173
- );
174
- });
175
- }
176
-
177
- /**
178
- * Method that specified how to merge two Text blocks.
179
- * Called by Editor.js by backspace at the beginning of the Block
180
- *
181
- * @param {HeaderData} data - saved data to merger with current block
182
- * @public
183
- */
184
- merge(data) {
185
- const newData = {
186
- text: this.data.text + data.text,
187
- labelName: this.data.labelName
188
- };
189
-
190
- this.data = newData;
191
- }
192
-
193
- /**
194
- * Validate Text block data:
195
- * - check for emptiness
196
- *
197
- * @param {HeaderData} blockData — data received after saving
198
- * @returns {boolean} false if saved data is not correct, otherwise true
199
- * @public
200
- */
201
- validate(blockData) {
202
- return blockData.text.trim() !== '';
203
- }
204
-
205
- /**
206
- * Extract Tool's data from the view
207
- *
208
- * @param {HTMLHeadingElement} toolsContent - Text tools rendered view
209
- * @returns {HeaderData} - saved data
210
- * @public
211
- */
212
- save(toolsContent) {
213
- return {
214
- text: toolsContent.innerHTML,
215
- labelName: this.currentLabel.labelName
216
- };
217
- }
218
-
219
- /**
220
- * Allow Header to be converted to/from other blocks
221
- */
222
- static get conversionConfig() {
223
- return {
224
- export: 'text', // use 'text' property for other blocks
225
- import: 'text' // fill 'text' property from other block's export string
226
- };
227
- }
228
-
229
- /**
230
- * Sanitizer Rules
231
- */
232
- static get sanitize() {
233
- return {
234
- labelName: false,
235
- text: {}
236
- };
237
- }
238
-
239
- /**
240
- * Returns true to notify core that read-only is supported
241
- *
242
- * @returns {boolean}
243
- */
244
- static get isReadOnlySupported() {
245
- return true;
246
- }
247
-
248
- /**
249
- * Get current Tools`s data
250
- *
251
- * @returns {HeaderData} Current data
252
- * @private
253
- */
254
- get data() {
255
- this._data.text = this._element.innerHTML;
256
- this._data.labelName = this.currentLabel.labelName;
257
-
258
- return this._data;
259
- }
260
-
261
- /**
262
- * Store data in plugin:
263
- * - at the this._data property
264
- * - at the HTML
265
- *
266
- * @param {HeaderData} data — data to set
267
- * @private
268
- */
269
- set data(data) {
270
- this._data = this.normalizeData(data);
271
-
272
- /**
273
- * If labelName is set and block in DOM
274
- * then replace it to a new block
275
- */
276
- if (data.labelName !== undefined && this._element.parentNode) {
277
- /**
278
- * Create a new tag
279
- *
280
- * @type {HTMLHeadingElement}
281
- */
282
- const newHeader = this.getTag();
283
-
284
- /**
285
- * Save Block's content
286
- */
287
- newHeader.innerHTML = this._element.innerHTML;
288
-
289
- /**
290
- * Replace blocks
291
- */
292
- this._element.parentNode.replaceChild(newHeader, this._element);
293
-
294
- /**
295
- * Save new block to private variable
296
- *
297
- * @type {HTMLHeadingElement}
298
- * @private
299
- */
300
- this._element = newHeader;
301
- }
302
-
303
- /**
304
- * If data.text was passed then update block's content
305
- */
306
- if (data.text !== undefined) {
307
- this._element.innerHTML = this._data.text || '';
308
- }
309
- }
310
-
311
- /**
312
- * Get tag for target label
313
- * By default returns second-labelled header
314
- *
315
- * @returns {HTMLElement}
316
- */
317
- getTag() {
318
- /**
319
- * Create element for current Block's label
320
- */
321
- const tag = document.createElement(this.currentLabel.tag);
322
- if (this.currentLabel.backgroundColor) {
323
- tag.style.backgroundColor = this.currentLabel.backgroundColor;
324
- }
325
-
326
- /**
327
- * Add text to block
328
- */
329
- tag.innerHTML = this._data.text || '';
330
-
331
- /**
332
- * Add styles class
333
- */
334
- tag.classList.add(this._CSS.wrapper);
335
-
336
- /**
337
- * Make tag editable
338
- */
339
- tag.contentEditable = this.readOnly ? 'false' : 'true';
340
-
341
- /**
342
- * Add Placeholder
343
- */
344
- tag.dataset.placeholder = this.api.i18n.t(this._settings.placeholder || '');
345
-
346
- return tag;
347
- }
348
-
349
- /**
350
- * Get current label
351
- *
352
- * @returns {label}
353
- */
354
- get currentLabel() {
355
- let label = this.labels.find(
356
- labelItem => labelItem.labelName === this._data.labelName
357
- );
358
-
359
- if (!label) {
360
- label = this.defaultLabel;
361
- }
362
-
363
- return label;
364
- }
365
-
366
- /**
367
- * Return default label
368
- *
369
- * @returns {label}
370
- */
371
- get defaultLabel() {
372
- /**
373
- * User can specify own default label value
374
- */
375
- if (this._settings.defaultLabel) {
376
- const userSpecified = this.labels.find(labelItem => {
377
- return labelItem.labelName === this._settings.defaultLabel;
378
- });
379
-
380
- if (userSpecified) {
381
- return userSpecified;
382
- }
383
- console.warn(
384
- "(ง'̀-'́)ง Annotation Tool: the default label specified was not found in available labels"
385
- );
386
- }
387
-
388
- /**
389
- * With no additional options, there will be H2 by default
390
- *
391
- * @type {label}
392
- */
393
- return this.labels[1];
394
- }
395
-
396
- /**
397
- * @typedef {object} label
398
- * @property {labelName} labelName - label labelName
399
- * @property {string} tag - tag corresponds with label labelName
400
- * @property {string} svg - icon
401
- */
402
-
403
- /**
404
- * Available header labels
405
- *
406
- * @returns {label[]}
407
- */
408
- get labels() {
409
- const availableLabels = [
410
- {
411
- labelName: 'title',
412
- tag: 'h1',
413
- name: 'title'
414
- // backgroundColor: '#d0fffe'
415
- },
416
- { labelName: 'subtitle', tag: 'h2', name: 'subtitle' },
417
- { labelName: 'text', tag: 'p', name: 'text' },
418
- { labelName: 'author', tag: 'i', name: 'author' },
419
- { labelName: 'appendix', tag: 'p', name: 'appendix' },
420
- { labelName: 'photo_author', tag: 'p', name: 'photo_author' },
421
- { labelName: 'photo_caption', tag: 'p', name: 'photo_caption' },
422
- { labelName: 'advertisement', tag: 'p', name: 'advertisement' },
423
- { labelName: 'other_graphics', tag: 'p', name: 'other_graphics' },
424
- { labelName: 'unknown', tag: 's', name: 'unknown' },
425
- { labelName: 'about_author', tag: 'p', name: 'about_author' },
426
- { labelName: 'image', tag: 'p', name: 'image' },
427
- { labelName: 'interview', tag: 'p', name: 'interview' },
428
- { labelName: 'table', tag: 'p', name: 'table' }
429
- ];
430
-
431
- return this._settings.labels
432
- ? availableLabels.filter(l => this._settings.labels.includes(l.labelName))
433
- : availableLabels;
434
- }
435
-
436
- /**
437
- * Handle H1-H6 tags on paste to substitute it with header Tool
438
- *
439
- * @param {PasteEvent} event - event with pasted content
440
- */
441
- onPaste(event) {
442
- const content = event.detail.data;
443
-
444
- /**
445
- * Define default label value
446
- *
447
- * @type {labelName}
448
- */
449
- let { labelName } = this.defaultLabel;
450
-
451
- switch (content.tagName) {
452
- case 'H1':
453
- labelName = 1;
454
- break;
455
- case 'H2':
456
- labelName = 2;
457
- break;
458
- case 'H3':
459
- labelName = 3;
460
- break;
461
- case 'H4':
462
- labelName = 4;
463
- break;
464
- case 'H5':
465
- labelName = 5;
466
- break;
467
- case 'H6':
468
- labelName = 6;
469
- break;
470
- }
471
-
472
- // if (this._settings.labels) {
473
- // // Fallback to nearest label when specified not available
474
- // label = this._settings.labels.reduce((prevLabel, currLabel) => {
475
- // return Math.abs(currLabel - label) < Math.abs(prevLabel - label)
476
- // ? currLabel
477
- // : prevLabel;
478
- // });
479
- // }
480
-
481
- this.data = {
482
- labelName,
483
- text: content.innerHTML
484
- };
485
- }
486
-
487
- /**
488
- * Used by Editor.js paste handling API.
489
- * Provides configuration to handle H1-H6 tags.
490
- *
491
- * @returns {{handler: (function(HTMLElement): {text: string}), tags: string[]}}
492
- */
493
- static get pasteConfig() {
494
- return {
495
- tags: ['H1', 'H2', 'H3', 'H4', 'H5', 'H6']
496
- };
497
- }
498
-
499
- /**
500
- * Get Tool toolbox settings
501
- * icon - Tool icon's SVG
502
- * title - title to show in toolbox
503
- *
504
- * @returns {{icon: string, title: string}}
505
- */
506
- static get toolbox() {
507
- return {
508
- icon:
509
- '<svg width="17" height="15" viewBox="0 0 336 276" xmlns="http://www.w3.org/2000/svg"><path d="M291 150V79c0-19-15-34-34-34H79c-19 0-34 15-34 34v42l67-44 81 72 56-29 42 30zm0 52l-43-30-56 30-81-67-66 39v23c0 19 15 34 34 34h178c17 0 31-13 34-29zM79 0h178c44 0 79 35 79 79v118c0 44-35 79-79 79H79c-44 0-79-35-79-79V79C0 35 35 0 79 0z"/></svg>',
510
- title: 'Annotation'
511
- };
512
- }
513
- }
514
-
515
- export default Annotation;
@@ -1,24 +0,0 @@
1
- import React from 'react';
2
- import { createReactEditorJS } from 'react-editor-js'
3
- import { EDITOR_JS_TOOLS } from './tools'
4
-
5
- const ReactEditorJS = createReactEditorJS()
6
-
7
- function Editor({ blocks, onChange, imageIndex }) {
8
- const handleChange = async instance => {
9
- const data = await instance.saver.save();
10
- onChange({ imageIndex, data })
11
- };
12
-
13
- return (
14
- <ReactEditorJS defaultValue={{
15
- blocks
16
- }}
17
- tools={EDITOR_JS_TOOLS}
18
- onChange={handleChange}
19
- enableReInitialize
20
- />
21
- );
22
- }
23
-
24
- export default Editor;
@@ -1,7 +0,0 @@
1
- // @flow
2
- import React from "react"
3
- import Annotator from "../Annotator"
4
-
5
- export default (props) => {
6
- return <Annotator {...props} fullImageSegmentationMode={true} />
7
- }