Commit a325611b authored by Romain Courteaud's avatar Romain Courteaud

Add jqte editor gadget.

parent cd4ef7e7
...@@ -9,6 +9,7 @@ module.exports = function (grunt) { ...@@ -9,6 +9,7 @@ module.exports = function (grunt) {
global_config = { global_config = {
src: "src", src: "src",
lib: "lib", lib: "lib",
tmp: "tmp",
dest: "dev" dest: "dev"
}; };
...@@ -41,6 +42,7 @@ module.exports = function (grunt) { ...@@ -41,6 +42,7 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-curl'); grunt.loadNpmTasks('grunt-curl');
grunt.loadNpmTasks('grunt-open'); grunt.loadNpmTasks('grunt-open');
grunt.loadNpmTasks('grunt-contrib-less'); grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-zip');
grunt.initConfig({ grunt.initConfig({
pkg: grunt.file.readJSON('package.json'), pkg: grunt.file.readJSON('package.json'),
...@@ -173,6 +175,14 @@ module.exports = function (grunt) { ...@@ -173,6 +175,14 @@ module.exports = function (grunt) {
}, },
curl: { curl: {
jqueryte: {
src: 'http://jqueryte.com/jqte/<%= curl.jqueryte.directory %>.zip',
version: "1.4.0",
directory: "jQuery-TE_v.<%= curl.jqueryte.version %>",
css_relative_url: "lib/<%= curl.jqueryte.directory %>/jquery-te-<%= curl.jqueryte.version %>.css",
js_relative_url: "lib/<%= curl.jqueryte.directory %>/jquery-te-<%= curl.jqueryte.version %>.min.js",
dest: '<%= global_config.tmp %>/jQuery-TE.zip'
},
jquery: { jquery: {
src: 'http://code.jquery.com/jquery-2.0.3.js', src: 'http://code.jquery.com/jquery-2.0.3.js',
relative_dest: 'lib/jquery.js', relative_dest: 'lib/jquery.js',
...@@ -204,6 +214,13 @@ module.exports = function (grunt) { ...@@ -204,6 +214,13 @@ module.exports = function (grunt) {
// all: ['test/index.html'] // all: ['test/index.html']
}, },
unzip: {
jqueryte: {
src: '<%= curl.jqueryte.dest %>',
dest: '<%= global_config.dest %>/lib/'
}
},
connect: { connect: {
client: { client: {
options: { options: {
...@@ -228,6 +245,7 @@ module.exports = function (grunt) { ...@@ -228,6 +245,7 @@ module.exports = function (grunt) {
grunt.registerTask('default', ['all']); grunt.registerTask('default', ['all']);
grunt.registerTask('all', ['lint', 'build']); grunt.registerTask('all', ['lint', 'build']);
grunt.registerTask('lint', ['jslint']); grunt.registerTask('lint', ['jslint']);
grunt.registerTask('dep', ['curl', 'unzip']);
// grunt.registerTask('test', ['qunit']); // grunt.registerTask('test', ['qunit']);
grunt.registerTask('server', ['connect:client', 'open', 'watch']); grunt.registerTask('server', ['connect:client', 'open', 'watch']);
grunt.registerTask('build', ['concat', 'uglify', 'copy', 'less']); grunt.registerTask('build', ['concat', 'uglify', 'copy', 'less']);
......
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
"connect-livereload": "~0.3.0", "connect-livereload": "~0.3.0",
"grunt-open": "~0.2.2", "grunt-open": "~0.2.2",
"grunt-contrib-concat": "~0.3.0", "grunt-contrib-concat": "~0.3.0",
"grunt-contrib-less": "~0.9.0" "grunt-contrib-less": "~0.9.0",
"grunt-zip": "~0.13.0"
}, },
"scripts": { "scripts": {
"test": "./node_modules/.bin/grunt test", "test": "./node_modules/.bin/grunt test",
......
<!DOCTYPE html>
<html>
<head>
<title>JQuery Text Editor Gadget</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="../<%= curl.jqueryte.css_relative_url %>" />
<script src="../<%= copy.rsvp.relative_dest %>" type="text/javascript"></script>
<script src="../<%= copy.renderjs.relative_dest %>" type="text/javascript"></script>
<script src="../<%= curl.jquery.relative_dest %>" type="text/javascript"></script>
<script src="../<%= curl.jqueryte.js_relative_url %>" type="text/javascript"></script>
<script src="jqteditor.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-b">Your advanced text editor:</label-->
<textarea id="textarea-b" class="ckeditor"></textarea>
</body>
</html>
/*global rJS, jQuery */
/*jslint nomen: true*/
(function (window, rJS, $) {
"use strict";
var gk = rJS(window);
gk.declareMethod('setContent', function (value) {
// return this.context.find('textarea').val(escape_text(value));
return $(this.__element).find('#textarea-b').jqteVal(value);
})
.declareMethod('getContent', function () {
return $(this.__element).find('#textarea-b').val();
});
gk.ready(function (g) {
$(g.__element).find("#textarea-b").jqte();
});
}(window, rJS, jQuery));
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