mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
file revisions preview
This commit is contained in:
parent
60ac1a04f4
commit
664485ccd5
@ -400,263 +400,268 @@ parentNoteId</ColNames>
|
|||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
<DefaultExpression>"note"</DefaultExpression>
|
<DefaultExpression>"note"</DefaultExpression>
|
||||||
</column>
|
</column>
|
||||||
<column id="92" parent="12" name="isProtected">
|
<column id="92" parent="12" name="contentLength">
|
||||||
<Position>3</Position>
|
<Position>3</Position>
|
||||||
<DataType>INT|0s</DataType>
|
<DataType>INT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<column id="93" parent="12" name="isProtected">
|
||||||
|
<Position>4</Position>
|
||||||
|
<DataType>INT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
<DefaultExpression>0</DefaultExpression>
|
<DefaultExpression>0</DefaultExpression>
|
||||||
</column>
|
</column>
|
||||||
<column id="93" parent="12" name="type">
|
<column id="94" parent="12" name="type">
|
||||||
<Position>4</Position>
|
<Position>5</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
<DefaultExpression>'text'</DefaultExpression>
|
<DefaultExpression>'text'</DefaultExpression>
|
||||||
</column>
|
</column>
|
||||||
<column id="94" parent="12" name="mime">
|
<column id="95" parent="12" name="mime">
|
||||||
<Position>5</Position>
|
<Position>6</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
<DefaultExpression>'text/html'</DefaultExpression>
|
<DefaultExpression>'text/html'</DefaultExpression>
|
||||||
</column>
|
</column>
|
||||||
<column id="95" parent="12" name="hash">
|
<column id="96" parent="12" name="hash">
|
||||||
<Position>6</Position>
|
<Position>7</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
<DefaultExpression>""</DefaultExpression>
|
<DefaultExpression>""</DefaultExpression>
|
||||||
</column>
|
</column>
|
||||||
<column id="96" parent="12" name="isDeleted">
|
<column id="97" parent="12" name="isDeleted">
|
||||||
<Position>7</Position>
|
|
||||||
<DataType>INT|0s</DataType>
|
|
||||||
<NotNull>1</NotNull>
|
|
||||||
<DefaultExpression>0</DefaultExpression>
|
|
||||||
</column>
|
|
||||||
<column id="97" parent="12" name="isErased">
|
|
||||||
<Position>8</Position>
|
<Position>8</Position>
|
||||||
<DataType>INT|0s</DataType>
|
<DataType>INT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
<DefaultExpression>0</DefaultExpression>
|
<DefaultExpression>0</DefaultExpression>
|
||||||
</column>
|
</column>
|
||||||
<column id="98" parent="12" name="dateCreated">
|
<column id="98" parent="12" name="isErased">
|
||||||
<Position>9</Position>
|
<Position>9</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>INT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
|
<DefaultExpression>0</DefaultExpression>
|
||||||
</column>
|
</column>
|
||||||
<column id="99" parent="12" name="dateModified">
|
<column id="99" parent="12" name="dateCreated">
|
||||||
<Position>10</Position>
|
<Position>10</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="100" parent="12" name="utcDateCreated">
|
<column id="100" parent="12" name="dateModified">
|
||||||
<Position>11</Position>
|
<Position>11</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="101" parent="12" name="utcDateModified">
|
<column id="101" parent="12" name="utcDateCreated">
|
||||||
<Position>12</Position>
|
<Position>12</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<index id="102" parent="12" name="sqlite_autoindex_notes_1">
|
<column id="102" parent="12" name="utcDateModified">
|
||||||
|
<Position>13</Position>
|
||||||
|
<DataType>TEXT|0s</DataType>
|
||||||
|
<NotNull>1</NotNull>
|
||||||
|
</column>
|
||||||
|
<index id="103" parent="12" name="sqlite_autoindex_notes_1">
|
||||||
<NameSurrogate>1</NameSurrogate>
|
<NameSurrogate>1</NameSurrogate>
|
||||||
<ColNames>noteId</ColNames>
|
<ColNames>noteId</ColNames>
|
||||||
<ColumnCollations></ColumnCollations>
|
<ColumnCollations></ColumnCollations>
|
||||||
<Unique>1</Unique>
|
<Unique>1</Unique>
|
||||||
</index>
|
</index>
|
||||||
<index id="103" parent="12" name="IDX_notes_title">
|
<index id="104" parent="12" name="IDX_notes_title">
|
||||||
<ColNames>title</ColNames>
|
<ColNames>title</ColNames>
|
||||||
<ColumnCollations></ColumnCollations>
|
<ColumnCollations></ColumnCollations>
|
||||||
</index>
|
</index>
|
||||||
<index id="104" parent="12" name="IDX_notes_type">
|
<index id="105" parent="12" name="IDX_notes_type">
|
||||||
<ColNames>type</ColNames>
|
<ColNames>type</ColNames>
|
||||||
<ColumnCollations></ColumnCollations>
|
<ColumnCollations></ColumnCollations>
|
||||||
</index>
|
</index>
|
||||||
<index id="105" parent="12" name="IDX_notes_isDeleted">
|
<index id="106" parent="12" name="IDX_notes_isDeleted">
|
||||||
<ColNames>isDeleted</ColNames>
|
<ColNames>isDeleted</ColNames>
|
||||||
<ColumnCollations></ColumnCollations>
|
<ColumnCollations></ColumnCollations>
|
||||||
</index>
|
</index>
|
||||||
<index id="106" parent="12" name="IDX_notes_dateCreated">
|
<index id="107" parent="12" name="IDX_notes_dateCreated">
|
||||||
<ColNames>dateCreated</ColNames>
|
<ColNames>dateCreated</ColNames>
|
||||||
<ColumnCollations></ColumnCollations>
|
<ColumnCollations></ColumnCollations>
|
||||||
</index>
|
</index>
|
||||||
<index id="107" parent="12" name="IDX_notes_dateModified">
|
<index id="108" parent="12" name="IDX_notes_dateModified">
|
||||||
<ColNames>dateModified</ColNames>
|
<ColNames>dateModified</ColNames>
|
||||||
<ColumnCollations></ColumnCollations>
|
<ColumnCollations></ColumnCollations>
|
||||||
</index>
|
</index>
|
||||||
<index id="108" parent="12" name="IDX_notes_utcDateCreated">
|
<index id="109" parent="12" name="IDX_notes_utcDateCreated">
|
||||||
<ColNames>utcDateCreated</ColNames>
|
<ColNames>utcDateCreated</ColNames>
|
||||||
<ColumnCollations></ColumnCollations>
|
<ColumnCollations></ColumnCollations>
|
||||||
</index>
|
</index>
|
||||||
<index id="109" parent="12" name="IDX_notes_utcDateModified">
|
<index id="110" parent="12" name="IDX_notes_utcDateModified">
|
||||||
<ColNames>utcDateModified</ColNames>
|
<ColNames>utcDateModified</ColNames>
|
||||||
<ColumnCollations></ColumnCollations>
|
<ColumnCollations></ColumnCollations>
|
||||||
</index>
|
</index>
|
||||||
<key id="110" parent="12">
|
<key id="111" parent="12">
|
||||||
<ColNames>noteId</ColNames>
|
<ColNames>noteId</ColNames>
|
||||||
<Primary>1</Primary>
|
<Primary>1</Primary>
|
||||||
<UnderlyingIndexName>sqlite_autoindex_notes_1</UnderlyingIndexName>
|
<UnderlyingIndexName>sqlite_autoindex_notes_1</UnderlyingIndexName>
|
||||||
</key>
|
</key>
|
||||||
<column id="111" parent="13" name="name">
|
<column id="112" parent="13" name="name">
|
||||||
<Position>1</Position>
|
<Position>1</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="112" parent="13" name="value">
|
<column id="113" parent="13" name="value">
|
||||||
<Position>2</Position>
|
<Position>2</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
</column>
|
</column>
|
||||||
<column id="113" parent="13" name="isSynced">
|
<column id="114" parent="13" name="isSynced">
|
||||||
<Position>3</Position>
|
<Position>3</Position>
|
||||||
<DataType>INTEGER|0s</DataType>
|
<DataType>INTEGER|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
<DefaultExpression>0</DefaultExpression>
|
<DefaultExpression>0</DefaultExpression>
|
||||||
</column>
|
</column>
|
||||||
<column id="114" parent="13" name="hash">
|
<column id="115" parent="13" name="hash">
|
||||||
<Position>4</Position>
|
<Position>4</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
<DefaultExpression>""</DefaultExpression>
|
<DefaultExpression>""</DefaultExpression>
|
||||||
</column>
|
</column>
|
||||||
<column id="115" parent="13" name="utcDateCreated">
|
<column id="116" parent="13" name="utcDateCreated">
|
||||||
<Position>5</Position>
|
<Position>5</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="116" parent="13" name="utcDateModified">
|
<column id="117" parent="13" name="utcDateModified">
|
||||||
<Position>6</Position>
|
<Position>6</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<index id="117" parent="13" name="sqlite_autoindex_options_1">
|
<index id="118" parent="13" name="sqlite_autoindex_options_1">
|
||||||
<NameSurrogate>1</NameSurrogate>
|
<NameSurrogate>1</NameSurrogate>
|
||||||
<ColNames>name</ColNames>
|
<ColNames>name</ColNames>
|
||||||
<ColumnCollations></ColumnCollations>
|
<ColumnCollations></ColumnCollations>
|
||||||
<Unique>1</Unique>
|
<Unique>1</Unique>
|
||||||
</index>
|
</index>
|
||||||
<key id="118" parent="13">
|
<key id="119" parent="13">
|
||||||
<ColNames>name</ColNames>
|
<ColNames>name</ColNames>
|
||||||
<Primary>1</Primary>
|
<Primary>1</Primary>
|
||||||
<UnderlyingIndexName>sqlite_autoindex_options_1</UnderlyingIndexName>
|
<UnderlyingIndexName>sqlite_autoindex_options_1</UnderlyingIndexName>
|
||||||
</key>
|
</key>
|
||||||
<column id="119" parent="14" name="noteId">
|
<column id="120" parent="14" name="noteId">
|
||||||
<Position>1</Position>
|
<Position>1</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="120" parent="14" name="notePath">
|
<column id="121" parent="14" name="notePath">
|
||||||
<Position>2</Position>
|
<Position>2</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="121" parent="14" name="hash">
|
<column id="122" parent="14" name="hash">
|
||||||
<Position>3</Position>
|
<Position>3</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
<DefaultExpression>""</DefaultExpression>
|
<DefaultExpression>""</DefaultExpression>
|
||||||
</column>
|
</column>
|
||||||
<column id="122" parent="14" name="utcDateCreated">
|
<column id="123" parent="14" name="utcDateCreated">
|
||||||
<Position>4</Position>
|
<Position>4</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="123" parent="14" name="isDeleted">
|
<column id="124" parent="14" name="isDeleted">
|
||||||
<Position>5</Position>
|
<Position>5</Position>
|
||||||
<DataType>INT|0s</DataType>
|
<DataType>INT|0s</DataType>
|
||||||
</column>
|
</column>
|
||||||
<index id="124" parent="14" name="sqlite_autoindex_recent_notes_1">
|
<index id="125" parent="14" name="sqlite_autoindex_recent_notes_1">
|
||||||
<NameSurrogate>1</NameSurrogate>
|
<NameSurrogate>1</NameSurrogate>
|
||||||
<ColNames>noteId</ColNames>
|
<ColNames>noteId</ColNames>
|
||||||
<ColumnCollations></ColumnCollations>
|
<ColumnCollations></ColumnCollations>
|
||||||
<Unique>1</Unique>
|
<Unique>1</Unique>
|
||||||
</index>
|
</index>
|
||||||
<key id="125" parent="14">
|
<key id="126" parent="14">
|
||||||
<ColNames>noteId</ColNames>
|
<ColNames>noteId</ColNames>
|
||||||
<Primary>1</Primary>
|
<Primary>1</Primary>
|
||||||
<UnderlyingIndexName>sqlite_autoindex_recent_notes_1</UnderlyingIndexName>
|
<UnderlyingIndexName>sqlite_autoindex_recent_notes_1</UnderlyingIndexName>
|
||||||
</key>
|
</key>
|
||||||
<column id="126" parent="15" name="sourceId">
|
<column id="127" parent="15" name="sourceId">
|
||||||
<Position>1</Position>
|
<Position>1</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="127" parent="15" name="utcDateCreated">
|
<column id="128" parent="15" name="utcDateCreated">
|
||||||
<Position>2</Position>
|
<Position>2</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<index id="128" parent="15" name="sqlite_autoindex_source_ids_1">
|
<index id="129" parent="15" name="sqlite_autoindex_source_ids_1">
|
||||||
<NameSurrogate>1</NameSurrogate>
|
<NameSurrogate>1</NameSurrogate>
|
||||||
<ColNames>sourceId</ColNames>
|
<ColNames>sourceId</ColNames>
|
||||||
<ColumnCollations></ColumnCollations>
|
<ColumnCollations></ColumnCollations>
|
||||||
<Unique>1</Unique>
|
<Unique>1</Unique>
|
||||||
</index>
|
</index>
|
||||||
<key id="129" parent="15">
|
<key id="130" parent="15">
|
||||||
<ColNames>sourceId</ColNames>
|
<ColNames>sourceId</ColNames>
|
||||||
<Primary>1</Primary>
|
<Primary>1</Primary>
|
||||||
<UnderlyingIndexName>sqlite_autoindex_source_ids_1</UnderlyingIndexName>
|
<UnderlyingIndexName>sqlite_autoindex_source_ids_1</UnderlyingIndexName>
|
||||||
</key>
|
</key>
|
||||||
<column id="130" parent="16" name="type">
|
<column id="131" parent="16" name="type">
|
||||||
<Position>1</Position>
|
<Position>1</Position>
|
||||||
<DataType>text|0s</DataType>
|
<DataType>text|0s</DataType>
|
||||||
</column>
|
</column>
|
||||||
<column id="131" parent="16" name="name">
|
<column id="132" parent="16" name="name">
|
||||||
<Position>2</Position>
|
<Position>2</Position>
|
||||||
<DataType>text|0s</DataType>
|
<DataType>text|0s</DataType>
|
||||||
</column>
|
</column>
|
||||||
<column id="132" parent="16" name="tbl_name">
|
<column id="133" parent="16" name="tbl_name">
|
||||||
<Position>3</Position>
|
<Position>3</Position>
|
||||||
<DataType>text|0s</DataType>
|
<DataType>text|0s</DataType>
|
||||||
</column>
|
</column>
|
||||||
<column id="133" parent="16" name="rootpage">
|
<column id="134" parent="16" name="rootpage">
|
||||||
<Position>4</Position>
|
<Position>4</Position>
|
||||||
<DataType>int|0s</DataType>
|
<DataType>int|0s</DataType>
|
||||||
</column>
|
</column>
|
||||||
<column id="134" parent="16" name="sql">
|
<column id="135" parent="16" name="sql">
|
||||||
<Position>5</Position>
|
<Position>5</Position>
|
||||||
<DataType>text|0s</DataType>
|
<DataType>text|0s</DataType>
|
||||||
</column>
|
</column>
|
||||||
<column id="135" parent="17" name="name">
|
<column id="136" parent="17" name="name">
|
||||||
<Position>1</Position>
|
<Position>1</Position>
|
||||||
</column>
|
</column>
|
||||||
<column id="136" parent="17" name="seq">
|
<column id="137" parent="17" name="seq">
|
||||||
<Position>2</Position>
|
<Position>2</Position>
|
||||||
</column>
|
</column>
|
||||||
<column id="137" parent="18" name="id">
|
<column id="138" parent="18" name="id">
|
||||||
<Position>1</Position>
|
<Position>1</Position>
|
||||||
<DataType>INTEGER|0s</DataType>
|
<DataType>INTEGER|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
<SequenceIdentity>1</SequenceIdentity>
|
<SequenceIdentity>1</SequenceIdentity>
|
||||||
</column>
|
</column>
|
||||||
<column id="138" parent="18" name="entityName">
|
<column id="139" parent="18" name="entityName">
|
||||||
<Position>2</Position>
|
<Position>2</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="139" parent="18" name="entityId">
|
<column id="140" parent="18" name="entityId">
|
||||||
<Position>3</Position>
|
<Position>3</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="140" parent="18" name="sourceId">
|
<column id="141" parent="18" name="sourceId">
|
||||||
<Position>4</Position>
|
<Position>4</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<column id="141" parent="18" name="utcSyncDate">
|
<column id="142" parent="18" name="utcSyncDate">
|
||||||
<Position>5</Position>
|
<Position>5</Position>
|
||||||
<DataType>TEXT|0s</DataType>
|
<DataType>TEXT|0s</DataType>
|
||||||
<NotNull>1</NotNull>
|
<NotNull>1</NotNull>
|
||||||
</column>
|
</column>
|
||||||
<index id="142" parent="18" name="IDX_sync_entityName_entityId">
|
<index id="143" parent="18" name="IDX_sync_entityName_entityId">
|
||||||
<ColNames>entityName
|
<ColNames>entityName
|
||||||
entityId</ColNames>
|
entityId</ColNames>
|
||||||
<ColumnCollations></ColumnCollations>
|
<ColumnCollations></ColumnCollations>
|
||||||
<Unique>1</Unique>
|
<Unique>1</Unique>
|
||||||
</index>
|
</index>
|
||||||
<index id="143" parent="18" name="IDX_sync_utcSyncDate">
|
<index id="144" parent="18" name="IDX_sync_utcSyncDate">
|
||||||
<ColNames>utcSyncDate</ColNames>
|
<ColNames>utcSyncDate</ColNames>
|
||||||
<ColumnCollations></ColumnCollations>
|
<ColumnCollations></ColumnCollations>
|
||||||
</index>
|
</index>
|
||||||
<key id="144" parent="18">
|
<key id="145" parent="18">
|
||||||
<ColNames>id</ColNames>
|
<ColNames>id</ColNames>
|
||||||
<Primary>1</Primary>
|
<Primary>1</Primary>
|
||||||
</key>
|
</key>
|
||||||
|
@ -64,31 +64,41 @@ $list.on('change', async () => {
|
|||||||
|
|
||||||
const fullNoteRevision = await server.get(`notes/${revisionItem.noteId}/revisions/${revisionItem.noteRevisionId}`);
|
const fullNoteRevision = await server.get(`notes/${revisionItem.noteId}/revisions/${revisionItem.noteRevisionId}`);
|
||||||
|
|
||||||
if (note.type === 'text') {
|
if (revisionItem.type === 'text') {
|
||||||
$content.html(fullNoteRevision.content);
|
$content.html(fullNoteRevision.content);
|
||||||
}
|
}
|
||||||
else if (note.type === 'code') {
|
else if (revisionItem.type === 'code') {
|
||||||
$content.html($("<pre>").text(fullNoteRevision.content));
|
$content.html($("<pre>").text(fullNoteRevision.content));
|
||||||
}
|
}
|
||||||
else if (note.type === 'image') {
|
else if (revisionItem.type === 'image') {
|
||||||
$content.html($("<img>")
|
$content.html($("<img>")
|
||||||
// reason why we put this inline as base64 is that we do not want to let user to copy this
|
// reason why we put this inline as base64 is that we do not want to let user to copy this
|
||||||
// as a URL to be used in a note. Instead if they copy and paste it into a note, it will be a uploaded as a new note
|
// as a URL to be used in a note. Instead if they copy and paste it into a note, it will be a uploaded as a new note
|
||||||
.attr("src", `data:${note.mime};base64,` + fullNoteRevision.content)
|
.attr("src", `data:${note.mime};base64,` + fullNoteRevision.content)
|
||||||
.css("width", "100%"));
|
.css("width", "100%"));
|
||||||
}
|
}
|
||||||
else if (note.type === 'file') {
|
else if (revisionItem.type === 'file') {
|
||||||
$content.html(
|
const $table = $("<table cellpadding='10'>")
|
||||||
$("<table cellpadding='10'>")
|
.append($("<tr>").append(
|
||||||
.append($("<tr>").append(
|
$("<th>").text("MIME: "),
|
||||||
$("<th>").text("MIME: "),
|
$("<td>").text(revisionItem.mime)
|
||||||
$("<td>").text(revisionItem.mime)
|
))
|
||||||
))
|
.append($("<tr>").append(
|
||||||
.append($("<tr>").append(
|
$("<th>").text("File size:"),
|
||||||
$("<th>").text("File size:"),
|
$("<td>").text(revisionItem.contentLength + " bytes")
|
||||||
$("<td>").text(revisionItem.contentLength + " bytes")
|
));
|
||||||
))
|
|
||||||
);
|
if (fullNoteRevision.content) {
|
||||||
|
$table.append($("<tr>").append(
|
||||||
|
$("<th>").text("Preview:"),
|
||||||
|
$("<td>").append(
|
||||||
|
$('<pre class="file-preview-content"></pre>')
|
||||||
|
.text(fullNoteRevision.content)
|
||||||
|
)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
$content.html($table);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$content.text("Preview isn't available for this note type.");
|
$content.text("Preview isn't available for this note type.");
|
||||||
|
@ -96,6 +96,8 @@ function getHost() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function download(url) {
|
function download(url) {
|
||||||
|
url += '?' + Date.now(); // don't use cache
|
||||||
|
|
||||||
if (isElectron()) {
|
if (isElectron()) {
|
||||||
const remote = require('electron').remote;
|
const remote = require('electron').remote;
|
||||||
|
|
||||||
@ -227,7 +229,6 @@ export default {
|
|||||||
assertArguments,
|
assertArguments,
|
||||||
escapeHtml,
|
escapeHtml,
|
||||||
stopWatch,
|
stopWatch,
|
||||||
formatValueWithWhitespace,
|
|
||||||
formatLabel,
|
formatLabel,
|
||||||
getHost,
|
getHost,
|
||||||
download,
|
download,
|
||||||
|
@ -19,7 +19,14 @@ async function getNoteRevisions(req) {
|
|||||||
async function getNoteRevision(req) {
|
async function getNoteRevision(req) {
|
||||||
const noteRevision = await repository.getNoteRevision(req.params.noteRevisionId);
|
const noteRevision = await repository.getNoteRevision(req.params.noteRevisionId);
|
||||||
|
|
||||||
if (noteRevision.type !== 'file') {
|
if (noteRevision.type === 'file') {
|
||||||
|
if (noteRevision.isStringNote()) {
|
||||||
|
await noteRevision.getContent();
|
||||||
|
|
||||||
|
noteRevision.content = noteRevision.content.substr(0, 10000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
await noteRevision.getContent();
|
await noteRevision.getContent();
|
||||||
|
|
||||||
if (noteRevision.content && noteRevision.type === 'image') {
|
if (noteRevision.content && noteRevision.type === 'image') {
|
||||||
|
@ -9,8 +9,13 @@ const dateUtils = require('../services/date_utils');
|
|||||||
async function protectNoteRevisions(note) {
|
async function protectNoteRevisions(note) {
|
||||||
for (const revision of await note.getRevisions()) {
|
for (const revision of await note.getRevisions()) {
|
||||||
if (note.isProtected !== revision.isProtected) {
|
if (note.isProtected !== revision.isProtected) {
|
||||||
|
const content = await revision.getContent();
|
||||||
|
|
||||||
revision.isProtected = note.isProtected;
|
revision.isProtected = note.isProtected;
|
||||||
|
|
||||||
|
// this will force de/encryption
|
||||||
|
await revision.setContent(content);
|
||||||
|
|
||||||
await revision.save();
|
await revision.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user