You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constTOGGLE_BUTTON_REFERENCE_ELEMENT_NOT_FOUND_WARNING="[mkdocs-toggle-sidebar-plugin] Reference element for inserting 'toggle_button' not found. This version of the plugin may not be compatible with this version of the theme. Try updating both to the latest version. If that fails, you can open an GitHub issue.";
// Custom key handlers: SEE https://squidfunk.github.io/mkdocs-material/setup/setting-up-navigation/?h=key+bind#docsjavascriptsshortcutsjs
182
+
keyboard$.subscribe(key=>{
183
+
if(key.mode==="global"){
184
+
if(coreEventListenerLogic(key.type)){
185
+
// event handled, stop propagation
186
+
key.claim();
187
+
}
188
+
}
189
+
});
190
+
}
191
+
192
+
// END OF INCLUDE
193
+
194
+
// argument: string, returns true if the key was handled and the event should be marked as already handled
195
+
constcoreEventListenerLogic=(keyChar)=>{
196
+
if(keyChar==="t"){
197
+
toggleVisibility(false,true);
198
+
returntrue;
199
+
}elseif(keyChar==="m"){
200
+
toggleVisibility(true,false);
201
+
returntrue;
202
+
}elseif(keyChar==="b"){
203
+
toggleVisibility(true,true);
204
+
returntrue;
205
+
}else{
206
+
returnfalse;
207
+
}
208
+
}
209
+
210
+
constonPageLoadedAction=()=>{
211
+
console.log("The mkdocs-toggle-sidebar-plugin is installed. It adds the following key bindings:\n T -> toggle table of contents sidebar\n M -> toggle navigation menu sidebar\n B -> toggle both sidebars (TOC and navigation)");
212
+
213
+
consttoggle_button="all";
214
+
if(toggle_button=="none"){
215
+
// do nothing
216
+
}elseif(toggle_button=="navigation"){
217
+
addToggleButton(true,false);
218
+
}elseif(toggle_button=="toc"){
219
+
addToggleButton(false,true);
220
+
}elseif(toggle_button=="all"){
221
+
addToggleButton(true,true);
222
+
}else{
223
+
console.error(`[mkdocs-toggle-sidebar-plugin] Unknown value for toggle_button: '${toggleButtonType}'`);
0 commit comments