diff --git a/packages/ckeditor5-html-support/src/datafilter.ts b/packages/ckeditor5-html-support/src/datafilter.ts index 13cb3ed3973..11a6c943d5f 100644 --- a/packages/ckeditor5-html-support/src/datafilter.ts +++ b/packages/ckeditor5-html-support/src/datafilter.ts @@ -461,7 +461,7 @@ export default class DataFilter extends Plugin { } // Remove the coupled GHS attributes on the same range as the feature attribute was removed. - for ( const { item } of change.range.getWalker( { shallow: true } ) ) { + for ( const { item } of change.range.getWalker() ) { for ( const attributeKey of attributeKeys ) { if ( item.hasAttribute( attributeKey ) ) { writer.removeAttribute( attributeKey, item ); diff --git a/packages/ckeditor5-html-support/tests/integrations/list.js b/packages/ckeditor5-html-support/tests/integrations/list.js index 84e260da737..75de9f6e450 100644 --- a/packages/ckeditor5-html-support/tests/integrations/list.js +++ b/packages/ckeditor5-html-support/tests/integrations/list.js @@ -8,6 +8,7 @@ import GeneralHtmlSupport from '../../src/generalhtmlsupport.js'; import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor.js'; import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph.js'; import ListEditing from '@ckeditor/ckeditor5-list/src/list/listediting.js'; +import TableEditing from '@ckeditor/ckeditor5-table/src/tableediting.js'; import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils.js'; import stubUid from '@ckeditor/ckeditor5-list/tests/list/_utils/uid.js'; @@ -28,7 +29,7 @@ describe( 'ListElementSupport', () => { editor = await ClassicTestEditor .create( editorElement, { - plugins: [ Paragraph, GeneralHtmlSupport, ListEditing ] + plugins: [ Paragraph, GeneralHtmlSupport, ListEditing, TableEditing ] } ); model = editor.model; dataFilter = editor.plugins.get( 'DataFilter' ); @@ -1013,6 +1014,145 @@ describe( 'ListElementSupport', () => { } ); } ); + describe( '#15527 and #15565', () => { + // See https://github.com/ckeditor/ckeditor5/issues/15527. + it( 'should not remove attribute from other elements (inside GHS div)', () => { + const dataFilter = editor.plugins.get( 'DataFilter' ); + + // Allow everything + dataFilter.allowElement( /^.*$/ ); + dataFilter.allowAttributes( { name: /^.*$/, attributes: true } ); + dataFilter.allowAttributes( { name: /^.*$/, classes: true } ); + + editor.setData( + '
' +
+ ' | ' +
+ '