Examples

Keyboard Shortcuts

General Shortcuts (CTRL+Z,A,X,C,V,B,U,I) are supported in Rich Text Editor. You can also create your own keyboard shortcuts.

This demo shows how to create two shortcuts (CTRL+J and Ctrl+Down Arrow).

Demo Code:

<link rel="stylesheet" href="/richtexteditor/rte_theme_default.css" />
<script type="text/javascript" src="/richtexteditor/rte.js"></script>
<script type="text/javascript" src='/richtexteditor/plugins/all_plugins.js'></script>
<div id="div_editor1"><p>This demo shows how to create two shortcuts (CTRL+J and Ctrl+Down Arrow).<p></div>
<script>
	var editor1 = new RichTextEditor("#div_editor1");
	editor1.document.addEventListener("keydown", function (e) {
		if (e.ctrlKey && e.key == 'j') {
			e.preventDefault();
			editor1.insertHTML("&nbsp;" + new Date().toString() + "&nbsp;");
			editor1.collapse(false);
		}
		if (e.ctrlKey && e.keyCode == 40) {//ArrowDown
			e.preventDefault();
			editor1.selectDoc(false);
			var p = editor1.insertRootParagraph("p");
			p.innerHTML = "<br/>";
			editor1.selectDoc(false);
		}
	})
</script>