Add autosaving to the editor #688
Inga granskare
Etiketter
Inga etiketter
A: API
A: Backend
A: Federation
A: Front-End
A: I18N
A: Meta
A: Security
Build
C: Bug
C: Discussion
C: Enhancement
C: Feature
Compatibility
Dependency
Design
Documentation
Good first issue
Help welcome
Mobile
Rendering
S: Blocked
S: Duplicate
S: Incomplete
S: Instance specific
S: Invalid
S: Needs Voting/Discussion
S: Ready for review
Suggestion
S: Voted on Loomio
S: Wontfix
Ingen milstolpe
Inget projekt
Inga tilldelade
2 Deltagare
Notiser
Förfallodatum
Inget förfallodatum satt.
Beroenden
No dependencies set.
Reference: Plume/Plume#688
Laddar…
Lägg till tabell
Hänvisa till i nytt ärende
No description provided.
Delete branch "confirmation-autosave"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This should fix #686 Confirmation prior to navigating away is easy enough to add, but it'd be good to know if it's wanted first since this seems like it might serve the same purpose
Codecov Report
👀
while content is probably the most annoying to loose, if we do a local save, we should as well save everything (including subtitle, tags...)
@ -66,0 +212,4 @@
fn autosave_debounce() {
let timeout = &mut AUTOSAVE_TIMEOUT.lock().unwrap();
if let Some(timeout) = timeout.take() {
timeout.clear();
I guess set_interval does not exist? 😕
@ -66,0 +212,4 @@
fn autosave_debounce() {
let timeout = &mut AUTOSAVE_TIMEOUT.lock().unwrap();
if let Some(timeout) = timeout.take() {
timeout.clear();
It doesn't look like it, oddly.
True enough, easy enough to add too
@ -66,0 +212,4 @@
fn autosave_debounce() {
let timeout = &mut AUTOSAVE_TIMEOUT.lock().unwrap();
if let Some(timeout) = timeout.take() {
timeout.clear();
Okay, works fine in the
js!
I didn't tested yet, but I left a few comments about the code itself.
Is the type hint really needed?
Maybe this line should be removed ?
This one too
You should use
i18n!
for formatting, to allow the date to be placed somewhere else in the sentence if translators need to do so.Why does it need to be
unsafe
?Oh, probably not
Oh, it should probably just be unsafe on the lines that refer to the
static mut
No, I don't know much about unsafe, so maybe you are right and whole function should be. But also, I feel like there is a better way to do this, like going with lazy_static for instance.
That option looked off to us too tbh.. At least on its own
Maybe it'd be better to use a RefCell or something?
Anything that will prevent having
unsafe
code is fine (not that it is really unsafe, we only have one thread when running in the browser).Didn't realize it was possible to do that with
i18n!
, that's nifty :)Works as expected, thank you!