[TYPO3-RTE] Automatic word clean?

Stefano Kowalke blueduck at gmx.net
Thu Dec 4 12:58:56 CET 2008


Christopher schrieb:
> Hi Stan,
> 
> what I am trying to do is simple to explain:
> An editor copies content (let's say from Microsoft Word) and in pastes it in 
> the RTE.
> 
> In that case the RTE just inserts everything which is there: headlines as 
> headlines, text with a special font-type with that font-type and so on.
> 
> When the content is saved(!) it is parsed by 
> RTE.default.proc.entryHTMLparser_db and cleaned in some way (see what is 
> quoted below), e.g. there are no longer headlines.
> (Another problem is that I cannot remap them to b-tags...)
> 
> The problem is that the layout of the text does not change till this 
> (saving) is done!
> That means that the editor sees some formating in the text when he works 
> with it. But some of those tags won't be kept when saving.
> That is confusing and makes working with the text uncomfortable.
> 
> So what I want to do(!) is to clean the text at the moment it is inserted 
> (and not for the first time when it is saved)!
> 
> 
> I tryed to achieve this with the second part I have quoted:
> RTE.default.enableWordClean.HTMLparser {HTMLparser-settings here}
> 
> But there is no change: The text is inserted "as is".
> Nothing is cleaned.
> 
> I also tryed
> RTE.default.enableWordClean {HTMLparser-settings here}
> But without success.
> 
> How can I get an automatic cleaning on inserting?
> 
> Kind regards
> 
> Christopher
> 
> 
> 
> "Stanislas Rolland" schrieb:
> Hi Christopher,
> 
> What is it exactly that you are trying to do and that is not working?
> 
> Stanislas
> 
> 
> 
> Christopher a écrit :
>> Hi Erik,
>>
>> I have tested it now, but it does not work at all:
>>
>> I read the following docs:
>> http://typo3.org/documentation/document-library/extension-manuals/rtehtmlarea/1.4.4/view/4/4/
>>
>> http://typo3.org/documentation/document-library/references/doc_core_tsref/4.1.0/view/5/17/
>>
>> And I saw a discussion in this newsgroup:
>> http://lists.netfielders.de/pipermail/typo3-project-rte/2008-August/001251.html
>> (The author also states that it does not seem to work correctly; but there 
>> is no solution.)
>>
>>
>> I am trying something like the follwoing at the moment, but it does not 
>> change anything:
>>
>> RTE.default.proc.entryHTMLparser_db {
>>         noAttrib = b, i, u, strike, sub, sup
>>         # Remove if no attribs:
>>         rmTagIfNoAttrib = span, div, font
>>
>>         tags {
>>                 p.fixAttrib.align.unset >
>>                 div.fixAttrib.align.unset >
>>                 font.allowedAttribs = color, face, size
>>                 p.allowedAttribs = class, style, align
>>
>>                 # PROBLEM: does not work
>>                 h1.remap = b
>>                 h2.remap = b
>>                 h3.remap = b
>>                 h4.remap = b
>>                 h5.remap = b
>>                 h6.remap = b
>>         }
>> }
>>
>> ...
>>
>> RTE.default.enableWordClean = 1
>> RTE.default.enableWordClean.HTMLparser = 1
>> RTE.default.enableWordClean.HTMLparser < 
>> RTE.default.proc.entryHTMLparser_db
>> RTE.default.enableWordClean.HTMLparser {
>>                 # HTMLparser config
>>                 allowTags (
>>                         blockquote, b, br, caption, center, col, colgroup, 
>> div, em, h1, h2, h3, h4, h5, h6, hr, i, img, li, link, ol, p, pre, strong, 
>> table, thead, tbody, tfoot, td, th, tr, tt, ul, var )
>>                 tags {
>>                         p {
>>                                 # do not allow class.
>>                                 allowedAttribs = id, title, dir, lang, 
>> xml:lang
>>                                 fixAttrib.align.unset = 1
>>                                 fixAttrib.style.unset = 1
>>                         }
>>                         # take away color, face, size
>>                         # Does NOT work.
>>                         font.allowedAttribs >
>>                         # Does NOT work either.
>>                         h1.remap = b
>>                         h2.remap = b
>>                         h3.remap = b
>>                         h4.remap = b
>>                         h5.remap = b
>>                 }
>>                 rmTagIfNoAttrib = span
>>                 removeTags = u, o:p, font
>>         }
>> }
>>
>> What can I do?
>>
>> Christopher
>>
> 
> 

Hi,

i have a work-around for this issue.
Copy the formated text from an Office application and paste it first to 
notepad or another texteditor that not provide these format styles.
Then you copy the text again and paste it to RTE. All formats are gone.

The other way is in the RTE: After pasting the text directly from Office 
to RTE you could click at the broom and choose which formats you want 
throw away.

I hope this is what you want.

Regards
Stefano


More information about the TYPO3-project-rte mailing list