Skip to content

Commit 55a68ba

Browse files
authored
编辑时, 默认从下一行开始
Trim saved code before setting it to the text area.
1 parent d969d11 commit 55a68ba

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/popup.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ console.log('[shynur] 当前 host:', host)
1212

1313
const saved_code = (await ((window as any).chrome || (window as any).browser).storage.local.get(
1414
[host]
15-
))[host]?.trim() as (string | undefined)
15+
))[host] as (string | undefined)
1616

1717
console.log('[shynur] 之前保存的代码:', '\n' + saved_code)
18-
text_area.value = typeof saved_code == 'string' ? saved_code : ''
18+
text_area.value = saved_code?.trim() ? saved_code.trim() + '\n' : ''
1919

2020
text_area.addEventListener(
2121
'input',

0 commit comments

Comments
 (0)