# HG changeset patch # User rougeronj # Date 1434113365 -7200 # Node ID b0d234cd739e7223228ac684648db0a6583fcb0d # Parent 7e9495eb3cb0167cbaeac1afd0be03a0ce648c93# Parent 364c367df7fc1dc6590c8aaa4a0b2045948b0771 Merge with 364c367df7fc1dc6590c8aaa4a0b2045948b0771 diff -r 7e9495eb3cb0 -r b0d234cd739e client/bower.json --- a/client/bower.json Fri Jun 12 14:42:27 2015 +0200 +++ b/client/bower.json Fri Jun 12 14:49:25 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" diff -r 7e9495eb3cb0 -r b0d234cd739e client/css/renkan.css --- a/client/css/renkan.css Fri Jun 12 14:42:27 2015 +0200 +++ b/client/css/renkan.css Fri Jun 12 14:49:25 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; } diff -r 7e9495eb3cb0 -r b0d234cd739e client/gruntfile.js --- a/client/gruntfile.js Fri Jun 12 14:42:27 2015 +0200 +++ b/client/gruntfile.js Fri Jun 12 14:49:25 2015 +0200 @@ -39,21 +39,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: { @@ -85,6 +87,7 @@ jst:["dist/js/templates.js"], renkan: ["dist/"], lib: ["lib/"], + bower: ["bower_components/"] }, cssmin: { options: { @@ -99,6 +102,9 @@ } }, copy: { + vendors: { + files: [{expand: true, cwd: 'vendors/', src: ['**'], dest: 'lib/'}], + }, renkan: { files: [ {expand: true, cwd: '', src: ['img/*'], dest: 'dist/', filter: 'isFile'}, @@ -142,28 +148,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: { @@ -195,11 +205,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']); }; diff -r 7e9495eb3cb0 -r b0d234cd739e client/js/defaults.js --- a/client/js/defaults.js Fri Jun 12 14:42:27 2015 +0200 +++ b/client/js/defaults.js Fri Jun 12 14:49:25 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, - /* */ }; diff -r 7e9495eb3cb0 -r b0d234cd739e client/js/main-renderer.js --- a/client/js/main-renderer.js Fri Jun 12 14:42:27 2015 +0200 +++ b/client/js/main-renderer.js Fri Jun 12 14:49:25 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'] + } + }, }); } diff -r 7e9495eb3cb0 -r b0d234cd739e client/js/renderer/nodeeditor.js --- a/client/js/renderer/nodeeditor.js Fri Jun 12 14:42:27 2015 +0200 +++ b/client/js/renderer/nodeeditor.js Fri Jun 12 14:49:25 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(); diff -r 7e9495eb3cb0 -r b0d234cd739e client/templates/edgeeditor_readonly.html --- a/client/templates/edgeeditor_readonly.html Fri Jun 12 14:42:27 2015 +0200 +++ b/client/templates/edgeeditor_readonly.html Fri Jun 12 14:49:25 2015 +0200 @@ -16,7 +16,7 @@ <%- edge.short_uri %>
<% } %> -<%-edge.description%>
+<%=edge.description%>
<% if (options.show_edge_tooltip_nodes) { %><%-renkan.translate("From:")%> diff -r 7e9495eb3cb0 -r b0d234cd739e client/templates/nodeeditor.html --- a/client/templates/nodeeditor.html Fri Jun 12 14:42:27 2015 +0200 +++ b/client/templates/nodeeditor.html Fri Jun 12 14:49:25 2015 +0200 @@ -15,7 +15,11 @@ <% } %> <% if (options.show_node_editor_description) { %>
- + <% if (options.show_node_editor_description_richtext) { %> +
diff -r 7e9495eb3cb0 -r b0d234cd739e client/templates/nodeeditor_readonly.html --- a/client/templates/nodeeditor_readonly.html Fri Jun 12 14:42:27 2015 +0200 +++ b/client/templates/nodeeditor_readonly.html Fri Jun 12 14:49:25 2015 +0200 @@ -16,7 +16,7 @@ <%-node.short_uri%>
<% } %> <% if (options.show_node_tooltip_description) { %> -<%-node.description%>
+<%=node.description%>
<% } %> <% if (node.image && options.show_node_tooltip_image) { %>