remove ITextEditorProvider interface

This commit is contained in:
sbwalker
2024-07-22 13:31:24 -04:00
parent 1c01087eda
commit 8b2e55a969
12 changed files with 40 additions and 66 deletions

View File

@ -14,7 +14,7 @@
</div>
@code {
private string _textEditorProvider;
private string _textEditorType;
private RenderFragment _textEditorComponent;
private ITextEditor _textEditor;
@ -35,7 +35,7 @@
protected override async Task OnInitializedAsync()
{
_textEditorProvider = await GetTextEditorType();
_textEditorType = await GetTextEditorType();
}
protected override void OnParametersSet()
@ -63,9 +63,9 @@
private void CreateTextEditor(RenderTreeBuilder builder)
{
if(!string.IsNullOrEmpty(_textEditorProvider))
if(!string.IsNullOrEmpty(_textEditorType))
{
var editorType = Type.GetType(_textEditorProvider);
var editorType = Type.GetType(_textEditorType);
if (editorType != null)
{
builder.OpenComponent(0, editorType);
@ -111,18 +111,18 @@
private async Task<string> GetTextEditorType()
{
const string EditorSettingName = "TextEditorProvider";
const string EditorSettingName = "TextEditor";
if(!string.IsNullOrEmpty(Provider))
{
var provider = ServiceProvider.GetServices<ITextEditorProvider>().FirstOrDefault(i => i.Name.Equals(Provider, StringComparison.OrdinalIgnoreCase));
var provider = ServiceProvider.GetServices<ITextEditor>().FirstOrDefault(i => i.Name.Equals(Provider, StringComparison.OrdinalIgnoreCase));
if(provider != null)
{
return provider.EditorType;
return Utilities.GetFullTypeName(provider.GetType().AssemblyQualifiedName);
}
}
var settings = await SettingService.GetSiteSettingsAsync(PageState.Site.SiteId);
return SettingService.GetSetting(settings, EditorSettingName, Constants.DefaultTextEditorProvider);
return SettingService.GetSetting(settings, EditorSettingName, Constants.DefaultTextEditor);
}
}