Bug #15305 » remove-format.js.patch

Administrator Admin, 2005-12-22 20:23

View differences:

htmlarea/plugins/RemoveFormat/remove-format.js 22 Dec 2005 19:11:16 -0000
66 66
				if (param["formatting"] == true) {
67 67
						// remove font, b, strong, i, em, u, strike, span and other tags
68 68
					var regF1 = new RegExp("<\/?(abbr|acronym|b[^r]|big|cite|code|em|font|i|q|s|samp|small|span|strike|strong|sub|sup|u|var)[^>]*>", "gi"); 
69
					html = html.replace(regF1, ""); 
69
					html = html.replace(regF1, "");
70 70
						// keep tags, strip attributes
71
					var regF2 = new RegExp(" style=\"[^>]*\"", "gi");
72
					var regF3 = new RegExp(" (class|align)=\[^\s|>]*", "gi");
71
					var regF2 = new RegExp(" style=\"[^>\"]*\"", "gi");
72
					var regF3 = new RegExp(" (class|align|cellpadding|cellspacing|frame|bgcolor)=(([^>\s\"]+)|(\"[^>]*\"))", "gi");
73 73
					html = html.replace(regF2, "").replace(regF3, "");
74 74
				}
75 75

  
......
86 86
					var regMS2 = new RegExp("<(b[^r]|strong|i|em|p|li|ul) [^>]*>", "gi");
87 87
					html = html.replace(regMS2, "<$1>");
88 88
						// keep tags, strip attributes
89
					var regMS3 = new RegExp(" style=\"[^>]*\"", "gi");
90
					var regMS4 = new RegExp(" (class|align)=\[^\s|>]*", "gi");
89
					var regMS3 = new RegExp(" style=\"[^>\"]*\"", "gi");
90
					var regMS4 = new RegExp(" (class|align)=(([^>\s\"]+)|(\"[^>]*\"))", "gi");
91 91
					html = html.replace(regMS3, "").replace(regMS4, "");
92 92
						// mozilla doesn't like <em> tags
93 93
					html = html.replace(/<em>/gi, "<i>").replace(/<\/em>/gi, "</i>");
(3-3/3)