@@ -328,18 +328,12 @@ export default function CopyPageButton({
328328 } ;
329329
330330 const extractPageContent = ( ) => {
331- console . log ( 'Extracting page content...' ) ;
332-
333331 const mainContent =
334332 document . querySelector ( "main article" ) ||
335333 document . querySelector ( "main .markdown" ) ;
336334
337- console . log ( 'Found main content element:' , ! ! mainContent ) ;
338335 if ( ! mainContent ) {
339- console . error ( 'No main content found - looking for alternative selectors' ) ;
340- // Try alternative selectors
341336 const alternatives = document . querySelector ( "main" ) || document . querySelector ( "article" ) || document . querySelector ( ".main-wrapper" ) ;
342- console . log ( 'Alternative content element found:' , ! ! alternatives ) ;
343337 if ( ! alternatives ) return "" ;
344338 }
345339
@@ -354,42 +348,30 @@ export default function CopyPageButton({
354348 // Extract title from first H1 and remove it from content
355349 const firstH1 = clone . querySelector ( "h1" ) ;
356350 const title = firstH1 ?. textContent . trim ( ) || "Documentation Page" ;
357- console . log ( 'Extracted title:' , title ) ;
358351 if ( firstH1 ) {
359352 firstH1 . remove ( ) ;
360353 }
361354
362355 const content = convertToMarkdown ( clone ) ;
363- console . log ( 'Converted content length:' , content . length ) ;
364- console . log ( 'Content preview:' , content . substring ( 0 , 200 ) ) ;
365-
366356 const currentUrl = window . location . href ;
367- const finalContent = `# ${ title } \n\nURL: ${ currentUrl } \n\n${ content } ` ;
368- console . log ( 'Final page content set with length:' , finalContent . length ) ;
369- return finalContent ;
357+ return `# ${ title } \n\nURL: ${ currentUrl } \n\n${ content } ` ;
370358 } ;
371359
372360 const copyToClipboard = async ( text ) => {
373- console . log ( 'copyToClipboard called with text length:' , text ?. length ) ;
374- console . log ( 'Text content preview:' , text ?. substring ( 0 , 100 ) ) ;
375-
376361 // If no content, try to extract it now
377362 if ( ! text || text . trim ( ) === '' ) {
378- console . log ( 'No pageContent available, extracting now...' ) ;
379363 const extractedContent = extractPageContent ( ) ;
380364 if ( extractedContent ) {
381365 setPageContent ( extractedContent ) ;
382366 text = extractedContent ;
383367 } else {
384- console . error ( 'Failed to extract content' ) ;
385368 return ;
386369 }
387370 }
388-
371+
389372 try {
390373 if ( navigator . clipboard && navigator . clipboard . writeText ) {
391374 await navigator . clipboard . writeText ( text ) ;
392- console . log ( 'Content copied to clipboard successfully' ) ;
393375 } else {
394376 // Fallback for older browsers
395377 const textArea = document . createElement ( 'textarea' ) ;
@@ -398,10 +380,9 @@ export default function CopyPageButton({
398380 textArea . select ( ) ;
399381 document . execCommand ( 'copy' ) ;
400382 document . body . removeChild ( textArea ) ;
401- console . log ( 'Content copied to clipboard using fallback method' ) ;
402383 }
403384 } catch ( err ) {
404- console . error ( 'Failed to copy to clipboard:' , err ) ;
385+ // Silently fail
405386 }
406387 } ;
407388
@@ -414,38 +395,31 @@ export default function CopyPageButton({
414395Please provide a clear summary and help me understand the key concepts covered in this documentation.`
415396 ) ;
416397 window . open ( `${ baseUrl } ?${ queryParam } =${ prompt } ` , "_blank" ) ;
417- console . log ( 'Opened AI tool with prompt' ) ;
418398 } catch ( err ) {
419- console . error ( 'Failed to open AI tool:' , err ) ;
399+ // Silently fail
420400 }
421401 } ;
422402
423403 const viewAsMarkdown = ( ) => {
424- console . log ( 'viewAsMarkdown called with pageContent length:' , pageContent ?. length ) ;
425- console . log ( 'PageContent preview:' , pageContent ?. substring ( 0 , 100 ) ) ;
426-
427404 let contentToView = pageContent ;
428-
405+
429406 // If no content, try to extract it now
430407 if ( ! contentToView || contentToView . trim ( ) === '' ) {
431- console . log ( 'No pageContent available, extracting now...' ) ;
432408 const extractedContent = extractPageContent ( ) ;
433409 if ( extractedContent ) {
434410 setPageContent ( extractedContent ) ;
435411 contentToView = extractedContent ;
436412 } else {
437- console . error ( 'Failed to extract content' ) ;
438413 return ;
439414 }
440415 }
441-
416+
442417 try {
443418 const blob = new Blob ( [ contentToView ] , { type : "text/plain" } ) ;
444419 const url = URL . createObjectURL ( blob ) ;
445420 window . open ( url , "_blank" ) ;
446- console . log ( 'Opened markdown view' ) ;
447421 } catch ( err ) {
448- console . error ( 'Failed to open markdown view:' , err ) ;
422+ // Silently fail
449423 }
450424 } ;
451425
0 commit comments