留言板

RE: Adapt CKEDITOR

Jan Bub,修改在12 年前。

Adapt CKEDITOR

Junior Member 帖子: 78 加入日期: 11-3-2 最近的帖子
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?


<%@ 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']
];
thumbnail
Jignesh Vachhani,修改在12 年前。

RE: Adapt CKEDITOR

Liferay Master 帖子: 803 加入日期: 08-3-10 最近的帖子
Jan Bub,修改在12 年前。

RE: Adapt CKEDITOR

Junior Member 帖子: 78 加入日期: 11-3-2 最近的帖子
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.
thumbnail
jelmer kuperus,修改在12 年前。

RE: Adapt CKEDITOR (答复)

Liferay Legend 帖子: 1191 加入日期: 10-3-10 最近的帖子
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
Jan Bub,修改在12 年前。

RE: Adapt CKEDITOR

Junior Member 帖子: 78 加入日期: 11-3-2 最近的帖子
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. emoticon
hadi mans,修改在12 年前。

RE: Adapt CKEDITOR

New Member 帖子: 7 加入日期: 10-10-28 最近的帖子
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 )

			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