feat: add version history and AI diff highlighting in editor
This commit is contained in:
@@ -17,6 +17,7 @@ const store = useEditorStore()
|
||||
const jsonText = ref('')
|
||||
const errorMsg = ref('')
|
||||
const saved = ref(false)
|
||||
const globalTooltip = ref('')
|
||||
|
||||
watch(() => [props.scene, store.gameData] as const, () => {
|
||||
errorMsg.value = ''
|
||||
@@ -32,6 +33,7 @@ watch(() => [props.scene, store.gameData] as const, () => {
|
||||
}, { immediate: true, deep: true })
|
||||
|
||||
function onBlur() {
|
||||
store.clearAIMarkers()
|
||||
errorMsg.value = ''
|
||||
try {
|
||||
const parsed = JSON.parse(jsonText.value)
|
||||
@@ -54,7 +56,7 @@ function onBlur() {
|
||||
<template>
|
||||
<div class="node-editor" v-if="scene || jsonText">
|
||||
<div class="editor-header">
|
||||
<h3>{{ scene ? scene.id : '全局配置' }}</h3>
|
||||
<h3>{{ scene ? scene.id : '全局配置' }}<span v-if="!scene && store.aiChanges?.globalFields?.length" class="global-diff-tag" :title="store.aiChanges.globalFields.join(', ')">● 已修改 {{ store.aiChanges.globalFields.length }} 字段</span></h3>
|
||||
<div class="header-actions">
|
||||
<span v-if="saved" class="saved-hint">已保存</span>
|
||||
<span v-if="errorMsg" class="error-hint">JSON 错误: {{ errorMsg }}</span>
|
||||
@@ -165,4 +167,17 @@ function onBlur() {
|
||||
.json-area.error {
|
||||
border-left: 3px solid #e74c3c;
|
||||
}
|
||||
|
||||
.global-diff-tag {
|
||||
display: inline-block;
|
||||
margin-left: 10px;
|
||||
padding: 1px 8px;
|
||||
font-size: 11px;
|
||||
font-weight: 400;
|
||||
color: #ffe0b2;
|
||||
background: rgba(230, 81, 0, 0.15);
|
||||
border: 1px solid rgba(230, 81, 0, 0.3);
|
||||
border-radius: 3px;
|
||||
cursor: default;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user