comparison 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
comparison
equal deleted inserted replaced
33:c23475f3f466 34:20d1f23225fe
196 txtExec: function (editor, caller, selected) { 196 txtExec: function (editor, caller, selected) {
197 getEditorCommand('link')._dropDown( 197 getEditorCommand('link')._dropDown(
198 editor, 198 editor,
199 caller, 199 caller,
200 function (url, text) { 200 function (url, text) {
201 editor.insertText( 201 if(text) {
202 '[url=' + url + ']' + 202 editor.insertText(
203 (text || selected || url) + 203 '[url=' + url + ']' +
204 '[/url]' 204 (text || selected) +
205 ); 205 '[/url]'
206 );
207 } else {
208 editor.insertText(
209 '[url]' +
210 (selected || url) +
211 '[/url]'
212 );
213 }
206 } 214 }
207 ); 215 );
208 } 216 }
209 }, 217 },
210 quote: { 218 quote: {
614 if (url.substr(0, 7) === 'mailto:') { 622 if (url.substr(0, 7) === 'mailto:') {
615 return '[email="' + url.substr(7) + '"]' + 623 return '[email="' + url.substr(7) + '"]' +
616 content + '[/email]'; 624 content + '[/email]';
617 } 625 }
618 626
619 return '[url=' + url + ']' + content + '[/url]'; 627 if( url === content ) {
628 return '[url]' + content + '[/url]';
629 } else {
630 return '[url=' + url + ']' + content + '[/url]';
631 }
620 }, 632 },
621 html: function (token, attrs, content) { 633 html: function (token, attrs, content) {
622 attrs.defaultattr = 634 attrs.defaultattr =
623 escapeEntities(attrs.defaultattr, true) || content; 635 escapeEntities(attrs.defaultattr, true) || content;
624 636