feat(editor): 持久化SQL编辑器光标位置
Co-authored-by: zipg <4047349+zipg@users.noreply.github.com>
This commit is contained in:
1 parent
772ce36de8
commit
5fb667716f
7 files changed
+52
-2
No files matched your search
@@ -2228,6 +2228,8 @@ export const useQueryStore = defineStore("query", () => {
|
||||
database: t.database,
|
||||
schema: t.schema,
|
||||
sql: t.sql,
|
||||
editorViewport: t.editorViewport,
|
||||
editorSelection: t.editorSelection,
|
||||
savedSqlId: t.savedSqlId,
|
||||
externalSqlPath: t.externalSqlPath,
|
||||
externalSqlFileVersion: t.externalSqlFileVersion,
|
||||
@@ -3237,6 +3239,13 @@ export const useQueryStore = defineStore("query", () => {
|
||||
);
|
||||
}
|
||||
|
||||
function flushEditorState(id: string): Promise<void> {
|
||||
const tab = tabs.value.find((item) => item.id === id);
|
||||
if (!tab) return Promise.resolve();
|
||||
persistSavedSqlEditorPosition(tab);
|
||||
return flushPendingPersist();
|
||||
}
|
||||
|
||||
function queueSavedSqlEditorPositionPersist(tab: QueryTab | undefined) {
|
||||
if (!tab?.savedSqlId || tab.mode !== "query") return;
|
||||
const pending = savedSqlEditorPositionTimers.get(tab.savedSqlId);
|
||||
@@ -7780,6 +7789,7 @@ export const useQueryStore = defineStore("query", () => {
|
||||
updateDataGridHiddenColumnKeys,
|
||||
updateEditorViewport,
|
||||
updateEditorSelection,
|
||||
flushEditorState,
|
||||
updateObjectBrowserViewport,
|
||||
updateObjectBrowserSearch,
|
||||
updateNacosConfigEditorViewport,
|
||||
|
||||
Reference in new issue
Block a user