Skip to content

Commit 197f775

Browse files
committed
feat: independent draft
1 parent b14caaf commit 197f775

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/client/view/submit.svelte

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
3333
// svelte变量
3434
let storage = localStorage.discuss
35+
let draft = localStorage.getItem('discuss:draft')
3536
let isEmot = false
3637
let emotIndex = 0
3738
let emotMaps = {}
@@ -86,11 +87,16 @@
8687
function initInfo() {
8788
try {
8889
storage = JSON.parse(storage) || {}
90+
draft = JSON.parse(draft) || {}
91+
8992
for (const [k, v] of Object.entries(storage)) {
9093
metas[k].value = v || ''
9194
}
95+
96+
metas.content.value = draft[D.path]?.content || ''
9297
} catch (error) {
9398
storage = {}
99+
draft = {}
94100
}
95101
}
96102
@@ -140,6 +146,11 @@
140146
storage[k] = v.value.trim()
141147
}
142148
localStorage.discuss = JSON.stringify(storage)
149+
150+
draft[D.path] = {}
151+
draft[D.path].content = metas.content.value
152+
localStorage.setItem('discuss:draft', JSON.stringify(draft))
153+
143154
// 重新解析表情
144155
parseEmot()
145156
}
@@ -514,7 +525,10 @@
514525
515526
&:hover {
516527
background: var(--D-Low-Color);
517-
box-shadow: 0 2px 2px 0 rgb(0 0 0 / 14%), 0 3px 1px -2px rgb(0 0 0 / 20%), 0 1px 5px 0 rgb(0 0 0 / 12%);
528+
box-shadow:
529+
0 2px 2px 0 rgb(0 0 0 / 14%),
530+
0 3px 1px -2px rgb(0 0 0 / 20%),
531+
0 1px 5px 0 rgb(0 0 0 / 12%);
518532
}
519533
}
520534

0 commit comments

Comments
 (0)