changeset 37:0c4e4b5ef40d

remove fragmentToHtml
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 17 Aug 2022 12:00:57 -0600
parents 21090996a131
children 2dfdaaac9482
files src/formats/bbcode.js src/sceditor.js
diffstat 2 files changed, 8 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/src/formats/bbcode.js	Tue Aug 16 13:50:36 2022 -0600
+++ b/src/formats/bbcode.js	Wed Aug 17 12:00:57 2022 -0600
@@ -2448,20 +2448,14 @@
 		/**
 		 * Converts BBCode into HTML
 		 *
-		 * @param {boolean} asFragment
 		 * @param {string} source
-		 * @param {boolean} [legacyAsFragment] Used by fromBBCode() method
 		 */
-		function toHtml(asFragment) {
-			return function(source, legacyAsFragment) {
-				var	parser = newBBCodeParser(base.editor);
-				var html = parser.toHTML(
-					base.opts.bbcodeTrim ? source.trim() : source
-				);
-
-				return (asFragment || legacyAsFragment) ?
-					removeFirstLastDiv(html) : html;
-			};
+		function toHtml(source) {
+			let parser = newBBCodeParser(base.editor);
+			let html = parser.toHTML(
+				base.opts.bbcodeTrim ? source.trim() : source
+			);
+			return html;
 		}
 
 		/**
@@ -2525,8 +2519,7 @@
 			};
 		}
 
-		base.toHtml = toHtml(false);
-		base.fragmentToHtml = toHtml(true);
+		base.toHtml = toHtml;
 		base.toSource = toSource(false);
 		base.fragmentToSource = toSource(true);
 
--- a/src/sceditor.js	Tue Aug 16 13:50:36 2022 -0600
+++ b/src/sceditor.js	Wed Aug 17 12:00:57 2022 -0600
@@ -5610,11 +5610,6 @@
 			pluginManager.call('paste', paste);
 			trigger(editorContainer, 'paste', paste);
 
-			if ('fragmentToHtml' in format) {
-				paste.val = format
-					.fragmentToHtml(paste.val, currentNode);
-			}
-
 			pluginManager.call('pasteHtml', paste);
 
 			var parent = rangeHelper.getFirstBlockParent();
@@ -5911,16 +5906,14 @@
 		 * @param {string} start
 		 * @param {string} [end=null]
 		 * @param {boolean} [filter=true]
-		 * @param {boolean} [convertEmoticons=true] If to convert emoticons
 		 * @param {boolean} [allowMixed=false]
-		 * @return {this}
 		 * @since 1.4.3
 		 * @function
 		 * @name insert^2
 		 */
 		// eslint-disable-next-line max-params
 		base.insert = function (
-			start, end, filter, convertEmoticons, allowMixed
+			start, end, filter, allowMixed
 		) {
 			if (base.inSourceMode()) {
 				base.sourceEditorInsertText(start, end);
@@ -5938,10 +5931,6 @@
 
 				start += html + end;
 			}
-			// TODO: This filter should allow empty tags as it's inserting.
-			if (filter !== false && 'fragmentToHtml' in format) {
-				start = format.fragmentToHtml(start, currentNode);
-			}
 
 			// Convert any escaped HTML back into HTML if mixed is allowed
 			if (filter !== false && allowMixed === true) {