event fixes WIP

This commit is contained in:
zadam 2020-03-06 22:17:07 +01:00
parent 26599f057c
commit e10d23289e
18 changed files with 359 additions and 1239 deletions

View File

@ -10,647 +10,5 @@
<collation id="3" parent="1" name="BINARY"/> <collation id="3" parent="1" name="BINARY"/>
<collation id="4" parent="1" name="NOCASE"/> <collation id="4" parent="1" name="NOCASE"/>
<collation id="5" parent="1" name="RTRIM"/> <collation id="5" parent="1" name="RTRIM"/>
<table id="6" parent="2" name="api_tokens"/>
<table id="7" parent="2" name="attributes"/>
<table id="8" parent="2" name="branches"/>
<table id="9" parent="2" name="note_contents"/>
<table id="10" parent="2" name="note_revision_contents"/>
<table id="11" parent="2" name="note_revisions"/>
<table id="12" parent="2" name="notes"/>
<table id="13" parent="2" name="options"/>
<table id="14" parent="2" name="recent_notes"/>
<table id="15" parent="2" name="source_ids"/>
<table id="16" parent="2" name="sqlite_master">
<System>1</System>
</table>
<table id="17" parent="2" name="sqlite_sequence">
<System>1</System>
</table>
<table id="18" parent="2" name="sync"/>
<column id="19" parent="6" name="apiTokenId">
<Position>1</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="20" parent="6" name="token">
<Position>2</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="21" parent="6" name="utcDateCreated">
<Position>3</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="22" parent="6" name="isDeleted">
<Position>4</Position>
<DataType>INT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>0</DefaultExpression>
</column>
<column id="23" parent="6" name="hash">
<Position>5</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>&quot;&quot;</DefaultExpression>
</column>
<index id="24" parent="6" name="sqlite_autoindex_api_tokens_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>apiTokenId</ColNames>
<Unique>1</Unique>
</index>
<key id="25" parent="6">
<ColNames>apiTokenId</ColNames>
<Primary>1</Primary>
<UnderlyingIndexName>sqlite_autoindex_api_tokens_1</UnderlyingIndexName>
</key>
<column id="26" parent="7" name="attributeId">
<Position>1</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="27" parent="7" name="noteId">
<Position>2</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="28" parent="7" name="type">
<Position>3</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="29" parent="7" name="name">
<Position>4</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="30" parent="7" name="value">
<Position>5</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>&apos;&apos;</DefaultExpression>
</column>
<column id="31" parent="7" name="position">
<Position>6</Position>
<DataType>INT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>0</DefaultExpression>
</column>
<column id="32" parent="7" name="utcDateCreated">
<Position>7</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="33" parent="7" name="utcDateModified">
<Position>8</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="34" parent="7" name="isDeleted">
<Position>9</Position>
<DataType>INT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="35" parent="7" name="deleteId">
<Position>10</Position>
<DataType>TEXT|0s</DataType>
<DefaultExpression>NULL</DefaultExpression>
</column>
<column id="36" parent="7" name="hash">
<Position>11</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>&quot;&quot;</DefaultExpression>
</column>
<column id="37" parent="7" name="isInheritable">
<Position>12</Position>
<DataType>int|0s</DataType>
<DefaultExpression>0</DefaultExpression>
</column>
<index id="38" parent="7" name="sqlite_autoindex_attributes_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>attributeId</ColNames>
<Unique>1</Unique>
</index>
<index id="39" parent="7" name="IDX_attributes_noteId_index">
<ColNames>noteId</ColNames>
</index>
<index id="40" parent="7" name="IDX_attributes_name_value">
<ColNames>name
value</ColNames>
</index>
<index id="41" parent="7" name="IDX_attributes_value_index">
<ColNames>value</ColNames>
</index>
<key id="42" parent="7">
<ColNames>attributeId</ColNames>
<Primary>1</Primary>
<UnderlyingIndexName>sqlite_autoindex_attributes_1</UnderlyingIndexName>
</key>
<column id="43" parent="8" name="branchId">
<Position>1</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="44" parent="8" name="noteId">
<Position>2</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="45" parent="8" name="parentNoteId">
<Position>3</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="46" parent="8" name="notePosition">
<Position>4</Position>
<DataType>INTEGER|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="47" parent="8" name="prefix">
<Position>5</Position>
<DataType>TEXT|0s</DataType>
</column>
<column id="48" parent="8" name="isExpanded">
<Position>6</Position>
<DataType>INTEGER|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>0</DefaultExpression>
</column>
<column id="49" parent="8" name="isDeleted">
<Position>7</Position>
<DataType>INTEGER|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>0</DefaultExpression>
</column>
<column id="50" parent="8" name="deleteId">
<Position>8</Position>
<DataType>TEXT|0s</DataType>
<DefaultExpression>NULL</DefaultExpression>
</column>
<column id="51" parent="8" name="utcDateModified">
<Position>9</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="52" parent="8" name="utcDateCreated">
<Position>10</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="53" parent="8" name="hash">
<Position>11</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>&quot;&quot;</DefaultExpression>
</column>
<index id="54" parent="8" name="sqlite_autoindex_branches_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>branchId</ColNames>
<Unique>1</Unique>
</index>
<index id="55" parent="8" name="IDX_branches_noteId_parentNoteId">
<ColNames>noteId
parentNoteId</ColNames>
</index>
<index id="56" parent="8" name="IDX_branches_parentNoteId">
<ColNames>parentNoteId</ColNames>
</index>
<key id="57" parent="8">
<ColNames>branchId</ColNames>
<Primary>1</Primary>
<UnderlyingIndexName>sqlite_autoindex_branches_1</UnderlyingIndexName>
</key>
<column id="58" parent="9" name="noteId">
<Position>1</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="59" parent="9" name="content">
<Position>2</Position>
<DataType>TEXT|0s</DataType>
<DefaultExpression>NULL</DefaultExpression>
</column>
<column id="60" parent="9" name="hash">
<Position>3</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>&quot;&quot;</DefaultExpression>
</column>
<column id="61" parent="9" name="utcDateModified">
<Position>4</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<index id="62" parent="9" name="sqlite_autoindex_note_contents_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>noteId</ColNames>
<Unique>1</Unique>
</index>
<key id="63" parent="9">
<ColNames>noteId</ColNames>
<Primary>1</Primary>
<UnderlyingIndexName>sqlite_autoindex_note_contents_1</UnderlyingIndexName>
</key>
<column id="64" parent="10" name="noteRevisionId">
<Position>1</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="65" parent="10" name="content">
<Position>2</Position>
<DataType>TEXT|0s</DataType>
</column>
<column id="66" parent="10" name="hash">
<Position>3</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>&apos;&apos;</DefaultExpression>
</column>
<column id="67" parent="10" name="utcDateModified">
<Position>4</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<index id="68" parent="10" name="sqlite_autoindex_note_revision_contents_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>noteRevisionId</ColNames>
<Unique>1</Unique>
</index>
<key id="69" parent="10">
<ColNames>noteRevisionId</ColNames>
<Primary>1</Primary>
<UnderlyingIndexName>sqlite_autoindex_note_revision_contents_1</UnderlyingIndexName>
</key>
<column id="70" parent="11" name="noteRevisionId">
<Position>1</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="71" parent="11" name="noteId">
<Position>2</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="72" parent="11" name="title">
<Position>3</Position>
<DataType>TEXT|0s</DataType>
</column>
<column id="73" parent="11" name="contentLength">
<Position>4</Position>
<DataType>INT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="74" parent="11" name="isErased">
<Position>5</Position>
<DataType>INT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>0</DefaultExpression>
</column>
<column id="75" parent="11" name="isProtected">
<Position>6</Position>
<DataType>INT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>0</DefaultExpression>
</column>
<column id="76" parent="11" name="utcDateLastEdited">
<Position>7</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="77" parent="11" name="utcDateCreated">
<Position>8</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="78" parent="11" name="utcDateModified">
<Position>9</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="79" parent="11" name="dateLastEdited">
<Position>10</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="80" parent="11" name="dateCreated">
<Position>11</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="81" parent="11" name="type">
<Position>12</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>&apos;&apos;</DefaultExpression>
</column>
<column id="82" parent="11" name="mime">
<Position>13</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>&apos;&apos;</DefaultExpression>
</column>
<column id="83" parent="11" name="hash">
<Position>14</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>&apos;&apos;</DefaultExpression>
</column>
<index id="84" parent="11" name="sqlite_autoindex_note_revisions_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>noteRevisionId</ColNames>
<Unique>1</Unique>
</index>
<index id="85" parent="11" name="IDX_note_revisions_noteId">
<ColNames>noteId</ColNames>
</index>
<index id="86" parent="11" name="IDX_note_revisions_utcDateLastEdited">
<ColNames>utcDateLastEdited</ColNames>
</index>
<index id="87" parent="11" name="IDX_note_revisions_utcDateCreated">
<ColNames>utcDateCreated</ColNames>
</index>
<index id="88" parent="11" name="IDX_note_revisions_dateLastEdited">
<ColNames>dateLastEdited</ColNames>
</index>
<index id="89" parent="11" name="IDX_note_revisions_dateCreated">
<ColNames>dateCreated</ColNames>
</index>
<key id="90" parent="11">
<ColNames>noteRevisionId</ColNames>
<Primary>1</Primary>
<UnderlyingIndexName>sqlite_autoindex_note_revisions_1</UnderlyingIndexName>
</key>
<column id="91" parent="12" name="noteId">
<Position>1</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="92" parent="12" name="title">
<Position>2</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>&quot;note&quot;</DefaultExpression>
</column>
<column id="93" parent="12" name="contentLength">
<Position>3</Position>
<DataType>INT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="94" parent="12" name="isProtected">
<Position>4</Position>
<DataType>INT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>0</DefaultExpression>
</column>
<column id="95" parent="12" name="type">
<Position>5</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>&apos;text&apos;</DefaultExpression>
</column>
<column id="96" parent="12" name="mime">
<Position>6</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>&apos;text/html&apos;</DefaultExpression>
</column>
<column id="97" parent="12" name="hash">
<Position>7</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>&quot;&quot;</DefaultExpression>
</column>
<column id="98" parent="12" name="isDeleted">
<Position>8</Position>
<DataType>INT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>0</DefaultExpression>
</column>
<column id="99" parent="12" name="deleteId">
<Position>9</Position>
<DataType>TEXT|0s</DataType>
<DefaultExpression>NULL</DefaultExpression>
</column>
<column id="100" parent="12" name="isErased">
<Position>10</Position>
<DataType>INT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>0</DefaultExpression>
</column>
<column id="101" parent="12" name="dateCreated">
<Position>11</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="102" parent="12" name="dateModified">
<Position>12</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="103" parent="12" name="utcDateCreated">
<Position>13</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="104" parent="12" name="utcDateModified">
<Position>14</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<index id="105" parent="12" name="sqlite_autoindex_notes_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>noteId</ColNames>
<Unique>1</Unique>
</index>
<index id="106" parent="12" name="IDX_notes_title">
<ColNames>title</ColNames>
</index>
<index id="107" parent="12" name="IDX_notes_type">
<ColNames>type</ColNames>
</index>
<index id="108" parent="12" name="IDX_notes_isDeleted">
<ColNames>isDeleted</ColNames>
</index>
<index id="109" parent="12" name="IDX_notes_dateCreated">
<ColNames>dateCreated</ColNames>
</index>
<index id="110" parent="12" name="IDX_notes_dateModified">
<ColNames>dateModified</ColNames>
</index>
<index id="111" parent="12" name="IDX_notes_utcDateCreated">
<ColNames>utcDateCreated</ColNames>
</index>
<index id="112" parent="12" name="IDX_notes_utcDateModified">
<ColNames>utcDateModified</ColNames>
</index>
<key id="113" parent="12">
<ColNames>noteId</ColNames>
<Primary>1</Primary>
<UnderlyingIndexName>sqlite_autoindex_notes_1</UnderlyingIndexName>
</key>
<column id="114" parent="13" name="name">
<Position>1</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="115" parent="13" name="value">
<Position>2</Position>
<DataType>TEXT|0s</DataType>
</column>
<column id="116" parent="13" name="isSynced">
<Position>3</Position>
<DataType>INTEGER|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>0</DefaultExpression>
</column>
<column id="117" parent="13" name="hash">
<Position>4</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>&quot;&quot;</DefaultExpression>
</column>
<column id="118" parent="13" name="utcDateCreated">
<Position>5</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="119" parent="13" name="utcDateModified">
<Position>6</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<index id="120" parent="13" name="sqlite_autoindex_options_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>name</ColNames>
<Unique>1</Unique>
</index>
<key id="121" parent="13">
<ColNames>name</ColNames>
<Primary>1</Primary>
<UnderlyingIndexName>sqlite_autoindex_options_1</UnderlyingIndexName>
</key>
<column id="122" parent="14" name="noteId">
<Position>1</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="123" parent="14" name="notePath">
<Position>2</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="124" parent="14" name="hash">
<Position>3</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
<DefaultExpression>&quot;&quot;</DefaultExpression>
</column>
<column id="125" parent="14" name="utcDateCreated">
<Position>4</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="126" parent="14" name="isDeleted">
<Position>5</Position>
<DataType>INT|0s</DataType>
</column>
<index id="127" parent="14" name="sqlite_autoindex_recent_notes_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>noteId</ColNames>
<Unique>1</Unique>
</index>
<key id="128" parent="14">
<ColNames>noteId</ColNames>
<Primary>1</Primary>
<UnderlyingIndexName>sqlite_autoindex_recent_notes_1</UnderlyingIndexName>
</key>
<column id="129" parent="15" name="sourceId">
<Position>1</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="130" parent="15" name="utcDateCreated">
<Position>2</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<index id="131" parent="15" name="sqlite_autoindex_source_ids_1">
<NameSurrogate>1</NameSurrogate>
<ColNames>sourceId</ColNames>
<Unique>1</Unique>
</index>
<index id="132" parent="15" name="IDX_source_ids_utcDateCreated">
<ColNames>utcDateCreated</ColNames>
</index>
<key id="133" parent="15">
<ColNames>sourceId</ColNames>
<Primary>1</Primary>
<UnderlyingIndexName>sqlite_autoindex_source_ids_1</UnderlyingIndexName>
</key>
<column id="134" parent="16" name="type">
<Position>1</Position>
<DataType>text|0s</DataType>
</column>
<column id="135" parent="16" name="name">
<Position>2</Position>
<DataType>text|0s</DataType>
</column>
<column id="136" parent="16" name="tbl_name">
<Position>3</Position>
<DataType>text|0s</DataType>
</column>
<column id="137" parent="16" name="rootpage">
<Position>4</Position>
<DataType>int|0s</DataType>
</column>
<column id="138" parent="16" name="sql">
<Position>5</Position>
<DataType>text|0s</DataType>
</column>
<column id="139" parent="17" name="name">
<Position>1</Position>
</column>
<column id="140" parent="17" name="seq">
<Position>2</Position>
</column>
<column id="141" parent="18" name="id">
<Position>1</Position>
<DataType>INTEGER|0s</DataType>
<NotNull>1</NotNull>
<SequenceIdentity>1</SequenceIdentity>
</column>
<column id="142" parent="18" name="entityName">
<Position>2</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="143" parent="18" name="entityId">
<Position>3</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="144" parent="18" name="sourceId">
<Position>4</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<column id="145" parent="18" name="utcSyncDate">
<Position>5</Position>
<DataType>TEXT|0s</DataType>
<NotNull>1</NotNull>
</column>
<index id="146" parent="18" name="IDX_sync_entityName_entityId">
<ColNames>entityName
entityId</ColNames>
<Unique>1</Unique>
</index>
<index id="147" parent="18" name="IDX_sync_utcSyncDate">
<ColNames>utcSyncDate</ColNames>
</index>
<key id="148" parent="18">
<ColNames>id</ColNames>
<Primary>1</Primary>
</key>
</database-model> </database-model>
</dataSource> </dataSource>

773
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -49,7 +49,7 @@
"imagemin-mozjpeg": "8.0.0", "imagemin-mozjpeg": "8.0.0",
"imagemin-pngquant": "8.0.0", "imagemin-pngquant": "8.0.0",
"ini": "1.3.5", "ini": "1.3.5",
"jimp": "0.9.3", "jimp": "0.9.5",
"mime-types": "2.1.26", "mime-types": "2.1.26",
"multer": "1.4.2", "multer": "1.4.2",
"node-abi": "2.15.0", "node-abi": "2.15.0",
@ -67,15 +67,15 @@
"sqlite": "3.0.3", "sqlite": "3.0.3",
"sqlite3": "4.1.1", "sqlite3": "4.1.1",
"string-similarity": "4.0.1", "string-similarity": "4.0.1",
"tar-stream": "2.1.0", "tar-stream": "2.1.1",
"turndown": "5.0.3", "turndown": "5.0.3",
"turndown-plugin-gfm": "1.0.2", "turndown-plugin-gfm": "1.0.2",
"unescape": "1.0.1", "unescape": "1.0.1",
"ws": "7.2.1" "ws": "7.2.1"
}, },
"devDependencies": { "devDependencies": {
"electron": "9.0.0-beta.4", "electron": "9.0.0-beta.6",
"electron-builder": "22.3.2", "electron-builder": "22.4.0",
"electron-packager": "14.2.1", "electron-packager": "14.2.1",
"electron-rebuild": "1.10.0", "electron-rebuild": "1.10.0",
"jsdoc": "3.6.3", "jsdoc": "3.6.3",

View File

@ -1,7 +1,6 @@
import treeService from '../services/tree.js'; import treeService from '../services/tree.js';
import noteAutocompleteService from "../services/note_autocomplete.js"; import noteAutocompleteService from "../services/note_autocomplete.js";
import utils from "../services/utils.js"; import utils from "../services/utils.js";
import appContext from "../services/app_context.js";
const $dialog = $("#add-link-dialog"); const $dialog = $("#add-link-dialog");
const $form = $("#add-link-form"); const $form = $("#add-link-form");

View File

@ -181,7 +181,7 @@ export default class TabManager extends Component {
const tabContext = new TabContext(tabId); const tabContext = new TabContext(tabId);
this.child(tabContext); this.child(tabContext);
await this.triggerEvent('newTabOpened', {tabId: tabContext.tabId}); await this.triggerEvent('newTabOpened', {tabContext});
return tabContext; return tabContext;
} }

View File

@ -47,7 +47,7 @@ class BasicWidget extends Component {
$widget.addClass('component') $widget.addClass('component')
.prop('component', this); .prop('component', this);
this.toggle(this.isEnabled()); this.toggleInt(this.isEnabled());
if (this.cssEl) { if (this.cssEl) {
const css = this.cssEl.trim().startsWith('<style>') ? this.cssEl : `<style>${this.cssEl}</style>`; const css = this.cssEl.trim().startsWith('<style>') ? this.cssEl : `<style>${this.cssEl}</style>`;
@ -75,8 +75,12 @@ class BasicWidget extends Component {
*/ */
doRender() {} doRender() {}
toggle(show) { toggleInt(show) {
this.$widget.toggle(show); this.$widget.toggleClass('hidden-int', !show);
}
toggleExt(show) {
this.$widget.toggleClass('hidden-ext', !show);
} }
isVisible() { isVisible() {

View File

@ -41,8 +41,9 @@ export default class CollapsibleWidget extends TabAwareWidget {
this.$bodyWrapper.collapse("show"); this.$bodyWrapper.collapse("show");
} }
this.$bodyWrapper.on('hidden.bs.collapse', () => options.save(widgetName + 'Collapsed', 'true')); // using immediate variants of the event so that the previous collapse is not caught
this.$bodyWrapper.on('shown.bs.collapse', () => options.save(widgetName + 'Collapsed', 'false')); this.$bodyWrapper.on('hide.bs.collapse', () => options.save(widgetName + 'Collapsed', 'true'));
this.$bodyWrapper.on('show.bs.collapse', () => options.save(widgetName + 'Collapsed', 'false'));
this.$body = this.$bodyWrapper.find('.card-body'); this.$body = this.$bodyWrapper.find('.card-body');

View File

@ -59,6 +59,10 @@ export default class NoteDetailWidget extends TabAwareWidget {
}); });
} }
isEnabled() {
return true;
}
doRender() { doRender() {
this.$widget = $(TPL); this.$widget = $(TPL);
@ -89,18 +93,7 @@ export default class NoteDetailWidget extends TabAwareWidget {
return this.$widget; return this.$widget;
} }
isEnabled() {
return this.tabContext && this.tabContext.isActive();
}
async refresh() { async refresh() {
if (!this.isEnabled()) {
this.toggle(false);
return;
}
this.toggle(true);
this.type = await this.getWidgetType(); this.type = await this.getWidgetType();
this.mime = this.note ? this.note.mime : null; this.mime = this.note ? this.note.mime : null;
@ -130,7 +123,7 @@ export default class NoteDetailWidget extends TabAwareWidget {
setupClasses() { setupClasses() {
for (const clazz of Array.from(this.$widget[0].classList)) { // create copy to safely iterate over while removing classes for (const clazz of Array.from(this.$widget[0].classList)) { // create copy to safely iterate over while removing classes
if (clazz !== 'note-detail') { if (clazz !== 'note-detail' && !clazz.startsWith('hidden-')) {
this.$widget.removeClass(clazz); this.$widget.removeClass(clazz);
} }
} }
@ -156,14 +149,16 @@ export default class NoteDetailWidget extends TabAwareWidget {
} }
async getWidgetType() { async getWidgetType() {
if (!this.note) { const note = this.note;
if (!note) {
return "empty"; return "empty";
} }
let type = this.note.type; let type = note.type;
if (type === 'text' && !this.tabContext.autoBookDisabled if (type === 'text' && !this.tabContext.autoBookDisabled
&& this.note.hasChildren() && note.hasChildren()
&& utils.isDesktop()) { && utils.isDesktop()) {
const noteComplement = await this.tabContext.getNoteComplement(); const noteComplement = await this.tabContext.getNoteComplement();
@ -173,7 +168,7 @@ export default class NoteDetailWidget extends TabAwareWidget {
} }
} }
if (this.note.isProtected && !protectedSessionHolder.isProtectedSessionAvailable()) { if (note.isProtected && !protectedSessionHolder.isProtectedSessionAvailable()) {
type = 'protected-session'; type = 'protected-session';
} }

View File

@ -425,7 +425,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
} }
async refresh() { async refresh() {
this.toggle(this.isEnabled()); this.toggleInt(this.isEnabled());
const oldActiveNode = this.getActiveNode(); const oldActiveNode = this.getActiveNode();

View File

@ -79,10 +79,10 @@ export default class PromotedAttributesWidget extends TabAwareWidget {
// 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) // (previously we saw promoted attributes doubling)
this.$container.empty().append($tbody); this.$container.empty().append($tbody);
this.toggle(true); this.toggleInt(true);
} }
else { else {
this.toggle(false); this.toggleInt(false);
} }
return attributes; return attributes;

View File

@ -170,7 +170,7 @@ export default class SearchBoxWidget extends BasicWidget {
searchInSubtreeEvent({noteId}) { searchInSubtreeEvent({noteId}) {
noteId = noteId || appContext.tabManager.getActiveTabNoteId(); noteId = noteId || appContext.tabManager.getActiveTabNoteId();
this.toggle(true); this.toggleInt(true);
this.$searchInput.val(`@in=${noteId} @text*=*`); this.$searchInput.val(`@in=${noteId} @text*=*`);
} }

View File

@ -34,13 +34,13 @@ export default class SearchResultsWidget extends BasicWidget {
this.$searchResults = this.$widget; this.$searchResults = this.$widget;
this.$searchResultsInner = this.$widget.find(".search-results-list"); this.$searchResultsInner = this.$widget.find(".search-results-list");
this.toggle(false); this.toggleInt(false);
return this.$widget; return this.$widget;
} }
searchResultsEvent({results}) { searchResultsEvent({results}) {
this.toggle(true); this.toggleInt(true);
this.$searchResultsInner.empty(); this.$searchResultsInner.empty();
this.$searchResults.show(); this.$searchResults.show();

View File

@ -2,11 +2,6 @@ import BasicWidget from "./basic_widget.js";
import appContext from "../services/app_context.js"; import appContext from "../services/app_context.js";
export default class TabAwareWidget extends BasicWidget { export default class TabAwareWidget extends BasicWidget {
setTabContextEvent({tabContext}) {
/** @var {TabContext} */
this.tabContext = tabContext;
}
isTab(tabId) { isTab(tabId) {
return this.tabContext && this.tabContext.tabId === tabId; return this.tabContext && this.tabContext.tabId === tabId;
} }
@ -27,36 +22,15 @@ export default class TabAwareWidget extends BasicWidget {
return this.tabContext && this.tabContext.notePath; return this.tabContext && this.tabContext.notePath;
} }
async tabNoteSwitchedEvent({tabId, notePath}) {
// if notePath does not match then the tabContext has been switched to another note in the mean time
if (this.isTab(tabId) && this.notePath === notePath) {
await this.noteSwitched();
}
}
async noteTypeMimeChangedEvent({noteId}) {
if (this.noteId === noteId) {
await this.refresh();
}
}
async noteSwitched() {
await this.refresh();
}
async activeTabChanged() {
await this.refresh();
}
isEnabled() { isEnabled() {
return !!this.note && this.tabContext.isActive(); return !!this.note;
} }
async refresh() { async refresh() {
if (this.isEnabled()) { if (this.isEnabled()) {
const start = Date.now(); const start = Date.now();
this.toggle(true); this.toggleInt(true);
await this.refreshWithNote(this.note, this.notePath); await this.refreshWithNote(this.note, this.notePath);
const end = Date.now(); const end = Date.now();
@ -66,29 +40,55 @@ export default class TabAwareWidget extends BasicWidget {
} }
} }
else { else {
this.toggle(false); this.toggleInt(false);
} }
} }
async refreshWithNote(note, notePath) {} async refreshWithNote(note, notePath) {}
async tabNoteSwitchedEvent({tabId, notePath}) {
// if notePath does not match then the tabContext has been switched to another note in the mean time
if (this.notePath === notePath) {
await this.noteSwitched();
}
}
async noteSwitched() {
await this.refresh();
}
async activeTabChangedEvent({tabId}) { async activeTabChangedEvent({tabId}) {
this.tabContext = appContext.tabManager.getTabContextById(tabId); this.tabContext = appContext.tabManager.getTabContextById(tabId);
if (this.tabContext.tabId === appContext.tabManager.getActiveTabContext().tabId) {
await this.activeTabChanged(); await this.activeTabChanged();
} }
async activeTabChanged() {
await this.refresh();
} }
// when note is both switched and activated, this should not produce double refresh // when note is both switched and activated, this should not produce double refresh
async tabNoteSwitchedAndActivatedEvent({tabId, notePath}) { async tabNoteSwitchedAndActivatedEvent({tabId, notePath}) {
this.tabContext = appContext.tabManager.getTabContextById(tabId); this.tabContext = appContext.tabManager.getTabContextById(tabId);
if (this.tabContext.tabId === appContext.tabManager.getActiveTabContext().tabId // if notePath does not match then the tabContext has been switched to another note in the mean time
&& this.notePath === notePath) { if (this.notePath === notePath) {
await this.refresh();
}
}
this.tabContext = appContext.tabManager.getActiveTabContext(); setTabContextEvent({tabContext}) {
/** @var {TabContext} */
this.tabContext = tabContext;
}
async newTabOpenedEvent({tabContext}) {
/** @var {TabContext} */
this.tabContext = tabContext;
}
async noteTypeMimeChangedEvent({noteId}) {
if (this.isNote(noteId)) {
await this.refresh(); await this.refresh();
} }
} }

View File

@ -1,6 +1,5 @@
import TabAwareWidget from "./tab_aware_widget.js"; import TabAwareWidget from "./tab_aware_widget.js";
import keyboardActionsService from "../services/keyboard_actions.js"; import keyboardActionsService from "../services/keyboard_actions.js";
import appContext from "../services/app_context.js";
export default class TabCachingWidget extends TabAwareWidget { export default class TabCachingWidget extends TabAwareWidget {
constructor(widgetFactory) { constructor(widgetFactory) {
@ -11,7 +10,7 @@ export default class TabCachingWidget extends TabAwareWidget {
} }
isEnabled() { isEnabled() {
return this.tabContext && this.tabContext.isActive(); return !!this.tabContext;
} }
doRender() { doRender() {
@ -31,7 +30,11 @@ export default class TabCachingWidget extends TabAwareWidget {
return Promise.resolve(); return Promise.resolve();
} }
async newTabOpenedEvent({tabId}) { async newTabOpenedEvent({tabContext}) {
super.newTabOpenedEvent({tabContext});
const {tabId} = tabContext;
if (this.widgets[tabId]) { if (this.widgets[tabId]) {
return; return;
} }
@ -39,20 +42,20 @@ export default class TabCachingWidget extends TabAwareWidget {
this.widgets[tabId] = this.widgetFactory(); this.widgets[tabId] = this.widgetFactory();
const $renderedWidget = this.widgets[tabId].render(); const $renderedWidget = this.widgets[tabId].render();
this.widgets[tabId].toggleExt(this.widgets[tabId]);
this.$widget.after($renderedWidget); this.$widget.after($renderedWidget);
keyboardActionsService.updateDisplayedShortcuts($renderedWidget); keyboardActionsService.updateDisplayedShortcuts($renderedWidget);
await this.widgets[tabId].handleEvent('setTabContext', { await this.widgets[tabId].handleEvent('newTabOpened', {tabContext});
tabContext: appContext.tabManager.getTabContextById(tabId)
});
this.child(this.widgets[tabId]); // add as child only once it is ready (rendered with tabContext) this.child(this.widgets[tabId]); // add as child only once it is ready (rendered with tabContext)
} }
async refreshWithNote() { async refreshWithNote() {
for (const widget of Object.values(this.widgets)) { for (const widget of Object.values(this.widgets)) {
widget.toggle(false); widget.toggleExt(false);
} }
if (!this.tabContext) { if (!this.tabContext) {
@ -64,7 +67,7 @@ export default class TabCachingWidget extends TabAwareWidget {
const widget = this.widgets[this.tabContext.tabId]; const widget = this.widgets[this.tabContext.tabId];
if (widget) { if (widget) {
widget.toggle(widget.isEnabled()); widget.toggleExt(true);
} }
else { else {
console.error(`Widget for tab ${this.tabContext.tabId} not found.`); console.error(`Widget for tab ${this.tabContext.tabId} not found.`);
@ -82,12 +85,11 @@ export default class TabCachingWidget extends TabAwareWidget {
} }
} }
toggle(show) { toggleInt(show) {} // not needed
toggleByTab(show) {
for (const tabId in this.widgets) { for (const tabId in this.widgets) {
this.widgets[tabId].toggle( this.widgets[tabId].toggleExt(show && this.isTab(tabId));
show
&& this.isTab(tabId)
&& this.widgets[tabId].isEnabled());
} }
} }
} }

View File

@ -420,8 +420,8 @@ export default class TabRowWidget extends BasicWidget {
if (tabEl) tabEl.setAttribute('active', ''); if (tabEl) tabEl.setAttribute('active', '');
} }
newTabOpenedEvent({tabId}) { newTabOpenedEvent({tabContext}) {
this.addTab(tabId); this.addTab(tabContext.tabId);
} }
removeTab(tabId) { removeTab(tabId) {

View File

@ -145,7 +145,7 @@ export default class TextTypeWidget extends TypeWidget {
const noteComplement = await this.tabContext.getNoteComplement(); const noteComplement = await this.tabContext.getNoteComplement();
this.spacedUpdate.allowUpdateWithoutChange(() => { await this.spacedUpdate.allowUpdateWithoutChange(() => {
this.textEditor.setData(noteComplement.content); this.textEditor.setData(noteComplement.content);
}); });
} }

View File

@ -7,21 +7,21 @@ export default class TypeWidget extends TabAwareWidget {
/** /**
* @param {NoteShort} note * @param {NoteShort} note
*/ */
doRefresh(note) {} async doRefresh(note) {}
async refresh() { async refresh() {
const thisWidgetType = this.constructor.getType(); const thisWidgetType = this.constructor.getType();
const noteWidgetType = await this.parent.getWidgetType(); const noteWidgetType = await this.parent.getWidgetType();
if (thisWidgetType !== noteWidgetType) { if (thisWidgetType !== noteWidgetType) {
this.toggle(false); this.toggleInt(false);
this.cleanup(); this.cleanup();
} }
else { else {
this.toggle(true); this.toggleInt(true);
this.doRefresh(this.note); await this.doRefresh(this.note);
} }
} }

View File

@ -864,3 +864,7 @@ body {
padding-bottom: 0; padding-bottom: 0;
border-bottom: 1px dotted; border-bottom: 1px dotted;
} }
.hidden-int, .hidden-ext {
display: none !important;
}