/** * Copyright (c) Tiny Technologies, Inc. All rights reserved. * Licensed under the LGPL or a commercial license. * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * * Version: 5.9.2 (2021-09-08) */ (function () { 'use strict'; var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager'); var global = tinymce.util.Tools.resolve('tinymce.util.Tools'); var html2bbcode = function (s) { s = global.trim(s); var rep = function (re, str) { s = s.replace(re, str); }; rep(/(.*?)<\/a>/gi, '[url=$1]$2[/url]'); rep(/(.*?)<\/font>/gi, '[code][color=$1]$2[/color][/code]'); rep(/(.*?)<\/font>/gi, '[quote][color=$1]$2[/color][/quote]'); rep(/(.*?)<\/font>/gi, '[code][color=$1]$2[/color][/code]'); rep(/(.*?)<\/font>/gi, '[quote][color=$1]$2[/color][/quote]'); rep(/(.*?)<\/span>/gi, '[color=$1]$2[/color]'); rep(/(.*?)<\/font>/gi, '[color=$1]$2[/color]'); rep(/(.*?)<\/span>/gi, '[size=$1]$2[/size]'); rep(/(.*?)<\/font>/gi, '$1'); rep(//gi, '[img]$1[/img]'); rep(/(.*?)<\/span>/gi, '[code]$1[/code]'); rep(/(.*?)<\/span>/gi, '[quote]$1[/quote]'); rep(/(.*?)<\/strong>/gi, '[code][b]$1[/b][/code]'); rep(/(.*?)<\/strong>/gi, '[quote][b]$1[/b][/quote]'); rep(/(.*?)<\/em>/gi, '[code][i]$1[/i][/code]'); rep(/(.*?)<\/em>/gi, '[quote][i]$1[/i][/quote]'); rep(/(.*?)<\/u>/gi, '[code][u]$1[/u][/code]'); rep(/(.*?)<\/u>/gi, '[quote][u]$1[/u][/quote]'); rep(/<\/(strong|b)>/gi, '[/b]'); rep(/<(strong|b)>/gi, '[b]'); rep(/<\/(em|i)>/gi, '[/i]'); rep(/<(em|i)>/gi, '[i]'); rep(/<\/u>/gi, '[/u]'); rep(/(.*?)<\/span>/gi, '[u]$1[/u]'); rep(//gi, '[u]'); rep(/]*>/gi, '[quote]'); rep(/<\/blockquote>/gi, '[/quote]'); rep(/
/gi, '\n'); rep(//gi, '\n'); rep(/
/gi, '\n'); rep(/

/gi, ''); rep(/<\/p>/gi, '\n'); rep(/ |\u00a0/gi, ' '); rep(/"/gi, '"'); rep(/</gi, '<'); rep(/>/gi, '>'); rep(/&/gi, '&'); return s; }; var bbcode2html = function (s) { s = global.trim(s); var rep = function (re, str) { s = s.replace(re, str); }; rep(/\n/gi, '
'); rep(/\[b\]/gi, ''); rep(/\[\/b\]/gi, ''); rep(/\[i\]/gi, ''); rep(/\[\/i\]/gi, ''); rep(/\[u\]/gi, ''); rep(/\[\/u\]/gi, ''); rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi, '$2'); rep(/\[url\](.*?)\[\/url\]/gi, '$1'); rep(/\[img\](.*?)\[\/img\]/gi, ''); rep(/\[color=(.*?)\](.*?)\[\/color\]/gi, '$2'); rep(/\[code\](.*?)\[\/code\]/gi, '$1 '); rep(/\[quote.*?\](.*?)\[\/quote\]/gi, '$1 '); return s; }; function Plugin () { global$1.add('bbcode', function (editor) { console.warn('The bbcode plugin has been deprecated and marked for removal in TinyMCE 6.0'); editor.on('BeforeSetContent', function (e) { e.content = bbcode2html(e.content); }); editor.on('PostProcess', function (e) { if (e.set) { e.content = bbcode2html(e.content); } if (e.get) { e.content = html2bbcode(e.content); } }); }); } Plugin(); }());