@nextcloud/vue 8.0.0-beta.7 → 8.0.0-beta.9

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 (583) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/Components/NcActionButton.cjs +49 -1
  3. package/dist/Components/NcActionButton.cjs.map +1 -1
  4. package/dist/Components/NcActionButton.mjs +49 -13
  5. package/dist/Components/NcActionButton.mjs.map +1 -1
  6. package/dist/Components/NcActionButtonGroup.cjs +30 -1
  7. package/dist/Components/NcActionButtonGroup.cjs.map +1 -1
  8. package/dist/Components/NcActionButtonGroup.mjs +30 -9
  9. package/dist/Components/NcActionButtonGroup.mjs.map +1 -1
  10. package/dist/Components/NcActionCaption.cjs +29 -1
  11. package/dist/Components/NcActionCaption.cjs.map +1 -1
  12. package/dist/Components/NcActionCaption.mjs +29 -9
  13. package/dist/Components/NcActionCaption.mjs.map +1 -1
  14. package/dist/Components/NcActionCheckbox.cjs +78 -1
  15. package/dist/Components/NcActionCheckbox.cjs.map +1 -1
  16. package/dist/Components/NcActionCheckbox.mjs +80 -19
  17. package/dist/Components/NcActionCheckbox.mjs.map +1 -1
  18. package/dist/Components/NcActionInput.cjs +231 -1
  19. package/dist/Components/NcActionInput.cjs.map +1 -1
  20. package/dist/Components/NcActionInput.mjs +235 -70
  21. package/dist/Components/NcActionInput.mjs.map +1 -1
  22. package/dist/Components/NcActionLink.cjs +69 -1
  23. package/dist/Components/NcActionLink.cjs.map +1 -1
  24. package/dist/Components/NcActionLink.mjs +66 -14
  25. package/dist/Components/NcActionLink.mjs.map +1 -1
  26. package/dist/Components/NcActionRadio.cjs +85 -1
  27. package/dist/Components/NcActionRadio.cjs.map +1 -1
  28. package/dist/Components/NcActionRadio.mjs +87 -19
  29. package/dist/Components/NcActionRadio.mjs.map +1 -1
  30. package/dist/Components/NcActionRouter.cjs +42 -1
  31. package/dist/Components/NcActionRouter.cjs.map +1 -1
  32. package/dist/Components/NcActionRouter.mjs +41 -12
  33. package/dist/Components/NcActionRouter.mjs.map +1 -1
  34. package/dist/Components/NcActionSeparator.cjs +20 -1
  35. package/dist/Components/NcActionSeparator.cjs.map +1 -1
  36. package/dist/Components/NcActionSeparator.mjs +20 -9
  37. package/dist/Components/NcActionSeparator.mjs.map +1 -1
  38. package/dist/Components/NcActionText.cjs +23 -1
  39. package/dist/Components/NcActionText.cjs.map +1 -1
  40. package/dist/Components/NcActionText.mjs +21 -9
  41. package/dist/Components/NcActionText.mjs.map +1 -1
  42. package/dist/Components/NcActionTextEditable.cjs +81 -1
  43. package/dist/Components/NcActionTextEditable.cjs.map +1 -1
  44. package/dist/Components/NcActionTextEditable.mjs +79 -22
  45. package/dist/Components/NcActionTextEditable.mjs.map +1 -1
  46. package/dist/Components/NcActions.cjs +459 -1
  47. package/dist/Components/NcActions.cjs.map +1 -1
  48. package/dist/Components/NcActions.mjs +463 -100
  49. package/dist/Components/NcActions.mjs.map +1 -1
  50. package/dist/Components/NcAppContent.cjs +218 -1
  51. package/dist/Components/NcAppContent.cjs.map +1 -1
  52. package/dist/Components/NcAppContent.mjs +220 -66
  53. package/dist/Components/NcAppContent.mjs.map +1 -1
  54. package/dist/Components/NcAppContentDetails.cjs +19 -1
  55. package/dist/Components/NcAppContentDetails.cjs.map +1 -1
  56. package/dist/Components/NcAppContentDetails.mjs +18 -7
  57. package/dist/Components/NcAppContentDetails.mjs.map +1 -1
  58. package/dist/Components/NcAppContentList.cjs +29 -1
  59. package/dist/Components/NcAppContentList.cjs.map +1 -1
  60. package/dist/Components/NcAppContentList.mjs +29 -8
  61. package/dist/Components/NcAppContentList.mjs.map +1 -1
  62. package/dist/Components/NcAppNavigation.cjs +66 -1
  63. package/dist/Components/NcAppNavigation.cjs.map +1 -1
  64. package/dist/Components/NcAppNavigation.mjs +67 -28
  65. package/dist/Components/NcAppNavigation.mjs.map +1 -1
  66. package/dist/Components/NcAppNavigationCaption.cjs +44 -1
  67. package/dist/Components/NcAppNavigationCaption.cjs.map +1 -1
  68. package/dist/Components/NcAppNavigationCaption.mjs +40 -9
  69. package/dist/Components/NcAppNavigationCaption.mjs.map +1 -1
  70. package/dist/Components/NcAppNavigationIconBullet.cjs +40 -1
  71. package/dist/Components/NcAppNavigationIconBullet.cjs.map +1 -1
  72. package/dist/Components/NcAppNavigationIconBullet.mjs +40 -15
  73. package/dist/Components/NcAppNavigationIconBullet.mjs.map +1 -1
  74. package/dist/Components/NcAppNavigationItem.cjs +386 -1
  75. package/dist/Components/NcAppNavigationItem.cjs.map +1 -1
  76. package/dist/Components/NcAppNavigationItem.mjs +382 -81
  77. package/dist/Components/NcAppNavigationItem.mjs.map +1 -1
  78. package/dist/Components/NcAppNavigationNew.cjs +50 -1
  79. package/dist/Components/NcAppNavigationNew.cjs.map +1 -1
  80. package/dist/Components/NcAppNavigationNew.mjs +51 -14
  81. package/dist/Components/NcAppNavigationNew.mjs.map +1 -1
  82. package/dist/Components/NcAppNavigationNewItem.cjs +87 -1
  83. package/dist/Components/NcAppNavigationNewItem.cjs.map +1 -1
  84. package/dist/Components/NcAppNavigationNewItem.mjs +83 -17
  85. package/dist/Components/NcAppNavigationNewItem.mjs.map +1 -1
  86. package/dist/Components/NcAppNavigationSettings.cjs +69 -1
  87. package/dist/Components/NcAppNavigationSettings.cjs.map +1 -1
  88. package/dist/Components/NcAppNavigationSettings.mjs +60 -21
  89. package/dist/Components/NcAppNavigationSettings.mjs.map +1 -1
  90. package/dist/Components/NcAppNavigationSpacer.cjs +20 -1
  91. package/dist/Components/NcAppNavigationSpacer.cjs.map +1 -1
  92. package/dist/Components/NcAppNavigationSpacer.mjs +20 -9
  93. package/dist/Components/NcAppNavigationSpacer.mjs.map +1 -1
  94. package/dist/Components/NcAppNavigationToggle.cjs +25 -1
  95. package/dist/Components/NcAppNavigationToggle.cjs.map +1 -1
  96. package/dist/Components/NcAppNavigationToggle.mjs +21 -1
  97. package/dist/Components/NcAppNavigationToggle.mjs.map +1 -1
  98. package/dist/Components/NcAppSettingsDialog.cjs +156 -1
  99. package/dist/Components/NcAppSettingsDialog.cjs.map +1 -1
  100. package/dist/Components/NcAppSettingsDialog.mjs +160 -50
  101. package/dist/Components/NcAppSettingsDialog.mjs.map +1 -1
  102. package/dist/Components/NcAppSettingsSection.cjs +39 -1
  103. package/dist/Components/NcAppSettingsSection.cjs.map +1 -1
  104. package/dist/Components/NcAppSettingsSection.mjs +39 -13
  105. package/dist/Components/NcAppSettingsSection.mjs.map +1 -1
  106. package/dist/Components/NcAppSidebar.cjs +443 -1
  107. package/dist/Components/NcAppSidebar.cjs.map +1 -1
  108. package/dist/Components/NcAppSidebar.mjs +409 -92
  109. package/dist/Components/NcAppSidebar.mjs.map +1 -1
  110. package/dist/Components/NcAppSidebarTab.cjs +83 -1
  111. package/dist/Components/NcAppSidebarTab.cjs.map +1 -1
  112. package/dist/Components/NcAppSidebarTab.mjs +83 -20
  113. package/dist/Components/NcAppSidebarTab.mjs.map +1 -1
  114. package/dist/Components/NcAvatar.cjs +3 -1
  115. package/dist/Components/NcAvatar.cjs.map +1 -1
  116. package/dist/Components/NcAvatar.mjs +1 -1
  117. package/dist/Components/NcBreadcrumb.cjs +175 -1
  118. package/dist/Components/NcBreadcrumb.cjs.map +1 -1
  119. package/dist/Components/NcBreadcrumb.mjs +175 -35
  120. package/dist/Components/NcBreadcrumb.mjs.map +1 -1
  121. package/dist/Components/NcBreadcrumbs.cjs +372 -1
  122. package/dist/Components/NcBreadcrumbs.cjs.map +1 -1
  123. package/dist/Components/NcBreadcrumbs.mjs +373 -142
  124. package/dist/Components/NcBreadcrumbs.mjs.map +1 -1
  125. package/dist/Components/NcButton.cjs +226 -1
  126. package/dist/Components/NcButton.cjs.map +1 -1
  127. package/dist/Components/NcButton.mjs +226 -24
  128. package/dist/Components/NcButton.mjs.map +1 -1
  129. package/dist/Components/NcCheckboxRadioSwitch.cjs +352 -1
  130. package/dist/Components/NcCheckboxRadioSwitch.cjs.map +1 -1
  131. package/dist/Components/NcCheckboxRadioSwitch.mjs +360 -59
  132. package/dist/Components/NcCheckboxRadioSwitch.mjs.map +1 -1
  133. package/dist/Components/NcColorPicker.cjs +118 -1
  134. package/dist/Components/NcColorPicker.cjs.map +1 -1
  135. package/dist/Components/NcColorPicker.mjs +124 -46
  136. package/dist/Components/NcColorPicker.mjs.map +1 -1
  137. package/dist/Components/NcContent.cjs +25 -1
  138. package/dist/Components/NcContent.cjs.map +1 -1
  139. package/dist/Components/NcContent.mjs +24 -8
  140. package/dist/Components/NcContent.mjs.map +1 -1
  141. package/dist/Components/NcCounterBubble.cjs +47 -1
  142. package/dist/Components/NcCounterBubble.cjs.map +1 -1
  143. package/dist/Components/NcCounterBubble.mjs +46 -12
  144. package/dist/Components/NcCounterBubble.mjs.map +1 -1
  145. package/dist/Components/NcDashboardWidget.cjs +133 -1
  146. package/dist/Components/NcDashboardWidget.cjs.map +1 -1
  147. package/dist/Components/NcDashboardWidget.mjs +128 -39
  148. package/dist/Components/NcDashboardWidget.mjs.map +1 -1
  149. package/dist/Components/NcDashboardWidgetItem.cjs +138 -1
  150. package/dist/Components/NcDashboardWidgetItem.cjs.map +1 -1
  151. package/dist/Components/NcDashboardWidgetItem.mjs +130 -23
  152. package/dist/Components/NcDashboardWidgetItem.mjs.map +1 -1
  153. package/dist/Components/NcDateTime.cjs +125 -1
  154. package/dist/Components/NcDateTime.cjs.map +1 -1
  155. package/dist/Components/NcDateTime.mjs +126 -41
  156. package/dist/Components/NcDateTime.mjs.map +1 -1
  157. package/dist/Components/NcDateTimePicker.cjs +217 -1
  158. package/dist/Components/NcDateTimePicker.cjs.map +1 -1
  159. package/dist/Components/NcDateTimePicker.mjs +212 -53
  160. package/dist/Components/NcDateTimePicker.mjs.map +1 -1
  161. package/dist/Components/NcDateTimePickerNative.cjs +199 -1
  162. package/dist/Components/NcDateTimePickerNative.cjs.map +1 -1
  163. package/dist/Components/NcDateTimePickerNative.mjs +195 -58
  164. package/dist/Components/NcDateTimePickerNative.mjs.map +1 -1
  165. package/dist/Components/NcDialog.cjs +171 -0
  166. package/dist/Components/NcDialog.cjs.map +1 -0
  167. package/dist/Components/NcDialog.mjs +177 -0
  168. package/dist/Components/NcDialog.mjs.map +1 -0
  169. package/dist/Components/NcDialogButton.cjs +69 -0
  170. package/dist/Components/NcDialogButton.cjs.map +1 -0
  171. package/dist/Components/NcDialogButton.mjs +74 -0
  172. package/dist/Components/NcDialogButton.mjs.map +1 -0
  173. package/dist/Components/NcEllipsisedOption.cjs +74 -1
  174. package/dist/Components/NcEllipsisedOption.cjs.map +1 -1
  175. package/dist/Components/NcEllipsisedOption.mjs +73 -20
  176. package/dist/Components/NcEllipsisedOption.mjs.map +1 -1
  177. package/dist/Components/NcEmojiPicker.cjs +175 -1
  178. package/dist/Components/NcEmojiPicker.cjs.map +1 -1
  179. package/dist/Components/NcEmojiPicker.mjs +172 -52
  180. package/dist/Components/NcEmojiPicker.mjs.map +1 -1
  181. package/dist/Components/NcEmptyContent.cjs +54 -1
  182. package/dist/Components/NcEmptyContent.cjs.map +1 -1
  183. package/dist/Components/NcEmptyContent.mjs +46 -10
  184. package/dist/Components/NcEmptyContent.mjs.map +1 -1
  185. package/dist/Components/NcGuestContent.cjs +26 -1
  186. package/dist/Components/NcGuestContent.cjs.map +1 -1
  187. package/dist/Components/NcGuestContent.mjs +24 -11
  188. package/dist/Components/NcGuestContent.mjs.map +1 -1
  189. package/dist/Components/NcHeaderMenu.cjs +167 -1
  190. package/dist/Components/NcHeaderMenu.cjs.map +1 -1
  191. package/dist/Components/NcHeaderMenu.mjs +161 -49
  192. package/dist/Components/NcHeaderMenu.mjs.map +1 -1
  193. package/dist/Components/NcHighlight.cjs +3 -1
  194. package/dist/Components/NcHighlight.cjs.map +1 -1
  195. package/dist/Components/NcHighlight.mjs +1 -1
  196. package/dist/Components/NcIconSvgWrapper.cjs +59 -1
  197. package/dist/Components/NcIconSvgWrapper.cjs.map +1 -1
  198. package/dist/Components/NcIconSvgWrapper.mjs +60 -12
  199. package/dist/Components/NcIconSvgWrapper.mjs.map +1 -1
  200. package/dist/Components/NcInputField.cjs +210 -1
  201. package/dist/Components/NcInputField.cjs.map +1 -1
  202. package/dist/Components/NcInputField.mjs +211 -38
  203. package/dist/Components/NcInputField.mjs.map +1 -1
  204. package/dist/Components/NcListItem.cjs +237 -1
  205. package/dist/Components/NcListItem.cjs.map +1 -1
  206. package/dist/Components/NcListItem.mjs +233 -57
  207. package/dist/Components/NcListItem.mjs.map +1 -1
  208. package/dist/Components/NcListItemIcon.cjs +158 -1
  209. package/dist/Components/NcListItemIcon.cjs.map +1 -1
  210. package/dist/Components/NcListItemIcon.mjs +154 -30
  211. package/dist/Components/NcListItemIcon.mjs.map +1 -1
  212. package/dist/Components/NcLoadingIcon.cjs +54 -1
  213. package/dist/Components/NcLoadingIcon.cjs.map +1 -1
  214. package/dist/Components/NcLoadingIcon.mjs +54 -14
  215. package/dist/Components/NcLoadingIcon.mjs.map +1 -1
  216. package/dist/Components/NcModal.cjs +403 -1
  217. package/dist/Components/NcModal.cjs.map +1 -1
  218. package/dist/Components/NcModal.mjs +392 -96
  219. package/dist/Components/NcModal.mjs.map +1 -1
  220. package/dist/Components/NcNoteCard.cjs +71 -1
  221. package/dist/Components/NcNoteCard.cjs.map +1 -1
  222. package/dist/Components/NcNoteCard.mjs +72 -38
  223. package/dist/Components/NcNoteCard.mjs.map +1 -1
  224. package/dist/Components/NcPasswordField.cjs +163 -1
  225. package/dist/Components/NcPasswordField.cjs.map +1 -1
  226. package/dist/Components/NcPasswordField.mjs +169 -54
  227. package/dist/Components/NcPasswordField.mjs.map +1 -1
  228. package/dist/Components/NcPopover.cjs +125 -1
  229. package/dist/Components/NcPopover.cjs.map +1 -1
  230. package/dist/Components/NcPopover.mjs +124 -41
  231. package/dist/Components/NcPopover.mjs.map +1 -1
  232. package/dist/Components/NcProgressBar.cjs +57 -1
  233. package/dist/Components/NcProgressBar.cjs.map +1 -1
  234. package/dist/Components/NcProgressBar.mjs +57 -15
  235. package/dist/Components/NcProgressBar.mjs.map +1 -1
  236. package/dist/Components/NcRelatedResourcesPanel.cjs +184 -1
  237. package/dist/Components/NcRelatedResourcesPanel.cjs.map +1 -1
  238. package/dist/Components/NcRelatedResourcesPanel.mjs +183 -61
  239. package/dist/Components/NcRelatedResourcesPanel.mjs.map +1 -1
  240. package/dist/Components/NcRichContenteditable.cjs +478 -1
  241. package/dist/Components/NcRichContenteditable.cjs.map +1 -1
  242. package/dist/Components/NcRichContenteditable.mjs +447 -127
  243. package/dist/Components/NcRichContenteditable.mjs.map +1 -1
  244. package/dist/Components/NcRichText.cjs +44 -1
  245. package/dist/Components/NcRichText.cjs.map +1 -1
  246. package/dist/Components/NcRichText.mjs +25 -4
  247. package/dist/Components/NcRichText.mjs.map +1 -1
  248. package/dist/Components/NcSavingIndicatorIcon.cjs +59 -1
  249. package/dist/Components/NcSavingIndicatorIcon.cjs.map +1 -1
  250. package/dist/Components/NcSavingIndicatorIcon.mjs +56 -9
  251. package/dist/Components/NcSavingIndicatorIcon.mjs.map +1 -1
  252. package/dist/Components/NcSelect.cjs +411 -1
  253. package/dist/Components/NcSelect.cjs.map +1 -1
  254. package/dist/Components/NcSelect.mjs +405 -47
  255. package/dist/Components/NcSelect.mjs.map +1 -1
  256. package/dist/Components/NcSelectTags.cjs +251 -2
  257. package/dist/Components/NcSelectTags.cjs.map +1 -1
  258. package/dist/Components/NcSelectTags.mjs +236 -73
  259. package/dist/Components/NcSelectTags.mjs.map +1 -1
  260. package/dist/Components/NcSettingsInputText.cjs +90 -1
  261. package/dist/Components/NcSettingsInputText.cjs.map +1 -1
  262. package/dist/Components/NcSettingsInputText.mjs +88 -19
  263. package/dist/Components/NcSettingsInputText.mjs.map +1 -1
  264. package/dist/Components/NcSettingsSection.cjs +62 -1
  265. package/dist/Components/NcSettingsSection.cjs.map +1 -1
  266. package/dist/Components/NcSettingsSection.mjs +62 -15
  267. package/dist/Components/NcSettingsSection.mjs.map +1 -1
  268. package/dist/Components/NcSettingsSelectGroup.cjs +26 -1
  269. package/dist/Components/NcSettingsSelectGroup.cjs.map +1 -1
  270. package/dist/Components/NcSettingsSelectGroup.mjs +22 -1
  271. package/dist/Components/NcSettingsSelectGroup.mjs.map +1 -1
  272. package/dist/Components/NcTextArea.cjs +167 -0
  273. package/dist/Components/NcTextArea.cjs.map +1 -0
  274. package/dist/Components/NcTextArea.mjs +172 -0
  275. package/dist/Components/NcTextArea.mjs.map +1 -0
  276. package/dist/Components/NcTextField.cjs +98 -1
  277. package/dist/Components/NcTextField.cjs.map +1 -1
  278. package/dist/Components/NcTextField.mjs +102 -22
  279. package/dist/Components/NcTextField.mjs.map +1 -1
  280. package/dist/Components/NcTimezonePicker.cjs +4387 -614
  281. package/dist/Components/NcTimezonePicker.cjs.map +1 -1
  282. package/dist/Components/NcTimezonePicker.mjs +4372 -663
  283. package/dist/Components/NcTimezonePicker.mjs.map +1 -1
  284. package/dist/Components/NcUserBubble.cjs +189 -1
  285. package/dist/Components/NcUserBubble.cjs.map +1 -1
  286. package/dist/Components/NcUserBubble.mjs +190 -47
  287. package/dist/Components/NcUserBubble.mjs.map +1 -1
  288. package/dist/Components/NcVNodes.cjs +35 -1
  289. package/dist/Components/NcVNodes.cjs.map +1 -1
  290. package/dist/Components/NcVNodes.mjs +35 -8
  291. package/dist/Components/NcVNodes.mjs.map +1 -1
  292. package/dist/Directives/Focus.cjs +30 -1
  293. package/dist/Directives/Focus.cjs.map +1 -1
  294. package/dist/Directives/Focus.mjs +28 -5
  295. package/dist/Directives/Focus.mjs.map +1 -1
  296. package/dist/Directives/Linkify.cjs +8 -1
  297. package/dist/Directives/Linkify.cjs.map +1 -1
  298. package/dist/Directives/Linkify.mjs +6 -6
  299. package/dist/Directives/Linkify.mjs.map +1 -1
  300. package/dist/Directives/Tooltip.cjs +37 -1
  301. package/dist/Directives/Tooltip.cjs.map +1 -1
  302. package/dist/Directives/Tooltip.mjs +29 -4
  303. package/dist/Directives/Tooltip.mjs.map +1 -1
  304. package/dist/Functions/emoji.cjs +36 -1
  305. package/dist/Functions/emoji.cjs.map +1 -1
  306. package/dist/Functions/emoji.mjs +32 -11
  307. package/dist/Functions/emoji.mjs.map +1 -1
  308. package/dist/Functions/usernameToColor.cjs +39 -1
  309. package/dist/Functions/usernameToColor.cjs.map +1 -1
  310. package/dist/Functions/usernameToColor.mjs +32 -11
  311. package/dist/Functions/usernameToColor.mjs.map +1 -1
  312. package/dist/Mixins/clickOutsideOptions.cjs +40 -1
  313. package/dist/Mixins/clickOutsideOptions.cjs.map +1 -1
  314. package/dist/Mixins/clickOutsideOptions.mjs +39 -4
  315. package/dist/Mixins/clickOutsideOptions.mjs.map +1 -1
  316. package/dist/Mixins/isFullscreen.cjs +44 -1
  317. package/dist/Mixins/isFullscreen.cjs.map +1 -1
  318. package/dist/Mixins/isFullscreen.mjs +42 -11
  319. package/dist/Mixins/isFullscreen.mjs.map +1 -1
  320. package/dist/Mixins/isMobile.cjs +87 -1
  321. package/dist/Mixins/isMobile.cjs.map +1 -1
  322. package/dist/Mixins/isMobile.mjs +86 -11
  323. package/dist/Mixins/isMobile.mjs.map +1 -1
  324. package/dist/Mixins/richEditor.cjs +10 -1
  325. package/dist/Mixins/richEditor.cjs.map +1 -1
  326. package/dist/Mixins/richEditor.mjs +2 -2
  327. package/dist/assets/NcAppNavigationToggle-2cc5b864.css +35 -0
  328. package/dist/assets/NcInputConfirmCancel-2ba60a52.css +51 -0
  329. package/dist/assets/NcMentionBubble-6e887c5f.css +81 -0
  330. package/dist/assets/{index-23405a74.css → NcSettingsSelectGroup-0d38d76b.css} +15 -2
  331. package/dist/assets/index-0adc989c.css +96 -0
  332. package/dist/assets/index-1151d229.css +41 -0
  333. package/dist/assets/index-1beccc92.css +140 -0
  334. package/dist/assets/index-236620b0.css +150 -0
  335. package/dist/assets/{index-823ec431.css → index-24f6c355.css} +67 -3
  336. package/dist/assets/index-2a8e4ca1.css +540 -0
  337. package/dist/assets/{index-29421a2e.css → index-2d4de2fc.css} +19 -2
  338. package/dist/assets/{NcSettingsSelectGroup-e88cbf1a.css → index-30e099f7.css} +17 -2
  339. package/dist/assets/index-34dfc54e.css +88 -0
  340. package/dist/assets/index-3764a447.css +99 -0
  341. package/dist/assets/index-400b48a6.css +60 -0
  342. package/dist/assets/{index-1d28ce70.css → index-441b6552.css} +25 -2
  343. package/dist/assets/{NcInputConfirmCancel-c1d05dd9.css → index-4611417f.css} +31 -2
  344. package/dist/assets/index-4a775ba1.css +204 -0
  345. package/dist/assets/index-4b75fe20.css +79 -0
  346. package/dist/assets/index-4ebacc78.css +107 -0
  347. package/dist/assets/index-4ef32afd.css +128 -0
  348. package/dist/assets/index-50b0766d.css +202 -0
  349. package/dist/assets/index-574438d6.css +884 -0
  350. package/dist/assets/index-57b305d3.css +44 -0
  351. package/dist/assets/index-5ee8a575.css +295 -0
  352. package/dist/assets/index-5fa0ac5a.css +46 -0
  353. package/dist/assets/index-61b63a8f.css +57 -0
  354. package/dist/assets/index-6416f636.css +83 -0
  355. package/dist/assets/index-6c47e88a.css +46 -0
  356. package/dist/assets/index-6f721577.css +80 -0
  357. package/dist/assets/index-73867d38.css +133 -0
  358. package/dist/assets/index-76a58945.css +68 -0
  359. package/dist/assets/index-76dd9f11.css +5 -0
  360. package/dist/assets/index-7813bab3.css +66 -0
  361. package/dist/assets/index-793eae6b.css +234 -0
  362. package/dist/assets/index-8304db49.css +129 -0
  363. package/dist/assets/index-8aa4712e.css +51 -0
  364. package/dist/assets/{index-3e8ea1d6.css → index-8f52a20f.css} +16 -2
  365. package/dist/assets/index-93ad846c.css +259 -0
  366. package/dist/assets/index-9dcf6260.css +151 -0
  367. package/dist/assets/index-9e44e336.css +59 -0
  368. package/dist/assets/index-9e9587e1.css +45 -0
  369. package/dist/assets/index-a2b51bce.css +47 -0
  370. package/dist/assets/index-a2d55f92.css +204 -0
  371. package/dist/assets/index-a9e4fe04.css +46 -0
  372. package/dist/assets/index-abb90c97.css +164 -0
  373. package/dist/assets/{index-3b76db9b.css → index-af72a30b.css} +78 -3
  374. package/dist/assets/{NcAppNavigationToggle-110970cd.css → index-b8f13a1f.css} +13 -2
  375. package/dist/assets/index-b991895f.css +87 -0
  376. package/dist/assets/{index-25b448e3.css → index-baf8711a.css} +67 -3
  377. package/dist/assets/index-c06ad941.css +175 -0
  378. package/dist/assets/index-c5ae3bc4.css +303 -0
  379. package/dist/assets/index-c6f0da2e.css +69 -0
  380. package/dist/assets/index-d211cae8.css +93 -0
  381. package/dist/assets/index-d646553d.css +41 -0
  382. package/dist/assets/index-dc612aa3.css +112 -0
  383. package/dist/assets/index-e7c55791.css +243 -0
  384. package/dist/assets/index-e7eadba7.css +82 -0
  385. package/dist/assets/index-e828b286.css +76 -0
  386. package/dist/assets/index-ed4adf1d.css +115 -0
  387. package/dist/assets/{index-19f059f6.css → index-edee3304.css} +33 -2
  388. package/dist/assets/index-eea65531.css +129 -0
  389. package/dist/assets/index-f85aa003.css +78 -0
  390. package/dist/assets/index-fc61f2d8.css +41 -0
  391. package/dist/assets/referencePickerModal-3a127978.css +482 -0
  392. package/dist/chunks/GenColors-38246c38.mjs +46 -0
  393. package/dist/chunks/{GenColors-8097de04.cjs.map → GenColors-38246c38.mjs.map} +1 -1
  394. package/dist/chunks/GenColors-eedcc70a.cjs +45 -0
  395. package/dist/chunks/{GenColors-85cb6194.mjs.map → GenColors-eedcc70a.cjs.map} +1 -1
  396. package/dist/{assets/index-cb18d6f3.css → chunks/GenRandomId-c214d235.cjs} +8 -5
  397. package/dist/chunks/{GenRandomId-67df40eb.cjs.map → GenRandomId-c214d235.cjs.map} +1 -1
  398. package/dist/chunks/GenRandomId-cb9ccebe.mjs +25 -0
  399. package/dist/chunks/{GenRandomId-1e1b509a.mjs.map → GenRandomId-cb9ccebe.mjs.map} +1 -1
  400. package/dist/chunks/Linkify-39f20c9a.mjs +33 -0
  401. package/dist/chunks/{Linkify-a0faf443.mjs.map → Linkify-39f20c9a.mjs.map} +1 -1
  402. package/dist/chunks/Linkify-40cdd635.cjs +32 -0
  403. package/dist/chunks/{Linkify-a4db36a9.cjs.map → Linkify-40cdd635.cjs.map} +1 -1
  404. package/dist/chunks/NcAppNavigationToggle-841d3015.cjs +49 -0
  405. package/dist/chunks/NcAppNavigationToggle-841d3015.cjs.map +1 -0
  406. package/dist/chunks/NcAppNavigationToggle-e358aa47.mjs +55 -0
  407. package/dist/chunks/NcAppNavigationToggle-e358aa47.mjs.map +1 -0
  408. package/dist/chunks/NcInputConfirmCancel-44052477.mjs +96 -0
  409. package/dist/chunks/NcInputConfirmCancel-44052477.mjs.map +1 -0
  410. package/dist/chunks/NcInputConfirmCancel-6bea0fdc.cjs +90 -0
  411. package/dist/chunks/NcInputConfirmCancel-6bea0fdc.cjs.map +1 -0
  412. package/dist/chunks/NcRichText-332fe454.cjs +289 -0
  413. package/dist/chunks/{NcRichText-bb9d3893.mjs.map → NcRichText-332fe454.cjs.map} +1 -1
  414. package/dist/chunks/NcRichText-8fda53c8.mjs +302 -0
  415. package/dist/chunks/{NcRichText-3c54a3cc.cjs.map → NcRichText-8fda53c8.mjs.map} +1 -1
  416. package/dist/chunks/NcSettingsSelectGroup-a5ff8c36.cjs +183 -0
  417. package/dist/chunks/NcSettingsSelectGroup-a5ff8c36.cjs.map +1 -0
  418. package/dist/chunks/NcSettingsSelectGroup-fdd3309c.mjs +192 -0
  419. package/dist/chunks/NcSettingsSelectGroup-fdd3309c.mjs.map +1 -0
  420. package/dist/chunks/ScopeComponent-9519afcc.mjs +29 -0
  421. package/dist/chunks/{ScopeComponent-1f3a7612.mjs.map → ScopeComponent-9519afcc.mjs.map} +1 -1
  422. package/dist/chunks/ScopeComponent-e060526a.cjs +28 -0
  423. package/dist/chunks/{ScopeComponent-4b8bd1ee.cjs.map → ScopeComponent-e060526a.cjs.map} +1 -1
  424. package/dist/chunks/_plugin-vue2_normalizer-71e2aa87.mjs +32 -0
  425. package/dist/chunks/_plugin-vue2_normalizer-71e2aa87.mjs.map +1 -0
  426. package/dist/chunks/_plugin-vue2_normalizer-7f9efb60.cjs +31 -0
  427. package/dist/chunks/_plugin-vue2_normalizer-7f9efb60.cjs.map +1 -0
  428. package/dist/chunks/actionGlobal-8c1c28c9.mjs +50 -0
  429. package/dist/chunks/{actionGlobal-cda46023.mjs.map → actionGlobal-8c1c28c9.mjs.map} +1 -1
  430. package/dist/chunks/actionGlobal-9e29e11b.cjs +49 -0
  431. package/dist/chunks/{actionGlobal-ec7003e8.cjs.map → actionGlobal-9e29e11b.cjs.map} +1 -1
  432. package/dist/chunks/actionText-54bc24a6.cjs +120 -0
  433. package/dist/chunks/{actionText-bef01778.cjs.map → actionText-54bc24a6.cjs.map} +1 -1
  434. package/dist/chunks/actionText-a64be267.mjs +121 -0
  435. package/dist/chunks/{actionText-6c35d3fc.mjs.map → actionText-a64be267.mjs.map} +1 -1
  436. package/dist/chunks/focusTrap-14985831.cjs +26 -0
  437. package/dist/chunks/{focusTrap-173aba65.mjs.map → focusTrap-14985831.cjs.map} +1 -1
  438. package/dist/chunks/focusTrap-5d0f71d4.mjs +27 -0
  439. package/dist/chunks/{focusTrap-139520e2.cjs.map → focusTrap-5d0f71d4.mjs.map} +1 -1
  440. package/dist/chunks/index-032137a6.cjs +468 -0
  441. package/dist/chunks/index-032137a6.cjs.map +1 -0
  442. package/dist/chunks/index-20a9ace9.mjs +149 -0
  443. package/dist/chunks/{index-cd3f1f8f.mjs.map → index-20a9ace9.mjs.map} +1 -1
  444. package/dist/chunks/index-4398f925.cjs +149 -0
  445. package/dist/chunks/{index-858938bd.cjs.map → index-4398f925.cjs.map} +1 -1
  446. package/dist/chunks/index-5f2a5f57.mjs +155 -0
  447. package/dist/chunks/{index-377488aa.mjs.map → index-5f2a5f57.mjs.map} +1 -1
  448. package/dist/chunks/index-e894376a.cjs +148 -0
  449. package/dist/chunks/{index-df3f51c6.cjs.map → index-e894376a.cjs.map} +1 -1
  450. package/dist/chunks/index-fb2ee22c.mjs +481 -0
  451. package/dist/chunks/index-fb2ee22c.mjs.map +1 -0
  452. package/dist/chunks/l10n-05a09c66.mjs +31 -0
  453. package/dist/chunks/l10n-05a09c66.mjs.map +1 -0
  454. package/dist/chunks/l10n-9aa6482d.mjs +10 -0
  455. package/dist/chunks/l10n-9aa6482d.mjs.map +1 -0
  456. package/dist/chunks/l10n-b1d264c7.cjs +29 -0
  457. package/dist/chunks/l10n-b1d264c7.cjs.map +1 -0
  458. package/dist/chunks/l10n-c7bd0ea6.cjs +8 -0
  459. package/dist/chunks/l10n-c7bd0ea6.cjs.map +1 -0
  460. package/dist/chunks/logger-3612e664.mjs +25 -0
  461. package/dist/chunks/{logger-01af1a78.cjs.map → logger-3612e664.mjs.map} +1 -1
  462. package/dist/chunks/logger-4998b668.cjs +24 -0
  463. package/dist/chunks/{logger-ccc7ee65.mjs.map → logger-4998b668.cjs.map} +1 -1
  464. package/dist/chunks/referencePickerModal-279a483d.cjs +858 -0
  465. package/dist/chunks/referencePickerModal-279a483d.cjs.map +1 -0
  466. package/dist/chunks/referencePickerModal-443a4c57.mjs +877 -0
  467. package/dist/chunks/referencePickerModal-443a4c57.mjs.map +1 -0
  468. package/dist/index.cjs +257 -1
  469. package/dist/index.cjs.map +1 -1
  470. package/dist/index.mjs +301 -150
  471. package/dist/index.mjs.map +1 -1
  472. package/package.json +7 -4
  473. package/dist/assets/NcMentionBubble-67378a12.css +0 -21
  474. package/dist/assets/index-2cedaf24.css +0 -21
  475. package/dist/assets/index-30d74459.css +0 -42
  476. package/dist/assets/index-317f55be.css +0 -21
  477. package/dist/assets/index-34f6bb3f.css +0 -21
  478. package/dist/assets/index-37970f20.css +0 -21
  479. package/dist/assets/index-3aba62de.css +0 -21
  480. package/dist/assets/index-47fab7bf.css +0 -21
  481. package/dist/assets/index-49a0d570.css +0 -21
  482. package/dist/assets/index-4a4c1700.css +0 -21
  483. package/dist/assets/index-4a4c2637.css +0 -21
  484. package/dist/assets/index-4efbac36.css +0 -21
  485. package/dist/assets/index-6140ff62.css +0 -21
  486. package/dist/assets/index-66b19339.css +0 -21
  487. package/dist/assets/index-6cb0dc4a.css +0 -21
  488. package/dist/assets/index-6f63d18f.css +0 -42
  489. package/dist/assets/index-76287c8f.css +0 -21
  490. package/dist/assets/index-7a7195d0.css +0 -21
  491. package/dist/assets/index-7e084b52.css +0 -21
  492. package/dist/assets/index-7f55fed2.css +0 -21
  493. package/dist/assets/index-7ffde264.css +0 -21
  494. package/dist/assets/index-81f5e4c8.css +0 -21
  495. package/dist/assets/index-82b5969a.css +0 -21
  496. package/dist/assets/index-852d8576.css +0 -21
  497. package/dist/assets/index-8f58dd75.css +0 -21
  498. package/dist/assets/index-935fa6f9.css +0 -42
  499. package/dist/assets/index-939ba6f0.css +0 -21
  500. package/dist/assets/index-a17dfbc4.css +0 -21
  501. package/dist/assets/index-a4a40fa3.css +0 -21
  502. package/dist/assets/index-a50a8de6.css +0 -1
  503. package/dist/assets/index-a513dcd5.css +0 -21
  504. package/dist/assets/index-a8c5cf75.css +0 -21
  505. package/dist/assets/index-a999ba9f.css +0 -21
  506. package/dist/assets/index-afc15e11.css +0 -21
  507. package/dist/assets/index-b814f5fa.css +0 -21
  508. package/dist/assets/index-ba6ad1b4.css +0 -21
  509. package/dist/assets/index-bf10e8e1.css +0 -21
  510. package/dist/assets/index-bf46edd7.css +0 -21
  511. package/dist/assets/index-c6d7f3b0.css +0 -21
  512. package/dist/assets/index-c736204a.css +0 -21
  513. package/dist/assets/index-cb76ef23.css +0 -21
  514. package/dist/assets/index-cc70a006.css +0 -21
  515. package/dist/assets/index-dd464a52.css +0 -21
  516. package/dist/assets/index-e0ceef85.css +0 -21
  517. package/dist/assets/index-ecdb616f.css +0 -42
  518. package/dist/assets/index-ee410fad.css +0 -21
  519. package/dist/assets/index-ef0bca81.css +0 -42
  520. package/dist/assets/index-f1030e54.css +0 -21
  521. package/dist/assets/index-f6ca40ca.css +0 -21
  522. package/dist/assets/index-f8466b88.css +0 -21
  523. package/dist/assets/referencePickerModal-41e4705a.css +0 -21
  524. package/dist/chunks/GenColors-8097de04.cjs +0 -1
  525. package/dist/chunks/GenColors-85cb6194.mjs +0 -25
  526. package/dist/chunks/GenRandomId-1e1b509a.mjs +0 -4
  527. package/dist/chunks/GenRandomId-67df40eb.cjs +0 -1
  528. package/dist/chunks/IsMobileState-151fc57d.cjs +0 -1
  529. package/dist/chunks/IsMobileState-151fc57d.cjs.map +0 -1
  530. package/dist/chunks/IsMobileState-e1fe5f58.mjs +0 -15
  531. package/dist/chunks/IsMobileState-e1fe5f58.mjs.map +0 -1
  532. package/dist/chunks/Linkify-a0faf443.mjs +0 -5
  533. package/dist/chunks/Linkify-a4db36a9.cjs +0 -1
  534. package/dist/chunks/NcAppNavigationToggle-5f3b9b9a.cjs +0 -1
  535. package/dist/chunks/NcAppNavigationToggle-5f3b9b9a.cjs.map +0 -1
  536. package/dist/chunks/NcAppNavigationToggle-86cc2542.mjs +0 -23
  537. package/dist/chunks/NcAppNavigationToggle-86cc2542.mjs.map +0 -1
  538. package/dist/chunks/NcInputConfirmCancel-0cd93e0e.mjs +0 -43
  539. package/dist/chunks/NcInputConfirmCancel-0cd93e0e.mjs.map +0 -1
  540. package/dist/chunks/NcInputConfirmCancel-17c8ddfb.cjs +0 -1
  541. package/dist/chunks/NcInputConfirmCancel-17c8ddfb.cjs.map +0 -1
  542. package/dist/chunks/NcMentionBubble.vue_vue_type_style_index_0_scoped_357e6d0e_lang-072bbb05.cjs.map +0 -1
  543. package/dist/chunks/NcMentionBubble.vue_vue_type_style_index_0_scoped_357e6d0e_lang-55016398.mjs.map +0 -1
  544. package/dist/chunks/NcRichText-3c54a3cc.cjs +0 -1
  545. package/dist/chunks/NcRichText-bb9d3893.mjs +0 -123
  546. package/dist/chunks/NcSettingsSelectGroup-0be1fe91.mjs +0 -58
  547. package/dist/chunks/NcSettingsSelectGroup-0be1fe91.mjs.map +0 -1
  548. package/dist/chunks/NcSettingsSelectGroup-62ca94a9.cjs +0 -1
  549. package/dist/chunks/NcSettingsSelectGroup-62ca94a9.cjs.map +0 -1
  550. package/dist/chunks/ScopeComponent-1f3a7612.mjs +0 -8
  551. package/dist/chunks/ScopeComponent-4b8bd1ee.cjs +0 -1
  552. package/dist/chunks/_plugin-vue2_normalizer-5b4c43a4.mjs +0 -24
  553. package/dist/chunks/_plugin-vue2_normalizer-5b4c43a4.mjs.map +0 -1
  554. package/dist/chunks/_plugin-vue2_normalizer-764a4c12.cjs +0 -1
  555. package/dist/chunks/_plugin-vue2_normalizer-764a4c12.cjs.map +0 -1
  556. package/dist/chunks/actionGlobal-cda46023.mjs +0 -15
  557. package/dist/chunks/actionGlobal-ec7003e8.cjs +0 -1
  558. package/dist/chunks/actionText-6c35d3fc.mjs +0 -23
  559. package/dist/chunks/actionText-bef01778.cjs +0 -1
  560. package/dist/chunks/focusTrap-139520e2.cjs +0 -1
  561. package/dist/chunks/focusTrap-173aba65.mjs +0 -6
  562. package/dist/chunks/index-197226c7.mjs +0 -171
  563. package/dist/chunks/index-197226c7.mjs.map +0 -1
  564. package/dist/chunks/index-377488aa.mjs +0 -46
  565. package/dist/chunks/index-858938bd.cjs +0 -3
  566. package/dist/chunks/index-cd3f1f8f.mjs +0 -43
  567. package/dist/chunks/index-cebd6e80.cjs +0 -1
  568. package/dist/chunks/index-cebd6e80.cjs.map +0 -1
  569. package/dist/chunks/index-df3f51c6.cjs +0 -1
  570. package/dist/chunks/l10n-05baf7da.mjs +0 -5
  571. package/dist/chunks/l10n-05baf7da.mjs.map +0 -1
  572. package/dist/chunks/l10n-46d0c1c0.cjs +0 -1
  573. package/dist/chunks/l10n-46d0c1c0.cjs.map +0 -1
  574. package/dist/chunks/l10n-9a5a6afc.mjs +0 -18
  575. package/dist/chunks/l10n-9a5a6afc.mjs.map +0 -1
  576. package/dist/chunks/l10n-dacb6440.cjs +0 -1
  577. package/dist/chunks/l10n-dacb6440.cjs.map +0 -1
  578. package/dist/chunks/logger-01af1a78.cjs +0 -1
  579. package/dist/chunks/logger-ccc7ee65.mjs +0 -5
  580. package/dist/chunks/referencePickerModal-6120a321.cjs +0 -1
  581. package/dist/chunks/referencePickerModal-6120a321.cjs.map +0 -1
  582. package/dist/chunks/referencePickerModal-d0573462.mjs +0 -428
  583. package/dist/chunks/referencePickerModal-d0573462.mjs.map +0 -1
@@ -0,0 +1,149 @@
1
+ import { n as r } from "./_plugin-vue2_normalizer-71e2aa87.mjs";
2
+ /**
3
+ * @copyright Copyright (c) 2020 Raimund Schlüßler <raimund.schluessler@mailbox.org>
4
+ *
5
+ * @author Raimund Schlüßler <raimund.schluessler@mailbox.org>
6
+ *
7
+ * @license AGPL-3.0-or-later
8
+ *
9
+ * This program is free software: you can redistribute it and/or modify
10
+ * it under the terms of the GNU Affero General Public License as
11
+ * published by the Free Software Foundation, either version 3 of the
12
+ * License, or (at your option) any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU Affero General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU Affero General Public License
20
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
+ *
22
+ */
23
+ const l = (e, t) => {
24
+ const s = [];
25
+ let h = 0, n = e.toLowerCase().indexOf(t.toLowerCase(), h), i = 0;
26
+ for (; n > -1 && i < e.length; )
27
+ h = n + t.length, s.push({ start: n, end: h }), n = e.toLowerCase().indexOf(t.toLowerCase(), h), i++;
28
+ return s;
29
+ }, a = {
30
+ name: "NcHighlight",
31
+ props: {
32
+ /**
33
+ * The string to display
34
+ */
35
+ text: {
36
+ type: String,
37
+ default: ""
38
+ },
39
+ /**
40
+ * The string to match and highlight
41
+ */
42
+ search: {
43
+ type: String,
44
+ default: ""
45
+ },
46
+ /**
47
+ * The ranges to highlight, takes precedence over the search prop.
48
+ */
49
+ highlight: {
50
+ type: Array,
51
+ default: () => []
52
+ }
53
+ },
54
+ computed: {
55
+ /**
56
+ * The indice ranges which should be highlighted.
57
+ * If an array with ranges is provided, we use it. Otherwise
58
+ * we calculate it based on the provided substring to highlight.
59
+ *
60
+ * @return {Array} The array of ranges to highlight
61
+ */
62
+ ranges() {
63
+ let e = [];
64
+ return !this.search && this.highlight.length === 0 || (this.highlight.length > 0 ? e = this.highlight : e = l(this.text, this.search), e.forEach((t, s) => {
65
+ t.end < t.start && (e[s] = {
66
+ start: t.end,
67
+ end: t.start
68
+ });
69
+ }), e = e.reduce((t, s) => (s.start < this.text.length && s.end > 0 && t.push({
70
+ start: s.start < 0 ? 0 : s.start,
71
+ end: s.end > this.text.length ? this.text.length : s.end
72
+ }), t), []), e.sort((t, s) => t.start - s.start), e = e.reduce((t, s) => {
73
+ if (!t.length)
74
+ t.push(s);
75
+ else {
76
+ const h = t.length - 1;
77
+ t[h].end >= s.start ? t[h] = {
78
+ start: t[h].start,
79
+ end: Math.max(t[h].end, s.end)
80
+ } : t.push(s);
81
+ }
82
+ return t;
83
+ }, [])), e;
84
+ },
85
+ /**
86
+ * Calculate the different chunks to show based on the ranges to highlight.
87
+ *
88
+ * @return {Array} The chunks
89
+ */
90
+ chunks() {
91
+ if (this.ranges.length === 0)
92
+ return [{
93
+ start: 0,
94
+ end: this.text.length,
95
+ highlight: !1,
96
+ text: this.text
97
+ }];
98
+ const e = [];
99
+ let t = 0, s = 0;
100
+ for (; t < this.text.length; ) {
101
+ const h = this.ranges[s];
102
+ if (h.start === t) {
103
+ e.push({
104
+ ...h,
105
+ highlight: !0,
106
+ text: this.text.slice(h.start, h.end)
107
+ }), s++, t = h.end, s >= this.ranges.length && t < this.text.length && (e.push({
108
+ start: t,
109
+ end: this.text.length,
110
+ highlight: !1,
111
+ text: this.text.slice(t)
112
+ }), t = this.text.length);
113
+ continue;
114
+ }
115
+ e.push({
116
+ start: t,
117
+ end: h.start,
118
+ highlight: !1,
119
+ text: this.text.slice(t, h.start)
120
+ }), t = h.start;
121
+ }
122
+ return e;
123
+ }
124
+ },
125
+ /**
126
+ * The render function to display the component
127
+ *
128
+ * @param {Function} h The function to create VNodes
129
+ * @return {object} The created VNode
130
+ */
131
+ render(e) {
132
+ return this.ranges.length ? e("span", {}, this.chunks.map((t) => t.highlight ? e("strong", {}, t.text) : t.text)) : e("span", {}, this.text);
133
+ }
134
+ }, u = null, o = null;
135
+ var c = /* @__PURE__ */ r(
136
+ a,
137
+ u,
138
+ o,
139
+ !1,
140
+ null,
141
+ null,
142
+ null,
143
+ null
144
+ );
145
+ const d = c.exports;
146
+ export {
147
+ l as F,
148
+ d as N
149
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"index-cd3f1f8f.mjs","sources":["../../src/utils/FindRanges.js","../../src/components/NcHighlight/NcHighlight.vue"],"sourcesContent":["/**\n * @copyright Copyright (c) 2020 Raimund Schlüßler <raimund.schluessler@mailbox.org>\n *\n * @author Raimund Schlüßler <raimund.schluessler@mailbox.org>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n/**\n * Find the ranges of a substr in a given string\n *\n * @param {string} text The text to search in\n * @param {string} search The text to search for\n * @return {Array} The array of ranges to highlight\n */\nconst FindRanges = (text, search) => {\n\tconst ranges = []\n\tlet currentIndex = 0\n\tlet index = text.toLowerCase().indexOf(search.toLowerCase(), currentIndex)\n\t// Variable to track that we don't iterate more often than the length of the text.\n\t// Shouldn't happen anyway, but just to be sure to not hang the browser for some reason.\n\tlet i = 0\n\twhile (index > -1 && i < text.length) {\n\t\tcurrentIndex = index + search.length\n\t\tranges.push({ start: index, end: currentIndex })\n\n\t\tindex = text.toLowerCase().indexOf(search.toLowerCase(), currentIndex)\n\t\ti++\n\t}\n\treturn ranges\n}\n\nexport default FindRanges\n","<!--\n - @copyright Copyright (c) 2021 Raimund Schlüßler <raimund.schluessler@mailbox.org>\n -\n - @author Raimund Schlüßler <raimund.schluessler@mailbox.org>\n -\n - @license GNU AGPL version 3 or any later version\n -\n - This program is free software: you can redistribute it and/or modify\n - it under the terms of the GNU Affero General Public License as\n - published by the Free Software Foundation, either version 3 of the\n - License, or (at your option) any later version.\n -\n - This program is distributed in the hope that it will be useful,\n - but WITHOUT ANY WARRANTY; without even the implied warranty of\n - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n - GNU Affero General Public License for more details.\n -\n - You should have received a copy of the GNU Affero General Public License\n - along with this program. If not, see <http://www.gnu.org/licenses/>.\n -\n -->\n\n<docs>\n\n### General description\n\nHighlight a string with html &lt;strong&gt;. Accepts a substring to highlight or an array with ranges.\n\n### Usage\n\n```vue\n<template>\n\t<div>\n\t\t<NcHighlight text=\"Highlight me please!\" search=\"me\" />\n\t\t<br />\n\t\t<NcHighlight text=\"Highlight me please!\" :highlight=\"[{ start: 4, end: 12 }]\" />\n\t</div>\n</template>\n```\n</docs>\n\n<script>\nimport FindRanges from '../../utils/FindRanges.js'\n\nexport default {\n\tname: 'NcHighlight',\n\tprops: {\n\t\t/**\n\t\t * The string to display\n\t\t */\n\t\ttext: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\t\t/**\n\t\t * The string to match and highlight\n\t\t */\n\t\tsearch: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\t\t/**\n\t\t * The ranges to highlight, takes precedence over the search prop.\n\t\t */\n\t\thighlight: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t},\n\t},\n\tcomputed: {\n\t\t/**\n\t\t * The indice ranges which should be highlighted.\n\t\t * If an array with ranges is provided, we use it. Otherwise\n\t\t * we calculate it based on the provided substring to highlight.\n\t\t *\n\t\t * @return {Array} The array of ranges to highlight\n\t\t */\n\t\tranges() {\n\t\t\tlet ranges = []\n\t\t\t// If the search term and the highlight array is empty, return early with empty array\n\t\t\tif (!this.search && this.highlight.length === 0) {\n\t\t\t\treturn ranges\n\t\t\t}\n\n\t\t\t// If there are ranges to highlight provided, we use this array.\n\t\t\tif (this.highlight.length > 0) {\n\t\t\t\tranges = this.highlight\n\t\t\t// Otherwise we check the text to highlight for matches of the search term.\n\t\t\t} else {\n\t\t\t\tranges = FindRanges(this.text, this.search)\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Ensure that the start of each range is equal to or smaller than the end\n\t\t\t */\n\t\t\tranges.forEach((range, i) => {\n\t\t\t\tif (range.end < range.start) {\n\t\t\t\t\tranges[i] = {\n\t\t\t\t\t\tstart: range.end,\n\t\t\t\t\t\tend: range.start,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\n\t\t\t/**\n\t\t\t * Validate the ranges array to be within the string length\n\t\t\t * and discard ranges which are completely out of bonds.\n\t\t\t */\n\t\t\tranges = ranges.reduce((validRanges, range) => {\n\t\t\t\tif (range.start < this.text.length && range.end > 0) {\n\t\t\t\t\tvalidRanges.push({\n\t\t\t\t\t\tstart: (range.start < 0) ? 0 : range.start,\n\t\t\t\t\t\tend: (range.end > this.text.length) ? this.text.length : range.end,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\treturn validRanges\n\t\t\t}, [])\n\n\t\t\t/**\n\t\t\t * Sort ranges ascendingly (necessary for next step)\n\t\t\t */\n\t\t\tranges.sort((a, b) => {\n\t\t\t\treturn a.start - b.start\n\t\t\t})\n\n\t\t\t/**\n\t\t\t * Merge overlapping or adjacent ranges\n\t\t\t */\n\t\t\tranges = ranges.reduce((mergedRanges, range) => {\n\t\t\t\t// If there are no ranges, just add the range\n\t\t\t\tif (!mergedRanges.length) {\n\t\t\t\t\tmergedRanges.push(range)\n\t\t\t\t} else {\n\t\t\t\t\t// If the range overlaps the last range, merge them\n\t\t\t\t\tconst idx = mergedRanges.length - 1\n\t\t\t\t\tif (mergedRanges[idx].end >= range.start) {\n\t\t\t\t\t\tmergedRanges[idx] = {\n\t\t\t\t\t\t\tstart: mergedRanges[idx].start,\n\t\t\t\t\t\t\tend: Math.max(mergedRanges[idx].end, range.end),\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmergedRanges.push(range)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn mergedRanges\n\t\t\t}, [])\n\n\t\t\treturn ranges\n\t\t},\n\t\t/**\n\t\t * Calculate the different chunks to show based on the ranges to highlight.\n\t\t *\n\t\t * @return {Array} The chunks\n\t\t */\n\t\tchunks() {\n\t\t\t// If the ranges array is empty, show only one chunk with all text\n\t\t\tif (this.ranges.length === 0) {\n\t\t\t\treturn [{\n\t\t\t\t\tstart: 0,\n\t\t\t\t\tend: this.text.length,\n\t\t\t\t\thighlight: false,\n\t\t\t\t\ttext: this.text,\n\t\t\t\t}]\n\t\t\t}\n\t\t\t// Calculate the chunks\n\t\t\tconst chunks = []\n\t\t\tlet currentIndex = 0\n\t\t\tlet currentRange = 0\n\t\t\t// Iterate over all characters in the text\n\t\t\twhile (currentIndex < this.text.length) {\n\t\t\t\t// Get the first range to highlight\n\t\t\t\tconst range = this.ranges[currentRange]\n\t\t\t\t// If the range starts at the current index, construct a chunk to highlight,\n\t\t\t\t// set the next range and continue with the next iteration.\n\t\t\t\tif (range.start === currentIndex) {\n\t\t\t\t\tchunks.push({\n\t\t\t\t\t\t...range,\n\t\t\t\t\t\thighlight: true,\n\t\t\t\t\t\ttext: this.text.slice(range.start, range.end),\n\t\t\t\t\t})\n\t\t\t\t\tcurrentRange++\n\t\t\t\t\tcurrentIndex = range.end\n\t\t\t\t\t// If this was the last range to highlight and we haven't reached the end of the text,\n\t\t\t\t\t// add the rest of the text without highlighting.\n\t\t\t\t\tif (currentRange >= this.ranges.length && currentIndex < this.text.length) {\n\t\t\t\t\t\tchunks.push({\n\t\t\t\t\t\t\tstart: currentIndex,\n\t\t\t\t\t\t\tend: this.text.length,\n\t\t\t\t\t\t\thighlight: false,\n\t\t\t\t\t\t\ttext: this.text.slice(currentIndex),\n\t\t\t\t\t\t})\n\t\t\t\t\t\t// Set the current index so the while loop ends.\n\t\t\t\t\t\tcurrentIndex = this.text.length\n\t\t\t\t\t}\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// If the current range does start after the current index, construct a chunk without\n\t\t\t\t// highlighting and set the current index to the start of the current range.\n\t\t\t\tchunks.push({\n\t\t\t\t\tstart: currentIndex,\n\t\t\t\t\tend: range.start,\n\t\t\t\t\thighlight: false,\n\t\t\t\t\ttext: this.text.slice(currentIndex, range.start),\n\t\t\t\t})\n\t\t\t\tcurrentIndex = range.start\n\t\t\t}\n\t\t\treturn chunks\n\t\t},\n\t},\n\t/**\n\t * The render function to display the component\n\t *\n\t * @param {Function} h The function to create VNodes\n\t * @return {object} The created VNode\n\t */\n\trender(h) {\n\t\tif (!this.ranges.length) {\n\t\t\treturn h('span', {}, this.text)\n\t\t}\n\n\t\treturn h('span', {}, this.chunks.map(chunk => {\n\t\t\treturn chunk.highlight ? h('strong', {}, chunk.text) : chunk.text\n\t\t}))\n\t},\n}\n</script>\n"],"names":["FindRanges","text","search","ranges","currentIndex","index","i","_sfc_main","range","validRanges","a","b","mergedRanges","idx","chunks","currentRange","h","chunk"],"mappings":";AA6BK,MAACA,IAAa,CAACC,GAAMC,MAAW;AACpC,QAAMC,IAAS,CAAE;AACjB,MAAIC,IAAe,GACfC,IAAQJ,EAAK,YAAa,EAAC,QAAQC,EAAO,YAAa,GAAEE,CAAY,GAGrEE,IAAI;AACR,SAAOD,IAAQ,MAAMC,IAAIL,EAAK;AAC7BG,IAAAA,IAAeC,IAAQH,EAAO,QAC9BC,EAAO,KAAK,EAAE,OAAOE,GAAO,KAAKD,GAAc,GAE/CC,IAAQJ,EAAK,YAAa,EAAC,QAAQC,EAAO,YAAa,GAAEE,CAAY,GACrEE;AAED,SAAOH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AA,KAAA,OAAA,WAAA;AACA,WAAA,CAAA,EACA,OAAA,GACA,KAAA,KAAA,KAAA,QACA,WAAA,IACA,MAAA,KAAA,KACA,CAAA;AAGA,QAAAW,IAAA,CAAA;AACA,MAAAV,IAAA,GACAW,IAAA;AAEA,SAAAX,IAAA,KAAA,KAAA,UAAA;AAEA,UAAAI,IAAA,KAAA,OAAAO,CAAA;AAGA,QAAAP,EAAA,UAAAJ,GAAA;AACAU,QAAA,KAAA,EACA,GAAAN,GACA,WAAA,IACA,MAAA,KAAA,KAAA,MAAAA,EAAA,OAAAA,EAAA,GAAA,EACA,CAAA,GACAO,KACAX,IAAAI,EAAA,KAGAO,KAAA,KAAA,OAAA,UAAAX,IAAA,KAAA,KAAA,WACAU,EAAA,KAAA,EACA,OAAAV,GACA,KAAA,KAAA,KAAA,QACA,WAAA,IACA,MAAA,KAAA,KAAA,MAAAA,CAAA,EACA,CAAA,GAEAA,IAAA,KAAA,KAAA;AAEA;AAAA,IAIAU;AAAAA,MAAA,KAAA,EACA,OAAAV,GACA,KAAAI,EAAA,OACA,WAAA,IACA,MAAA,KAAA,KAAA,MAAAJ,GAAAI,EAAA,KAAA,EACA,CAAA,GACAJ,IAAAI,EAAA;AAAA,EAEA;AAAA,SAAAM;AACA,EACA,GAOA,OAAAE,GAAA;AACA,SAAA,KAAA,OAAA,SAIAA,EAAA,QAAA,CAAA,GAAA,KAAA,OAAA,IAAAC,OACAA,EAAA,YAAAD,EAAA,UAAA,CAAA,GAAAC,EAAA,IAAA,IAAAA,EAAA,IACA,CAAA,IALAD,EAAA,QAAA,IAAA,KAAA,IAAA;AAMA,EACA;;;"}
1
+ {"version":3,"file":"index-20a9ace9.mjs","sources":["../../src/utils/FindRanges.js","../../src/components/NcHighlight/NcHighlight.vue"],"sourcesContent":["/**\n * @copyright Copyright (c) 2020 Raimund Schlüßler <raimund.schluessler@mailbox.org>\n *\n * @author Raimund Schlüßler <raimund.schluessler@mailbox.org>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n/**\n * Find the ranges of a substr in a given string\n *\n * @param {string} text The text to search in\n * @param {string} search The text to search for\n * @return {Array} The array of ranges to highlight\n */\nconst FindRanges = (text, search) => {\n\tconst ranges = []\n\tlet currentIndex = 0\n\tlet index = text.toLowerCase().indexOf(search.toLowerCase(), currentIndex)\n\t// Variable to track that we don't iterate more often than the length of the text.\n\t// Shouldn't happen anyway, but just to be sure to not hang the browser for some reason.\n\tlet i = 0\n\twhile (index > -1 && i < text.length) {\n\t\tcurrentIndex = index + search.length\n\t\tranges.push({ start: index, end: currentIndex })\n\n\t\tindex = text.toLowerCase().indexOf(search.toLowerCase(), currentIndex)\n\t\ti++\n\t}\n\treturn ranges\n}\n\nexport default FindRanges\n","<!--\n - @copyright Copyright (c) 2021 Raimund Schlüßler <raimund.schluessler@mailbox.org>\n -\n - @author Raimund Schlüßler <raimund.schluessler@mailbox.org>\n -\n - @license GNU AGPL version 3 or any later version\n -\n - This program is free software: you can redistribute it and/or modify\n - it under the terms of the GNU Affero General Public License as\n - published by the Free Software Foundation, either version 3 of the\n - License, or (at your option) any later version.\n -\n - This program is distributed in the hope that it will be useful,\n - but WITHOUT ANY WARRANTY; without even the implied warranty of\n - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n - GNU Affero General Public License for more details.\n -\n - You should have received a copy of the GNU Affero General Public License\n - along with this program. If not, see <http://www.gnu.org/licenses/>.\n -\n -->\n\n<docs>\n\n### General description\n\nHighlight a string with html &lt;strong&gt;. Accepts a substring to highlight or an array with ranges.\n\n### Usage\n\n```vue\n<template>\n\t<div>\n\t\t<NcHighlight text=\"Highlight me please!\" search=\"me\" />\n\t\t<br />\n\t\t<NcHighlight text=\"Highlight me please!\" :highlight=\"[{ start: 4, end: 12 }]\" />\n\t</div>\n</template>\n```\n</docs>\n\n<script>\nimport FindRanges from '../../utils/FindRanges.js'\n\nexport default {\n\tname: 'NcHighlight',\n\tprops: {\n\t\t/**\n\t\t * The string to display\n\t\t */\n\t\ttext: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\t\t/**\n\t\t * The string to match and highlight\n\t\t */\n\t\tsearch: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\t\t/**\n\t\t * The ranges to highlight, takes precedence over the search prop.\n\t\t */\n\t\thighlight: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t},\n\t},\n\tcomputed: {\n\t\t/**\n\t\t * The indice ranges which should be highlighted.\n\t\t * If an array with ranges is provided, we use it. Otherwise\n\t\t * we calculate it based on the provided substring to highlight.\n\t\t *\n\t\t * @return {Array} The array of ranges to highlight\n\t\t */\n\t\tranges() {\n\t\t\tlet ranges = []\n\t\t\t// If the search term and the highlight array is empty, return early with empty array\n\t\t\tif (!this.search && this.highlight.length === 0) {\n\t\t\t\treturn ranges\n\t\t\t}\n\n\t\t\t// If there are ranges to highlight provided, we use this array.\n\t\t\tif (this.highlight.length > 0) {\n\t\t\t\tranges = this.highlight\n\t\t\t// Otherwise we check the text to highlight for matches of the search term.\n\t\t\t} else {\n\t\t\t\tranges = FindRanges(this.text, this.search)\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Ensure that the start of each range is equal to or smaller than the end\n\t\t\t */\n\t\t\tranges.forEach((range, i) => {\n\t\t\t\tif (range.end < range.start) {\n\t\t\t\t\tranges[i] = {\n\t\t\t\t\t\tstart: range.end,\n\t\t\t\t\t\tend: range.start,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\n\t\t\t/**\n\t\t\t * Validate the ranges array to be within the string length\n\t\t\t * and discard ranges which are completely out of bonds.\n\t\t\t */\n\t\t\tranges = ranges.reduce((validRanges, range) => {\n\t\t\t\tif (range.start < this.text.length && range.end > 0) {\n\t\t\t\t\tvalidRanges.push({\n\t\t\t\t\t\tstart: (range.start < 0) ? 0 : range.start,\n\t\t\t\t\t\tend: (range.end > this.text.length) ? this.text.length : range.end,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\treturn validRanges\n\t\t\t}, [])\n\n\t\t\t/**\n\t\t\t * Sort ranges ascendingly (necessary for next step)\n\t\t\t */\n\t\t\tranges.sort((a, b) => {\n\t\t\t\treturn a.start - b.start\n\t\t\t})\n\n\t\t\t/**\n\t\t\t * Merge overlapping or adjacent ranges\n\t\t\t */\n\t\t\tranges = ranges.reduce((mergedRanges, range) => {\n\t\t\t\t// If there are no ranges, just add the range\n\t\t\t\tif (!mergedRanges.length) {\n\t\t\t\t\tmergedRanges.push(range)\n\t\t\t\t} else {\n\t\t\t\t\t// If the range overlaps the last range, merge them\n\t\t\t\t\tconst idx = mergedRanges.length - 1\n\t\t\t\t\tif (mergedRanges[idx].end >= range.start) {\n\t\t\t\t\t\tmergedRanges[idx] = {\n\t\t\t\t\t\t\tstart: mergedRanges[idx].start,\n\t\t\t\t\t\t\tend: Math.max(mergedRanges[idx].end, range.end),\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmergedRanges.push(range)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn mergedRanges\n\t\t\t}, [])\n\n\t\t\treturn ranges\n\t\t},\n\t\t/**\n\t\t * Calculate the different chunks to show based on the ranges to highlight.\n\t\t *\n\t\t * @return {Array} The chunks\n\t\t */\n\t\tchunks() {\n\t\t\t// If the ranges array is empty, show only one chunk with all text\n\t\t\tif (this.ranges.length === 0) {\n\t\t\t\treturn [{\n\t\t\t\t\tstart: 0,\n\t\t\t\t\tend: this.text.length,\n\t\t\t\t\thighlight: false,\n\t\t\t\t\ttext: this.text,\n\t\t\t\t}]\n\t\t\t}\n\t\t\t// Calculate the chunks\n\t\t\tconst chunks = []\n\t\t\tlet currentIndex = 0\n\t\t\tlet currentRange = 0\n\t\t\t// Iterate over all characters in the text\n\t\t\twhile (currentIndex < this.text.length) {\n\t\t\t\t// Get the first range to highlight\n\t\t\t\tconst range = this.ranges[currentRange]\n\t\t\t\t// If the range starts at the current index, construct a chunk to highlight,\n\t\t\t\t// set the next range and continue with the next iteration.\n\t\t\t\tif (range.start === currentIndex) {\n\t\t\t\t\tchunks.push({\n\t\t\t\t\t\t...range,\n\t\t\t\t\t\thighlight: true,\n\t\t\t\t\t\ttext: this.text.slice(range.start, range.end),\n\t\t\t\t\t})\n\t\t\t\t\tcurrentRange++\n\t\t\t\t\tcurrentIndex = range.end\n\t\t\t\t\t// If this was the last range to highlight and we haven't reached the end of the text,\n\t\t\t\t\t// add the rest of the text without highlighting.\n\t\t\t\t\tif (currentRange >= this.ranges.length && currentIndex < this.text.length) {\n\t\t\t\t\t\tchunks.push({\n\t\t\t\t\t\t\tstart: currentIndex,\n\t\t\t\t\t\t\tend: this.text.length,\n\t\t\t\t\t\t\thighlight: false,\n\t\t\t\t\t\t\ttext: this.text.slice(currentIndex),\n\t\t\t\t\t\t})\n\t\t\t\t\t\t// Set the current index so the while loop ends.\n\t\t\t\t\t\tcurrentIndex = this.text.length\n\t\t\t\t\t}\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// If the current range does start after the current index, construct a chunk without\n\t\t\t\t// highlighting and set the current index to the start of the current range.\n\t\t\t\tchunks.push({\n\t\t\t\t\tstart: currentIndex,\n\t\t\t\t\tend: range.start,\n\t\t\t\t\thighlight: false,\n\t\t\t\t\ttext: this.text.slice(currentIndex, range.start),\n\t\t\t\t})\n\t\t\t\tcurrentIndex = range.start\n\t\t\t}\n\t\t\treturn chunks\n\t\t},\n\t},\n\t/**\n\t * The render function to display the component\n\t *\n\t * @param {Function} h The function to create VNodes\n\t * @return {object} The created VNode\n\t */\n\trender(h) {\n\t\tif (!this.ranges.length) {\n\t\t\treturn h('span', {}, this.text)\n\t\t}\n\n\t\treturn h('span', {}, this.chunks.map(chunk => {\n\t\t\treturn chunk.highlight ? h('strong', {}, chunk.text) : chunk.text\n\t\t}))\n\t},\n}\n</script>\n"],"names":["FindRanges","text","search","ranges","currentIndex","index","_sfc_main","range","i","validRanges","a","b","mergedRanges","idx","chunks","currentRange","h","chunk"],"mappings":";AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6BK,MAACA,IAAa,CAACC,GAAMC,MAAW;AACpC,QAAMC,IAAS,CAAE;AACjB,MAAIC,IAAe,GACfC,IAAQJ,EAAK,YAAa,EAAC,QAAQC,EAAO,YAAa,GAAEE,CAAY,GAGrE,IAAI;AACR,SAAOC,IAAQ,MAAM,IAAIJ,EAAK;AAC7B,IAAAG,IAAeC,IAAQH,EAAO,QAC9BC,EAAO,KAAK,EAAE,OAAOE,GAAO,KAAKD,GAAc,GAE/CC,IAAQJ,EAAK,YAAa,EAAC,QAAQC,EAAO,YAAa,GAAEE,CAAY,GACrE;AAED,SAAOD;AACR,GCAAG,IAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA;AAAA;AAAA;AAAA,IAIA,MAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAIA,QAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAIA,WAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA,MAAA,CAAA;AAAA,IACA;AAAA,EACA;AAAA,EACA,UAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQA,SAAA;AACA,UAAAH,IAAA,CAAA;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A,MAAA,KAAA;AAAA,QACA,CAAA;AAGA,YAAAW,IAAA,CAAA;AACA,UAAAV,IAAA,GACAW,IAAA;AAEA,aAAAX,IAAA,KAAA,KAAA,UAAA;AAEA,cAAAG,IAAA,KAAA,OAAAQ,CAAA;AAGA,YAAAR,EAAA,UAAAH,GAAA;AACA,UAAAU,EAAA,KAAA;AAAA,YACA,GAAAP;AAAA,YACA,WAAA;AAAA,YACA,MAAA,KAAA,KAAA,MAAAA,EAAA,OAAAA,EAAA,GAAA;AAAA,UACA,CAAA,GACAQ,KACAX,IAAAG,EAAA,KAGAQ,KAAA,KAAA,OAAA,UAAAX,IAAA,KAAA,KAAA,WACAU,EAAA,KAAA;AAAA,YACA,OAAAV;AAAA,YACA,KAAA,KAAA,KAAA;AAAA,YACA,WAAA;AAAA,YACA,MAAA,KAAA,KAAA,MAAAA,CAAA;AAAA,UACA,CAAA,GAEAA,IAAA,KAAA,KAAA;AAEA;AAAA,QACA;AAGA,QAAAU,EAAA,KAAA;AAAA,UACA,OAAAV;AAAA,UACA,KAAAG,EAAA;AAAA,UACA,WAAA;AAAA,UACA,MAAA,KAAA,KAAA,MAAAH,GAAAG,EAAA,KAAA;AAAA,QACA,CAAA,GACAH,IAAAG,EAAA;AAAA,MACA;AACA,aAAAO;AAAA,IACA;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAAE,GAAA;AACA,WAAA,KAAA,OAAA,SAIAA,EAAA,QAAA,CAAA,GAAA,KAAA,OAAA,IAAA,CAAAC,MACAA,EAAA,YAAAD,EAAA,UAAA,CAAA,GAAAC,EAAA,IAAA,IAAAA,EAAA,IACA,CAAA,IALAD,EAAA,QAAA,IAAA,KAAA,IAAA;AAAA,EAMA;AACA;;;;;;;;;;;;"}
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+ const _ = require("@nextcloud/router");
3
+ /* empty css */const b = require("./_plugin-vue2_normalizer-7f9efb60.cjs"), g = require("./Linkify-40cdd635.cjs"), f = require("escape-html"), h = require("striptags"), E = require("vue"), s = (t) => t && t.__esModule ? t : { default: t }, y = /* @__PURE__ */ s(f), l = /* @__PURE__ */ s(h), T = /* @__PURE__ */ s(E), C = {
4
+ name: "NcMentionBubble",
5
+ props: {
6
+ id: {
7
+ type: String,
8
+ required: !0
9
+ },
10
+ title: {
11
+ type: String,
12
+ required: !0
13
+ },
14
+ icon: {
15
+ type: String,
16
+ required: !0
17
+ },
18
+ iconUrl: {
19
+ type: [String, null],
20
+ default: null
21
+ },
22
+ source: {
23
+ type: String,
24
+ required: !0
25
+ },
26
+ primary: {
27
+ type: Boolean,
28
+ default: !1
29
+ }
30
+ },
31
+ computed: {
32
+ avatarUrl() {
33
+ return this.iconUrl ? this.iconUrl : this.id && this.source === "users" ? this.getAvatarUrl(this.id, 44) : null;
34
+ },
35
+ mentionText() {
36
+ return !this.id.includes(" ") && !this.id.includes("/") ? `@${this.id}` : `@"${this.id}"`;
37
+ }
38
+ },
39
+ methods: {
40
+ getAvatarUrl(t, e) {
41
+ return _.generateUrl("/avatar/{user}/{size}", {
42
+ user: t,
43
+ size: e
44
+ });
45
+ }
46
+ }
47
+ };
48
+ var $ = function() {
49
+ var e = this, n = e._self._c;
50
+ return n("span", { staticClass: "mention-bubble", class: { "mention-bubble--primary": e.primary }, attrs: { contenteditable: "false" } }, [n("span", { staticClass: "mention-bubble__wrapper" }, [n("span", { staticClass: "mention-bubble__content" }, [n("span", { staticClass: "mention-bubble__icon", class: [e.icon, `mention-bubble__icon--${e.avatarUrl ? "with-avatar" : ""}`], style: e.avatarUrl ? { backgroundImage: `url(${e.avatarUrl})` } : null }), n("span", { staticClass: "mention-bubble__title", attrs: { role: "heading", title: e.title } })]), n("span", { staticClass: "mention-bubble__select", attrs: { role: "none" } }, [e._v(e._s(e.mentionText))])])]);
51
+ }, q = [], v = /* @__PURE__ */ b.normalizeComponent(
52
+ C,
53
+ $,
54
+ q,
55
+ !1,
56
+ null,
57
+ "357e6d0e",
58
+ null,
59
+ null
60
+ );
61
+ const o = v.exports;
62
+ /**
63
+ * @copyright Copyright (c) 2020 John Molakvoæ <skjnldsv@protonmail.com>
64
+ *
65
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
66
+ *
67
+ * @license AGPL-3.0-or-later
68
+ *
69
+ * This program is free software: you can redistribute it and/or modify
70
+ * it under the terms of the GNU Affero General Public License as
71
+ * published by the Free Software Foundation, either version 3 of the
72
+ * License, or (at your option) any later version.
73
+ *
74
+ * This program is distributed in the hope that it will be useful,
75
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
76
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
77
+ * GNU Affero General Public License for more details.
78
+ *
79
+ * You should have received a copy of the GNU Affero General Public License
80
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
81
+ *
82
+ */
83
+ const u = "(?:^|\\s)", c = "(?:[^a-z]|$)", d = new RegExp(`${u}(@[a-zA-Z0-9_.@\\-']+)(${c})`, "gi"), p = new RegExp(`${u}(@&quot;[a-zA-Z0-9 _.@\\-']+&quot;)(${c})`, "gi"), S = {
84
+ props: {
85
+ userData: {
86
+ type: Object,
87
+ default: () => ({})
88
+ }
89
+ },
90
+ methods: {
91
+ /**
92
+ * Convert the value string to html for the inner content
93
+ *
94
+ * @param {string} value the content without html
95
+ * @return {string} rendered html
96
+ */
97
+ renderContent(t) {
98
+ return y.default(t).split(d).map((r) => r.split(p)).flat().map((r) => {
99
+ if (!r.startsWith("@"))
100
+ return g.Linkify(r);
101
+ const i = r.slice(1).replace(/&quot;/gi, "");
102
+ return " " + this.genSelectTemplate(i);
103
+ }).join("").replace(/\n/gmi, "<br>").replace(/&amp;/gmi, "&");
104
+ },
105
+ /**
106
+ * Convert the innerHtml content to a string with mentions as text
107
+ *
108
+ * @param {string} content the content without html
109
+ * @return {string}
110
+ */
111
+ parseContent(t) {
112
+ let e = t.replace(/<br>/gmi, `
113
+ `);
114
+ return e = e.replace(/&nbsp;/gmi, " "), e = e.replace(/&amp;/gmi, "&"), e = e.replace(/<\/div>/gmi, `
115
+ `), e = l.default(e, "<div>"), e = l.default(e), e;
116
+ },
117
+ /**
118
+ * Generate an autocompletion popup entry template
119
+ *
120
+ * @param {string} value the value to match against the userData
121
+ * @return {string}
122
+ */
123
+ genSelectTemplate(t) {
124
+ if (typeof t > "u")
125
+ return `${this.autocompleteTribute.current.collection.trigger}${this.autocompleteTribute.current.mentionText}`;
126
+ const e = this.userData[t];
127
+ return e ? this.renderComponentHtml(e, o).replace(/[\n\t]/gmi, "") : !t.includes(" ") && !t.includes("/") ? `@${t}` : `@"${t}"`;
128
+ },
129
+ /**
130
+ * Render a component and return its html content
131
+ *
132
+ * @param {object} propsData the props to pass to the component
133
+ * @param {object} component the component to render
134
+ * @return {string} the rendered html
135
+ */
136
+ renderComponentHtml(t, e) {
137
+ const n = T.default.extend(e), r = new n({
138
+ propsData: t
139
+ }), i = document.createElement("div"), a = document.createElement("div");
140
+ i.style.display = "none", i.appendChild(a), document.body.appendChild(i), r.$mount(a);
141
+ const m = i.innerHTML;
142
+ return r.$destroy(), i.remove(), m;
143
+ }
144
+ }
145
+ };
146
+ exports.NcMentionBubble = o;
147
+ exports.USERID_REGEX = d;
148
+ exports.USERID_REGEX_WITH_SPACE = p;
149
+ exports.richEditor = S;
@@ -1 +1 @@
1
- {"version":3,"file":"index-858938bd.cjs","sources":["../../src/components/NcRichContenteditable/NcMentionBubble.vue","../../src/mixins/richEditor/index.js"],"sourcesContent":["<!--\n - @copyright Copyright (c) 2020 John Molakvoæ <skjnldsv@protonmail.com>\n -\n - @author John Molakvoæ <skjnldsv@protonmail.com>\n -\n - @license GNU AGPL version 3 or any later version\n -\n - This program is free software: you can redistribute it and/or modify\n - it under the terms of the GNU Affero General Public License as\n - published by the Free Software Foundation, either version 3 of the\n - License, or (at your option) any later version.\n -\n - This program is distributed in the hope that it will be useful,\n - but WITHOUT ANY WARRANTY; without even the implied warranty of\n - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n - GNU Affero General Public License for more details.\n -\n - You should have received a copy of the GNU Affero General Public License\n - along with this program. If not, see <http://www.gnu.org/licenses/>.\n-->\n\n<template>\n\t<span :class=\"{'mention-bubble--primary': primary}\"\n\t\tclass=\"mention-bubble\"\n\t\tcontenteditable=\"false\">\n\t\t<span class=\"mention-bubble__wrapper\">\n\t\t\t<span class=\"mention-bubble__content\">\n\t\t\t\t<!-- Avatar or icon -->\n\t\t\t\t<span :class=\"[icon, `mention-bubble__icon--${avatarUrl ? 'with-avatar' : ''}`]\"\n\t\t\t\t\t:style=\"avatarUrl ? { backgroundImage: `url(${avatarUrl})` } : null\"\n\t\t\t\t\tclass=\"mention-bubble__icon\" />\n\n\t\t\t\t<!-- Title -->\n\t\t\t\t<span role=\"heading\" class=\"mention-bubble__title\" :title=\"title\" />\n\t\t\t</span>\n\n\t\t\t<!-- Selectable text for copy/paste -->\n\t\t\t<span role=\"none\" class=\"mention-bubble__select\">{{ mentionText }}</span>\n\t\t</span>\n\t</span>\n</template>\n\n<script>\nimport { generateUrl } from '@nextcloud/router'\n\nexport default {\n\tname: 'NcMentionBubble',\n\n\tprops: {\n\t\tid: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\ttitle: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\ticon: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\ticonUrl: {\n\t\t\ttype: [String, null],\n\t\t\tdefault: null,\n\t\t},\n\t\tsource: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\tprimary: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\t},\n\tcomputed: {\n\t\tavatarUrl() {\n\t\t\tif (this.iconUrl) {\n\t\t\t\treturn this.iconUrl\n\t\t\t}\n\n\t\t\treturn this.id && this.source === 'users'\n\t\t\t\t? this.getAvatarUrl(this.id, 44)\n\t\t\t\t: null\n\t\t},\n\t\tmentionText() {\n\t\t\treturn !this.id.includes(' ') && !this.id.includes('/')\n\t\t\t\t? `@${this.id}`\n\t\t\t\t: `@\"${this.id}\"`\n\t\t},\n\t},\n\n\tmethods: {\n\t\tgetAvatarUrl(user, size) {\n\t\t\treturn generateUrl('/avatar/{user}/{size}', {\n\t\t\t\tuser,\n\t\t\t\tsize,\n\t\t\t})\n\t\t},\n\t},\n}\n</script>\n\n<style lang=\"scss\" scoped>\n$bubble-height: 20px;\n$bubble-max-width: 150px;\n$bubble-padding: 2px;\n$bubble-avatar-size: $bubble-height - 2 * $bubble-padding;\n\n.mention-bubble {\n\t&--primary &__content {\n\t\tcolor: var(--color-primary-element-text);\n\t\tbackground-color: var(--color-primary-element);\n\t}\n\n\t&__wrapper {\n\t\tmax-width: $bubble-max-width;\n\t\t// Align with text\n\t\theight: $bubble-height - $bubble-padding;\n\t\tvertical-align: text-bottom;\n\t\tdisplay: inline-flex;\n\t\talign-items: center;\n\t}\n\n\t&__content {\n\t\tdisplay: inline-flex;\n\t\toverflow: hidden;\n\t\talign-items: center;\n\t\tmax-width: 100%;\n\t\theight: $bubble-height ;\n\t\t-webkit-user-select: none;\n\t\tuser-select: none;\n\t\tpadding-right: $bubble-padding * 3;\n\t\tpadding-left: $bubble-padding;\n\t\tborder-radius: math.div($bubble-height, 2);\n\t\tbackground-color: var(--color-background-dark);\n\t}\n\n\t&__icon {\n\t\tposition: relative;\n\t\twidth: $bubble-avatar-size;\n\t\theight: $bubble-avatar-size;\n\t\tborder-radius: math.div($bubble-avatar-size, 2);\n\t\tbackground-color: var(--color-background-darker);\n\t\tbackground-repeat: no-repeat;\n\t\tbackground-position: center;\n\t\tbackground-size: $bubble-avatar-size - 2 * $bubble-padding;\n\n\t\t&--with-avatar {\n\t\t\tcolor: inherit;\n\t\t\tbackground-size: cover;\n\t\t}\n\t}\n\n\t&__title {\n\t\toverflow: hidden;\n\t\tmargin-left: $bubble-padding;\n\t\twhite-space: nowrap;\n\t\ttext-overflow: ellipsis;\n\t\t// Put title in ::before so it is not selectable\n\t\t&::before {\n\t\t\tcontent: attr(title);\n\t\t}\n\t}\n\n\t// Hide the mention id so it is selectable\n\t&__select {\n\t\tposition: absolute;\n\t\tz-index: -1;\n\t\tleft: -1000px;\n\t}\n}\n\n</style>\n","/**\n * @copyright Copyright (c) 2020 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport NcMentionBubble from '../../components/NcRichContenteditable/NcMentionBubble.vue'\nimport Linkify from '../../utils/Linkify.js'\n\nimport escapeHtml from 'escape-html'\nimport stripTags from 'striptags'\nimport Vue from 'vue'\n\n// Beginning or whitespace. Non-capturing group\nconst MENTION_START = '(?:^|\\\\s)'\n// Anything that is not text or end-of-line. Non-capturing group\nconst MENTION_END = '(?:[^a-z]|$)'\nexport const USERID_REGEX = new RegExp(`${MENTION_START}(@[a-zA-Z0-9_.@\\\\-']+)(${MENTION_END})`, 'gi')\nexport const USERID_REGEX_WITH_SPACE = new RegExp(`${MENTION_START}(@&quot;[a-zA-Z0-9 _.@\\\\-']+&quot;)(${MENTION_END})`, 'gi')\n\nexport default {\n\tprops: {\n\t\tuserData: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\t},\n\tmethods: {\n\t\t/**\n\t\t * Convert the value string to html for the inner content\n\t\t *\n\t\t * @param {string} value the content without html\n\t\t * @return {string} rendered html\n\t\t */\n\t\trenderContent(value) {\n\t\t\t// Sanitize the value prop\n\t\t\tconst sanitizedValue = escapeHtml(value)\n\n\t\t\t// Extract all the userIds\n\t\t\tconst splitValue = sanitizedValue.split(USERID_REGEX)\n\t\t\t\t.map(part => part.split(USERID_REGEX_WITH_SPACE)).flat()\n\n\t\t\t// Replace userIds by html\n\t\t\treturn splitValue\n\t\t\t\t.map(part => {\n\t\t\t\t\t// When splitting, the string is always putting the userIds\n\t\t\t\t\t// on the the uneven indexes. We only want to generate the mentions html\n\t\t\t\t\tif (!part.startsWith('@')) {\n\t\t\t\t\t\t// This part doesn't contain a mention, let's make sure links are parsed\n\t\t\t\t\t\treturn Linkify(part)\n\t\t\t\t\t}\n\n\t\t\t\t\t// Extracting the id, nuking the leading @ and all \"\n\t\t\t\t\tconst id = part.slice(1).replace(/&quot;/gi, '')\n\t\t\t\t\t// Compiling template and prepend with the space we removed during the split\n\t\t\t\t\treturn ' ' + this.genSelectTemplate(id)\n\t\t\t\t})\n\t\t\t\t.join('')\n\t\t\t\t.replace(/\\n/gmi, '<br>')\n\t\t\t\t.replace(/&amp;/gmi, '&')\n\t\t},\n\n\t\t/**\n\t\t * Convert the innerHtml content to a string with mentions as text\n\t\t *\n\t\t * @param {string} content the content without html\n\t\t * @return {string}\n\t\t */\n\t\tparseContent(content) {\n\t\t\tlet text = content.replace(/<br>/gmi, '\\n')\n\t\t\ttext = text.replace(/&nbsp;/gmi, ' ')\n\t\t\ttext = text.replace(/&amp;/gmi, '&')\n\n\t\t\t// Convert the mentions to text only\n\t\t\t// first we replace divs with new lines\n\t\t\ttext = text.replace(/<\\/div>/gmi, '\\n')\n\t\t\t// then we remove all leftover html\n\t\t\ttext = stripTags(text, '<div>')\n\t\t\ttext = stripTags(text)\n\n\t\t\treturn text\n\t\t},\n\n\t\t/**\n\t\t * Generate an autocompletion popup entry template\n\t\t *\n\t\t * @param {string} value the value to match against the userData\n\t\t * @return {string}\n\t\t */\n\t\tgenSelectTemplate(value) {\n\t\t\t// The value returned by this function will replace the trigger '@'\n\t\t\t// and the search text, so when there is no match we simply return\n\t\t\t// '@' and the text.\n\t\t\tif (typeof value === 'undefined') {\n\t\t\t\treturn `${this.autocompleteTribute.current.collection.trigger}${this.autocompleteTribute.current.mentionText}`\n\t\t\t}\n\n\t\t\tconst data = this.userData[value]\n\n\t\t\t// Fallback to @mention in case no data matches\n\t\t\tif (!data) {\n\t\t\t\t// return `@${value}`\n\t\t\t\treturn !value.includes(' ') && !value.includes('/')\n\t\t\t\t\t? `@${value}`\n\t\t\t\t\t: `@\"${value}\"`\n\t\t\t}\n\n\t\t\t// Return template and make sure we strip of new lines and tabs\n\t\t\treturn this.renderComponentHtml(data, NcMentionBubble).replace(/[\\n\\t]/gmi, '')\n\t\t},\n\n\t\t/**\n\t\t * Render a component and return its html content\n\t\t *\n\t\t * @param {object} propsData the props to pass to the component\n\t\t * @param {object} component the component to render\n\t\t * @return {string} the rendered html\n\t\t */\n\t\trenderComponentHtml(propsData, component) {\n\t\t\tconst View = Vue.extend(component)\n\t\t\tconst Item = new View({\n\t\t\t\tpropsData,\n\t\t\t})\n\n\t\t\t// Prepare mountpoint\n\t\t\tconst wrapper = document.createElement('div')\n\t\t\tconst mount = document.createElement('div')\n\t\t\twrapper.style.display = 'none'\n\t\t\twrapper.appendChild(mount)\n\t\t\tdocument.body.appendChild(wrapper)\n\n\t\t\t// Mount and get raw html\n\t\t\tItem.$mount(mount)\n\t\t\tconst renderedHtml = wrapper.innerHTML\n\n\t\t\t// Destroy\n\t\t\tItem.$destroy()\n\t\t\twrapper.remove()\n\n\t\t\treturn renderedHtml\n\t\t},\n\t},\n}\n"],"names":["_sfc_main","user","size","generateUrl","MENTION_START","MENTION_END","USERID_REGEX","USERID_REGEX_WITH_SPACE","richEditor","value","escapeHtml","part","Linkify","id","content","text","stripTags","data","NcMentionBubble","propsData","component","View","Vue","Item","wrapper","mount","renderedHtml"],"mappings":"2SA6CAA,EAAA,CACA,KAAA,kBAEA,MAAA,CACA,GAAA,CACA,KAAA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EACvB,QAAQ,WAAY,GAAG,CACzB,EAQD,aAAaC,EAAS,CACrB,IAAIC,EAAOD,EAAQ,QAAQ,UAAW;AAAA,CAAI,EAC1C,OAAAC,EAAOA,EAAK,QAAQ,YAAa,GAAG,EACpCA,EAAOA,EAAK,QAAQ,WAAY,GAAG,EAInCA,EAAOA,EAAK,QAAQ,aAAc;AAAA,CAAI,EAEtCA,EAAOC,EAAUD,EAAM,OAAO,EAC9BA,EAAOC,EAAUD,CAAI,EAEdA,CACP,EAQD,kBAAkBN,EAAO,CAIxB,GAAI,OAAOA,EAAU,IACpB,MAAO,GAAG,KAAK,oBAAoB,QAAQ,WAAW,OAAU,GAAA,KAAK,oBAAoB,QAAQ,cAGlG,MAAMQ,EAAO,KAAK,SAASR,CAAK,EAGhC,OAAKQ,EAQE,KAAK,oBAAoBA,EAAMC,CAAe,EAAE,QAAQ,YAAa,EAAE,EANtE,CAACT,EAAM,SAAS,GAAG,GAAK,CAACA,EAAM,SAAS,GAAG,EAC/C,IAAIA,CAAAA,GACJ,KAAKA,CAAAA,GAKT,EASD,oBAAoBU,EAAWC,EAAW,CACzC,MAAMC,EAAOC,EAAI,OAAOF,CAAS,EAC3BG,EAAO,IAAIF,EAAK,CACrB,UAAAF,CACJ,CAAI,EAGKK,EAAU,SAAS,cAAc,KAAK,EACtCC,EAAQ,SAAS,cAAc,KAAK,EAC1CD,EAAQ,MAAM,QAAU,OACxBA,EAAQ,YAAYC,CAAK,EACzB,SAAS,KAAK,YAAYD,CAAO,EAGjCD,EAAK,OAAOE,CAAK,EACjB,MAAMC,EAAeF,EAAQ,UAG7B,OAAAD,EAAK,SAAU,EACfC,EAAQ,OAAQ,EAETE,CACP,CACD,CACF"}
1
+ {"version":3,"file":"index-4398f925.cjs","sources":["../../src/components/NcRichContenteditable/NcMentionBubble.vue","../../src/mixins/richEditor/index.js"],"sourcesContent":["<!--\n - @copyright Copyright (c) 2020 John Molakvoæ <skjnldsv@protonmail.com>\n -\n - @author John Molakvoæ <skjnldsv@protonmail.com>\n -\n - @license GNU AGPL version 3 or any later version\n -\n - This program is free software: you can redistribute it and/or modify\n - it under the terms of the GNU Affero General Public License as\n - published by the Free Software Foundation, either version 3 of the\n - License, or (at your option) any later version.\n -\n - This program is distributed in the hope that it will be useful,\n - but WITHOUT ANY WARRANTY; without even the implied warranty of\n - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n - GNU Affero General Public License for more details.\n -\n - You should have received a copy of the GNU Affero General Public License\n - along with this program. If not, see <http://www.gnu.org/licenses/>.\n-->\n\n<template>\n\t<span :class=\"{'mention-bubble--primary': primary}\"\n\t\tclass=\"mention-bubble\"\n\t\tcontenteditable=\"false\">\n\t\t<span class=\"mention-bubble__wrapper\">\n\t\t\t<span class=\"mention-bubble__content\">\n\t\t\t\t<!-- Avatar or icon -->\n\t\t\t\t<span :class=\"[icon, `mention-bubble__icon--${avatarUrl ? 'with-avatar' : ''}`]\"\n\t\t\t\t\t:style=\"avatarUrl ? { backgroundImage: `url(${avatarUrl})` } : null\"\n\t\t\t\t\tclass=\"mention-bubble__icon\" />\n\n\t\t\t\t<!-- Title -->\n\t\t\t\t<span role=\"heading\" class=\"mention-bubble__title\" :title=\"title\" />\n\t\t\t</span>\n\n\t\t\t<!-- Selectable text for copy/paste -->\n\t\t\t<span role=\"none\" class=\"mention-bubble__select\">{{ mentionText }}</span>\n\t\t</span>\n\t</span>\n</template>\n\n<script>\nimport { generateUrl } from '@nextcloud/router'\n\nexport default {\n\tname: 'NcMentionBubble',\n\n\tprops: {\n\t\tid: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\ttitle: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\ticon: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\ticonUrl: {\n\t\t\ttype: [String, null],\n\t\t\tdefault: null,\n\t\t},\n\t\tsource: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\tprimary: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\t},\n\tcomputed: {\n\t\tavatarUrl() {\n\t\t\tif (this.iconUrl) {\n\t\t\t\treturn this.iconUrl\n\t\t\t}\n\n\t\t\treturn this.id && this.source === 'users'\n\t\t\t\t? this.getAvatarUrl(this.id, 44)\n\t\t\t\t: null\n\t\t},\n\t\tmentionText() {\n\t\t\treturn !this.id.includes(' ') && !this.id.includes('/')\n\t\t\t\t? `@${this.id}`\n\t\t\t\t: `@\"${this.id}\"`\n\t\t},\n\t},\n\n\tmethods: {\n\t\tgetAvatarUrl(user, size) {\n\t\t\treturn generateUrl('/avatar/{user}/{size}', {\n\t\t\t\tuser,\n\t\t\t\tsize,\n\t\t\t})\n\t\t},\n\t},\n}\n</script>\n\n<style lang=\"scss\" scoped>\n$bubble-height: 20px;\n$bubble-max-width: 150px;\n$bubble-padding: 2px;\n$bubble-avatar-size: $bubble-height - 2 * $bubble-padding;\n\n.mention-bubble {\n\t&--primary &__content {\n\t\tcolor: var(--color-primary-element-text);\n\t\tbackground-color: var(--color-primary-element);\n\t}\n\n\t&__wrapper {\n\t\tmax-width: $bubble-max-width;\n\t\t// Align with text\n\t\theight: $bubble-height - $bubble-padding;\n\t\tvertical-align: text-bottom;\n\t\tdisplay: inline-flex;\n\t\talign-items: center;\n\t}\n\n\t&__content {\n\t\tdisplay: inline-flex;\n\t\toverflow: hidden;\n\t\talign-items: center;\n\t\tmax-width: 100%;\n\t\theight: $bubble-height ;\n\t\t-webkit-user-select: none;\n\t\tuser-select: none;\n\t\tpadding-right: $bubble-padding * 3;\n\t\tpadding-left: $bubble-padding;\n\t\tborder-radius: math.div($bubble-height, 2);\n\t\tbackground-color: var(--color-background-dark);\n\t}\n\n\t&__icon {\n\t\tposition: relative;\n\t\twidth: $bubble-avatar-size;\n\t\theight: $bubble-avatar-size;\n\t\tborder-radius: math.div($bubble-avatar-size, 2);\n\t\tbackground-color: var(--color-background-darker);\n\t\tbackground-repeat: no-repeat;\n\t\tbackground-position: center;\n\t\tbackground-size: $bubble-avatar-size - 2 * $bubble-padding;\n\n\t\t&--with-avatar {\n\t\t\tcolor: inherit;\n\t\t\tbackground-size: cover;\n\t\t}\n\t}\n\n\t&__title {\n\t\toverflow: hidden;\n\t\tmargin-left: $bubble-padding;\n\t\twhite-space: nowrap;\n\t\ttext-overflow: ellipsis;\n\t\t// Put title in ::before so it is not selectable\n\t\t&::before {\n\t\t\tcontent: attr(title);\n\t\t}\n\t}\n\n\t// Hide the mention id so it is selectable\n\t&__select {\n\t\tposition: absolute;\n\t\tz-index: -1;\n\t\tleft: -1000px;\n\t}\n}\n\n</style>\n","/**\n * @copyright Copyright (c) 2020 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport NcMentionBubble from '../../components/NcRichContenteditable/NcMentionBubble.vue'\nimport Linkify from '../../utils/Linkify.js'\n\nimport escapeHtml from 'escape-html'\nimport stripTags from 'striptags'\nimport Vue from 'vue'\n\n// Beginning or whitespace. Non-capturing group\nconst MENTION_START = '(?:^|\\\\s)'\n// Anything that is not text or end-of-line. Non-capturing group\nconst MENTION_END = '(?:[^a-z]|$)'\nexport const USERID_REGEX = new RegExp(`${MENTION_START}(@[a-zA-Z0-9_.@\\\\-']+)(${MENTION_END})`, 'gi')\nexport const USERID_REGEX_WITH_SPACE = new RegExp(`${MENTION_START}(@&quot;[a-zA-Z0-9 _.@\\\\-']+&quot;)(${MENTION_END})`, 'gi')\n\nexport default {\n\tprops: {\n\t\tuserData: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\t},\n\tmethods: {\n\t\t/**\n\t\t * Convert the value string to html for the inner content\n\t\t *\n\t\t * @param {string} value the content without html\n\t\t * @return {string} rendered html\n\t\t */\n\t\trenderContent(value) {\n\t\t\t// Sanitize the value prop\n\t\t\tconst sanitizedValue = escapeHtml(value)\n\n\t\t\t// Extract all the userIds\n\t\t\tconst splitValue = sanitizedValue.split(USERID_REGEX)\n\t\t\t\t.map(part => part.split(USERID_REGEX_WITH_SPACE)).flat()\n\n\t\t\t// Replace userIds by html\n\t\t\treturn splitValue\n\t\t\t\t.map(part => {\n\t\t\t\t\t// When splitting, the string is always putting the userIds\n\t\t\t\t\t// on the the uneven indexes. We only want to generate the mentions html\n\t\t\t\t\tif (!part.startsWith('@')) {\n\t\t\t\t\t\t// This part doesn't contain a mention, let's make sure links are parsed\n\t\t\t\t\t\treturn Linkify(part)\n\t\t\t\t\t}\n\n\t\t\t\t\t// Extracting the id, nuking the leading @ and all \"\n\t\t\t\t\tconst id = part.slice(1).replace(/&quot;/gi, '')\n\t\t\t\t\t// Compiling template and prepend with the space we removed during the split\n\t\t\t\t\treturn ' ' + this.genSelectTemplate(id)\n\t\t\t\t})\n\t\t\t\t.join('')\n\t\t\t\t.replace(/\\n/gmi, '<br>')\n\t\t\t\t.replace(/&amp;/gmi, '&')\n\t\t},\n\n\t\t/**\n\t\t * Convert the innerHtml content to a string with mentions as text\n\t\t *\n\t\t * @param {string} content the content without html\n\t\t * @return {string}\n\t\t */\n\t\tparseContent(content) {\n\t\t\tlet text = content.replace(/<br>/gmi, '\\n')\n\t\t\ttext = text.replace(/&nbsp;/gmi, ' ')\n\t\t\ttext = text.replace(/&amp;/gmi, '&')\n\n\t\t\t// Convert the mentions to text only\n\t\t\t// first we replace divs with new lines\n\t\t\ttext = text.replace(/<\\/div>/gmi, '\\n')\n\t\t\t// then we remove all leftover html\n\t\t\ttext = stripTags(text, '<div>')\n\t\t\ttext = stripTags(text)\n\n\t\t\treturn text\n\t\t},\n\n\t\t/**\n\t\t * Generate an autocompletion popup entry template\n\t\t *\n\t\t * @param {string} value the value to match against the userData\n\t\t * @return {string}\n\t\t */\n\t\tgenSelectTemplate(value) {\n\t\t\t// The value returned by this function will replace the trigger '@'\n\t\t\t// and the search text, so when there is no match we simply return\n\t\t\t// '@' and the text.\n\t\t\tif (typeof value === 'undefined') {\n\t\t\t\treturn `${this.autocompleteTribute.current.collection.trigger}${this.autocompleteTribute.current.mentionText}`\n\t\t\t}\n\n\t\t\tconst data = this.userData[value]\n\n\t\t\t// Fallback to @mention in case no data matches\n\t\t\tif (!data) {\n\t\t\t\t// return `@${value}`\n\t\t\t\treturn !value.includes(' ') && !value.includes('/')\n\t\t\t\t\t? `@${value}`\n\t\t\t\t\t: `@\"${value}\"`\n\t\t\t}\n\n\t\t\t// Return template and make sure we strip of new lines and tabs\n\t\t\treturn this.renderComponentHtml(data, NcMentionBubble).replace(/[\\n\\t]/gmi, '')\n\t\t},\n\n\t\t/**\n\t\t * Render a component and return its html content\n\t\t *\n\t\t * @param {object} propsData the props to pass to the component\n\t\t * @param {object} component the component to render\n\t\t * @return {string} the rendered html\n\t\t */\n\t\trenderComponentHtml(propsData, component) {\n\t\t\tconst View = Vue.extend(component)\n\t\t\tconst Item = new View({\n\t\t\t\tpropsData,\n\t\t\t})\n\n\t\t\t// Prepare mountpoint\n\t\t\tconst wrapper = document.createElement('div')\n\t\t\tconst mount = document.createElement('div')\n\t\t\twrapper.style.display = 'none'\n\t\t\twrapper.appendChild(mount)\n\t\t\tdocument.body.appendChild(wrapper)\n\n\t\t\t// Mount and get raw html\n\t\t\tItem.$mount(mount)\n\t\t\tconst renderedHtml = wrapper.innerHTML\n\n\t\t\t// Destroy\n\t\t\tItem.$destroy()\n\t\t\twrapper.remove()\n\n\t\t\treturn renderedHtml\n\t\t},\n\t},\n}\n"],"names":["_sfc_main","user","size","generateUrl","MENTION_START","MENTION_END","USERID_REGEX","USERID_REGEX_WITH_SPACE","richEditor","value","escapeHtml","part","Linkify","id","content","text","stripTags","data","NcMentionBubble","propsData","component","View","Vue","Item","wrapper","mount","renderedHtml"],"mappings":";;;+SA6CAA,IAAA;AAAA,EACA,MAAA;AAAA,EAEA,OAAA;AAAA,IACA,IAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;AAAA,IACA,OAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;AAAA,IACA,MAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;AAAA,IACA,SAAA;AAAA,MACA,MAAA,CAAA,QAAA,IAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA,IACA,QAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;AAAA,IACA,SAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA,EACA;AAAA,EACA,UAAA;AAAA,IACA,YAAA;AACA,aAAA,KAAA,UACA,KAAA,UAGA,KAAA,MAAA,KAAA,WAAA,UACA,KAAA,aAAA,KAAA,IAAA,EAAA,IACA;AAAA,IACA;AAAA,IACA,cAAA;AACA,aAAA,CAAA,KAAA,GAAA,SAAA,GAAA,KAAA,CAAA,KAAA,GAAA,SAAA,GAAA,IACA,IAAA,KAAA,EAAA,KACA,KAAA,KAAA,EAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,SAAA;AAAA,IACA,aAAAC,GAAAC,GAAA;AACA,aAAAC,EAAAA,YAAA,yBAAA;AAAA,QACA,MAAAF;AAAA,QACA,MAAAC;AAAA,MACA,CAAA;AAAA,IACA;AAAA,EACA;AACA;;;;;;;;;;;;;;;ACnGA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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,KAAK,oBAAoB,QAAQ,WAAW,OAAO,GAAG,KAAK,oBAAoB,QAAQ,WAAW;AAG7G,YAAMQ,IAAO,KAAK,SAASR,CAAK;AAGhC,aAAKQ,IAQE,KAAK,oBAAoBA,GAAMC,CAAe,EAAE,QAAQ,aAAa,EAAE,IANtE,CAACT,EAAM,SAAS,GAAG,KAAK,CAACA,EAAM,SAAS,GAAG,IAC/C,IAAIA,CAAK,KACT,KAAKA,CAAK;AAAA,IAKd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IASD,oBAAoBU,GAAWC,GAAW;AACzC,YAAMC,IAAOC,EAAAA,QAAI,OAAOF,CAAS,GAC3BG,IAAO,IAAIF,EAAK;AAAA,QACrB,WAAAF;AAAA,MACJ,CAAI,GAGKK,IAAU,SAAS,cAAc,KAAK,GACtCC,IAAQ,SAAS,cAAc,KAAK;AAC1C,MAAAD,EAAQ,MAAM,UAAU,QACxBA,EAAQ,YAAYC,CAAK,GACzB,SAAS,KAAK,YAAYD,CAAO,GAGjCD,EAAK,OAAOE,CAAK;AACjB,YAAMC,IAAeF,EAAQ;AAG7B,aAAAD,EAAK,SAAU,GACfC,EAAQ,OAAQ,GAETE;AAAA,IACP;AAAA,EACD;AACF;;;;;"}
@@ -0,0 +1,155 @@
1
+ import { generateUrl as u } from "@nextcloud/router";
2
+ /* empty css */import { n as p } from "./_plugin-vue2_normalizer-71e2aa87.mjs";
3
+ import { L as m } from "./Linkify-39f20c9a.mjs";
4
+ import d from "escape-html";
5
+ import a from "striptags";
6
+ import b from "vue";
7
+ const _ = {
8
+ name: "NcMentionBubble",
9
+ props: {
10
+ id: {
11
+ type: String,
12
+ required: !0
13
+ },
14
+ title: {
15
+ type: String,
16
+ required: !0
17
+ },
18
+ icon: {
19
+ type: String,
20
+ required: !0
21
+ },
22
+ iconUrl: {
23
+ type: [String, null],
24
+ default: null
25
+ },
26
+ source: {
27
+ type: String,
28
+ required: !0
29
+ },
30
+ primary: {
31
+ type: Boolean,
32
+ default: !1
33
+ }
34
+ },
35
+ computed: {
36
+ avatarUrl() {
37
+ return this.iconUrl ? this.iconUrl : this.id && this.source === "users" ? this.getAvatarUrl(this.id, 44) : null;
38
+ },
39
+ mentionText() {
40
+ return !this.id.includes(" ") && !this.id.includes("/") ? `@${this.id}` : `@"${this.id}"`;
41
+ }
42
+ },
43
+ methods: {
44
+ getAvatarUrl(t, e) {
45
+ return u("/avatar/{user}/{size}", {
46
+ user: t,
47
+ size: e
48
+ });
49
+ }
50
+ }
51
+ };
52
+ var g = function() {
53
+ var e = this, n = e._self._c;
54
+ return n("span", { staticClass: "mention-bubble", class: { "mention-bubble--primary": e.primary }, attrs: { contenteditable: "false" } }, [n("span", { staticClass: "mention-bubble__wrapper" }, [n("span", { staticClass: "mention-bubble__content" }, [n("span", { staticClass: "mention-bubble__icon", class: [e.icon, `mention-bubble__icon--${e.avatarUrl ? "with-avatar" : ""}`], style: e.avatarUrl ? { backgroundImage: `url(${e.avatarUrl})` } : null }), n("span", { staticClass: "mention-bubble__title", attrs: { role: "heading", title: e.title } })]), n("span", { staticClass: "mention-bubble__select", attrs: { role: "none" } }, [e._v(e._s(e.mentionText))])])]);
55
+ }, f = [], h = /* @__PURE__ */ p(
56
+ _,
57
+ g,
58
+ f,
59
+ !1,
60
+ null,
61
+ "357e6d0e",
62
+ null,
63
+ null
64
+ );
65
+ const y = h.exports;
66
+ /**
67
+ * @copyright Copyright (c) 2020 John Molakvoæ <skjnldsv@protonmail.com>
68
+ *
69
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
70
+ *
71
+ * @license AGPL-3.0-or-later
72
+ *
73
+ * This program is free software: you can redistribute it and/or modify
74
+ * it under the terms of the GNU Affero General Public License as
75
+ * published by the Free Software Foundation, either version 3 of the
76
+ * License, or (at your option) any later version.
77
+ *
78
+ * This program is distributed in the hope that it will be useful,
79
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
80
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
81
+ * GNU Affero General Public License for more details.
82
+ *
83
+ * You should have received a copy of the GNU Affero General Public License
84
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
85
+ *
86
+ */
87
+ const o = "(?:^|\\s)", l = "(?:[^a-z]|$)", E = new RegExp(`${o}(@[a-zA-Z0-9_.@\\-']+)(${l})`, "gi"), $ = new RegExp(`${o}(@&quot;[a-zA-Z0-9 _.@\\-']+&quot;)(${l})`, "gi"), R = {
88
+ props: {
89
+ userData: {
90
+ type: Object,
91
+ default: () => ({})
92
+ }
93
+ },
94
+ methods: {
95
+ /**
96
+ * Convert the value string to html for the inner content
97
+ *
98
+ * @param {string} value the content without html
99
+ * @return {string} rendered html
100
+ */
101
+ renderContent(t) {
102
+ return d(t).split(E).map((r) => r.split($)).flat().map((r) => {
103
+ if (!r.startsWith("@"))
104
+ return m(r);
105
+ const i = r.slice(1).replace(/&quot;/gi, "");
106
+ return " " + this.genSelectTemplate(i);
107
+ }).join("").replace(/\n/gmi, "<br>").replace(/&amp;/gmi, "&");
108
+ },
109
+ /**
110
+ * Convert the innerHtml content to a string with mentions as text
111
+ *
112
+ * @param {string} content the content without html
113
+ * @return {string}
114
+ */
115
+ parseContent(t) {
116
+ let e = t.replace(/<br>/gmi, `
117
+ `);
118
+ return e = e.replace(/&nbsp;/gmi, " "), e = e.replace(/&amp;/gmi, "&"), e = e.replace(/<\/div>/gmi, `
119
+ `), e = a(e, "<div>"), e = a(e), e;
120
+ },
121
+ /**
122
+ * Generate an autocompletion popup entry template
123
+ *
124
+ * @param {string} value the value to match against the userData
125
+ * @return {string}
126
+ */
127
+ genSelectTemplate(t) {
128
+ if (typeof t > "u")
129
+ return `${this.autocompleteTribute.current.collection.trigger}${this.autocompleteTribute.current.mentionText}`;
130
+ const e = this.userData[t];
131
+ return e ? this.renderComponentHtml(e, y).replace(/[\n\t]/gmi, "") : !t.includes(" ") && !t.includes("/") ? `@${t}` : `@"${t}"`;
132
+ },
133
+ /**
134
+ * Render a component and return its html content
135
+ *
136
+ * @param {object} propsData the props to pass to the component
137
+ * @param {object} component the component to render
138
+ * @return {string} the rendered html
139
+ */
140
+ renderComponentHtml(t, e) {
141
+ const n = b.extend(e), r = new n({
142
+ propsData: t
143
+ }), i = document.createElement("div"), s = document.createElement("div");
144
+ i.style.display = "none", i.appendChild(s), document.body.appendChild(i), r.$mount(s);
145
+ const c = i.innerHTML;
146
+ return r.$destroy(), i.remove(), c;
147
+ }
148
+ }
149
+ };
150
+ export {
151
+ y as N,
152
+ E as U,
153
+ $ as a,
154
+ R as r
155
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"index-377488aa.mjs","sources":["../../src/components/NcRichContenteditable/NcMentionBubble.vue","../../src/mixins/richEditor/index.js"],"sourcesContent":["<!--\n - @copyright Copyright (c) 2020 John Molakvoæ <skjnldsv@protonmail.com>\n -\n - @author John Molakvoæ <skjnldsv@protonmail.com>\n -\n - @license GNU AGPL version 3 or any later version\n -\n - This program is free software: you can redistribute it and/or modify\n - it under the terms of the GNU Affero General Public License as\n - published by the Free Software Foundation, either version 3 of the\n - License, or (at your option) any later version.\n -\n - This program is distributed in the hope that it will be useful,\n - but WITHOUT ANY WARRANTY; without even the implied warranty of\n - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n - GNU Affero General Public License for more details.\n -\n - You should have received a copy of the GNU Affero General Public License\n - along with this program. If not, see <http://www.gnu.org/licenses/>.\n-->\n\n<template>\n\t<span :class=\"{'mention-bubble--primary': primary}\"\n\t\tclass=\"mention-bubble\"\n\t\tcontenteditable=\"false\">\n\t\t<span class=\"mention-bubble__wrapper\">\n\t\t\t<span class=\"mention-bubble__content\">\n\t\t\t\t<!-- Avatar or icon -->\n\t\t\t\t<span :class=\"[icon, `mention-bubble__icon--${avatarUrl ? 'with-avatar' : ''}`]\"\n\t\t\t\t\t:style=\"avatarUrl ? { backgroundImage: `url(${avatarUrl})` } : null\"\n\t\t\t\t\tclass=\"mention-bubble__icon\" />\n\n\t\t\t\t<!-- Title -->\n\t\t\t\t<span role=\"heading\" class=\"mention-bubble__title\" :title=\"title\" />\n\t\t\t</span>\n\n\t\t\t<!-- Selectable text for copy/paste -->\n\t\t\t<span role=\"none\" class=\"mention-bubble__select\">{{ mentionText }}</span>\n\t\t</span>\n\t</span>\n</template>\n\n<script>\nimport { generateUrl } from '@nextcloud/router'\n\nexport default {\n\tname: 'NcMentionBubble',\n\n\tprops: {\n\t\tid: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\ttitle: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\ticon: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\ticonUrl: {\n\t\t\ttype: [String, null],\n\t\t\tdefault: null,\n\t\t},\n\t\tsource: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\tprimary: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\t},\n\tcomputed: {\n\t\tavatarUrl() {\n\t\t\tif (this.iconUrl) {\n\t\t\t\treturn this.iconUrl\n\t\t\t}\n\n\t\t\treturn this.id && this.source === 'users'\n\t\t\t\t? this.getAvatarUrl(this.id, 44)\n\t\t\t\t: null\n\t\t},\n\t\tmentionText() {\n\t\t\treturn !this.id.includes(' ') && !this.id.includes('/')\n\t\t\t\t? `@${this.id}`\n\t\t\t\t: `@\"${this.id}\"`\n\t\t},\n\t},\n\n\tmethods: {\n\t\tgetAvatarUrl(user, size) {\n\t\t\treturn generateUrl('/avatar/{user}/{size}', {\n\t\t\t\tuser,\n\t\t\t\tsize,\n\t\t\t})\n\t\t},\n\t},\n}\n</script>\n\n<style lang=\"scss\" scoped>\n$bubble-height: 20px;\n$bubble-max-width: 150px;\n$bubble-padding: 2px;\n$bubble-avatar-size: $bubble-height - 2 * $bubble-padding;\n\n.mention-bubble {\n\t&--primary &__content {\n\t\tcolor: var(--color-primary-element-text);\n\t\tbackground-color: var(--color-primary-element);\n\t}\n\n\t&__wrapper {\n\t\tmax-width: $bubble-max-width;\n\t\t// Align with text\n\t\theight: $bubble-height - $bubble-padding;\n\t\tvertical-align: text-bottom;\n\t\tdisplay: inline-flex;\n\t\talign-items: center;\n\t}\n\n\t&__content {\n\t\tdisplay: inline-flex;\n\t\toverflow: hidden;\n\t\talign-items: center;\n\t\tmax-width: 100%;\n\t\theight: $bubble-height ;\n\t\t-webkit-user-select: none;\n\t\tuser-select: none;\n\t\tpadding-right: $bubble-padding * 3;\n\t\tpadding-left: $bubble-padding;\n\t\tborder-radius: math.div($bubble-height, 2);\n\t\tbackground-color: var(--color-background-dark);\n\t}\n\n\t&__icon {\n\t\tposition: relative;\n\t\twidth: $bubble-avatar-size;\n\t\theight: $bubble-avatar-size;\n\t\tborder-radius: math.div($bubble-avatar-size, 2);\n\t\tbackground-color: var(--color-background-darker);\n\t\tbackground-repeat: no-repeat;\n\t\tbackground-position: center;\n\t\tbackground-size: $bubble-avatar-size - 2 * $bubble-padding;\n\n\t\t&--with-avatar {\n\t\t\tcolor: inherit;\n\t\t\tbackground-size: cover;\n\t\t}\n\t}\n\n\t&__title {\n\t\toverflow: hidden;\n\t\tmargin-left: $bubble-padding;\n\t\twhite-space: nowrap;\n\t\ttext-overflow: ellipsis;\n\t\t// Put title in ::before so it is not selectable\n\t\t&::before {\n\t\t\tcontent: attr(title);\n\t\t}\n\t}\n\n\t// Hide the mention id so it is selectable\n\t&__select {\n\t\tposition: absolute;\n\t\tz-index: -1;\n\t\tleft: -1000px;\n\t}\n}\n\n</style>\n","/**\n * @copyright Copyright (c) 2020 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport NcMentionBubble from '../../components/NcRichContenteditable/NcMentionBubble.vue'\nimport Linkify from '../../utils/Linkify.js'\n\nimport escapeHtml from 'escape-html'\nimport stripTags from 'striptags'\nimport Vue from 'vue'\n\n// Beginning or whitespace. Non-capturing group\nconst MENTION_START = '(?:^|\\\\s)'\n// Anything that is not text or end-of-line. Non-capturing group\nconst MENTION_END = '(?:[^a-z]|$)'\nexport const USERID_REGEX = new RegExp(`${MENTION_START}(@[a-zA-Z0-9_.@\\\\-']+)(${MENTION_END})`, 'gi')\nexport const USERID_REGEX_WITH_SPACE = new RegExp(`${MENTION_START}(@&quot;[a-zA-Z0-9 _.@\\\\-']+&quot;)(${MENTION_END})`, 'gi')\n\nexport default {\n\tprops: {\n\t\tuserData: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\t},\n\tmethods: {\n\t\t/**\n\t\t * Convert the value string to html for the inner content\n\t\t *\n\t\t * @param {string} value the content without html\n\t\t * @return {string} rendered html\n\t\t */\n\t\trenderContent(value) {\n\t\t\t// Sanitize the value prop\n\t\t\tconst sanitizedValue = escapeHtml(value)\n\n\t\t\t// Extract all the userIds\n\t\t\tconst splitValue = sanitizedValue.split(USERID_REGEX)\n\t\t\t\t.map(part => part.split(USERID_REGEX_WITH_SPACE)).flat()\n\n\t\t\t// Replace userIds by html\n\t\t\treturn splitValue\n\t\t\t\t.map(part => {\n\t\t\t\t\t// When splitting, the string is always putting the userIds\n\t\t\t\t\t// on the the uneven indexes. We only want to generate the mentions html\n\t\t\t\t\tif (!part.startsWith('@')) {\n\t\t\t\t\t\t// This part doesn't contain a mention, let's make sure links are parsed\n\t\t\t\t\t\treturn Linkify(part)\n\t\t\t\t\t}\n\n\t\t\t\t\t// Extracting the id, nuking the leading @ and all \"\n\t\t\t\t\tconst id = part.slice(1).replace(/&quot;/gi, '')\n\t\t\t\t\t// Compiling template and prepend with the space we removed during the split\n\t\t\t\t\treturn ' ' + this.genSelectTemplate(id)\n\t\t\t\t})\n\t\t\t\t.join('')\n\t\t\t\t.replace(/\\n/gmi, '<br>')\n\t\t\t\t.replace(/&amp;/gmi, '&')\n\t\t},\n\n\t\t/**\n\t\t * Convert the innerHtml content to a string with mentions as text\n\t\t *\n\t\t * @param {string} content the content without html\n\t\t * @return {string}\n\t\t */\n\t\tparseContent(content) {\n\t\t\tlet text = content.replace(/<br>/gmi, '\\n')\n\t\t\ttext = text.replace(/&nbsp;/gmi, ' ')\n\t\t\ttext = text.replace(/&amp;/gmi, '&')\n\n\t\t\t// Convert the mentions to text only\n\t\t\t// first we replace divs with new lines\n\t\t\ttext = text.replace(/<\\/div>/gmi, '\\n')\n\t\t\t// then we remove all leftover html\n\t\t\ttext = stripTags(text, '<div>')\n\t\t\ttext = stripTags(text)\n\n\t\t\treturn text\n\t\t},\n\n\t\t/**\n\t\t * Generate an autocompletion popup entry template\n\t\t *\n\t\t * @param {string} value the value to match against the userData\n\t\t * @return {string}\n\t\t */\n\t\tgenSelectTemplate(value) {\n\t\t\t// The value returned by this function will replace the trigger '@'\n\t\t\t// and the search text, so when there is no match we simply return\n\t\t\t// '@' and the text.\n\t\t\tif (typeof value === 'undefined') {\n\t\t\t\treturn `${this.autocompleteTribute.current.collection.trigger}${this.autocompleteTribute.current.mentionText}`\n\t\t\t}\n\n\t\t\tconst data = this.userData[value]\n\n\t\t\t// Fallback to @mention in case no data matches\n\t\t\tif (!data) {\n\t\t\t\t// return `@${value}`\n\t\t\t\treturn !value.includes(' ') && !value.includes('/')\n\t\t\t\t\t? `@${value}`\n\t\t\t\t\t: `@\"${value}\"`\n\t\t\t}\n\n\t\t\t// Return template and make sure we strip of new lines and tabs\n\t\t\treturn this.renderComponentHtml(data, NcMentionBubble).replace(/[\\n\\t]/gmi, '')\n\t\t},\n\n\t\t/**\n\t\t * Render a component and return its html content\n\t\t *\n\t\t * @param {object} propsData the props to pass to the component\n\t\t * @param {object} component the component to render\n\t\t * @return {string} the rendered html\n\t\t */\n\t\trenderComponentHtml(propsData, component) {\n\t\t\tconst View = Vue.extend(component)\n\t\t\tconst Item = new View({\n\t\t\t\tpropsData,\n\t\t\t})\n\n\t\t\t// Prepare mountpoint\n\t\t\tconst wrapper = document.createElement('div')\n\t\t\tconst mount = document.createElement('div')\n\t\t\twrapper.style.display = 'none'\n\t\t\twrapper.appendChild(mount)\n\t\t\tdocument.body.appendChild(wrapper)\n\n\t\t\t// Mount and get raw html\n\t\t\tItem.$mount(mount)\n\t\t\tconst renderedHtml = wrapper.innerHTML\n\n\t\t\t// Destroy\n\t\t\tItem.$destroy()\n\t\t\twrapper.remove()\n\n\t\t\treturn renderedHtml\n\t\t},\n\t},\n}\n"],"names":["_sfc_main","user","size","generateUrl","MENTION_START","MENTION_END","USERID_REGEX","USERID_REGEX_WITH_SPACE","richEditor","value","escapeHtml","part","Linkify","id","content","text","stripTags","data","NcMentionBubble","propsData","component","View","Vue","Item","wrapper","mount","renderedHtml"],"mappings":";;;;;;;AA6CA,MAAAA,IAAA,EACA,MAAA,mBAEA,OAAA,EACA,IAAA,EACA,MAAA,QACA,UAAA,GACA,GACA,OAAA,EACA,MAAA,QACA,UAAA,GACA,GACA,MAAA,EACA,MAAA,QACA,UAAA,GACA,GACA,SAAA,EACA,MAAA,CAAA,QAAA,IAAA,GACA,SAAA,KACA,GACA,QAAA,EACA,MAAA,QACA,UAAA,GACA,GACA,SAAA,EACA,MAAA,SACA,SAAA,GACA,EACA,GACA,UAAA,EACA,YAAA;AACA,SAAA,KAAA,UACA,KAAA,UAGA,KAAA,MAAA,KAAA,WAAA,UACA,KAAA,aAAA,KAAA,IAAA,EAAA,IACA;AACA,GACA,cAAA;AACA,SAAA,CAAA,KAAA,GAAA,SAAA,GAAA,KAAA,CAAA,KAAA,GAAA,SAAA,GAAA,IACA,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WAGlG;AAAA,QAAMQ,IAAO,KAAK,SAASR,CAAK;AAGhC,SAAKQ,IAQE,KAAK,oBAAoBA,GAAMC,CAAe,EAAE,QAAQ,aAAa,EAAE,IANtE,CAACT,EAAM,SAAS,GAAG,KAAK,CAACA,EAAM,SAAS,GAAG,IAC/C,IAAIA,CAAAA,KACJ,KAAKA,CAAAA;AAKT,GASD,oBAAoBU,GAAWC,GAAW;AACzC,QAAMC,IAAOC,EAAI,OAAOF,CAAS,GAC3BG,IAAO,IAAIF,EAAK,EACrB,WAAAF,EACJ,CAAI,GAGKK,IAAU,SAAS,cAAc,KAAK,GACtCC,IAAQ,SAAS,cAAc,KAAK;AAC1CD,EAAAA,EAAQ,MAAM,UAAU,QACxBA,EAAQ,YAAYC,CAAK,GACzB,SAAS,KAAK,YAAYD,CAAO,GAGjCD,EAAK,OAAOE,CAAK;AACjB,QAAMC,IAAeF,EAAQ;AAG7B,SAAAD,EAAK,SAAU,GACfC,EAAQ,OAAQ,GAETE;AACP,EACD,EACF;"}
1
+ {"version":3,"file":"index-5f2a5f57.mjs","sources":["../../src/components/NcRichContenteditable/NcMentionBubble.vue","../../src/mixins/richEditor/index.js"],"sourcesContent":["<!--\n - @copyright Copyright (c) 2020 John Molakvoæ <skjnldsv@protonmail.com>\n -\n - @author John Molakvoæ <skjnldsv@protonmail.com>\n -\n - @license GNU AGPL version 3 or any later version\n -\n - This program is free software: you can redistribute it and/or modify\n - it under the terms of the GNU Affero General Public License as\n - published by the Free Software Foundation, either version 3 of the\n - License, or (at your option) any later version.\n -\n - This program is distributed in the hope that it will be useful,\n - but WITHOUT ANY WARRANTY; without even the implied warranty of\n - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n - GNU Affero General Public License for more details.\n -\n - You should have received a copy of the GNU Affero General Public License\n - along with this program. If not, see <http://www.gnu.org/licenses/>.\n-->\n\n<template>\n\t<span :class=\"{'mention-bubble--primary': primary}\"\n\t\tclass=\"mention-bubble\"\n\t\tcontenteditable=\"false\">\n\t\t<span class=\"mention-bubble__wrapper\">\n\t\t\t<span class=\"mention-bubble__content\">\n\t\t\t\t<!-- Avatar or icon -->\n\t\t\t\t<span :class=\"[icon, `mention-bubble__icon--${avatarUrl ? 'with-avatar' : ''}`]\"\n\t\t\t\t\t:style=\"avatarUrl ? { backgroundImage: `url(${avatarUrl})` } : null\"\n\t\t\t\t\tclass=\"mention-bubble__icon\" />\n\n\t\t\t\t<!-- Title -->\n\t\t\t\t<span role=\"heading\" class=\"mention-bubble__title\" :title=\"title\" />\n\t\t\t</span>\n\n\t\t\t<!-- Selectable text for copy/paste -->\n\t\t\t<span role=\"none\" class=\"mention-bubble__select\">{{ mentionText }}</span>\n\t\t</span>\n\t</span>\n</template>\n\n<script>\nimport { generateUrl } from '@nextcloud/router'\n\nexport default {\n\tname: 'NcMentionBubble',\n\n\tprops: {\n\t\tid: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\ttitle: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\ticon: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\ticonUrl: {\n\t\t\ttype: [String, null],\n\t\t\tdefault: null,\n\t\t},\n\t\tsource: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\tprimary: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\t},\n\tcomputed: {\n\t\tavatarUrl() {\n\t\t\tif (this.iconUrl) {\n\t\t\t\treturn this.iconUrl\n\t\t\t}\n\n\t\t\treturn this.id && this.source === 'users'\n\t\t\t\t? this.getAvatarUrl(this.id, 44)\n\t\t\t\t: null\n\t\t},\n\t\tmentionText() {\n\t\t\treturn !this.id.includes(' ') && !this.id.includes('/')\n\t\t\t\t? `@${this.id}`\n\t\t\t\t: `@\"${this.id}\"`\n\t\t},\n\t},\n\n\tmethods: {\n\t\tgetAvatarUrl(user, size) {\n\t\t\treturn generateUrl('/avatar/{user}/{size}', {\n\t\t\t\tuser,\n\t\t\t\tsize,\n\t\t\t})\n\t\t},\n\t},\n}\n</script>\n\n<style lang=\"scss\" scoped>\n$bubble-height: 20px;\n$bubble-max-width: 150px;\n$bubble-padding: 2px;\n$bubble-avatar-size: $bubble-height - 2 * $bubble-padding;\n\n.mention-bubble {\n\t&--primary &__content {\n\t\tcolor: var(--color-primary-element-text);\n\t\tbackground-color: var(--color-primary-element);\n\t}\n\n\t&__wrapper {\n\t\tmax-width: $bubble-max-width;\n\t\t// Align with text\n\t\theight: $bubble-height - $bubble-padding;\n\t\tvertical-align: text-bottom;\n\t\tdisplay: inline-flex;\n\t\talign-items: center;\n\t}\n\n\t&__content {\n\t\tdisplay: inline-flex;\n\t\toverflow: hidden;\n\t\talign-items: center;\n\t\tmax-width: 100%;\n\t\theight: $bubble-height ;\n\t\t-webkit-user-select: none;\n\t\tuser-select: none;\n\t\tpadding-right: $bubble-padding * 3;\n\t\tpadding-left: $bubble-padding;\n\t\tborder-radius: math.div($bubble-height, 2);\n\t\tbackground-color: var(--color-background-dark);\n\t}\n\n\t&__icon {\n\t\tposition: relative;\n\t\twidth: $bubble-avatar-size;\n\t\theight: $bubble-avatar-size;\n\t\tborder-radius: math.div($bubble-avatar-size, 2);\n\t\tbackground-color: var(--color-background-darker);\n\t\tbackground-repeat: no-repeat;\n\t\tbackground-position: center;\n\t\tbackground-size: $bubble-avatar-size - 2 * $bubble-padding;\n\n\t\t&--with-avatar {\n\t\t\tcolor: inherit;\n\t\t\tbackground-size: cover;\n\t\t}\n\t}\n\n\t&__title {\n\t\toverflow: hidden;\n\t\tmargin-left: $bubble-padding;\n\t\twhite-space: nowrap;\n\t\ttext-overflow: ellipsis;\n\t\t// Put title in ::before so it is not selectable\n\t\t&::before {\n\t\t\tcontent: attr(title);\n\t\t}\n\t}\n\n\t// Hide the mention id so it is selectable\n\t&__select {\n\t\tposition: absolute;\n\t\tz-index: -1;\n\t\tleft: -1000px;\n\t}\n}\n\n</style>\n","/**\n * @copyright Copyright (c) 2020 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport NcMentionBubble from '../../components/NcRichContenteditable/NcMentionBubble.vue'\nimport Linkify from '../../utils/Linkify.js'\n\nimport escapeHtml from 'escape-html'\nimport stripTags from 'striptags'\nimport Vue from 'vue'\n\n// Beginning or whitespace. Non-capturing group\nconst MENTION_START = '(?:^|\\\\s)'\n// Anything that is not text or end-of-line. Non-capturing group\nconst MENTION_END = '(?:[^a-z]|$)'\nexport const USERID_REGEX = new RegExp(`${MENTION_START}(@[a-zA-Z0-9_.@\\\\-']+)(${MENTION_END})`, 'gi')\nexport const USERID_REGEX_WITH_SPACE = new RegExp(`${MENTION_START}(@&quot;[a-zA-Z0-9 _.@\\\\-']+&quot;)(${MENTION_END})`, 'gi')\n\nexport default {\n\tprops: {\n\t\tuserData: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\t},\n\tmethods: {\n\t\t/**\n\t\t * Convert the value string to html for the inner content\n\t\t *\n\t\t * @param {string} value the content without html\n\t\t * @return {string} rendered html\n\t\t */\n\t\trenderContent(value) {\n\t\t\t// Sanitize the value prop\n\t\t\tconst sanitizedValue = escapeHtml(value)\n\n\t\t\t// Extract all the userIds\n\t\t\tconst splitValue = sanitizedValue.split(USERID_REGEX)\n\t\t\t\t.map(part => part.split(USERID_REGEX_WITH_SPACE)).flat()\n\n\t\t\t// Replace userIds by html\n\t\t\treturn splitValue\n\t\t\t\t.map(part => {\n\t\t\t\t\t// When splitting, the string is always putting the userIds\n\t\t\t\t\t// on the the uneven indexes. We only want to generate the mentions html\n\t\t\t\t\tif (!part.startsWith('@')) {\n\t\t\t\t\t\t// This part doesn't contain a mention, let's make sure links are parsed\n\t\t\t\t\t\treturn Linkify(part)\n\t\t\t\t\t}\n\n\t\t\t\t\t// Extracting the id, nuking the leading @ and all \"\n\t\t\t\t\tconst id = part.slice(1).replace(/&quot;/gi, '')\n\t\t\t\t\t// Compiling template and prepend with the space we removed during the split\n\t\t\t\t\treturn ' ' + this.genSelectTemplate(id)\n\t\t\t\t})\n\t\t\t\t.join('')\n\t\t\t\t.replace(/\\n/gmi, '<br>')\n\t\t\t\t.replace(/&amp;/gmi, '&')\n\t\t},\n\n\t\t/**\n\t\t * Convert the innerHtml content to a string with mentions as text\n\t\t *\n\t\t * @param {string} content the content without html\n\t\t * @return {string}\n\t\t */\n\t\tparseContent(content) {\n\t\t\tlet text = content.replace(/<br>/gmi, '\\n')\n\t\t\ttext = text.replace(/&nbsp;/gmi, ' ')\n\t\t\ttext = text.replace(/&amp;/gmi, '&')\n\n\t\t\t// Convert the mentions to text only\n\t\t\t// first we replace divs with new lines\n\t\t\ttext = text.replace(/<\\/div>/gmi, '\\n')\n\t\t\t// then we remove all leftover html\n\t\t\ttext = stripTags(text, '<div>')\n\t\t\ttext = stripTags(text)\n\n\t\t\treturn text\n\t\t},\n\n\t\t/**\n\t\t * Generate an autocompletion popup entry template\n\t\t *\n\t\t * @param {string} value the value to match against the userData\n\t\t * @return {string}\n\t\t */\n\t\tgenSelectTemplate(value) {\n\t\t\t// The value returned by this function will replace the trigger '@'\n\t\t\t// and the search text, so when there is no match we simply return\n\t\t\t// '@' and the text.\n\t\t\tif (typeof value === 'undefined') {\n\t\t\t\treturn `${this.autocompleteTribute.current.collection.trigger}${this.autocompleteTribute.current.mentionText}`\n\t\t\t}\n\n\t\t\tconst data = this.userData[value]\n\n\t\t\t// Fallback to @mention in case no data matches\n\t\t\tif (!data) {\n\t\t\t\t// return `@${value}`\n\t\t\t\treturn !value.includes(' ') && !value.includes('/')\n\t\t\t\t\t? `@${value}`\n\t\t\t\t\t: `@\"${value}\"`\n\t\t\t}\n\n\t\t\t// Return template and make sure we strip of new lines and tabs\n\t\t\treturn this.renderComponentHtml(data, NcMentionBubble).replace(/[\\n\\t]/gmi, '')\n\t\t},\n\n\t\t/**\n\t\t * Render a component and return its html content\n\t\t *\n\t\t * @param {object} propsData the props to pass to the component\n\t\t * @param {object} component the component to render\n\t\t * @return {string} the rendered html\n\t\t */\n\t\trenderComponentHtml(propsData, component) {\n\t\t\tconst View = Vue.extend(component)\n\t\t\tconst Item = new View({\n\t\t\t\tpropsData,\n\t\t\t})\n\n\t\t\t// Prepare mountpoint\n\t\t\tconst wrapper = document.createElement('div')\n\t\t\tconst mount = document.createElement('div')\n\t\t\twrapper.style.display = 'none'\n\t\t\twrapper.appendChild(mount)\n\t\t\tdocument.body.appendChild(wrapper)\n\n\t\t\t// Mount and get raw html\n\t\t\tItem.$mount(mount)\n\t\t\tconst renderedHtml = wrapper.innerHTML\n\n\t\t\t// Destroy\n\t\t\tItem.$destroy()\n\t\t\twrapper.remove()\n\n\t\t\treturn renderedHtml\n\t\t},\n\t},\n}\n"],"names":["_sfc_main","user","size","generateUrl","MENTION_START","MENTION_END","USERID_REGEX","USERID_REGEX_WITH_SPACE","richEditor","value","escapeHtml","part","Linkify","id","content","text","stripTags","data","NcMentionBubble","propsData","component","View","Vue","Item","wrapper","mount","renderedHtml"],"mappings":";;;;;;;AA6CA,MAAAA,IAAA;AAAA,EACA,MAAA;AAAA,EAEA,OAAA;AAAA,IACA,IAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;AAAA,IACA,OAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;AAAA,IACA,MAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;A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