@datawhale/prosemirror-render 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AttachmentBlock-ChMNTUOo.mjs → AttachmentBlock-BTIBSu4p.js} +2 -2
- package/dist/AttachmentBlock-W05YY8zN.cjs +1 -0
- package/dist/{AttachmentInline-tbC8BJBy.mjs → AttachmentInline-BF7QTLxZ.js} +2 -2
- package/dist/AttachmentInline-CgV-t0WF.cjs +1 -0
- package/dist/{AttachmentMenu-B5x8P9_n.mjs → AttachmentMenu-BjM7LAlw.js} +1 -1
- package/dist/AttachmentMenu-vc18PNLc.cjs +1 -0
- package/dist/{Callout-Cu6HI-xq.mjs → Callout-BH6_xPHP.js} +2 -2
- package/dist/Callout-BgG8-zJn.cjs +1 -0
- package/dist/{CellOutput-DiKZlIFa.js → CellOutput-CXb77W7X.cjs} +1 -1
- package/dist/{CellOutput-C33VK0df.mjs → CellOutput-DJqn5MJH.js} +1 -1
- package/dist/{CodeBlock-DWniNUQB.js → CodeBlock-BejcPvxj.cjs} +1 -1
- package/dist/{CodeBlock-Cjuxuq7B.mjs → CodeBlock-D9lrTXj3.js} +1 -1
- package/dist/FoldBlock-CMDkkdoU.cjs +1 -0
- package/dist/{FoldBlock-DRdlU-DX.mjs → FoldBlock-CZwxKsSG.js} +2 -2
- package/dist/{Grid-GfmJxM93.mjs → Grid-B53O57Vv.js} +1 -1
- package/dist/Grid-Cw9joyDF.cjs +1 -0
- package/dist/IFrame-CP2oHuDb.cjs +1 -0
- package/dist/{IFrame-CaAOVLGN.mjs → IFrame-DRvqa1hl.js} +1 -1
- package/dist/Image-B9Rer9RA.cjs +1 -0
- package/dist/{Image-C8v5dCij.mjs → Image-BjIZuyk1.js} +1 -1
- package/dist/{MathDisplay-CoGsFzXW.mjs → MathDisplay-BficZWEq.js} +2 -2
- package/dist/MathDisplay-D5rx_pee.cjs +1 -0
- package/dist/{MathInline-0xTZoIIq.mjs → MathInline-Ca8s53fu.js} +2 -2
- package/dist/MathInline-DZ86cc6g.cjs +1 -0
- package/dist/{McChoices-Aj394G5E.mjs → McChoices-B8W03KdG.js} +1 -1
- package/dist/McChoices-CW1gsp_V.cjs +1 -0
- package/dist/McQuestion-DwBWk5S2.cjs +1 -0
- package/dist/{McQuestion-DvD-J47M.mjs → McQuestion-WyxeDFjM.js} +1 -1
- package/dist/McSolution-BtY7RBEb.cjs +1 -0
- package/dist/{McSolution-C5sTXz3y.mjs → McSolution-CRahjdmW.js} +1 -1
- package/dist/{MultipleChoice-Dv-k1zUU.mjs → MultipleChoice-BgGHy-NW.js} +4 -4
- package/dist/MultipleChoice-mFFm3sQv.cjs +1 -0
- package/dist/{Paragraph-DGcZy8t_.mjs → Paragraph-C3uQVRMm.js} +1 -1
- package/dist/Paragraph-CU-CMQz2.cjs +1 -0
- package/dist/{SlotNode-6OpoUcOa.mjs → SlotNode-BThSEhpr.js} +1 -1
- package/dist/SlotNode-ivBAGFTX.cjs +1 -0
- package/dist/Text-3RT27QJn.cjs +1 -0
- package/dist/{Text-Br_pcGz4.mjs → Text-cG9dlJgd.js} +1 -1
- package/dist/{index-DVmWCrQE.mjs → index-C97tUvOp.js} +30 -30
- package/dist/index-DuVSDVpW.cjs +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- package/package.json +8 -2
- package/dist/AttachmentBlock-DsmJP3Kw.js +0 -1
- package/dist/AttachmentInline-Dc3dp0g-.js +0 -1
- package/dist/AttachmentMenu-ExoCOe4B.js +0 -1
- package/dist/Callout-DPdOqTb4.js +0 -1
- package/dist/FoldBlock-ZPMf0QsR.js +0 -1
- package/dist/Grid-QToZdaRT.js +0 -1
- package/dist/IFrame-DcCpSoDC.js +0 -1
- package/dist/Image-cHL85CXs.js +0 -1
- package/dist/MathDisplay-CESKZV46.js +0 -1
- package/dist/MathInline-C_1SJUVz.js +0 -1
- package/dist/McChoices-B4euzY7M.js +0 -1
- package/dist/McQuestion-Dq0aM5tC.js +0 -1
- package/dist/McSolution-N79CllH9.js +0 -1
- package/dist/MultipleChoice-DTCF3Q8m.js +0 -1
- package/dist/Paragraph-CzRSCJNr.js +0 -1
- package/dist/SlotNode-DMG0R6Vf.js +0 -1
- package/dist/Text-DlUfrsNI.js +0 -1
- package/dist/index-D2CtpNvR.js +0 -1
- package/src/apis/monitor.ts +0 -8
- package/src/apis/tingwu.ts +0 -22
- package/src/apis/types.ts +0 -45
- package/src/components/TreeRecursive.vue +0 -47
- package/src/components/TreeRender.vue +0 -404
- package/src/components/collections/async/AsyncError.vue +0 -17
- package/src/components/collections/async/AsyncLoading.vue +0 -1
- package/src/components/collections/attachment/AttachmentBlock.vue +0 -561
- package/src/components/collections/attachment/AttachmentInline.vue +0 -90
- package/src/components/collections/attachment/AttachmentMenu.vue +0 -359
- package/src/components/collections/attachment/VideoDetail.vue +0 -375
- package/src/components/collections/attachment/index.ts +0 -6
- package/src/components/collections/basic/Blockquote.vue +0 -15
- package/src/components/collections/basic/BulletList.vue +0 -15
- package/src/components/collections/basic/HardBreak.vue +0 -11
- package/src/components/collections/basic/Heading.vue +0 -15
- package/src/components/collections/basic/HorizontalRule.vue +0 -11
- package/src/components/collections/basic/ListItem.vue +0 -15
- package/src/components/collections/basic/OrderedList.vue +0 -15
- package/src/components/collections/basic/Paragraph.vue +0 -19
- package/src/components/collections/basic/Text.vue +0 -73
- package/src/components/collections/basic/index.ts +0 -13
- package/src/components/collections/callout/Callout.vue +0 -77
- package/src/components/collections/callout/index.ts +0 -5
- package/src/components/collections/code/CellOutput.vue +0 -72
- package/src/components/collections/code/CodeBlock.vue +0 -83
- package/src/components/collections/code/index.ts +0 -6
- package/src/components/collections/fold/FoldBlock.vue +0 -130
- package/src/components/collections/fold/index.ts +0 -5
- package/src/components/collections/grid/Grid.vue +0 -70
- package/src/components/collections/grid/index.ts +0 -5
- package/src/components/collections/iframe/IFrame.vue +0 -19
- package/src/components/collections/iframe/index.ts +0 -5
- package/src/components/collections/img/Image.vue +0 -318
- package/src/components/collections/img/index.ts +0 -5
- package/src/components/collections/index.ts +0 -29
- package/src/components/collections/math/MathDisplay.vue +0 -42
- package/src/components/collections/math/MathInline.vue +0 -42
- package/src/components/collections/math/index.ts +0 -6
- package/src/components/collections/multipleChoice/McChoices.vue +0 -72
- package/src/components/collections/multipleChoice/McQuestion.vue +0 -61
- package/src/components/collections/multipleChoice/McSolution.vue +0 -47
- package/src/components/collections/multipleChoice/MultipleChoice.vue +0 -62
- package/src/components/collections/multipleChoice/index.ts +0 -8
- package/src/components/collections/table/TableCell.vue +0 -20
- package/src/components/collections/table/TableContainer.vue +0 -32
- package/src/components/collections/table/TableHeader.vue +0 -15
- package/src/components/collections/table/TableRow.vue +0 -15
- package/src/components/collections/table/index.ts +0 -8
- package/src/components/collections/utils.ts +0 -17
- package/src/components/collections/wrapper/Doc.vue +0 -15
- package/src/components/collections/wrapper/SlotNode.vue +0 -5
- package/src/components/collections/wrapper/index.ts +0 -6
- package/src/components/index.ts +0 -1
- package/src/icons/Attachment/CardView.vue +0 -21
- package/src/icons/Attachment/Code/Bat.vue +0 -26
- package/src/icons/Attachment/Code/C.vue +0 -26
- package/src/icons/Attachment/Code/Cpp.vue +0 -26
- package/src/icons/Attachment/Code/Css.vue +0 -34
- package/src/icons/Attachment/Code/Go.vue +0 -26
- package/src/icons/Attachment/Code/Html.vue +0 -34
- package/src/icons/Attachment/Code/Java.vue +0 -42
- package/src/icons/Attachment/Code/Js.vue +0 -26
- package/src/icons/Attachment/Code/Json.vue +0 -26
- package/src/icons/Attachment/Code/Jsx.vue +0 -30
- package/src/icons/Attachment/Code/Md.vue +0 -26
- package/src/icons/Attachment/Code/Php.vue +0 -26
- package/src/icons/Attachment/Code/Python.vue +0 -30
- package/src/icons/Attachment/Code/Rb.vue +0 -26
- package/src/icons/Attachment/Code/Sh.vue +0 -30
- package/src/icons/Attachment/Code/Sql.vue +0 -30
- package/src/icons/Attachment/Code/Swift.vue +0 -26
- package/src/icons/Attachment/Code/Ts.vue +0 -26
- package/src/icons/Attachment/Code/Tsx.vue +0 -30
- package/src/icons/Attachment/Code/Vue.vue +0 -24
- package/src/icons/Attachment/Excel.vue +0 -26
- package/src/icons/Attachment/Eye.vue +0 -15
- package/src/icons/Attachment/FullScreen.vue +0 -15
- package/src/icons/Attachment/InlineView.vue +0 -21
- package/src/icons/Attachment/Pdf.vue +0 -25
- package/src/icons/Attachment/Ppt.vue +0 -26
- package/src/icons/Attachment/PreviewView.vue +0 -21
- package/src/icons/Attachment/UnknownFile.vue +0 -26
- package/src/icons/Attachment/VideoIcon.vue +0 -25
- package/src/icons/Attachment/VideoPlay.vue +0 -15
- package/src/icons/Attachment/Word.vue +0 -26
- package/src/icons/Code/Confirm.vue +0 -38
- package/src/icons/Code/Paste.vue +0 -8
- package/src/icons/Common/Choice.vue +0 -28
- package/src/icons/Common/Close.vue +0 -15
- package/src/icons/Common/Comment.vue +0 -16
- package/src/icons/Common/CopyAnchorLink.vue +0 -15
- package/src/icons/Common/Delete.vue +0 -15
- package/src/icons/Common/Download.vue +0 -15
- package/src/icons/Common/FoldClose.vue +0 -9
- package/src/icons/Common/FoldOpen.vue +0 -9
- package/src/icons/Common/Plate.vue +0 -23
- package/src/icons/Common/Question.vue +0 -8
- package/src/icons/Common/ShareTextLink.vue +0 -15
- package/src/index.ts +0 -3
- package/src/types.ts +0 -236
- package/src/utils/common.ts +0 -6
- package/src/utils/emoji.ts +0 -3715
- package/src/utils/globalStatus.ts +0 -19
- package/src/utils/shiki.ts +0 -25
- package/src/utils/useAttachment.ts +0 -215
- package/tsconfig.build.json +0 -10
- package/tsconfig.json +0 -23
- package/vite.config.ts +0 -24
- /package/dist/{Blockquote-BamWUQND.mjs → Blockquote-BamWUQND.js} +0 -0
- /package/dist/{Blockquote-CQSBFnsu.js → Blockquote-CQSBFnsu.cjs} +0 -0
- /package/dist/{BulletList-BQTUD69X.mjs → BulletList-BQTUD69X.js} +0 -0
- /package/dist/{BulletList-CFjF3U-l.js → BulletList-CFjF3U-l.cjs} +0 -0
- /package/dist/{Doc-6s4VMDsx.mjs → Doc-6s4VMDsx.js} +0 -0
- /package/dist/{Doc-D2yvlSII.js → Doc-D2yvlSII.cjs} +0 -0
- /package/dist/{HardBreak-B2tFO31P.mjs → HardBreak-B2tFO31P.js} +0 -0
- /package/dist/{HardBreak-Dbf5Zg5o.js → HardBreak-Dbf5Zg5o.cjs} +0 -0
- /package/dist/{Heading-BElRvhGn.mjs → Heading-BElRvhGn.js} +0 -0
- /package/dist/{Heading-BUnffIAz.js → Heading-BUnffIAz.cjs} +0 -0
- /package/dist/{HorizontalRule-BRG45oT0.mjs → HorizontalRule-BRG45oT0.js} +0 -0
- /package/dist/{HorizontalRule-CE09LZGf.js → HorizontalRule-CE09LZGf.cjs} +0 -0
- /package/dist/{ListItem-BrjxeGxz.js → ListItem-BrjxeGxz.cjs} +0 -0
- /package/dist/{ListItem-X0T7a_z8.mjs → ListItem-X0T7a_z8.js} +0 -0
- /package/dist/{OrderedList-B8v1gchv.mjs → OrderedList-B8v1gchv.js} +0 -0
- /package/dist/{OrderedList-DMl3tvwP.js → OrderedList-DMl3tvwP.cjs} +0 -0
- /package/dist/{TableCell-BY9gdldc.js → TableCell-BY9gdldc.cjs} +0 -0
- /package/dist/{TableCell-Bp52L368.mjs → TableCell-Bp52L368.js} +0 -0
- /package/dist/{TableContainer-C5KXY6f7.js → TableContainer-C5KXY6f7.cjs} +0 -0
- /package/dist/{TableContainer-C9PhNGlz.mjs → TableContainer-C9PhNGlz.js} +0 -0
- /package/dist/{TableHeader-BTuqvorM.js → TableHeader-BTuqvorM.cjs} +0 -0
- /package/dist/{TableHeader-C7KKz3e1.mjs → TableHeader-C7KKz3e1.js} +0 -0
- /package/dist/{TableRow-D4F6AKFt.js → TableRow-D4F6AKFt.cjs} +0 -0
- /package/dist/{TableRow-OzpVq1qW.mjs → TableRow-OzpVq1qW.js} +0 -0
- /package/dist/{emoji-Bk6FG72F.js → emoji-Bk6FG72F.cjs} +0 -0
- /package/dist/{emoji-CmOToDEU.mjs → emoji-CmOToDEU.js} +0 -0
- /package/dist/{katex-CS0ZfoxP.js → katex-CS0ZfoxP.cjs} +0 -0
- /package/dist/{katex-r9TeExgs.mjs → katex-r9TeExgs.js} +0 -0
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<template v-if="outputType != 'empty'">
|
|
3
|
-
<div class="cell-ouput-container">
|
|
4
|
-
<template v-if="outputType === 'error'">
|
|
5
|
-
<pre class="jp-error monospace-text"><Ansi>{{ ensureString(value) }}</Ansi></pre>
|
|
6
|
-
</template>
|
|
7
|
-
<template v-else-if="outputType === 'stream'">
|
|
8
|
-
<pre class="monospace-text">{{ value }}</pre>
|
|
9
|
-
</template>
|
|
10
|
-
<template v-else-if="outputType === 'image'">
|
|
11
|
-
<img :src="value?.startsWith('http') ? value : 'data:image/png;base64,' + value" class="jp-img" />
|
|
12
|
-
</template>
|
|
13
|
-
<template v-else-if="outputType === 'html'">
|
|
14
|
-
<div v-html="value"></div>
|
|
15
|
-
</template>
|
|
16
|
-
<template v-else-if="outputType === 'text'">
|
|
17
|
-
<pre class="monospace-text">{{ value }}</pre>
|
|
18
|
-
</template>
|
|
19
|
-
</div>
|
|
20
|
-
</template>
|
|
21
|
-
</template>
|
|
22
|
-
|
|
23
|
-
<script setup lang="ts">
|
|
24
|
-
import Ansi from 'ansi-to-vue3';
|
|
25
|
-
import { computed } from 'vue';
|
|
26
|
-
import type { PMCellOutput, PMText } from '@datawhale/dipwap-types/index';
|
|
27
|
-
|
|
28
|
-
const { node } = defineProps<{
|
|
29
|
-
node: PMCellOutput;
|
|
30
|
-
}>();
|
|
31
|
-
const outputType = computed(() => node.attrs.outputType);
|
|
32
|
-
const value = computed(() => (node.content ? (node.content[0] as PMText).text : undefined));
|
|
33
|
-
|
|
34
|
-
function ensureString(maybeString: string[] | string | undefined, joinWith = '\n'): string {
|
|
35
|
-
if (!maybeString) return '';
|
|
36
|
-
if (typeof maybeString === 'string') return maybeString;
|
|
37
|
-
if (maybeString.join) return maybeString.join(joinWith);
|
|
38
|
-
return maybeString as unknown as string;
|
|
39
|
-
}
|
|
40
|
-
</script>
|
|
41
|
-
|
|
42
|
-
<style scoped>
|
|
43
|
-
pre {
|
|
44
|
-
margin: 0;
|
|
45
|
-
padding: 0 10px;
|
|
46
|
-
box-shadow: none;
|
|
47
|
-
background-color: transparent;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.cell-ouput-container {
|
|
51
|
-
margin: 20px 0 20px 10px;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.jp-error {
|
|
55
|
-
/* margin: 0;
|
|
56
|
-
padding: 0 10px; */
|
|
57
|
-
line-height: 14px;
|
|
58
|
-
font-size: 14px;
|
|
59
|
-
overflow-x: auto;
|
|
60
|
-
overflow-y: hidden;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.jp-img {
|
|
64
|
-
max-width: 50%;
|
|
65
|
-
height: auto;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.monospace-text {
|
|
69
|
-
font-family: monospace;
|
|
70
|
-
overflow-y: hidden;
|
|
71
|
-
}
|
|
72
|
-
</style>
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="code-block-wrapper">
|
|
3
|
-
<div class="code-block-container" v-html="code"></div>
|
|
4
|
-
<button class="copy-btn" @click="copyCode">
|
|
5
|
-
<Confirm v-if="copied" />
|
|
6
|
-
<Paste v-else />
|
|
7
|
-
</button>
|
|
8
|
-
</div>
|
|
9
|
-
</template>
|
|
10
|
-
|
|
11
|
-
<script setup lang="ts">
|
|
12
|
-
import { ref, watch } from 'vue';
|
|
13
|
-
import Confirm from '@datawhale/dipwap-render/icons/Code/Confirm.vue';
|
|
14
|
-
import Paste from '@datawhale/dipwap-render/icons/Code/Paste.vue';
|
|
15
|
-
import { getHighlighter, supportedLangs } from '@datawhale/dipwap-render/utils/shiki';
|
|
16
|
-
import type { PMCode, PMText } from '@datawhale/dipwap-types/index';
|
|
17
|
-
|
|
18
|
-
const { node } = defineProps<{
|
|
19
|
-
node: PMCode;
|
|
20
|
-
}>();
|
|
21
|
-
|
|
22
|
-
const code = ref('');
|
|
23
|
-
const rawText = ref('');
|
|
24
|
-
const copied = ref(false);
|
|
25
|
-
|
|
26
|
-
function resolveLanguage(lang: string | undefined | null) {
|
|
27
|
-
if (lang && supportedLangs.includes(lang)) {
|
|
28
|
-
return lang;
|
|
29
|
-
} else {
|
|
30
|
-
return 'text';
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
watch(
|
|
35
|
-
() => node,
|
|
36
|
-
() => {
|
|
37
|
-
if (node.content?.[0]) {
|
|
38
|
-
const text = (node.content[0] as PMText).text;
|
|
39
|
-
rawText.value = text.trim();
|
|
40
|
-
|
|
41
|
-
code.value = getHighlighter().codeToHtml(text, {
|
|
42
|
-
lang: resolveLanguage(node.attrs.language),
|
|
43
|
-
theme: 'min-light',
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
{ immediate: true },
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
const copyCode = async () => {
|
|
51
|
-
try {
|
|
52
|
-
await navigator.clipboard.writeText(rawText.value);
|
|
53
|
-
copied.value = true;
|
|
54
|
-
setTimeout(() => {
|
|
55
|
-
copied.value = false;
|
|
56
|
-
}, 2000);
|
|
57
|
-
} catch (_e) {
|
|
58
|
-
alert('复制失败');
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
</script>
|
|
62
|
-
|
|
63
|
-
<style scoped lang="scss">
|
|
64
|
-
.code-block-wrapper {
|
|
65
|
-
position: relative;
|
|
66
|
-
.copy-btn {
|
|
67
|
-
position: absolute;
|
|
68
|
-
top: 8px;
|
|
69
|
-
right: 8px;
|
|
70
|
-
cursor: pointer;
|
|
71
|
-
border: none;
|
|
72
|
-
background-color: transparent;
|
|
73
|
-
padding: 0;
|
|
74
|
-
outline: none;
|
|
75
|
-
height: 20px;
|
|
76
|
-
width: 20px;
|
|
77
|
-
display: flex;
|
|
78
|
-
align-items: center;
|
|
79
|
-
justify-content: center;
|
|
80
|
-
color: #909090;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
</style>
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="foldBlock-wrapper" :style="{ backgroundColor: node.attrs.bgColor, borderColor: node.attrs.bdColor }">
|
|
3
|
-
<div class="collapse-icon" @click="isFolded = !isFolded">
|
|
4
|
-
<component :is="!isFolded ? FoldOpen : FoldClose"></component>
|
|
5
|
-
</div>
|
|
6
|
-
<div class="foldBlock-icon">
|
|
7
|
-
{{ EMOJI_MAP[node.content[0].attrs.emoji] ? EMOJI_MAP[node.content[0].attrs.emoji] : EMOJI_MAP['whale'] }}
|
|
8
|
-
</div>
|
|
9
|
-
<div class="foldBlock-inner" :class="isFolded ? 'is-folded' : 'not-folded'">
|
|
10
|
-
<div class="foldBlock-header">
|
|
11
|
-
<TreeRecursive v-for="child in node.content[0].content" :node="child" :key="useId()" />
|
|
12
|
-
</div>
|
|
13
|
-
<div class="foldBlock-content">
|
|
14
|
-
<TreeRecursive v-for="child in node.content[1].content" :node="child" :key="useId()" />
|
|
15
|
-
</div>
|
|
16
|
-
</div>
|
|
17
|
-
</div>
|
|
18
|
-
</template>
|
|
19
|
-
|
|
20
|
-
<script setup lang="ts">
|
|
21
|
-
import { ref, useId } from 'vue';
|
|
22
|
-
import TreeRecursive from '@datawhale/dipwap-render/components/TreeRecursive.vue';
|
|
23
|
-
import FoldClose from '@datawhale/dipwap-render/icons/Common/FoldClose.vue';
|
|
24
|
-
import FoldOpen from '@datawhale/dipwap-render/icons/Common/FoldOpen.vue';
|
|
25
|
-
import { EMOJI_MAP } from '@datawhale/dipwap-render/utils/emoji';
|
|
26
|
-
import type { PMFoldBlock } from '@datawhale/dipwap-types/index';
|
|
27
|
-
|
|
28
|
-
const { node } = defineProps<{
|
|
29
|
-
node: PMFoldBlock;
|
|
30
|
-
}>();
|
|
31
|
-
|
|
32
|
-
const isFolded = ref(node.attrs.initFolded);
|
|
33
|
-
</script>
|
|
34
|
-
|
|
35
|
-
<style scoped lang="scss">
|
|
36
|
-
.foldBlock-wrapper {
|
|
37
|
-
position: relative;
|
|
38
|
-
margin: 16px 0;
|
|
39
|
-
padding: 16px;
|
|
40
|
-
border-radius: 6px;
|
|
41
|
-
display: flex;
|
|
42
|
-
flex-direction: row;
|
|
43
|
-
border-width: 1.5px;
|
|
44
|
-
border-style: solid;
|
|
45
|
-
.collapse-icon {
|
|
46
|
-
cursor: pointer;
|
|
47
|
-
font-size: 22px;
|
|
48
|
-
position: absolute;
|
|
49
|
-
top: calc(22px - 1.5px);
|
|
50
|
-
right: calc(4px - 1.5px);
|
|
51
|
-
padding: 4px 12px;
|
|
52
|
-
border-radius: 0 6px 0 0;
|
|
53
|
-
z-index: 1;
|
|
54
|
-
display: flex;
|
|
55
|
-
align-items: center;
|
|
56
|
-
}
|
|
57
|
-
.foldBlock-icon {
|
|
58
|
-
font-size: 22px;
|
|
59
|
-
width: 26px;
|
|
60
|
-
height: 26px;
|
|
61
|
-
display: flex;
|
|
62
|
-
justify-content: center;
|
|
63
|
-
align-items: center;
|
|
64
|
-
cursor: default;
|
|
65
|
-
&:hover {
|
|
66
|
-
background-color: rgba(0, 0, 0, 0.1);
|
|
67
|
-
border-radius: 4px;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
.foldBlock-inner {
|
|
71
|
-
display: flex;
|
|
72
|
-
flex-direction: column;
|
|
73
|
-
flex: 1;
|
|
74
|
-
min-width: 0;
|
|
75
|
-
.foldBlock-header {
|
|
76
|
-
padding-left: 12px;
|
|
77
|
-
padding-right: 14px;
|
|
78
|
-
padding-bottom: 16px;
|
|
79
|
-
p {
|
|
80
|
-
font-size: 20px;
|
|
81
|
-
font-weight: 600;
|
|
82
|
-
}
|
|
83
|
-
justify-content: flex-start;
|
|
84
|
-
align-items: center;
|
|
85
|
-
}
|
|
86
|
-
.foldBlock-header > *:first-child,
|
|
87
|
-
.foldBlock-header > ul > li:first-child,
|
|
88
|
-
.foldBlock-header > ul > li:first-child > p:first-child,
|
|
89
|
-
.foldBlock-header > ol > li:first-child,
|
|
90
|
-
.foldBlock-header > ol > li:first-child > p:first-child {
|
|
91
|
-
margin-top: 0;
|
|
92
|
-
}
|
|
93
|
-
.foldBlock-header > *:last-child,
|
|
94
|
-
.foldBlock-header > ul > li:last-child,
|
|
95
|
-
.foldBlock-header > ul > li:last-child > p:last-child,
|
|
96
|
-
.foldBlock-header > ol > li:last-child,
|
|
97
|
-
.foldBlock-header > ol > li:last-child > p:last-child {
|
|
98
|
-
margin-bottom: 0;
|
|
99
|
-
}
|
|
100
|
-
&.is-folded {
|
|
101
|
-
.foldBlock-header {
|
|
102
|
-
padding-bottom: 0;
|
|
103
|
-
}
|
|
104
|
-
.foldBlock-content {
|
|
105
|
-
display: none;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
.foldBlock-content {
|
|
109
|
-
padding-left: 12px;
|
|
110
|
-
overflow-x: auto;
|
|
111
|
-
}
|
|
112
|
-
.foldBlock-content > :deep(*:first-child),
|
|
113
|
-
.foldBlock-content > :deep(ul > li:first-child),
|
|
114
|
-
.foldBlock-content > :deep(ul > li:first-child > p:first-child),
|
|
115
|
-
.foldBlock-content > :deep(ol > li:first-child),
|
|
116
|
-
.foldBlock-content > :deep(ol > li:first-child > p:first-child),
|
|
117
|
-
.foldBlock-content > :deep(div:first-child > pre) {
|
|
118
|
-
margin-top: 0;
|
|
119
|
-
}
|
|
120
|
-
.foldBlock-content > :deep(*:last-child),
|
|
121
|
-
.foldBlock-content > :deep(ul > li:last-child),
|
|
122
|
-
.foldBlock-content > :deep(ul > li:last-child > p:last-child),
|
|
123
|
-
.foldBlock-content > :deep(ol > li:last-child),
|
|
124
|
-
.foldBlock-content > :deep(ol > li:last-child > p:last-child),
|
|
125
|
-
.foldBlock-content > :deep(div:last-child > pre) {
|
|
126
|
-
margin-bottom: 0;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
</style>
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="dipwap-grid">
|
|
3
|
-
<div v-for="column in node.content" :style="{ flex: column.attrs.colWidth / totalWidth }" :key="useId()"
|
|
4
|
-
class="dipwap-column">
|
|
5
|
-
<TreeRecursive v-for="child in column.content" :node="child" :key="useId()" />
|
|
6
|
-
</div>
|
|
7
|
-
</div>
|
|
8
|
-
</template>
|
|
9
|
-
|
|
10
|
-
<script setup lang="ts">
|
|
11
|
-
import { computed, useId } from 'vue';
|
|
12
|
-
import TreeRecursive from '@datawhale/dipwap-render/components/TreeRecursive.vue';
|
|
13
|
-
import type { PMGrid } from '@datawhale/dipwap-types/index';
|
|
14
|
-
|
|
15
|
-
const { node } = defineProps<{
|
|
16
|
-
node: PMGrid;
|
|
17
|
-
}>();
|
|
18
|
-
|
|
19
|
-
const totalWidth = computed(() => {
|
|
20
|
-
let total = 0;
|
|
21
|
-
for (const column of node.content) {
|
|
22
|
-
total += column.attrs.colWidth;
|
|
23
|
-
}
|
|
24
|
-
return total;
|
|
25
|
-
});
|
|
26
|
-
</script>
|
|
27
|
-
|
|
28
|
-
<style lang="scss" scoped>
|
|
29
|
-
.dipwap-grid {
|
|
30
|
-
display: flex;
|
|
31
|
-
flex-direction: row;
|
|
32
|
-
width: calc(100% - 8px);
|
|
33
|
-
gap: 12px;
|
|
34
|
-
margin: 16px 0;
|
|
35
|
-
|
|
36
|
-
&:hover {
|
|
37
|
-
.dipwap-column {
|
|
38
|
-
background-color: rgba(100, 106, 115, 0.05);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.dipwap-column {
|
|
43
|
-
position: relative;
|
|
44
|
-
border-radius: 8px;
|
|
45
|
-
min-width: 50px;
|
|
46
|
-
padding: 12px;
|
|
47
|
-
background-color: transparent;
|
|
48
|
-
transition: background-color 0.2s ease;
|
|
49
|
-
|
|
50
|
-
> :nth-child(1) {
|
|
51
|
-
margin-top: 0;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
> :nth-last-child(1) {
|
|
55
|
-
margin-bottom: 0;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@media screen and (max-width: 768px) {
|
|
61
|
-
.dipwap-grid {
|
|
62
|
-
flex-direction: column !important;
|
|
63
|
-
width: 100%;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.dipwap-column {
|
|
67
|
-
flex: none !important;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
</style>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<iframe class="iframe-wrapper" :src="node.attrs.src"></iframe>
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script setup lang="ts">
|
|
6
|
-
import type { PMIFrame } from '@datawhale/dipwap-types/index';
|
|
7
|
-
|
|
8
|
-
const { node } = defineProps<{
|
|
9
|
-
node: PMIFrame;
|
|
10
|
-
}>();
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<style scoped lang="scss">
|
|
14
|
-
iframe.iframe-wrapper {
|
|
15
|
-
width: 100%;
|
|
16
|
-
margin: 16px 0;
|
|
17
|
-
aspect-ratio: 16 / 9;
|
|
18
|
-
}
|
|
19
|
-
</style>
|