Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-14999

Patch fixing various HTMLarea issues

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.6, 1.7, 1.8, 1.9
    • Fix Version/s: 1.8.6, 1.9.2
    • Component/s: HTML Editor (TinyMCE)
    • Labels:
      None
    • Affected Branches:
      MOODLE_16_STABLE, MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  11/Jul/08