1
1
const searchButtonContainerIds = [
2
- "fern-search-bar" ,
3
2
"fern-search-button" ,
3
+ "fern-search-bar"
4
4
] ;
5
5
6
6
// Define the base settings
7
7
const inkeepSettings = {
8
- isOpen : true ,
9
8
baseSettings : {
10
9
apiKey : "a58574ddc0e41c75990d1c0e890ad3c8725dc9e7c8ee3d3e" ,
11
10
integrationId : "clthv1rgg000sdjil26l2vg03" ,
@@ -34,26 +33,6 @@ const inkeepSettings = {
34
33
}
35
34
} ;
36
35
37
- // Function to initialize search containers
38
- function initializeSearchContainers ( ) {
39
- // Clone and replace search buttons to remove existing listeners
40
- // Only process elements that exist
41
- const clonedSearchButtonContainers = searchButtonContainerIds
42
- . map ( ( id ) => {
43
- const originalElement = document . getElementById ( id ) ;
44
- if ( ! originalElement ) {
45
- console . log ( `Search container ${ id } not found, skipping...` ) ;
46
- return null ;
47
- }
48
- const clonedElement = originalElement . cloneNode ( true ) ;
49
- originalElement . parentNode . replaceChild ( clonedElement , originalElement ) ;
50
- return clonedElement ;
51
- } )
52
- . filter ( Boolean ) ; // Remove null entries
53
-
54
- return clonedSearchButtonContainers ;
55
- }
56
-
57
36
// Function to initialize Inkeep
58
37
function initializeInkeep ( ) {
59
38
// Color mode sync settings
@@ -88,13 +67,23 @@ function initializeInkeep() {
88
67
} ,
89
68
} ,
90
69
} ) ;
91
-
92
- // Get search containers after DOM is ready
93
- const clonedSearchButtonContainers = initializeSearchContainers ( ) ;
70
+
71
+ const clonedSearchButtonContainers = searchButtonContainerIds
72
+ . map ( ( id ) => {
73
+ const originalElement = document . getElementById ( id ) ;
74
+ if ( ! originalElement ) {
75
+ console . log ( `Search container ${ id } not found, skipping...` ) ;
76
+ return null ;
77
+ }
78
+ originalElement . disabled = false ;
79
+ return originalElement
80
+ } ) . filter ( Boolean ) ;
94
81
95
82
// Add click listeners to search buttons
96
83
clonedSearchButtonContainers . forEach ( ( trigger ) => {
84
+ console . log ( "adding trigger" )
97
85
trigger . addEventListener ( "click" , function ( ) {
86
+ console . log ( "clicked" )
98
87
inkeepSearchModal . render ( {
99
88
isOpen : true ,
100
89
} ) ;
@@ -106,7 +95,6 @@ function initializeInkeep() {
106
95
"keydown" ,
107
96
( event ) => {
108
97
if (
109
- ( event . metaKey || event . ctrlKey ) &&
110
98
( event . key === "/" )
111
99
) {
112
100
event . stopPropagation ( ) ;
0 commit comments