@mixd-id/web-scaffold 0.1.250801002 → 0.1.250801003
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/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="
|
|
2
|
+
<div :class="$style.comp">
|
|
3
3
|
<div class="flex flex-row divide-x divide-text-50 px-3">
|
|
4
4
|
<button type="button" class="p-3" @click="addMarkdown('table')">
|
|
5
5
|
<svg width="13" height="13" class="fill-text" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M448 32H64.05C28.7 32 .0492 60.65 .0492 96v320c0 35.35 28.65 64 64 64h383.1c35.35 0 64-28.65 64-64V96C512 60.65 483.4 32 448 32zM224 416H64v-96h160V416zM224 256H64V160h160V256zM448 416h-160v-96h160V416zM448 256h-160V160h160V256z"/></svg>
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
</button>
|
|
28
28
|
</div>
|
|
29
29
|
|
|
30
|
-
<textarea ref="textarea" class="flex-1 outline-none p-6 bg-transparent" :value="modelValue" />
|
|
30
|
+
<textarea ref="textarea" class="flex-1 outline-none p-6 bg-transparent" :value="modelValue" @keyup="keyUp" />
|
|
31
31
|
</div>
|
|
32
32
|
</template>
|
|
33
33
|
|
|
@@ -108,6 +108,10 @@ export default{
|
|
|
108
108
|
this.$emit('update:modelValue', this.modelValue + content)
|
|
109
109
|
},
|
|
110
110
|
|
|
111
|
+
keyUp(event){
|
|
112
|
+
this.$emit('update:modelValue', event.target.value)
|
|
113
|
+
}
|
|
114
|
+
|
|
111
115
|
}
|
|
112
116
|
|
|
113
117
|
}
|
|
@@ -117,7 +121,8 @@ export default{
|
|
|
117
121
|
<style module>
|
|
118
122
|
|
|
119
123
|
.comp{
|
|
120
|
-
|
|
124
|
+
@apply flex flex-col divide-y divide-text-50 relative;
|
|
125
|
+
@apply border-[1px] border-text-200 bg-base-300 hover:border-text-300 rounded-lg;
|
|
121
126
|
}
|
|
122
127
|
|
|
123
128
|
</style>
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<article v-html="markedText" :class="$style.comp" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup>
|
|
6
|
+
|
|
7
|
+
import { computed } from "vue";
|
|
8
|
+
import {marked} from "marked";
|
|
9
|
+
|
|
10
|
+
const { modelValue } = defineProps({
|
|
11
|
+
modelValue: String
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
const renderer = new marked.Renderer();
|
|
15
|
+
|
|
16
|
+
renderer.image = function(args) {
|
|
17
|
+
const { href, title, text, tokens } = args
|
|
18
|
+
|
|
19
|
+
if (/\.(mp4|webm|ogg)$/i.test(href)) {
|
|
20
|
+
return `
|
|
21
|
+
<video controls style="max-width:100%;">
|
|
22
|
+
<source src="${href}" type="video/${href.split('.').pop()}">
|
|
23
|
+
Your browser does not support the video tag.
|
|
24
|
+
</video>`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return marked.Renderer.prototype.image.call(this, args);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
marked.setOptions({
|
|
31
|
+
highlight: function (code, lang) {
|
|
32
|
+
if (lang && hljs.getLanguage(lang)) {
|
|
33
|
+
return hljs.highlight(code, { language: lang }).value
|
|
34
|
+
}
|
|
35
|
+
return hljs.highlightAuto(code).value
|
|
36
|
+
},
|
|
37
|
+
langPrefix: 'hljs language-',
|
|
38
|
+
gfm: true,
|
|
39
|
+
breaks: true,
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
marked.setOptions({ renderer });
|
|
43
|
+
|
|
44
|
+
const markedText = computed(() => {
|
|
45
|
+
return marked.parse(modelValue)
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<style module>
|
|
51
|
+
|
|
52
|
+
.comp{
|
|
53
|
+
@apply p-6 bg-base-300 overflow-y-auto;
|
|
54
|
+
}
|
|
55
|
+
.comp>*{
|
|
56
|
+
@apply mb-2;
|
|
57
|
+
}
|
|
58
|
+
.comp>h1, .comp>h2, .comp>h3, .comp>h4, .comp>h5, .comp>h6{
|
|
59
|
+
@apply mb-6;
|
|
60
|
+
}
|
|
61
|
+
.comp>* + h1, .comp>* + h2, .comp>* + h3, .comp>* + h4, .comp>* + h5, .comp>* + h6{
|
|
62
|
+
@apply mt-8;
|
|
63
|
+
}
|
|
64
|
+
.comp>hr{
|
|
65
|
+
@apply mt-0 mb-4;
|
|
66
|
+
}
|
|
67
|
+
.comp ol, .comp ul{
|
|
68
|
+
@apply ml-8;
|
|
69
|
+
}
|
|
70
|
+
.comp ol{
|
|
71
|
+
@apply list-decimal;
|
|
72
|
+
}
|
|
73
|
+
.comp ul{
|
|
74
|
+
@apply list-disc;
|
|
75
|
+
}
|
|
76
|
+
.comp strong, .comp label, .comp p, .comp li{
|
|
77
|
+
@apply text-lg;
|
|
78
|
+
}
|
|
79
|
+
.comp table{
|
|
80
|
+
table-layout: fixed;
|
|
81
|
+
border-collapse: collapse;
|
|
82
|
+
}
|
|
83
|
+
.comp th{
|
|
84
|
+
@apply text-left;
|
|
85
|
+
}
|
|
86
|
+
.comp th, .comp td{
|
|
87
|
+
@apply p-2 px-5 border-[1px] border-text-50;
|
|
88
|
+
}
|
|
89
|
+
.comp hr{
|
|
90
|
+
@apply border-text-200 my-4;
|
|
91
|
+
}
|
|
92
|
+
.comp pre{
|
|
93
|
+
@apply rounded-2xl overflow-hidden;
|
|
94
|
+
}
|
|
95
|
+
.comp code{
|
|
96
|
+
@apply !bg-primary-100 p-1 text-sm;
|
|
97
|
+
}
|
|
98
|
+
.comp code *{
|
|
99
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
</style>
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="$style.comp">
|
|
3
3
|
|
|
4
|
-
<TreeViewItem2 v-for="item in items"
|
|
4
|
+
<TreeViewItem2 v-for="(item, index) in items"
|
|
5
5
|
:item="item"
|
|
6
|
+
:index="index"
|
|
6
7
|
:container-class="containerClass">
|
|
7
|
-
<template #default="{ item }">
|
|
8
|
-
<slot :item="item"></slot>
|
|
8
|
+
<template #default="{ item, index }">
|
|
9
|
+
<slot :item="item" :index="index"></slot>
|
|
9
10
|
</template>
|
|
10
11
|
</TreeViewItem2>
|
|
11
12
|
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="$style.comp">
|
|
3
3
|
|
|
4
|
-
<slot name="default" :item="item">
|
|
4
|
+
<slot name="default" :item="item" :index="index">
|
|
5
5
|
<div :class="$style.item">
|
|
6
6
|
<label>{{ item.title }}</label>
|
|
7
7
|
</div>
|
|
8
8
|
</slot>
|
|
9
9
|
|
|
10
|
-
<div v-if="(item.items ?? []).length > 0"
|
|
11
|
-
|
|
10
|
+
<div v-if="(item.items ?? []).length > 0"
|
|
11
|
+
:class="containerClass ?? $style.subitems">
|
|
12
|
+
<TreeViewItem2 v-for="(subItem, index) in item.items"
|
|
12
13
|
:item="subItem"
|
|
14
|
+
:index="index"
|
|
13
15
|
:container-class="containerClass">
|
|
14
|
-
<template #default="{ item }">
|
|
15
|
-
<slot :item="item"></slot>
|
|
16
|
+
<template #default="{ item, index }">
|
|
17
|
+
<slot :item="item" :index="index"></slot>
|
|
16
18
|
</template>
|
|
17
19
|
</TreeViewItem2>
|
|
18
20
|
</div>
|
|
@@ -26,7 +28,9 @@ const { } = defineProps({
|
|
|
26
28
|
|
|
27
29
|
containerClass: String,
|
|
28
30
|
|
|
29
|
-
item: Object
|
|
31
|
+
item: Object,
|
|
32
|
+
|
|
33
|
+
index: Number
|
|
30
34
|
})
|
|
31
35
|
|
|
32
36
|
</script>
|
package/src/index.js
CHANGED
|
@@ -635,6 +635,7 @@ export default{
|
|
|
635
635
|
app.component('CheckoutSetting', defineAsyncComponent(() => import("./widgets/CheckoutSetting.vue")))
|
|
636
636
|
app.component('TreeMenu', defineAsyncComponent(() => import("./components/TreeMenu.vue")))
|
|
637
637
|
app.component('MarkdownEdit', defineAsyncComponent(() => import("./components/MarkdownEdit.vue")))
|
|
638
|
+
app.component('MarkdownPreview', defineAsyncComponent(() => import("./components/MarkdownPreview.vue")))
|
|
638
639
|
}
|
|
639
640
|
|
|
640
641
|
}
|