mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +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.shadows.addTiddlers(
|
||||||
$tw.wiki.deserializeTiddlers("(DOM)",document.getElementById("pluginModules"))
|
$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
|
// Load the main store tiddlers from the DOM
|
||||||
$tw.wiki.addTiddlers(
|
$tw.wiki.addTiddlers(
|
||||||
$tw.wiki.deserializeTiddlers("(DOM)",document.getElementById("storeArea"))
|
$tw.wiki.deserializeTiddlers("(DOM)",document.getElementById("storeArea"))
|
||||||
|
@ -21,6 +21,20 @@ exports["text/html"] = function(tiddler) {
|
|||||||
return text ? text : "";
|
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) {
|
exports["application/javascript"] = function(tiddler) {
|
||||||
var attributes = {type: "text/javascript"}; // The script type is set to text/javascript for compatibility with old browsers
|
var attributes = {type: "text/javascript"}; // The script type is set to text/javascript for compatibility with old browsers
|
||||||
for(var f in tiddler.fields) {
|
for(var f in tiddler.fields) {
|
||||||
|
@ -16,9 +16,9 @@ type: text/x-tiddlywiki-html
|
|||||||
" />
|
" />
|
||||||
<title><<tiddler target:$:/shadows/title>></title>
|
<title><<tiddler target:$:/shadows/title>></title>
|
||||||
<!----------- This is a Tiddlywiki file. The points of interest in the file are marked with this pattern ----------->
|
<!----------- 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>>
|
<<^"[is[shadowStyle]]" text/plain>>
|
||||||
</style>
|
</div>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<<^"PageTemplate" text/html>>
|
<<^"PageTemplate" text/html>>
|
||||||
|
@ -16,9 +16,9 @@ type: text/x-tiddlywiki-html
|
|||||||
" />
|
" />
|
||||||
<title><<tiddler target:$:/shadows/title>></title>
|
<title><<tiddler target:$:/shadows/title>></title>
|
||||||
<!----------- This is a Tiddlywiki file. The points of interest in the file are marked with this pattern ----------->
|
<!----------- 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>>
|
<<^"[is[shadowStyle]]" application/x-tiddler-css>>
|
||||||
</style>
|
</div>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!----------- Static content for Google and browsers without JavaScript ----------->
|
<!----------- Static content for Google and browsers without JavaScript ----------->
|
||||||
|
Loading…
Reference in New Issue
Block a user