Block Editor 重构入口文件

This commit is contained in:
jingrow 2026-06-02 16:54:11 +08:00
parent 679062422d
commit a83ba51292
3 changed files with 4 additions and 57 deletions

View File

@ -1,9 +1,9 @@
<script setup lang="ts">
/**
* index.vue Block Editor 主入口 Orchestrator
* BlockEditorEntry.vue Block Editor 主入口 Orchestrator
*
* 纯编排层仅组合 composables + 子组件
* 从原 1383 行精简至 ~200
* FieldRenderer 经由 controls/BlockEditor.vue 动态导入此文件
*/
import { ref, computed, shallowRef, onMounted, onBeforeUnmount } from 'vue'
@ -315,7 +315,6 @@ function toggleBubbleHeading() {
</template>
<style>
@import './BlockEditor.css';
</style>

View File

@ -1,52 +0,0 @@
<script setup lang="ts">
/**
* BlockEditorShell.vue 向后兼容薄壳
*
* 适配 FieldRenderer Props/Emit 接口
* 透传到 index.vue内部接口
*
* index.vue 内部接口变化时仅需修改此文件适配层
* FieldRenderer.vue 零改动
*/
import BlockEditorIndex from './index.vue'
interface Df {
fieldname: string
fieldtype: string
label?: string
description?: string
placeholder?: string
[key: string]: any
}
const props = withDefaults(
defineProps<{
df: Df
modelValue?: any
disabled?: boolean
record?: Record<string, any>
canEdit?: boolean
ctx?: any
}>(),
{ canEdit: true },
)
const emit = defineEmits<{
(e: 'update:modelValue', v: any): void
(e: 'onSave'): void
}>()
</script>
<template>
<BlockEditorIndex
:df="df"
:model-value="modelValue"
:disabled="disabled"
:record="record"
:can-edit="canEdit"
:ctx="ctx"
@update:model-value="emit('update:modelValue', $event)"
@on-save="emit('onSave')"
/>
</template>

View File

@ -4,7 +4,7 @@ BlockEditor.vue — 向后兼容重定向
此文件仅做重定向FieldRenderer.vue 无需任何改动
-->
<script setup lang="ts">
import BlockEditorShell from '@/core/features/block_editor/BlockEditorShell.vue'
import BlockEditorEntry from '@/core/features/block_editor/BlockEditorEntry.vue'
interface Df {
fieldname: string
@ -34,7 +34,7 @@ const emit = defineEmits<{
</script>
<template>
<BlockEditorShell
<BlockEditorEntry
:df="df"
:model-value="modelValue"
:disabled="disabled"