@datawhale/prosemirror-render 0.0.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 (287) hide show
  1. package/dist/AttachmentBlock-ChMNTUOo.mjs +351 -0
  2. package/dist/AttachmentBlock-DsmJP3Kw.js +1 -0
  3. package/dist/AttachmentInline-Dc3dp0g-.js +1 -0
  4. package/dist/AttachmentInline-tbC8BJBy.mjs +52 -0
  5. package/dist/AttachmentMenu-B5x8P9_n.mjs +541 -0
  6. package/dist/AttachmentMenu-ExoCOe4B.js +1 -0
  7. package/dist/Blockquote-BamWUQND.mjs +15 -0
  8. package/dist/Blockquote-CQSBFnsu.js +1 -0
  9. package/dist/BulletList-BQTUD69X.mjs +15 -0
  10. package/dist/BulletList-CFjF3U-l.js +1 -0
  11. package/dist/Callout-Cu6HI-xq.mjs +28 -0
  12. package/dist/Callout-DPdOqTb4.js +1 -0
  13. package/dist/CellOutput-C33VK0df.mjs +981 -0
  14. package/dist/CellOutput-DiKZlIFa.js +6 -0
  15. package/dist/CodeBlock-Cjuxuq7B.mjs +8359 -0
  16. package/dist/CodeBlock-DWniNUQB.js +148 -0
  17. package/dist/Doc-6s4VMDsx.mjs +15 -0
  18. package/dist/Doc-D2yvlSII.js +1 -0
  19. package/dist/FoldBlock-DRdlU-DX.mjs +75 -0
  20. package/dist/FoldBlock-ZPMf0QsR.js +1 -0
  21. package/dist/Grid-GfmJxM93.mjs +31 -0
  22. package/dist/Grid-QToZdaRT.js +1 -0
  23. package/dist/HardBreak-B2tFO31P.mjs +13 -0
  24. package/dist/HardBreak-Dbf5Zg5o.js +1 -0
  25. package/dist/Heading-BElRvhGn.mjs +21 -0
  26. package/dist/Heading-BUnffIAz.js +1 -0
  27. package/dist/HorizontalRule-BRG45oT0.mjs +13 -0
  28. package/dist/HorizontalRule-CE09LZGf.js +1 -0
  29. package/dist/IFrame-CaAOVLGN.mjs +17 -0
  30. package/dist/IFrame-DcCpSoDC.js +1 -0
  31. package/dist/Image-C8v5dCij.mjs +105 -0
  32. package/dist/Image-cHL85CXs.js +1 -0
  33. package/dist/ListItem-BrjxeGxz.js +1 -0
  34. package/dist/ListItem-X0T7a_z8.mjs +15 -0
  35. package/dist/MathDisplay-CESKZV46.js +1 -0
  36. package/dist/MathDisplay-CoGsFzXW.mjs +30 -0
  37. package/dist/MathInline-0xTZoIIq.mjs +30 -0
  38. package/dist/MathInline-C_1SJUVz.js +1 -0
  39. package/dist/McChoices-Aj394G5E.mjs +52 -0
  40. package/dist/McChoices-B4euzY7M.js +1 -0
  41. package/dist/McQuestion-Dq0aM5tC.js +1 -0
  42. package/dist/McQuestion-DvD-J47M.mjs +38 -0
  43. package/dist/McSolution-C5sTXz3y.mjs +24 -0
  44. package/dist/McSolution-N79CllH9.js +1 -0
  45. package/dist/MultipleChoice-DTCF3Q8m.js +1 -0
  46. package/dist/MultipleChoice-Dv-k1zUU.mjs +47 -0
  47. package/dist/OrderedList-B8v1gchv.mjs +17 -0
  48. package/dist/OrderedList-DMl3tvwP.js +1 -0
  49. package/dist/Paragraph-CzRSCJNr.js +1 -0
  50. package/dist/Paragraph-DGcZy8t_.mjs +16 -0
  51. package/dist/SlotNode-6OpoUcOa.mjs +10 -0
  52. package/dist/SlotNode-DMG0R6Vf.js +1 -0
  53. package/dist/TableCell-BY9gdldc.js +1 -0
  54. package/dist/TableCell-Bp52L368.mjs +20 -0
  55. package/dist/TableContainer-C5KXY6f7.js +1 -0
  56. package/dist/TableContainer-C9PhNGlz.mjs +29 -0
  57. package/dist/TableHeader-BTuqvorM.js +1 -0
  58. package/dist/TableHeader-C7KKz3e1.mjs +17 -0
  59. package/dist/TableRow-D4F6AKFt.js +1 -0
  60. package/dist/TableRow-OzpVq1qW.mjs +15 -0
  61. package/dist/Text-Br_pcGz4.mjs +78 -0
  62. package/dist/Text-DlUfrsNI.js +1 -0
  63. package/dist/emoji-Bk6FG72F.js +1 -0
  64. package/dist/emoji-CmOToDEU.mjs +3711 -0
  65. package/dist/index-D2CtpNvR.js +1 -0
  66. package/dist/index-DVmWCrQE.mjs +159 -0
  67. package/dist/index.cjs.js +1 -0
  68. package/dist/index.es.js +4 -0
  69. package/dist/katex-CS0ZfoxP.js +261 -0
  70. package/dist/katex-r9TeExgs.mjs +11690 -0
  71. package/dist/prosemirror-render.css +1 -0
  72. package/dist/types/apis/monitor.d.ts +9 -0
  73. package/dist/types/apis/tingwu.d.ts +14 -0
  74. package/dist/types/apis/types.d.ts +23 -0
  75. package/dist/types/components/TreeRecursive.vue.d.ts +7 -0
  76. package/dist/types/components/TreeRender.vue.d.ts +9 -0
  77. package/dist/types/components/collections/async/AsyncError.vue.d.ts +3 -0
  78. package/dist/types/components/collections/async/AsyncLoading.vue.d.ts +3 -0
  79. package/dist/types/components/collections/attachment/AttachmentBlock.vue.d.ts +7 -0
  80. package/dist/types/components/collections/attachment/AttachmentInline.vue.d.ts +7 -0
  81. package/dist/types/components/collections/attachment/AttachmentMenu.vue.d.ts +16 -0
  82. package/dist/types/components/collections/attachment/VideoDetail.vue.d.ts +7 -0
  83. package/dist/types/components/collections/attachment/index.d.ts +1 -0
  84. package/dist/types/components/collections/basic/Blockquote.vue.d.ts +17 -0
  85. package/dist/types/components/collections/basic/BulletList.vue.d.ts +17 -0
  86. package/dist/types/components/collections/basic/HardBreak.vue.d.ts +7 -0
  87. package/dist/types/components/collections/basic/Heading.vue.d.ts +17 -0
  88. package/dist/types/components/collections/basic/HorizontalRule.vue.d.ts +7 -0
  89. package/dist/types/components/collections/basic/ListItem.vue.d.ts +17 -0
  90. package/dist/types/components/collections/basic/OrderedList.vue.d.ts +17 -0
  91. package/dist/types/components/collections/basic/Paragraph.vue.d.ts +17 -0
  92. package/dist/types/components/collections/basic/Text.vue.d.ts +7 -0
  93. package/dist/types/components/collections/basic/index.d.ts +1 -0
  94. package/dist/types/components/collections/callout/Callout.vue.d.ts +7 -0
  95. package/dist/types/components/collections/callout/index.d.ts +1 -0
  96. package/dist/types/components/collections/code/CellOutput.vue.d.ts +7 -0
  97. package/dist/types/components/collections/code/CodeBlock.vue.d.ts +7 -0
  98. package/dist/types/components/collections/code/index.d.ts +1 -0
  99. package/dist/types/components/collections/fold/FoldBlock.vue.d.ts +7 -0
  100. package/dist/types/components/collections/fold/index.d.ts +1 -0
  101. package/dist/types/components/collections/grid/Grid.vue.d.ts +7 -0
  102. package/dist/types/components/collections/grid/index.d.ts +1 -0
  103. package/dist/types/components/collections/iframe/IFrame.vue.d.ts +7 -0
  104. package/dist/types/components/collections/iframe/index.d.ts +1 -0
  105. package/dist/types/components/collections/img/Image.vue.d.ts +7 -0
  106. package/dist/types/components/collections/img/index.d.ts +1 -0
  107. package/dist/types/components/collections/index.d.ts +1 -0
  108. package/dist/types/components/collections/math/MathDisplay.vue.d.ts +7 -0
  109. package/dist/types/components/collections/math/MathInline.vue.d.ts +7 -0
  110. package/dist/types/components/collections/math/index.d.ts +1 -0
  111. package/dist/types/components/collections/multipleChoice/McChoices.vue.d.ts +16 -0
  112. package/dist/types/components/collections/multipleChoice/McQuestion.vue.d.ts +7 -0
  113. package/dist/types/components/collections/multipleChoice/McSolution.vue.d.ts +8 -0
  114. package/dist/types/components/collections/multipleChoice/MultipleChoice.vue.d.ts +7 -0
  115. package/dist/types/components/collections/multipleChoice/index.d.ts +1 -0
  116. package/dist/types/components/collections/table/TableCell.vue.d.ts +17 -0
  117. package/dist/types/components/collections/table/TableContainer.vue.d.ts +17 -0
  118. package/dist/types/components/collections/table/TableHeader.vue.d.ts +17 -0
  119. package/dist/types/components/collections/table/TableRow.vue.d.ts +17 -0
  120. package/dist/types/components/collections/table/index.d.ts +1 -0
  121. package/dist/types/components/collections/utils.d.ts +2 -0
  122. package/dist/types/components/collections/wrapper/Doc.vue.d.ts +17 -0
  123. package/dist/types/components/collections/wrapper/SlotNode.vue.d.ts +13 -0
  124. package/dist/types/components/collections/wrapper/index.d.ts +1 -0
  125. package/dist/types/components/index.d.ts +1 -0
  126. package/dist/types/icons/Attachment/CardView.vue.d.ts +9 -0
  127. package/dist/types/icons/Attachment/Code/Bat.vue.d.ts +3 -0
  128. package/dist/types/icons/Attachment/Code/C.vue.d.ts +3 -0
  129. package/dist/types/icons/Attachment/Code/Cpp.vue.d.ts +3 -0
  130. package/dist/types/icons/Attachment/Code/Css.vue.d.ts +3 -0
  131. package/dist/types/icons/Attachment/Code/Go.vue.d.ts +3 -0
  132. package/dist/types/icons/Attachment/Code/Html.vue.d.ts +3 -0
  133. package/dist/types/icons/Attachment/Code/Java.vue.d.ts +3 -0
  134. package/dist/types/icons/Attachment/Code/Js.vue.d.ts +3 -0
  135. package/dist/types/icons/Attachment/Code/Json.vue.d.ts +3 -0
  136. package/dist/types/icons/Attachment/Code/Jsx.vue.d.ts +3 -0
  137. package/dist/types/icons/Attachment/Code/Md.vue.d.ts +3 -0
  138. package/dist/types/icons/Attachment/Code/Php.vue.d.ts +3 -0
  139. package/dist/types/icons/Attachment/Code/Python.vue.d.ts +3 -0
  140. package/dist/types/icons/Attachment/Code/Rb.vue.d.ts +3 -0
  141. package/dist/types/icons/Attachment/Code/Sh.vue.d.ts +3 -0
  142. package/dist/types/icons/Attachment/Code/Sql.vue.d.ts +3 -0
  143. package/dist/types/icons/Attachment/Code/Swift.vue.d.ts +3 -0
  144. package/dist/types/icons/Attachment/Code/Ts.vue.d.ts +3 -0
  145. package/dist/types/icons/Attachment/Code/Tsx.vue.d.ts +3 -0
  146. package/dist/types/icons/Attachment/Code/Vue.vue.d.ts +3 -0
  147. package/dist/types/icons/Attachment/Excel.vue.d.ts +3 -0
  148. package/dist/types/icons/Attachment/Eye.vue.d.ts +3 -0
  149. package/dist/types/icons/Attachment/FullScreen.vue.d.ts +3 -0
  150. package/dist/types/icons/Attachment/InlineView.vue.d.ts +9 -0
  151. package/dist/types/icons/Attachment/Pdf.vue.d.ts +3 -0
  152. package/dist/types/icons/Attachment/Ppt.vue.d.ts +3 -0
  153. package/dist/types/icons/Attachment/PreviewView.vue.d.ts +9 -0
  154. package/dist/types/icons/Attachment/UnknownFile.vue.d.ts +3 -0
  155. package/dist/types/icons/Attachment/VideoIcon.vue.d.ts +3 -0
  156. package/dist/types/icons/Attachment/VideoPlay.vue.d.ts +3 -0
  157. package/dist/types/icons/Attachment/Word.vue.d.ts +3 -0
  158. package/dist/types/icons/Code/Confirm.vue.d.ts +3 -0
  159. package/dist/types/icons/Code/Paste.vue.d.ts +3 -0
  160. package/dist/types/icons/Common/Choice.vue.d.ts +3 -0
  161. package/dist/types/icons/Common/Close.vue.d.ts +3 -0
  162. package/dist/types/icons/Common/Comment.vue.d.ts +3 -0
  163. package/dist/types/icons/Common/CopyAnchorLink.vue.d.ts +3 -0
  164. package/dist/types/icons/Common/Delete.vue.d.ts +3 -0
  165. package/dist/types/icons/Common/Download.vue.d.ts +3 -0
  166. package/dist/types/icons/Common/FoldClose.vue.d.ts +3 -0
  167. package/dist/types/icons/Common/FoldOpen.vue.d.ts +3 -0
  168. package/dist/types/icons/Common/Plate.vue.d.ts +3 -0
  169. package/dist/types/icons/Common/Question.vue.d.ts +3 -0
  170. package/dist/types/icons/Common/ShareTextLink.vue.d.ts +3 -0
  171. package/dist/types/index.d.ts +2 -0
  172. package/dist/types/types.d.ts +269 -0
  173. package/dist/types/utils/common.d.ts +1 -0
  174. package/dist/types/utils/emoji.d.ts +10 -0
  175. package/dist/types/utils/globalStatus.d.ts +16 -0
  176. package/dist/types/utils/shiki.d.ts +3 -0
  177. package/dist/types/utils/useAttachment.d.ts +8 -0
  178. package/package.json +29 -0
  179. package/src/apis/monitor.ts +8 -0
  180. package/src/apis/tingwu.ts +22 -0
  181. package/src/apis/types.ts +45 -0
  182. package/src/components/TreeRecursive.vue +47 -0
  183. package/src/components/TreeRender.vue +404 -0
  184. package/src/components/collections/async/AsyncError.vue +17 -0
  185. package/src/components/collections/async/AsyncLoading.vue +1 -0
  186. package/src/components/collections/attachment/AttachmentBlock.vue +561 -0
  187. package/src/components/collections/attachment/AttachmentInline.vue +90 -0
  188. package/src/components/collections/attachment/AttachmentMenu.vue +359 -0
  189. package/src/components/collections/attachment/VideoDetail.vue +375 -0
  190. package/src/components/collections/attachment/index.ts +6 -0
  191. package/src/components/collections/basic/Blockquote.vue +15 -0
  192. package/src/components/collections/basic/BulletList.vue +15 -0
  193. package/src/components/collections/basic/HardBreak.vue +11 -0
  194. package/src/components/collections/basic/Heading.vue +15 -0
  195. package/src/components/collections/basic/HorizontalRule.vue +11 -0
  196. package/src/components/collections/basic/ListItem.vue +15 -0
  197. package/src/components/collections/basic/OrderedList.vue +15 -0
  198. package/src/components/collections/basic/Paragraph.vue +19 -0
  199. package/src/components/collections/basic/Text.vue +73 -0
  200. package/src/components/collections/basic/index.ts +13 -0
  201. package/src/components/collections/callout/Callout.vue +77 -0
  202. package/src/components/collections/callout/index.ts +5 -0
  203. package/src/components/collections/code/CellOutput.vue +72 -0
  204. package/src/components/collections/code/CodeBlock.vue +83 -0
  205. package/src/components/collections/code/index.ts +6 -0
  206. package/src/components/collections/fold/FoldBlock.vue +130 -0
  207. package/src/components/collections/fold/index.ts +5 -0
  208. package/src/components/collections/grid/Grid.vue +70 -0
  209. package/src/components/collections/grid/index.ts +5 -0
  210. package/src/components/collections/iframe/IFrame.vue +19 -0
  211. package/src/components/collections/iframe/index.ts +5 -0
  212. package/src/components/collections/img/Image.vue +318 -0
  213. package/src/components/collections/img/index.ts +5 -0
  214. package/src/components/collections/index.ts +29 -0
  215. package/src/components/collections/math/MathDisplay.vue +42 -0
  216. package/src/components/collections/math/MathInline.vue +42 -0
  217. package/src/components/collections/math/index.ts +6 -0
  218. package/src/components/collections/multipleChoice/McChoices.vue +72 -0
  219. package/src/components/collections/multipleChoice/McQuestion.vue +61 -0
  220. package/src/components/collections/multipleChoice/McSolution.vue +47 -0
  221. package/src/components/collections/multipleChoice/MultipleChoice.vue +62 -0
  222. package/src/components/collections/multipleChoice/index.ts +8 -0
  223. package/src/components/collections/table/TableCell.vue +20 -0
  224. package/src/components/collections/table/TableContainer.vue +32 -0
  225. package/src/components/collections/table/TableHeader.vue +15 -0
  226. package/src/components/collections/table/TableRow.vue +15 -0
  227. package/src/components/collections/table/index.ts +8 -0
  228. package/src/components/collections/utils.ts +17 -0
  229. package/src/components/collections/wrapper/Doc.vue +15 -0
  230. package/src/components/collections/wrapper/SlotNode.vue +5 -0
  231. package/src/components/collections/wrapper/index.ts +6 -0
  232. package/src/components/index.ts +1 -0
  233. package/src/icons/Attachment/CardView.vue +21 -0
  234. package/src/icons/Attachment/Code/Bat.vue +26 -0
  235. package/src/icons/Attachment/Code/C.vue +26 -0
  236. package/src/icons/Attachment/Code/Cpp.vue +26 -0
  237. package/src/icons/Attachment/Code/Css.vue +34 -0
  238. package/src/icons/Attachment/Code/Go.vue +26 -0
  239. package/src/icons/Attachment/Code/Html.vue +34 -0
  240. package/src/icons/Attachment/Code/Java.vue +42 -0
  241. package/src/icons/Attachment/Code/Js.vue +26 -0
  242. package/src/icons/Attachment/Code/Json.vue +26 -0
  243. package/src/icons/Attachment/Code/Jsx.vue +30 -0
  244. package/src/icons/Attachment/Code/Md.vue +26 -0
  245. package/src/icons/Attachment/Code/Php.vue +26 -0
  246. package/src/icons/Attachment/Code/Python.vue +30 -0
  247. package/src/icons/Attachment/Code/Rb.vue +26 -0
  248. package/src/icons/Attachment/Code/Sh.vue +30 -0
  249. package/src/icons/Attachment/Code/Sql.vue +30 -0
  250. package/src/icons/Attachment/Code/Swift.vue +26 -0
  251. package/src/icons/Attachment/Code/Ts.vue +26 -0
  252. package/src/icons/Attachment/Code/Tsx.vue +30 -0
  253. package/src/icons/Attachment/Code/Vue.vue +24 -0
  254. package/src/icons/Attachment/Excel.vue +26 -0
  255. package/src/icons/Attachment/Eye.vue +15 -0
  256. package/src/icons/Attachment/FullScreen.vue +15 -0
  257. package/src/icons/Attachment/InlineView.vue +21 -0
  258. package/src/icons/Attachment/Pdf.vue +25 -0
  259. package/src/icons/Attachment/Ppt.vue +26 -0
  260. package/src/icons/Attachment/PreviewView.vue +21 -0
  261. package/src/icons/Attachment/UnknownFile.vue +26 -0
  262. package/src/icons/Attachment/VideoIcon.vue +25 -0
  263. package/src/icons/Attachment/VideoPlay.vue +15 -0
  264. package/src/icons/Attachment/Word.vue +26 -0
  265. package/src/icons/Code/Confirm.vue +38 -0
  266. package/src/icons/Code/Paste.vue +8 -0
  267. package/src/icons/Common/Choice.vue +28 -0
  268. package/src/icons/Common/Close.vue +15 -0
  269. package/src/icons/Common/Comment.vue +16 -0
  270. package/src/icons/Common/CopyAnchorLink.vue +15 -0
  271. package/src/icons/Common/Delete.vue +15 -0
  272. package/src/icons/Common/Download.vue +15 -0
  273. package/src/icons/Common/FoldClose.vue +9 -0
  274. package/src/icons/Common/FoldOpen.vue +9 -0
  275. package/src/icons/Common/Plate.vue +23 -0
  276. package/src/icons/Common/Question.vue +8 -0
  277. package/src/icons/Common/ShareTextLink.vue +15 -0
  278. package/src/index.ts +3 -0
  279. package/src/types.ts +236 -0
  280. package/src/utils/common.ts +6 -0
  281. package/src/utils/emoji.ts +3715 -0
  282. package/src/utils/globalStatus.ts +19 -0
  283. package/src/utils/shiki.ts +25 -0
  284. package/src/utils/useAttachment.ts +215 -0
  285. package/tsconfig.build.json +10 -0
  286. package/tsconfig.json +23 -0
  287. package/vite.config.ts +24 -0
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@datawhale/prosemirror-render",
3
+ "version": "0.0.1",
4
+ "main": "index.js",
5
+ "scripts": {
6
+ "build": "vite build && vue-tsc -p tsconfig.build.json"
7
+ },
8
+ "keywords": [],
9
+ "author": "",
10
+ "license": "ISC",
11
+ "description": "",
12
+ "devDependencies": {
13
+ "@types/katex": "^0.16.7",
14
+ "@types/node": "^25.0.3",
15
+ "@vitejs/plugin-vue": "^6.0.3",
16
+ "@vue/tsconfig": "^0.8.1",
17
+ "sass-embedded": "^1.97.1",
18
+ "shiki": "^1.29.2",
19
+ "typescript": "^5.9.3",
20
+ "vite": "^7.3.0",
21
+ "vue-tsc": "^3.2.1"
22
+ },
23
+ "dependencies": {
24
+ "ansi-to-vue3": "^0.1.2",
25
+ "axios": "^1.13.2",
26
+ "katex": "^0.16.27",
27
+ "vue": "^3.5.26"
28
+ }
29
+ }
@@ -0,0 +1,8 @@
1
+ import type { HTTPClientType } from "./types";
2
+
3
+ export async function monitorApi(
4
+ service: HTTPClientType,
5
+ data: { log: string }
6
+ ) {
7
+ return await service.post("/api/monitor", { data });
8
+ }
@@ -0,0 +1,22 @@
1
+ import type { HTTPClientType } from "./types";
2
+
3
+ export type VideoProgressDetail = {
4
+ id?: number;
5
+ videoUrl?: string;
6
+ progress?: number;
7
+ tingwuTaskId?: string;
8
+ tingwuStatus?: "pending" | "running" | "done" | "failed";
9
+ chapters: string;
10
+ summary: string;
11
+ keywords: string;
12
+ };
13
+
14
+ export async function videoProgressDetailApi(
15
+ service: HTTPClientType,
16
+ params: { taskId: string }
17
+ ): Promise<VideoProgressDetail> {
18
+ const response = await service.get("/admin/editor/v2/videoProgressDetail", {
19
+ params,
20
+ });
21
+ return response.data;
22
+ }
@@ -0,0 +1,45 @@
1
+ type HTTPResponse<T = any> = {
2
+ data: T;
3
+ code: number;
4
+ message: string;
5
+ traceId: string;
6
+ };
7
+
8
+ type HTTPOptions<P = any, D = any> = {
9
+ data?: D;
10
+ params?: P;
11
+ headers?: Record<string, any>;
12
+ timeout?: number;
13
+ };
14
+
15
+ type CustomConfig = {
16
+ ignoreErrHandler?: boolean; // 是否不使用错误拦截
17
+ };
18
+
19
+ export interface HTTPClientType {
20
+ get<P = any, R = any>(
21
+ url: string,
22
+ options?: HTTPOptions<P>,
23
+ customConfig?: CustomConfig
24
+ ): Promise<HTTPResponse<R>>;
25
+
26
+ post<D = any, R = any, P = any>(
27
+ url: string,
28
+ options?: HTTPOptions<P, D>,
29
+ customConfig?: CustomConfig
30
+ ): Promise<HTTPResponse<R>>;
31
+
32
+ patch<D = any, R = any, P = any>(
33
+ url: string,
34
+ options?: HTTPOptions<P, D>,
35
+ customConfig?: CustomConfig
36
+ ): Promise<HTTPResponse<R>>;
37
+
38
+ delete<D = any, R = any, P = any>(
39
+ url: string,
40
+ options?: HTTPOptions<P, D>,
41
+ customConfig?: CustomConfig
42
+ ): Promise<HTTPResponse<R>>;
43
+ }
44
+
45
+ export const axiosKey = Symbol();
@@ -0,0 +1,47 @@
1
+ <template>
2
+ <Suspense>
3
+ <component :is="componentMapper[node.type]" :node="node" v-bind="dataBlockId">
4
+ <template v-if="node.content && !(node.type in ['foldBlock', 'grid', 'callout'])">
5
+ <TreeRecursive v-for="child in node.content" :node="child" :key="useId()" />
6
+ </template>
7
+ </component>
8
+ </Suspense>
9
+ </template>
10
+
11
+ <script setup lang="ts">
12
+ import { computed, useId } from 'vue';
13
+ import type { PMNode } from '@datawhale/dipwap-types/index';
14
+ import { componentMapper } from './collections';
15
+
16
+ const { node } = defineProps<{
17
+ node: PMNode;
18
+ }>();
19
+
20
+ const dataBlockIdContainerNames = new Set<string>([
21
+ 'blockquote',
22
+ 'orderedList',
23
+ 'bulletList',
24
+ 'paragraph',
25
+ 'math_display',
26
+ 'codeBlock',
27
+ 'cellOutput',
28
+ 'callout',
29
+ 'foldBlock',
30
+ 'image',
31
+ 'attachment-block',
32
+ 'grid',
33
+ 'table',
34
+ 'iframe',
35
+ 'multipleChoice',
36
+ ]);
37
+
38
+ const dataBlockId = computed(() => {
39
+ // @ts-ignore every node here has a block-id
40
+ if (dataBlockIdContainerNames.has(node.type) && node.attrs && node.attrs['block-id']) {
41
+ // @ts-ignore every node here has a block-id
42
+ return { 'data-block-id': node.attrs['block-id'] };
43
+ } else {
44
+ return {};
45
+ }
46
+ });
47
+ </script>
@@ -0,0 +1,404 @@
1
+ <template>
2
+ <div class="tree-render">
3
+ <TreeRecursive :node="node" />
4
+ </div>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import { provide, watch } from 'vue';
9
+ import { type HTTPClientType, axiosKey } from '@datawhale/dipwap-render/apis/types';
10
+ import type { PMNode } from '@datawhale/dipwap-types/index';
11
+ import { getAllImageNodes, imageNodes, imageNodesKey } from '../utils/globalStatus';
12
+ import TreeRecursive from './TreeRecursive.vue';
13
+
14
+ const { node, axios } = defineProps<{
15
+ node: PMNode;
16
+ axios: HTTPClientType;
17
+ }>();
18
+
19
+ provide(imageNodesKey, imageNodes);
20
+ provide(axiosKey, axios);
21
+
22
+ watch(
23
+ () => node,
24
+ (newNode) => {
25
+ imageNodes.value = getAllImageNodes(newNode);
26
+ },
27
+ );
28
+ </script>
29
+
30
+ <style lang="scss">
31
+ .tree-render {
32
+ mark {
33
+ color: inherit;
34
+ background-color: inherit;
35
+ }
36
+ min-height: calc(100vh - 232.25px);
37
+ outline: none;
38
+ width: 100%;
39
+ box-sizing: border-box;
40
+ ::selection {
41
+ background-color: rgba(20, 86, 240, 0.18);
42
+ /* 选中背景颜色 */
43
+ }
44
+ color: rgb(31, 35, 41);
45
+ letter-spacing: 0.28px;
46
+ word-wrap: break-word;
47
+ font-family:
48
+ LarkHackSafariFont,
49
+ LarkEmojiFont,
50
+ LarkChineseQuote,
51
+ -apple-system,
52
+ BlinkMacSystemFont,
53
+ Helvetica Neue,
54
+ Tahoma,
55
+ PingFang SC,
56
+ Microsoft Yahei,
57
+ Arial,
58
+ Hiragino Sans GB,
59
+ sans-serif,
60
+ Apple Color Emoji,
61
+ Segoe UI Emoji,
62
+ Segoe UI Symbol,
63
+ Noto Color Emoji;
64
+ code {
65
+ font-family: 'Source Code Pro', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', 'Microsoft Yahei';
66
+ }
67
+ h1,
68
+ h2,
69
+ h3,
70
+ h4,
71
+ h5,
72
+ h6 {
73
+ font-weight: 600;
74
+ letter-spacing: -0.52px;
75
+ code {
76
+ box-sizing: border-box;
77
+ margin: 0 3px;
78
+ padding: 1px 2px;
79
+ background-color: rgb(245, 246, 247);
80
+ border-radius: 4px;
81
+ border: 1px solid rgb(222, 224, 227);
82
+ }
83
+ }
84
+ & .doc > h1:first-child {
85
+ margin-top: 22px;
86
+ }
87
+ h1 {
88
+ margin-top: 26px;
89
+ margin-bottom: 10px;
90
+ font-size: 26px;
91
+ line-height: 36.4px;
92
+ }
93
+ h2 {
94
+ margin-top: 22px;
95
+ margin-bottom: 8px;
96
+ font-size: 22px;
97
+ line-height: 30.8px;
98
+ }
99
+ h3 {
100
+ margin-top: 20px;
101
+ margin-bottom: 8px;
102
+ font-size: 20px;
103
+ line-height: 28px;
104
+ }
105
+ h4 {
106
+ margin-top: 18px;
107
+ margin-bottom: 8px;
108
+ font-size: 18px;
109
+ line-height: 25.2px;
110
+ }
111
+ h5 {
112
+ margin-top: 18px;
113
+ margin-bottom: 8px;
114
+ font-size: 16px;
115
+ line-height: 22.4px;
116
+ }
117
+ h6 {
118
+ margin-top: 16px;
119
+ margin-bottom: 8px;
120
+ font-size: 16px;
121
+ line-height: 22.4px;
122
+ }
123
+ hr {
124
+ border: none;
125
+ margin: 8px 0;
126
+ height: 26px;
127
+ position: relative;
128
+ &::after {
129
+ content: '';
130
+ position: absolute;
131
+ top: 50%;
132
+ left: 0;
133
+ width: 100%;
134
+ height: 1px;
135
+ background-color: rgba(31, 35, 41, 0.15);
136
+ transform: translateY(-50%);
137
+ }
138
+ }
139
+ blockquote {
140
+ border-left: 2px solid rgb(187, 191, 196);
141
+ padding-left: 12px;
142
+ p {
143
+ color: rgb(100, 106, 115);
144
+ }
145
+ }
146
+ span.math-src {
147
+ div[contenteditable='true'] {
148
+ outline: none;
149
+ }
150
+ }
151
+ p {
152
+ margin: 8px 0;
153
+ line-height: 26px;
154
+ font-size: 16px;
155
+ font-weight: 400;
156
+ white-space-collapse: break-spaces;
157
+ text-wrap-mode: wrap;
158
+ a {
159
+ color: rgb(51, 109, 244);
160
+ text-decoration: none;
161
+ cursor: pointer;
162
+ &:hover {
163
+ text-decoration: underline;
164
+ text-decoration-color: rgb(51, 109, 244);
165
+ }
166
+ }
167
+ strong {
168
+ font-weight: 700;
169
+ }
170
+ em {
171
+ font-style: italic;
172
+ }
173
+ del {
174
+ text-decoration: line-through;
175
+ }
176
+ u {
177
+ text-decoration: underline;
178
+ }
179
+ code {
180
+ box-sizing: border-box;
181
+ margin: 0 3px;
182
+ padding: 1px 2px;
183
+ background-color: rgb(245, 246, 247);
184
+ border-radius: 4px;
185
+ border: 1px solid rgb(222, 224, 227);
186
+ }
187
+ }
188
+ ul {
189
+ margin-left: 22px;
190
+ margin-top: 8px;
191
+ margin-bottom: 8px;
192
+ & > li::marker {
193
+ content: '• ';
194
+ color: rgb(20, 86, 240);
195
+ font-size: 16px;
196
+ }
197
+ ul {
198
+ & > li::marker {
199
+ content: '◦ ';
200
+ color: rgb(20, 86, 240);
201
+ font-size: 16px;
202
+ }
203
+ ul {
204
+ & > li::marker {
205
+ content: '▪ ';
206
+ color: rgb(20, 86, 240);
207
+ font-size: 16px;
208
+ }
209
+ ul {
210
+ & > li::marker {
211
+ content: '• ';
212
+ color: rgb(20, 86, 240);
213
+ font-size: 16px;
214
+ }
215
+ ul {
216
+ & > li::marker {
217
+ content: '◦ ';
218
+ color: rgb(20, 86, 240);
219
+ font-size: 16px;
220
+ }
221
+ }
222
+ }
223
+ }
224
+ }
225
+ }
226
+ li {
227
+ margin: 8px 0;
228
+ }
229
+ ol {
230
+ margin-left: 29px;
231
+ list-style-type: decimal;
232
+ li::marker {
233
+ color: rgb(20, 86, 240);
234
+ font-family: 'Helvetica Neue', Consolas;
235
+ }
236
+ ol {
237
+ list-style-type: lower-alpha;
238
+ ol {
239
+ list-style-type: lower-roman;
240
+ ol {
241
+ list-style-type: decimal;
242
+ ol {
243
+ list-style-type: lower-alpha;
244
+ }
245
+ }
246
+ }
247
+ }
248
+ }
249
+ .tiptap .shiki {
250
+ border-radius: 4px;
251
+ padding: 8px;
252
+ }
253
+ .tiptap .shiki:focus-visible {
254
+ outline: 2px solid transparent;
255
+ outline-offset: 2px;
256
+ }
257
+ pre {
258
+ padding: 24px;
259
+ border-radius: 6px;
260
+ margin: 16px 0;
261
+ outline: none;
262
+ box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
263
+ overflow-x: auto;
264
+ background-color: rgb(245, 246, 247);
265
+ code {
266
+ width: 100%;
267
+ outline: none;
268
+ line-height: 22px;
269
+ font-size: 14px;
270
+ span {
271
+ text-wrap-mode: nowrap;
272
+ }
273
+ }
274
+ }
275
+ .tableWrapper {
276
+ margin: 24px 0;
277
+ max-width: 100%;
278
+ overflow-x: auto;
279
+ }
280
+ table {
281
+ th,
282
+ td {
283
+ min-width: 39px;
284
+ border: 1px solid rgb(222, 224, 227);
285
+ padding: 12px;
286
+ position: relative;
287
+ :not(a.grip-column):not(a.grip-row):nth-child(1),
288
+ a.grip-column + :not(a.grip-row):nth-child(2),
289
+ a.grip-row + :not(a.grip-column):nth-child(2),
290
+ a.grip-column + *:nth-child(3),
291
+ a.grip-row + *:nth-child(3) {
292
+ margin-top: 0;
293
+ }
294
+ :not(a.grip-column):not(a.grip-row):nth-last-child(1),
295
+ :not(a.grip-column):not(a.grip-row):nth-last-child(2) {
296
+ margin-bottom: 0;
297
+ }
298
+ }
299
+ .column-resize-handle {
300
+ background-color: rgb(20, 86, 240);
301
+ bottom: 0px;
302
+ pointer-events: none;
303
+ position: absolute;
304
+ right: -1px;
305
+ top: 0;
306
+ width: 2px;
307
+ }
308
+ .selectedCell {
309
+ background-color: rgba(20, 86, 240, 0.18) !important;
310
+ // filter: brightness(0.9);
311
+ }
312
+ .grip-column,
313
+ .grip-row {
314
+ display: flex;
315
+ align-items: center;
316
+ justify-content: center;
317
+ position: absolute;
318
+ z-index: 10;
319
+ background-color: rgb(239, 240, 241);
320
+ cursor: pointer;
321
+ }
322
+ .grip-column {
323
+ width: 100%;
324
+ height: 8px;
325
+ left: 0;
326
+ top: -8px;
327
+ margin-left: -1px;
328
+ margin-top: -1px;
329
+ border-left: 1px solid rgb(239, 240, 241);
330
+ border-right: 1px solid rgb(239, 240, 241);
331
+ &:hover,
332
+ &.selected {
333
+ z-index: 15;
334
+ &::before {
335
+ content: '';
336
+ width: 10px;
337
+ }
338
+ }
339
+ &:hover {
340
+ border-left: 1px solid rgb(227, 227, 227);
341
+ border-right: 1px solid rgb(227, 227, 227);
342
+ background-color: rgb(227, 227, 227);
343
+ &::before {
344
+ border-bottom: 2px dotted rgb(95, 95, 95);
345
+ }
346
+ }
347
+ &.selected {
348
+ border-left: 1px solid rgb(20, 86, 240);
349
+ border-right: 1px solid rgb(20, 86, 240);
350
+ background-color: rgb(20, 86, 240);
351
+ &::before {
352
+ border-bottom: 2px dotted rgb(251, 251, 251);
353
+ }
354
+ }
355
+ &.first {
356
+ border-top-left-radius: 4px;
357
+ }
358
+ &.last {
359
+ border-top-right-radius: 4px;
360
+ }
361
+ }
362
+ .grip-row {
363
+ width: 8px;
364
+ height: 100%;
365
+ top: 0;
366
+ left: -8px;
367
+ margin-top: -1px;
368
+ margin-left: -1px;
369
+ border-top: 1px solid rgb(239, 240, 241);
370
+ border-bottom: 1px solid rgb(239, 240, 241);
371
+ &:hover,
372
+ &.selected {
373
+ z-index: 15;
374
+ &::before {
375
+ content: '';
376
+ height: 10px;
377
+ }
378
+ }
379
+ &:hover {
380
+ border-top: 1px solid rgb(227, 227, 227);
381
+ border-bottom: 1px solid rgb(227, 227, 227);
382
+ background-color: rgb(227, 227, 227);
383
+ &::before {
384
+ border-left: 2px dotted rgb(95, 95, 95);
385
+ }
386
+ }
387
+ &.selected {
388
+ border-top: 1px solid rgb(20, 86, 240);
389
+ border-bottom: 1px solid rgb(20, 86, 240);
390
+ background-color: rgb(20, 86, 240);
391
+ &::before {
392
+ border-left: 2px dotted rgb(251, 251, 251);
393
+ }
394
+ }
395
+ &.first {
396
+ border-top-left-radius: 4px;
397
+ }
398
+ &.last {
399
+ border-bottom-left-radius: 4px;
400
+ }
401
+ }
402
+ }
403
+ }
404
+ </style>
@@ -0,0 +1,17 @@
1
+ <template>
2
+ <div class="error-wrapper">组件加载失败</div>
3
+ </template>
4
+
5
+ <style scoped>
6
+ .error-wrapper {
7
+ width: 160px;
8
+ height: 90px;
9
+ display: flex;
10
+ align-items: center;
11
+ justify-content: center;
12
+ color: rgb(136, 46, 46);
13
+ font-size: 12px;
14
+ border: 1px solid #888;
15
+ border-radius: 8px;
16
+ }
17
+ </style>
@@ -0,0 +1 @@
1
+ <template>loading...</template>