mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 13:01:31 +08:00 
			
		
		
		
	allow specifying include note widget size
This commit is contained in:
		
							parent
							
								
									6c76d862d2
								
							
						
					
					
						commit
						242f139be4
					
				
							
								
								
									
										2
									
								
								libraries/ckeditor/ckeditor.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								libraries/ckeditor/ckeditor.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @ -25,13 +25,15 @@ async function includeNote(notePath) { | |||||||
|     const noteId = treeService.getNoteIdFromNotePath(notePath); |     const noteId = treeService.getNoteIdFromNotePath(notePath); | ||||||
|     const note = await treeCache.getNote(noteId); |     const note = await treeCache.getNote(noteId); | ||||||
| 
 | 
 | ||||||
|  |     const boxSize = $("input[name='include-note-box-size']:checked").val(); | ||||||
|  | 
 | ||||||
|     if (note.type === 'image') { |     if (note.type === 'image') { | ||||||
|         // there's no benefit to use insert note functionlity for images
 |         // there's no benefit to use insert note functionlity for images
 | ||||||
|         // so we'll just add an IMG tag
 |         // so we'll just add an IMG tag
 | ||||||
|         textTypeWidget.addImage(noteId); |         textTypeWidget.addImage(noteId); | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|         textTypeWidget.addIncludeNote(noteId); |         textTypeWidget.addIncludeNote(noteId, boxSize); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -237,12 +237,13 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget { | |||||||
|         import("../../dialogs/include_note.js").then(d => d.showDialog(this)); |         import("../../dialogs/include_note.js").then(d => d.showDialog(this)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     addIncludeNote(noteId) { |     addIncludeNote(noteId, boxSize) { | ||||||
|         this.textEditor.model.change( writer => { |         this.textEditor.model.change( writer => { | ||||||
|             // Insert <includeNote>*</includeNote> at the current selection position
 |             // Insert <includeNote>*</includeNote> at the current selection position
 | ||||||
|             // in a way that will result in creating a valid model structure
 |             // in a way that will result in creating a valid model structure
 | ||||||
|             this.textEditor.model.insertContent(writer.createElement('includeNote', { |             this.textEditor.model.insertContent(writer.createElement('includeNote', { | ||||||
|                 noteId: noteId |                 noteId: noteId, | ||||||
|  |                 boxSize: boxSize | ||||||
|             })); |             })); | ||||||
|         } ); |         } ); | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -864,3 +864,13 @@ body { | |||||||
| .hidden-int, .hidden-ext { | .hidden-int, .hidden-ext { | ||||||
|     display: none !important; |     display: none !important; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | .include-note.box-size-small { | ||||||
|  |     max-height: 12em; | ||||||
|  |     overflow: auto; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .include-note.box-size-medium { | ||||||
|  |     max-height: 25em; | ||||||
|  |     overflow: auto; | ||||||
|  | } | ||||||
| @ -15,6 +15,27 @@ | |||||||
|                             <input id="include-note-autocomplete" class="form-control" placeholder="search for note by its name"> |                             <input id="include-note-autocomplete" class="form-control" placeholder="search for note by its name"> | ||||||
|                         </div> |                         </div> | ||||||
|                     </div> |                     </div> | ||||||
|  | 
 | ||||||
|  |                     Box size of the included note: | ||||||
|  | 
 | ||||||
|  |                     <div class="form-check"> | ||||||
|  |                         <input class="form-check-input" type="radio" name="include-note-box-size" value="small" id="include-note-box-size-small"> | ||||||
|  |                         <label class="form-check-label" for="include-note-box-size-small"> | ||||||
|  |                             small (~ 10 lines) | ||||||
|  |                         </label> | ||||||
|  |                     </div> | ||||||
|  |                     <div class="form-check"> | ||||||
|  |                         <input class="form-check-input" type="radio" name="include-note-box-size" value="medium" id="include-note-box-size-medium" checked> | ||||||
|  |                         <label class="form-check-label" for="include-note-box-size-medium"> | ||||||
|  |                             medium (~ 30 lines) | ||||||
|  |                         </label> | ||||||
|  |                     </div> | ||||||
|  |                     <div class="form-check"> | ||||||
|  |                         <input class="form-check-input" type="radio" name="include-note-box-size" value="full" id="include-note-box-size-full"> | ||||||
|  |                         <label class="form-check-label" for="include-note-box-size-full"> | ||||||
|  |                             full (box shows complete text) | ||||||
|  |                         </label> | ||||||
|  |                     </div> | ||||||
|                 </div> |                 </div> | ||||||
|                 <div class="modal-footer"> |                 <div class="modal-footer"> | ||||||
|                     <button type="submit" class="btn btn-primary">Include note <kbd>enter</kbd></button> |                     <button type="submit" class="btn btn-primary">Include note <kbd>enter</kbd></button> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam