Jump to content

NIC EDIT help


conan318

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.