This commit is contained in:
zadam
2023-06-30 11:18:34 +02:00
parent fc564f6aed
commit 192e399cb5
77 changed files with 160 additions and 159 deletions

View File

@@ -310,7 +310,7 @@ export default class AttributeEditorWidget extends NoteContextAwareWidget {
this.$saveAttributesButton.fadeOut();
// blink the attribute text to give visual hint that save has been executed
// blink the attribute text to give a visual hint that save has been executed
this.$editor.css('opacity', 0);
// revert back
@@ -387,7 +387,7 @@ export default class AttributeEditorWidget extends NoteContextAwareWidget {
parsedAttrs = attributeParser.lexAndParse(this.getPreprocessedData(), true);
}
catch (e) {
// the input is incorrect because user messed up with it and now needs to fix it manually
// the input is incorrect because the user messed up with it and now needs to fix it manually
return null;
}

View File

@@ -4,7 +4,7 @@ import appContext from "../../../components/app_context.js";
import utils from "../../../services/utils.js";
import linkContextMenuService from "../../../menus/link_context_menu.js";
// we're intentionally displaying the launcher title and icon instead of the target
// we're intentionally displaying the launcher title and icon instead of the target,
// e.g. you want to make launchers to 2 mermaid diagrams which both have mermaid icon (ok),
// but on the launchpad you want them distinguishable.
// for titles, the note titles may follow a different scheme than maybe desirable on the launchpad

View File

@@ -67,7 +67,7 @@ export default class LauncherContainer extends FlexContainer {
entitiesReloadedEvent({loadResults}) {
if (loadResults.getBranchRows().find(branch => froca.getNoteFromCache(branch.parentNoteId)?.isLaunchBarConfig())) {
// changes in note placement requires reload of all launchers, all other changes are handled by individual
// changes in note placement require reload of all launchers, all other changes are handled by individual
// launchers
this.load();
}

View File

@@ -341,7 +341,7 @@ export default class RibbonContainer extends NoteContextAwareWidget {
entitiesReloadedEvent({loadResults}) {
if (loadResults.isNoteReloaded(this.noteId) && this.lastNoteType !== this.note.type) {
// note type influences the list of available ribbon tabs the most
// check for type is so that we don't update on each title rename
// check for the type is so that we don't update on each title rename
this.lastNoteType = this.note.type;
this.refresh();

View File

@@ -20,9 +20,9 @@ export default class RightPaneContainer extends FlexContainer {
const promise = super.handleEventInChildren(name, data);
if (['activeContextChanged', 'noteSwitchedAndActivated', 'noteSwitched'].includes(name)) {
// right pane is displayed only if some child widget is active
// the right pane is displayed only if some child widget is active,
// we'll reevaluate the visibility based on events which are probable to cause visibility change
// but these events needs to be finished and only then we check
// but these events need to be finished and only then we check
if (promise) {
promise.then(() => this.reEvaluateRightPaneVisibilityCommand());
}

View File

@@ -157,7 +157,7 @@ export default class SplitNoteContainer extends FlexContainer {
/**
* widget.hasBeenAlreadyShown is intended for lazy loading of cached tabs - initial note switches of new tabs
* are not executed, we're waiting for the first tab activation, and then we update the tab. After this initial
* activation further note switches are always propagated to the tabs.
* activation, further note switches are always propagated to the tabs.
*/
handleEventInChildren(name, data) {
if (['noteSwitched', 'noteSwitchedAndActivated'].includes(name)) {

View File

@@ -153,7 +153,7 @@ export default class BulkActionsDialog extends BasicWidget {
&& row.noteId === '_bulkAction'
&& row.isDeleted)) {
// this may be triggered from e.g. sync without open widget, then no need to refresh the widget
// this may be triggered from e.g., sync without open widget, then no need to refresh the widget
if (this.selectedOrActiveNoteIds && this.$widget.is(":visible")) {
this.refresh();
}

View File

@@ -84,7 +84,7 @@ export default class JumpToNoteDialog extends BasicWidget {
}
showInFullText(e) {
// stop from propagating upwards (dangerous especially with ctrl+enter executable javascript notes)
// stop from propagating upwards (dangerous, especially with ctrl+enter executable javascript notes)
e.preventDefault();
e.stopPropagation();

View File

@@ -246,8 +246,8 @@ export default class RevisionsDialog extends BasicWidget {
this.$content.html($("<pre>").text(fullRevision.content));
} else if (revisionItem.type === 'image') {
this.$content.html($("<img>")
// reason why we put this inline as base64 is that we do not want to let user copy this
// as a URL to be used in a note. Instead, if they copy and paste it into a note, it will be an uploaded as a new note
// the reason why we put this inline as base64 is that we do not want to let user copy this
// as a URL to be used in a note. Instead, if they copy and paste it into a note, it will be uploaded as a new note
.attr("src", `data:${fullRevision.mime};base64,${fullRevision.content}`)
.css("max-width", "100%")
.css("max-height", "100%"));

View File

@@ -73,7 +73,7 @@ export default class NoteListWidget extends NoteContextAwareWidget {
/**
* We have this event so that we evaluate intersection only after note detail is loaded.
* If it's evaluated before note detail then it's clearly intersected (visible) although after note detail load
* If it's evaluated before note detail, then it's clearly intersected (visible) although after note detail load
* it is not intersected (visible) anymore.
*/
noteDetailRefreshedEvent({ntxId}) {

View File

@@ -171,7 +171,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
this.triggerCommand('hoistNote', {noteId: node.data.noteId});
});
// fancytree doesn't support middle click so this is a way to support it
// fancytree doesn't support middle click, so this is a way to support it
this.$tree.on('mousedown', '.fancytree-title', e => {
if (e.which === 2) {
const node = $.ui.fancytree.getNode(e);
@@ -353,7 +353,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
}
},
beforeActivate: (event, {node}) => {
// hidden subtree is hidden hackily, prevent activating it e.g. by keyboard
// hidden subtree is hidden hackily, prevent activating it, e.g. by keyboard
if (hoistedNoteService.getHoistedNoteId() === '_hidden') {
// if we're hoisted in hidden subtree, we want to avoid crossing to "visible" tree,
@@ -545,7 +545,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
const $unhoistButton = $('<span class="tree-item-button unhoist-button bx bx-door-open" title="Unhoist"></span>')
.on("click", cancelClickPropagation);
// unhoist button is prepended since compared to other buttons this is not just convenience
// unhoist button is prepended since compared to other buttons, this is not just convenience
// on the mobile interface - it's the only way to unhoist
$span.prepend($unhoistButton);
}
@@ -812,7 +812,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
await this.batchUpdate(async () => {
await node.load(true);
if (node.data.noteId !== hoistedNoteService.getHoistedNoteId()) { // hoisted note should be always expanded
if (node.data.noteId !== hoistedNoteService.getHoistedNoteId()) { // hoisted note should always be expanded
await node.setExpanded(isExpanded, {noEvents: true, noAnimation: true});
}
});
@@ -905,7 +905,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
await parentNode.setExpanded(true, {noAnimation: true});
}
// although previous line should set the expanded status, it seems to happen asynchronously,
// although the previous line should set the expanded status, it seems to happen asynchronously,
// so we need to make sure it is set properly before calling updateNode which uses this flag
const branch = froca.getBranch(parentNode.data.branchId);
branch.isExpanded = true;
@@ -922,7 +922,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
if (!foundChildNode) {
if (logErrors) {
// besides real errors this can be also caused by hiding of e.g. included images
// besides real errors, this can be also caused by hiding of e.g. included images
// these are real notes with real notePath, user can display them in a detail,
// but they don't have a node in the tree
@@ -1040,7 +1040,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
}
/*
* We're collapsing notes after period of inactivity to "cleanup" the tree - users rarely
* We're collapsing notes after a period of inactivity to "cleanup" the tree - users rarely
* collapse the notes and the tree becomes unusuably large.
* Some context: https://github.com/zadam/trilium/issues/1192
*/
@@ -1116,8 +1116,8 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
const note = froca.getNoteFromCache(ecAttr.noteId);
if (note && note.getChildNoteIds().includes(ecAttr.value)) {
// there's new/deleted imageLink betwen note and its image child - which can show/hide
// the image (if there is a imageLink relation between parent and child
// there's a new /deleted imageLink betwen note and its image child - which can show/hide
// the image (if there is an imageLink relation between parent and child,
// then it is assumed to be "contained" in the note and thus does not have to be displayed in the tree)
noteIdsToReload.add(ecAttr.noteId);
}
@@ -1213,7 +1213,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
}
});
// for some reason node update cannot be in the batchUpdate() block (node is not re-rendered)
// for some reason, node update cannot be in the batchUpdate() block (node is not re-rendered)
for (const noteId of noteIdsToUpdate) {
for (const node of this.getNodesByNoteId(noteId)) {
await this.updateNode(node);
@@ -1239,7 +1239,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
// so we switch to the alternative of trying to find it by noteId
const notesById = this.getNodesByNoteId(activeNoteId);
// if there are multiple clones then we'd rather not activate any one
// if there are multiple clones, then we'd rather not activate anyone
node = notesById.length === 1 ? notesById[0] : null;
}
@@ -1252,7 +1252,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
await node.setActive(true, {noEvents: true, noFocus: !activeNodeFocused});
}
else {
// this is used when original note has been deleted, and we want to move the focus to the note above/below
// this is used when the original note has been deleted, and we want to move the focus to the note above/below
node = await this.expandToNote(nextNotePath, false);
if (node) {

View File

@@ -64,7 +64,7 @@ export default class NoteTypeWidget extends NoteContextAwareWidget {
this.$noteTypeButton.dropdown('hide');
}
/** actual body is rendered lazily on note-type button click */
/** the actual body is rendered lazily on note-type button click */
async renderDropdown() {
this.$noteTypeDropdown.empty();

View File

@@ -107,7 +107,7 @@ export default class PromotedAttributesWidget extends NoteContextAwareWidget {
}
}
// we replace the whole content in one step so there can't be any race conditions
// we replace the whole content in one step, so there can't be any race conditions
// (previously we saw promoted attributes doubling)
this.$container.empty().append(...$cells);
this.toggleInt(true);

View File

@@ -47,8 +47,8 @@ export default class SearchString extends AbstractSearchOption {
shortcutService.bindElShortcut(this.$searchString, 'return', async () => {
// this also in effect disallows new lines in query string.
// on one hand this makes sense since search string is a label
// on the other hand it could be nice for structuring long search string. It's probably a niche case though.
// on one hand, this makes sense since search string is a label
// on the other hand, it could be nice for structuring long search string. It's probably a niche case though.
await this.spacedUpdate.updateNowIfNecessary();
this.triggerCommand('refreshResults');

View File

@@ -336,7 +336,7 @@ export default class TabRowWidget extends BasicWidget {
position += width + MARGIN_WIDTH;
});
position -= MARGIN_WIDTH; // last margin should not be applied
position -= MARGIN_WIDTH; // the last margin should not be applied
const newTabPosition = position;
const fillerPosition = position + 32;
@@ -542,7 +542,7 @@ export default class TabRowWidget extends BasicWidget {
});
draggabilly.on('dragMove', (event, pointer, moveVector) => {
// Current index be computed within the event since it can change during the dragMove
// The current index be computed within the event since it can change during the dragMove
const tabEls = this.tabEls;
const currentIndex = tabEls.indexOf(tabEl);

View File

@@ -2,14 +2,14 @@
* Table of contents widget
* (c) Antonio Tejada 2022
*
* By design there's no support for nonsensical or malformed constructs:
* By design, there's no support for nonsensical or malformed constructs:
* - headings inside elements (e.g. Trilium allows headings inside tables, but
* not inside lists)
* - nested headings when using raw HTML <H2><H3></H3></H2>
* - malformed headings when using raw HTML <H2></H3></H2><H3>
* - etc.
*
* In those cases the generated TOC may be incorrect or the navigation may lead
* In those cases, the generated TOC may be incorrect, or the navigation may lead
* to the wrong heading (although what "right" means in those cases is not
* clear), but it won't crash.
*/

View File

@@ -72,7 +72,7 @@ export default class EditableCodeTypeWidget extends TypeWidget {
const blob = await this.note.getBlob();
await this.spacedUpdate.allowUpdateWithoutChange(() => {
// CodeMirror breaks pretty badly on null, so even though it shouldn't happen (guarded by consistency check)
// CodeMirror breaks pretty badly on null, so even though it shouldn't happen (guarded by a consistency check)
// we provide fallback
this.codeEditor.setValue(blob.content || "");
this.codeEditor.clearHistory();

View File

@@ -192,7 +192,7 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget {
getData() {
const content = this.watchdog.editor.getData();
// if content is only tags/whitespace (typically <p>&nbsp;</p>), then just make it empty
// if content is only tags/whitespace (typically <p>&nbsp;</p>), then just make it empty,
// this is important when setting a new note to code
return {
content: utils.isHtmlEmpty(content) ? '' : content

View File

@@ -91,7 +91,7 @@ export default class RelationMapTypeWidget extends TypeWidget {
if (this.clipboard) {
let {x, y} = this.getMousePosition(event);
// modifying position so that cursor is on the top-center of the box
// modifying position so that the cursor is on the top-center of the box
x -= 80;
y -= 15;
@@ -186,8 +186,8 @@ export default class RelationMapTypeWidget extends TypeWidget {
async loadMapData() {
this.mapData = {
notes: [],
// it is important to have this exact value here so that initial transform is same as this
// which will guarantee note won't be saved on first conversion to relation map note type
// it is important to have this exact value here so that initial transform is the same as this
// which will guarantee note won't be saved on first conversion to the relation map note type
// this keeps the principle that note type change doesn't destroy note content unless user
// does some actual change
transform: {
@@ -231,7 +231,7 @@ export default class RelationMapTypeWidget extends TypeWidget {
// this is done at this point (after async operations) to reduce flicker to the minimum
this.jsPlumbInstance.deleteEveryEndpoint();
// without this we still end up with note boxes remaining in the canvas
// without this, we still end up with note boxes remaining in the canvas
this.$relationMapContainer.empty();
}
@@ -305,7 +305,7 @@ export default class RelationMapTypeWidget extends TypeWidget {
minZoom: 0.3,
smoothScroll: false,
filterKey: function(e, dx, dy, dz) {
// if ALT is pressed then panzoom should bubble the event up
// if ALT is pressed, then panzoom should bubble the event up
// this is to preserve ALT-LEFT, ALT-RIGHT navigation working
return e.altKey;
}