diff --git a/package.json b/package.json
index e7a0485dd..c07311b82 100644
--- a/package.json
+++ b/package.json
@@ -75,7 +75,7 @@
},
"devDependencies": {
"cross-env": "^7.0.2",
- "electron": "10.0.0-beta.11",
+ "electron": "10.0.0-beta.13",
"electron-builder": "22.7.0",
"electron-packager": "15.0.0",
"electron-rebuild": "1.11.0",
diff --git a/src/public/app/widgets/attribute_editor.js b/src/public/app/widgets/attribute_editor.js
index 87f69acf6..8f97a986c 100644
--- a/src/public/app/widgets/attribute_editor.js
+++ b/src/public/app/widgets/attribute_editor.js
@@ -171,7 +171,7 @@ const editorConfig = {
toolbar: {
items: []
},
- placeholder: "Type the labels and relations here ...",
+ placeholder: "Type the labels and relations here, e.g. #year=2020",
mention: mentionSetup
};
diff --git a/src/public/app/widgets/attribute_list.js b/src/public/app/widgets/attribute_list.js
index 5ed72ce04..8a09f7ac0 100644
--- a/src/public/app/widgets/attribute_list.js
+++ b/src/public/app/widgets/attribute_list.js
@@ -2,6 +2,7 @@ import TabAwareWidget from "./tab_aware_widget.js";
import AttributeDetailWidget from "./attribute_detail.js";
import attributeRenderer from "../services/attribute_renderer.js";
import AttributeEditorWidget from "./attribute_editor.js";
+import options from '../services/options.js';
const TPL = `
@@ -103,15 +104,15 @@ export default class AttributeListWidget extends TabAwareWidget {
this.$widget = $(TPL);
this.$attrDisplay = this.$widget.find('.attr-display');
+ this.$attrDisplay.toggle(options.is('attributeListExpanded'));
this.$ownedExpander = this.$widget.find('.attr-owned-expander');
- this.$ownedExpander.on('click', () => {
- if (this.$attrDisplay.is(":visible")) {
- this.$attrDisplay.slideUp(200);
- }
- else {
- this.$attrDisplay.slideDown(200);
- }
+ this.$ownedExpander.on('click', async () => {
+ const collapse = this.$attrDisplay.is(":visible");
+
+ await options.save('attributeListExpanded', !collapse);
+
+ this.triggerEvent(`attributeListCollapsedStateChanged`, {collapse});
});
this.$ownedExpanderText = this.$ownedExpander.find('.attr-expander-text');
@@ -137,7 +138,7 @@ export default class AttributeListWidget extends TabAwareWidget {
}
async refreshWithNote(note) {
- const ownedAttributes = note.getOwnedAttributes();
+ const ownedAttributes = note.getOwnedAttributes().filter(attr => !attr.isAutoLink);
this.$ownedExpanderText.text(ownedAttributes.length + ' owned ' + this.attrPlural(ownedAttributes.length));
@@ -191,4 +192,17 @@ export default class AttributeListWidget extends TabAwareWidget {
updateAttributeListCommand({attributes}) {
this.attributeEditorWidget.updateAttributeList(attributes);
}
+
+ /**
+ * This event is used to synchronize collapsed state of all the tab-cached widgets since they are all rendered
+ * separately but should behave uniformly for the user.
+ */
+ attributeListCollapsedStateChangedEvent({collapse}) {
+ if (collapse) {
+ this.$attrDisplay.slideUp(200);
+ }
+ else {
+ this.$attrDisplay.slideDown(200);
+ }
+ }
}
diff --git a/src/public/app/widgets/promoted_attributes.js b/src/public/app/widgets/promoted_attributes.js
index 024649afb..e4e2babca 100644
--- a/src/public/app/widgets/promoted_attributes.js
+++ b/src/public/app/widgets/promoted_attributes.js
@@ -15,6 +15,7 @@ const TPL = `
flex-shrink: 0;
flex-grow: 0;
overflow: auto;
+ max-height: 400px;
}
.promoted-attributes td, .promoted-attributes th {
diff --git a/src/routes/api/options.js b/src/routes/api/options.js
index 25d4813ee..76291b91f 100644
--- a/src/routes/api/options.js
+++ b/src/routes/api/options.js
@@ -37,7 +37,8 @@ const ALLOWED_OPTIONS = new Set([
'rightPaneWidth',
'leftPaneVisible',
'rightPaneVisible',
- 'nativeTitleBarVisible'
+ 'nativeTitleBarVisible',
+ 'attributeListExpanded'
]);
function getOptions() {
diff --git a/src/services/options_init.js b/src/services/options_init.js
index 11aa4b69e..8913303dc 100644
--- a/src/services/options_init.js
+++ b/src/services/options_init.js
@@ -84,7 +84,8 @@ const defaultOptions = [
{ name: 'nativeTitleBarVisible', value: 'false', isSynced: false },
{ name: 'eraseNotesAfterTimeInSeconds', value: '604800', isSynced: true }, // default is 7 days
{ name: 'hideArchivedNotes_main', value: 'false', isSynced: false },
- { name: 'hideIncludedImages_main', value: 'true', isSynced: false }
+ { name: 'hideIncludedImages_main', value: 'true', isSynced: false },
+ { name: 'attributeListExpanded', value: 'false', isSynced: false }
];
function initStartupOptions() {
diff --git a/src/services/sql_init.js b/src/services/sql_init.js
index 46675f6a9..01d4e26c2 100644
--- a/src/services/sql_init.js
+++ b/src/services/sql_init.js
@@ -1,7 +1,6 @@
const log = require('./log');
const fs = require('fs');
const resourceDir = require('./resource_dir');
-const appInfo = require('./app_info');
const sql = require('./sql');
const utils = require('./utils');
const optionService = require('./options');
@@ -9,10 +8,11 @@ const port = require('./port');
const Option = require('../entities/option');
const TaskContext = require('./task_context.js');
const migrationService = require('./migration');
+const cls = require('./cls');
const dbReady = utils.deferred();
-initDbConnection();
+cls.init(initDbConnection);
function schemaExists() {
return !!sql.getValue(`SELECT name FROM sqlite_master