Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Commit

Permalink
Merge pull request #807 from ezsystems/ezp-26978_colspan_rowspan
Browse files Browse the repository at this point in the history
Fix EZP-26978: colspan and rowspan attributes stripped out when pasting
  • Loading branch information
dpobel authored Feb 17, 2017
2 parents 55b8d0f + 2b589dd commit 5e49830
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Resources/public/js/alloyeditor/plugins/paste.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 thead tbody th td tr': true,
'p h1 h2 h3 h4 h5 h6 ul li ol thead th tbody tr': true,
'td th': {
attributes: ['colspan', 'rowspan'],
},
'table': {
attributes: 'border',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,34 @@ YUI.add('ez-alloyeditor-plugin-paste-tests', function (Y) {
this._testPaste(code, expected, "The table border attribute should have been kept");
},

"Should keep colspan attribute on td": function () {
var code = '<table border="1"><tr><td colspan="2">Led Zeppelin</td></tr></table>',
expected = '<table border="1"><tbody><tr><td colspan="2">Led Zeppelin</td></tr></tbody></table>';

this._testPaste(code, expected, "The table border attribute should have been kept");
},

"Should keep colspan attribute on th": function () {
var code = '<table border="1"><tr><th colspan="2">Led Zeppelin</th></tr></table>',
expected = '<table border="1"><tbody><tr><th colspan="2">Led Zeppelin</th></tr></tbody></table>';

this._testPaste(code, expected, "The table border attribute should have been kept");
},

"Should keep rowspan attribute on td": function () {
var code = '<table border="1"><tr><td rowspan="2">Led Zeppelin</td></tr></table>',
expected = '<table border="1"><tbody><tr><td rowspan="2">Led Zeppelin</td></tr></tbody></table>';

this._testPaste(code, expected, "The table border attribute should have been kept");
},

"Should keep rowspan attribute on th": function () {
var code = '<table border="1"><tr><th rowspan="2">Led Zeppelin</th></tr></table>',
expected = '<table border="1"><tbody><tr><th rowspan="2">Led Zeppelin</th></tr></tbody></table>';

this._testPaste(code, expected, "The table border attribute should have been kept");
},

"Should apply the paste filter after pastefromword cleanup": function () {
var code = '<div>Led Zeppelin - <strong class="MsoNormal">Black mountain side</strong></div>',
expected = '<p>Led Zeppelin - <strong>Black mountain side</strong></p>';
Expand Down

0 comments on commit 5e49830

Please # to comment.