@pie-element/inline-dropdown 11.0.5-esm.1 → 11.0.5-next.20261012010413

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 (281) hide show
  1. package/author.js +2 -0
  2. package/configure.js +2 -0
  3. package/controller.js +1 -0
  4. package/dist/author/defaults.d.ts +187 -0
  5. package/dist/author/defaults.js +130 -0
  6. package/dist/author/index.d.ts +25 -0
  7. package/dist/author/index.js +91 -0
  8. package/dist/author/inline-dropdown-toolbar.d.ts +44 -0
  9. package/dist/author/inline-dropdown-toolbar.js +269 -0
  10. package/dist/author/main.d.ts +65 -0
  11. package/dist/author/main.js +363 -0
  12. package/dist/author/markupUtils.d.ts +4 -0
  13. package/dist/author/markupUtils.js +23 -0
  14. package/dist/author/response-area.d.ts +12 -0
  15. package/dist/author/response-area.js +32 -0
  16. package/dist/author/utils.d.ts +2 -0
  17. package/dist/author/utils.js +10 -0
  18. package/dist/browser/Close-V6zXg6OM.js +12945 -0
  19. package/dist/browser/Close-V6zXg6OM.js.map +1 -0
  20. package/dist/browser/PUA-tLuTiQ7---_oZ5q_A.js +4370 -0
  21. package/dist/browser/PUA-tLuTiQ7---_oZ5q_A.js.map +1 -0
  22. package/dist/browser/accents-BTUYmhn9-BvG-5D5U.js +1508 -0
  23. package/dist/browser/accents-BTUYmhn9-BvG-5D5U.js.map +1 -0
  24. package/dist/browser/accents-b-i-CngHZsLL-D9VyhQb6.js +2847 -0
  25. package/dist/browser/accents-b-i-CngHZsLL-D9VyhQb6.js.map +1 -0
  26. package/dist/browser/arabic-BzEHMVZD-Dynlj189.js +785 -0
  27. package/dist/browser/arabic-BzEHMVZD-Dynlj189.js.map +1 -0
  28. package/dist/browser/arrows-VjxlU-jv-DSm4SIYN.js +2655 -0
  29. package/dist/browser/arrows-VjxlU-jv-DSm4SIYN.js.map +1 -0
  30. package/dist/browser/assets/Symbola-4c507403.woff2 +0 -0
  31. package/dist/browser/author/index.js +36618 -0
  32. package/dist/browser/author/index.js.map +1 -0
  33. package/dist/browser/braille-BeWC_Ruq-T-5kTNil.js +1287 -0
  34. package/dist/browser/braille-BeWC_Ruq-T-5kTNil.js.map +1 -0
  35. package/dist/browser/braille-d-Dk6J96GO--ZdfI9kr.js +1287 -0
  36. package/dist/browser/braille-d-Dk6J96GO--ZdfI9kr.js.map +1 -0
  37. package/dist/browser/calligraphic-Cew9cU3x-qfCrrm3u.js +323 -0
  38. package/dist/browser/calligraphic-Cew9cU3x-qfCrrm3u.js.map +1 -0
  39. package/dist/browser/cherokee-Cny3FYho-CbTYre7_.js +2029 -0
  40. package/dist/browser/cherokee-Cny3FYho-CbTYre7_.js.map +1 -0
  41. package/dist/browser/chtml-CbqemTOM-x0_YISTK.js +20329 -0
  42. package/dist/browser/chtml-CbqemTOM-x0_YISTK.js.map +1 -0
  43. package/dist/browser/controller/index.js +198 -0
  44. package/dist/browser/controller/index.js.map +1 -0
  45. package/dist/browser/cyrillic-CfCDulXU-EvNL2rHi.js +5617 -0
  46. package/dist/browser/cyrillic-CfCDulXU-EvNL2rHi.js.map +1 -0
  47. package/dist/browser/cyrillic-ss-lU7bNGG9-jdxJx-EF.js +5606 -0
  48. package/dist/browser/cyrillic-ss-lU7bNGG9-jdxJx-EF.js.map +1 -0
  49. package/dist/browser/delivery/index.js +1307 -0
  50. package/dist/browser/delivery/index.js.map +1 -0
  51. package/dist/browser/devanagari-CDIz2h-r-FGcUsKu2.js +692 -0
  52. package/dist/browser/devanagari-CDIz2h-r-FGcUsKu2.js.map +1 -0
  53. package/dist/browser/dist-FMIRkZir.js +753 -0
  54. package/dist/browser/dist-FMIRkZir.js.map +1 -0
  55. package/dist/browser/double-struck-BpJEQk8y-CLqFtvAN.js +438 -0
  56. package/dist/browser/double-struck-BpJEQk8y-CLqFtvAN.js.map +1 -0
  57. package/dist/browser/editor-runtime/Close-C0bNS2Kx.js +12945 -0
  58. package/dist/browser/editor-runtime/Close-C0bNS2Kx.js.map +1 -0
  59. package/dist/browser/editor-runtime/PUA-tLuTiQ7---_oZ5q_A.js +4370 -0
  60. package/dist/browser/editor-runtime/PUA-tLuTiQ7---_oZ5q_A.js.map +1 -0
  61. package/dist/browser/editor-runtime/accents-BTUYmhn9-BvG-5D5U.js +1508 -0
  62. package/dist/browser/editor-runtime/accents-BTUYmhn9-BvG-5D5U.js.map +1 -0
  63. package/dist/browser/editor-runtime/accents-b-i-CngHZsLL-D9VyhQb6.js +2847 -0
  64. package/dist/browser/editor-runtime/accents-b-i-CngHZsLL-D9VyhQb6.js.map +1 -0
  65. package/dist/browser/editor-runtime/arabic-BzEHMVZD-Dynlj189.js +785 -0
  66. package/dist/browser/editor-runtime/arabic-BzEHMVZD-Dynlj189.js.map +1 -0
  67. package/dist/browser/editor-runtime/arrows-VjxlU-jv-DSm4SIYN.js +2655 -0
  68. package/dist/browser/editor-runtime/arrows-VjxlU-jv-DSm4SIYN.js.map +1 -0
  69. package/dist/browser/editor-runtime/assets/Symbola-4c507403.woff2 +0 -0
  70. package/dist/browser/editor-runtime/author/index.js +20030 -0
  71. package/dist/browser/editor-runtime/author/index.js.map +1 -0
  72. package/dist/browser/editor-runtime/braille-BeWC_Ruq-T-5kTNil.js +1287 -0
  73. package/dist/browser/editor-runtime/braille-BeWC_Ruq-T-5kTNil.js.map +1 -0
  74. package/dist/browser/editor-runtime/braille-d-Dk6J96GO--ZdfI9kr.js +1287 -0
  75. package/dist/browser/editor-runtime/braille-d-Dk6J96GO--ZdfI9kr.js.map +1 -0
  76. package/dist/browser/editor-runtime/calligraphic-Cew9cU3x-qfCrrm3u.js +323 -0
  77. package/dist/browser/editor-runtime/calligraphic-Cew9cU3x-qfCrrm3u.js.map +1 -0
  78. package/dist/browser/editor-runtime/cherokee-Cny3FYho-CbTYre7_.js +2029 -0
  79. package/dist/browser/editor-runtime/cherokee-Cny3FYho-CbTYre7_.js.map +1 -0
  80. package/dist/browser/editor-runtime/chtml-CbqemTOM-x0_YISTK.js +20329 -0
  81. package/dist/browser/editor-runtime/chtml-CbqemTOM-x0_YISTK.js.map +1 -0
  82. package/dist/browser/editor-runtime/controller/index.js +198 -0
  83. package/dist/browser/editor-runtime/controller/index.js.map +1 -0
  84. package/dist/browser/editor-runtime/cyrillic-CfCDulXU-EvNL2rHi.js +5617 -0
  85. package/dist/browser/editor-runtime/cyrillic-CfCDulXU-EvNL2rHi.js.map +1 -0
  86. package/dist/browser/editor-runtime/cyrillic-ss-lU7bNGG9-jdxJx-EF.js +5606 -0
  87. package/dist/browser/editor-runtime/cyrillic-ss-lU7bNGG9-jdxJx-EF.js.map +1 -0
  88. package/dist/browser/editor-runtime/delivery/index.js +1307 -0
  89. package/dist/browser/editor-runtime/delivery/index.js.map +1 -0
  90. package/dist/browser/editor-runtime/devanagari-CDIz2h-r-FGcUsKu2.js +692 -0
  91. package/dist/browser/editor-runtime/devanagari-CDIz2h-r-FGcUsKu2.js.map +1 -0
  92. package/dist/browser/editor-runtime/dist-FMIRkZir.js +753 -0
  93. package/dist/browser/editor-runtime/dist-FMIRkZir.js.map +1 -0
  94. package/dist/browser/editor-runtime/double-struck-BpJEQk8y-CLqFtvAN.js +438 -0
  95. package/dist/browser/editor-runtime/double-struck-BpJEQk8y-CLqFtvAN.js.map +1 -0
  96. package/dist/browser/editor-runtime/fraktur-rLEq9DEH-BU0iR4xw.js +694 -0
  97. package/dist/browser/editor-runtime/fraktur-rLEq9DEH-BU0iR4xw.js.map +1 -0
  98. package/dist/browser/editor-runtime/greek-BlraJTyL-DAfjxxNh.js +9335 -0
  99. package/dist/browser/editor-runtime/greek-BlraJTyL-DAfjxxNh.js.map +1 -0
  100. package/dist/browser/editor-runtime/greek-ss-D-EN2PK0-CcyaecGS.js +6767 -0
  101. package/dist/browser/editor-runtime/greek-ss-D-EN2PK0-CcyaecGS.js.map +1 -0
  102. package/dist/browser/editor-runtime/hebrew-GiQZeybp-DqJrAkkB.js +3218 -0
  103. package/dist/browser/editor-runtime/hebrew-GiQZeybp-DqJrAkkB.js.map +1 -0
  104. package/dist/browser/editor-runtime/latin-b-BhEnC7R2-CQAVv0CI.js +3134 -0
  105. package/dist/browser/editor-runtime/latin-b-BhEnC7R2-CQAVv0CI.js.map +1 -0
  106. package/dist/browser/editor-runtime/latin-bi-DqiIKv3U-DM22wSUP.js +3637 -0
  107. package/dist/browser/editor-runtime/latin-bi-DqiIKv3U-DM22wSUP.js.map +1 -0
  108. package/dist/browser/editor-runtime/latin-i-B1xtwaE1-uBpJAGjo.js +3634 -0
  109. package/dist/browser/editor-runtime/latin-i-B1xtwaE1-uBpJAGjo.js.map +1 -0
  110. package/dist/browser/editor-runtime/latin-xfWFlLkD-CKElfDKc.js +3266 -0
  111. package/dist/browser/editor-runtime/latin-xfWFlLkD-CKElfDKc.js.map +1 -0
  112. package/dist/browser/editor-runtime/marrows-DD1NgMQi-BIBP-NrK.js +761 -0
  113. package/dist/browser/editor-runtime/marrows-DD1NgMQi-BIBP-NrK.js.map +1 -0
  114. package/dist/browser/editor-runtime/math-DpWn1mbG-B7Krt7Jk.js +2034 -0
  115. package/dist/browser/editor-runtime/math-DpWn1mbG-B7Krt7Jk.js.map +1 -0
  116. package/dist/browser/editor-runtime/mathjax-CptWnMbQ-BymmkoDr.js +36692 -0
  117. package/dist/browser/editor-runtime/mathjax-CptWnMbQ-BymmkoDr.js.map +1 -0
  118. package/dist/browser/editor-runtime/monospace-D116QD2a-C40p3Rv8.js +1112 -0
  119. package/dist/browser/editor-runtime/monospace-D116QD2a-C40p3Rv8.js.map +1 -0
  120. package/dist/browser/editor-runtime/monospace-ex-DcXpouKS-DkaktwPJ.js +6014 -0
  121. package/dist/browser/editor-runtime/monospace-ex-DcXpouKS-DkaktwPJ.js.map +1 -0
  122. package/dist/browser/editor-runtime/monospace-l-Ct5wkMDs-CuE7t5pv.js +3114 -0
  123. package/dist/browser/editor-runtime/monospace-l-Ct5wkMDs-CuE7t5pv.js.map +1 -0
  124. package/dist/browser/editor-runtime/mshapes-DCp86WSX-DX0WfJid.js +524 -0
  125. package/dist/browser/editor-runtime/mshapes-DCp86WSX-DX0WfJid.js.map +1 -0
  126. package/dist/browser/editor-runtime/phonetics-BwOCw2Y9-lJWnARqt.js +2496 -0
  127. package/dist/browser/editor-runtime/phonetics-BwOCw2Y9-lJWnARqt.js.map +1 -0
  128. package/dist/browser/editor-runtime/phonetics-ss-CRtMn02f-Cr32SJLL.js +2984 -0
  129. package/dist/browser/editor-runtime/phonetics-ss-CRtMn02f-Cr32SJLL.js.map +1 -0
  130. package/dist/browser/editor-runtime/sans-serif-BYPZKlE9-DftjSdim.js +5246 -0
  131. package/dist/browser/editor-runtime/sans-serif-BYPZKlE9-DftjSdim.js.map +1 -0
  132. package/dist/browser/editor-runtime/sans-serif-b-B0kRKiC--BsRQiyQP.js +3176 -0
  133. package/dist/browser/editor-runtime/sans-serif-b-B0kRKiC--BsRQiyQP.js.map +1 -0
  134. package/dist/browser/editor-runtime/sans-serif-bi-DXWul6mu-D4NuD72A.js +3688 -0
  135. package/dist/browser/editor-runtime/sans-serif-bi-DXWul6mu-D4NuD72A.js.map +1 -0
  136. package/dist/browser/editor-runtime/sans-serif-ex-Boux1kMP-BrL4RNcD.js +10033 -0
  137. package/dist/browser/editor-runtime/sans-serif-ex-Boux1kMP-BrL4RNcD.js.map +1 -0
  138. package/dist/browser/editor-runtime/sans-serif-i-676RFaSO-BCRikTTw.js +3635 -0
  139. package/dist/browser/editor-runtime/sans-serif-i-676RFaSO-BCRikTTw.js.map +1 -0
  140. package/dist/browser/editor-runtime/sans-serif-r-DrN9xdZt-CN8omxfu.js +3159 -0
  141. package/dist/browser/editor-runtime/sans-serif-r-DrN9xdZt-CN8omxfu.js.map +1 -0
  142. package/dist/browser/editor-runtime/script-0ohehnXc-4G2PiBkk.js +649 -0
  143. package/dist/browser/editor-runtime/script-0ohehnXc-4G2PiBkk.js.map +1 -0
  144. package/dist/browser/editor-runtime/shapes-BG47NodJ-D3eH0HjT.js +1932 -0
  145. package/dist/browser/editor-runtime/shapes-BG47NodJ-D3eH0HjT.js.map +1 -0
  146. package/dist/browser/editor-runtime/speech-worker-CTpOB9m5-pwCKeQ9c.js +160 -0
  147. package/dist/browser/editor-runtime/speech-worker-CTpOB9m5-pwCKeQ9c.js.map +1 -0
  148. package/dist/browser/editor-runtime/symbols-BqnUxf_t-DJHA_nO7.js +1833 -0
  149. package/dist/browser/editor-runtime/symbols-BqnUxf_t-DJHA_nO7.js.map +1 -0
  150. package/dist/browser/editor-runtime/symbols-b-i-eg9k5hmF-Bn-dxZT_.js +1153 -0
  151. package/dist/browser/editor-runtime/symbols-b-i-eg9k5hmF-Bn-dxZT_.js.map +1 -0
  152. package/dist/browser/editor-runtime/variants-2LRNhOUP-BlL4NIVJ.js +231 -0
  153. package/dist/browser/editor-runtime/variants-2LRNhOUP-BlL4NIVJ.js.map +1 -0
  154. package/dist/browser/fraktur-rLEq9DEH-BU0iR4xw.js +694 -0
  155. package/dist/browser/fraktur-rLEq9DEH-BU0iR4xw.js.map +1 -0
  156. package/dist/browser/greek-BlraJTyL-DAfjxxNh.js +9335 -0
  157. package/dist/browser/greek-BlraJTyL-DAfjxxNh.js.map +1 -0
  158. package/dist/browser/greek-ss-D-EN2PK0-CcyaecGS.js +6767 -0
  159. package/dist/browser/greek-ss-D-EN2PK0-CcyaecGS.js.map +1 -0
  160. package/dist/browser/hebrew-GiQZeybp-DqJrAkkB.js +3218 -0
  161. package/dist/browser/hebrew-GiQZeybp-DqJrAkkB.js.map +1 -0
  162. package/dist/browser/latin-b-BhEnC7R2-CQAVv0CI.js +3134 -0
  163. package/dist/browser/latin-b-BhEnC7R2-CQAVv0CI.js.map +1 -0
  164. package/dist/browser/latin-bi-DqiIKv3U-DM22wSUP.js +3637 -0
  165. package/dist/browser/latin-bi-DqiIKv3U-DM22wSUP.js.map +1 -0
  166. package/dist/browser/latin-i-B1xtwaE1-uBpJAGjo.js +3634 -0
  167. package/dist/browser/latin-i-B1xtwaE1-uBpJAGjo.js.map +1 -0
  168. package/dist/browser/latin-xfWFlLkD-CKElfDKc.js +3266 -0
  169. package/dist/browser/latin-xfWFlLkD-CKElfDKc.js.map +1 -0
  170. package/dist/browser/marrows-DD1NgMQi-BIBP-NrK.js +761 -0
  171. package/dist/browser/marrows-DD1NgMQi-BIBP-NrK.js.map +1 -0
  172. package/dist/browser/math-DpWn1mbG-B7Krt7Jk.js +2034 -0
  173. package/dist/browser/math-DpWn1mbG-B7Krt7Jk.js.map +1 -0
  174. package/dist/browser/mathjax-CptWnMbQ-ncPHVakS.js +36692 -0
  175. package/dist/browser/mathjax-CptWnMbQ-ncPHVakS.js.map +1 -0
  176. package/dist/browser/monospace-D116QD2a-C40p3Rv8.js +1112 -0
  177. package/dist/browser/monospace-D116QD2a-C40p3Rv8.js.map +1 -0
  178. package/dist/browser/monospace-ex-DcXpouKS-DkaktwPJ.js +6014 -0
  179. package/dist/browser/monospace-ex-DcXpouKS-DkaktwPJ.js.map +1 -0
  180. package/dist/browser/monospace-l-Ct5wkMDs-CuE7t5pv.js +3114 -0
  181. package/dist/browser/monospace-l-Ct5wkMDs-CuE7t5pv.js.map +1 -0
  182. package/dist/browser/mshapes-DCp86WSX-DX0WfJid.js +524 -0
  183. package/dist/browser/mshapes-DCp86WSX-DX0WfJid.js.map +1 -0
  184. package/dist/browser/phonetics-BwOCw2Y9-lJWnARqt.js +2496 -0
  185. package/dist/browser/phonetics-BwOCw2Y9-lJWnARqt.js.map +1 -0
  186. package/dist/browser/phonetics-ss-CRtMn02f-Cr32SJLL.js +2984 -0
  187. package/dist/browser/phonetics-ss-CRtMn02f-Cr32SJLL.js.map +1 -0
  188. package/dist/browser/sans-serif-BYPZKlE9-DftjSdim.js +5246 -0
  189. package/dist/browser/sans-serif-BYPZKlE9-DftjSdim.js.map +1 -0
  190. package/dist/browser/sans-serif-b-B0kRKiC--BsRQiyQP.js +3176 -0
  191. package/dist/browser/sans-serif-b-B0kRKiC--BsRQiyQP.js.map +1 -0
  192. package/dist/browser/sans-serif-bi-DXWul6mu-D4NuD72A.js +3688 -0
  193. package/dist/browser/sans-serif-bi-DXWul6mu-D4NuD72A.js.map +1 -0
  194. package/dist/browser/sans-serif-ex-Boux1kMP-BrL4RNcD.js +10033 -0
  195. package/dist/browser/sans-serif-ex-Boux1kMP-BrL4RNcD.js.map +1 -0
  196. package/dist/browser/sans-serif-i-676RFaSO-BCRikTTw.js +3635 -0
  197. package/dist/browser/sans-serif-i-676RFaSO-BCRikTTw.js.map +1 -0
  198. package/dist/browser/sans-serif-r-DrN9xdZt-CN8omxfu.js +3159 -0
  199. package/dist/browser/sans-serif-r-DrN9xdZt-CN8omxfu.js.map +1 -0
  200. package/dist/browser/script-0ohehnXc-4G2PiBkk.js +649 -0
  201. package/dist/browser/script-0ohehnXc-4G2PiBkk.js.map +1 -0
  202. package/dist/browser/shapes-BG47NodJ-D3eH0HjT.js +1932 -0
  203. package/dist/browser/shapes-BG47NodJ-D3eH0HjT.js.map +1 -0
  204. package/dist/browser/speech-worker-CTpOB9m5-BIgcSm3A.js +160 -0
  205. package/dist/browser/speech-worker-CTpOB9m5-BIgcSm3A.js.map +1 -0
  206. package/dist/browser/symbols-BqnUxf_t-DJHA_nO7.js +1833 -0
  207. package/dist/browser/symbols-BqnUxf_t-DJHA_nO7.js.map +1 -0
  208. package/dist/browser/symbols-b-i-eg9k5hmF-Bn-dxZT_.js +1153 -0
  209. package/dist/browser/symbols-b-i-eg9k5hmF-Bn-dxZT_.js.map +1 -0
  210. package/dist/browser/variants-2LRNhOUP-BlL4NIVJ.js +231 -0
  211. package/dist/browser/variants-2LRNhOUP-BlL4NIVJ.js.map +1 -0
  212. package/dist/controller/defaults.d.ts +19 -0
  213. package/dist/controller/defaults.js +21 -0
  214. package/dist/controller/index.d.ts +95 -0
  215. package/dist/controller/index.js +126 -0
  216. package/dist/controller/utils.d.ts +2 -0
  217. package/dist/controller/utils.js +13 -0
  218. package/dist/delivery/__tests__/inline-dropdown-language.test.d.ts +1 -0
  219. package/dist/delivery/index.d.ts +14 -0
  220. package/dist/delivery/index.js +64 -0
  221. package/dist/delivery/inline-dropdown.d.ts +30 -0
  222. package/dist/delivery/inline-dropdown.js +111 -0
  223. package/dist/index.d.ts +2 -0
  224. package/dist/index.iife.d.ts +6 -0
  225. package/dist/index.iife.js +185 -0
  226. package/dist/index.js +2 -0
  227. package/dist/runtime-support.d.ts +12 -0
  228. package/dist/runtime-support.js +12 -0
  229. package/dist/schemas/configuration.schema.json +414 -0
  230. package/dist/schemas/model.schema.json +453 -0
  231. package/dist/schemas/session.schema.json +43 -0
  232. package/dist/types.d.ts +164 -0
  233. package/package.json +96 -32
  234. package/CHANGELOG.json +0 -1082
  235. package/CHANGELOG.md +0 -3440
  236. package/LICENSE.md +0 -5
  237. package/README.md +0 -1
  238. package/configure/CHANGELOG.json +0 -647
  239. package/configure/CHANGELOG.md +0 -3066
  240. package/configure/lib/defaults.js +0 -190
  241. package/configure/lib/defaults.js.map +0 -1
  242. package/configure/lib/index.js +0 -209
  243. package/configure/lib/index.js.map +0 -1
  244. package/configure/lib/inline-dropdown-toolbar.js +0 -573
  245. package/configure/lib/inline-dropdown-toolbar.js.map +0 -1
  246. package/configure/lib/main.js +0 -753
  247. package/configure/lib/main.js.map +0 -1
  248. package/configure/lib/markupUtils.js +0 -70
  249. package/configure/lib/markupUtils.js.map +0 -1
  250. package/configure/lib/response-area.js +0 -99
  251. package/configure/lib/response-area.js.map +0 -1
  252. package/configure/lib/utils.js +0 -33
  253. package/configure/lib/utils.js.map +0 -1
  254. package/configure/package.json +0 -22
  255. package/controller/CHANGELOG.json +0 -467
  256. package/controller/CHANGELOG.md +0 -2114
  257. package/controller/lib/defaults.js +0 -26
  258. package/controller/lib/defaults.js.map +0 -1
  259. package/controller/lib/index.js +0 -360
  260. package/controller/lib/index.js.map +0 -1
  261. package/controller/lib/utils.js +0 -40
  262. package/controller/lib/utils.js.map +0 -1
  263. package/controller/package.json +0 -16
  264. package/docs/config-schema.json +0 -2854
  265. package/docs/config-schema.json.md +0 -2106
  266. package/docs/demo/config.js +0 -8
  267. package/docs/demo/generate.js +0 -76
  268. package/docs/demo/index.html +0 -1
  269. package/docs/demo/session.js +0 -11
  270. package/docs/pie-schema.json +0 -1152
  271. package/docs/pie-schema.json.md +0 -814
  272. package/esm/configure.js +0 -1973
  273. package/esm/configure.js.map +0 -1
  274. package/esm/controller.js +0 -304
  275. package/esm/controller.js.map +0 -1
  276. package/esm/element.js +0 -278
  277. package/esm/element.js.map +0 -1
  278. package/lib/index.js +0 -130
  279. package/lib/index.js.map +0 -1
  280. package/lib/inline-dropdown.js +0 -248
  281. package/lib/inline-dropdown.js.map +0 -1
package/esm/configure.js DELETED
@@ -1,1973 +0,0 @@
1
- import { ModelUpdatedEvent, InsertImageEvent, DeleteImageEvent, InsertSoundEvent, DeleteSoundEvent } from '@pie-framework/pie-configure-events';
2
- import React from 'react';
3
- import ReactDOM from 'react-dom';
4
- import PropTypes from 'prop-types';
5
- import EditableHtml, { ALL_PLUGINS } from '@pie-lib/editable-html';
6
- import { layout, InputContainer, AlertDialog, settings } from '@pie-lib/config-ui';
7
- import { renderMath } from '@pie-lib/math-rendering';
8
- import { color } from '@pie-lib/render-ui';
9
- import cloneDeep from 'lodash/cloneDeep';
10
- import isEqual from 'lodash/isEqual';
11
- import isUndefined from 'lodash/isUndefined';
12
- import isEmpty from 'lodash/isEmpty';
13
- import reduce from 'lodash/reduce';
14
- import max from 'lodash/max';
15
- import { withStyles } from '@material-ui/core/styles';
16
- import Tooltip from '@material-ui/core/Tooltip';
17
- import Typography from '@material-ui/core/Typography';
18
- import ExpansionPanel from '@material-ui/core/ExpansionPanel';
19
- import ExpansionPanelSummary from '@material-ui/core/ExpansionPanelSummary';
20
- import ExpansionPanelDetails from '@material-ui/core/ExpansionPanelDetails';
21
- import require$$3 from '@material-ui/core/SvgIcon';
22
- import classnames from 'classnames';
23
- import IconButton from '@material-ui/core/IconButton';
24
- import debug from 'debug';
25
- import defaults from 'lodash/defaults';
26
- import escape from 'lodash/escape';
27
-
28
- function _extends() {
29
- _extends = Object.assign || function (target) {
30
- for (var i = 1; i < arguments.length; i++) {
31
- var source = arguments[i];
32
-
33
- for (var key in source) {
34
- if (Object.prototype.hasOwnProperty.call(source, key)) {
35
- target[key] = source[key];
36
- }
37
- }
38
- }
39
-
40
- return target;
41
- };
42
-
43
- return _extends.apply(this, arguments);
44
- }
45
-
46
- var ExpandMore = {};
47
-
48
- var interopRequireDefault = {exports: {}};
49
-
50
- (function (module) {
51
- function _interopRequireDefault(obj) {
52
- return obj && obj.__esModule ? obj : {
53
- "default": obj
54
- };
55
- }
56
-
57
- module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
58
- }(interopRequireDefault));
59
-
60
- var createSvgIcon$1 = {};
61
-
62
- var pure$1 = {};
63
-
64
- var shouldUpdate$1 = {};
65
-
66
- var inheritsLoose = {exports: {}};
67
-
68
- var setPrototypeOf = {exports: {}};
69
-
70
- (function (module) {
71
- function _setPrototypeOf(o, p) {
72
- module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
73
- o.__proto__ = p;
74
- return o;
75
- }, module.exports.__esModule = true, module.exports["default"] = module.exports;
76
- return _setPrototypeOf(o, p);
77
- }
78
-
79
- module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
80
- }(setPrototypeOf));
81
-
82
- (function (module) {
83
- var setPrototypeOf$1 = setPrototypeOf.exports;
84
-
85
- function _inheritsLoose(subClass, superClass) {
86
- subClass.prototype = Object.create(superClass.prototype);
87
- subClass.prototype.constructor = subClass;
88
- setPrototypeOf$1(subClass, superClass);
89
- }
90
-
91
- module.exports = _inheritsLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
92
- }(inheritsLoose));
93
-
94
- var setDisplayName$1 = {};
95
-
96
- var setStatic$1 = {};
97
-
98
- setStatic$1.__esModule = true;
99
- setStatic$1.default = void 0;
100
-
101
- var setStatic = function setStatic(key, value) {
102
- return function (BaseComponent) {
103
- /* eslint-disable no-param-reassign */
104
- BaseComponent[key] = value;
105
- /* eslint-enable no-param-reassign */
106
-
107
- return BaseComponent;
108
- };
109
- };
110
-
111
- var _default$d = setStatic;
112
- setStatic$1.default = _default$d;
113
-
114
- var _interopRequireDefault$b = interopRequireDefault.exports;
115
-
116
- setDisplayName$1.__esModule = true;
117
- setDisplayName$1.default = void 0;
118
-
119
- var _setStatic = _interopRequireDefault$b(setStatic$1);
120
-
121
- var setDisplayName = function setDisplayName(displayName) {
122
- return (0, _setStatic.default)('displayName', displayName);
123
- };
124
-
125
- var _default$c = setDisplayName;
126
- setDisplayName$1.default = _default$c;
127
-
128
- var wrapDisplayName$1 = {};
129
-
130
- var getDisplayName$1 = {};
131
-
132
- getDisplayName$1.__esModule = true;
133
- getDisplayName$1.default = void 0;
134
-
135
- var getDisplayName = function getDisplayName(Component) {
136
- if (typeof Component === 'string') {
137
- return Component;
138
- }
139
-
140
- if (!Component) {
141
- return undefined;
142
- }
143
-
144
- return Component.displayName || Component.name || 'Component';
145
- };
146
-
147
- var _default$b = getDisplayName;
148
- getDisplayName$1.default = _default$b;
149
-
150
- var _interopRequireDefault$a = interopRequireDefault.exports;
151
-
152
- wrapDisplayName$1.__esModule = true;
153
- wrapDisplayName$1.default = void 0;
154
-
155
- var _getDisplayName = _interopRequireDefault$a(getDisplayName$1);
156
-
157
- var wrapDisplayName = function wrapDisplayName(BaseComponent, hocName) {
158
- return hocName + "(" + (0, _getDisplayName.default)(BaseComponent) + ")";
159
- };
160
-
161
- var _default$a = wrapDisplayName;
162
- wrapDisplayName$1.default = _default$a;
163
-
164
- var _interopRequireDefault$9 = interopRequireDefault.exports;
165
-
166
- shouldUpdate$1.__esModule = true;
167
- shouldUpdate$1.default = void 0;
168
-
169
- var _inheritsLoose2 = _interopRequireDefault$9(inheritsLoose.exports);
170
-
171
- var _react$7 = React;
172
-
173
- var _setDisplayName$1 = _interopRequireDefault$9(setDisplayName$1);
174
-
175
- var _wrapDisplayName$1 = _interopRequireDefault$9(wrapDisplayName$1);
176
-
177
- var shouldUpdate = function shouldUpdate(test) {
178
- return function (BaseComponent) {
179
- var factory = (0, _react$7.createFactory)(BaseComponent);
180
-
181
- var ShouldUpdate =
182
- /*#__PURE__*/
183
- function (_Component) {
184
- (0, _inheritsLoose2.default)(ShouldUpdate, _Component);
185
-
186
- function ShouldUpdate() {
187
- return _Component.apply(this, arguments) || this;
188
- }
189
-
190
- var _proto = ShouldUpdate.prototype;
191
-
192
- _proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
193
- return test(this.props, nextProps);
194
- };
195
-
196
- _proto.render = function render() {
197
- return factory(this.props);
198
- };
199
-
200
- return ShouldUpdate;
201
- }(_react$7.Component);
202
-
203
- if (process.env.NODE_ENV !== 'production') {
204
- return (0, _setDisplayName$1.default)((0, _wrapDisplayName$1.default)(BaseComponent, 'shouldUpdate'))(ShouldUpdate);
205
- }
206
-
207
- return ShouldUpdate;
208
- };
209
- };
210
-
211
- var _default$9 = shouldUpdate;
212
- shouldUpdate$1.default = _default$9;
213
-
214
- var shallowEqual$1 = {};
215
-
216
- /**
217
- * Copyright (c) 2013-present, Facebook, Inc.
218
- *
219
- * This source code is licensed under the MIT license found in the
220
- * LICENSE file in the root directory of this source tree.
221
- *
222
- * @typechecks
223
- *
224
- */
225
-
226
- var hasOwnProperty = Object.prototype.hasOwnProperty;
227
-
228
- /**
229
- * inlined Object.is polyfill to avoid requiring consumers ship their own
230
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
231
- */
232
- function is(x, y) {
233
- // SameValue algorithm
234
- if (x === y) {
235
- // Steps 1-5, 7-10
236
- // Steps 6.b-6.e: +0 != -0
237
- // Added the nonzero y check to make Flow happy, but it is redundant
238
- return x !== 0 || y !== 0 || 1 / x === 1 / y;
239
- } else {
240
- // Step 6.a: NaN == NaN
241
- return x !== x && y !== y;
242
- }
243
- }
244
-
245
- /**
246
- * Performs equality by iterating through keys on an object and returning false
247
- * when any key has values which are not strictly equal between the arguments.
248
- * Returns true when the values of all keys are strictly equal.
249
- */
250
- function shallowEqual(objA, objB) {
251
- if (is(objA, objB)) {
252
- return true;
253
- }
254
-
255
- if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
256
- return false;
257
- }
258
-
259
- var keysA = Object.keys(objA);
260
- var keysB = Object.keys(objB);
261
-
262
- if (keysA.length !== keysB.length) {
263
- return false;
264
- }
265
-
266
- // Test for A's keys different from B.
267
- for (var i = 0; i < keysA.length; i++) {
268
- if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
269
- return false;
270
- }
271
- }
272
-
273
- return true;
274
- }
275
-
276
- var shallowEqual_1 = shallowEqual;
277
-
278
- var _interopRequireDefault$8 = interopRequireDefault.exports;
279
-
280
- shallowEqual$1.__esModule = true;
281
- shallowEqual$1.default = void 0;
282
-
283
- var _shallowEqual$1 = _interopRequireDefault$8(shallowEqual_1);
284
-
285
- var _default$8 = _shallowEqual$1.default;
286
- shallowEqual$1.default = _default$8;
287
-
288
- var _interopRequireDefault$7 = interopRequireDefault.exports;
289
-
290
- pure$1.__esModule = true;
291
- pure$1.default = void 0;
292
-
293
- var _shouldUpdate = _interopRequireDefault$7(shouldUpdate$1);
294
-
295
- var _shallowEqual = _interopRequireDefault$7(shallowEqual$1);
296
-
297
- var _setDisplayName = _interopRequireDefault$7(setDisplayName$1);
298
-
299
- var _wrapDisplayName = _interopRequireDefault$7(wrapDisplayName$1);
300
-
301
- var pure = function pure(BaseComponent) {
302
- var hoc = (0, _shouldUpdate.default)(function (props, nextProps) {
303
- return !(0, _shallowEqual.default)(props, nextProps);
304
- });
305
-
306
- if (process.env.NODE_ENV !== 'production') {
307
- return (0, _setDisplayName.default)((0, _wrapDisplayName.default)(BaseComponent, 'pure'))(hoc(BaseComponent));
308
- }
309
-
310
- return hoc(BaseComponent);
311
- };
312
-
313
- var _default$7 = pure;
314
- pure$1.default = _default$7;
315
-
316
- var _interopRequireDefault$6 = interopRequireDefault.exports;
317
-
318
- Object.defineProperty(createSvgIcon$1, "__esModule", {
319
- value: true
320
- });
321
- createSvgIcon$1.default = void 0;
322
-
323
- var _react$6 = _interopRequireDefault$6(React);
324
-
325
- var _pure = _interopRequireDefault$6(pure$1);
326
-
327
- var _SvgIcon = _interopRequireDefault$6(require$$3);
328
-
329
- function createSvgIcon(path, displayName) {
330
- var Icon = function Icon(props) {
331
- return _react$6.default.createElement(_SvgIcon.default, props, path);
332
- };
333
-
334
- Icon.displayName = "".concat(displayName, "Icon");
335
- Icon = (0, _pure.default)(Icon);
336
- Icon.muiName = 'SvgIcon';
337
- return Icon;
338
- }
339
- var _default$6 = createSvgIcon;
340
- createSvgIcon$1.default = _default$6;
341
-
342
- var _interopRequireDefault$5 = interopRequireDefault.exports;
343
-
344
- Object.defineProperty(ExpandMore, "__esModule", {
345
- value: true
346
- });
347
- var default_1$5 = ExpandMore.default = void 0;
348
-
349
- var _react$5 = _interopRequireDefault$5(React);
350
-
351
- var _createSvgIcon$5 = _interopRequireDefault$5(createSvgIcon$1);
352
-
353
- var _default$5 = (0, _createSvgIcon$5.default)(_react$5.default.createElement(_react$5.default.Fragment, null, _react$5.default.createElement("path", {
354
- d: "M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"
355
- }), _react$5.default.createElement("path", {
356
- fill: "none",
357
- d: "M0 0h24v24H0z"
358
- })), 'ExpandMore');
359
-
360
- default_1$5 = ExpandMore.default = _default$5;
361
-
362
- var Info = {};
363
-
364
- var _interopRequireDefault$4 = interopRequireDefault.exports;
365
-
366
- Object.defineProperty(Info, "__esModule", {
367
- value: true
368
- });
369
- var default_1$4 = Info.default = void 0;
370
-
371
- var _react$4 = _interopRequireDefault$4(React);
372
-
373
- var _createSvgIcon$4 = _interopRequireDefault$4(createSvgIcon$1);
374
-
375
- var _default$4 = (0, _createSvgIcon$4.default)(_react$4.default.createElement(_react$4.default.Fragment, null, _react$4.default.createElement("path", {
376
- fill: "none",
377
- d: "M0 0h24v24H0z"
378
- }), _react$4.default.createElement("path", {
379
- d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"
380
- })), 'Info');
381
-
382
- default_1$4 = Info.default = _default$4;
383
-
384
- const generateValidationMessage = config => {
385
- const {
386
- maxResponseAreas,
387
- maxResponseAreaChoices
388
- } = config;
389
- const responseAreasMessage = '\nThere should be at least 1 ' + (maxResponseAreas ? `and at most ${maxResponseAreas} ` : '') + 'response area' + (maxResponseAreas ? 's' : '') + ' defined.' + (maxResponseAreaChoices ? `\nThere should be at most ${maxResponseAreaChoices} choices defined per response area.` : '');
390
- const message = 'Validation requirements:' + responseAreasMessage;
391
- return message;
392
- };
393
- const getPluginProps = (props = {}, baseInputConfiguration = {}) => _extends({}, baseInputConfiguration, props);
394
-
395
- var Add = {};
396
-
397
- var _interopRequireDefault$3 = interopRequireDefault.exports;
398
-
399
- Object.defineProperty(Add, "__esModule", {
400
- value: true
401
- });
402
- var default_1$3 = Add.default = void 0;
403
-
404
- var _react$3 = _interopRequireDefault$3(React);
405
-
406
- var _createSvgIcon$3 = _interopRequireDefault$3(createSvgIcon$1);
407
-
408
- var _default$3 = (0, _createSvgIcon$3.default)(_react$3.default.createElement(_react$3.default.Fragment, null, _react$3.default.createElement("path", {
409
- d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"
410
- }), _react$3.default.createElement("path", {
411
- fill: "none",
412
- d: "M0 0h24v24H0z"
413
- })), 'Add');
414
-
415
- default_1$3 = Add.default = _default$3;
416
-
417
- var Check = {};
418
-
419
- var _interopRequireDefault$2 = interopRequireDefault.exports;
420
-
421
- Object.defineProperty(Check, "__esModule", {
422
- value: true
423
- });
424
- var default_1$2 = Check.default = void 0;
425
-
426
- var _react$2 = _interopRequireDefault$2(React);
427
-
428
- var _createSvgIcon$2 = _interopRequireDefault$2(createSvgIcon$1);
429
-
430
- var _default$2 = (0, _createSvgIcon$2.default)(_react$2.default.createElement(_react$2.default.Fragment, null, _react$2.default.createElement("path", {
431
- fill: "none",
432
- d: "M0 0h24v24H0z"
433
- }), _react$2.default.createElement("path", {
434
- d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"
435
- })), 'Check');
436
-
437
- default_1$2 = Check.default = _default$2;
438
-
439
- var Close = {};
440
-
441
- var _interopRequireDefault$1 = interopRequireDefault.exports;
442
-
443
- Object.defineProperty(Close, "__esModule", {
444
- value: true
445
- });
446
- var default_1$1 = Close.default = void 0;
447
-
448
- var _react$1 = _interopRequireDefault$1(React);
449
-
450
- var _createSvgIcon$1 = _interopRequireDefault$1(createSvgIcon$1);
451
-
452
- var _default$1 = (0, _createSvgIcon$1.default)(_react$1.default.createElement(_react$1.default.Fragment, null, _react$1.default.createElement("path", {
453
- d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
454
- }), _react$1.default.createElement("path", {
455
- fill: "none",
456
- d: "M0 0h24v24H0z"
457
- })), 'Close');
458
-
459
- default_1$1 = Close.default = _default$1;
460
-
461
- var Edit = {};
462
-
463
- var _interopRequireDefault = interopRequireDefault.exports;
464
-
465
- Object.defineProperty(Edit, "__esModule", {
466
- value: true
467
- });
468
- var default_1 = Edit.default = void 0;
469
-
470
- var _react = _interopRequireDefault(React);
471
-
472
- var _createSvgIcon = _interopRequireDefault(createSvgIcon$1);
473
-
474
- var _default = (0, _createSvgIcon.default)(_react.default.createElement(_react.default.Fragment, null, _react.default.createElement("path", {
475
- d: "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"
476
- }), _react.default.createElement("path", {
477
- fill: "none",
478
- d: "M0 0h24v24H0z"
479
- })), 'Edit');
480
-
481
- default_1 = Edit.default = _default;
482
-
483
- class MenuItemComp extends React.Component {
484
- constructor(...args) {
485
- super(...args);
486
-
487
- this.onRemoveClick = e => {
488
- const {
489
- onRemoveChoice
490
- } = this.props;
491
- e.preventDefault();
492
- e.stopPropagation();
493
- onRemoveChoice();
494
- };
495
-
496
- this.onEditClick = e => {
497
- const {
498
- onEditChoice
499
- } = this.props;
500
- e.preventDefault();
501
- e.stopPropagation();
502
- onEditChoice();
503
- };
504
- }
505
-
506
- render() {
507
- const {
508
- classes,
509
- correct,
510
- onClick,
511
- value
512
- } = this.props;
513
- return /*#__PURE__*/React.createElement("div", {
514
- className: classes.wrapper
515
- }, correct && /*#__PURE__*/React.createElement("div", {
516
- className: classes.selectedIcon,
517
- onClick: onClick
518
- }, /*#__PURE__*/React.createElement(default_1$2, {
519
- fontSize: "inherit"
520
- })), /*#__PURE__*/React.createElement("div", {
521
- className: classnames(classes.valueHolder, {
522
- [classes.correct]: correct
523
- }),
524
- onClick: onClick,
525
- dangerouslySetInnerHTML: {
526
- __html: value
527
- }
528
- }), /*#__PURE__*/React.createElement("div", {
529
- className: classes.actionButtons
530
- }, /*#__PURE__*/React.createElement(IconButton, {
531
- className: classes.iconButton,
532
- onClick: this.onEditClick,
533
- size: "small",
534
- "aria-label": "Edit"
535
- }, /*#__PURE__*/React.createElement(default_1, {
536
- fontSize: "inherit"
537
- })), /*#__PURE__*/React.createElement(IconButton, {
538
- className: classes.iconButton,
539
- onClick: this.onRemoveClick,
540
- size: "small",
541
- "aria-label": "Remove"
542
- }, /*#__PURE__*/React.createElement(default_1$1, {
543
- fontSize: "inherit"
544
- }))));
545
- }
546
-
547
- }
548
-
549
- MenuItemComp.propTypes = {
550
- classes: PropTypes.object.isRequired,
551
- correct: PropTypes.bool.isRequired,
552
- onClick: PropTypes.func.isRequired,
553
- onRemoveChoice: PropTypes.func.isRequired,
554
- onEditChoice: PropTypes.func.isRequired,
555
- value: PropTypes.string.isRequired
556
- };
557
- const MenuItem = withStyles(theme => ({
558
- wrapper: {
559
- display: 'flex',
560
- alignItems: 'flex-start',
561
- position: 'relative',
562
- background: theme.palette.common.white,
563
- borderBottom: `1px solid ${theme.palette.grey[400]}`,
564
- '&:last-child': {
565
- borderRadius: '0 0 4px 4px'
566
- }
567
- },
568
- correct: {
569
- background: color.correctSecondary()
570
- },
571
- actionButtons: {
572
- margin: theme.spacing.unit / 2,
573
- display: 'flex'
574
- },
575
- iconButton: {
576
- fontSize: theme.typography.fontSize,
577
- padding: theme.spacing.unit / 2,
578
- color: theme.palette.common.black
579
- },
580
- selectedIcon: {
581
- display: 'flex',
582
- justifyContent: 'center',
583
- color: theme.palette.common.white,
584
- fontSize: theme.typography.fontSize,
585
- fontStyle: 'normal',
586
- position: 'absolute',
587
- transform: 'translate(0, -50%)',
588
- backgroundColor: color.correct(),
589
- borderRadius: '50%',
590
- top: theme.spacing.unit * 2,
591
- left: theme.spacing.unit,
592
- zIndex: 3
593
- },
594
- valueHolder: {
595
- flex: 1,
596
- padding: theme.spacing.unit * 0.75,
597
- paddingLeft: theme.spacing.unit * 3.5
598
- }
599
- }))(MenuItemComp);
600
-
601
- const findSlateNode = key => {
602
- return window.document.querySelector('[data-key="' + key + '"]');
603
- };
604
-
605
- const createElementFromHTML$2 = htmlString => {
606
- const div = document.createElement('div');
607
- div.innerHTML = (htmlString || '').trim();
608
- return div;
609
- };
610
-
611
- class RespAreaToolbar extends React.Component {
612
- constructor(...args) {
613
- super(...args);
614
- this.clickedInside = false;
615
- this.preventDone = false;
616
- this.state = {
617
- respAreaMarkup: '',
618
- editedChoiceIndex: -1
619
- };
620
-
621
- this.onRespAreaChange = respAreaMarkup => {
622
- this.setState({
623
- respAreaMarkup
624
- });
625
- };
626
-
627
- this.onAddChoice = () => {
628
- if (this.editorRef) {
629
- this.editorRef.finishEditing();
630
- }
631
- };
632
-
633
- this.onDone = val => {
634
- var _choices$editedChoice;
635
-
636
- const {
637
- choices,
638
- node,
639
- value,
640
- onAddChoice,
641
- onToolbarDone
642
- } = this.props;
643
- const {
644
- editedChoiceIndex
645
- } = this.state;
646
- const onlyText = createElementFromHTML$2(val).textContent.trim();
647
-
648
- if (editedChoiceIndex >= 0 && choices != null && (_choices$editedChoice = choices[editedChoiceIndex]) != null && _choices$editedChoice.correct) {
649
- const update = _extends({}, node.data.toJSON(), {
650
- value: val
651
- });
652
-
653
- const change = value.change().setNodeByKey(node.key, {
654
- data: update
655
- });
656
- onToolbarDone(change, false);
657
- }
658
-
659
- if (!isEmpty(onlyText)) {
660
- onAddChoice(node.data.get('index'), val, editedChoiceIndex);
661
- }
662
-
663
- this.setState({
664
- editedChoiceIndex: -1
665
- });
666
- };
667
-
668
- this.onSelectChoice = (newValue, index) => {
669
- const {
670
- node,
671
- value,
672
- onToolbarDone,
673
- onSelectChoice
674
- } = this.props;
675
-
676
- const update = _extends({}, node.data.toJSON(), {
677
- value: newValue
678
- });
679
-
680
- const change = value.change().setNodeByKey(node.key, {
681
- data: update
682
- });
683
- const nextText = value.document.getNextText(node.key);
684
- change.moveFocusTo(nextText.key, 0).moveAnchorTo(nextText.key, 0);
685
- onToolbarDone(change, false);
686
- onSelectChoice(index);
687
- };
688
-
689
- this.onRemoveChoice = (val, index) => {
690
- const {
691
- node,
692
- value,
693
- onToolbarDone,
694
- onRemoveChoice
695
- } = this.props;
696
-
697
- if (isEqual(val, node.data.get('value'))) {
698
- const update = _extends({}, node.data.toJSON(), {
699
- value: null
700
- });
701
-
702
- const change = value.change().setNodeByKey(node.key, {
703
- data: update
704
- });
705
- onToolbarDone(change, false);
706
- }
707
-
708
- onRemoveChoice(index);
709
- };
710
-
711
- this.onEditChoice = (val, index) => {
712
- this.onRespAreaChange(val);
713
- this.setState({
714
- editedChoiceIndex: index
715
- });
716
- };
717
-
718
- this.onKeyDown = event => {
719
- if (event.key === 'Enter') {
720
- this.preventDone = false;
721
- this.onAddChoice(); // Cancelling event
722
-
723
- return false;
724
- }
725
- };
726
-
727
- this.onBlur = () => {
728
- if (this.clickedInside) {
729
- this.clickedInside = false;
730
- return;
731
- }
732
-
733
- const {
734
- node,
735
- choices,
736
- onCheck,
737
- onToolbarDone,
738
- value
739
- } = this.props;
740
- const correctResponse = (choices || []).find(choice => choice.correct);
741
- this.onAddChoice();
742
-
743
- if (!choices || choices && choices.length < 2 || !correctResponse) {
744
- onCheck(() => {
745
- const change = value.change();
746
- change.removeNodeByKey(node.get('key'));
747
- onToolbarDone(change, false);
748
- });
749
- }
750
- };
751
-
752
- this.onClickInside = () => {
753
- this.clickedInside = true;
754
- };
755
-
756
- this.focusInput = () => {
757
- // we need to focus the input so that math is saved even without pressing the green checkmark
758
- const slateEditorRef = this.editorRef && this.editorRef.rootRef && this.editorRef.rootRef.slateEditor;
759
- const inputRef = slateEditorRef && slateEditorRef.editorRef && slateEditorRef.editorRef.element;
760
-
761
- if (inputRef) {
762
- inputRef.focus();
763
- }
764
- };
765
- }
766
-
767
- componentDidMount() {
768
- const {
769
- node
770
- } = this.props;
771
- const domNode = findSlateNode(node.key);
772
-
773
- if (domNode) {
774
- //eslint-disable-next-line
775
- const domNodeRect = domNode.getBoundingClientRect();
776
- const editor = domNode.closest('[data-slate-editor]');
777
- const editorRect = editor.getBoundingClientRect();
778
- const top = domNodeRect.top - editorRect.top;
779
- const left = domNodeRect.left - editorRect.left;
780
- this.setState({
781
- toolbarStyle: {
782
- position: 'absolute',
783
- top: `${top + domNodeRect.height + 60}px`,
784
- left: `${left + 25}px`
785
- }
786
- });
787
- }
788
- }
789
-
790
- componentDidUpdate() {
791
- //eslint-disable-next-line
792
- const domNode = ReactDOM.findDOMNode(this);
793
- renderMath(domNode);
794
- }
795
-
796
- render() {
797
- const {
798
- classes,
799
- choices,
800
- spellCheck,
801
- uploadSoundSupport,
802
- mathMlOptions = {},
803
- baseInputConfiguration = {},
804
- responseAreaInputConfiguration = {}
805
- } = this.props;
806
- const {
807
- respAreaMarkup,
808
- toolbarStyle
809
- } = this.state;
810
-
811
- if (!toolbarStyle) {
812
- return null;
813
- }
814
-
815
- return /*#__PURE__*/React.createElement("div", {
816
- className: classes.responseContainer,
817
- style: _extends({}, toolbarStyle, {
818
- backgroundColor: '#E0E1E6'
819
- }),
820
- onMouseDown: this.onClickInside
821
- }, /*#__PURE__*/React.createElement("div", {
822
- className: classes.itemBuilder
823
- }, /*#__PURE__*/React.createElement(EditableHtml, {
824
- ref: ref => {
825
- if (ref) {
826
- this.editorRef = ref;
827
- }
828
- },
829
- autoFocus: true,
830
- autoSave: true,
831
- className: classes.respArea,
832
- toolbarOpts: {
833
- position: 'top',
834
- alwaysVisible: false,
835
- showDone: false,
836
- doneOn: 'blur'
837
- },
838
- markup: respAreaMarkup,
839
- onKeyDown: this.onKeyDown,
840
- languageCharactersProps: [{
841
- language: 'spanish'
842
- }, {
843
- language: 'special'
844
- }],
845
- onChange: respAreaMarkup => {
846
- if (this.preventDone) {
847
- return;
848
- }
849
-
850
- this.onRespAreaChange(respAreaMarkup);
851
- },
852
- onDone: val => {
853
- if (this.preventDone) {
854
- return;
855
- }
856
-
857
- this.onDone(val);
858
- },
859
- onBlur: e => {
860
- if (!e.relatedTarget) {
861
- return;
862
- }
863
-
864
- const isInInsertCharacter = !!(e.relatedTarget && e.relatedTarget.closest('.insert-character-dialog'));
865
- const isInDoneButton = !!(e.relatedTarget && e.relatedTarget.closest('[aria-label="Done"]'));
866
- this.preventDone = isInInsertCharacter || isInDoneButton;
867
-
868
- if (isInInsertCharacter || isInDoneButton) {
869
- this.clickedInside = true;
870
- }
871
-
872
- this.onBlur(e);
873
- },
874
- placeholder: "Add Choice",
875
- pluginProps: getPluginProps(responseAreaInputConfiguration == null ? void 0 : responseAreaInputConfiguration.inputConfiguration, baseInputConfiguration),
876
- spellCheck: spellCheck,
877
- uploadSoundSupport: uploadSoundSupport,
878
- mathMlOptions: mathMlOptions
879
- }), /*#__PURE__*/React.createElement(IconButton, {
880
- className: classes.addButton,
881
- onMouseDown: () => this.focusInput(),
882
- onClick: () => this.onAddChoice(),
883
- size: "small",
884
- "aria-label": "Add"
885
- }, /*#__PURE__*/React.createElement(default_1$3, {
886
- fontSize: "inherit"
887
- }))), choices && /*#__PURE__*/React.createElement("div", {
888
- className: classes.choicesHolder
889
- }, choices.map(({
890
- label,
891
- correct
892
- }, index) => /*#__PURE__*/React.createElement(MenuItem, {
893
- key: index,
894
- onClick: () => this.onSelectChoice(label, index),
895
- onRemoveChoice: () => this.onRemoveChoice(label, index),
896
- onEditChoice: () => this.onEditChoice(label, index),
897
- value: label,
898
- correct: correct
899
- }))));
900
- }
901
-
902
- }
903
- RespAreaToolbar.propTypes = {
904
- classes: PropTypes.object,
905
- node: PropTypes.object,
906
- uploadSoundSupport: PropTypes.object,
907
- onDone: PropTypes.func,
908
- choices: PropTypes.array,
909
- onAddChoice: PropTypes.func.isRequired,
910
- onCheck: PropTypes.func,
911
- onRemoveChoice: PropTypes.func.isRequired,
912
- onSelectChoice: PropTypes.func.isRequired,
913
- onToolbarDone: PropTypes.func.isRequired,
914
- value: PropTypes.shape({
915
- change: PropTypes.func.isRequired,
916
- document: PropTypes.shape({
917
- getNextText: PropTypes.func.isRequired
918
- })
919
- }),
920
- spellCheck: PropTypes.bool
921
- };
922
- const StyledRespAreaToolbar = withStyles(theme => ({
923
- responseContainer: {
924
- boxShadow: theme.shadows[2],
925
- borderRadius: '4px',
926
- width: '400px'
927
- },
928
- respArea: {
929
- borderRadius: '4px',
930
- backgroundColor: theme.palette.common.white,
931
- '& [data-slate-editor="true"]': {
932
- minHeight: 'initial !important'
933
- }
934
- },
935
- addButton: {
936
- fontSize: theme.typography.fontSize + 2,
937
- padding: theme.spacing.unit / 2,
938
- color: theme.palette.common.black,
939
- position: 'absolute',
940
- top: '50%',
941
- right: theme.spacing.unit * 2,
942
- transform: 'translate(0, -50%)'
943
- },
944
- choicesHolder: {
945
- display: 'flex',
946
- flexDirection: 'column',
947
- '& > div:last-child': {
948
- border: 'none'
949
- }
950
- },
951
- itemBuilder: {
952
- padding: theme.spacing.unit / 2,
953
- position: 'relative'
954
- }
955
- }))(RespAreaToolbar);
956
-
957
- const styles$1 = theme => ({
958
- responseArea: {
959
- paddingBottom: theme.spacing.unit * 2.5
960
- },
961
- errorText: {
962
- fontSize: theme.typography.fontSize - 2,
963
- color: theme.palette.error.main,
964
- paddingTop: theme.spacing.unit
965
- }
966
- });
967
-
968
- class ResponseAreaComponent extends React.Component {
969
- componentDidMount() {
970
- // eslint-disable-next-line react/no-find-dom-node
971
- const domNode = ReactDOM.findDOMNode(this);
972
- renderMath(domNode);
973
- }
974
-
975
- render() {
976
- const {
977
- editableHtmlProps,
978
- responseAreasError,
979
- responseAreaChoicesError,
980
- classes
981
- } = this.props;
982
- return /*#__PURE__*/React.createElement("div", {
983
- className: classes.responseArea
984
- }, /*#__PURE__*/React.createElement(EditableHtml, editableHtmlProps), responseAreasError && /*#__PURE__*/React.createElement("div", {
985
- className: classes.errorText
986
- }, responseAreasError), responseAreaChoicesError && /*#__PURE__*/React.createElement("div", {
987
- className: classes.errorText
988
- }, responseAreaChoicesError));
989
- }
990
-
991
- }
992
-
993
- ResponseAreaComponent.propTypes = {
994
- editableHtmlProps: PropTypes.object.isRequired,
995
- classes: PropTypes.object.isRequired,
996
- responseAreasError: PropTypes.string,
997
- responseAreaChoicesError: PropTypes.string
998
- };
999
- var ResponseAreaComponent$1 = withStyles(styles$1)(ResponseAreaComponent);
1000
-
1001
- const {
1002
- toggle,
1003
- Panel,
1004
- dropdown
1005
- } = settings;
1006
-
1007
- const styles = theme => ({
1008
- promptHolder: {
1009
- width: '100%',
1010
- paddingTop: theme.spacing.unit * 2,
1011
- marginBottom: theme.spacing.unit * 2
1012
- },
1013
- choiceRationaleHolder: {
1014
- width: '100%',
1015
- paddingTop: theme.spacing.unit / 2,
1016
- marginBottom: theme.spacing.unit * 2
1017
- },
1018
- markup: {
1019
- minHeight: '100px',
1020
- width: '100%',
1021
- '& [data-slate-editor="true"]': {
1022
- minHeight: '100px'
1023
- }
1024
- },
1025
- choiceConfiguration: {
1026
- paddingTop: theme.spacing.unit * 2,
1027
- paddingBottom: theme.spacing.unit * 2
1028
- },
1029
- text: {
1030
- fontSize: theme.typography.fontSize + 2,
1031
- marginRight: theme.spacing.unit
1032
- },
1033
- rationaleLabel: {
1034
- display: 'flex',
1035
- alignItems: 'center',
1036
- whiteSpace: 'break-spaces',
1037
- color: color.disabled(),
1038
- padding: 0,
1039
- fontSize: theme.typography.fontSize - 2,
1040
- lineHeight: 1
1041
- },
1042
- rationaleChoices: {
1043
- marginBottom: theme.spacing.unit * 2.5
1044
- },
1045
- panelDetails: {
1046
- display: 'block',
1047
- paddingTop: 0,
1048
- paddingBottom: 0
1049
- },
1050
- flexContainer: {
1051
- display: 'flex',
1052
- alignItems: 'center',
1053
- marginBottom: theme.spacing.unit
1054
- },
1055
- tooltip: {
1056
- fontSize: theme.typography.fontSize - 2,
1057
- whiteSpace: 'pre',
1058
- maxWidth: '500px'
1059
- },
1060
- errorText: {
1061
- fontSize: theme.typography.fontSize - 2,
1062
- color: theme.palette.error.main,
1063
- paddingTop: theme.spacing.unit
1064
- }
1065
- });
1066
-
1067
- const createElementFromHTML$1 = htmlString => {
1068
- const div = document.createElement('div');
1069
- div.innerHTML = (htmlString || '').trim();
1070
- return div;
1071
- };
1072
-
1073
- class Main extends React.Component {
1074
- constructor(...args) {
1075
- super(...args);
1076
- this.state = {
1077
- warning: {
1078
- open: false
1079
- }
1080
- };
1081
-
1082
- this.onModelChange = newVal => {
1083
- this.props.onModelChanged(_extends({}, this.props.model, newVal));
1084
- };
1085
-
1086
- this.onPromptChanged = prompt => {
1087
- this.onModelChange({
1088
- prompt
1089
- });
1090
- };
1091
-
1092
- this.onRationaleChanged = rationale => {
1093
- this.onModelChange({
1094
- rationale
1095
- });
1096
- };
1097
-
1098
- this.onChoiceRationaleChanged = (index, choice) => {
1099
- const {
1100
- model
1101
- } = this.props;
1102
- const indexOfChoice = model.choices && model.choices[index] && model.choices[index].findIndex(elem => elem.label === choice.label && elem.value === choice.value);
1103
- model.choices[index] && model.choices[index].splice(indexOfChoice, 1, choice);
1104
- this.onModelChange(model);
1105
- };
1106
-
1107
- this.onTeacherInstructionsChanged = teacherInstructions => {
1108
- this.onModelChange({
1109
- teacherInstructions
1110
- });
1111
- };
1112
-
1113
- this.onMarkupChanged = slateMarkup => {
1114
- this.onModelChange({
1115
- slateMarkup
1116
- });
1117
- };
1118
-
1119
- this.onCheck = callback => {
1120
- this.setState({
1121
- warning: {
1122
- open: true,
1123
- text: 'Response areas with under 2 options or with no correct answers will be discarded.',
1124
- onClose: () => {
1125
- this.setState({
1126
- warning: {
1127
- open: false
1128
- }
1129
- });
1130
- },
1131
- onConfirm: () => {
1132
- this.setState({
1133
- warning: {
1134
- open: false
1135
- }
1136
- }, callback);
1137
- }
1138
- }
1139
- });
1140
- };
1141
-
1142
- this.onChange = markup => {
1143
- const {
1144
- respAreaChoices
1145
- } = this.state;
1146
- const domMarkup = createElementFromHTML$1(markup);
1147
- const allRespAreas = domMarkup.querySelectorAll('[data-type="inline_dropdown"]');
1148
- const allChoices = {};
1149
- allRespAreas.forEach(el => {
1150
- allChoices[el.dataset.index] = el.dataset.value || '';
1151
- });
1152
- const existingRespAreaChoices = reduce(respAreaChoices, (obj, choices, key) => {
1153
- if (!isUndefined(allChoices[key])) {
1154
- obj[key] = respAreaChoices[key];
1155
- }
1156
-
1157
- return obj;
1158
- }, {});
1159
- const newRespAreaChoices = {};
1160
- let shouldWarn = false;
1161
- allRespAreas.forEach((el, index) => {
1162
- const newChoices = existingRespAreaChoices[el.dataset.index] || [];
1163
-
1164
- if (newChoices.length < 2 || !newChoices.find(c => c.correct)) {
1165
- el.remove();
1166
- shouldWarn = true;
1167
- } else {
1168
- newRespAreaChoices[index] = existingRespAreaChoices[el.dataset.index] || [];
1169
- el.dataset.index = index;
1170
- }
1171
- });
1172
-
1173
- if (shouldWarn) {
1174
- this.setState({
1175
- warning: {
1176
- open: true,
1177
- text: 'Response areas with under 2 options or with no correct answers will be discarded.',
1178
- onClose: () => {
1179
- this.setState({
1180
- warning: {
1181
- open: false
1182
- }
1183
- });
1184
- },
1185
- onConfirm: () => {
1186
- this.setState({
1187
- warning: {
1188
- open: false
1189
- }
1190
- }, () => this.onModelChange({
1191
- choices: cloneDeep(newRespAreaChoices),
1192
- slateMarkup: domMarkup.innerHTML
1193
- }));
1194
- }
1195
- }
1196
- });
1197
- } else {
1198
- this.onModelChange({
1199
- choices: cloneDeep(newRespAreaChoices),
1200
- slateMarkup: domMarkup.innerHTML
1201
- });
1202
- }
1203
- };
1204
-
1205
- this.onAddChoice = (index, label, choiceIndex) => {
1206
- var _respAreaChoices$inde;
1207
-
1208
- const {
1209
- respAreaChoices
1210
- } = this.state;
1211
- const {
1212
- maxResponseAreaChoices
1213
- } = this.props.configuration;
1214
-
1215
- if (respAreaChoices[index] && respAreaChoices[index].length >= maxResponseAreaChoices) {
1216
- this.setState({
1217
- warning: {
1218
- open: true,
1219
- text: `There are only ${maxResponseAreaChoices} answers allowed per choice.`,
1220
- onClose: undefined,
1221
- onConfirm: () => {
1222
- this.setState({
1223
- warning: {
1224
- open: false
1225
- }
1226
- });
1227
- }
1228
- }
1229
- });
1230
- return;
1231
- }
1232
-
1233
- if (!respAreaChoices[index]) {
1234
- respAreaChoices[index] = [];
1235
- } // check for duplicate answer, but exclude the one that is currently edited
1236
-
1237
-
1238
- if ((respAreaChoices[index] || []).find((r, idx) => r.label === label && idx !== choiceIndex)) {
1239
- // show warning for duplicated answers
1240
- this.setState({
1241
- warning: {
1242
- open: true,
1243
- text: 'Duplicate answers are not allowed.',
1244
- onClose: undefined,
1245
- onConfirm: () => {
1246
- this.setState({
1247
- warning: {
1248
- open: false
1249
- }
1250
- });
1251
- }
1252
- }
1253
- });
1254
- return;
1255
- }
1256
-
1257
- if (choiceIndex >= 0 && (_respAreaChoices$inde = respAreaChoices[index]) != null && _respAreaChoices$inde[choiceIndex]) {
1258
- // we need to update the choice label with the new value
1259
- respAreaChoices[index][choiceIndex].label = label;
1260
- } else {
1261
- // add a new choice
1262
- const value = respAreaChoices[index] && max(respAreaChoices[index].map(c => parseInt(c.value)).filter(val => !isNaN(val))) || 0;
1263
- respAreaChoices[index].push({
1264
- label,
1265
- value: `${value + 1}`,
1266
- correct: false
1267
- });
1268
- }
1269
-
1270
- this.onModelChange({
1271
- choices: cloneDeep(respAreaChoices)
1272
- });
1273
- };
1274
-
1275
- this.onRemoveChoice = (respIndex, index) => {
1276
- const {
1277
- respAreaChoices
1278
- } = this.state;
1279
- respAreaChoices[respIndex].splice(index, 1);
1280
- this.onModelChange({
1281
- choices: cloneDeep(respAreaChoices)
1282
- });
1283
- };
1284
-
1285
- this.onSelectChoice = (respIndex, selectedIndex) => {
1286
- const {
1287
- respAreaChoices
1288
- } = this.state;
1289
- respAreaChoices[respIndex] = respAreaChoices[respIndex].map((choice, index) => _extends({}, choice, {
1290
- correct: index === selectedIndex
1291
- }));
1292
- this.onModelChange({
1293
- choices: cloneDeep(respAreaChoices)
1294
- });
1295
- };
1296
- }
1297
-
1298
- componentDidMount() {
1299
- const {
1300
- model: {
1301
- choices
1302
- }
1303
- } = this.props;
1304
- this.setState({
1305
- respAreaChoices: cloneDeep(choices)
1306
- });
1307
- }
1308
-
1309
- UNSAFE_componentWillReceiveProps(nProps) {
1310
- const newState = {};
1311
-
1312
- if (!isEqual(nProps.model.choices, this.props.model.choices) || !isEqual(nProps.model.choices, this.state.respAreaChoices)) {
1313
- newState.respAreaChoices = cloneDeep(nProps.model.choices);
1314
- }
1315
-
1316
- if (!isEmpty(newState)) {
1317
- this.setState(newState);
1318
- }
1319
- }
1320
-
1321
- componentDidUpdate() {
1322
- //eslint-disable-next-line
1323
- const domNode = ReactDOM.findDOMNode(this);
1324
- renderMath(domNode);
1325
- }
1326
-
1327
- render() {
1328
- const {
1329
- warning
1330
- } = this.state;
1331
- const {
1332
- classes,
1333
- model,
1334
- configuration,
1335
- onConfigurationChanged,
1336
- imageSupport,
1337
- uploadSoundSupport
1338
- } = this.props;
1339
- const {
1340
- baseInputConfiguration = {},
1341
- choiceRationale = {},
1342
- contentDimensions = {},
1343
- lockChoiceOrder = {},
1344
- maxResponseAreas,
1345
- maxImageWidth = {},
1346
- maxImageHeight = {},
1347
- partialScoring = {},
1348
- prompt = {},
1349
- rationale = {},
1350
- settingsPanelDisabled,
1351
- spellCheck = {},
1352
- teacherInstructions = {},
1353
- template = {},
1354
- withRubric = {},
1355
- mathMlOptions = {},
1356
- language = {},
1357
- languageChoices = {},
1358
- responseAreaInputConfiguration = {}
1359
- } = configuration || {};
1360
- const {
1361
- choiceRationaleEnabled,
1362
- choices,
1363
- errors,
1364
- extraCSSRules,
1365
- promptEnabled,
1366
- rationaleEnabled,
1367
- spellCheckEnabled,
1368
- teacherInstructionsEnabled,
1369
- toolbarEditorPosition
1370
- } = model || {};
1371
- const {
1372
- prompt: promptError,
1373
- rationale: rationaleError,
1374
- responseAreasError,
1375
- responseAreaChoicesError,
1376
- teacherInstructions: teacherInstructionsError
1377
- } = errors || {};
1378
- const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
1379
- const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
1380
-
1381
- const renderChoiceRationale = () => (Object.keys(choices) || []).map((key, index) => /*#__PURE__*/React.createElement("div", {
1382
- key: key,
1383
- className: classes.rationaleChoices
1384
- }, /*#__PURE__*/React.createElement(ExpansionPanel, null, /*#__PURE__*/React.createElement(ExpansionPanelSummary, {
1385
- expandIcon: /*#__PURE__*/React.createElement(default_1$5, null)
1386
- }, /*#__PURE__*/React.createElement(Typography, {
1387
- className: classes.text
1388
- }, `Rationale for response area #${index + 1}`)), /*#__PURE__*/React.createElement(ExpansionPanelDetails, {
1389
- className: classes.panelDetails
1390
- }, (choices[key] || []).map(choice => /*#__PURE__*/React.createElement(React.Fragment, {
1391
- key: choice.label
1392
- }, /*#__PURE__*/React.createElement("span", {
1393
- className: classes.rationaleLabel,
1394
- dangerouslySetInnerHTML: {
1395
- __html: `${rationale.label} for ${choice.label} (${choice.correct ? 'correct' : 'incorrect'})`
1396
- }
1397
- }), /*#__PURE__*/React.createElement(InputContainer, {
1398
- className: classes.choiceRationaleHolder
1399
- }, /*#__PURE__*/React.createElement(EditableHtml, {
1400
- className: classes.prompt,
1401
- markup: choice.rationale || '',
1402
- spellCheck: spellCheckEnabled,
1403
- onChange: c => this.onChoiceRationaleChanged(key, _extends({}, choice, {
1404
- rationale: c
1405
- })),
1406
- imageSupport: imageSupport,
1407
- maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
1408
- maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
1409
- uploadSoundSupport: uploadSoundSupport,
1410
- mathMlOptions: mathMlOptions
1411
- }))))))));
1412
-
1413
- const toolbarOpts = {
1414
- position: toolbarEditorPosition === 'top' ? 'top' : 'bottom'
1415
- };
1416
- const validationMessage = generateValidationMessage(configuration);
1417
- const panelSettings = {
1418
- partialScoring: partialScoring.settings && toggle(partialScoring.label),
1419
- lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),
1420
- 'language.enabled': language.settings && toggle(language.label, true),
1421
- language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options)
1422
- };
1423
- const panelProperties = {
1424
- teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
1425
- rationaleEnabled: rationale.settings && toggle(rationale.label),
1426
- choiceRationaleEnabled: choiceRationale.settings && toggle(choiceRationale.label),
1427
- promptEnabled: prompt.settings && toggle(prompt.label),
1428
- spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
1429
- rubricEnabled: (withRubric == null ? void 0 : withRubric.settings) && toggle(withRubric == null ? void 0 : withRubric.label)
1430
- };
1431
-
1432
- const getPluginProps = (props = {}) => _extends({}, baseInputConfiguration, props);
1433
-
1434
- return /*#__PURE__*/React.createElement(layout.ConfigLayout, {
1435
- extraCSSRules: extraCSSRules,
1436
- dimensions: contentDimensions,
1437
- hideSettings: settingsPanelDisabled,
1438
- settings: /*#__PURE__*/React.createElement(Panel, {
1439
- model: model,
1440
- configuration: configuration,
1441
- onChangeModel: model => this.onModelChange(model),
1442
- onChangeConfiguration: configuration => onConfigurationChanged(configuration, true),
1443
- groups: {
1444
- Settings: panelSettings,
1445
- Properties: panelProperties
1446
- }
1447
- })
1448
- }, teacherInstructionsEnabled && /*#__PURE__*/React.createElement(InputContainer, {
1449
- label: teacherInstructions.label,
1450
- className: classes.promptHolder
1451
- }, /*#__PURE__*/React.createElement(EditableHtml, {
1452
- className: classes.prompt,
1453
- markup: model.teacherInstructions || '',
1454
- onChange: this.onTeacherInstructionsChanged,
1455
- imageSupport: imageSupport,
1456
- nonEmpty: false,
1457
- error: teacherInstructionsError,
1458
- toolbarOpts: toolbarOpts,
1459
- pluginProps: getPluginProps(teacherInstructions == null ? void 0 : teacherInstructions.inputConfiguration),
1460
- spellCheck: spellCheckEnabled,
1461
- maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
1462
- maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
1463
- uploadSoundSupport: uploadSoundSupport,
1464
- languageCharactersProps: [{
1465
- language: 'spanish'
1466
- }, {
1467
- language: 'special'
1468
- }],
1469
- mathMlOptions: mathMlOptions
1470
- }), teacherInstructionsError && /*#__PURE__*/React.createElement("div", {
1471
- className: classes.errorText
1472
- }, teacherInstructionsError)), promptEnabled && /*#__PURE__*/React.createElement(InputContainer, {
1473
- label: prompt.label,
1474
- className: classes.promptHolder
1475
- }, /*#__PURE__*/React.createElement(EditableHtml, {
1476
- className: classes.prompt,
1477
- markup: model.prompt,
1478
- onChange: this.onPromptChanged,
1479
- imageSupport: imageSupport,
1480
- nonEmpty: false,
1481
- disableUnderline: true,
1482
- error: promptError,
1483
- toolbarOpts: toolbarOpts,
1484
- pluginProps: getPluginProps(prompt == null ? void 0 : prompt.inputConfiguration),
1485
- spellCheck: spellCheckEnabled,
1486
- maxImageWidth: defaultImageMaxWidth,
1487
- maxImageHeight: defaultImageMaxHeight,
1488
- uploadSoundSupport: uploadSoundSupport,
1489
- languageCharactersProps: [{
1490
- language: 'spanish'
1491
- }, {
1492
- language: 'special'
1493
- }],
1494
- mathMlOptions: mathMlOptions
1495
- }), promptError && /*#__PURE__*/React.createElement("div", {
1496
- className: classes.errorText
1497
- }, promptError)), /*#__PURE__*/React.createElement("div", {
1498
- className: classes.flexContainer
1499
- }, /*#__PURE__*/React.createElement(Typography, {
1500
- className: classes.text,
1501
- component: 'div'
1502
- }, "Define Template, Choices, and Correct Responses"), /*#__PURE__*/React.createElement(Tooltip, {
1503
- classes: {
1504
- tooltip: classes.tooltip
1505
- },
1506
- disableFocusListener: true,
1507
- disableTouchListener: true,
1508
- placement: 'right',
1509
- title: validationMessage
1510
- }, /*#__PURE__*/React.createElement(default_1$4, {
1511
- fontSize: 'small',
1512
- color: 'primary'
1513
- }))), /*#__PURE__*/React.createElement(ResponseAreaComponent$1, {
1514
- responseAreasError: responseAreasError,
1515
- responseAreaChoicesError: responseAreaChoicesError,
1516
- editableHtmlProps: {
1517
- pluginProps: getPluginProps(template == null ? void 0 : template.inputConfiguration),
1518
- activePlugins: ALL_PLUGINS,
1519
- toolbarOpts: {
1520
- position: 'top'
1521
- },
1522
- responseAreaProps: {
1523
- type: 'inline-dropdown',
1524
- options: {
1525
- duplicates: true
1526
- },
1527
- maxResponseAreas: maxResponseAreas,
1528
- respAreaToolbar: (node, value, onToolbarDone) => {
1529
- const {
1530
- respAreaChoices
1531
- } = this.state;
1532
- return () => /*#__PURE__*/React.createElement(StyledRespAreaToolbar, {
1533
- onAddChoice: this.onAddChoice,
1534
- onCheck: this.onCheck,
1535
- onRemoveChoice: index => this.onRemoveChoice(node.data.get('index'), index),
1536
- onSelectChoice: index => this.onSelectChoice(node.data.get('index'), index),
1537
- node: node,
1538
- value: value,
1539
- onToolbarDone: onToolbarDone,
1540
- choices: respAreaChoices[node.data.get('index')],
1541
- spellCheck: spellCheckEnabled,
1542
- uploadSoundSupport: uploadSoundSupport,
1543
- mathMlOptions: mathMlOptions,
1544
- baseInputConfiguration: baseInputConfiguration,
1545
- responseAreaInputConfiguration: responseAreaInputConfiguration
1546
- });
1547
- }
1548
- },
1549
- spellCheck: spellCheckEnabled,
1550
- className: classes.markup,
1551
- markup: model.slateMarkup || '',
1552
- onChange: this.onChange,
1553
- imageSupport: imageSupport,
1554
- disableImageAlignmentButtons: true,
1555
- disabled: false,
1556
- highlightShape: false,
1557
- error: responseAreasError,
1558
- uploadSoundSupport: uploadSoundSupport,
1559
- languageCharactersProps: [{
1560
- language: 'spanish'
1561
- }, {
1562
- language: 'special'
1563
- }],
1564
- mathMlOptions: mathMlOptions
1565
- }
1566
- }), choiceRationaleEnabled && renderChoiceRationale(), rationaleEnabled && /*#__PURE__*/React.createElement(InputContainer, {
1567
- label: rationale.label,
1568
- className: classes.promptHolder
1569
- }, /*#__PURE__*/React.createElement(EditableHtml, {
1570
- className: classes.prompt,
1571
- markup: model.rationale || '',
1572
- onChange: this.onRationaleChanged,
1573
- imageSupport: imageSupport,
1574
- error: rationaleError,
1575
- toolbarOpts: toolbarOpts,
1576
- pluginProps: getPluginProps(rationale == null ? void 0 : rationale.inputConfiguration),
1577
- spellCheck: spellCheckEnabled,
1578
- maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
1579
- maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
1580
- uploadSoundSupport: uploadSoundSupport,
1581
- languageCharactersProps: [{
1582
- language: 'spanish'
1583
- }, {
1584
- language: 'special'
1585
- }],
1586
- mathMlOptions: mathMlOptions
1587
- }), rationaleError && /*#__PURE__*/React.createElement("div", {
1588
- className: classes.errorText
1589
- }, rationaleError)), /*#__PURE__*/React.createElement(AlertDialog, {
1590
- open: warning.open,
1591
- title: "Warning",
1592
- text: warning.text,
1593
- onClose: warning.onClose,
1594
- onConfirm: warning.onConfirm
1595
- }));
1596
- }
1597
-
1598
- }
1599
- Main.propTypes = {
1600
- configuration: PropTypes.object.isRequired,
1601
- model: PropTypes.object.isRequired,
1602
- disableSidePanel: PropTypes.bool,
1603
- onModelChanged: PropTypes.func.isRequired,
1604
- onConfigurationChanged: PropTypes.func.isRequired,
1605
- classes: PropTypes.object.isRequired,
1606
- imageSupport: PropTypes.shape({
1607
- add: PropTypes.func.isRequired,
1608
- delete: PropTypes.func.isRequired
1609
- }),
1610
- uploadSoundSupport: PropTypes.shape({
1611
- add: PropTypes.func.isRequired,
1612
- delete: PropTypes.func.isRequired
1613
- })
1614
- };
1615
- const Styled = withStyles(styles)(Main);
1616
-
1617
- var sensibleDefaults = {
1618
- model: {
1619
- alternateResponse: {},
1620
- choiceRationaleEnabled: true,
1621
- choices: {},
1622
- disabled: false,
1623
- displayType: 'block',
1624
- markup: '',
1625
- mode: 'gather',
1626
- prompt: '',
1627
- promptEnabled: true,
1628
- rationale: '',
1629
- rationaleEnabled: true,
1630
- shuffle: true,
1631
- studentInstructionsEnabled: true,
1632
- teacherInstructions: '',
1633
- teacherInstructionsEnabled: true,
1634
- toolbarEditorPosition: 'bottom'
1635
- },
1636
- configuration: {
1637
- baseInputConfiguration: {
1638
- audio: {
1639
- disabled: false
1640
- },
1641
- video: {
1642
- disabled: false
1643
- },
1644
- image: {
1645
- disabled: false
1646
- },
1647
- h3: {
1648
- disabled: true
1649
- },
1650
- blockquote: {
1651
- disabled: true
1652
- },
1653
- textAlign: {
1654
- disabled: true
1655
- },
1656
- showParagraphs: {
1657
- disabled: false
1658
- },
1659
- separateParagraphs: {
1660
- disabled: true
1661
- }
1662
- },
1663
- prompt: {
1664
- settings: true,
1665
- label: 'Prompt',
1666
- required: false,
1667
- inputConfiguration: {
1668
- audio: {
1669
- disabled: false
1670
- },
1671
- video: {
1672
- disabled: false
1673
- },
1674
- image: {
1675
- disabled: false
1676
- }
1677
- }
1678
- },
1679
- responseAreaInputConfiguration: {
1680
- inputConfiguration: {
1681
- audio: {
1682
- disabled: true
1683
- },
1684
- video: {
1685
- disabled: true
1686
- },
1687
- image: {
1688
- disabled: true
1689
- },
1690
- table: {
1691
- disabled: true
1692
- },
1693
- ul_list: {
1694
- disabled: true
1695
- },
1696
- ol_list: {
1697
- disabled: true
1698
- }
1699
- }
1700
- },
1701
- settingsPanelDisabled: false,
1702
- spellCheck: {
1703
- label: 'Spellcheck',
1704
- settings: false,
1705
- enabled: true
1706
- },
1707
- lockChoiceOrder: {
1708
- settings: true,
1709
- label: 'Lock Choice Order'
1710
- },
1711
- partialScoring: {
1712
- settings: false,
1713
- label: 'Allow Partial Scoring'
1714
- },
1715
- rationale: {
1716
- settings: true,
1717
- label: 'Rationale',
1718
- required: false,
1719
- inputConfiguration: {
1720
- audio: {
1721
- disabled: false
1722
- },
1723
- video: {
1724
- disabled: false
1725
- },
1726
- image: {
1727
- disabled: false
1728
- }
1729
- }
1730
- },
1731
- teacherInstructions: {
1732
- settings: true,
1733
- label: 'Teacher Instructions',
1734
- required: false,
1735
- inputConfiguration: {
1736
- audio: {
1737
- disabled: false
1738
- },
1739
- video: {
1740
- disabled: false
1741
- },
1742
- image: {
1743
- disabled: false
1744
- }
1745
- }
1746
- },
1747
- template: {
1748
- inputConfiguration: {
1749
- audio: {
1750
- disabled: false
1751
- },
1752
- video: {
1753
- disabled: false
1754
- },
1755
- image: {
1756
- disabled: false
1757
- }
1758
- }
1759
- },
1760
- choiceRationale: {
1761
- settings: true,
1762
- label: 'Choice Rationale'
1763
- },
1764
- toolbarEditorPosition: {
1765
- settings: false,
1766
- label: 'Toolbar Editor Position'
1767
- },
1768
- maxResponseAreas: 10,
1769
- maxResponseAreaChoices: 10,
1770
- maxImageWidth: {
1771
- teacherInstructions: 300,
1772
- prompt: 300,
1773
- rationale: 300
1774
- },
1775
- maxImageHeight: {
1776
- teacherInstructions: 300,
1777
- prompt: 300,
1778
- rationale: 300
1779
- },
1780
- withRubric: {
1781
- settings: false,
1782
- label: 'Add Rubric'
1783
- },
1784
- mathMlOptions: {
1785
- mmlOutput: false,
1786
- mmlEditing: false
1787
- },
1788
- language: {
1789
- settings: false,
1790
- label: 'Specify Language',
1791
- enabled: false
1792
- },
1793
- languageChoices: {
1794
- label: 'Language Choices',
1795
- options: []
1796
- }
1797
- }
1798
- };
1799
-
1800
- const tSymbols = 'imes|riangle|an|heta|herefore'; // do not remove \n from \nthroot, \nparallel, \ncong, \napprox, \neq, \ne or \nsim
1801
-
1802
- const nSymbols = 'throot|parallel|cong|approx|eq|e|sim'; // match all \t and \n that are not part of math symbols that starts with \t or \n
1803
-
1804
- const matchTabAndNewLine = new RegExp(`(\\t(?!${tSymbols}))|(\\n(?!${nSymbols}))|(\\\\t(?!${tSymbols}))|(\\\\n(?!${nSymbols}))`, 'g');
1805
- const removeUnwantedCharacters = markup => markup.replace(matchTabAndNewLine, '').replace(/\\"/g, '"').replace(/\\\//g, '/');
1806
- const createElementFromHTML = htmlString => {
1807
- const div = document.createElement('div');
1808
- div.innerHTML = htmlString.trim();
1809
- return div;
1810
- };
1811
- const processMarkup = markup => {
1812
- const newMarkup = removeUnwantedCharacters(markup);
1813
- const slateMarkup = createElementFromHTML(newMarkup);
1814
- slateMarkup.querySelectorAll('[data-type="inline_dropdown"]').forEach(s => {
1815
- s.replaceWith(`{{${s.dataset.index}}}`);
1816
- });
1817
- return slateMarkup.innerHTML;
1818
- };
1819
- const REGEX = /\{\{(\d+)\}\}/g;
1820
- const createSlateMarkup = (markup, choices) => {
1821
- const newMarkup = removeUnwantedCharacters(markup);
1822
-
1823
- const createSelect = index => {
1824
- let correctChoice = choices[index] && choices[index].find(c => c.correct);
1825
-
1826
- if (!correctChoice || !correctChoice.value) {
1827
- correctChoice = {
1828
- id: '',
1829
- value: '',
1830
- label: ''
1831
- };
1832
- }
1833
-
1834
- return `<span data-type="inline_dropdown" data-index="${index}" data-value="${escape(correctChoice.label)}"></span>`;
1835
- };
1836
-
1837
- return newMarkup.replace(REGEX, (match, g) => {
1838
- return createSelect(g);
1839
- });
1840
- };
1841
-
1842
- const log = debug('multiple-choice:configure');
1843
- class InlineDropdown extends HTMLElement {
1844
- constructor() {
1845
- super();
1846
- this._model = InlineDropdown.prepareModel();
1847
- this._configuration = sensibleDefaults.configuration;
1848
- this.onModelChanged = this.onModelChanged.bind(this);
1849
- this.onConfigurationChanged = this.onConfigurationChanged.bind(this);
1850
- }
1851
-
1852
- set model(s) {
1853
- this._model = InlineDropdown.prepareModel(s);
1854
-
1855
- this._render();
1856
- }
1857
-
1858
- set configuration(c) {
1859
- var _c$language;
1860
-
1861
- this._configuration = defaults(c, sensibleDefaults.configuration); // if language:enabled is true, then the corresponding default item model should include a language value;
1862
- // if it is false, then the language field should be omitted from the item model.
1863
- // if a default item model includes a language value (e.g., en_US) and the corresponding authoring view settings have language:settings = true,
1864
- // then (a) language:enabled should also be true, and (b) that default language value should be represented in languageChoices[] (as a key).
1865
-
1866
- if ((_c$language = c.language) != null && _c$language.enabled) {
1867
- var _c$languageChoices, _c$languageChoices$op;
1868
-
1869
- if ((_c$languageChoices = c.languageChoices) != null && (_c$languageChoices$op = _c$languageChoices.options) != null && _c$languageChoices$op.length) {
1870
- this._model.language = c.languageChoices.options[0].value;
1871
- }
1872
- } else if (c.language.settings && this._model.language) {
1873
- this._configuration.language.enabled = true;
1874
-
1875
- if (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) {
1876
- this._configuration.languageChoices.options = [];
1877
- } // check if the language is already included in the languageChoices.options array
1878
- // and if not, then add it.
1879
-
1880
-
1881
- if (!this._configuration.languageChoices.options.find(option => option.value === this._model.language)) {
1882
- this._configuration.languageChoices.options.push({
1883
- value: this._model.language,
1884
- label: this._model.language
1885
- });
1886
- }
1887
- } else {
1888
- delete this._model.language;
1889
- }
1890
-
1891
- this._render();
1892
- }
1893
-
1894
- set disableSidePanel(s) {
1895
- this._disableSidePanel = s;
1896
-
1897
- this._render();
1898
- }
1899
-
1900
- dispatchModelUpdated(reset) {
1901
- const resetValue = !!reset;
1902
- this.dispatchEvent(new ModelUpdatedEvent(this._model, resetValue));
1903
- }
1904
-
1905
- onModelChanged(m, reset) {
1906
- this._model = InlineDropdown.prepareModel(m);
1907
-
1908
- this._render();
1909
-
1910
- this.dispatchModelUpdated(reset);
1911
- }
1912
-
1913
- onConfigurationChanged(c) {
1914
- this._configuration = c;
1915
-
1916
- this._render();
1917
- }
1918
- /** @param {done, progress, file} handler */
1919
-
1920
-
1921
- insertImage(handler) {
1922
- this.dispatchEvent(new InsertImageEvent(handler));
1923
- }
1924
-
1925
- onDeleteImage(src, done) {
1926
- this.dispatchEvent(new DeleteImageEvent(src, done));
1927
- }
1928
-
1929
- insertSound(handler) {
1930
- this.dispatchEvent(new InsertSoundEvent(handler));
1931
- }
1932
-
1933
- onDeleteSound(src, done) {
1934
- this.dispatchEvent(new DeleteSoundEvent(src, done));
1935
- }
1936
-
1937
- _render() {
1938
- log('_render');
1939
- let element = /*#__PURE__*/React.createElement(Styled, {
1940
- model: this._model,
1941
- configuration: this._configuration,
1942
- onModelChanged: this.onModelChanged,
1943
- onConfigurationChanged: this.onConfigurationChanged,
1944
- disableSidePanel: this._disableSidePanel,
1945
- imageSupport: {
1946
- add: this.insertImage.bind(this),
1947
- delete: this.onDeleteImage.bind(this)
1948
- },
1949
- uploadSoundSupport: {
1950
- add: this.insertSound.bind(this),
1951
- delete: this.onDeleteSound.bind(this)
1952
- }
1953
- });
1954
- ReactDOM.render(element, this);
1955
- }
1956
-
1957
- }
1958
-
1959
- InlineDropdown.prepareModel = (model = {}) => {
1960
- const currModal = _extends({}, sensibleDefaults.model, model);
1961
-
1962
- const slateMarkup = model.slateMarkup || createSlateMarkup(currModal.markup, currModal.choices);
1963
- const markup = processMarkup(slateMarkup);
1964
- return _extends({}, currModal, {
1965
- slateMarkup,
1966
- markup
1967
- /*...processedMarkup,*/
1968
-
1969
- });
1970
- };
1971
-
1972
- export { InlineDropdown as default };
1973
- //# sourceMappingURL=configure.js.map