@vigilkids/section-renderer-vue 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.
- package/LICENSE +21 -0
- package/README.md +88 -0
- package/dist/assets/images/article/arrow.svg +3 -0
- package/dist/assets/images/article/hot.svg +3 -0
- package/dist/assets/images/article/notice-info-icon.svg +5 -0
- package/dist/assets/images/article/notice-info.svg +3 -0
- package/dist/assets/images/article/notice-warning-icon.svg +5 -0
- package/dist/assets/images/article/notice-warning.svg +10 -0
- package/dist/assets/images/article/question.svg +10 -0
- package/dist/composables/useInlineEdit.d.ts +30 -0
- package/dist/composables/useInlineEdit.mjs +94 -0
- package/dist/composables/useLazyRender.d.ts +18 -0
- package/dist/composables/useLazyRender.mjs +33 -0
- package/dist/composables/useRegistry.d.ts +38 -0
- package/dist/composables/useRegistry.mjs +60 -0
- package/dist/composables/useSectionSEO.d.ts +26 -0
- package/dist/composables/useSectionSEO.mjs +122 -0
- package/dist/composables/useSectionStyle.d.ts +23 -0
- package/dist/composables/useSectionStyle.mjs +111 -0
- package/dist/editor.d.ts +4 -0
- package/dist/editor.mjs +9 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.mjs +14 -0
- package/dist/plugin.d.ts +6 -0
- package/dist/plugin.mjs +14 -0
- package/dist/preview/createPreviewApp.d.ts +20 -0
- package/dist/preview/createPreviewApp.mjs +161 -0
- package/dist/renderer/FallbackSection.d.vue.ts +8 -0
- package/dist/renderer/FallbackSection.vue +17 -0
- package/dist/renderer/FallbackSection.vue.d.ts +8 -0
- package/dist/renderer/LazySection.d.vue.ts +60 -0
- package/dist/renderer/LazySection.vue +115 -0
- package/dist/renderer/LazySection.vue.d.ts +60 -0
- package/dist/renderer/SectionErrorBoundary.d.vue.ts +16 -0
- package/dist/renderer/SectionErrorBoundary.vue +38 -0
- package/dist/renderer/SectionErrorBoundary.vue.d.ts +16 -0
- package/dist/renderer/SectionRenderer.d.vue.ts +29 -0
- package/dist/renderer/SectionRenderer.vue +99 -0
- package/dist/renderer/SectionRenderer.vue.d.ts +29 -0
- package/dist/renderer/SectionWrapper.d.vue.ts +24 -0
- package/dist/renderer/SectionWrapper.vue +52 -0
- package/dist/renderer/SectionWrapper.vue.d.ts +24 -0
- package/dist/sections/RichTextSection.d.vue.ts +9 -0
- package/dist/sections/RichTextSection.vue +135 -0
- package/dist/sections/RichTextSection.vue.d.ts +9 -0
- package/dist/sections/article/index.d.ts +2 -0
- package/dist/sections/article/index.mjs +174 -0
- package/dist/sections/article/prosemirror.d.ts +2 -0
- package/dist/sections/article/prosemirror.mjs +65 -0
- package/dist/sections/article/shared/ArticleCustomHtml.d.vue.ts +9 -0
- package/dist/sections/article/shared/ArticleCustomHtml.vue +32 -0
- package/dist/sections/article/shared/ArticleCustomHtml.vue.d.ts +9 -0
- package/dist/sections/article/shared/ArticleImage.d.vue.ts +21 -0
- package/dist/sections/article/shared/ArticleImage.vue +53 -0
- package/dist/sections/article/shared/ArticleImage.vue.d.ts +21 -0
- package/dist/sections/article/vigilkids/ArticleBulletList.d.vue.ts +21 -0
- package/dist/sections/article/vigilkids/ArticleBulletList.vue +48 -0
- package/dist/sections/article/vigilkids/ArticleBulletList.vue.d.ts +21 -0
- package/dist/sections/article/vigilkids/ArticleCta.d.vue.ts +21 -0
- package/dist/sections/article/vigilkids/ArticleCta.vue +126 -0
- package/dist/sections/article/vigilkids/ArticleCta.vue.d.ts +21 -0
- package/dist/sections/article/vigilkids/ArticleFaq.d.vue.ts +21 -0
- package/dist/sections/article/vigilkids/ArticleFaq.vue +62 -0
- package/dist/sections/article/vigilkids/ArticleFaq.vue.d.ts +21 -0
- package/dist/sections/article/vigilkids/ArticleFaqItem.d.vue.ts +5 -0
- package/dist/sections/article/vigilkids/ArticleFaqItem.vue +24 -0
- package/dist/sections/article/vigilkids/ArticleFaqItem.vue.d.ts +5 -0
- package/dist/sections/article/vigilkids/ArticleFeature.d.vue.ts +21 -0
- package/dist/sections/article/vigilkids/ArticleFeature.vue +77 -0
- package/dist/sections/article/vigilkids/ArticleFeature.vue.d.ts +21 -0
- package/dist/sections/article/vigilkids/ArticleHeading.d.vue.ts +21 -0
- package/dist/sections/article/vigilkids/ArticleHeading.vue +53 -0
- package/dist/sections/article/vigilkids/ArticleHeading.vue.d.ts +21 -0
- package/dist/sections/article/vigilkids/ArticleNotice.d.vue.ts +21 -0
- package/dist/sections/article/vigilkids/ArticleNotice.vue +81 -0
- package/dist/sections/article/vigilkids/ArticleNotice.vue.d.ts +21 -0
- package/dist/sections/article/vigilkids/ArticleProsCons.d.vue.ts +21 -0
- package/dist/sections/article/vigilkids/ArticleProsCons.vue +74 -0
- package/dist/sections/article/vigilkids/ArticleProsCons.vue.d.ts +21 -0
- package/dist/sections/article/vigilkids/ArticleQuestion.d.vue.ts +21 -0
- package/dist/sections/article/vigilkids/ArticleQuestion.vue +58 -0
- package/dist/sections/article/vigilkids/ArticleQuestion.vue.d.ts +21 -0
- package/dist/sections/article/vigilkids/ArticleQuote.d.vue.ts +21 -0
- package/dist/sections/article/vigilkids/ArticleQuote.vue +50 -0
- package/dist/sections/article/vigilkids/ArticleQuote.vue.d.ts +21 -0
- package/dist/sections/article/vigilkids/ArticleStepList.d.vue.ts +21 -0
- package/dist/sections/article/vigilkids/ArticleStepList.vue +49 -0
- package/dist/sections/article/vigilkids/ArticleStepList.vue.d.ts +21 -0
- package/dist/sections/article/vigilkids/ArticleSubheading.d.vue.ts +21 -0
- package/dist/sections/article/vigilkids/ArticleSubheading.vue +56 -0
- package/dist/sections/article/vigilkids/ArticleSubheading.vue.d.ts +21 -0
- package/dist/sections/article/vigilkids/ArticleTable.d.vue.ts +9 -0
- package/dist/sections/article/vigilkids/ArticleTable.vue +75 -0
- package/dist/sections/article/vigilkids/ArticleTable.vue.d.ts +9 -0
- package/dist/sections/article/vigilkids/ArticleToc.d.vue.ts +21 -0
- package/dist/sections/article/vigilkids/ArticleToc.vue +102 -0
- package/dist/sections/article/vigilkids/ArticleToc.vue.d.ts +21 -0
- package/dist/sections/article/visiva/ArticleBulletList.d.vue.ts +21 -0
- package/dist/sections/article/visiva/ArticleBulletList.vue +48 -0
- package/dist/sections/article/visiva/ArticleBulletList.vue.d.ts +21 -0
- package/dist/sections/article/visiva/ArticleCta.d.vue.ts +21 -0
- package/dist/sections/article/visiva/ArticleCta.vue +148 -0
- package/dist/sections/article/visiva/ArticleCta.vue.d.ts +21 -0
- package/dist/sections/article/visiva/ArticleFaq.d.vue.ts +21 -0
- package/dist/sections/article/visiva/ArticleFaq.vue +76 -0
- package/dist/sections/article/visiva/ArticleFaq.vue.d.ts +21 -0
- package/dist/sections/article/visiva/ArticleFeature.d.vue.ts +21 -0
- package/dist/sections/article/visiva/ArticleFeature.vue +79 -0
- package/dist/sections/article/visiva/ArticleFeature.vue.d.ts +21 -0
- package/dist/sections/article/visiva/ArticleHeading.d.vue.ts +21 -0
- package/dist/sections/article/visiva/ArticleHeading.vue +61 -0
- package/dist/sections/article/visiva/ArticleHeading.vue.d.ts +21 -0
- package/dist/sections/article/visiva/ArticleNotice.d.vue.ts +21 -0
- package/dist/sections/article/visiva/ArticleNotice.vue +102 -0
- package/dist/sections/article/visiva/ArticleNotice.vue.d.ts +21 -0
- package/dist/sections/article/visiva/ArticleProsCons.d.vue.ts +21 -0
- package/dist/sections/article/visiva/ArticleProsCons.vue +98 -0
- package/dist/sections/article/visiva/ArticleProsCons.vue.d.ts +21 -0
- package/dist/sections/article/visiva/ArticleQuestion.d.vue.ts +21 -0
- package/dist/sections/article/visiva/ArticleQuestion.vue +80 -0
- package/dist/sections/article/visiva/ArticleQuestion.vue.d.ts +21 -0
- package/dist/sections/article/visiva/ArticleQuote.d.vue.ts +21 -0
- package/dist/sections/article/visiva/ArticleQuote.vue +50 -0
- package/dist/sections/article/visiva/ArticleQuote.vue.d.ts +21 -0
- package/dist/sections/article/visiva/ArticleStepList.d.vue.ts +21 -0
- package/dist/sections/article/visiva/ArticleStepList.vue +48 -0
- package/dist/sections/article/visiva/ArticleStepList.vue.d.ts +21 -0
- package/dist/sections/article/visiva/ArticleSubheading.d.vue.ts +21 -0
- package/dist/sections/article/visiva/ArticleSubheading.vue +91 -0
- package/dist/sections/article/visiva/ArticleSubheading.vue.d.ts +21 -0
- package/dist/sections/article/visiva/ArticleTable.d.vue.ts +9 -0
- package/dist/sections/article/visiva/ArticleTable.vue +140 -0
- package/dist/sections/article/visiva/ArticleTable.vue.d.ts +9 -0
- package/dist/sections/article/visiva/ArticleToc.d.vue.ts +21 -0
- package/dist/sections/article/visiva/ArticleToc.vue +116 -0
- package/dist/sections/article/visiva/ArticleToc.vue.d.ts +21 -0
- package/dist/shims-css.d.ts +4 -0
- package/dist/styles/products/vigilkids.css +1 -0
- package/dist/styles/products/visiva.css +1 -0
- package/package.json +43 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { BlockData } from '@vigilkids/section-core'
|
|
3
|
+
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
|
|
6
|
+
import { useInlineEdit } from '../../../composables/useInlineEdit'
|
|
7
|
+
import { renderContent } from '../prosemirror'
|
|
8
|
+
|
|
9
|
+
const props = defineProps<{
|
|
10
|
+
blockOrder: string[]
|
|
11
|
+
blocks: Record<string, BlockData>
|
|
12
|
+
editorMode?: boolean
|
|
13
|
+
settings: Record<string, unknown>
|
|
14
|
+
}>()
|
|
15
|
+
|
|
16
|
+
const emit = defineEmits<{
|
|
17
|
+
(e: 'update:setting', key: string, value: unknown): void
|
|
18
|
+
(e: 'update:block-setting', blockId: string, key: string, value: unknown): void
|
|
19
|
+
(e: 'inline-edit-start', key: string): void
|
|
20
|
+
(e: 'inline-edit-end'): void
|
|
21
|
+
(e: 'undo-redo', action: 'redo' | 'undo'): void
|
|
22
|
+
}>()
|
|
23
|
+
|
|
24
|
+
const s = computed(() => props.settings)
|
|
25
|
+
const renderedContent = computed(() => renderContent(s.value.content))
|
|
26
|
+
|
|
27
|
+
const { editableAttrs } = useInlineEdit({
|
|
28
|
+
editorMode: () => !!props.editorMode,
|
|
29
|
+
onSettingUpdate: (key, value) => emit('update:setting', key, value),
|
|
30
|
+
onBlockSettingUpdate: (blockId, key, value) => emit('update:block-setting', blockId, key, value),
|
|
31
|
+
onEditStart: (key) => emit('inline-edit-start', key),
|
|
32
|
+
onEditEnd: () => emit('inline-edit-end'),
|
|
33
|
+
onUndoRedo: (action) => emit('undo-redo', action),
|
|
34
|
+
})
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<template>
|
|
38
|
+
<div class="article-info">
|
|
39
|
+
<p v-if="s.title" class="article-info-title" v-bind="editableAttrs('title')">{{ s.title }}</p>
|
|
40
|
+
<div class="article-info-content" v-html="renderedContent" />
|
|
41
|
+
<cite v-if="s.attribution" class="article-info-attribution">
|
|
42
|
+
<span class="article-info-divider"></span>
|
|
43
|
+
<span v-bind="editableAttrs('attribution')">by {{ s.attribution }}</span>
|
|
44
|
+
</cite>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<style scoped>
|
|
49
|
+
.article-info{background:var(--article-quote-bg,#f7f7f7);border:var(--article-quote-border,none);color:var(--article-text,#3a4259);font-size:16px;line-height:24px;margin:30px 0 14px;padding:30px;position:relative}.article-info:before{background:var(--article-quote-bar,#24c790);content:"";height:100%;left:0;position:absolute;top:0;width:10px}.article-info-title{font-size:20px;font-weight:700;line-height:23px;margin-top:0}.article-info-content,.article-info-title{color:var(--article-text,#3a4259);margin-bottom:14px}.article-info-content{font-size:16px;font-style:italic;line-height:24px}.article-info-content :deep(p){margin-top:10px}.article-info-content :deep(p:first-child){margin-top:0}.article-info-attribution{align-items:center;display:flex;font-style:normal;margin-bottom:0;margin-top:10px}.article-info-divider{background:var(--article-text-muted,#6b7280);display:inline-block;height:1px;margin-right:8px;vertical-align:middle;width:48px}@media (max-width:768px){.article-info{font-size:14px;padding:20px 16px}.article-info:before{height:100%;width:4px}.article-info-title{font-size:18px;line-height:21px;margin-bottom:10px}.article-info-content{font-size:14px;line-height:21px}.article-info-attribution{text-align:right}}
|
|
50
|
+
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BlockData } from '@vigilkids/section-core';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
blockOrder: string[];
|
|
4
|
+
blocks: Record<string, BlockData>;
|
|
5
|
+
editorMode?: boolean;
|
|
6
|
+
settings: Record<string, unknown>;
|
|
7
|
+
};
|
|
8
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
9
|
+
"update:setting": (key: string, value: unknown) => any;
|
|
10
|
+
"update:block-setting": (blockId: string, key: string, value: unknown) => any;
|
|
11
|
+
"inline-edit-start": (key: string) => any;
|
|
12
|
+
"inline-edit-end": () => any;
|
|
13
|
+
"undo-redo": (action: "redo" | "undo") => any;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
15
|
+
"onUpdate:setting"?: ((key: string, value: unknown) => any) | undefined;
|
|
16
|
+
"onUpdate:block-setting"?: ((blockId: string, key: string, value: unknown) => any) | undefined;
|
|
17
|
+
"onInline-edit-start"?: ((key: string) => any) | undefined;
|
|
18
|
+
"onInline-edit-end"?: (() => any) | undefined;
|
|
19
|
+
"onUndo-redo"?: ((action: "redo" | "undo") => any) | undefined;
|
|
20
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BlockData } from '@vigilkids/section-core';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
blockOrder: string[];
|
|
4
|
+
blocks: Record<string, BlockData>;
|
|
5
|
+
editorMode?: boolean;
|
|
6
|
+
settings: Record<string, unknown>;
|
|
7
|
+
};
|
|
8
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
9
|
+
"update:setting": (key: string, value: unknown) => any;
|
|
10
|
+
"update:block-setting": (blockId: string, key: string, value: unknown) => any;
|
|
11
|
+
"inline-edit-start": (key: string) => any;
|
|
12
|
+
"inline-edit-end": () => any;
|
|
13
|
+
"undo-redo": (action: "redo" | "undo") => any;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
15
|
+
"onUpdate:setting"?: ((key: string, value: unknown) => any) | undefined;
|
|
16
|
+
"onUpdate:block-setting"?: ((blockId: string, key: string, value: unknown) => any) | undefined;
|
|
17
|
+
"onInline-edit-start"?: ((key: string) => any) | undefined;
|
|
18
|
+
"onInline-edit-end"?: (() => any) | undefined;
|
|
19
|
+
"onUndo-redo"?: ((action: "redo" | "undo") => any) | undefined;
|
|
20
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { BlockData } from '@vigilkids/section-core'
|
|
3
|
+
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
|
|
6
|
+
import { useInlineEdit } from '../../../composables/useInlineEdit'
|
|
7
|
+
|
|
8
|
+
const props = defineProps<{
|
|
9
|
+
blockOrder: string[]
|
|
10
|
+
blocks: Record<string, BlockData>
|
|
11
|
+
editorMode?: boolean
|
|
12
|
+
settings: Record<string, unknown>
|
|
13
|
+
}>()
|
|
14
|
+
|
|
15
|
+
const emit = defineEmits<{
|
|
16
|
+
(e: 'update:setting', key: string, value: unknown): void
|
|
17
|
+
(e: 'update:block-setting', blockId: string, key: string, value: unknown): void
|
|
18
|
+
(e: 'inline-edit-start', key: string): void
|
|
19
|
+
(e: 'inline-edit-end'): void
|
|
20
|
+
(e: 'undo-redo', action: 'redo' | 'undo'): void
|
|
21
|
+
}>()
|
|
22
|
+
|
|
23
|
+
const blockOrder = computed(() => props.blockOrder)
|
|
24
|
+
const blocks = computed(() => props.blocks)
|
|
25
|
+
|
|
26
|
+
const { blockEditableAttrs } = useInlineEdit({
|
|
27
|
+
editorMode: () => !!props.editorMode,
|
|
28
|
+
onSettingUpdate: (key, value) => emit('update:setting', key, value),
|
|
29
|
+
onBlockSettingUpdate: (blockId, key, value) => emit('update:block-setting', blockId, key, value),
|
|
30
|
+
onEditStart: (key) => emit('inline-edit-start', key),
|
|
31
|
+
onEditEnd: () => emit('inline-edit-end'),
|
|
32
|
+
onUndoRedo: (action) => emit('undo-redo', action),
|
|
33
|
+
})
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<template>
|
|
37
|
+
<ul class="step-list">
|
|
38
|
+
<template v-for="blockId in blockOrder" :key="blockId">
|
|
39
|
+
<li v-if="blocks[blockId]">
|
|
40
|
+
<span class="primary-color" v-bind="blockEditableAttrs(blockId, 'label')">{{ blocks[blockId]!.settings.label }}</span>
|
|
41
|
+
{{ blocks[blockId]!.settings.description }}
|
|
42
|
+
</li>
|
|
43
|
+
</template>
|
|
44
|
+
</ul>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<style scoped>
|
|
48
|
+
.step-list{list-style:none;margin-bottom:30px;margin-top:20px;padding:0}.step-list li:not(:last-child){margin-bottom:24px}.step-list li{color:var(--article-text,#3a4259);font-size:16px;line-height:24px}.step-list li span{font-weight:700}.step-list .primary-color{color:var(--article-primary-hover,#1ba97a)}@media (max-width:768px){.step-list li{font-size:14px;line-height:21px}.step-list li:not(:last-child){margin-bottom:21px}}
|
|
49
|
+
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BlockData } from '@vigilkids/section-core';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
blockOrder: string[];
|
|
4
|
+
blocks: Record<string, BlockData>;
|
|
5
|
+
editorMode?: boolean;
|
|
6
|
+
settings: Record<string, unknown>;
|
|
7
|
+
};
|
|
8
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
9
|
+
"update:setting": (key: string, value: unknown) => any;
|
|
10
|
+
"update:block-setting": (blockId: string, key: string, value: unknown) => any;
|
|
11
|
+
"inline-edit-start": (key: string) => any;
|
|
12
|
+
"inline-edit-end": () => any;
|
|
13
|
+
"undo-redo": (action: "redo" | "undo") => any;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
15
|
+
"onUpdate:setting"?: ((key: string, value: unknown) => any) | undefined;
|
|
16
|
+
"onUpdate:block-setting"?: ((blockId: string, key: string, value: unknown) => any) | undefined;
|
|
17
|
+
"onInline-edit-start"?: ((key: string) => any) | undefined;
|
|
18
|
+
"onInline-edit-end"?: (() => any) | undefined;
|
|
19
|
+
"onUndo-redo"?: ((action: "redo" | "undo") => any) | undefined;
|
|
20
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BlockData } from '@vigilkids/section-core';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
blockOrder: string[];
|
|
4
|
+
blocks: Record<string, BlockData>;
|
|
5
|
+
editorMode?: boolean;
|
|
6
|
+
settings: Record<string, unknown>;
|
|
7
|
+
};
|
|
8
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
9
|
+
"update:setting": (key: string, value: unknown) => any;
|
|
10
|
+
"update:block-setting": (blockId: string, key: string, value: unknown) => any;
|
|
11
|
+
"inline-edit-start": (key: string) => any;
|
|
12
|
+
"inline-edit-end": () => any;
|
|
13
|
+
"undo-redo": (action: "redo" | "undo") => any;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
15
|
+
"onUpdate:setting"?: ((key: string, value: unknown) => any) | undefined;
|
|
16
|
+
"onUpdate:block-setting"?: ((blockId: string, key: string, value: unknown) => any) | undefined;
|
|
17
|
+
"onInline-edit-start"?: ((key: string) => any) | undefined;
|
|
18
|
+
"onInline-edit-end"?: (() => any) | undefined;
|
|
19
|
+
"onUndo-redo"?: ((action: "redo" | "undo") => any) | undefined;
|
|
20
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { BlockData } from '@vigilkids/section-core'
|
|
3
|
+
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
|
|
6
|
+
import { useInlineEdit } from '../../../composables/useInlineEdit'
|
|
7
|
+
|
|
8
|
+
const props = defineProps<{
|
|
9
|
+
blockOrder: string[]
|
|
10
|
+
blocks: Record<string, BlockData>
|
|
11
|
+
editorMode?: boolean
|
|
12
|
+
settings: Record<string, unknown>
|
|
13
|
+
}>()
|
|
14
|
+
|
|
15
|
+
const emit = defineEmits<{
|
|
16
|
+
(e: 'update:setting', key: string, value: unknown): void
|
|
17
|
+
(e: 'update:block-setting', blockId: string, key: string, value: unknown): void
|
|
18
|
+
(e: 'inline-edit-start', key: string): void
|
|
19
|
+
(e: 'inline-edit-end'): void
|
|
20
|
+
(e: 'undo-redo', action: 'redo' | 'undo'): void
|
|
21
|
+
}>()
|
|
22
|
+
|
|
23
|
+
const s = computed(() => props.settings)
|
|
24
|
+
const variant = computed(() => (s.value.variant as string) || 'default')
|
|
25
|
+
|
|
26
|
+
const { editableAttrs } = useInlineEdit({
|
|
27
|
+
editorMode: () => !!props.editorMode,
|
|
28
|
+
onSettingUpdate: (key, value) => emit('update:setting', key, value),
|
|
29
|
+
onBlockSettingUpdate: (blockId, key, value) => emit('update:block-setting', blockId, key, value),
|
|
30
|
+
onEditStart: (key) => emit('inline-edit-start', key),
|
|
31
|
+
onEditEnd: () => emit('inline-edit-end'),
|
|
32
|
+
onUndoRedo: (action) => emit('undo-redo', action),
|
|
33
|
+
})
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<template>
|
|
37
|
+
<h3 :class="['article-subheading', `article-subheading--${variant}`]">
|
|
38
|
+
<!-- numbered: 实心绿色圆形+白色数字 (VigilKids) -->
|
|
39
|
+
<span v-if="variant === 'numbered' && s.number" class="article-subheading__number" v-bind="editableAttrs('number')">
|
|
40
|
+
{{ s.number }}
|
|
41
|
+
</span>
|
|
42
|
+
<!-- pill: 绿色药丸标签 (Visiva) -->
|
|
43
|
+
<span v-else-if="variant === 'pill' && s.label" class="article-subheading__pill" v-bind="editableAttrs('label')">
|
|
44
|
+
{{ s.label }}
|
|
45
|
+
</span>
|
|
46
|
+
<!-- icon: 浅色圆形+深色数字 (Visiva) -->
|
|
47
|
+
<span v-else-if="variant === 'icon' && s.number" class="article-subheading__icon" v-bind="editableAttrs('number')">
|
|
48
|
+
{{ s.number }}
|
|
49
|
+
</span>
|
|
50
|
+
<span v-bind="editableAttrs('title')">{{ s.title }}</span>
|
|
51
|
+
</h3>
|
|
52
|
+
</template>
|
|
53
|
+
|
|
54
|
+
<style scoped>
|
|
55
|
+
.article-subheading{align-items:center;color:var(--article-primary-hover,#1ba97a);display:flex;font-size:20px;font-weight:700;line-height:23px;margin-top:30px}.article-subheading--numbered{color:var(--article-text,#3a4259)}.article-subheading__number{align-items:center;background:var(--article-sub-number-bg,var(--article-primary,#24c790));border:var(--article-sub-number-border,none);border-radius:50%;color:var(--article-sub-number-color,#fff);display:flex;height:36px;justify-content:center;margin-right:14px;min-width:36px;width:36px}.article-subheading__pill{background:var(--article-primary,#24c790);border-radius:20px;color:#fff;display:inline-flex;height:22px;padding:0 8px}.article-subheading__icon,.article-subheading__pill{align-items:center;flex-shrink:0;font-size:14px;font-weight:600;justify-content:center;margin-right:8px}.article-subheading__icon{background:var(--article-highlight,#ecfdf5);border-radius:50%;color:var(--article-text,#3a4259);display:flex;height:24px;min-width:24px;width:24px}.article-subheading--icon,.article-subheading--pill{color:var(--article-text,#3a4259);font-weight:700}@media (max-width:768px){.article-subheading{font-size:18px}}
|
|
56
|
+
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BlockData } from '@vigilkids/section-core';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
blockOrder: string[];
|
|
4
|
+
blocks: Record<string, BlockData>;
|
|
5
|
+
editorMode?: boolean;
|
|
6
|
+
settings: Record<string, unknown>;
|
|
7
|
+
};
|
|
8
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
9
|
+
"update:setting": (key: string, value: unknown) => any;
|
|
10
|
+
"update:block-setting": (blockId: string, key: string, value: unknown) => any;
|
|
11
|
+
"inline-edit-start": (key: string) => any;
|
|
12
|
+
"inline-edit-end": () => any;
|
|
13
|
+
"undo-redo": (action: "redo" | "undo") => any;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
15
|
+
"onUpdate:setting"?: ((key: string, value: unknown) => any) | undefined;
|
|
16
|
+
"onUpdate:block-setting"?: ((blockId: string, key: string, value: unknown) => any) | undefined;
|
|
17
|
+
"onInline-edit-start"?: ((key: string) => any) | undefined;
|
|
18
|
+
"onInline-edit-end"?: (() => any) | undefined;
|
|
19
|
+
"onUndo-redo"?: ((action: "redo" | "undo") => any) | undefined;
|
|
20
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BlockData } from '@vigilkids/section-core';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
blockOrder: string[];
|
|
4
|
+
blocks: Record<string, BlockData>;
|
|
5
|
+
editorMode?: boolean;
|
|
6
|
+
settings: Record<string, unknown>;
|
|
7
|
+
};
|
|
8
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { BlockData } from '@vigilkids/section-core'
|
|
3
|
+
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
|
|
6
|
+
const props = defineProps<{
|
|
7
|
+
blockOrder: string[]
|
|
8
|
+
blocks: Record<string, BlockData>
|
|
9
|
+
editorMode?: boolean
|
|
10
|
+
settings: Record<string, unknown>
|
|
11
|
+
}>()
|
|
12
|
+
|
|
13
|
+
const s = computed(() => props.settings)
|
|
14
|
+
|
|
15
|
+
interface ColumnDef {
|
|
16
|
+
label: string
|
|
17
|
+
min_width?: number
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function parseJsonOrArray<T>(value: unknown): T[] {
|
|
21
|
+
if (Array.isArray(value)) return value as T[]
|
|
22
|
+
if (typeof value === 'string') {
|
|
23
|
+
try {
|
|
24
|
+
const parsed = JSON.parse(value)
|
|
25
|
+
if (Array.isArray(parsed)) return parsed as T[]
|
|
26
|
+
} catch {
|
|
27
|
+
/* JSON 解析失败,返回空数组 */
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return []
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const isSticky = computed(() => String(s.value.variant) === 'sticky')
|
|
34
|
+
|
|
35
|
+
const columns = computed<ColumnDef[]>(() =>
|
|
36
|
+
parseJsonOrArray<ColumnDef>(s.value.columns),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
const rows = computed(() =>
|
|
40
|
+
props.blockOrder
|
|
41
|
+
.filter((id) => props.blocks[id]?.type === 'table-row')
|
|
42
|
+
.map((id) => {
|
|
43
|
+
const block = props.blocks[id]!
|
|
44
|
+
return parseJsonOrArray<string>(block.settings.cells)
|
|
45
|
+
}),
|
|
46
|
+
)
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<template>
|
|
50
|
+
<div :class="['contrast-table', { 'sticky-table': isSticky }]">
|
|
51
|
+
<table>
|
|
52
|
+
<thead align="left">
|
|
53
|
+
<tr>
|
|
54
|
+
<th
|
|
55
|
+
v-for="(col, idx) in columns"
|
|
56
|
+
:key="idx"
|
|
57
|
+
:style="col.min_width ? { minWidth: `${col.min_width}px` } : undefined"
|
|
58
|
+
>
|
|
59
|
+
{{ col.label }}
|
|
60
|
+
</th>
|
|
61
|
+
</tr>
|
|
62
|
+
</thead>
|
|
63
|
+
<tbody align="left">
|
|
64
|
+
<tr v-for="(row, rowIdx) in rows" :key="rowIdx">
|
|
65
|
+
<!-- eslint-disable-next-line vue/no-v-html -->
|
|
66
|
+
<td v-for="(cell, cellIdx) in row" :key="cellIdx" v-html="cell" />
|
|
67
|
+
</tr>
|
|
68
|
+
</tbody>
|
|
69
|
+
</table>
|
|
70
|
+
</div>
|
|
71
|
+
</template>
|
|
72
|
+
|
|
73
|
+
<style scoped>
|
|
74
|
+
.contrast-table{background:#fff;border:1px solid var(--article-border,#e5e7eb);margin:30px 0;overflow-x:auto}.contrast-table table{border-spacing:0;color:var(--article-text,#3a4259);text-align:center;width:100%}.contrast-table td,.contrast-table th{border-bottom:1px solid var(--article-border,#e5e7eb);border-right:1px solid var(--article-border,#e5e7eb);padding:18px 20px;width:25%}.contrast-table td:last-child,.contrast-table th:last-child{border-right:none}.contrast-table thead{font-size:16px}.contrast-table tbody tr:last-child td{border-bottom:none}.contrast-table tr td,.contrast-table tr th{background-color:#fff}.contrast-table tbody tr:nth-child(2n) td{background-color:var(--article-bg-light,#f5f9fc)}.contrast-table thead tr th{background-color:var(--article-table-header,#374151);color:var(--article-table-header-text,#fff)}.contrast-table.sticky-table tr td:first-child,.contrast-table.sticky-table tr th:first-child{font-weight:700;left:0;position:sticky;z-index:2}.contrast-table.sticky-table tr td:first-child:after,.contrast-table.sticky-table tr th:first-child:after{background-image:linear-gradient(270deg,rgba(49,49,49,0),rgba(0,0,0,.04));bottom:0;content:"";position:absolute;right:-16px;top:0;width:16px;z-index:1}.contrast-table tr td :deep(a){color:var(--article-primary-hover,#1ba97a);font-weight:400}@media (max-width:768px){.contrast-table:not(.sticky-table) tr th{min-width:200px!important}.contrast-table tbody{font-size:14px}}
|
|
75
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BlockData } from '@vigilkids/section-core';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
blockOrder: string[];
|
|
4
|
+
blocks: Record<string, BlockData>;
|
|
5
|
+
editorMode?: boolean;
|
|
6
|
+
settings: Record<string, unknown>;
|
|
7
|
+
};
|
|
8
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BlockData } from '@vigilkids/section-core';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
blockOrder: string[];
|
|
4
|
+
blocks: Record<string, BlockData>;
|
|
5
|
+
editorMode?: boolean;
|
|
6
|
+
settings: Record<string, unknown>;
|
|
7
|
+
};
|
|
8
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
9
|
+
"update:setting": (key: string, value: unknown) => any;
|
|
10
|
+
"update:block-setting": (blockId: string, key: string, value: unknown) => any;
|
|
11
|
+
"inline-edit-start": (key: string) => any;
|
|
12
|
+
"inline-edit-end": () => any;
|
|
13
|
+
"undo-redo": (action: "redo" | "undo") => any;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
15
|
+
"onUpdate:setting"?: ((key: string, value: unknown) => any) | undefined;
|
|
16
|
+
"onUpdate:block-setting"?: ((blockId: string, key: string, value: unknown) => any) | undefined;
|
|
17
|
+
"onInline-edit-start"?: ((key: string) => any) | undefined;
|
|
18
|
+
"onInline-edit-end"?: (() => any) | undefined;
|
|
19
|
+
"onUndo-redo"?: ((action: "redo" | "undo") => any) | undefined;
|
|
20
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { BlockData } from '@vigilkids/section-core'
|
|
3
|
+
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
|
|
6
|
+
import { useInlineEdit } from '../../../composables/useInlineEdit'
|
|
7
|
+
|
|
8
|
+
interface TocGroup {
|
|
9
|
+
id: string
|
|
10
|
+
text: string
|
|
11
|
+
anchor: string
|
|
12
|
+
hot: boolean
|
|
13
|
+
children: { id: string; text: string; anchor: string }[]
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const props = defineProps<{
|
|
17
|
+
blockOrder: string[]
|
|
18
|
+
blocks: Record<string, BlockData>
|
|
19
|
+
editorMode?: boolean
|
|
20
|
+
settings: Record<string, unknown>
|
|
21
|
+
}>()
|
|
22
|
+
|
|
23
|
+
const emit = defineEmits<{
|
|
24
|
+
(e: 'update:setting', key: string, value: unknown): void
|
|
25
|
+
(e: 'update:block-setting', blockId: string, key: string, value: unknown): void
|
|
26
|
+
(e: 'inline-edit-start', key: string): void
|
|
27
|
+
(e: 'inline-edit-end'): void
|
|
28
|
+
(e: 'undo-redo', action: 'redo' | 'undo'): void
|
|
29
|
+
}>()
|
|
30
|
+
|
|
31
|
+
const title = computed(() => String(props.settings.title || 'Table Of Contents'))
|
|
32
|
+
|
|
33
|
+
// 将 blockOrder 中连续的 toc-h3 归组到前一个 toc-h2 下
|
|
34
|
+
const tocGroups = computed<TocGroup[]>(() => {
|
|
35
|
+
const groups: TocGroup[] = []
|
|
36
|
+
|
|
37
|
+
for (const blockId of props.blockOrder) {
|
|
38
|
+
const block = props.blocks[blockId]
|
|
39
|
+
if (!block) continue
|
|
40
|
+
|
|
41
|
+
if (block.type === 'toc-h2') {
|
|
42
|
+
groups.push({
|
|
43
|
+
id: blockId,
|
|
44
|
+
text: String(block.settings.text || ''),
|
|
45
|
+
anchor: String(block.settings.anchor || ''),
|
|
46
|
+
hot: Boolean(block.settings.hot),
|
|
47
|
+
children: [],
|
|
48
|
+
})
|
|
49
|
+
} else if (block.type === 'toc-h3' && groups.length > 0) {
|
|
50
|
+
groups[groups.length - 1]!.children.push({
|
|
51
|
+
id: blockId,
|
|
52
|
+
text: String(block.settings.text || ''),
|
|
53
|
+
anchor: String(block.settings.anchor || ''),
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return groups
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
const hotIconSrc =
|
|
62
|
+
"data:image/svg+xml,%3Csvg viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.5479 11.9702C10.0966 11.9702 9.71456 12.5389 9.71456 13.2188C9.71456 13.8948 10.0966 14.4668 10.5479 14.4668C10.9992 14.4668 11.3819 13.8968 11.3819 13.2175C11.3819 12.5389 10.9999 11.9689 10.5485 11.9689L10.5479 11.9702ZM15.3977 3.54841C15.3258 3.46817 15.2338 3.40848 15.1312 3.37545C15.0286 3.34242 14.919 3.33723 14.8138 3.36042C14.6018 3.41108 14.4271 3.57374 14.3471 3.79507C14.1688 4.31816 14.0036 4.84565 13.8518 5.37704C13.6385 4.93438 13.3985 4.50972 13.1318 4.10374C12.1478 2.60444 10.7985 1.3318 8.88657 0.0985037C8.7956 0.0391916 8.69032 0.00547728 8.58182 0.000902909C8.47331 -0.00367146 8.36558 0.021063 8.26993 0.0725076C8.17116 0.129583 8.08767 0.209723 8.02661 0.306079C7.96554 0.402435 7.92871 0.512143 7.91927 0.625828C7.65327 3.22973 7.16395 5.86901 5.492 7.72696L5.27001 7.25364C5.0747 6.84432 4.89202 6.45901 4.7747 6.12901C4.64802 5.76569 4.27671 5.5837 3.94538 5.72237C3.7931 5.78848 3.67093 5.90898 3.60272 6.06034L3.46806 6.347C2.64741 8.08696 1.52544 10.4736 1.3561 12.4915C1.00477 16.7687 4.55669 19.4567 8.25059 19.9033C9.06192 20.0013 9.87722 20.0233 10.6919 19.9733C13.5965 19.784 17.125 18.1554 18.3143 14.1468C19.0843 11.5449 18.7837 7.21032 15.3977 3.54708V3.54774V3.54841ZM7.82794 15.1521C7.82794 15.4901 7.57528 15.7655 7.26462 15.7655C6.95464 15.7668 6.70329 15.4921 6.70196 15.1521V13.7588L5.542 13.7788V15.1861C5.542 15.5234 5.28934 15.7994 4.97868 15.7994C4.66936 15.8008 4.41669 15.5261 4.41536 15.1861V11.4189C4.41536 11.0802 4.66735 10.8056 4.97868 10.8056C5.28934 10.8056 5.54134 11.0802 5.54134 11.4189V12.5515L6.70196 12.5322V11.3855C6.70196 11.0469 6.95395 10.7716 7.26462 10.7716C7.57528 10.7716 7.82727 11.0469 7.82727 11.3849V15.1515H7.82794V15.1521ZM10.5479 15.6908C9.4679 15.6908 8.59059 14.5801 8.59059 13.2155C8.59059 11.8509 9.4679 10.7402 10.5479 10.7402C11.6278 10.7402 12.5078 11.8509 12.5078 13.2155C12.5065 14.5801 11.6278 15.6908 10.5479 15.6908V15.6908ZM15.6504 12.1022H14.9351V15.1188C14.9351 15.4568 14.6838 15.7321 14.3731 15.7321C14.0631 15.7334 13.8111 15.4588 13.8091 15.1188V12.1022H13.0951C13.0202 12.1022 12.9461 12.0862 12.8778 12.0553C12.8095 12.0244 12.7486 11.9792 12.6991 11.9229C12.5931 11.8023 12.5339 11.6475 12.5325 11.4869C12.5325 11.1482 12.7845 10.8736 13.0951 10.8736H15.6484C15.9591 10.8736 16.2104 11.1482 16.2104 11.4869C16.2099 11.6477 16.1506 11.8028 16.0437 11.9229C15.9951 11.9796 15.9348 12.0251 15.8669 12.0562C15.799 12.0872 15.7251 12.1032 15.6504 12.1029V12.1022Z' fill='%23F74343'/%3E%3C/svg%3E"
|
|
63
|
+
|
|
64
|
+
const { editableAttrs } = useInlineEdit({
|
|
65
|
+
editorMode: () => !!props.editorMode,
|
|
66
|
+
onSettingUpdate: (key, value) => emit('update:setting', key, value),
|
|
67
|
+
onBlockSettingUpdate: (blockId, key, value) => emit('update:block-setting', blockId, key, value),
|
|
68
|
+
onEditStart: (key) => emit('inline-edit-start', key),
|
|
69
|
+
onEditEnd: () => emit('inline-edit-end'),
|
|
70
|
+
onUndoRedo: (action) => emit('undo-redo', action),
|
|
71
|
+
})
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<template>
|
|
75
|
+
<ul class="level-1">
|
|
76
|
+
<li class="table-of-contents" v-bind="editableAttrs('title')">{{ title }}</li>
|
|
77
|
+
<template v-for="group in tocGroups" :key="group.id">
|
|
78
|
+
<li :class="{ 'hot-link': group.hot }">
|
|
79
|
+
<a :href="`#${group.anchor}`">
|
|
80
|
+
{{ group.text }}
|
|
81
|
+
<img
|
|
82
|
+
v-if="group.hot"
|
|
83
|
+
class="hot-icon"
|
|
84
|
+
:src="hotIconSrc"
|
|
85
|
+
width="20"
|
|
86
|
+
height="20"
|
|
87
|
+
alt="hot"
|
|
88
|
+
/>
|
|
89
|
+
</a>
|
|
90
|
+
</li>
|
|
91
|
+
<ul v-if="group.children.length > 0" class="level-2">
|
|
92
|
+
<li v-for="child in group.children" :key="child.id">
|
|
93
|
+
<a :href="`#${child.anchor}`">{{ child.text }}</a>
|
|
94
|
+
</li>
|
|
95
|
+
</ul>
|
|
96
|
+
</template>
|
|
97
|
+
</ul>
|
|
98
|
+
</template>
|
|
99
|
+
|
|
100
|
+
<style scoped>
|
|
101
|
+
.level-1{background:#f5f9fc;border-radius:10px;display:flex;flex-direction:column;font-weight:700;gap:10px;line-height:19px;list-style:none;margin-bottom:20px;margin-top:30px;padding:28px 28px 28px 74px}.level-1 li,.level-2 li{align-items:center;display:flex;position:relative;width:-moz-fit-content;width:fit-content}.level-1 li:not(.table-of-contents):before,.level-2 li:before{background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='21' height='12' fill='none' viewBox='0 0 21 12'%3E%3Cpath fill='%2324c790' d='M20.53 6.53a.75.75 0 0 0 0-1.06L15.757.697a.75.75 0 0 0-1.06 1.06L18.939 6l-4.242 4.243a.75.75 0 0 0 1.06 1.06zM0 6v.75h20v-1.5H0z'/%3E%3C/svg%3E") no-repeat 50%;background-size:cover;content:"";height:12px;left:-34px;position:absolute;top:3.5px;width:21px}.level-1 li.table-of-contents{font-size:18px;margin-left:-37px}.level-2{display:flex;flex-direction:column;gap:10px;list-style:none;margin-left:35px;padding:0}.level-1 a,.level-2 a{align-items:center;color:inherit;display:flex;text-decoration:none}.hot-icon{flex-shrink:0;margin-left:4px}@media (max-width:768px){.level-1 li.table-of-contents{font-size:16px}.level-1{font-size:14px;line-height:16px;margin-top:20px;padding:24px 20px 24px 54px}}
|
|
102
|
+
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BlockData } from '@vigilkids/section-core';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
blockOrder: string[];
|
|
4
|
+
blocks: Record<string, BlockData>;
|
|
5
|
+
editorMode?: boolean;
|
|
6
|
+
settings: Record<string, unknown>;
|
|
7
|
+
};
|
|
8
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
9
|
+
"update:setting": (key: string, value: unknown) => any;
|
|
10
|
+
"update:block-setting": (blockId: string, key: string, value: unknown) => any;
|
|
11
|
+
"inline-edit-start": (key: string) => any;
|
|
12
|
+
"inline-edit-end": () => any;
|
|
13
|
+
"undo-redo": (action: "redo" | "undo") => any;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
15
|
+
"onUpdate:setting"?: ((key: string, value: unknown) => any) | undefined;
|
|
16
|
+
"onUpdate:block-setting"?: ((blockId: string, key: string, value: unknown) => any) | undefined;
|
|
17
|
+
"onInline-edit-start"?: ((key: string) => any) | undefined;
|
|
18
|
+
"onInline-edit-end"?: (() => any) | undefined;
|
|
19
|
+
"onUndo-redo"?: ((action: "redo" | "undo") => any) | undefined;
|
|
20
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BlockData } from '@vigilkids/section-core';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
blockOrder: string[];
|
|
4
|
+
blocks: Record<string, BlockData>;
|
|
5
|
+
editorMode?: boolean;
|
|
6
|
+
settings: Record<string, unknown>;
|
|
7
|
+
};
|
|
8
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
9
|
+
"update:setting": (key: string, value: unknown) => any;
|
|
10
|
+
"update:block-setting": (blockId: string, key: string, value: unknown) => any;
|
|
11
|
+
"inline-edit-start": (key: string) => any;
|
|
12
|
+
"inline-edit-end": () => any;
|
|
13
|
+
"undo-redo": (action: "redo" | "undo") => any;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
15
|
+
"onUpdate:setting"?: ((key: string, value: unknown) => any) | undefined;
|
|
16
|
+
"onUpdate:block-setting"?: ((blockId: string, key: string, value: unknown) => any) | undefined;
|
|
17
|
+
"onInline-edit-start"?: ((key: string) => any) | undefined;
|
|
18
|
+
"onInline-edit-end"?: (() => any) | undefined;
|
|
19
|
+
"onUndo-redo"?: ((action: "redo" | "undo") => any) | undefined;
|
|
20
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { BlockData } from '@vigilkids/section-core'
|
|
3
|
+
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
|
|
6
|
+
import { useInlineEdit } from '../../../composables/useInlineEdit'
|
|
7
|
+
|
|
8
|
+
const props = defineProps<{
|
|
9
|
+
blockOrder: string[]
|
|
10
|
+
blocks: Record<string, BlockData>
|
|
11
|
+
editorMode?: boolean
|
|
12
|
+
settings: Record<string, unknown>
|
|
13
|
+
}>()
|
|
14
|
+
|
|
15
|
+
const emit = defineEmits<{
|
|
16
|
+
(e: 'update:setting', key: string, value: unknown): void
|
|
17
|
+
(e: 'update:block-setting', blockId: string, key: string, value: unknown): void
|
|
18
|
+
(e: 'inline-edit-start', key: string): void
|
|
19
|
+
(e: 'inline-edit-end'): void
|
|
20
|
+
(e: 'undo-redo', action: 'redo' | 'undo'): void
|
|
21
|
+
}>()
|
|
22
|
+
|
|
23
|
+
const blockOrder = computed(() => props.blockOrder)
|
|
24
|
+
const blocks = computed(() => props.blocks)
|
|
25
|
+
|
|
26
|
+
const { blockEditableAttrs } = useInlineEdit({
|
|
27
|
+
editorMode: () => !!props.editorMode,
|
|
28
|
+
onSettingUpdate: (key, value) => emit('update:setting', key, value),
|
|
29
|
+
onBlockSettingUpdate: (blockId, key, value) => emit('update:block-setting', blockId, key, value),
|
|
30
|
+
onEditStart: (key) => emit('inline-edit-start', key),
|
|
31
|
+
onEditEnd: () => emit('inline-edit-end'),
|
|
32
|
+
onUndoRedo: (action) => emit('undo-redo', action),
|
|
33
|
+
})
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<template>
|
|
37
|
+
<ul class="blog-h3-style1-list">
|
|
38
|
+
<template v-for="blockId in blockOrder" :key="blockId">
|
|
39
|
+
<li v-if="blocks[blockId]" v-bind="blockEditableAttrs(blockId, 'text')">
|
|
40
|
+
{{ blocks[blockId]!.settings.text }}
|
|
41
|
+
</li>
|
|
42
|
+
</template>
|
|
43
|
+
</ul>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<style scoped>
|
|
47
|
+
.blog-h3-style1-list{font-size:14px;font-weight:300;list-style-position:inside;list-style-type:disc;margin-top:16px;padding-left:20px}.blog-h3-style1-list li+li{margin-top:8px}@media (min-width:768px){.blog-h3-style1-list{font-size:14px;margin-top:8px}}
|
|
48
|
+
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BlockData } from '@vigilkids/section-core';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
blockOrder: string[];
|
|
4
|
+
blocks: Record<string, BlockData>;
|
|
5
|
+
editorMode?: boolean;
|
|
6
|
+
settings: Record<string, unknown>;
|
|
7
|
+
};
|
|
8
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
9
|
+
"update:setting": (key: string, value: unknown) => any;
|
|
10
|
+
"update:block-setting": (blockId: string, key: string, value: unknown) => any;
|
|
11
|
+
"inline-edit-start": (key: string) => any;
|
|
12
|
+
"inline-edit-end": () => any;
|
|
13
|
+
"undo-redo": (action: "redo" | "undo") => any;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
15
|
+
"onUpdate:setting"?: ((key: string, value: unknown) => any) | undefined;
|
|
16
|
+
"onUpdate:block-setting"?: ((blockId: string, key: string, value: unknown) => any) | undefined;
|
|
17
|
+
"onInline-edit-start"?: ((key: string) => any) | undefined;
|
|
18
|
+
"onInline-edit-end"?: (() => any) | undefined;
|
|
19
|
+
"onUndo-redo"?: ((action: "redo" | "undo") => any) | undefined;
|
|
20
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BlockData } from '@vigilkids/section-core';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
blockOrder: string[];
|
|
4
|
+
blocks: Record<string, BlockData>;
|
|
5
|
+
editorMode?: boolean;
|
|
6
|
+
settings: Record<string, unknown>;
|
|
7
|
+
};
|
|
8
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
9
|
+
"update:setting": (key: string, value: unknown) => any;
|
|
10
|
+
"update:block-setting": (blockId: string, key: string, value: unknown) => any;
|
|
11
|
+
"inline-edit-start": (key: string) => any;
|
|
12
|
+
"inline-edit-end": () => any;
|
|
13
|
+
"undo-redo": (action: "redo" | "undo") => any;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
15
|
+
"onUpdate:setting"?: ((key: string, value: unknown) => any) | undefined;
|
|
16
|
+
"onUpdate:block-setting"?: ((blockId: string, key: string, value: unknown) => any) | undefined;
|
|
17
|
+
"onInline-edit-start"?: ((key: string) => any) | undefined;
|
|
18
|
+
"onInline-edit-end"?: (() => any) | undefined;
|
|
19
|
+
"onUndo-redo"?: ((action: "redo" | "undo") => any) | undefined;
|
|
20
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
export default _default;
|