kopia lustrzana https://github.com/miklobit/TiddlyWiki5
Update HTML parser to use an IFRAME
Gives us better sandboxing of unsafe HTML contentprint-window-tiddler
rodzic
d2796d0c9c
commit
f131c37893
|
@ -13,9 +13,18 @@ The HTML parser displays text as raw HTML
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var HtmlParser = function(type,text,options) {
|
var HtmlParser = function(type,text,options) {
|
||||||
|
var src;
|
||||||
|
if(options._canonical_uri) {
|
||||||
|
src = options._canonical_uri;
|
||||||
|
} else if(text) {
|
||||||
|
src = "data:text/html," + encodeURIComponent(text);
|
||||||
|
}
|
||||||
this.tree = [{
|
this.tree = [{
|
||||||
type: "raw",
|
type: "element",
|
||||||
html: text
|
tag: "iframe",
|
||||||
|
attributes: {
|
||||||
|
src: {type: "string", value: src}
|
||||||
|
}
|
||||||
}];
|
}];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -117,11 +117,16 @@ table tfoot tr td {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tw-tiddler-frame img, .tw-tiddler-frame svg, .tw-tiddler-frame canvas, .tw-tiddler-frame embed {
|
.tw-tiddler-frame img,
|
||||||
|
.tw-tiddler-frame svg,
|
||||||
|
.tw-tiddler-frame canvas,
|
||||||
|
.tw-tiddler-frame embed,
|
||||||
|
.tw-tiddler-frame iframe {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tw-tiddler-frame embed {
|
.tw-tiddler-frame embed,
|
||||||
|
.tw-tiddler-frame iframe {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 600px;
|
height: 600px;
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue