--- a/client/bower.json Wed Jun 10 14:27:12 2015 +0200
+++ b/client/bower.json Fri Jun 12 14:46:08 2015 +0200
@@ -31,7 +31,8 @@
"FileSaver": "*",
"backbone-relational": "~0.9.0",
"requirejs": null,
- "lodash": "~2.4.1"
+ "lodash": "~2.4.1",
+ "ckeditor": "~4.4.7"
},
"devDependencies": {
"jquery-ui": "~1.11.4"
--- a/client/css/renkan.css Wed Jun 10 14:27:12 2015 +0200
+++ b/client/css/renkan.css Fri Jun 12 14:46:08 2015 +0200
@@ -427,6 +427,16 @@
width: 250px; height: 120px; resize: none;
}
+div.Rk-Edit-Description {
+ background-color: #FFF;
+ border: 1px solid #F0F0F0;
+ width: 250px;
+ height: 120px;
+ resize: vertical;
+ overflow: auto;
+ padding: 1px;
+}
+
.Rk-UserColor {
display: inline-block; width: 12px; height: 12px; border: 1px solid #666666; margin: -2px 2px;
}
--- a/client/gruntfile.js Wed Jun 10 14:27:12 2015 +0200
+++ b/client/gruntfile.js Fri Jun 12 14:46:08 2015 +0200
@@ -38,21 +38,23 @@
requtils: "require-utils",
jquery: "empty:",
underscore: "empty:",
- filesaver: "empty:"
+ filesaver: "empty:",
+ 'ckeditor-core': "empty:",
+ 'ckeditor-jquery': "empty:"
}
}
}
},
jst: {
- compile: {
- options: {
- namespace: 'renkanJST',
- //amd: true
- },
- files: {
- "dist/js/templates.js": ["templates/**/*.html"]
- }
- }
+ compile: {
+ options: {
+ namespace: 'renkanJST',
+ //amd: true
+ },
+ files: {
+ "dist/js/templates.js": ["templates/**/*.html"]
+ }
+ }
},
uglify: {
options: {
@@ -84,6 +86,7 @@
jst:["dist/js/templates.js"],
renkan: ["dist/"],
lib: ["lib/"],
+ bower: ["bower_components/"]
},
cssmin: {
options: {
@@ -98,6 +101,9 @@
}
},
copy: {
+ vendors: {
+ files: [{expand: true, cwd: 'vendors/', src: ['**'], dest: 'lib/'}],
+ },
renkan: {
files: [
{expand: true, cwd: '', src: ['img/*'], dest: 'dist/', filter: 'isFile'},
@@ -141,28 +147,32 @@
layout: 'byComponent',
install: true,
verbose: false,
- cleanTargetDir: false,
+ cleanTargetDir: true,
cleanBowerDir: false,
bowerOptions: {}
}
}
},
watch: {
- css:{
- files: ['css/**/*.css'],
- tasks: ['cssmin', 'copy:renkan_css'],
- },
- js:{
- files: ['js/**/*.js', 'templates/**/*.html'],
- tasks: ['jshint', 'requirejs', 'jst', 'concat', 'uglify', 'copy:renkan', 'clean:renderer'],
- },
- lib:{
- files: ['bower.json'],
- tasks: ['bower:install', 'copy:renkan'],
- },
- options: {
- interrupt: true,
- },
+ css:{
+ files: ['css/**/*.css'],
+ tasks: ['cssmin', 'copy:renkan_css'],
+ },
+ js:{
+ files: ['js/**/*.js', 'templates/**/*.html'],
+ tasks: ['jshint', 'requirejs', 'jst', 'concat', 'uglify', 'copy:renkan', 'clean:renderer'],
+ },
+ lib:{
+ files: ['bower.json'],
+ tasks: ['bower:install', 'copy:vendors', 'copy:renkan'],
+ },
+ vendors: {
+ files: ['vendors/**'],
+ tasks: ['copy:vendors', 'copy:renkan'],
+ },
+ options: {
+ interrupt: true,
+ },
},
connect: {
server: {
@@ -194,11 +204,11 @@
grunt.loadNpmTasks('grunt-contrib-watch');
// Default task(s).
- grunt.registerTask('default', ['jshint', 'requirejs', 'jst', 'concat', 'uglify', 'cssmin', 'bower:install', 'copy:renkan', 'copy:renkan_css', 'clean:renderer', 'clean:jst']);
+ grunt.registerTask('default', ['jshint', 'bower:install', 'copy:vendors', 'requirejs', 'jst', 'concat', 'uglify', 'cssmin', 'copy:renkan', 'copy:renkan_css', 'clean:renderer', 'clean:jst']);
grunt.registerTask('copy-server', 'copy files to server part', function(){
grunt.task.run(['copy:renkan_server']);
});
- grunt.registerTask('dev', [ 'jshint', 'requirejs', 'jst', 'concat', 'uglify', 'cssmin', 'bower:install', 'copy:renkan', 'copy:renkan_css', 'clean:renderer', 'connect:server', 'watch']);
+ grunt.registerTask('dev', [ 'jshint', 'bower:install', 'copy:vendors', 'requirejs', 'jst', 'concat', 'uglify', 'cssmin', 'copy:renkan', 'copy:renkan_css', 'clean:renderer', 'connect:server', 'watch']);
};
--- a/client/js/defaults.js Wed Jun 10 14:27:12 2015 +0200
+++ b/client/js/defaults.js Fri Jun 12 14:46:08 2015 +0200
@@ -145,10 +145,22 @@
tooltip_border_color: "#808080",
tooltip_border_width: 1,
+ richtext_editor_config: {
+ toolbarGroups: [
+ { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
+ { name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
+ '/',
+ { name: 'styles'},
+ ],
+ //extraPlugins: 'onchange',
+ removePlugins : 'colorbutton,find,flash,font,forms,iframe,image,newpage,smiley,specialchar,stylescombo,templates'
+ },
+
/* NODE EDITOR OPTIONS */
show_node_editor_uri: true,
show_node_editor_description: true,
+ show_node_editor_description_richtext: true,
show_node_editor_size: true,
show_node_editor_style: true,
show_node_editor_style_color: true,
@@ -159,6 +171,7 @@
allow_image_upload: true,
uploaded_image_max_kb: 500,
+
/* NODE TOOLTIP OPTIONS */
show_node_tooltip_uri: true,
@@ -184,8 +197,7 @@
show_edge_tooltip_uri: true,
show_edge_tooltip_color: true,
show_edge_tooltip_nodes: true,
- show_edge_tooltip_creator: true
+ show_edge_tooltip_creator: true,
- /* */
};
--- a/client/js/main-renderer.js Wed Jun 10 14:27:12 2015 +0200
+++ b/client/js/main-renderer.js Fri Jun 12 14:46:08 2015 +0200
@@ -6,8 +6,15 @@
'jquery':'../lib/jquery/jquery',
'underscore':'../lib/lodash/lodash',
'filesaver' :'../lib/FileSaver/FileSaver',
- 'requtils':'require-utils'
- }
+ 'requtils':'require-utils',
+ 'ckeditor-core':'../lib/ckeditor/ckeditor',
+ 'ckeditor-jquery':'../lib/ckeditor/adapters/jquery'
+ },
+ shim: {
+ 'ckeditor-jquery':{
+ deps:['jquery','ckeditor-core']
+ }
+ },
});
}
--- a/client/js/renderer/nodeeditor.js Wed Jun 10 14:27:12 2015 +0200
+++ b/client/js/renderer/nodeeditor.js Fri Jun 12 14:46:08 2015 +0200
@@ -1,5 +1,5 @@
-define(['jquery', 'underscore', 'requtils', 'renderer/baseeditor', 'renderer/shapebuilder'], function ($, _, requtils, BaseEditor, ShapeBuilder) {
+define(['jquery', 'underscore', 'requtils', 'renderer/baseeditor', 'renderer/shapebuilder', 'ckeditor-jquery'], function ($, _, requtils, BaseEditor, ShapeBuilder) {
'use strict';
var Utils = requtils.getUtils();
@@ -48,20 +48,31 @@
}));
this.redraw();
var _this = this,
- closeEditor = function() {
- _this.editor_$.off("keyup");
- _this.editor_$.find("input, textarea, select").off("change keyup paste");
- _this.editor_$.find(".Rk-Edit-Image-File").off('change');
- _this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").off('hover');
- _this.editor_$.find(".Rk-Edit-Size-Btn").off('click');
- _this.editor_$.find(".Rk-Edit-Image-Del").off('click');
- _this.editor_$.find(".Rk-Edit-ColorPicker").find("li").off('hover click');
- _this.editor_$.find(".Rk-CloseX").off('click');
- _this.editor_$.find(".Rk-Edit-Goto").off('click');
+ editorInstance = _this.options.show_node_editor_description_richtext ?
+ $(".Rk-Edit-Description").ckeditor(_this.options.richtext_editor_config) :
+ false,
+ closeEditor = function() {
+ _this.editor_$.off("keyup");
+ _this.editor_$.find("input, textarea, select").off("change keyup paste");
+ _this.editor_$.find(".Rk-Edit-Image-File").off('change');
+ _this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").off('hover');
+ _this.editor_$.find(".Rk-Edit-Size-Btn").off('click');
+ _this.editor_$.find(".Rk-Edit-Image-Del").off('click');
+ _this.editor_$.find(".Rk-Edit-ColorPicker").find("li").off('hover click');
+ _this.editor_$.find(".Rk-CloseX").off('click');
+ _this.editor_$.find(".Rk-Edit-Goto").off('click');
- _this.renderer.removeRepresentation(_this);
- paper.view.draw();
- };
+ if(_this.options.show_node_editor_description_richtext) {
+ if(typeof _this.blurListener !== 'undefined') {
+ _this.editorBlurListener.removeListener();
+ }
+ if(typeof editorInstance.editor !== 'undefined') {
+ editorInstance.editor.destroy();
+ }
+ }
+ _this.renderer.removeRepresentation(_this);
+ paper.view.draw();
+ };
this.editor_$.find(".Rk-CloseX").click(closeEditor);
@@ -88,7 +99,16 @@
_this.editor_$.find(".Rk-Edit-ImgPreview").attr("src", _data.image || _image_placeholder);
}
if (_this.options.show_node_editor_description) {
- _data.description = _this.editor_$.find(".Rk-Edit-Description").val();
+ if(_this.options.show_node_editor_description_richtext &&
+ typeof editorInstance.editor !== 'undefined' &&
+ editorInstance.editor.checkDirty())
+ {
+ _data.description = editorInstance.editor.getData();
+ editorInstance.editor.resetDirty();
+ }
+ else {
+ _data.description = _this.editor_$.find(".Rk-Edit-Description").val();
+ }
}
if (_this.options.show_node_editor_style) {
var dash = _this.editor_$.find(".Rk-Edit-Dash").is(':checked');
@@ -105,7 +125,7 @@
closeEditor();
}
});
- }, 500);
+ }, 1000);
this.editor_$.on("keyup", function(_e) {
if (_e.keyCode === 27) {
@@ -114,6 +134,13 @@
});
this.editor_$.find("input, textarea, select").on("change keyup paste", onFieldChange);
+ if( _this.options.show_node_editor_description &&
+ _this.options.show_node_editor_description_richtext &&
+ typeof editorInstance.editor !== 'undefined')
+ {
+ editorInstance.editor.on("change", onFieldChange);
+ _this.editorBlurListener = editorInstance.editor.on("blur", onFieldChange);
+ }
if(_this.options.allow_image_upload) {
this.editor_$.find(".Rk-Edit-Image-File").change(function() {
@@ -242,7 +269,7 @@
redraw: function() {
if (this.options.popup_editor){
var _coords = this.source_representation.paper_coords;
- Utils.drawEditBox(this.options, _coords, this.editor_block, this.source_representation.circle_radius * 0.75, this.editor_$);
+ Utils.drawEditBox(this.options, _coords, this.editor_block, this.source_representation.circle_radius * 0.75, this.editor_$);
}
this.editor_$.show();
paper.view.draw();
--- a/client/templates/edgeeditor_readonly.html Wed Jun 10 14:27:12 2015 +0200
+++ b/client/templates/edgeeditor_readonly.html Fri Jun 12 14:46:08 2015 +0200
@@ -16,7 +16,7 @@
<a href="<%-edge.uri%>" target="_blank"><%- edge.short_uri %></a>
</p>
<% } %>
-<p><%-edge.description%></p>
+<p><%=edge.description%></p>
<% if (options.show_edge_tooltip_nodes) { %>
<p>
<span class="Rk-Editor-Label"><%-renkan.translate("From:")%></span>
--- a/client/templates/nodeeditor.html Wed Jun 10 14:27:12 2015 +0200
+++ b/client/templates/nodeeditor.html Fri Jun 12 14:46:08 2015 +0200
@@ -15,7 +15,11 @@
<% } %> <% if (options.show_node_editor_description) { %>
<p>
<label><%-renkan.translate("Description:")%></label>
- <textarea class="Rk-Edit-Description"><%-node.description%></textarea>
+ <% if (options.show_node_editor_description_richtext) { %>
+ <div class="Rk-Edit-Description" contenteditable="true"><%=node.description%></div>
+ <% } else { %>
+ <textarea class="Rk-Edit-Description"><%=node.description%></textarea>
+ <% } %>
</p>
<% } %> <% if (options.show_node_editor_size) { %>
<p>
--- a/client/templates/nodeeditor_readonly.html Wed Jun 10 14:27:12 2015 +0200
+++ b/client/templates/nodeeditor_readonly.html Fri Jun 12 14:46:08 2015 +0200
@@ -16,7 +16,7 @@
<a href="<%-node.uri%>" target="_blank"><%-node.short_uri%></a>
</p>
<% } %> <% if (options.show_node_tooltip_description) { %>
- <p class="Rk-Display-Description"><%-node.description%></p>
+ <p class="Rk-Display-Description"><%=node.description%></p>
<% } %> <% if (node.image && options.show_node_tooltip_image) { %>
<img class="Rk-Display-ImgPreview" src="<%-node.image%>" />
<% } %> <% if (node.has_creator && options.show_node_tooltip_creator) { %>