cqqqh / pagedown

Automatically exported from code.google.com/p/pagedown
Other
0 stars 0 forks source link

Failure with multiple editors. Each instantiation overwrites the previous one. #62

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Example:

  var makeEditor = function(id) {
    var converter = Markdown.getSanitizingConverter();
    selectors = {
        input : id,
        button : id+"_wmd_button_bar",
        preview : id+"_wmd_preview",
    }
    return new Markdown.Editor(converter, "", selectors);
  };
  var editor1 = makeEditor('#textarea_a');
  var editor2 = makeEditor('#textarea_b');
  editor1.run();
  editor2.run();

This causes the editor to be placed twice on the second field, while ignoring 
the first one. The problem is an issue of scope. The variables for the 
selectors are not tied to the editor instances, but rather the function itself, 
causing each instantiation to overwrite the previous one.

Original issue reported on code.google.com by bendavi...@gmail.com on 25 Jul 2013 at 3:09

GoogleCodeExporter commented 9 years ago
My apologies, please close this issue. I was unaware that I was using a fork of 
the project which is what produces the bug.

Original comment by bendavi...@gmail.com on 25 Jul 2013 at 3:27

GoogleCodeExporter commented 9 years ago

Original comment by b...@stackoverflow.com on 11 Apr 2014 at 9:23