diff --git a/apps/client/src/widgets/attribute_widgets/attribute_editor.ts b/apps/client/src/widgets/attribute_widgets/attribute_editor.ts
index 6c732b779..87db417f5 100644
--- a/apps/client/src/widgets/attribute_widgets/attribute_editor.ts
+++ b/apps/client/src/widgets/attribute_widgets/attribute_editor.ts
@@ -18,29 +18,7 @@ export default class AttributeEditorWidget extends NoteContextAwareWidget implem
}
}
- dataChanged() {
- this.lastUpdatedNoteId = this.noteId;
- }
-
- async createNoteForReferenceLink(title: string) {
- let result;
- if (this.notePath) {
- result = await noteCreateService.createNoteWithTypePrompt(this.notePath, {
- activate: false,
- title: title
- });
- }
-
- return result?.note?.getBestNotePathString();
- }
-
async updateAttributeList(attributes: FAttribute[]) {
await this.renderOwnedAttributes(attributes, false);
}
-
- focus() {
- this.$editor.trigger("focus");
-
-
- }
}
diff --git a/apps/client/src/widgets/ribbon/OwnedAttributesTab.tsx b/apps/client/src/widgets/ribbon/OwnedAttributesTab.tsx
index 2c168841f..daf9d1495 100644
--- a/apps/client/src/widgets/ribbon/OwnedAttributesTab.tsx
+++ b/apps/client/src/widgets/ribbon/OwnedAttributesTab.tsx
@@ -1,10 +1,16 @@
import AttributeEditor from "./components/AttributeEditor";
import { TabContext } from "./ribbon-interface";
-export default function OwnedAttributesTab({ note }: TabContext) {
+export default function OwnedAttributesTab({ note, notePath, componentId }: TabContext) {
return (
- { note &&
}
+ { note && (
+
+ )}
)
}
\ No newline at end of file
diff --git a/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx b/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx
index 7a82962cc..2ef34d22e 100644
--- a/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx
+++ b/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx
@@ -20,6 +20,7 @@ import contextMenu from "../../../menus/context_menu";
import type { CommandData, FilteredCommandNames } from "../../../components/app_context";
import { AttributeType } from "@triliumnext/commons";
import attributes from "../../../services/attributes";
+import note_create from "../../../services/note_create";
type AttributeCommandNames = FilteredCommandNames;
@@ -75,9 +76,9 @@ const mentionSetup: MentionFeed[] = [
];
-export default function AttributeEditor({ note, componentId }: { note: FNote, componentId: string }) {
+export default function AttributeEditor({ note, componentId, notePath }: { note: FNote, componentId: string, notePath?: string | null }) {
const parentComponent = useContext(ParentComponent);
- injectLoadReferenceLinkTitle(parentComponent);
+ injectLoadReferenceLinkTitle(parentComponent, notePath);
const [ state, setState ] = useState<"normal" | "showHelpTooltip" | "showAttributeDetail">();
const [ error, setError ] = useState();
@@ -373,7 +374,7 @@ function getClickIndex(pos: ModelPosition) {
return clickIndex;
}
-function injectLoadReferenceLinkTitle(component: Component | null) {
+function injectLoadReferenceLinkTitle(component: Component | null, notePath?: string | null) {
if (!component) return;
(component as any).loadReferenceLinkTitle = async ($el: JQuery, href: string) => {
const { noteId } = link.parseNavigationStateFromUrl(href);
@@ -382,4 +383,15 @@ function injectLoadReferenceLinkTitle(component: Component | null) {
$el.text(title);
}
+ (component as any).createNoteForReferenceLink = async (title: string) => {
+ let result;
+ if (notePath) {
+ result = await note_create.createNoteWithTypePrompt(notePath, {
+ activate: false,
+ title: title
+ });
+ }
+
+ return result?.note?.getBestNotePathString();
+ }
}
\ No newline at end of file