hacking quicktags 2nd link button, how?
-
Hi,
I’m trying to create a second link button in the quicktags.js file, so that I can have the option to format my links two different ways.
Here is what I did:
1. I copied and pasted the existing link button and renamed it:
‘edButtons[edButtons.length] =
new edButton(‘ed_jlink’
,’jlink’
,”
,”
,’j’
); // special case’2. added the following else if statement to the function edShowButton:
‘else if (button.id == ‘ed_jlink’) {
document.write(‘<input type=”button” id=”‘ + button.id + ‘” accesskey=”‘ + button.access + ‘” class=”ed_button” onclick=”edInsertJLink(edCanvas, ‘ + i + ‘);” value=”‘ + button.display + ‘” />’);
}’3. copied and renamed the function edInsertLink:
‘function edInsertJLink(myField, i, defaultValue) {
if (!defaultValue) {
defaultValue = ‘https://’;
}
if (!edCheckOpenTags(i)) {
var URL = prompt(‘Enter the URL’ ,defaultValue);
if (URL) {
edButtons[i].tagStart = ‘‘;
edInsertTag(myField, i);
}
}
else {
edInsertTag(myField, i);
}
}’I uploaded the quicktags.js file but if I go to the post page I don’t get any quicktags button displayed and I get the following javascript error: Error Object expected.
Can anyone help please?
Thanks.
Stefan
- The topic ‘hacking quicktags 2nd link button, how?’ is closed to new replies.