mirror of
https://github.com/TriliumNext/Notes.git
synced 2026-01-25 22:48:34 -06:00
Merge branch 'stable'
This commit is contained in:
@@ -170,6 +170,10 @@ class Branch extends AbstractEntity {
|
||||
|
||||
log.info("Deleting note " + note.noteId);
|
||||
|
||||
// marking note as deleted as a signal to event handlers that the note is being deleted
|
||||
// (isDeleted is being checked against becca)
|
||||
delete this.becca.notes[note.noteId];
|
||||
|
||||
for (const attribute of note.getOwnedAttributes()) {
|
||||
attribute.markAsDeleted(deleteId);
|
||||
}
|
||||
|
||||
@@ -230,18 +230,7 @@ function focusSavedElement() {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($lastFocusedElement.hasClass("ck")) {
|
||||
// must handle CKEditor separately because of this bug: https://github.com/ckeditor/ckeditor5/issues/607
|
||||
|
||||
const editor = $lastFocusedElement
|
||||
.closest('.ck-editor__editable')
|
||||
.prop('ckeditorInstance');
|
||||
|
||||
editor.editing.view.focus();
|
||||
} else {
|
||||
$lastFocusedElement.focus();
|
||||
}
|
||||
|
||||
$lastFocusedElement.focus();
|
||||
$lastFocusedElement = null;
|
||||
}
|
||||
|
||||
@@ -252,10 +241,12 @@ async function openDialog($dialog, closeActDialog = true) {
|
||||
}
|
||||
|
||||
saveFocusedElement();
|
||||
|
||||
-
|
||||
$dialog.modal();
|
||||
|
||||
$dialog.on('hidden.bs.modal', () => {
|
||||
$(".aa-input").autocomplete("close");
|
||||
|
||||
if (!glob.activeDialog || glob.activeDialog === $dialog) {
|
||||
focusSavedElement();
|
||||
}
|
||||
|
||||
@@ -332,6 +332,7 @@ function BackendScriptApi(currentNote, apiParams) {
|
||||
*
|
||||
* @method
|
||||
* @param {string} date in YYYY-MM-DD format
|
||||
* @param {Note} [rootNote] - specify calendar root note, normally leave empty to use default calendar
|
||||
* @returns {Note|null}
|
||||
* @deprecated use getDayNote instead
|
||||
*/
|
||||
@@ -342,6 +343,7 @@ function BackendScriptApi(currentNote, apiParams) {
|
||||
*
|
||||
* @method
|
||||
* @param {string} date in YYYY-MM-DD format
|
||||
* @param {Note} [rootNote] - specify calendar root note, normally leave empty to use default calendar
|
||||
* @returns {Note|null}
|
||||
*/
|
||||
this.getDayNote = dateNoteService.getDayNote;
|
||||
@@ -350,6 +352,7 @@ function BackendScriptApi(currentNote, apiParams) {
|
||||
* Returns today's day note. If such note doesn't exist, it is created.
|
||||
*
|
||||
* @method
|
||||
* @param {Note} [rootNote] - specify calendar root note, normally leave empty to use default calendar
|
||||
* @returns {Note|null}
|
||||
*/
|
||||
this.getTodayNote = dateNoteService.getTodayNote;
|
||||
@@ -359,7 +362,8 @@ function BackendScriptApi(currentNote, apiParams) {
|
||||
*
|
||||
* @method
|
||||
* @param {string} date in YYYY-MM-DD format
|
||||
* @param {object} options - "startOfTheWeek" - either "monday" (default) or "sunday"
|
||||
* @param {object} [options] - "startOfTheWeek" - either "monday" (default) or "sunday"
|
||||
* @param {Note} [rootNote] - specify calendar root note, normally leave empty to use default calendar
|
||||
* @returns {Note|null}
|
||||
*/
|
||||
this.getWeekNote = dateNoteService.getWeekNote;
|
||||
@@ -369,6 +373,7 @@ function BackendScriptApi(currentNote, apiParams) {
|
||||
*
|
||||
* @method
|
||||
* @param {string} date in YYYY-MM format
|
||||
* @param {Note} [rootNote] - specify calendar root note, normally leave empty to use default calendar
|
||||
* @returns {Note|null}
|
||||
*/
|
||||
this.getMonthNote = dateNoteService.getMonthNote;
|
||||
@@ -378,6 +383,7 @@ function BackendScriptApi(currentNote, apiParams) {
|
||||
*
|
||||
* @method
|
||||
* @param {string} year in YYYY format
|
||||
* @param {Note} [rootNote] - specify calendar root note, normally leave empty to use default calendar
|
||||
* @returns {Note|null}
|
||||
*/
|
||||
this.getYearNote = dateNoteService.getYearNote;
|
||||
|
||||
@@ -150,8 +150,11 @@ function getDayNoteTitle(rootNote, dayNumber, dateObj) {
|
||||
}
|
||||
|
||||
/** @returns {Note} */
|
||||
function getDayNote(dateStr) {
|
||||
const rootNote = getRootCalendarNote();
|
||||
function getDayNote(dateStr, rootNote = null) {
|
||||
if (!rootNote) {
|
||||
rootNote = getRootCalendarNote();
|
||||
}
|
||||
|
||||
dateStr = dateStr.trim().substr(0, 10);
|
||||
|
||||
let dateNote = searchService.findFirstNoteWithQuery(`#${DATE_LABEL}="${dateStr}"`,
|
||||
@@ -183,8 +186,8 @@ function getDayNote(dateStr) {
|
||||
return dateNote;
|
||||
}
|
||||
|
||||
function getTodayNote() {
|
||||
return getDayNote(dateUtils.localNowDate());
|
||||
function getTodayNote(rootNote = null) {
|
||||
return getDayNote(dateUtils.localNowDate(), rootNote);
|
||||
}
|
||||
|
||||
function getStartOfTheWeek(date, startOfTheWeek) {
|
||||
@@ -204,14 +207,14 @@ function getStartOfTheWeek(date, startOfTheWeek) {
|
||||
return new Date(date.setDate(diff));
|
||||
}
|
||||
|
||||
function getWeekNote(dateStr, options = {}) {
|
||||
function getWeekNote(dateStr, options = {}, rootNote = null) {
|
||||
const startOfTheWeek = options.startOfTheWeek || "monday";
|
||||
|
||||
const dateObj = getStartOfTheWeek(dateUtils.parseLocalDate(dateStr), startOfTheWeek);
|
||||
|
||||
dateStr = dateUtils.utcDateTimeStr(dateObj);
|
||||
|
||||
return getDayNote(dateStr);
|
||||
return getDayNote(dateStr, rootNote);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
Reference in New Issue
Block a user