Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<PackageReference Include="BootstrapBlazor.OctIcon" Version="9.0.4" />
<PackageReference Include="BootstrapBlazor.OnScreenKeyboard" Version="9.0.1" />
<PackageReference Include="BootstrapBlazor.PdfReader" Version="9.0.1" />
<PackageReference Include="BootstrapBlazor.PdfViewer" Version="9.0.0" />
<PackageReference Include="BootstrapBlazor.PdfViewer" Version="9.0.1" />
<PackageReference Include="BootstrapBlazor.Player" Version="9.0.1" />
<PackageReference Include="BootstrapBlazor.RDKit" Version="9.0.2" />
<PackageReference Include="BootstrapBlazor.SignaturePad" Version="9.0.1" />
Expand Down
13 changes: 12 additions & 1 deletion src/BootstrapBlazor.Server/Components/Samples/PdfViewers.razor
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@
<PackageTips Name="BootstrapBlazor.PdfViewer" />

<DemoBlock Title="@Localizer["PdfViewerNormalTitle"]" Introduction="@Localizer["PdfViewerNormalIntro"]" Name="Normal">
<section ignore>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Using a non-standard ignore attribute may not behave as expected

Consider replacing the non-standard ignore attribute with an @if block, a CSS class like d-none, or a framework-supported directive to control visibility.

Suggested implementation:

    <section class="d-none">
        <div class="row g-3">
            <div class="col-12 col-sm-6">

If you want to control the visibility dynamically, you can use an @if block or bind the class to a variable. For example:

@if (showSection)
{
    <section>
        ...
    </section>
}

or

<section class="@(showSection ? "" : "d-none")">
    ...
</section>

Replace showSection with your actual condition.

<div class="row g-3">
<div class="col-12 col-sm-6">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="UseGoogleDocs"></BootstrapInputGroupLabel>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Label text should be localized

Use the Localizer for the label text to support localization, e.g., DisplayText="@localizer["UseGoogleDocs"]".

Suggested change
<BootstrapInputGroupLabel DisplayText="UseGoogleDocs"></BootstrapInputGroupLabel>
<BootstrapInputGroupLabel DisplayText="@Localizer["UseGoogleDocs"]"></BootstrapInputGroupLabel>

<Switch @bind-Value="@_useGoogleDocs"></Switch>
</BootstrapInputGroup>
</div>
</div>
</section>
<PdfViewer Url="./samples/pdf-viewer.pdf" Height="620px"
NotSupportCallback="NotSupportCallback" OnLoaded="OnLoaded"></PdfViewer>
NotSupportCallback="NotSupportCallback" OnLoaded="OnLoaded"
UseGoogleDocs="@_useGoogleDocs"></PdfViewer>
</DemoBlock>
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public partial class PdfViewers
[Inject, NotNull]
private ToastService? ToastService { get; set; }

private bool _useGoogleDocs = true;

private Task OnLoaded() => ToastService.Success("Pdf Viewer", Localizer["PdfViewerToastSuccessfulContent"]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Toast title is hard-coded and inconsistent

The success and error toasts use different titles ('Pdf Viewer' vs. 'PdfViewer'). Please standardize and consider localizing the title for consistency.


private Task NotSupportCallback() => ToastService.Error("PdfViewer", Localizer["PdfViewerToastNotSupportContent"]);
Expand Down
2 changes: 1 addition & 1 deletion src/BootstrapBlazor.Server/Locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -6161,7 +6161,7 @@
"PdfViewerTitle": "PDFViewer",
"PdfViewerDescription": "Open the PDF file in the component to read its contents",
"PdfViewerNormalTitle": "Basic usage",
"PdfViewerNormalIntro": "Load a PDF file by setting the <code>Url</code> parameter",
"PdfViewerNormalIntro": "Load a PDF file by setting the <code>Url</code> parameter. Set <code>UseGoogleDocs</code> to use docs.google.com preview",
"PdfViewerToastSuccessfulContent": "PDF document loaded successfully.",
"PdfViewerToastNotSupportContent": "The browser does not support inline viewing of PDF files."
},
Expand Down
2 changes: 1 addition & 1 deletion src/BootstrapBlazor.Server/Locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -6161,7 +6161,7 @@
"PdfViewerTitle": "PDFViewer PDF 阅读器",
"PdfViewerDescription": "在组件中打开 Pdf 文件阅读其内容",
"PdfViewerNormalTitle": "基础用法",
"PdfViewerNormalIntro": "通过设置 <code>Url</code> 参数加载 Pdf 文件",
"PdfViewerNormalIntro": "通过设置 <code>Url</code> 参数加载 Pdf 文件,设置 <code>UseGoogleDocs</code> 使用 docs.google.com 预览",
"PdfViewerToastSuccessfulContent": "PDF 文档加载成功",
"PdfViewerToastNotSupportContent": "当前浏览器不支持 Pdf 文档预览功能"
},
Expand Down