@pie-element/ebsr 6.6.3-next.1131 → 6.6.3-next.1199
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/configure/package.json +1 -1
- package/package.json +3 -3
- package/configure/node_modules/@pie-lib/config-ui/CHANGELOG.json +0 -1677
- package/configure/node_modules/@pie-lib/config-ui/CHANGELOG.md +0 -1743
- package/configure/node_modules/@pie-lib/config-ui/LICENSE.md +0 -5
- package/configure/node_modules/@pie-lib/config-ui/README.md +0 -12
- package/configure/node_modules/@pie-lib/config-ui/lib/alert-dialog.js +0 -44
- package/configure/node_modules/@pie-lib/config-ui/lib/alert-dialog.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/checkbox.js +0 -86
- package/configure/node_modules/@pie-lib/config-ui/lib/checkbox.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/choice-configuration/feedback-menu.js +0 -164
- package/configure/node_modules/@pie-lib/config-ui/lib/choice-configuration/feedback-menu.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/choice-configuration/index.js +0 -398
- package/configure/node_modules/@pie-lib/config-ui/lib/choice-configuration/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/choice-utils.js +0 -54
- package/configure/node_modules/@pie-lib/config-ui/lib/choice-utils.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/feedback-config/feedback-selector.js +0 -185
- package/configure/node_modules/@pie-lib/config-ui/lib/feedback-config/feedback-selector.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/feedback-config/group.js +0 -75
- package/configure/node_modules/@pie-lib/config-ui/lib/feedback-config/group.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/feedback-config/index.js +0 -178
- package/configure/node_modules/@pie-lib/config-ui/lib/feedback-config/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/form-section.js +0 -46
- package/configure/node_modules/@pie-lib/config-ui/lib/form-section.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/help.js +0 -145
- package/configure/node_modules/@pie-lib/config-ui/lib/help.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/index.js +0 -216
- package/configure/node_modules/@pie-lib/config-ui/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/input.js +0 -139
- package/configure/node_modules/@pie-lib/config-ui/lib/input.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/inputs.js +0 -131
- package/configure/node_modules/@pie-lib/config-ui/lib/inputs.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/langs.js +0 -179
- package/configure/node_modules/@pie-lib/config-ui/lib/langs.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/layout/config-layout.js +0 -101
- package/configure/node_modules/@pie-lib/config-ui/lib/layout/config-layout.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/layout/index.js +0 -24
- package/configure/node_modules/@pie-lib/config-ui/lib/layout/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/layout/layout-contents.js +0 -105
- package/configure/node_modules/@pie-lib/config-ui/lib/layout/layout-contents.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/layout/settings-box.js +0 -87
- package/configure/node_modules/@pie-lib/config-ui/lib/layout/settings-box.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/mui-box/index.js +0 -79
- package/configure/node_modules/@pie-lib/config-ui/lib/mui-box/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/number-text-field-custom.js +0 -364
- package/configure/node_modules/@pie-lib/config-ui/lib/number-text-field-custom.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/number-text-field.js +0 -265
- package/configure/node_modules/@pie-lib/config-ui/lib/number-text-field.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/radio-with-label.js +0 -41
- package/configure/node_modules/@pie-lib/config-ui/lib/radio-with-label.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/settings/display-size.js +0 -77
- package/configure/node_modules/@pie-lib/config-ui/lib/settings/display-size.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/settings/index.js +0 -130
- package/configure/node_modules/@pie-lib/config-ui/lib/settings/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/settings/panel.js +0 -412
- package/configure/node_modules/@pie-lib/config-ui/lib/settings/panel.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/settings/settings-radio-label.js +0 -43
- package/configure/node_modules/@pie-lib/config-ui/lib/settings/settings-radio-label.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/settings/toggle.js +0 -56
- package/configure/node_modules/@pie-lib/config-ui/lib/settings/toggle.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/tabs/index.js +0 -106
- package/configure/node_modules/@pie-lib/config-ui/lib/tabs/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/tags-input/index.js +0 -198
- package/configure/node_modules/@pie-lib/config-ui/lib/tags-input/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/two-choice.js +0 -180
- package/configure/node_modules/@pie-lib/config-ui/lib/two-choice.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/lib/with-stateful-model.js +0 -84
- package/configure/node_modules/@pie-lib/config-ui/lib/with-stateful-model.js.map +0 -1
- package/configure/node_modules/@pie-lib/config-ui/package.json +0 -30
- package/configure/node_modules/@pie-lib/config-ui/src/alert-dialog.jsx +0 -43
- package/configure/node_modules/@pie-lib/config-ui/src/checkbox.jsx +0 -63
- package/configure/node_modules/@pie-lib/config-ui/src/choice-configuration/feedback-menu.jsx +0 -103
- package/configure/node_modules/@pie-lib/config-ui/src/choice-configuration/index.jsx +0 -319
- package/configure/node_modules/@pie-lib/config-ui/src/choice-utils.js +0 -30
- package/configure/node_modules/@pie-lib/config-ui/src/feedback-config/feedback-selector.jsx +0 -116
- package/configure/node_modules/@pie-lib/config-ui/src/feedback-config/group.jsx +0 -54
- package/configure/node_modules/@pie-lib/config-ui/src/feedback-config/index.jsx +0 -98
- package/configure/node_modules/@pie-lib/config-ui/src/form-section.jsx +0 -23
- package/configure/node_modules/@pie-lib/config-ui/src/help.jsx +0 -88
- package/configure/node_modules/@pie-lib/config-ui/src/index.js +0 -58
- package/configure/node_modules/@pie-lib/config-ui/src/input.jsx +0 -72
- package/configure/node_modules/@pie-lib/config-ui/src/inputs.jsx +0 -96
- package/configure/node_modules/@pie-lib/config-ui/src/langs.jsx +0 -122
- package/configure/node_modules/@pie-lib/config-ui/src/layout/config-layout.jsx +0 -64
- package/configure/node_modules/@pie-lib/config-ui/src/layout/index.js +0 -4
- package/configure/node_modules/@pie-lib/config-ui/src/layout/layout-contents.jsx +0 -60
- package/configure/node_modules/@pie-lib/config-ui/src/layout/settings-box.jsx +0 -31
- package/configure/node_modules/@pie-lib/config-ui/src/mui-box/index.jsx +0 -64
- package/configure/node_modules/@pie-lib/config-ui/src/number-text-field-custom.jsx +0 -276
- package/configure/node_modules/@pie-lib/config-ui/src/number-text-field.jsx +0 -196
- package/configure/node_modules/@pie-lib/config-ui/src/radio-with-label.jsx +0 -18
- package/configure/node_modules/@pie-lib/config-ui/src/settings/display-size.jsx +0 -52
- package/configure/node_modules/@pie-lib/config-ui/src/settings/index.js +0 -75
- package/configure/node_modules/@pie-lib/config-ui/src/settings/panel.jsx +0 -297
- package/configure/node_modules/@pie-lib/config-ui/src/settings/settings-radio-label.jsx +0 -20
- package/configure/node_modules/@pie-lib/config-ui/src/settings/toggle.jsx +0 -31
- package/configure/node_modules/@pie-lib/config-ui/src/tabs/index.jsx +0 -51
- package/configure/node_modules/@pie-lib/config-ui/src/tags-input/index.jsx +0 -121
- package/configure/node_modules/@pie-lib/config-ui/src/two-choice.jsx +0 -94
- package/configure/node_modules/@pie-lib/config-ui/src/with-stateful-model.jsx +0 -36
- package/configure/node_modules/@pie-lib/editable-html/CHANGELOG.json +0 -3327
- package/configure/node_modules/@pie-lib/editable-html/CHANGELOG.md +0 -1759
- package/configure/node_modules/@pie-lib/editable-html/LICENSE.md +0 -5
- package/configure/node_modules/@pie-lib/editable-html/README.md +0 -45
- package/configure/node_modules/@pie-lib/editable-html/deploy.sh +0 -16
- package/configure/node_modules/@pie-lib/editable-html/lib/editor.js +0 -893
- package/configure/node_modules/@pie-lib/editable-html/lib/editor.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/index.js +0 -226
- package/configure/node_modules/@pie-lib/editable-html/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/parse-html.js +0 -16
- package/configure/node_modules/@pie-lib/editable-html/lib/parse-html.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/characters/custom-popover.js +0 -70
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/characters/custom-popover.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/characters/index.js +0 -266
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/characters/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/characters/utils.js +0 -382
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/characters/utils.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/alt-dialog.js +0 -119
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/alt-dialog.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/component.js +0 -424
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/component.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/image-toolbar.js +0 -175
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/image-toolbar.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/index.js +0 -261
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/insert-image-handler.js +0 -135
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/insert-image-handler.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/index.js +0 -141
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/list/index.js +0 -204
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/list/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/math/index.js +0 -347
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/math/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/media/index.js +0 -339
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/media/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/media/media-dialog.js +0 -434
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/media/media-dialog.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/media/media-toolbar.js +0 -99
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/media/media-toolbar.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/media/media-wrapper.js +0 -93
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/media/media-wrapper.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/drag-in-the-blank/choice.js +0 -251
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/drag-in-the-blank/choice.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/drag-in-the-blank/index.js +0 -97
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/drag-in-the-blank/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/explicit-constructed-response/index.js +0 -54
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/explicit-constructed-response/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/icons/index.js +0 -93
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/icons/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/index.js +0 -293
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/inline-dropdown/index.js +0 -70
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/inline-dropdown/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/utils.js +0 -110
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/utils.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/table/icons/index.js +0 -69
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/table/icons/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/table/index.js +0 -499
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/table/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/table/table-toolbar.js +0 -158
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/table/table-toolbar.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/default-toolbar.js +0 -132
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/default-toolbar.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/done-button.js +0 -50
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/done-button.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/editor-and-toolbar.js +0 -263
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/editor-and-toolbar.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/index.js +0 -32
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/toolbar-buttons.js +0 -161
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/toolbar-buttons.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/toolbar.js +0 -346
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/toolbar.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/utils.js +0 -62
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/utils.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/serialization.js +0 -428
- package/configure/node_modules/@pie-lib/editable-html/lib/serialization.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/lib/theme.js +0 -9
- package/configure/node_modules/@pie-lib/editable-html/lib/theme.js.map +0 -1
- package/configure/node_modules/@pie-lib/editable-html/package.json +0 -52
- package/configure/node_modules/@pie-lib/editable-html/playground/image/data.js +0 -59
- package/configure/node_modules/@pie-lib/editable-html/playground/image/index.html +0 -24
- package/configure/node_modules/@pie-lib/editable-html/playground/image/index.jsx +0 -83
- package/configure/node_modules/@pie-lib/editable-html/playground/index.html +0 -27
- package/configure/node_modules/@pie-lib/editable-html/playground/mathquill/index.html +0 -25
- package/configure/node_modules/@pie-lib/editable-html/playground/mathquill/index.jsx +0 -151
- package/configure/node_modules/@pie-lib/editable-html/playground/package.json +0 -15
- package/configure/node_modules/@pie-lib/editable-html/playground/prod-test/index.html +0 -26
- package/configure/node_modules/@pie-lib/editable-html/playground/prod-test/index.jsx +0 -30
- package/configure/node_modules/@pie-lib/editable-html/playground/schema-override/data.js +0 -29
- package/configure/node_modules/@pie-lib/editable-html/playground/schema-override/image-plugin.jsx +0 -40
- package/configure/node_modules/@pie-lib/editable-html/playground/schema-override/index.html +0 -23
- package/configure/node_modules/@pie-lib/editable-html/playground/schema-override/index.jsx +0 -96
- package/configure/node_modules/@pie-lib/editable-html/playground/serialization/data.js +0 -29
- package/configure/node_modules/@pie-lib/editable-html/playground/serialization/image-plugin.jsx +0 -40
- package/configure/node_modules/@pie-lib/editable-html/playground/serialization/index.html +0 -24
- package/configure/node_modules/@pie-lib/editable-html/playground/serialization/index.jsx +0 -12
- package/configure/node_modules/@pie-lib/editable-html/playground/static.json +0 -3
- package/configure/node_modules/@pie-lib/editable-html/playground/table-examples.html +0 -67
- package/configure/node_modules/@pie-lib/editable-html/playground/webpack.config.js +0 -42
- package/configure/node_modules/@pie-lib/editable-html/src/editor.jsx +0 -749
- package/configure/node_modules/@pie-lib/editable-html/src/index.jsx +0 -145
- package/configure/node_modules/@pie-lib/editable-html/src/parse-html.js +0 -8
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/README.md +0 -27
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/characters/custom-popover.js +0 -45
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/characters/index.jsx +0 -244
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/characters/utils.js +0 -448
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/image/alt-dialog.jsx +0 -69
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/image/component.jsx +0 -349
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/image/image-toolbar.jsx +0 -108
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/image/index.jsx +0 -218
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/image/insert-image-handler.js +0 -93
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/index.jsx +0 -115
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/list/index.jsx +0 -175
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/math/index.jsx +0 -283
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/media/index.jsx +0 -284
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/media/media-dialog.js +0 -372
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/media/media-toolbar.jsx +0 -53
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/media/media-wrapper.jsx +0 -43
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/respArea/drag-in-the-blank/choice.jsx +0 -187
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/respArea/drag-in-the-blank/index.jsx +0 -78
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/respArea/explicit-constructed-response/index.jsx +0 -45
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/respArea/icons/index.jsx +0 -68
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/respArea/index.jsx +0 -263
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/respArea/inline-dropdown/index.jsx +0 -63
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/respArea/utils.jsx +0 -77
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/table/icons/index.jsx +0 -59
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/table/index.jsx +0 -439
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/table/table-toolbar.jsx +0 -104
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/toolbar/default-toolbar.jsx +0 -111
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/toolbar/done-button.jsx +0 -36
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/toolbar/editor-and-toolbar.jsx +0 -225
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/toolbar/index.jsx +0 -21
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/toolbar/toolbar-buttons.jsx +0 -97
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/toolbar/toolbar.jsx +0 -323
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/utils.js +0 -32
- package/configure/node_modules/@pie-lib/editable-html/src/serialization.jsx +0 -385
- package/configure/node_modules/@pie-lib/editable-html/src/theme.js +0 -1
- package/configure/node_modules/@pie-lib/editable-html/static.json +0 -1
|
@@ -1,349 +0,0 @@
|
|
|
1
|
-
import LinearProgress from '@material-ui/core/LinearProgress';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import debug from 'debug';
|
|
6
|
-
import { withStyles } from '@material-ui/core/styles';
|
|
7
|
-
import SlatePropTypes from 'slate-prop-types';
|
|
8
|
-
|
|
9
|
-
const log = debug('@pie-lib:editable-html:plugins:image:component');
|
|
10
|
-
|
|
11
|
-
const size = s => (s ? `${s}px` : 'auto');
|
|
12
|
-
|
|
13
|
-
export class Component extends React.Component {
|
|
14
|
-
static propTypes = {
|
|
15
|
-
node: SlatePropTypes.node.isRequired,
|
|
16
|
-
editor: PropTypes.shape({
|
|
17
|
-
change: PropTypes.func.isRequired,
|
|
18
|
-
value: PropTypes.object
|
|
19
|
-
}).isRequired,
|
|
20
|
-
classes: PropTypes.object.isRequired,
|
|
21
|
-
attributes: PropTypes.object,
|
|
22
|
-
onFocus: PropTypes.func,
|
|
23
|
-
onBlur: PropTypes.func,
|
|
24
|
-
maxImageWidth: PropTypes.number,
|
|
25
|
-
maxImageHeight: PropTypes.number
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
getWidth = percent => {
|
|
29
|
-
const multiplier = percent / 100;
|
|
30
|
-
return this.img.naturalWidth * multiplier;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
getHeight = percent => {
|
|
34
|
-
const multiplier = percent / 100;
|
|
35
|
-
return this.img.naturalHeight * multiplier;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
getPercentFromWidth = width => {
|
|
39
|
-
var floored = (width / this.img.naturalWidth) * 4;
|
|
40
|
-
return parseInt(floored.toFixed(0) * 25, 10);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
applySizeData = () => {
|
|
44
|
-
const { node, editor } = this.props;
|
|
45
|
-
|
|
46
|
-
let update = node.data;
|
|
47
|
-
|
|
48
|
-
const w = update.get('width');
|
|
49
|
-
if (w) {
|
|
50
|
-
update = update.set('resizePercent', this.getPercentFromWidth(w));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
log('[applySizeData] update: ', update);
|
|
54
|
-
|
|
55
|
-
if (!update.equals(node.data)) {
|
|
56
|
-
editor.change(c => c.setNodeByKey(node.key, { data: update }));
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
initialiseResize = () => {
|
|
61
|
-
window.addEventListener('mousemove', this.startResizing, false);
|
|
62
|
-
window.addEventListener('mouseup', this.stopResizing, false);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
componentDidMount() {
|
|
66
|
-
this.applySizeData();
|
|
67
|
-
|
|
68
|
-
const resizeHandle = this.resize;
|
|
69
|
-
|
|
70
|
-
if (resizeHandle) {
|
|
71
|
-
resizeHandle.addEventListener('mousedown', this.initialiseResize, false);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
componentDidUpdate() {
|
|
76
|
-
this.applySizeData();
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
getSize(data) {
|
|
80
|
-
return {
|
|
81
|
-
width: size(data.get('width')),
|
|
82
|
-
height: size(data.get('height')),
|
|
83
|
-
objectFit: 'contain'
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
loadImage = () => {
|
|
88
|
-
let { maxImageWidth, maxImageHeight } = this.props || {};
|
|
89
|
-
maxImageWidth = maxImageWidth || 700;
|
|
90
|
-
maxImageHeight = maxImageHeight || 900;
|
|
91
|
-
|
|
92
|
-
const box = this.img;
|
|
93
|
-
|
|
94
|
-
//on first load
|
|
95
|
-
if (!box.style.width || box.style.width === 'auto') {
|
|
96
|
-
const dimensions = {
|
|
97
|
-
width: (box && box.naturalWidth) || 100,
|
|
98
|
-
height: (box && box.naturalHeight) || 100
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
const { width, height } = this.updateImageDimensions(
|
|
102
|
-
dimensions,
|
|
103
|
-
{
|
|
104
|
-
width: dimensions.width < maxImageWidth ? dimensions.width : maxImageWidth,
|
|
105
|
-
height: dimensions.height < maxImageHeight ? dimensions.height : maxImageHeight
|
|
106
|
-
},
|
|
107
|
-
true
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
box.style.width = `${width}px`;
|
|
111
|
-
box.style.height = `${height}px`;
|
|
112
|
-
|
|
113
|
-
this.setState({
|
|
114
|
-
dimensions: { height: height, width: width }
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
const { node, editor } = this.props;
|
|
118
|
-
|
|
119
|
-
let update = node.data;
|
|
120
|
-
|
|
121
|
-
update = update.set('width', width);
|
|
122
|
-
update = update.set('height', height);
|
|
123
|
-
|
|
124
|
-
if (!update.equals(node.data)) {
|
|
125
|
-
editor.change(c => c.setNodeByKey(node.key, { data: update }));
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
startResizing = e => {
|
|
131
|
-
const bounds = e.target.getBoundingClientRect();
|
|
132
|
-
const box = this.img;
|
|
133
|
-
const dimensions = {
|
|
134
|
-
width: (box && box.naturalWidth) || 100,
|
|
135
|
-
height: (box && box.naturalHeight) || 100
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
const { width, height } = this.updateImageDimensions(
|
|
139
|
-
dimensions,
|
|
140
|
-
{
|
|
141
|
-
width: e.clientX - bounds.left,
|
|
142
|
-
height: e.clientY - bounds.top
|
|
143
|
-
},
|
|
144
|
-
true
|
|
145
|
-
);
|
|
146
|
-
|
|
147
|
-
const hasMinimumWidth = width > 50 && height > 50;
|
|
148
|
-
const hasDimensionsConstraints = width <= 700 && height <= 900;
|
|
149
|
-
|
|
150
|
-
if (hasMinimumWidth && hasDimensionsConstraints && box) {
|
|
151
|
-
box.style.width = `${width}px`;
|
|
152
|
-
box.style.height = `${height}px`;
|
|
153
|
-
|
|
154
|
-
this.setState({
|
|
155
|
-
dimensions: { height: height, width: width }
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
const { node, editor } = this.props;
|
|
159
|
-
|
|
160
|
-
let update = node.data;
|
|
161
|
-
|
|
162
|
-
update = update.set('width', width);
|
|
163
|
-
update = update.set('height', height);
|
|
164
|
-
|
|
165
|
-
if (!update.equals(node.data)) {
|
|
166
|
-
editor.change(c => c.setNodeByKey(node.key, { data: update }));
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
stopResizing = () => {
|
|
172
|
-
window.removeEventListener('mousemove', this.startResizing, false);
|
|
173
|
-
window.removeEventListener('mouseup', this.stopResizing, false);
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
updateImageDimensions = (initialDim, nextDim, keepAspectRatio, resizeType) => {
|
|
177
|
-
// if we want to keep image aspect ratio
|
|
178
|
-
if (keepAspectRatio) {
|
|
179
|
-
const imageAspectRatio = initialDim.width / initialDim.height;
|
|
180
|
-
|
|
181
|
-
if (resizeType === 'height') {
|
|
182
|
-
// if we want to change image height => we update the width accordingly
|
|
183
|
-
return {
|
|
184
|
-
width: nextDim.height * imageAspectRatio,
|
|
185
|
-
height: nextDim.height
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// if we want to change image width => we update the height accordingly
|
|
190
|
-
return {
|
|
191
|
-
width: nextDim.width,
|
|
192
|
-
height: nextDim.width / imageAspectRatio
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// if we don't want to keep aspect ratio, we just update both values
|
|
197
|
-
return {
|
|
198
|
-
width: nextDim.width,
|
|
199
|
-
height: nextDim.height
|
|
200
|
-
};
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
render() {
|
|
204
|
-
const { node, editor, classes, attributes, onFocus } = this.props;
|
|
205
|
-
const active = editor.value.isFocused && editor.value.selection.hasEdgeIn(node);
|
|
206
|
-
const src = node.data.get('src');
|
|
207
|
-
const loaded = node.data.get('loaded') !== false;
|
|
208
|
-
const deleteStatus = node.data.get('deleteStatus');
|
|
209
|
-
const alignment = node.data.get('alignment');
|
|
210
|
-
const percent = node.data.get('percent');
|
|
211
|
-
const alt = node.data.get('alt');
|
|
212
|
-
let margin;
|
|
213
|
-
let justifyContent;
|
|
214
|
-
|
|
215
|
-
switch (alignment) {
|
|
216
|
-
case 'left':
|
|
217
|
-
justifyContent = 'flex-start';
|
|
218
|
-
margin = '0';
|
|
219
|
-
break;
|
|
220
|
-
case 'center':
|
|
221
|
-
justifyContent = 'center';
|
|
222
|
-
margin = '0 auto';
|
|
223
|
-
break;
|
|
224
|
-
case 'right':
|
|
225
|
-
justifyContent = 'flex-end';
|
|
226
|
-
margin = 'auto 0 0 auto ';
|
|
227
|
-
break;
|
|
228
|
-
default:
|
|
229
|
-
justifyContent = 'flex-start';
|
|
230
|
-
margin = '0';
|
|
231
|
-
break;
|
|
232
|
-
}
|
|
233
|
-
log('[render] node.data:', node.data);
|
|
234
|
-
|
|
235
|
-
const size = this.getSize(node.data);
|
|
236
|
-
|
|
237
|
-
log('[render] style:', size);
|
|
238
|
-
|
|
239
|
-
const className = classNames(
|
|
240
|
-
classes.root,
|
|
241
|
-
!loaded && classes.loading,
|
|
242
|
-
deleteStatus === 'pending' && classes.pendingDelete
|
|
243
|
-
);
|
|
244
|
-
|
|
245
|
-
const progressClasses = classNames(classes.progress, loaded && classes.hideProgress);
|
|
246
|
-
|
|
247
|
-
return [
|
|
248
|
-
<span key={'sp1'}> </span>,
|
|
249
|
-
<div key={'comp'} onFocus={onFocus} className={className} style={{ justifyContent }}>
|
|
250
|
-
<LinearProgress
|
|
251
|
-
mode="determinate"
|
|
252
|
-
value={percent > 0 ? percent : 0}
|
|
253
|
-
className={progressClasses}
|
|
254
|
-
/>
|
|
255
|
-
<div className={classes.imageContainer}>
|
|
256
|
-
<img
|
|
257
|
-
{...attributes}
|
|
258
|
-
className={classNames(classes.image, active && classes.active)}
|
|
259
|
-
ref={ref => {
|
|
260
|
-
this.img = ref;
|
|
261
|
-
}}
|
|
262
|
-
src={src}
|
|
263
|
-
style={size}
|
|
264
|
-
onLoad={this.loadImage}
|
|
265
|
-
alt={alt}
|
|
266
|
-
/>
|
|
267
|
-
<div
|
|
268
|
-
ref={ref => {
|
|
269
|
-
this.resize = ref;
|
|
270
|
-
}}
|
|
271
|
-
className={classNames(classes.resize, 'resize')}
|
|
272
|
-
/>
|
|
273
|
-
</div>
|
|
274
|
-
</div>,
|
|
275
|
-
<span key={'sp2'}> </span>
|
|
276
|
-
];
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
const styles = theme => ({
|
|
281
|
-
portal: {
|
|
282
|
-
position: 'absolute',
|
|
283
|
-
opacity: 0,
|
|
284
|
-
transition: 'opacity 200ms linear'
|
|
285
|
-
},
|
|
286
|
-
floatingButtonRow: {
|
|
287
|
-
backgroundColor: 'white',
|
|
288
|
-
borderRadius: '1px',
|
|
289
|
-
display: 'flex',
|
|
290
|
-
padding: '10px',
|
|
291
|
-
border: 'solid 1px #eeeeee',
|
|
292
|
-
boxShadow:
|
|
293
|
-
'0px 1px 5px 0px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 3px 1px -2px rgba(0, 0, 0, 0.12)'
|
|
294
|
-
},
|
|
295
|
-
progress: {
|
|
296
|
-
position: 'absolute',
|
|
297
|
-
left: '0',
|
|
298
|
-
width: 'fit-content',
|
|
299
|
-
top: '0%',
|
|
300
|
-
transition: 'opacity 200ms linear'
|
|
301
|
-
},
|
|
302
|
-
hideProgress: {
|
|
303
|
-
opacity: 0
|
|
304
|
-
},
|
|
305
|
-
loading: {
|
|
306
|
-
opacity: 0.3
|
|
307
|
-
},
|
|
308
|
-
pendingDelete: {
|
|
309
|
-
opacity: 0.3
|
|
310
|
-
},
|
|
311
|
-
root: {
|
|
312
|
-
position: 'relative',
|
|
313
|
-
border: 'solid 1px white',
|
|
314
|
-
display: 'flex',
|
|
315
|
-
transition: 'opacity 200ms linear'
|
|
316
|
-
},
|
|
317
|
-
delete: {
|
|
318
|
-
position: 'absolute',
|
|
319
|
-
right: 0
|
|
320
|
-
},
|
|
321
|
-
imageContainer: {
|
|
322
|
-
position: 'relative',
|
|
323
|
-
width: 'fit-content',
|
|
324
|
-
display: 'flex',
|
|
325
|
-
alignItems: 'center',
|
|
326
|
-
|
|
327
|
-
'&&:hover > .resize': {
|
|
328
|
-
display: 'block'
|
|
329
|
-
}
|
|
330
|
-
},
|
|
331
|
-
active: {
|
|
332
|
-
border: `solid 1px ${theme.palette.primary.main}`
|
|
333
|
-
},
|
|
334
|
-
resize: {
|
|
335
|
-
backgroundColor: theme.palette.primary.main,
|
|
336
|
-
cursor: 'col-resize',
|
|
337
|
-
height: '35px',
|
|
338
|
-
width: '5px',
|
|
339
|
-
borderRadius: 8,
|
|
340
|
-
marginLeft: '5px',
|
|
341
|
-
marginRight: '10px',
|
|
342
|
-
display: 'none'
|
|
343
|
-
},
|
|
344
|
-
drawableHeight: {
|
|
345
|
-
minHeight: 350
|
|
346
|
-
}
|
|
347
|
-
});
|
|
348
|
-
|
|
349
|
-
export default withStyles(styles)(Component);
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import debug from 'debug';
|
|
4
|
-
import ReactDOM from 'react-dom';
|
|
5
|
-
import { withStyles } from '@material-ui/core/styles';
|
|
6
|
-
import classNames from 'classnames';
|
|
7
|
-
|
|
8
|
-
import { MarkButton } from '../toolbar/toolbar-buttons';
|
|
9
|
-
import AltDialog from './alt-dialog';
|
|
10
|
-
|
|
11
|
-
const log = debug('@pie-lib:editable-html:plugins:image:image-toolbar');
|
|
12
|
-
|
|
13
|
-
const AlignmentButton = ({ alignment, active, onClick }) => {
|
|
14
|
-
return (
|
|
15
|
-
<MarkButton active={active} onToggle={() => onClick(alignment)} label={alignment}>
|
|
16
|
-
{alignment}
|
|
17
|
-
</MarkButton>
|
|
18
|
-
);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
AlignmentButton.propTypes = {
|
|
22
|
-
alignment: PropTypes.string.isRequired,
|
|
23
|
-
active: PropTypes.bool.isRequired,
|
|
24
|
-
onClick: PropTypes.func.isRequired
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export class ImageToolbar extends React.Component {
|
|
28
|
-
static propTypes = {
|
|
29
|
-
onChange: PropTypes.func.isRequired,
|
|
30
|
-
classes: PropTypes.object.isRequired,
|
|
31
|
-
alignment: PropTypes.string,
|
|
32
|
-
alt: PropTypes.string,
|
|
33
|
-
imageLoaded: PropTypes.bool
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
onAltTextDone = newAlt => {
|
|
37
|
-
log('[onAltTextDone]: alt:', newAlt);
|
|
38
|
-
|
|
39
|
-
this.props.onChange({ alt: newAlt });
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
onAlignmentClick = alignment => {
|
|
43
|
-
log('[onAlignmentClick]: alignment:', alignment);
|
|
44
|
-
this.props.onChange({ alignment });
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
renderDialog = () => {
|
|
48
|
-
const { alt } = this.props;
|
|
49
|
-
const popoverEl = document.createElement('div');
|
|
50
|
-
|
|
51
|
-
const el = <AltDialog alt={alt} onDone={this.onAltTextDone} />;
|
|
52
|
-
|
|
53
|
-
ReactDOM.render(el, popoverEl);
|
|
54
|
-
|
|
55
|
-
document.body.appendChild(popoverEl);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
render() {
|
|
59
|
-
const { classes, alignment, imageLoaded } = this.props;
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<div className={classes.holder}>
|
|
63
|
-
<AlignmentButton
|
|
64
|
-
alignment={'left'}
|
|
65
|
-
active={alignment === 'left'}
|
|
66
|
-
onClick={this.onAlignmentClick}
|
|
67
|
-
/>
|
|
68
|
-
<AlignmentButton
|
|
69
|
-
alignment={'center'}
|
|
70
|
-
active={alignment === 'center'}
|
|
71
|
-
onClick={this.onAlignmentClick}
|
|
72
|
-
/>
|
|
73
|
-
<AlignmentButton
|
|
74
|
-
alignment={'right'}
|
|
75
|
-
active={alignment === 'right'}
|
|
76
|
-
onClick={this.onAlignmentClick}
|
|
77
|
-
/>
|
|
78
|
-
<span
|
|
79
|
-
className={classNames({
|
|
80
|
-
[classes.disabled]: !imageLoaded,
|
|
81
|
-
[classes.altButton]: true
|
|
82
|
-
})}
|
|
83
|
-
onMouseDown={event => imageLoaded && this.renderDialog(event)}
|
|
84
|
-
>
|
|
85
|
-
Alt text
|
|
86
|
-
</span>
|
|
87
|
-
</div>
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const styles = theme => ({
|
|
93
|
-
holder: {
|
|
94
|
-
paddingLeft: theme.spacing.unit,
|
|
95
|
-
display: 'flex',
|
|
96
|
-
alignItems: 'center'
|
|
97
|
-
},
|
|
98
|
-
disabled: {
|
|
99
|
-
opacity: 0.5
|
|
100
|
-
},
|
|
101
|
-
altButton: {
|
|
102
|
-
borderLeft: '1px solid grey',
|
|
103
|
-
paddingLeft: 8,
|
|
104
|
-
marginLeft: 4,
|
|
105
|
-
},
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
export default withStyles(styles)(ImageToolbar);
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import { Data, Inline } from 'slate';
|
|
2
|
-
|
|
3
|
-
import Image from '@material-ui/icons/Image';
|
|
4
|
-
import ImageComponent from './component';
|
|
5
|
-
import ImageToolbar from './image-toolbar';
|
|
6
|
-
import InsertImageHandler from './insert-image-handler';
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import debug from 'debug';
|
|
9
|
-
|
|
10
|
-
const log = debug('@pie-lib:editable-html:plugins:image');
|
|
11
|
-
|
|
12
|
-
export default function ImagePlugin(opts) {
|
|
13
|
-
const toolbar = opts.insertImageRequested && {
|
|
14
|
-
icon: <Image />,
|
|
15
|
-
onClick: (value, onChange) => {
|
|
16
|
-
log('[toolbar] onClick');
|
|
17
|
-
const inline = Inline.create({
|
|
18
|
-
type: 'image',
|
|
19
|
-
isVoid: true,
|
|
20
|
-
data: {
|
|
21
|
-
loaded: false,
|
|
22
|
-
src: undefined
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const change = value.change().insertInline(inline);
|
|
27
|
-
onChange(change);
|
|
28
|
-
opts.insertImageRequested(getValue => new InsertImageHandler(inline, getValue, onChange));
|
|
29
|
-
},
|
|
30
|
-
supports: node => node.object === 'inline' && node.type === 'image',
|
|
31
|
-
customToolbar: (node, value, onToolbarDone) => {
|
|
32
|
-
const alignment = node.data.get('alignment');
|
|
33
|
-
const alt = node.data.get('alt');
|
|
34
|
-
const imageLoaded = node.data.get('loaded') !== false;
|
|
35
|
-
const onChange = newValues => {
|
|
36
|
-
const update = {
|
|
37
|
-
...node.data.toObject(),
|
|
38
|
-
...newValues
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const change = value.change().setNodeByKey(node.key, { data: update });
|
|
42
|
-
onToolbarDone(change, false);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const Tb = () => (
|
|
46
|
-
<ImageToolbar alt={alt} imageLoaded={imageLoaded} alignment={alignment || 'left'} onChange={onChange} />
|
|
47
|
-
);
|
|
48
|
-
return Tb;
|
|
49
|
-
},
|
|
50
|
-
showDone: true
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
return {
|
|
54
|
-
name: 'image',
|
|
55
|
-
toolbar,
|
|
56
|
-
deleteNode: (e, node, value, onChange) => {
|
|
57
|
-
e.preventDefault();
|
|
58
|
-
if (opts.onDelete) {
|
|
59
|
-
const update = node.data.merge(Data.create({ deleteStatus: 'pending' }));
|
|
60
|
-
|
|
61
|
-
let change = value.change().setNodeByKey(node.key, { data: update });
|
|
62
|
-
|
|
63
|
-
onChange(change);
|
|
64
|
-
opts.onDelete(node.data.get('src'), (err, v) => {
|
|
65
|
-
if (!err) {
|
|
66
|
-
change = v.change().removeNodeByKey(node.key);
|
|
67
|
-
} else {
|
|
68
|
-
log('[error]: ', err);
|
|
69
|
-
change = v
|
|
70
|
-
.change()
|
|
71
|
-
.setNodeByKey(node.key, node.data.merge(Data.create({ deleteStatus: 'failed' })));
|
|
72
|
-
}
|
|
73
|
-
onChange(change);
|
|
74
|
-
});
|
|
75
|
-
} else {
|
|
76
|
-
let change = value.change().removeNodeByKey(node.key);
|
|
77
|
-
onChange(change);
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
stopReset: value => {
|
|
81
|
-
const imgPendingInsertion = value.document.findDescendant(n => {
|
|
82
|
-
if (n.type !== 'image') {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
return n.data.get('loaded') === false;
|
|
86
|
-
});
|
|
87
|
-
/** don't reset if there is an image pending insertion */
|
|
88
|
-
return imgPendingInsertion !== undefined && imgPendingInsertion !== null;
|
|
89
|
-
},
|
|
90
|
-
renderNode(props) {
|
|
91
|
-
if (props.node.type === 'image') {
|
|
92
|
-
const all = Object.assign(
|
|
93
|
-
{
|
|
94
|
-
onDelete: opts.onDelete,
|
|
95
|
-
onFocus: opts.onFocus,
|
|
96
|
-
onBlur: opts.onBlur,
|
|
97
|
-
maxImageWidth: opts.maxImageWidth,
|
|
98
|
-
maxImageHeight: opts.maxImageHeight
|
|
99
|
-
},
|
|
100
|
-
props
|
|
101
|
-
);
|
|
102
|
-
return <ImageComponent {...all} />;
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
normalizeNode: node => {
|
|
106
|
-
const textNodeMap = {};
|
|
107
|
-
const updateNodesArray = [];
|
|
108
|
-
let index = 0;
|
|
109
|
-
|
|
110
|
-
if (node.object !== 'document') return;
|
|
111
|
-
|
|
112
|
-
node.findDescendant(d => {
|
|
113
|
-
if (d.object === 'text') {
|
|
114
|
-
textNodeMap[index] = d;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (d.type === 'image') {
|
|
118
|
-
if (index > 0 && textNodeMap[index - 1] && textNodeMap[index - 1].text === '') {
|
|
119
|
-
updateNodesArray.push(textNodeMap[index - 1]);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
index++;
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
if (!updateNodesArray.length) return;
|
|
127
|
-
|
|
128
|
-
return change => {
|
|
129
|
-
change.withoutNormalization(() => {
|
|
130
|
-
updateNodesArray.forEach(n => change.insertTextByKey(n.key, 0, ' '));
|
|
131
|
-
});
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export const serialization = {
|
|
138
|
-
deserialize(el /*, next*/) {
|
|
139
|
-
const name = el.tagName.toLowerCase();
|
|
140
|
-
if (name !== 'img') return;
|
|
141
|
-
|
|
142
|
-
log('deserialize: ', name);
|
|
143
|
-
const style = el.style || { width: '', height: '', margin: '', justifyContent: '' };
|
|
144
|
-
const width = parseInt(style.width.replace('px', ''), 10) || null;
|
|
145
|
-
const height = parseInt(style.height.replace('px', ''), 10) || null;
|
|
146
|
-
|
|
147
|
-
const out = {
|
|
148
|
-
object: 'inline',
|
|
149
|
-
type: 'image',
|
|
150
|
-
isVoid: true,
|
|
151
|
-
data: {
|
|
152
|
-
src: el.getAttribute('src'),
|
|
153
|
-
width,
|
|
154
|
-
height,
|
|
155
|
-
margin: el.style.margin,
|
|
156
|
-
justifyContent: el.style.justifyContent,
|
|
157
|
-
alignment: el.getAttribute('alignment'),
|
|
158
|
-
alt: el.getAttribute('alt')
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
log('return object: ', out);
|
|
162
|
-
return out;
|
|
163
|
-
},
|
|
164
|
-
serialize(object /*, children*/) {
|
|
165
|
-
if (object.type !== 'image') return;
|
|
166
|
-
|
|
167
|
-
const { data } = object;
|
|
168
|
-
const src = data.get('src');
|
|
169
|
-
const width = data.get('width');
|
|
170
|
-
const height = data.get('height');
|
|
171
|
-
const alignment = data.get('alignment');
|
|
172
|
-
const margin = data.get('margin');
|
|
173
|
-
const justifyContent = data.get('margin');
|
|
174
|
-
const alt = data.get('alt');
|
|
175
|
-
const style = {};
|
|
176
|
-
if (width) {
|
|
177
|
-
style.width = `${width}px`;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
if (height) {
|
|
181
|
-
style.height = `${height}px`;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
style.margin = margin;
|
|
185
|
-
style.justifyContent = justifyContent;
|
|
186
|
-
|
|
187
|
-
if (alignment) {
|
|
188
|
-
switch (alignment) {
|
|
189
|
-
case 'left':
|
|
190
|
-
style.justifyContent = 'flex-start';
|
|
191
|
-
style.margin = '0';
|
|
192
|
-
break;
|
|
193
|
-
case 'center':
|
|
194
|
-
style.justifyContent = 'center';
|
|
195
|
-
style.margin = '0 auto';
|
|
196
|
-
break;
|
|
197
|
-
case 'right':
|
|
198
|
-
style.justifyContent = 'flex-end';
|
|
199
|
-
style.margin = 'auto 0 0 auto';
|
|
200
|
-
break;
|
|
201
|
-
default:
|
|
202
|
-
style.justifyContent = 'flex-start';
|
|
203
|
-
break;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
style.objectFit = 'contain';
|
|
208
|
-
|
|
209
|
-
const props = {
|
|
210
|
-
src,
|
|
211
|
-
style,
|
|
212
|
-
alignment,
|
|
213
|
-
alt
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
return <img {...props} />;
|
|
217
|
-
}
|
|
218
|
-
};
|