Add autosaving to the editor #688

Слито
epsilon-phase слито 6 коммит(ов) из confirmation-autosave в master 2019-11-02 14:14:41 +00:00
epsilon-phase оставлен комментарий 2019-10-31 22:50:19 +00:00 (Перенесено из github.com)

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

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[bot] оставлен комментарий 2019-10-31 23:13:41 +00:00 (Перенесено из github.com)

Codecov Report

Merging #688 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #688   +/-   ##
=======================================
  Coverage   39.35%   39.35%           
=======================================
  Files          72       72           
  Lines        9494     9494           
  Branches     2263     2263           
=======================================
  Hits         3736     3736           
  Misses       4702     4702           
  Partials     1056     1056
# [Codecov](https://codecov.io/gh/Plume-org/Plume/pull/688?src=pr&el=h1) Report > Merging [#688](https://codecov.io/gh/Plume-org/Plume/pull/688?src=pr&el=desc) into [master](https://codecov.io/gh/Plume-org/Plume/commit/865f372d5a9c0866c7ec5215afb69d2916740c07?src=pr&el=desc) will **not change** coverage. > The diff coverage is `n/a`. ```diff @@ Coverage Diff @@ ## master #688 +/- ## ======================================= Coverage 39.35% 39.35% ======================================= Files 72 72 Lines 9494 9494 Branches 2263 2263 ======================================= Hits 3736 3736 Misses 4702 4702 Partials 1056 1056 ```
trinity-1686a оставлена рецензия 2019-11-01 00:23:33 +00:00
trinity-1686a оставил комментарий
Владелец

👀

:eyes:
trinity-1686a оставлен комментарий 2019-11-01 00:23:25 +00:00
Владелец

while content is probably the most annoying to loose, if we do a local save, we should as well save everything (including subtitle, tags...)

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();
trinity-1686a оставлен комментарий 2019-11-01 00:21:22 +00:00
Владелец

I guess set_interval does not exist? 😕

I guess set_interval does not exist? :confused:
epsilon-phase (Перенесено из github.com) оставлена рецензия 2019-11-01 01:31:51 +00:00
@ -66,0 +212,4 @@
fn autosave_debounce() {
let timeout = &mut AUTOSAVE_TIMEOUT.lock().unwrap();
if let Some(timeout) = timeout.take() {
timeout.clear();
epsilon-phase (Перенесено из github.com) оставлен комментарий 2019-11-01 01:31:50 +00:00

It doesn't look like it, oddly.

It doesn't look like it, oddly.
epsilon-phase (Перенесено из github.com) оставлена рецензия 2019-11-01 01:32:14 +00:00
epsilon-phase (Перенесено из github.com) оставлен комментарий 2019-11-01 01:32:14 +00:00

True enough, easy enough to add too

True enough, easy enough to add too
epsilon-phase (Перенесено из github.com) оставлена рецензия 2019-11-01 02:23:27 +00:00
@ -66,0 +212,4 @@
fn autosave_debounce() {
let timeout = &mut AUTOSAVE_TIMEOUT.lock().unwrap();
if let Some(timeout) = timeout.take() {
timeout.clear();
epsilon-phase (Перенесено из github.com) оставлен комментарий 2019-11-01 02:23:27 +00:00

Okay, works fine in the js!

Okay, works fine in the `js!`
elegaanz (Перенесено из github.com) оставлена рецензия 2019-11-01 20:06:50 +00:00
elegaanz (Перенесено из github.com) оставил комментарий

I didn't tested yet, but I left a few comments about the code itself.

I didn't tested yet, but I left a few comments about the code itself.
elegaanz (Перенесено из github.com) оставлен комментарий 2019-11-01 20:01:09 +00:00

Is the type hint really needed?

Is the type hint really needed?
elegaanz (Перенесено из github.com) оставлен комментарий 2019-11-01 20:01:50 +00:00

Maybe this line should be removed ?

Maybe this line should be removed ?
elegaanz (Перенесено из github.com) оставлен комментарий 2019-11-01 20:01:56 +00:00

This one too

This one too
elegaanz (Перенесено из github.com) оставлен комментарий 2019-11-01 20:04:58 +00:00

You should use i18n! for formatting, to allow the date to be placed somewhere else in the sentence if translators need to do so.

i18n!(
    CATALOG,
    "Do you want to load the local autosave last edited at {}";
    Date::from_time(autosave_info.last_saved).to_date_string()
)
You should use `i18n!` for formatting, to allow the date to be placed somewhere else in the sentence if translators need to do so. ```rust i18n!( CATALOG, "Do you want to load the local autosave last edited at {}"; Date::from_time(autosave_info.last_saved).to_date_string() ) ```
elegaanz (Перенесено из github.com) оставлен комментарий 2019-11-01 20:05:49 +00:00

Why does it need to be unsafe?

Why does it need to be `unsafe`?
epsilon-phase (Перенесено из github.com) оставлена рецензия 2019-11-01 20:07:24 +00:00
epsilon-phase (Перенесено из github.com) оставлен комментарий 2019-11-01 20:07:24 +00:00

Oh, probably not

Oh, probably not
epsilon-phase (Перенесено из github.com) оставлена рецензия 2019-11-01 20:09:54 +00:00
epsilon-phase (Перенесено из github.com) оставлен комментарий 2019-11-01 20:09:54 +00:00

Oh, it should probably just be unsafe on the lines that refer to the static mut

Oh, it should probably just be unsafe on the lines that refer to the `static mut`
elegaanz (Перенесено из github.com) оставлена рецензия 2019-11-01 20:14:02 +00:00
elegaanz (Перенесено из github.com) оставлен комментарий 2019-11-01 20:14:02 +00:00

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.

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.
epsilon-phase (Перенесено из github.com) оставлена рецензия 2019-11-01 20:19:29 +00:00
epsilon-phase (Перенесено из github.com) оставлен комментарий 2019-11-01 20:19:28 +00:00

That option looked off to us too tbh.. At least on its own
Maybe it'd be better to use a RefCell or something?

That option looked off to us too tbh.. At least on its own Maybe it'd be better to use a RefCell or something?
elegaanz (Перенесено из github.com) оставлена рецензия 2019-11-01 20:22:01 +00:00
elegaanz (Перенесено из github.com) оставлен комментарий 2019-11-01 20:22:01 +00:00

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).

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).
epsilon-phase (Перенесено из github.com) оставлена рецензия 2019-11-01 20:43:27 +00:00
epsilon-phase (Перенесено из github.com) оставлен комментарий 2019-11-01 20:43:27 +00:00

Didn't realize it was possible to do that with i18n!, that's nifty :)

Didn't realize it was possible to do that with `i18n!`, that's nifty :)
elegaanz (Перенесено из github.com) изменения одобрены 2019-11-02 14:14:22 +00:00
elegaanz (Перенесено из github.com) оставил комментарий

Works as expected, thank you!

Works as expected, thank you!
Войдите, чтобы присоединиться к обсуждению.
Нет рецензентов
Нет этапа
Нет проекта
Нет назначенных
2 участников
Уведомления
Срок выполнения
Срок выполнения недействителен или находится за пределами допустимого диапазона. Пожалуйста, используйте формат «гггг-мм-дд».

Срок выполнения не установлен.

Зависимости

Зависимостей нет.

Ссылка: Plume/Plume#688
Описание отсутствует.