Keyword

K2 v2.3 Extra Fields html editor link target error

  • matthew turner
  • matthew turner's Avatar Topic Author
  • Offline
  • Senior Member
More
14 years 2 months ago #85235 by matthew turner
HiJust found a fault with the latest release of K2 (v2.3) -  I have added the fix below)I was really happy to find the new feature of a html editor in the Extra Fields "text area" as I was about to make the required hacks to the core files for another client....However I have found that the "default html editor" used in this new feature incorrectly sets the "open in same window" target to either empty quotes "" or "target" which opens the link in a new window...I have found the offending line replaced the empty double quotes and added the missing "_self" instead and tested it works before posting this.I hope this helps.Affected file : /administrator/components/com_k2/lib/nicEdit.jsline : 72before: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);after: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:{_self:"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);

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum