@using Oqtane.Modules.HtmlText.Services @namespace Oqtane.Modules.HtmlText @inherits ModuleBase @inject IHtmlTextService HtmlTextService @inject ISettingService SettingService @inject IStringLocalizer Localizer @for (int i = 1; i < 6; i++) { string product = $"product{i}";
} @if (PageState.EditMode) {
} @((MarkupString)content) @if (PageState.EditMode && content.Length > 3000) {
} @code { private string content = ""; //public override string RenderMode => RenderModes.Static; Dictionary _labels = new Dictionary { { ":product1", "成为顾问 (FIA)"}, { ":product2", "Market Shield Savings Plan (MS)"}, { ":product3", "Global Term Life Insurance"}, { ":product4", "Protection Advantage Universal Life Insurance"}, { ":product5", "Summit Indexed Universal Life Insurance"} }; private List _products = new List(); private void ProductChanged(string product) { if (_products.Contains(product)) { _products.Remove(product); } else { _products.Add(product); } } private string GetLabel(string key) { if (_labels.ContainsKey($"{PageState.Alias.Path}:{key}")) { return _labels[$"{PageState.Alias.Path}:{key}"]; } else { return ""; } } protected override async Task OnParametersSetAsync() { try { if (ShouldRender()) { var htmltext = await HtmlTextService.GetHtmlTextAsync(ModuleState.ModuleId); if (htmltext != null) { content = htmltext.Content; content = Utilities.FormatContent(content, PageState.Alias, "render"); if (bool.Parse(SettingService.GetSetting(ModuleState.Settings, "DynamicTokens", "false"))) { content = ReplaceTokens(content); } } else { content = ""; } } } catch (Exception ex) { await logger.LogError(ex, "Error Loading Content {Error}", ex.Message); AddModuleMessage(Localizer["Error.Content.Load"], MessageType.Error); } } }