Customizing EZ Online Editor

Author Message

Hakim Bouras

Friday 18 November 2005 11:06:29 am

How can I add features for the end users such as: justifying the text or selecting the color of the text?

Also how are we suppose to use the "wordmatch.ini" file to enable text pasted from Word?

And finally how can modulate/customize what will be accepted or not in an XMLbloc (tag and attribute)?

Thank you for your help
Hakim

Kirill Subbotin

Monday 21 November 2005 2:51:01 am

>Justifying the text or selecting the color of the text?

Its impossible to do it directly in current realization, although you can use templates and css classes to implement it on your site. For justifying text you can use your special custom tag and render it as justified text using template. (placed in /templates/content/datatype/view/ezxmltags directory in your site design)

> Also how are we suppose to use the "wordmatch.ini" file to enable text pasted from Word?

You can paste from Word without any additional settings. 'wordmatch.ini' is an advanced feature intended to keep additional Word styling information and translate it in order to use in your site design. In fact it searches the given string inside HTML pasted from Word and if matches it adds the corresponding class attribute to your XML tag.

I don't know where user should get those strings, the possible way to do it is to view Word's clipboard result in HTML format. I think we will add debug output of the input data, so you can view it and copy those strings.

But anyway now this is more like backward-compatiblity feature, we will review it in future releases of OE.

> And finally how can modulate/customize what will be accepted or not in an XMLbloc (tag and attribute)?

Currently it's impossible, although I think these features will be implemented in ez publish 4.

Ɓukasz Serwatka

Monday 21 November 2005 4:07:04 am

Hakim, don't cross post please. One message deleted due to cross posting.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Hakim Bouras

Monday 21 November 2005 7:45:02 am

Kirill,

Thanks for your answer. I found a way for the editor to do a part of what I want (by updating the "ezeditor.js" file). But, the text justification is lost, when the content is saved in the XML block.
Do you know what php code (and where) is used to clean the content received in the XML Block?

Lukasz,

Sorry for the cross post, but since I did not get answers, I thought it was maybe not the right place. I'll be more patient in the future.

Kirill Subbotin

Tuesday 22 November 2005 8:36:06 am

It is done in /ezxmltext/handlers/input/ ezdhtmlxmlinput.php

It will be much better if you use OE 4.0 alpha, cause we have rewritten this part there and its much easier to manage now.

Kirill Subbotin

Tuesday 22 November 2005 8:39:16 am

To correctly implement this you have to set new conversion rules html -> eZXML.

Also not only the input part, but the output to the edit window should be updated. (in the same file)

Hakim Bouras

Tuesday 22 November 2005 9:04:56 am

I had a quick look to this file and was a bit afraid of going through these more than 4000 lines of code...

Would it be possible for you to give some clues to exactly know what methods need to be changed and where in order to:
- allow a tag (ie: <FONT> tag)
- allow an attribute (ie: color="red" - color attribute)

Thanks for your help,
Hakim

Kirill Subbotin

Tuesday 22 November 2005 9:18:11 am

You can't just "allow" a tag. You can only convert it to a one of ezxml tags.
Allowing an attribute is simple if you are using oe 4.0.

Hakim Bouras

Tuesday 22 November 2005 9:38:58 am

Then, would it be possible for you to give some clues to exactly know what methods need to be changed and where in order to:
- convert a tag (ie: <FONT> tag)
- allow an attribute with oe 4.0 (ie: color="red" - color attribute)

Thanks

Kirill Subbotin

Wednesday 23 November 2005 3:08:05 am

You can convert 'font' tag to 'custom' with specific attributes.

To do this:
In the $InputTags array, add element:
'font' => array( 'name' => 'custom' ),

In the $OutputTags array find definition of the 'custom' tag, here you should add new conversion rules for the attributes, for example 'style' => 'custom:style', which means that style attribute of the font tag will be converted to 'custom:style' attribute of custom tag.

To find out which tags and attributes come from the input and what is actually stored you can add debug output to the validateInput function. I think just uncomment these lines:
eZDebug::writeDebug( $text, 'HTML input' );
eZDebug::writeDebug( $myDomString, 'converted eZXML' );

Also you should correct rendering of the custom tag in the inputTagXML function.

Kirill Subbotin

Wednesday 23 November 2005 3:16:03 am

Also you should add a 'name' attribute to your custom tag converted from 'font' tag. For example you want the name "font".

One of easiest ways to do this is to add 'title' attribute to the font tag in the javascript part. Then it will be automatically converted to a 'name'. (see $OutputTags for the converting rules).

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.