mirror of
https://github.com/zadam/trilium.git
synced 2025-12-02 05:24:23 +01:00
fix(promoted_attributes): value carrying over onto new notes
This commit is contained in:
parent
3051664228
commit
98241fb54b
@ -207,7 +207,7 @@ function toObject<T, R>(array: T[], fn: (arg0: T) => [key: string, value: R]) {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
function randomString(len: number) {
|
export function randomString(len: number) {
|
||||||
let text = "";
|
let text = "";
|
||||||
const possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
const possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||||
|
|
||||||
|
|||||||
@ -14,8 +14,10 @@ import ws from "../services/ws";
|
|||||||
import { UpdateAttributeResponse } from "@triliumnext/commons";
|
import { UpdateAttributeResponse } from "@triliumnext/commons";
|
||||||
import attributes from "../services/attributes";
|
import attributes from "../services/attributes";
|
||||||
import debounce from "../services/debounce";
|
import debounce from "../services/debounce";
|
||||||
|
import { randomString } from "../services/utils";
|
||||||
|
|
||||||
interface Cell {
|
interface Cell {
|
||||||
|
uniqueId: string;
|
||||||
definitionAttr: FAttribute;
|
definitionAttr: FAttribute;
|
||||||
definition: DefinitionObject;
|
definition: DefinitionObject;
|
||||||
valueAttr: Attribute;
|
valueAttr: Attribute;
|
||||||
@ -44,6 +46,7 @@ export default function PromotedAttributes() {
|
|||||||
<div className="promoted-attributes-widget">
|
<div className="promoted-attributes-widget">
|
||||||
{cells && cells.length > 0 && <div className="promoted-attributes-container">
|
{cells && cells.length > 0 && <div className="promoted-attributes-container">
|
||||||
{note && cells?.map(cell => <PromotedAttributeCell
|
{note && cells?.map(cell => <PromotedAttributeCell
|
||||||
|
key={cell.uniqueId}
|
||||||
cell={cell}
|
cell={cell}
|
||||||
cells={cells} setCells={setCells}
|
cells={cells} setCells={setCells}
|
||||||
shouldFocus={cell === cellToFocus} setCellToFocus={setCellToFocus}
|
shouldFocus={cell === cellToFocus} setCellToFocus={setCellToFocus}
|
||||||
@ -103,7 +106,8 @@ function usePromotedAttributeData(note: FNote | null | undefined, componentId: s
|
|||||||
valueAttr.attributeId = "";
|
valueAttr.attributeId = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
cells.push({ definitionAttr, definition, valueAttr, valueName });
|
const uniqueId = randomString(10);
|
||||||
|
cells.push({ definitionAttr, definition, valueAttr, valueName, uniqueId });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setCells(cells);
|
setCells(cells);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user