mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 12:07:19 +00:00
Add the ability to set classes on list elements
This commit is contained in:
parent
031e3b8b80
commit
da43887d7c
@ -24,7 +24,8 @@ exports.info = {
|
||||
editTemplateText: {byName: true, type: "text"},
|
||||
emptyMessage: {byName: true, type: "text"},
|
||||
listviewTiddler: {byName: true, type: "tiddler"},
|
||||
listview: {byName: true, type: "text"}
|
||||
listview: {byName: true, type: "text"},
|
||||
itemClass: {byName: true, type: "text"}
|
||||
}
|
||||
};
|
||||
|
||||
@ -110,13 +111,18 @@ Create a list element representing a given tiddler
|
||||
*/
|
||||
exports.createListElement = function(title) {
|
||||
var node = this.createListElementMacro(title),
|
||||
attributes = {"class": ["tw-list-element"]},
|
||||
eventHandler = {handleEvent: function(event) {
|
||||
// Add context information to the event
|
||||
event.navigateFromTitle = title;
|
||||
return true;
|
||||
}};
|
||||
node.execute(this.parents,this.tiddlerTitle);
|
||||
var listElement = $tw.Tree.Element(this.isBlock ? "div" : "span",{"class": ["tw-list-element"]},[node],{
|
||||
// Add any specified classes
|
||||
if(this.hasParameter("itemClass")) {
|
||||
attributes["class"].push(this.params["itemClass"]);
|
||||
}
|
||||
var listElement = $tw.Tree.Element(this.isBlock ? "div" : "span",attributes,[node],{
|
||||
events: ["tw-navigate","tw-EditTiddler","tw-SaveTiddler","tw-CloseTiddler","tw-NewTiddler"],
|
||||
eventHandler: eventHandler
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user