dhxEditor events
Log (clear) |
</> Source
<!DOCTYPE html>
<html>
<head>
<title>dhxEditor events</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<link rel="stylesheet" type="text/css" href="../../../codebase/fonts/font_roboto/roboto.css"/>
<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
<script src="../../../codebase/dhtmlx.js"></script>
<style>
div#simpleLog {
width: 500px;
height: 200px;
font-family: Roboto, Arial, Helvetica;
font-size: 14px;
color: #404040;
overflow: auto;
}
</style>
<script>
var myForm, formData, logObj;
function doOnLoad() {
formData = [
{type: "settings", labelWidth: 90},
{type: "editor", name: "a1", label: "One", inputWidth: 400, inputHeight: 100, value: "Lorem ipsum"},
{type: "editor", name: "a2", label: "Two", inputWidth: 400, inputHeight: 300, value: "<b>Lorem ipsum </b>dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud <u>exercitation ullamco laboris nisi ut aliquip ex ea commodo </u>consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. <i>Excepteur sint occaecat cupidatat non proident</i>, sunt in culpa qui officia deserunt mollit anim id est laborum."}
];
myForm = new dhtmlXForm("myForm", formData);
// some editor events
myForm.attachEvent("onEditorAccess", function(name, type, ev, editor, form){
// ev - event object
// editor - editor instance
// form - form instance
logEvent("onEditorAccess, item name '"+name+"', access type '"+type+"'</span><br>");
});
myForm.attachEvent("onEditorToolbarClick", function(name, toolbar_id, editor, form){
// for extended editor init
});
}
function logEvent(t) {
if (!logObj) logObj = document.getElementById("simpleLog");
logObj.innerHTML += t;
}
function clearLog() {
if (!logObj) logObj = document.getElementById("simpleLog");
logObj.innerHTML = "";
}
</script>
</head>
<body onload="doOnLoad();">
<table>
<tr><td><div id="myForm"></div></td></tr>
<tr><td><b>Log (<a href="javascript:void(0);" onclick="clearLog();">clear</a>)</b></td></tr>
<tr><td><div id="simpleLog"></div></td></tr>
</table>
</body>
</html>
Documentation
Check documentation to learn how to use the components and easily implement them in your applications.