Add autosaving to the editor #688
No hay revisores
Etiquetas
Sin etiquetas
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
Sin hito
Ningún proyecto
Sin encargados
2 participantes
Notificaciones
Fecha límite
Fecha límite no definida.
Dependencias
No se han establecido dependencias.
Referencia: Plume/Plume#688
Cargando…
Añadir tabla
Referenciar en una nueva incidencia
No se ha proporcionado una descripción.
Eliminar rama "confirmation-autosave "
Eliminar una rama es permanente. Aunque la rama eliminada puede continuar existiendo durante un corto tiempo antes de que sea eliminada, en la mayoría de los casos NO PUEDE deshacerse. ¿Continuar?
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!