mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-11-29 06:51:01 +00:00
Use the "classic" editor by default (#697)
This commit is contained in:
parent
c66ef5f85d
commit
7f296b2ef2
1 changed files with 26 additions and 23 deletions
|
@ -258,8 +258,12 @@ pub fn init() -> Result<(), EditorError> {
|
||||||
ed.add_event_listener(|_: SubmitEvent| clear_autosave());
|
ed.add_event_listener(|_: SubmitEvent| clear_autosave());
|
||||||
}
|
}
|
||||||
// Check if the user wants to use the basic editor
|
// Check if the user wants to use the basic editor
|
||||||
if let Some(basic_editor) = window().local_storage().get("basic-editor") {
|
if window()
|
||||||
if basic_editor == "true" {
|
.local_storage()
|
||||||
|
.get("basic-editor")
|
||||||
|
.map(|x| x == "true")
|
||||||
|
.unwrap_or(true)
|
||||||
|
{
|
||||||
if let Some(editor) = document().get_element_by_id("plume-fallback-editor") {
|
if let Some(editor) = document().get_element_by_id("plume-fallback-editor") {
|
||||||
if let Ok(Some(title_label)) = document().query_selector("label[for=title]") {
|
if let Ok(Some(title_label)) = document().query_selector("label[for=title]") {
|
||||||
let editor_button = document().create_element("a")?;
|
let editor_button = document().create_element("a")?;
|
||||||
|
@ -276,15 +280,14 @@ pub fn init() -> Result<(), EditorError> {
|
||||||
.get_element_by_id("editor-content")
|
.get_element_by_id("editor-content")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.add_event_listener(|_: KeyDownEvent| autosave_debounce());
|
.add_event_listener(|_: KeyDownEvent| autosave_debounce());
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we didn't returned above
|
Ok(())
|
||||||
|
} else {
|
||||||
init_editor()
|
init_editor()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn init_editor() -> Result<(), EditorError> {
|
fn init_editor() -> Result<(), EditorError> {
|
||||||
if let Some(ed) = document().get_element_by_id("plume-editor") {
|
if let Some(ed) = document().get_element_by_id("plume-editor") {
|
||||||
|
|
Loading…
Reference in a new issue