Commit bc1b9325 authored by Romain Courteaud's avatar Romain Courteaud

Add simple textarea editor.

parent a325611b
/*jslint nomen: true*/
/*global rJS */
(function (window, rJS) {
"use strict";
function escape_text(text) {
// &, ", ', <, >, /
return text.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;");
}
var gk = rJS(window);
gk.declareMethod('setContent', function (value) {
this.__element.getElementsByTagName('textarea')[0].value =
escape_text(value);
})
.declareMethod('getContent', function () {
return this.__element.getElementsByTagName('textarea')[0].value;
});
}(window, rJS));
<html>
<head>
<title>Simple Text Editor Gadget</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="../<%= copy.rsvp.relative_dest %>" type="text/javascript"></script>
<script src="../<%= copy.renderjs.relative_dest %>" type="text/javascript"></script>
<script src="editor.js" type="text/javascript"></script>
<link rel="http://www.renderjs.org/rel/interface"
href="http://www.renderjs.org/interface/editor"/>
</head>
<body>
<!--label for="textarea-a">Your basic text editor:</label-->
<textarea id="textarea-a"></textarea>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment