Merge pull request #4816 from mkllnk/1860-copy-paste

1860 Remove style from pasted text for shopfront messages
This commit is contained in:
Maikel
2020-03-18 16:23:50 +11:00
committed by GitHub
6 changed files with 2287 additions and 10 deletions

View File

@@ -2,4 +2,10 @@ angular.module("admin.utils").directive "textangularStrip", () ->
restrict: 'CA'
link: (scope, element, attrs) ->
scope.stripFormatting = ($html) ->
return String($html).replace(/<[^>]+>/gm, '')
element = document.createElement("div")
element.innerHTML = String($html)
allTags = element.getElementsByTagName("*")
for child in allTags
child.removeAttribute("style")
child.removeAttribute("class")
return element.innerHTML