mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-19 00:04:51 +00:00
Revise startup display handling
And adjust the image parser registration
This commit is contained in:
parent
bd5de61156
commit
b32826f110
24
js/App.js
24
js/App.js
@ -15,8 +15,7 @@ var WikiStore = require("./WikiStore.js").WikiStore,
|
|||||||
tiddlerOutput = require("./TiddlerOutput.js"),
|
tiddlerOutput = require("./TiddlerOutput.js"),
|
||||||
WikiTextParser = require("./WikiTextParser.js").WikiTextParser,
|
WikiTextParser = require("./WikiTextParser.js").WikiTextParser,
|
||||||
JavaScriptParser = require("./JavaScriptParser.js").JavaScriptParser,
|
JavaScriptParser = require("./JavaScriptParser.js").JavaScriptParser,
|
||||||
SVGParser = require("./SVGParser.js").SVGParser,
|
ImageParser = require("./ImageParser.js").ImageParser,
|
||||||
BitmapParser = require("./BitmapParser.js").BitmapParser,
|
|
||||||
Navigators = require("./Navigators.js").Navigators,
|
Navigators = require("./Navigators.js").Navigators,
|
||||||
StoryNavigator = require("./StoryNavigator.js").StoryNavigator;
|
StoryNavigator = require("./StoryNavigator.js").StoryNavigator;
|
||||||
|
|
||||||
@ -30,12 +29,12 @@ var App = function() {
|
|||||||
this.store.registerParser("text/x-tiddlywiki",new WikiTextParser({
|
this.store.registerParser("text/x-tiddlywiki",new WikiTextParser({
|
||||||
store: this.store
|
store: this.store
|
||||||
}));
|
}));
|
||||||
this.store.registerParser("image/svg+xml",new SVGParser());
|
var imageParser = new ImageParser();
|
||||||
var bitmapParser = new BitmapParser();
|
this.store.registerParser("image/svg+xml",imageParser);
|
||||||
this.store.registerParser("image/jpg",bitmapParser);
|
this.store.registerParser("image/jpg",imageParser);
|
||||||
this.store.registerParser("image/jpeg",bitmapParser);
|
this.store.registerParser("image/jpeg",imageParser);
|
||||||
this.store.registerParser("image/png",bitmapParser);
|
this.store.registerParser("image/png",imageParser);
|
||||||
this.store.registerParser("image/gif",bitmapParser);
|
this.store.registerParser("image/gif",imageParser);
|
||||||
// Register the standard tiddler serializers and deserializers
|
// Register the standard tiddler serializers and deserializers
|
||||||
tiddlerInput.register(this.store);
|
tiddlerInput.register(this.store);
|
||||||
tiddlerOutput.register(this.store);
|
tiddlerOutput.register(this.store);
|
||||||
@ -110,8 +109,14 @@ var App = function() {
|
|||||||
navigators.install("a","StoryNavigator");
|
navigators.install("a","StoryNavigator");
|
||||||
// Open the PageTemplate
|
// Open the PageTemplate
|
||||||
var div = document.createElement("div");
|
var div = document.createElement("div");
|
||||||
div.innerHTML = this.store.renderTiddler("text/html","PageTemplate");
|
div.innerHTML = this.store.renderMacro("tiddler",
|
||||||
|
"text/html",
|
||||||
|
this.store.getTiddler("PageTemplate"),
|
||||||
|
{
|
||||||
|
target: "PageTemplate"
|
||||||
|
});
|
||||||
document.body.appendChild(div);
|
document.body.appendChild(div);
|
||||||
|
// Set up a timer to change the value of a tiddler
|
||||||
var me = this;
|
var me = this;
|
||||||
window.setInterval(function() {
|
window.setInterval(function() {
|
||||||
me.store.addTiddler(new Tiddler({
|
me.store.addTiddler(new Tiddler({
|
||||||
@ -119,6 +124,7 @@ var App = function() {
|
|||||||
text: "This is a newly created tiddler!"
|
text: "This is a newly created tiddler!"
|
||||||
}));
|
}));
|
||||||
},3000);
|
},3000);
|
||||||
|
// Register an event handler to handle refreshing the DOM
|
||||||
this.store.addEventListener("",function() {
|
this.store.addEventListener("",function() {
|
||||||
me.store.refreshDomNode(div,me.store.getTiddler("PageTemplate"));
|
me.store.refreshDomNode(div,me.store.getTiddler("PageTemplate"));
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user