How to Disable Auto Numbering Lists in JavaScript Rich Text Editor?
To disable the auto numbering lists feature in the JavaScript Rich Text Editor, you can utilize the actionBegin
event of the control. This allows you to intercept the action and prevent the default behavior when a user attempts to create ordered or unordered lists by typing 1.
or *
followed by space bar.
Initializing the Rich Text Editor
Initialize and set up the RichTextEditor with the actionBegin event.
var defaultRTE = new ej.richtexteditor.RichTextEditor({
actionBegin: actionBegin,
});
defaultRTE.appendTo('#defaultRTE');
Implement the ActionBegin event
- The
actionBegin
function checks if the action is a space key press and if the request type is either an ordered list (OL
) or an unordered list (UL
). - If both conditions are met, the
args.cancel
property is set totrue
, which prevents the auto numbering feature from being triggered.
Here is a code snippet demonstrating how to achieve this:
function actionBegin(args) {
if (args.originalEvent.action == 'space' && (args.requestType == 'OL' || args.requestType == 'UL')
) {
args.cancel = true;
}
}
Conclusion
I hope you enjoyed learning how to disable auto numbering lists in JavaScript Rich Text Editor.
You can refer to our JavaScript Rich Text Editor feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our JavaScript Rich Text Editor Example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!