hide some "boring" attributes from book listing view

This commit is contained in:
zadam 2021-03-12 20:39:42 +01:00
parent 12b468d3dc
commit 4e76d1fa85
7 changed files with 16 additions and 6 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "trilium",
"version": "0.46.3-beta",
"version": "0.46.4-beta",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -79,6 +79,15 @@ async function renderAttributes(attributes, renderIsInheritable) {
return $container;
}
const HIDDEN_ATTRIBUTES = [
'originalFileName',
'template',
'cssClass',
'iconClass',
'pageSize',
'viewType'
];
async function renderNormalAttributes(note) {
const promotedDefinitionAttributes = note.getPromotedDefinitionAttributes();
let attrs = note.getAttributes();
@ -90,6 +99,7 @@ async function renderNormalAttributes(note) {
attrs = attrs.filter(
attr => !attr.isDefinition()
&& !attr.isAutoLink
&& !HIDDEN_ATTRIBUTES.includes(attr.name)
&& attr.noteId === note.noteId
);
}

View File

@ -194,7 +194,7 @@ const ATTR_HELP = {
"appTheme": "marks CSS notes which are full Trilium themes and are thus available in Trilium options.",
"cssClass": "value of this label is then added as CSS class to the node representing given note in the tree. This can be useful for advanced theming. Can be used in template notes.",
"iconClass": "value of this label is added as a CSS class to the icon on the tree which can help visually distinguish the notes in the tree. Example might be bx bx-home - icons are taken from boxicons. Can be used in template notes.",
"bookZoomLevel": 'applies only to book note and sets the "zoom level" (how many notes fit on 1 row)',
"pageSize": "number of items per page in note listing",
"customRequestHandler": 'see <a href="javascript:" data-help-page="Custom request handler">Custom request handler</a>',
"customResourceProvider": 'see <a href="javascript:" data-help-page="Custom request handler">Custom request handler</a>'
},

View File

@ -278,7 +278,7 @@ export default class NoteDetailWidget extends TabAwareWidget {
const label = attrs.find(attr =>
attr.type === 'label'
&& ['readOnly', 'autoReadOnlyDisabled', 'cssClass', 'bookZoomLevel', 'displayRelations'].includes(attr.name)
&& ['readOnly', 'autoReadOnlyDisabled', 'cssClass', 'displayRelations'].includes(attr.name)
&& attr.isAffecting(this.note));
const relation = attrs.find(attr =>

View File

@ -106,7 +106,7 @@ function processContent(images, note, content) {
for (const {src, dataUrl, imageId} of images) {
const filename = path.basename(src);
if (!dataUrl.startsWith("data:image")) {
if (!dataUrl || !dataUrl.startsWith("data:image")) {
log.info("Image could not be recognized as data URL:", dataUrl.substr(0, Math.min(100, dataUrl.length)));
continue;
}

View File

@ -27,7 +27,6 @@ const BUILTIN_ATTRIBUTES = [
{ type: 'label', name: 'run', isDangerous: true },
{ type: 'label', name: 'customRequestHandler', isDangerous: true },
{ type: 'label', name: 'customResourceProvider', isDangerous: true },
{ type: 'label', name: 'bookZoomLevel', isDangerous: false },
{ type: 'label', name: 'widget', isDangerous: true },
{ type: 'label', name: 'noteInfoWidgetDisabled' },
{ type: 'label', name: 'linkMapWidgetDisabled' },
@ -41,6 +40,8 @@ const BUILTIN_ATTRIBUTES = [
{ type: 'label', name: 'hoistedSearchHome' },
{ type: 'label', name: 'sqlConsoleHome' },
{ type: 'label', name: 'datePattern' },
{ type: 'label', name: 'pageSize' },
{ type: 'label', name: 'viewType' },
// relation names
{ type: 'relation', name: 'runOnNoteCreation', isDangerous: true },

View File

@ -23,7 +23,6 @@ const IGNORED_ATTR_NAMES = [
"archived",
"hidepromotedattributes",
"keyboardshortcut",
"bookzoomlevel",
"noteinfowidgetdisabled",
"linkmapwidgetdisabled",
"noterevisionswidgetdisabled",