diff --git a/.gitignore b/.gitignore index 890ff010..2daa5c85 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,6 @@ build/ develop-eggs/ dist/ eggs/ -lib/ lib64/ parts/ sdist/ diff --git a/web_ckeditor4/README.rst b/web_ckeditor4/README.rst new file mode 100644 index 00000000..813d58f3 --- /dev/null +++ b/web_ckeditor4/README.rst @@ -0,0 +1,4 @@ +This addon provides a widget for editing html fields via CKEditor 4.x + +Use widget="text_html" if you need just html display. In the unlikely case +you need specific features of ckeditor, use widget="text_ckeditor4". diff --git a/web_ckeditor4/__init__.py b/web_ckeditor4/__init__.py index a97ee816..fae962cc 100644 --- a/web_ckeditor4/__init__.py +++ b/web_ckeditor4/__init__.py @@ -19,4 +19,3 @@ # along with this program. If not, see . # ############################################################################## - diff --git a/web_ckeditor4/__openerp__.py b/web_ckeditor4/__openerp__.py index 75a7915b..2e404ec4 100644 --- a/web_ckeditor4/__openerp__.py +++ b/web_ckeditor4/__openerp__.py @@ -2,7 +2,7 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# This module copyright (C) 2013 Therp BV () +# This module copyright (C) 2013-2015 Therp BV () # All Rights Reserved # # This program is free software: you can redistribute it and/or modify @@ -23,92 +23,20 @@ { 'name': 'CKEditor 4.x widget', 'version': '1.0', - 'description': """ - This addon provides a widget for editing html fields via CKEditor 4.x - - Use widget="text_html" if you need just html display. In the unlikely case - you need specific features of ckeditor, use widget="text_ckeditor4". - """, 'author': 'Therp BV', - 'website': 'http://www.therp.nl', + 'website': 'https://github.com/OCA/web', + 'summary': 'Provides a widget for editing HTML fields using CKEditor 4.x', "category": "Tools", "depends": [ 'web', - ], + ], + 'data': [ + 'views/qweb.xml', + ], 'css': [ 'static/src/css/web_ckeditor4.css', - ], - 'data': [ - ], - 'js': [ - 'static/src/js/ckeditor_basepath.js', - 'static/lib/ckeditor/ckeditor.js', - 'static/lib/ckeditor/config.js', - #to debug ckeditor, comment the lines above, - #do a - #cd static/lib - #git clone https://github.com/ckeditor/ckeditor-dev.git trunk - #cd trunk - #git checkout remotes/origin/release/4.1.x - #and uncomment the lines below -# 'static/lib/trunk/ckeditor.js', -# 'static/lib/trunk/core/event.js', -# 'static/lib/trunk/core/editor_basic.js', -# 'static/lib/trunk/core/env.js', -# 'static/lib/trunk/core/ckeditor_basic.js', -# 'static/lib/trunk/core/dom.js', -# 'static/lib/trunk/core/tools.js', -# 'static/lib/trunk/core/dtd.js', -# 'static/lib/trunk/core/dom/event.js', -# 'static/lib/trunk/core/dom/domobject.js', -# 'static/lib/trunk/core/dom/node.js', -# 'static/lib/trunk/core/dom/window.js', -# 'static/lib/trunk/core/dom/document.js', -# 'static/lib/trunk/core/dom/nodelist.js', -# 'static/lib/trunk/core/dom/element.js', -# 'static/lib/trunk/core/dom/documentfragment.js', -# 'static/lib/trunk/core/dom/walker.js', -# 'static/lib/trunk/core/dom/range.js', -# 'static/lib/trunk/core/dom/iterator.js', -# 'static/lib/trunk/core/command.js', -# 'static/lib/trunk/core/ckeditor_base.js', -# 'static/lib/trunk/core/config.js', -# 'static/lib/trunk/core/filter.js', -# 'static/lib/trunk/core/focusmanager.js', -# 'static/lib/trunk/core/keystrokehandler.js', -# 'static/lib/trunk/core/lang.js', -# 'static/lib/trunk/core/scriptloader.js', -# 'static/lib/trunk/core/resourcemanager.js', -# 'static/lib/trunk/core/plugins.js', -# 'static/lib/trunk/core/ui.js', -# 'static/lib/trunk/core/editor.js', -# 'static/lib/trunk/core/htmlparser.js', -# 'static/lib/trunk/core/htmlparser/basicwriter.js', -# 'static/lib/trunk/core/htmlparser/node.js', -# 'static/lib/trunk/core/htmlparser/comment.js', -# 'static/lib/trunk/core/htmlparser/text.js', -# 'static/lib/trunk/core/htmlparser/cdata.js', -# 'static/lib/trunk/core/htmlparser/fragment.js', -# 'static/lib/trunk/core/htmlparser/filter.js', -# 'static/lib/trunk/core/htmldataprocessor.js', -# 'static/lib/trunk/core/htmlparser/element.js', -# 'static/lib/trunk/core/template.js', -# 'static/lib/trunk/core/ckeditor.js', -# 'static/lib/trunk/core/creators/inline.js', -# 'static/lib/trunk/core/creators/themedui.js', -# 'static/lib/trunk/core/editable.js', -# 'static/lib/trunk/core/selection.js', -# 'static/lib/trunk/core/style.js', -# 'static/lib/trunk/core/dom/comment.js', -# 'static/lib/trunk/core/dom/elementpath.js', -# 'static/lib/trunk/core/dom/text.js', -# 'static/lib/trunk/core/dom/rangelist.js', -# 'static/lib/trunk/core/skin.js', -# 'static/lib/trunk/core/_bootstrap.js', - #end of ckeditor debug - 'static/src/js/web_ckeditor4.js', - ], - 'installable': False, + ], + 'installable': True, 'auto_install': False, 'certificate': '', } diff --git a/web_ckeditor4/static/src/js/web_ckeditor4.js b/web_ckeditor4/static/src/js/web_ckeditor4.js index c72b36a3..1969d29e 100644 --- a/web_ckeditor4/static/src/js/web_ckeditor4.js +++ b/web_ckeditor4/static/src/js/web_ckeditor4.js @@ -20,7 +20,7 @@ # ############################################################################*/ -openerp.web_ckeditor4 = function(openerp) +openerp.web_ckeditor4 = function(instance) { var ckeditor_addFunction_org = CKEDITOR.tools.addFunction; //this is a quite complicated way to kind of monkey patch the private @@ -87,14 +87,14 @@ openerp.web_ckeditor4 = function(openerp) }); }); - openerp.web.form.widgets.add('text_ckeditor4', - 'openerp.web_ckeditor4.FieldCKEditor4'); - openerp.web.form.widgets.add('text_ckeditor4_raw', - 'openerp.web_ckeditor4.FieldCKEditor4Raw'); - openerp.web.form.widgets.add('text_html', - 'openerp.web_ckeditor4.FieldCKEditor4'); - openerp.web.form.widgets.add('html', - 'openerp.web_ckeditor4.FieldCKEditor4'); + instance.web.form.widgets.add('text_ckeditor4', + 'instance.web_ckeditor4.FieldCKEditor4'); + instance.web.form.widgets.add('text_ckeditor4_raw', + 'instance.web_ckeditor4.FieldCKEditor4Raw'); + instance.web.form.widgets.add('text_html', + 'instance.web_ckeditor4.FieldCKEditor4'); + instance.web.form.widgets.add('html', + 'instance.web_ckeditor4.FieldCKEditor4'); function filter_html(value, ckeditor_filter, ckeditor_writer) { @@ -117,11 +117,13 @@ openerp.web_ckeditor4 = function(openerp) }); default_ckeditor_writer = new CKEDITOR.htmlParser.basicWriter(); - openerp.web_ckeditor4.FieldCKEditor4 = openerp.web.form.FieldText.extend({ + instance.web_ckeditor4.FieldCKEditor4 = instance.web.form.FieldText.extend({ ckeditor_config: { removePlugins: 'iframe,flash,forms,smiley,pagebreak,stylescombo', filebrowserImageUploadUrl: 'dummy', extraPlugins: 'filebrowser', + // this is '#39' per default which screws up single quoted text in ${} + entities_additional: '', }, ckeditor_filter: default_ckeditor_filter, ckeditor_writer: default_ckeditor_writer, @@ -129,7 +131,7 @@ openerp.web_ckeditor4 = function(openerp) { this._super.apply(this, arguments); - CKEDITOR.lang.load(openerp.session.user_context.lang.split('_')[0], 'en', function() {}); + CKEDITOR.lang.load(instance.session.user_context.lang.split('_')[0], 'en', function() {}); }, initialize_content: function() { @@ -142,7 +144,7 @@ openerp.web_ckeditor4 = function(openerp) this.editor = CKEDITOR.replace(this.$textarea.get(0), _.extend( { - language: openerp.session.user_context.lang.split('_')[0], + language: instance.session.user_context.lang.split('_')[0], on: { 'change': function() @@ -155,7 +157,7 @@ openerp.web_ckeditor4 = function(openerp) }, store_dom_value: function() { - this.internal_set_value(this.editor ? this.editor.getData() : openerp.web.parse_value(this.get('value'), this)); + this.internal_set_value(this.editor ? this.editor.getData() : instance.web.parse_value(this.get('value'), this)); }, filter_html: function(value) { @@ -207,7 +209,7 @@ openerp.web_ckeditor4 = function(openerp) this._cleanup_editor(); } }); - openerp.web_ckeditor4.FieldCKEditor4Raw = openerp.web_ckeditor4.FieldCKEditor4.extend({ + instance.web_ckeditor4.FieldCKEditor4Raw = instance.web_ckeditor4.FieldCKEditor4.extend({ filter_html: function(value) { return value; diff --git a/web_ckeditor4/views/qweb.xml b/web_ckeditor4/views/qweb.xml new file mode 100644 index 00000000..48097136 --- /dev/null +++ b/web_ckeditor4/views/qweb.xml @@ -0,0 +1,18 @@ + + + + + +