File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,10 @@ import createBlock from "roamjs-components/writes/createBlock";
2525import updateBlock from "roamjs-components/writes/updateBlock" ;
2626import DiscourseNodeSuggestiveRules from "./DiscourseNodeSuggestiveRules" ;
2727
28+ export const getCleanTagText = ( tag : string ) : string => {
29+ return tag . replace ( / ^ # + / , "" ) . trim ( ) . toUpperCase ( ) ;
30+ } ;
31+
2832const ValidatedInputPanel = ( {
2933 label,
3034 description,
@@ -215,10 +219,6 @@ const NodeConfig = ({
215219 true ,
216220 ) ;
217221
218- const getCleanTagText = ( tag : string ) : string => {
219- return tag . replace ( / ^ # + / , "" ) . trim ( ) . toUpperCase ( ) ;
220- } ;
221-
222222 const validate = useCallback ( ( tag : string , format : string ) => {
223223 const cleanTag = getCleanTagText ( tag ) ;
224224
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ import { formatHexColor } from "~/components/settings/DiscourseNodeCanvasSetting
4949import { getSetting } from "./extensionSettings" ;
5050import { mountLeftSidebar } from "~/components/LeftSidebarView" ;
5151import { getUidAndBooleanSetting } from "./getExportSettings" ;
52+ import { getCleanTagText } from "~/components/settings/NodeConfig" ;
5253
5354const debounce = ( fn : ( ) => void , delay = 250 ) => {
5455 let timeout : number ;
@@ -109,8 +110,11 @@ export const initObservers = async ({
109110 callback : ( s : HTMLSpanElement ) => {
110111 const tag = s . getAttribute ( "data-tag" ) ;
111112 if ( tag ) {
113+ const normalizedTag = getCleanTagText ( tag ) ;
114+
112115 for ( const node of getDiscourseNodes ( ) ) {
113- if ( tag . toLowerCase ( ) === node . tag ?. toLowerCase ( ) ) {
116+ const normalizedNodeTag = node . tag ? getCleanTagText ( node . tag ) : "" ;
117+ if ( normalizedTag === normalizedNodeTag ) {
114118 renderNodeTagPopupButton ( s , node , onloadArgs . extensionAPI ) ;
115119 if ( node . canvasSettings ?. color ) {
116120 s . style . color = formatHexColor ( node . canvasSettings . color ) ;
You can’t perform that action at this time.
0 commit comments