[🚨] Fix test errors
This commit is contained in:
parent
39cb8e6964
commit
cd3d6dfa36
1 changed files with 5 additions and 6 deletions
|
|
@ -143,11 +143,12 @@ export default class EditorApp implements App {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const language = fileLanguageMap[data.path.split('.').at(-1)?.toLowerCase()!] || 'text'
|
const fileExtension = data.path.split('.').pop()?.toLowerCase() as string
|
||||||
|
const language = fileLanguageMap[fileExtension] ?? 'text'
|
||||||
|
|
||||||
const value = (await window.fs.promises.readFile(data.path)).toString()
|
const value = (await window.fs.promises.readFile(data.path)).toString()
|
||||||
const editor = fullEditor(
|
const editor = fullEditor(
|
||||||
win.content.querySelector<HTMLElement>('.editor')!,
|
win.content.querySelector('.editor') as HTMLElement,
|
||||||
{
|
{
|
||||||
language,
|
language,
|
||||||
theme: 'github-dark',
|
theme: 'github-dark',
|
||||||
|
|
@ -156,7 +157,7 @@ export default class EditorApp implements App {
|
||||||
)
|
)
|
||||||
|
|
||||||
const style = document.createElement('style')
|
const style = document.createElement('style')
|
||||||
style.innerHTML = `
|
style.textContent = `
|
||||||
.prism-code-editor {
|
.prism-code-editor {
|
||||||
border-radius: 10px 10px 0 0;
|
border-radius: 10px 10px 0 0;
|
||||||
caret-color: var(--text);
|
caret-color: var(--text);
|
||||||
|
|
@ -178,8 +179,6 @@ export default class EditorApp implements App {
|
||||||
--editor__bg-selection-match: var(--surface-1)40;
|
--editor__bg-selection-match: var(--surface-1)40;
|
||||||
--editor__line-number: #636e7b;
|
--editor__line-number: #636e7b;
|
||||||
--editor__line-number-active: #adbac7;
|
--editor__line-number-active: #adbac7;
|
||||||
--editor__bg-scrollbar: 210, 10%, 35%;
|
|
||||||
--editor__bg-fold: #768390;
|
|
||||||
--bg-guide-indent: var(--surface-0);
|
--bg-guide-indent: var(--surface-0);
|
||||||
overflow: visible;
|
overflow: visible;
|
||||||
}
|
}
|
||||||
|
|
@ -189,7 +188,7 @@ export default class EditorApp implements App {
|
||||||
`
|
`
|
||||||
editor.scrollContainer.appendChild(style);
|
editor.scrollContainer.appendChild(style);
|
||||||
(win.content.querySelector('#find') as HTMLElement).onclick = () => {
|
(win.content.querySelector('#find') as HTMLElement).onclick = () => {
|
||||||
editor.extensions.searchWidget!.open()
|
editor.extensions.searchWidget?.open()
|
||||||
}
|
}
|
||||||
(win.content.querySelector('#save') as HTMLElement).onclick = async () => {
|
(win.content.querySelector('#save') as HTMLElement).onclick = async () => {
|
||||||
await window.fs.promises.writeFile(data.path, editor.value)
|
await window.fs.promises.writeFile(data.path, editor.value)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue