BBCode link values (url and text) from bbcode contrib module aren't parsed into the "Insert link" box when selected. I can create new link correctly, but if I try to select it and click the link button no text appears into Url and text boxes (screenshot attached). Maybe E.getSelection() doesn't work or there's a regex problem?

Defaults buttons behave correctly.

I'm writing some buttons for Wikitext (like Wikipedia ones, but funnier with BUeditor :-) ) modifying the BBcode buttons (due to similar syntaxes), but I've to fix this parsing on selection issue to proceed. Thanks.

CommentFileSizeAuthor
bbcode_isntparsed.jpg24.28 KBchirale

Comments

ufku’s picture

Category: bug » support

Firstly, i mark this issue as support request because the bbcode contrib buttons are not part of the core.
Secondly, i'm not sure i get it right. You say that the default buttons work correctly. Excluding the link button?
As far as i tested, it works as expected. Your selection should start with [url... and end with ...url] having no extra characters.
Are you trying to modify the link button which has the below content?

js:
var S = E.getSelection();
var M = S.match(new RegExp('^\\[url(?:=([^\\]]*))?]((?:.|[\r\n])*)\\[/url]$')) || ['', '', ''];
var form = [
 {name: 'href', title: 'URL', value: M[1] ? M[1] : M[2], suffix: eDefBrowseButton('/?q=imce', 'attr_href', 'Browse', 'link')},
 {name: 'text', value: M[1] ? M[2] : (M[0] ? '' : S)}
];
eDefTagDialog('a', form, 'Insert/edit link', 'OK', 'bbcUrlProcess');

bbcUrlProcess = function(tag, form) {
  var url = form.elements['attr_href'].value;
  var text = form.elements['attr_text'].value;
  var str = '[url'+ (text ? ('='+ url) : '') +']'+ (text ? text : url) +'[/url]';
  editor.dialog.close();
  if (url) editor.active.replaceSelection(str);
}
chirale’s picture

Thanks for the quick reply. Sorry, as "default buttons" I mean "core buttons" (for HTML) bundled with core. This issue affects bbcode links for bbcode contrib buttons. It seems there's a problem on selection.

ufku’s picture

Is the button code same as above?
I had no problem with it.

chirale’s picture

Yes, it's the same. I even try to copy the code above on the button (it differs only for two whitespaces) but nothing changes. I try it on Firefox 3, on Konqueror 3.5.9, epiphany 2.22.2.

Buttons are loaded and code insertion is ok, but when I select an existing string text boxes aren't filled.

ufku’s picture

This could be related: #248330: Value does not work in javascript
Try using 6.x-1.x-dev or the patch for the issue.
If that's the issue, please change the status of this issue to duplicate.

chirale’s picture

Status: Active » Closed (duplicate)

Thanks, upgrading to 6.x-1.x-dev solve the issue to both BBCode and wikitext buttons.