Skip to content

Commit

Permalink
refactor(MeiliSearch): use HeadContent render static assets (#177)
Browse files Browse the repository at this point in the history
* refactor: use HeadContent render static assets

* chore: bump version 9.0.6
  • Loading branch information
ArgoZhang authored Dec 16, 2024
1 parent 7e50a18 commit 76761c4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<Version>9.0.5</Version>
<Version>9.0.6</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
@namespace BootstrapBlazor.Components
@using Microsoft.AspNetCore.Components.Web
@namespace BootstrapBlazor.Components
@inherits BootstrapModuleComponentBase
@attribute [JSModuleAutoLoader("./_content/BootstrapBlazor.MeiliSearch/MeiliSearchBox.razor.js")]

<HeadContent>
<link href="_content/BootstrapBlazor.MeiliSearch/meilisearch.css" rel="stylesheet" />
<script src="_content/BootstrapBlazor.MeiliSearch/meilisearch.umd.min.js"></script>
</HeadContent>

<div @attributes="@AdditionalAttributes" id="@Id" class="@ClassString">
<i class="fa-solid fa-search"></i>
<input type="text" readonly placeholder="@SearchBoxPlaceHolder" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import { addScript, addLink, debounce, isMobile } from "../BootstrapBlazor/modules/utility.js"
import { debounce, isMobile } from "../BootstrapBlazor/modules/utility.js"
import Data from "../BootstrapBlazor/modules/data.js"
import EventHandler from "../BootstrapBlazor/modules/event-handler.js"

if (window.BootstrapBlazor === void 0) {
window.BootstrapBlazor = {};
}

export async function init(id, options) {
export function init(id, options) {
const el = document.getElementById(id);
await addLink('./_content/BootstrapBlazor.MeiliSearch/meilisearch.css');
el.classList.remove('d-none');

await addScript('./_content/BootstrapBlazor.MeiliSearch/meilisearch.umd.min.js')
const search = {
el, options,
searchText: 'searching ...',
Expand Down

0 comments on commit 76761c4

Please sign in to comment.