Mercurial Hosting > sceditor
changeset 25:80bf0adc9efd
remove format oo
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 09 Aug 2022 23:15:58 -0600 |
parents | 80a86fb8f2b7 |
children | 160be99e1517 |
files | src/formats/bbcode.js src/formats/xhtml.js src/sceditor.js |
diffstat | 3 files changed, 15 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
diff -r 80a86fb8f2b7 -r 80bf0adc9efd src/formats/bbcode.js --- a/src/formats/bbcode.js Tue Aug 09 22:49:59 2022 -0600 +++ b/src/formats/bbcode.js Tue Aug 09 23:15:58 2022 -0600 @@ -1024,8 +1024,8 @@ * @name BBCodeParser * @since v1.4.0 */ - function BBCodeParser(options) { - var base = this; + function newBBCodeParser(options) { + var base = {}; base.opts = extend({}, BBCodeParser.defaults, options); @@ -2065,8 +2065,12 @@ function lower(str) { return str.toLowerCase(); } + + return base; }; + var BBCodeParser = {}; + /** * Quote type * @type {Object} @@ -2213,7 +2217,7 @@ * @since 2.0.0 */ function bbcodeFormat() { - var base = this; + var base = {}; base.stripQuotes = _stripQuotes; @@ -2522,7 +2526,7 @@ * @param {boolean} [legacyAsFragment] Used by fromBBCode() method */ function toHtml(asFragment, source, legacyAsFragment) { - var parser = new BBCodeParser(base.opts.parserOptions); + var parser = newBBCodeParser(base.opts.parserOptions); var html = parser.toHTML( base.opts.bbcodeTrim ? source.trim() : source ); @@ -2547,7 +2551,7 @@ var bbcode, elements; var containerParent = context.createElement('div'); var container = context.createElement('div'); - var parser = new BBCodeParser(base.opts.parserOptions); + var parser = newBBCodeParser(base.opts.parserOptions); container.innerHTML = html; css(containerParent, 'visibility', 'hidden'); @@ -2594,6 +2598,8 @@ base.fragmentToHtml = toHtml.bind(null, true); base.toSource = toSource.bind(null, false); base.fragmentToSource = toSource.bind(null, true); + + return base; }; /**
diff -r 80a86fb8f2b7 -r 80bf0adc9efd src/formats/xhtml.js --- a/src/formats/xhtml.js Tue Aug 09 22:49:59 2022 -0600 +++ b/src/formats/xhtml.js Tue Aug 09 23:15:58 2022 -0600 @@ -486,7 +486,7 @@ * @since v1.4.1 */ function xhtmlFormat() { - var base = this; + var base = {}; /** * Tag converters cache @@ -880,6 +880,8 @@ } }); }; + + return base; }; /**
diff -r 80a86fb8f2b7 -r 80bf0adc9efd src/sceditor.js --- a/src/sceditor.js Tue Aug 09 22:49:59 2022 -0600 +++ b/src/sceditor.js Tue Aug 09 23:15:58 2022 -0600 @@ -4494,7 +4494,7 @@ original.required = false; var FormatCtor = _formats[options.format]; - format = FormatCtor ? new FormatCtor() : {}; + format = FormatCtor ? FormatCtor() : {}; /* * Plugins should be initialized before the formatters since * they may wish to add or change formatting handlers and