I have a client who wants target="_blank" added to his links created by the BUEditor button automatically. I don't know javascript and can't figure out where to add it in this code:

js:
var B = eDefBrowseButton('', 'attr_href', 'Browse', 'link');
var form = [
 {name: 'href', title: 'Link href', suffix: B},
 {name: 'title', title: 'Title text' },
];
eDefTagDialog('a', form, 'Insert/edit link', 'OK');

Anyone know?

Thanks,

Michelle

Comments

ufku’s picture

js:
var B = eDefBrowseButton('', 'attr_href', 'Browse', 'link');
var form = [
{name: 'href', title: 'Link href', suffix: B},
{name: 'title', title: 'Title text' },
{name: 'target', value: '_blank'}
];
eDefTagDialog('a', form, 'Insert/edit link', 'OK');

For a selectbox try replacing "{name: 'target', value: '_blank'}" with "{name: 'target', type: 'select', options: {'_blank': 'New page', '': 'Current page'} , value: '_blank'}"

For disabling the default _blank value, delete ", value: '_blank'" strings.

michelle’s picture

Status: Active » Fixed

Perfect!

Thanks for the quick response and even going beyond with the selection. That's awesome!

Love this editor, by the way. I use it on all my sites. It gives me shortcuts for HTML without getting in the way like a WYSIWYG.

Michelle

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

cheathamlane’s picture

Title: Add target="_blank" to link » Add target="_blank" to link (and have the target field be hidden)

Hi there:

Adding the line like you show above works A-OK. I can't seem to hide the "target" field though.

This doesn't work:

js:
var B = eDefBrowseButton('$imce_url', 'attr_href', 'Browse', 'link');
var form = [
 {name: 'href', title: 'Link href', suffix: B},
 {name: 'title', title: 'Title text'},
 {name: 'target', type:'hidden', value: '_blank'}
];
eDefTagDialog('a', form, 'Insert/edit link', 'OK');

The target input field is still visible.

Ideas?

Thanks!

clockwood’s picture

I'd also love to learn how to hide the USER INPUT field for certain link attributes.

In my case, I'm using BUeditor on a forum and I need to add rel="nofollow" to the link code added by users in comments, without allowing them to edit/select the rel attribute.

clockwood’s picture

Status: Closed (fixed) » Active

Changing status to active in hope this will be seen. Sorry for the double post.

ufku’s picture

try {name: 'rel', title: '', value: 'nofollow', attributes: {type: 'hidden'}}

clockwood’s picture

A+ thanks!

ufku’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

gadehans’s picture

Version: 5.x-1.x-dev » 6.x-2.1
Status: Closed (fixed) » Active

This doesn't seem to work in Drupal 6 with BUEditor version 6.x-2.1.

I'm trying to make every link open in a new window, i.e adding a default target="_blank" to links made by BUeditor. I tried messing with the code in "default.bueditor.txt" but without any luck.

Does anyone know a god solution?

ufku’s picture

Status: Active » Fixed
js:
var form = [
 {name: 'href', title: 'Link URL', required: true, suffix: E.imce.button('attr_href')},
 {name: 'html', title: 'Link text'},
 {name: 'title', title: 'Link title'},
 {name: 'target', type: 'hidden', value: '_blank'}
];
E.tagDialog('a', form, {title: 'Insert/edit link'});

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.