mirror of
https://github.com/Powerful-517/yys-editor.git
synced 2026-01-23 22:43:28 +00:00
自动恢复工作区,增加重置按钮
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
<el-button type="info" @click="loadExample">{{ t('loadExample') }}</el-button>
|
<el-button type="info" @click="loadExample">{{ t('loadExample') }}</el-button>
|
||||||
<el-button type="info" @click="showUpdateLog">{{ t('updateLog') }}</el-button>
|
<el-button type="info" @click="showUpdateLog">{{ t('updateLog') }}</el-button>
|
||||||
<el-button type="warning" @click="showFeedbackForm">{{ t('feedback') }}</el-button>
|
<el-button type="warning" @click="showFeedbackForm">{{ t('feedback') }}</el-button>
|
||||||
|
<el-button type="danger" @click="handleResetWorkspace">重置工作区</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 更新日志对话框 -->
|
<!-- 更新日志对话框 -->
|
||||||
@@ -107,11 +108,13 @@ const refreshLogicFlowCanvas = (message?: string) => {
|
|||||||
const logicFlowInstance = getLogicFlowInstance();
|
const logicFlowInstance = getLogicFlowInstance();
|
||||||
if (logicFlowInstance) {
|
if (logicFlowInstance) {
|
||||||
// 获取当前活动文件的数据
|
// 获取当前活动文件的数据
|
||||||
const currentFileData = filesStore.getTab(filesStore.activeFile);
|
const currentFileData = filesStore.getTab(filesStore.activeFileId);
|
||||||
if (currentFileData) {
|
if (currentFileData) {
|
||||||
// 清空画布并重新渲染
|
// 清空画布并重新渲染
|
||||||
logicFlowInstance.clearData();
|
logicFlowInstance.clearData();
|
||||||
logicFlowInstance.render(currentFileData);
|
// 注意:此处根据你的画布 API 传入 graphRawData 或整个文件数据
|
||||||
|
const data = (currentFileData as any).graphRawData || currentFileData;
|
||||||
|
logicFlowInstance.render(data);
|
||||||
console.log(message || 'LogicFlow 画布已重新渲染');
|
console.log(message || 'LogicFlow 画布已重新渲染');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -215,6 +218,18 @@ const handleImport = () => {
|
|||||||
input.click();
|
input.click();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleResetWorkspace = () => {
|
||||||
|
ElMessageBox.confirm('确定重置当前工作区?该操作不可撤销', '提示', {
|
||||||
|
confirmButtonText: '重置',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
}).then(() => {
|
||||||
|
filesStore.resetWorkspace();
|
||||||
|
}).catch(() => {
|
||||||
|
// 用户取消
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const watermark = reactive({
|
const watermark = reactive({
|
||||||
text: localStorage.getItem('watermark.text') || '示例水印',
|
text: localStorage.getItem('watermark.text') || '示例水印',
|
||||||
fontSize: Number(localStorage.getItem('watermark.fontSize')) || 30,
|
fontSize: Number(localStorage.getItem('watermark.fontSize')) || 30,
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ export const useFilesStore = defineStore('files', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 关闭文件后立即更新
|
// 关闭文件后立即更新
|
||||||
updateTab();
|
// updateTab();
|
||||||
};
|
};
|
||||||
|
|
||||||
// 更新指定 Tab - 内存操作即时,localStorage 操作防抖
|
// 更新指定 Tab - 内存操作即时,localStorage 操作防抖
|
||||||
|
|||||||
Reference in New Issue
Block a user