mirror of https://github.com/OCA/web.git
[PRT] Odoo integration of web_ckeditor4
parent
c691a83598
commit
a33bce29e9
|
@ -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".
|
|
@ -19,4 +19,3 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# This module copyright (C) 2013 Therp BV (<http://therp.nl>)
|
||||
# This module copyright (C) 2013-2015 Therp BV (<http://therp.nl>)
|
||||
# All Rights Reserved
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
@ -23,18 +23,16 @@
|
|||
{
|
||||
'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',
|
||||
],
|
||||
|
@ -107,7 +105,7 @@
|
|||
# 'static/lib/trunk/core/_bootstrap.js',
|
||||
#end of ckeditor debug
|
||||
'static/src/js/web_ckeditor4.js',
|
||||
],
|
||||
],
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
'certificate': '',
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<template id="assets_backend" name="web_ckeditor4 assets"
|
||||
inherit_id="web.assets_backend">
|
||||
<xpath expr="." position="inside">
|
||||
<script type="text/javascript"
|
||||
src="/web_ckeditor4/static/src/js/ckeditor_basepath.js"></script>
|
||||
<script type="text/javascript"
|
||||
src="/web_ckeditor4/static/lib/ckeditor/ckeditor.js"></script>
|
||||
<script type="text/javascript"
|
||||
src="/web_ckeditor4/static/lib/ckeditor/config.js"></script>
|
||||
<script type="text/javascript"
|
||||
src="/web_ckeditor4/static/src/js/web_ckeditor4.js"></script>
|
||||
</xpath>
|
||||
</template>
|
||||
</data>
|
||||
</openerp>
|
Loading…
Reference in New Issue