feat: 文件编辑器侧边栏指上和选中文件样式调整 (#5689)

This commit is contained in:
2024-07-05 16:48:38 +08:00 committed by GitHub
parent 9ca69732ca
commit f0fbb02495
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 0 deletions

View File

@ -442,3 +442,15 @@ html {
.el-tag {
cursor: pointer;
}
.monaco-editor-tree-light .el-tree-node__content:hover {
background-color: #e5eefd;
}
.monaco-editor-tree-dark .el-tree-node__content:hover {
background-color: #111417;
}
.monaco-editor-tree-dark .el-tree-node.is-current > .el-tree-node__content {
background-color: #111417;
}

View File

@ -344,6 +344,21 @@ const changeLanguage = () => {
const changeTheme = () => {
monaco.editor.setTheme(config.theme);
const themes = {
vs: 'monaco-editor-tree-light',
'vs-dark': 'monaco-editor-tree-dark',
'hc-black': 'monaco-editor-tree-dark',
};
if (treeRef.value) {
Object.values(themes).forEach((themeClass) => {
treeRef.value.$el.classList.remove(themeClass);
});
if (themes[config.theme]) {
treeRef.value.$el.classList.add(themes[config.theme]);
}
}
localStorage.setItem(codeThemeKey, config.theme);
};
@ -455,6 +470,7 @@ const getDirectoryPath = (filePath: string) => {
const onOpen = () => {
initEditor();
changeTheme();
search(directoryPath.value).then((res) => {
handleSearchResult(res);
});