1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-30 13:29:56 +00:00

Normalise custom event names

This commit is contained in:
Jeremy Ruston 2013-02-04 15:29:25 +00:00
parent 1f98ea5c87
commit 170c1425f7
6 changed files with 15 additions and 19 deletions

View File

@ -99,7 +99,7 @@ Modal.prototype.display = function(title,options) {
if(tiddler && tiddler.fields && tiddler.fields.footer) { if(tiddler && tiddler.fields && tiddler.fields.footer) {
footerText = tiddler.fields.footer; footerText = tiddler.fields.footer;
} else { } else {
footerText = '<$button message="tw-close" class="btn btn-primary">Close</$button>'; footerText = '<$button message="tw-close-tiddler" class="btn btn-primary">Close</$button>';
} }
var footerParser = this.wiki.parseText("text/vnd.tiddlywiki-run",footerText), var footerParser = this.wiki.parseText("text/vnd.tiddlywiki-run",footerText),
footerRenderTree = new $tw.WikiRenderTree(footerParser,{wiki: $tw.wiki}); footerRenderTree = new $tw.WikiRenderTree(footerParser,{wiki: $tw.wiki});
@ -109,7 +109,7 @@ Modal.prototype.display = function(title,options) {
footerRenderTree.refreshInDom(changes); footerRenderTree.refreshInDom(changes);
}); });
// Add the close event handler // Add the close event handler
wrapper.addEventListener("tw-close",function(event) { wrapper.addEventListener("tw-close-tiddler",function(event) {
// Force layout and animate the modal message away // Force layout and animate the modal message away
$tw.utils.forceLayout(modalBackdrop); $tw.utils.forceLayout(modalBackdrop);
$tw.utils.forceLayout(modalWrapper); $tw.utils.forceLayout(modalWrapper);
@ -126,7 +126,7 @@ Modal.prototype.display = function(title,options) {
document.body.removeChild(wrapper); document.body.removeChild(wrapper);
} }
},false); },false);
// Don't let anyone else handle the tw-close message // Don't let anyone else handle the tw-close-tiddler message
event.stopPropagation(); event.stopPropagation();
return false; return false;
},false); },false);

View File

@ -110,10 +110,10 @@ ListWidget.prototype.createListElement = function(title) {
children: [this.createListElementMacro(title)], children: [this.createListElementMacro(title)],
events: [ events: [
{name: "tw-navigate", handlerFunction: handleEvent}, {name: "tw-navigate", handlerFunction: handleEvent},
{name: "tw-EditTiddler", handlerFunction: handleEvent}, {name: "tw-edit-tiddler", handlerFunction: handleEvent},
{name: "tw-SaveTiddler", handlerFunction: handleEvent}, {name: "tw-save-tiddler", handlerFunction: handleEvent},
{name: "tw-CloseTiddler", handlerFunction: handleEvent}, {name: "tw-close-tiddler", handlerFunction: handleEvent},
{name: "tw-NewTiddler", handlerFunction: handleEvent} {name: "tw-new-tiddler", handlerFunction: handleEvent}
] ]
}; };
}; };

View File

@ -31,10 +31,10 @@ NavigatorWidget.prototype.generate = function() {
this.children = this.renderer.renderTree.createRenderers(this.renderer.renderContext,this.renderer.parseTreeNode.children); this.children = this.renderer.renderTree.createRenderers(this.renderer.renderContext,this.renderer.parseTreeNode.children);
this.events = [ this.events = [
{name: "tw-navigate", handlerObject: this, handlerMethod: "handleNavigateEvent"}, {name: "tw-navigate", handlerObject: this, handlerMethod: "handleNavigateEvent"},
{name: "tw-EditTiddler", handlerObject: this, handlerMethod: "handleEditTiddlerEvent"}, {name: "tw-edit-tiddler", handlerObject: this, handlerMethod: "handleEditTiddlerEvent"},
{name: "tw-SaveTiddler", handlerObject: this, handlerMethod: "handleSaveTiddlerEvent"}, {name: "tw-save-tiddler", handlerObject: this, handlerMethod: "handleSaveTiddlerEvent"},
{name: "tw-close", handlerObject: this, handlerMethod: "handleCloseTiddlerEvent"}, {name: "tw-close-tiddler", handlerObject: this, handlerMethod: "handleCloseTiddlerEvent"},
{name: "tw-NewTiddler", handlerObject: this, handlerMethod: "handleNewTiddlerEvent"} {name: "tw-new-tiddler", handlerObject: this, handlerMethod: "handleNewTiddlerEvent"}
]; ];
}; };

View File

@ -1,9 +1,7 @@
title: $:/templates/EditTemplate title: $:/templates/EditTemplate
modifier: JeremyRuston modifier: JeremyRuston
<div class="tw-tiddler-frame"> <$view field="title"/> <$button message="tw-save-tiddler" class="btn btn-mini btn-success">done</$button>
<$view field="title"/> <$button message="tw-SaveTiddler" class="btn btn-mini btn-success">done</$button>
@@.title @@.title
<$edit field="draft.title"/> <$edit field="draft.title"/>
@ -14,5 +12,3 @@ modifier: JeremyRuston
@@.body @@.body
<$edit field="text"/> <$edit field="text"/>
@@ @@
</div>

View File

@ -13,7 +13,7 @@ title: $:/templates/PageTemplate
<$list filter="[list[$:/StoryList]]" history="$:/HistoryList" listview=classic itemClass="tw-menu-list-item"/> <$list filter="[list[$:/StoryList]]" history="$:/HistoryList" listview=classic itemClass="tw-menu-list-item"/>
<div class="edit-controls"> <div class="edit-controls">
<$button message="tw-NewTiddler" class="btn btn-mini btn-success">New</$button> <$button message="tw-new-tiddler" class="btn btn-mini btn-success">New</$button>
<$button message="tw-save-wiki" class="btn btn-mini btn-primary">Save</$button> <$button message="tw-save-wiki" class="btn btn-mini btn-primary">Save</$button>
</div> </div>

View File

@ -2,8 +2,8 @@ title: $:/templates/ViewTemplate
modifier: JeremyRuston modifier: JeremyRuston
<span class="tw-tiddler-controls"> <span class="tw-tiddler-controls">
<$button message="tw-close" class="btn-invisible">{{$:/core/images/close-button.svg}}</$button> <$button message="tw-close-tiddler" class="btn-invisible">{{$:/core/images/close-button.svg}}</$button>
<$button message="tw-EditTiddler" class="btn-invisible">{{$:/core/images/edit-button.svg}}</$button> <$button message="tw-edit-tiddler" class="btn-invisible">{{$:/core/images/edit-button.svg}}</$button>
</span> </span>
<span class="title"> <span class="title">
<$view field="title"/> <$view field="title"/>