-
Improvement
-
Resolution: Fixed
-
Minor
-
1.6, 1.7, 1.8, 1.9
-
None
-
MOODLE_16_STABLE, MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE
-
MOODLE_18_STABLE, MOODLE_19_STABLE
This patch fixes an issue with pasting in HTMLarea, in addition to a few other bugfixes.
1. Unnesting block tags
When pasting multiple-paragraph text into HTMLarea in MSIE, HTML blocks may be nested. This is usually a problem when paragraphs are pasted into a heading, which is often the case when attempting to paste at the beginning of a document. It is non-trivial to circumvent the problem or fix the formatting, without resorting to html-mode.
This patch adds unnesting of block tags to the word html-cleaner.
Mozilla does not have this problem, as it doesn't allow nesting as a result of pasting.
2. </><//>-style garbage removed. (MDL-13451)
Issues with getHTML (the innerHTML-replacement) of HTMLarea combined with nasty behaviour of MSIEs tag soup parser may generate garbage that doubles in length each time the text is saved (or html-mode is entered).
The problem is, MSIE won't parse unknown tags as content tags, for example <foo></foo> will be two empty nodes in the DOM, which will be considered content-tags and each will be closed in the generated HTML. By only closing tags that are recognized by MSIE, the problem will no longer occur. Also old tags generated by the byg looking like </>, <//>, or <//foo> are removed.
3. Ctrl+rightarrow keybinding removed (MDL-13451)
The input handling of HTMLarea is screwed up. The same function handles both keydown and keypress events, not taking into consideration that the generated keyCode varies depending on the event type. (See http://unixpapa.com/js/key.html for a description of the mess that is javascript keyboard handling.)
A simple fix is provided by commenting out this keybinding (which is supposed to be Ctrl+').
4. <personname> tags are now removed by the Word cleaner
Empty <personname> tags are sometimes produced by Word, and are a common cause for the symptoms of MDL-10657.