mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-14 05:44:50 +00:00
050b643948
Otherwise Firefox allows code in html tiddlers to access the main window: https://groups.google.com/d/topic/tiddlywiki/NwOI-QER2ig/discussion
36 lines
654 B
JavaScript
36 lines
654 B
JavaScript
/*\
|
|
title: $:/core/modules/parsers/htmlparser.js
|
|
type: application/javascript
|
|
module-type: parser
|
|
|
|
The HTML parser displays text as raw HTML
|
|
|
|
\*/
|
|
(function(){
|
|
|
|
/*jslint node: true, browser: true */
|
|
/*global $tw: false */
|
|
"use strict";
|
|
|
|
var HtmlParser = function(type,text,options) {
|
|
var src;
|
|
if(options._canonical_uri) {
|
|
src = options._canonical_uri;
|
|
} else if(text) {
|
|
src = "data:text/html;charset=utf-8," + encodeURIComponent(text);
|
|
}
|
|
this.tree = [{
|
|
type: "element",
|
|
tag: "iframe",
|
|
attributes: {
|
|
src: {type: "string", value: src},
|
|
sandbox: {type: "string", value: "sandbox"}
|
|
}
|
|
}];
|
|
};
|
|
|
|
exports["text/html"] = HtmlParser;
|
|
|
|
})();
|
|
|