@pie-element/ebsr 6.6.3-next.1075 → 6.6.3-next.1082
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/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/CHANGELOG.json +1677 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/CHANGELOG.md +1695 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/LICENSE.md +5 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/README.md +12 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/alert-dialog.js +44 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/alert-dialog.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/checkbox.js +86 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/checkbox.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/choice-configuration/feedback-menu.js +164 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/choice-configuration/feedback-menu.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/choice-configuration/index.js +398 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/choice-configuration/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/choice-utils.js +54 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/choice-utils.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/feedback-config/feedback-selector.js +185 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/feedback-config/feedback-selector.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/feedback-config/group.js +75 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/feedback-config/group.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/feedback-config/index.js +178 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/feedback-config/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/form-section.js +46 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/form-section.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/help.js +145 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/help.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/index.js +216 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/input.js +139 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/input.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/inputs.js +131 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/inputs.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/langs.js +179 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/langs.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/layout/config-layout.js +101 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/layout/config-layout.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/layout/index.js +24 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/layout/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/layout/layout-contents.js +105 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/layout/layout-contents.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/layout/settings-box.js +87 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/layout/settings-box.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/mui-box/index.js +79 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/mui-box/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/number-text-field-custom.js +364 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/number-text-field-custom.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/number-text-field.js +265 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/number-text-field.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/radio-with-label.js +41 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/radio-with-label.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/settings/display-size.js +77 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/settings/display-size.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/settings/index.js +130 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/settings/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/settings/panel.js +412 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/settings/panel.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/settings/settings-radio-label.js +43 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/settings/settings-radio-label.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/settings/toggle.js +56 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/settings/toggle.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/tabs/index.js +106 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/tabs/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/tags-input/index.js +198 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/tags-input/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/two-choice.js +180 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/two-choice.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/with-stateful-model.js +84 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/lib/with-stateful-model.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/package.json +30 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/alert-dialog.jsx +43 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/checkbox.jsx +63 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/choice-configuration/feedback-menu.jsx +103 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/choice-configuration/index.jsx +319 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/choice-utils.js +30 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/feedback-config/feedback-selector.jsx +116 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/feedback-config/group.jsx +54 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/feedback-config/index.jsx +98 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/form-section.jsx +23 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/help.jsx +88 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/index.js +58 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/input.jsx +72 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/inputs.jsx +96 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/langs.jsx +122 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/layout/config-layout.jsx +64 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/layout/index.js +4 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/layout/layout-contents.jsx +60 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/layout/settings-box.jsx +31 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/mui-box/index.jsx +64 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/number-text-field-custom.jsx +276 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/number-text-field.jsx +196 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/radio-with-label.jsx +18 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/settings/display-size.jsx +52 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/settings/index.js +75 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/settings/panel.jsx +297 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/settings/settings-radio-label.jsx +20 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/settings/toggle.jsx +31 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/tabs/index.jsx +51 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/tags-input/index.jsx +121 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/two-choice.jsx +94 -0
- package/configure/node_modules/@pie-element/multiple-choice/node_modules/@pie-lib/config-ui/src/with-stateful-model.jsx +36 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/CHANGELOG.json +547 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/CHANGELOG.md +524 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/LICENSE.md +5 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/README.md +64 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/expander.js +86 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/expander.js.map +1 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/index.js +155 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/styles.js +65 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/styles.js.map +1 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/package.json +36 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/preview.png +0 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/src/expander.jsx +65 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/src/index.jsx +75 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/src/styles.js +60 -0
- package/configure/node_modules/@pie-lib/editable-html/CHANGELOG.json +3327 -0
- package/configure/node_modules/@pie-lib/editable-html/CHANGELOG.md +1676 -0
- package/configure/node_modules/@pie-lib/editable-html/LICENSE.md +5 -0
- package/configure/node_modules/@pie-lib/editable-html/README.md +45 -0
- package/configure/node_modules/@pie-lib/editable-html/deploy.sh +16 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/editor.js +837 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/editor.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/index.js +224 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/parse-html.js +16 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/parse-html.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/characters/custom-popover.js +70 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/characters/custom-popover.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/characters/index.js +261 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/characters/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/characters/utils.js +362 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/characters/utils.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/component.js +393 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/component.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/image-toolbar.js +78 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/image-toolbar.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/index.js +221 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/insert-image-handler.js +135 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/insert-image-handler.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/index.js +141 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/list/index.js +204 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/list/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/math/index.js +347 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/math/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/media/index.js +339 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/media/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/media/media-dialog.js +434 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/media/media-dialog.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/media/media-toolbar.js +99 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/media/media-toolbar.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/media/media-wrapper.js +93 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/media/media-wrapper.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/drag-in-the-blank/choice.js +251 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/drag-in-the-blank/choice.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/drag-in-the-blank/index.js +97 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/drag-in-the-blank/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/explicit-constructed-response/index.js +54 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/explicit-constructed-response/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/icons/index.js +93 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/icons/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/index.js +288 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/inline-dropdown/index.js +70 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/inline-dropdown/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/utils.js +110 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/utils.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/table/icons/index.js +69 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/table/icons/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/table/index.js +497 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/table/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/table/table-toolbar.js +158 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/table/table-toolbar.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/default-toolbar.js +132 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/default-toolbar.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/done-button.js +50 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/done-button.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/editor-and-toolbar.js +263 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/editor-and-toolbar.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/index.js +32 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/toolbar-buttons.js +161 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/toolbar-buttons.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/toolbar.js +346 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/toolbar.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/utils.js +62 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/plugins/utils.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/serialization.js +428 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/serialization.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/theme.js +9 -0
- package/configure/node_modules/@pie-lib/editable-html/lib/theme.js.map +1 -0
- package/configure/node_modules/@pie-lib/editable-html/package.json +51 -0
- package/configure/node_modules/@pie-lib/editable-html/playground/image/data.js +59 -0
- package/configure/node_modules/@pie-lib/editable-html/playground/image/index.html +24 -0
- package/configure/node_modules/@pie-lib/editable-html/playground/image/index.jsx +83 -0
- package/configure/node_modules/@pie-lib/editable-html/playground/index.html +27 -0
- package/configure/node_modules/@pie-lib/editable-html/playground/mathquill/index.html +25 -0
- package/configure/node_modules/@pie-lib/editable-html/playground/mathquill/index.jsx +151 -0
- package/configure/node_modules/@pie-lib/editable-html/playground/package.json +15 -0
- package/configure/node_modules/@pie-lib/editable-html/playground/prod-test/index.html +26 -0
- package/configure/node_modules/@pie-lib/editable-html/playground/prod-test/index.jsx +30 -0
- package/configure/node_modules/@pie-lib/editable-html/playground/schema-override/data.js +29 -0
- package/configure/node_modules/@pie-lib/editable-html/playground/schema-override/image-plugin.jsx +40 -0
- package/configure/node_modules/@pie-lib/editable-html/playground/schema-override/index.html +23 -0
- package/configure/node_modules/@pie-lib/editable-html/playground/schema-override/index.jsx +96 -0
- package/configure/node_modules/@pie-lib/editable-html/playground/serialization/data.js +29 -0
- package/configure/node_modules/@pie-lib/editable-html/playground/serialization/image-plugin.jsx +40 -0
- package/configure/node_modules/@pie-lib/editable-html/playground/serialization/index.html +24 -0
- package/configure/node_modules/@pie-lib/editable-html/playground/serialization/index.jsx +12 -0
- package/configure/node_modules/@pie-lib/editable-html/playground/static.json +3 -0
- package/configure/node_modules/@pie-lib/editable-html/playground/table-examples.html +67 -0
- package/configure/node_modules/@pie-lib/editable-html/playground/webpack.config.js +42 -0
- package/configure/node_modules/@pie-lib/editable-html/src/editor.jsx +724 -0
- package/configure/node_modules/@pie-lib/editable-html/src/index.jsx +145 -0
- package/configure/node_modules/@pie-lib/editable-html/src/parse-html.js +8 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/README.md +27 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/characters/custom-popover.js +45 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/characters/index.jsx +237 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/characters/utils.js +444 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/image/component.jsx +318 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/image/image-toolbar.jsx +32 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/image/index.jsx +182 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/image/insert-image-handler.js +93 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/index.jsx +115 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/list/index.jsx +175 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/math/index.jsx +283 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/media/index.jsx +284 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/media/media-dialog.js +372 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/media/media-toolbar.jsx +53 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/media/media-wrapper.jsx +43 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/respArea/drag-in-the-blank/choice.jsx +187 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/respArea/drag-in-the-blank/index.jsx +78 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/respArea/explicit-constructed-response/index.jsx +45 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/respArea/icons/index.jsx +68 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/respArea/index.jsx +259 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/respArea/inline-dropdown/index.jsx +63 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/respArea/utils.jsx +77 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/table/icons/index.jsx +59 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/table/index.jsx +437 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/table/table-toolbar.jsx +104 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/toolbar/default-toolbar.jsx +111 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/toolbar/done-button.jsx +36 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/toolbar/editor-and-toolbar.jsx +225 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/toolbar/index.jsx +21 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/toolbar/toolbar-buttons.jsx +97 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/toolbar/toolbar.jsx +323 -0
- package/configure/node_modules/@pie-lib/editable-html/src/plugins/utils.js +32 -0
- package/configure/node_modules/@pie-lib/editable-html/src/serialization.jsx +385 -0
- package/configure/node_modules/@pie-lib/editable-html/src/theme.js +1 -0
- package/configure/node_modules/@pie-lib/editable-html/static.json +1 -0
- package/configure/node_modules/@pie-lib/math-input/CHANGELOG.json +1547 -0
- package/configure/node_modules/@pie-lib/math-input/CHANGELOG.md +765 -0
- package/configure/node_modules/@pie-lib/math-input/LICENSE.md +5 -0
- package/configure/node_modules/@pie-lib/math-input/README.md +27 -0
- package/configure/node_modules/@pie-lib/math-input/lib/horizontal-keypad.js +129 -0
- package/configure/node_modules/@pie-lib/math-input/lib/horizontal-keypad.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/index.js +80 -0
- package/configure/node_modules/@pie-lib/math-input/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keypad/index.js +440 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keypad/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keypad/keys-layout.js +34 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keypad/keys-layout.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/basic-operators.js +41 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/basic-operators.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/chars.js +17 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/chars.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/comparison.js +46 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/comparison.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/constants.js +43 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/constants.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/digits.js +53 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/digits.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/edit.js +16 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/edit.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/exponent.js +35 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/exponent.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/fractions.js +31 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/fractions.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/geometry.js +165 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/geometry.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/grades.js +295 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/grades.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/index.js +54 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/log.js +32 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/log.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/logic.js +23 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/logic.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/matrices.js +23 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/matrices.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/misc.js +69 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/misc.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/navigation.js +23 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/navigation.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/operators.js +17 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/operators.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/statistics.js +45 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/statistics.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/sub-sup.js +23 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/sub-sup.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/trigonometry.js +53 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/trigonometry.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/utils.js +130 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/utils.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/vars.js +29 -0
- package/configure/node_modules/@pie-lib/math-input/lib/keys/vars.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/math-input.js +206 -0
- package/configure/node_modules/@pie-lib/math-input/lib/math-input.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/mq/custom-elements.js +23 -0
- package/configure/node_modules/@pie-lib/math-input/lib/mq/custom-elements.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/mq/index.js +24 -0
- package/configure/node_modules/@pie-lib/math-input/lib/mq/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/mq/input.js +257 -0
- package/configure/node_modules/@pie-lib/math-input/lib/mq/input.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/lib/mq/static.js +224 -0
- package/configure/node_modules/@pie-lib/math-input/lib/mq/static.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-input/package.json +26 -0
- package/configure/node_modules/@pie-lib/math-input/src/horizontal-keypad.jsx +56 -0
- package/configure/node_modules/@pie-lib/math-input/src/index.jsx +27 -0
- package/configure/node_modules/@pie-lib/math-input/src/keypad/index.jsx +367 -0
- package/configure/node_modules/@pie-lib/math-input/src/keypad/keys-layout.js +17 -0
- package/configure/node_modules/@pie-lib/math-input/src/keys/basic-operators.js +32 -0
- package/configure/node_modules/@pie-lib/math-input/src/keys/chars.js +5 -0
- package/configure/node_modules/@pie-lib/math-input/src/keys/comparison.js +27 -0
- package/configure/node_modules/@pie-lib/math-input/src/keys/constants.js +35 -0
- package/configure/node_modules/@pie-lib/math-input/src/keys/digits.js +40 -0
- package/configure/node_modules/@pie-lib/math-input/src/keys/edit.js +3 -0
- package/configure/node_modules/@pie-lib/math-input/src/keys/exponent.js +27 -0
- package/configure/node_modules/@pie-lib/math-input/src/keys/fractions.js +23 -0
- package/configure/node_modules/@pie-lib/math-input/src/keys/geometry.js +140 -0
- package/configure/node_modules/@pie-lib/math-input/src/keys/grades.js +379 -0
- package/configure/node_modules/@pie-lib/math-input/src/keys/index.js +21 -0
- package/configure/node_modules/@pie-lib/math-input/src/keys/log.js +22 -0
- package/configure/node_modules/@pie-lib/math-input/src/keys/logic.js +15 -0
- package/configure/node_modules/@pie-lib/math-input/src/keys/matrices.js +15 -0
- package/configure/node_modules/@pie-lib/math-input/src/keys/misc.js +60 -0
- package/configure/node_modules/@pie-lib/math-input/src/keys/navigation.js +8 -0
- package/configure/node_modules/@pie-lib/math-input/src/keys/operators.js +9 -0
- package/configure/node_modules/@pie-lib/math-input/src/keys/statistics.js +36 -0
- package/configure/node_modules/@pie-lib/math-input/src/keys/sub-sup.js +15 -0
- package/configure/node_modules/@pie-lib/math-input/src/keys/trigonometry.js +15 -0
- package/configure/node_modules/@pie-lib/math-input/src/keys/utils.js +71 -0
- package/configure/node_modules/@pie-lib/math-input/src/keys/vars.js +19 -0
- package/configure/node_modules/@pie-lib/math-input/src/math-input.jsx +128 -0
- package/configure/node_modules/@pie-lib/math-input/src/mq/custom-elements.js +11 -0
- package/configure/node_modules/@pie-lib/math-input/src/mq/index.js +4 -0
- package/configure/node_modules/@pie-lib/math-input/src/mq/input.jsx +163 -0
- package/configure/node_modules/@pie-lib/math-input/src/mq/static.jsx +145 -0
- package/configure/node_modules/@pie-lib/math-rendering/CHANGELOG.json +672 -0
- package/configure/node_modules/@pie-lib/math-rendering/CHANGELOG.md +457 -0
- package/configure/node_modules/@pie-lib/math-rendering/LICENSE.md +5 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/index.js +30 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/chtml.js +316 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/chtml.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/index.js +23 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/mml.js +123 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/mml.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/normalization.js +103 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/normalization.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/render-math.js +281 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/render-math.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/package.json +19 -0
- package/configure/node_modules/@pie-lib/math-rendering/playground/demo.html +872 -0
- package/configure/node_modules/@pie-lib/math-rendering/playground/demo.js +108 -0
- package/configure/node_modules/@pie-lib/math-rendering/playground/main.html +156 -0
- package/configure/node_modules/@pie-lib/math-rendering/playground/main.js +16 -0
- package/configure/node_modules/@pie-lib/math-rendering/playground/webpack.config.js +29 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/index.js +4 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/chtml.js +215 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/index.js +13 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/mml.js +24 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/normalization.js +69 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/render-math.js +235 -0
- package/configure/node_modules/@pie-lib/math-toolbar/CHANGELOG.json +862 -0
- package/configure/node_modules/@pie-lib/math-toolbar/CHANGELOG.md +639 -0
- package/configure/node_modules/@pie-lib/math-toolbar/LICENSE.md +5 -0
- package/configure/node_modules/@pie-lib/math-toolbar/lib/done-button.js +53 -0
- package/configure/node_modules/@pie-lib/math-toolbar/lib/done-button.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-toolbar/lib/editor-and-pad.js +483 -0
- package/configure/node_modules/@pie-lib/math-toolbar/lib/editor-and-pad.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-toolbar/lib/index.js +280 -0
- package/configure/node_modules/@pie-lib/math-toolbar/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-toolbar/lib/math-preview.js +173 -0
- package/configure/node_modules/@pie-lib/math-toolbar/lib/math-preview.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-toolbar/package.json +37 -0
- package/configure/node_modules/@pie-lib/math-toolbar/src/done-button.jsx +39 -0
- package/configure/node_modules/@pie-lib/math-toolbar/src/editor-and-pad.jsx +388 -0
- package/configure/node_modules/@pie-lib/math-toolbar/src/index.jsx +202 -0
- package/configure/node_modules/@pie-lib/math-toolbar/src/math-preview.jsx +107 -0
- package/configure/node_modules/@pie-lib/render-ui/CHANGELOG.json +937 -0
- package/configure/node_modules/@pie-lib/render-ui/CHANGELOG.md +626 -0
- package/configure/node_modules/@pie-lib/render-ui/LICENSE.md +5 -0
- package/configure/node_modules/@pie-lib/render-ui/README.md +33 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/collapsible/index.js +146 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/collapsible/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/color.js +134 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/color.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/feedback.js +160 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/feedback.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/has-text.js +24 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/has-text.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/html-and-math.js +102 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/html-and-math.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/index.js +104 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/input-container.js +60 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/input-container.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-layout.js +133 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-layout.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-prompt.js +162 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-prompt.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/purpose.js +28 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/purpose.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/readable.js +28 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/readable.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/response-indicators.js +160 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/response-indicators.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/withUndoReset.js +206 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/withUndoReset.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/package.json +30 -0
- package/configure/node_modules/@pie-lib/render-ui/src/collapsible/index.jsx +68 -0
- package/configure/node_modules/@pie-lib/render-ui/src/color.js +48 -0
- package/configure/node_modules/@pie-lib/render-ui/src/feedback.jsx +100 -0
- package/configure/node_modules/@pie-lib/render-ui/src/has-text.js +14 -0
- package/configure/node_modules/@pie-lib/render-ui/src/html-and-math.js +40 -0
- package/configure/node_modules/@pie-lib/render-ui/src/index.js +27 -0
- package/configure/node_modules/@pie-lib/render-ui/src/input-container.jsx +41 -0
- package/configure/node_modules/@pie-lib/render-ui/src/preview-layout.jsx +77 -0
- package/configure/node_modules/@pie-lib/render-ui/src/preview-prompt.jsx +90 -0
- package/configure/node_modules/@pie-lib/render-ui/src/purpose.jsx +19 -0
- package/configure/node_modules/@pie-lib/render-ui/src/readable.jsx +19 -0
- package/configure/node_modules/@pie-lib/render-ui/src/response-indicators.jsx +89 -0
- package/configure/node_modules/@pie-lib/render-ui/src/withUndoReset.jsx +118 -0
- package/configure/package.json +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/print.js +2 -2
- package/lib/print.js.map +1 -1
- package/package.json +2 -2
- package/src/index.js +2 -2
- package/src/print.js +2 -2
|
@@ -0,0 +1,318 @@
|
|
|
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 = { width: box && box.naturalWidth || 100, height: box && box.naturalHeight || 100 };
|
|
97
|
+
|
|
98
|
+
const { width, height } = this.updateImageDimensions(
|
|
99
|
+
dimensions,
|
|
100
|
+
{
|
|
101
|
+
width: dimensions.width < maxImageWidth ? dimensions.width : maxImageWidth,
|
|
102
|
+
height: dimensions.height < maxImageHeight ? dimensions.height : maxImageHeight
|
|
103
|
+
},
|
|
104
|
+
true
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
box.style.width = `${width}px`;
|
|
108
|
+
box.style.height = `${height}px`;
|
|
109
|
+
|
|
110
|
+
this.setState({
|
|
111
|
+
dimensions: { height: height, width: width },
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
const { node, editor } = this.props;
|
|
115
|
+
|
|
116
|
+
let update = node.data;
|
|
117
|
+
|
|
118
|
+
update = update.set('width', width);
|
|
119
|
+
update = update.set('height', height);
|
|
120
|
+
|
|
121
|
+
if (!update.equals(node.data)) {
|
|
122
|
+
editor.change(c => c.setNodeByKey(node.key, { data: update }));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
startResizing = (e) => {
|
|
128
|
+
const bounds = e.target.getBoundingClientRect();
|
|
129
|
+
const box = this.img;
|
|
130
|
+
const dimensions = { width: box && box.naturalWidth || 100, height: box && box.naturalHeight || 100};
|
|
131
|
+
|
|
132
|
+
const { width, height } = this.updateImageDimensions(
|
|
133
|
+
dimensions,
|
|
134
|
+
{
|
|
135
|
+
width: e.clientX - bounds.left,
|
|
136
|
+
height: e.clientY - bounds.top
|
|
137
|
+
},
|
|
138
|
+
true
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
const hasMinimumWidth = width > 50 && height > 50;
|
|
142
|
+
const hasDimensionsConstraints = width <= 700 && height <= 900;
|
|
143
|
+
|
|
144
|
+
if (hasMinimumWidth && hasDimensionsConstraints && box) {
|
|
145
|
+
box.style.width = `${width}px`;
|
|
146
|
+
box.style.height = `${height}px`;
|
|
147
|
+
|
|
148
|
+
this.setState({
|
|
149
|
+
dimensions: { height: height, width: width }
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
const { node, editor } = this.props;
|
|
153
|
+
|
|
154
|
+
let update = node.data;
|
|
155
|
+
|
|
156
|
+
update = update.set('width', width);
|
|
157
|
+
update = update.set('height', height);
|
|
158
|
+
|
|
159
|
+
if (!update.equals(node.data)) {
|
|
160
|
+
editor.change(c => c.setNodeByKey(node.key, { data: update }));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
stopResizing = () => {
|
|
166
|
+
window.removeEventListener('mousemove', this.startResizing, false);
|
|
167
|
+
window.removeEventListener('mouseup', this.stopResizing, false);
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
updateImageDimensions = (initialDim, nextDim, keepAspectRatio, resizeType) => {
|
|
171
|
+
// if we want to keep image aspect ratio
|
|
172
|
+
if (keepAspectRatio) {
|
|
173
|
+
const imageAspectRatio = initialDim.width / initialDim.height;
|
|
174
|
+
|
|
175
|
+
if (resizeType === 'height') {
|
|
176
|
+
// if we want to change image height => we update the width accordingly
|
|
177
|
+
return {
|
|
178
|
+
width: nextDim.height * imageAspectRatio,
|
|
179
|
+
height: nextDim.height
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// if we want to change image width => we update the height accordingly
|
|
184
|
+
return {
|
|
185
|
+
width: nextDim.width,
|
|
186
|
+
height: nextDim.width / imageAspectRatio
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// if we don't want to keep aspect ratio, we just update both values
|
|
191
|
+
return {
|
|
192
|
+
width: nextDim.width,
|
|
193
|
+
height: nextDim.height
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
render() {
|
|
199
|
+
const { node, editor, classes, attributes, onFocus } = this.props;
|
|
200
|
+
const active = editor.value.isFocused && editor.value.selection.hasEdgeIn(node);
|
|
201
|
+
const src = node.data.get('src');
|
|
202
|
+
const percent = node.data.get('percent');
|
|
203
|
+
const loaded = node.data.get('loaded') !== false;
|
|
204
|
+
const deleteStatus = node.data.get('deleteStatus');
|
|
205
|
+
|
|
206
|
+
log('[render] node.data:', node.data);
|
|
207
|
+
|
|
208
|
+
const size = this.getSize(node.data);
|
|
209
|
+
|
|
210
|
+
log('[render] style:', size);
|
|
211
|
+
|
|
212
|
+
const className = classNames(
|
|
213
|
+
classes.root,
|
|
214
|
+
!loaded && classes.loading,
|
|
215
|
+
deleteStatus === 'pending' && classes.pendingDelete
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
const progressClasses = classNames(classes.progress, loaded && classes.hideProgress);
|
|
219
|
+
|
|
220
|
+
return [
|
|
221
|
+
<span key={'sp1'}> </span>,
|
|
222
|
+
<div key={'comp'} onFocus={onFocus} className={className}>
|
|
223
|
+
<LinearProgress
|
|
224
|
+
mode="determinate"
|
|
225
|
+
value={percent > 0 ? percent : 0}
|
|
226
|
+
className={progressClasses}
|
|
227
|
+
/>
|
|
228
|
+
<div className={classes.imageContainer}>
|
|
229
|
+
<img
|
|
230
|
+
{...attributes}
|
|
231
|
+
className={classNames(classes.image, active && classes.active)}
|
|
232
|
+
ref={ref => {
|
|
233
|
+
this.img = ref;
|
|
234
|
+
}}
|
|
235
|
+
src={src}
|
|
236
|
+
style={size}
|
|
237
|
+
onLoad={this.loadImage}
|
|
238
|
+
/>
|
|
239
|
+
<div ref={ref => {
|
|
240
|
+
this.resize = ref;
|
|
241
|
+
}} className={classNames(classes.resize, 'resize')}/>
|
|
242
|
+
</div>
|
|
243
|
+
</div>,
|
|
244
|
+
<span key={'sp2'}> </span>
|
|
245
|
+
];
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
const styles = theme => ({
|
|
250
|
+
portal: {
|
|
251
|
+
position: 'absolute',
|
|
252
|
+
opacity: 0,
|
|
253
|
+
transition: 'opacity 200ms linear'
|
|
254
|
+
},
|
|
255
|
+
floatingButtonRow: {
|
|
256
|
+
backgroundColor: 'white',
|
|
257
|
+
borderRadius: '1px',
|
|
258
|
+
display: 'flex',
|
|
259
|
+
padding: '10px',
|
|
260
|
+
border: 'solid 1px #eeeeee',
|
|
261
|
+
boxShadow:
|
|
262
|
+
'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)'
|
|
263
|
+
},
|
|
264
|
+
progress: {
|
|
265
|
+
position: 'absolute',
|
|
266
|
+
left: '0',
|
|
267
|
+
width: '100%',
|
|
268
|
+
top: '0%',
|
|
269
|
+
transition: 'opacity 200ms linear'
|
|
270
|
+
},
|
|
271
|
+
hideProgress: {
|
|
272
|
+
opacity: 0
|
|
273
|
+
},
|
|
274
|
+
loading: {
|
|
275
|
+
opacity: 0.3
|
|
276
|
+
},
|
|
277
|
+
pendingDelete: {
|
|
278
|
+
opacity: 0.3
|
|
279
|
+
},
|
|
280
|
+
root: {
|
|
281
|
+
position: 'relative',
|
|
282
|
+
border: 'solid 1px white',
|
|
283
|
+
display: 'inline-block',
|
|
284
|
+
transition: 'opacity 200ms linear'
|
|
285
|
+
},
|
|
286
|
+
delete: {
|
|
287
|
+
position: 'absolute',
|
|
288
|
+
right: 0
|
|
289
|
+
},
|
|
290
|
+
imageContainer: {
|
|
291
|
+
position: 'relative',
|
|
292
|
+
width: 'fit-content',
|
|
293
|
+
display: 'flex',
|
|
294
|
+
alignItems: 'center',
|
|
295
|
+
|
|
296
|
+
'&&:hover > .resize': {
|
|
297
|
+
display: 'block'
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
active: {
|
|
301
|
+
border: `solid 1px ${theme.palette.primary.main}`
|
|
302
|
+
},
|
|
303
|
+
resize: {
|
|
304
|
+
backgroundColor: theme.palette.primary.main,
|
|
305
|
+
cursor: 'col-resize',
|
|
306
|
+
height: '35px',
|
|
307
|
+
width: '5px',
|
|
308
|
+
borderRadius: 8,
|
|
309
|
+
marginLeft: '5px',
|
|
310
|
+
marginRight: '10px',
|
|
311
|
+
display: 'none'
|
|
312
|
+
},
|
|
313
|
+
drawableHeight: {
|
|
314
|
+
minHeight: 350,
|
|
315
|
+
},
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
export default withStyles(styles)(Component);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import debug from 'debug';
|
|
4
|
+
import { withStyles } from '@material-ui/core/styles';
|
|
5
|
+
|
|
6
|
+
const log = debug('@pie-lib:editable-html:plugins:image:image-toolbar');
|
|
7
|
+
|
|
8
|
+
export class ImageToolbar extends React.Component {
|
|
9
|
+
static propTypes = {
|
|
10
|
+
onChange: PropTypes.func.isRequired,
|
|
11
|
+
classes: PropTypes.object.isRequired
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
render() {
|
|
15
|
+
// Don't remove toolbar since we will have other new buttons
|
|
16
|
+
const { classes } = this.props;
|
|
17
|
+
return (
|
|
18
|
+
<div className={classes.holder}>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const styles = theme => ({
|
|
25
|
+
holder: {
|
|
26
|
+
paddingLeft: theme.spacing.unit,
|
|
27
|
+
display: 'flex',
|
|
28
|
+
alignItems: 'center'
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export default withStyles(styles)(ImageToolbar);
|
|
@@ -0,0 +1,182 @@
|
|
|
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 percent = node.data.get('resizePercent');
|
|
33
|
+
|
|
34
|
+
const onChange = resizePercent => {
|
|
35
|
+
const update = {
|
|
36
|
+
...node.data.toObject(),
|
|
37
|
+
resizePercent
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const change = value.change().setNodeByKey(node.key, { data: update });
|
|
41
|
+
onToolbarDone(change, false);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const Tb = () => <ImageToolbar percent={percent || 100} onChange={onChange} />;
|
|
45
|
+
return Tb;
|
|
46
|
+
},
|
|
47
|
+
showDone: true
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
name: 'image',
|
|
52
|
+
toolbar,
|
|
53
|
+
deleteNode: (e, node, value, onChange) => {
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
if (opts.onDelete) {
|
|
56
|
+
const update = node.data.merge(Data.create({ deleteStatus: 'pending' }));
|
|
57
|
+
|
|
58
|
+
let change = value.change().setNodeByKey(node.key, { data: update });
|
|
59
|
+
|
|
60
|
+
onChange(change);
|
|
61
|
+
opts.onDelete(node.data.get('src'), (err, v) => {
|
|
62
|
+
if (!err) {
|
|
63
|
+
change = v.change().removeNodeByKey(node.key);
|
|
64
|
+
} else {
|
|
65
|
+
log('[error]: ', err);
|
|
66
|
+
change = v
|
|
67
|
+
.change()
|
|
68
|
+
.setNodeByKey(node.key, node.data.merge(Data.create({ deleteStatus: 'failed' })));
|
|
69
|
+
}
|
|
70
|
+
onChange(change);
|
|
71
|
+
});
|
|
72
|
+
} else {
|
|
73
|
+
let change = value.change().removeNodeByKey(node.key);
|
|
74
|
+
onChange(change);
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
stopReset: value => {
|
|
78
|
+
const imgPendingInsertion = value.document.findDescendant(n => {
|
|
79
|
+
if (n.type !== 'image') {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
return n.data.get('loaded') === false;
|
|
83
|
+
});
|
|
84
|
+
/** don't reset if there is an image pending insertion */
|
|
85
|
+
return imgPendingInsertion !== undefined && imgPendingInsertion !== null;
|
|
86
|
+
},
|
|
87
|
+
renderNode(props) {
|
|
88
|
+
if (props.node.type === 'image') {
|
|
89
|
+
const all = Object.assign(
|
|
90
|
+
{
|
|
91
|
+
onDelete: opts.onDelete,
|
|
92
|
+
onFocus: opts.onFocus,
|
|
93
|
+
onBlur: opts.onBlur,
|
|
94
|
+
maxImageWidth: opts.maxImageWidth,
|
|
95
|
+
maxImageHeight: opts.maxImageHeight,
|
|
96
|
+
},
|
|
97
|
+
props
|
|
98
|
+
);
|
|
99
|
+
return <ImageComponent {...all} />;
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
normalizeNode: node => {
|
|
103
|
+
const textNodeMap = {};
|
|
104
|
+
const updateNodesArray = [];
|
|
105
|
+
let index = 0;
|
|
106
|
+
|
|
107
|
+
if (node.object !== 'document') return;
|
|
108
|
+
|
|
109
|
+
node.findDescendant(d => {
|
|
110
|
+
if (d.object === 'text') {
|
|
111
|
+
textNodeMap[index] = d;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (d.type === 'image') {
|
|
115
|
+
if (index > 0 && textNodeMap[index - 1] && textNodeMap[index - 1].text === '') {
|
|
116
|
+
updateNodesArray.push(textNodeMap[index - 1]);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
index++;
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
if (!updateNodesArray.length) return;
|
|
124
|
+
|
|
125
|
+
return change => {
|
|
126
|
+
change.withoutNormalization(() => {
|
|
127
|
+
updateNodesArray.forEach(n => change.insertTextByKey(n.key, 0, ' '));
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export const serialization = {
|
|
135
|
+
deserialize(el /*, next*/) {
|
|
136
|
+
const name = el.tagName.toLowerCase();
|
|
137
|
+
if (name !== 'img') return;
|
|
138
|
+
|
|
139
|
+
log('deserialize: ', name);
|
|
140
|
+
const style = el.style || { width: '', height: '' };
|
|
141
|
+
const width = parseInt(style.width.replace('px', ''), 10) || null;
|
|
142
|
+
const height = parseInt(style.height.replace('px', ''), 10) || null;
|
|
143
|
+
|
|
144
|
+
const out = {
|
|
145
|
+
object: 'inline',
|
|
146
|
+
type: 'image',
|
|
147
|
+
isVoid: true,
|
|
148
|
+
data: {
|
|
149
|
+
src: el.getAttribute('src'),
|
|
150
|
+
width,
|
|
151
|
+
height
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
log('return object: ', out);
|
|
155
|
+
return out;
|
|
156
|
+
},
|
|
157
|
+
serialize(object /*, children*/) {
|
|
158
|
+
if (object.type !== 'image') return;
|
|
159
|
+
|
|
160
|
+
const { data } = object;
|
|
161
|
+
const src = data.get('src');
|
|
162
|
+
const width = data.get('width');
|
|
163
|
+
const height = data.get('height');
|
|
164
|
+
const style = {};
|
|
165
|
+
if (width) {
|
|
166
|
+
style.width = `${width}px`;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (height) {
|
|
170
|
+
style.height = `${height}px`;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
style.objectFit = 'contain';
|
|
174
|
+
|
|
175
|
+
const props = {
|
|
176
|
+
src,
|
|
177
|
+
style
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
return <img {...props} />;
|
|
181
|
+
}
|
|
182
|
+
};
|
package/configure/node_modules/@pie-lib/editable-html/src/plugins/image/insert-image-handler.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Data } from 'slate';
|
|
2
|
+
import debug from 'debug';
|
|
3
|
+
|
|
4
|
+
const log = debug('@pie-lib:editable-html:image:insert-image-handler');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Handles user selection, insertion (or cancellation) of an image into the editor.
|
|
8
|
+
* @param {Block} placeholderBlock - a block that has been added to the editor as a place holder for the image
|
|
9
|
+
* @param {Function} getValue - a function to return the value of the editor
|
|
10
|
+
* @param {Function} onChange - callback to notify changes applied by the handler
|
|
11
|
+
*/
|
|
12
|
+
class InsertImageHandler {
|
|
13
|
+
constructor(placeholderBlock, getValue, onChange) {
|
|
14
|
+
this.placeholderBlock = placeholderBlock;
|
|
15
|
+
this.getValue = getValue;
|
|
16
|
+
this.onChange = onChange;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
getPlaceholderInDocument(value) {
|
|
20
|
+
const { document } = value;
|
|
21
|
+
const directChild = document.getChild(this.placeholderBlock.key);
|
|
22
|
+
|
|
23
|
+
if (directChild) {
|
|
24
|
+
return directChild;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const child = document.getDescendant(this.placeholderBlock.key);
|
|
28
|
+
|
|
29
|
+
if (child) {
|
|
30
|
+
return child;
|
|
31
|
+
} else {
|
|
32
|
+
//eslint-disable-next-line
|
|
33
|
+
throw new Error("insert-image: Can't find placeholder!");
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
cancel() {
|
|
38
|
+
log('insert cancelled');
|
|
39
|
+
const c = this.getValue()
|
|
40
|
+
.change()
|
|
41
|
+
.removeNodeByKey(this.placeholderBlock.key);
|
|
42
|
+
this.onChange(c);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
done(err, src) {
|
|
46
|
+
log('done: err:', err);
|
|
47
|
+
if (err) {
|
|
48
|
+
//eslint-disable-next-line
|
|
49
|
+
console.log(err);
|
|
50
|
+
} else {
|
|
51
|
+
const value = this.getValue();
|
|
52
|
+
const child = this.getPlaceholderInDocument(value);
|
|
53
|
+
const data = child.data.merge(Data.create({ loaded: true, src, percent: 100 }));
|
|
54
|
+
|
|
55
|
+
const change = value.change().setNodeByKey(this.placeholderBlock.key, { data });
|
|
56
|
+
this.onChange(change);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Notify handler that the user chose a file - will create a change with a preview in the editor.
|
|
62
|
+
*
|
|
63
|
+
* @param {File} file - the file that the user chose using a file input.
|
|
64
|
+
*/
|
|
65
|
+
fileChosen(file) {
|
|
66
|
+
if (!file) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
log('[fileChosen] file: ', file);
|
|
71
|
+
const reader = new FileReader();
|
|
72
|
+
reader.onload = () => {
|
|
73
|
+
const value = this.getValue();
|
|
74
|
+
const dataURL = reader.result;
|
|
75
|
+
const child = this.getPlaceholderInDocument(value);
|
|
76
|
+
const data = child.data.set('src', dataURL);
|
|
77
|
+
const change = value.change().setNodeByKey(this.placeholderBlock.key, { data });
|
|
78
|
+
this.onChange(change);
|
|
79
|
+
};
|
|
80
|
+
reader.readAsDataURL(file);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
progress(percent, bytes, total) {
|
|
84
|
+
log('progress: ', percent, bytes, total);
|
|
85
|
+
const value = this.getValue();
|
|
86
|
+
const child = this.getPlaceholderInDocument(value);
|
|
87
|
+
const data = child.data.set('percent', percent);
|
|
88
|
+
const change = value.change().setNodeByKey(this.placeholderBlock.key, { data });
|
|
89
|
+
this.onChange(change);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export default InsertImageHandler;
|