mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
toggle to expand/collapse attr list is saved and propagated across tabs
This commit is contained in:
parent
aa4a645670
commit
e1d4be814f
@ -75,7 +75,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"cross-env": "^7.0.2",
|
"cross-env": "^7.0.2",
|
||||||
"electron": "10.0.0-beta.11",
|
"electron": "10.0.0-beta.13",
|
||||||
"electron-builder": "22.7.0",
|
"electron-builder": "22.7.0",
|
||||||
"electron-packager": "15.0.0",
|
"electron-packager": "15.0.0",
|
||||||
"electron-rebuild": "1.11.0",
|
"electron-rebuild": "1.11.0",
|
||||||
|
@ -171,7 +171,7 @@ const editorConfig = {
|
|||||||
toolbar: {
|
toolbar: {
|
||||||
items: []
|
items: []
|
||||||
},
|
},
|
||||||
placeholder: "Type the labels and relations here ...",
|
placeholder: "Type the labels and relations here, e.g. #year=2020",
|
||||||
mention: mentionSetup
|
mention: mentionSetup
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ import TabAwareWidget from "./tab_aware_widget.js";
|
|||||||
import AttributeDetailWidget from "./attribute_detail.js";
|
import AttributeDetailWidget from "./attribute_detail.js";
|
||||||
import attributeRenderer from "../services/attribute_renderer.js";
|
import attributeRenderer from "../services/attribute_renderer.js";
|
||||||
import AttributeEditorWidget from "./attribute_editor.js";
|
import AttributeEditorWidget from "./attribute_editor.js";
|
||||||
|
import options from '../services/options.js';
|
||||||
|
|
||||||
const TPL = `
|
const TPL = `
|
||||||
<div class="attribute-list">
|
<div class="attribute-list">
|
||||||
@ -103,15 +104,15 @@ export default class AttributeListWidget extends TabAwareWidget {
|
|||||||
this.$widget = $(TPL);
|
this.$widget = $(TPL);
|
||||||
|
|
||||||
this.$attrDisplay = this.$widget.find('.attr-display');
|
this.$attrDisplay = this.$widget.find('.attr-display');
|
||||||
|
this.$attrDisplay.toggle(options.is('attributeListExpanded'));
|
||||||
|
|
||||||
this.$ownedExpander = this.$widget.find('.attr-owned-expander');
|
this.$ownedExpander = this.$widget.find('.attr-owned-expander');
|
||||||
this.$ownedExpander.on('click', () => {
|
this.$ownedExpander.on('click', async () => {
|
||||||
if (this.$attrDisplay.is(":visible")) {
|
const collapse = this.$attrDisplay.is(":visible");
|
||||||
this.$attrDisplay.slideUp(200);
|
|
||||||
}
|
await options.save('attributeListExpanded', !collapse);
|
||||||
else {
|
|
||||||
this.$attrDisplay.slideDown(200);
|
this.triggerEvent(`attributeListCollapsedStateChanged`, {collapse});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$ownedExpanderText = this.$ownedExpander.find('.attr-expander-text');
|
this.$ownedExpanderText = this.$ownedExpander.find('.attr-expander-text');
|
||||||
@ -137,7 +138,7 @@ export default class AttributeListWidget extends TabAwareWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async refreshWithNote(note) {
|
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));
|
this.$ownedExpanderText.text(ownedAttributes.length + ' owned ' + this.attrPlural(ownedAttributes.length));
|
||||||
|
|
||||||
@ -191,4 +192,17 @@ export default class AttributeListWidget extends TabAwareWidget {
|
|||||||
updateAttributeListCommand({attributes}) {
|
updateAttributeListCommand({attributes}) {
|
||||||
this.attributeEditorWidget.updateAttributeList(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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ const TPL = `
|
|||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
flex-grow: 0;
|
flex-grow: 0;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
max-height: 400px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.promoted-attributes td, .promoted-attributes th {
|
.promoted-attributes td, .promoted-attributes th {
|
||||||
|
@ -37,7 +37,8 @@ const ALLOWED_OPTIONS = new Set([
|
|||||||
'rightPaneWidth',
|
'rightPaneWidth',
|
||||||
'leftPaneVisible',
|
'leftPaneVisible',
|
||||||
'rightPaneVisible',
|
'rightPaneVisible',
|
||||||
'nativeTitleBarVisible'
|
'nativeTitleBarVisible',
|
||||||
|
'attributeListExpanded'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
function getOptions() {
|
function getOptions() {
|
||||||
|
@ -84,7 +84,8 @@ const defaultOptions = [
|
|||||||
{ name: 'nativeTitleBarVisible', value: 'false', isSynced: false },
|
{ name: 'nativeTitleBarVisible', value: 'false', isSynced: false },
|
||||||
{ name: 'eraseNotesAfterTimeInSeconds', value: '604800', isSynced: true }, // default is 7 days
|
{ name: 'eraseNotesAfterTimeInSeconds', value: '604800', isSynced: true }, // default is 7 days
|
||||||
{ name: 'hideArchivedNotes_main', value: 'false', isSynced: false },
|
{ 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() {
|
function initStartupOptions() {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
const log = require('./log');
|
const log = require('./log');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const resourceDir = require('./resource_dir');
|
const resourceDir = require('./resource_dir');
|
||||||
const appInfo = require('./app_info');
|
|
||||||
const sql = require('./sql');
|
const sql = require('./sql');
|
||||||
const utils = require('./utils');
|
const utils = require('./utils');
|
||||||
const optionService = require('./options');
|
const optionService = require('./options');
|
||||||
@ -9,10 +8,11 @@ const port = require('./port');
|
|||||||
const Option = require('../entities/option');
|
const Option = require('../entities/option');
|
||||||
const TaskContext = require('./task_context.js');
|
const TaskContext = require('./task_context.js');
|
||||||
const migrationService = require('./migration');
|
const migrationService = require('./migration');
|
||||||
|
const cls = require('./cls');
|
||||||
|
|
||||||
const dbReady = utils.deferred();
|
const dbReady = utils.deferred();
|
||||||
|
|
||||||
initDbConnection();
|
cls.init(initDbConnection);
|
||||||
|
|
||||||
function schemaExists() {
|
function schemaExists() {
|
||||||
return !!sql.getValue(`SELECT name FROM sqlite_master
|
return !!sql.getValue(`SELECT name FROM sqlite_master
|
||||||
|
Loading…
x
Reference in New Issue
Block a user