From bb59f6600891082ad1918547c62f386080ebcf5d Mon Sep 17 00:00:00 2001 From: sbwalker Date: Sat, 23 Mar 2024 11:55:44 -0400 Subject: [PATCH] set active tab in RichTextEditor based on content --- Oqtane.Client/Modules/Controls/RichTextEditor.razor | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Oqtane.Client/Modules/Controls/RichTextEditor.razor b/Oqtane.Client/Modules/Controls/RichTextEditor.razor index b313500b..b99032a4 100644 --- a/Oqtane.Client/Modules/Controls/RichTextEditor.razor +++ b/Oqtane.Client/Modules/Controls/RichTextEditor.razor @@ -6,7 +6,7 @@
- + @if (AllowRichText) { @@ -114,6 +114,7 @@ private string _rawhtml = string.Empty; private string _originalrawhtml = string.Empty; private string _message = string.Empty; + private string _activetab = "Rich"; [Parameter] public string Content { get; set; } @@ -156,6 +157,12 @@ _rawhtml = Content; _originalrawhtml = _rawhtml; // preserve for comparison later _originalrichhtml = ""; + + // Quill wraps content in

tags which can be used as a signal to set the active tab + if (!string.IsNullOrEmpty(Content) && !Content.StartsWith("

") && AllowRawHtml) + { + _activetab = "Raw"; + } } protected override async Task OnAfterRenderAsync(bool firstRender)