diff src/formats/xhtml.js @ 46:ab2dc8736d88

fix paste html and cleanup
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 30 Aug 2022 14:33:27 -0600
parents c23475f3f466
children
line wrap: on
line diff
--- a/src/formats/xhtml.js	Tue Aug 30 02:03:50 2022 -0600
+++ b/src/formats/xhtml.js	Tue Aug 30 14:33:27 2022 -0600
@@ -538,34 +538,30 @@
 		 * @return {string}
 		 * @memberOf jQuery.sceditor.plugins.xhtml.prototype
 		 */
-		function toSource(isFragment) {
-			return function(html, context) {
-				var xhtml,
-					container = context.createElement('div');
-				container.innerHTML = html;
+		function toSource(html, context, parent, asFragment) {
+			var xhtml,
+				container = context.createElement('div');
+			container.innerHTML = html;
 
-				css(container, 'visibility', 'hidden');
-				context.body.appendChild(container);
+			css(container, 'visibility', 'hidden');
+			context.body.appendChild(container);
 
-				convertTags(container);
-				removeTags(container);
-				removeAttribs(container);
+			convertTags(container);
+			removeTags(container);
+			removeAttribs(container);
 
-				if (!isFragment) {
-					wrapInlines(container);
-				}
+			if (!asFragment) {
+				wrapInlines(container);
+			}
 
-				xhtml = (new sceditor.XHTMLSerializer()).serialize(container, true);
+			xhtml = (new sceditor.XHTMLSerializer()).serialize(container, true);
 
-				context.body.removeChild(container);
+			context.body.removeChild(container);
 
-				return xhtml;
-			};
+			return xhtml;
 		}
 
-		base.toSource = toSource(false);
-
-		base.fragmentToSource = toSource(true);;
+		base.toSource = toSource;
 
 		/**
 		 * Runs all converters for the specified tagName