markdown-flow-ui 0.3.2-dev.2 → 0.3.2

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 (283) hide show
  1. package/README.md +0 -13
  2. package/dist/_virtual/index.es8.js +2 -2
  3. package/dist/_virtual/index.es9.js +2 -2
  4. package/dist/_virtual/index8.cjs +1 -1
  5. package/dist/_virtual/index9.cjs +1 -1
  6. package/dist/assets/markdown-flow-ui.css +1 -1
  7. package/dist/components/ContentRender/IframeSandbox.cjs.map +1 -1
  8. package/dist/components/ContentRender/IframeSandbox.es.js.map +1 -1
  9. package/dist/components/ContentRender/utils/video-markdown-run.cjs.map +1 -1
  10. package/dist/components/ContentRender/utils/video-markdown-run.es.js.map +1 -1
  11. package/dist/components/MarkdownFlow/ScrollToBottomButton.cjs.map +1 -1
  12. package/dist/components/MarkdownFlow/ScrollToBottomButton.es.js.map +1 -1
  13. package/dist/components/MarkdownFlow/ScrollToBottomControl.cjs.map +1 -1
  14. package/dist/components/MarkdownFlow/ScrollToBottomControl.es.js.map +1 -1
  15. package/dist/components/MarkdownFlow/useScrollToBottom.cjs.map +1 -1
  16. package/dist/components/MarkdownFlow/useScrollToBottom.es.js.map +1 -1
  17. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs +1 -1
  18. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs.map +1 -1
  19. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.d.ts +2 -2
  20. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js +323 -562
  21. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js.map +1 -1
  22. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.cjs +1 -1
  23. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.cjs.map +1 -1
  24. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.d.ts +0 -8
  25. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js +64 -107
  26. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js.map +1 -1
  27. package/dist/components/MarkdownFlowEditor/editor-context.cjs +1 -1
  28. package/dist/components/MarkdownFlowEditor/editor-context.cjs.map +1 -1
  29. package/dist/components/MarkdownFlowEditor/editor-context.es.js +4 -10
  30. package/dist/components/MarkdownFlowEditor/editor-context.es.js.map +1 -1
  31. package/dist/components/MarkdownFlowEditor/editorI18n.d.ts +0 -308
  32. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.cjs +1 -1
  33. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.d.ts +1 -15
  34. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js +87 -115
  35. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js.map +1 -1
  36. package/dist/components/MarkdownFlowEditor/locales/de-DE.json.cjs +1 -1
  37. package/dist/components/MarkdownFlowEditor/locales/de-DE.json.d.ts +1 -15
  38. package/dist/components/MarkdownFlowEditor/locales/de-DE.json.es.js +88 -116
  39. package/dist/components/MarkdownFlowEditor/locales/de-DE.json.es.js.map +1 -1
  40. package/dist/components/MarkdownFlowEditor/locales/en-US.json.cjs +1 -1
  41. package/dist/components/MarkdownFlowEditor/locales/en-US.json.d.ts +1 -15
  42. package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js +88 -116
  43. package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js.map +1 -1
  44. package/dist/components/MarkdownFlowEditor/locales/es-ES.json.cjs +1 -1
  45. package/dist/components/MarkdownFlowEditor/locales/es-ES.json.d.ts +1 -15
  46. package/dist/components/MarkdownFlowEditor/locales/es-ES.json.es.js +80 -108
  47. package/dist/components/MarkdownFlowEditor/locales/es-ES.json.es.js.map +1 -1
  48. package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.cjs +1 -1
  49. package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.d.ts +1 -15
  50. package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.es.js +82 -110
  51. package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.es.js.map +1 -1
  52. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.cjs +1 -1
  53. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.d.ts +1 -15
  54. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js +86 -114
  55. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js.map +1 -1
  56. package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.cjs +1 -1
  57. package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.d.ts +1 -15
  58. package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.es.js +88 -116
  59. package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.es.js.map +1 -1
  60. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.cjs +1 -1
  61. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.d.ts +1 -15
  62. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js +85 -113
  63. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js.map +1 -1
  64. package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.cjs +1 -1
  65. package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.d.ts +1 -15
  66. package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.es.js +94 -122
  67. package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.es.js.map +1 -1
  68. package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.cjs +1 -1
  69. package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.d.ts +1 -15
  70. package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.es.js +74 -102
  71. package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.es.js.map +1 -1
  72. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.cjs +1 -1
  73. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.d.ts +1 -15
  74. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.es.js +72 -100
  75. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.es.js.map +1 -1
  76. package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.cjs +1 -1
  77. package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.cjs.map +1 -1
  78. package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.d.ts +2 -1
  79. package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.es.js +62 -53
  80. package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.es.js.map +1 -1
  81. package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.cjs.map +1 -1
  82. package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.d.ts +1 -1
  83. package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.es.js.map +1 -1
  84. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs +3 -3
  85. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs.map +1 -1
  86. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.d.ts +1 -5
  87. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js +149 -154
  88. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js.map +1 -1
  89. package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.cjs +1 -1
  90. package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.cjs.map +1 -1
  91. package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.d.ts +2 -1
  92. package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.es.js +53 -42
  93. package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.es.js.map +1 -1
  94. package/dist/components/MarkdownFlowEditor/types.cjs +1 -1
  95. package/dist/components/MarkdownFlowEditor/types.cjs.map +1 -1
  96. package/dist/components/MarkdownFlowEditor/types.d.ts +1 -11
  97. package/dist/components/MarkdownFlowEditor/types.es.js +2 -2
  98. package/dist/components/MarkdownFlowEditor/types.es.js.map +1 -1
  99. package/dist/components/MarkdownFlowEditor/utils.cjs +1 -1
  100. package/dist/components/MarkdownFlowEditor/utils.cjs.map +1 -1
  101. package/dist/components/MarkdownFlowEditor/utils.d.ts +0 -10
  102. package/dist/components/MarkdownFlowEditor/utils.es.js +59 -73
  103. package/dist/components/MarkdownFlowEditor/utils.es.js.map +1 -1
  104. package/dist/components/Slide/MarkdownSlideScaling.cjs.map +1 -1
  105. package/dist/components/Slide/MarkdownSlideScaling.es.js.map +1 -1
  106. package/dist/components/Slide/MobilePlayerSettingsSheet.es.js +16 -16
  107. package/dist/components/Slide/Player.cjs.map +1 -1
  108. package/dist/components/Slide/Player.es.js.map +1 -1
  109. package/dist/components/Slide/Slide.cjs.map +1 -1
  110. package/dist/components/Slide/Slide.es.js.map +1 -1
  111. package/dist/components/Slide/SubtitleOverlay.cjs.map +1 -1
  112. package/dist/components/Slide/SubtitleOverlay.es.js.map +1 -1
  113. package/dist/components/Slide/slideI18n.cjs.map +1 -1
  114. package/dist/components/Slide/slideI18n.es.js.map +1 -1
  115. package/dist/components/Slide/useSlide.cjs.map +1 -1
  116. package/dist/components/Slide/useSlide.es.js.map +1 -1
  117. package/dist/components/Slide/utils/streamingNavigation.cjs.map +1 -1
  118. package/dist/components/Slide/utils/streamingNavigation.es.js.map +1 -1
  119. package/dist/components/ui/dialog.cjs +1 -1
  120. package/dist/components/ui/dialog.cjs.map +1 -1
  121. package/dist/components/ui/dialog.es.js +27 -27
  122. package/dist/components/ui/dialog.es.js.map +1 -1
  123. package/dist/lib/interaction-defaults.cjs.map +1 -1
  124. package/dist/lib/interaction-defaults.es.js.map +1 -1
  125. package/dist/markdown-flow-ui-lib.css +1 -1
  126. package/dist/markdown-flow-ui.css +1 -1
  127. package/dist/node_modules/@braintree/sanitize-url/dist/index.cjs +1 -1
  128. package/dist/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
  129. package/dist/node_modules/@radix-ui/react-context/dist/index.cjs +1 -1
  130. package/dist/node_modules/@radix-ui/react-context/dist/index.cjs.map +1 -1
  131. package/dist/node_modules/@radix-ui/react-context/dist/index.es.js +34 -49
  132. package/dist/node_modules/@radix-ui/react-context/dist/index.es.js.map +1 -1
  133. package/dist/node_modules/@radix-ui/react-dialog/dist/index.cjs +1 -5
  134. package/dist/node_modules/@radix-ui/react-dialog/dist/index.cjs.map +1 -1
  135. package/dist/node_modules/@radix-ui/react-dialog/dist/index.es.js +206 -220
  136. package/dist/node_modules/@radix-ui/react-dialog/dist/index.es.js.map +1 -1
  137. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/primitive/dist/index.cjs +2 -0
  138. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/primitive/dist/index.cjs.map +1 -0
  139. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/primitive/dist/index.es.js +50 -0
  140. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/primitive/dist/index.es.js.map +1 -0
  141. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-compose-refs/dist/index.cjs +2 -0
  142. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-compose-refs/dist/index.cjs.map +1 -0
  143. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-compose-refs/dist/index.es.js +34 -0
  144. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-compose-refs/dist/index.es.js.map +1 -0
  145. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-context/dist/index.cjs +2 -0
  146. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-context/dist/index.cjs.map +1 -0
  147. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-context/dist/index.es.js +82 -0
  148. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-context/dist/index.es.js.map +1 -0
  149. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs +2 -0
  150. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs.map +1 -0
  151. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-dismissable-layer/dist/index.es.js +216 -0
  152. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-dismissable-layer/dist/index.es.js.map +1 -0
  153. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-id/dist/index.cjs +2 -0
  154. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-id/dist/index.cjs.map +1 -0
  155. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-id/dist/index.es.js +15 -0
  156. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-id/dist/index.es.js.map +1 -0
  157. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-portal/dist/index.cjs +2 -0
  158. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-portal/dist/index.cjs.map +1 -0
  159. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-portal/dist/index.es.js +18 -0
  160. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-portal/dist/index.es.js.map +1 -0
  161. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-presence/dist/index.cjs +2 -0
  162. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-presence/dist/index.cjs.map +1 -0
  163. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-presence/dist/index.es.js +104 -0
  164. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-presence/dist/index.es.js.map +1 -0
  165. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive/dist/index.cjs +2 -0
  166. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive/dist/index.cjs.map +1 -0
  167. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive/dist/index.es.js +39 -0
  168. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive/dist/index.es.js.map +1 -0
  169. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs +2 -0
  170. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs.map +1 -0
  171. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-callback-ref/dist/index.es.js +13 -0
  172. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-callback-ref/dist/index.es.js.map +1 -0
  173. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs +2 -0
  174. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs.map +1 -0
  175. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-controllable-state/dist/index.es.js +70 -0
  176. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-controllable-state/dist/index.es.js.map +1 -0
  177. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-effect-event/dist/index.cjs +2 -0
  178. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-effect-event/dist/index.cjs.map +1 -0
  179. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-effect-event/dist/index.es.js +20 -0
  180. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-effect-event/dist/index.es.js.map +1 -0
  181. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-layout-effect/dist/index.cjs +2 -0
  182. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-layout-effect/dist/index.cjs.map +1 -0
  183. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-layout-effect/dist/index.es.js +7 -0
  184. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-layout-effect/dist/index.es.js.map +1 -0
  185. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.cjs +1 -1
  186. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.cjs.map +1 -1
  187. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.es.js +18 -9
  188. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.es.js.map +1 -1
  189. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.cjs +1 -1
  190. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.cjs.map +1 -1
  191. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.es.js +148 -100
  192. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.es.js.map +1 -1
  193. package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-compose-refs/dist/index.cjs +2 -0
  194. package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-compose-refs/dist/index.cjs.map +1 -0
  195. package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-compose-refs/dist/index.es.js +34 -0
  196. package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-compose-refs/dist/index.es.js.map +1 -0
  197. package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-primitive/dist/index.cjs +2 -0
  198. package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-primitive/dist/index.cjs.map +1 -0
  199. package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-primitive/dist/index.es.js +39 -0
  200. package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-primitive/dist/index.es.js.map +1 -0
  201. package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs +2 -0
  202. package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs.map +1 -0
  203. package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-use-callback-ref/dist/index.es.js +13 -0
  204. package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-use-callback-ref/dist/index.es.js.map +1 -0
  205. package/dist/node_modules/@radix-ui/react-id/dist/index.cjs +1 -1
  206. package/dist/node_modules/@radix-ui/react-id/dist/index.cjs.map +1 -1
  207. package/dist/node_modules/@radix-ui/react-id/dist/index.es.js +8 -8
  208. package/dist/node_modules/@radix-ui/react-id/dist/index.es.js.map +1 -1
  209. package/dist/node_modules/@radix-ui/react-primitive/dist/index.cjs +1 -1
  210. package/dist/node_modules/@radix-ui/react-primitive/dist/index.cjs.map +1 -1
  211. package/dist/node_modules/@radix-ui/react-primitive/dist/index.es.js +1 -1
  212. package/dist/node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot/dist/index.cjs +2 -0
  213. package/dist/node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot/dist/index.cjs.map +1 -0
  214. package/dist/node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot/dist/index.es.js +50 -0
  215. package/dist/node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot/dist/index.es.js.map +1 -0
  216. package/dist/node_modules/@radix-ui/react-slot/dist/index.cjs +1 -1
  217. package/dist/node_modules/@radix-ui/react-slot/dist/index.cjs.map +1 -1
  218. package/dist/node_modules/@radix-ui/react-slot/dist/index.es.js +80 -41
  219. package/dist/node_modules/@radix-ui/react-slot/dist/index.es.js.map +1 -1
  220. package/dist/node_modules/@radix-ui/react-slot/node_modules/@radix-ui/react-compose-refs/dist/index.cjs +2 -0
  221. package/dist/node_modules/@radix-ui/react-slot/node_modules/@radix-ui/react-compose-refs/dist/index.cjs.map +1 -0
  222. package/dist/node_modules/@radix-ui/react-slot/node_modules/@radix-ui/react-compose-refs/dist/index.es.js +34 -0
  223. package/dist/node_modules/@radix-ui/react-slot/node_modules/@radix-ui/react-compose-refs/dist/index.es.js.map +1 -0
  224. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.cjs +1 -1
  225. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.cjs.map +1 -1
  226. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.es.js +1 -1
  227. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.cjs +2 -0
  228. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.cjs.map +1 -0
  229. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.es.js +12 -0
  230. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.es.js.map +1 -0
  231. package/dist/node_modules/classnames/index.cjs +1 -1
  232. package/dist/node_modules/classnames/index.es.js +1 -1
  233. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.cjs +2 -2
  234. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.cjs.map +1 -1
  235. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.es.js +75 -72
  236. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.es.js.map +1 -1
  237. package/package.json +10 -10
  238. package/dist/components/MarkdownFlowEditor/components/CustomPopover.cjs +0 -2
  239. package/dist/components/MarkdownFlowEditor/components/CustomPopover.cjs.map +0 -1
  240. package/dist/components/MarkdownFlowEditor/components/CustomPopover.d.ts +0 -17
  241. package/dist/components/MarkdownFlowEditor/components/CustomPopover.es.js +0 -46
  242. package/dist/components/MarkdownFlowEditor/components/CustomPopover.es.js.map +0 -1
  243. package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.cjs +0 -2
  244. package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.cjs.map +0 -1
  245. package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.d.ts +0 -18
  246. package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.es.js +0 -184
  247. package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.es.js.map +0 -1
  248. package/dist/components/MarkdownFlowEditor/components/VariableSelect.cjs +0 -2
  249. package/dist/components/MarkdownFlowEditor/components/VariableSelect.cjs.map +0 -1
  250. package/dist/components/MarkdownFlowEditor/components/VariableSelect.d.ts +0 -11
  251. package/dist/components/MarkdownFlowEditor/components/VariableSelect.es.js +0 -172
  252. package/dist/components/MarkdownFlowEditor/components/VariableSelect.es.js.map +0 -1
  253. package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.cjs +0 -2
  254. package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.cjs.map +0 -1
  255. package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.d.ts +0 -3
  256. package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.es.js +0 -32
  257. package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.es.js.map +0 -1
  258. package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.cjs +0 -3
  259. package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.cjs.map +0 -1
  260. package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.d.ts +0 -9
  261. package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.es.js +0 -53
  262. package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.es.js.map +0 -1
  263. package/dist/components/ui/popover.cjs +0 -2
  264. package/dist/components/ui/popover.cjs.map +0 -1
  265. package/dist/components/ui/popover.es.js +0 -24
  266. package/dist/components/ui/popover.es.js.map +0 -1
  267. package/dist/node_modules/@radix-ui/react-popover/dist/index.cjs +0 -2
  268. package/dist/node_modules/@radix-ui/react-popover/dist/index.cjs.map +0 -1
  269. package/dist/node_modules/@radix-ui/react-popover/dist/index.es.js +0 -241
  270. package/dist/node_modules/@radix-ui/react-popover/dist/index.es.js.map +0 -1
  271. package/dist/node_modules/lucide-react/dist/esm/icons/braces.cjs +0 -7
  272. package/dist/node_modules/lucide-react/dist/esm/icons/braces.cjs.map +0 -1
  273. package/dist/node_modules/lucide-react/dist/esm/icons/braces.es.js +0 -25
  274. package/dist/node_modules/lucide-react/dist/esm/icons/braces.es.js.map +0 -1
  275. package/dist/node_modules/lucide-react/dist/esm/icons/plus.cjs +0 -7
  276. package/dist/node_modules/lucide-react/dist/esm/icons/plus.cjs.map +0 -1
  277. package/dist/node_modules/lucide-react/dist/esm/icons/plus.es.js +0 -16
  278. package/dist/node_modules/lucide-react/dist/esm/icons/plus.es.js.map +0 -1
  279. package/dist/node_modules/lucide-react/dist/esm/icons/search.cjs +0 -7
  280. package/dist/node_modules/lucide-react/dist/esm/icons/search.cjs.map +0 -1
  281. package/dist/node_modules/lucide-react/dist/esm/icons/search.es.js +0 -16
  282. package/dist/node_modules/lucide-react/dist/esm/icons/search.es.js.map +0 -1
  283. /package/dist/components/MarkdownFlowEditor/plugins/{VariablePlaceholder.test.d.ts → MediaPlaceholder.variables.test.d.ts} +0 -0
@@ -1,141 +1,113 @@
1
- const o = "输入'/'快速插入内容", e = "请输入你的内容", t = "请输入你的内容,输入 / 唤起更多", Z = "设置", _ = "关闭", l = "添加图片", a = "添加视频", i = "请输入图片地址", $ = "URL", oo = "预览", n = "请输入图片标题", s = "使用图片", c = "图片名称", eo = "上传", r = "拖拽文件或点击上传", d = "正在上传...", b = "上传完成", u = "上传失败,请重试", g = "添加固定文本", v = "固定文本", to = "分割线", h = "图片标题", m = "缩放比例", lo = "取消", T = "请输入图片地址", p = "请输入有效的图片地址", U = "请输入 B 站或 YouTube 视频链接", ao = "URL", io = "预览", I = "使用资源", C = "请输入视频标题", no = "标题", B = "视频标题", L = "哔哩哔哩视频", P = "YouTube 视频", V = "请输入有效的 B 站或 YouTube 视频链接", so = "取消", x = "使用视频", f = "预览将在这里显示", R = "视频预览", co = "图片", ro = "视频", bo = "变量", S = "固定文本", D = "选择变量", E = "搜索变量", N = "未找到变量", O = "暂无变量", w = "变量名称", Y = "变量已存在", y = "名称不能为空,且不能包含控制字符、换行或连续两个右花括号", k = "系统变量", q = "自定义变量", A = "添加变量", F = "插入新变量", z = "插入已有变量", M = "插入确定内容", Q = "插入链接", j = "插入按钮", G = "插入单选", uo = "选项1", go = "选项2", H = "插入多选", J = "插入输入框", vo = "请输入", K = "插入图片", W = "插入视频", X = "你的问题", ho = {
1
+ const o = "输入'/'快速插入内容", e = "请输入你的内容", t = "请输入你的内容,输入 / 唤起更多", F = "设置", M = "关闭", l = "添加图片", i = "添加视频", n = "请输入图片地址", N = "URL", Q = "预览", a = "请输入图片标题", s = "使用图片", c = "图片名称", j = "上传", d = "拖拽文件或点击上传", r = "正在上传...", u = "上传完成", g = "上传失败,请重试", b = "添加固定文本", h = "固定文本", y = "分割线", m = "图片标题", v = "缩放比例", A = "取消", T = "请输入图片地址", U = "请输入有效的图片地址", p = "请输入 B 站或 YouTube 视频链接", G = "URL", H = "预览", I = "使用资源", B = "请输入视频标题", J = "标题", C = "视频标题", L = "哔哩哔哩视频", P = "YouTube 视频", f = "请输入有效的 B 站或 YouTube 视频链接", K = "取消", x = "使用视频", R = "预览将在这里显示", D = "视频预览", W = "图片", X = "视频", O = "固定文本", V = "插入确定内容", Y = "插入链接", E = "插入按钮", S = "插入单选", Z = "选项1", _ = "选项2", k = "插入多选", w = "插入输入框", $ = "请输入", q = "插入图片", z = "插入视频", oo = {
2
2
  placeholder: o,
3
3
  placeholderCodeEdit: e,
4
4
  placeholderQuickEdit: t,
5
5
  dialogTitle: "设置",
6
6
  dialogCloseLabel: "关闭",
7
7
  dialogTitleImage: l,
8
- dialogTitleVideo: a,
9
- imageUrlPlaceholder: i,
8
+ dialogTitleVideo: i,
9
+ imageUrlPlaceholder: n,
10
10
  imageUrlLabel: "URL",
11
11
  imageRunButton: "预览",
12
- imageTitlePlaceholder: n,
12
+ imageTitlePlaceholder: a,
13
13
  imageUseButton: s,
14
14
  imageDefaultTitle: c,
15
15
  imageUploadLabel: "上传",
16
- imageUploadPlaceholder: r,
17
- imageUploading: d,
18
- imageUploadSuccess: b,
19
- imageUploadError: u,
20
- fixedTextPlaceholder: g,
21
- fixedTextTooltip: v,
16
+ imageUploadPlaceholder: d,
17
+ imageUploading: r,
18
+ imageUploadSuccess: u,
19
+ imageUploadError: g,
20
+ fixedTextPlaceholder: b,
21
+ fixedTextTooltip: h,
22
22
  slashDivider: "分割线",
23
- imageTitleLabel: h,
24
- imageScaleLabel: m,
23
+ imageTitleLabel: m,
24
+ imageScaleLabel: v,
25
25
  imageCancelButton: "取消",
26
26
  imageUrlRequired: T,
27
- imageInvalidUrl: p,
28
- videoUrlPlaceholder: U,
27
+ imageInvalidUrl: U,
28
+ videoUrlPlaceholder: p,
29
29
  videoUrlLabel: "URL",
30
30
  videoRunButton: "预览",
31
31
  videoUseButton: I,
32
- videoTitlePlaceholder: C,
32
+ videoTitlePlaceholder: B,
33
33
  videoTitleLabel: "标题",
34
- videoDefaultTitle: B,
34
+ videoDefaultTitle: C,
35
35
  videoDefaultTitleBilibili: L,
36
36
  videoDefaultTitleYoutube: P,
37
- videoInvalidUrl: V,
37
+ videoInvalidUrl: f,
38
38
  videoCancelButton: "取消",
39
39
  videoUseVideoButton: x,
40
- videoPreviewPlaceholder: f,
41
- videoPreviewTitle: R,
40
+ videoPreviewPlaceholder: R,
41
+ videoPreviewTitle: D,
42
42
  slashImage: "图片",
43
43
  slashVideo: "视频",
44
- slashVariable: "变量",
45
- slashFixedText: S,
46
- dialogTitleVariable: D,
47
- variableSearchPlaceholder: E,
48
- variableNotFound: N,
49
- variableEmpty: O,
50
- variableNamePlaceholder: w,
51
- variableAlreadyExists: Y,
52
- variableNameInvalid: y,
53
- variableSectionSystem: k,
54
- variableSectionCustom: q,
55
- variableAddNew: A,
56
- toolbarInsertNewVariable: F,
57
- toolbarInsertExistingVariable: z,
58
- toolbarConfirmOutput: M,
59
- toolbarInsertLink: Q,
60
- toolbarInsertButton: j,
61
- toolbarInsertSingleChoice: G,
44
+ slashFixedText: O,
45
+ toolbarConfirmOutput: V,
46
+ toolbarInsertLink: Y,
47
+ toolbarInsertButton: E,
48
+ toolbarInsertSingleChoice: S,
62
49
  toolbarChoiceOption1: "选项1",
63
50
  toolbarChoiceOption2: "选项2",
64
- toolbarInsertMultiChoice: H,
65
- toolbarInsertInput: J,
51
+ toolbarInsertMultiChoice: k,
52
+ toolbarInsertInput: w,
66
53
  toolbarInputPlaceholder: "请输入",
67
- toolbarInsertImage: K,
68
- toolbarInsertVideo: W,
69
- questionPlaceholder: X
54
+ toolbarInsertImage: q,
55
+ toolbarInsertVideo: z
70
56
  };
71
57
  export {
72
- ho as default,
73
- _ as dialogCloseLabel,
74
- Z as dialogTitle,
58
+ oo as default,
59
+ M as dialogCloseLabel,
60
+ F as dialogTitle,
75
61
  l as dialogTitleImage,
76
- D as dialogTitleVariable,
77
- a as dialogTitleVideo,
78
- g as fixedTextPlaceholder,
79
- v as fixedTextTooltip,
80
- lo as imageCancelButton,
62
+ i as dialogTitleVideo,
63
+ b as fixedTextPlaceholder,
64
+ h as fixedTextTooltip,
65
+ A as imageCancelButton,
81
66
  c as imageDefaultTitle,
82
- p as imageInvalidUrl,
83
- oo as imageRunButton,
84
- m as imageScaleLabel,
85
- h as imageTitleLabel,
86
- n as imageTitlePlaceholder,
87
- u as imageUploadError,
88
- eo as imageUploadLabel,
89
- r as imageUploadPlaceholder,
90
- b as imageUploadSuccess,
91
- d as imageUploading,
92
- $ as imageUrlLabel,
93
- i as imageUrlPlaceholder,
67
+ U as imageInvalidUrl,
68
+ Q as imageRunButton,
69
+ v as imageScaleLabel,
70
+ m as imageTitleLabel,
71
+ a as imageTitlePlaceholder,
72
+ g as imageUploadError,
73
+ j as imageUploadLabel,
74
+ d as imageUploadPlaceholder,
75
+ u as imageUploadSuccess,
76
+ r as imageUploading,
77
+ N as imageUrlLabel,
78
+ n as imageUrlPlaceholder,
94
79
  T as imageUrlRequired,
95
80
  s as imageUseButton,
96
81
  o as placeholder,
97
82
  e as placeholderCodeEdit,
98
83
  t as placeholderQuickEdit,
99
- X as questionPlaceholder,
100
- to as slashDivider,
101
- S as slashFixedText,
102
- co as slashImage,
103
- bo as slashVariable,
104
- ro as slashVideo,
105
- uo as toolbarChoiceOption1,
106
- go as toolbarChoiceOption2,
107
- M as toolbarConfirmOutput,
108
- vo as toolbarInputPlaceholder,
109
- j as toolbarInsertButton,
110
- z as toolbarInsertExistingVariable,
111
- K as toolbarInsertImage,
112
- J as toolbarInsertInput,
113
- Q as toolbarInsertLink,
114
- H as toolbarInsertMultiChoice,
115
- F as toolbarInsertNewVariable,
116
- G as toolbarInsertSingleChoice,
117
- W as toolbarInsertVideo,
118
- A as variableAddNew,
119
- Y as variableAlreadyExists,
120
- O as variableEmpty,
121
- y as variableNameInvalid,
122
- w as variableNamePlaceholder,
123
- N as variableNotFound,
124
- E as variableSearchPlaceholder,
125
- q as variableSectionCustom,
126
- k as variableSectionSystem,
127
- so as videoCancelButton,
128
- B as videoDefaultTitle,
84
+ y as slashDivider,
85
+ O as slashFixedText,
86
+ W as slashImage,
87
+ X as slashVideo,
88
+ Z as toolbarChoiceOption1,
89
+ _ as toolbarChoiceOption2,
90
+ V as toolbarConfirmOutput,
91
+ $ as toolbarInputPlaceholder,
92
+ E as toolbarInsertButton,
93
+ q as toolbarInsertImage,
94
+ w as toolbarInsertInput,
95
+ Y as toolbarInsertLink,
96
+ k as toolbarInsertMultiChoice,
97
+ S as toolbarInsertSingleChoice,
98
+ z as toolbarInsertVideo,
99
+ K as videoCancelButton,
100
+ C as videoDefaultTitle,
129
101
  L as videoDefaultTitleBilibili,
130
102
  P as videoDefaultTitleYoutube,
131
- V as videoInvalidUrl,
132
- f as videoPreviewPlaceholder,
133
- R as videoPreviewTitle,
134
- io as videoRunButton,
135
- no as videoTitleLabel,
136
- C as videoTitlePlaceholder,
137
- ao as videoUrlLabel,
138
- U as videoUrlPlaceholder,
103
+ f as videoInvalidUrl,
104
+ R as videoPreviewPlaceholder,
105
+ D as videoPreviewTitle,
106
+ H as videoRunButton,
107
+ J as videoTitleLabel,
108
+ B as videoTitlePlaceholder,
109
+ G as videoUrlLabel,
110
+ p as videoUrlPlaceholder,
139
111
  I as videoUseButton,
140
112
  x as videoUseVideoButton
141
113
  };
@@ -1 +1 @@
1
- {"version":3,"file":"zh-CN.json.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"zh-CN.json.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("../../../node_modules/@codemirror/view/dist/index.cjs"),f=require("../types.cjs"),x=require("../utils.cjs"),b=require("./PlaceholderWidget.cjs"),s=require("./mediaPlaceholderLabels.cjs"),P=/!\[([^\]]*)\]\(([^)]+)\)|<img\b[^>]*>/i,w=/===\s*(?:!\[[^\]]*\]\([^)]+\)|<img\b[^>]*>)\s*===|!\[[^\]]*\]\([^)]+\)|<img\b[^>]*>/gi,o=(e,r)=>{const t=new RegExp(`${r}\\s*=\\s*("(.*?)"|'(.*?)'|([^\\s"'<>]+))`,"i"),c=e.match(t);if(c)return c[2]??c[3]??c[4]},M=e=>Math.max(1,Math.min(1e3,Math.round(e))),D=e=>{const r=e?.[0]??"",t=x.unwrapFixedOutput(r),c=/^\s*===/.test(r);if(/^<img\b/i.test(t)){const p=o(t,"src")??"",u=o(t,"alt")??o(t,"title")??"",d=o(t,"width");let g;if(d){const m=Number.parseFloat(d);Number.isFinite(m)&&(g=M(m))}return{text:u,url:p,title:u,scalePercent:g,fixedOutput:c}}const l=t.match(P),n=l?.[1]??"",h=l?.[2]??"";return{text:n,url:h,title:n,scalePercent:void 0,fixedOutput:c}},i=new a.MatchDecorator({regexp:w,decoration:(e,r)=>{const t=D(e);return a.Decoration.replace({widget:new b.default(t.text||r.state.facet(s.mediaPlaceholderLabels).image,{tag:"image",url:t.url,title:t.title,scalePercent:t.scalePercent,fixedOutput:t.fixedOutput},"tag-image",f.SelectedOption.Image,r)})}}),O=a.ViewPlugin.fromClass(class{constructor(e){this.placeholders=i.createDeco(e)}update(e){if(e.startState.facet(s.mediaPlaceholderLabels)!==e.state.facet(s.mediaPlaceholderLabels)){this.placeholders=i.createDeco(e.view);return}this.placeholders=i.updateDeco(e,this.placeholders)}},{decorations:e=>e.placeholders,provide:e=>a.EditorView.atomicRanges.of(r=>r.plugin(e)?.placeholders||a.Decoration.none)});exports.default=O;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../../../node_modules/@codemirror/view/dist/index.cjs"),f=require("../types.cjs"),x=require("../utils.cjs"),b=require("./PlaceholderWidget.cjs"),u=require("./mediaPlaceholderLabels.cjs"),P=require("../../../_virtual/index.cjs"),w=/!\[([^\]]*)\]\(([^)]+)\)|<img\b[^>]*>/i,M=/===\s*(?:!\[[^\]]*\]\([^)]+\)|<img\b[^>]*>)\s*===|!\[[^\]]*\]\([^)]+\)|<img\b[^>]*>/gi,l=(e,c)=>{const t=new RegExp(`${c}\\s*=\\s*("(.*?)"|'(.*?)'|([^\\s"'<>]+))`,"i"),r=e.match(t);if(r)return r[2]??r[3]??r[4]},D=e=>Math.max(1,Math.min(1e3,Math.round(e))),q=e=>{const c=e?.[0]??"",t=x.unwrapFixedOutput(c),r=/^\s*===/.test(c);if(/^<img\b/i.test(t)){const n=l(t,"src")??"",d=l(t,"alt")??l(t,"title")??"",h=l(t,"width");let m;if(h){const g=Number.parseFloat(h);Number.isFinite(g)&&(m=D(g))}return{text:d,url:n,title:d,scalePercent:m,fixedOutput:r}}const s=t.match(w),o=s?.[1]??"",a=s?.[2]??"";return{text:o,url:a,title:o,scalePercent:void 0,fixedOutput:r}},p=e=>{const c=P.distExports.findDocumentVariableMarkers(e.state.doc.toString()).filter(t=>t.name!==null);return new i.MatchDecorator({regexp:M,decoration:(t,r,s)=>{const o=s+t[0].length;if(c.some(n=>s<n.end&&o>n.start))return null;const a=q(t);return i.Decoration.replace({widget:new b.default(a.text||r.state.facet(u.mediaPlaceholderLabels).image,{tag:"image",url:a.url,title:a.title,scalePercent:a.scalePercent,fixedOutput:a.fixedOutput},"tag-image",f.SelectedOption.Image,r)})}})},v=i.ViewPlugin.fromClass(class{constructor(e){this.matcher=p(e),this.placeholders=this.matcher.createDeco(e)}update(e){if(e.docChanged&&(this.matcher=p(e.view)),e.docChanged||e.startState.facet(u.mediaPlaceholderLabels)!==e.state.facet(u.mediaPlaceholderLabels)){this.placeholders=this.matcher.createDeco(e.view);return}this.placeholders=this.matcher.updateDeco(e,this.placeholders)}},{decorations:e=>e.placeholders,provide:e=>i.EditorView.atomicRanges.of(c=>c.plugin(e)?.placeholders||i.Decoration.none)});exports.default=v;
2
2
  //# sourceMappingURL=ImgPlaceholder.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ImgPlaceholder.cjs","sources":["../../../../src/components/MarkdownFlowEditor/plugins/ImgPlaceholder.ts"],"sourcesContent":["import {\n EditorView,\n Decoration,\n DecorationSet,\n ViewPlugin,\n ViewUpdate,\n MatchDecorator,\n} from \"@codemirror/view\";\nimport { SelectedOption } from \"../types\";\nimport { unwrapFixedOutput } from \"../utils\";\nimport PlaceholderWidget from \"./PlaceholderWidget\";\nimport { mediaPlaceholderLabels } from \"./mediaPlaceholderLabels\";\n\nconst imageMarkupRegexp = /!\\[([^\\]]*)\\]\\(([^)]+)\\)|<img\\b[^>]*>/i;\nconst agiImgContextRegexp =\n /===\\s*(?:!\\[[^\\]]*\\]\\([^)]+\\)|<img\\b[^>]*>)\\s*===|!\\[[^\\]]*\\]\\([^)]+\\)|<img\\b[^>]*>/gi;\n\nconst extractAttributeValue = (tag: string, attribute: string) => {\n const regexp = new RegExp(\n `${attribute}\\\\s*=\\\\s*(\"(.*?)\"|'(.*?)'|([^\\\\s\"'<>]+))`,\n \"i\"\n );\n const match = tag.match(regexp);\n if (!match) return undefined;\n return match[2] ?? match[3] ?? match[4];\n};\n\nconst clampScalePercent = (value: number) =>\n Math.max(1, Math.min(1000, Math.round(value)));\n\nconst getImageMatchInfo = (match: RegExpMatchArray) => {\n const source = match?.[0] ?? \"\";\n const raw = unwrapFixedOutput(source);\n const fixedOutput = /^\\s*===/.test(source);\n if (/^<img\\b/i.test(raw)) {\n const src = extractAttributeValue(raw, \"src\") ?? \"\";\n const alt =\n extractAttributeValue(raw, \"alt\") ??\n extractAttributeValue(raw, \"title\") ??\n \"\";\n const widthAttr = extractAttributeValue(raw, \"width\");\n let scalePercent: number | undefined;\n if (widthAttr) {\n const numeric = Number.parseFloat(widthAttr);\n if (Number.isFinite(numeric)) {\n scalePercent = clampScalePercent(numeric);\n }\n }\n return {\n text: alt,\n url: src,\n title: alt,\n scalePercent,\n fixedOutput,\n };\n }\n const markdownMatch = raw.match(imageMarkupRegexp);\n const title = markdownMatch?.[1] ?? \"\";\n const url = markdownMatch?.[2] ?? \"\";\n return {\n text: title,\n url,\n title,\n scalePercent: undefined,\n fixedOutput,\n };\n};\n\nconst imageUrlMatcher = new MatchDecorator({\n regexp: agiImgContextRegexp,\n decoration: (match, view) => {\n const info = getImageMatchInfo(match);\n return Decoration.replace({\n widget: new PlaceholderWidget(\n info.text || view.state.facet(mediaPlaceholderLabels).image,\n {\n tag: \"image\",\n url: info.url,\n title: info.title,\n scalePercent: info.scalePercent,\n fixedOutput: info.fixedOutput,\n },\n \"tag-image\",\n SelectedOption.Image,\n view\n ),\n });\n },\n});\n\nconst ImgPlaceholder = ViewPlugin.fromClass(\n class {\n placeholders: DecorationSet;\n constructor(view: EditorView) {\n this.placeholders = imageUrlMatcher.createDeco(view);\n }\n update(update: ViewUpdate) {\n if (\n update.startState.facet(mediaPlaceholderLabels) !==\n update.state.facet(mediaPlaceholderLabels)\n ) {\n this.placeholders = imageUrlMatcher.createDeco(update.view);\n return;\n }\n this.placeholders = imageUrlMatcher.updateDeco(update, this.placeholders);\n }\n },\n {\n decorations: (instance) => instance.placeholders,\n provide: (plugin) =>\n EditorView.atomicRanges.of((view) => {\n return view.plugin(plugin)?.placeholders || Decoration.none;\n }),\n }\n);\n\nexport default ImgPlaceholder;\n"],"names":["imageMarkupRegexp","agiImgContextRegexp","extractAttributeValue","tag","attribute","regexp","match","clampScalePercent","value","getImageMatchInfo","source","raw","unwrapFixedOutput","fixedOutput","src","alt","widthAttr","scalePercent","numeric","markdownMatch","title","url","imageUrlMatcher","MatchDecorator","view","info","Decoration","PlaceholderWidget","mediaPlaceholderLabels","SelectedOption","ImgPlaceholder","ViewPlugin","update","instance","plugin","EditorView"],"mappings":"wTAaMA,EAAoB,yCACpBC,EACJ,wFAEIC,EAAwB,CAACC,EAAaC,IAAsB,CAChE,MAAMC,EAAS,IAAI,OACjB,GAAGD,CAAS,2CACZ,GAAA,EAEIE,EAAQH,EAAI,MAAME,CAAM,EAC9B,GAAKC,EACL,OAAOA,EAAM,CAAC,GAAKA,EAAM,CAAC,GAAKA,EAAM,CAAC,CACxC,EAEMC,EAAqBC,GACzB,KAAK,IAAI,EAAG,KAAK,IAAI,IAAM,KAAK,MAAMA,CAAK,CAAC,CAAC,EAEzCC,EAAqBH,GAA4B,CACrD,MAAMI,EAASJ,IAAQ,CAAC,GAAK,GACvBK,EAAMC,EAAAA,kBAAkBF,CAAM,EAC9BG,EAAc,UAAU,KAAKH,CAAM,EACzC,GAAI,WAAW,KAAKC,CAAG,EAAG,CACxB,MAAMG,EAAMZ,EAAsBS,EAAK,KAAK,GAAK,GAC3CI,EACJb,EAAsBS,EAAK,KAAK,GAChCT,EAAsBS,EAAK,OAAO,GAClC,GACIK,EAAYd,EAAsBS,EAAK,OAAO,EACpD,IAAIM,EACJ,GAAID,EAAW,CACb,MAAME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AgBR,EAAAA,WAAW,IACxD,CAAA,CAEP"}
1
+ {"version":3,"file":"ImgPlaceholder.cjs","sources":["../../../../src/components/MarkdownFlowEditor/plugins/ImgPlaceholder.ts"],"sourcesContent":["import {\n EditorView,\n Decoration,\n DecorationSet,\n ViewPlugin,\n ViewUpdate,\n MatchDecorator,\n} from \"@codemirror/view\";\nimport { SelectedOption } from \"../types\";\nimport { findDocumentVariableMarkers, unwrapFixedOutput } from \"../utils\";\nimport PlaceholderWidget from \"./PlaceholderWidget\";\nimport { mediaPlaceholderLabels } from \"./mediaPlaceholderLabels\";\n\nconst imageMarkupRegexp = /!\\[([^\\]]*)\\]\\(([^)]+)\\)|<img\\b[^>]*>/i;\nconst agiImgContextRegexp =\n /===\\s*(?:!\\[[^\\]]*\\]\\([^)]+\\)|<img\\b[^>]*>)\\s*===|!\\[[^\\]]*\\]\\([^)]+\\)|<img\\b[^>]*>/gi;\n\nconst extractAttributeValue = (tag: string, attribute: string) => {\n const regexp = new RegExp(\n `${attribute}\\\\s*=\\\\s*(\"(.*?)\"|'(.*?)'|([^\\\\s\"'<>]+))`,\n \"i\"\n );\n const match = tag.match(regexp);\n if (!match) return undefined;\n return match[2] ?? match[3] ?? match[4];\n};\n\nconst clampScalePercent = (value: number) =>\n Math.max(1, Math.min(1000, Math.round(value)));\n\nconst getImageMatchInfo = (match: RegExpMatchArray) => {\n const source = match?.[0] ?? \"\";\n const raw = unwrapFixedOutput(source);\n const fixedOutput = /^\\s*===/.test(source);\n if (/^<img\\b/i.test(raw)) {\n const src = extractAttributeValue(raw, \"src\") ?? \"\";\n const alt =\n extractAttributeValue(raw, \"alt\") ??\n extractAttributeValue(raw, \"title\") ??\n \"\";\n const widthAttr = extractAttributeValue(raw, \"width\");\n let scalePercent: number | undefined;\n if (widthAttr) {\n const numeric = Number.parseFloat(widthAttr);\n if (Number.isFinite(numeric)) {\n scalePercent = clampScalePercent(numeric);\n }\n }\n return {\n text: alt,\n url: src,\n title: alt,\n scalePercent,\n fixedOutput,\n };\n }\n const markdownMatch = raw.match(imageMarkupRegexp);\n const title = markdownMatch?.[1] ?? \"\";\n const url = markdownMatch?.[2] ?? \"\";\n return {\n text: title,\n url,\n title,\n scalePercent: undefined,\n fixedOutput,\n };\n};\n\nconst createImageUrlMatcher = (view: EditorView) => {\n const variables = findDocumentVariableMarkers(\n view.state.doc.toString()\n ).filter((marker) => marker.name !== null);\n return new MatchDecorator({\n regexp: agiImgContextRegexp,\n decoration: (match, view, from) => {\n const to = from + match[0].length;\n if (variables.some((marker) => from < marker.end && to > marker.start)) {\n return null;\n }\n const info = getImageMatchInfo(match);\n return Decoration.replace({\n widget: new PlaceholderWidget(\n info.text || view.state.facet(mediaPlaceholderLabels).image,\n {\n tag: \"image\",\n url: info.url,\n title: info.title,\n scalePercent: info.scalePercent,\n fixedOutput: info.fixedOutput,\n },\n \"tag-image\",\n SelectedOption.Image,\n view\n ),\n });\n },\n });\n};\n\nconst ImgPlaceholder = ViewPlugin.fromClass(\n class {\n placeholders: DecorationSet;\n matcher: MatchDecorator;\n constructor(view: EditorView) {\n this.matcher = createImageUrlMatcher(view);\n this.placeholders = this.matcher.createDeco(view);\n }\n update(update: ViewUpdate) {\n if (update.docChanged) {\n this.matcher = createImageUrlMatcher(update.view);\n }\n if (\n update.docChanged ||\n update.startState.facet(mediaPlaceholderLabels) !==\n update.state.facet(mediaPlaceholderLabels)\n ) {\n this.placeholders = this.matcher.createDeco(update.view);\n return;\n }\n this.placeholders = this.matcher.updateDeco(update, this.placeholders);\n }\n },\n {\n decorations: (instance) => instance.placeholders,\n provide: (plugin) =>\n EditorView.atomicRanges.of((view) => {\n return view.plugin(plugin)?.placeholders || Decoration.none;\n }),\n }\n);\n\nexport default ImgPlaceholder;\n"],"names":["imageMarkupRegexp","agiImgContextRegexp","extractAttributeValue","tag","attribute","regexp","match","clampScalePercent","value","getImageMatchInfo","source","raw","unwrapFixedOutput","fixedOutput","src","alt","widthAttr","scalePercent","numeric","markdownMatch","title","url","createImageUrlMatcher","view","variables","findDocumentVariableMarkers","marker","MatchDecorator","from","to","info","Decoration","PlaceholderWidget","mediaPlaceholderLabels","SelectedOption","ImgPlaceholder","ViewPlugin","update","instance","plugin","EditorView"],"mappings":"iWAaMA,EAAoB,yCACpBC,EACJ,wFAEIC,EAAwB,CAACC,EAAaC,IAAsB,CAChE,MAAMC,EAAS,IAAI,OACjB,GAAGD,CAAS,2CACZ,GAAA,EAEIE,EAAQH,EAAI,MAAME,CAAM,EAC9B,GAAKC,EACL,OAAOA,EAAM,CAAC,GAAKA,EAAM,CAAC,GAAKA,EAAM,CAAC,CACxC,EAEMC,EAAqBC,GACzB,KAAK,IAAI,EAAG,KAAK,IAAI,IAAM,KAAK,MAAMA,CAAK,CAAC,CAAC,EAEzCC,EAAqBH,GAA4B,CACrD,MAAMI,EAASJ,IAAQ,CAAC,GAAK,GACvBK,EAAMC,EAAAA,kBAAkBF,CAAM,EAC9BG,EAAc,UAAU,KAAKH,CAAM,EACzC,GAAI,WAAW,KAAKC,CAAG,EAAG,CACxB,MAAMG,EAAMZ,EAAsBS,EAAK,KAAK,GAAK,GAC3CI,EACJb,EAAsBS,EAAK,KAAK,GAChCT,EAAsBS,EAAK,OAAO,GAClC,GACIK,EAAYd,EAAsBS,EAAK,OAAO,EACpD,IAAIM,EACJ,GAAID,EAAW,CACb,MAAME,EAAU,OAAO,WAAWF,CAAS,EACvC,OAAO,SAASE,CAAO,IACzBD,EAAeV,EAAkBW,CAAO,EAE5C,CACA,MAAO,CACL,KAAMH,EACN,IAAKD,EACL,MAAOC,EACP,aAAAE,EACA,YAAAJ,CAAA,CAEJ,CACA,MAAMM,EAAgBR,EAAI,MAAMX,CAAiB,EAC3CoB,EAAQD,IAAgB,CAAC,GAAK,GAC9BE,EAAMF,IAAgB,CAAC,GAAK,GAClC,MAAO,CACL,KAAMC,EACN,IAAAC,EACA,MAAAD,EACA,aAAc,OACd,YAAAP,CAAA,CAEJ,EAEMS,EAAyBC,GAAqB,CAClD,M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WAAW,IACxD,CAAA,CAEP"}
@@ -1,6 +1,7 @@
1
- import { DecorationSet, ViewPlugin, ViewUpdate } from '@codemirror/view';
1
+ import { DecorationSet, ViewPlugin, ViewUpdate, MatchDecorator } from '@codemirror/view';
2
2
  declare const ImgPlaceholder: ViewPlugin<{
3
3
  placeholders: DecorationSet;
4
+ matcher: MatchDecorator;
4
5
  update(update: ViewUpdate): void;
5
6
  }, undefined>;
6
7
  export default ImgPlaceholder;
@@ -1,76 +1,85 @@
1
- import { MatchDecorator as f, Decoration as p, ViewPlugin as x, EditorView as w } from "../../../node_modules/@codemirror/view/dist/index.es.js";
2
- import { SelectedOption as P } from "../types.es.js";
3
- import { unwrapFixedOutput as b } from "../utils.es.js";
4
- import M from "./PlaceholderWidget.es.js";
5
- import { mediaPlaceholderLabels as i } from "./mediaPlaceholderLabels.es.js";
6
- const D = /!\[([^\]]*)\]\(([^)]+)\)|<img\b[^>]*>/i, I = /===\s*(?:!\[[^\]]*\]\([^)]+\)|<img\b[^>]*>)\s*===|!\[[^\]]*\]\([^)]+\)|<img\b[^>]*>/gi, o = (t, r) => {
1
+ import { ViewPlugin as f, EditorView as x, Decoration as p, MatchDecorator as w } from "../../../node_modules/@codemirror/view/dist/index.es.js";
2
+ import { SelectedOption as b } from "../types.es.js";
3
+ import { unwrapFixedOutput as M } from "../utils.es.js";
4
+ import P from "./PlaceholderWidget.es.js";
5
+ import { mediaPlaceholderLabels as l } from "./mediaPlaceholderLabels.es.js";
6
+ import { d as D } from "../../../_virtual/index.es.js";
7
+ const I = /!\[([^\]]*)\]\(([^)]+)\)|<img\b[^>]*>/i, O = /===\s*(?:!\[[^\]]*\]\([^)]+\)|<img\b[^>]*>)\s*===|!\[[^\]]*\]\([^)]+\)|<img\b[^>]*>/gi, n = (t, c) => {
7
8
  const e = new RegExp(
8
- `${r}\\s*=\\s*("(.*?)"|'(.*?)'|([^\\s"'<>]+))`,
9
+ `${c}\\s*=\\s*("(.*?)"|'(.*?)'|([^\\s"'<>]+))`,
9
10
  "i"
10
- ), c = t.match(e);
11
- if (c)
12
- return c[2] ?? c[3] ?? c[4];
13
- }, O = (t) => Math.max(1, Math.min(1e3, Math.round(t))), R = (t) => {
14
- const r = t?.[0] ?? "", e = b(r), c = /^\s*===/.test(r);
11
+ ), r = t.match(e);
12
+ if (r)
13
+ return r[2] ?? r[3] ?? r[4];
14
+ }, v = (t) => Math.max(1, Math.min(1e3, Math.round(t))), C = (t) => {
15
+ const c = t?.[0] ?? "", e = M(c), r = /^\s*===/.test(c);
15
16
  if (/^<img\b/i.test(e)) {
16
- const h = o(e, "src") ?? "", l = o(e, "alt") ?? o(e, "title") ?? "", m = o(e, "width");
17
- let u;
18
- if (m) {
19
- const g = Number.parseFloat(m);
20
- Number.isFinite(g) && (u = O(g));
17
+ const s = n(e, "src") ?? "", m = n(e, "alt") ?? n(e, "title") ?? "", h = n(e, "width");
18
+ let d;
19
+ if (h) {
20
+ const u = Number.parseFloat(h);
21
+ Number.isFinite(u) && (d = v(u));
21
22
  }
22
23
  return {
23
- text: l,
24
- url: h,
25
- title: l,
26
- scalePercent: u,
27
- fixedOutput: c
24
+ text: m,
25
+ url: s,
26
+ title: m,
27
+ scalePercent: d,
28
+ fixedOutput: r
28
29
  };
29
30
  }
30
- const s = e.match(D), n = s?.[1] ?? "", d = s?.[2] ?? "";
31
+ const a = e.match(I), i = a?.[1] ?? "", o = a?.[2] ?? "";
31
32
  return {
32
- text: n,
33
- url: d,
34
- title: n,
33
+ text: i,
34
+ url: o,
35
+ title: i,
35
36
  scalePercent: void 0,
36
- fixedOutput: c
37
+ fixedOutput: r
37
38
  };
38
- }, a = new f({
39
- regexp: I,
40
- decoration: (t, r) => {
41
- const e = R(t);
42
- return p.replace({
43
- widget: new M(
44
- e.text || r.state.facet(i).image,
45
- {
46
- tag: "image",
47
- url: e.url,
48
- title: e.title,
49
- scalePercent: e.scalePercent,
50
- fixedOutput: e.fixedOutput
51
- },
52
- "tag-image",
53
- P.Image,
54
- r
55
- )
56
- });
57
- }
58
- }), A = x.fromClass(
39
+ }, g = (t) => {
40
+ const c = D.findDocumentVariableMarkers(
41
+ t.state.doc.toString()
42
+ ).filter((e) => e.name !== null);
43
+ return new w({
44
+ regexp: O,
45
+ decoration: (e, r, a) => {
46
+ const i = a + e[0].length;
47
+ if (c.some((s) => a < s.end && i > s.start))
48
+ return null;
49
+ const o = C(e);
50
+ return p.replace({
51
+ widget: new P(
52
+ o.text || r.state.facet(l).image,
53
+ {
54
+ tag: "image",
55
+ url: o.url,
56
+ title: o.title,
57
+ scalePercent: o.scalePercent,
58
+ fixedOutput: o.fixedOutput
59
+ },
60
+ "tag-image",
61
+ b.Image,
62
+ r
63
+ )
64
+ });
65
+ }
66
+ });
67
+ }, A = f.fromClass(
59
68
  class {
60
69
  constructor(t) {
61
- this.placeholders = a.createDeco(t);
70
+ this.matcher = g(t), this.placeholders = this.matcher.createDeco(t);
62
71
  }
63
72
  update(t) {
64
- if (t.startState.facet(i) !== t.state.facet(i)) {
65
- this.placeholders = a.createDeco(t.view);
73
+ if (t.docChanged && (this.matcher = g(t.view)), t.docChanged || t.startState.facet(l) !== t.state.facet(l)) {
74
+ this.placeholders = this.matcher.createDeco(t.view);
66
75
  return;
67
76
  }
68
- this.placeholders = a.updateDeco(t, this.placeholders);
77
+ this.placeholders = this.matcher.updateDeco(t, this.placeholders);
69
78
  }
70
79
  },
71
80
  {
72
81
  decorations: (t) => t.placeholders,
73
- provide: (t) => w.atomicRanges.of((r) => r.plugin(t)?.placeholders || p.none)
82
+ provide: (t) => x.atomicRanges.of((c) => c.plugin(t)?.placeholders || p.none)
74
83
  }
75
84
  );
76
85
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"ImgPlaceholder.es.js","sources":["../../../../src/components/MarkdownFlowEditor/plugins/ImgPlaceholder.ts"],"sourcesContent":["import {\n EditorView,\n Decoration,\n DecorationSet,\n ViewPlugin,\n ViewUpdate,\n MatchDecorator,\n} from \"@codemirror/view\";\nimport { SelectedOption } from \"../types\";\nimport { unwrapFixedOutput } from \"../utils\";\nimport PlaceholderWidget from \"./PlaceholderWidget\";\nimport { mediaPlaceholderLabels } from \"./mediaPlaceholderLabels\";\n\nconst imageMarkupRegexp = /!\\[([^\\]]*)\\]\\(([^)]+)\\)|<img\\b[^>]*>/i;\nconst agiImgContextRegexp =\n /===\\s*(?:!\\[[^\\]]*\\]\\([^)]+\\)|<img\\b[^>]*>)\\s*===|!\\[[^\\]]*\\]\\([^)]+\\)|<img\\b[^>]*>/gi;\n\nconst extractAttributeValue = (tag: string, attribute: string) => {\n const regexp = new RegExp(\n `${attribute}\\\\s*=\\\\s*(\"(.*?)\"|'(.*?)'|([^\\\\s\"'<>]+))`,\n \"i\"\n );\n const match = tag.match(regexp);\n if (!match) return undefined;\n return match[2] ?? match[3] ?? match[4];\n};\n\nconst clampScalePercent = (value: number) =>\n Math.max(1, Math.min(1000, Math.round(value)));\n\nconst getImageMatchInfo = (match: RegExpMatchArray) => {\n const source = match?.[0] ?? \"\";\n const raw = unwrapFixedOutput(source);\n const fixedOutput = /^\\s*===/.test(source);\n if (/^<img\\b/i.test(raw)) {\n const src = extractAttributeValue(raw, \"src\") ?? \"\";\n const alt =\n extractAttributeValue(raw, \"alt\") ??\n extractAttributeValue(raw, \"title\") ??\n \"\";\n const widthAttr = extractAttributeValue(raw, \"width\");\n let scalePercent: number | undefined;\n if (widthAttr) {\n const numeric = Number.parseFloat(widthAttr);\n if (Number.isFinite(numeric)) {\n scalePercent = clampScalePercent(numeric);\n }\n }\n return {\n text: alt,\n url: src,\n title: alt,\n scalePercent,\n fixedOutput,\n };\n }\n const markdownMatch = raw.match(imageMarkupRegexp);\n const title = markdownMatch?.[1] ?? \"\";\n const url = markdownMatch?.[2] ?? \"\";\n return {\n text: title,\n url,\n title,\n scalePercent: undefined,\n fixedOutput,\n };\n};\n\nconst imageUrlMatcher = new MatchDecorator({\n regexp: agiImgContextRegexp,\n decoration: (match, view) => {\n const info = getImageMatchInfo(match);\n return Decoration.replace({\n widget: new PlaceholderWidget(\n info.text || view.state.facet(mediaPlaceholderLabels).image,\n {\n tag: \"image\",\n url: info.url,\n title: info.title,\n scalePercent: info.scalePercent,\n fixedOutput: info.fixedOutput,\n },\n \"tag-image\",\n SelectedOption.Image,\n view\n ),\n });\n },\n});\n\nconst ImgPlaceholder = ViewPlugin.fromClass(\n class {\n placeholders: DecorationSet;\n constructor(view: EditorView) {\n this.placeholders = imageUrlMatcher.createDeco(view);\n }\n update(update: ViewUpdate) {\n if (\n update.startState.facet(mediaPlaceholderLabels) !==\n update.state.facet(mediaPlaceholderLabels)\n ) {\n this.placeholders = imageUrlMatcher.createDeco(update.view);\n return;\n }\n this.placeholders = imageUrlMatcher.updateDeco(update, this.placeholders);\n }\n },\n {\n decorations: (instance) => instance.placeholders,\n provide: (plugin) =>\n EditorView.atomicRanges.of((view) => {\n return view.plugin(plugin)?.placeholders || Decoration.none;\n }),\n }\n);\n\nexport default ImgPlaceholder;\n"],"names":["imageMarkupRegexp","agiImgContextRegexp","extractAttributeValue","tag","attribute","regexp","match","clampScalePercent","value","getImageMatchInfo","source","raw","unwrapFixedOutput","fixedOutput","src","alt","widthAttr","scalePercent","numeric","markdownMatch","title","url","imageUrlMatcher","MatchDecorator","view","info","Decoration","PlaceholderWidget","mediaPlaceholderLabels","SelectedOption","ImgPlaceholder","ViewPlugin","update","instance","plugin","EditorView"],"mappings":";;;;;AAaA,MAAMA,IAAoB,0CACpBC,IACJ,yFAEIC,IAAwB,CAACC,GAAaC,MAAsB;AAChE,QAAMC,IAAS,IAAI;AAAA,IACjB,GAAGD,CAAS;AAAA,IACZ;AAAA,EAAA,GAEIE,IAAQH,EAAI,MAAME,CAAM;AAC9B,MAAKC;AACL,WAAOA,EAAM,CAAC,KAAKA,EAAM,CAAC,KAAKA,EAAM,CAAC;AACxC,GAEMC,IAAoB,CAACC,MACzB,KAAK,IAAI,GAAG,KAAK,IAAI,KAAM,KAAK,MAAMA,CAAK,CAAC,CAAC,GAE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;AAAA,MAAA;AAAA,IACF,CACD;AAAA,EACH;AACF,CAAC,GAEKM,IAAiBC,EAAW;AAAA,EAChC,MAAM;AAAA,IAEJ,YAAYP,GAAkB;AAC5B,WAAK,eAAeF,EAAgB,WAAWE,CAAI;AAAA,IACrD;AAAA,IACA,OAAOQ,GAAoB;AACzB,UACEA,EAAO,WAAW,MAAMJ,CAAsB,MAC9CI,EAAO,MAAM,MAAMJ,CAAsB,GACzC;AACA,aAAK,eAAeN,EAAgB,WAAWU,EAAO,IAAI;AAC1D;AAAA,MACF;AACA,WAAK,eAAeV,EAAgB,WAAWU,GAAQ,KAAK,YAAY;AAAA,IAC1E;AAAA,EAAA;AAAA,EAEF;AAAA,IACE,aAAa,CAACC,MAAaA,EAAS;AAAA,IACpC,SAAS,CAACC,MACRC,EAAW,aAAa,GAAG,CAACX,MACnBA,EAAK,OAAOU,CAAM,GAAG,gBAAgBR,EAAW,IACxD;AAAA,EAAA;AAEP;"}
1
+ {"version":3,"file":"ImgPlaceholder.es.js","sources":["../../../../src/components/MarkdownFlowEditor/plugins/ImgPlaceholder.ts"],"sourcesContent":["import {\n EditorView,\n Decoration,\n DecorationSet,\n ViewPlugin,\n ViewUpdate,\n MatchDecorator,\n} from \"@codemirror/view\";\nimport { SelectedOption } from \"../types\";\nimport { findDocumentVariableMarkers, unwrapFixedOutput } from \"../utils\";\nimport PlaceholderWidget from \"./PlaceholderWidget\";\nimport { mediaPlaceholderLabels } from \"./mediaPlaceholderLabels\";\n\nconst imageMarkupRegexp = /!\\[([^\\]]*)\\]\\(([^)]+)\\)|<img\\b[^>]*>/i;\nconst agiImgContextRegexp =\n /===\\s*(?:!\\[[^\\]]*\\]\\([^)]+\\)|<img\\b[^>]*>)\\s*===|!\\[[^\\]]*\\]\\([^)]+\\)|<img\\b[^>]*>/gi;\n\nconst extractAttributeValue = (tag: string, attribute: string) => {\n const regexp = new RegExp(\n `${attribute}\\\\s*=\\\\s*(\"(.*?)\"|'(.*?)'|([^\\\\s\"'<>]+))`,\n \"i\"\n );\n const match = tag.match(regexp);\n if (!match) return undefined;\n return match[2] ?? match[3] ?? match[4];\n};\n\nconst clampScalePercent = (value: number) =>\n Math.max(1, Math.min(1000, Math.round(value)));\n\nconst getImageMatchInfo = (match: RegExpMatchArray) => {\n const source = match?.[0] ?? \"\";\n const raw = unwrapFixedOutput(source);\n const fixedOutput = /^\\s*===/.test(source);\n if (/^<img\\b/i.test(raw)) {\n const src = extractAttributeValue(raw, \"src\") ?? \"\";\n const alt =\n extractAttributeValue(raw, \"alt\") ??\n extractAttributeValue(raw, \"title\") ??\n \"\";\n const widthAttr = extractAttributeValue(raw, \"width\");\n let scalePercent: number | undefined;\n if (widthAttr) {\n const numeric = Number.parseFloat(widthAttr);\n if (Number.isFinite(numeric)) {\n scalePercent = clampScalePercent(numeric);\n }\n }\n return {\n text: alt,\n url: src,\n title: alt,\n scalePercent,\n fixedOutput,\n };\n }\n const markdownMatch = raw.match(imageMarkupRegexp);\n const title = markdownMatch?.[1] ?? \"\";\n const url = markdownMatch?.[2] ?? \"\";\n return {\n text: title,\n url,\n title,\n scalePercent: undefined,\n fixedOutput,\n };\n};\n\nconst createImageUrlMatcher = (view: EditorView) => {\n const variables = findDocumentVariableMarkers(\n view.state.doc.toString()\n ).filter((marker) => marker.name !== null);\n return new MatchDecorator({\n regexp: agiImgContextRegexp,\n decoration: (match, view, from) => {\n const to = from + match[0].length;\n if (variables.some((marker) => from < marker.end && to > marker.start)) {\n return null;\n }\n const info = getImageMatchInfo(match);\n return Decoration.replace({\n widget: new PlaceholderWidget(\n info.text || view.state.facet(mediaPlaceholderLabels).image,\n {\n tag: \"image\",\n url: info.url,\n title: info.title,\n scalePercent: info.scalePercent,\n fixedOutput: info.fixedOutput,\n },\n \"tag-image\",\n SelectedOption.Image,\n view\n ),\n });\n },\n });\n};\n\nconst ImgPlaceholder = ViewPlugin.fromClass(\n class {\n placeholders: DecorationSet;\n matcher: MatchDecorator;\n constructor(view: EditorView) {\n this.matcher = createImageUrlMatcher(view);\n this.placeholders = this.matcher.createDeco(view);\n }\n update(update: ViewUpdate) {\n if (update.docChanged) {\n this.matcher = createImageUrlMatcher(update.view);\n }\n if (\n update.docChanged ||\n update.startState.facet(mediaPlaceholderLabels) !==\n update.state.facet(mediaPlaceholderLabels)\n ) {\n this.placeholders = this.matcher.createDeco(update.view);\n return;\n }\n this.placeholders = this.matcher.updateDeco(update, this.placeholders);\n }\n },\n {\n decorations: (instance) => instance.placeholders,\n provide: (plugin) =>\n EditorView.atomicRanges.of((view) => {\n return view.plugin(plugin)?.placeholders || Decoration.none;\n }),\n }\n);\n\nexport default ImgPlaceholder;\n"],"names":["imageMarkupRegexp","agiImgContextRegexp","extractAttributeValue","tag","attribute","regexp","match","clampScalePercent","value","getImageMatchInfo","source","raw","unwrapFixedOutput","fixedOutput","src","alt","widthAttr","scalePercent","numeric","markdownMatch","title","url","createImageUrlMatcher","view","variables","findDocumentVariableMarkers","marker","MatchDecorator","from","to","info","Decoration","PlaceholderWidget","mediaPlaceholderLabels","SelectedOption","ImgPlaceholder","ViewPlugin","update","instance","plugin","EditorView"],"mappings":";;;;;;AAaA,MAAMA,IAAoB,0CACpBC,IACJ,yFAEIC,IAAwB,CAACC,GAAaC,MAAsB;AAChE,QAAMC,IAAS,IAAI;AAAA,IACjB,GAAGD,CAAS;AAAA,IACZ;AAAA,EAAA,GAEIE,IAAQH,EAAI,MAAME,CAAM;AAC9B,MAAKC;AACL,WAAOA,EAAM,CAAC,KAAKA,EAAM,CAAC,KAAKA,EAAM,CAAC;AACxC,GAEMC,IAAoB,CAACC,MACzB,KAAK,IAAI,GAAG,KAAK,IAAI,KAAM,KAAK,MAAMA,CAAK,CAAC,CAAC,GAEzCC,IAAoB,CAACH,MAA4B;AACrD,QAAMI,IAASJ,IAAQ,CAAC,KAAK,IACvBK,IAAMC,EAAkBF,CAAM,GAC9BG,IAAc,UAAU,KAAKH,CAAM;AACzC,MAAI,WAAW,KAAKC,CAAG,GAAG;AACx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,YACV,OAAOA,EAAK;AAAA,YACZ,cAAcA,EAAK;AAAA,YACnB,aAAaA,EAAK;AAAA,UAAA;AAAA,UAEpB;AAAA,UACAI,EAAe;AAAA,UACfX;AAAAA,QAAA;AAAA,MACF,CACD;AAAA,IACH;AAAA,EAAA,CACD;AACH,GAEMY,IAAiBC,EAAW;AAAA,EAChC,MAAM;AAAA,IAGJ,YAAYb,GAAkB;AAC5B,WAAK,UAAUD,EAAsBC,CAAI,GACzC,KAAK,eAAe,KAAK,QAAQ,WAAWA,CAAI;AAAA,IAClD;AAAA,IACA,OAAOc,GAAoB;AAIzB,UAHIA,EAAO,eACT,KAAK,UAAUf,EAAsBe,EAAO,IAAI,IAGhDA,EAAO,cACPA,EAAO,WAAW,MAAMJ,CAAsB,MAC5CI,EAAO,MAAM,MAAMJ,CAAsB,GAC3C;AACA,aAAK,eAAe,KAAK,QAAQ,WAAWI,EAAO,IAAI;AACvD;AAAA,MACF;AACA,WAAK,eAAe,KAAK,QAAQ,WAAWA,GAAQ,KAAK,YAAY;AAAA,IACvE;AAAA,EAAA;AAAA,EAEF;AAAA,IACE,aAAa,CAACC,MAAaA,EAAS;AAAA,IACpC,SAAS,CAACC,MACRC,EAAW,aAAa,GAAG,CAACjB,MACnBA,EAAK,OAAOgB,CAAM,GAAG,gBAAgBR,EAAW,IACxD;AAAA,EAAA;AAEP;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PlaceholderWidget.cjs","sources":["../../../../src/components/MarkdownFlowEditor/plugins/PlaceholderWidget.ts"],"sourcesContent":["import { EditorView, Decoration, WidgetType } from \"@codemirror/view\";\nimport { SelectedOption } from \"../types\";\n\nconst SVG_NS = \"http://www.w3.org/2000/svg\";\n\nconst createSvgElement = (tag: string) => document.createElementNS(SVG_NS, tag);\n// TODO: if use renderToStaticMarkup & createElement, it will cause react & react-dom version mismatch\n// so we use lucide-react to build the icon\n// lucide-react image icon\nconst buildImageIcon = () => {\n const svg = createSvgElement(\"svg\");\n svg.setAttribute(\"viewBox\", \"0 0 24 24\");\n svg.setAttribute(\"width\", \"14\");\n svg.setAttribute(\"height\", \"14\");\n svg.setAttribute(\"fill\", \"none\");\n svg.setAttribute(\"stroke\", \"currentColor\");\n svg.setAttribute(\"stroke-width\", \"1.5\");\n svg.setAttribute(\"stroke-linecap\", \"round\");\n svg.setAttribute(\"stroke-linejoin\", \"round\");\n\n const rect = createSvgElement(\"rect\");\n rect.setAttribute(\"width\", \"18\");\n rect.setAttribute(\"height\", \"18\");\n rect.setAttribute(\"x\", \"3\");\n rect.setAttribute(\"y\", \"3\");\n rect.setAttribute(\"rx\", \"2\");\n rect.setAttribute(\"ry\", \"2\");\n\n const circle = createSvgElement(\"circle\");\n circle.setAttribute(\"cx\", \"9\");\n circle.setAttribute(\"cy\", \"9\");\n circle.setAttribute(\"r\", \"2\");\n\n const path = createSvgElement(\"path\");\n path.setAttribute(\"d\", \"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\");\n\n svg.append(rect, circle, path);\n return svg;\n};\n\n// lucide-react image icon\nconst buildVideoIcon = () => {\n const svg = createSvgElement(\"svg\");\n svg.setAttribute(\"viewBox\", \"0 0 24 24\");\n svg.setAttribute(\"width\", \"14\");\n svg.setAttribute(\"height\", \"14\");\n svg.setAttribute(\"fill\", \"none\");\n svg.setAttribute(\"stroke\", \"currentColor\");\n svg.setAttribute(\"stroke-width\", \"1.5\");\n svg.setAttribute(\"stroke-linecap\", \"round\");\n svg.setAttribute(\"stroke-linejoin\", \"round\");\n\n const rect = createSvgElement(\"rect\");\n rect.setAttribute(\"width\", \"18\");\n rect.setAttribute(\"height\", \"18\");\n rect.setAttribute(\"x\", \"3\");\n rect.setAttribute(\"y\", \"3\");\n rect.setAttribute(\"rx\", \"2\");\n\n const path = createSvgElement(\"path\");\n path.setAttribute(\"d\", \"m9 8 6 4-6 4Z\");\n\n svg.append(rect, path);\n return svg;\n};\n\nclass PlaceholderWidget extends WidgetType {\n constructor(\n private text: string,\n private dataset: {\n tag: \"image\" | \"video\" | \"variable\";\n title?: string;\n url?: string;\n scalePercent?: number;\n fixedOutput?: boolean;\n },\n private styleClass: string,\n private type: SelectedOption,\n private view: EditorView\n ) {\n super();\n }\n\n getPosition() {\n let from = -1;\n let to = -1;\n const decorations = this.view.state.facet(EditorView.decorations);\n for (const deco of decorations) {\n const decoSet = typeof deco === \"function\" ? deco(this.view) : deco;\n decoSet.between(\n 0,\n this.view.state.doc.length,\n (start: number, end: number, decoration: Decoration) => {\n if (decoration.spec.widget === this) {\n from = start;\n to = end;\n return false;\n }\n }\n );\n if (from !== -1) break;\n }\n if (from !== -1 && to !== -1) {\n return [from, to];\n }\n }\n\n toDOM() {\n const container = document.createElement(\"span\");\n container.className = this.styleClass;\n const content = document.createElement(\"span\");\n content.className = \"tag-placeholder-content\";\n const span = document.createElement(\"span\");\n span.className = \"tag-placeholder-label\";\n span.textContent = this.text;\n span.dataset[\"tag\"] = this.dataset.tag || \"\";\n span.dataset[\"url\"] = this.dataset.url || \"\";\n span.dataset[\"title\"] = this.dataset.title || \"\";\n // const icon = document.createElement(\"span\");\n // icon.className = \"tag-icon\";\n // icon.innerHTML = \"✕\";\n // icon.addEventListener(\"click\", (e) => {\n // e.stopPropagation();\n // const [from, to] = this.getPosition() ?? [-1, -1];\n // if (from !== -1 && to !== -1) {\n // this.view.dispatch({\n // changes: { from, to, insert: \"\" },\n // });\n // }\n // });\n content.addEventListener(\"click\", (e) => {\n const [from, to] = this.getPosition() ?? [-1, -1];\n const event = new CustomEvent(\"globalTagClick\", {\n detail: {\n view: this.view,\n type: this.type,\n dataset: this.dataset,\n content: span.textContent,\n from,\n to,\n target: e.currentTarget,\n },\n });\n window.dispatchEvent(event);\n });\n\n if (this.dataset.fixedOutput) {\n const prefix = document.createElement(\"span\");\n prefix.className = \"tag-fixed-output-marker\";\n prefix.textContent = \"===\";\n container.appendChild(prefix);\n }\n\n if (this.dataset.tag === \"image\" || this.dataset.tag === \"video\") {\n const iconWrapper = document.createElement(\"span\");\n iconWrapper.className = \"tag-placeholder-icon\";\n\n const icon =\n this.dataset.tag === \"image\" ? buildImageIcon() : buildVideoIcon();\n iconWrapper.appendChild(icon);\n content.appendChild(iconWrapper);\n }\n content.appendChild(span);\n container.appendChild(content);\n\n if (this.dataset.fixedOutput) {\n const suffix = document.createElement(\"span\");\n suffix.className = \"tag-fixed-output-marker\";\n suffix.textContent = \"===\";\n container.appendChild(suffix);\n }\n\n // container.appendChild(icon);\n return container;\n }\n\n ignoreEvent() {\n return false;\n }\n}\n\nexport default PlaceholderWidget;\n"],"names":["SVG_NS","createSvgElement","tag","buildImageIcon","svg","rect","circle","path","buildVideoIcon","PlaceholderWidget","WidgetType","text","dataset","styleClass","type","view","from","to","decorations","EditorView","deco","start","end","decoration","container","content","span","e","event","prefix","iconWrapper","icon","suffix"],"mappings":"qLAGMA,EAAS,6BAETC,EAAoBC,GAAgB,SAAS,gBAAgBF,EAAQE,CAAG,EAIxEC,EAAiB,IAAM,CAC3B,MAAMC,EAAMH,EAAiB,KAAK,EAClCG,EAAI,aAAa,UAAW,WAAW,EACvCA,EAAI,aAAa,QAAS,IAAI,EAC9BA,EAAI,aAAa,SAAU,IAAI,EAC/BA,EAAI,aAAa,OAAQ,MAAM,EAC/BA,EAAI,aAAa,SAAU,cAAc,EACzCA,EAAI,aAAa,eAAgB,KAAK,EACtCA,EAAI,aAAa,iBAAkB,OAAO,EAC1CA,EAAI,aAAa,kBAAmB,OAAO,EAE3C,MAAMC,EAAOJ,EAAiB,MAAM,EACpCI,EAAK,aAAa,QAAS,IAAI,EAC/BA,EAAK,aAAa,SAAU,IAAI,EAChCA,EAAK,aAAa,IAAK,GAAG,EAC1BA,EAAK,aAAa,IAAK,GAAG,EAC1BA,EAAK,aAAa,KAAM,GAAG,EAC3BA,EAAK,aAAa,KAAM,GAAG,EAE3B,MAAMC,EAASL,EAAiB,QAAQ,EACxCK,EAAO,aAAa,KAAM,GAAG,EAC7BA,EAAO,aAAa,KAAM,GAAG,EAC7BA,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,YAAYK,CAAW,CACjC,CAIA,GAHAL,EAAQ,YAAYC,CAAI,EACxBF,EAAU,YAAYC,CAAO,EAEzB,KAAK,QAAQ,YAAa,CAC5B,MAAMO,EAAS,SAAS,cAAc,MAAM,EAC5CA,EAAO,UAAY,0BACnBA,EAAO,YAAc,MACrBR,EAAU,YAAYQ,CAAM,CAC9B,CAGA,OAAOR,CACT,CAEA,aAAc,CACZ,MAAO,EACT,CACF"}
1
+ {"version":3,"file":"PlaceholderWidget.cjs","sources":["../../../../src/components/MarkdownFlowEditor/plugins/PlaceholderWidget.ts"],"sourcesContent":["import { EditorView, Decoration, WidgetType } from \"@codemirror/view\";\nimport { SelectedOption } from \"../types\";\n\nconst SVG_NS = \"http://www.w3.org/2000/svg\";\n\nconst createSvgElement = (tag: string) => document.createElementNS(SVG_NS, tag);\n// TODO: if use renderToStaticMarkup & createElement, it will cause react & react-dom version mismatch\n// so we use lucide-react to build the icon\n// lucide-react image icon\nconst buildImageIcon = () => {\n const svg = createSvgElement(\"svg\");\n svg.setAttribute(\"viewBox\", \"0 0 24 24\");\n svg.setAttribute(\"width\", \"14\");\n svg.setAttribute(\"height\", \"14\");\n svg.setAttribute(\"fill\", \"none\");\n svg.setAttribute(\"stroke\", \"currentColor\");\n svg.setAttribute(\"stroke-width\", \"1.5\");\n svg.setAttribute(\"stroke-linecap\", \"round\");\n svg.setAttribute(\"stroke-linejoin\", \"round\");\n\n const rect = createSvgElement(\"rect\");\n rect.setAttribute(\"width\", \"18\");\n rect.setAttribute(\"height\", \"18\");\n rect.setAttribute(\"x\", \"3\");\n rect.setAttribute(\"y\", \"3\");\n rect.setAttribute(\"rx\", \"2\");\n rect.setAttribute(\"ry\", \"2\");\n\n const circle = createSvgElement(\"circle\");\n circle.setAttribute(\"cx\", \"9\");\n circle.setAttribute(\"cy\", \"9\");\n circle.setAttribute(\"r\", \"2\");\n\n const path = createSvgElement(\"path\");\n path.setAttribute(\"d\", \"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\");\n\n svg.append(rect, circle, path);\n return svg;\n};\n\n// lucide-react image icon\nconst buildVideoIcon = () => {\n const svg = createSvgElement(\"svg\");\n svg.setAttribute(\"viewBox\", \"0 0 24 24\");\n svg.setAttribute(\"width\", \"14\");\n svg.setAttribute(\"height\", \"14\");\n svg.setAttribute(\"fill\", \"none\");\n svg.setAttribute(\"stroke\", \"currentColor\");\n svg.setAttribute(\"stroke-width\", \"1.5\");\n svg.setAttribute(\"stroke-linecap\", \"round\");\n svg.setAttribute(\"stroke-linejoin\", \"round\");\n\n const rect = createSvgElement(\"rect\");\n rect.setAttribute(\"width\", \"18\");\n rect.setAttribute(\"height\", \"18\");\n rect.setAttribute(\"x\", \"3\");\n rect.setAttribute(\"y\", \"3\");\n rect.setAttribute(\"rx\", \"2\");\n\n const path = createSvgElement(\"path\");\n path.setAttribute(\"d\", \"m9 8 6 4-6 4Z\");\n\n svg.append(rect, path);\n return svg;\n};\n\nclass PlaceholderWidget extends WidgetType {\n constructor(\n private text: string,\n private dataset: {\n tag: \"image\" | \"video\";\n title?: string;\n url?: string;\n scalePercent?: number;\n fixedOutput?: boolean;\n },\n private styleClass: string,\n private type: SelectedOption,\n private view: EditorView\n ) {\n super();\n }\n\n getPosition() {\n let from = -1;\n let to = -1;\n const decorations = this.view.state.facet(EditorView.decorations);\n for (const deco of decorations) {\n const decoSet = typeof deco === \"function\" ? deco(this.view) : deco;\n decoSet.between(\n 0,\n this.view.state.doc.length,\n (start: number, end: number, decoration: Decoration) => {\n if (decoration.spec.widget === this) {\n from = start;\n to = end;\n return false;\n }\n }\n );\n if (from !== -1) break;\n }\n if (from !== -1 && to !== -1) {\n return [from, to];\n }\n }\n\n toDOM() {\n const container = document.createElement(\"span\");\n container.className = this.styleClass;\n const content = document.createElement(\"span\");\n content.className = \"tag-placeholder-content\";\n const span = document.createElement(\"span\");\n span.className = \"tag-placeholder-label\";\n span.textContent = this.text;\n span.dataset[\"tag\"] = this.dataset.tag || \"\";\n span.dataset[\"url\"] = this.dataset.url || \"\";\n span.dataset[\"title\"] = this.dataset.title || \"\";\n // const icon = document.createElement(\"span\");\n // icon.className = \"tag-icon\";\n // icon.innerHTML = \"✕\";\n // icon.addEventListener(\"click\", (e) => {\n // e.stopPropagation();\n // const [from, to] = this.getPosition() ?? [-1, -1];\n // if (from !== -1 && to !== -1) {\n // this.view.dispatch({\n // changes: { from, to, insert: \"\" },\n // });\n // }\n // });\n content.addEventListener(\"click\", (e) => {\n const [from, to] = this.getPosition() ?? [-1, -1];\n const event = new CustomEvent(\"globalTagClick\", {\n detail: {\n view: this.view,\n type: this.type,\n dataset: this.dataset,\n content: span.textContent,\n from,\n to,\n target: e.currentTarget,\n },\n });\n window.dispatchEvent(event);\n });\n\n if (this.dataset.fixedOutput) {\n const prefix = document.createElement(\"span\");\n prefix.className = \"tag-fixed-output-marker\";\n prefix.textContent = \"===\";\n container.appendChild(prefix);\n }\n\n if (this.dataset.tag === \"image\" || this.dataset.tag === \"video\") {\n const iconWrapper = document.createElement(\"span\");\n iconWrapper.className = \"tag-placeholder-icon\";\n\n const icon =\n this.dataset.tag === \"image\" ? buildImageIcon() : buildVideoIcon();\n iconWrapper.appendChild(icon);\n content.appendChild(iconWrapper);\n }\n content.appendChild(span);\n container.appendChild(content);\n\n if (this.dataset.fixedOutput) {\n const suffix = document.createElement(\"span\");\n suffix.className = \"tag-fixed-output-marker\";\n suffix.textContent = \"===\";\n container.appendChild(suffix);\n }\n\n // container.appendChild(icon);\n return container;\n }\n\n ignoreEvent() {\n return false;\n }\n}\n\nexport default PlaceholderWidget;\n"],"names":["SVG_NS","createSvgElement","tag","buildImageIcon","svg","rect","circle","path","buildVideoIcon","PlaceholderWidget","WidgetType","text","dataset","styleClass","type","view","from","to","decorations","EditorView","deco","start","end","decoration","container","content","span","e","event","prefix","iconWrapper","icon","suffix"],"mappings":"qLAGMA,EAAS,6BAETC,EAAoBC,GAAgB,SAAS,gBAAgBF,EAAQE,CAAG,EAIxEC,EAAiB,I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,EAAMC,CAAE,EAAI,KAAK,eAAiB,CAAC,GAAI,EAAE,EAC1CW,EAAQ,IAAI,YAAY,iBAAkB,CAC9C,OAAQ,CACN,KAAM,KAAK,KACX,KAAM,KAAK,KACX,QAAS,KAAK,QACd,QAASF,EAAK,YACd,KAAAV,EACA,GAAAC,EACA,OAAQU,EAAE,aAAA,CACZ,CACD,EACD,OAAO,cAAcC,CAAK,CAC5B,CAAC,EAEG,KAAK,QAAQ,YAAa,CAC5B,MAAMC,EAAS,SAAS,cAAc,MAAM,EAC5CA,EAAO,UAAY,0BACnBA,EAAO,YAAc,MACrBL,EAAU,YAAYK,CAAM,CAC9B,CAEA,GAAI,KAAK,QAAQ,MAAQ,SAAW,KAAK,QAAQ,MAAQ,QAAS,CAChE,MAAMC,EAAc,SAAS,cAAc,MAAM,EACjDA,EAAY,UAAY,uBAExB,MAAMC,EACJ,KAAK,QAAQ,MAAQ,QAAU5B,EAAA,EAAmBK,EAAA,EACpDsB,EAAY,YAAYC,CAAI,EAC5BN,EAAQ,YAAYK,CAAW,CACjC,CAIA,GAHAL,EAAQ,YAAYC,CAAI,EACxBF,EAAU,YAAYC,CAAO,EAEzB,KAAK,QAAQ,YAAa,CAC5B,MAAMO,EAAS,SAAS,cAAc,MAAM,EAC5CA,EAAO,UAAY,0BACnBA,EAAO,YAAc,MACrBR,EAAU,YAAYQ,CAAM,CAC9B,CAGA,OAAOR,CACT,CAEA,aAAc,CACZ,MAAO,EACT,CACF"}
@@ -7,7 +7,7 @@ declare class PlaceholderWidget extends WidgetType {
7
7
  private type;
8
8
  private view;
9
9
  constructor(text: string, dataset: {
10
- tag: "image" | "video" | "variable";
10
+ tag: "image" | "video";
11
11
  title?: string;
12
12
  url?: string;
13
13
  scalePercent?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"PlaceholderWidget.es.js","sources":["../../../../src/components/MarkdownFlowEditor/plugins/PlaceholderWidget.ts"],"sourcesContent":["import { EditorView, Decoration, WidgetType } from \"@codemirror/view\";\nimport { SelectedOption } from \"../types\";\n\nconst SVG_NS = \"http://www.w3.org/2000/svg\";\n\nconst createSvgElement = (tag: string) => document.createElementNS(SVG_NS, tag);\n// TODO: if use renderToStaticMarkup & createElement, it will cause react & react-dom version mismatch\n// so we use lucide-react to build the icon\n// lucide-react image icon\nconst buildImageIcon = () => {\n const svg = createSvgElement(\"svg\");\n svg.setAttribute(\"viewBox\", \"0 0 24 24\");\n svg.setAttribute(\"width\", \"14\");\n svg.setAttribute(\"height\", \"14\");\n svg.setAttribute(\"fill\", \"none\");\n svg.setAttribute(\"stroke\", \"currentColor\");\n svg.setAttribute(\"stroke-width\", \"1.5\");\n svg.setAttribute(\"stroke-linecap\", \"round\");\n svg.setAttribute(\"stroke-linejoin\", \"round\");\n\n const rect = createSvgElement(\"rect\");\n rect.setAttribute(\"width\", \"18\");\n rect.setAttribute(\"height\", \"18\");\n rect.setAttribute(\"x\", \"3\");\n rect.setAttribute(\"y\", \"3\");\n rect.setAttribute(\"rx\", \"2\");\n rect.setAttribute(\"ry\", \"2\");\n\n const circle = createSvgElement(\"circle\");\n circle.setAttribute(\"cx\", \"9\");\n circle.setAttribute(\"cy\", \"9\");\n circle.setAttribute(\"r\", \"2\");\n\n const path = createSvgElement(\"path\");\n path.setAttribute(\"d\", \"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\");\n\n svg.append(rect, circle, path);\n return svg;\n};\n\n// lucide-react image icon\nconst buildVideoIcon = () => {\n const svg = createSvgElement(\"svg\");\n svg.setAttribute(\"viewBox\", \"0 0 24 24\");\n svg.setAttribute(\"width\", \"14\");\n svg.setAttribute(\"height\", \"14\");\n svg.setAttribute(\"fill\", \"none\");\n svg.setAttribute(\"stroke\", \"currentColor\");\n svg.setAttribute(\"stroke-width\", \"1.5\");\n svg.setAttribute(\"stroke-linecap\", \"round\");\n svg.setAttribute(\"stroke-linejoin\", \"round\");\n\n const rect = createSvgElement(\"rect\");\n rect.setAttribute(\"width\", \"18\");\n rect.setAttribute(\"height\", \"18\");\n rect.setAttribute(\"x\", \"3\");\n rect.setAttribute(\"y\", \"3\");\n rect.setAttribute(\"rx\", \"2\");\n\n const path = createSvgElement(\"path\");\n path.setAttribute(\"d\", \"m9 8 6 4-6 4Z\");\n\n svg.append(rect, path);\n return svg;\n};\n\nclass PlaceholderWidget extends WidgetType {\n constructor(\n private text: string,\n private dataset: {\n tag: \"image\" | \"video\" | \"variable\";\n title?: string;\n url?: string;\n scalePercent?: number;\n fixedOutput?: boolean;\n },\n private styleClass: string,\n private type: SelectedOption,\n private view: EditorView\n ) {\n super();\n }\n\n getPosition() {\n let from = -1;\n let to = -1;\n const decorations = this.view.state.facet(EditorView.decorations);\n for (const deco of decorations) {\n const decoSet = typeof deco === \"function\" ? deco(this.view) : deco;\n decoSet.between(\n 0,\n this.view.state.doc.length,\n (start: number, end: number, decoration: Decoration) => {\n if (decoration.spec.widget === this) {\n from = start;\n to = end;\n return false;\n }\n }\n );\n if (from !== -1) break;\n }\n if (from !== -1 && to !== -1) {\n return [from, to];\n }\n }\n\n toDOM() {\n const container = document.createElement(\"span\");\n container.className = this.styleClass;\n const content = document.createElement(\"span\");\n content.className = \"tag-placeholder-content\";\n const span = document.createElement(\"span\");\n span.className = \"tag-placeholder-label\";\n span.textContent = this.text;\n span.dataset[\"tag\"] = this.dataset.tag || \"\";\n span.dataset[\"url\"] = this.dataset.url || \"\";\n span.dataset[\"title\"] = this.dataset.title || \"\";\n // const icon = document.createElement(\"span\");\n // icon.className = \"tag-icon\";\n // icon.innerHTML = \"✕\";\n // icon.addEventListener(\"click\", (e) => {\n // e.stopPropagation();\n // const [from, to] = this.getPosition() ?? [-1, -1];\n // if (from !== -1 && to !== -1) {\n // this.view.dispatch({\n // changes: { from, to, insert: \"\" },\n // });\n // }\n // });\n content.addEventListener(\"click\", (e) => {\n const [from, to] = this.getPosition() ?? [-1, -1];\n const event = new CustomEvent(\"globalTagClick\", {\n detail: {\n view: this.view,\n type: this.type,\n dataset: this.dataset,\n content: span.textContent,\n from,\n to,\n target: e.currentTarget,\n },\n });\n window.dispatchEvent(event);\n });\n\n if (this.dataset.fixedOutput) {\n const prefix = document.createElement(\"span\");\n prefix.className = \"tag-fixed-output-marker\";\n prefix.textContent = \"===\";\n container.appendChild(prefix);\n }\n\n if (this.dataset.tag === \"image\" || this.dataset.tag === \"video\") {\n const iconWrapper = document.createElement(\"span\");\n iconWrapper.className = \"tag-placeholder-icon\";\n\n const icon =\n this.dataset.tag === \"image\" ? buildImageIcon() : buildVideoIcon();\n iconWrapper.appendChild(icon);\n content.appendChild(iconWrapper);\n }\n content.appendChild(span);\n container.appendChild(content);\n\n if (this.dataset.fixedOutput) {\n const suffix = document.createElement(\"span\");\n suffix.className = \"tag-fixed-output-marker\";\n suffix.textContent = \"===\";\n container.appendChild(suffix);\n }\n\n // container.appendChild(icon);\n return container;\n }\n\n ignoreEvent() {\n return false;\n }\n}\n\nexport default PlaceholderWidget;\n"],"names":["SVG_NS","createSvgElement","tag","buildImageIcon","svg","rect","circle","path","buildVideoIcon","PlaceholderWidget","WidgetType","text","dataset","styleClass","type","view","from","to","decorations","EditorView","deco","start","end","decoration","container","content","span","e","event","prefix","iconWrapper","icon","suffix"],"mappings":";AAGA,MAAMA,IAAS,8BAETC,IAAmB,CAACC,MAAgB,SAAS,gBAAgBF,GAAQE,CAAG,GAIxEC,IAAiB,MAAM;AAC3B,QAAMC,IAAMH,EAAiB,KAAK;AAClC,EAAAG,EAAI,aAAa,WAAW,WAAW,GACvCA,EAAI,aAAa,SAAS,IAAI,GAC9BA,EAAI,aAAa,UAAU,IAAI,GAC/BA,EAAI,aAAa,QAAQ,MAAM,GAC/BA,EAAI,aAAa,UAAU,cAAc,GACzCA,EAAI,aAAa,gBAAgB,KAAK,GACtCA,EAAI,aAAa,kBAAkB,OAAO,GAC1CA,EAAI,aAAa,mBAAmB,OAAO;AAE3C,QAAMC,IAAOJ,EAAiB,MAAM;AACpC,EAAAI,EAAK,aAAa,SAAS,IAAI,GAC/B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,aAAO,cAAcC,CAAK;AAAA,IAC5B,CAAC,GAEG,KAAK,QAAQ,aAAa;AAC5B,YAAMC,IAAS,SAAS,cAAc,MAAM;AAC5C,MAAAA,EAAO,YAAY,2BACnBA,EAAO,cAAc,OACrBL,EAAU,YAAYK,CAAM;AAAA,IAC9B;AAEA,QAAI,KAAK,QAAQ,QAAQ,WAAW,KAAK,QAAQ,QAAQ,SAAS;AAChE,YAAMC,IAAc,SAAS,cAAc,MAAM;AACjD,MAAAA,EAAY,YAAY;AAExB,YAAMC,IACJ,KAAK,QAAQ,QAAQ,UAAU5B,EAAA,IAAmBK,EAAA;AACpD,MAAAsB,EAAY,YAAYC,CAAI,GAC5BN,EAAQ,YAAYK,CAAW;AAAA,IACjC;AAIA,QAHAL,EAAQ,YAAYC,CAAI,GACxBF,EAAU,YAAYC,CAAO,GAEzB,KAAK,QAAQ,aAAa;AAC5B,YAAMO,IAAS,SAAS,cAAc,MAAM;AAC5C,MAAAA,EAAO,YAAY,2BACnBA,EAAO,cAAc,OACrBR,EAAU,YAAYQ,CAAM;AAAA,IAC9B;AAGA,WAAOR;AAAA,EACT;AAAA,EAEA,cAAc;AACZ,WAAO;AAAA,EACT;AACF;"}
1
+ {"version":3,"file":"PlaceholderWidget.es.js","sources":["../../../../src/components/MarkdownFlowEditor/plugins/PlaceholderWidget.ts"],"sourcesContent":["import { EditorView, Decoration, WidgetType } from \"@codemirror/view\";\nimport { SelectedOption } from \"../types\";\n\nconst SVG_NS = \"http://www.w3.org/2000/svg\";\n\nconst createSvgElement = (tag: string) => document.createElementNS(SVG_NS, tag);\n// TODO: if use renderToStaticMarkup & createElement, it will cause react & react-dom version mismatch\n// so we use lucide-react to build the icon\n// lucide-react image icon\nconst buildImageIcon = () => {\n const svg = createSvgElement(\"svg\");\n svg.setAttribute(\"viewBox\", \"0 0 24 24\");\n svg.setAttribute(\"width\", \"14\");\n svg.setAttribute(\"height\", \"14\");\n svg.setAttribute(\"fill\", \"none\");\n svg.setAttribute(\"stroke\", \"currentColor\");\n svg.setAttribute(\"stroke-width\", \"1.5\");\n svg.setAttribute(\"stroke-linecap\", \"round\");\n svg.setAttribute(\"stroke-linejoin\", \"round\");\n\n const rect = createSvgElement(\"rect\");\n rect.setAttribute(\"width\", \"18\");\n rect.setAttribute(\"height\", \"18\");\n rect.setAttribute(\"x\", \"3\");\n rect.setAttribute(\"y\", \"3\");\n rect.setAttribute(\"rx\", \"2\");\n rect.setAttribute(\"ry\", \"2\");\n\n const circle = createSvgElement(\"circle\");\n circle.setAttribute(\"cx\", \"9\");\n circle.setAttribute(\"cy\", \"9\");\n circle.setAttribute(\"r\", \"2\");\n\n const path = createSvgElement(\"path\");\n path.setAttribute(\"d\", \"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\");\n\n svg.append(rect, circle, path);\n return svg;\n};\n\n// lucide-react image icon\nconst buildVideoIcon = () => {\n const svg = createSvgElement(\"svg\");\n svg.setAttribute(\"viewBox\", \"0 0 24 24\");\n svg.setAttribute(\"width\", \"14\");\n svg.setAttribute(\"height\", \"14\");\n svg.setAttribute(\"fill\", \"none\");\n svg.setAttribute(\"stroke\", \"currentColor\");\n svg.setAttribute(\"stroke-width\", \"1.5\");\n svg.setAttribute(\"stroke-linecap\", \"round\");\n svg.setAttribute(\"stroke-linejoin\", \"round\");\n\n const rect = createSvgElement(\"rect\");\n rect.setAttribute(\"width\", \"18\");\n rect.setAttribute(\"height\", \"18\");\n rect.setAttribute(\"x\", \"3\");\n rect.setAttribute(\"y\", \"3\");\n rect.setAttribute(\"rx\", \"2\");\n\n const path = createSvgElement(\"path\");\n path.setAttribute(\"d\", \"m9 8 6 4-6 4Z\");\n\n svg.append(rect, path);\n return svg;\n};\n\nclass PlaceholderWidget extends WidgetType {\n constructor(\n private text: string,\n private dataset: {\n tag: \"image\" | \"video\";\n title?: string;\n url?: string;\n scalePercent?: number;\n fixedOutput?: boolean;\n },\n private styleClass: string,\n private type: SelectedOption,\n private view: EditorView\n ) {\n super();\n }\n\n getPosition() {\n let from = -1;\n let to = -1;\n const decorations = this.view.state.facet(EditorView.decorations);\n for (const deco of decorations) {\n const decoSet = typeof deco === \"function\" ? deco(this.view) : deco;\n decoSet.between(\n 0,\n this.view.state.doc.length,\n (start: number, end: number, decoration: Decoration) => {\n if (decoration.spec.widget === this) {\n from = start;\n to = end;\n return false;\n }\n }\n );\n if (from !== -1) break;\n }\n if (from !== -1 && to !== -1) {\n return [from, to];\n }\n }\n\n toDOM() {\n const container = document.createElement(\"span\");\n container.className = this.styleClass;\n const content = document.createElement(\"span\");\n content.className = \"tag-placeholder-content\";\n const span = document.createElement(\"span\");\n span.className = \"tag-placeholder-label\";\n span.textContent = this.text;\n span.dataset[\"tag\"] = this.dataset.tag || \"\";\n span.dataset[\"url\"] = this.dataset.url || \"\";\n span.dataset[\"title\"] = this.dataset.title || \"\";\n // const icon = document.createElement(\"span\");\n // icon.className = \"tag-icon\";\n // icon.innerHTML = \"✕\";\n // icon.addEventListener(\"click\", (e) => {\n // e.stopPropagation();\n // const [from, to] = this.getPosition() ?? [-1, -1];\n // if (from !== -1 && to !== -1) {\n // this.view.dispatch({\n // changes: { from, to, insert: \"\" },\n // });\n // }\n // });\n content.addEventListener(\"click\", (e) => {\n const [from, to] = this.getPosition() ?? [-1, -1];\n const event = new CustomEvent(\"globalTagClick\", {\n detail: {\n view: this.view,\n type: this.type,\n dataset: this.dataset,\n content: span.textContent,\n from,\n to,\n target: e.currentTarget,\n },\n });\n window.dispatchEvent(event);\n });\n\n if (this.dataset.fixedOutput) {\n const prefix = document.createElement(\"span\");\n prefix.className = \"tag-fixed-output-marker\";\n prefix.textContent = \"===\";\n container.appendChild(prefix);\n }\n\n if (this.dataset.tag === \"image\" || this.dataset.tag === \"video\") {\n const iconWrapper = document.createElement(\"span\");\n iconWrapper.className = \"tag-placeholder-icon\";\n\n const icon =\n this.dataset.tag === \"image\" ? buildImageIcon() : buildVideoIcon();\n iconWrapper.appendChild(icon);\n content.appendChild(iconWrapper);\n }\n content.appendChild(span);\n container.appendChild(content);\n\n if (this.dataset.fixedOutput) {\n const suffix = document.createElement(\"span\");\n suffix.className = \"tag-fixed-output-marker\";\n suffix.textContent = \"===\";\n container.appendChild(suffix);\n }\n\n // container.appendChild(icon);\n return container;\n }\n\n ignoreEvent() {\n return false;\n }\n}\n\nexport default PlaceholderWidget;\n"],"names":["SVG_NS","createSvgElement","tag","buildImageIcon","svg","rect","circle","path","buildVideoIcon","PlaceholderWidget","WidgetType","text","dataset","styleClass","type","view","from","to","decorations","EditorView","deco","start","end","decoration","container","content","span","e","event","prefix","iconWrapper","icon","suffix"],"mappings":";AAGA,MAAMA,IAAS,8BAETC,IAAmB,CAACC,MAAgB,SAAS,gBAAgBF,GAAQE,CAAG,GAIxEC,IAAiB,MAAM;AAC3B,QAAMC,IAAMH,EAAiB,KAAK;AAClC,EAAAG,EAAI,aAAa,WAAW,WAAW,GACvCA,EAAI,aAAa,SAAS,IAAI,GAC9BA,EAAI,aAAa,UAAU,IAAI,GAC/BA,EAAI,aAAa,QAAQ,MAAM,GAC/BA,EAAI,aAAa,UAAU,cAAc,GACzCA,EAAI,aAAa,gBAAgB,KAAK,GACtCA,EAAI,aAAa,kBAAkB,OAAO,GAC1CA,EAAI,aAAa,mBAAmB,OAAO;AAE3C,QAAMC,IAAOJ,EAAiB,MAAM;AACpC,EAAAI,EAAK,aAAa,SAAS,IAAI,GAC/BA,EAAK,aAAa,UAAU,IAAI,GAChCA,EAAK,aAAa,KAAK,GAAG,GAC1BA,EAAK,aAAa,KAAK,GAAG,GAC1BA,EAAK,aAAa,MAAM,GAAG,GAC3BA,EAAK,aAAa,MAAM,GAAG;AAE3B,QAAMC,IAASL,EAAiB,QAAQ;AACxC,EAAAK,EAAO,aAAa,MAAM,GAAG,GAC7BA,EAAO,aAAa,MAAM,GAAG,GAC7BA,EAAO,aAAa,KAAK,GAAG;AAE5B,QAAMC,IAAON,EAAiB,MAAM;AACpC,SAAAM,EAAK,aAAa,KAAK,2CAA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