From c102089731883fb5a27e6a343585dce6b445bdf8 Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 14 Jan 2022 19:44:23 +0100 Subject: [PATCH 1/5] migration workaround for corrupted index in entity_changes table, closes #2534 --- .../0187__add_changeId_to_entity_changes.sql | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/db/migrations/0187__add_changeId_to_entity_changes.sql b/db/migrations/0187__add_changeId_to_entity_changes.sql index e2350594b..1fdadbec7 100644 --- a/db/migrations/0187__add_changeId_to_entity_changes.sql +++ b/db/migrations/0187__add_changeId_to_entity_changes.sql @@ -1,13 +1,3 @@ --- delete duplicates https://github.com/zadam/trilium/issues/2534 -DELETE FROM entity_changes WHERE isErased = 0 AND id IN ( - SELECT id FROM entity_changes ec - WHERE ( - SELECT COUNT(*) FROM entity_changes - WHERE ec.entityName = entity_changes.entityName - AND ec.entityId = entity_changes.entityId - ) > 1 -); - CREATE TABLE IF NOT EXISTS "mig_entity_changes" ( `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, `entityName` TEXT NOT NULL, @@ -23,7 +13,17 @@ CREATE TABLE IF NOT EXISTS "mig_entity_changes" ( INSERT INTO mig_entity_changes (id, entityName, entityId, hash, isErased, changeId, sourceId, isSynced, utcDateChanged) SELECT id, entityName, entityId, hash, isErased, '', sourceId, isSynced, utcDateChanged FROM entity_changes; -DROP TABLE entity_changes; +-- delete duplicates https://github.com/zadam/trilium/issues/2534 +DELETE FROM mig_entity_changes WHERE isErased = 0 AND id IN ( + SELECT id FROM mig_entity_changes ec + WHERE ( + SELECT COUNT(*) FROM mig_entity_changes + WHERE ec.entityName = mig_entity_changes.entityName + AND ec.entityId = mig_entity_changes.entityId + ) > 1 +); + +DROP TABLE entity_changes; ALTER TABLE mig_entity_changes RENAME TO entity_changes; From 1c34f73f615d3283cd0b2bd83fd0abdcb70d5574 Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 14 Jan 2022 21:02:11 +0100 Subject: [PATCH 2/5] print should include promoted attributes, #2550 (cherry picked from commit a5444fd6ad8e7af62799146acb85bee9f43231a0) --- src/public/app/widgets/note_detail.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/public/app/widgets/note_detail.js b/src/public/app/widgets/note_detail.js index e951fbbdc..77fd1919f 100644 --- a/src/public/app/widgets/note_detail.js +++ b/src/public/app/widgets/note_detail.js @@ -21,6 +21,7 @@ import ReadOnlyCodeTypeWidget from "./type_widgets/read_only_code.js"; import NoneTypeWidget from "./type_widgets/none.js"; import attributeService from "../services/attributes.js"; import NoteMapTypeWidget from "./type_widgets/note_map.js"; +import attributeRenderer from "../services/attribute_renderer.js"; const TPL = `
@@ -136,6 +137,15 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { this.child(typeWidget); } + + this.checkFullHeight(); + } + + checkFullHeight() { + // https://github.com/zadam/trilium/issues/2522 + this.$widget.toggleClass("full-height", + !this.noteContext.hasNoteList() + && ['editable-text', 'editable-code'].includes(this.type)); } getTypeWidget() { @@ -209,8 +219,17 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { await libraryLoader.requireLibrary(libraryLoader.PRINT_THIS); + let $promotedAttributes = $(""); + + if (this.note.getPromotedDefinitionAttributes().length > 0) { + $promotedAttributes = (await attributeRenderer.renderNormalAttributes(this.note)).$renderedAttributes; + } + this.$widget.find('.note-detail-printable:visible').printThis({ - header: $("

").text(this.note && this.note.title).prop('outerHTML'), + header: $("
") + .append($("

").text(this.note.title)) + .append($promotedAttributes) + .prop('outerHTML'), footer: ` From 8240a208dda7d9f260b3f214bad30488218bd1b6 Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 14 Jan 2022 21:05:39 +0100 Subject: [PATCH 3/5] fixed wrong cherry pick --- src/public/app/widgets/note_detail.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/public/app/widgets/note_detail.js b/src/public/app/widgets/note_detail.js index 77fd1919f..09cb2a925 100644 --- a/src/public/app/widgets/note_detail.js +++ b/src/public/app/widgets/note_detail.js @@ -137,15 +137,6 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { this.child(typeWidget); } - - this.checkFullHeight(); - } - - checkFullHeight() { - // https://github.com/zadam/trilium/issues/2522 - this.$widget.toggleClass("full-height", - !this.noteContext.hasNoteList() - && ['editable-text', 'editable-code'].includes(this.type)); } getTypeWidget() { From 77c6c4617b634226e12ead172482fe1fe92bc360 Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 14 Jan 2022 21:23:10 +0100 Subject: [PATCH 4/5] changed shared_info class names to avoid conflict with adblocker, closes #2546 --- src/public/app/widgets/shared_info.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/public/app/widgets/shared_info.js b/src/public/app/widgets/shared_info.js index d0aef4b20..6a830f8b6 100644 --- a/src/public/app/widgets/shared_info.js +++ b/src/public/app/widgets/shared_info.js @@ -13,7 +13,7 @@ const TPL = ` } - . For help visit wiki. + . For help visit wiki.

`; export default class SharedInfoWidget extends NoteContextAwareWidget { @@ -23,8 +23,8 @@ export default class SharedInfoWidget extends NoteContextAwareWidget { doRender() { this.$widget = $(TPL); - this.$shareLink = this.$widget.find(".share-link"); - this.$shareText = this.$widget.find(".share-text"); + this.$sharedLink = this.$widget.find(".shared-link"); + this.$sharedText = this.$widget.find(".shared-text"); this.contentSized(); } @@ -36,14 +36,14 @@ export default class SharedInfoWidget extends NoteContextAwareWidget { if (syncServerHost) { link = syncServerHost + "/share/" + shareId; - this.$shareText.text("This note is shared publicly on"); + this.$sharedText.text("This note is shared publicly on"); } else { link = location.protocol + '//' + location.host + location.pathname + "share/" + shareId; - this.$shareText.text("This note is shared locally on"); + this.$sharedText.text("This note is shared locally on"); } - this.$shareLink.attr("href", link).text(link); + this.$sharedLink.attr("href", link).text(link); } entitiesReloadedEvent({loadResults}) { From b679f4218d4bd1a4ffe419d037ef9715b5144740 Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 14 Jan 2022 21:40:37 +0100 Subject: [PATCH 5/5] release 0.49.5 --- package.json | 2 +- src/services/build.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 2ec348adb..93e0f158f 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "trilium", "productName": "Trilium Notes", "description": "Trilium Notes", - "version": "0.49.4", + "version": "0.49.5", "license": "AGPL-3.0-only", "main": "electron.js", "bin": { diff --git a/src/services/build.js b/src/services/build.js index 380750302..fe7d20395 100644 --- a/src/services/build.js +++ b/src/services/build.js @@ -1 +1 @@ -module.exports = { buildDate:"2022-01-09T22:32:13+01:00", buildRevision: "be59f248e8387c268471946da99979939c8d2c1d" }; +module.exports = { buildDate:"2022-01-14T21:40:37+01:00", buildRevision: "77c6c4617b634226e12ead172482fe1fe92bc360" };