留言板
RE: Adapt CKEDITOR
Hi,
I want to extend the CKEditor with an video Function. Unfortunately I fail by adding an extra button. I created a hook plugin with the file ckconfig.jsp but the toolbar is not changing. Although I noticed that the toolbar view not match to the structure in die config file. Can anybody help me how to extend the ckeditor in liferay?
I want to extend the CKEditor with an video Function. Unfortunately I fail by adding an extra button. I created a hook plugin with the file ckconfig.jsp but the toolbar is not changing. Although I noticed that the toolbar view not match to the structure in die config file. Can anybody help me how to extend the ckeditor in liferay?
<%@ page import="com.liferay.portal.kernel.util.HtmlUtil" %>
<%@ page import="com.liferay.portal.kernel.util.ParamUtil" %>
<%String cssPath = ParamUtil.getString(request, "cssPath");%>
[color=#e80c0c][b]
//Ergänzungen für das Kaltura-Plugin
CKEDITOR.plugins.add( 'abbr',
{
init: function( ckEditor )
{
// Plugin logic goes here...
}
} );
ckEditor.addCommand( 'abbrDialog', new CKEDITOR.dialogCommand( 'abbrDialog' ) );
ckEditor.ui.addButton( 'Abbr',
{
label: 'Insert Abbreviation',
command: 'abbrDialog',
icon: this.path + 'images/icon.png'
} );[/color][/b]
CKEDITOR.addStylesSet(
'liferayStyles',
[
// Block Styles
{name: 'Normal', element : 'p'},
{name: 'Heading 1', element : 'h1'},
{name: 'Heading 2', element : 'h2'},
{name: 'Heading 3', element : 'h3'},
{name: 'Heading 4', element : 'h4'},
//Special classes
{name: 'Preformatted Text', element:'pre'},
{name: 'Cited Work', element:'cite'},
{name: 'Computer Code', element:'code'},
//Custom styles
{name : 'Info Message', element : 'div', attributes : {'class' : 'portlet-msg-info'}},
{name : 'Alert Message', element : 'div', attributes : {'class' : 'portlet-msg-alert'}},
{name : 'Error Message', element : 'div', attributes : {'class' : 'portlet-msg-error'}}
]
);
CKEDITOR.config.contentsCss = '<%= HtmlUtil.escape(cssPath) %>/main.css';
CKEDITOR.config.entities = false;
CKEDITOR.config.resize_enabled = false;
CKEDITOR.config.height = 265;
CKEDITOR.config.stylesCombo_stylesSet = 'liferayStyles';
CKEDITOR.config.toolbar_liferay = [
['Styles', 'FontSize', '-', 'TextColor', 'BGColor'],
['Bold', 'Italic', 'Underline', 'StrikeThrough'],
['Subscript', 'Superscript'],
'/',
['Undo', 'Redo', '-', 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'SelectAll', 'RemoveFormat'],
['Find', 'Replace', 'SpellCheck'],
['OrderedList', 'UnorderedList', '-', 'Outdent', 'Indent'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
'/',
['Source'],
['Link', 'Unlink', 'Anchor'],
[b][color=#e80c0c]['Abbr'[/color][/b]],'Image', 'Flash', 'Table', '-', 'Smiley', 'SpecialChar']
];
Hey Jignesh, I can't find informations to that problem under the link but after wasting one day with "try and error" I realized that it is perhaps a bug. I tested it with the trial EE version an it works perfectly. But I am not able to fix it. At this time I only can hope for 6.1 CE. But this can not be the solution. If anybody have an idea how to fix the problem, please help.
Try using the attached ckeditor.jsp (by for instance creating a jsp hook or overwriting the file in webapps\ROOT\html\js\editor\ckeditor.jsp
The jsp that comes with liferay 6.0.5 / 6.0.6 has a ton of issues, and does not load the config
The jsp that comes with liferay 6.0.5 / 6.0.6 has a ton of issues, and does not load the config
Thank you very much jelmer. I was trying to solve the bug by myself. You saved me a lot of time and my closing time.
thank you for the modification
i`m facing a strange behavior
i`v add some extra html filters to the ckeditor inside ckeditor.jsp
it worked perfectly on my local machine but not working at all on line as if ckedito is not recognizing them
my code is add to the original code (my extra code in red )
Could you pleas advice me on this
i`m facing a strange behavior
i`v add some extra html filters to the ckeditor inside ckeditor.jsp
it worked perfectly on my local machine but not working at all on line as if ckedito is not recognizing them
my code is add to the original code (my extra code in red )
ckEditor.on(
'instanceReady',
function([color=#e81616]ev[/color]) {
[color=#ee0d0d]ev.editor.dataProcessor.htmlFilter.addRules(
{
elements:
{
$: function (element) {
// Output dimensions of images as width and height
if (element.name == 'p') {
var style = element.attributes.style;
var dir = element.attributes.dir;
if(dir)
{
if ( style )
{
element.attributes.style = element.attributes.style + "direction:"+dir;
}
else
{
element.attributes.style = "direction:"+dir;
}
delete element.attributes.dir;
}
}
if (!element.attributes.style)
delete element.attributes.style;
return element;
}
}
});[/color]
setInterval(
function() {
try {
onChangeCallback();
}
catch(e) {
}
},
300
);
}
);{
Could you pleas advice me on this