mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 10:07:19 +00:00
Save and restore shadow stylesheets
This commit is contained in:
parent
6d0da350c7
commit
19deb60f8c
@ -506,6 +506,10 @@ $tw.plugins.applyMethods("tiddlerdeserializer",$tw.Wiki.tiddlerDeserializerPlugi
|
||||
$tw.wiki.shadows.addTiddlers(
|
||||
$tw.wiki.deserializeTiddlers("(DOM)",document.getElementById("pluginModules"))
|
||||
);
|
||||
// Load the stylesheet tiddlers from the DOM
|
||||
$tw.wiki.shadows.addTiddlers(
|
||||
$tw.wiki.deserializeTiddlers("(DOM)",document.getElementById("styleArea"))
|
||||
);
|
||||
// Load the main store tiddlers from the DOM
|
||||
$tw.wiki.addTiddlers(
|
||||
$tw.wiki.deserializeTiddlers("(DOM)",document.getElementById("storeArea"))
|
||||
|
@ -21,6 +21,20 @@ exports["text/html"] = function(tiddler) {
|
||||
return text ? text : "";
|
||||
};
|
||||
|
||||
exports["application/x-tiddler-css"] = function(tiddler) {
|
||||
var attributes = {type: "text/css"}; // The script type is set to text/javascript for compatibility with old browsers
|
||||
for(var f in tiddler.fields) {
|
||||
if(f !== "text") {
|
||||
attributes["data-tiddler-" + f] = tiddler.getFieldString(f);
|
||||
}
|
||||
}
|
||||
return $tw.Tree.Element(
|
||||
"style",
|
||||
attributes,
|
||||
[$tw.Tree.Raw(tiddler.fields.text)]
|
||||
).render("text/html");
|
||||
};
|
||||
|
||||
exports["application/javascript"] = function(tiddler) {
|
||||
var attributes = {type: "text/javascript"}; // The script type is set to text/javascript for compatibility with old browsers
|
||||
for(var f in tiddler.fields) {
|
||||
|
@ -16,9 +16,9 @@ type: text/x-tiddlywiki-html
|
||||
" />
|
||||
<title><<tiddler target:$:/shadows/title>></title>
|
||||
<!----------- This is a Tiddlywiki file. The points of interest in the file are marked with this pattern ----------->
|
||||
<style id="styleArea" type="text/css">
|
||||
<div id="styleArea">
|
||||
<<^"[is[shadowStyle]]" text/plain>>
|
||||
</style>
|
||||
</div>
|
||||
</head>
|
||||
<body>
|
||||
<<^"PageTemplate" text/html>>
|
||||
|
@ -16,9 +16,9 @@ type: text/x-tiddlywiki-html
|
||||
" />
|
||||
<title><<tiddler target:$:/shadows/title>></title>
|
||||
<!----------- This is a Tiddlywiki file. The points of interest in the file are marked with this pattern ----------->
|
||||
<style id="styleArea" type="text/css">
|
||||
<<^"[is[shadowStyle]]" text/plain>>
|
||||
</style>
|
||||
<div id="styleArea">
|
||||
<<^"[is[shadowStyle]]" application/x-tiddler-css>>
|
||||
</div>
|
||||
</head>
|
||||
<body>
|
||||
<!----------- Static content for Google and browsers without JavaScript ----------->
|
||||
|
Loading…
Reference in New Issue
Block a user