@onereach/ui-components 8.3.0 → 8.3.1

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 (262) hide show
  1. package/dist/bundled/v2/components/OrBottomSheetV3/OrBottomSheet.js +1 -1
  2. package/dist/bundled/v2/components/OrBottomSheetV3/hooks/useBottomSheetSwipeState.js +1 -1
  3. package/dist/bundled/v2/components/OrCheckboxTreeV3/OrCheckboxTree.js +1 -1
  4. package/dist/bundled/v2/components/OrCode/OrCode.js +1 -1
  5. package/dist/bundled/v2/components/OrColorPicker/OrColorPicker.js +2 -2
  6. package/dist/bundled/v2/components/OrConfirm/OrConfirm.js +3 -3
  7. package/dist/bundled/v2/components/OrConfirmV3/OrConfirm.js +3 -3
  8. package/dist/bundled/v2/components/OrDatePickerV3/OrDatePicker.js +2 -2
  9. package/dist/bundled/v2/components/OrDateRangePickerV3/OrDateRangePicker.js +2 -2
  10. package/dist/bundled/v2/components/OrDateTimePicker/OrDateTimePicker.js +1 -1
  11. package/dist/bundled/v2/components/OrDateTimePickerV3/OrDateTimePicker.js +3 -3
  12. package/dist/bundled/v2/components/OrDateTimePickerV3/index.js +3 -3
  13. package/dist/bundled/v2/components/OrInlineTextEdit/OrInlineTextEdit.js +1 -1
  14. package/dist/bundled/v2/components/OrListV3/OrList.js +1 -1
  15. package/dist/bundled/v2/components/OrListV3/index.js +1 -1
  16. package/dist/bundled/v2/components/OrLoaderV3/OrLoader.js +1 -1
  17. package/dist/bundled/v2/components/OrModal/OrModal.js +2 -2
  18. package/dist/bundled/v2/components/OrOverflowMenu/OrOverflowMenu.js +2 -2
  19. package/dist/bundled/v2/components/OrOverlayV3/OrOverlay.js +1 -1
  20. package/dist/bundled/v2/components/OrPassword/OrPassword.js +1 -1
  21. package/dist/bundled/v2/components/OrPopoverV3/OrPopover.js +1 -1
  22. package/dist/bundled/v2/components/OrProgressV3/OrProgress.js +1 -1
  23. package/dist/bundled/v2/components/OrRangeSliderV3/OrRangeSlider.js +2 -2
  24. package/dist/bundled/v2/components/OrResizeablePanelV3/OrResizeablePanel.js +1 -1
  25. package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.js +4 -9474
  26. package/dist/bundled/v2/components/OrSearch/OrSearch.js +1 -1
  27. package/dist/bundled/v2/components/OrSearchV3/OrSearch.js +1 -1
  28. package/dist/bundled/v2/components/OrSelect/OrSelect.js +1 -1
  29. package/dist/bundled/v2/components/OrSelectV3/OrSelect.js +1 -1
  30. package/dist/bundled/v2/components/OrSidebar/OrSidebar.js +1 -1
  31. package/dist/bundled/v2/components/OrSlider/OrSlider.js +1 -1
  32. package/dist/bundled/v2/components/OrSliderV3/OrSlider.js +2 -2
  33. package/dist/bundled/v2/components/OrTabsV3/OrTabs.js +1 -1
  34. package/dist/bundled/v2/components/OrTagInputV3/OrTagInput.js +1 -1
  35. package/dist/bundled/v2/components/OrTimePickerV3/OrTimePicker.js +2 -2
  36. package/dist/bundled/v2/components/OrTimeRangePickerV3/OrTimeRangePicker.js +2 -2
  37. package/dist/bundled/v2/components/OrToast/Timer.js +1 -1
  38. package/dist/bundled/v2/components/OrToast/composable/useToastEventBus.js +2 -2
  39. package/dist/bundled/v2/components/OrToastContainer/OrToastContainer.js +1 -1
  40. package/dist/bundled/v2/components/OrToastContainerV3/OrToastContainer.js +1 -1
  41. package/dist/bundled/v2/components/OrToastV3/Timer.js +1 -1
  42. package/dist/bundled/v2/components/OrToastV3/composable/useToastEventBus.js +2 -2
  43. package/dist/bundled/v2/components/OrTreeV3/OrTree.js +1 -1
  44. package/dist/bundled/v2/components/index.js +4 -4
  45. package/dist/bundled/v2/hooks/useOverflow.js +1 -1
  46. package/dist/bundled/v2/hooks/usePopoverState.js +1 -1
  47. package/dist/bundled/v2/hooks/useResponsive/useResponsive.js +1 -1
  48. package/dist/bundled/v2/{index-39fe2838.js → index-5564585f.js} +1 -1
  49. package/dist/bundled/v2/{index-adc8aac4.js → index-7121b6d0.js} +1 -1
  50. package/dist/bundled/v2/{index-f29777b6.js → index-c1efbf6a.js} +1 -1
  51. package/dist/bundled/v2/index.js +4 -4
  52. package/dist/bundled/v2/{useFocusTrap-1bc572f0.js → useFocusTrap-f810e0ea.js} +2 -2
  53. package/dist/bundled/v3/{OrBottomSheet.vue_vue_type_script_lang-8125362b.js → OrBottomSheet.vue_vue_type_script_lang-248139f6.js} +2 -2
  54. package/dist/bundled/v3/{OrButton.vue_vue_type_script_lang-2ec4da42.js → OrButton.vue_vue_type_script_lang-dfeef2d0.js} +1 -1
  55. package/dist/bundled/v3/{OrCardCollection.vue_vue_type_script_lang-417aadd9.js → OrCardCollection.vue_vue_type_script_lang-20f91db4.js} +1 -1
  56. package/dist/bundled/v3/{OrCardCollection.vue_vue_type_script_lang-800d3d73.js → OrCardCollection.vue_vue_type_script_lang-b6e741bc.js} +3 -3
  57. package/dist/bundled/v3/{OrCheckboxGroup.vue_vue_type_script_lang-038398e8.js → OrCheckboxGroup.vue_vue_type_script_lang-0622d8c3.js} +1 -1
  58. package/dist/bundled/v3/{OrCheckboxTree.vue_vue_type_script_lang-d04a8b5d.js → OrCheckboxTree.vue_vue_type_script_lang-b939bd8a.js} +2 -2
  59. package/dist/bundled/v3/{OrCode.vue_vue_type_script_lang-a5344989.js → OrCode.vue_vue_type_script_lang-6608e26d.js} +2 -2
  60. package/dist/bundled/v3/{OrCode.vue_vue_type_script_lang-a24a226f.js → OrCode.vue_vue_type_script_lang-8376244c.js} +2 -2
  61. package/dist/bundled/v3/{OrColorPicker.vue_vue_type_script_lang-fefa6bd8.js → OrColorPicker.vue_vue_type_script_lang-b030a96d.js} +2 -2
  62. package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-32893b65.js → OrConfirm.vue_vue_type_script_lang-21ef5ff5.js} +6 -6
  63. package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-8635648d.js → OrConfirm.vue_vue_type_script_lang-2887602e.js} +4 -4
  64. package/dist/bundled/v3/{OrContextMenu.vue_vue_type_script_lang-4302053a.js → OrContextMenu.vue_vue_type_script_lang-5a64e05d.js} +1 -1
  65. package/dist/bundled/v3/{OrDatePicker.vue_vue_type_script_lang-7bf77750.js → OrDatePicker.vue_vue_type_script_lang-e59aa8b4.js} +5 -5
  66. package/dist/bundled/v3/{OrDateRangePicker.vue_vue_type_script_lang-2ae06e4c.js → OrDateRangePicker.vue_vue_type_script_lang-736e93bd.js} +4 -4
  67. package/dist/bundled/v3/{OrDateTimePicker.vue_vue_type_script_lang-b69e0100.js → OrDateTimePicker.vue_vue_type_script_lang-0542cccc.js} +1 -1
  68. package/dist/bundled/v3/{OrDateTimePicker.vue_vue_type_script_lang-03d9acba.js → OrDateTimePicker.vue_vue_type_script_lang-238e7a86.js} +7 -7
  69. package/dist/bundled/v3/{OrDateTimePickerMonthSelect.vue_vue_type_script_lang-951355b0.js → OrDateTimePickerMonthSelect.vue_vue_type_script_lang-f5d0e738.js} +3 -3
  70. package/dist/bundled/v3/{OrDateTimePickerPopoverHeader-5afb5cb6.js → OrDateTimePickerPopoverHeader-57dbb127.js} +2 -2
  71. package/dist/bundled/v3/{OrDateTimePickerPopoverHeader.vue_vue_type_script_lang-e1e72065.js → OrDateTimePickerPopoverHeader.vue_vue_type_script_lang-40a2de7e.js} +1 -1
  72. package/dist/bundled/v3/{OrDateTimePickerTimeSelect-fa69d6bc.js → OrDateTimePickerTimeSelect-178aa93a.js} +1 -1
  73. package/dist/bundled/v3/{OrDateTimePickerTimeSelect.vue_vue_type_script_lang-83d6af6c.js → OrDateTimePickerTimeSelect.vue_vue_type_script_lang-636aa4a8.js} +1 -1
  74. package/dist/bundled/v3/{OrIconButton.vue_vue_type_script_lang-dc078574.js → OrIconButton.vue_vue_type_script_lang-6c4f3216.js} +1 -1
  75. package/dist/bundled/v3/{OrInlineInput.vue_vue_type_script_lang-efbfd166.js → OrInlineInput.vue_vue_type_script_lang-a678b2c3.js} +1 -1
  76. package/dist/bundled/v3/{OrInlineTextEdit.vue_vue_type_script_lang-ae2c5e4c.js → OrInlineTextEdit.vue_vue_type_script_lang-d2f3ad39.js} +1 -1
  77. package/dist/bundled/v3/{OrInlineTextarea.vue_vue_type_script_lang-6ed5261f.js → OrInlineTextarea.vue_vue_type_script_lang-75a4d0b4.js} +1 -1
  78. package/dist/bundled/v3/{OrInput.vue_vue_type_script_lang-98ef7291.js → OrInput.vue_vue_type_script_lang-2520e0f2.js} +2 -2
  79. package/dist/bundled/v3/{OrList.vue_vue_type_script_lang-9ccd7172.js → OrList.vue_vue_type_script_lang-4218ec79.js} +1 -1
  80. package/dist/bundled/v3/{OrLoader.vue_vue_type_script_lang-7459ba26.js → OrLoader.vue_vue_type_script_lang-52edc8f8.js} +1 -1
  81. package/dist/bundled/v3/{OrMenu.vue_vue_type_script_lang-f11fa811.js → OrMenu.vue_vue_type_script_lang-8a3c6cfc.js} +1 -1
  82. package/dist/bundled/v3/{OrModal.vue_vue_type_script_lang-0900c482.js → OrModal.vue_vue_type_script_lang-70904ce1.js} +2 -2
  83. package/dist/bundled/v3/{OrModal.vue_vue_type_script_lang-760e81a9.js → OrModal.vue_vue_type_script_lang-9b908bb2.js} +2 -2
  84. package/dist/bundled/v3/{OrNotification.vue_vue_type_script_lang-358a8c8f.js → OrNotification.vue_vue_type_script_lang-4d7bb6fd.js} +1 -1
  85. package/dist/bundled/v3/{OrOverflowMenu.vue_vue_type_script_lang-d6a366b4.js → OrOverflowMenu.vue_vue_type_script_lang-5bde29a6.js} +2 -2
  86. package/dist/bundled/v3/{OrOverlay.vue_vue_type_script_lang-0e2b6542.js → OrOverlay.vue_vue_type_script_lang-4a0cd054.js} +1 -1
  87. package/dist/bundled/v3/{OrPagination.vue_vue_type_script_lang-0a7b45ee.js → OrPagination.vue_vue_type_script_lang-dcc37a32.js} +2 -2
  88. package/dist/bundled/v3/{OrPassword.vue_vue_type_script_lang-4eb18564.js → OrPassword.vue_vue_type_script_lang-1165ec6c.js} +1 -1
  89. package/dist/bundled/v3/{OrPopover.vue_vue_type_script_lang-89baa0c9.js → OrPopover.vue_vue_type_script_lang-cb38a064.js} +2 -2
  90. package/dist/bundled/v3/{OrProgress.vue_vue_type_script_lang-21e31192.js → OrProgress.vue_vue_type_script_lang-4b93a66e.js} +1 -1
  91. package/dist/bundled/v3/{OrRangeSlider.vue_vue_type_script_lang-3ca2a3e9.js → OrRangeSlider.vue_vue_type_script_lang-206b8321.js} +3 -3
  92. package/dist/bundled/v3/{OrResizeablePanel.vue_vue_type_script_lang-9bbd20fa.js → OrResizeablePanel.vue_vue_type_script_lang-ce7a2c31.js} +2 -2
  93. package/dist/bundled/v3/OrRichTextEditor.vue_vue_type_script_lang-ee6edbe6.js +1910 -0
  94. package/dist/bundled/v3/{OrSearch.vue_vue_type_script_lang-d1f7c334.js → OrSearch.vue_vue_type_script_lang-245c9614.js} +1 -1
  95. package/dist/bundled/v3/{OrSearch.vue_vue_type_script_lang-ccdc384e.js → OrSearch.vue_vue_type_script_lang-33e6f81a.js} +2 -2
  96. package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-d41fe97f.js → OrSelect.vue_vue_type_script_lang-4b6e13dd.js} +6 -6
  97. package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-95e88b3b.js → OrSelect.vue_vue_type_script_lang-baf7c270.js} +1 -1
  98. package/dist/bundled/v3/{OrSidebar.vue_vue_type_script_lang-c9607d4f.js → OrSidebar.vue_vue_type_script_lang-12bfe1fb.js} +1 -1
  99. package/dist/bundled/v3/{OrSidebar.vue_vue_type_script_lang-5cdae1e4.js → OrSidebar.vue_vue_type_script_lang-d6e95246.js} +1 -1
  100. package/dist/bundled/v3/{OrSlider.vue_vue_type_script_lang-777879e0.js → OrSlider.vue_vue_type_script_lang-ae4652e3.js} +1 -1
  101. package/dist/bundled/v3/{OrSlider.vue_vue_type_script_lang-2fa6f84a.js → OrSlider.vue_vue_type_script_lang-e2eb7acc.js} +3 -3
  102. package/dist/bundled/v3/{OrSorting.vue_vue_type_script_lang-e22393ba.js → OrSorting.vue_vue_type_script_lang-cbce5820.js} +2 -2
  103. package/dist/bundled/v3/{OrSwitch.vue_vue_type_script_lang-c117cd4c.js → OrSwitch.vue_vue_type_script_lang-9e9e15d1.js} +1 -1
  104. package/dist/bundled/v3/{OrTabs.vue_vue_type_script_lang-8d55d906.js → OrTabs.vue_vue_type_script_lang-ab443a23.js} +2 -2
  105. package/dist/bundled/v3/{OrTag.vue_vue_type_script_lang-13157498.js → OrTag.vue_vue_type_script_lang-27978933.js} +1 -1
  106. package/dist/bundled/v3/{OrTagInput.vue_vue_type_script_lang-13cf2e64.js → OrTagInput.vue_vue_type_script_lang-af84dfd0.js} +3 -3
  107. package/dist/bundled/v3/{OrTags.vue_vue_type_script_lang-ff60f3fc.js → OrTags.vue_vue_type_script_lang-15f2054e.js} +3 -3
  108. package/dist/bundled/v3/{OrTimePicker.vue_vue_type_script_lang-a9992a9a.js → OrTimePicker.vue_vue_type_script_lang-017d79ec.js} +5 -5
  109. package/dist/bundled/v3/{OrTimeRangePicker.vue_vue_type_script_lang-28686ff3.js → OrTimeRangePicker.vue_vue_type_script_lang-d4690ca9.js} +4 -4
  110. package/dist/bundled/v3/{OrToastContainer.vue_vue_type_script_lang-bb6ef8da.js → OrToastContainer.vue_vue_type_script_lang-7a137b51.js} +1 -1
  111. package/dist/bundled/v3/{OrToastContainer.vue_vue_type_script_lang-b474df01.js → OrToastContainer.vue_vue_type_script_lang-b019a53c.js} +1 -1
  112. package/dist/bundled/v3/{OrTooltip.vue_vue_type_script_lang-491196cd.js → OrTooltip.vue_vue_type_script_lang-8ae35930.js} +1 -1
  113. package/dist/bundled/v3/{OrTree.vue_vue_type_script_lang-d3b62b95.js → OrTree.vue_vue_type_script_lang-f6e6d6ac.js} +2 -2
  114. package/dist/bundled/v3/components/OrBottomSheetV3/OrBottomSheet.js +2 -2
  115. package/dist/bundled/v3/components/OrBottomSheetV3/hooks/useBottomSheetSwipeState.js +1 -1
  116. package/dist/bundled/v3/components/OrBottomSheetV3/index.js +1 -1
  117. package/dist/bundled/v3/components/OrButtonV3/OrButton.js +2 -2
  118. package/dist/bundled/v3/components/OrButtonV3/index.js +1 -1
  119. package/dist/bundled/v3/components/OrCardCollection/OrCardCollection.js +2 -2
  120. package/dist/bundled/v3/components/OrCardCollection/index.js +1 -1
  121. package/dist/bundled/v3/components/OrCardCollectionV3/OrCardCollection.js +2 -2
  122. package/dist/bundled/v3/components/OrCardCollectionV3/index.js +1 -1
  123. package/dist/bundled/v3/components/OrCheckboxGroupV3/OrCheckboxGroup.js +2 -2
  124. package/dist/bundled/v3/components/OrCheckboxGroupV3/index.js +1 -1
  125. package/dist/bundled/v3/components/OrCheckboxTreeV3/OrCheckboxTree.js +2 -2
  126. package/dist/bundled/v3/components/OrCheckboxTreeV3/index.js +1 -1
  127. package/dist/bundled/v3/components/OrCode/OrCode.js +2 -2
  128. package/dist/bundled/v3/components/OrCode/index.js +1 -1
  129. package/dist/bundled/v3/components/OrCodeV3/OrCode.js +2 -2
  130. package/dist/bundled/v3/components/OrCodeV3/index.js +1 -1
  131. package/dist/bundled/v3/components/OrColorPicker/OrColorPicker.js +2 -2
  132. package/dist/bundled/v3/components/OrColorPicker/index.js +1 -1
  133. package/dist/bundled/v3/components/OrConfirm/OrConfirm.js +2 -2
  134. package/dist/bundled/v3/components/OrConfirm/index.js +1 -1
  135. package/dist/bundled/v3/components/OrConfirmV3/OrConfirm.js +2 -2
  136. package/dist/bundled/v3/components/OrConfirmV3/index.js +1 -1
  137. package/dist/bundled/v3/components/OrContextMenuV3/OrContextMenu.js +2 -2
  138. package/dist/bundled/v3/components/OrContextMenuV3/index.js +1 -1
  139. package/dist/bundled/v3/components/OrDatePickerV3/OrDatePicker.js +2 -2
  140. package/dist/bundled/v3/components/OrDatePickerV3/index.js +1 -1
  141. package/dist/bundled/v3/components/OrDateRangePickerV3/OrDateRangePicker.js +2 -2
  142. package/dist/bundled/v3/components/OrDateRangePickerV3/index.js +1 -1
  143. package/dist/bundled/v3/components/OrDateTimePicker/OrDateTimePicker.js +2 -2
  144. package/dist/bundled/v3/components/OrDateTimePicker/index.js +1 -1
  145. package/dist/bundled/v3/components/OrDateTimePickerV3/OrDateTimePicker.js +2 -2
  146. package/dist/bundled/v3/components/OrDateTimePickerV3/index.js +4 -4
  147. package/dist/bundled/v3/components/OrExpansionPanelV3/OrExpansionPanel.js +2 -2
  148. package/dist/bundled/v3/components/OrExpansionPanelV3/index.js +1 -1
  149. package/dist/bundled/v3/components/OrIconButtonV3/OrIconButton.js +2 -2
  150. package/dist/bundled/v3/components/OrIconButtonV3/index.js +1 -1
  151. package/dist/bundled/v3/components/OrInlineInputV3/OrInlineInput.js +2 -2
  152. package/dist/bundled/v3/components/OrInlineInputV3/index.js +1 -1
  153. package/dist/bundled/v3/components/OrInlineTextEdit/OrInlineTextEdit.js +2 -2
  154. package/dist/bundled/v3/components/OrInlineTextEdit/index.js +1 -1
  155. package/dist/bundled/v3/components/OrInlineTextareaV3/OrInlineTextarea.js +2 -2
  156. package/dist/bundled/v3/components/OrInlineTextareaV3/index.js +1 -1
  157. package/dist/bundled/v3/components/OrInputV3/OrInput.js +2 -2
  158. package/dist/bundled/v3/components/OrInputV3/index.js +1 -1
  159. package/dist/bundled/v3/components/OrListV3/OrList.js +2 -2
  160. package/dist/bundled/v3/components/OrListV3/index.js +1 -1
  161. package/dist/bundled/v3/components/OrLoaderV3/OrLoader.js +2 -2
  162. package/dist/bundled/v3/components/OrLoaderV3/index.js +1 -1
  163. package/dist/bundled/v3/components/OrMenuV3/OrMenu.js +2 -2
  164. package/dist/bundled/v3/components/OrMenuV3/index.js +1 -1
  165. package/dist/bundled/v3/components/OrModal/OrModal.js +2 -2
  166. package/dist/bundled/v3/components/OrModal/index.js +1 -1
  167. package/dist/bundled/v3/components/OrModalV3/OrModal.js +2 -2
  168. package/dist/bundled/v3/components/OrModalV3/index.js +1 -1
  169. package/dist/bundled/v3/components/OrNotificationV3/OrNotification.js +2 -2
  170. package/dist/bundled/v3/components/OrNotificationV3/index.js +1 -1
  171. package/dist/bundled/v3/components/OrOverflowMenu/OrOverflowMenu.js +2 -2
  172. package/dist/bundled/v3/components/OrOverflowMenu/index.js +1 -1
  173. package/dist/bundled/v3/components/OrOverlayV3/OrOverlay.js +2 -2
  174. package/dist/bundled/v3/components/OrOverlayV3/index.js +1 -1
  175. package/dist/bundled/v3/components/OrPaginationV3/OrPagination.js +2 -2
  176. package/dist/bundled/v3/components/OrPaginationV3/index.js +1 -1
  177. package/dist/bundled/v3/components/OrPassword/OrPassword.js +2 -2
  178. package/dist/bundled/v3/components/OrPassword/index.js +1 -1
  179. package/dist/bundled/v3/components/OrPopoverV3/OrPopover.js +2 -2
  180. package/dist/bundled/v3/components/OrPopoverV3/index.js +1 -1
  181. package/dist/bundled/v3/components/OrProgressV3/OrProgress.js +2 -2
  182. package/dist/bundled/v3/components/OrProgressV3/index.js +1 -1
  183. package/dist/bundled/v3/components/OrRangeSliderV3/OrRangeSlider.js +2 -2
  184. package/dist/bundled/v3/components/OrRangeSliderV3/index.js +1 -1
  185. package/dist/bundled/v3/components/OrResizeablePanelV3/OrResizeablePanel.js +2 -2
  186. package/dist/bundled/v3/components/OrResizeablePanelV3/index.js +1 -1
  187. package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.js +2 -2
  188. package/dist/bundled/v3/components/OrRichTextEditorV3/index.js +1 -1
  189. package/dist/bundled/v3/components/OrSearch/OrSearch.js +2 -2
  190. package/dist/bundled/v3/components/OrSearch/index.js +1 -1
  191. package/dist/bundled/v3/components/OrSearchV3/OrSearch.js +2 -2
  192. package/dist/bundled/v3/components/OrSearchV3/index.js +1 -1
  193. package/dist/bundled/v3/components/OrSelect/OrSelect.js +2 -2
  194. package/dist/bundled/v3/components/OrSelect/index.js +1 -1
  195. package/dist/bundled/v3/components/OrSelectV3/OrSelect.js +2 -2
  196. package/dist/bundled/v3/components/OrSelectV3/index.js +1 -1
  197. package/dist/bundled/v3/components/OrSidebar/OrSidebar.js +2 -2
  198. package/dist/bundled/v3/components/OrSidebar/index.js +1 -1
  199. package/dist/bundled/v3/components/OrSidebarV3/OrSidebar.js +2 -2
  200. package/dist/bundled/v3/components/OrSidebarV3/index.js +1 -1
  201. package/dist/bundled/v3/components/OrSlider/OrSlider.js +2 -2
  202. package/dist/bundled/v3/components/OrSlider/index.js +1 -1
  203. package/dist/bundled/v3/components/OrSliderV3/OrSlider.js +2 -2
  204. package/dist/bundled/v3/components/OrSliderV3/index.js +1 -1
  205. package/dist/bundled/v3/components/OrSortingV3/OrSorting.js +2 -2
  206. package/dist/bundled/v3/components/OrSortingV3/index.js +1 -1
  207. package/dist/bundled/v3/components/OrSwitchV3/OrSwitch.js +2 -2
  208. package/dist/bundled/v3/components/OrSwitchV3/index.js +1 -1
  209. package/dist/bundled/v3/components/OrTabsV3/OrTabs.js +2 -2
  210. package/dist/bundled/v3/components/OrTabsV3/index.js +1 -1
  211. package/dist/bundled/v3/components/OrTagInputV3/OrTagInput.js +2 -2
  212. package/dist/bundled/v3/components/OrTagInputV3/index.js +1 -1
  213. package/dist/bundled/v3/components/OrTagV3/OrTag.js +2 -2
  214. package/dist/bundled/v3/components/OrTagV3/index.js +1 -1
  215. package/dist/bundled/v3/components/OrTagsV3/OrTags.js +2 -2
  216. package/dist/bundled/v3/components/OrTagsV3/index.js +1 -1
  217. package/dist/bundled/v3/components/OrTimePickerV3/OrTimePicker.js +2 -2
  218. package/dist/bundled/v3/components/OrTimePickerV3/index.js +1 -1
  219. package/dist/bundled/v3/components/OrTimeRangePickerV3/OrTimeRangePicker.js +2 -2
  220. package/dist/bundled/v3/components/OrTimeRangePickerV3/index.js +1 -1
  221. package/dist/bundled/v3/components/OrToast/Timer.js +1 -1
  222. package/dist/bundled/v3/components/OrToast/composable/useToastEventBus.js +2 -2
  223. package/dist/bundled/v3/components/OrToast/index.js +1 -1
  224. package/dist/bundled/v3/components/OrToastContainer/OrToastContainer.js +2 -2
  225. package/dist/bundled/v3/components/OrToastContainer/index.js +1 -1
  226. package/dist/bundled/v3/components/OrToastContainerV3/OrToastContainer.js +2 -2
  227. package/dist/bundled/v3/components/OrToastContainerV3/index.js +1 -1
  228. package/dist/bundled/v3/components/OrToastV3/OrToast.js +2 -2
  229. package/dist/bundled/v3/components/OrToastV3/Timer.js +1 -1
  230. package/dist/bundled/v3/components/OrToastV3/composable/useToastEventBus.js +2 -2
  231. package/dist/bundled/v3/components/OrToastV3/index.js +1 -1
  232. package/dist/bundled/v3/components/OrTooltipV3/OrTooltip.js +2 -2
  233. package/dist/bundled/v3/components/OrTooltipV3/index.js +1 -1
  234. package/dist/bundled/v3/components/OrTreeV3/OrTree.js +2 -2
  235. package/dist/bundled/v3/components/OrTreeV3/index.js +1 -1
  236. package/dist/bundled/v3/components/index.js +60 -60
  237. package/dist/bundled/v3/hooks/useOverflow.js +1 -1
  238. package/dist/bundled/v3/hooks/usePopoverState.js +1 -1
  239. package/dist/bundled/v3/hooks/useResponsive/useResponsive.js +1 -1
  240. package/dist/bundled/v3/{index-ba131271.js → index-06852368.js} +1 -1
  241. package/dist/bundled/v3/{index-8420da7b.js → index-2ca6453c.js} +1 -1
  242. package/dist/bundled/v3/{index-8d86c3d5.js → index-ffeb3fc8.js} +1 -1
  243. package/dist/bundled/v3/index.js +60 -60
  244. package/dist/bundled/v3/{useFocusTrap-5ec18c69.js → useFocusTrap-dabc16ec.js} +2 -2
  245. package/dist/esm/v2/{OrRichTextEditor-7297ab63.js → OrRichTextEditor-d1520fce.js} +2 -3
  246. package/dist/esm/v2/components/index.js +1 -2
  247. package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +1 -2
  248. package/dist/esm/v2/components/or-textarea-v3/OrTextarea.vue.d.ts +2 -2
  249. package/dist/esm/v2/components/or-textbox/OrTextbox.vue.d.ts +2 -2
  250. package/dist/esm/v2/index.js +1 -2
  251. package/dist/esm/v3/{OrRichTextEditor-24040de1.js → OrRichTextEditor-d4f5cc37.js} +2 -3
  252. package/dist/esm/v3/components/index.js +1 -2
  253. package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +1 -2
  254. package/dist/esm/v3/index.js +1 -2
  255. package/package.json +2 -2
  256. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +2 -4
  257. package/dist/bundled/v3/OrRichTextEditor.vue_vue_type_script_lang-bf036571.js +0 -11380
  258. /package/dist/bundled/v2/{OrDateTimePickerMonthSelect-a9664055.js → OrDateTimePickerMonthSelect-18ba0793.js} +0 -0
  259. /package/dist/bundled/v2/{OrDateTimePickerPopoverHeader-72397f4c.js → OrDateTimePickerPopoverHeader-13a1f9e3.js} +0 -0
  260. /package/dist/bundled/v2/{OrDateTimePickerTimeSelect-c59105c1.js → OrDateTimePickerTimeSelect-7ce1b97d.js} +0 -0
  261. /package/dist/bundled/v2/{OrList-e889a448.js → OrList-746fc406.js} +0 -0
  262. /package/dist/bundled/v3/{OrExpansionPanel.vue_vue_type_script_lang-5369736c.js → OrExpansionPanel.vue_vue_type_script_lang-7fad7b18.js} +0 -0
@@ -0,0 +1,1910 @@
1
+ import { defineComponent, ref, onMounted, onBeforeUnmount, computed, watch, nextTick } from 'vue-demi';
2
+ import { u as useFocusTrap } from './useFocusTrap-dabc16ec.js';
3
+ import { f as useResizeObserver, o as onClickOutside } from './index-06852368.js';
4
+ import { B as Blockquote, a as Bold, b as BulletList, C as CodeBlock, H as HardBreak, I as Italic, L as ListItem, O as OrderedList, P as Paragraph, S as Strike, s as serialize, d as deserialize, U as Underline, c as Link, e as Highlight } from './markdown-7d2cd3a5.js';
5
+ import { EditorContainer, ToolbarContainer, Toolbar, ToolbarButtonFocused, ToolbarButton, EditorInput } from './components/OrRichTextEditorV3/styles.js';
6
+ import { Formats } from './components/OrRichTextEditorV3/props.js';
7
+ import { M as Mark, m as mergeAttributes, a as markInputRule, b as markPasteRule, N as Node, E as Extension, k as keydownHandler, D as DecorationSet, c as Decoration, d as callOrReturn, g as getExtensionField, t as textblockTypeInputRule, n as nodeInputRule, e as Editor } from './index-67eff9fe.js';
8
+ import { P as Plugin, d as dropPoint, S as Selection, N as NodeSelection, F as Fragment, a as Slice, T as TextSelection, b as PluginKey, M as Mapping } from './index-f671afe5.js';
9
+ import codemirrorNode from './components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js';
10
+ import './components/OrIconButtonV3/OrIconButton.js';
11
+ import './components/OrLabelV3/OrLabel.js';
12
+ import './components/OrMenuItemV3/OrMenuItem.js';
13
+ import './components/OrMenuV3/OrMenu.js';
14
+ import './components/OrModalV3/OrModal.js';
15
+ import './components/OrInputV3/OrInput.js';
16
+ import './components/OrButtonV3/OrButton.js';
17
+ import './components/OrPopoverV3/OrPopover.js';
18
+ import { a as useDebounceFn } from './index-ffeb3fc8.js';
19
+ import { s as script$1 } from './OrIconButton.vue_vue_type_script_lang-6c4f3216.js';
20
+ import { s as script$2 } from './OrLabel.vue_vue_type_script_lang-e2bcff17.js';
21
+ import { s as script$3 } from './OrMenuItem.vue_vue_type_script_lang-11569833.js';
22
+ import { s as script$4 } from './OrMenu.vue_vue_type_script_lang-8a3c6cfc.js';
23
+ import { s as script$5 } from './OrModal.vue_vue_type_script_lang-9b908bb2.js';
24
+ import { s as script$6 } from './OrInput.vue_vue_type_script_lang-2520e0f2.js';
25
+ import { s as script$7 } from './OrButton.vue_vue_type_script_lang-dfeef2d0.js';
26
+ import { s as script$8 } from './OrPopover.vue_vue_type_script_lang-cb38a064.js';
27
+
28
+ const inputRegex = /(?:^|\s)((?:`)((?:[^`]+))(?:`))$/;
29
+ const pasteRegex = /(?:^|\s)((?:`)((?:[^`]+))(?:`))/g;
30
+ const Code = Mark.create({
31
+ name: 'code',
32
+ addOptions() {
33
+ return {
34
+ HTMLAttributes: {}
35
+ };
36
+ },
37
+ excludes: '_',
38
+ code: true,
39
+ exitable: true,
40
+ parseHTML() {
41
+ return [{
42
+ tag: 'code'
43
+ }];
44
+ },
45
+ renderHTML(_ref) {
46
+ let {
47
+ HTMLAttributes
48
+ } = _ref;
49
+ return ['code', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
50
+ },
51
+ addCommands() {
52
+ return {
53
+ setCode: () => _ref2 => {
54
+ let {
55
+ commands
56
+ } = _ref2;
57
+ return commands.setMark(this.name);
58
+ },
59
+ toggleCode: () => _ref3 => {
60
+ let {
61
+ commands
62
+ } = _ref3;
63
+ return commands.toggleMark(this.name);
64
+ },
65
+ unsetCode: () => _ref4 => {
66
+ let {
67
+ commands
68
+ } = _ref4;
69
+ return commands.unsetMark(this.name);
70
+ }
71
+ };
72
+ },
73
+ addKeyboardShortcuts() {
74
+ return {
75
+ 'Mod-e': () => this.editor.commands.toggleCode()
76
+ };
77
+ },
78
+ addInputRules() {
79
+ return [markInputRule({
80
+ find: inputRegex,
81
+ type: this.type
82
+ })];
83
+ },
84
+ addPasteRules() {
85
+ return [markPasteRule({
86
+ find: pasteRegex,
87
+ type: this.type
88
+ })];
89
+ }
90
+ });
91
+
92
+ const Document = Node.create({
93
+ name: 'doc',
94
+ topNode: true,
95
+ content: 'block+'
96
+ });
97
+
98
+ /**
99
+ Create a plugin that, when added to a ProseMirror instance,
100
+ causes a decoration to show up at the drop position when something
101
+ is dragged over the editor.
102
+
103
+ Nodes may add a `disableDropCursor` property to their spec to
104
+ control the showing of a drop cursor inside them. This may be a
105
+ boolean or a function, which will be called with a view and a
106
+ position, and should return a boolean.
107
+ */
108
+ function dropCursor() {
109
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
110
+ return new Plugin({
111
+ view(editorView) {
112
+ return new DropCursorView(editorView, options);
113
+ }
114
+ });
115
+ }
116
+ class DropCursorView {
117
+ constructor(editorView, options) {
118
+ var _a;
119
+ this.editorView = editorView;
120
+ this.cursorPos = null;
121
+ this.element = null;
122
+ this.timeout = -1;
123
+ this.width = (_a = options.width) !== null && _a !== void 0 ? _a : 1;
124
+ this.color = options.color === false ? undefined : options.color || "black";
125
+ this.class = options.class;
126
+ this.handlers = ["dragover", "dragend", "drop", "dragleave"].map(name => {
127
+ let handler = e => {
128
+ this[name](e);
129
+ };
130
+ editorView.dom.addEventListener(name, handler);
131
+ return {
132
+ name,
133
+ handler
134
+ };
135
+ });
136
+ }
137
+ destroy() {
138
+ this.handlers.forEach(_ref => {
139
+ let {
140
+ name,
141
+ handler
142
+ } = _ref;
143
+ return this.editorView.dom.removeEventListener(name, handler);
144
+ });
145
+ }
146
+ update(editorView, prevState) {
147
+ if (this.cursorPos != null && prevState.doc != editorView.state.doc) {
148
+ if (this.cursorPos > editorView.state.doc.content.size) this.setCursor(null);else this.updateOverlay();
149
+ }
150
+ }
151
+ setCursor(pos) {
152
+ if (pos == this.cursorPos) return;
153
+ this.cursorPos = pos;
154
+ if (pos == null) {
155
+ this.element.parentNode.removeChild(this.element);
156
+ this.element = null;
157
+ } else {
158
+ this.updateOverlay();
159
+ }
160
+ }
161
+ updateOverlay() {
162
+ let $pos = this.editorView.state.doc.resolve(this.cursorPos);
163
+ let isBlock = !$pos.parent.inlineContent,
164
+ rect;
165
+ if (isBlock) {
166
+ let before = $pos.nodeBefore,
167
+ after = $pos.nodeAfter;
168
+ if (before || after) {
169
+ let node = this.editorView.nodeDOM(this.cursorPos - (before ? before.nodeSize : 0));
170
+ if (node) {
171
+ let nodeRect = node.getBoundingClientRect();
172
+ let top = before ? nodeRect.bottom : nodeRect.top;
173
+ if (before && after) top = (top + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2;
174
+ rect = {
175
+ left: nodeRect.left,
176
+ right: nodeRect.right,
177
+ top: top - this.width / 2,
178
+ bottom: top + this.width / 2
179
+ };
180
+ }
181
+ }
182
+ }
183
+ if (!rect) {
184
+ let coords = this.editorView.coordsAtPos(this.cursorPos);
185
+ rect = {
186
+ left: coords.left - this.width / 2,
187
+ right: coords.left + this.width / 2,
188
+ top: coords.top,
189
+ bottom: coords.bottom
190
+ };
191
+ }
192
+ let parent = this.editorView.dom.offsetParent;
193
+ if (!this.element) {
194
+ this.element = parent.appendChild(document.createElement("div"));
195
+ if (this.class) this.element.className = this.class;
196
+ this.element.style.cssText = "position: absolute; z-index: 50; pointer-events: none;";
197
+ if (this.color) {
198
+ this.element.style.backgroundColor = this.color;
199
+ }
200
+ }
201
+ this.element.classList.toggle("prosemirror-dropcursor-block", isBlock);
202
+ this.element.classList.toggle("prosemirror-dropcursor-inline", !isBlock);
203
+ let parentLeft, parentTop;
204
+ if (!parent || parent == document.body && getComputedStyle(parent).position == "static") {
205
+ parentLeft = -pageXOffset;
206
+ parentTop = -pageYOffset;
207
+ } else {
208
+ let rect = parent.getBoundingClientRect();
209
+ parentLeft = rect.left - parent.scrollLeft;
210
+ parentTop = rect.top - parent.scrollTop;
211
+ }
212
+ this.element.style.left = rect.left - parentLeft + "px";
213
+ this.element.style.top = rect.top - parentTop + "px";
214
+ this.element.style.width = rect.right - rect.left + "px";
215
+ this.element.style.height = rect.bottom - rect.top + "px";
216
+ }
217
+ scheduleRemoval(timeout) {
218
+ clearTimeout(this.timeout);
219
+ this.timeout = setTimeout(() => this.setCursor(null), timeout);
220
+ }
221
+ dragover(event) {
222
+ if (!this.editorView.editable) return;
223
+ let pos = this.editorView.posAtCoords({
224
+ left: event.clientX,
225
+ top: event.clientY
226
+ });
227
+ let node = pos && pos.inside >= 0 && this.editorView.state.doc.nodeAt(pos.inside);
228
+ let disableDropCursor = node && node.type.spec.disableDropCursor;
229
+ let disabled = typeof disableDropCursor == "function" ? disableDropCursor(this.editorView, pos, event) : disableDropCursor;
230
+ if (pos && !disabled) {
231
+ let target = pos.pos;
232
+ if (this.editorView.dragging && this.editorView.dragging.slice) {
233
+ let point = dropPoint(this.editorView.state.doc, target, this.editorView.dragging.slice);
234
+ if (point != null) target = point;
235
+ }
236
+ this.setCursor(target);
237
+ this.scheduleRemoval(5000);
238
+ }
239
+ }
240
+ dragend() {
241
+ this.scheduleRemoval(20);
242
+ }
243
+ drop() {
244
+ this.scheduleRemoval(20);
245
+ }
246
+ dragleave(event) {
247
+ if (event.target == this.editorView.dom || !this.editorView.dom.contains(event.relatedTarget)) this.setCursor(null);
248
+ }
249
+ }
250
+
251
+ const Dropcursor = Extension.create({
252
+ name: 'dropCursor',
253
+ addOptions() {
254
+ return {
255
+ color: 'currentColor',
256
+ width: 1,
257
+ class: undefined
258
+ };
259
+ },
260
+ addProseMirrorPlugins() {
261
+ return [dropCursor(this.options)];
262
+ }
263
+ });
264
+
265
+ /**
266
+ Gap cursor selections are represented using this class. Its
267
+ `$anchor` and `$head` properties both point at the cursor position.
268
+ */
269
+ class GapCursor extends Selection {
270
+ /**
271
+ Create a gap cursor.
272
+ */
273
+ constructor($pos) {
274
+ super($pos, $pos);
275
+ }
276
+ map(doc, mapping) {
277
+ let $pos = doc.resolve(mapping.map(this.head));
278
+ return GapCursor.valid($pos) ? new GapCursor($pos) : Selection.near($pos);
279
+ }
280
+ content() {
281
+ return Slice.empty;
282
+ }
283
+ eq(other) {
284
+ return other instanceof GapCursor && other.head == this.head;
285
+ }
286
+ toJSON() {
287
+ return {
288
+ type: "gapcursor",
289
+ pos: this.head
290
+ };
291
+ }
292
+ /**
293
+ @internal
294
+ */
295
+ static fromJSON(doc, json) {
296
+ if (typeof json.pos != "number") throw new RangeError("Invalid input for GapCursor.fromJSON");
297
+ return new GapCursor(doc.resolve(json.pos));
298
+ }
299
+ /**
300
+ @internal
301
+ */
302
+ getBookmark() {
303
+ return new GapBookmark(this.anchor);
304
+ }
305
+ /**
306
+ @internal
307
+ */
308
+ static valid($pos) {
309
+ let parent = $pos.parent;
310
+ if (parent.isTextblock || !closedBefore($pos) || !closedAfter($pos)) return false;
311
+ let override = parent.type.spec.allowGapCursor;
312
+ if (override != null) return override;
313
+ let deflt = parent.contentMatchAt($pos.index()).defaultType;
314
+ return deflt && deflt.isTextblock;
315
+ }
316
+ /**
317
+ @internal
318
+ */
319
+ static findGapCursorFrom($pos, dir) {
320
+ let mustMove = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
321
+ search: for (;;) {
322
+ if (!mustMove && GapCursor.valid($pos)) return $pos;
323
+ let pos = $pos.pos,
324
+ next = null;
325
+ // Scan up from this position
326
+ for (let d = $pos.depth;; d--) {
327
+ let parent = $pos.node(d);
328
+ if (dir > 0 ? $pos.indexAfter(d) < parent.childCount : $pos.index(d) > 0) {
329
+ next = parent.child(dir > 0 ? $pos.indexAfter(d) : $pos.index(d) - 1);
330
+ break;
331
+ } else if (d == 0) {
332
+ return null;
333
+ }
334
+ pos += dir;
335
+ let $cur = $pos.doc.resolve(pos);
336
+ if (GapCursor.valid($cur)) return $cur;
337
+ }
338
+ // And then down into the next node
339
+ for (;;) {
340
+ let inside = dir > 0 ? next.firstChild : next.lastChild;
341
+ if (!inside) {
342
+ if (next.isAtom && !next.isText && !NodeSelection.isSelectable(next)) {
343
+ $pos = $pos.doc.resolve(pos + next.nodeSize * dir);
344
+ mustMove = false;
345
+ continue search;
346
+ }
347
+ break;
348
+ }
349
+ next = inside;
350
+ pos += dir;
351
+ let $cur = $pos.doc.resolve(pos);
352
+ if (GapCursor.valid($cur)) return $cur;
353
+ }
354
+ return null;
355
+ }
356
+ }
357
+ }
358
+ GapCursor.prototype.visible = false;
359
+ GapCursor.findFrom = GapCursor.findGapCursorFrom;
360
+ Selection.jsonID("gapcursor", GapCursor);
361
+ class GapBookmark {
362
+ constructor(pos) {
363
+ this.pos = pos;
364
+ }
365
+ map(mapping) {
366
+ return new GapBookmark(mapping.map(this.pos));
367
+ }
368
+ resolve(doc) {
369
+ let $pos = doc.resolve(this.pos);
370
+ return GapCursor.valid($pos) ? new GapCursor($pos) : Selection.near($pos);
371
+ }
372
+ }
373
+ function closedBefore($pos) {
374
+ for (let d = $pos.depth; d >= 0; d--) {
375
+ let index = $pos.index(d),
376
+ parent = $pos.node(d);
377
+ // At the start of this parent, look at next one
378
+ if (index == 0) {
379
+ if (parent.type.spec.isolating) return true;
380
+ continue;
381
+ }
382
+ // See if the node before (or its first ancestor) is closed
383
+ for (let before = parent.child(index - 1);; before = before.lastChild) {
384
+ if (before.childCount == 0 && !before.inlineContent || before.isAtom || before.type.spec.isolating) return true;
385
+ if (before.inlineContent) return false;
386
+ }
387
+ }
388
+ // Hit start of document
389
+ return true;
390
+ }
391
+ function closedAfter($pos) {
392
+ for (let d = $pos.depth; d >= 0; d--) {
393
+ let index = $pos.indexAfter(d),
394
+ parent = $pos.node(d);
395
+ if (index == parent.childCount) {
396
+ if (parent.type.spec.isolating) return true;
397
+ continue;
398
+ }
399
+ for (let after = parent.child(index);; after = after.firstChild) {
400
+ if (after.childCount == 0 && !after.inlineContent || after.isAtom || after.type.spec.isolating) return true;
401
+ if (after.inlineContent) return false;
402
+ }
403
+ }
404
+ return true;
405
+ }
406
+
407
+ /**
408
+ Create a gap cursor plugin. When enabled, this will capture clicks
409
+ near and arrow-key-motion past places that don't have a normally
410
+ selectable position nearby, and create a gap cursor selection for
411
+ them. The cursor is drawn as an element with class
412
+ `ProseMirror-gapcursor`. You can either include
413
+ `style/gapcursor.css` from the package's directory or add your own
414
+ styles to make it visible.
415
+ */
416
+ function gapCursor() {
417
+ return new Plugin({
418
+ props: {
419
+ decorations: drawGapCursor,
420
+ createSelectionBetween(_view, $anchor, $head) {
421
+ return $anchor.pos == $head.pos && GapCursor.valid($head) ? new GapCursor($head) : null;
422
+ },
423
+ handleClick,
424
+ handleKeyDown,
425
+ handleDOMEvents: {
426
+ beforeinput: beforeinput
427
+ }
428
+ }
429
+ });
430
+ }
431
+ const handleKeyDown = keydownHandler({
432
+ "ArrowLeft": arrow("horiz", -1),
433
+ "ArrowRight": arrow("horiz", 1),
434
+ "ArrowUp": arrow("vert", -1),
435
+ "ArrowDown": arrow("vert", 1)
436
+ });
437
+ function arrow(axis, dir) {
438
+ const dirStr = axis == "vert" ? dir > 0 ? "down" : "up" : dir > 0 ? "right" : "left";
439
+ return function (state, dispatch, view) {
440
+ let sel = state.selection;
441
+ let $start = dir > 0 ? sel.$to : sel.$from,
442
+ mustMove = sel.empty;
443
+ if (sel instanceof TextSelection) {
444
+ if (!view.endOfTextblock(dirStr) || $start.depth == 0) return false;
445
+ mustMove = false;
446
+ $start = state.doc.resolve(dir > 0 ? $start.after() : $start.before());
447
+ }
448
+ let $found = GapCursor.findGapCursorFrom($start, dir, mustMove);
449
+ if (!$found) return false;
450
+ if (dispatch) dispatch(state.tr.setSelection(new GapCursor($found)));
451
+ return true;
452
+ };
453
+ }
454
+ function handleClick(view, pos, event) {
455
+ if (!view || !view.editable) return false;
456
+ let $pos = view.state.doc.resolve(pos);
457
+ if (!GapCursor.valid($pos)) return false;
458
+ let clickPos = view.posAtCoords({
459
+ left: event.clientX,
460
+ top: event.clientY
461
+ });
462
+ if (clickPos && clickPos.inside > -1 && NodeSelection.isSelectable(view.state.doc.nodeAt(clickPos.inside))) return false;
463
+ view.dispatch(view.state.tr.setSelection(new GapCursor($pos)));
464
+ return true;
465
+ }
466
+ // This is a hack that, when a composition starts while a gap cursor
467
+ // is active, quickly creates an inline context for the composition to
468
+ // happen in, to avoid it being aborted by the DOM selection being
469
+ // moved into a valid position.
470
+ function beforeinput(view, event) {
471
+ if (event.inputType != "insertCompositionText" || !(view.state.selection instanceof GapCursor)) return false;
472
+ let {
473
+ $from
474
+ } = view.state.selection;
475
+ let insert = $from.parent.contentMatchAt($from.index()).findWrapping(view.state.schema.nodes.text);
476
+ if (!insert) return false;
477
+ let frag = Fragment.empty;
478
+ for (let i = insert.length - 1; i >= 0; i--) frag = Fragment.from(insert[i].createAndFill(null, frag));
479
+ let tr = view.state.tr.replace($from.pos, $from.pos, new Slice(frag, 0, 0));
480
+ tr.setSelection(TextSelection.near(tr.doc.resolve($from.pos + 1)));
481
+ view.dispatch(tr);
482
+ return false;
483
+ }
484
+ function drawGapCursor(state) {
485
+ if (!(state.selection instanceof GapCursor)) return null;
486
+ let node = document.createElement("div");
487
+ node.className = "ProseMirror-gapcursor";
488
+ return DecorationSet.create(state.doc, [Decoration.widget(state.selection.head, node, {
489
+ key: "gapcursor"
490
+ })]);
491
+ }
492
+
493
+ const Gapcursor = Extension.create({
494
+ name: 'gapCursor',
495
+ addProseMirrorPlugins() {
496
+ return [gapCursor()];
497
+ },
498
+ extendNodeSchema(extension) {
499
+ var _a;
500
+ const context = {
501
+ name: extension.name,
502
+ options: extension.options,
503
+ storage: extension.storage
504
+ };
505
+ return {
506
+ allowGapCursor: (_a = callOrReturn(getExtensionField(extension, 'allowGapCursor', context))) !== null && _a !== void 0 ? _a : null
507
+ };
508
+ }
509
+ });
510
+
511
+ const Heading = Node.create({
512
+ name: 'heading',
513
+ addOptions() {
514
+ return {
515
+ levels: [1, 2, 3, 4, 5, 6],
516
+ HTMLAttributes: {}
517
+ };
518
+ },
519
+ content: 'inline*',
520
+ group: 'block',
521
+ defining: true,
522
+ addAttributes() {
523
+ return {
524
+ level: {
525
+ default: 1,
526
+ rendered: false
527
+ }
528
+ };
529
+ },
530
+ parseHTML() {
531
+ return this.options.levels.map(level => ({
532
+ tag: `h${level}`,
533
+ attrs: {
534
+ level
535
+ }
536
+ }));
537
+ },
538
+ renderHTML(_ref) {
539
+ let {
540
+ node,
541
+ HTMLAttributes
542
+ } = _ref;
543
+ const hasLevel = this.options.levels.includes(node.attrs.level);
544
+ const level = hasLevel ? node.attrs.level : this.options.levels[0];
545
+ return [`h${level}`, mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
546
+ },
547
+ addCommands() {
548
+ return {
549
+ setHeading: attributes => _ref2 => {
550
+ let {
551
+ commands
552
+ } = _ref2;
553
+ if (!this.options.levels.includes(attributes.level)) {
554
+ return false;
555
+ }
556
+ return commands.setNode(this.name, attributes);
557
+ },
558
+ toggleHeading: attributes => _ref3 => {
559
+ let {
560
+ commands
561
+ } = _ref3;
562
+ if (!this.options.levels.includes(attributes.level)) {
563
+ return false;
564
+ }
565
+ return commands.toggleNode(this.name, 'paragraph', attributes);
566
+ }
567
+ };
568
+ },
569
+ addKeyboardShortcuts() {
570
+ return this.options.levels.reduce((items, level) => ({
571
+ ...items,
572
+ ...{
573
+ [`Mod-Alt-${level}`]: () => this.editor.commands.toggleHeading({
574
+ level
575
+ })
576
+ }
577
+ }), {});
578
+ },
579
+ addInputRules() {
580
+ return this.options.levels.map(level => {
581
+ return textblockTypeInputRule({
582
+ find: new RegExp(`^(#{1,${level}})\\s$`),
583
+ type: this.type,
584
+ getAttributes: {
585
+ level
586
+ }
587
+ });
588
+ });
589
+ }
590
+ });
591
+
592
+ var GOOD_LEAF_SIZE = 200;
593
+
594
+ // :: class<T> A rope sequence is a persistent sequence data structure
595
+ // that supports appending, prepending, and slicing without doing a
596
+ // full copy. It is represented as a mostly-balanced tree.
597
+ var RopeSequence = function RopeSequence() {};
598
+ RopeSequence.prototype.append = function append(other) {
599
+ if (!other.length) {
600
+ return this;
601
+ }
602
+ other = RopeSequence.from(other);
603
+ return !this.length && other || other.length < GOOD_LEAF_SIZE && this.leafAppend(other) || this.length < GOOD_LEAF_SIZE && other.leafPrepend(this) || this.appendInner(other);
604
+ };
605
+
606
+ // :: (union<[T], RopeSequence<T>>) → RopeSequence<T>
607
+ // Prepend an array or other rope to this one, returning a new rope.
608
+ RopeSequence.prototype.prepend = function prepend(other) {
609
+ if (!other.length) {
610
+ return this;
611
+ }
612
+ return RopeSequence.from(other).append(this);
613
+ };
614
+ RopeSequence.prototype.appendInner = function appendInner(other) {
615
+ return new Append(this, other);
616
+ };
617
+
618
+ // :: (?number, ?number) → RopeSequence<T>
619
+ // Create a rope repesenting a sub-sequence of this rope.
620
+ RopeSequence.prototype.slice = function slice(from, to) {
621
+ if (from === void 0) from = 0;
622
+ if (to === void 0) to = this.length;
623
+ if (from >= to) {
624
+ return RopeSequence.empty;
625
+ }
626
+ return this.sliceInner(Math.max(0, from), Math.min(this.length, to));
627
+ };
628
+
629
+ // :: (number) → T
630
+ // Retrieve the element at the given position from this rope.
631
+ RopeSequence.prototype.get = function get(i) {
632
+ if (i < 0 || i >= this.length) {
633
+ return undefined;
634
+ }
635
+ return this.getInner(i);
636
+ };
637
+
638
+ // :: ((element: T, index: number) → ?bool, ?number, ?number)
639
+ // Call the given function for each element between the given
640
+ // indices. This tends to be more efficient than looping over the
641
+ // indices and calling `get`, because it doesn't have to descend the
642
+ // tree for every element.
643
+ RopeSequence.prototype.forEach = function forEach(f, from, to) {
644
+ if (from === void 0) from = 0;
645
+ if (to === void 0) to = this.length;
646
+ if (from <= to) {
647
+ this.forEachInner(f, from, to, 0);
648
+ } else {
649
+ this.forEachInvertedInner(f, from, to, 0);
650
+ }
651
+ };
652
+
653
+ // :: ((element: T, index: number) → U, ?number, ?number) → [U]
654
+ // Map the given functions over the elements of the rope, producing
655
+ // a flat array.
656
+ RopeSequence.prototype.map = function map(f, from, to) {
657
+ if (from === void 0) from = 0;
658
+ if (to === void 0) to = this.length;
659
+ var result = [];
660
+ this.forEach(function (elt, i) {
661
+ return result.push(f(elt, i));
662
+ }, from, to);
663
+ return result;
664
+ };
665
+
666
+ // :: (?union<[T], RopeSequence<T>>) → RopeSequence<T>
667
+ // Create a rope representing the given array, or return the rope
668
+ // itself if a rope was given.
669
+ RopeSequence.from = function from(values) {
670
+ if (values instanceof RopeSequence) {
671
+ return values;
672
+ }
673
+ return values && values.length ? new Leaf(values) : RopeSequence.empty;
674
+ };
675
+ var Leaf = /*@__PURE__*/function (RopeSequence) {
676
+ function Leaf(values) {
677
+ RopeSequence.call(this);
678
+ this.values = values;
679
+ }
680
+ if (RopeSequence) Leaf.__proto__ = RopeSequence;
681
+ Leaf.prototype = Object.create(RopeSequence && RopeSequence.prototype);
682
+ Leaf.prototype.constructor = Leaf;
683
+ var prototypeAccessors = {
684
+ length: {
685
+ configurable: true
686
+ },
687
+ depth: {
688
+ configurable: true
689
+ }
690
+ };
691
+ Leaf.prototype.flatten = function flatten() {
692
+ return this.values;
693
+ };
694
+ Leaf.prototype.sliceInner = function sliceInner(from, to) {
695
+ if (from == 0 && to == this.length) {
696
+ return this;
697
+ }
698
+ return new Leaf(this.values.slice(from, to));
699
+ };
700
+ Leaf.prototype.getInner = function getInner(i) {
701
+ return this.values[i];
702
+ };
703
+ Leaf.prototype.forEachInner = function forEachInner(f, from, to, start) {
704
+ for (var i = from; i < to; i++) {
705
+ if (f(this.values[i], start + i) === false) {
706
+ return false;
707
+ }
708
+ }
709
+ };
710
+ Leaf.prototype.forEachInvertedInner = function forEachInvertedInner(f, from, to, start) {
711
+ for (var i = from - 1; i >= to; i--) {
712
+ if (f(this.values[i], start + i) === false) {
713
+ return false;
714
+ }
715
+ }
716
+ };
717
+ Leaf.prototype.leafAppend = function leafAppend(other) {
718
+ if (this.length + other.length <= GOOD_LEAF_SIZE) {
719
+ return new Leaf(this.values.concat(other.flatten()));
720
+ }
721
+ };
722
+ Leaf.prototype.leafPrepend = function leafPrepend(other) {
723
+ if (this.length + other.length <= GOOD_LEAF_SIZE) {
724
+ return new Leaf(other.flatten().concat(this.values));
725
+ }
726
+ };
727
+ prototypeAccessors.length.get = function () {
728
+ return this.values.length;
729
+ };
730
+ prototypeAccessors.depth.get = function () {
731
+ return 0;
732
+ };
733
+ Object.defineProperties(Leaf.prototype, prototypeAccessors);
734
+ return Leaf;
735
+ }(RopeSequence);
736
+
737
+ // :: RopeSequence
738
+ // The empty rope sequence.
739
+ RopeSequence.empty = new Leaf([]);
740
+ var Append = /*@__PURE__*/function (RopeSequence) {
741
+ function Append(left, right) {
742
+ RopeSequence.call(this);
743
+ this.left = left;
744
+ this.right = right;
745
+ this.length = left.length + right.length;
746
+ this.depth = Math.max(left.depth, right.depth) + 1;
747
+ }
748
+ if (RopeSequence) Append.__proto__ = RopeSequence;
749
+ Append.prototype = Object.create(RopeSequence && RopeSequence.prototype);
750
+ Append.prototype.constructor = Append;
751
+ Append.prototype.flatten = function flatten() {
752
+ return this.left.flatten().concat(this.right.flatten());
753
+ };
754
+ Append.prototype.getInner = function getInner(i) {
755
+ return i < this.left.length ? this.left.get(i) : this.right.get(i - this.left.length);
756
+ };
757
+ Append.prototype.forEachInner = function forEachInner(f, from, to, start) {
758
+ var leftLen = this.left.length;
759
+ if (from < leftLen && this.left.forEachInner(f, from, Math.min(to, leftLen), start) === false) {
760
+ return false;
761
+ }
762
+ if (to > leftLen && this.right.forEachInner(f, Math.max(from - leftLen, 0), Math.min(this.length, to) - leftLen, start + leftLen) === false) {
763
+ return false;
764
+ }
765
+ };
766
+ Append.prototype.forEachInvertedInner = function forEachInvertedInner(f, from, to, start) {
767
+ var leftLen = this.left.length;
768
+ if (from > leftLen && this.right.forEachInvertedInner(f, from - leftLen, Math.max(to, leftLen) - leftLen, start + leftLen) === false) {
769
+ return false;
770
+ }
771
+ if (to < leftLen && this.left.forEachInvertedInner(f, Math.min(from, leftLen), to, start) === false) {
772
+ return false;
773
+ }
774
+ };
775
+ Append.prototype.sliceInner = function sliceInner(from, to) {
776
+ if (from == 0 && to == this.length) {
777
+ return this;
778
+ }
779
+ var leftLen = this.left.length;
780
+ if (to <= leftLen) {
781
+ return this.left.slice(from, to);
782
+ }
783
+ if (from >= leftLen) {
784
+ return this.right.slice(from - leftLen, to - leftLen);
785
+ }
786
+ return this.left.slice(from, leftLen).append(this.right.slice(0, to - leftLen));
787
+ };
788
+ Append.prototype.leafAppend = function leafAppend(other) {
789
+ var inner = this.right.leafAppend(other);
790
+ if (inner) {
791
+ return new Append(this.left, inner);
792
+ }
793
+ };
794
+ Append.prototype.leafPrepend = function leafPrepend(other) {
795
+ var inner = this.left.leafPrepend(other);
796
+ if (inner) {
797
+ return new Append(inner, this.right);
798
+ }
799
+ };
800
+ Append.prototype.appendInner = function appendInner(other) {
801
+ if (this.left.depth >= Math.max(this.right.depth, other.depth) + 1) {
802
+ return new Append(this.left, new Append(this.right, other));
803
+ }
804
+ return new Append(this, other);
805
+ };
806
+ return Append;
807
+ }(RopeSequence);
808
+
809
+ // ProseMirror's history isn't simply a way to roll back to a previous
810
+ // state, because ProseMirror supports applying changes without adding
811
+ // them to the history (for example during collaboration).
812
+ //
813
+ // To this end, each 'Branch' (one for the undo history and one for
814
+ // the redo history) keeps an array of 'Items', which can optionally
815
+ // hold a step (an actual undoable change), and always hold a position
816
+ // map (which is needed to move changes below them to apply to the
817
+ // current document).
818
+ //
819
+ // An item that has both a step and a selection bookmark is the start
820
+ // of an 'event' — a group of changes that will be undone or redone at
821
+ // once. (It stores only the bookmark, since that way we don't have to
822
+ // provide a document until the selection is actually applied, which
823
+ // is useful when compressing.)
824
+ // Used to schedule history compression
825
+ const max_empty_items = 500;
826
+ class Branch {
827
+ constructor(items, eventCount) {
828
+ this.items = items;
829
+ this.eventCount = eventCount;
830
+ }
831
+ // Pop the latest event off the branch's history and apply it
832
+ // to a document transform.
833
+ popEvent(state, preserveItems) {
834
+ if (this.eventCount == 0) return null;
835
+ let end = this.items.length;
836
+ for (;; end--) {
837
+ let next = this.items.get(end - 1);
838
+ if (next.selection) {
839
+ --end;
840
+ break;
841
+ }
842
+ }
843
+ let remap, mapFrom;
844
+ if (preserveItems) {
845
+ remap = this.remapping(end, this.items.length);
846
+ mapFrom = remap.maps.length;
847
+ }
848
+ let transform = state.tr;
849
+ let selection, remaining;
850
+ let addAfter = [],
851
+ addBefore = [];
852
+ this.items.forEach((item, i) => {
853
+ if (!item.step) {
854
+ if (!remap) {
855
+ remap = this.remapping(end, i + 1);
856
+ mapFrom = remap.maps.length;
857
+ }
858
+ mapFrom--;
859
+ addBefore.push(item);
860
+ return;
861
+ }
862
+ if (remap) {
863
+ addBefore.push(new Item(item.map));
864
+ let step = item.step.map(remap.slice(mapFrom)),
865
+ map;
866
+ if (step && transform.maybeStep(step).doc) {
867
+ map = transform.mapping.maps[transform.mapping.maps.length - 1];
868
+ addAfter.push(new Item(map, undefined, undefined, addAfter.length + addBefore.length));
869
+ }
870
+ mapFrom--;
871
+ if (map) remap.appendMap(map, mapFrom);
872
+ } else {
873
+ transform.maybeStep(item.step);
874
+ }
875
+ if (item.selection) {
876
+ selection = remap ? item.selection.map(remap.slice(mapFrom)) : item.selection;
877
+ remaining = new Branch(this.items.slice(0, end).append(addBefore.reverse().concat(addAfter)), this.eventCount - 1);
878
+ return false;
879
+ }
880
+ }, this.items.length, 0);
881
+ return {
882
+ remaining: remaining,
883
+ transform,
884
+ selection: selection
885
+ };
886
+ }
887
+ // Create a new branch with the given transform added.
888
+ addTransform(transform, selection, histOptions, preserveItems) {
889
+ let newItems = [],
890
+ eventCount = this.eventCount;
891
+ let oldItems = this.items,
892
+ lastItem = !preserveItems && oldItems.length ? oldItems.get(oldItems.length - 1) : null;
893
+ for (let i = 0; i < transform.steps.length; i++) {
894
+ let step = transform.steps[i].invert(transform.docs[i]);
895
+ let item = new Item(transform.mapping.maps[i], step, selection),
896
+ merged;
897
+ if (merged = lastItem && lastItem.merge(item)) {
898
+ item = merged;
899
+ if (i) newItems.pop();else oldItems = oldItems.slice(0, oldItems.length - 1);
900
+ }
901
+ newItems.push(item);
902
+ if (selection) {
903
+ eventCount++;
904
+ selection = undefined;
905
+ }
906
+ if (!preserveItems) lastItem = item;
907
+ }
908
+ let overflow = eventCount - histOptions.depth;
909
+ if (overflow > DEPTH_OVERFLOW) {
910
+ oldItems = cutOffEvents(oldItems, overflow);
911
+ eventCount -= overflow;
912
+ }
913
+ return new Branch(oldItems.append(newItems), eventCount);
914
+ }
915
+ remapping(from, to) {
916
+ let maps = new Mapping();
917
+ this.items.forEach((item, i) => {
918
+ let mirrorPos = item.mirrorOffset != null && i - item.mirrorOffset >= from ? maps.maps.length - item.mirrorOffset : undefined;
919
+ maps.appendMap(item.map, mirrorPos);
920
+ }, from, to);
921
+ return maps;
922
+ }
923
+ addMaps(array) {
924
+ if (this.eventCount == 0) return this;
925
+ return new Branch(this.items.append(array.map(map => new Item(map))), this.eventCount);
926
+ }
927
+ // When the collab module receives remote changes, the history has
928
+ // to know about those, so that it can adjust the steps that were
929
+ // rebased on top of the remote changes, and include the position
930
+ // maps for the remote changes in its array of items.
931
+ rebased(rebasedTransform, rebasedCount) {
932
+ if (!this.eventCount) return this;
933
+ let rebasedItems = [],
934
+ start = Math.max(0, this.items.length - rebasedCount);
935
+ let mapping = rebasedTransform.mapping;
936
+ let newUntil = rebasedTransform.steps.length;
937
+ let eventCount = this.eventCount;
938
+ this.items.forEach(item => {
939
+ if (item.selection) eventCount--;
940
+ }, start);
941
+ let iRebased = rebasedCount;
942
+ this.items.forEach(item => {
943
+ let pos = mapping.getMirror(--iRebased);
944
+ if (pos == null) return;
945
+ newUntil = Math.min(newUntil, pos);
946
+ let map = mapping.maps[pos];
947
+ if (item.step) {
948
+ let step = rebasedTransform.steps[pos].invert(rebasedTransform.docs[pos]);
949
+ let selection = item.selection && item.selection.map(mapping.slice(iRebased + 1, pos));
950
+ if (selection) eventCount++;
951
+ rebasedItems.push(new Item(map, step, selection));
952
+ } else {
953
+ rebasedItems.push(new Item(map));
954
+ }
955
+ }, start);
956
+ let newMaps = [];
957
+ for (let i = rebasedCount; i < newUntil; i++) newMaps.push(new Item(mapping.maps[i]));
958
+ let items = this.items.slice(0, start).append(newMaps).append(rebasedItems);
959
+ let branch = new Branch(items, eventCount);
960
+ if (branch.emptyItemCount() > max_empty_items) branch = branch.compress(this.items.length - rebasedItems.length);
961
+ return branch;
962
+ }
963
+ emptyItemCount() {
964
+ let count = 0;
965
+ this.items.forEach(item => {
966
+ if (!item.step) count++;
967
+ });
968
+ return count;
969
+ }
970
+ // Compressing a branch means rewriting it to push the air (map-only
971
+ // items) out. During collaboration, these naturally accumulate
972
+ // because each remote change adds one. The `upto` argument is used
973
+ // to ensure that only the items below a given level are compressed,
974
+ // because `rebased` relies on a clean, untouched set of items in
975
+ // order to associate old items with rebased steps.
976
+ compress() {
977
+ let upto = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.items.length;
978
+ let remap = this.remapping(0, upto),
979
+ mapFrom = remap.maps.length;
980
+ let items = [],
981
+ events = 0;
982
+ this.items.forEach((item, i) => {
983
+ if (i >= upto) {
984
+ items.push(item);
985
+ if (item.selection) events++;
986
+ } else if (item.step) {
987
+ let step = item.step.map(remap.slice(mapFrom)),
988
+ map = step && step.getMap();
989
+ mapFrom--;
990
+ if (map) remap.appendMap(map, mapFrom);
991
+ if (step) {
992
+ let selection = item.selection && item.selection.map(remap.slice(mapFrom));
993
+ if (selection) events++;
994
+ let newItem = new Item(map.invert(), step, selection),
995
+ merged,
996
+ last = items.length - 1;
997
+ if (merged = items.length && items[last].merge(newItem)) items[last] = merged;else items.push(newItem);
998
+ }
999
+ } else if (item.map) {
1000
+ mapFrom--;
1001
+ }
1002
+ }, this.items.length, 0);
1003
+ return new Branch(RopeSequence.from(items.reverse()), events);
1004
+ }
1005
+ }
1006
+ Branch.empty = new Branch(RopeSequence.empty, 0);
1007
+ function cutOffEvents(items, n) {
1008
+ let cutPoint;
1009
+ items.forEach((item, i) => {
1010
+ if (item.selection && n-- == 0) {
1011
+ cutPoint = i;
1012
+ return false;
1013
+ }
1014
+ });
1015
+ return items.slice(cutPoint);
1016
+ }
1017
+ class Item {
1018
+ constructor(
1019
+ // The (forward) step map for this item.
1020
+ map,
1021
+ // The inverted step
1022
+ step,
1023
+ // If this is non-null, this item is the start of a group, and
1024
+ // this selection is the starting selection for the group (the one
1025
+ // that was active before the first step was applied)
1026
+ selection,
1027
+ // If this item is the inverse of a previous mapping on the stack,
1028
+ // this points at the inverse's offset
1029
+ mirrorOffset) {
1030
+ this.map = map;
1031
+ this.step = step;
1032
+ this.selection = selection;
1033
+ this.mirrorOffset = mirrorOffset;
1034
+ }
1035
+ merge(other) {
1036
+ if (this.step && other.step && !other.selection) {
1037
+ let step = other.step.merge(this.step);
1038
+ if (step) return new Item(step.getMap().invert(), step, this.selection);
1039
+ }
1040
+ }
1041
+ }
1042
+ // The value of the state field that tracks undo/redo history for that
1043
+ // state. Will be stored in the plugin state when the history plugin
1044
+ // is active.
1045
+ class HistoryState {
1046
+ constructor(done, undone, prevRanges, prevTime, prevComposition) {
1047
+ this.done = done;
1048
+ this.undone = undone;
1049
+ this.prevRanges = prevRanges;
1050
+ this.prevTime = prevTime;
1051
+ this.prevComposition = prevComposition;
1052
+ }
1053
+ }
1054
+ const DEPTH_OVERFLOW = 20;
1055
+ // Record a transformation in undo history.
1056
+ function applyTransaction(history, state, tr, options) {
1057
+ let historyTr = tr.getMeta(historyKey),
1058
+ rebased;
1059
+ if (historyTr) return historyTr.historyState;
1060
+ if (tr.getMeta(closeHistoryKey)) history = new HistoryState(history.done, history.undone, null, 0, -1);
1061
+ let appended = tr.getMeta("appendedTransaction");
1062
+ if (tr.steps.length == 0) {
1063
+ return history;
1064
+ } else if (appended && appended.getMeta(historyKey)) {
1065
+ if (appended.getMeta(historyKey).redo) return new HistoryState(history.done.addTransform(tr, undefined, options, mustPreserveItems(state)), history.undone, rangesFor(tr.mapping.maps[tr.steps.length - 1]), history.prevTime, history.prevComposition);else return new HistoryState(history.done, history.undone.addTransform(tr, undefined, options, mustPreserveItems(state)), null, history.prevTime, history.prevComposition);
1066
+ } else if (tr.getMeta("addToHistory") !== false && !(appended && appended.getMeta("addToHistory") === false)) {
1067
+ // Group transforms that occur in quick succession into one event.
1068
+ let composition = tr.getMeta("composition");
1069
+ let newGroup = history.prevTime == 0 || !appended && history.prevComposition != composition && (history.prevTime < (tr.time || 0) - options.newGroupDelay || !isAdjacentTo(tr, history.prevRanges));
1070
+ let prevRanges = appended ? mapRanges(history.prevRanges, tr.mapping) : rangesFor(tr.mapping.maps[tr.steps.length - 1]);
1071
+ return new HistoryState(history.done.addTransform(tr, newGroup ? state.selection.getBookmark() : undefined, options, mustPreserveItems(state)), Branch.empty, prevRanges, tr.time, composition == null ? history.prevComposition : composition);
1072
+ } else if (rebased = tr.getMeta("rebased")) {
1073
+ // Used by the collab module to tell the history that some of its
1074
+ // content has been rebased.
1075
+ return new HistoryState(history.done.rebased(tr, rebased), history.undone.rebased(tr, rebased), mapRanges(history.prevRanges, tr.mapping), history.prevTime, history.prevComposition);
1076
+ } else {
1077
+ return new HistoryState(history.done.addMaps(tr.mapping.maps), history.undone.addMaps(tr.mapping.maps), mapRanges(history.prevRanges, tr.mapping), history.prevTime, history.prevComposition);
1078
+ }
1079
+ }
1080
+ function isAdjacentTo(transform, prevRanges) {
1081
+ if (!prevRanges) return false;
1082
+ if (!transform.docChanged) return true;
1083
+ let adjacent = false;
1084
+ transform.mapping.maps[0].forEach((start, end) => {
1085
+ for (let i = 0; i < prevRanges.length; i += 2) if (start <= prevRanges[i + 1] && end >= prevRanges[i]) adjacent = true;
1086
+ });
1087
+ return adjacent;
1088
+ }
1089
+ function rangesFor(map) {
1090
+ let result = [];
1091
+ map.forEach((_from, _to, from, to) => result.push(from, to));
1092
+ return result;
1093
+ }
1094
+ function mapRanges(ranges, mapping) {
1095
+ if (!ranges) return null;
1096
+ let result = [];
1097
+ for (let i = 0; i < ranges.length; i += 2) {
1098
+ let from = mapping.map(ranges[i], 1),
1099
+ to = mapping.map(ranges[i + 1], -1);
1100
+ if (from <= to) result.push(from, to);
1101
+ }
1102
+ return result;
1103
+ }
1104
+ // Apply the latest event from one branch to the document and shift the event
1105
+ // onto the other branch.
1106
+ function histTransaction(history, state, dispatch, redo) {
1107
+ let preserveItems = mustPreserveItems(state);
1108
+ let histOptions = historyKey.get(state).spec.config;
1109
+ let pop = (redo ? history.undone : history.done).popEvent(state, preserveItems);
1110
+ if (!pop) return;
1111
+ let selection = pop.selection.resolve(pop.transform.doc);
1112
+ let added = (redo ? history.done : history.undone).addTransform(pop.transform, state.selection.getBookmark(), histOptions, preserveItems);
1113
+ let newHist = new HistoryState(redo ? added : pop.remaining, redo ? pop.remaining : added, null, 0, -1);
1114
+ dispatch(pop.transform.setSelection(selection).setMeta(historyKey, {
1115
+ redo,
1116
+ historyState: newHist
1117
+ }).scrollIntoView());
1118
+ }
1119
+ let cachedPreserveItems = false,
1120
+ cachedPreserveItemsPlugins = null;
1121
+ // Check whether any plugin in the given state has a
1122
+ // `historyPreserveItems` property in its spec, in which case we must
1123
+ // preserve steps exactly as they came in, so that they can be
1124
+ // rebased.
1125
+ function mustPreserveItems(state) {
1126
+ let plugins = state.plugins;
1127
+ if (cachedPreserveItemsPlugins != plugins) {
1128
+ cachedPreserveItems = false;
1129
+ cachedPreserveItemsPlugins = plugins;
1130
+ for (let i = 0; i < plugins.length; i++) if (plugins[i].spec.historyPreserveItems) {
1131
+ cachedPreserveItems = true;
1132
+ break;
1133
+ }
1134
+ }
1135
+ return cachedPreserveItems;
1136
+ }
1137
+ const historyKey = new PluginKey("history");
1138
+ const closeHistoryKey = new PluginKey("closeHistory");
1139
+ /**
1140
+ Returns a plugin that enables the undo history for an editor. The
1141
+ plugin will track undo and redo stacks, which can be used with the
1142
+ [`undo`](https://prosemirror.net/docs/ref/#history.undo) and [`redo`](https://prosemirror.net/docs/ref/#history.redo) commands.
1143
+
1144
+ You can set an `"addToHistory"` [metadata
1145
+ property](https://prosemirror.net/docs/ref/#state.Transaction.setMeta) of `false` on a transaction
1146
+ to prevent it from being rolled back by undo.
1147
+ */
1148
+ function history() {
1149
+ let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1150
+ config = {
1151
+ depth: config.depth || 100,
1152
+ newGroupDelay: config.newGroupDelay || 500
1153
+ };
1154
+ return new Plugin({
1155
+ key: historyKey,
1156
+ state: {
1157
+ init() {
1158
+ return new HistoryState(Branch.empty, Branch.empty, null, 0, -1);
1159
+ },
1160
+ apply(tr, hist, state) {
1161
+ return applyTransaction(hist, state, tr, config);
1162
+ }
1163
+ },
1164
+ config,
1165
+ props: {
1166
+ handleDOMEvents: {
1167
+ beforeinput(view, e) {
1168
+ let inputType = e.inputType;
1169
+ let command = inputType == "historyUndo" ? undo : inputType == "historyRedo" ? redo : null;
1170
+ if (!command) return false;
1171
+ e.preventDefault();
1172
+ return command(view.state, view.dispatch);
1173
+ }
1174
+ }
1175
+ }
1176
+ });
1177
+ }
1178
+ /**
1179
+ A command function that undoes the last change, if any.
1180
+ */
1181
+ const undo = (state, dispatch) => {
1182
+ let hist = historyKey.getState(state);
1183
+ if (!hist || hist.done.eventCount == 0) return false;
1184
+ if (dispatch) histTransaction(hist, state, dispatch, false);
1185
+ return true;
1186
+ };
1187
+ /**
1188
+ A command function that redoes the last undone change, if any.
1189
+ */
1190
+ const redo = (state, dispatch) => {
1191
+ let hist = historyKey.getState(state);
1192
+ if (!hist || hist.undone.eventCount == 0) return false;
1193
+ if (dispatch) histTransaction(hist, state, dispatch, true);
1194
+ return true;
1195
+ };
1196
+
1197
+ const History = Extension.create({
1198
+ name: 'history',
1199
+ addOptions() {
1200
+ return {
1201
+ depth: 100,
1202
+ newGroupDelay: 500
1203
+ };
1204
+ },
1205
+ addCommands() {
1206
+ return {
1207
+ undo: () => _ref => {
1208
+ let {
1209
+ state,
1210
+ dispatch
1211
+ } = _ref;
1212
+ return undo(state, dispatch);
1213
+ },
1214
+ redo: () => _ref2 => {
1215
+ let {
1216
+ state,
1217
+ dispatch
1218
+ } = _ref2;
1219
+ return redo(state, dispatch);
1220
+ }
1221
+ };
1222
+ },
1223
+ addProseMirrorPlugins() {
1224
+ return [history(this.options)];
1225
+ },
1226
+ addKeyboardShortcuts() {
1227
+ return {
1228
+ 'Mod-z': () => this.editor.commands.undo(),
1229
+ 'Mod-y': () => this.editor.commands.redo(),
1230
+ 'Shift-Mod-z': () => this.editor.commands.redo(),
1231
+ // Russian keyboard layouts
1232
+ 'Mod-я': () => this.editor.commands.undo(),
1233
+ 'Shift-Mod-я': () => this.editor.commands.redo()
1234
+ };
1235
+ }
1236
+ });
1237
+
1238
+ const HorizontalRule = Node.create({
1239
+ name: 'horizontalRule',
1240
+ addOptions() {
1241
+ return {
1242
+ HTMLAttributes: {}
1243
+ };
1244
+ },
1245
+ group: 'block',
1246
+ parseHTML() {
1247
+ return [{
1248
+ tag: 'hr'
1249
+ }];
1250
+ },
1251
+ renderHTML(_ref) {
1252
+ let {
1253
+ HTMLAttributes
1254
+ } = _ref;
1255
+ return ['hr', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
1256
+ },
1257
+ addCommands() {
1258
+ return {
1259
+ setHorizontalRule: () => _ref2 => {
1260
+ let {
1261
+ chain
1262
+ } = _ref2;
1263
+ return chain().insertContent({
1264
+ type: this.name
1265
+ })
1266
+ // set cursor after horizontal rule
1267
+ .command(_ref3 => {
1268
+ let {
1269
+ tr,
1270
+ dispatch
1271
+ } = _ref3;
1272
+ var _a;
1273
+ if (dispatch) {
1274
+ const {
1275
+ $to
1276
+ } = tr.selection;
1277
+ const posAfter = $to.end();
1278
+ if ($to.nodeAfter) {
1279
+ tr.setSelection(TextSelection.create(tr.doc, $to.pos));
1280
+ } else {
1281
+ // add node after horizontal rule if it’s the end of the document
1282
+ const node = (_a = $to.parent.type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.create();
1283
+ if (node) {
1284
+ tr.insert(posAfter, node);
1285
+ tr.setSelection(TextSelection.create(tr.doc, posAfter));
1286
+ }
1287
+ }
1288
+ tr.scrollIntoView();
1289
+ }
1290
+ return true;
1291
+ }).run();
1292
+ }
1293
+ };
1294
+ },
1295
+ addInputRules() {
1296
+ return [nodeInputRule({
1297
+ find: /^(?:---|—-|___\s|\*\*\*\s)$/,
1298
+ type: this.type
1299
+ })];
1300
+ }
1301
+ });
1302
+
1303
+ const Text = Node.create({
1304
+ name: 'text',
1305
+ group: 'inline'
1306
+ });
1307
+
1308
+ const StarterKit = Extension.create({
1309
+ name: 'starterKit',
1310
+ addExtensions() {
1311
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
1312
+ const extensions = [];
1313
+ if (this.options.blockquote !== false) {
1314
+ extensions.push(Blockquote.configure((_a = this.options) === null || _a === void 0 ? void 0 : _a.blockquote));
1315
+ }
1316
+ if (this.options.bold !== false) {
1317
+ extensions.push(Bold.configure((_b = this.options) === null || _b === void 0 ? void 0 : _b.bold));
1318
+ }
1319
+ if (this.options.bulletList !== false) {
1320
+ extensions.push(BulletList.configure((_c = this.options) === null || _c === void 0 ? void 0 : _c.bulletList));
1321
+ }
1322
+ if (this.options.code !== false) {
1323
+ extensions.push(Code.configure((_d = this.options) === null || _d === void 0 ? void 0 : _d.code));
1324
+ }
1325
+ if (this.options.codeBlock !== false) {
1326
+ extensions.push(CodeBlock.configure((_e = this.options) === null || _e === void 0 ? void 0 : _e.codeBlock));
1327
+ }
1328
+ if (this.options.document !== false) {
1329
+ extensions.push(Document.configure((_f = this.options) === null || _f === void 0 ? void 0 : _f.document));
1330
+ }
1331
+ if (this.options.dropcursor !== false) {
1332
+ extensions.push(Dropcursor.configure((_g = this.options) === null || _g === void 0 ? void 0 : _g.dropcursor));
1333
+ }
1334
+ if (this.options.gapcursor !== false) {
1335
+ extensions.push(Gapcursor.configure((_h = this.options) === null || _h === void 0 ? void 0 : _h.gapcursor));
1336
+ }
1337
+ if (this.options.hardBreak !== false) {
1338
+ extensions.push(HardBreak.configure((_j = this.options) === null || _j === void 0 ? void 0 : _j.hardBreak));
1339
+ }
1340
+ if (this.options.heading !== false) {
1341
+ extensions.push(Heading.configure((_k = this.options) === null || _k === void 0 ? void 0 : _k.heading));
1342
+ }
1343
+ if (this.options.history !== false) {
1344
+ extensions.push(History.configure((_l = this.options) === null || _l === void 0 ? void 0 : _l.history));
1345
+ }
1346
+ if (this.options.horizontalRule !== false) {
1347
+ extensions.push(HorizontalRule.configure((_m = this.options) === null || _m === void 0 ? void 0 : _m.horizontalRule));
1348
+ }
1349
+ if (this.options.italic !== false) {
1350
+ extensions.push(Italic.configure((_o = this.options) === null || _o === void 0 ? void 0 : _o.italic));
1351
+ }
1352
+ if (this.options.listItem !== false) {
1353
+ extensions.push(ListItem.configure((_p = this.options) === null || _p === void 0 ? void 0 : _p.listItem));
1354
+ }
1355
+ if (this.options.orderedList !== false) {
1356
+ extensions.push(OrderedList.configure((_q = this.options) === null || _q === void 0 ? void 0 : _q.orderedList));
1357
+ }
1358
+ if (this.options.paragraph !== false) {
1359
+ extensions.push(Paragraph.configure((_r = this.options) === null || _r === void 0 ? void 0 : _r.paragraph));
1360
+ }
1361
+ if (this.options.strike !== false) {
1362
+ extensions.push(Strike.configure((_s = this.options) === null || _s === void 0 ? void 0 : _s.strike));
1363
+ }
1364
+ if (this.options.text !== false) {
1365
+ extensions.push(Text.configure((_t = this.options) === null || _t === void 0 ? void 0 : _t.text));
1366
+ }
1367
+ return extensions;
1368
+ }
1369
+ });
1370
+
1371
+ const Placeholder = Extension.create({
1372
+ name: 'placeholder',
1373
+ addOptions() {
1374
+ return {
1375
+ emptyEditorClass: 'is-editor-empty',
1376
+ emptyNodeClass: 'is-empty',
1377
+ placeholder: 'Write something …',
1378
+ showOnlyWhenEditable: true,
1379
+ showOnlyCurrent: true,
1380
+ includeChildren: false
1381
+ };
1382
+ },
1383
+ addProseMirrorPlugins() {
1384
+ return [new Plugin({
1385
+ key: new PluginKey('placeholder'),
1386
+ props: {
1387
+ decorations: _ref => {
1388
+ let {
1389
+ doc,
1390
+ selection
1391
+ } = _ref;
1392
+ const active = this.editor.isEditable || !this.options.showOnlyWhenEditable;
1393
+ const {
1394
+ anchor
1395
+ } = selection;
1396
+ const decorations = [];
1397
+ if (!active) {
1398
+ return null;
1399
+ }
1400
+ // only calculate isEmpty once due to its performance impacts (see issue #3360)
1401
+ const emptyDocInstance = doc.type.createAndFill();
1402
+ const isEditorEmpty = (emptyDocInstance === null || emptyDocInstance === void 0 ? void 0 : emptyDocInstance.sameMarkup(doc)) && emptyDocInstance.content.findDiffStart(doc.content) === null;
1403
+ doc.descendants((node, pos) => {
1404
+ const hasAnchor = anchor >= pos && anchor <= pos + node.nodeSize;
1405
+ const isEmpty = !node.isLeaf && !node.childCount;
1406
+ if ((hasAnchor || !this.options.showOnlyCurrent) && isEmpty) {
1407
+ const classes = [this.options.emptyNodeClass];
1408
+ if (isEditorEmpty) {
1409
+ classes.push(this.options.emptyEditorClass);
1410
+ }
1411
+ const decoration = Decoration.node(pos, pos + node.nodeSize, {
1412
+ class: classes.join(' '),
1413
+ 'data-placeholder': typeof this.options.placeholder === 'function' ? this.options.placeholder({
1414
+ editor: this.editor,
1415
+ node,
1416
+ pos,
1417
+ hasAnchor
1418
+ }) : this.options.placeholder
1419
+ });
1420
+ decorations.push(decoration);
1421
+ }
1422
+ return this.options.includeChildren;
1423
+ });
1424
+ return DecorationSet.create(doc, decorations);
1425
+ }
1426
+ }
1427
+ })];
1428
+ }
1429
+ });
1430
+
1431
+ var script = defineComponent({
1432
+ name: 'OrRichTextEditor',
1433
+ components: {
1434
+ OrIconButton: script$1,
1435
+ OrLabel: script$2,
1436
+ OrMenuItem: script$3,
1437
+ OrMenu: script$4,
1438
+ OrModal: script$5,
1439
+ OrInput: script$6,
1440
+ OrButton: script$7,
1441
+ OrPopover: script$8
1442
+ },
1443
+ inheritAttrs: false,
1444
+ model: {
1445
+ prop: 'modelValue',
1446
+ event: 'update:modelValue'
1447
+ },
1448
+ props: {
1449
+ modelValue: {
1450
+ type: String,
1451
+ default: undefined
1452
+ },
1453
+ toolbar: {
1454
+ type: Array,
1455
+ default: () => []
1456
+ },
1457
+ description: {
1458
+ type: String,
1459
+ default: ''
1460
+ },
1461
+ placeholder: {
1462
+ type: String,
1463
+ default: ''
1464
+ },
1465
+ autofocus: {
1466
+ type: Boolean,
1467
+ default: false
1468
+ },
1469
+ format: {
1470
+ type: String,
1471
+ default: Formats.Markup
1472
+ },
1473
+ fullHeight: {
1474
+ type: Boolean,
1475
+ default: false
1476
+ }
1477
+ },
1478
+ emits: ['update:modelValue', 'input', 'file-upload'],
1479
+ expose: ['root'],
1480
+ setup(props, context) {
1481
+ // Refs
1482
+ const root = ref();
1483
+ let editor = null;
1484
+ const editorRef = ref();
1485
+ const textareaRef = ref();
1486
+ const containerRef = ref();
1487
+ const toolbarRef = ref();
1488
+ const moreButtonRef = ref();
1489
+ const moreRef = ref();
1490
+ const toolbarButtonRef = ref();
1491
+ const menuRef = ref();
1492
+ // isActive should be set with default values for all toolbar buttons, otherwise it will not work in vue2
1493
+ const isActive = ref({
1494
+ bold: false,
1495
+ italic: false,
1496
+ underline: false,
1497
+ strike: false,
1498
+ bulletList: false,
1499
+ orderedList: false,
1500
+ link: false,
1501
+ highlight: false,
1502
+ redo: false,
1503
+ undo: false,
1504
+ codeBlock: false,
1505
+ blockquote: false,
1506
+ file: false,
1507
+ source: false
1508
+ });
1509
+ const isFocused = ref(props.autofocus);
1510
+ const headingLevels = [1, 2, 3, 4];
1511
+ const activeHeadingLevel = ref(0);
1512
+ const markdownOutput = ref('');
1513
+ const isOpenLinkModal = ref(false);
1514
+ const disableMarkdown = ref(false);
1515
+ const text = ref('');
1516
+ const link = ref('');
1517
+ const countOfNotVisibleTools = ref(0);
1518
+ const sourceValue = ref('');
1519
+ let trap = useFocusTrap(editorRef, {
1520
+ immediate: true,
1521
+ fallbackFocus: '.container',
1522
+ allowOutsideClick: true
1523
+ });
1524
+ const iconsEnum = ref({
1525
+ bold: 'format_bold',
1526
+ italic: 'format_italic',
1527
+ underline: 'format_underlined',
1528
+ strike: 'format_strikethrough',
1529
+ bulletList: 'format_list_bulleted',
1530
+ orderedList: 'format_list_numbered',
1531
+ link: 'link',
1532
+ highlight: 'highlight',
1533
+ redo: 'redo',
1534
+ undo: 'undo',
1535
+ codeBlock: 'code_blocks',
1536
+ blockquote: 'format_quote',
1537
+ file: 'attach_file',
1538
+ source: 'source_notes'
1539
+ });
1540
+ const iconTooltipsEnum = ref({
1541
+ bold: 'Bold',
1542
+ italic: 'Italic',
1543
+ underline: 'Underline',
1544
+ strike: 'Strike',
1545
+ bulletList: 'Bulleted List',
1546
+ orderedList: 'Numbered List',
1547
+ link: 'Link',
1548
+ highlight: 'Highlight',
1549
+ redo: 'Redo',
1550
+ undo: 'Undo',
1551
+ codeBlock: 'Code Block',
1552
+ blockquote: 'Quote',
1553
+ file: 'File',
1554
+ source: 'Source'
1555
+ });
1556
+ useResizeObserver(root, useDebounceFn(entries => {
1557
+ var _a, _b;
1558
+ const entry = entries[0];
1559
+ const {
1560
+ width
1561
+ } = entry.contentRect;
1562
+ if (containerRef.value && toolbarRef.value && toolbarLength.value) {
1563
+ let lengthOfItem = 0;
1564
+ lengthOfItem = ((_b = (_a = toolbarRef.value.firstElementChild) === null || _a === void 0 ? void 0 : _a.firstElementChild) === null || _b === void 0 ? void 0 : _b.offsetWidth) + 16;
1565
+ const count = width / lengthOfItem - 2;
1566
+ countOfNotVisibleTools.value = Math.round(toolbarLength.value - count);
1567
+ }
1568
+ }, 10));
1569
+ onMounted(() => {
1570
+ editor = new Editor({
1571
+ onUpdate: _ref => {
1572
+ let {
1573
+ editor
1574
+ } = _ref;
1575
+ isFocused.value = true;
1576
+ setActiveFormats();
1577
+ const html = editor.getHTML();
1578
+ const text = editor.getText();
1579
+ if (props.format === 'markdown') {
1580
+ markdownOutput.value = serialize(editor.schema, editor.getJSON());
1581
+ proxyModelValue.value = markdownOutput.value;
1582
+ } else {
1583
+ proxyModelValue.value = text === '' ? text : html;
1584
+ }
1585
+ },
1586
+ onCreate: _ref2 => {
1587
+ let {
1588
+ editor
1589
+ } = _ref2;
1590
+ if (props.format === 'markdown') {
1591
+ const deserialized = deserialize(editor.schema, proxyModelValue.value);
1592
+ editor.commands.setContent(deserialized);
1593
+ } else {
1594
+ editor.commands.setContent(proxyModelValue.value);
1595
+ }
1596
+ },
1597
+ element: editorRef.value,
1598
+ autofocus: props.autofocus,
1599
+ enableInputRules: true,
1600
+ enablePasteRules: true,
1601
+ extensions: [codemirrorNode, StarterKit.configure({
1602
+ heading: false,
1603
+ codeBlock: false,
1604
+ paragraph: false,
1605
+ bulletList: false,
1606
+ orderedList: false,
1607
+ blockquote: false
1608
+ }), Paragraph.configure({
1609
+ HTMLAttributes: {
1610
+ class: 'my-xs'
1611
+ }
1612
+ }), BulletList.configure({
1613
+ HTMLAttributes: {
1614
+ class: 'mx-lg my-xs list-disc'
1615
+ }
1616
+ }), OrderedList.configure({
1617
+ HTMLAttributes: {
1618
+ class: 'mx-lg my-xs list-decimal'
1619
+ }
1620
+ }), Blockquote.configure({
1621
+ HTMLAttributes: {
1622
+ class: 'my-sm mx-lg px-lg border-l-2 border-outline'
1623
+ }
1624
+ }), Heading.configure({
1625
+ levels: headingLevels
1626
+ }).extend({
1627
+ levels: headingLevels,
1628
+ renderHTML(_ref3) {
1629
+ let {
1630
+ node,
1631
+ HTMLAttributes
1632
+ } = _ref3;
1633
+ return ['h' + node.attrs.level, mergeAttributes(HTMLAttributes, {
1634
+ class: `typography-headline-${node.attrs.level} my-xs`
1635
+ }), 0];
1636
+ }
1637
+ }), Underline, Link.configure({
1638
+ openOnClick: true,
1639
+ linkOnPaste: true,
1640
+ autolink: false,
1641
+ protocols: ['ftp', 'mailto', 'http', 'https'],
1642
+ validate: href => /^https?:\/\//.test(href),
1643
+ HTMLAttributes: {
1644
+ class: 'text-primary cursor-pointer'
1645
+ }
1646
+ }), Highlight, Placeholder.configure({
1647
+ placeholder: props.placeholder,
1648
+ emptyEditorClass: 'is-editor-empty text-outline'
1649
+ })],
1650
+ editorProps: {
1651
+ attributes: {
1652
+ class: 'flex flex-col focus:outline-none gap-xs'
1653
+ }
1654
+ },
1655
+ parseOptions: {
1656
+ preserveWhitespace: true
1657
+ }
1658
+ });
1659
+ setActiveFormats();
1660
+ trap.activate();
1661
+ });
1662
+ onBeforeUnmount(() => {
1663
+ editor === null || editor === void 0 ? void 0 : editor.destroy();
1664
+ });
1665
+ onClickOutside(root, () => {
1666
+ isFocused.value = false;
1667
+ trap.deactivate();
1668
+ });
1669
+ // Computed
1670
+ const proxyModelValue = computed({
1671
+ get: () => {
1672
+ return props.modelValue;
1673
+ },
1674
+ set: value => {
1675
+ context.emit('input', value);
1676
+ context.emit('update:modelValue', value);
1677
+ }
1678
+ });
1679
+ const getIndexOfHeading = computed(() => {
1680
+ return props.toolbar.flat().indexOf('heading');
1681
+ });
1682
+ const headingIcon = computed(() => {
1683
+ if (activeHeadingLevel.value && isActive.value.heading) {
1684
+ return `format_h${activeHeadingLevel.value}`;
1685
+ }
1686
+ return 'format_paragraph';
1687
+ });
1688
+ const toolbarLength = computed(() => {
1689
+ return props.toolbar.flat().length;
1690
+ });
1691
+ const notVisibleTools = computed(() => {
1692
+ const count = countOfNotVisibleTools.value;
1693
+ const toolbar = props.toolbar.flat();
1694
+ let notVisible = new Set(toolbar.slice(toolbar.length - count, toolbar.length));
1695
+ props.toolbar.forEach(tools => {
1696
+ if (tools.some(item => notVisible.has(item))) {
1697
+ tools.forEach(item => notVisible.add(item));
1698
+ }
1699
+ });
1700
+ return notVisible;
1701
+ });
1702
+ //Methods
1703
+ const handleEditorClick = () => {
1704
+ var _a;
1705
+ setActiveFormats();
1706
+ isFocused.value = true;
1707
+ editor === null || editor === void 0 ? void 0 : editor.commands.focus();
1708
+ activeHeadingLevel.value = ((_a = editor === null || editor === void 0 ? void 0 : editor.getAttributes('heading')) === null || _a === void 0 ? void 0 : _a.level) || 0;
1709
+ };
1710
+ const isVisible = value => {
1711
+ if (Array.isArray(value)) {
1712
+ const isHaveNotVisibleTools = value.some(item => notVisibleTools.value.has(item));
1713
+ return isHaveNotVisibleTools;
1714
+ }
1715
+ return !notVisibleTools.value.has(value);
1716
+ };
1717
+ const handleInput = event => {
1718
+ const target = event.target;
1719
+ const value = target.value;
1720
+ editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, value));
1721
+ markdownOutput.value = serialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getJSON());
1722
+ proxyModelValue.value = markdownOutput.value;
1723
+ };
1724
+ const handleToolbarClick = (item, level) => {
1725
+ var _a, _b;
1726
+ switch (item) {
1727
+ case 'source':
1728
+ disableMarkdown.value = !disableMarkdown.value;
1729
+ sourceValue.value = serialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getJSON());
1730
+ nextTick(() => {
1731
+ var _a;
1732
+ return (_a = textareaRef.value) === null || _a === void 0 ? void 0 : _a.focus();
1733
+ });
1734
+ break;
1735
+ case 'bulletList':
1736
+ case 'orderedList':
1737
+ item === 'bulletList' ? editor === null || editor === void 0 ? void 0 : editor.commands.toggleBulletList() : editor === null || editor === void 0 ? void 0 : editor.commands.toggleOrderedList();
1738
+ break;
1739
+ case 'link':
1740
+ if (editor) {
1741
+ const cursorPosition = (editor === null || editor === void 0 ? void 0 : editor.state.selection.$anchor.pos) || 0;
1742
+ const {
1743
+ from,
1744
+ to,
1745
+ empty
1746
+ } = editor.state.selection;
1747
+ const isLink = (_a = editor.view.state.doc.nodeAt(cursorPosition)) === null || _a === void 0 ? void 0 : _a.marks.filter(mark => mark.type.name === 'link');
1748
+ const existedText = (isLink === null || isLink === void 0 ? void 0 : isLink.length) ? ((_b = editor.view.state.doc.nodeAt(cursorPosition)) === null || _b === void 0 ? void 0 : _b.text) || '' : '';
1749
+ text.value = empty ? existedText : editor.state.doc.textBetween(from, to, ' ');
1750
+ link.value = editor.getAttributes('link').href || '';
1751
+ }
1752
+ isOpenLinkModal.value = !isOpenLinkModal.value;
1753
+ break;
1754
+ case 'blockquote':
1755
+ editor === null || editor === void 0 ? void 0 : editor.chain().focus().toggleBlockquote().run();
1756
+ break;
1757
+ case 'codeBlock':
1758
+ if (!isActive.value['codeBlock']) {
1759
+ editor === null || editor === void 0 ? void 0 : editor.commands.setNode(item, {
1760
+ language: 'javascript'
1761
+ });
1762
+ } else {
1763
+ editor === null || editor === void 0 ? void 0 : editor.commands.setNode('paragraph');
1764
+ }
1765
+ break;
1766
+ case 'heading':
1767
+ if (!level) {
1768
+ editor === null || editor === void 0 ? void 0 : editor.commands.setParagraph();
1769
+ activeHeadingLevel.value = 0;
1770
+ } else {
1771
+ activeHeadingLevel.value = level;
1772
+ editor === null || editor === void 0 ? void 0 : editor.commands.toggleHeading({
1773
+ level: level
1774
+ });
1775
+ }
1776
+ editor === null || editor === void 0 ? void 0 : editor.commands.focus();
1777
+ break;
1778
+ case 'undo':
1779
+ case 'redo':
1780
+ item === 'undo' ? editor === null || editor === void 0 ? void 0 : editor.commands.undo() : editor === null || editor === void 0 ? void 0 : editor.commands.redo();
1781
+ break;
1782
+ case 'file':
1783
+ context.emit('file-upload');
1784
+ break;
1785
+ default:
1786
+ editor === null || editor === void 0 ? void 0 : editor.chain().focus().toggleMark(item).run();
1787
+ break;
1788
+ }
1789
+ };
1790
+ const attachLink = async () => {
1791
+ var _a, _b;
1792
+ // empty
1793
+ if (link.value === '') {
1794
+ editor === null || editor === void 0 ? void 0 : editor.chain().focus().extendMarkRange('link').unsetLink().run();
1795
+ }
1796
+ const isEmptySelection = editor === null || editor === void 0 ? void 0 : editor.state.selection.empty;
1797
+ const cursorPosition = (editor === null || editor === void 0 ? void 0 : editor.state.selection.$anchor.pos) || 0;
1798
+ const isLink = (_a = editor === null || editor === void 0 ? void 0 : editor.view.state.doc.nodeAt(cursorPosition)) === null || _a === void 0 ? void 0 : _a.marks.filter(mark => mark.type.name === 'link');
1799
+ const existedText = (isLink === null || isLink === void 0 ? void 0 : isLink.length) ? (_b = editor === null || editor === void 0 ? void 0 : editor.view.state.doc.nodeAt(cursorPosition)) === null || _b === void 0 ? void 0 : _b.text : '';
1800
+ if (link.value && isEmptySelection && !existedText) {
1801
+ editor === null || editor === void 0 ? void 0 : editor.chain().focus().setMark('link', {
1802
+ href: link.value,
1803
+ target: '__blank'
1804
+ }).command(_ref4 => {
1805
+ let {
1806
+ tr
1807
+ } = _ref4;
1808
+ const preparedValue = text.value[text.value.length - 1] === ' ' ? text.value : `${text.value} `;
1809
+ tr.insertText(preparedValue);
1810
+ return true;
1811
+ }).run();
1812
+ }
1813
+ if (link.value && existedText === text.value && isEmptySelection) {
1814
+ editor === null || editor === void 0 ? void 0 : editor.chain().extendMarkRange('link').updateAttributes('link', {
1815
+ href: link.value
1816
+ }).run();
1817
+ }
1818
+ if (link.value && !isEmptySelection) {
1819
+ editor === null || editor === void 0 ? void 0 : editor.chain().focus().setMark('link', {
1820
+ href: link.value,
1821
+ target: '__blank'
1822
+ }).run();
1823
+ }
1824
+ text.value = '';
1825
+ link.value = '';
1826
+ isOpenLinkModal.value = false;
1827
+ };
1828
+ const discardLink = () => {
1829
+ isOpenLinkModal.value = false;
1830
+ };
1831
+ const setActiveFormats = () => {
1832
+ const toolbarList = props.toolbar.flat();
1833
+ toolbarList.forEach(item => {
1834
+ if (item === 'source') {
1835
+ isActive.value[item] = disableMarkdown.value;
1836
+ } else {
1837
+ isActive.value[item] = (editor === null || editor === void 0 ? void 0 : editor.isActive(item)) || false;
1838
+ }
1839
+ });
1840
+ };
1841
+ // Styles
1842
+ const rootStyles = computed(() => {
1843
+ return ['or-rich-text-editor', ...(props.fullHeight ? ['h-full'] : [])];
1844
+ });
1845
+ const containerStyles = computed(() => {
1846
+ return [...EditorContainer, ...(props.fullHeight ? ['h-full'] : [])];
1847
+ });
1848
+ const toolbarContainerStyles = computed(() => {
1849
+ return [...ToolbarContainer];
1850
+ });
1851
+ const toolbarStyles = computed(() => {
1852
+ return [...Toolbar,
1853
+ // 'overflow-x-hidden',
1854
+ ...(isFocused.value ? ToolbarButtonFocused : ToolbarButton)];
1855
+ });
1856
+ const editorInputStyles = computed(() => {
1857
+ return ['tiptap-editor-v3', ...(props.fullHeight ? ['h-full overflow-y-auto'] : []), ...EditorInput];
1858
+ });
1859
+ //Effects
1860
+ watch(proxyModelValue, value => {
1861
+ if (value !== (editor === null || editor === void 0 ? void 0 : editor.getHTML()) && props.format !== 'markdown') {
1862
+ editor === null || editor === void 0 ? void 0 : editor.commands.setContent(value);
1863
+ }
1864
+ if (props.format === 'markdown' && value !== markdownOutput.value) {
1865
+ //TODO: const deserialized = deserialize(editor?.schema, value);
1866
+ editor === null || editor === void 0 ? void 0 : editor.commands.setContent(value);
1867
+ }
1868
+ });
1869
+ return {
1870
+ editor,
1871
+ editorRef,
1872
+ toolbarRef,
1873
+ containerRef,
1874
+ toolbarButtonRef,
1875
+ moreButtonRef,
1876
+ textareaRef,
1877
+ moreRef,
1878
+ menuRef,
1879
+ iconsEnum,
1880
+ handleToolbarClick,
1881
+ handleEditorClick,
1882
+ isActive,
1883
+ iconTooltipsEnum,
1884
+ containerStyles,
1885
+ toolbarContainerStyles,
1886
+ toolbarStyles,
1887
+ rootStyles,
1888
+ root,
1889
+ editorInputStyles,
1890
+ getIndexOfHeading,
1891
+ headingLevels,
1892
+ headingIcon,
1893
+ attachLink,
1894
+ discardLink,
1895
+ isOpenLinkModal,
1896
+ text,
1897
+ link,
1898
+ isFocused,
1899
+ isVisible,
1900
+ countOfNotVisibleTools,
1901
+ notVisibleTools,
1902
+ handleInput,
1903
+ proxyModelValue,
1904
+ disableMarkdown,
1905
+ sourceValue
1906
+ };
1907
+ }
1908
+ });
1909
+
1910
+ export { script as s };