Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion apps/roam/src/components/settings/NodeConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,19 @@ const useDebouncedRoamUpdater = <
return { value, handleChange, handleBlur };
};

const generateTagPlaceholder = (node: DiscourseNode): string => {
// Extract first reference from format like [[CLM]], [[QUE]], [[EVD]]
const referenceMatch = node.format.match(/\[\[([A-Z]+)\]\]/);

if (referenceMatch) {
const reference = referenceMatch[1].toLowerCase();
return `#${reference.slice(0, 3)}-candidate`; // [[EVD]] - {content} = #evd-candidate
}

const nodeTextPrefix = node.text.toLowerCase().slice(0, 3);
return `#${nodeTextPrefix}-candidate`; // Evidence = #evi-candidate
};

const NodeConfig = ({
node,
onloadArgs,
Expand Down Expand Up @@ -288,7 +301,7 @@ const NodeConfig = ({
onChange={handleTagChange}
onBlur={handleTagBlur}
error={tagError}
placeholder={`#${node.text.toLowerCase()}`}
placeholder={generateTagPlaceholder(node)}
/>
</div>
}
Expand Down
2 changes: 2 additions & 0 deletions apps/roam/src/data/defaultDiscourseNodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const INITIAL_NODE_VALUES: Partial<DiscourseNode>[] = [
format: "[[CLM]] - {content}",
text: "Claim",
shortcut: "C",
tag: "#clm-candidate",
graphOverview: true,
canvasSettings: {
color: "7DA13E",
Expand All @@ -26,6 +27,7 @@ const INITIAL_NODE_VALUES: Partial<DiscourseNode>[] = [
format: "[[EVD]] - {content} - {Source}",
text: "Evidence",
shortcut: "E",
tag: "#evd-candidate",
graphOverview: true,
canvasSettings: {
color: "DB134A",
Expand Down