added note properties widget

This commit is contained in:
zadam 2021-01-31 12:15:36 +01:00
parent 56a35b85a6
commit 6068bd7c44
7 changed files with 49 additions and 4 deletions

Binary file not shown.

View File

@ -19,6 +19,7 @@ import NoteListWidget from "../widgets/note_list.js";
import SqlResultWidget from "../widgets/sql_result.js";
import FilePropertiesWidget from "../widgets/type_property_widgets/file_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 {
constructor(customWidgets) {
@ -50,6 +51,7 @@ export default class DesktopExtraWindowLayout {
.child(
new TabCachingWidget(() => new CollapsibleSectionContainer()
.child(new SearchDefinitionWidget())
.child(new NotePropertiesWidget())
.child(new FilePropertiesWidget())
.child(new ImagePropertiesWidget())
.child(new PromotedAttributesWidget())

View File

@ -30,6 +30,7 @@ import SqlResultWidget from "../widgets/sql_result.js";
import SqlTableSchemasWidget from "../widgets/sql_table_schemas.js";
import FilePropertiesWidget from "../widgets/type_property_widgets/file_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 = `
<style>
@ -161,6 +162,7 @@ export default class DesktopMainWindowLayout {
.child(
new TabCachingWidget(() => new CollapsibleSectionContainer()
.child(new SearchDefinitionWidget())
.child(new NotePropertiesWidget())
.child(new FilePropertiesWidget())
.child(new ImagePropertiesWidget())
.child(new PromotedAttributesWidget())

View File

@ -90,7 +90,7 @@ function goToLink(e) {
|| $link.hasClass("ck-link-actions__preview") // within edit link dialog single click suffices
) {
const address = $link.attr('href');
console.log("address", address);
if (address) {
if (address.toLowerCase().startsWith('http')) {
window.open(address, '_blank');

View File

@ -52,8 +52,7 @@ const TPL = `
</td>
</tr>
</table>
</div>\`;
`;
</div>`;
export default class FilePropertiesWidget extends TabAwareWidget {
static getType() { return "file"; }

View 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);
}
}

View File

@ -205,7 +205,9 @@ function highlightSearchResults(searchResults, highlightedTokens) {
}
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)}>`;
}
}