Use the "classic" editor by default (#697)
This commit is contained in:
		
							parent
							
								
									c66ef5f85d
								
							
						
					
					
						commit
						7f296b2ef2
					
				| @ -258,32 +258,35 @@ 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() | ||||||
|             if let Some(editor) = document().get_element_by_id("plume-fallback-editor") { |         .get("basic-editor") | ||||||
|                 if let Ok(Some(title_label)) = document().query_selector("label[for=title]") { |         .map(|x| x == "true") | ||||||
|                     let editor_button = document().create_element("a")?; |         .unwrap_or(true) | ||||||
|                     js! { @{&editor_button}.href = "#"; } |     { | ||||||
|                     editor_button.add_event_listener(|_: ClickEvent| { |         if let Some(editor) = document().get_element_by_id("plume-fallback-editor") { | ||||||
|                         window().local_storage().remove("basic-editor"); |             if let Ok(Some(title_label)) = document().query_selector("label[for=title]") { | ||||||
|                         window().history().go(0).ok(); // refresh
 |                 let editor_button = document().create_element("a")?; | ||||||
|                     }); |                 js! { @{&editor_button}.href = "#"; } | ||||||
|                     editor_button.append_child( |                 editor_button.add_event_listener(|_: ClickEvent| { | ||||||
|                         &document().create_text_node(&i18n!(CATALOG, "Open the rich text editor")), |                     window().local_storage().remove("basic-editor"); | ||||||
|                     ); |                     window().history().go(0).ok(); // refresh
 | ||||||
|                     editor.insert_before(&editor_button, &title_label).ok(); |                 }); | ||||||
|                     document() |                 editor_button.append_child( | ||||||
|                         .get_element_by_id("editor-content") |                     &document().create_text_node(&i18n!(CATALOG, "Open the rich text editor")), | ||||||
|                         .unwrap() |                 ); | ||||||
|                         .add_event_listener(|_: KeyDownEvent| autosave_debounce()); |                 editor.insert_before(&editor_button, &title_label).ok(); | ||||||
|                     return Ok(()); |                 document() | ||||||
|                 } |                     .get_element_by_id("editor-content") | ||||||
|  |                     .unwrap() | ||||||
|  |                     .add_event_listener(|_: KeyDownEvent| autosave_debounce()); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
|     // If we didn't returned above
 |         Ok(()) | ||||||
|     init_editor() |     } else { | ||||||
|  |         init_editor() | ||||||
|  |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| fn init_editor() -> Result<(), EditorError> { | fn init_editor() -> Result<(), EditorError> { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user