Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

85 lines (80 sloc) 3.008 kb
<!DOCTYPE html>
<html lang="en">
<head>
<title>NextEditor Test</title>
<meta charset="utf-8" />
<link href="style.css" rel="stylesheet" type="text/css" />
<script src="jquery-1.6.js" type="text/javascript"></script>
<script src="../src/next_editor/_main.js" type="text/javascript"></script>
<script src="../src/next_editor/_ui.js" type="text/javascript"></script>
<script src="../src/next_editor/dom.js" type="text/javascript"></script>
<script src="../src/next_editor/input.js" type="text/javascript"></script>
<script src="../src/next_editor/support.js" type="text/javascript"></script>
<script src="../src/next_editor/tokenizers.js" type="text/javascript"></script>
<script src="../src/next_editor/ui_fire.js" type="text/javascript"></script>
<script src="../src/next_editor/ui_water.js" type="text/javascript"></script>
</head>
<body>
<div>
<header>
<h1>NextEditor Test / Demo Page</h1>
</header>
<div>
<form action="#" class="testForm">
<textarea class="testInput"></textarea>
<input type="Submit" value="Send" />
</form>
<textarea id="log"></textarea>
<script type="text/javascript">
var onChangeFn = function (element) {
$(logArea).val($(logArea).val() + "\r\nChange: " + $(element).val());
};
var onEventFn = function (eventName, event) {
var data = {};
if (eventName == 'keydown' || eventName == 'keyup') {
data = {key: event.keyCode};
} else if (eventName == 'textInput') {
data = {data: event.data};
} else if (eventName == 'compositionstart' ||
eventName == 'compositionend') {
data = {data: event.data};
}
$(logArea).val($(logArea).val() + "\r\nEvent: " + eventName + ":" +
JSON.stringify(data));
console.log([eventName, event]);
};
var onSubmitFn = function (element) {
$(logArea).val($(logArea).val() +
"\r\Submit: " + $(element).val());
return false;
};
if (false) {
// Disable the event loop to behave like a dumb editor.
NextEditor.Input = function (options) {};
}
if (false) {
// Use the (slower) compatibility event handling code.
NextEditor.Support.hasTextInput = function() { return false; };
}
if (false) {
// Disable logging for benchmarks.
onChangeFn = null;
onEventFn = null;
onSubmitFn = null;
}
var logArea = $('#log')[0];
var inputTextArea = $('.testInput')[0];
var editor = NextEditor.create({
inputElement: inputTextArea,
forceWater: false,
multiLine: true,
onChange: onChangeFn,
onEverything: onEventFn,
onSubmitKey: onSubmitFn
});
editor.ui.focus();
</script>
</div>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.