conan318 Posted August 20, 2011 Share Posted August 20, 2011 i am using nic edit on my text area which all is working expect for when i use the add link button when i add a link it just displays javascript:nicTemp(); and not the link i think this is part of there code that does not work they havent made it eazy to read var nicLinkButton=nicEditorAdvancedButton.extend({addPane:function(){this.ln=this.ne.selectedInstance.selElm().parentTag("A");this.addForm({"":{type:"title",txt:"Add/Edit Link"},href:{type:"text",txt:"URL",value:"http://",style:{width:"150px"}},title:{type:"text",txt:"Title"},target:{type:"select",txt:"Open In",options:{"":"Current Window",_blank:"New Window"},style:{width:"100px"}}},this.ln)},submit:function(C){var A=this.inputs.href.value;if(A=="http://"||A==""){alert("You must enter a URL to Create a Link");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); Link to comment https://forums.phpfreaks.com/topic/245258-nic-edit-help/ Share on other sites More sharing options...
Omirion Posted August 20, 2011 Share Posted August 20, 2011 Readable code: Read notes bellow. var nicLinkButton = nicEditorAdvancedButton.extend({ addPane:function(){ this.ln=this.ne.selectedInstance.selElm().parentTag("A"); this.addForm({ "":{ type:"title", txt:"Add/Edit Link" }, href:{ type:"text", txt:"URL", value:"http://", style:{ width:"150px" } }, title:{ type:"text", txt:"Title" }, target:{ type:"select", txt:"Open In", options:{ "":"Current Window", _blank:"New Window" }, style:{ width:"100px" } } }, this.ln )}, submit:function(C){ var A=this.inputs.href.value; if(A=="http://"||A=="") { alert("You must enter a URL to Create a Link"); 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); Notes: there is some code that doesn't add up. So either i split the code wrong, or there is more code before it. Also i'm sure providing a link of the plugin would help. Also if there is any code written by you using the plugins API or whatnot. Seeing as i have never used it i don't know how i functions. Link to comment https://forums.phpfreaks.com/topic/245258-nic-edit-help/#findComment-1259932 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.