Skip to content

Build your personal knowledge base with Trilium Notes

Merge branch 'main' into reusable-preact-widgets

BeatLink0aff11e03a9c
diff --cc apps/client/src/widgets/PromotedAttributes.tsx
index 2569af11a2,e6f323cda5..647b383254
--- a/apps/client/src/widgets/PromotedAttributes.tsx
+++ b/apps/client/src/widgets/PromotedAttributes.tsx
@@@ -1,8 -1,8 +1,9 @@@
import "./PromotedAttributes.css";
- import { DefinitionObject, LabelType, UpdateAttributeResponse } from "@triliumnext/commons";
+ import { DefinitionObject, extractAttributeDefinitionTypeAndName, UpdateAttributeResponse } from "@triliumnext/commons";
import clsx from "clsx";
+import { ComponentChild, createElement, HTMLInputTypeAttribute, InputHTMLAttributes, MouseEventHandler, TargetedEvent } from "preact";
+ import { ComponentChild, MouseEventHandler, TargetedEvent } from "preact";
import { Dispatch, StateUpdater, useCallback, useEffect, useState } from "preact/hooks";
import NoteContext from "../components/note_context";
@@@ -252,34 -219,11 +221,36 @@@ function LabelInput(props: CellProps &
<label for={inputId}>{definition.promotedAlias ?? valueName}</label>
</>;
}
+ return (
+ <div className="input-group">
+ {inputNode}
+ { definition.labelType === "color" && (
+ <ColorPicker
+ currentValue={valueAttr.value || null}
+ onChange={(color) => updateAttribute(note, cell, componentId, color ?? "", setCells)}
+ />
+ )}
+ { definition.labelType === "url" && (
+ <InputButton
+ className="open-external-link-button"
+ icon="bx bx-window-open"
+ title={t("promoted_attributes.open_external_link")}
+ onClick={(e) => {
+ const inputEl = document.getElementById(inputId) as HTMLInputElement | null;
+ const url = inputEl?.value;
+ if (url) {
+ window.open(url, "_blank");
+ }
+ }}
+ />
+ )}
+ </div>
+ );
+ return <div className="input-group">{input}</div>;
}
+
function RelationInput({ inputId, ...props }: CellProps & { inputId: string }) {
return (
<NoteAutocomplete