Recent Topics

1 Jan 26, 2007 16:48    

I did this one before and I don't think the code changed, but since I did it again I'll share it here again. Crack open plugins/_quicktags.plugin.php and find something that looks mostly like this, then make it be like this:

		function b2evoInsertLink(myField, i, defaultValue) {
			if (!defaultValue) {
				defaultValue = 'http://';
			}
			if (!b2evoCheckOpenTags(i)) {
				var URL = prompt('<?php echo T_('URL') ?>:' ,defaultValue);
				if (URL) {
					var URLTITLE = prompt('<?php echo T_('TITLE') ?>:' ,URL);
					b2evoButtons[i].tagStart = '<a href="' + URL + '" title="' + URLTITLE + '">';
					b2evoInsertTag(myField, i);
				}
			}
			else {
				b2evoInsertTag(myField, i);
			}
		}

The 'link' button will prompt you for a title after you give it your url, defaulting to the url as the title. It'll make your page smarter because smart pages have title tags.

2 Jan 26, 2007 17:01

Great! I was going to ask for this. I'm testing it with 1.9.1 and it works.

The little problem is, when the prompt pops up, one cannot change tabs (at least in firefox 1.5). Since one cannot have (that I know of) two selections in the clipboard (one for the URL and another for the title), I usually change tab to the one I'm linking to, copy the title and paste it back in my editor tab. Would there be a way to make this pop-ups "non-blocking" so that one can change tabs after they spring into existance?

P.S. I don't know if the proper term is "non-blocking", but I haven't find anything in google by that term 'javascript non-blocking prompt', so I suspect that's not the proper term.

3 Jan 26, 2007 17:31

AFAIK you can't do it with the plugin as-is because, again AFAIK, javascript rules tabs when a popup is pops up. You can switch windows of course, but that means knowing up front you want one window to post in and another window for the link and the text.

Personally I've been happy with using the url as the title because it beats the pants off of not having a title at all. On the occasion that I want a different title tag I edit it after the link button does the insert thing.

4 Jan 26, 2007 17:33

That's bad. However it is better than the way it was before, i.e., I had to insert the title proporty by hand. And for some reason I seem to be addicted to inserting titles for all links. Anyway, thanks for the hack.

5 Jan 27, 2007 14:48

You could make it popup with a pseudo window (ie/ a div with a couple of <input type="text">'s) instead of the 2*prompt(), then you'd be able to switch windows/tabs and copy-paste .... but as EdB said, you'd need to hack the plugin to achieve it

¥


Form is loading...