Mercurial Hosting > sceditor
diff src/formats/bbcode.js @ 34:20d1f23225fe
fix [url]
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 15 Aug 2022 21:35:44 -0600 |
parents | c23475f3f466 |
children | cd02cd04bc9d |
line wrap: on
line diff
--- a/src/formats/bbcode.js Sun Aug 14 20:36:17 2022 -0600 +++ b/src/formats/bbcode.js Mon Aug 15 21:35:44 2022 -0600 @@ -198,11 +198,19 @@ editor, caller, function (url, text) { - editor.insertText( - '[url=' + url + ']' + - (text || selected || url) + - '[/url]' - ); + if(text) { + editor.insertText( + '[url=' + url + ']' + + (text || selected) + + '[/url]' + ); + } else { + editor.insertText( + '[url]' + + (selected || url) + + '[/url]' + ); + } } ); } @@ -616,7 +624,11 @@ content + '[/email]'; } - return '[url=' + url + ']' + content + '[/url]'; + if( url === content ) { + return '[url]' + content + '[/url]'; + } else { + return '[url=' + url + ']' + content + '[/url]'; + } }, html: function (token, attrs, content) { attrs.defaultattr =