[SOLVED] Online Editor - preserving align when pasting

Author Message

STEVO +

Sunday 02 August 2009 10:32:06 am

Hi,

When pasting into OE from word (2007) using cntrl-v or the pasteword button, all the attributes of tags appear to be stripped, even 'align' which is supported by ezxml.

I thought this would be a fairly easy fix but i'm going nowhere at the moment.

Any pointers anyone?

André R.

Sunday 02 August 2009 1:10:47 pm

What version? I guess its 5.0.0 or 5.0.1 since you use that button, shouldn't need on newer versions(.2 & svn).
This is 100% TinyMCE territory, so you should take a look at settings* for it and modify "ezoe/design/standard/templates/content/datatype/edit/ezxmltext_ezoe.tpl" to set them.

* http://wiki.moxiecode.com/index.php/TinyMCE:Configuration
&
http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste

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

STEVO +

Monday 03 August 2009 3:32:06 am

Thanks for the info Andre,

Sorry I should have said I'm using svn trunk. was just experimenting with the pasteword button.

Good to know it's a tinymce thing. i will continue scouring the paste plugin.

STEVO +

Monday 03 August 2009 5:00:22 am

doh, silly me.

[align] needs adding to relevant tags in the valid_elements setting in ezoe/design/standard/templates/content/datatype/edit/ezxmltext_ezoe.tpl

André R.

Monday 03 August 2009 5:03:00 am

> Good to know it's a tinymce thing. i will continue scouring the paste plugin.
If the cleanup is done before you even press publish or store draft, then it is tinyMCE and you can verify it by using firebug or the 'code' button to see the current internal xhtml.
If the cleanup is done when page is refreshed with publish, store draft or disable editor button, then its is the ezoe html to ezxml Parser (eZOEInputParser).

UPDATE:
>[align] needs adding to relevant tags in the valid_elements setting in ezoe/design/standard/templates/content/datatype/edit/ezxmltext_ezoe.tpl

Damn.. thanks, will fix that, Witch tags are missing? Should be table, div, span, td, th, h[1-6] and p tags.

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

STEVO +

Monday 03 August 2009 5:17:29 am

i think all of them were missing [align].

the cleanup was happening in _serializeNode() which gets fired after a paste.

anyways, great work on the editor btw. a massive improvement. and the yui stuff's another step in the right direction.

STEVO +

Monday 03 August 2009 5:20:28 am

div doesn't seem to be there at all. should have the same allowed attrs as span, no?

André R.

Monday 03 August 2009 5:28:09 am

yes, and span is incorrectly together with the block elements in valid_child_elements.

Haven't looked at this in a year++, since tinyMCE validation was disabled as it created to many issues*. didn't know past plugin used it as well though :)

This is what I have so far, does it correspond to what you have and have tested?
add align on span + p + table + td + th, add div ( div[type|class|title|customattributes|align] ), add attributes on headings ([class|customattributes|align]) and move span from block to inline tags in valid_child_elements.

* Will try to re enable it during the 5.1(4.3 probably) phase though, as it is desirable to use it correctly, and it might behave a bit better now with newer versions of TinyMCE and with the changes in the internal xhtml over the last 18 months..

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

STEVO +

Monday 03 August 2009 5:31:23 am

looks good to me.

cheers André

André R.

Monday 03 August 2009 6:27:07 am

Cheers back ;)

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

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