@pie-element/ebsr 6.6.3-next.1097 → 6.6.3-next.1137

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (239) hide show
  1. package/configure/node_modules/@pie-lib/config-ui/CHANGELOG.json +1677 -0
  2. package/configure/node_modules/@pie-lib/config-ui/CHANGELOG.md +1743 -0
  3. package/configure/node_modules/@pie-lib/config-ui/LICENSE.md +5 -0
  4. package/configure/node_modules/@pie-lib/config-ui/README.md +12 -0
  5. package/configure/node_modules/@pie-lib/config-ui/lib/alert-dialog.js +44 -0
  6. package/configure/node_modules/@pie-lib/config-ui/lib/alert-dialog.js.map +1 -0
  7. package/configure/node_modules/@pie-lib/config-ui/lib/checkbox.js +86 -0
  8. package/configure/node_modules/@pie-lib/config-ui/lib/checkbox.js.map +1 -0
  9. package/configure/node_modules/@pie-lib/config-ui/lib/choice-configuration/feedback-menu.js +164 -0
  10. package/configure/node_modules/@pie-lib/config-ui/lib/choice-configuration/feedback-menu.js.map +1 -0
  11. package/configure/node_modules/@pie-lib/config-ui/lib/choice-configuration/index.js +398 -0
  12. package/configure/node_modules/@pie-lib/config-ui/lib/choice-configuration/index.js.map +1 -0
  13. package/configure/node_modules/@pie-lib/config-ui/lib/choice-utils.js +54 -0
  14. package/configure/node_modules/@pie-lib/config-ui/lib/choice-utils.js.map +1 -0
  15. package/configure/node_modules/@pie-lib/config-ui/lib/feedback-config/feedback-selector.js +185 -0
  16. package/configure/node_modules/@pie-lib/config-ui/lib/feedback-config/feedback-selector.js.map +1 -0
  17. package/configure/node_modules/@pie-lib/config-ui/lib/feedback-config/group.js +75 -0
  18. package/configure/node_modules/@pie-lib/config-ui/lib/feedback-config/group.js.map +1 -0
  19. package/configure/node_modules/@pie-lib/config-ui/lib/feedback-config/index.js +178 -0
  20. package/configure/node_modules/@pie-lib/config-ui/lib/feedback-config/index.js.map +1 -0
  21. package/configure/node_modules/@pie-lib/config-ui/lib/form-section.js +46 -0
  22. package/configure/node_modules/@pie-lib/config-ui/lib/form-section.js.map +1 -0
  23. package/configure/node_modules/@pie-lib/config-ui/lib/help.js +145 -0
  24. package/configure/node_modules/@pie-lib/config-ui/lib/help.js.map +1 -0
  25. package/configure/node_modules/@pie-lib/config-ui/lib/index.js +216 -0
  26. package/configure/node_modules/@pie-lib/config-ui/lib/index.js.map +1 -0
  27. package/configure/node_modules/@pie-lib/config-ui/lib/input.js +139 -0
  28. package/configure/node_modules/@pie-lib/config-ui/lib/input.js.map +1 -0
  29. package/configure/node_modules/@pie-lib/config-ui/lib/inputs.js +131 -0
  30. package/configure/node_modules/@pie-lib/config-ui/lib/inputs.js.map +1 -0
  31. package/configure/node_modules/@pie-lib/config-ui/lib/langs.js +179 -0
  32. package/configure/node_modules/@pie-lib/config-ui/lib/langs.js.map +1 -0
  33. package/configure/node_modules/@pie-lib/config-ui/lib/layout/config-layout.js +101 -0
  34. package/configure/node_modules/@pie-lib/config-ui/lib/layout/config-layout.js.map +1 -0
  35. package/configure/node_modules/@pie-lib/config-ui/lib/layout/index.js +24 -0
  36. package/configure/node_modules/@pie-lib/config-ui/lib/layout/index.js.map +1 -0
  37. package/configure/node_modules/@pie-lib/config-ui/lib/layout/layout-contents.js +105 -0
  38. package/configure/node_modules/@pie-lib/config-ui/lib/layout/layout-contents.js.map +1 -0
  39. package/configure/node_modules/@pie-lib/config-ui/lib/layout/settings-box.js +87 -0
  40. package/configure/node_modules/@pie-lib/config-ui/lib/layout/settings-box.js.map +1 -0
  41. package/configure/node_modules/@pie-lib/config-ui/lib/mui-box/index.js +79 -0
  42. package/configure/node_modules/@pie-lib/config-ui/lib/mui-box/index.js.map +1 -0
  43. package/configure/node_modules/@pie-lib/config-ui/lib/number-text-field-custom.js +364 -0
  44. package/configure/node_modules/@pie-lib/config-ui/lib/number-text-field-custom.js.map +1 -0
  45. package/configure/node_modules/@pie-lib/config-ui/lib/number-text-field.js +265 -0
  46. package/configure/node_modules/@pie-lib/config-ui/lib/number-text-field.js.map +1 -0
  47. package/configure/node_modules/@pie-lib/config-ui/lib/radio-with-label.js +41 -0
  48. package/configure/node_modules/@pie-lib/config-ui/lib/radio-with-label.js.map +1 -0
  49. package/configure/node_modules/@pie-lib/config-ui/lib/settings/display-size.js +77 -0
  50. package/configure/node_modules/@pie-lib/config-ui/lib/settings/display-size.js.map +1 -0
  51. package/configure/node_modules/@pie-lib/config-ui/lib/settings/index.js +130 -0
  52. package/configure/node_modules/@pie-lib/config-ui/lib/settings/index.js.map +1 -0
  53. package/configure/node_modules/@pie-lib/config-ui/lib/settings/panel.js +412 -0
  54. package/configure/node_modules/@pie-lib/config-ui/lib/settings/panel.js.map +1 -0
  55. package/configure/node_modules/@pie-lib/config-ui/lib/settings/settings-radio-label.js +43 -0
  56. package/configure/node_modules/@pie-lib/config-ui/lib/settings/settings-radio-label.js.map +1 -0
  57. package/configure/node_modules/@pie-lib/config-ui/lib/settings/toggle.js +56 -0
  58. package/configure/node_modules/@pie-lib/config-ui/lib/settings/toggle.js.map +1 -0
  59. package/configure/node_modules/@pie-lib/config-ui/lib/tabs/index.js +106 -0
  60. package/configure/node_modules/@pie-lib/config-ui/lib/tabs/index.js.map +1 -0
  61. package/configure/node_modules/@pie-lib/config-ui/lib/tags-input/index.js +198 -0
  62. package/configure/node_modules/@pie-lib/config-ui/lib/tags-input/index.js.map +1 -0
  63. package/configure/node_modules/@pie-lib/config-ui/lib/two-choice.js +180 -0
  64. package/configure/node_modules/@pie-lib/config-ui/lib/two-choice.js.map +1 -0
  65. package/configure/node_modules/@pie-lib/config-ui/lib/with-stateful-model.js +84 -0
  66. package/configure/node_modules/@pie-lib/config-ui/lib/with-stateful-model.js.map +1 -0
  67. package/configure/node_modules/@pie-lib/config-ui/package.json +30 -0
  68. package/configure/node_modules/@pie-lib/config-ui/src/alert-dialog.jsx +43 -0
  69. package/configure/node_modules/@pie-lib/config-ui/src/checkbox.jsx +63 -0
  70. package/configure/node_modules/@pie-lib/config-ui/src/choice-configuration/feedback-menu.jsx +103 -0
  71. package/configure/node_modules/@pie-lib/config-ui/src/choice-configuration/index.jsx +319 -0
  72. package/configure/node_modules/@pie-lib/config-ui/src/choice-utils.js +30 -0
  73. package/configure/node_modules/@pie-lib/config-ui/src/feedback-config/feedback-selector.jsx +116 -0
  74. package/configure/node_modules/@pie-lib/config-ui/src/feedback-config/group.jsx +54 -0
  75. package/configure/node_modules/@pie-lib/config-ui/src/feedback-config/index.jsx +98 -0
  76. package/configure/node_modules/@pie-lib/config-ui/src/form-section.jsx +23 -0
  77. package/configure/node_modules/@pie-lib/config-ui/src/help.jsx +88 -0
  78. package/configure/node_modules/@pie-lib/config-ui/src/index.js +58 -0
  79. package/configure/node_modules/@pie-lib/config-ui/src/input.jsx +72 -0
  80. package/configure/node_modules/@pie-lib/config-ui/src/inputs.jsx +96 -0
  81. package/configure/node_modules/@pie-lib/config-ui/src/langs.jsx +122 -0
  82. package/configure/node_modules/@pie-lib/config-ui/src/layout/config-layout.jsx +64 -0
  83. package/configure/node_modules/@pie-lib/config-ui/src/layout/index.js +4 -0
  84. package/configure/node_modules/@pie-lib/config-ui/src/layout/layout-contents.jsx +60 -0
  85. package/configure/node_modules/@pie-lib/config-ui/src/layout/settings-box.jsx +31 -0
  86. package/configure/node_modules/@pie-lib/config-ui/src/mui-box/index.jsx +64 -0
  87. package/configure/node_modules/@pie-lib/config-ui/src/number-text-field-custom.jsx +276 -0
  88. package/configure/node_modules/@pie-lib/config-ui/src/number-text-field.jsx +196 -0
  89. package/configure/node_modules/@pie-lib/config-ui/src/radio-with-label.jsx +18 -0
  90. package/configure/node_modules/@pie-lib/config-ui/src/settings/display-size.jsx +52 -0
  91. package/configure/node_modules/@pie-lib/config-ui/src/settings/index.js +75 -0
  92. package/configure/node_modules/@pie-lib/config-ui/src/settings/panel.jsx +297 -0
  93. package/configure/node_modules/@pie-lib/config-ui/src/settings/settings-radio-label.jsx +20 -0
  94. package/configure/node_modules/@pie-lib/config-ui/src/settings/toggle.jsx +31 -0
  95. package/configure/node_modules/@pie-lib/config-ui/src/tabs/index.jsx +51 -0
  96. package/configure/node_modules/@pie-lib/config-ui/src/tags-input/index.jsx +121 -0
  97. package/configure/node_modules/@pie-lib/config-ui/src/two-choice.jsx +94 -0
  98. package/configure/node_modules/@pie-lib/config-ui/src/with-stateful-model.jsx +36 -0
  99. package/configure/node_modules/@pie-lib/editable-html/CHANGELOG.json +3327 -0
  100. package/configure/node_modules/@pie-lib/editable-html/CHANGELOG.md +1759 -0
  101. package/configure/node_modules/@pie-lib/editable-html/LICENSE.md +5 -0
  102. package/configure/node_modules/@pie-lib/editable-html/README.md +45 -0
  103. package/configure/node_modules/@pie-lib/editable-html/deploy.sh +16 -0
  104. package/configure/node_modules/@pie-lib/editable-html/lib/editor.js +893 -0
  105. package/configure/node_modules/@pie-lib/editable-html/lib/editor.js.map +1 -0
  106. package/configure/node_modules/@pie-lib/editable-html/lib/index.js +226 -0
  107. package/configure/node_modules/@pie-lib/editable-html/lib/index.js.map +1 -0
  108. package/configure/node_modules/@pie-lib/editable-html/lib/parse-html.js +16 -0
  109. package/configure/node_modules/@pie-lib/editable-html/lib/parse-html.js.map +1 -0
  110. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/characters/custom-popover.js +70 -0
  111. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/characters/custom-popover.js.map +1 -0
  112. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/characters/index.js +266 -0
  113. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/characters/index.js.map +1 -0
  114. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/characters/utils.js +382 -0
  115. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/characters/utils.js.map +1 -0
  116. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/alt-dialog.js +119 -0
  117. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/alt-dialog.js.map +1 -0
  118. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/component.js +424 -0
  119. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/component.js.map +1 -0
  120. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/image-toolbar.js +175 -0
  121. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/image-toolbar.js.map +1 -0
  122. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/index.js +261 -0
  123. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/index.js.map +1 -0
  124. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/insert-image-handler.js +135 -0
  125. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/image/insert-image-handler.js.map +1 -0
  126. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/index.js +141 -0
  127. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/index.js.map +1 -0
  128. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/list/index.js +204 -0
  129. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/list/index.js.map +1 -0
  130. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/math/index.js +347 -0
  131. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/math/index.js.map +1 -0
  132. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/media/index.js +339 -0
  133. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/media/index.js.map +1 -0
  134. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/media/media-dialog.js +434 -0
  135. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/media/media-dialog.js.map +1 -0
  136. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/media/media-toolbar.js +99 -0
  137. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/media/media-toolbar.js.map +1 -0
  138. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/media/media-wrapper.js +93 -0
  139. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/media/media-wrapper.js.map +1 -0
  140. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/drag-in-the-blank/choice.js +251 -0
  141. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/drag-in-the-blank/choice.js.map +1 -0
  142. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/drag-in-the-blank/index.js +97 -0
  143. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/drag-in-the-blank/index.js.map +1 -0
  144. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/explicit-constructed-response/index.js +54 -0
  145. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/explicit-constructed-response/index.js.map +1 -0
  146. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/icons/index.js +93 -0
  147. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/icons/index.js.map +1 -0
  148. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/index.js +293 -0
  149. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/index.js.map +1 -0
  150. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/inline-dropdown/index.js +70 -0
  151. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/inline-dropdown/index.js.map +1 -0
  152. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/utils.js +110 -0
  153. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/respArea/utils.js.map +1 -0
  154. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/table/icons/index.js +69 -0
  155. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/table/icons/index.js.map +1 -0
  156. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/table/index.js +499 -0
  157. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/table/index.js.map +1 -0
  158. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/table/table-toolbar.js +158 -0
  159. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/table/table-toolbar.js.map +1 -0
  160. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/default-toolbar.js +132 -0
  161. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/default-toolbar.js.map +1 -0
  162. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/done-button.js +50 -0
  163. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/done-button.js.map +1 -0
  164. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/editor-and-toolbar.js +263 -0
  165. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/editor-and-toolbar.js.map +1 -0
  166. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/index.js +32 -0
  167. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/index.js.map +1 -0
  168. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/toolbar-buttons.js +161 -0
  169. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/toolbar-buttons.js.map +1 -0
  170. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/toolbar.js +346 -0
  171. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/toolbar/toolbar.js.map +1 -0
  172. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/utils.js +62 -0
  173. package/configure/node_modules/@pie-lib/editable-html/lib/plugins/utils.js.map +1 -0
  174. package/configure/node_modules/@pie-lib/editable-html/lib/serialization.js +428 -0
  175. package/configure/node_modules/@pie-lib/editable-html/lib/serialization.js.map +1 -0
  176. package/configure/node_modules/@pie-lib/editable-html/lib/theme.js +9 -0
  177. package/configure/node_modules/@pie-lib/editable-html/lib/theme.js.map +1 -0
  178. package/configure/node_modules/@pie-lib/editable-html/package.json +52 -0
  179. package/configure/node_modules/@pie-lib/editable-html/playground/image/data.js +59 -0
  180. package/configure/node_modules/@pie-lib/editable-html/playground/image/index.html +24 -0
  181. package/configure/node_modules/@pie-lib/editable-html/playground/image/index.jsx +83 -0
  182. package/configure/node_modules/@pie-lib/editable-html/playground/index.html +27 -0
  183. package/configure/node_modules/@pie-lib/editable-html/playground/mathquill/index.html +25 -0
  184. package/configure/node_modules/@pie-lib/editable-html/playground/mathquill/index.jsx +151 -0
  185. package/configure/node_modules/@pie-lib/editable-html/playground/package.json +15 -0
  186. package/configure/node_modules/@pie-lib/editable-html/playground/prod-test/index.html +26 -0
  187. package/configure/node_modules/@pie-lib/editable-html/playground/prod-test/index.jsx +30 -0
  188. package/configure/node_modules/@pie-lib/editable-html/playground/schema-override/data.js +29 -0
  189. package/configure/node_modules/@pie-lib/editable-html/playground/schema-override/image-plugin.jsx +40 -0
  190. package/configure/node_modules/@pie-lib/editable-html/playground/schema-override/index.html +23 -0
  191. package/configure/node_modules/@pie-lib/editable-html/playground/schema-override/index.jsx +96 -0
  192. package/configure/node_modules/@pie-lib/editable-html/playground/serialization/data.js +29 -0
  193. package/configure/node_modules/@pie-lib/editable-html/playground/serialization/image-plugin.jsx +40 -0
  194. package/configure/node_modules/@pie-lib/editable-html/playground/serialization/index.html +24 -0
  195. package/configure/node_modules/@pie-lib/editable-html/playground/serialization/index.jsx +12 -0
  196. package/configure/node_modules/@pie-lib/editable-html/playground/static.json +3 -0
  197. package/configure/node_modules/@pie-lib/editable-html/playground/table-examples.html +67 -0
  198. package/configure/node_modules/@pie-lib/editable-html/playground/webpack.config.js +42 -0
  199. package/configure/node_modules/@pie-lib/editable-html/src/editor.jsx +749 -0
  200. package/configure/node_modules/@pie-lib/editable-html/src/index.jsx +145 -0
  201. package/configure/node_modules/@pie-lib/editable-html/src/parse-html.js +8 -0
  202. package/configure/node_modules/@pie-lib/editable-html/src/plugins/README.md +27 -0
  203. package/configure/node_modules/@pie-lib/editable-html/src/plugins/characters/custom-popover.js +45 -0
  204. package/configure/node_modules/@pie-lib/editable-html/src/plugins/characters/index.jsx +244 -0
  205. package/configure/node_modules/@pie-lib/editable-html/src/plugins/characters/utils.js +448 -0
  206. package/configure/node_modules/@pie-lib/editable-html/src/plugins/image/alt-dialog.jsx +69 -0
  207. package/configure/node_modules/@pie-lib/editable-html/src/plugins/image/component.jsx +349 -0
  208. package/configure/node_modules/@pie-lib/editable-html/src/plugins/image/image-toolbar.jsx +108 -0
  209. package/configure/node_modules/@pie-lib/editable-html/src/plugins/image/index.jsx +218 -0
  210. package/configure/node_modules/@pie-lib/editable-html/src/plugins/image/insert-image-handler.js +93 -0
  211. package/configure/node_modules/@pie-lib/editable-html/src/plugins/index.jsx +115 -0
  212. package/configure/node_modules/@pie-lib/editable-html/src/plugins/list/index.jsx +175 -0
  213. package/configure/node_modules/@pie-lib/editable-html/src/plugins/math/index.jsx +283 -0
  214. package/configure/node_modules/@pie-lib/editable-html/src/plugins/media/index.jsx +284 -0
  215. package/configure/node_modules/@pie-lib/editable-html/src/plugins/media/media-dialog.js +372 -0
  216. package/configure/node_modules/@pie-lib/editable-html/src/plugins/media/media-toolbar.jsx +53 -0
  217. package/configure/node_modules/@pie-lib/editable-html/src/plugins/media/media-wrapper.jsx +43 -0
  218. package/configure/node_modules/@pie-lib/editable-html/src/plugins/respArea/drag-in-the-blank/choice.jsx +187 -0
  219. package/configure/node_modules/@pie-lib/editable-html/src/plugins/respArea/drag-in-the-blank/index.jsx +78 -0
  220. package/configure/node_modules/@pie-lib/editable-html/src/plugins/respArea/explicit-constructed-response/index.jsx +45 -0
  221. package/configure/node_modules/@pie-lib/editable-html/src/plugins/respArea/icons/index.jsx +68 -0
  222. package/configure/node_modules/@pie-lib/editable-html/src/plugins/respArea/index.jsx +263 -0
  223. package/configure/node_modules/@pie-lib/editable-html/src/plugins/respArea/inline-dropdown/index.jsx +63 -0
  224. package/configure/node_modules/@pie-lib/editable-html/src/plugins/respArea/utils.jsx +77 -0
  225. package/configure/node_modules/@pie-lib/editable-html/src/plugins/table/icons/index.jsx +59 -0
  226. package/configure/node_modules/@pie-lib/editable-html/src/plugins/table/index.jsx +439 -0
  227. package/configure/node_modules/@pie-lib/editable-html/src/plugins/table/table-toolbar.jsx +104 -0
  228. package/configure/node_modules/@pie-lib/editable-html/src/plugins/toolbar/default-toolbar.jsx +111 -0
  229. package/configure/node_modules/@pie-lib/editable-html/src/plugins/toolbar/done-button.jsx +36 -0
  230. package/configure/node_modules/@pie-lib/editable-html/src/plugins/toolbar/editor-and-toolbar.jsx +225 -0
  231. package/configure/node_modules/@pie-lib/editable-html/src/plugins/toolbar/index.jsx +21 -0
  232. package/configure/node_modules/@pie-lib/editable-html/src/plugins/toolbar/toolbar-buttons.jsx +97 -0
  233. package/configure/node_modules/@pie-lib/editable-html/src/plugins/toolbar/toolbar.jsx +323 -0
  234. package/configure/node_modules/@pie-lib/editable-html/src/plugins/utils.js +32 -0
  235. package/configure/node_modules/@pie-lib/editable-html/src/serialization.jsx +385 -0
  236. package/configure/node_modules/@pie-lib/editable-html/src/theme.js +1 -0
  237. package/configure/node_modules/@pie-lib/editable-html/static.json +1 -0
  238. package/configure/package.json +1 -1
  239. package/package.json +3 -3
@@ -0,0 +1,893 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ Object.defineProperty(exports, "ALL_PLUGINS", {
11
+ enumerable: true,
12
+ get: function get() {
13
+ return _plugins.ALL_PLUGINS;
14
+ }
15
+ });
16
+ Object.defineProperty(exports, "DEFAULT_PLUGINS", {
17
+ enumerable: true,
18
+ get: function get() {
19
+ return _plugins.DEFAULT_PLUGINS;
20
+ }
21
+ });
22
+ exports.serialization = exports["default"] = exports.Editor = void 0;
23
+
24
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
25
+
26
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
27
+
28
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
29
+
30
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
31
+
32
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
33
+
34
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
35
+
36
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
37
+
38
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
39
+
40
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
41
+
42
+ var _slateReact = require("slate-react");
43
+
44
+ var _slatePropTypes = _interopRequireDefault(require("slate-prop-types"));
45
+
46
+ var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
47
+
48
+ var serialization = _interopRequireWildcard(require("./serialization"));
49
+
50
+ exports.serialization = serialization;
51
+
52
+ var _propTypes = _interopRequireDefault(require("prop-types"));
53
+
54
+ var _react = _interopRequireDefault(require("react"));
55
+
56
+ var _slate = require("slate");
57
+
58
+ var _plugins = require("./plugins");
59
+
60
+ var _debug = _interopRequireDefault(require("debug"));
61
+
62
+ var _styles = require("@material-ui/core/styles");
63
+
64
+ var _classnames = _interopRequireDefault(require("classnames"));
65
+
66
+ var _renderUi = require("@pie-lib/render-ui");
67
+
68
+ var _slatePlainSerializer = _interopRequireDefault(require("slate-plain-serializer"));
69
+
70
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
71
+
72
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
73
+
74
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
75
+
76
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
77
+
78
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
79
+
80
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
81
+
82
+ var log = (0, _debug["default"])('editable-html:editor');
83
+ var defaultToolbarOpts = {
84
+ position: 'bottom',
85
+ alignment: 'left',
86
+ alwaysVisible: false,
87
+ showDone: true,
88
+ doneOn: 'blur'
89
+ };
90
+ var defaultResponseAreaProps = {
91
+ options: {},
92
+ respAreaToolbar: function respAreaToolbar() {},
93
+ onHandleAreaChange: function onHandleAreaChange() {}
94
+ };
95
+ var defaultLanguageCharactersProps = [];
96
+
97
+ var createToolbarOpts = function createToolbarOpts(toolbarOpts) {
98
+ return _objectSpread(_objectSpread({}, defaultToolbarOpts), toolbarOpts);
99
+ };
100
+
101
+ var Editor = /*#__PURE__*/function (_React$Component) {
102
+ (0, _inherits2["default"])(Editor, _React$Component);
103
+
104
+ var _super = _createSuper(Editor);
105
+
106
+ function Editor(_props) {
107
+ var _this;
108
+
109
+ (0, _classCallCheck2["default"])(this, Editor);
110
+ _this = _super.call(this, _props);
111
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handlePlugins", function (props) {
112
+ var normalizedResponseAreaProps = _objectSpread(_objectSpread({}, defaultResponseAreaProps), props.responseAreaProps);
113
+
114
+ _this.plugins = (0, _plugins.buildPlugins)(props.activePlugins, {
115
+ math: {
116
+ onClick: _this.onMathClick,
117
+ onFocus: _this.onPluginFocus,
118
+ onBlur: _this.onPluginBlur
119
+ },
120
+ image: {
121
+ onDelete: props.imageSupport && props.imageSupport["delete"] && function (src, done) {
122
+ props.imageSupport["delete"](src, function (e) {
123
+ done(e, _this.state.value);
124
+ });
125
+ },
126
+ insertImageRequested: props.imageSupport && function (getHandler) {
127
+ /**
128
+ * The handler is the object through which the outer context
129
+ * communicates file upload events like: fileChosen, cancel, progress
130
+ */
131
+ var handler = getHandler(function () {
132
+ return _this.state.value;
133
+ });
134
+ props.imageSupport.add(handler);
135
+ },
136
+ onFocus: _this.onPluginFocus,
137
+ onBlur: _this.onPluginBlur,
138
+ maxImageWidth: _this.props.maxImageWidth,
139
+ maxImageHeight: _this.props.maxImageHeight
140
+ },
141
+ toolbar: {
142
+ /**
143
+ * To minimize converting html -> state -> html
144
+ * We only emit markup once 'done' is clicked.
145
+ */
146
+ disableUnderline: props.disableUnderline,
147
+ autoWidth: props.autoWidthToolbar,
148
+ onDone: function onDone() {
149
+ var _this$state$value$sta, _this$state$value$sta2;
150
+
151
+ var nonEmpty = props.nonEmpty;
152
+ log('[onDone]');
153
+
154
+ _this.setState({
155
+ toolbarInFocus: false,
156
+ focusedNode: null
157
+ });
158
+
159
+ _this.editor.blur();
160
+
161
+ if (nonEmpty && ((_this$state$value$sta = _this.state.value.startText) === null || _this$state$value$sta === void 0 ? void 0 : (_this$state$value$sta2 = _this$state$value$sta.text) === null || _this$state$value$sta2 === void 0 ? void 0 : _this$state$value$sta2.length) === 0) {
162
+ _this.resetValue(true).then(function () {
163
+ _this.onEditingDone();
164
+ });
165
+ } else {
166
+ _this.onEditingDone();
167
+ }
168
+ }
169
+ },
170
+ table: {
171
+ onFocus: function onFocus() {
172
+ log('[table:onFocus]...');
173
+
174
+ _this.onPluginFocus();
175
+ },
176
+ onBlur: function onBlur() {
177
+ log('[table:onBlur]...');
178
+
179
+ _this.onPluginBlur();
180
+ }
181
+ },
182
+ responseArea: {
183
+ type: normalizedResponseAreaProps.type,
184
+ options: normalizedResponseAreaProps.options,
185
+ maxResponseAreas: normalizedResponseAreaProps.maxResponseAreas,
186
+ respAreaToolbar: normalizedResponseAreaProps.respAreaToolbar,
187
+ onHandleAreaChange: normalizedResponseAreaProps.onHandleAreaChange,
188
+ error: normalizedResponseAreaProps.error,
189
+ onFocus: function onFocus() {
190
+ log('[table:onFocus]...');
191
+
192
+ _this.onPluginFocus();
193
+ },
194
+ onBlur: function onBlur() {
195
+ log('[table:onBlur]...');
196
+
197
+ _this.onPluginBlur();
198
+ }
199
+ },
200
+ languageCharacters: props.languageCharactersProps,
201
+ media: {
202
+ focus: _this.focus,
203
+ createChange: function createChange() {
204
+ return _this.state.value.change();
205
+ },
206
+ onChange: _this.onChange
207
+ }
208
+ });
209
+ });
210
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onPluginBlur", function (e) {
211
+ log('[onPluginBlur]', e && e.relatedTarget);
212
+ var target = e && e.relatedTarget;
213
+ var node = target ? (0, _slateReact.findNode)(target, _this.state.value) : null;
214
+ log('[onPluginBlur] node: ', node);
215
+
216
+ _this.setState({
217
+ focusedNode: node
218
+ }, function () {
219
+ _this.resetValue();
220
+ });
221
+ });
222
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onPluginFocus", function (e) {
223
+ log('[onPluginFocus]', e && e.target);
224
+ var target = e && e.target;
225
+
226
+ if (target) {
227
+ var node = (0, _slateReact.findNode)(target, _this.state.value);
228
+ log('[onPluginFocus] node: ', node);
229
+ var stashedValue = _this.state.stashedValue || _this.state.value;
230
+
231
+ _this.setState({
232
+ focusedNode: node,
233
+ stashedValue: stashedValue
234
+ });
235
+ } else {
236
+ _this.setState({
237
+ focusedNode: null
238
+ });
239
+ }
240
+
241
+ _this.stashValue();
242
+ });
243
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onMathClick", function (node) {
244
+ _this.editor.change(function (c) {
245
+ return c.collapseToStartOf(node);
246
+ });
247
+
248
+ _this.setState({
249
+ selectedNode: node
250
+ });
251
+ });
252
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onEditingDone", function () {
253
+ log('[onEditingDone]');
254
+
255
+ _this.setState({
256
+ stashedValue: null,
257
+ focusedNode: null
258
+ });
259
+
260
+ log('[onEditingDone] value: ', _this.state.value);
261
+
262
+ _this.props.onChange(_this.state.value, true);
263
+ });
264
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleBlur", function (resolve) {
265
+ var nonEmpty = _this.props.nonEmpty;
266
+ var doneOn = _this.state.toolbarOpts.doneOn;
267
+
268
+ _this.setState({
269
+ toolbarInFocus: false,
270
+ focusedNode: null
271
+ });
272
+
273
+ if (_this.editor) {
274
+ _this.editor.blur();
275
+ }
276
+
277
+ if (doneOn === 'blur') {
278
+ var _this$state$value$sta3, _this$state$value$sta4;
279
+
280
+ if (nonEmpty && ((_this$state$value$sta3 = _this.state.value.startText) === null || _this$state$value$sta3 === void 0 ? void 0 : (_this$state$value$sta4 = _this$state$value$sta3.text) === null || _this$state$value$sta4 === void 0 ? void 0 : _this$state$value$sta4.length) === 0) {
281
+ _this.resetValue(true).then(function () {
282
+ _this.onEditingDone();
283
+
284
+ resolve();
285
+ });
286
+ } else {
287
+ _this.onEditingDone();
288
+
289
+ resolve();
290
+ }
291
+ }
292
+ });
293
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onBlur", function (event) {
294
+ log('[onBlur]');
295
+ var target = event.relatedTarget;
296
+ var node = target ? (0, _slateReact.findNode)(target, _this.state.value) : null;
297
+ log('[onBlur] node: ', node);
298
+ return new Promise(function (resolve) {
299
+ _this.setState({
300
+ focusedNode: !node ? null : node
301
+ }, _this.handleBlur.bind((0, _assertThisInitialized2["default"])(_this), resolve));
302
+
303
+ _this.props.onBlur(event);
304
+ });
305
+ });
306
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleDomBlur", function (e) {
307
+ var editorDOM = document.querySelector("[data-key=\"".concat(_this.state.value.document.key, "\"]"));
308
+ setTimeout(function () {
309
+ if (!_this.wrapperRef) {
310
+ return;
311
+ }
312
+
313
+ var editorElement = !editorDOM || document.activeElement.closest("[class*=\"".concat(editorDOM.className, "\"]"));
314
+ var toolbarElement = !_this.toolbarRef || document.activeElement.closest("[class*=\"".concat(_this.toolbarRef.className, "\"]"));
315
+
316
+ var isInCurrentComponent = _this.wrapperRef.contains(editorElement) || _this.wrapperRef.contains(toolbarElement);
317
+
318
+ if (!isInCurrentComponent) {
319
+ editorDOM.removeEventListener('blur', _this.handleDomBlur);
320
+
321
+ _this.onBlur(e);
322
+ }
323
+ }, 50);
324
+ });
325
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onFocus", function () {
326
+ return new Promise(function (resolve) {
327
+ var editorDOM = document.querySelector("[data-key=\"".concat(_this.state.value.document.key, "\"]"));
328
+ log('[onFocus]', document.activeElement);
329
+ /**
330
+ * This is a temporary hack - @see changeData below for some more information.
331
+ */
332
+
333
+ if (_this.__TEMPORARY_CHANGE_DATA) {
334
+ var _this$__TEMPORARY_CHA = _this.__TEMPORARY_CHANGE_DATA,
335
+ key = _this$__TEMPORARY_CHA.key,
336
+ data = _this$__TEMPORARY_CHA.data;
337
+ var domEl = document.querySelector("[data-key=\"".concat(key, "\"]"));
338
+
339
+ if (domEl) {
340
+ var change = _this.state.value.change().setNodeByKey(key, {
341
+ data: data
342
+ });
343
+
344
+ _this.setState({
345
+ value: change.value
346
+ }, function () {
347
+ _this.__TEMPORARY_CHANGE_DATA = null;
348
+ });
349
+ }
350
+ }
351
+ /**
352
+ * This is needed just in case the browser decides to make the editor
353
+ * lose focus without triggering the onBlur event (can happen in a few cases).
354
+ * This will also trigger onBlur if the user clicks outside of the page when the editor
355
+ * is focused.
356
+ */
357
+
358
+
359
+ if (editorDOM === document.activeElement) {
360
+ editorDOM.removeEventListener('blur', _this.handleDomBlur);
361
+ editorDOM.addEventListener('blur', _this.handleDomBlur);
362
+ }
363
+
364
+ _this.stashValue();
365
+
366
+ _this.props.onFocus();
367
+
368
+ resolve();
369
+ });
370
+ });
371
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "stashValue", function () {
372
+ log('[stashValue]');
373
+
374
+ if (!_this.state.stashedValue) {
375
+ _this.setState({
376
+ stashedValue: _this.state.value
377
+ });
378
+ }
379
+ });
380
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "resetValue", function (force) {
381
+ var _this$state = _this.state,
382
+ value = _this$state.value,
383
+ focusedNode = _this$state.focusedNode;
384
+
385
+ var stopReset = _this.plugins.reduce(function (s, p) {
386
+ return s || p.stopReset && p.stopReset(_this.state.value);
387
+ }, false);
388
+
389
+ log('[resetValue]', value.isFocused, focusedNode, 'stopReset: ', stopReset);
390
+
391
+ if (_this.state.stashedValue && !value.isFocused && !focusedNode && !stopReset || force) {
392
+ log('[resetValue] resetting...');
393
+ log('stashed', _this.state.stashedValue.document.toObject());
394
+ log('current', _this.state.value.document.toObject());
395
+
396
+ var newValue = _slate.Value.fromJSON(_this.state.stashedValue.toJSON());
397
+
398
+ log('newValue: ', newValue.document);
399
+ return new Promise(function (resolve) {
400
+ setTimeout(function () {
401
+ _this.setState({
402
+ value: newValue,
403
+ stashedValue: null
404
+ }, function () {
405
+ log('value now: ', _this.state.value.document.toJSON());
406
+ resolve();
407
+ });
408
+ }, 50);
409
+ });
410
+ } else {
411
+ return Promise.resolve({});
412
+ }
413
+ });
414
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function (change, done) {
415
+ log('[onChange]');
416
+ var value = change.value;
417
+ var charactersLimit = _this.props.charactersLimit;
418
+
419
+ if (value && value.document && value.document.text && value.document.text.length > charactersLimit) {
420
+ return;
421
+ }
422
+
423
+ _this.setState({
424
+ value: value
425
+ }, function () {
426
+ log('[onChange], call done()');
427
+
428
+ if (done) {
429
+ done();
430
+ }
431
+ });
432
+ });
433
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "valueToSize", function (v) {
434
+ if (!v) {
435
+ return;
436
+ }
437
+
438
+ if (typeof v === 'string') {
439
+ if (v.endsWith('%')) {
440
+ return undefined;
441
+ } else if (v.endsWith('px') || v.endsWith('vh') || v.endsWith('vw')) {
442
+ return v;
443
+ } else {
444
+ var value = parseInt(v, 10);
445
+ return isNaN(value) ? value : "".concat(value, "px");
446
+ }
447
+ }
448
+
449
+ if (typeof v === 'number') {
450
+ return "".concat(v, "px");
451
+ }
452
+
453
+ return;
454
+ });
455
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "validateNode", function (node) {
456
+ if (node.object !== 'block') return;
457
+ var last = node.nodes.last();
458
+ if (!last) return;
459
+ if (last.type !== 'image') return;
460
+ log('[validateNode] last is image..');
461
+ var parent = last.getParent(last.key);
462
+
463
+ var p = _slate.Block.getParent(last.key);
464
+
465
+ log('[validateNode] parent:', parent, p);
466
+ return undefined;
467
+ });
468
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeData", function (key, data) {
469
+ log('[changeData]. .. ', key, data);
470
+ /**
471
+ * HACK ALERT: We should be calling setState here and storing the change data:
472
+ *
473
+ * <code>this.setState({changeData: { key, data}})</code>
474
+ * However this is causing issues with the Mathquill instance. The 'input' event stops firing on the element and no
475
+ * more changes get through. The issues seem to be related to the promises in onBlur/onFocus. But removing these
476
+ * brings it's own problems. A major clean up is planned for this component so I've decided to temporarily settle
477
+ * on this hack rather than spend more time on this.
478
+ */
479
+ // Uncomment this line to see the bug described above.
480
+ // this.setState({changeData: {key, data}})
481
+
482
+ _this.__TEMPORARY_CHANGE_DATA = {
483
+ key: key,
484
+ data: data
485
+ };
486
+ });
487
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "focus", function (pos, node) {
488
+ var position = pos || 'end';
489
+
490
+ _this.props.focus(position, node);
491
+ });
492
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onDropPaste", /*#__PURE__*/function () {
493
+ var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(event, change, dropContext) {
494
+ var editor, transfer, file, type, fragment, text, src, inline, range, ch, _change$value, _document, selection, startBlock, defaultBlock, defaultMarks, frag;
495
+
496
+ return _regenerator["default"].wrap(function _callee$(_context) {
497
+ while (1) {
498
+ switch (_context.prev = _context.next) {
499
+ case 0:
500
+ editor = change.editor;
501
+ transfer = (0, _slateReact.getEventTransfer)(event);
502
+ file = transfer.files && transfer.files[0];
503
+ type = transfer.type;
504
+ fragment = transfer.fragment;
505
+ text = transfer.text;
506
+
507
+ if (!(file && (file.type === 'image/jpeg' || file.type === 'image/jpg' || file.type === 'image/png'))) {
508
+ _context.next = 25;
509
+ break;
510
+ }
511
+
512
+ if (_this.props.imageSupport) {
513
+ _context.next = 9;
514
+ break;
515
+ }
516
+
517
+ return _context.abrupt("return");
518
+
519
+ case 9:
520
+ _context.prev = 9;
521
+ log('[onDropPaste]');
522
+ _context.next = 13;
523
+ return (0, serialization.getBase64)(file);
524
+
525
+ case 13:
526
+ src = _context.sent;
527
+ inline = _slate.Inline.create({
528
+ type: 'image',
529
+ isVoid: true,
530
+ data: {
531
+ loading: false,
532
+ src: src
533
+ }
534
+ });
535
+
536
+ if (dropContext) {
537
+ _this.focus();
538
+ } else {
539
+ range = (0, _slateReact.getEventRange)(event, editor);
540
+
541
+ if (range) {
542
+ change.select(range);
543
+ }
544
+ }
545
+
546
+ ch = change.insertInline(inline);
547
+
548
+ _this.onChange(ch);
549
+
550
+ _context.next = 23;
551
+ break;
552
+
553
+ case 20:
554
+ _context.prev = 20;
555
+ _context.t0 = _context["catch"](9);
556
+ log('[onDropPaste] error: ', _context.t0);
557
+
558
+ case 23:
559
+ _context.next = 39;
560
+ break;
561
+
562
+ case 25:
563
+ if (!(type === 'fragment')) {
564
+ _context.next = 29;
565
+ break;
566
+ }
567
+
568
+ change.insertFragment(fragment);
569
+ _context.next = 39;
570
+ break;
571
+
572
+ case 29:
573
+ if (!(type === 'text' || type === 'html')) {
574
+ _context.next = 39;
575
+ break;
576
+ }
577
+
578
+ if (text) {
579
+ _context.next = 32;
580
+ break;
581
+ }
582
+
583
+ return _context.abrupt("return");
584
+
585
+ case 32:
586
+ _change$value = change.value, _document = _change$value.document, selection = _change$value.selection, startBlock = _change$value.startBlock;
587
+
588
+ if (!startBlock.isVoid) {
589
+ _context.next = 35;
590
+ break;
591
+ }
592
+
593
+ return _context.abrupt("return");
594
+
595
+ case 35:
596
+ defaultBlock = startBlock;
597
+ defaultMarks = _document.getInsertMarksAtRange(selection);
598
+ frag = _slatePlainSerializer["default"].deserialize(text, {
599
+ defaultBlock: defaultBlock,
600
+ defaultMarks: defaultMarks
601
+ }).document;
602
+ change.insertFragment(frag);
603
+
604
+ case 39:
605
+ case "end":
606
+ return _context.stop();
607
+ }
608
+ }
609
+ }, _callee, null, [[9, 20]]);
610
+ }));
611
+
612
+ return function (_x, _x2, _x3) {
613
+ return _ref.apply(this, arguments);
614
+ };
615
+ }());
616
+ _this.state = {
617
+ value: _props.value,
618
+ toolbarOpts: createToolbarOpts(_props.toolbarOpts)
619
+ };
620
+
621
+ _this.onResize = function () {
622
+ _props.onChange(_this.state.value, true);
623
+ };
624
+
625
+ _this.handlePlugins(_this.props);
626
+
627
+ return _this;
628
+ }
629
+
630
+ (0, _createClass2["default"])(Editor, [{
631
+ key: "componentDidMount",
632
+ value: function componentDidMount() {
633
+ var _this2 = this;
634
+
635
+ // onRef is needed to get the ref of the component because we export it using withStyles
636
+ this.props.onRef(this);
637
+ window.addEventListener('resize', this.onResize);
638
+
639
+ if (this.editor && this.props.autoFocus) {
640
+ Promise.resolve().then(function () {
641
+ if (_this2.editor) {
642
+ var editorDOM = document.querySelector("[data-key=\"".concat(_this2.editor.value.document.key, "\"]"));
643
+
644
+ _this2.editor.focus();
645
+
646
+ if (editorDOM) {
647
+ editorDOM.focus();
648
+ }
649
+ }
650
+ });
651
+ }
652
+ }
653
+ }, {
654
+ key: "componentWillReceiveProps",
655
+ value: function componentWillReceiveProps(nextProps) {
656
+ var toolbarOpts = this.state.toolbarOpts;
657
+ var newToolbarOpts = createToolbarOpts(nextProps.toolbarOpts);
658
+
659
+ if (!(0, _isEqual["default"])(newToolbarOpts, toolbarOpts)) {
660
+ this.setState({
661
+ toolbarOpts: newToolbarOpts
662
+ });
663
+ }
664
+
665
+ if (!(0, _isEqual["default"])(nextProps.languageCharactersProps, this.props.languageCharactersProps)) {
666
+ this.handlePlugins(nextProps);
667
+ }
668
+ }
669
+ }, {
670
+ key: "componentDidUpdate",
671
+ value: function componentDidUpdate() {
672
+ // The cursor is on a zero width element and when that is placed near void elements, it is not visible
673
+ // so we increase the width to at least 2px in order for the user to see it
674
+ var zeroWidthEls = document.querySelectorAll('[data-slate-zero-width="z"]');
675
+ Array.from(zeroWidthEls).forEach(function (el) {
676
+ el.style.minWidth = '2px';
677
+ el.style.display = 'inline-block';
678
+ });
679
+ }
680
+ }, {
681
+ key: "componentWillUnmount",
682
+ value:
683
+ /**
684
+ * Remove onResize event listener
685
+ */
686
+ function componentWillUnmount() {
687
+ window.removeEventListener('resize', this.onResize);
688
+ } // Allowing time for onChange to take effect if it is called
689
+
690
+ }, {
691
+ key: "UNSAFE_componentWillReceiveProps",
692
+ value: function UNSAFE_componentWillReceiveProps(props) {
693
+ if (!props.value.document.equals(this.props.value.document)) {
694
+ this.setState({
695
+ focus: false,
696
+ value: props.value
697
+ });
698
+ }
699
+ }
700
+ }, {
701
+ key: "buildSizeStyle",
702
+ value: function buildSizeStyle() {
703
+ var _this$props = this.props,
704
+ width = _this$props.width,
705
+ minHeight = _this$props.minHeight,
706
+ height = _this$props.height,
707
+ maxHeight = _this$props.maxHeight;
708
+ return {
709
+ width: this.valueToSize(width),
710
+ height: this.valueToSize(height),
711
+ minHeight: this.valueToSize(minHeight),
712
+ maxHeight: this.valueToSize(maxHeight)
713
+ };
714
+ }
715
+ }, {
716
+ key: "render",
717
+ value: function render() {
718
+ var _classNames,
719
+ _this3 = this;
720
+
721
+ var _this$props2 = this.props,
722
+ disabled = _this$props2.disabled,
723
+ spellCheck = _this$props2.spellCheck,
724
+ highlightShape = _this$props2.highlightShape,
725
+ classes = _this$props2.classes,
726
+ className = _this$props2.className,
727
+ placeholder = _this$props2.placeholder,
728
+ pluginProps = _this$props2.pluginProps,
729
+ onKeyDown = _this$props2.onKeyDown;
730
+ var _this$state2 = this.state,
731
+ value = _this$state2.value,
732
+ focusedNode = _this$state2.focusedNode,
733
+ toolbarOpts = _this$state2.toolbarOpts;
734
+ log('[render] value: ', value);
735
+ var sizeStyle = this.buildSizeStyle();
736
+ var names = (0, _classnames["default"])((_classNames = {}, (0, _defineProperty2["default"])(_classNames, classes.withBg, highlightShape), (0, _defineProperty2["default"])(_classNames, classes.toolbarOnTop, toolbarOpts.alwaysVisible && toolbarOpts.position === 'top'), _classNames), className);
737
+ return /*#__PURE__*/_react["default"].createElement("div", {
738
+ ref: function ref(_ref2) {
739
+ return _this3.wrapperRef = _ref2;
740
+ },
741
+ style: {
742
+ width: sizeStyle.width
743
+ },
744
+ className: names
745
+ }, /*#__PURE__*/_react["default"].createElement(_slateReact.Editor, {
746
+ plugins: this.plugins,
747
+ innerRef: function innerRef(r) {
748
+ if (r) {
749
+ _this3.slateEditor = r;
750
+ }
751
+ },
752
+ ref: function ref(r) {
753
+ return _this3.editor = r && _this3.props.editorRef(r);
754
+ },
755
+ toolbarRef: function toolbarRef(r) {
756
+ if (r) {
757
+ _this3.toolbarRef = r;
758
+ }
759
+ },
760
+ value: value,
761
+ focus: this.focus,
762
+ onKeyDown: onKeyDown,
763
+ onChange: this.onChange,
764
+ onBlur: this.onBlur,
765
+ onDrop: function onDrop(event, editor) {
766
+ return _this3.onDropPaste(event, editor, true);
767
+ },
768
+ onPaste: function onPaste(event, editor) {
769
+ return _this3.onDropPaste(event, editor);
770
+ },
771
+ onFocus: this.onFocus,
772
+ onEditingDone: this.onEditingDone,
773
+ focusedNode: focusedNode,
774
+ normalize: this.normalize,
775
+ readOnly: disabled,
776
+ spellCheck: spellCheck,
777
+ className: classes.slateEditor,
778
+ style: {
779
+ minHeight: sizeStyle.minHeight,
780
+ height: sizeStyle.height,
781
+ maxHeight: sizeStyle.maxHeight
782
+ },
783
+ pluginProps: pluginProps,
784
+ toolbarOpts: toolbarOpts,
785
+ placeholder: placeholder,
786
+ onDataChange: this.changeData
787
+ }));
788
+ }
789
+ }]);
790
+ return Editor;
791
+ }(_react["default"].Component); // TODO color - hardcoded gray background and keypad colors will need to change too
792
+
793
+
794
+ exports.Editor = Editor;
795
+ (0, _defineProperty2["default"])(Editor, "propTypes", {
796
+ autoFocus: _propTypes["default"].bool,
797
+ editorRef: _propTypes["default"].func.isRequired,
798
+ onRef: _propTypes["default"].func.isRequired,
799
+ onChange: _propTypes["default"].func.isRequired,
800
+ onFocus: _propTypes["default"].func,
801
+ onBlur: _propTypes["default"].func,
802
+ onKeyDown: _propTypes["default"].func,
803
+ focus: _propTypes["default"].func.isRequired,
804
+ value: _slatePropTypes["default"].value.isRequired,
805
+ imageSupport: _propTypes["default"].object,
806
+ charactersLimit: _propTypes["default"].number,
807
+ width: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
808
+ height: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
809
+ minHeight: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
810
+ maxHeight: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
811
+ classes: _propTypes["default"].object.isRequired,
812
+ highlightShape: _propTypes["default"].bool,
813
+ disabled: _propTypes["default"].bool,
814
+ spellCheck: _propTypes["default"].bool,
815
+ nonEmpty: _propTypes["default"].bool,
816
+ disableUnderline: _propTypes["default"].bool,
817
+ autoWidthToolbar: _propTypes["default"].bool,
818
+ pluginProps: _propTypes["default"].any,
819
+ placeholder: _propTypes["default"].string,
820
+ responseAreaProps: _propTypes["default"].shape({
821
+ type: _propTypes["default"].oneOf(['explicit-constructed-response', 'inline-dropdown', 'drag-in-the-blank']),
822
+ options: _propTypes["default"].object,
823
+ respAreaToolbar: _propTypes["default"].func,
824
+ onHandleAreaChange: _propTypes["default"].func
825
+ }),
826
+ languageCharactersProps: _propTypes["default"].arrayOf(_propTypes["default"].shape({
827
+ language: _propTypes["default"].string,
828
+ characterIcon: _propTypes["default"].string,
829
+ characters: _propTypes["default"].arrayOf(_propTypes["default"].arrayOf(_propTypes["default"].string))
830
+ })),
831
+ toolbarOpts: _propTypes["default"].shape({
832
+ position: _propTypes["default"].oneOf(['bottom', 'top']),
833
+ alignment: _propTypes["default"].oneOf(['left', 'right']),
834
+ alwaysVisible: _propTypes["default"].bool,
835
+ showDone: _propTypes["default"].bool,
836
+ doneOn: _propTypes["default"].string
837
+ }),
838
+ activePlugins: _propTypes["default"].arrayOf(function (values) {
839
+ var allValid = values.every(function (v) {
840
+ return _plugins.ALL_PLUGINS.includes(v);
841
+ });
842
+ return !allValid && new Error("Invalid values: ".concat(values, ", values must be one of [").concat(_plugins.ALL_PLUGINS.join(','), "]"));
843
+ }),
844
+ className: _propTypes["default"].string,
845
+ maxImageWidth: _propTypes["default"].number,
846
+ maxImageHeight: _propTypes["default"].number
847
+ });
848
+ (0, _defineProperty2["default"])(Editor, "defaultProps", {
849
+ disableUnderline: true,
850
+ onFocus: function onFocus() {},
851
+ onBlur: function onBlur() {},
852
+ onKeyDown: function onKeyDown() {},
853
+ toolbarOpts: defaultToolbarOpts,
854
+ responseAreaProps: defaultResponseAreaProps,
855
+ languageCharactersProps: defaultLanguageCharactersProps
856
+ });
857
+ var styles = {
858
+ withBg: {
859
+ backgroundColor: 'rgba(0,0,0,0.06)'
860
+ },
861
+ slateEditor: {
862
+ fontFamily: 'Roboto, sans-serif',
863
+ '& table': {
864
+ tableLayout: 'fixed',
865
+ width: '100%',
866
+ borderCollapse: 'collapse',
867
+ color: _renderUi.color.text(),
868
+ backgroundColor: _renderUi.color.background()
869
+ },
870
+ '& table:not([border="1"]) tr': {
871
+ borderTop: '1px solid #dfe2e5' // TODO perhaps secondary color for background, for now disable
872
+ // '&:nth-child(2n)': {
873
+ // backgroundColor: '#f6f8fa'
874
+ // }
875
+
876
+ },
877
+ '& td, th': {
878
+ padding: '.6em 1em',
879
+ textAlign: 'center'
880
+ },
881
+ '& table:not([border="1"]) td, th': {
882
+ border: '1px solid #dfe2e5'
883
+ }
884
+ },
885
+ toolbarOnTop: {
886
+ marginTop: '45px'
887
+ }
888
+ };
889
+
890
+ var _default = (0, _styles.withStyles)(styles)(Editor);
891
+
892
+ exports["default"] = _default;
893
+ //# sourceMappingURL=editor.js.map