-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stop removing tables on paste (#2199)
This removes the code that was stripping table elements on paste. They used to cause an exception on paste, but are now working fine.
- Loading branch information
Showing
3 changed files
with
9 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
import { ELEMENT_NODE } from 'utils/nodetypes'; | ||
|
||
export default function( nodes ) { | ||
// MUTATION! | ||
nodes.forEach( deepAttributeStrip ); | ||
return nodes; | ||
} | ||
|
||
function deepAttributeStrip( node ) { | ||
node.removeAttribute( 'style' ); | ||
node.removeAttribute( 'class' ); | ||
node.removeAttribute( 'id' ); | ||
Array.from( node.children ).forEach( deepAttributeStrip ); | ||
if ( ELEMENT_NODE === node.nodeType ) { | ||
node.removeAttribute( 'style' ); | ||
node.removeAttribute( 'class' ); | ||
node.removeAttribute( 'id' ); | ||
Array.from( node.children ).forEach( deepAttributeStrip ); | ||
} | ||
} |