mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
added note properties widget
This commit is contained in:
parent
56a35b85a6
commit
6068bd7c44
BIN
db/demo.zip
BIN
db/demo.zip
Binary file not shown.
@ -19,6 +19,7 @@ import NoteListWidget from "../widgets/note_list.js";
|
|||||||
import SqlResultWidget from "../widgets/sql_result.js";
|
import SqlResultWidget from "../widgets/sql_result.js";
|
||||||
import FilePropertiesWidget from "../widgets/type_property_widgets/file_properties.js";
|
import FilePropertiesWidget from "../widgets/type_property_widgets/file_properties.js";
|
||||||
import ImagePropertiesWidget from "../widgets/type_property_widgets/image_properties.js";
|
import ImagePropertiesWidget from "../widgets/type_property_widgets/image_properties.js";
|
||||||
|
import NotePropertiesWidget from "../widgets/type_property_widgets/note_properties.js";
|
||||||
|
|
||||||
export default class DesktopExtraWindowLayout {
|
export default class DesktopExtraWindowLayout {
|
||||||
constructor(customWidgets) {
|
constructor(customWidgets) {
|
||||||
@ -50,6 +51,7 @@ export default class DesktopExtraWindowLayout {
|
|||||||
.child(
|
.child(
|
||||||
new TabCachingWidget(() => new CollapsibleSectionContainer()
|
new TabCachingWidget(() => new CollapsibleSectionContainer()
|
||||||
.child(new SearchDefinitionWidget())
|
.child(new SearchDefinitionWidget())
|
||||||
|
.child(new NotePropertiesWidget())
|
||||||
.child(new FilePropertiesWidget())
|
.child(new FilePropertiesWidget())
|
||||||
.child(new ImagePropertiesWidget())
|
.child(new ImagePropertiesWidget())
|
||||||
.child(new PromotedAttributesWidget())
|
.child(new PromotedAttributesWidget())
|
||||||
|
@ -30,6 +30,7 @@ import SqlResultWidget from "../widgets/sql_result.js";
|
|||||||
import SqlTableSchemasWidget from "../widgets/sql_table_schemas.js";
|
import SqlTableSchemasWidget from "../widgets/sql_table_schemas.js";
|
||||||
import FilePropertiesWidget from "../widgets/type_property_widgets/file_properties.js";
|
import FilePropertiesWidget from "../widgets/type_property_widgets/file_properties.js";
|
||||||
import ImagePropertiesWidget from "../widgets/type_property_widgets/image_properties.js";
|
import ImagePropertiesWidget from "../widgets/type_property_widgets/image_properties.js";
|
||||||
|
import NotePropertiesWidget from "../widgets/type_property_widgets/note_properties.js";
|
||||||
|
|
||||||
const RIGHT_PANE_CSS = `
|
const RIGHT_PANE_CSS = `
|
||||||
<style>
|
<style>
|
||||||
@ -161,6 +162,7 @@ export default class DesktopMainWindowLayout {
|
|||||||
.child(
|
.child(
|
||||||
new TabCachingWidget(() => new CollapsibleSectionContainer()
|
new TabCachingWidget(() => new CollapsibleSectionContainer()
|
||||||
.child(new SearchDefinitionWidget())
|
.child(new SearchDefinitionWidget())
|
||||||
|
.child(new NotePropertiesWidget())
|
||||||
.child(new FilePropertiesWidget())
|
.child(new FilePropertiesWidget())
|
||||||
.child(new ImagePropertiesWidget())
|
.child(new ImagePropertiesWidget())
|
||||||
.child(new PromotedAttributesWidget())
|
.child(new PromotedAttributesWidget())
|
||||||
|
@ -90,7 +90,7 @@ function goToLink(e) {
|
|||||||
|| $link.hasClass("ck-link-actions__preview") // within edit link dialog single click suffices
|
|| $link.hasClass("ck-link-actions__preview") // within edit link dialog single click suffices
|
||||||
) {
|
) {
|
||||||
const address = $link.attr('href');
|
const address = $link.attr('href');
|
||||||
console.log("address", address);
|
|
||||||
if (address) {
|
if (address) {
|
||||||
if (address.toLowerCase().startsWith('http')) {
|
if (address.toLowerCase().startsWith('http')) {
|
||||||
window.open(address, '_blank');
|
window.open(address, '_blank');
|
||||||
|
@ -52,8 +52,7 @@ const TPL = `
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>\`;
|
</div>`;
|
||||||
`;
|
|
||||||
|
|
||||||
export default class FilePropertiesWidget extends TabAwareWidget {
|
export default class FilePropertiesWidget extends TabAwareWidget {
|
||||||
static getType() { return "file"; }
|
static getType() { return "file"; }
|
||||||
|
@ -0,0 +1,40 @@
|
|||||||
|
import TabAwareWidget from "../tab_aware_widget.js";
|
||||||
|
|
||||||
|
const TPL = `
|
||||||
|
<div class="note-properties-widget">
|
||||||
|
<style>
|
||||||
|
.note-properties-widget {
|
||||||
|
padding: 12px;
|
||||||
|
color: var(--muted-text-color);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
This note was originally taken from: <a class="page-url external"></a>
|
||||||
|
</div>`;
|
||||||
|
|
||||||
|
export default class NotePropertiesWidget extends TabAwareWidget {
|
||||||
|
static getType() { return "note-properties"; }
|
||||||
|
|
||||||
|
renderTitle(note) {
|
||||||
|
return {
|
||||||
|
show: !!note.getLabelValue('pageUrl'),
|
||||||
|
activate: true,
|
||||||
|
$title: 'Info'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
doRender() {
|
||||||
|
this.$widget = $(TPL);
|
||||||
|
this.contentSized();
|
||||||
|
|
||||||
|
this.$pageUrl = this.$widget.find('.page-url');
|
||||||
|
}
|
||||||
|
|
||||||
|
async refreshWithNote(note) {
|
||||||
|
const pageUrl = note.getLabelValue('pageUrl');
|
||||||
|
|
||||||
|
this.$pageUrl
|
||||||
|
.attr('href', pageUrl)
|
||||||
|
.text(pageUrl);
|
||||||
|
}
|
||||||
|
}
|
@ -205,7 +205,9 @@ function highlightSearchResults(searchResults, highlightedTokens) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const attr of note.attributes) {
|
for (const attr of note.attributes) {
|
||||||
if (highlightedTokens.find(token => attr.name.includes(token) || attr.value.includes(token))) {
|
if (highlightedTokens.find(token => attr.name.toLowerCase().includes(token)
|
||||||
|
|| attr.value.toLowerCase().includes(token))) {
|
||||||
|
|
||||||
result.highlightedNotePathTitle += ` <${formatAttribute(attr)}>`;
|
result.highlightedNotePathTitle += ` <${formatAttribute(attr)}>`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user