diff --git a/Resources/config/css.yml b/Resources/config/css.yml
index c4bd734c3..edb61f501 100644
--- a/Resources/config/css.yml
+++ b/Resources/config/css.yml
@@ -110,6 +110,7 @@ system:
- 'bundles/ezplatformui/css/modules/yui-calendar.css'
- 'bundles/ezplatformui/css/modules/pure-grid.css'
- 'bundles/ezplatformui/css/modules/embed.css'
+ - 'bundles/ezplatformui/css/modules/richtext.css'
- 'bundles/ezplatformui/css/modules/loadmorepagination.css'
- 'bundles/ezplatformui/css/alloyeditor/general.css'
- 'bundles/ezplatformui/css/alloyeditor/buttons/labeled-button.css'
@@ -200,6 +201,7 @@ system:
- 'bundles/ezplatformui/css/theme/modules/selection-table.css'
- 'bundles/ezplatformui/css/theme/modules/yui-calendar.css'
- 'bundles/ezplatformui/css/theme/modules/embed.css'
+ - 'bundles/ezplatformui/css/theme/modules/richtext.css'
- 'bundles/ezplatformui/css/theme/modules/collapsetoggle.css'
- 'bundles/ezplatformui/css/theme/modules/loadmorepagination.css'
- 'bundles/ezplatformui/css/theme/alloyeditor/general.css'
diff --git a/Resources/public/css/modules/richtext.css b/Resources/public/css/modules/richtext.css
new file mode 100644
index 000000000..8e435d87a
--- /dev/null
+++ b/Resources/public/css/modules/richtext.css
@@ -0,0 +1,9 @@
+/**
+ * Copyright (C) eZ Systems AS. All rights reserved.
+ * For full copyright and license information view LICENSE file distributed with this source code.
+ */
+
+.ez-richtext-content table {
+ margin: 1em 0;
+ line-height: 1.4;
+}
diff --git a/Resources/public/css/theme/modules/richtext.css b/Resources/public/css/theme/modules/richtext.css
new file mode 100644
index 000000000..8139a174b
--- /dev/null
+++ b/Resources/public/css/theme/modules/richtext.css
@@ -0,0 +1,11 @@
+/**
+ * Copyright (C) eZ Systems AS. All rights reserved.
+ * For full copyright and license information view LICENSE file distributed with this source code.
+ */
+
+.ez-richtext-content table:not([border]),
+.ez-richtext-content table:not([border]) tr,
+.ez-richtext-content table:not([border]) td,
+.ez-richtext-content table:not([border]) th {
+ border: 1px dotted #888;
+}
diff --git a/Resources/public/js/alloyeditor/plugins/paste.js b/Resources/public/js/alloyeditor/plugins/paste.js
index 6fc9b20ab..700138645 100644
--- a/Resources/public/js/alloyeditor/plugins/paste.js
+++ b/Resources/public/js/alloyeditor/plugins/paste.js
@@ -72,7 +72,10 @@ YUI.add('ez-alloyeditor-plugin-paste', function (Y) {
requires: 'clipboard',
init: function (editor) {
editor.pasteFilter = new CKEDITOR.filter({
- 'p h1 h2 h3 h4 h5 h6 ul li ol': true,
+ 'p h1 h2 h3 h4 h5 h6 ul li ol thead tbody th td tr': true,
+ 'table': {
+ attributes: 'border',
+ },
'strong b i em u': true,
'a': {
attributes: '!href',
diff --git a/Resources/public/templates/fields/edit/richtext.hbt b/Resources/public/templates/fields/edit/richtext.hbt
index 84d534bb8..9c8af008a 100644
--- a/Resources/public/templates/fields/edit/richtext.hbt
+++ b/Resources/public/templates/fields/edit/richtext.hbt
@@ -18,7 +18,7 @@
{{{ xhtml }}}
diff --git a/Tests/js/alloyeditor/plugins/assets/ez-alloyeditor-plugin-paste-tests.js b/Tests/js/alloyeditor/plugins/assets/ez-alloyeditor-plugin-paste-tests.js
index 1cd123f07..417ce48cc 100644
--- a/Tests/js/alloyeditor/plugins/assets/ez-alloyeditor-plugin-paste-tests.js
+++ b/Tests/js/alloyeditor/plugins/assets/ez-alloyeditor-plugin-paste-tests.js
@@ -230,11 +230,18 @@ YUI.add('ez-alloyeditor-plugin-paste-tests', function (Y) {
this._testPaste(code, expected, "The div should be transformed into paragraph");
},
- "Should transform table into paragraphs": function () {
+ "Should keep the table": function () {
var code = '
Led Zeppelin |
Over the hill and far away |
',
- expected = '
Led Zeppelin
Over the hill and far away
';
+ expected = '
Led Zeppelin |
Over the hill and far away |
';
- this._testPaste(code, expected, "The table should be transformed into paragraphs");
+ this._testPaste(code, expected, "The table should have been kept");
+ },
+
+ "Should keep the border attribute on table": function () {
+ var code = '
',
+ expected = '
';
+
+ this._testPaste(code, expected, "The table border attribute should have been kept");
},
"Should apply the paste filter after pastefromword cleanup": function () {