Hi,
Is there a way to use two different HTMLEditorProviders on one site? I have edited the web.config and added the new provider. However, how can I use the second provider without making it default?
Refering to EditAnnouncements.ascx the <dnn:texteditor> tag is used to place the editor on a page. So I thought I could add a parameter like provider=”…” to it and searched for something like this in “~/controls/TextEditor.ascx”. The code behind this control (DotNetNuke.UI.UserControls.TextEditor) reveals how the provider is actually created:
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
RichTextEditor = HTMLEditorProvider.HtmlEditorProvider.Instance
RichTextEditor.ControlID = Me.ID
RichTextEditor.Initialize()
End Sub
So following the static Instance function I came to:
' dynamically create provider
Private Shared Sub CreateProvider()
objProvider = CType(Framework.Reflection.CreateObject("htmlEditor"), HtmlEditorProvider)
End Sub
' return the provider
Public Shared Shadows Function Instance() As HtmlEditorProvider
CreateProvider()
Return objProvider
End Function
At this point, we are doomed to only get the default provider instance, because CreateObject has not enough parameters to create anything else (Refer to DotNetNuke.Framework.Reflection.CreateObject. Am I missing something or do I really have to modify core files in order to use two providers at the time?
best regards
patrick
PS: I found http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspnet/html/asp02182004.asp very useful, it says:
“Features that derive from the various provider base classes should follow the common pattern of supporting a Provider property and Providers collection property that allow the developer to access the default configured provider as well as the other providers specified in configuration.”
How can I access this collection in DNN?