[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.

eZ debug

Timing: Jan 18 2025 16:01:59
Script start
Timing: Jan 18 2025 16:01:59
Module start 'layout'
Timing: Jan 18 2025 16:01:59
Module start 'content'
Timing: Jan 18 2025 16:01:59
Module end 'content'
Timing: Jan 18 2025 16:01:59
Script end

Main resources:

Total runtime0.8621 sec
Peak memory usage4,096.0000 KB
Database Queries78

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0047 588.0469152.6406
Module start 'layout' 0.00470.0028 740.687539.4922
Module start 'content' 0.00750.8532 780.1797631.2969
Module end 'content' 0.86070.0013 1,411.476624.1250
Script end 0.8620  1,435.6016 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.3490160.0002
Check MTime0.00130.1492160.0001
Mysql Total
Database connection0.00070.077410.0007
Mysqli_queries0.784891.0373780.0101
Looping result0.00070.0790760.0000
Template Total0.836897.120.4184
Template load0.00170.198920.0009
Template processing0.835196.869120.4175
Template load and register function0.00010.015710.0001
states
state_id_array0.00070.076610.0007
state_identifier_array0.00170.197720.0009
Override
Cache load0.00150.1760540.0000
Sytem overhead
Fetch class attribute can translate value0.00070.085320.0004
Fetch class attribute name0.00130.1540120.0001
XML
Image XML parsing0.00170.201020.0009
class_abstraction
Instantiating content class attribute0.00000.0054200.0000
General
dbfile0.00170.1954230.0001
String conversion0.00000.001240.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
10content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
10content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
13content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 40
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs