@gravity-ui/markdown-editor 15.24.1 → 15.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. package/build/cjs/bundle/Editor.js +56 -23
  2. package/build/cjs/bundle/Editor.js.map +1 -1
  3. package/build/cjs/extensions/additional/Math/const.d.ts +1 -0
  4. package/build/cjs/extensions/additional/Math/const.js +11 -1
  5. package/build/cjs/extensions/additional/Math/const.js.map +1 -1
  6. package/build/cjs/extensions/additional/Math/index.d.ts +1 -0
  7. package/build/cjs/extensions/additional/Math/index.js +6 -1
  8. package/build/cjs/extensions/additional/Math/index.js.map +1 -1
  9. package/build/cjs/extensions/additional/Math/latex-paste-plugin.d.ts +2 -0
  10. package/build/cjs/extensions/additional/Math/latex-paste-plugin.js +54 -0
  11. package/build/cjs/extensions/additional/Math/latex-paste-plugin.js.map +1 -0
  12. package/build/cjs/extensions/additional/Math/utils.d.ts +7 -0
  13. package/build/cjs/extensions/additional/Math/utils.js +45 -0
  14. package/build/cjs/extensions/additional/Math/utils.js.map +1 -0
  15. package/build/cjs/extensions/markdown/CodeBlock/CodeBlockHighlight/CodeBlockHighlight.css +8 -0
  16. package/build/cjs/extensions/markdown/CodeBlock/CodeBlockHighlight/CodeBlockHighlight.d.ts +3 -0
  17. package/build/cjs/extensions/markdown/CodeBlock/CodeBlockHighlight/CodeBlockHighlight.js +79 -11
  18. package/build/cjs/extensions/markdown/CodeBlock/CodeBlockHighlight/CodeBlockHighlight.js.map +1 -1
  19. package/build/cjs/extensions/markdown/CodeBlock/CodeBlockHighlight/TooltipPlugin/TooltipView.css +4 -0
  20. package/build/cjs/extensions/markdown/CodeBlock/CodeBlockHighlight/TooltipPlugin/index.d.ts +1 -1
  21. package/build/cjs/extensions/markdown/CodeBlock/CodeBlockHighlight/TooltipPlugin/index.js +53 -28
  22. package/build/cjs/extensions/markdown/CodeBlock/CodeBlockHighlight/TooltipPlugin/index.js.map +1 -1
  23. package/build/cjs/extensions/markdown/CodeBlock/CodeBlockSpecs/index.d.ts +7 -0
  24. package/build/cjs/extensions/markdown/CodeBlock/CodeBlockSpecs/index.js +36 -2
  25. package/build/cjs/extensions/markdown/CodeBlock/CodeBlockSpecs/index.js.map +1 -1
  26. package/build/cjs/extensions/markdown/CodeBlock/index.d.ts +2 -1
  27. package/build/cjs/extensions/markdown/CodeBlock/index.js +21 -6
  28. package/build/cjs/extensions/markdown/CodeBlock/index.js.map +1 -1
  29. package/build/cjs/extensions/markdown/Deflist/DeflistSpecs/const.d.ts +3 -0
  30. package/build/cjs/extensions/markdown/Deflist/DeflistSpecs/const.js +4 -1
  31. package/build/cjs/extensions/markdown/Deflist/DeflistSpecs/const.js.map +1 -1
  32. package/build/cjs/extensions/markdown/Deflist/DeflistSpecs/parser.js +9 -1
  33. package/build/cjs/extensions/markdown/Deflist/DeflistSpecs/parser.js.map +1 -1
  34. package/build/cjs/extensions/markdown/Deflist/DeflistSpecs/schema.js +3 -2
  35. package/build/cjs/extensions/markdown/Deflist/DeflistSpecs/schema.js.map +1 -1
  36. package/build/cjs/extensions/markdown/Lists/ListsSpecs/const.d.ts +2 -1
  37. package/build/cjs/extensions/markdown/Lists/ListsSpecs/const.js +1 -0
  38. package/build/cjs/extensions/markdown/Lists/ListsSpecs/const.js.map +1 -1
  39. package/build/cjs/extensions/markdown/Lists/ListsSpecs/parser.js +4 -1
  40. package/build/cjs/extensions/markdown/Lists/ListsSpecs/parser.js.map +1 -1
  41. package/build/cjs/extensions/markdown/Lists/ListsSpecs/schema.js +3 -2
  42. package/build/cjs/extensions/markdown/Lists/ListsSpecs/schema.js.map +1 -1
  43. package/build/cjs/extensions/markdown/Table/TableSpecs/const.d.ts +2 -1
  44. package/build/cjs/extensions/markdown/Table/TableSpecs/const.js +1 -0
  45. package/build/cjs/extensions/markdown/Table/TableSpecs/const.js.map +1 -1
  46. package/build/cjs/extensions/markdown/Table/TableSpecs/parser.js +9 -1
  47. package/build/cjs/extensions/markdown/Table/TableSpecs/parser.js.map +1 -1
  48. package/build/cjs/extensions/markdown/Table/TableSpecs/schema.js +3 -2
  49. package/build/cjs/extensions/markdown/Table/TableSpecs/schema.js.map +1 -1
  50. package/build/cjs/extensions/yfm/Checkbox/CheckboxSpecs/const.d.ts +1 -0
  51. package/build/cjs/extensions/yfm/Checkbox/CheckboxSpecs/const.js +1 -0
  52. package/build/cjs/extensions/yfm/Checkbox/CheckboxSpecs/const.js.map +1 -1
  53. package/build/cjs/extensions/yfm/Checkbox/CheckboxSpecs/schema.js +30 -17
  54. package/build/cjs/extensions/yfm/Checkbox/CheckboxSpecs/schema.js.map +1 -1
  55. package/build/cjs/extensions/yfm/YfmCut/YfmCutSpecs/const.d.ts +1 -0
  56. package/build/cjs/extensions/yfm/YfmCut/YfmCutSpecs/const.js +1 -0
  57. package/build/cjs/extensions/yfm/YfmCut/YfmCutSpecs/const.js.map +1 -1
  58. package/build/cjs/extensions/yfm/YfmCut/YfmCutSpecs/parser.js +14 -1
  59. package/build/cjs/extensions/yfm/YfmCut/YfmCutSpecs/parser.js.map +1 -1
  60. package/build/cjs/extensions/yfm/YfmCut/YfmCutSpecs/schema.js +4 -1
  61. package/build/cjs/extensions/yfm/YfmCut/YfmCutSpecs/schema.js.map +1 -1
  62. package/build/cjs/extensions/yfm/YfmCut/const.d.ts +1 -1
  63. package/build/cjs/extensions/yfm/YfmCut/const.js +2 -1
  64. package/build/cjs/extensions/yfm/YfmCut/const.js.map +1 -1
  65. package/build/cjs/extensions/yfm/YfmCut/nodeviews/yfm-cut-title.js +10 -0
  66. package/build/cjs/extensions/yfm/YfmCut/nodeviews/yfm-cut-title.js.map +1 -1
  67. package/build/cjs/extensions/yfm/YfmNote/YfmNoteSpecs/const.d.ts +2 -1
  68. package/build/cjs/extensions/yfm/YfmNote/YfmNoteSpecs/const.js +1 -0
  69. package/build/cjs/extensions/yfm/YfmNote/YfmNoteSpecs/const.js.map +1 -1
  70. package/build/cjs/extensions/yfm/YfmNote/YfmNoteSpecs/parser.js +14 -1
  71. package/build/cjs/extensions/yfm/YfmNote/YfmNoteSpecs/parser.js.map +1 -1
  72. package/build/cjs/extensions/yfm/YfmNote/YfmNoteSpecs/schema.js +3 -2
  73. package/build/cjs/extensions/yfm/YfmNote/YfmNoteSpecs/schema.js.map +1 -1
  74. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenu/FloatingMenu.d.ts +2 -1
  75. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenu/FloatingMenu.js.map +1 -1
  76. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/FloatingMenuControl.d.ts +5 -2
  77. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/FloatingMenuControl.js +59 -2
  78. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/FloatingMenuControl.js.map +1 -1
  79. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/FloatingPlusButton.d.ts +4 -2
  80. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/FloatingPlusButton.js +3 -4
  81. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/FloatingPlusButton.js.map +1 -1
  82. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusControl/FloatingPlusControl.d.ts +3 -1
  83. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusControl/FloatingPlusControl.js +36 -1
  84. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusControl/FloatingPlusControl.js.map +1 -1
  85. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/FloatingPopup.d.ts +13 -1
  86. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/FloatingPopup.js +7 -10
  87. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/FloatingPopup.js.map +1 -1
  88. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-drop-cursor.d.ts +3 -0
  89. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-drop-cursor.js +39 -1
  90. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-drop-cursor.js.map +1 -1
  91. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-ghost.js +9 -4
  92. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-ghost.js.map +1 -1
  93. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd.js +1 -1
  94. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd.js.map +1 -1
  95. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/hooks/use-raf-throttle.d.ts +1 -0
  96. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/hooks/use-raf-throttle.js +25 -0
  97. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/hooks/use-raf-throttle.js.map +1 -0
  98. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/nodeviews/yfm-table-cell-view.js +4 -2
  99. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/nodeviews/yfm-table-cell-view.js.map +1 -1
  100. package/build/cjs/i18n/codeblock/en.json +2 -1
  101. package/build/cjs/i18n/codeblock/index.d.ts +2 -1
  102. package/build/cjs/i18n/codeblock/ru.json +2 -1
  103. package/build/cjs/styles/styles.css +289 -0
  104. package/build/cjs/styles/yfm-themes.css +288 -0
  105. package/build/cjs/table-utils/table-desc.d.ts +1 -0
  106. package/build/cjs/table-utils/table-desc.js +3 -0
  107. package/build/cjs/table-utils/table-desc.js.map +1 -1
  108. package/build/cjs/utils/index.d.ts +1 -0
  109. package/build/cjs/utils/index.js +1 -0
  110. package/build/cjs/utils/index.js.map +1 -1
  111. package/build/cjs/utils/node-descedants.d.ts +10 -0
  112. package/build/cjs/utils/node-descedants.js +23 -0
  113. package/build/cjs/utils/node-descedants.js.map +1 -0
  114. package/build/cjs/version.js +1 -1
  115. package/build/cjs/version.js.map +1 -1
  116. package/build/cjs/view/hocs/withYfmHtml/index.d.ts +1 -0
  117. package/build/cjs/view/hocs/withYfmHtml/index.js +3 -0
  118. package/build/cjs/view/hocs/withYfmHtml/index.js.map +1 -1
  119. package/build/cjs/view/hocs/withYfmHtml/useYfmHtmlBlockRuntime.d.ts +5 -1
  120. package/build/cjs/view/hocs/withYfmHtml/useYfmHtmlBlockRuntime.js +8 -1
  121. package/build/cjs/view/hocs/withYfmHtml/useYfmHtmlBlockRuntime.js.map +1 -1
  122. package/build/esm/bundle/Editor.js +56 -23
  123. package/build/esm/bundle/Editor.js.map +1 -1
  124. package/build/esm/extensions/additional/Math/const.d.ts +1 -0
  125. package/build/esm/extensions/additional/Math/const.js +10 -0
  126. package/build/esm/extensions/additional/Math/const.js.map +1 -1
  127. package/build/esm/extensions/additional/Math/index.d.ts +1 -0
  128. package/build/esm/extensions/additional/Math/index.js +3 -0
  129. package/build/esm/extensions/additional/Math/index.js.map +1 -1
  130. package/build/esm/extensions/additional/Math/latex-paste-plugin.d.ts +2 -0
  131. package/build/esm/extensions/additional/Math/latex-paste-plugin.js +50 -0
  132. package/build/esm/extensions/additional/Math/latex-paste-plugin.js.map +1 -0
  133. package/build/esm/extensions/additional/Math/utils.d.ts +7 -0
  134. package/build/esm/extensions/additional/Math/utils.js +39 -0
  135. package/build/esm/extensions/additional/Math/utils.js.map +1 -0
  136. package/build/esm/extensions/markdown/CodeBlock/CodeBlockHighlight/CodeBlockHighlight.css +8 -0
  137. package/build/esm/extensions/markdown/CodeBlock/CodeBlockHighlight/CodeBlockHighlight.d.ts +3 -0
  138. package/build/esm/extensions/markdown/CodeBlock/CodeBlockHighlight/CodeBlockHighlight.js +80 -12
  139. package/build/esm/extensions/markdown/CodeBlock/CodeBlockHighlight/CodeBlockHighlight.js.map +1 -1
  140. package/build/esm/extensions/markdown/CodeBlock/CodeBlockHighlight/TooltipPlugin/TooltipView.css +4 -0
  141. package/build/esm/extensions/markdown/CodeBlock/CodeBlockHighlight/TooltipPlugin/index.d.ts +1 -1
  142. package/build/esm/extensions/markdown/CodeBlock/CodeBlockHighlight/TooltipPlugin/index.js +54 -29
  143. package/build/esm/extensions/markdown/CodeBlock/CodeBlockHighlight/TooltipPlugin/index.js.map +1 -1
  144. package/build/esm/extensions/markdown/CodeBlock/CodeBlockSpecs/index.d.ts +7 -0
  145. package/build/esm/extensions/markdown/CodeBlock/CodeBlockSpecs/index.js +36 -2
  146. package/build/esm/extensions/markdown/CodeBlock/CodeBlockSpecs/index.js.map +1 -1
  147. package/build/esm/extensions/markdown/CodeBlock/index.d.ts +2 -1
  148. package/build/esm/extensions/markdown/CodeBlock/index.js +21 -6
  149. package/build/esm/extensions/markdown/CodeBlock/index.js.map +1 -1
  150. package/build/esm/extensions/markdown/Deflist/DeflistSpecs/const.d.ts +3 -0
  151. package/build/esm/extensions/markdown/Deflist/DeflistSpecs/const.js +3 -0
  152. package/build/esm/extensions/markdown/Deflist/DeflistSpecs/const.js.map +1 -1
  153. package/build/esm/extensions/markdown/Deflist/DeflistSpecs/parser.js +10 -2
  154. package/build/esm/extensions/markdown/Deflist/DeflistSpecs/parser.js.map +1 -1
  155. package/build/esm/extensions/markdown/Deflist/DeflistSpecs/schema.js +4 -3
  156. package/build/esm/extensions/markdown/Deflist/DeflistSpecs/schema.js.map +1 -1
  157. package/build/esm/extensions/markdown/Lists/ListsSpecs/const.d.ts +2 -1
  158. package/build/esm/extensions/markdown/Lists/ListsSpecs/const.js +1 -0
  159. package/build/esm/extensions/markdown/Lists/ListsSpecs/const.js.map +1 -1
  160. package/build/esm/extensions/markdown/Lists/ListsSpecs/parser.js +4 -1
  161. package/build/esm/extensions/markdown/Lists/ListsSpecs/parser.js.map +1 -1
  162. package/build/esm/extensions/markdown/Lists/ListsSpecs/schema.js +3 -2
  163. package/build/esm/extensions/markdown/Lists/ListsSpecs/schema.js.map +1 -1
  164. package/build/esm/extensions/markdown/Table/TableSpecs/const.d.ts +2 -1
  165. package/build/esm/extensions/markdown/Table/TableSpecs/const.js +1 -0
  166. package/build/esm/extensions/markdown/Table/TableSpecs/const.js.map +1 -1
  167. package/build/esm/extensions/markdown/Table/TableSpecs/parser.js +9 -1
  168. package/build/esm/extensions/markdown/Table/TableSpecs/parser.js.map +1 -1
  169. package/build/esm/extensions/markdown/Table/TableSpecs/schema.js +3 -2
  170. package/build/esm/extensions/markdown/Table/TableSpecs/schema.js.map +1 -1
  171. package/build/esm/extensions/yfm/Checkbox/CheckboxSpecs/const.d.ts +1 -0
  172. package/build/esm/extensions/yfm/Checkbox/CheckboxSpecs/const.js +1 -0
  173. package/build/esm/extensions/yfm/Checkbox/CheckboxSpecs/const.js.map +1 -1
  174. package/build/esm/extensions/yfm/Checkbox/CheckboxSpecs/schema.js +30 -17
  175. package/build/esm/extensions/yfm/Checkbox/CheckboxSpecs/schema.js.map +1 -1
  176. package/build/esm/extensions/yfm/YfmCut/YfmCutSpecs/const.d.ts +1 -0
  177. package/build/esm/extensions/yfm/YfmCut/YfmCutSpecs/const.js +1 -0
  178. package/build/esm/extensions/yfm/YfmCut/YfmCutSpecs/const.js.map +1 -1
  179. package/build/esm/extensions/yfm/YfmCut/YfmCutSpecs/parser.js +14 -1
  180. package/build/esm/extensions/yfm/YfmCut/YfmCutSpecs/parser.js.map +1 -1
  181. package/build/esm/extensions/yfm/YfmCut/YfmCutSpecs/schema.js +4 -1
  182. package/build/esm/extensions/yfm/YfmCut/YfmCutSpecs/schema.js.map +1 -1
  183. package/build/esm/extensions/yfm/YfmCut/const.d.ts +1 -1
  184. package/build/esm/extensions/yfm/YfmCut/const.js +1 -1
  185. package/build/esm/extensions/yfm/YfmCut/const.js.map +1 -1
  186. package/build/esm/extensions/yfm/YfmCut/nodeviews/yfm-cut-title.js +11 -1
  187. package/build/esm/extensions/yfm/YfmCut/nodeviews/yfm-cut-title.js.map +1 -1
  188. package/build/esm/extensions/yfm/YfmNote/YfmNoteSpecs/const.d.ts +2 -1
  189. package/build/esm/extensions/yfm/YfmNote/YfmNoteSpecs/const.js +1 -0
  190. package/build/esm/extensions/yfm/YfmNote/YfmNoteSpecs/const.js.map +1 -1
  191. package/build/esm/extensions/yfm/YfmNote/YfmNoteSpecs/parser.js +15 -2
  192. package/build/esm/extensions/yfm/YfmNote/YfmNoteSpecs/parser.js.map +1 -1
  193. package/build/esm/extensions/yfm/YfmNote/YfmNoteSpecs/schema.js +3 -2
  194. package/build/esm/extensions/yfm/YfmNote/YfmNoteSpecs/schema.js.map +1 -1
  195. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenu/FloatingMenu.d.ts +2 -1
  196. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenu/FloatingMenu.js.map +1 -1
  197. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/FloatingMenuControl.d.ts +5 -2
  198. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/FloatingMenuControl.js +59 -2
  199. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/FloatingMenuControl.js.map +1 -1
  200. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/FloatingPlusButton.d.ts +4 -2
  201. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/FloatingPlusButton.js +4 -4
  202. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/FloatingPlusButton.js.map +1 -1
  203. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusControl/FloatingPlusControl.d.ts +3 -1
  204. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusControl/FloatingPlusControl.js +38 -3
  205. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusControl/FloatingPlusControl.js.map +1 -1
  206. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/FloatingPopup.d.ts +13 -1
  207. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/FloatingPopup.js +8 -10
  208. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/FloatingPopup.js.map +1 -1
  209. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-drop-cursor.d.ts +3 -0
  210. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-drop-cursor.js +38 -1
  211. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-drop-cursor.js.map +1 -1
  212. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-ghost.js +9 -4
  213. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-ghost.js.map +1 -1
  214. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd.js +2 -2
  215. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd.js.map +1 -1
  216. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/hooks/use-raf-throttle.d.ts +1 -0
  217. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/hooks/use-raf-throttle.js +22 -0
  218. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/hooks/use-raf-throttle.js.map +1 -0
  219. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/nodeviews/yfm-table-cell-view.js +4 -2
  220. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/nodeviews/yfm-table-cell-view.js.map +1 -1
  221. package/build/esm/i18n/codeblock/en.json +2 -1
  222. package/build/esm/i18n/codeblock/index.d.ts +2 -1
  223. package/build/esm/i18n/codeblock/ru.json +2 -1
  224. package/build/esm/styles/styles.css +289 -0
  225. package/build/esm/styles/yfm-themes.css +288 -0
  226. package/build/esm/table-utils/table-desc.d.ts +1 -0
  227. package/build/esm/table-utils/table-desc.js +3 -0
  228. package/build/esm/table-utils/table-desc.js.map +1 -1
  229. package/build/esm/utils/index.d.ts +1 -0
  230. package/build/esm/utils/index.js +1 -0
  231. package/build/esm/utils/index.js.map +1 -1
  232. package/build/esm/utils/node-descedants.d.ts +10 -0
  233. package/build/esm/utils/node-descedants.js +19 -0
  234. package/build/esm/utils/node-descedants.js.map +1 -0
  235. package/build/esm/version.js +1 -1
  236. package/build/esm/version.js.map +1 -1
  237. package/build/esm/view/hocs/withYfmHtml/index.d.ts +1 -0
  238. package/build/esm/view/hocs/withYfmHtml/index.js +1 -0
  239. package/build/esm/view/hocs/withYfmHtml/index.js.map +1 -1
  240. package/build/esm/view/hocs/withYfmHtml/useYfmHtmlBlockRuntime.d.ts +5 -1
  241. package/build/esm/view/hocs/withYfmHtml/useYfmHtmlBlockRuntime.js +7 -1
  242. package/build/esm/view/hocs/withYfmHtml/useYfmHtmlBlockRuntime.js.map +1 -1
  243. package/build/styles.css +589 -0
  244. package/package.json +10 -9
@@ -0,0 +1,288 @@
1
+ .yfm {
2
+ --yfm-color-base: var(--g-color-base-background);
3
+ --yfm-color-text: var(--g-color-text-primary);
4
+ --yfm-color-link: var(--g-color-text-link);
5
+ --yfm-color-link-hover: var(--g-color-text-link-hover);
6
+ --yfm-color-border: var(--g-color-line-generic);
7
+ --yfm-color-accent: var(--g-color-line-brand);
8
+ --yfm-color-inline-code: var(--g-color-text-misc);
9
+ --yfm-color-inline-code-background: var(--g-color-base-misc-light);
10
+ --yfm-color-code-background: var(--g-color-base-misc-light);
11
+ --yfm-color-note-tip: var(--g-color-text-positive);
12
+ --yfm-color-note-tip-background: var(--g-color-base-positive-light);
13
+ --yfm-color-note-warning: var(--g-color-text-warning);
14
+ --yfm-color-note-warning-background: var(--g-color-base-warning-light);
15
+ --yfm-color-note-important: var(--g-color-text-danger);
16
+ --yfm-color-note-important-background: var(--g-color-base-danger-light);
17
+ --yfm-color-note-info: var(--g-color-text-info);
18
+ --yfm-color-note-info-background: var(--g-color-base-info-light);
19
+ --yfm-color-term-title: var(--g-color-text-brand);
20
+ --yfm-color-term-title-hover: var(--g-color-text-brand-heavy);
21
+ --yfm-color-term-dfn-background: var(--g-color-base-float);
22
+ --yfm-color-term-dfn-shadow: var(--g-color-sfx-shadow);
23
+ --yfm-color-term-dfn-pseudo-shadow: var(--g-color-line-generic);
24
+ --yfm-color-modal-content: var(--g-color-base-modal);
25
+ --yfm-color-modal-actions-hover: var(--g-color-base-simple-hover);
26
+ --yfm-color-modal-wide-content: var(--g-color-text-primary);
27
+ --yfm-color-modal-wide-content-overlay: var(--g-color-sfx-veil);
28
+ --yfm-color-table: var(--g-color-text-primary);
29
+ --yfm-color-table-row-background: var(--g-color-base-generic);
30
+ --yfm-color-table-border: var(--g-color-line-generic);
31
+ --yfm-color-table-background: var(--g-color-base-background);
32
+ --yfm-color-table-head-background: var(--g-color-base-generic);
33
+ --yfm-color-table-stripe-row-background: var(--g-color-base-generic);
34
+ }
35
+
36
+ .yfm {
37
+ --yfm-color-base: var(--g-color-base-background);
38
+ --yfm-color-text: var(--g-color-text-primary);
39
+ --yfm-color-link: var(--g-color-text-link);
40
+ --yfm-color-link-hover: var(--g-color-text-link-hover);
41
+ --yfm-color-border: var(--g-color-line-generic);
42
+ --yfm-color-accent: var(--g-color-line-brand);
43
+ --yfm-color-inline-code: var(--g-color-text-misc);
44
+ --yfm-color-inline-code-background: var(--g-color-base-misc-light);
45
+ --yfm-color-code-background: var(--g-color-base-misc-light);
46
+ --yfm-color-note-tip: var(--g-color-text-positive);
47
+ --yfm-color-note-tip-background: var(--g-color-base-positive-light);
48
+ --yfm-color-note-warning: var(--g-color-text-warning);
49
+ --yfm-color-note-warning-background: var(--g-color-base-warning-light);
50
+ --yfm-color-note-important: var(--g-color-text-danger);
51
+ --yfm-color-note-important-background: var(--g-color-base-danger-light);
52
+ --yfm-color-note-info: var(--g-color-text-info);
53
+ --yfm-color-note-info-background: var(--g-color-base-info-light);
54
+ --yfm-color-term-title: var(--g-color-text-brand);
55
+ --yfm-color-term-title-hover: var(--g-color-text-brand-heavy);
56
+ --yfm-color-term-dfn-background: var(--g-color-base-float);
57
+ --yfm-color-term-dfn-shadow: var(--g-color-sfx-shadow);
58
+ --yfm-color-term-dfn-pseudo-shadow: var(--g-color-line-generic);
59
+ --yfm-color-modal-content: var(--g-color-base-modal);
60
+ --yfm-color-modal-actions-hover: var(--g-color-base-simple-hover);
61
+ --yfm-color-modal-wide-content: var(--g-color-text-primary);
62
+ --yfm-color-modal-wide-content-overlay: var(--g-color-sfx-veil);
63
+ --yfm-color-table: var(--g-color-text-primary);
64
+ --yfm-color-table-row-background: var(--g-color-base-generic);
65
+ --yfm-color-table-border: var(--g-color-line-generic);
66
+ --yfm-color-table-background: var(--g-color-base-background);
67
+ --yfm-color-table-head-background: var(--g-color-base-generic);
68
+ --yfm-color-table-stripe-row-background: var(--g-color-base-generic);
69
+ }
70
+
71
+ .yfm {
72
+ --yfm-color-base: var(--g-color-base-background);
73
+ --yfm-color-text: var(--g-color-text-primary);
74
+ --yfm-color-link: var(--g-color-text-link);
75
+ --yfm-color-link-hover: var(--g-color-text-link-hover);
76
+ --yfm-color-border: var(--g-color-line-generic);
77
+ --yfm-color-accent: var(--g-color-line-brand);
78
+ --yfm-color-inline-code: var(--g-color-text-misc);
79
+ --yfm-color-inline-code-background: var(--g-color-base-misc-light);
80
+ --yfm-color-code-background: var(--g-color-base-misc-light);
81
+ --yfm-color-note-tip: var(--g-color-text-positive);
82
+ --yfm-color-note-tip-background: var(--g-color-base-positive-light);
83
+ --yfm-color-note-warning: var(--g-color-text-warning);
84
+ --yfm-color-note-warning-background: var(--g-color-base-warning-light);
85
+ --yfm-color-note-important: var(--g-color-text-danger);
86
+ --yfm-color-note-important-background: var(--g-color-base-danger-light);
87
+ --yfm-color-note-info: var(--g-color-text-info);
88
+ --yfm-color-note-info-background: var(--g-color-base-info-light);
89
+ --yfm-color-term-title: var(--g-color-text-brand);
90
+ --yfm-color-term-title-hover: var(--g-color-text-brand-heavy);
91
+ --yfm-color-term-dfn-background: var(--g-color-base-float);
92
+ --yfm-color-term-dfn-shadow: var(--g-color-sfx-shadow);
93
+ --yfm-color-term-dfn-pseudo-shadow: var(--g-color-line-generic);
94
+ --yfm-color-modal-content: var(--g-color-base-modal);
95
+ --yfm-color-modal-actions-hover: var(--g-color-base-simple-hover);
96
+ --yfm-color-modal-wide-content: var(--g-color-text-primary);
97
+ --yfm-color-modal-wide-content-overlay: var(--g-color-sfx-veil);
98
+ --yfm-color-table: var(--g-color-text-primary);
99
+ --yfm-color-table-row-background: var(--g-color-base-generic);
100
+ --yfm-color-table-border: var(--g-color-line-generic);
101
+ --yfm-color-table-background: var(--g-color-base-background);
102
+ --yfm-color-table-head-background: var(--g-color-base-generic);
103
+ --yfm-color-table-stripe-row-background: var(--g-color-base-generic);
104
+ }
105
+
106
+ .yfm {
107
+ --yfm-color-base: var(--g-color-base-background);
108
+ --yfm-color-text: var(--g-color-text-primary);
109
+ --yfm-color-link: var(--g-color-text-link);
110
+ --yfm-color-link-hover: var(--g-color-text-link-hover);
111
+ --yfm-color-border: var(--g-color-line-generic);
112
+ --yfm-color-accent: var(--g-color-line-brand);
113
+ --yfm-color-inline-code: var(--g-color-text-misc);
114
+ --yfm-color-inline-code-background: var(--g-color-base-misc-light);
115
+ --yfm-color-code-background: var(--g-color-base-misc-light);
116
+ --yfm-color-note-tip: var(--g-color-text-positive);
117
+ --yfm-color-note-tip-background: var(--g-color-base-positive-light);
118
+ --yfm-color-note-warning: var(--g-color-text-warning);
119
+ --yfm-color-note-warning-background: var(--g-color-base-warning-light);
120
+ --yfm-color-note-important: var(--g-color-text-danger);
121
+ --yfm-color-note-important-background: var(--g-color-base-danger-light);
122
+ --yfm-color-note-info: var(--g-color-text-info);
123
+ --yfm-color-note-info-background: var(--g-color-base-info-light);
124
+ --yfm-color-term-title: var(--g-color-text-brand);
125
+ --yfm-color-term-title-hover: var(--g-color-text-brand-heavy);
126
+ --yfm-color-term-dfn-background: var(--g-color-base-float);
127
+ --yfm-color-term-dfn-shadow: var(--g-color-sfx-shadow);
128
+ --yfm-color-term-dfn-pseudo-shadow: var(--g-color-line-generic);
129
+ --yfm-color-modal-content: var(--g-color-base-modal);
130
+ --yfm-color-modal-actions-hover: var(--g-color-base-simple-hover);
131
+ --yfm-color-modal-wide-content: var(--g-color-text-primary);
132
+ --yfm-color-modal-wide-content-overlay: var(--g-color-sfx-veil);
133
+ --yfm-color-table: var(--g-color-text-primary);
134
+ --yfm-color-table-row-background: var(--g-color-base-generic);
135
+ --yfm-color-table-border: var(--g-color-line-generic);
136
+ --yfm-color-table-background: var(--g-color-base-background);
137
+ --yfm-color-table-head-background: var(--g-color-base-generic);
138
+ --yfm-color-table-stripe-row-background: var(--g-color-base-generic);
139
+ }
140
+
141
+ .g-root_theme_light .yfm {
142
+ --yfm-color-base: var(--g-color-base-background);
143
+ --yfm-color-text: var(--g-color-text-primary);
144
+ --yfm-color-link: var(--g-color-text-link);
145
+ --yfm-color-link-hover: var(--g-color-text-link-hover);
146
+ --yfm-color-border: var(--g-color-line-generic);
147
+ --yfm-color-accent: var(--g-color-line-brand);
148
+ --yfm-color-inline-code: var(--g-color-text-misc);
149
+ --yfm-color-inline-code-background: var(--g-color-base-misc-light);
150
+ --yfm-color-code-background: var(--g-color-base-misc-light);
151
+ --yfm-color-note-tip: var(--g-color-text-positive);
152
+ --yfm-color-note-tip-background: var(--g-color-base-positive-light);
153
+ --yfm-color-note-warning: var(--g-color-text-warning);
154
+ --yfm-color-note-warning-background: var(--g-color-base-warning-light);
155
+ --yfm-color-note-important: var(--g-color-text-danger);
156
+ --yfm-color-note-important-background: var(--g-color-base-danger-light);
157
+ --yfm-color-note-info: var(--g-color-text-info);
158
+ --yfm-color-note-info-background: var(--g-color-base-info-light);
159
+ --yfm-color-term-title: var(--g-color-text-brand);
160
+ --yfm-color-term-title-hover: var(--g-color-text-brand-heavy);
161
+ --yfm-color-term-dfn-background: var(--g-color-base-float);
162
+ --yfm-color-term-dfn-shadow: var(--g-color-sfx-shadow);
163
+ --yfm-color-term-dfn-pseudo-shadow: var(--g-color-line-generic);
164
+ --yfm-color-modal-content: var(--g-color-base-modal);
165
+ --yfm-color-modal-actions-hover: var(--g-color-base-simple-hover);
166
+ --yfm-color-modal-wide-content: var(--g-color-text-primary);
167
+ --yfm-color-modal-wide-content-overlay: var(--g-color-sfx-veil);
168
+ --yfm-color-table: var(--g-color-text-primary);
169
+ --yfm-color-table-row-background: var(--g-color-base-generic);
170
+ --yfm-color-table-border: var(--g-color-line-generic);
171
+ --yfm-color-table-background: var(--g-color-base-background);
172
+ --yfm-color-table-head-background: var(--g-color-base-generic);
173
+ --yfm-color-table-stripe-row-background: var(--g-color-base-generic);
174
+ }
175
+
176
+ .g-root_theme_light-hc .yfm {
177
+ --yfm-color-base: var(--g-color-base-background);
178
+ --yfm-color-text: var(--g-color-text-primary);
179
+ --yfm-color-link: var(--g-color-text-link);
180
+ --yfm-color-link-hover: var(--g-color-text-link-hover);
181
+ --yfm-color-border: var(--g-color-line-generic);
182
+ --yfm-color-accent: var(--g-color-line-brand);
183
+ --yfm-color-inline-code: var(--g-color-text-misc);
184
+ --yfm-color-inline-code-background: var(--g-color-base-misc-light);
185
+ --yfm-color-code-background: var(--g-color-base-misc-light);
186
+ --yfm-color-note-tip: var(--g-color-text-positive);
187
+ --yfm-color-note-tip-background: var(--g-color-base-positive-light);
188
+ --yfm-color-note-warning: var(--g-color-text-warning);
189
+ --yfm-color-note-warning-background: var(--g-color-base-warning-light);
190
+ --yfm-color-note-important: var(--g-color-text-danger);
191
+ --yfm-color-note-important-background: var(--g-color-base-danger-light);
192
+ --yfm-color-note-info: var(--g-color-text-info);
193
+ --yfm-color-note-info-background: var(--g-color-base-info-light);
194
+ --yfm-color-term-title: var(--g-color-text-brand);
195
+ --yfm-color-term-title-hover: var(--g-color-text-brand-heavy);
196
+ --yfm-color-term-dfn-background: var(--g-color-base-float);
197
+ --yfm-color-term-dfn-shadow: var(--g-color-sfx-shadow);
198
+ --yfm-color-term-dfn-pseudo-shadow: var(--g-color-line-generic);
199
+ --yfm-color-modal-content: var(--g-color-base-modal);
200
+ --yfm-color-modal-actions-hover: var(--g-color-base-simple-hover);
201
+ --yfm-color-modal-wide-content: var(--g-color-text-primary);
202
+ --yfm-color-modal-wide-content-overlay: var(--g-color-sfx-veil);
203
+ --yfm-color-table: var(--g-color-text-primary);
204
+ --yfm-color-table-row-background: var(--g-color-base-generic);
205
+ --yfm-color-table-border: var(--g-color-line-generic);
206
+ --yfm-color-table-background: var(--g-color-base-background);
207
+ --yfm-color-table-head-background: var(--g-color-base-generic);
208
+ --yfm-color-table-stripe-row-background: var(--g-color-base-generic);
209
+ }
210
+
211
+ .g-root_theme_dark .yfm {
212
+ --yfm-color-base: var(--g-color-base-background);
213
+ --yfm-color-text: var(--g-color-text-primary);
214
+ --yfm-color-link: var(--g-color-text-link);
215
+ --yfm-color-link-hover: var(--g-color-text-link-hover);
216
+ --yfm-color-border: var(--g-color-line-generic);
217
+ --yfm-color-accent: var(--g-color-line-brand);
218
+ --yfm-color-inline-code: var(--g-color-text-misc);
219
+ --yfm-color-inline-code-background: var(--g-color-base-misc-light);
220
+ --yfm-color-code-background: var(--g-color-base-misc-light);
221
+ --yfm-color-note-tip: var(--g-color-text-positive);
222
+ --yfm-color-note-tip-background: var(--g-color-base-positive-light);
223
+ --yfm-color-note-warning: var(--g-color-text-warning);
224
+ --yfm-color-note-warning-background: var(--g-color-base-warning-light);
225
+ --yfm-color-note-important: var(--g-color-text-danger);
226
+ --yfm-color-note-important-background: var(--g-color-base-danger-light);
227
+ --yfm-color-note-info: var(--g-color-text-info);
228
+ --yfm-color-note-info-background: var(--g-color-base-info-light);
229
+ --yfm-color-term-title: var(--g-color-text-brand);
230
+ --yfm-color-term-title-hover: var(--g-color-text-brand-heavy);
231
+ --yfm-color-term-dfn-background: var(--g-color-base-float);
232
+ --yfm-color-term-dfn-shadow: var(--g-color-sfx-shadow);
233
+ --yfm-color-term-dfn-pseudo-shadow: var(--g-color-line-generic);
234
+ --yfm-color-modal-content: var(--g-color-base-modal);
235
+ --yfm-color-modal-actions-hover: var(--g-color-base-simple-hover);
236
+ --yfm-color-modal-wide-content: var(--g-color-text-primary);
237
+ --yfm-color-modal-wide-content-overlay: var(--g-color-sfx-veil);
238
+ --yfm-color-table: var(--g-color-text-primary);
239
+ --yfm-color-table-row-background: var(--g-color-base-generic);
240
+ --yfm-color-table-border: var(--g-color-line-generic);
241
+ --yfm-color-table-background: var(--g-color-base-background);
242
+ --yfm-color-table-head-background: var(--g-color-base-generic);
243
+ --yfm-color-table-stripe-row-background: var(--g-color-base-generic);
244
+ }
245
+ .g-root_theme_dark .yfm table[sticky-header] th::before {
246
+ background: var(--yfm-color-base);
247
+ }
248
+ .g-root_theme_dark .yfm .yfm-cut-title:before {
249
+ background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiI+PHBhdGggc3Ryb2tlPSJyZ2JhKDI1NSwgMjU1LCAyNTUsIDAuNykiIGZpbGw9Im5vbmUiIGQ9Ik0zIDZsNSA1IDUtNSI+PC9wYXRoPjwvc3ZnPg==");
250
+ }
251
+ .g-root_theme_dark .yfm .yfm-tabs-accordion .yfm-tab:after {
252
+ background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiI+PHBhdGggc3Ryb2tlPSJyZ2JhKDI1NSwgMjU1LCAyNTUsIDAuNykiIGZpbGw9Im5vbmUiIGQ9Ik0zIDZsNSA1IDUtNSI+PC9wYXRoPjwvc3ZnPg==");
253
+ }
254
+
255
+ .g-root_theme_dark-hc .yfm {
256
+ --yfm-color-base: var(--g-color-base-background);
257
+ --yfm-color-text: var(--g-color-text-primary);
258
+ --yfm-color-link: var(--g-color-text-link);
259
+ --yfm-color-link-hover: var(--g-color-text-link-hover);
260
+ --yfm-color-border: var(--g-color-line-generic);
261
+ --yfm-color-accent: var(--g-color-line-brand);
262
+ --yfm-color-inline-code: var(--g-color-text-misc);
263
+ --yfm-color-inline-code-background: var(--g-color-base-misc-light);
264
+ --yfm-color-code-background: var(--g-color-base-misc-light);
265
+ --yfm-color-note-tip: var(--g-color-text-positive);
266
+ --yfm-color-note-tip-background: var(--g-color-base-positive-light);
267
+ --yfm-color-note-warning: var(--g-color-text-warning);
268
+ --yfm-color-note-warning-background: var(--g-color-base-warning-light);
269
+ --yfm-color-note-important: var(--g-color-text-danger);
270
+ --yfm-color-note-important-background: var(--g-color-base-danger-light);
271
+ --yfm-color-note-info: var(--g-color-text-info);
272
+ --yfm-color-note-info-background: var(--g-color-base-info-light);
273
+ --yfm-color-term-title: var(--g-color-text-brand);
274
+ --yfm-color-term-title-hover: var(--g-color-text-brand-heavy);
275
+ --yfm-color-term-dfn-background: var(--g-color-base-float);
276
+ --yfm-color-term-dfn-shadow: var(--g-color-sfx-shadow);
277
+ --yfm-color-term-dfn-pseudo-shadow: var(--g-color-line-generic);
278
+ --yfm-color-modal-content: var(--g-color-base-modal);
279
+ --yfm-color-modal-actions-hover: var(--g-color-base-simple-hover);
280
+ --yfm-color-modal-wide-content: var(--g-color-text-primary);
281
+ --yfm-color-modal-wide-content-overlay: var(--g-color-sfx-veil);
282
+ --yfm-color-table: var(--g-color-text-primary);
283
+ --yfm-color-table-row-background: var(--g-color-base-generic);
284
+ --yfm-color-table-border: var(--g-color-line-generic);
285
+ --yfm-color-table-background: var(--g-color-base-background);
286
+ --yfm-color-table-head-background: var(--g-color-base-generic);
287
+ --yfm-color-table-stripe-row-background: var(--g-color-base-generic);
288
+ }
@@ -85,6 +85,7 @@ export declare class TableDesc {
85
85
  declare class TableDescBinded {
86
86
  readonly pos: number;
87
87
  readonly base: TableDesc;
88
+ get bodyPos(): number;
88
89
  get rows(): number;
89
90
  get cols(): number;
90
91
  constructor(pos: number, desc: TableDesc);
@@ -284,6 +284,9 @@ exports.TableDesc = TableDesc;
284
284
  class TableDescBinded {
285
285
  pos;
286
286
  base;
287
+ get bodyPos() {
288
+ return this.pos + 1;
289
+ }
287
290
  get rows() {
288
291
  return this.base.rows;
289
292
  }
@@ -1 +1 @@
1
- {"version":3,"file":"table-desc.js","sourceRoot":"../../../src","sources":["table-utils/table-desc.ts"],"names":[],"mappings":";;;;AAAA,kEAAiC;AAGjC,sCAAqD;AAoDrD,MAAa,SAAS;IAyFL;IACA;IACA;IACA;IA3FL,MAAM,CAAC,OAAO,GAAG,IAAI,OAAO,EAAmB,CAAC;IAExD,MAAM,CAAC,MAAM,CAAC,KAAW;QACrB,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC;QAE7D,IAAI,CAAC,IAAA,mBAAW,EAAC,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QACrC,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC;QAC9B,IAAI,CAAC,KAAK,IAAI,CAAC,IAAA,uBAAe,EAAC,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QAEnD,wBAAwB;QACxB,MAAM,UAAU,GAAG,CAAC,CAAC;QAErB,MAAM,IAAI,GAAmB,EAAE,CAAC;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;YAC3B,IAAI,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAC,CAAC,CAAC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,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;YACtC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC;QACpD,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ","sourcesContent":["import isNumber from 'is-number';\nimport type {Node} from 'prosemirror-model';\n\nimport {isTableBodyNode, isTableNode} from './utils';\n\n// TableDesc creates a virtual table description containing info about real and virtual cells needed for correct table operations.\n// This description is cached.\n// At the same time, positions of rows and cells may change, so a separate class (TableDescBinded) has been added\n// to work with absolute (relative to the document) positions.\n// Ranges are also added for more comprehensive operations with rows and columns.\n\nexport type TableCellRealDesc = {\n type: 'real';\n offset: number;\n node: Node;\n colspan?: number;\n rowspan?: number;\n};\nexport type TableCellVirtualDesc = {\n type: 'virtual';\n /** Index of real cell, that prodeced this virtual cell */\n colspan?: [number, number];\n /** Index of real cell, that prodeced this virtual cell */\n rowspan?: [number, number];\n};\n\ntype Pos = {from: number; to: number};\nexport type CellPos = RealCellPos | VirtualCellPos;\nexport type RealCellPos = {type: 'real'} & Pos;\nexport type VirtualCellPos = {type: 'virtual'; closestPos: number};\n\nexport type TableCellDesc = TableCellRealDesc | TableCellVirtualDesc;\nexport type TableRowRange = {\n startIdx: number;\n endIdx: number;\n rowsCount: number;\n safeTopBoundary: boolean;\n safeBottomBoundary: boolean;\n};\nexport type TableColumnRange = {\n startIdx: number;\n endIdx: number;\n columnsCount: number;\n safeLeftBoundary: boolean;\n safeRightBoundary: boolean;\n};\n\ntype TableRowDesc = {\n node: Node;\n cells: TableCellDesc[];\n offset: number;\n colspan?: boolean;\n rowspan?: boolean;\n};\n\nexport class TableDesc {\n private static __cache = new WeakMap<Node, TableDesc>();\n\n static create(table: Node) {\n if (this.__cache.has(table)) return this.__cache.get(table)!;\n\n if (!isTableNode(table)) return null;\n const tbody = table.lastChild;\n if (!tbody || !isTableBodyNode(tbody)) return null;\n\n // table –> tbody -> ...\n const baseOffset = 2;\n\n const rows: TableRowDesc[] = [];\n tbody.forEach((trow, offset) => {\n rows.push({node: trow, offset, cells: []});\n });\n\n tbody.forEach((trow, _1, trowIndex) => {\n trow.forEach((tcell, offset, tcellRealIndex) => {\n const rowDesc = rows[trowIndex];\n\n let tcellIndex = tcellRealIndex;\n while (rowDesc.cells[tcellIndex]) {\n tcellIndex++;\n }\n\n const cellDesc: TableCellRealDesc = (rowDesc.cells[tcellIndex] = {\n type: 'real',\n node: tcell,\n offset,\n });\n\n const map: [number, number] = [trowIndex, tcellIndex];\n\n if (isNumber(tcell.attrs['colspan'])) {\n rowDesc.colspan = true;\n const colspan = (cellDesc.colspan = parseInt(tcell.attrs['colspan'], 10));\n for (let i = 1; i < colspan; i++) {\n rowDesc.cells[tcellIndex + i] = {\n type: 'virtual',\n colspan: map,\n };\n }\n }\n\n if (isNumber(tcell.attrs['rowspan'])) {\n rowDesc.rowspan = true;\n const rowspan = (cellDesc.rowspan = parseInt(tcell.attrs['rowspan'], 10));\n for (let i = 1; i < rowspan; i++) {\n const colspan = cellDesc.colspan ?? 1;\n for (let j = 0; j < colspan; j++) {\n const cell: TableCellVirtualDesc = (rows[trowIndex + i].cells[\n tcellIndex + j\n ] = {\n type: 'virtual',\n rowspan: map,\n });\n if (colspan > 1) {\n cell.colspan = map;\n }\n }\n }\n }\n });\n });\n\n // ---> validation\n const rowsCount = rows.length;\n const colsCount = rows[0].cells.length;\n for (let r = 0; r < rowsCount; r++) {\n if (!rows[r] || rows[r].cells.length !== colsCount) return null;\n\n for (let c = 0; c < colsCount; c++) {\n if (!rows[r].cells[c]) return null;\n }\n }\n // <--- validation\n\n const desc = new this(rows.length, rows[0].cells.length, rows, baseOffset);\n this.__cache.set(table, desc);\n return desc;\n }\n\n private _rowRanges?: readonly Readonly<TableRowRange>[];\n private _columnRanges?: readonly Readonly<TableColumnRange>[];\n\n private constructor(\n /* eslint-disable @typescript-eslint/parameter-properties */\n readonly rows: number,\n readonly cols: number,\n readonly rowsDesc: readonly TableRowDesc[],\n readonly baseOffset: number,\n /* eslint-enable @typescript-eslint/parameter-properties */\n ) {}\n\n bind(pos: number) {\n return new TableDescBinded(pos, this);\n }\n\n rowHasVirtualCells(rowIndex: number): boolean {\n return this.rowsDesc[rowIndex]?.cells.some((cell) => cell.type === 'virtual');\n }\n\n columnHasVirtualCells(columnIndex: number): boolean {\n return this.rowsDesc.some((row) => row.cells[columnIndex]?.type === 'virtual');\n }\n\n isSafeColumn(columnIndex: number): boolean {\n return this.rowsDesc.every((row) => {\n const cell = row.cells[columnIndex];\n if (cell.type === 'real' && (!cell.colspan || cell.colspan === 1)) return true;\n if (cell.type === 'virtual' && cell.rowspan?.[1] === columnIndex) return true;\n return false;\n });\n }\n\n isSafeRow(rowIndex: number): boolean {\n return this.rowsDesc[rowIndex]?.cells.every((cell) => {\n if (cell.type === 'real' && (!cell.rowspan || cell.rowspan === 1)) return true;\n if (cell.type === 'virtual' && cell.colspan?.[0] === rowIndex) return true;\n return false;\n });\n }\n\n getOffsetForRow(rowIndex: number): number {\n return this.baseOffset + this.rowsDesc[rowIndex]?.offset;\n }\n\n getRelativePosForRow(rowIndex: number): Pos {\n const from = this.getOffsetForRow(rowIndex);\n const to = from + this.rowsDesc[rowIndex].node.nodeSize;\n return {from, to};\n }\n\n getRelativePosForCell(rowIndex: number, columnIndex: number): CellPos {\n const cell = this.rowsDesc[rowIndex]?.cells[columnIndex];\n const rowOffset = this.getOffsetForRow(rowIndex);\n\n if (cell?.type === 'real') {\n // 1 – open boundary for row node\n const from = rowOffset + 1 + cell.offset;\n const to = from + cell.node.nodeSize;\n return {type: 'real', from, to};\n }\n\n if (cell?.type === 'virtual') {\n let index = columnIndex;\n while (--index >= 0) {\n const cell = this.rowsDesc[rowIndex].cells[index];\n if (cell.type === 'real') {\n const closest = rowOffset + 1 + cell.offset + cell.node.nodeSize;\n return {type: 'virtual', closestPos: closest};\n }\n }\n return {type: 'virtual', closestPos: rowOffset + 1};\n }\n\n throw new Error(\n `Impossible to calculate offset for cell with position [${rowIndex},${columnIndex}]`,\n );\n }\n\n getRelativePosForRowCells(rowIndex: number): CellPos[] {\n const cells: CellPos[] = [];\n\n for (let colIndex = 0; colIndex < this.cols; colIndex++) {\n cells.push(this.getRelativePosForCell(rowIndex, colIndex));\n }\n\n return cells;\n }\n\n getRelativePosForColumn(columnIndex: number): CellPos[] {\n const ranges: CellPos[] = [];\n\n for (let i = 0; i < this.rows; i++) {\n ranges.push(this.getRelativePosForCell(i, columnIndex));\n }\n\n return ranges;\n }\n\n getCellNodeType() {\n const isRealCell = (cell: TableCellDesc): cell is TableCellRealDesc => cell.type === 'real';\n return this.rowsDesc[0].cells.find(isRealCell)!.node.type;\n }\n\n getRowNodeType() {\n return this.rowsDesc[0].node.type;\n }\n\n getCellInfo(node: Node) {\n let desc: {node: Node; offset: number; row: number; column: number} | null = null;\n for (let i = 0; i < this.rowsDesc.length; i++) {\n const row = this.rowsDesc[i];\n for (let j = 0; j < row.cells.length; j++) {\n const cell = row.cells[j];\n if (cell.type === 'real' && cell.node === node) {\n desc = {\n node: cell.node,\n offset: this.getOffsetForRow(i) + 1 + cell.offset,\n row: i,\n column: j,\n };\n }\n }\n }\n return desc;\n }\n\n getRowRanges() {\n if (this._rowRanges) return this._rowRanges;\n\n const ranges: TableRowRange[] = [];\n let last: TableRowRange | null = null;\n\n for (let i = 0; i < this.rowsDesc.length; i++) {\n const row = this.rowsDesc[i];\n const firstCell = row.cells[0];\n\n if (firstCell.type === 'real') {\n let safeTopBoundary = true;\n for (const cell of row.cells) {\n if (cell.type === 'virtual') safeTopBoundary &&= !cell.rowspan;\n }\n\n ranges.push(\n (last = {\n startIdx: i,\n endIdx: i,\n rowsCount: 1,\n safeTopBoundary,\n // calculate later\n safeBottomBoundary: true,\n }),\n );\n } else if (firstCell.rowspan) {\n last!.endIdx = i;\n last!.rowsCount++;\n } else {\n throw new Error(`First cell in row is virtual, but without rowspan [row=${i}]`);\n }\n }\n\n for (let i = 0; i < ranges.length; i++) {\n if (!ranges[i].safeTopBoundary) ranges[i - 1].safeBottomBoundary = false;\n }\n\n this._rowRanges = ranges;\n return ranges;\n }\n\n getRowRangeByRowIdx(rowIdx: number) {\n const rangeIdx = this.getRowRangeIdxByRowIdx(rowIdx);\n return this.getRowRanges()[rangeIdx];\n }\n\n getRowRangeIdxByRowIdx(rowIdx: number) {\n return this.getRowRanges().findIndex(\n (range) => range.startIdx <= rowIdx && range.endIdx >= rowIdx,\n );\n }\n\n getColumnRanges() {\n if (this._columnRanges) return this._columnRanges;\n\n const ranges: TableColumnRange[] = [];\n let last: TableColumnRange | null = null;\n\n const firstRow = this.rowsDesc[0];\n\n for (let i = 0; i < firstRow.cells.length; i++) {\n const cell = firstRow.cells[i];\n\n if (cell.type === 'real') {\n let safeLeftBoundary = true;\n for (const row of this.rowsDesc) {\n const cell = row.cells[i];\n if (cell.type === 'virtual' && cell.colspan)\n safeLeftBoundary &&= cell.colspan[1] === i;\n }\n\n ranges.push(\n (last = {\n startIdx: i,\n endIdx: i,\n columnsCount: 1,\n safeLeftBoundary,\n // calculate later\n safeRightBoundary: true,\n }),\n );\n } else if (cell.colspan) {\n last!.endIdx = i;\n last!.columnsCount++;\n } else {\n throw new Error(\n `First cell in column is virtual, but without colspan [column=${i}]`,\n );\n }\n }\n\n for (let i = 0; i < ranges.length; i++) {\n if (!ranges[i].safeLeftBoundary) ranges[i - 1].safeRightBoundary = false;\n }\n\n this._columnRanges = ranges;\n return ranges;\n }\n\n getColumnRangeByColumnIdx(columnIdx: number) {\n const rangeIdx = this.getColumnRangeIdxByColumnIdx(columnIdx);\n return this.getColumnRanges()[rangeIdx];\n }\n\n getColumnRangeIdxByColumnIdx(columnIdx: number) {\n return this.getColumnRanges().findIndex(\n (range) => range.startIdx <= columnIdx && range.endIdx >= columnIdx,\n );\n }\n}\n\nclass TableDescBinded {\n readonly pos: number;\n readonly base: TableDesc;\n\n get rows(): number {\n return this.base.rows;\n }\n\n get cols(): number {\n return this.base.cols;\n }\n\n constructor(pos: number, desc: TableDesc) {\n this.pos = pos;\n this.base = desc;\n }\n\n getRowIndexByPos(pos: number) {\n for (let rowIdx = 0; rowIdx < this.rows; rowIdx++) {\n const rowPos = this.pos + this.base.getOffsetForRow(rowIdx);\n if (pos === rowPos) return rowIdx;\n }\n return null;\n }\n\n getPosForRow(rowIndex: number): Pos {\n const pos = this.base.getRelativePosForRow(rowIndex);\n pos.from += this.pos;\n pos.to += this.pos;\n return pos;\n }\n\n getPosForCell(rowIndex: number, columnIndex: number): CellPos {\n const pos = this.base.getRelativePosForCell(rowIndex, columnIndex);\n if (pos.type === 'real') {\n pos.from += this.pos;\n pos.to += this.pos;\n } else if (pos.type === 'virtual') {\n pos.closestPos += this.pos;\n } else {\n throw new Error(\n `Impossible to calculate positions for cell with position [${rowIndex},${columnIndex}]`,\n );\n }\n return pos;\n }\n\n getPosForRowCells(rowIndex: number): CellPos[] {\n const cells: CellPos[] = [];\n\n for (let colIndex = 0; colIndex < this.base.cols; colIndex++) {\n cells.push(this.getPosForCell(rowIndex, colIndex));\n }\n\n return cells;\n }\n\n getPosForColumn(columnIndex: number): CellPos[] {\n const ranges: CellPos[] = [];\n\n for (let i = 0; i < this.base.rows; i++) {\n ranges.push(this.getPosForCell(i, columnIndex));\n }\n\n return ranges;\n }\n}\n\nexport type {TableDescBinded};\n"]}
1
+ {"version":3,"file":"table-desc.js","sourceRoot":"../../../src","sources":["table-utils/table-desc.ts"],"names":[],"mappings":";;;;AAAA,kEAAiC;AAGjC,sCAAqD;AAoDrD,MAAa,SAAS;IAyFL;IACA;IACA;IACA;IA3FL,MAAM,CAAC,OAAO,GAAG,IAAI,OAAO,EAAmB,CAAC;IAExD,MAAM,CAAC,MAAM,CAAC,KAAW;QACrB,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC;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,MAAM,IAAI,KAAK,CACX,6DAA6D,QAAQ,IAAI,WAAW,GAAG,CAC1F,CAAC;QACN,CAAC;QACD,OAAO,GAAG,CAAC;IACf,CAAC;IAED,iBAAiB,CAAC,QAAgB;QAC9B,MAAM,KAAK,GAAc,EAAE,CAAC;QAE5B,KAAK,IAAI,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC;YAC3D,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;QACvD,CAAC;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,eAAe,CAAC,WAAmB;QAC/B,MAAM,MAAM,GAAc,EAAE,CAAC;QAE7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;YACtC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC;QACpD,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ","sourcesContent":["import isNumber from 'is-number';\nimport type {Node} from 'prosemirror-model';\n\nimport {isTableBodyNode, isTableNode} from './utils';\n\n// TableDesc creates a virtual table description containing info about real and virtual cells needed for correct table operations.\n// This description is cached.\n// At the same time, positions of rows and cells may change, so a separate class (TableDescBinded) has been added\n// to work with absolute (relative to the document) positions.\n// Ranges are also added for more comprehensive operations with rows and columns.\n\nexport type TableCellRealDesc = {\n type: 'real';\n offset: number;\n node: Node;\n colspan?: number;\n rowspan?: number;\n};\nexport type TableCellVirtualDesc = {\n type: 'virtual';\n /** Index of real cell, that prodeced this virtual cell */\n colspan?: [number, number];\n /** Index of real cell, that prodeced this virtual cell */\n rowspan?: [number, number];\n};\n\ntype Pos = {from: number; to: number};\nexport type CellPos = RealCellPos | VirtualCellPos;\nexport type RealCellPos = {type: 'real'} & Pos;\nexport type VirtualCellPos = {type: 'virtual'; closestPos: number};\n\nexport type TableCellDesc = TableCellRealDesc | TableCellVirtualDesc;\nexport type TableRowRange = {\n startIdx: number;\n endIdx: number;\n rowsCount: number;\n safeTopBoundary: boolean;\n safeBottomBoundary: boolean;\n};\nexport type TableColumnRange = {\n startIdx: number;\n endIdx: number;\n columnsCount: number;\n safeLeftBoundary: boolean;\n safeRightBoundary: boolean;\n};\n\ntype TableRowDesc = {\n node: Node;\n cells: TableCellDesc[];\n offset: number;\n colspan?: boolean;\n rowspan?: boolean;\n};\n\nexport class TableDesc {\n private static __cache = new WeakMap<Node, TableDesc>();\n\n static create(table: Node) {\n if (this.__cache.has(table)) return this.__cache.get(table)!;\n\n if (!isTableNode(table)) return null;\n const tbody = table.lastChild;\n if (!tbody || !isTableBodyNode(tbody)) return null;\n\n // table –> tbody -> ...\n const baseOffset = 2;\n\n const rows: TableRowDesc[] = [];\n tbody.forEach((trow, offset) => {\n rows.push({node: trow, offset, cells: []});\n });\n\n tbody.forEach((trow, _1, trowIndex) => {\n trow.forEach((tcell, offset, tcellRealIndex) => {\n const rowDesc = rows[trowIndex];\n\n let tcellIndex = tcellRealIndex;\n while (rowDesc.cells[tcellIndex]) {\n tcellIndex++;\n }\n\n const cellDesc: TableCellRealDesc = (rowDesc.cells[tcellIndex] = {\n type: 'real',\n node: tcell,\n offset,\n });\n\n const map: [number, number] = [trowIndex, tcellIndex];\n\n if (isNumber(tcell.attrs['colspan'])) {\n rowDesc.colspan = true;\n const colspan = (cellDesc.colspan = parseInt(tcell.attrs['colspan'], 10));\n for (let i = 1; i < colspan; i++) {\n rowDesc.cells[tcellIndex + i] = {\n type: 'virtual',\n colspan: map,\n };\n }\n }\n\n if (isNumber(tcell.attrs['rowspan'])) {\n rowDesc.rowspan = true;\n const rowspan = (cellDesc.rowspan = parseInt(tcell.attrs['rowspan'], 10));\n for (let i = 1; i < rowspan; i++) {\n const colspan = cellDesc.colspan ?? 1;\n for (let j = 0; j < colspan; j++) {\n const cell: TableCellVirtualDesc = (rows[trowIndex + i].cells[\n tcellIndex + j\n ] = {\n type: 'virtual',\n rowspan: map,\n });\n if (colspan > 1) {\n cell.colspan = map;\n }\n }\n }\n }\n });\n });\n\n // ---> validation\n const rowsCount = rows.length;\n const colsCount = rows[0].cells.length;\n for (let r = 0; r < rowsCount; r++) {\n if (!rows[r] || rows[r].cells.length !== colsCount) return null;\n\n for (let c = 0; c < colsCount; c++) {\n if (!rows[r].cells[c]) return null;\n }\n }\n // <--- validation\n\n const desc = new this(rows.length, rows[0].cells.length, rows, baseOffset);\n this.__cache.set(table, desc);\n return desc;\n }\n\n private _rowRanges?: readonly Readonly<TableRowRange>[];\n private _columnRanges?: readonly Readonly<TableColumnRange>[];\n\n private constructor(\n /* eslint-disable @typescript-eslint/parameter-properties */\n readonly rows: number,\n readonly cols: number,\n readonly rowsDesc: readonly TableRowDesc[],\n readonly baseOffset: number,\n /* eslint-enable @typescript-eslint/parameter-properties */\n ) {}\n\n bind(pos: number) {\n return new TableDescBinded(pos, this);\n }\n\n rowHasVirtualCells(rowIndex: number): boolean {\n return this.rowsDesc[rowIndex]?.cells.some((cell) => cell.type === 'virtual');\n }\n\n columnHasVirtualCells(columnIndex: number): boolean {\n return this.rowsDesc.some((row) => row.cells[columnIndex]?.type === 'virtual');\n }\n\n isSafeColumn(columnIndex: number): boolean {\n return this.rowsDesc.every((row) => {\n const cell = row.cells[columnIndex];\n if (cell.type === 'real' && (!cell.colspan || cell.colspan === 1)) return true;\n if (cell.type === 'virtual' && cell.rowspan?.[1] === columnIndex) return true;\n return false;\n });\n }\n\n isSafeRow(rowIndex: number): boolean {\n return this.rowsDesc[rowIndex]?.cells.every((cell) => {\n if (cell.type === 'real' && (!cell.rowspan || cell.rowspan === 1)) return true;\n if (cell.type === 'virtual' && cell.colspan?.[0] === rowIndex) return true;\n return false;\n });\n }\n\n getOffsetForRow(rowIndex: number): number {\n return this.baseOffset + this.rowsDesc[rowIndex]?.offset;\n }\n\n getRelativePosForRow(rowIndex: number): Pos {\n const from = this.getOffsetForRow(rowIndex);\n const to = from + this.rowsDesc[rowIndex].node.nodeSize;\n return {from, to};\n }\n\n getRelativePosForCell(rowIndex: number, columnIndex: number): CellPos {\n const cell = this.rowsDesc[rowIndex]?.cells[columnIndex];\n const rowOffset = this.getOffsetForRow(rowIndex);\n\n if (cell?.type === 'real') {\n // 1 – open boundary for row node\n const from = rowOffset + 1 + cell.offset;\n const to = from + cell.node.nodeSize;\n return {type: 'real', from, to};\n }\n\n if (cell?.type === 'virtual') {\n let index = columnIndex;\n while (--index >= 0) {\n const cell = this.rowsDesc[rowIndex].cells[index];\n if (cell.type === 'real') {\n const closest = rowOffset + 1 + cell.offset + cell.node.nodeSize;\n return {type: 'virtual', closestPos: closest};\n }\n }\n return {type: 'virtual', closestPos: rowOffset + 1};\n }\n\n throw new Error(\n `Impossible to calculate offset for cell with position [${rowIndex},${columnIndex}]`,\n );\n }\n\n getRelativePosForRowCells(rowIndex: number): CellPos[] {\n const cells: CellPos[] = [];\n\n for (let colIndex = 0; colIndex < this.cols; colIndex++) {\n cells.push(this.getRelativePosForCell(rowIndex, colIndex));\n }\n\n return cells;\n }\n\n getRelativePosForColumn(columnIndex: number): CellPos[] {\n const ranges: CellPos[] = [];\n\n for (let i = 0; i < this.rows; i++) {\n ranges.push(this.getRelativePosForCell(i, columnIndex));\n }\n\n return ranges;\n }\n\n getCellNodeType() {\n const isRealCell = (cell: TableCellDesc): cell is TableCellRealDesc => cell.type === 'real';\n return this.rowsDesc[0].cells.find(isRealCell)!.node.type;\n }\n\n getRowNodeType() {\n return this.rowsDesc[0].node.type;\n }\n\n getCellInfo(node: Node) {\n let desc: {node: Node; offset: number; row: number; column: number} | null = null;\n for (let i = 0; i < this.rowsDesc.length; i++) {\n const row = this.rowsDesc[i];\n for (let j = 0; j < row.cells.length; j++) {\n const cell = row.cells[j];\n if (cell.type === 'real' && cell.node === node) {\n desc = {\n node: cell.node,\n offset: this.getOffsetForRow(i) + 1 + cell.offset,\n row: i,\n column: j,\n };\n }\n }\n }\n return desc;\n }\n\n getRowRanges() {\n if (this._rowRanges) return this._rowRanges;\n\n const ranges: TableRowRange[] = [];\n let last: TableRowRange | null = null;\n\n for (let i = 0; i < this.rowsDesc.length; i++) {\n const row = this.rowsDesc[i];\n const firstCell = row.cells[0];\n\n if (firstCell.type === 'real') {\n let safeTopBoundary = true;\n for (const cell of row.cells) {\n if (cell.type === 'virtual') safeTopBoundary &&= !cell.rowspan;\n }\n\n ranges.push(\n (last = {\n startIdx: i,\n endIdx: i,\n rowsCount: 1,\n safeTopBoundary,\n // calculate later\n safeBottomBoundary: true,\n }),\n );\n } else if (firstCell.rowspan) {\n last!.endIdx = i;\n last!.rowsCount++;\n } else {\n throw new Error(`First cell in row is virtual, but without rowspan [row=${i}]`);\n }\n }\n\n for (let i = 0; i < ranges.length; i++) {\n if (!ranges[i].safeTopBoundary) ranges[i - 1].safeBottomBoundary = false;\n }\n\n this._rowRanges = ranges;\n return ranges;\n }\n\n getRowRangeByRowIdx(rowIdx: number) {\n const rangeIdx = this.getRowRangeIdxByRowIdx(rowIdx);\n return this.getRowRanges()[rangeIdx];\n }\n\n getRowRangeIdxByRowIdx(rowIdx: number) {\n return this.getRowRanges().findIndex(\n (range) => range.startIdx <= rowIdx && range.endIdx >= rowIdx,\n );\n }\n\n getColumnRanges() {\n if (this._columnRanges) return this._columnRanges;\n\n const ranges: TableColumnRange[] = [];\n let last: TableColumnRange | null = null;\n\n const firstRow = this.rowsDesc[0];\n\n for (let i = 0; i < firstRow.cells.length; i++) {\n const cell = firstRow.cells[i];\n\n if (cell.type === 'real') {\n let safeLeftBoundary = true;\n for (const row of this.rowsDesc) {\n const cell = row.cells[i];\n if (cell.type === 'virtual' && cell.colspan)\n safeLeftBoundary &&= cell.colspan[1] === i;\n }\n\n ranges.push(\n (last = {\n startIdx: i,\n endIdx: i,\n columnsCount: 1,\n safeLeftBoundary,\n // calculate later\n safeRightBoundary: true,\n }),\n );\n } else if (cell.colspan) {\n last!.endIdx = i;\n last!.columnsCount++;\n } else {\n throw new Error(\n `First cell in column is virtual, but without colspan [column=${i}]`,\n );\n }\n }\n\n for (let i = 0; i < ranges.length; i++) {\n if (!ranges[i].safeLeftBoundary) ranges[i - 1].safeRightBoundary = false;\n }\n\n this._columnRanges = ranges;\n return ranges;\n }\n\n getColumnRangeByColumnIdx(columnIdx: number) {\n const rangeIdx = this.getColumnRangeIdxByColumnIdx(columnIdx);\n return this.getColumnRanges()[rangeIdx];\n }\n\n getColumnRangeIdxByColumnIdx(columnIdx: number) {\n return this.getColumnRanges().findIndex(\n (range) => range.startIdx <= columnIdx && range.endIdx >= columnIdx,\n );\n }\n}\n\nclass TableDescBinded {\n readonly pos: number;\n readonly base: TableDesc;\n\n get bodyPos(): number {\n return this.pos + 1;\n }\n\n get rows(): number {\n return this.base.rows;\n }\n\n get cols(): number {\n return this.base.cols;\n }\n\n constructor(pos: number, desc: TableDesc) {\n this.pos = pos;\n this.base = desc;\n }\n\n getRowIndexByPos(pos: number) {\n for (let rowIdx = 0; rowIdx < this.rows; rowIdx++) {\n const rowPos = this.pos + this.base.getOffsetForRow(rowIdx);\n if (pos === rowPos) return rowIdx;\n }\n return null;\n }\n\n getPosForRow(rowIndex: number): Pos {\n const pos = this.base.getRelativePosForRow(rowIndex);\n pos.from += this.pos;\n pos.to += this.pos;\n return pos;\n }\n\n getPosForCell(rowIndex: number, columnIndex: number): CellPos {\n const pos = this.base.getRelativePosForCell(rowIndex, columnIndex);\n if (pos.type === 'real') {\n pos.from += this.pos;\n pos.to += this.pos;\n } else if (pos.type === 'virtual') {\n pos.closestPos += this.pos;\n } else {\n throw new Error(\n `Impossible to calculate positions for cell with position [${rowIndex},${columnIndex}]`,\n );\n }\n return pos;\n }\n\n getPosForRowCells(rowIndex: number): CellPos[] {\n const cells: CellPos[] = [];\n\n for (let colIndex = 0; colIndex < this.base.cols; colIndex++) {\n cells.push(this.getPosForCell(rowIndex, colIndex));\n }\n\n return cells;\n }\n\n getPosForColumn(columnIndex: number): CellPos[] {\n const ranges: CellPos[] = [];\n\n for (let i = 0; i < this.base.rows; i++) {\n ranges.push(this.getPosForCell(i, columnIndex));\n }\n\n return ranges;\n }\n}\n\nexport type {TableDescBinded};\n"]}
@@ -11,6 +11,7 @@ export * from "./inputrules.js";
11
11
  export * from "./keymap.js";
12
12
  export * from "./marks.js";
13
13
  export * from "./node-children.js";
14
+ export * from "./node-descedants.js";
14
15
  export * from "./nodes.js";
15
16
  export * from "./placeholder.js";
16
17
  export * from "./platform.js";
@@ -14,6 +14,7 @@ tslib_1.__exportStar(require("./inputrules.js"), exports);
14
14
  tslib_1.__exportStar(require("./keymap.js"), exports);
15
15
  tslib_1.__exportStar(require("./marks.js"), exports);
16
16
  tslib_1.__exportStar(require("./node-children.js"), exports);
17
+ tslib_1.__exportStar(require("./node-descedants.js"), exports);
17
18
  tslib_1.__exportStar(require("./nodes.js"), exports);
18
19
  tslib_1.__exportStar(require("./placeholder.js"), exports);
19
20
  tslib_1.__exportStar(require("./platform.js"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../../../src","sources":["utils/index.ts"],"names":[],"mappings":";;;AAAA,uDAA0B;AAC1B,kEAAqC;AACrC,8DAA2B;AAC3B,yDAA4B;AAC5B,0DAA6B;AAC7B,2DAA8B;AAC9B,yDAA4B;AAC5B,6DAAgC;AAChC,uDAA0B;AAC1B,0DAA6B;AAC7B,sDAAyB;AACzB,qDAAwB;AACxB,6DAAgC;AAChC,qDAAwB;AACxB,2DAA8B;AAC9B,wDAA2B;AAC3B,2DAA8B;AAC9B,sDAAyB;AACzB,yDAA4B;AAC5B,uEAA0C;AAC1C,2DAA8B;AAC9B,sDAAyB;AACzB,qEAAwC","sourcesContent":["export * from './actions';\nexport * from './autocomplete-popup';\nexport * from './carousel';\nexport * from './clipboard';\nexport * from './descedants';\nexport * from './ecapeRegexp';\nexport * from './entity-id';\nexport * from './event-emitter';\nexport * from './helpers';\nexport * from './inputrules';\nexport * from './keymap';\nexport * from './marks';\nexport * from './node-children';\nexport * from './nodes';\nexport * from './placeholder';\nexport * from './platform';\nexport * from './remove-node';\nexport * from './schema';\nexport * from './selection';\nexport * from './serialize-for-clipboard';\nexport * from './sync-scroll';\nexport * from './upload';\nexport * from './get-proportional-size';\nexport type {DirectiveSyntaxValue, DirectiveSyntaxOption} from './directive';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"../../../src","sources":["utils/index.ts"],"names":[],"mappings":";;;AAAA,uDAA0B;AAC1B,kEAAqC;AACrC,8DAA2B;AAC3B,yDAA4B;AAC5B,0DAA6B;AAC7B,2DAA8B;AAC9B,yDAA4B;AAC5B,6DAAgC;AAChC,uDAA0B;AAC1B,0DAA6B;AAC7B,sDAAyB;AACzB,qDAAwB;AACxB,6DAAgC;AAChC,+DAAkC;AAClC,qDAAwB;AACxB,2DAA8B;AAC9B,wDAA2B;AAC3B,2DAA8B;AAC9B,sDAAyB;AACzB,yDAA4B;AAC5B,uEAA0C;AAC1C,2DAA8B;AAC9B,sDAAyB;AACzB,qEAAwC","sourcesContent":["export * from './actions';\nexport * from './autocomplete-popup';\nexport * from './carousel';\nexport * from './clipboard';\nexport * from './descedants';\nexport * from './ecapeRegexp';\nexport * from './entity-id';\nexport * from './event-emitter';\nexport * from './helpers';\nexport * from './inputrules';\nexport * from './keymap';\nexport * from './marks';\nexport * from './node-children';\nexport * from './node-descedants';\nexport * from './nodes';\nexport * from './placeholder';\nexport * from './platform';\nexport * from './remove-node';\nexport * from './schema';\nexport * from './selection';\nexport * from './serialize-for-clipboard';\nexport * from './sync-scroll';\nexport * from './upload';\nexport * from './get-proportional-size';\nexport type {DirectiveSyntaxValue, DirectiveSyntaxOption} from './directive';\n"]}
@@ -0,0 +1,10 @@
1
+ import type { Node } from "../pm/model.js";
2
+ type DescendantWithMeta = {
3
+ node: Node;
4
+ pos: number;
5
+ parent: Node | null;
6
+ index: number;
7
+ };
8
+ export declare function getDescedantBy(node: Node, f: (child: DescendantWithMeta) => boolean): DescendantWithMeta | null;
9
+ export declare function getDescedantByAttribute(node: Node, attr: string, value: unknown | unknown[]): DescendantWithMeta | null;
10
+ export {};
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDescedantBy = getDescedantBy;
4
+ exports.getDescedantByAttribute = getDescedantByAttribute;
5
+ function getDescedantBy(node, f) {
6
+ let result = null;
7
+ node.descendants((node, pos, parent, index) => {
8
+ if (result)
9
+ return false;
10
+ const child = { node, pos, parent, index };
11
+ if (f(child)) {
12
+ result = child;
13
+ return false;
14
+ }
15
+ return true;
16
+ });
17
+ return result;
18
+ }
19
+ function getDescedantByAttribute(node, attr, value) {
20
+ const values = Array().concat(value);
21
+ return getDescedantBy(node, (item) => values.includes(item.node.attrs[attr]));
22
+ }
23
+ //# sourceMappingURL=node-descedants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-descedants.js","sourceRoot":"../../../src","sources":["utils/node-descedants.ts"],"names":[],"mappings":";;AASA,wCAiBC;AAED,0DAOC;AA1BD,SAAgB,cAAc,CAC1B,IAAU,EACV,CAAyC;IAEzC,IAAI,MAAM,GAA8B,IAAI,CAAC;IAC7C,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE;QAC1C,IAAI,MAAM;YAAE,OAAO,KAAK,CAAC;QAEzB,MAAM,KAAK,GAAuB,EAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAC,CAAC;QAC7D,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;YACX,MAAM,GAAG,KAAK,CAAC;YACf,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,SAAgB,uBAAuB,CACnC,IAAU,EACV,IAAY,EACZ,KAA0B;IAE1B,MAAM,MAAM,GAAG,KAAK,EAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9C,OAAO,cAAc,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClF,CAAC","sourcesContent":["import type {Node} from '#pm/model';\n\ntype DescendantWithMeta = {\n node: Node;\n pos: number;\n parent: Node | null;\n index: number;\n};\n\nexport function getDescedantBy(\n node: Node,\n f: (child: DescendantWithMeta) => boolean,\n): DescendantWithMeta | null {\n let result: DescendantWithMeta | null = null;\n node.descendants((node, pos, parent, index) => {\n if (result) return false;\n\n const child: DescendantWithMeta = {node, pos, parent, index};\n if (f(child)) {\n result = child;\n return false;\n }\n\n return true;\n });\n return result;\n}\n\nexport function getDescedantByAttribute(\n node: Node,\n attr: string,\n value: unknown | unknown[],\n): DescendantWithMeta | null {\n const values = Array<unknown>().concat(value);\n return getDescedantBy(node, (item) => values.includes(item.node.attrs[attr]));\n}\n"]}
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  /** During build process, the current version will be injected here */
5
- exports.VERSION = typeof '15.24.1' !== 'undefined' ? '15.24.1' : 'unknown';
5
+ exports.VERSION = typeof '15.26.1' !== 'undefined' ? '15.26.1' : 'unknown';
6
6
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"../../src","sources":["version.ts"],"names":[],"mappings":";;;AAAA,sEAAsE;AACzD,QAAA,OAAO,GAAG,OAAO,WAAW,KAAK,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC","sourcesContent":["/** During build process, the current version will be injected here */\nexport const VERSION = typeof '15.24.1' !== 'undefined' ? '15.24.1' : 'unknown';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"../../src","sources":["version.ts"],"names":[],"mappings":";;;AAAA,sEAAsE;AACzD,QAAA,OAAO,GAAG,OAAO,WAAW,KAAK,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC","sourcesContent":["/** During build process, the current version will be injected here */\nexport const VERSION = typeof '15.26.1' !== 'undefined' ? '15.26.1' : 'unknown';\n"]}
@@ -2,6 +2,7 @@ import { type ComponentType, type RefAttributes } from 'react';
2
2
  import type { HTMLRuntimeConfig } from '@diplodoc/html-extension';
3
3
  import type { IHTMLIFrameElementConfig } from '@diplodoc/html-extension/runtime';
4
4
  import type { PluginRuntime, TransformMeta } from "../withMermaid/types.js";
5
+ export { DEFAULT_HTML_RUNTIME_CONFIG } from "./useYfmHtmlBlockRuntime.js";
5
6
  export type WithYfmHtmlBlockOptions = {
6
7
  runtime: PluginRuntime;
7
8
  };
@@ -1,10 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_HTML_RUNTIME_CONFIG = void 0;
3
4
  exports.withYfmHtmlBlock = withYfmHtmlBlock;
4
5
  const jsx_runtime_1 = require("react/jsx-runtime");
5
6
  const react_1 = require("react");
6
7
  const react_2 = require("@diplodoc/html-extension/react");
7
8
  const useYfmHtmlBlockRuntime_1 = require("./useYfmHtmlBlockRuntime.js");
9
+ var useYfmHtmlBlockRuntime_2 = require("./useYfmHtmlBlockRuntime.js");
10
+ Object.defineProperty(exports, "DEFAULT_HTML_RUNTIME_CONFIG", { enumerable: true, get: function () { return useYfmHtmlBlockRuntime_2.DEFAULT_HTML_RUNTIME_CONFIG; } });
8
11
  function withYfmHtmlBlock(opts) {
9
12
  return (Component) => (0, react_1.forwardRef)(function WithYfmHtml(props, ref) {
10
13
  const { meta, html, yfmHtmlBlockConfig, htmlRuntimeConfig } = props;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../../../../../src","sources":["view/hocs/withYfmHtml/index.tsx"],"names":[],"mappings":";;AAqBA,4CAsBC;;AA3CD,iCAAoF;AAGpF,0DAAoF;AAKpF,wEAAgE;AAahE,SAAgB,gBAAgB,CAAC,IAA6B;IAC1D,OAAO,CACH,SAA2D,EAC7D,EAAE,CACA,IAAA,kBAAU,EAA4C,SAAS,WAAW,CAAC,KAAK,EAAE,GAAG;QACjF,MAAM,EAAC,IAAI,EAAE,IAAI,EAAE,kBAAkB,EAAE,iBAAiB,EAAC,GAAG,KAAK,CAAC;QAElE,IAAA,+CAAsB,EAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;QAE9D,MAAM,YAAY,GAAG,IAAA,4CAAoC,GAAE,CAAC;QAE5D,IAAA,iBAAS,EAAC,GAAG,EAAE;YACX,IAAI,YAAY,EAAE,CAAC;gBACf,IAAI,kBAAkB,EAAE,CAAC;oBACrB,YAAY,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;gBAC/C,CAAC;gBACD,YAAY,CAAC,UAAU,EAAE,CAAC;YAC9B,CAAC;QACL,CAAC,EAAE,CAAC,YAAY,EAAE,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAC;QAE7C,OAAO,uBAAC,SAAS,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,GAAI,CAAC;IAC9C,CAAC,CAAC,CAAC;AACX,CAAC","sourcesContent":["import {type ComponentType, type RefAttributes, forwardRef, useEffect} from 'react';\n\nimport type {HTMLRuntimeConfig} from '@diplodoc/html-extension';\nimport {useDiplodocEmbeddedContentController} from '@diplodoc/html-extension/react';\nimport type {IHTMLIFrameElementConfig} from '@diplodoc/html-extension/runtime';\n\nimport type {PluginRuntime, TransformMeta} from '../withMermaid/types';\n\nimport {useYfmHtmlBlockRuntime} from './useYfmHtmlBlockRuntime';\n\nexport type WithYfmHtmlBlockOptions = {\n runtime: PluginRuntime;\n};\n\nexport type WithYfmHtmlBlockProps = {\n meta: TransformMeta;\n yfmHtmlBlockConfig?: IHTMLIFrameElementConfig;\n /** Works only with html-extension dep version 2.7.1 and higher */\n htmlRuntimeConfig?: HTMLRuntimeConfig;\n};\n\nexport function withYfmHtmlBlock(opts: WithYfmHtmlBlockOptions) {\n return <T extends {html: string}>(\n Component: ComponentType<T & RefAttributes<HTMLDivElement>>,\n ) =>\n forwardRef<HTMLDivElement, T & WithYfmHtmlBlockProps>(function WithYfmHtml(props, ref) {\n const {meta, html, yfmHtmlBlockConfig, htmlRuntimeConfig} = props;\n\n useYfmHtmlBlockRuntime(meta, opts.runtime, htmlRuntimeConfig);\n\n const yfmHtmlBlock = useDiplodocEmbeddedContentController();\n\n useEffect(() => {\n if (yfmHtmlBlock) {\n if (yfmHtmlBlockConfig) {\n yfmHtmlBlock.setConfig(yfmHtmlBlockConfig);\n }\n yfmHtmlBlock.initialize();\n }\n }, [yfmHtmlBlock, html, yfmHtmlBlockConfig]);\n\n return <Component {...props} ref={ref} />;\n });\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"../../../../../src","sources":["view/hocs/withYfmHtml/index.tsx"],"names":[],"mappings":";;;AAuBA,4CAsBC;;AA7CD,iCAAoF;AAGpF,0DAAoF;AAKpF,wEAAgE;AAEhE,sEAAqE;AAA7D,qIAAA,2BAA2B,OAAA;AAanC,SAAgB,gBAAgB,CAAC,IAA6B;IAC1D,OAAO,CACH,SAA2D,EAC7D,EAAE,CACA,IAAA,kBAAU,EAA4C,SAAS,WAAW,CAAC,KAAK,EAAE,GAAG;QACjF,MAAM,EAAC,IAAI,EAAE,IAAI,EAAE,kBAAkB,EAAE,iBAAiB,EAAC,GAAG,KAAK,CAAC;QAElE,IAAA,+CAAsB,EAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;QAE9D,MAAM,YAAY,GAAG,IAAA,4CAAoC,GAAE,CAAC;QAE5D,IAAA,iBAAS,EAAC,GAAG,EAAE;YACX,IAAI,YAAY,EAAE,CAAC;gBACf,IAAI,kBAAkB,EAAE,CAAC;oBACrB,YAAY,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;gBAC/C,CAAC;gBACD,YAAY,CAAC,UAAU,EAAE,CAAC;YAC9B,CAAC;QACL,CAAC,EAAE,CAAC,YAAY,EAAE,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAC;QAE7C,OAAO,uBAAC,SAAS,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,GAAI,CAAC;IAC9C,CAAC,CAAC,CAAC;AACX,CAAC","sourcesContent":["import {type ComponentType, type RefAttributes, forwardRef, useEffect} from 'react';\n\nimport type {HTMLRuntimeConfig} from '@diplodoc/html-extension';\nimport {useDiplodocEmbeddedContentController} from '@diplodoc/html-extension/react';\nimport type {IHTMLIFrameElementConfig} from '@diplodoc/html-extension/runtime';\n\nimport type {PluginRuntime, TransformMeta} from '../withMermaid/types';\n\nimport {useYfmHtmlBlockRuntime} from './useYfmHtmlBlockRuntime';\n\nexport {DEFAULT_HTML_RUNTIME_CONFIG} from './useYfmHtmlBlockRuntime';\n\nexport type WithYfmHtmlBlockOptions = {\n runtime: PluginRuntime;\n};\n\nexport type WithYfmHtmlBlockProps = {\n meta: TransformMeta;\n yfmHtmlBlockConfig?: IHTMLIFrameElementConfig;\n /** Works only with html-extension dep version 2.7.1 and higher */\n htmlRuntimeConfig?: HTMLRuntimeConfig;\n};\n\nexport function withYfmHtmlBlock(opts: WithYfmHtmlBlockOptions) {\n return <T extends {html: string}>(\n Component: ComponentType<T & RefAttributes<HTMLDivElement>>,\n ) =>\n forwardRef<HTMLDivElement, T & WithYfmHtmlBlockProps>(function WithYfmHtml(props, ref) {\n const {meta, html, yfmHtmlBlockConfig, htmlRuntimeConfig} = props;\n\n useYfmHtmlBlockRuntime(meta, opts.runtime, htmlRuntimeConfig);\n\n const yfmHtmlBlock = useDiplodocEmbeddedContentController();\n\n useEffect(() => {\n if (yfmHtmlBlock) {\n if (yfmHtmlBlockConfig) {\n yfmHtmlBlock.setConfig(yfmHtmlBlockConfig);\n }\n yfmHtmlBlock.initialize();\n }\n }, [yfmHtmlBlock, html, yfmHtmlBlockConfig]);\n\n return <Component {...props} ref={ref} />;\n });\n}\n"]}
@@ -1 +1,5 @@
1
- export {};
1
+ import type { HTMLRuntimeConfig } from '@diplodoc/html-extension';
2
+ /**
3
+ * Default runtime config with shadow mode disabled for XSS protection.
4
+ */
5
+ export declare const DEFAULT_HTML_RUNTIME_CONFIG: HTMLRuntimeConfig;
@@ -1,9 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_HTML_RUNTIME_CONFIG = void 0;
3
4
  exports.useYfmHtmlBlockRuntime = useYfmHtmlBlockRuntime;
4
5
  const utils_1 = require("@diplodoc/html-extension/utils");
6
+ /**
7
+ * Default runtime config with shadow mode disabled for XSS protection.
8
+ */
9
+ exports.DEFAULT_HTML_RUNTIME_CONFIG = {
10
+ disabledModes: ['shadow'],
11
+ };
5
12
  /** @internal */
6
- function useYfmHtmlBlockRuntime(meta, runtime = '_assets/html-extension.js', htmlRuntimeConfig = {}) {
13
+ function useYfmHtmlBlockRuntime(meta, runtime = '_assets/html-extension.js', htmlRuntimeConfig = exports.DEFAULT_HTML_RUNTIME_CONFIG) {
7
14
  if (meta?.script?.includes(runtime)) {
8
15
  // MAJOR: update html-extension peer on ^2.7.1 and remove optional chain
9
16
  (0, utils_1.setupRuntimeConfig)?.(htmlRuntimeConfig);
@@ -1 +1 @@
1
- {"version":3,"file":"useYfmHtmlBlockRuntime.js","sourceRoot":"../../../../../src","sources":["view/hocs/withYfmHtml/useYfmHtmlBlockRuntime.ts"],"names":[],"mappings":";;AAMA,wDAUC;AAfD,0DAAkE;AAIlE,gBAAgB;AAChB,SAAgB,sBAAsB,CAClC,IAAmB,EACnB,UAAyB,2BAA2B,EACpD,oBAAuC,EAAE;IAEzC,IAAI,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAClC,wEAAwE;QACxE,IAAA,0BAAkB,CAAA,EAAE,CAAC,iBAAiB,CAAC,CAAC;QACxC,MAAM,CAAC,0CAA0C,CAAC,kCAAkC,CAAC,CAAC;IAC1F,CAAC;AACL,CAAC","sourcesContent":["import type {HTMLRuntimeConfig} from '@diplodoc/html-extension';\nimport {setupRuntimeConfig} from '@diplodoc/html-extension/utils';\n\nimport type {PluginRuntime, TransformMeta} from './types';\n\n/** @internal */\nexport function useYfmHtmlBlockRuntime(\n meta: TransformMeta,\n runtime: PluginRuntime = '_assets/html-extension.js',\n htmlRuntimeConfig: HTMLRuntimeConfig = {},\n) {\n if (meta?.script?.includes(runtime)) {\n // MAJOR: update html-extension peer on ^2.7.1 and remove optional chain\n setupRuntimeConfig?.(htmlRuntimeConfig);\n import(/* webpackChunkName: \"yfm-html-runtime\" */ '@diplodoc/html-extension/runtime');\n }\n}\n"]}
1
+ {"version":3,"file":"useYfmHtmlBlockRuntime.js","sourceRoot":"../../../../../src","sources":["view/hocs/withYfmHtml/useYfmHtmlBlockRuntime.ts"],"names":[],"mappings":";;;AAaA,wDAUC;AAtBD,0DAAkE;AAIlE;;GAEG;AACU,QAAA,2BAA2B,GAAsB;IAC1D,aAAa,EAAE,CAAC,QAAQ,CAAC;CAC5B,CAAC;AAEF,gBAAgB;AAChB,SAAgB,sBAAsB,CAClC,IAAmB,EACnB,UAAyB,2BAA2B,EACpD,oBAAuC,mCAA2B;IAElE,IAAI,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAClC,wEAAwE;QACxE,IAAA,0BAAkB,CAAA,EAAE,CAAC,iBAAiB,CAAC,CAAC;QACxC,MAAM,CAAC,0CAA0C,CAAC,kCAAkC,CAAC,CAAC;IAC1F,CAAC;AACL,CAAC","sourcesContent":["import type {HTMLRuntimeConfig} from '@diplodoc/html-extension';\nimport {setupRuntimeConfig} from '@diplodoc/html-extension/utils';\n\nimport type {PluginRuntime, TransformMeta} from './types';\n\n/**\n * Default runtime config with shadow mode disabled for XSS protection.\n */\nexport const DEFAULT_HTML_RUNTIME_CONFIG: HTMLRuntimeConfig = {\n disabledModes: ['shadow'],\n};\n\n/** @internal */\nexport function useYfmHtmlBlockRuntime(\n meta: TransformMeta,\n runtime: PluginRuntime = '_assets/html-extension.js',\n htmlRuntimeConfig: HTMLRuntimeConfig = DEFAULT_HTML_RUNTIME_CONFIG,\n) {\n if (meta?.script?.includes(runtime)) {\n // MAJOR: update html-extension peer on ^2.7.1 and remove optional chain\n setupRuntimeConfig?.(htmlRuntimeConfig);\n import(/* webpackChunkName: \"yfm-html-runtime\" */ '@diplodoc/html-extension/runtime');\n }\n}\n"]}