mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01: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 note = await treeCache.getNote(noteId);
|
||||
|
||||
const boxSize = $("input[name='include-note-box-size']:checked").val();
|
||||
|
||||
if (note.type === 'image') {
|
||||
// there's no benefit to use insert note functionlity for images
|
||||
// so we'll just add an IMG tag
|
||||
textTypeWidget.addImage(noteId);
|
||||
}
|
||||
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));
|
||||
}
|
||||
|
||||
addIncludeNote(noteId) {
|
||||
addIncludeNote(noteId, boxSize) {
|
||||
this.textEditor.model.change( writer => {
|
||||
// Insert <includeNote>*</includeNote> at the current selection position
|
||||
// in a way that will result in creating a valid model structure
|
||||
this.textEditor.model.insertContent(writer.createElement('includeNote', {
|
||||
noteId: noteId
|
||||
noteId: noteId,
|
||||
boxSize: boxSize
|
||||
}));
|
||||
} );
|
||||
}
|
||||
|
@ -863,4 +863,14 @@ body {
|
||||
|
||||
.hidden-int, .hidden-ext {
|
||||
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">
|
||||
</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 class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">Include note <kbd>enter</kbd></button>
|
||||
|
Loading…
x
Reference in New Issue
Block a user