mirror of
https://github.com/halo-dev/theme-earth.git
synced 2025-10-14 14:30:50 +00:00
feat: add search widget plugin adaptation support
This commit is contained in:
1
env.d.ts
vendored
1
env.d.ts
vendored
@@ -6,5 +6,6 @@ export {};
|
||||
declare global {
|
||||
interface Window {
|
||||
Alpine: Alpine;
|
||||
SearchWidget: any;
|
||||
}
|
||||
}
|
||||
|
@@ -34,3 +34,11 @@ export function generateToc() {
|
||||
scrollSmoothOffset: -100,
|
||||
});
|
||||
}
|
||||
|
||||
// 此主题的搜索依赖 https://github.com/halo-sigs/plugin-search-widget 插件,在 Halo 支持主题依赖插件之前,使用 alert 以提示使用者。
|
||||
export function openSearch() {
|
||||
if(!window.SearchWidget) {
|
||||
alert("未安装或启用搜索插件,无法使用搜索功能。https://github.com/halo-sigs/plugin-search-widget");
|
||||
}
|
||||
window.SearchWidget.open()
|
||||
}
|
6
templates/assets/dist/main.iife.js
vendored
6
templates/assets/dist/main.iife.js
vendored
File diff suppressed because one or more lines are too long
@@ -87,7 +87,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="text-gray-600 hover:text-blue-600">
|
||||
<a href="javascript:main.openSearch()" class="text-gray-600 hover:text-blue-600">
|
||||
<span data-icon="tabler:search" class="iconify text-lg"></span>
|
||||
</a>
|
||||
</li>
|
||||
|
Reference in New Issue
Block a user