mirror of
https://github.com/Powerful-517/yys-editor.git
synced 2026-03-05 15:05:27 +00:00
feat: 简化 TextNode 实现,完全依赖 LogicFlow 原生文本节点能力
- 移除自定义文本编辑逻辑,交由 LogicFlow 和 TextNodeModel 处理 - TextNode.vue 简化为空容器,LogicFlow 自动渲染文本内容 - 保留 TextNodeModel.ts 用于配置文本样式和编辑行为 - 采用模型-视图分离架构,符合 LogicFlow 设计模式
This commit is contained in:
@@ -74,7 +74,8 @@ import YuhunSelectNode from './nodes/yys/YuhunSelectNode.vue';
|
||||
import PropertySelectNode from './nodes/yys/PropertySelectNode.vue';
|
||||
import ImageNode from './nodes/common/ImageNode.vue';
|
||||
import AssetSelectorNode from './nodes/common/AssetSelectorNode.vue';
|
||||
// import TextNode from './nodes/common/TextNode.vue';
|
||||
import TextNode from './nodes/common/TextNode.vue';
|
||||
import TextNodeModel from './nodes/common/TextNodeModel';
|
||||
import PropertyPanel from './PropertyPanel.vue';
|
||||
import { useGlobalMessage } from '@/ts/useGlobalMessage';
|
||||
import { setLogicFlowInstance, destroyLogicFlowInstance } from '@/ts/useLogicFlow';
|
||||
@@ -312,7 +313,7 @@ function bringForward(nodeId?: string) {
|
||||
if (!targetId) return;
|
||||
|
||||
const currentNode = lfInstance.getNodeModelById(targetId);
|
||||
if (!currentNode) return;
|
||||
if (!currentNode) return;t
|
||||
|
||||
const currentZIndex = currentNode.zIndex;
|
||||
currentNode.setZIndex(currentZIndex + 1);
|
||||
@@ -662,7 +663,7 @@ function registerNodes(lfInstance: LogicFlow) {
|
||||
|
||||
register({ type: 'imageNode', component: ImageNode }, lfInstance);
|
||||
register({ type: 'assetSelector', component: AssetSelectorNode }, lfInstance);
|
||||
// register({ type: 'textNode', component: TextNode }, lfInstance);
|
||||
register({ type: 'textNode', component: TextNode, model: TextNodeModel }, lfInstance);
|
||||
}
|
||||
|
||||
// 初始化 LogicFlow
|
||||
@@ -677,6 +678,22 @@ onMounted(() => {
|
||||
keyboard: {
|
||||
enabled: true
|
||||
},
|
||||
style: {
|
||||
text: {
|
||||
color: '#333333',
|
||||
fontSize: 14,
|
||||
background: {
|
||||
fill: '#ffffff',
|
||||
stroke: '#dcdfe6',
|
||||
strokeWidth: 1,
|
||||
radius: 4
|
||||
}
|
||||
},
|
||||
nodeText: {
|
||||
color: '#333333',
|
||||
fontSize: 14
|
||||
}
|
||||
},
|
||||
plugins: [Menu, Label, Snapshot, SelectionSelect, MiniMap, Control],
|
||||
pluginsOptions: {
|
||||
label: {
|
||||
|
||||
Reference in New Issue
Block a user