1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
| var nicLinkOptions = {
buttons: {
'link': {
name: 'Lien',
type: 'nicLinkButton',
tags: ['A']
},
'unlink': {
name: 'Supprimer le lien',
command: 'unlink',
noActive: true
}
}
};
var nicLinkButton = nicEditorAdvancedButton.extend({
addPane: function () {
this.ln = this.ne.selectedInstance.selElm().parentTag("A");
this.addForm({
"": {
type: "title",
txt: "Ajouter/Editer le lien"
},
href: {
type: "text",
txt: "URL",
value: "http://",
style: {
width: "150px"
}
},
title: {
type: "text",
txt: "Titre"
},
target: {
type: "select",
txt: "Ouvrir",
options: {
"": "La fenêtre courante",
_blank: "Nouvelle fenêtre"
},
style: {
width: "100px"
}
}
}, this.ln)
},
submit: function (C) {
var A = this.inputs.href.value;
if (A == "http://" || A == "") {
alert("Vous devez entrer une URL pour créer un lien");
return false
}
this.removePane();
if (!this.ln) {
var B = "javascript:nicTemp();";
this.ne.nicCommand("createlink", B);
this.ln = this.findElm("A", "href", B)
}
if (this.ln) {
this.ln.setAttributes({
href: this.inputs.href.value,
title: this.inputs.title.value,
target: this.inputs.target.options[this.inputs.target.selectedIndex].value
})
}
}
});
nicEditors.registerPlugin(nicPlugin, nicLinkOptions); |
Partager