Reputation: 303
I am trying to add a link using ckeditor.
<a href="$JSPFILENAMES.getAbsoluteJSPName("LOGIN_JSP")?type=7">login</a>
I am clicking the hyperlink icon on ckeditor and pasting $JSPFILENAMES.getAbsoluteJSPName("LOGIN_JSP")?type=7. When I do this the link is created with href="$JSPFILENAMES.getAbsoluteJSPName(". Anything after the first double quote is removed. I need to figure out a solution for this problem. I can think of 2 solutions which I am not able to implement due to various constraints.
Solution 1: Create the hyperlink with href using single quotes instead of double quotes like login. Does ckeditor have a setting to attain this?
Sultion 2: Create a custom dropdown which can insert the link. This way I can create the href with single quote. But this did not work either because ckeditor is failing if I use quotes or double quaotes or &quot; or escape characters in the text I need to insert using the following code.
CKEDITOR.plugins.add( 'links_tokens', {
requires : ['richcombo'], //, 'styles' ],
init : function( editor ) {
var config = editor.config,
lang = editor.lang.format;
var login_link = '<a href="$JSPFILENAMES.getAbsoluteJSPName("LOGIN_JSP")?type=7">login</a>';
var links_tags = [];
links_tags[0]=[login_link, "Login", "Login"];
links_tags[1]=["$company.getcompany_url()", "URL", "URL"];
editor.ui.addRichCombo( 'links_tokens', {
label : "Links tokens",
title :"Links tokens",
voiceLabel : "Links tokens",
className : 'cke_format',
multiSelect : false,
panel : {
css : [ config.contentsCss, CKEDITOR.getUrl( editor.skinPath + 'editor.css' ) ],
voiceLabel : lang.panelVoiceLabel
},
init : function() {
this.startGroup( "Links tokens" );
for (var this_tag in links_tags){
this.add(links_tags[this_tag][0], links_tags[this_tag][1], links_tags[this_tag][2]);
}
},
onClick : function( value ) {
editor.focus();
editor.fire( 'saveSnapshot' );
editor.insertHtml(value);
editor.fire( 'saveSnapshot' );
}
});
}
});
Upvotes: 1
Views: 1281
Reputation: 41
You can not have double quotes inside the double quotes. You can either have double quotes inside the single quotes or single quotes inside the double quotes. If you really want to use the double quotes inside the double quotes, you need to add forward lash before the quotes ie: "$JSPFILENAMES.getAbsoluteJSPName(\"LOGIN_JSP\")?type=7"
Upvotes: 1