Forums / Developer / ezoe stripping custom tags

ezoe stripping custom tags

Author Message

Erik Weinmaster

Thursday 27 May 2010 2:17:55 pm

I have a system where the ezoe has been hacked to show the actual image in the tinyMCE. This consisted of an edit to tag_custom.tpl and ezxmltext_ezoe.tpl as well as a js plugin.

What works is seeing the actual image in the tinyMCE textarea. However, when I click 'Send for publish' the object with the ezoe attribute publishes, but the custom tag is stripped out.

I have modified my content.ini file to show the applicable attributes, however, I'm looking for where the ezoe strips out the tag it thinks don't belong?

André R.

Friday 28 May 2010 1:17:46 am

It could be the valid_elements list in ezxmltext_ezoe.tpl, it was missing "type" attribute on img tag. (fixed in trunk rev. 241 & stable/5.1 rev. 242).

Or it could be the parser, given that these images are posted as images to server, this is how the image to custom tag mapping works:

if ( $name === '' && isset( $attributes['type'] ) && $attributes['type'] === 'custom' )
{
    $name = 'custom';
    // strip out style / tinymce related classes and end up with only custom tag name
    $attributes['name'] = self::tagClassNamesCleanup( $attributes['class'] );
}

But, why hacking? You had custom image tag support since 5.0.1 & InlineImageIconPath since 5.1, ref (content.ini):

#[CustomTagSettings]
#AvailableCustomTags[]=pagebreak
#AvailableCustomTags[]=underline
#IsInline[underline]=true
## Displays the custom tag as an image so you cannot create sub content.
## Will use custom image if there is a custom attribute on the tag named 'image_url'
#IsInline[externalimage]=image
## Lets you specify 22x22 icon to use on custom image tag if it doesn't have 'image_url' attribute
#InlineImageIconPath[mashup]=images/tango/image-x-generic22.png#

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Erik Weinmaster

Monday 31 May 2010 11:37:16 am

Well, the answer to the first segment (of why the image tag is being stripped out) is that I made the mistake of naming the image url attribute just 'url'. Thus when the system was looking for 'image_url', it couldn't find it.

Now, one more problem. I also have 'href' and 'target' as custom attributes to image. So if a user clicks on image and fills in at least the href attribute as well. then the following will be returned:

'<a href="' + customImgHref.value + '" target="' + customImgTarget.value + '"><img id="__mce_tmp" type="custom" src="' + imageSrc + '" border="0" /></a>'

instead of the normal img tag:

'<img id="__mce_tmp" type="custom" src="' + imageSrc + '" />'

Whats happening is that the anchor tag and image tag (from the first example) are being stripped out in the input parser. This doesn't happen when the normal input tag is returned (second example). I've checked the vales for customImgHref and customImgTarget and both are being populate. Also, the anchor tag does go through the conversion to 'link' type.

Is there something else I need to put into the valid_elements?

H-Works Agency

Tuesday 05 July 2011 9:56:03 am

A little example for people figthing for documentation about this topic :

This will make available two custom tags named "included" and "not_included" which will be rendered in ezoe with image/icons/included.png...etc

 [CustomTagSettings]
AvailableCustomTags[]=included
AvailableCustomTags[]=not_included
IsInline[included]=image
IsInline[not_included]=image
InlineImageIconPath[included]=images/icons/included.png
InlineImageIconPath[not_included]=images/icons/not_included.png

EZP is Great