Load the RichTextEdit scripts and stylesheets on demand.
bool
true
Basic example
My example content
<RichTextEdit@ref="richTextEditRef"Theme="RichTextEditTheme.Snow"ContentChanged="@OnContentChanged"PlaceHolder="Type your post here..."ReadOnly="@readOnly"SubmitOnEnter="false"EnterPressed="@OnSave"ToolbarPosition="Placement.Bottom"><Editor>My example content</Editor><Toolbar><RichTextEditToolbarGroup><RichTextEditToolbarButtonAction="RichTextEditAction.Bold"/><RichTextEditToolbarButtonAction="RichTextEditAction.Italic"/><RichTextEditToolbarSelectAction="RichTextEditAction.Size"><RichTextEditToolbarSelectItemValue="small"/><RichTextEditToolbarSelectItemSelected/><RichTextEditToolbarSelectItemValue="large"/><RichTextEditToolbarSelectItemValue="huge">Very Big</RichTextEditToolbarSelectItem></RichTextEditToolbarSelect><RichTextEditToolbarButtonAction="RichTextEditAction.List"Value="ordered"/><RichTextEditToolbarButtonAction="RichTextEditAction.List"Value="bullet"/></RichTextEditToolbarGroup><!-- Custom toolbar content --><RichTextEditToolbarGroupFloat="Float.End"><ButtononClick="window.open('https://www.quilljs.com/','quilljs')"><IconName="IconName.InfoCircle"/></Button><ButtonClicked="@OnSave"><IconName="IconName.Save"/></Button></RichTextEditToolbarGroup></Toolbar></RichTextEdit>
The RichTextEdit comes default with 2 themes Snow and Bubble. The Snow theme is a simple flat toolbar theme and the Bubble theme is a tooltip based theme where the toolbar will be displayed in the tooltip.
The RichTextEdit toolbar can be completely customized. QuillJS defines a number of default actions that can be used through the RichTextEditToolbarButton and RichTextEditToolbarSelect components
The RichTextEdit has the option to inject additional QuillJS configuration logic or load additional modules. Use the ConfigureQuillJSMethod property to indicate which javascript method needs to be called during initialization.
If you for example want to change the way how links are sanitized you can use the following logic. Default all user typed url’s are relative to your pages base url. So when a user types google.com this will result in something like https://baseurl/google.com, but if you would probably like https://google.com then use the following configuration routine.
<RichTextEditConfigureQuillJsMethod="myComponent.configureQuillJs"/>@* Define this configuration in a javascript file
window.myComponent = {
configureQuillJs: () => {
var link = Quill.import("formats/link");
link.sanitize = url => {
let newUrl = window.decodeURIComponent(url);
newUrl = newUrl.trim().replace(/\s/g, "");
if (/^(:\/\/)/.test(newUrl)) {
return `http${newUrl}`;
}
if (!/^(f|ht)tps?:\/\//i.test(newUrl)) {
return `http://${newUrl}`;
}
return newUrl;
}
}
}
*@
API
Attributes
RichTextEdit
Name
Description
Type
Default
Toolbar
The custom toolbar definition.
markup
Editor
The editor content.
markup
ReadOnly
Editor read-only flag.
bool
false
Theme
The editor theme.
RichTextEditTheme
Snow
PlaceHolder
Placeholder text for empty editor.
string
ToolbarPosition
Toolbar position (top or bottom).
Placement
Top
SubmitOnEnter
Call EnterPressed event when pressing ENTER key.
bool
false
ContentChanged
Occurs when the content changes.
EventCallback
EnterPressed
Occurs when ENTER key is pressed and SubmitOnEnter.
EventCallback
ConfigureQuillJSMethod
The JavaScript method to call to configure additional QuillJS modules and or add custom bindings.