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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -389,3 +389,6 @@ src/**/wwwroot/**/uploader
# test
**/UnitTestSvgIcon/**/*.svg
**/UnitTestSvgIcon/**/*.razor

# AI
**/.workbuddy/
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<Version>10.0.1</Version>
</PropertyGroup>

<PropertyGroup>
<PackageTags>Bootstrap Blazor WebAssembly wasm UI Components ImageCropper</PackageTags>
<Description>Bootstrap UI components extensions of ImageCropper</Description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ namespace BootstrapBlazor.Components;
/// </summary>
public partial class ImageCropper
{
private const string CropperStylePath = "_content/BootstrapBlazor.ImageCropper/cropper.bundle.css";

/// <summary>
/// 获得/设置 图片地址 URL
/// </summary>
Expand Down Expand Up @@ -92,8 +94,15 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
{
Options = Options ?? new(),
TriggerOnCropEndAsync = OnCropChangedAsync != null ? nameof(TriggerOnCropChangedAsync) : null,
StyleUrl = CropperStyleUrl
});

#if NET9_0_OR_GREATER
private string CropperStyleUrl => Assets[CropperStylePath];
#else
private static string CropperStyleUrl => CropperStylePath;
#endif

/// <summary>
/// 剪裁方法 触发 <see cref="OnCropAsync"/> 回调方法
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ import Data from '../BootstrapBlazor/modules/data.js'
import { addLink } from '../BootstrapBlazor/modules/utility.js'

export async function init(id, invoke, options) {
await addLink("./_content/BootstrapBlazor.ImageCropper/cropper.bundle.css");

const el = document.getElementById(id);
if (el === null) {
return;
}

const image = el.querySelector(".bb-cropper-image");
const { options: op, triggerOnCropEndAsync } = options;
const { options: op, triggerOnCropEndAsync, styleUrl } = options;
await addLink(styleUrl);
Comment thread
ArgoZhang marked this conversation as resolved.
if (triggerOnCropEndAsync) {
let cropData = null;
op.cropend = () => {
Expand Down
Loading