Skip to content

Commit

Permalink
Save the cover too
Browse files Browse the repository at this point in the history
  • Loading branch information
epsilon-phase committed Nov 1, 2019
1 parent 86dbc04 commit 599c372
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions plume-front/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ impl From<stdweb::private::ConversionError> for EditorError {
#[derive(Serialize, Deserialize)]
struct AutosaveInformation {
contents: String,
cover: String,
last_saved: f64,
license:String,
subtitle:String,
Expand Down Expand Up @@ -177,6 +178,14 @@ fn set_license(lic:&str){
let license:InputElement = InputElement::try_from(document().get_element_by_id("license").unwrap()).ok().unwrap();
license.set_raw_value(lic);
}
fn get_cover()->String{
let cover:InputElement = InputElement::try_from(document().get_element_by_id("cover").unwrap()).ok().unwrap();
cover.raw_value()
}
fn set_cover(new_cover:&str){
let cover:InputElement = InputElement::try_from(document().get_element_by_id("cover").unwrap()).ok().unwrap();
cover.set_raw_value(new_cover);
}
fn autosave() {
let info: AutosaveInformation = AutosaveInformation {
contents: get_editor_contents(),
Expand All @@ -185,6 +194,7 @@ fn autosave() {
tags: get_tags(),
license:get_license(),
last_saved: Date::now(),
cover:get_cover(),
};
let id = get_autosave_id();
match window()
Expand Down Expand Up @@ -215,6 +225,7 @@ fn load_autosave() {
set_subtitle(&autosave_info.subtitle);
set_tags(&autosave_info.tags);
set_license(&autosave_info.license);
set_cover(&autosave_info.cover);
console!(log, "Loaded autosave.");
} else {
clear_autosave();
Expand Down

0 comments on commit 599c372

Please sign in to comment.