6174 / 6174/pagedown

Sanitizer fails to find Markdown in certain requirejs environments

Ouverte
#49 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
auto-migrated Priority-Medium Type-Defect
Langage dominant
JavaScript
Étoiles
0
Forks
0
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

```
When building a bundle using some requireje-based tools each file is loaded in
a separate closure, with the result that Markdown.Convertor creates a Markdown
in a different scope than window and Markdown.Sanitizer then fails to find it.
This can be fixed by modifying the converter to explicitly create
window.Markdown as well:

diff --git a/src/3rdparty/pagedown/Markdown.Converter.js
b/src/3rdparty/pagedown/Markdown.Converter.js
index 58fc54a..8c1a909 100755
--- a/src/3rdparty/pagedown/Markdown.Converter.js
+++ b/src/3rdparty/pagedown/Markdown.Converter.js
@@ -3,7 +3,7 @@ var Markdown;
if (typeof exports === "object" && typeof require === "function") // we're in a CommonJS (e.g. Node.js) module
Markdown = exports;
else
- Markdown = {};
+ Markdown = window.Markdown = {};

// The following text is included for historical reasons, but should
// be taken with a pinch of salt; it's not all true anymore.

```

Original issue reported on code.google.com by `wich...@outlook.com` on 4 Jan 2013 at 3:41

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.