Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-11275

editor.js::colorPalette() breaks page with document.write > add proper target

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.1.0-a1
    • 3.0.11, 3.1.0-dev
    • Styles
    • None

      The current (3.0.11) function colorPalette(dir, width, height) in /styles/prosilver/template/editor.js uses document.write to directly write to the browser output. In this current state it is impossible to call this function from outside its target-environment or with another javascript. The document.write will cause the entire page to be overwritten.

      I'm proposing the usage of a variable to store the output while its being composed rather than writing it directly to the browser, the addition of an optional target argument and then the fallback to document.write if no target is present.

      I have attached how the new colorPallete() could look like, the +"\n" are optional, but replaces the old "writeln".

      This modification is fully backwards compatible and will not break any current implementation.

            EXreaction EXreaction [X] (Inactive)
            vindex vindex [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: