Skip to content
Closed
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
10 changes: 7 additions & 3 deletions apps/roam/src/components/DiscourseNodeMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const NodeMenu = ({
setTimeout(() => {
const currentText = textarea.value;
const cursorPos = textarea.selectionStart;
const textToInsert = `#${tag} `;
const textToInsert = `#${tag.replace(/^#/, "")} `;

const newText = `${currentText.substring(
0,
Expand Down Expand Up @@ -249,9 +249,13 @@ const NodeMenu = ({
<MenuItem
key={item.text}
data-node={item.type}
data-tag={item.tag}
data-tag={item.tag?.replace(/^#/, "")}
text={
showNodeTypes ? item.text : item.tag ? `#${item.tag}` : ""
showNodeTypes
? item.text
: item.tag
? `#${item.tag.replace(/^#/, "")}`
: ""
}
active={i === activeIndex}
onMouseEnter={() => setActiveIndex(i)}
Expand Down
2 changes: 1 addition & 1 deletion apps/roam/src/components/settings/NodeConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ const NodeConfig = ({
onChange={handleTagChange}
onBlur={handleTagBlur}
error={tagError}
placeholder={`${node.text}`}
placeholder={`#${node.text.toLowerCase()}`}
/>
</div>
}
Expand Down
10 changes: 7 additions & 3 deletions apps/roam/src/utils/renderNodeTagPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,15 @@ export const renderNodeTagPopupButton = (
const tag = tagAttr.replace(/^#/, "").toLowerCase();
const discourseNodes = getDiscourseNodes();
const discourseTagSet = new Set(
discourseNodes.map((n) => n.tag?.toLowerCase()).filter(Boolean),
discourseNodes
.map((n) => n.tag?.replace(/^#/, "").toLowerCase())
.filter(Boolean),
);
if (!discourseTagSet.has(tag)) return;

const matchedNode = discourseNodes.find((n) => n.tag?.toLowerCase() === tag);
const matchedNode = discourseNodes.find(
(n) => n.tag?.replace(/^#/, "").toLowerCase() === tag,
);

if (!matchedNode) return;

Expand All @@ -67,7 +71,7 @@ export const renderNodeTagPopupButton = (
initialTitle: cleanedBlockText,
});
}}
text={`Create ${matchedNode.text}`}
text={`Create #${matchedNode.tag?.replace(/^#/, "").toLowerCase()}`}
/>
}
target={
Expand Down