mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-24 00:39:32 +09:00
parent
a6cd97ca9a
commit
f2d9e3105d
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<component :is="'x-' + block.type" :key="block.id" :page="page" :block="block" :h="h"/>
|
<component :is="getComponent(block.type)" :key="block.id" :page="page" :block="block" :h="h"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
@ -11,6 +11,16 @@ import XImage from './page.image.vue';
|
|||||||
import XNote from './page.note.vue';
|
import XNote from './page.note.vue';
|
||||||
import { Block } from './block.type';
|
import { Block } from './block.type';
|
||||||
|
|
||||||
|
function getComponent(type: string) {
|
||||||
|
switch (type) {
|
||||||
|
case 'text': return XText;
|
||||||
|
case 'section': return XSection;
|
||||||
|
case 'image': return XImage;
|
||||||
|
case 'note': return XNote;
|
||||||
|
default: return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
block: Block,
|
block: Block,
|
||||||
h: number,
|
h: number,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div :class="{ [$style.center]: page.alignCenter, [$style.serif]: page.font === 'serif' }">
|
<div :class="{ [$style.center]: page.alignCenter, [$style.serif]: page.font === 'serif' }">
|
||||||
<XBlock v-for="child in page.content" :key="child.id" :block="child" :h="2"/>
|
<XBlock v-for="child in page.content" :key="child.id" :page="page" :block="child" :h="2"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<template #item="{element}">
|
<template #item="{element}">
|
||||||
<div :class="$style.item">
|
<div :class="$style.item">
|
||||||
<!-- divが無いとエラーになる https://github.com/SortableJS/vue.draggable.next/issues/189 -->
|
<!-- divが無いとエラーになる https://github.com/SortableJS/vue.draggable.next/issues/189 -->
|
||||||
<component :is="'x-' + element.type" :modelValue="element" @update:modelValue="updateItem" @remove="() => removeItem(element)"/>
|
<component :is="getComponent(element.type)" :modelValue="element" @update:modelValue="updateItem" @remove="() => removeItem(element)"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</Sortable>
|
</Sortable>
|
||||||
@ -16,6 +16,16 @@ import XText from './els/page-editor.el.text.vue';
|
|||||||
import XImage from './els/page-editor.el.image.vue';
|
import XImage from './els/page-editor.el.image.vue';
|
||||||
import XNote from './els/page-editor.el.note.vue';
|
import XNote from './els/page-editor.el.note.vue';
|
||||||
|
|
||||||
|
function getComponent(type: string) {
|
||||||
|
switch (type) {
|
||||||
|
case 'section': return XSection;
|
||||||
|
case 'text': return XText;
|
||||||
|
case 'image': return XImage;
|
||||||
|
case 'note': return XNote;
|
||||||
|
default: return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const Sortable = defineAsyncComponent(() => import('vuedraggable').then(x => x.default));
|
const Sortable = defineAsyncComponent(() => import('vuedraggable').then(x => x.default));
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
Loading…
Reference in New Issue
Block a user