@datawhale/prosemirror-render 0.0.1 → 0.0.3

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 (199) hide show
  1. package/dist/{AttachmentBlock-ChMNTUOo.mjs → AttachmentBlock-BU56Jral.js} +100 -107
  2. package/dist/AttachmentBlock-D4287MIh.cjs +1 -0
  3. package/dist/AttachmentInline-DjENK-yS.cjs +1 -0
  4. package/dist/{AttachmentInline-tbC8BJBy.mjs → AttachmentInline-Dpuxwof6.js} +2 -2
  5. package/dist/{AttachmentMenu-B5x8P9_n.mjs → AttachmentMenu-CGVTP1Yv.js} +1 -1
  6. package/dist/AttachmentMenu-DbbJfEmt.cjs +1 -0
  7. package/dist/{Callout-Cu6HI-xq.mjs → Callout-BXchNfJk.js} +2 -2
  8. package/dist/Callout-DaFC0yQ4.cjs +1 -0
  9. package/dist/{CellOutput-DiKZlIFa.js → CellOutput-B7Lb-RKC.cjs} +1 -1
  10. package/dist/{CellOutput-C33VK0df.mjs → CellOutput-DvijyrkS.js} +1 -1
  11. package/dist/{CodeBlock-Cjuxuq7B.mjs → CodeBlock-B2ZZtPly.js} +1 -1
  12. package/dist/{CodeBlock-DWniNUQB.js → CodeBlock-CdWT5lK0.cjs} +1 -1
  13. package/dist/{FoldBlock-DRdlU-DX.mjs → FoldBlock-DndxoDsF.js} +2 -2
  14. package/dist/FoldBlock-HGN28wvI.cjs +1 -0
  15. package/dist/{Grid-GfmJxM93.mjs → Grid-253iqCMF.js} +1 -1
  16. package/dist/Grid-xOWRvjRR.cjs +1 -0
  17. package/dist/{IFrame-CaAOVLGN.mjs → IFrame-CY4qkGFL.js} +1 -1
  18. package/dist/IFrame-k7fk5enb.cjs +1 -0
  19. package/dist/Image-DkfpQMVQ.cjs +1 -0
  20. package/dist/{Image-C8v5dCij.mjs → Image-R6iVek-9.js} +1 -1
  21. package/dist/MathDisplay-Bimaa4Y6.cjs +1 -0
  22. package/dist/{MathDisplay-CoGsFzXW.mjs → MathDisplay-CEY2k2fV.js} +2 -2
  23. package/dist/{MathInline-0xTZoIIq.mjs → MathInline-Bz9Baz68.js} +2 -2
  24. package/dist/MathInline-C3GWYu2n.cjs +1 -0
  25. package/dist/McChoices-Cq68UY4X.cjs +1 -0
  26. package/dist/{McChoices-Aj394G5E.mjs → McChoices-D3HhRraE.js} +1 -1
  27. package/dist/{McQuestion-DvD-J47M.mjs → McQuestion-BtWjhEnd.js} +1 -1
  28. package/dist/McQuestion-D7skHE3m.cjs +1 -0
  29. package/dist/{McSolution-C5sTXz3y.mjs → McSolution-DiMXYCQt.js} +1 -1
  30. package/dist/McSolution-ytOHw96W.cjs +1 -0
  31. package/dist/MultipleChoice-Byg7IpwO.cjs +1 -0
  32. package/dist/{MultipleChoice-Dv-k1zUU.mjs → MultipleChoice-Cl8wfstN.js} +4 -4
  33. package/dist/Paragraph-Bc08aEUA.cjs +1 -0
  34. package/dist/{Paragraph-DGcZy8t_.mjs → Paragraph-BipTa7mo.js} +1 -1
  35. package/dist/SlotNode-BBgyADP6.cjs +1 -0
  36. package/dist/{SlotNode-6OpoUcOa.mjs → SlotNode-Dy-7S7b1.js} +1 -1
  37. package/dist/{Text-Br_pcGz4.mjs → Text-CRiw47FV.js} +1 -1
  38. package/dist/Text-DmgJshdk.cjs +1 -0
  39. package/dist/index-CEnrh8_5.cjs +1 -0
  40. package/dist/{index-DVmWCrQE.mjs → index-CnHgx6Xd.js} +30 -30
  41. package/dist/index.cjs.js +1 -1
  42. package/dist/index.es.js +1 -1
  43. package/dist/prosemirror-render.css +1 -1
  44. package/package.json +10 -3
  45. package/dist/AttachmentBlock-DsmJP3Kw.js +0 -1
  46. package/dist/AttachmentInline-Dc3dp0g-.js +0 -1
  47. package/dist/AttachmentMenu-ExoCOe4B.js +0 -1
  48. package/dist/Callout-DPdOqTb4.js +0 -1
  49. package/dist/FoldBlock-ZPMf0QsR.js +0 -1
  50. package/dist/Grid-QToZdaRT.js +0 -1
  51. package/dist/IFrame-DcCpSoDC.js +0 -1
  52. package/dist/Image-cHL85CXs.js +0 -1
  53. package/dist/MathDisplay-CESKZV46.js +0 -1
  54. package/dist/MathInline-C_1SJUVz.js +0 -1
  55. package/dist/McChoices-B4euzY7M.js +0 -1
  56. package/dist/McQuestion-Dq0aM5tC.js +0 -1
  57. package/dist/McSolution-N79CllH9.js +0 -1
  58. package/dist/MultipleChoice-DTCF3Q8m.js +0 -1
  59. package/dist/Paragraph-CzRSCJNr.js +0 -1
  60. package/dist/SlotNode-DMG0R6Vf.js +0 -1
  61. package/dist/Text-DlUfrsNI.js +0 -1
  62. package/dist/index-D2CtpNvR.js +0 -1
  63. package/src/apis/monitor.ts +0 -8
  64. package/src/apis/tingwu.ts +0 -22
  65. package/src/apis/types.ts +0 -45
  66. package/src/components/TreeRecursive.vue +0 -47
  67. package/src/components/TreeRender.vue +0 -404
  68. package/src/components/collections/async/AsyncError.vue +0 -17
  69. package/src/components/collections/async/AsyncLoading.vue +0 -1
  70. package/src/components/collections/attachment/AttachmentBlock.vue +0 -561
  71. package/src/components/collections/attachment/AttachmentInline.vue +0 -90
  72. package/src/components/collections/attachment/AttachmentMenu.vue +0 -359
  73. package/src/components/collections/attachment/VideoDetail.vue +0 -375
  74. package/src/components/collections/attachment/index.ts +0 -6
  75. package/src/components/collections/basic/Blockquote.vue +0 -15
  76. package/src/components/collections/basic/BulletList.vue +0 -15
  77. package/src/components/collections/basic/HardBreak.vue +0 -11
  78. package/src/components/collections/basic/Heading.vue +0 -15
  79. package/src/components/collections/basic/HorizontalRule.vue +0 -11
  80. package/src/components/collections/basic/ListItem.vue +0 -15
  81. package/src/components/collections/basic/OrderedList.vue +0 -15
  82. package/src/components/collections/basic/Paragraph.vue +0 -19
  83. package/src/components/collections/basic/Text.vue +0 -73
  84. package/src/components/collections/basic/index.ts +0 -13
  85. package/src/components/collections/callout/Callout.vue +0 -77
  86. package/src/components/collections/callout/index.ts +0 -5
  87. package/src/components/collections/code/CellOutput.vue +0 -72
  88. package/src/components/collections/code/CodeBlock.vue +0 -83
  89. package/src/components/collections/code/index.ts +0 -6
  90. package/src/components/collections/fold/FoldBlock.vue +0 -130
  91. package/src/components/collections/fold/index.ts +0 -5
  92. package/src/components/collections/grid/Grid.vue +0 -70
  93. package/src/components/collections/grid/index.ts +0 -5
  94. package/src/components/collections/iframe/IFrame.vue +0 -19
  95. package/src/components/collections/iframe/index.ts +0 -5
  96. package/src/components/collections/img/Image.vue +0 -318
  97. package/src/components/collections/img/index.ts +0 -5
  98. package/src/components/collections/index.ts +0 -29
  99. package/src/components/collections/math/MathDisplay.vue +0 -42
  100. package/src/components/collections/math/MathInline.vue +0 -42
  101. package/src/components/collections/math/index.ts +0 -6
  102. package/src/components/collections/multipleChoice/McChoices.vue +0 -72
  103. package/src/components/collections/multipleChoice/McQuestion.vue +0 -61
  104. package/src/components/collections/multipleChoice/McSolution.vue +0 -47
  105. package/src/components/collections/multipleChoice/MultipleChoice.vue +0 -62
  106. package/src/components/collections/multipleChoice/index.ts +0 -8
  107. package/src/components/collections/table/TableCell.vue +0 -20
  108. package/src/components/collections/table/TableContainer.vue +0 -32
  109. package/src/components/collections/table/TableHeader.vue +0 -15
  110. package/src/components/collections/table/TableRow.vue +0 -15
  111. package/src/components/collections/table/index.ts +0 -8
  112. package/src/components/collections/utils.ts +0 -17
  113. package/src/components/collections/wrapper/Doc.vue +0 -15
  114. package/src/components/collections/wrapper/SlotNode.vue +0 -5
  115. package/src/components/collections/wrapper/index.ts +0 -6
  116. package/src/components/index.ts +0 -1
  117. package/src/icons/Attachment/CardView.vue +0 -21
  118. package/src/icons/Attachment/Code/Bat.vue +0 -26
  119. package/src/icons/Attachment/Code/C.vue +0 -26
  120. package/src/icons/Attachment/Code/Cpp.vue +0 -26
  121. package/src/icons/Attachment/Code/Css.vue +0 -34
  122. package/src/icons/Attachment/Code/Go.vue +0 -26
  123. package/src/icons/Attachment/Code/Html.vue +0 -34
  124. package/src/icons/Attachment/Code/Java.vue +0 -42
  125. package/src/icons/Attachment/Code/Js.vue +0 -26
  126. package/src/icons/Attachment/Code/Json.vue +0 -26
  127. package/src/icons/Attachment/Code/Jsx.vue +0 -30
  128. package/src/icons/Attachment/Code/Md.vue +0 -26
  129. package/src/icons/Attachment/Code/Php.vue +0 -26
  130. package/src/icons/Attachment/Code/Python.vue +0 -30
  131. package/src/icons/Attachment/Code/Rb.vue +0 -26
  132. package/src/icons/Attachment/Code/Sh.vue +0 -30
  133. package/src/icons/Attachment/Code/Sql.vue +0 -30
  134. package/src/icons/Attachment/Code/Swift.vue +0 -26
  135. package/src/icons/Attachment/Code/Ts.vue +0 -26
  136. package/src/icons/Attachment/Code/Tsx.vue +0 -30
  137. package/src/icons/Attachment/Code/Vue.vue +0 -24
  138. package/src/icons/Attachment/Excel.vue +0 -26
  139. package/src/icons/Attachment/Eye.vue +0 -15
  140. package/src/icons/Attachment/FullScreen.vue +0 -15
  141. package/src/icons/Attachment/InlineView.vue +0 -21
  142. package/src/icons/Attachment/Pdf.vue +0 -25
  143. package/src/icons/Attachment/Ppt.vue +0 -26
  144. package/src/icons/Attachment/PreviewView.vue +0 -21
  145. package/src/icons/Attachment/UnknownFile.vue +0 -26
  146. package/src/icons/Attachment/VideoIcon.vue +0 -25
  147. package/src/icons/Attachment/VideoPlay.vue +0 -15
  148. package/src/icons/Attachment/Word.vue +0 -26
  149. package/src/icons/Code/Confirm.vue +0 -38
  150. package/src/icons/Code/Paste.vue +0 -8
  151. package/src/icons/Common/Choice.vue +0 -28
  152. package/src/icons/Common/Close.vue +0 -15
  153. package/src/icons/Common/Comment.vue +0 -16
  154. package/src/icons/Common/CopyAnchorLink.vue +0 -15
  155. package/src/icons/Common/Delete.vue +0 -15
  156. package/src/icons/Common/Download.vue +0 -15
  157. package/src/icons/Common/FoldClose.vue +0 -9
  158. package/src/icons/Common/FoldOpen.vue +0 -9
  159. package/src/icons/Common/Plate.vue +0 -23
  160. package/src/icons/Common/Question.vue +0 -8
  161. package/src/icons/Common/ShareTextLink.vue +0 -15
  162. package/src/index.ts +0 -3
  163. package/src/types.ts +0 -236
  164. package/src/utils/common.ts +0 -6
  165. package/src/utils/emoji.ts +0 -3715
  166. package/src/utils/globalStatus.ts +0 -19
  167. package/src/utils/shiki.ts +0 -25
  168. package/src/utils/useAttachment.ts +0 -215
  169. package/tsconfig.build.json +0 -10
  170. package/tsconfig.json +0 -23
  171. package/vite.config.ts +0 -24
  172. /package/dist/{Blockquote-BamWUQND.mjs → Blockquote-BamWUQND.js} +0 -0
  173. /package/dist/{Blockquote-CQSBFnsu.js → Blockquote-CQSBFnsu.cjs} +0 -0
  174. /package/dist/{BulletList-BQTUD69X.mjs → BulletList-BQTUD69X.js} +0 -0
  175. /package/dist/{BulletList-CFjF3U-l.js → BulletList-CFjF3U-l.cjs} +0 -0
  176. /package/dist/{Doc-6s4VMDsx.mjs → Doc-6s4VMDsx.js} +0 -0
  177. /package/dist/{Doc-D2yvlSII.js → Doc-D2yvlSII.cjs} +0 -0
  178. /package/dist/{HardBreak-B2tFO31P.mjs → HardBreak-B2tFO31P.js} +0 -0
  179. /package/dist/{HardBreak-Dbf5Zg5o.js → HardBreak-Dbf5Zg5o.cjs} +0 -0
  180. /package/dist/{Heading-BElRvhGn.mjs → Heading-BElRvhGn.js} +0 -0
  181. /package/dist/{Heading-BUnffIAz.js → Heading-BUnffIAz.cjs} +0 -0
  182. /package/dist/{HorizontalRule-BRG45oT0.mjs → HorizontalRule-BRG45oT0.js} +0 -0
  183. /package/dist/{HorizontalRule-CE09LZGf.js → HorizontalRule-CE09LZGf.cjs} +0 -0
  184. /package/dist/{ListItem-BrjxeGxz.js → ListItem-BrjxeGxz.cjs} +0 -0
  185. /package/dist/{ListItem-X0T7a_z8.mjs → ListItem-X0T7a_z8.js} +0 -0
  186. /package/dist/{OrderedList-B8v1gchv.mjs → OrderedList-B8v1gchv.js} +0 -0
  187. /package/dist/{OrderedList-DMl3tvwP.js → OrderedList-DMl3tvwP.cjs} +0 -0
  188. /package/dist/{TableCell-BY9gdldc.js → TableCell-BY9gdldc.cjs} +0 -0
  189. /package/dist/{TableCell-Bp52L368.mjs → TableCell-Bp52L368.js} +0 -0
  190. /package/dist/{TableContainer-C5KXY6f7.js → TableContainer-C5KXY6f7.cjs} +0 -0
  191. /package/dist/{TableContainer-C9PhNGlz.mjs → TableContainer-C9PhNGlz.js} +0 -0
  192. /package/dist/{TableHeader-BTuqvorM.js → TableHeader-BTuqvorM.cjs} +0 -0
  193. /package/dist/{TableHeader-C7KKz3e1.mjs → TableHeader-C7KKz3e1.js} +0 -0
  194. /package/dist/{TableRow-D4F6AKFt.js → TableRow-D4F6AKFt.cjs} +0 -0
  195. /package/dist/{TableRow-OzpVq1qW.mjs → TableRow-OzpVq1qW.js} +0 -0
  196. /package/dist/{emoji-Bk6FG72F.js → emoji-Bk6FG72F.cjs} +0 -0
  197. /package/dist/{emoji-CmOToDEU.mjs → emoji-CmOToDEU.js} +0 -0
  198. /package/dist/{katex-CS0ZfoxP.js → katex-CS0ZfoxP.cjs} +0 -0
  199. /package/dist/{katex-r9TeExgs.mjs → katex-r9TeExgs.js} +0 -0
@@ -1,375 +0,0 @@
1
- <template>
2
- <div class="ai-panel">
3
- <div class="panel-header">
4
- <div class="header-title">
5
- <span class="icon">🤖</span>
6
- <span>智能分析结果</span>
7
- </div>
8
- <button class="close-btn" @click="$emit('close')" title="关闭助手">
9
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
10
- <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
11
- </svg>
12
- </button>
13
- </div>
14
-
15
- <div v-if="loading" class="panel-loading">
16
- <div class="spinner"></div>
17
- <p>正在生成分析结果...</p>
18
- </div>
19
-
20
- <div v-else-if="error" class="panel-error">
21
- {{ error }}
22
- </div>
23
-
24
- <div v-else class="panel-content">
25
- <div class="content-card summary-card" v-if="analysis?.summary">
26
- <div class="card-header">
27
- <span class="card-title">全文摘要</span>
28
- </div>
29
- <div class="summary-text" :class="{ expanded: isExpanded }">
30
- {{ analysis.summary }}
31
- </div>
32
- <div class="expand-btn" v-if="analysis.summary.length > 100" @click="isExpanded = !isExpanded">
33
- {{ isExpanded ? '收起' : '展开全文' }}
34
- </div>
35
- </div>
36
-
37
- <div class="content-card chapters-card">
38
- <div class="card-header">
39
- <span class="card-title">章节速览</span>
40
- <span class="badge">{{ analysis?.chapters?.length || 0 }}</span>
41
- </div>
42
-
43
- <div class="chapter-list">
44
- <div v-for="(chapter, index) in analysis?.chapters || []" :key="index" class="chapter-item"
45
- @click="seekToChapter(chapter)">
46
- <div class="chapter-index">{{ index + 1 }}</div>
47
- <div class="chapter-info">
48
- <div class="chapter-title">{{ chapter.title }}</div>
49
- <div class="chapter-time">
50
- <i class="icon-time">🕒</i>
51
- {{ formatTime(chapter.startTime) }} - {{ formatTime(chapter.endTime) }}
52
- </div>
53
- </div>
54
- </div>
55
-
56
- <div v-if="!analysis?.chapters || analysis.chapters.length === 0" class="empty-state">暂无章节信息</div>
57
- </div>
58
- </div>
59
- </div>
60
- </div>
61
- </template>
62
-
63
- <script setup lang="ts">
64
- import { inject, onMounted, ref } from 'vue';
65
- import { monitorApi } from '@datawhale/dipwap-render/apis/monitor';
66
- import { videoProgressDetailApi } from '@datawhale/dipwap-render/apis/tingwu';
67
- import { axiosKey } from '@datawhale/dipwap-render/apis/types';
68
-
69
- // 接口定义
70
- interface Chapter {
71
- title: string;
72
- startTime: number;
73
- endTime: number;
74
- }
75
- interface Analysis {
76
- summary?: string;
77
- chapters?: Chapter[];
78
- }
79
-
80
- const props = defineProps<{
81
- taskId: string;
82
- videoRef: HTMLVideoElement | null;
83
- }>();
84
-
85
- const loading = ref(false);
86
- const error = ref('');
87
- const analysis = ref<Analysis | null>(null);
88
- const isExpanded = ref(false);
89
-
90
- const service = inject(axiosKey);
91
-
92
- const loadAnalysis = async () => {
93
- if (!props.taskId) return;
94
- if (!service) return;
95
- loading.value = true;
96
- try {
97
- // @ts-ignore
98
- const data = await videoProgressDetailApi(service, { taskId: props.taskId });
99
- analysis.value = {
100
- summary: data.summary,
101
- chapters: JSON.parse(data.chapters) as { title: string; startTime: number; endTime: number }[],
102
- };
103
- loading.value = false;
104
- } catch (e) {
105
- error.value = '加载失败';
106
- loading.value = false;
107
- console.error(e);
108
- }
109
- };
110
-
111
- const seekToChapter = async (chapter: Chapter) => {
112
- if (props.videoRef) {
113
- props.videoRef.currentTime = chapter.startTime;
114
- void props.videoRef.play();
115
- }
116
- if (service) {
117
- // @ts-ignore
118
- await monitorApi(service, {
119
- log: JSON.stringify({
120
- name: 'toggleVideoAiPanelSidebar',
121
- chapterTitle: chapter.title,
122
- tingwuTaskId: props.taskId,
123
- videoPageUrl: window.location.href,
124
- }),
125
- });
126
- }
127
- };
128
-
129
- const formatTime = (seconds: number) => {
130
- const m = Math.floor(seconds / 60);
131
- const s = Math.floor(seconds % 60);
132
- return `${m}:${s.toString().padStart(2, '0')}`;
133
- };
134
-
135
- onMounted(async () => {
136
- await loadAnalysis();
137
- });
138
- </script>
139
-
140
- <style lang="scss" scoped>
141
- $primary-color: #2563eb;
142
- $border-color: #e5e7eb;
143
- $bg-white: #ffffff;
144
- $text-main: #111827;
145
- $text-sub: #6b7280;
146
- $hover-bg: #f3f4f6;
147
-
148
- .ai-panel {
149
- background: $bg-white;
150
- border-radius: 8px;
151
- border: 1px solid $border-color;
152
- height: 100%;
153
- max-height: 500px;
154
- display: flex;
155
- flex-direction: column;
156
- overflow: hidden;
157
- box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
158
- }
159
-
160
- .panel-header {
161
- padding: 12px 16px;
162
- background-color: #eff6ff;
163
- border-bottom: 1px solid #bfdbfe;
164
- display: flex;
165
- justify-content: space-between;
166
- align-items: center;
167
-
168
- .header-title {
169
- font-size: 14px;
170
- font-weight: 600;
171
- color: #1e40af;
172
- display: flex;
173
- align-items: center;
174
- gap: 8px;
175
- }
176
-
177
- // 新增:关闭按钮样式
178
- .close-btn {
179
- background: transparent;
180
- border: none;
181
- cursor: pointer;
182
- color: #60a5fa; // 浅蓝色
183
- padding: 4px;
184
- border-radius: 4px;
185
- display: flex;
186
- align-items: center;
187
- justify-content: center;
188
- transition: all 0.2s;
189
- width: 24px;
190
- height: 24px;
191
-
192
- svg {
193
- width: 18px;
194
- height: 18px;
195
- }
196
-
197
- &:hover {
198
- background-color: rgba(255, 255, 255, 0.5);
199
- color: #1e40af; // 深蓝色
200
- }
201
- }
202
- }
203
-
204
- // ... 后面的样式保持不变 ...
205
- .panel-loading,
206
- .panel-error {
207
- padding: 32px;
208
- text-align: center;
209
- color: $text-sub;
210
- font-size: 13px;
211
-
212
- .spinner {
213
- width: 20px;
214
- height: 20px;
215
- border: 2px solid $border-color;
216
- border-top-color: $primary-color;
217
- border-radius: 50%;
218
- margin: 0 auto 12px;
219
- animation: spin 1s linear infinite;
220
- }
221
- }
222
-
223
- .panel-content {
224
- flex: 1;
225
- overflow-y: auto;
226
- padding: 0;
227
-
228
- &::-webkit-scrollbar {
229
- width: 4px;
230
- }
231
-
232
- &::-webkit-scrollbar-thumb {
233
- background: #d1d5db;
234
- border-radius: 2px;
235
- }
236
- }
237
-
238
- .content-card {
239
- padding: 16px;
240
- border-bottom: 1px solid $border-color;
241
-
242
- &:last-child {
243
- border-bottom: none;
244
- }
245
-
246
- .card-header {
247
- display: flex;
248
- justify-content: space-between;
249
- align-items: center;
250
- margin-bottom: 12px;
251
-
252
- .card-title {
253
- font-size: 13px;
254
- font-weight: 700;
255
- color: $text-sub;
256
- text-transform: uppercase;
257
- }
258
-
259
- .badge {
260
- font-size: 12px;
261
- background: $hover-bg;
262
- padding: 2px 6px;
263
- border-radius: 4px;
264
- color: $text-sub;
265
- }
266
- }
267
- }
268
-
269
- .summary-card {
270
- .summary-text {
271
- font-size: 14px;
272
- line-height: 1.6;
273
- color: #374151;
274
- text-align: justify;
275
- display: -webkit-box;
276
- -webkit-line-clamp: 3;
277
- -webkit-box-orient: vertical;
278
- overflow: hidden;
279
-
280
- &.expanded {
281
- -webkit-line-clamp: unset;
282
- overflow: visible;
283
- }
284
- }
285
-
286
- .expand-btn {
287
- margin-top: 8px;
288
- font-size: 12px;
289
- color: $primary-color;
290
- cursor: pointer;
291
-
292
- &:hover {
293
- text-decoration: underline;
294
- }
295
- }
296
- }
297
-
298
- .chapter-list {
299
- display: flex;
300
- flex-direction: column;
301
- gap: 8px;
302
- }
303
-
304
- .chapter-item {
305
- display: flex;
306
- gap: 12px;
307
- padding: 8px;
308
- border-radius: 6px;
309
- cursor: pointer;
310
- border: 1px solid transparent;
311
- transition: all 0.2s;
312
-
313
- &:hover {
314
- background-color: $hover-bg;
315
- border-color: $border-color;
316
-
317
- .chapter-index {
318
- background-color: white;
319
- color: $primary-color;
320
- }
321
-
322
- .chapter-title {
323
- color: $primary-color;
324
- }
325
- }
326
-
327
- .chapter-index {
328
- width: 20px;
329
- height: 20px;
330
- background-color: #dbeafe;
331
- color: $primary-color;
332
- font-size: 11px;
333
- font-weight: 700;
334
- display: flex;
335
- align-items: center;
336
- justify-content: center;
337
- border-radius: 4px;
338
- flex-shrink: 0;
339
- margin-top: 2px;
340
- }
341
-
342
- .chapter-info {
343
- flex: 1;
344
- min-width: 0;
345
-
346
- .chapter-title {
347
- font-size: 14px;
348
- font-weight: 500;
349
- color: #374151;
350
- margin-bottom: 4px;
351
- }
352
-
353
- .chapter-time {
354
- font-size: 12px;
355
- color: #9ca3af;
356
- display: flex;
357
- align-items: center;
358
- gap: 4px;
359
- }
360
- }
361
- }
362
-
363
- .empty-state {
364
- text-align: center;
365
- color: #9ca3af;
366
- font-size: 13px;
367
- padding: 12px 0;
368
- }
369
-
370
- @keyframes spin {
371
- to {
372
- transform: rotate(360deg);
373
- }
374
- }
375
- </style>
@@ -1,6 +0,0 @@
1
- import { customDefineAsyncComponent } from '../utils';
2
-
3
- export const attachmentMapper: Record<string, any> = {
4
- 'attachment-inline': customDefineAsyncComponent(() => import('./AttachmentInline.vue')),
5
- 'attachment-block': customDefineAsyncComponent(() => import('./AttachmentBlock.vue')),
6
- };
@@ -1,15 +0,0 @@
1
- <template>
2
- <blockquote>
3
- <slot />
4
- </blockquote>
5
- </template>
6
-
7
- <script setup lang="ts">
8
- import type { PMBlockquote } from '@datawhale/dipwap-types/index';
9
-
10
- defineProps<{
11
- node: PMBlockquote;
12
- }>();
13
- </script>
14
-
15
- <style scoped></style>
@@ -1,15 +0,0 @@
1
- <template>
2
- <ul>
3
- <slot />
4
- </ul>
5
- </template>
6
-
7
- <script setup lang="ts">
8
- import type { PMBulletList } from '@datawhale/dipwap-types/index';
9
-
10
- defineProps<{
11
- node: PMBulletList;
12
- }>();
13
- </script>
14
-
15
- <style scoped></style>
@@ -1,11 +0,0 @@
1
- <template>
2
- <br />
3
- </template>
4
-
5
- <script setup lang="ts">
6
- import type { PMHardBreak } from '@datawhale/dipwap-types/index';
7
-
8
- defineProps<{
9
- node: PMHardBreak;
10
- }>();
11
- </script>
@@ -1,15 +0,0 @@
1
- <template>
2
- <component :id="node.attrs.id" :is="`h${node.attrs.level}`" class="heading">
3
- <slot />
4
- </component>
5
- </template>
6
-
7
- <script setup lang="ts">
8
- import type { PMHeading } from '@datawhale/dipwap-types/index';
9
-
10
- defineProps<{
11
- node: PMHeading;
12
- }>();
13
- </script>
14
-
15
- <style scoped></style>
@@ -1,11 +0,0 @@
1
- <template>
2
- <hr />
3
- </template>
4
-
5
- <script setup lang="ts">
6
- import type { PMThematicBreak } from '@datawhale/dipwap-types/index';
7
-
8
- defineProps<{
9
- node: PMThematicBreak;
10
- }>();
11
- </script>
@@ -1,15 +0,0 @@
1
- <template>
2
- <li>
3
- <slot />
4
- </li>
5
- </template>
6
-
7
- <script setup lang="ts">
8
- import type { PMListItem } from '@datawhale/dipwap-types/index';
9
-
10
- defineProps<{
11
- node: PMListItem;
12
- }>();
13
- </script>
14
-
15
- <style scoped></style>
@@ -1,15 +0,0 @@
1
- <template>
2
- <ol :start="node.attrs.start">
3
- <slot />
4
- </ol>
5
- </template>
6
-
7
- <script setup lang="ts">
8
- import type { PMOrderedList } from '@datawhale/dipwap-types/index';
9
-
10
- defineProps<{
11
- node: PMOrderedList;
12
- }>();
13
- </script>
14
-
15
- <style scoped></style>
@@ -1,19 +0,0 @@
1
- <template>
2
- <p class="paragraph">
3
- <slot />
4
- </p>
5
- </template>
6
-
7
- <script setup lang="ts">
8
- import type { PMParagraph } from '@datawhale/dipwap-types/index';
9
-
10
- defineProps<{
11
- node: PMParagraph;
12
- }>();
13
- </script>
14
-
15
- <style scoped>
16
- p:empty::before {
17
- content: '\00a0';
18
- }
19
- </style>
@@ -1,73 +0,0 @@
1
- <template>
2
- <template v-if="node.marks?.length && currentMarkType">
3
- <!-- 每次取第0个mark渲染对应的标签 -->
4
- <!-- 再取除了第0个以外的其他marks,再加上其他属性,递归地传至下一层 -->
5
- <component
6
- v-if="currentMarkType === 'link'"
7
- :is="currentHTMLType"
8
- :target="(currentMark as LinkMark).attrs?.href"
9
- :href="(currentMark as LinkMark).attrs?.href"
10
- :class="(currentMark as LinkMark).attrs?.class"
11
- :rel="(currentMark as LinkMark).attrs?.rel"
12
- >
13
- <Text :node="{ ...node, marks: node.marks?.slice(1) }" />
14
- </component>
15
- <component
16
- v-else-if="currentMarkType === 'highlight'"
17
- :is="currentHTMLType"
18
- :style="{
19
- ...(currentMark as HighlightMark).attrs,
20
- color: null,
21
- 'background-color': (currentMark as HighlightMark).attrs.color,
22
- }"
23
- >
24
- <Text :node="{ ...node, marks: node.marks?.slice(1) }" />
25
- </component>
26
- <component
27
- v-else-if="currentMarkType === 'textStyle'"
28
- :is="currentHTMLType"
29
- :style="(currentMark as TextStyleMark).attrs ?? null"
30
- >
31
- <Text :node="{ ...node, marks: node.marks?.slice(1) }" />
32
- </component>
33
- <component v-else :is="currentHTMLType">
34
- <Text :node="{ ...node, marks: node.marks?.slice(1) }" />
35
- </component>
36
- </template>
37
- <SlotNode v-else>
38
- {{ node.text }}
39
- </SlotNode>
40
- </template>
41
-
42
- <script setup lang="ts">
43
- import { computed } from 'vue';
44
- import type { HighlightMark, LinkMark, PMText, TextStyleMark } from '@datawhale/dipwap-types/index';
45
- import SlotNode from '../wrapper/SlotNode.vue';
46
-
47
- const { node } = defineProps<{
48
- node: PMText;
49
- }>();
50
-
51
- const currentMark = computed(() => {
52
- return node.marks?.[0];
53
- });
54
-
55
- const currentMarkType = computed(() => {
56
- return currentMark.value?.type;
57
- });
58
-
59
- const currentHTMLType = computed(() => {
60
- return nodeTypeMap[currentMark.value?.type as keyof typeof nodeTypeMap];
61
- });
62
-
63
- const nodeTypeMap = {
64
- bold: 'strong',
65
- italic: 'em',
66
- underline: 'u',
67
- strike: 's',
68
- highlight: 'mark',
69
- textStyle: 'span',
70
- link: 'a',
71
- code: 'code',
72
- };
73
- </script>
@@ -1,13 +0,0 @@
1
- import { customDefineAsyncComponent } from '../utils';
2
-
3
- export const basicMapper: Record<string, any> = {
4
- text: customDefineAsyncComponent(() => import('./Text.vue')),
5
- paragraph: customDefineAsyncComponent(() => import('./Paragraph.vue')),
6
- heading: customDefineAsyncComponent(() => import('./Heading.vue')),
7
- orderedList: customDefineAsyncComponent(() => import('./OrderedList.vue')),
8
- bulletList: customDefineAsyncComponent(() => import('./BulletList.vue')),
9
- listItem: customDefineAsyncComponent(() => import('./ListItem.vue')),
10
- horizontalRule: customDefineAsyncComponent(() => import('./HorizontalRule.vue')),
11
- blockquote: customDefineAsyncComponent(() => import('./Blockquote.vue')),
12
- hardBreak: customDefineAsyncComponent(() => import('./HardBreak.vue')),
13
- };
@@ -1,77 +0,0 @@
1
- <template>
2
- <div class="callout-wrapper" :style="{ backgroundColor: node.attrs.bgColor, borderColor: node.attrs.bdColor }">
3
- <div class="callout-icon">
4
- {{ node.attrs.emoji ? EMOJI_MAP[node.attrs.emoji] : EMOJI_MAP['whale'] }}
5
- </div>
6
- <div class="callout-content">
7
- <div class="node-view-content">
8
- <TreeRecursive v-for="child in node.content" :node="child" :key="useId()" />
9
- </div>
10
- </div>
11
- </div>
12
- </template>
13
-
14
- <script setup lang="ts">
15
- import { useId } from 'vue';
16
- import TreeRecursive from '@datawhale/dipwap-render/components/TreeRecursive.vue';
17
- import { EMOJI_MAP } from '@datawhale/dipwap-render/utils/emoji';
18
- import type { PMLarkCallout } from '@datawhale/dipwap-types/index';
19
-
20
- const { node } = defineProps<{
21
- node: PMLarkCallout;
22
- }>();
23
- </script>
24
-
25
- <style scoped lang="scss">
26
- .callout-wrapper {
27
- position: relative;
28
- margin: 16px 0;
29
- padding: 16px;
30
- border-radius: 6px;
31
- display: flex;
32
- flex-direction: row;
33
- border-width: 1.5px;
34
- border-style: solid;
35
- .callout-icon {
36
- font-size: 22px;
37
- width: 26px;
38
- height: 26px;
39
- display: flex;
40
- justify-content: center;
41
- align-items: center;
42
- cursor: default;
43
- &:hover {
44
- background-color: rgba(0, 0, 0, 0.1);
45
- border-radius: 4px;
46
- }
47
- }
48
- .callout-content {
49
- padding-left: 12px;
50
- display: flex;
51
- justify-content: flex-start;
52
- flex-direction: column;
53
- flex: 1;
54
- min-width: 0;
55
- overflow-x: auto;
56
- .node-view-content {
57
- width: 100%;
58
- & > :deep(*:first-child),
59
- & > :deep(ul > li:first-child),
60
- & > :deep(ul > li:first-child > p:first-child),
61
- & > :deep(ol > li:first-child),
62
- & > :deep(ol > li:first-child > p:first-child),
63
- & > :deep(div:first-child > pre) {
64
- margin-top: 0;
65
- }
66
- & > :deep(*:last-child),
67
- & > :deep(ul > li:last-child),
68
- & > :deep(ul > li:last-child > p:last-child),
69
- & > :deep(ol > li:last-child),
70
- & > :deep(ol > li:last-child > p:last-child),
71
- & > :deep(div:last-child > pre) {
72
- margin-bottom: 0;
73
- }
74
- }
75
- }
76
- }
77
- </style>
@@ -1,5 +0,0 @@
1
- import { customDefineAsyncComponent } from '../utils';
2
-
3
- export const calloutMapper: Record<string, any> = {
4
- callout: customDefineAsyncComponent(() => import('./Callout.vue')),
5
- };