mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	change in naming conventions for element variables from *El to $name
This commit is contained in:
		| @@ -1,18 +1,18 @@ | ||||
| "use strict"; | ||||
|  | ||||
| const addLink = (function() { | ||||
|     const dialogEl = $("#add-link-dialog"); | ||||
|     const formEl = $("#add-link-form"); | ||||
|     const autoCompleteEl = $("#note-autocomplete"); | ||||
|     const linkTitleEl = $("#link-title"); | ||||
|     const clonePrefixEl = $("#clone-prefix"); | ||||
|     const linkTitleFormGroup = $("#add-link-title-form-group"); | ||||
|     const prefixFormGroup = $("#add-link-prefix-form-group"); | ||||
|     const linkTypeEls = $("input[name='add-link-type']"); | ||||
|     const linkTypeHtmlEl = linkTypeEls.filter('input[value="html"]'); | ||||
|     const $dialog = $("#add-link-dialog"); | ||||
|     const $form = $("#add-link-form"); | ||||
|     const $autoComplete = $("#note-autocomplete"); | ||||
|     const $linkTitle = $("#link-title"); | ||||
|     const $clonePrefix = $("#clone-prefix"); | ||||
|     const $linkTitleFormGroup = $("#add-link-title-form-group"); | ||||
|     const $prefixFormGroup = $("#add-link-prefix-form-group"); | ||||
|     const $linkTypes = $("input[name='add-link-type']"); | ||||
|     const $linkTypeHtml = $linkTypes.filter('input[value="html"]'); | ||||
|  | ||||
|     function setLinkType(linkType) { | ||||
|         linkTypeEls.each(function () { | ||||
|         $linkTypes.each(function () { | ||||
|             $(this).prop('checked', $(this).val() === linkType); | ||||
|         }); | ||||
|  | ||||
| @@ -20,39 +20,39 @@ const addLink = (function() { | ||||
|     } | ||||
|  | ||||
|     function showDialog() { | ||||
|         glob.activeDialog = dialogEl; | ||||
|         glob.activeDialog = $dialog; | ||||
|  | ||||
|         if (noteEditor.getCurrentNoteType() === 'text') { | ||||
|             linkTypeHtmlEl.prop('disabled', false); | ||||
|             $linkTypeHtml.prop('disabled', false); | ||||
|  | ||||
|             setLinkType('html'); | ||||
|         } | ||||
|         else { | ||||
|             linkTypeHtmlEl.prop('disabled', true); | ||||
|             $linkTypeHtml.prop('disabled', true); | ||||
|  | ||||
|             setLinkType('selected-to-current'); | ||||
|         } | ||||
|  | ||||
|         dialogEl.dialog({ | ||||
|         $dialog.dialog({ | ||||
|             modal: true, | ||||
|             width: 700 | ||||
|         }); | ||||
|  | ||||
|         autoCompleteEl.val('').focus(); | ||||
|         clonePrefixEl.val(''); | ||||
|         linkTitleEl.val(''); | ||||
|         $autoComplete.val('').focus(); | ||||
|         $clonePrefix.val(''); | ||||
|         $linkTitle.val(''); | ||||
|  | ||||
|         function setDefaultLinkTitle(noteId) { | ||||
|             const noteTitle = noteTree.getNoteTitle(noteId); | ||||
|  | ||||
|             linkTitleEl.val(noteTitle); | ||||
|             $linkTitle.val(noteTitle); | ||||
|         } | ||||
|  | ||||
|         autoCompleteEl.autocomplete({ | ||||
|         $autoComplete.autocomplete({ | ||||
|             source: noteTree.getAutocompleteItems(), | ||||
|             minLength: 0, | ||||
|             change: () => { | ||||
|                 const val = autoCompleteEl.val(); | ||||
|                 const val = $autoComplete.val(); | ||||
|                 const notePath = link.getNodePathFromLabel(val); | ||||
|                 if (!notePath) { | ||||
|                     return; | ||||
| @@ -75,8 +75,8 @@ const addLink = (function() { | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     formEl.submit(() => { | ||||
|         const value = autoCompleteEl.val(); | ||||
|     $form.submit(() => { | ||||
|         const value = $autoComplete.val(); | ||||
|  | ||||
|         const notePath = link.getNodePathFromLabel(value); | ||||
|         const noteId = treeUtils.getNoteIdFromNotePath(notePath); | ||||
| @@ -85,25 +85,25 @@ const addLink = (function() { | ||||
|             const linkType = $("input[name='add-link-type']:checked").val(); | ||||
|  | ||||
|             if (linkType === 'html') { | ||||
|                 const linkTitle = linkTitleEl.val(); | ||||
|                 const linkTitle = $linkTitle.val(); | ||||
|  | ||||
|                 dialogEl.dialog("close"); | ||||
|                 $dialog.dialog("close"); | ||||
|  | ||||
|                 link.addLinkToEditor(linkTitle, '#' + notePath); | ||||
|             } | ||||
|             else if (linkType === 'selected-to-current') { | ||||
|                 const prefix = clonePrefixEl.val(); | ||||
|                 const prefix = $clonePrefix.val(); | ||||
|  | ||||
|                 cloning.cloneNoteTo(noteId, noteEditor.getCurrentNoteId(), prefix); | ||||
|  | ||||
|                 dialogEl.dialog("close"); | ||||
|                 $dialog.dialog("close"); | ||||
|             } | ||||
|             else if (linkType === 'current-to-selected') { | ||||
|                 const prefix = clonePrefixEl.val(); | ||||
|                 const prefix = $clonePrefix.val(); | ||||
|  | ||||
|                 cloning.cloneNoteTo(noteEditor.getCurrentNoteId(), noteId, prefix); | ||||
|  | ||||
|                 dialogEl.dialog("close"); | ||||
|                 $dialog.dialog("close"); | ||||
|             } | ||||
|         } | ||||
|  | ||||
| @@ -111,19 +111,19 @@ const addLink = (function() { | ||||
|     }); | ||||
|  | ||||
|     function linkTypeChanged() { | ||||
|         const value = linkTypeEls.filter(":checked").val(); | ||||
|         const value = $linkTypes.filter(":checked").val(); | ||||
|  | ||||
|         if (value === 'html') { | ||||
|             linkTitleFormGroup.show(); | ||||
|             prefixFormGroup.hide(); | ||||
|             $linkTitleFormGroup.show(); | ||||
|             $prefixFormGroup.hide(); | ||||
|         } | ||||
|         else { | ||||
|             linkTitleFormGroup.hide(); | ||||
|             prefixFormGroup.show(); | ||||
|             $linkTitleFormGroup.hide(); | ||||
|             $prefixFormGroup.show(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     linkTypeEls.change(linkTypeChanged); | ||||
|     $linkTypes.change(linkTypeChanged); | ||||
|  | ||||
|     $(document).bind('keydown', 'ctrl+l', e => { | ||||
|         showDialog(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user