mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 04:51:31 +08:00 
			
		
		
		
	Merge pull request #587 from TriliumNext/feature/editor-type-radios
Replace the editor type combo box with radio buttons
This commit is contained in:
		
						commit
						40c9ef69e7
					
				| @ -6,25 +6,37 @@ const TPL = ` | |||||||
| <div class="options-section"> | <div class="options-section"> | ||||||
|     <h4>${t("editing.editor_type.label")}</h4> |     <h4>${t("editing.editor_type.label")}</h4> | ||||||
|      |      | ||||||
|     <select class="editor-type-select form-select"> |     <div> | ||||||
|         <option value="ckeditor-balloon">${t("editing.editor_type.floating")}</option> |         <label> | ||||||
|         <option value="ckeditor-classic">${t("editing.editor_type.fixed")}</option> |             <input type="radio" name="editor-type" value="ckeditor-balloon" /> | ||||||
|     </select> |             <strong>${t("editing.editor_type.floating.title")}</strong> | ||||||
|  |             - ${t("editing.editor_type.floating.description")} | ||||||
|  |         </label> | ||||||
|  |     </div> | ||||||
|  | 
 | ||||||
|  |     <div> | ||||||
|  |         <label> | ||||||
|  |             <input type="radio" name="editor-type" value="ckeditor-classic" /> | ||||||
|  |             <strong>${t("editing.editor_type.fixed.title")}</strong> | ||||||
|  |             - ${t("editing.editor_type.fixed.description")} | ||||||
|  |         </label> | ||||||
|  |     </div> | ||||||
|  | 
 | ||||||
| </div>`; | </div>`; | ||||||
| 
 | 
 | ||||||
| export default class EditorOptions extends OptionsWidget { | export default class EditorOptions extends OptionsWidget { | ||||||
|     doRender() { |     doRender() { | ||||||
|         this.$widget = $(TPL); |         this.$widget = $(TPL); | ||||||
|         this.$body = $("body"); |         this.$body = $("body"); | ||||||
|         this.$editorType = this.$widget.find(".editor-type-select"); |         this.$widget.find(`input[name="editor-type"]`).on('change', async () => { | ||||||
|         this.$editorType.on('change', async () => { |             const newEditorType = this.$widget.find(`input[name="editor-type"]:checked`).val(); | ||||||
|             const newEditorType = this.$editorType.val(); |  | ||||||
|             await this.updateOption('textNoteEditorType', newEditorType); |             await this.updateOption('textNoteEditorType', newEditorType); | ||||||
|             utils.reloadFrontendApp("editor type change"); |             utils.reloadFrontendApp("editor type change"); | ||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     async optionsLoaded(options) { |     async optionsLoaded(options) { | ||||||
|         this.$editorType.val(options.textNoteEditorType); |         this.$widget.find(`input[name="editor-type"][value="${options.textNoteEditorType}"]`) | ||||||
|  |                     .prop("checked", "true"); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -1522,8 +1522,14 @@ | |||||||
|   "editing": { |   "editing": { | ||||||
|     "editor_type": { |     "editor_type": { | ||||||
|       "label": "Formatting toolbar", |       "label": "Formatting toolbar", | ||||||
|       "floating": "Floating (editing tools appear near the cursor)", |       "floating": { | ||||||
|       "fixed": "Fixed (editing tools appear in the \"Formatting\" ribbon tab)" |         "title": "Floating", | ||||||
|  |         "description": "editing tools appear near the cursor;" | ||||||
|  |       }, | ||||||
|  |       "fixed": { | ||||||
|  |         "title": "Fixed", | ||||||
|  |         "description": "editing tools appear in the \"Formatting\" ribbon tab." | ||||||
|  |       } | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | |||||||
| @ -1518,8 +1518,14 @@ | |||||||
|   "editing": { |   "editing": { | ||||||
|     "editor_type": { |     "editor_type": { | ||||||
|       "label": "Barra de herramientas de formato", |       "label": "Barra de herramientas de formato", | ||||||
|       "floating": "Flotante (las herramientas de edición aparecen cerca del cursor)", |       "floating": { | ||||||
|       "fixed": "Fijo (las herramientas de edición aparecen en la pestaña de la cinta \"Formato\")" |         "title": "Flotante", | ||||||
|  |         "description": "las herramientas de edición aparecen cerca del cursor;" | ||||||
|  |       }, | ||||||
|  |       "fixed": { | ||||||
|  |         "title": "Fijo", | ||||||
|  |         "description": "las herramientas de edición aparecen en la pestaña de la cinta \"Formato\")." | ||||||
|  |       } | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | |||||||
| @ -1514,9 +1514,15 @@ | |||||||
|   }, |   }, | ||||||
|   "editing": { |   "editing": { | ||||||
|     "editor_type": { |     "editor_type": { | ||||||
|       "fixed": "Editor cu bară fixă (uneltele de editare vor apărea în tab-ul „Formatare” din panglică)", |       "label": "Bară de formatare", | ||||||
|       "floating": "Editor cu bară flotantă (uneltele de editare vor apărea lângă cursor)", |       "floating": { | ||||||
|       "label": "Bară de formatare" |         "title": "Editor cu bară flotantă", | ||||||
|  |         "description": "uneltele de editare vor apărea lângă cursor." | ||||||
|  |       }, | ||||||
|  |       "fixed": { | ||||||
|  |         "title": "Editor cu bară fixă", | ||||||
|  |         "description": "uneltele de editare vor apărea în tab-ul „Formatare” din panglică;" | ||||||
|  |       } | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|   "editor": { |   "editor": { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran