mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 21:19:01 +01:00 
			
		
		
		
	add checkbox in popup and handle case in popup.js
This commit is contained in:
		
							parent
							
								
									b731a051f1
								
							
						
					
					
						commit
						82c1b21d64
					
				@ -27,6 +27,10 @@
 | 
				
			|||||||
  <div id="save-link-with-note-wrapper">
 | 
					  <div id="save-link-with-note-wrapper">
 | 
				
			||||||
    <textarea id="save-link-with-note-textarea" rows="5"></textarea>
 | 
					    <textarea id="save-link-with-note-textarea" rows="5"></textarea>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <div>
 | 
				
			||||||
 | 
					      <input type="checkbox" id="keep-title-checkbox" name="keep-title-checkbox" value="Bike">
 | 
				
			||||||
 | 
					      <label for="keep-title-checkbox">Keep page title as note title</label><br>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
    <div style="display: flex;">
 | 
					    <div style="display: flex;">
 | 
				
			||||||
      <button type="submit" class="button wide" id="save-button">Save</button>
 | 
					      <button type="submit" class="button wide" id="save-button">Save</button>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -35,6 +35,7 @@ $saveTabsButton.on("click", () => sendMessage({name: 'save-tabs'}));
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const $saveLinkWithNoteWrapper = $("#save-link-with-note-wrapper");
 | 
					const $saveLinkWithNoteWrapper = $("#save-link-with-note-wrapper");
 | 
				
			||||||
const $textNote = $("#save-link-with-note-textarea");
 | 
					const $textNote = $("#save-link-with-note-textarea");
 | 
				
			||||||
 | 
					const $keepTitle = $("#keep-title-checkbox");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$textNote.on('keypress', function (event) {
 | 
					$textNote.on('keypress', function (event) {
 | 
				
			||||||
    if ((event.which === 10 || event.which === 13) && event.ctrlKey) {
 | 
					    if ((event.which === 10 || event.which === 13) && event.ctrlKey) {
 | 
				
			||||||
@ -66,6 +67,10 @@ async function saveLinkWithNote() {
 | 
				
			|||||||
        title = '';
 | 
					        title = '';
 | 
				
			||||||
        content = '';
 | 
					        content = '';
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    else if ($keepTitle[0].checked){
 | 
				
			||||||
 | 
					        title = '';
 | 
				
			||||||
 | 
					        content = textNoteVal;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    else {
 | 
					    else {
 | 
				
			||||||
        const match = /^(.*?)([.?!]\s|\n)/.exec(textNoteVal);
 | 
					        const match = /^(.*?)([.?!]\s|\n)/.exec(textNoteVal);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user