Last active
December 7, 2015 09:48
-
-
Save tingwei628/3600d927fb7b2a66baaf to your computer and use it in GitHub Desktop.
[JavaScript][ExtJS]如何將 ExtJS 的htmleditor 裡面的style 簡單化 (simplify the style inside the htmleditor)
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
paste: { | |
element: 'inputEl', | |
fn: function(event, inputEl) { | |
var a = add_Content.getValue(); | |
//已過濾表格 儲存在var b | |
var b = a.replace(/((<td[^>]+)style=".*?">)/ig, function(x) { | |
return x = x.replace(/style=".*?"/, 'style="border:solid"'); | |
}); | |
//對非td 的style 改變,儲存在c | |
var c = b.replace(/((<[^td][^>]+)style=".*?">)/ig, function(y) { | |
y = y.replace(/style=".*?"/, 'style=""'); | |
return y; | |
}); | |
add_Content.setValue(c); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
同上, 但多了過濾" "
參考:http://stackoverflow.com/questions/1499889/remove-html-tags-in-javascript-with-regex