Compare commits

...

17 Commits

Author SHA1 Message Date
zadam
a717ee00fb release 0.40.6 2020-03-15 11:21:43 +01:00
zadam
f5e27278ab fix migration script to preserve sync IDs 2020-03-15 11:19:30 +01:00
zadam
20c24e26cc added entity constructors for "content" tables 2020-03-14 21:09:07 +01:00
zadam
3bafc396fc fix consistency checks 2020-03-14 13:13:27 +01:00
zadam
3fa3e912a4 not sending ping to clients after every sync addition, only after commit which significantly speeds up imports 2020-03-14 12:39:55 +01:00
zadam
44219e7ccc do not load the note content during ENEX import again since it's already available 2020-03-13 22:23:44 +01:00
zadam
5b67854cbe clear history in the code mirror after setting a value, closes #766 2020-03-10 22:48:21 +01:00
zadam
c6d912dcb7 sync only changes with isSynced = true 2020-03-09 21:34:03 +01:00
zadam
da53c1eaa8 updated schema.sql 2020-03-09 21:23:11 +01:00
zadam
73bf2dcb02 added isSynced to sync table to allow forward compatibility with 0.41 2020-03-09 20:56:43 +01:00
zadam
719f10981e fix sync 2020-03-08 22:00:12 +01:00
zadam
deb67d6275 release 0.40.5 2020-03-08 21:05:52 +01:00
zadam
e4039ea5e1 fixed printing relation map 2020-03-08 09:24:03 +01:00
zadam
78a50be663 don't print control buttons 2020-03-07 22:18:12 +01:00
zadam
3d3ad3b99b include themes.css for printing to have default CSS variables available 2020-03-07 22:14:07 +01:00
zadam
0d9cdcac85 load appropriate styles for printing book notes, closes #899 2020-03-07 22:01:34 +01:00
zadam
350331e2ef fix 500px constant height of relation maps, closes #882 2020-02-28 15:20:54 +01:00
27 changed files with 172 additions and 152 deletions

View File

@@ -57,7 +57,6 @@
<index id="24" parent="6" name="sqlite_autoindex_api_tokens_1"> <index id="24" parent="6" name="sqlite_autoindex_api_tokens_1">
<NameSurrogate>1</NameSurrogate> <NameSurrogate>1</NameSurrogate>
<ColNames>apiTokenId</ColNames> <ColNames>apiTokenId</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique> <Unique>1</Unique>
</index> </index>
<key id="25" parent="6"> <key id="25" parent="6">
@@ -131,21 +130,17 @@
<index id="38" parent="7" name="sqlite_autoindex_attributes_1"> <index id="38" parent="7" name="sqlite_autoindex_attributes_1">
<NameSurrogate>1</NameSurrogate> <NameSurrogate>1</NameSurrogate>
<ColNames>attributeId</ColNames> <ColNames>attributeId</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique> <Unique>1</Unique>
</index> </index>
<index id="39" parent="7" name="IDX_attributes_noteId_index"> <index id="39" parent="7" name="IDX_attributes_noteId_index">
<ColNames>noteId</ColNames> <ColNames>noteId</ColNames>
<ColumnCollations></ColumnCollations>
</index> </index>
<index id="40" parent="7" name="IDX_attributes_name_value"> <index id="40" parent="7" name="IDX_attributes_name_value">
<ColNames>name <ColNames>name
value</ColNames> value</ColNames>
<ColumnCollations></ColumnCollations>
</index> </index>
<index id="41" parent="7" name="IDX_attributes_value_index"> <index id="41" parent="7" name="IDX_attributes_value_index">
<ColNames>value</ColNames> <ColNames>value</ColNames>
<ColumnCollations></ColumnCollations>
</index> </index>
<key id="42" parent="7"> <key id="42" parent="7">
<ColNames>attributeId</ColNames> <ColNames>attributeId</ColNames>
@@ -212,17 +207,14 @@ value</ColNames>
<index id="54" parent="8" name="sqlite_autoindex_branches_1"> <index id="54" parent="8" name="sqlite_autoindex_branches_1">
<NameSurrogate>1</NameSurrogate> <NameSurrogate>1</NameSurrogate>
<ColNames>branchId</ColNames> <ColNames>branchId</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique> <Unique>1</Unique>
</index> </index>
<index id="55" parent="8" name="IDX_branches_noteId_parentNoteId"> <index id="55" parent="8" name="IDX_branches_noteId_parentNoteId">
<ColNames>noteId <ColNames>noteId
parentNoteId</ColNames> parentNoteId</ColNames>
<ColumnCollations></ColumnCollations>
</index> </index>
<index id="56" parent="8" name="IDX_branches_parentNoteId"> <index id="56" parent="8" name="IDX_branches_parentNoteId">
<ColNames>parentNoteId</ColNames> <ColNames>parentNoteId</ColNames>
<ColumnCollations></ColumnCollations>
</index> </index>
<key id="57" parent="8"> <key id="57" parent="8">
<ColNames>branchId</ColNames> <ColNames>branchId</ColNames>
@@ -253,7 +245,6 @@ parentNoteId</ColNames>
<index id="62" parent="9" name="sqlite_autoindex_note_contents_1"> <index id="62" parent="9" name="sqlite_autoindex_note_contents_1">
<NameSurrogate>1</NameSurrogate> <NameSurrogate>1</NameSurrogate>
<ColNames>noteId</ColNames> <ColNames>noteId</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique> <Unique>1</Unique>
</index> </index>
<key id="63" parent="9"> <key id="63" parent="9">
@@ -284,7 +275,6 @@ parentNoteId</ColNames>
<index id="68" parent="10" name="sqlite_autoindex_note_revision_contents_1"> <index id="68" parent="10" name="sqlite_autoindex_note_revision_contents_1">
<NameSurrogate>1</NameSurrogate> <NameSurrogate>1</NameSurrogate>
<ColNames>noteRevisionId</ColNames> <ColNames>noteRevisionId</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique> <Unique>1</Unique>
</index> </index>
<key id="69" parent="10"> <key id="69" parent="10">
@@ -369,28 +359,22 @@ parentNoteId</ColNames>
<index id="84" parent="11" name="sqlite_autoindex_note_revisions_1"> <index id="84" parent="11" name="sqlite_autoindex_note_revisions_1">
<NameSurrogate>1</NameSurrogate> <NameSurrogate>1</NameSurrogate>
<ColNames>noteRevisionId</ColNames> <ColNames>noteRevisionId</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique> <Unique>1</Unique>
</index> </index>
<index id="85" parent="11" name="IDX_note_revisions_noteId"> <index id="85" parent="11" name="IDX_note_revisions_noteId">
<ColNames>noteId</ColNames> <ColNames>noteId</ColNames>
<ColumnCollations></ColumnCollations>
</index> </index>
<index id="86" parent="11" name="IDX_note_revisions_utcDateLastEdited"> <index id="86" parent="11" name="IDX_note_revisions_utcDateLastEdited">
<ColNames>utcDateLastEdited</ColNames> <ColNames>utcDateLastEdited</ColNames>
<ColumnCollations></ColumnCollations>
</index> </index>
<index id="87" parent="11" name="IDX_note_revisions_utcDateCreated"> <index id="87" parent="11" name="IDX_note_revisions_utcDateCreated">
<ColNames>utcDateCreated</ColNames> <ColNames>utcDateCreated</ColNames>
<ColumnCollations></ColumnCollations>
</index> </index>
<index id="88" parent="11" name="IDX_note_revisions_dateLastEdited"> <index id="88" parent="11" name="IDX_note_revisions_dateLastEdited">
<ColNames>dateLastEdited</ColNames> <ColNames>dateLastEdited</ColNames>
<ColumnCollations></ColumnCollations>
</index> </index>
<index id="89" parent="11" name="IDX_note_revisions_dateCreated"> <index id="89" parent="11" name="IDX_note_revisions_dateCreated">
<ColNames>dateCreated</ColNames> <ColNames>dateCreated</ColNames>
<ColumnCollations></ColumnCollations>
</index> </index>
<key id="90" parent="11"> <key id="90" parent="11">
<ColNames>noteRevisionId</ColNames> <ColNames>noteRevisionId</ColNames>
@@ -477,36 +461,28 @@ parentNoteId</ColNames>
<index id="105" parent="12" name="sqlite_autoindex_notes_1"> <index id="105" parent="12" name="sqlite_autoindex_notes_1">
<NameSurrogate>1</NameSurrogate> <NameSurrogate>1</NameSurrogate>
<ColNames>noteId</ColNames> <ColNames>noteId</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique> <Unique>1</Unique>
</index> </index>
<index id="106" parent="12" name="IDX_notes_title"> <index id="106" parent="12" name="IDX_notes_title">
<ColNames>title</ColNames> <ColNames>title</ColNames>
<ColumnCollations></ColumnCollations>
</index> </index>
<index id="107" parent="12" name="IDX_notes_type"> <index id="107" parent="12" name="IDX_notes_type">
<ColNames>type</ColNames> <ColNames>type</ColNames>
<ColumnCollations></ColumnCollations>
</index> </index>
<index id="108" parent="12" name="IDX_notes_isDeleted"> <index id="108" parent="12" name="IDX_notes_isDeleted">
<ColNames>isDeleted</ColNames> <ColNames>isDeleted</ColNames>
<ColumnCollations></ColumnCollations>
</index> </index>
<index id="109" parent="12" name="IDX_notes_dateCreated"> <index id="109" parent="12" name="IDX_notes_dateCreated">
<ColNames>dateCreated</ColNames> <ColNames>dateCreated</ColNames>
<ColumnCollations></ColumnCollations>
</index> </index>
<index id="110" parent="12" name="IDX_notes_dateModified"> <index id="110" parent="12" name="IDX_notes_dateModified">
<ColNames>dateModified</ColNames> <ColNames>dateModified</ColNames>
<ColumnCollations></ColumnCollations>
</index> </index>
<index id="111" parent="12" name="IDX_notes_utcDateCreated"> <index id="111" parent="12" name="IDX_notes_utcDateCreated">
<ColNames>utcDateCreated</ColNames> <ColNames>utcDateCreated</ColNames>
<ColumnCollations></ColumnCollations>
</index> </index>
<index id="112" parent="12" name="IDX_notes_utcDateModified"> <index id="112" parent="12" name="IDX_notes_utcDateModified">
<ColNames>utcDateModified</ColNames> <ColNames>utcDateModified</ColNames>
<ColumnCollations></ColumnCollations>
</index> </index>
<key id="113" parent="12"> <key id="113" parent="12">
<ColNames>noteId</ColNames> <ColNames>noteId</ColNames>
@@ -547,7 +523,6 @@ parentNoteId</ColNames>
<index id="120" parent="13" name="sqlite_autoindex_options_1"> <index id="120" parent="13" name="sqlite_autoindex_options_1">
<NameSurrogate>1</NameSurrogate> <NameSurrogate>1</NameSurrogate>
<ColNames>name</ColNames> <ColNames>name</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique> <Unique>1</Unique>
</index> </index>
<key id="121" parent="13"> <key id="121" parent="13">
@@ -583,7 +558,6 @@ parentNoteId</ColNames>
<index id="127" parent="14" name="sqlite_autoindex_recent_notes_1"> <index id="127" parent="14" name="sqlite_autoindex_recent_notes_1">
<NameSurrogate>1</NameSurrogate> <NameSurrogate>1</NameSurrogate>
<ColNames>noteId</ColNames> <ColNames>noteId</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique> <Unique>1</Unique>
</index> </index>
<key id="128" parent="14"> <key id="128" parent="14">
@@ -604,12 +578,10 @@ parentNoteId</ColNames>
<index id="131" parent="15" name="sqlite_autoindex_source_ids_1"> <index id="131" parent="15" name="sqlite_autoindex_source_ids_1">
<NameSurrogate>1</NameSurrogate> <NameSurrogate>1</NameSurrogate>
<ColNames>sourceId</ColNames> <ColNames>sourceId</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique> <Unique>1</Unique>
</index> </index>
<index id="132" parent="15" name="IDX_source_ids_utcDateCreated"> <index id="132" parent="15" name="IDX_source_ids_utcDateCreated">
<ColNames>utcDateCreated</ColNames> <ColNames>utcDateCreated</ColNames>
<ColumnCollations></ColumnCollations>
</index> </index>
<key id="133" parent="15"> <key id="133" parent="15">
<ColNames>sourceId</ColNames> <ColNames>sourceId</ColNames>
@@ -663,22 +635,26 @@ parentNoteId</ColNames>
<DataType>TEXT|0s</DataType> <DataType>TEXT|0s</DataType>
<NotNull>1</NotNull> <NotNull>1</NotNull>
</column> </column>
<column id="145" parent="18" name="utcSyncDate"> <column id="145" parent="18" name="isSynced">
<Position>5</Position> <Position>5</Position>
<DataType>INTEGER|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>0</DefaultExpression>
</column>
<column id="146" parent="18" name="utcSyncDate">
<Position>6</Position>
<DataType>TEXT|0s</DataType> <DataType>TEXT|0s</DataType>
<NotNull>1</NotNull> <NotNull>1</NotNull>
</column> </column>
<index id="146" parent="18" name="IDX_sync_entityName_entityId"> <index id="147" parent="18" name="IDX_sync_entityName_entityId">
<ColNames>entityName <ColNames>entityName
entityId</ColNames> entityId</ColNames>
<ColumnCollations></ColumnCollations>
<Unique>1</Unique> <Unique>1</Unique>
</index> </index>
<index id="147" parent="18" name="IDX_sync_utcSyncDate"> <index id="148" parent="18" name="IDX_sync_utcSyncDate">
<ColNames>utcSyncDate</ColNames> <ColNames>utcSyncDate</ColNames>
<ColumnCollations></ColumnCollations>
</index> </index>
<key id="148" parent="18"> <key id="149" parent="18">
<ColNames>id</ColNames> <ColNames>id</ColNames>
<Primary>1</Primary> <Primary>1</Primary>
</key> </key>

View File

@@ -0,0 +1,22 @@
CREATE TABLE IF NOT EXISTS "sync_mig" (
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
`entityName` TEXT NOT NULL,
`entityId` TEXT NOT NULL,
`sourceId` TEXT NOT NULL,
`isSynced` INTEGER default 0 not null,
`utcSyncDate` TEXT NOT NULL);
INSERT INTO sync_mig (id, entityName, entityId, sourceId, isSynced, utcSyncDate)
SELECT id, entityName, entityId, sourceId, 1, utcSyncDate FROM sync;
DROP TABLE sync;
ALTER TABLE sync_mig RENAME TO sync;
CREATE UNIQUE INDEX `IDX_sync_entityName_entityId` ON `sync` (
`entityName`,
`entityId`
);
CREATE INDEX `IDX_sync_utcSyncDate` ON `sync` (
`utcSyncDate`
);

View File

@@ -1,16 +1,8 @@
CREATE TABLE IF NOT EXISTS "sync" (
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
`entityName` TEXT NOT NULL,
`entityId` TEXT NOT NULL,
`sourceId` TEXT NOT NULL,
`utcSyncDate` TEXT NOT NULL);
CREATE TABLE IF NOT EXISTS "source_ids" ( CREATE TABLE IF NOT EXISTS "source_ids" (
`sourceId` TEXT NOT NULL, `sourceId` TEXT NOT NULL,
`utcDateCreated` TEXT NOT NULL, `utcDateCreated` TEXT NOT NULL,
PRIMARY KEY(`sourceId`) PRIMARY KEY(`sourceId`)
); );
CREATE INDEX IDX_source_ids_utcDateCreated
on source_ids (utcDateCreated);
CREATE TABLE IF NOT EXISTS "api_tokens" CREATE TABLE IF NOT EXISTS "api_tokens"
( (
apiTokenId TEXT PRIMARY KEY NOT NULL, apiTokenId TEXT PRIMARY KEY NOT NULL,
@@ -27,13 +19,6 @@ CREATE TABLE IF NOT EXISTS "options"
utcDateCreated TEXT not null, utcDateCreated TEXT not null,
utcDateModified TEXT NOT NULL utcDateModified TEXT NOT NULL
); );
CREATE UNIQUE INDEX `IDX_sync_entityName_entityId` ON `sync` (
`entityName`,
`entityId`
);
CREATE INDEX `IDX_sync_utcSyncDate` ON `sync` (
`utcSyncDate`
);
CREATE TABLE IF NOT EXISTS "note_contents" ( CREATE TABLE IF NOT EXISTS "note_contents" (
`noteId` TEXT NOT NULL, `noteId` TEXT NOT NULL,
`content` TEXT NULL DEFAULT NULL, `content` TEXT NULL DEFAULT NULL,
@@ -72,6 +57,8 @@ CREATE INDEX `IDX_note_revisions_utcDateCreated` ON `note_revisions` (`utcDateCr
CREATE INDEX `IDX_note_revisions_utcDateLastEdited` ON `note_revisions` (`utcDateLastEdited`); CREATE INDEX `IDX_note_revisions_utcDateLastEdited` ON `note_revisions` (`utcDateLastEdited`);
CREATE INDEX `IDX_note_revisions_dateCreated` ON `note_revisions` (`dateCreated`); CREATE INDEX `IDX_note_revisions_dateCreated` ON `note_revisions` (`dateCreated`);
CREATE INDEX `IDX_note_revisions_dateLastEdited` ON `note_revisions` (`dateLastEdited`); CREATE INDEX `IDX_note_revisions_dateLastEdited` ON `note_revisions` (`dateLastEdited`);
CREATE INDEX IDX_source_ids_utcDateCreated
on source_ids (utcDateCreated);
CREATE TABLE IF NOT EXISTS "notes" ( CREATE TABLE IF NOT EXISTS "notes" (
`noteId` TEXT NOT NULL, `noteId` TEXT NOT NULL,
`title` TEXT NOT NULL DEFAULT "note", `title` TEXT NOT NULL DEFAULT "note",
@@ -130,3 +117,17 @@ CREATE INDEX IDX_attributes_noteId_index
on attributes (noteId); on attributes (noteId);
CREATE INDEX IDX_attributes_value_index CREATE INDEX IDX_attributes_value_index
on attributes (value); on attributes (value);
CREATE TABLE IF NOT EXISTS "sync" (
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
`entityName` TEXT NOT NULL,
`entityId` TEXT NOT NULL,
`sourceId` TEXT NOT NULL,
`isSynced` INTEGER default 0 not null,
`utcSyncDate` TEXT NOT NULL);
CREATE UNIQUE INDEX `IDX_sync_entityName_entityId` ON `sync` (
`entityName`,
`entityId`
);
CREATE INDEX `IDX_sync_utcSyncDate` ON `sync` (
`utcSyncDate`
);

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{ {
"name": "trilium", "name": "trilium",
"version": "0.40.3", "version": "0.40.4",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@@ -2,7 +2,7 @@
"name": "trilium", "name": "trilium",
"productName": "Trilium Notes", "productName": "Trilium Notes",
"description": "Trilium Notes", "description": "Trilium Notes",
"version": "0.40.4", "version": "0.40.6",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"main": "electron.js", "main": "electron.js",
"bin": { "bin": {

View File

@@ -11,7 +11,9 @@ const ENTITY_NAME_TO_ENTITY = {
"attributes": Attribute, "attributes": Attribute,
"branches": Branch, "branches": Branch,
"notes": Note, "notes": Note,
"note_contents": Note,
"note_revisions": NoteRevision, "note_revisions": NoteRevision,
"note_revision_contents": NoteRevision,
"recent_notes": RecentNote, "recent_notes": RecentNote,
"options": Option, "options": Option,
"api_tokens": ApiToken, "api_tokens": ApiToken,

View File

@@ -161,7 +161,13 @@ async function printActiveNote() {
importCSS: false, importCSS: false,
loadCSS: [ loadCSS: [
"libraries/codemirror/codemirror.css", "libraries/codemirror/codemirror.css",
"libraries/ckeditor/ckeditor-content.css" "libraries/ckeditor/ckeditor-content.css",
"libraries/ckeditor/ckeditor-content.css",
"libraries/bootstrap/css/bootstrap.min.css",
"stylesheets/print.css",
"stylesheets/relation_map.css",
"stylesheets/themes.css",
"stylesheets/detail.css"
], ],
debug: true debug: true
}); });

View File

@@ -148,8 +148,8 @@ class NoteDetailBook {
const label = `${childCount} child${childCount > 1 ? 'ren' : ''}`; const label = `${childCount} child${childCount > 1 ? 'ren' : ''}`;
$card.append($('<div class="note-book-children">') $card.append($('<div class="note-book-children">')
.append($(`<a class="note-book-open-children-button" href="javascript:">+ Show ${label}</a>`)) .append($(`<a class="note-book-open-children-button no-print" href="javascript:">+ Show ${label}</a>`))
.append($(`<a class="note-book-hide-children-button" href="javascript:">- Hide ${label}</a>`).hide()) .append($(`<a class="note-book-hide-children-button no-print" href="javascript:">- Hide ${label}</a>`).hide())
.append($('<div class="note-book-children-content">')) .append($('<div class="note-book-children-content">'))
); );
} }

View File

@@ -60,6 +60,7 @@ class NoteDetailCode {
// 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 consistency check)
// we provide fallback // we provide fallback
this.codeEditor.setValue(this.ctx.note.content || ""); this.codeEditor.setValue(this.ctx.note.content || "");
this.codeEditor.clearHistory();
const info = CodeMirror.findModeByMIME(this.ctx.note.mime); const info = CodeMirror.findModeByMIME(this.ctx.note.mime);

View File

@@ -43,6 +43,7 @@ body {
min-height: 0; min-height: 0;
padding-left: 10px; padding-left: 10px;
width: 100%; width: 100%;
height: 100%;
} }
#search-box { #search-box {

View File

@@ -0,0 +1,69 @@
.note-detail-book {
height: 100%;
}
.note-detail-book-content {
display: flex;
flex-wrap: wrap;
overflow: auto;
height: 100%;
align-content: start;
}
.note-book-card {
border-radius: 10px;
background-color: var(--accented-background-color);
padding: 15px;
padding-bottom: 5px;
margin: 5px;
margin-left: 0;
overflow: hidden;
display: flex;
flex-direction: column;
flex-shrink: 0;
}
.note-book-card .note-book-card {
border: 1px solid var(--main-border-color);
}
.note-book-content {
overflow: hidden;
}
.note-book-card.type-image .note-book-content, .note-book-card.type-file .note-book-content, .note-book-card.type-protected-session .note-book-content {
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}
.note-book-card.type-image .note-book-content img, .note-book-card.type-text .note-book-content img {
max-width: 100%;
max-height: 100%;
}
.note-book-title {
flex-grow: 0;
}
.note-book-content {
flex-grow: 1;
}
.note-book-auto-message {
background-color: var(--accented-background-color);
text-align: center;
width: 100%;
border-radius: 10px;
padding: 5px;
margin-top: 5px;
}
.note-detail-image {
text-align: center;
}
.note-detail-image-view {
max-width: 100%;
}

View File

@@ -0,0 +1,11 @@
@media print
{
.no-print, .no-print *
{
display: none !important;
}
.relation-map-wrapper {
height: 100vh !important;
}
}

View File

@@ -518,14 +518,6 @@ button.icon-button {
padding: 5px; padding: 5px;
} }
.note-detail-image {
text-align: center;
}
.note-detail-image-view {
max-width: 100%;
}
pre:not(.CodeMirror-line) { pre:not(.CodeMirror-line) {
color: var(--main-text-color) !important; color: var(--main-text-color) !important;
white-space: pre-wrap; white-space: pre-wrap;
@@ -857,68 +849,6 @@ a.external:not(.no-arrow):after, a[href^="http://"]:not(.no-arrow):after, a[href
z-index: 100; z-index: 100;
} }
.note-detail-book {
height: 100%;
}
.note-detail-book-content {
display: flex;
flex-wrap: wrap;
overflow: auto;
height: 100%;
align-content: start;
}
.note-book-card {
border-radius: 10px;
background-color: var(--accented-background-color);
padding: 15px;
padding-bottom: 5px;
margin: 5px;
margin-left: 0;
overflow: hidden;
display: flex;
flex-direction: column;
flex-shrink: 0;
}
.note-book-card .note-book-card {
border: 1px solid var(--main-border-color);
}
.note-book-content {
overflow: hidden;
}
.note-book-card.type-image .note-book-content, .note-book-card.type-file .note-book-content, .note-book-card.type-protected-session .note-book-content {
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}
.note-book-card.type-image .note-book-content img, .note-book-card.type-text .note-book-content img {
max-width: 100%;
max-height: 100%;
}
.note-book-title {
flex-grow: 0;
}
.note-book-content {
flex-grow: 1;
}
.note-book-auto-message {
background-color: var(--accented-background-color);
text-align: center;
width: 100%;
border-radius: 10px;
padding: 5px;
margin-top: 5px;
}
#toast-container { #toast-container {
position: absolute; position: absolute;
width: 100%; width: 100%;

View File

@@ -1,9 +1,9 @@
"use strict"; "use strict";
const app_info = require('../../services/app_info'); const appInfo = require('../../services/app_info');
async function getAppInfo() { async function getAppInfo() {
return app_info; return appInfo;
} }
module.exports = { module.exports = {

View File

@@ -49,7 +49,7 @@ async function loginSync(req) {
return { return {
sourceId: sourceIdService.getCurrentSourceId(), sourceId: sourceIdService.getCurrentSourceId(),
maxSyncId: await sql.getValue("SELECT MAX(id) FROM sync") maxSyncId: await sql.getValue("SELECT MAX(id) FROM sync WHERE isSynced = 1")
}; };
} }

View File

@@ -50,7 +50,7 @@ async function getStats() {
async function checkSync() { async function checkSync() {
return { return {
entityHashes: await contentHashService.getEntityHashes(), entityHashes: await contentHashService.getEntityHashes(),
maxSyncId: await sql.getValue('SELECT MAX(id) FROM sync') maxSyncId: await sql.getValue('SELECT MAX(id) FROM sync WHERE isSynced = 1')
}; };
} }
@@ -116,11 +116,11 @@ async function forceNoteSync(req) {
async function getChanged(req) { async function getChanged(req) {
const lastSyncId = parseInt(req.query.lastSyncId); const lastSyncId = parseInt(req.query.lastSyncId);
const syncs = await sql.getRows("SELECT * FROM sync WHERE id > ? LIMIT 1000", [lastSyncId]); const syncs = await sql.getRows("SELECT * FROM sync WHERE isSynced = 1 AND id > ? LIMIT 1000", [lastSyncId]);
return { return {
syncs: await syncService.getSyncRecords(syncs), syncs: await syncService.getSyncRecords(syncs),
maxSyncId: await sql.getValue('SELECT MAX(id) FROM sync') maxSyncId: await sql.getValue('SELECT MAX(id) FROM sync WHERE isSynced = 1')
}; };
} }

View File

@@ -4,7 +4,7 @@ const build = require('./build');
const packageJson = require('../../package'); const packageJson = require('../../package');
const {TRILIUM_DATA_DIR} = require('./data_dir'); const {TRILIUM_DATA_DIR} = require('./data_dir');
const APP_DB_VERSION = 157; const APP_DB_VERSION = 158;
const SYNC_VERSION = 14; const SYNC_VERSION = 14;
const CLIPPER_PROTOCOL_VERSION = "1.0"; const CLIPPER_PROTOCOL_VERSION = "1.0";

View File

@@ -1 +1 @@
module.exports = { buildDate:"2020-02-24T22:59:22+01:00", buildRevision: "fb55cdaea6b1367129e11118b8b6fd2eadebad5f" }; module.exports = { buildDate:"2020-03-15T11:21:43+01:00", buildRevision: "f5e27278ab2a38484019ee2510781099b60ec2b6" };

View File

@@ -51,7 +51,7 @@ class ConsistencyChecks {
childToParents[childNoteId].push(parentNoteId); childToParents[childNoteId].push(parentNoteId);
} }
function checkTreeCycle(noteId, path) { const checkTreeCycle = (noteId, path) => {
if (noteId === 'root') { if (noteId === 'root') {
return; return;
} }
@@ -75,7 +75,7 @@ class ConsistencyChecks {
checkTreeCycle(parentNoteId, newPath); checkTreeCycle(parentNoteId, newPath);
} }
} }
} };
const noteIds = Object.keys(childToParents); const noteIds = Object.keys(childToParents);
@@ -546,7 +546,7 @@ class ConsistencyChecks {
${entityName} ${entityName}
LEFT JOIN sync ON sync.entityName = '${entityName}' AND entityId = ${key} LEFT JOIN sync ON sync.entityName = '${entityName}' AND entityId = ${key}
WHERE WHERE
sync.id IS NULL AND ` + (entityName === 'options' ? 'isSynced = 1' : '1'), sync.id IS NULL AND ` + (entityName === 'options' ? 'options.isSynced = 1' : '1'),
async ({entityId}) => { async ({entityId}) => {
if (this.autoFix) { if (this.autoFix) {
await syncTableService.addEntitySync(entityName, entityId); await syncTableService.addEntitySync(entityName, entityId);

View File

@@ -235,8 +235,6 @@ async function importEnex(taskContext, file, parentNote) {
taskContext.increaseProgressCount(); taskContext.increaseProgressCount();
let noteContent = await noteEntity.getContent();
for (const resource of resources) { for (const resource of resources) {
const hash = utils.md5(resource.content); const hash = utils.md5(resource.content);
@@ -268,7 +266,7 @@ async function importEnex(taskContext, file, parentNote) {
const resourceLink = `<a href="#root/${resourceNote.noteId}">${utils.escapeHtml(resource.title)}</a>`; const resourceLink = `<a href="#root/${resourceNote.noteId}">${utils.escapeHtml(resource.title)}</a>`;
noteContent = noteContent.replace(mediaRegex, resourceLink); content = content.replace(mediaRegex, resourceLink);
}; };
if (["image/jpeg", "image/png", "image/gif", "image/webp"].includes(resource.mime)) { if (["image/jpeg", "image/png", "image/gif", "image/webp"].includes(resource.mime)) {
@@ -281,12 +279,12 @@ async function importEnex(taskContext, file, parentNote) {
const imageLink = `<img src="${url}">`; const imageLink = `<img src="${url}">`;
noteContent = noteContent.replace(mediaRegex, imageLink); content = content.replace(mediaRegex, imageLink);
if (!noteContent.includes(imageLink)) { if (!content.includes(imageLink)) {
// if there wasn't any match for the reference, we'll add the image anyway // if there wasn't any match for the reference, we'll add the image anyway
// otherwise image would be removed since no note would include it // otherwise image would be removed since no note would include it
noteContent += imageLink; content += imageLink;
} }
} catch (e) { } catch (e) {
log.error("error when saving image from ENEX file: " + e); log.error("error when saving image from ENEX file: " + e);
@@ -298,7 +296,7 @@ async function importEnex(taskContext, file, parentNote) {
} }
// save updated content with links to files/images // save updated content with links to files/images
await noteEntity.setContent(noteContent); await noteEntity.setContent(content);
await noteService.scanForLinks(noteEntity.noteId); await noteService.scanForLinks(noteEntity.noteId);

View File

@@ -209,6 +209,8 @@ async function transactional(func) {
transactionActive = false; transactionActive = false;
resolve(); resolve();
setTimeout(() => require('./ws').sendPingToAllClients(), 50);
} }
catch (e) { catch (e) {
if (transactionActive) { if (transactionActive) {

View File

@@ -176,7 +176,7 @@ async function pushSync(syncContext) {
let lastSyncedPush = await getLastSyncedPush(); let lastSyncedPush = await getLastSyncedPush();
while (true) { while (true) {
const syncs = await sql.getRows('SELECT * FROM sync WHERE id > ? LIMIT 1000', [lastSyncedPush]); const syncs = await sql.getRows('SELECT * FROM sync WHERE isSynced = 1 AND id > ? LIMIT 1000', [lastSyncedPush]);
if (syncs.length === 0) { if (syncs.length === 0) {
log.info("Nothing to push"); log.info("Nothing to push");
@@ -236,7 +236,7 @@ async function checkContentHash(syncContext) {
return true; return true;
} }
const notPushedSyncs = await sql.getValue("SELECT EXISTS(SELECT 1 FROM sync WHERE id > ?)", [await getLastSyncedPush()]); const notPushedSyncs = await sql.getValue("SELECT EXISTS(SELECT 1 FROM sync WHERE isSynced = 1 AND id > ?)", [await getLastSyncedPush()]);
if (notPushedSyncs) { if (notPushedSyncs) {
log.info(`There's ${notPushedSyncs} outstanding pushes, skipping content check.`); log.info(`There's ${notPushedSyncs} outstanding pushes, skipping content check.`);
@@ -353,7 +353,7 @@ async function updatePushStats() {
if (await syncOptions.isSyncSetup()) { if (await syncOptions.isSyncSetup()) {
const lastSyncedPush = await optionService.getOption('lastSyncedPush'); const lastSyncedPush = await optionService.getOption('lastSyncedPush');
stats.outstandingPushes = await sql.getValue("SELECT COUNT(1) FROM sync WHERE id > ?", [lastSyncedPush]); stats.outstandingPushes = await sql.getValue("SELECT COUNT(1) FROM sync WHERE isSynced = 1 AND id > ?", [lastSyncedPush]);
} }
} }

View File

@@ -11,7 +11,8 @@ async function insertEntitySync(entityName, entityId, sourceId) {
entityName: entityName, entityName: entityName,
entityId: entityId, entityId: entityId,
utcSyncDate: dateUtils.utcNowDateTime(), utcSyncDate: dateUtils.utcNowDateTime(),
sourceId: sourceId || cls.getSourceId() || sourceIdService.getCurrentSourceId() sourceId: sourceId || cls.getSourceId() || sourceIdService.getCurrentSourceId(),
isSynced: 1
}; };
sync.id = await sql.replace("sync", sync); sync.id = await sql.replace("sync", sync);
@@ -23,8 +24,6 @@ async function addEntitySync(entityName, entityId, sourceId) {
const sync = await insertEntitySync(entityName, entityId, sourceId); const sync = await insertEntitySync(entityName, entityId, sourceId);
syncs.push(sync); syncs.push(sync);
setTimeout(() => require('./ws').sendPingToAllClients(), 50);
} }
async function addEntitySyncsForSector(entityName, entityPrimaryKey, sector) { async function addEntitySyncsForSector(entityName, entityPrimaryKey, sector) {

View File

@@ -250,6 +250,7 @@
<link href="stylesheets/themes.css" rel="stylesheet"> <link href="stylesheets/themes.css" rel="stylesheet">
<link href="stylesheets/style.css" rel="stylesheet"> <link href="stylesheets/style.css" rel="stylesheet">
<link href="stylesheets/detail.css" rel="stylesheet">
<link href="stylesheets/desktop.css" rel="stylesheet"> <link href="stylesheets/desktop.css" rel="stylesheet">
<script src="javascripts/desktop.js" crossorigin type="module"></script> <script src="javascripts/desktop.js" crossorigin type="module"></script>

View File

@@ -1,5 +1,5 @@
<div class="note-detail-image note-detail-component"> <div class="note-detail-image note-detail-component">
<div style="display: flex; justify-content: space-evenly; margin: 10px;"> <div class="no-print" style="display: flex; justify-content: space-evenly; margin: 10px;">
<button class="image-download btn btn-sm btn-primary" type="button">Download</button> <button class="image-download btn btn-sm btn-primary" type="button">Download</button>
<button class="image-copy-to-clipboard btn btn-sm btn-primary" type="button">Copy to clipboard</button> <button class="image-copy-to-clipboard btn btn-sm btn-primary" type="button">Copy to clipboard</button>

View File

@@ -1,5 +1,5 @@
<div class="note-detail-relation-map note-detail-component"> <div class="note-detail-relation-map note-detail-component">
<button class="relation-map-create-child-note btn btn-sm floating-button" type="button" <button class="relation-map-create-child-note btn btn-sm floating-button no-print" type="button"
title="Create new child note and add it into this relation map"> title="Create new child note and add it into this relation map">
<span class="bx bx-folder-plus"></span> <span class="bx bx-folder-plus"></span>
@@ -7,11 +7,11 @@
</button> </button>
<button type="button" <button type="button"
class="relation-map-reset-pan-zoom btn icon-button floating-button bx bx-crop" class="relation-map-reset-pan-zoom btn icon-button floating-button bx bx-crop no-print"
title="Reset pan & zoom to initial coordinates and magnification" title="Reset pan & zoom to initial coordinates and magnification"
style="right: 70px;"></button> style="right: 70px;"></button>
<div class="btn-group floating-button" style="right: 10px;"> <div class="btn-group floating-button no-print" style="right: 10px;">
<button type="button" <button type="button"
class="relation-map-zoom-in btn icon-button bx bx-zoom-in" class="relation-map-zoom-in btn icon-button bx bx-zoom-in"
title="Zoom In"></button> title="Zoom In"></button>

View File

@@ -118,6 +118,7 @@
<link href="stylesheets/themes.css" rel="stylesheet"> <link href="stylesheets/themes.css" rel="stylesheet">
<link href="stylesheets/style.css" rel="stylesheet"> <link href="stylesheets/style.css" rel="stylesheet">
<link href="stylesheets/detail.css" rel="stylesheet">
<link href="stylesheets/mobile.css" rel="stylesheet"> <link href="stylesheets/mobile.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="libraries/boxicons/css/boxicons.min.css"> <link rel="stylesheet" type="text/css" href="libraries/boxicons/css/boxicons.min.css">