@@ -191,7 +191,14 @@ const LinkNode: React.FC<LinkNodeProps> = ({ node, canEdit = false, isEditing =
191191 // NOTE: Compound links are now handled separately in the rendering logic,
192192 // so this function only extracts the base text without compound formatting
193193
194- // CRITICAL FIX: Properly extract custom text from children array first
194+ // CRITICAL FIX: Check for direct text property first (legacy links)
195+ // This handles legacy links that have a direct "text" property
196+ if ( node . text && node . text . trim ( ) && node . text !== 'Link' && node . text !== 'Page Link' ) {
197+ console . log ( 'LEGACY_TEXT_DEBUG: Found direct text property:' , node . text ) ;
198+ return node . text . trim ( ) ;
199+ }
200+
201+ // CRITICAL FIX: Properly extract custom text from children array
195202 // This is the most important source of custom text that users configure
196203 if ( node . children && Array . isArray ( node . children ) && node . children . length > 0 ) {
197204 // Concatenate all text from children to handle custom text properly
@@ -207,35 +214,35 @@ const LinkNode: React.FC<LinkNodeProps> = ({ node, canEdit = false, isEditing =
207214 }
208215 }
209216
210- // 2 . Check for explicit displayText property (backup for custom text)
217+ // 3 . Check for explicit displayText property (backup for custom text)
211218 if ( node . displayText && node . displayText !== 'Link' && node . displayText . trim ( ) ) {
212219 console . log ( 'CUSTOM_TEXT_DEBUG: Found displayText:' , node . displayText ) ;
213220 return node . displayText ;
214221 }
215222
216- // 3 . Check for pageTitle (for page links without custom text)
223+ // 4 . Check for pageTitle (for page links without custom text)
217224 if ( node . pageTitle && node . pageTitle !== 'Link' ) {
218225 return node . pageTitle ;
219226 }
220227
221- // 4 . Check for originalPageTitle
228+ // 5 . Check for originalPageTitle
222229 if ( node . originalPageTitle && node . originalPageTitle !== 'Link' ) {
223230 return node . originalPageTitle ;
224231 }
225232
226- // 5 . Use the standardized utility function as fallback
233+ // 6 . Use the standardized utility function as fallback
227234 const utilityText = getLinkDisplayText ( node ) ;
228235 if ( utilityText && utilityText !== 'Link' ) {
229236 return utilityText ;
230237 }
231238
232- // 6 . Check for text in data property
239+ // 7 . Check for text in data property
233240 if ( node . data && typeof node . data === 'object' ) {
234241 if ( node . data . text && node . data . text . trim ( ) ) return node . data . text ;
235242 if ( node . data . displayText && node . data . displayText . trim ( ) ) return node . data . displayText ;
236243 }
237244
238- // 7 . Use appropriate fallbacks based on link type
245+ // 8 . Use appropriate fallbacks based on link type
239246 if ( isExternal && href ) return href ;
240247 if ( pageId ) return pageId . replace ( / - / g, ' ' ) ;
241248
0 commit comments