From 58ee801e5734360d98f6f1c81aa6ea6961d19eb3 Mon Sep 17 00:00:00 2001 From: Jin <22962980+JYC333@users.noreply.github.com> Date: Tue, 3 Sep 2024 18:42:03 +0200 Subject: [PATCH] other fixes --- .../attribute_widgets/attribute_detail.js | 24 +++++++++---------- src/public/app/widgets/find.js | 18 +++++--------- .../ribbon_widgets/promoted_attributes.js | 14 +++++------ .../type_widgets/options/appearance/fonts.js | 16 ++++--------- .../type_widgets/options/appearance/theme.js | 4 +++- 5 files changed, 30 insertions(+), 46 deletions(-) diff --git a/src/public/app/widgets/attribute_widgets/attribute_detail.js b/src/public/app/widgets/attribute_widgets/attribute_detail.js index ce84cd4a3..46f1d2e6a 100644 --- a/src/public/app/widgets/attribute_widgets/attribute_detail.js +++ b/src/public/app/widgets/attribute_widgets/attribute_detail.js @@ -97,7 +97,7 @@ const TPL = ` ${t('attribute_detail.promoted')} - + ${t('attribute_detail.promoted_alias')} @@ -134,9 +134,7 @@ const TPL = `
-
- ${t('attribute_detail.digits')} -
+ ${t('attribute_detail.digits')}
@@ -150,7 +148,7 @@ const TPL = ` ${t('attribute_detail.inheritable')} - + @@ -349,7 +347,7 @@ export default class AttributeDetailWidget extends NoteContextAwareWidget { this.$rowTargetNote = this.$widget.find('.attr-row-target-note'); this.$inputTargetNote = this.$widget.find('.attr-input-target-note'); - noteAutocompleteService.initNoteAutocomplete(this.$inputTargetNote, {allowCreatingNotes: true}) + noteAutocompleteService.initNoteAutocomplete(this.$inputTargetNote, { allowCreatingNotes: true }) .on('autocomplete:noteselected', (event, suggestion, dataset) => { if (!suggestion.notePath) { return false; @@ -403,7 +401,7 @@ export default class AttributeDetailWidget extends NoteContextAwareWidget { }); } - async showAttributeDetail({allAttributes, attribute, isOwned, x, y, focus}) { + async showAttributeDetail({ allAttributes, attribute, isOwned, x, y, focus }) { if (!attribute) { this.hide(); @@ -545,7 +543,7 @@ export default class AttributeDetailWidget extends NoteContextAwareWidget { } } - return {left, right}; + return { left, right }; } async saveAndClose() { @@ -589,19 +587,19 @@ export default class AttributeDetailWidget extends NoteContextAwareWidget { } async updateRelatedNotes() { - let {results, count} = await server.post('search-related', this.attribute); + let { results, count } = await server.post('search-related', this.attribute); for (const res of results) { res.noteId = res.notePathArray[res.notePathArray.length - 1]; } - results = results.filter(({noteId}) => noteId !== this.noteId); + results = results.filter(({ noteId }) => noteId !== this.noteId); if (results.length === 0) { this.$relatedNotesContainer.hide(); } else { this.$relatedNotesContainer.show(); - this.$relatedNotesTitle.text(t("attribute_detail.other_notes_with_name", {attributeType: this.attribute.type, attributeName: this.attribute.name})); + this.$relatedNotesTitle.text(t("attribute_detail.other_notes_with_name", { attributeType: this.attribute.type, attributeName: this.attribute.name })); this.$relatedNotesList.empty(); @@ -611,7 +609,7 @@ export default class AttributeDetailWidget extends NoteContextAwareWidget { for (const note of displayedNotes) { const notePath = note.getBestNotePathString(hoistedNoteId); - const $noteLink = await linkService.createLink(notePath, {showNotePath: true}); + const $noteLink = await linkService.createLink(notePath, { showNotePath: true }); this.$relatedNotesList.append( $("
  • ").append($noteLink) @@ -619,7 +617,7 @@ export default class AttributeDetailWidget extends NoteContextAwareWidget { } if (results.length > DISPLAYED_NOTES) { - this.$relatedNotesMoreNotes.show().text(t("attribute_detail.and_more", {count: count - DISPLAYED_NOTES})); + this.$relatedNotesMoreNotes.show().text(t("attribute_detail.and_more", { count: count - DISPLAYED_NOTES })); } else { this.$relatedNotesMoreNotes.hide(); } diff --git a/src/public/app/widgets/find.js b/src/public/app/widgets/find.js index d3d3dbcad..cf505aab1 100644 --- a/src/public/app/widgets/find.js +++ b/src/public/app/widgets/find.js @@ -47,24 +47,18 @@ const TPL = `
    -
    - - -
    + +
    - + +
    - + +
    diff --git a/src/public/app/widgets/ribbon_widgets/promoted_attributes.js b/src/public/app/widgets/ribbon_widgets/promoted_attributes.js index ecbdf59b2..119797c35 100644 --- a/src/public/app/widgets/ribbon_widgets/promoted_attributes.js +++ b/src/public/app/widgets/ribbon_widgets/promoted_attributes.js @@ -71,7 +71,7 @@ export default class PromotedAttributesWidget extends NoteContextAwareWidget { const promotedDefAttrs = note.getPromotedDefinitionAttributes(); if (promotedDefAttrs.length === 0) { - return {show: false}; + return { show: false }; } return { @@ -167,7 +167,7 @@ export default class PromotedAttributesWidget extends NoteContextAwareWidget { return; } - attributeValues = attributeValues.map(attribute => ({value: attribute})); + attributeValues = attributeValues.map(attribute => ({ value: attribute })); $input.autocomplete({ appendTo: document.querySelector('body'), @@ -229,9 +229,7 @@ export default class PromotedAttributesWidget extends NoteContextAwareWidget { .prop("title", t("promoted_attributes.open_external_link")) .on('click', () => window.open($input.val(), '_blank')); - $input.after($("
    ") - .addClass("input-group-append") - .append($openButton)); + $input.after($openButton); } else { ws.logError(t("promoted_attributes.unknown_label_type", { type: definitionAttr.labelType })); @@ -244,7 +242,7 @@ export default class PromotedAttributesWidget extends NoteContextAwareWidget { if (utils.isDesktop()) { // no need to wait for this - noteAutocompleteService.initNoteAutocomplete($input, {allowCreatingNotes: true}); + noteAutocompleteService.initNoteAutocomplete($input, { allowCreatingNotes: true }); $input.on('autocomplete:noteselected', (event, suggestion, dataset) => { this.promotedAttributeChanged(event); @@ -257,7 +255,7 @@ export default class PromotedAttributesWidget extends NoteContextAwareWidget { } } else { - ws.logError(t(`promoted_attributes.unknown_attribute_type`, {type: valueAttr.type})); + ws.logError(t(`promoted_attributes.unknown_attribute_type`, { type: valueAttr.type })); return; } @@ -346,7 +344,7 @@ export default class PromotedAttributesWidget extends NoteContextAwareWidget { this.$widget.find(".promoted-attribute-input:first").focus(); } - entitiesReloadedEvent({loadResults}) { + entitiesReloadedEvent({ loadResults }) { if (loadResults.getAttributeRows(this.componentId).find(attr => attributeService.isAffecting(attr, this.note))) { this.refresh(); } diff --git a/src/public/app/widgets/type_widgets/options/appearance/fonts.js b/src/public/app/widgets/type_widgets/options/appearance/fonts.js index e0e2ac088..3fa1cf016 100644 --- a/src/public/app/widgets/type_widgets/options/appearance/fonts.js +++ b/src/public/app/widgets/type_widgets/options/appearance/fonts.js @@ -45,9 +45,7 @@ const TPL = `
    -
    - % -
    + %
    @@ -65,9 +63,7 @@ const TPL = `
    -
    - % -
    + %
    @@ -85,9 +81,7 @@ const TPL = `
    -
    - % -
    + %
    @@ -105,9 +99,7 @@ const TPL = `
    -
    - % -
    + %
    diff --git a/src/public/app/widgets/type_widgets/options/appearance/theme.js b/src/public/app/widgets/type_widgets/options/appearance/theme.js index 1d0bc23df..fd26daa23 100644 --- a/src/public/app/widgets/type_widgets/options/appearance/theme.js +++ b/src/public/app/widgets/type_widgets/options/appearance/theme.js @@ -15,7 +15,9 @@ const TPL = `
    - +
    + +
    `;