private MarkupString AddClass(MarkupString svg) { var svgData = svg.ToString(); var svgLine = Regex.Match(svg.ToString(), @"<svg(.*?)>", RegexOptions.Singleline).Value; svgData = svgData.Replace(svgLine, ""); var classIndex = svgLine.IndexOf("class=", StringComparison.Ordinal); if (classIndex > -1) { svgLine = svgLine.Replace("class=", $"class={ClassBuilder} "); } else { svgLine = svgLine.Replace("<svg", $"<svg class=\"{ClassBuilder}\" "); } return(new MarkupString(svgLine + svgData)); }
public async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "SetDescription/{category}/{name}")] HttpRequest req, [Blob("dzi-images/{category}/{name}/description.txt", FileAccess.Write)] CloudBlockBlob blob, string category, string name, ILogger log) { try { try { ClaimsPrincipal principal = await _JwtService.GetClaimsPrincipalAsync(req); if (!principal.Identity.IsAuthenticated) { return(new UnauthorizedResult()); } } catch (Exception e) { log.LogError(e.ToString()); return(new UnauthorizedResult()); } if (name.Contains('/') || name.Contains('\\') || category.Contains('/') || category.Contains('\\')) { throw new ArgumentException("The file name or category contained a slash."); } MarkupString markup = JsonConvert.DeserializeObject <MarkupString>(await req.ReadAsStringAsync()); blob.Properties.ContentType = "text/plain"; await blob.UploadTextAsync(markup.ToString()); return(new OkResult()); } catch (Exception e) { log.LogError(e.ToString()); return(new InternalServerErrorResult()); } }
public async Task <object> Open(MarkupString htmlContent, ILocationable locationable) { return(await jSRuntime.InvokeAsync <object>( "blazorGoogleMap.openInfoWindow", string.Empty, locationable, htmlContent.ToString())); }
public static string ReplaceHtmlLineBreaks(this MarkupString source) => source.ToString().ReplaceHtmlLineBreaks();
public static MarkupString Replace(this MarkupString source, string oldValue, string newValue) => source.ToString().Replace(oldValue, newValue).ToMarkup();
public async Task SetHTMLAsync(ElementReference editorReference, MarkupString markup) { await _JSRuntime.InvokeVoidAsync("QuillClient.setHTML", editorReference, markup.ToString()); }