Bug #16341
closedEntities entered in wysiwyg are decoded and therefore gone when toggling to html source or saving
0%
Description
Version info: 1.4.1 demo mode with some adaptions in page tsconfig
If you want to use the RTE for documentation purposes, you might need to talk about entities, but they get decoded when toggling to htmlCode view and on save.
- in whysiwyg enter <
- toggle to htmlCode view and you see < where it should be <
- toggle back whysiwyg and you see <
The same destructive behaviour is observed on
- entering < in wysiwyg-mode
- then pressing save
I found out where this happens :-)
The thief of my entitities is to be found in HTMLArea.htmlEncode = function(str). Before the entities get encoded, they get decoded:
str = HTMLArea.htmlDecode(str);
If you comment out this line, the entities are kept, provided that the parser is configured properly (see additional information).
Prosit, Uschi
HTMLArea.htmlEncode = function(str) {
if (typeof(str) != 'string') str = str.toString(); // we don't need regexp for that, but.. so be it for now.
// Let's not do it twice
// str = HTMLArea.htmlDecode(str);
str = str.replace(/&/g, "&");
str = str.replace(/</g, "<").replace(/>/g, ">");
str = str.replace(/\xA0/g, " "); // Decimal 160, non-breaking-space
str = str.replace(/\x22/g, """); // \x22 means '"'
str = str.replace(HTMLArea.Reg_entities, "&$1;"); // keep numeric entities
return str;
};
Parser configuration:
- default, see res/proc/pageTSConfig.txt
RTE.default.proc.entryHTMLparser_db.htmlSpecialChars = 0
- my config
- If this is not set, the entities are destroyed by the central parser even after
- you comment out the str = HTMLArea.htmlDecode(str);
RTE.default.proc.exitHTMLparser_rte = 1
RTE.default.proc.exitHTMLparser_rte.htmlSpecialChars = -1
(issue imported from #M3830)
Files
Updated by Uschi Renziehausen over 18 years ago
I just realised that there are to more things to change in RTE.default.proc, because otherwise the main parser will destroy entities inside
! Here again the full list: RTE.default.proc.entryHTMLparser_db.htmlSpecialChars = 0 RTE.default.proc.entryHTMLparser_rte = 1 RTE.default.proc.exitHTMLparser_rte = 1 RTE.default.proc.entryHTMLparser_rte.htmlSpecialChars = 1 RTE.default.proc.dontHSC_rte = 1 RTE.default.proc.exitHTMLparser_rte.htmlSpecialChars = -1
Updated by Dmitry Pikhno over 18 years ago
i am not sure if this bug has relation to my but... anyway
it is not possible to insert presentation of tag in text. for example:
text "tag for links is <a>" in whysiwyg converted to "tag for links is"
and source shows "tag for links is <a rtekeep=1></a>" instead of "tag for links is <a>". it happens after saving.
Updated by Stanislas Rolland almost 17 years ago
I would think that if you use htmlArea RTE 1.5.4+ (it would probably work also with older versions) and if you use the default processing options (that is: if you do not override any part of RTE.default.proc in Page TSConfig), then all you need to do is add the following two lines to Page TSConfig:
RTE.default.proc.dontUndoHSC_db = 1
RTE.default.proc.dontHSC_rte = 1
Updated by Stanislas Rolland almost 17 years ago
See related issue #5659 for patch.
Fixed in SVN TYPO3core branches trunk and TYPO3_4-2.