41 changes: 36 additions & 5 deletions core/modules/widgets/checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,21 @@ CheckboxWidget.prototype.getValue = function() {
}
}
if(this.checkboxField) {
var value = tiddler.fields[this.checkboxField] || this.checkboxDefault || "";
var value;
if($tw.utils.hop(tiddler.fields,this.checkboxField)) {
value = tiddler.fields[this.checkboxField] || "";
} else {
value = this.checkboxDefault || "";
}
if(value === this.checkboxChecked) {
return true;
}
if(value === this.checkboxUnchecked) {
return false;
}
}
if(this.checkboxIndex) {
var value = this.wiki.extractTiddlerDataItem(tiddler,this.checkboxIndex,this.checkboxDefault || "");
if(value === this.checkboxChecked) {
return true;
}
Expand Down Expand Up @@ -96,7 +110,8 @@ CheckboxWidget.prototype.handleChangeEvent = function(event) {
newFields = {title: this.checkboxTitle},
hasChanged = false,
tagCheck = false,
hasTag = tiddler && tiddler.hasTag(this.checkboxTag);
hasTag = tiddler && tiddler.hasTag(this.checkboxTag),
value = checked ? this.checkboxChecked : this.checkboxUnchecked;
if(this.checkboxTag && this.checkboxInvertTag === "yes") {
tagCheck = hasTag === checked;
} else {
Expand All @@ -118,14 +133,28 @@ CheckboxWidget.prototype.handleChangeEvent = function(event) {
}
// Set the field if specified
if(this.checkboxField) {
var value = checked ? this.checkboxChecked : this.checkboxUnchecked;
if(!tiddler || tiddler.fields[this.checkboxField] !== value) {
newFields[this.checkboxField] = value;
hasChanged = true;
}
}
// Set the index if specified
if(this.checkboxIndex) {
var indexValue = this.wiki.extractTiddlerDataItem(this.checkboxTitle,this.checkboxIndex);
if(!tiddler || indexValue !== value) {
hasChanged = true;
}
}
if(hasChanged) {
this.wiki.addTiddler(new $tw.Tiddler(this.wiki.getCreationFields(),fallbackFields,tiddler,newFields,this.wiki.getModificationFields()));
if(this.checkboxIndex) {
this.wiki.setText(this.checkboxTitle,"",this.checkboxIndex,value);
} else {
this.wiki.addTiddler(new $tw.Tiddler(this.wiki.getCreationFields(),fallbackFields,tiddler,newFields,this.wiki.getModificationFields()));
}
}
// Trigger actions
if(this.checkboxActions) {
this.invokeActionString(this.checkboxActions,this,event);
}
};

Expand All @@ -134,9 +163,11 @@ Compute the internal state of the widget
*/
CheckboxWidget.prototype.execute = function() {
// Get the parameters from the attributes
this.checkboxActions = this.getAttribute("actions");
this.checkboxTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler"));
this.checkboxTag = this.getAttribute("tag");
this.checkboxField = this.getAttribute("field");
this.checkboxIndex = this.getAttribute("index");
this.checkboxChecked = this.getAttribute("checked");
this.checkboxUnchecked = this.getAttribute("unchecked");
this.checkboxDefault = this.getAttribute("default");
Expand All @@ -151,7 +182,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
*/
CheckboxWidget.prototype.refresh = function(changedTiddlers) {
var changedAttributes = this.computeAttributes();
if(changedAttributes.tiddler || changedAttributes.tag || changedAttributes.invertTag || changedAttributes.field || changedAttributes.checked || changedAttributes.unchecked || changedAttributes["default"] || changedAttributes["class"]) {
if(changedAttributes.tiddler || changedAttributes.tag || changedAttributes.invertTag || changedAttributes.field || changedAttributes.index || changedAttributes.checked || changedAttributes.unchecked || changedAttributes["default"] || changedAttributes["class"]) {
this.refreshSelf();
return true;
} else {
Expand Down
88 changes: 88 additions & 0 deletions core/modules/widgets/draggable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*\
title: $:/core/modules/widgets/draggable.js
type: application/javascript
module-type: widget
Draggable widget
\*/
(function(){

/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";

var Widget = require("$:/core/modules/widgets/widget.js").widget;

var DraggableWidget = function(parseTreeNode,options) {
this.initialise(parseTreeNode,options);
};

/*
Inherit from the base widget class
*/
DraggableWidget.prototype = new Widget();

/*
Render this widget into the DOM
*/
DraggableWidget.prototype.render = function(parent,nextSibling) {
var self = this;
// Save the parent dom node
this.parentDomNode = parent;
// Compute our attributes
this.computeAttributes();
// Execute our logic
this.execute();
// Sanitise the specified tag
var tag = this.draggableTag;
if($tw.config.htmlUnsafeElements.indexOf(tag) !== -1) {
tag = "div";
}
// Create our element
var domNode = this.document.createElement(tag);
// Assign classes
var classes = ["tc-draggable"];
if(this.draggableClasses) {
classes.push(this.draggableClasses);
}
domNode.setAttribute("class",classes.join(" "));
// Add event handlers
$tw.utils.makeDraggable({
domNode: domNode,
dragTiddlerFn: function() {return self.getAttribute("tiddler");},
dragFilterFn: function() {return self.getAttribute("filter");},
widget: this
});
// Insert the link into the DOM and render any children
parent.insertBefore(domNode,nextSibling);
this.renderChildren(domNode,null);
this.domNodes.push(domNode);
};

/*
Compute the internal state of the widget
*/
DraggableWidget.prototype.execute = function() {
// Pick up our attributes
this.draggableTag = this.getAttribute("tag","div");
this.draggableClasses = this.getAttribute("class");
// Make the child widgets
this.makeChildWidgets();
};

/*
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
*/
DraggableWidget.prototype.refresh = function(changedTiddlers) {
var changedAttributes = this.computeAttributes();
if(changedTiddlers.tag || changedTiddlers["class"]) {
this.refreshSelf();
return true;
}
return this.refreshChildren(changedTiddlers);
};

exports.draggable = DraggableWidget;

})();
161 changes: 161 additions & 0 deletions core/modules/widgets/droppable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
/*\
title: $:/core/modules/widgets/droppable.js
type: application/javascript
module-type: widget
Droppable widget
\*/
(function(){

/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";

var Widget = require("$:/core/modules/widgets/widget.js").widget;

var DroppableWidget = function(parseTreeNode,options) {
this.initialise(parseTreeNode,options);
};

/*
Inherit from the base widget class
*/
DroppableWidget.prototype = new Widget();

/*
Render this widget into the DOM
*/
DroppableWidget.prototype.render = function(parent,nextSibling) {
var self = this;
// Remember parent
this.parentDomNode = parent;
// Compute attributes and execute state
this.computeAttributes();
this.execute();
var tag = this.parseTreeNode.isBlock ? "div" : "span";
if(this.droppableTag && $tw.config.htmlUnsafeElements.indexOf(this.droppableTag) === -1) {
tag = this.droppableTag;
}
// Create element and assign classes
var domNode = this.document.createElement(tag),
classes = (this["class"] || "").split(" ");
classes.push("tc-droppable");
domNode.className = classes.join(" ");
// Add event handlers
$tw.utils.addEventListeners(domNode,[
{name: "dragenter", handlerObject: this, handlerMethod: "handleDragEnterEvent"},
{name: "dragover", handlerObject: this, handlerMethod: "handleDragOverEvent"},
{name: "dragleave", handlerObject: this, handlerMethod: "handleDragLeaveEvent"},
{name: "drop", handlerObject: this, handlerMethod: "handleDropEvent"}
]);
// Insert element
parent.insertBefore(domNode,nextSibling);
this.renderChildren(domNode,null);
this.domNodes.push(domNode);
// Stack of outstanding enter/leave events
this.currentlyEntered = [];
};

DroppableWidget.prototype.enterDrag = function(event) {
if(this.currentlyEntered.indexOf(event.target) === -1) {
this.currentlyEntered.push(event.target);
}
// If we're entering for the first time we need to apply highlighting
$tw.utils.addClass(this.domNodes[0],"tc-dragover");
};

DroppableWidget.prototype.leaveDrag = function(event) {
var pos = this.currentlyEntered.indexOf(event.target);
if(pos !== -1) {
this.currentlyEntered.splice(pos,1);
}
// Remove highlighting if we're leaving externally. The hacky second condition is to resolve a problem with Firefox whereby there is an erroneous dragenter event if the node being dragged is within the dropzone
if(this.currentlyEntered.length === 0 || (this.currentlyEntered.length === 1 && this.currentlyEntered[0] === $tw.dragInProgress)) {
this.currentlyEntered = [];
$tw.utils.removeClass(this.domNodes[0],"tc-dragover");
}
};

DroppableWidget.prototype.handleDragEnterEvent = function(event) {
this.enterDrag(event);
// Tell the browser that we're ready to handle the drop
event.preventDefault();
// Tell the browser not to ripple the drag up to any parent drop handlers
event.stopPropagation();
return false;
};

DroppableWidget.prototype.handleDragOverEvent = function(event) {
// Check for being over a TEXTAREA or INPUT
if(["TEXTAREA","INPUT"].indexOf(event.target.tagName) !== -1) {
return false;
}
// Tell the browser that we're still interested in the drop
event.preventDefault();
// Set the drop effect
event.dataTransfer.dropEffect = this.droppableEffect;
return false;
};

DroppableWidget.prototype.handleDragLeaveEvent = function(event) {
this.leaveDrag(event);
return false;
};

DroppableWidget.prototype.handleDropEvent = function(event) {
var self = this;
this.leaveDrag(event);
// Check for being over a TEXTAREA or INPUT
if(["TEXTAREA","INPUT"].indexOf(event.target.tagName) !== -1) {
return false;
}
var dataTransfer = event.dataTransfer;
// Remove highlighting
$tw.utils.removeClass(this.domNodes[0],"tc-dragover");
// Try to import the various data types we understand
$tw.utils.importDataTransfer(dataTransfer,null,function(fieldsArray) {
fieldsArray.forEach(function(fields) {
self.performActions(fields.title || fields.text,event);
});
});
// Tell the browser that we handled the drop
event.preventDefault();
// Stop the drop ripple up to any parent handlers
event.stopPropagation();
return false;
};

DroppableWidget.prototype.performActions = function(title,event) {
if(this.droppableActions) {
this.invokeActionString(this.droppableActions,this,event,{actionTiddler: title});
}
};

/*
Compute the internal state of the widget
*/
DroppableWidget.prototype.execute = function() {
this.droppableActions = this.getAttribute("actions");
this.droppableEffect = this.getAttribute("effect","copy");
this.droppableTag = this.getAttribute("tag");
this.droppableClass = this.getAttribute("class");
// Make child widgets
this.makeChildWidgets();
};

/*
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
*/
DroppableWidget.prototype.refresh = function(changedTiddlers) {
var changedAttributes = this.computeAttributes();
if(changedAttributes["class"] || changedAttributes.tag) {
this.refreshSelf();
return true;
}
return this.refreshChildren(changedTiddlers);
};

exports.droppable = DroppableWidget;

})();
122 changes: 29 additions & 93 deletions core/modules/widgets/dropzone.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,32 +50,35 @@ DropZoneWidget.prototype.render = function(parent,nextSibling) {
parent.insertBefore(domNode,nextSibling);
this.renderChildren(domNode,null);
this.domNodes.push(domNode);
// Stack of outstanding enter/leave events
this.currentlyEntered = [];
};

DropZoneWidget.prototype.enterDrag = function() {
// Check for this window being the source of the drag
if($tw.dragInProgress) {
return false;
DropZoneWidget.prototype.enterDrag = function(event) {
if(this.currentlyEntered.indexOf(event.target) === -1) {
this.currentlyEntered.push(event.target);
}
// We count enter/leave events
this.dragEnterCount = (this.dragEnterCount || 0) + 1;
// If we're entering for the first time we need to apply highlighting
if(this.dragEnterCount === 1) {
$tw.utils.addClass(this.domNodes[0],"tc-dragover");
}
$tw.utils.addClass(this.domNodes[0],"tc-dragover");
};

DropZoneWidget.prototype.leaveDrag = function() {
// Reduce the enter count
this.dragEnterCount = (this.dragEnterCount || 0) - 1;
DropZoneWidget.prototype.leaveDrag = function(event) {
var pos = this.currentlyEntered.indexOf(event.target);
if(pos !== -1) {
this.currentlyEntered.splice(pos,1);
}
// Remove highlighting if we're leaving externally
if(this.dragEnterCount <= 0) {
if(this.currentlyEntered.length === 0) {
$tw.utils.removeClass(this.domNodes[0],"tc-dragover");
}
};

DropZoneWidget.prototype.handleDragEnterEvent = function(event) {
this.enterDrag();
// Check for this window being the source of the drag
if($tw.dragInProgress) {
return false;
}
this.enterDrag(event);
// Tell the browser that we're ready to handle the drop
event.preventDefault();
// Tell the browser not to ripple the drag up to any parent drop handlers
Expand All @@ -97,11 +100,12 @@ DropZoneWidget.prototype.handleDragOverEvent = function(event) {
};

DropZoneWidget.prototype.handleDragLeaveEvent = function(event) {
this.leaveDrag();
this.leaveDrag(event);
};

DropZoneWidget.prototype.handleDropEvent = function(event) {
this.leaveDrag();
var self = this;
this.leaveDrag(event);
// Check for being over a TEXTAREA or INPUT
if(["TEXTAREA","INPUT"].indexOf(event.target.tagName) !== -1) {
return false;
Expand All @@ -112,95 +116,27 @@ DropZoneWidget.prototype.handleDropEvent = function(event) {
}
var self = this,
dataTransfer = event.dataTransfer;
// Reset the enter count
this.dragEnterCount = 0;
// Remove highlighting
$tw.utils.removeClass(this.domNodes[0],"tc-dragover");
// Import any files in the drop
var numFiles = this.wiki.readFiles(dataTransfer.files,function(tiddlerFieldsArray) {
self.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray)});
});
var numFiles = 0;
if(dataTransfer.files) {
numFiles = this.wiki.readFiles(dataTransfer.files,function(tiddlerFieldsArray) {
self.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray)});
});
}
// Try to import the various data types we understand
if(numFiles === 0) {
this.importData(dataTransfer);
$tw.utils.importDataTransfer(dataTransfer,this.wiki.generateNewTitle("Untitled"),function(fieldsArray) {
self.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify(fieldsArray)});
});
}
// Tell the browser that we handled the drop
event.preventDefault();
// Stop the drop ripple up to any parent handlers
event.stopPropagation();
};

DropZoneWidget.prototype.importData = function(dataTransfer) {
// Try each provided data type in turn
for(var t=0; t<this.importDataTypes.length; t++) {
if(!$tw.browser.isIE || this.importDataTypes[t].IECompatible) {
// Get the data
var dataType = this.importDataTypes[t];
var data = dataTransfer.getData(dataType.type);
// Import the tiddlers in the data
if(data !== "" && data !== null) {
if($tw.log.IMPORT) {
console.log("Importing data type '" + dataType.type + "', data: '" + data + "'")
}
var tiddlerFields = dataType.convertToFields(data);
if(!tiddlerFields.title) {
tiddlerFields.title = this.wiki.generateNewTitle("Untitled");
}
this.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify([tiddlerFields])});
return;
}
}
}
};

DropZoneWidget.prototype.importDataTypes = [
{type: "text/vnd.tiddler", IECompatible: false, convertToFields: function(data) {
return JSON.parse(data);
}},
{type: "URL", IECompatible: true, convertToFields: function(data) {
// Check for tiddler data URI
var match = decodeURIComponent(data).match(/^data\:text\/vnd\.tiddler,(.*)/i);
if(match) {
return JSON.parse(match[1]);
} else {
return { // As URL string
text: data
};
}
}},
{type: "text/x-moz-url", IECompatible: false, convertToFields: function(data) {
// Check for tiddler data URI
var match = decodeURIComponent(data).match(/^data\:text\/vnd\.tiddler,(.*)/i);
if(match) {
return JSON.parse(match[1]);
} else {
return { // As URL string
text: data
};
}
}},
{type: "text/html", IECompatible: false, convertToFields: function(data) {
return {
text: data
};
}},
{type: "text/plain", IECompatible: false, convertToFields: function(data) {
return {
text: data
};
}},
{type: "Text", IECompatible: true, convertToFields: function(data) {
return {
text: data
};
}},
{type: "text/uri-list", IECompatible: false, convertToFields: function(data) {
return {
text: data
};
}}
];

DropZoneWidget.prototype.handlePasteEvent = function(event) {
// Let the browser handle it if we're in a textarea or input box
if(["TEXTAREA","INPUT"].indexOf(event.target.tagName) == -1) {
Expand Down
6 changes: 3 additions & 3 deletions core/modules/widgets/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ FieldsWidget.prototype.execute = function() {
value = reMatch[1];
}
}
row = row.replace("$name$",fieldName);
row = row.replace("$value$",value);
row = row.replace("$encoded_value$",$tw.utils.htmlEncode(value));
row = $tw.utils.replaceString(row,"$name$",fieldName);
row = $tw.utils.replaceString(row,"$value$",value);
row = $tw.utils.replaceString(row,"$encoded_value$",$tw.utils.htmlEncode(value));
text.push(row);
}
}
Expand Down
9 changes: 7 additions & 2 deletions core/modules/widgets/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ KeyboardWidget.prototype.render = function(parent,nextSibling) {
// Compute attributes and execute state
this.computeAttributes();
this.execute();
var tag = this.parseTreeNode.isBlock ? "div" : "span";
if(this.tag && $tw.config.htmlUnsafeElements.indexOf(this.tag) === -1) {
tag = this.tag;
}
// Create element
var domNode = this.document.createElement("div");
var domNode = this.document.createElement(tag);
// Assign classes
var classes = (this["class"] || "").split(" ");
classes.push("tc-keyboard");
Expand Down Expand Up @@ -72,6 +76,7 @@ KeyboardWidget.prototype.execute = function() {
this.message = this.getAttribute("message");
this.param = this.getAttribute("param");
this.key = this.getAttribute("key");
this.tag = this.getAttribute("tag");
this.keyInfoArray = $tw.keyboardManager.parseKeyDescriptors(this.key);
this["class"] = this.getAttribute("class");
// Make child widgets
Expand All @@ -83,7 +88,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
*/
KeyboardWidget.prototype.refresh = function(changedTiddlers) {
var changedAttributes = this.computeAttributes();
if(changedAttributes.message || changedAttributes.param || changedAttributes.key || changedAttributes["class"]) {
if(changedAttributes.message || changedAttributes.param || changedAttributes.key || changedAttributes["class"] || changedAttributes.tag) {
this.refreshSelf();
return true;
}
Expand Down
75 changes: 8 additions & 67 deletions core/modules/widgets/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ LinkWidget.prototype.renderLink = function(parent,nextSibling) {
// Set an href
var wikiLinkTemplateMacro = this.getVariable("tv-wikilink-template"),
wikiLinkTemplate = wikiLinkTemplateMacro ? wikiLinkTemplateMacro.trim() : "#$uri_encoded$",
wikiLinkText = wikiLinkTemplate.replace("$uri_encoded$",encodeURIComponent(this.to));
wikiLinkText = wikiLinkText.replace("$uri_doubleencoded$",encodeURIComponent(encodeURIComponent(this.to)));
wikiLinkText = $tw.utils.replaceString(wikiLinkTemplate,"$uri_encoded$",encodeURIComponent(this.to));
wikiLinkText = $tw.utils.replaceString(wikiLinkText,"$uri_doubleencoded$",encodeURIComponent(encodeURIComponent(this.to)));
wikiLinkText = this.getVariable("tv-get-export-link",{params: [{name: "to",value: this.to}],defaultValue: wikiLinkText});
if(tag === "a") {
domNode.setAttribute("href",wikiLinkText);
Expand Down Expand Up @@ -111,11 +111,13 @@ LinkWidget.prototype.renderLink = function(parent,nextSibling) {
$tw.utils.addEventListeners(domNode,[
{name: "click", handlerObject: this, handlerMethod: "handleClickEvent"},
]);
// Make the link draggable if required
if(this.draggable === "yes") {
$tw.utils.addEventListeners(domNode,[
{name: "dragstart", handlerObject: this, handlerMethod: "handleDragStartEvent"},
{name: "dragend", handlerObject: this, handlerMethod: "handleDragEndEvent"}
]);
$tw.utils.makeDraggable({
domNode: domNode,
dragTiddlerFn: function() {return self.to;},
widget: this
});
}
// Insert the link into the DOM and render any children
parent.insertBefore(domNode,nextSibling);
Expand All @@ -142,67 +144,6 @@ LinkWidget.prototype.handleClickEvent = function(event) {
return false;
};

LinkWidget.prototype.handleDragStartEvent = function(event) {
if(event.target === this.domNodes[0]) {
if(this.to) {
$tw.dragInProgress = true;
// Set the dragging class on the element being dragged
$tw.utils.addClass(event.target,"tc-tiddlylink-dragging");
// Create the drag image elements
this.dragImage = this.document.createElement("div");
this.dragImage.className = "tc-tiddler-dragger";
var inner = this.document.createElement("div");
inner.className = "tc-tiddler-dragger-inner";
inner.appendChild(this.document.createTextNode(this.to));
this.dragImage.appendChild(inner);
this.document.body.appendChild(this.dragImage);
// Astoundingly, we need to cover the dragger up: http://www.kryogenix.org/code/browser/custom-drag-image.html
var cover = this.document.createElement("div");
cover.className = "tc-tiddler-dragger-cover";
cover.style.left = (inner.offsetLeft - 16) + "px";
cover.style.top = (inner.offsetTop - 16) + "px";
cover.style.width = (inner.offsetWidth + 32) + "px";
cover.style.height = (inner.offsetHeight + 32) + "px";
this.dragImage.appendChild(cover);
// Set the data transfer properties
var dataTransfer = event.dataTransfer;
// First the image
dataTransfer.effectAllowed = "copy";
if(dataTransfer.setDragImage) {
dataTransfer.setDragImage(this.dragImage.firstChild,-16,-16);
}
// Then the data
dataTransfer.clearData();
var jsonData = this.wiki.getTiddlerAsJson(this.to),
textData = this.wiki.getTiddlerText(this.to,""),
title = (new RegExp("^" + $tw.config.textPrimitives.wikiLink + "$","mg")).exec(this.to) ? this.to : "[[" + this.to + "]]";
// IE doesn't like these content types
if(!$tw.browser.isIE) {
dataTransfer.setData("text/vnd.tiddler",jsonData);
dataTransfer.setData("text/plain",title);
dataTransfer.setData("text/x-moz-url","data:text/vnd.tiddler," + encodeURIComponent(jsonData));
}
dataTransfer.setData("URL","data:text/vnd.tiddler," + encodeURIComponent(jsonData));
dataTransfer.setData("Text",title);
event.stopPropagation();
} else {
event.preventDefault();
}
}
};

LinkWidget.prototype.handleDragEndEvent = function(event) {
if(event.target === this.domNodes[0]) {
$tw.dragInProgress = false;
// Remove the dragging class on the element being dragged
$tw.utils.removeClass(event.target,"tc-tiddlylink-dragging");
// Delete the drag image element
if(this.dragImage) {
this.dragImage.parentNode.removeChild(this.dragImage);
}
}
};

/*
Compute the internal state of the widget
*/
Expand Down
3 changes: 3 additions & 0 deletions core/modules/widgets/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ ListWidget.prototype.render = function(parent,nextSibling) {
this.renderChildren(parent,nextSibling);
// Construct the storyview
var StoryView = this.storyViews[this.storyViewName];
if(this.storyViewName && !StoryView) {
StoryView = this.storyViews["classic"];
}
if(StoryView && !this.document.isTiddlyWikiFakeDom) {
this.storyview = new StoryView(this);
} else {
Expand Down
34 changes: 24 additions & 10 deletions core/modules/widgets/navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ NavigatorWidget.prototype.refresh = function(changedTiddlers) {
this.refreshSelf();
return true;
} else {
return this.refreshChildren(changedTiddlers);
return this.refreshChildren(changedTiddlers);
}
};

Expand Down Expand Up @@ -174,6 +174,7 @@ NavigatorWidget.prototype.addToHistory = function(title,fromPageRect) {
Handle a tm-navigate event
*/
NavigatorWidget.prototype.handleNavigateEvent = function(event) {
event = $tw.hooks.invokeHook("th-navigating",event);
if(event.navigateTo) {
this.addToStory(event.navigateTo,event.navigateFromTitle);
if(!event.navigateSuppressNavigation) {
Expand Down Expand Up @@ -245,6 +246,7 @@ NavigatorWidget.prototype.handleDeleteTiddlerEvent = function(event) {
tiddler = this.wiki.getTiddler(title),
storyList = this.getStoryList(),
originalTitle = tiddler ? tiddler.fields["draft.of"] : "",
originalTiddler = originalTitle ? this.wiki.getTiddler(originalTitle) : undefined,
confirmationTitle;
if(!tiddler) {
return false;
Expand All @@ -268,10 +270,14 @@ NavigatorWidget.prototype.handleDeleteTiddlerEvent = function(event) {
}
// Delete the original tiddler
if(originalTitle) {
if(originalTiddler) {
$tw.hooks.invokeHook("th-deleting-tiddler",originalTiddler);
}
this.wiki.deleteTiddler(originalTitle);
this.removeTitleFromStory(storyList,originalTitle);
}
// Delete this tiddler
// Invoke the hook function and delete this tiddler
$tw.hooks.invokeHook("th-deleting-tiddler",tiddler);
this.wiki.deleteTiddler(title);
// Remove the closed tiddler from the story
this.removeTitleFromStory(storyList,title);
Expand Down Expand Up @@ -349,12 +355,21 @@ NavigatorWidget.prototype.handleSaveTiddlerEvent = function(event) {
},this.wiki.getModificationFields());
newTiddler = $tw.hooks.invokeHook("th-saving-tiddler",newTiddler);
this.wiki.addTiddler(newTiddler);
// If enabled, relink references to renamed tiddler
var shouldRelink = this.getAttribute("relinkOnRename","no").toLowerCase().trim() === "yes";
if(isRename && shouldRelink && this.wiki.tiddlerExists(draftOf)) {
console.log("Relinking '" + draftOf + "' to '" + draftTitle + "'");
this.wiki.relinkTiddler(draftOf,draftTitle);
}
// Remove the draft tiddler
this.wiki.deleteTiddler(title);
// Remove the original tiddler if we're renaming it
if(isRename) {
this.wiki.deleteTiddler(draftOf);
}
// #2381 always remove new title & old
this.removeTitleFromStory(storyList,draftTitle);
this.removeTitleFromStory(storyList,draftOf);
if(!event.paramObject || event.paramObject.suppressNavigation !== "yes") {
// Replace the draft in the story with the original
this.replaceFirstTitleInStory(storyList,title,draftTitle);
Expand Down Expand Up @@ -451,7 +466,7 @@ NavigatorWidget.prototype.handleNewTiddlerEvent = function(event) {
// Merge the tags
var mergedTags = [];
if(existingTiddler && existingTiddler.fields.tags) {
$tw.utils.pushTop(mergedTags,existingTiddler.fields.tags)
$tw.utils.pushTop(mergedTags,existingTiddler.fields.tags);
}
if(additionalFields && additionalFields.tags) {
// Merge tags
Expand Down Expand Up @@ -492,7 +507,6 @@ NavigatorWidget.prototype.handleNewTiddlerEvent = function(event) {

// Import JSON tiddlers into a pending import tiddler
NavigatorWidget.prototype.handleImportTiddlersEvent = function(event) {
var self = this;
// Get the tiddlers
var tiddlers = [];
try {
Expand Down Expand Up @@ -544,7 +558,7 @@ NavigatorWidget.prototype.handleImportTiddlersEvent = function(event) {
history.push(IMPORT_TITLE);
// Save the updated story and history
this.saveStoryList(storyList);
this.addToHistory(history);
this.addToHistory(history);
}
return false;
};
Expand All @@ -560,7 +574,9 @@ NavigatorWidget.prototype.handlePerformImportEvent = function(event) {
$tw.utils.each(importData.tiddlers,function(tiddlerFields) {
var title = tiddlerFields.title;
if(title && importTiddler && importTiddler.fields["selection-" + title] !== "unchecked") {
self.wiki.addTiddler(new $tw.Tiddler(tiddlerFields));
var tiddler = new $tw.Tiddler(tiddlerFields);
tiddler = $tw.hooks.invokeHook("th-importing-tiddler",tiddler);
self.wiki.addTiddler(tiddler);
importReport.push("# [[" + tiddlerFields.title + "]]");
}
});
Expand All @@ -577,8 +593,7 @@ NavigatorWidget.prototype.handlePerformImportEvent = function(event) {
};

NavigatorWidget.prototype.handleFoldTiddlerEvent = function(event) {
var self = this,
paramObject = event.paramObject || {};
var paramObject = event.paramObject || {};
if(paramObject.foldedState) {
var foldedState = this.wiki.getTiddlerText(paramObject.foldedState,"show") === "show" ? "hide" : "show";
this.wiki.setText(paramObject.foldedState,"text",null,foldedState);
Expand Down Expand Up @@ -613,8 +628,7 @@ NavigatorWidget.prototype.handleUnfoldAllTiddlersEvent = function(event) {
};

NavigatorWidget.prototype.handleRenameTiddlerEvent = function(event) {
var self = this,
paramObject = event.paramObject || {},
var paramObject = event.paramObject || {},
from = paramObject.from || event.tiddlerTitle,
to = paramObject.to;
$tw.wiki.renameTiddler(from,to);
Expand Down
34 changes: 14 additions & 20 deletions core/modules/widgets/radio.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,7 @@ title: $:/core/modules/widgets/radio.js
type: application/javascript
module-type: widget
Radio widget
Will set a field to the selected value:
```
<$radio field="myfield" value="check 1">one</$radio>
<$radio field="myfield" value="check 2">two</$radio>
<$radio field="myfield" value="check 3">three</$radio>
```
|Parameter |Description |h
|tiddler |Name of the tiddler in which the field should be set. Defaults to current tiddler |
|field |The name of the field to be set |
|value |The value to set |
|class |Optional class name(s) |
Set a field or index at a given tiddler via radio buttons
\*/
(function(){
Expand Down Expand Up @@ -70,12 +55,20 @@ RadioWidget.prototype.render = function(parent,nextSibling) {
};

RadioWidget.prototype.getValue = function() {
var tiddler = this.wiki.getTiddler(this.radioTitle);
return tiddler && tiddler.getFieldString(this.radioField);
var value,
tiddler = this.wiki.getTiddler(this.radioTitle);
if (this.radioIndex) {
value = this.wiki.extractTiddlerDataItem(this.radioTitle,this.radioIndex);
} else {
value = tiddler && tiddler.getFieldString(this.radioField);
}
return value;
};

RadioWidget.prototype.setValue = function() {
if(this.radioField) {
if(this.radioIndex) {
this.wiki.setText(this.radioTitle,"",this.radioIndex,this.radioValue);
} else {
var tiddler = this.wiki.getTiddler(this.radioTitle),
addition = {};
addition[this.radioField] = this.radioValue;
Expand All @@ -96,6 +89,7 @@ RadioWidget.prototype.execute = function() {
// Get the parameters from the attributes
this.radioTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler"));
this.radioField = this.getAttribute("field","text");
this.radioIndex = this.getAttribute("index");
this.radioValue = this.getAttribute("value");
this.radioClass = this.getAttribute("class","");
if(this.radioClass !== "") {
Expand All @@ -111,7 +105,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
*/
RadioWidget.prototype.refresh = function(changedTiddlers) {
var changedAttributes = this.computeAttributes();
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.value || changedAttributes["class"]) {
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.value || changedAttributes["class"]) {
this.refreshSelf();
return true;
} else {
Expand Down
13 changes: 11 additions & 2 deletions core/modules/widgets/setvariable.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ SetWidget.prototype.execute = function() {
// Get our parameters
this.setName = this.getAttribute("name","currentTiddler");
this.setFilter = this.getAttribute("filter");
this.setSelect = this.getAttribute("select");
this.setValue = this.getAttribute("value");
this.setEmptyValue = this.getAttribute("emptyValue");
// Set context variable
Expand All @@ -56,7 +57,15 @@ SetWidget.prototype.getValue = function() {
if(this.setFilter) {
var results = this.wiki.filterTiddlers(this.setFilter,this);
if(!this.setValue) {
value = $tw.utils.stringifyList(results);
var select;
if(this.setSelect) {
select = parseInt(this.setSelect,10);
}
if(select !== undefined) {
value = results[select] || "";
} else {
value = $tw.utils.stringifyList(results);
}
}
if(results.length === 0 && this.setEmptyValue !== undefined) {
value = this.setEmptyValue;
Expand All @@ -72,7 +81,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
*/
SetWidget.prototype.refresh = function(changedTiddlers) {
var changedAttributes = this.computeAttributes();
if(changedAttributes.name || changedAttributes.filter || changedAttributes.value || changedAttributes.emptyValue ||
if(changedAttributes.name || changedAttributes.filter || changedAttributes.select ||changedAttributes.value || changedAttributes.emptyValue ||
(this.setFilter && this.getValue() != this.variables[this.setName].value)) {
this.refreshSelf();
return true;
Expand Down
18 changes: 12 additions & 6 deletions core/modules/widgets/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Widget.prototype.substituteVariableParameters = function(text,formalParams,actua
// If we've still not got a value, use the default, if any
paramValue = paramValue || paramInfo["default"] || "";
// Replace any instances of this parameter
text = text.replace(new RegExp("\\$" + $tw.utils.escapeRegExp(paramInfo.name) + "\\$","mg"),paramValue);
text = $tw.utils.replaceString(text,new RegExp("\\$" + $tw.utils.escapeRegExp(paramInfo.name) + "\\$","mg"),paramValue);
}
}
return text;
Expand Down Expand Up @@ -222,7 +222,9 @@ Widget.prototype.computeAttributes = function() {
self = this,
value;
$tw.utils.each(this.parseTreeNode.attributes,function(attribute,name) {
if(attribute.type === "indirect") {
if(attribute.type === "filtered") {
value = self.wiki.filterTiddlers(attribute.filter,self)[0] || "";
} else if(attribute.type === "indirect") {
value = self.wiki.getTextReference(attribute.textReference,"",self.getVariable("currentTiddler"));
} else if(attribute.type === "macro") {
value = self.getVariable(attribute.value.name,{params: attribute.value.params});
Expand Down Expand Up @@ -493,8 +495,11 @@ Widget.prototype.invokeActions = function(triggeringWidget,event) {
for(var t=0; t<this.children.length; t++) {
var child = this.children[t];
// Invoke the child if it is an action widget
if(child.invokeAction && child.invokeAction(triggeringWidget,event)) {
handled = true;
if(child.invokeAction) {
child.refreshSelf();
if(child.invokeAction(triggeringWidget,event)) {
handled = true;
}
}
// Propagate through through the child if it permits it
if(child.allowActionPropagation() && child.invokeActions(triggeringWidget,event)) {
Expand All @@ -507,15 +512,16 @@ Widget.prototype.invokeActions = function(triggeringWidget,event) {
/*
Invoke the action widgets defined in a string
*/
Widget.prototype.invokeActionString = function(actions,triggeringWidget,event) {
Widget.prototype.invokeActionString = function(actions,triggeringWidget,event,variables) {
actions = actions || "";
var parser = this.wiki.parseText("text/vnd.tiddlywiki",actions,{
parentWidget: this,
document: this.document
}),
widgetNode = this.wiki.makeWidget(parser,{
parentWidget: this,
document: this.document
document: this.document,
variables: variables
});
var container = this.document.createElement("div");
widgetNode.render(container,null);
Expand Down
3 changes: 3 additions & 0 deletions core/modules/widgets/wikify.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ WikifyWidget.prototype.getResult = function() {
case "text":
result = this.wikifyContainer.textContent;
break;
case "formattedtext":
result = this.wikifyContainer.formattedTextContent;
break;
case "html":
result = this.wikifyContainer.innerHTML;
break;
Expand Down
74 changes: 52 additions & 22 deletions core/modules/wiki-bulkops.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,69 @@ Bulk tiddler operations such as rename.
/*
Rename a tiddler, and relink any tags or lists that reference it.
*/
exports.renameTiddler = function(fromTitle,toTitle) {
var self = this;
function renameTiddler(fromTitle,toTitle,options) {
fromTitle = (fromTitle || "").trim();
toTitle = (toTitle || "").trim();
options = options || {};
if(fromTitle && toTitle && fromTitle !== toTitle) {
// Rename the tiddler itself
var tiddler = this.getTiddler(fromTitle);
this.addTiddler(new $tw.Tiddler(tiddler,{title: toTitle},this.getModificationFields()));
var oldTiddler = this.getTiddler(fromTitle),
newTiddler = new $tw.Tiddler(oldTiddler,{title: toTitle},this.getModificationFields());
newTiddler = $tw.hooks.invokeHook("th-renaming-tiddler",newTiddler,oldTiddler);
this.addTiddler(newTiddler);
this.deleteTiddler(fromTitle);
// Rename any tags or lists that reference it
this.relinkTiddler(fromTitle,toTitle,options)
}
}

/*
Relink any tags or lists that reference a given tiddler
*/
function relinkTiddler(fromTitle,toTitle,options) {
var self = this;
fromTitle = (fromTitle || "").trim();
toTitle = (toTitle || "").trim();
options = options || {};
if(fromTitle && toTitle && fromTitle !== toTitle) {
this.each(function(tiddler,title) {
var tags = (tiddler.fields.tags || []).slice(0),
list = (tiddler.fields.list || []).slice(0),
isModified = false;
// Rename tags
$tw.utils.each(tags,function (title,index) {
if(title === fromTitle) {
tags[index] = toTitle;
isModified = true;
var type = tiddler.fields.type || "";
// Don't touch plugins or JavaScript modules
if(!tiddler.fields["plugin-type"] && type !== "application/javascript") {
var tags = (tiddler.fields.tags || []).slice(0),
list = (tiddler.fields.list || []).slice(0),
isModified = false;
if(!options.dontRenameInTags) {
// Rename tags
$tw.utils.each(tags,function (title,index) {
if(title === fromTitle) {
console.log("Renaming tag '" + tags[index] + "' to '" + toTitle + "' of tiddler '" + tiddler.fields.title + "'");
tags[index] = toTitle;
isModified = true;
}
});
}
});
// Rename lists
$tw.utils.each(list,function (title,index) {
if(title === fromTitle) {
list[index] = toTitle;
isModified = true;
if(!options.dontRenameInLists) {
// Rename lists
$tw.utils.each(list,function (title,index) {
if(title === fromTitle) {
console.log("Renaming list item '" + list[index] + "' to '" + toTitle + "' of tiddler '" + tiddler.fields.title + "'");
list[index] = toTitle;
isModified = true;
}
});
}
if(isModified) {
var newTiddler = new $tw.Tiddler(tiddler,{tags: tags, list: list},self.getModificationFields())
newTiddler = $tw.hooks.invokeHook("th-relinking-tiddler",newTiddler,tiddler);
self.addTiddler(newTiddler);
}
});
if(isModified) {
self.addTiddler(new $tw.Tiddler(tiddler,{tags: tags, list: list},self.getModificationFields()));
}
});
}
}
};

exports.renameTiddler = renameTiddler;
exports.relinkTiddler = relinkTiddler;

})();
140 changes: 92 additions & 48 deletions core/modules/wiki.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ Adds the following properties to the wiki object:

var widget = require("$:/core/modules/widgets/widget.js");

var USER_NAME_TITLE = "$:/status/UserName";
var USER_NAME_TITLE = "$:/status/UserName",
TIMESTAMP_DISABLE_TITLE = "$:/config/TimestampDisable";

/*
Get the value of a text reference. Text references can have any of these forms:
Expand Down Expand Up @@ -231,27 +232,35 @@ exports.importTiddler = function(tiddler) {
Return a hashmap of the fields that should be set when a tiddler is created
*/
exports.getCreationFields = function() {
var fields = {
created: new Date()
},
creator = this.getTiddlerText(USER_NAME_TITLE);
if(creator) {
fields.creator = creator;
if(this.getTiddlerText(TIMESTAMP_DISABLE_TITLE,"").toLowerCase() !== "yes") {
var fields = {
created: new Date()
},
creator = this.getTiddlerText(USER_NAME_TITLE);
if(creator) {
fields.creator = creator;
}
return fields;
} else {
return {};
}
return fields;
};

/*
Return a hashmap of the fields that should be set when a tiddler is modified
*/
exports.getModificationFields = function() {
var fields = Object.create(null),
modifier = this.getTiddlerText(USER_NAME_TITLE);
fields.modified = new Date();
if(modifier) {
fields.modifier = modifier;
if(this.getTiddlerText(TIMESTAMP_DISABLE_TITLE,"").toLowerCase() !== "yes") {
var fields = Object.create(null),
modifier = this.getTiddlerText(USER_NAME_TITLE);
fields.modified = new Date();
if(modifier) {
fields.modifier = modifier;
}
return fields;
} else {
return {};
}
return fields;
};

/*
Expand Down Expand Up @@ -328,7 +337,7 @@ exports.sortTiddlers = function(titles,sortField,isDescending,isCaseSensitive,is
var result =
isNaN(x) && !isNaN(y) ? (isDescending ? -1 : 1) :
!isNaN(x) && isNaN(y) ? (isDescending ? 1 : -1) :
(isDescending ? y - x : x - y);
(isDescending ? y - x : x - y);
return result;
};
if(sortField !== "title") {
Expand Down Expand Up @@ -632,10 +641,10 @@ exports.getTiddlerDataCached = function(titleOrTiddler,defaultData) {
if(tiddler) {
return this.getCacheForTiddler(tiddler.fields.title,"data",function() {
// Return the frozen value
var value = self.getTiddlerData(tiddler.fields.title,defaultData);
var value = self.getTiddlerData(tiddler.fields.title,undefined);
$tw.utils.deepFreeze(value);
return value;
});
}) || defaultData;
} else {
return defaultData;
}
Expand Down Expand Up @@ -671,7 +680,7 @@ exports.getTiddlerData = function(titleOrTiddler,defaultData) {
Extract an indexed field from within a data tiddler
*/
exports.extractTiddlerDataItem = function(titleOrTiddler,index,defaultText) {
var data = this.getTiddlerData(titleOrTiddler,Object.create(null)),
var data = this.getTiddlerDataCached(titleOrTiddler,Object.create(null)),
text;
if(data && $tw.utils.hop(data,index)) {
text = data[index];
Expand Down Expand Up @@ -904,31 +913,54 @@ options: as for wiki.makeWidget() plus:
options.field: optional field to transclude (defaults to "text")
options.mode: transclusion mode "inline" or "block"
options.children: optional array of children for the transclude widget
options.importVariables: optional importvariables filter string for macros to be included
options.importPageMacros: optional boolean; if true, equivalent to passing "[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]" to options.importVariables
*/
exports.makeTranscludeWidget = function(title,options) {
options = options || {};
var parseTree = {tree: [{
var parseTreeDiv = {tree: [{
type: "element",
tag: "div",
children: [{
type: "transclude",
attributes: {
tiddler: {
name: "tiddler",
type: "string",
value: title}},
isBlock: !options.parseAsInline}]}
]};
children: []}]},
parseTreeImportVariables = {
type: "importvariables",
attributes: {
filter: {
name: "filter",
type: "string"
}
},
isBlock: false,
children: []},
parseTreeTransclude = {
type: "transclude",
attributes: {
tiddler: {
name: "tiddler",
type: "string",
value: title}},
isBlock: !options.parseAsInline};
if(options.importVariables || options.importPageMacros) {
if(options.importVariables) {
parseTreeImportVariables.attributes.filter.value = options.importVariables;
} else if(options.importPageMacros) {
parseTreeImportVariables.attributes.filter.value = "[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]";
}
parseTreeDiv.tree[0].children.push(parseTreeImportVariables);
parseTreeImportVariables.children.push(parseTreeTransclude);
} else {
parseTreeDiv.tree[0].children.push(parseTreeTransclude);
}
if(options.field) {
parseTree.tree[0].children[0].attributes.field = {type: "string", value: options.field};
parseTreeTransclude.attributes.field = {type: "string", value: options.field};
}
if(options.mode) {
parseTree.tree[0].children[0].attributes.mode = {type: "string", value: options.mode};
parseTreeTransclude.attributes.mode = {type: "string", value: options.mode};
}
if(options.children) {
parseTree.tree[0].children[0].children = options.children;
parseTreeTransclude.children = options.children;
}
return $tw.wiki.makeWidget(parseTree,options);
return $tw.wiki.makeWidget(parseTreeDiv,options);
};

/*
Expand Down Expand Up @@ -1074,6 +1106,22 @@ exports.getTiddlerText = function(title,defaultText) {
}
};

/*
Check whether the text of a tiddler matches a given value. By default, the comparison is case insensitive, and any spaces at either end of the tiddler text is trimmed
*/
exports.checkTiddlerText = function(title,targetText,options) {
options = options || {};
var text = this.getTiddlerText(title,"");
if(!options.noTrim) {
text = text.trim();
}
if(!options.caseSensitive) {
text = text.toLowerCase();
targetText = targetText.toLowerCase();
}
return text === targetText;
}

/*
Read an array of browser File objects, invoking callback(tiddlerFieldsArray) once they're all read
*/
Expand Down Expand Up @@ -1118,29 +1166,24 @@ exports.readFile = function(file,callback) {
var reader = new FileReader();
// Onload
reader.onload = function(event) {
// Deserialise the file contents
var text = event.target.result,
tiddlerFields = {title: file.name || "Untitled", type: type};
// Are we binary?
if(isBinary) {
// The base64 section starts after the first comma in the data URI
var commaPos = text.indexOf(",");
if(commaPos !== -1) {
tiddlerFields.text = text.substr(commaPos+1);
callback([tiddlerFields]);
text = text.substr(commaPos + 1);
}
}
// Check whether this is an encrypted TiddlyWiki file
var encryptedJson = $tw.utils.extractEncryptedStoreArea(text);
if(encryptedJson) {
// If so, attempt to decrypt it with the current password
$tw.utils.decryptStoreAreaInteractive(encryptedJson,function(tiddlers) {
callback(tiddlers);
});
} else {
// Check whether this is an encrypted TiddlyWiki file
var encryptedJson = $tw.utils.extractEncryptedStoreArea(text);
if(encryptedJson) {
// If so, attempt to decrypt it with the current password
$tw.utils.decryptStoreAreaInteractive(encryptedJson,function(tiddlers) {
callback(tiddlers);
});
} else {
// Otherwise, just try to deserialise any tiddlers in the file
callback(self.deserializeTiddlers(type,text,tiddlerFields));
}
// Otherwise, just try to deserialise any tiddlers in the file
callback(self.deserializeTiddlers(type,text,tiddlerFields));
}
};
// Kick off the read
Expand Down Expand Up @@ -1219,3 +1262,4 @@ exports.invokeUpgraders = function(titles,tiddlers) {
};

})();

61 changes: 61 additions & 0 deletions core/sjcl-license.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
title: $:/library/sjcl.js/license
type: text/plain

SJCL is open. You can use, modify and redistribute it under a BSD
license or under the GNU GPL, version 2.0.

---------------------------------------------------------------------

http://opensource.org/licenses/BSD-2-Clause

Copyright (c) 2009-2015, Emily Stark, Mike Hamburg and Dan Boneh at
Stanford University. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

---------------------------------------------------------------------

http://opensource.org/licenses/GPL-2.0

The Stanford Javascript Crypto Library (hosted here on GitHub) is a
project by the Stanford Computer Security Lab to build a secure,
powerful, fast, small, easy-to-use, cross-browser library for
cryptography in Javascript.

Copyright (c) 2009-2015, Emily Stark, Mike Hamburg and Dan Boneh at
Stanford University.

This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
7 changes: 7 additions & 0 deletions core/templates/json-tiddler.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
title: $:/core/templates/json-tiddler

<!--

This template is used for saving tiddlers as raw JSON

--><$text text=<<jsontiddler>>/>
3 changes: 2 additions & 1 deletion core/templates/tiddlywiki5.html.tid
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: $:/core/templates/tiddlywiki5.html
<!doctype html>
{{$:/core/templates/MOTW.html}}<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <!-- Force IE standards mode for Intranet and HTA - should be the first meta -->
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="application-name" content="TiddlyWiki" />
<meta name="generator" content="TiddlyWiki" />
Expand All @@ -21,6 +21,7 @@ title: $:/core/templates/tiddlywiki5.html

<!--~~ Raw markup ~~-->
{{{ [all[shadows+tiddlers]tag[$:/core/wiki/rawmarkup]] [all[shadows+tiddlers]tag[$:/tags/RawMarkup]] ||$:/core/templates/plain-text-tiddler}}}
{{{ [all[shadows+tiddlers]tag[$:/tags/RawMarkupWikified]] ||$:/core/templates/raw-static-tiddler}}}
</head>
<body class="tc-body">
<!--~~ Static styles ~~-->
Expand Down
2 changes: 1 addition & 1 deletion core/ui/AboveStory/tw2-plugin-check.tid
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tags: $:/tags/AboveStory

<ul>

<$list filter="[all[system+tiddlers]tag[systemConfig]limit[1]]">
<$list filter="[all[system+tiddlers]tag[systemConfig]]">

<li>

Expand Down
4 changes: 4 additions & 0 deletions core/ui/AdvancedSearch/Shadows.tid
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ caption: {{$:/language/Search/Shadows/Caption}}

<$reveal state="$:/temp/advancedsearch" type="nomatch" text="">

<$list filter="[{$:/temp/advancedsearch}minlength{$:/config/Search/MinLength}limit[1]]" emptyMessage="""<div class="tc-search-results">{{$:/language/Search/Search/TooShort}}</div>""" variable="listItem">

<$set name="resultCount" value="""<$count filter="[all[shadows]search{$:/temp/advancedsearch}] -[[$:/temp/advancedsearch]]"/>""">

<div class="tc-search-results">
Expand All @@ -33,6 +35,8 @@ caption: {{$:/language/Search/Shadows/Caption}}

</$set>

</$list>

</$reveal>

<$reveal state="$:/temp/advancedsearch" type="match" text="">
Expand Down
2 changes: 2 additions & 0 deletions core/ui/AdvancedSearch/Standard.tid
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ caption: {{$:/language/Search/Standard/Caption}}
</$linkcatcher>

<$reveal state="$:/temp/advancedsearch" type="nomatch" text="">
<$list filter="[{$:/temp/advancedsearch}minlength{$:/config/Search/MinLength}limit[1]]" emptyMessage="""<div class="tc-search-results">{{$:/language/Search/Search/TooShort}}</div>""" variable="listItem">
<$set name="searchTiddler" value="$:/temp/advancedsearch">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]butfirst[]limit[1]]" emptyMessage="""
<$list filter="[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]]">
Expand All @@ -29,4 +30,5 @@ caption: {{$:/language/Search/Standard/Caption}}
<$macrocall $name="tabs" tabsList="[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]]" default={{$:/config/SearchResults/Default}}/>
</$list>
</$set>
</$list>
</$reveal>
4 changes: 4 additions & 0 deletions core/ui/AdvancedSearch/System.tid
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ caption: {{$:/language/Search/System/Caption}}

<$reveal state="$:/temp/advancedsearch" type="nomatch" text="">

<$list filter="[{$:/temp/advancedsearch}minlength{$:/config/Search/MinLength}limit[1]]" emptyMessage="""<div class="tc-search-results">{{$:/language/Search/Search/TooShort}}</div>""" variable="listItem">

<$set name="resultCount" value="""<$count filter="[is[system]search{$:/temp/advancedsearch}] -[[$:/temp/advancedsearch]]"/>""">

<div class="tc-search-results">
Expand All @@ -33,6 +35,8 @@ caption: {{$:/language/Search/System/Caption}}

</$set>

</$list>

</$reveal>

<$reveal state="$:/temp/advancedsearch" type="match" text="">
Expand Down
95 changes: 95 additions & 0 deletions core/ui/Components/plugin-info.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
title: $:/core/ui/Components/plugin-info

\define lingo-base() $:/language/ControlPanel/Plugins/

\define popup-state-macro()
$(qualified-state)$-$(currentTiddler)$
\end

\define tabs-state-macro()
$(popup-state)$-$(pluginInfoType)$
\end

\define plugin-icon-title()
$(currentTiddler)$/icon
\end

\define plugin-disable-title()
$:/config/Plugins/Disabled/$(currentTiddler)$
\end

\define plugin-table-body(type,disabledMessage,default-popup-state)
<div class="tc-plugin-info-chunk tc-small-icon">
<$reveal type="nomatch" state=<<popup-state>> text="yes" default="""$default-popup-state$""">
<$button class="tc-btn-invisible tc-btn-dropdown" set=<<popup-state>> setTo="yes">
{{$:/core/images/right-arrow}}
</$button>
</$reveal>
<$reveal type="match" state=<<popup-state>> text="yes" default="""$default-popup-state$""">
<$button class="tc-btn-invisible tc-btn-dropdown" set=<<popup-state>> setTo="no">
{{$:/core/images/down-arrow}}
</$button>
</$reveal>
</div>
<div class="tc-plugin-info-chunk">
<$transclude tiddler=<<currentTiddler>> subtiddler=<<plugin-icon-title>>>
<$transclude tiddler="$:/core/images/plugin-generic-$type$"/>
</$transclude>
</div>
<div class="tc-plugin-info-chunk">
<h1>
''<$view field="description"><$view field="title"/></$view>'' $disabledMessage$
</h1>
<h2>
<$view field="title"/>
</h2>
<h2>
<div><em><$view field="version"/></em></div>
</h2>
</div>
\end

\define plugin-info(type,default-popup-state)
<$set name="popup-state" value=<<popup-state-macro>>>
<$reveal type="nomatch" state=<<plugin-disable-title>> text="yes">
<$link to={{!!title}} class="tc-plugin-info">
<<plugin-table-body type:"$type$" default-popup-state:"""$default-popup-state$""">>
</$link>
</$reveal>
<$reveal type="match" state=<<plugin-disable-title>> text="yes">
<$link to={{!!title}} class="tc-plugin-info tc-plugin-info-disabled">
<<plugin-table-body type:"$type$" default-popup-state:"""$default-popup-state$""" disabledMessage:"<$macrocall $name='lingo' title='Disabled/Status'/>">>
</$link>
</$reveal>
<$reveal type="match" text="yes" state=<<popup-state>> default="""$default-popup-state$""">
<div class="tc-plugin-info-dropdown">
<div class="tc-plugin-info-dropdown-body">
<$list filter="[all[current]] -[[$:/core]]">
<div style="float:right;">
<$reveal type="nomatch" state=<<plugin-disable-title>> text="yes">
<$button set=<<plugin-disable-title>> setTo="yes" tooltip={{$:/language/ControlPanel/Plugins/Disable/Hint}} aria-label={{$:/language/ControlPanel/Plugins/Disable/Caption}}>
<<lingo Disable/Caption>>
</$button>
</$reveal>
<$reveal type="match" state=<<plugin-disable-title>> text="yes">
<$button set=<<plugin-disable-title>> setTo="no" tooltip={{$:/language/ControlPanel/Plugins/Enable/Hint}} aria-label={{$:/language/ControlPanel/Plugins/Enable/Caption}}>
<<lingo Enable/Caption>>
</$button>
</$reveal>
</div>
</$list>
<$reveal type="nomatch" text="" state="!!list">
<$set name="tabsList" filter="[<currentTiddler>list[]] contents">
<$macrocall $name="tabs" state=<<tabs-state-macro>> tabsList=<<tabsList>> default="readme" template="$:/core/ui/PluginInfo"/>
</$set>
</$reveal>
<$reveal type="match" text="" state="!!list">
<<lingo NoInformation/Hint>>
</$reveal>
</div>
</div>
</$reveal>
</$set>
\end

<$macrocall $name="plugin-info" type=<<plugin-type>> default-popup-state=<<default-popup-state>>/>
1 change: 1 addition & 0 deletions core/ui/ControlPanel/Basics.tid
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ caption: {{$:/language/ControlPanel/Basics/Caption}}
|<$link to="$:/config/AnimationDuration"><<lingo AnimDuration/Prompt>></$link> |<$edit-text tiddler="$:/config/AnimationDuration" default="" tag="input"/> |
|<$link to="$:/DefaultTiddlers"><<lingo DefaultTiddlers/Prompt>></$link> |<<lingo DefaultTiddlers/TopHint>><br> <$edit tag="textarea" tiddler="$:/DefaultTiddlers" class="tc-edit-texteditor"/><br>//<<lingo DefaultTiddlers/BottomHint>>// |
|<$link to="$:/config/NewJournal/Title"><<lingo NewJournal/Title/Prompt>></$link> |<$edit-text tiddler="$:/config/NewJournal/Title" default="" tag="input"/> |
|<$link to="$:/config/NewJournal/Text"><<lingo NewJournal/Text/Prompt>></$link> |<$edit tiddler="$:/config/NewJournal/Text" tag="textarea" class="tc-edit-texteditor" default=""/> |
|<$link to="$:/config/NewJournal/Tags"><<lingo NewJournal/Tags/Prompt>></$link> |<$edit-text tiddler="$:/config/NewJournal/Tags" default="" tag="input"/> |
|<<lingo Language/Prompt>> |{{$:/snippets/minilanguageswitcher}} |
|<<lingo Tiddlers/Prompt>> |<<show-filter-count "[!is[system]sort[title]]">> |
Expand Down
14 changes: 14 additions & 0 deletions core/ui/ControlPanel/Modals/AddPlugins.tid
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ $:/state/add-plugin-info/$(connectionTiddler)$/$(assetInfo)$
</$list>
\end

\define close-library-button()
<$reveal type='nomatch' state='$:/temp/ServerConnection/$(PluginLibraryURL)$' text=''>
<$button class='tc-btn-big-green'>
<$action-sendmessage $message="tm-unload-plugin-library" url={{!!url}}/>
{{$:/core/images/chevron-left}} {{$:/language/ControlPanel/Plugins/ClosePluginLibrary}}
<$action-deletetiddler $filter="[prefix[$:/temp/ServerConnection/$(PluginLibraryURL)$]][prefix[$:/temp/RemoteAssetInfo/$(PluginLibraryURL)$]]"/>
</$button>
</$reveal>
\end

\define plugin-library-listing()
<$list filter="[all[tiddlers+shadows]tag[$:/tags/PluginLibrary]]">
<div class="tc-plugin-library">
Expand All @@ -100,6 +110,10 @@ $:/state/add-plugin-info/$(connectionTiddler)$/$(assetInfo)$

<$transclude/>

<$set name=PluginLibraryURL value={{!!url}}>
<<close-library-button>>
</$set>

<<display-server-connection>>
</div>
</$list>
Expand Down
40 changes: 20 additions & 20 deletions core/ui/ControlPanel/Parsing.tid
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@ caption: {{$:/language/ControlPanel/Parsing/Caption}}

\define lingo-base() $:/language/ControlPanel/Parsing/

\define parsing-inner(typeCap)
<li>
<$checkbox tiddler="""$:/config/WikiParserRules/$typeCap$/$(currentTiddler)$""" field="text" checked="enable" unchecked="disable" default="enable"> ''<$text text=<<currentTiddler>>/>'': </$checkbox>
</li>
\define toggle(Type)
<$checkbox
tiddler="""$:/config/WikiParserRules/$Type$/$(rule)$"""
field="text"
checked="enable"
unchecked="disable"
default="enable">
<<rule>>
</$checkbox>
\end

\define parsing-outer(typeLower,typeCap)
<ul>
<$list filter="[wikiparserrules[$typeLower$]]">
<<parsing-inner typeCap:"$typeCap$">>
\define rules(type,Type)
<$list filter="[wikiparserrules[$type$]]" variable="rule">
<dd><<toggle $Type$>></dd>
</$list>
</ul>
\end

<<lingo Hint>>

! <<lingo Pragma/Caption>>

<<parsing-outer typeLower:"pragma" typeCap:"Pragma">>

! <<lingo Inline/Caption>>

<<parsing-outer typeLower:"inline" typeCap:"Inline">>

! <<lingo Block/Caption>>

<<parsing-outer typeLower:"block" typeCap:"Block">>
<dl>
<dt><<lingo Pragma/Caption>></dt>
<<rules pragma Pragma>>
<dt><<lingo Inline/Caption>></dt>
<<rules inline Inline>>
<dt><<lingo Block/Caption>></dt>
<<rules block Block>>
</dl>
88 changes: 2 additions & 86 deletions core/ui/ControlPanel/Plugins.tid
Original file line number Diff line number Diff line change
Expand Up @@ -4,95 +4,11 @@ caption: {{$:/language/ControlPanel/Plugins/Caption}}

\define lingo-base() $:/language/ControlPanel/Plugins/

\define popup-state-macro()
$(qualified-state)$-$(currentTiddler)$
\end

\define tabs-state-macro()
$(popup-state)$-$(pluginInfoType)$
\end

\define plugin-icon-title()
$(currentTiddler)$/icon
\end

\define plugin-disable-title()
$:/config/Plugins/Disabled/$(currentTiddler)$
\end

\define plugin-table-body(type,disabledMessage)
<div class="tc-plugin-info-chunk tc-small-icon">
<$reveal type="nomatch" state=<<popup-state>> text="yes">
<$button class="tc-btn-invisible tc-btn-dropdown" set=<<popup-state>> setTo="yes">
{{$:/core/images/right-arrow}}
</$button>
</$reveal>
<$reveal type="match" state=<<popup-state>> text="yes">
<$button class="tc-btn-invisible tc-btn-dropdown" set=<<popup-state>> setTo="no">
{{$:/core/images/down-arrow}}
</$button>
</$reveal>
</div>
<div class="tc-plugin-info-chunk">
<$transclude tiddler=<<currentTiddler>> subtiddler=<<plugin-icon-title>>>
<$transclude tiddler="$:/core/images/plugin-generic-$type$"/>
</$transclude>
</div>
<div class="tc-plugin-info-chunk">
<h1>
''<$view field="description"><$view field="title"/></$view>'' $disabledMessage$
</h1>
<h2>
<$view field="title"/>
</h2>
<h2>
<div><em><$view field="version"/></em></div>
</h2>
</div>
\end

\define plugin-table(type)
<$set name="plugin-type" value="""$type$""">
<$set name="qualified-state" value=<<qualify "$:/state/plugin-info">>>
<$list filter="[!has[draft.of]plugin-type[$type$]sort[description]]" emptyMessage=<<lingo "Empty/Hint">>>
<$set name="popup-state" value=<<popup-state-macro>>>
<$reveal type="nomatch" state=<<plugin-disable-title>> text="yes">
<$link to={{!!title}} class="tc-plugin-info">
<<plugin-table-body type:"$type$">>
</$link>
</$reveal>
<$reveal type="match" state=<<plugin-disable-title>> text="yes">
<$link to={{!!title}} class="tc-plugin-info tc-plugin-info-disabled">
<<plugin-table-body type:"$type$" disabledMessage:"<$macrocall $name='lingo' title='Disabled/Status'/>">>
</$link>
</$reveal>
<$reveal type="match" text="yes" state=<<popup-state>>>
<div class="tc-plugin-info-dropdown">
<div class="tc-plugin-info-dropdown-body">
<$list filter="[all[current]] -[[$:/core]]">
<div style="float:right;">
<$reveal type="nomatch" state=<<plugin-disable-title>> text="yes">
<$button set=<<plugin-disable-title>> setTo="yes" tooltip={{$:/language/ControlPanel/Plugins/Disable/Hint}} aria-label={{$:/language/ControlPanel/Plugins/Disable/Caption}}>
<<lingo Disable/Caption>>
</$button>
</$reveal>
<$reveal type="match" state=<<plugin-disable-title>> text="yes">
<$button set=<<plugin-disable-title>> setTo="no" tooltip={{$:/language/ControlPanel/Plugins/Enable/Hint}} aria-label={{$:/language/ControlPanel/Plugins/Enable/Caption}}>
<<lingo Enable/Caption>>
</$button>
</$reveal>
</div>
</$list>
<$reveal type="nomatch" text="" state="!!list">
<$macrocall $name="tabs" state=<<tabs-state-macro>> tabsList={{!!list}} default="readme" template="$:/core/ui/PluginInfo"/>
</$reveal>
<$reveal type="match" text="" state="!!list">
<<lingo NoInformation/Hint>>
</$reveal>
</div>
</div>
</$reveal>
<$list filter="[!has[draft.of]plugin-type[$type$]sort[description]]" emptyMessage=<<lingo "Empty/Hint">> template="$:/core/ui/Components/plugin-info"/>
</$set>
</$list>
</$set>
\end

Expand Down
35 changes: 4 additions & 31 deletions core/ui/ControlPanel/Saving.tid
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,8 @@ title: $:/core/ui/ControlPanel/Saving
tags: $:/tags/ControlPanel
caption: {{$:/language/ControlPanel/Saving/Caption}}

\define lingo-base() $:/language/ControlPanel/Saving/
\define backupURL()
http://$(userName)$.tiddlyspot.com/backup/
\end
\define backupLink()
<$reveal type="nomatch" state="$:/UploadName" text="">
<$set name="userName" value={{$:/UploadName}}>
<$reveal type="match" state="$:/UploadURL" text="">
<<backupURL>>
</$reveal>
<$reveal type="nomatch" state="$:/UploadURL" text="">
<$macrocall $name=resolvePath source={{$:/UploadBackupDir}} root={{$:/UploadURL}}>>
</$reveal>
</$set>
</$reveal>
\end
! <<lingo TiddlySpot/Heading>>
{{$:/language/ControlPanel/Saving/Hint}}

<<lingo TiddlySpot/Description>>

|<<lingo TiddlySpot/UserName>> |<$edit-text tiddler="$:/UploadName" default="" tag="input"/> |
|<<lingo TiddlySpot/Password>> |<$password name="upload"/> |
|<<lingo TiddlySpot/Backups>> |<<backupLink>> |

''<<lingo TiddlySpot/Advanced/Heading>>''

|<<lingo TiddlySpot/ServerURL>> |<$edit-text tiddler="$:/UploadURL" default="" tag="input"/> |
|<<lingo TiddlySpot/Filename>> |<$edit-text tiddler="$:/UploadFilename" default="index.html" tag="input"/> |
|<<lingo TiddlySpot/UploadDir>> |<$edit-text tiddler="$:/UploadDir" default="." tag="input"/> |
|<<lingo TiddlySpot/BackupDir>> |<$edit-text tiddler="$:/UploadBackupDir" default="." tag="input"/> |

<<lingo TiddlySpot/Hint>>
<div class="tc-control-panel">
<<tabs "[all[shadows+tiddlers]tag[$:/tags/ControlPanel/Saving]!has[draft.of]]" "$:/core/ui/ControlPanel/Saving/General">>
</div>
11 changes: 11 additions & 0 deletions core/ui/ControlPanel/Saving/DownloadSaver.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
title: $:/core/ui/ControlPanel/Saving/DownloadSaver
tags: $:/tags/ControlPanel/Saving
caption: {{$:/language/ControlPanel/Saving/DownloadSaver/Caption}}

\define lingo-base() $:/language/ControlPanel/Saving/DownloadSaver/

<<lingo Hint>>

!! <$link to="$:/config/DownloadSaver/AutoSave"><<lingo AutoSave/Hint>></$link>

<$checkbox tiddler="$:/config/DownloadSaver/AutoSave" field="text" checked="yes" unchecked="no" default="no"> <<lingo AutoSave/Description>> </$checkbox>
16 changes: 16 additions & 0 deletions core/ui/ControlPanel/Saving/General.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
title: $:/core/ui/ControlPanel/Saving/General
tags: $:/tags/ControlPanel/Saving
caption: {{$:/language/ControlPanel/Saving/General/Caption}}
list-before:

\define lingo-base() $:/language/ControlPanel/Settings/

{{$:/language/ControlPanel/Saving/General/Hint}}

!! <$link to="$:/config/AutoSave"><<lingo AutoSave/Caption>></$link>

<<lingo AutoSave/Hint>>

<$radio tiddler="$:/config/AutoSave" value="yes"> <<lingo AutoSave/Enabled/Description>> </$radio>

<$radio tiddler="$:/config/AutoSave" value="no"> <<lingo AutoSave/Disabled/Description>> </$radio>
36 changes: 36 additions & 0 deletions core/ui/ControlPanel/Saving/TiddlySpot.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
title: $:/core/ui/ControlPanel/Saving/TiddlySpot
tags: $:/tags/ControlPanel/Saving
caption: {{$:/language/ControlPanel/Saving/TiddlySpot/Caption}}

\define lingo-base() $:/language/ControlPanel/Saving/TiddlySpot/

\define backupURL()
http://$(userName)$.tiddlyspot.com/backup/
\end
\define backupLink()
<$reveal type="nomatch" state="$:/UploadName" text="">
<$set name="userName" value={{$:/UploadName}}>
<$reveal type="match" state="$:/UploadURL" text="">
<<backupURL>>
</$reveal>
<$reveal type="nomatch" state="$:/UploadURL" text="">
<$macrocall $name=resolvePath source={{$:/UploadBackupDir}} root={{$:/UploadURL}}>>
</$reveal>
</$set>
</$reveal>
\end

<<lingo Description>>

|<<lingo UserName>> |<$edit-text tiddler="$:/UploadName" default="" tag="input"/> |
|<<lingo Password>> |<$password name="upload"/> |
|<<lingo Backups>> |<<backupLink>> |

''<<lingo Advanced/Heading>>''

|<<lingo ServerURL>> |<$edit-text tiddler="$:/UploadURL" default="" tag="input"/> |
|<<lingo Filename>> |<$edit-text tiddler="$:/UploadFilename" default="index.html" tag="input"/> |
|<<lingo UploadDir>> |<$edit-text tiddler="$:/UploadDir" default="." tag="input"/> |
|<<lingo BackupDir>> |<$edit-text tiddler="$:/UploadBackupDir" default="." tag="input"/> |

<<lingo TiddlySpot/Hint>>
11 changes: 0 additions & 11 deletions core/ui/ControlPanel/Settings/AutoSave.tid

This file was deleted.

10 changes: 10 additions & 0 deletions core/ui/ControlPanel/Settings/InfoPanelMode.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
title: $:/core/ui/ControlPanel/Settings/InfoPanelMode
tags: $:/tags/ControlPanel/Settings
caption: {{$:/language/ControlPanel/Settings/InfoPanelMode/Caption}}

\define lingo-base() $:/language/ControlPanel/Settings/InfoPanelMode/
<$link to="$:/config/TiddlerInfo/Mode"><<lingo Hint>></$link>

<$radio tiddler="$:/config/TiddlerInfo/Mode" value="popup"> <<lingo Popup/Description>> </$radio>

<$radio tiddler="$:/config/TiddlerInfo/Mode" value="sticky"> <<lingo Sticky/Description>> </$radio>
13 changes: 4 additions & 9 deletions core/ui/ControlPanel/Toolbars/EditToolbar.tid
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,17 @@ tags: $:/tags/ControlPanel/Toolbars
caption: {{$:/language/ControlPanel/Toolbars/EditToolbar/Caption}}

\define lingo-base() $:/language/TiddlerInfo/
\define config-title()
$:/config/EditToolbarButtons/Visibility/$(listItem)$
\end

\define config-base() $:/config/EditToolbarButtons/Visibility/

{{$:/language/ControlPanel/Toolbars/EditToolbar/Hint}}

<$set name="tv-config-toolbar-icons" value="yes">

<$set name="tv-config-toolbar-text" value="yes">

<$list filter="[all[shadows+tiddlers]tag[$:/tags/EditToolbar]!has[draft.of]]" variable="listItem">

<$checkbox tiddler=<<config-title>> field="text" checked="show" unchecked="hide" default="show"/> <$transclude tiddler=<<listItem>> field="caption"/> <i class="tc-muted">-- <$transclude tiddler=<<listItem>> field="description"/></i>

</$list>
<$macrocall $name="list-tagged-draggable" tag="$:/tags/EditToolbar" itemTemplate="$:/core/ui/ControlPanel/Toolbars/ItemTemplate"/>

</$set>

</$set>
</$set>
9 changes: 9 additions & 0 deletions core/ui/ControlPanel/Toolbars/EditorItemTemplate.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
title: $:/core/ui/ControlPanel/Toolbars/EditorItemTemplate

\define config-title()
$(config-base)$$(currentTiddler)$
\end

<$draggable tiddler=<<currentTiddler>>>
<$checkbox tiddler=<<config-title>> field="text" checked="show" unchecked="hide" default="show"/> <span class="tc-icon-wrapper"><$transclude tiddler={{!!icon}}/></span> <$transclude field="caption"/> -- <i class="tc-muted"><$transclude field="description"/></i>
</$draggable>
14 changes: 2 additions & 12 deletions core/ui/ControlPanel/Toolbars/EditorToolbar.tid
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,8 @@ caption: {{$:/language/ControlPanel/Toolbars/EditorToolbar/Caption}}

\define lingo-base() $:/language/TiddlerInfo/

\define config-title()
$:/config/EditorToolbarButtons/Visibility/$(listItem)$
\end

\define toolbar-button()
<$checkbox tiddler=<<config-title>> field="text" checked="show" unchecked="hide" default="show"> <$transclude tiddler={{$(listItem)$!!icon}}/> <$transclude tiddler=<<listItem>> field="caption"/> -- <i class="tc-muted"><$transclude tiddler=<<listItem>> field="description"/></i></$checkbox>
\end
\define config-base() $:/config/EditorToolbarButtons/Visibility/

{{$:/language/ControlPanel/Toolbars/EditorToolbar/Hint}}

<$list filter="[all[shadows+tiddlers]tag[$:/tags/EditorToolbar]!has[draft.of]]" variable="listItem">

<<toolbar-button>>

</$list>
<$macrocall $name="list-tagged-draggable" tag="$:/tags/EditorToolbar" itemTemplate="$:/core/ui/ControlPanel/Toolbars/EditorItemTemplate"/>
9 changes: 9 additions & 0 deletions core/ui/ControlPanel/Toolbars/ItemTemplate.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
title: $:/core/ui/ControlPanel/Toolbars/ItemTemplate

\define config-title()
$(config-base)$$(currentTiddler)$
\end

<$draggable tiddler=<<currentTiddler>>>
<$checkbox tiddler=<<config-title>> field="text" checked="show" unchecked="hide" default="show"/> <span class="tc-icon-wrapper"> <$transclude field="caption"/> <i class="tc-muted">-- <$transclude field="description"/></i></span>
</$draggable>
11 changes: 3 additions & 8 deletions core/ui/ControlPanel/Toolbars/PageControls.tid
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,16 @@ tags: $:/tags/ControlPanel/Toolbars
caption: {{$:/language/ControlPanel/Toolbars/PageControls/Caption}}

\define lingo-base() $:/language/TiddlerInfo/
\define config-title()
$:/config/PageControlButtons/Visibility/$(listItem)$
\end

\define config-base() $:/config/PageControlButtons/Visibility/

{{$:/language/ControlPanel/Toolbars/PageControls/Hint}}

<$set name="tv-config-toolbar-icons" value="yes">

<$set name="tv-config-toolbar-text" value="yes">

<$list filter="[all[shadows+tiddlers]tag[$:/tags/PageControls]!has[draft.of]]" variable="listItem">

<$checkbox tiddler=<<config-title>> field="text" checked="show" unchecked="hide" default="show"/> <$transclude tiddler=<<listItem>> field="caption"/> <i class="tc-muted">-- <$transclude tiddler=<<listItem>> field="description"/></i>

</$list>
<$macrocall $name="list-tagged-draggable" tag="$:/tags/PageControls" itemTemplate="$:/core/ui/ControlPanel/Toolbars/ItemTemplate"/>

</$set>

Expand Down
11 changes: 3 additions & 8 deletions core/ui/ControlPanel/Toolbars/ViewToolbar.tid
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,16 @@ tags: $:/tags/ControlPanel/Toolbars
caption: {{$:/language/ControlPanel/Toolbars/ViewToolbar/Caption}}

\define lingo-base() $:/language/TiddlerInfo/
\define config-title()
$:/config/ViewToolbarButtons/Visibility/$(listItem)$
\end

\define config-base() $:/config/ViewToolbarButtons/Visibility/

{{$:/language/ControlPanel/Toolbars/ViewToolbar/Hint}}

<$set name="tv-config-toolbar-icons" value="yes">

<$set name="tv-config-toolbar-text" value="yes">

<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewToolbar]!has[draft.of]]" variable="listItem">

<$checkbox tiddler=<<config-title>> field="text" checked="show" unchecked="hide" default="show"/> <$transclude tiddler=<<listItem>> field="caption"/> <i class="tc-muted">-- <$transclude tiddler=<<listItem>> field="description"/></i>

</$list>
<$macrocall $name="list-tagged-draggable" tag="$:/tags/ViewToolbar" itemTemplate="$:/core/ui/ControlPanel/Toolbars/ItemTemplate"/>

</$set>

Expand Down
12 changes: 11 additions & 1 deletion core/ui/EditTemplate.tid
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
title: $:/core/ui/EditTemplate

\define actions()
<$action-sendmessage $message="tm-add-tag" $param={{$:/temp/NewTagName}}/>
<$action-deletetiddler $tiddler="$:/temp/NewTagName"/>
<$action-sendmessage $message="tm-add-field" $name={{$:/temp/newfieldname}} $value={{$:/temp/newfieldvalue}}/>
<$action-deletetiddler $tiddler="$:/temp/newfieldname"/>
<$action-deletetiddler $tiddler="$:/temp/newfieldvalue"/>
<$action-sendmessage $message="tm-save-tiddler"/>
\end
\define frame-classes()
tc-tiddler-frame tc-tiddler-edit-frame $(missingTiddlerClass)$ $(shadowTiddlerClass)$ $(systemTiddlerClass)$
\end
<div class=<<frame-classes>>>
<$fieldmangler>
<$set name="storyTiddler" value=<<currentTiddler>>>
<$keyboard key="((cancel-edit-tiddler))" message="tm-cancel-tiddler">
<$keyboard key="((save-tiddler))" message="tm-save-tiddler">
<$keyboard key="((save-tiddler))" actions=<<actions>>>
<$list filter="[all[shadows+tiddlers]tag[$:/tags/EditTemplate]!has[draft.of]]" variable="listItem">
<$transclude tiddler=<<listItem>>/>
</$list>
</$keyboard>
</$keyboard>
</$set>
</$fieldmangler>
</div>
5 changes: 2 additions & 3 deletions core/ui/EditTemplate/fields.tid
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ $:/config/EditTemplateFields/Visibility/$(currentField)$
<div class="tc-dropdown-item">
<<lingo Fields/Add/Dropdown/User>>
</div>
<$list filter="[!is[shadow]!is[system]fields[]sort[]] -created -creator -draft.of -draft.title -modified -modifier -tags -text -title -type" variable="currentField">
<$list filter="[!is[shadow]!is[system]fields[]search:title{$:/temp/newfieldname}sort[]] -created -creator -draft.of -draft.title -modified -modifier -tags -text -title -type" variable="currentField">
<$link to=<<currentField>>>
<<currentField>>
</$link>
</$list>
<div class="tc-dropdown-item">
<<lingo Fields/Add/Dropdown/System>>
</div>
<$list filter="[fields[]sort[]] -[!is[shadow]!is[system]fields[]]" variable="currentField">
<$list filter="[fields[]search:title{$:/temp/newfieldname}sort[]] -[!is[shadow]!is[system]fields[]]" variable="currentField">
<$link to=<<currentField>>>
<<currentField>>
</$link>
Expand All @@ -97,4 +97,3 @@ $:/config/EditTemplateFields/Visibility/$(currentField)$
</span>
</div>
</$fieldmangler>

41 changes: 14 additions & 27 deletions core/ui/EditTemplate/tags.tid
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ title: $:/core/ui/EditTemplate/tags
tags: $:/tags/EditTemplate

\define lingo-base() $:/language/EditTemplate/

\define tag-styles()
background-color:$(backgroundColor)$;
fill:$(foregroundColor)$;
color:$(foregroundColor)$;
\end

\define tag-body-inner(colour,fallbackTarget,colourA,colourB)
<$vars foregroundColor=<<contrastcolour target:"""$colour$""" fallbackTarget:"""$fallbackTarget$""" colourA:"""$colourA$""" colourB:"""$colourB$""">> backgroundColor="""$colour$""">
<span style=<<tag-styles>> class="tc-tag-label">
Expand All @@ -15,39 +17,24 @@ color:$(foregroundColor)$;
</span>
</$vars>
\end

\define tag-body(colour,palette)
<$macrocall $name="tag-body-inner" colour="""$colour$""" fallbackTarget={{$palette$##tag-background}} colourA={{$palette$##foreground}} colourB={{$palette$##background}}/>
\end

\define tag-picker-actions()
<$action-listops
$tiddler=<<currentTiddler>>
$field="tags"
$subfilter="[<tag>] [all[current]tags[]]"
/>
\end

<div class="tc-edit-tags">
<$fieldmangler>
<$list filter="[all[current]tags[]sort[title]]" storyview="pop">
<$macrocall $name="tag-body" colour={{!!color}} palette={{$:/palette}}/>
</$list>

<div class="tc-edit-add-tag">
<span class="tc-add-tag-name">
<$edit-text tiddler="$:/temp/NewTagName" tag="input" default="" placeholder={{$:/language/EditTemplate/Tags/Add/Placeholder}} focusPopup=<<qualify "$:/state/popup/tags-auto-complete">> class="tc-edit-texteditor tc-popup-handle"/>
</span> <$button popup=<<qualify "$:/state/popup/tags-auto-complete">> class="tc-btn-invisible tc-btn-dropdown" tooltip={{$:/language/EditTemplate/Tags/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Tags/Dropdown/Caption}}>{{$:/core/images/down-arrow}}</$button> <span class="tc-add-tag-button">
<$button message="tm-add-tag" param={{$:/temp/NewTagName}} set="$:/temp/NewTagName" setTo="" class="">
<<lingo Tags/Add/Button>>
</$button>
</span>
</div>

<div class="tc-block-dropdown-wrapper">
<$reveal state=<<qualify "$:/state/popup/tags-auto-complete">> type="nomatch" text="" default="">
<div class="tc-block-dropdown">
<$linkcatcher set="$:/temp/NewTagName" setTo="" message="tm-add-tag">
<$list filter="[tags[]!is[system]search:title{$:/temp/NewTagName}sort[]]">
{{||$:/core/ui/Components/tag-link}}
</$list>
<hr>
<$list filter="[tags[]is[system]search:title{$:/temp/NewTagName}sort[]]">
{{||$:/core/ui/Components/tag-link}}
</$list>
</$linkcatcher>
</div>
</$reveal>
</div>
</$fieldmangler>
</div>
<$macrocall $name="tag-picker" actions=<<tag-picker-actions>>/>
</div>
30 changes: 28 additions & 2 deletions core/ui/EditTemplate/title.tid
Original file line number Diff line number Diff line change
@@ -1,18 +1,44 @@
title: $:/core/ui/EditTemplate/title
tags: $:/tags/EditTemplate

<$edit-text field="draft.title" class="tc-titlebar tc-edit-texteditor" focus="true"/>

<$vars pattern="""[\|\[\]{}]""" bad-chars="""`| [ ] { }`""">

<$list filter="[is[current]regexp:draft.title<pattern>]" variable="listItem">

<div class="tc-message-box">

{{$:/language/EditTemplate/Title/BadCharacterWarning}}
{{$:/core/images/warning}} {{$:/language/EditTemplate/Title/BadCharacterWarning}}

</div>

</$list>

</$vars>

<$edit-text field="draft.title" class="tc-titlebar tc-edit-texteditor" focus="true"/>
<$reveal state="!!draft.title" type="nomatch" text={{!!draft.of}} tag="div">

<$list filter="[{!!draft.title}!is[missing]]" variable="listItem">

<div class="tc-message-box">

{{$:/core/images/warning}} {{$:/language/EditTemplate/Title/Exists/Prompt}}

</div>

</$list>

<$list filter="[{!!draft.of}!is[missing]]" variable="listItem">

<$vars fromTitle={{!!draft.of}} toTitle={{!!draft.title}}>

<$checkbox tiddler="$:/config/RelinkOnRename" field="text" checked="yes" unchecked="no" default="no"> {{$:/language/EditTemplate/Title/Relink/Prompt}}</$checkbox>

</$vars>

</$list>

</$reveal>


2 changes: 1 addition & 1 deletion core/ui/EditTemplate/type.tid
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tags: $:/tags/EditTemplate
<$reveal state=<<qualify "$:/state/popup/type-dropdown">> type="nomatch" text="" default="">
<div class="tc-block-dropdown tc-edit-type-dropdown">
<$linkcatcher to="!!type">
<$list filter='[all[shadows+tiddlers]prefix[$:/language/Docs/Types/]each[group]sort[group]]'>
<$list filter='[all[shadows+tiddlers]prefix[$:/language/Docs/Types/]each[group]sort[group-sort]]'>
<div class="tc-dropdown-item">
<$text text={{!!group}}/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion core/ui/EditorToolbar/excise-dropdown.tid
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ title: $:/core/ui/EditorToolbar/excise-dropdown
tagnew={{$config-title$/tagnew}}
/>
<$action-deletetiddler
$tiddler=<<qualify "$:/state/Excise/NewTitle">>
$tiddler="$config-title$/new-title"
/>
<$action-deletetiddler
$tiddler=<<dropdown-state>>
Expand Down
25 changes: 23 additions & 2 deletions core/ui/EditorToolbar/link-dropdown.tid
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,34 @@ title: $:/core/ui/EditorToolbar/link-dropdown
/>
\end

\define external-link()
<$button class="tc-btn-invisible" style="width: auto; display: inline-block; background-colour: inherit;">
<$action-sendmessage $message="tm-edit-text-operation" $param="make-link" text={{$(searchTiddler)$}}
/>
{{$:/core/images/chevron-right}}
<$action-deletetiddler
$tiddler=<<dropdown-state>>
/>

<$action-deletetiddler
$tiddler=<<searchTiddler>>
/>

<$action-deletetiddler
$tiddler=<<linkTiddler>>
/>
</$button>
\end


\define body(config-title)
''<<lingo Hint>>''

<$vars searchTiddler="""$config-title$/search""" linkTiddler="""$config-title$/link""">
<$vars searchTiddler="""$config-title$/search""" linkTiddler="""$config-title$/link""" linktext="" >

<$edit-text tiddler=<<searchTiddler>> type="search" tag="input" focus="true" placeholder={{$:/language/Search/Search}} default=""/>
<$reveal tag="span" state=<<searchTiddler>> type="nomatch" text="">
<<external-link>>
<$button class="tc-btn-invisible" style="width: auto; display: inline-block; background-colour: inherit;">
<$action-setfield $tiddler=<<searchTiddler>> text="" />
{{$:/core/images/close-button}}
Expand All @@ -49,4 +70,4 @@ title: $:/core/ui/EditorToolbar/link-dropdown

\end

<$macrocall $name="body" config-title=<<qualify "$:/state/Link/">>/>
<$macrocall $name="body" config-title=<<qualify "$:/state/Link/">>/>
5 changes: 5 additions & 0 deletions core/ui/Filters/StoryList.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
title: $:/core/Filters/StoryList
tags: $:/tags/Filter
filter: [list[$:/StoryList]] -$:/AdvancedSearch
description: {{$:/language/Filters/StoryList}}

12 changes: 12 additions & 0 deletions core/ui/ImportListing.tid
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
title: $:/core/ui/ImportListing

\define lingo-base() $:/language/Import/

\define messageField()
message-$(payloadTiddler)$
\end

\define selectionField()
selection-$(payloadTiddler)$
\end

\define previewPopupState()
$(currentTiddler)$!!popup-$(payloadTiddler)$
\end

\define select-all-actions()
<$list filter="[all[current]plugintiddlers[]sort[title]]" variable="payloadTiddler">
<$action-setfield $field={{{ [<payloadTiddler>addprefix[selection-]] }}} $value={{$:/state/import/select-all}}/>
</$list>
\end

<table>
<tbody>
<tr>
<th>
<$checkbox tiddler="$:/state/import/select-all" field="text" checked="checked" unchecked="unchecked" default="checked" actions=<<select-all-actions>>>
<<lingo Listing/Select/Caption>>
</$checkbox>
</th>
<th>
<<lingo Listing/Title/Caption>>
Expand Down
92 changes: 92 additions & 0 deletions core/ui/Manager.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
title: $:/Manager
icon: $:/core/images/list
color: #bbb

\define lingo-base() $:/language/Manager/

\define list-item-content-item()
<div class="tc-manager-list-item-content-item">
<$vars state-title="""$:/state/popup/manager/item/$(listItem)$""">
<$reveal state=<<state-title>> type="match" text="show" default="show" tag="div">
<$button set=<<state-title>> setTo="hide" class="tc-btn-invisible tc-manager-list-item-content-item-heading">
{{$:/core/images/down-arrow}} <$transclude tiddler=<<listItem>> field="caption"/>
</$button>
</$reveal>
<$reveal state=<<state-title>> type="nomatch" text="show" default="show" tag="div">
<$button set=<<state-title>> setTo="show" class="tc-btn-invisible tc-manager-list-item-content-item-heading">
{{$:/core/images/right-arrow}} <$transclude tiddler=<<listItem>> field="caption"/>
</$button>
</$reveal>
<$reveal state=<<state-title>> type="match" text="show" default="show" tag="div" class="tc-manager-list-item-content-item-body">
<$transclude tiddler=<<listItem>>/>
</$reveal>
</$vars>
</div>
\end

<div class="tc-manager-wrapper">
<div class="tc-manager-controls">
<div class="tc-manager-control">
<<lingo Controls/Show/Prompt>> <$select tiddler="$:/config/Manager/Show" default="tiddlers">
<option value="tiddlers"><<lingo Controls/Show/Option/Tiddlers>></option>
<option value="tags"><<lingo Controls/Show/Option/Tags>></option>
</$select>
</div>
<div class="tc-manager-control">
<<lingo Controls/Search/Prompt>> <$edit-text tiddler="$:/config/Manager/Filter" tag="input" default="" placeholder={{$:/language/Manager/Controls/Search/Placeholder}}/>
</div>
<div class="tc-manager-control">
<<lingo Controls/FilterByTag/Prompt>> <$select tiddler="$:/config/Manager/Tag" default="">
<option value=""><<lingo Controls/FilterByTag/None>></option>
<$list filter="[!is{$:/config/Manager/System}tags[]!is[system]sort[title]]" variable="tag">
<option value=<<tag>>><$text text=<<tag>>/></option>
</$list>
</$select>
</div>
<div class="tc-manager-control">
<<lingo Controls/Sort/Prompt>> <$select tiddler="$:/config/Manager/Sort" default="title">
<optgroup label="Common">
<$list filter="title modified modifier created creator created" variable="field">
<option value=<<field>>><$text text=<<field>>/></option>
</$list>
</optgroup>
<optgroup label="All">
<$list filter="[all{$:/config/Manager/Show}!is{$:/config/Manager/System}fields[]sort[title]] -title -modified -modifier -created -creator -created" variable="field">
<option value=<<field>>><$text text=<<field>>/></option>
</$list>
</optgroup>
</$select>
<$checkbox tiddler="$:/config/Manager/Order" field="text" checked="reverse" unchecked="forward" default="forward">
<<lingo Controls/Order/Prompt>>
</$checkbox>
</div>
<div class="tc-manager-control">
<$checkbox tiddler="$:/config/Manager/System" field="text" checked="" unchecked="system" default="system">
{{$:/language/SystemTiddlers/Include/Prompt}}
</$checkbox>
</div>
</div>
<div class="tc-manager-list">
<$list filter="[all{$:/config/Manager/Show}!is{$:/config/Manager/System}search{$:/config/Manager/Filter}tag:strict{$:/config/Manager/Tag}sort{$:/config/Manager/Sort}order{$:/config/Manager/Order}]">
<$vars transclusion=<<currentTiddler>>>
<div style="tc-manager-list-item">
<$button popup=<<qualify "$:/state/manager/popup">> class="tc-btn-invisible tc-manager-list-item-heading" selectedClass="tc-manager-list-item-heading-selected">
<$text text=<<currentTiddler>>/>
</$button>
<$reveal state=<<qualify "$:/state/manager/popup">> type="nomatch" text="" default="" tag="div" class="tc-manager-list-item-content tc-popup-handle">
<div class="tc-manager-list-item-content-tiddler">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/Manager/ItemMain]!has[draft.of]]" variable="listItem">
<<list-item-content-item>>
</$list>
</div>
<div class="tc-manager-list-item-content-sidebar">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/Manager/ItemSidebar]!has[draft.of]]" variable="listItem">
<<list-item-content-item>>
</$list>
</div>
</$reveal>
</div>
</$vars>
</$list>
</div>
</div>
9 changes: 9 additions & 0 deletions core/ui/Manager/ItemMainFields.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
title: $:/Manager/ItemMain/Fields
tags: $:/tags/Manager/ItemMain
caption: {{$:/language/Manager/Item/Fields}}

<table>
<tbody>
<$list filter="[all[current]fields[]sort[title]] -text" template="$:/core/ui/TiddlerFieldTemplate" variable="listItem"/>
</tbody>
</table>
5 changes: 5 additions & 0 deletions core/ui/Manager/ItemMainRawText.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
title: $:/Manager/ItemMain/RawText
tags: $:/tags/Manager/ItemMain
caption: {{$:/language/Manager/Item/RawText}}

<pre><code><$view/></code></pre>
5 changes: 5 additions & 0 deletions core/ui/Manager/ItemMainWikifiedText.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
title: $:/Manager/ItemMain/WikifiedText
tags: $:/tags/Manager/ItemMain
caption: {{$:/language/Manager/Item/WikifiedText}}

<$transclude mode="block"/>
15 changes: 15 additions & 0 deletions core/ui/Manager/ItemSidebarColour.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
title: $:/Manager/ItemSidebar/Colour
tags: $:/tags/Manager/ItemSidebar
caption: {{$:/language/Manager/Item/Colour}}

\define swatch-styles()
height: 1em;
background-color: $(colour)$
\end

<$vars colour={{!!color}}>
<p style=<<swatch-styles>>/>
</$vars>
<p>
<$edit-text field="color" tag="input" type="color"/> / <$edit-text field="color" tag="input" type="text" size="9"/>
</p>
23 changes: 23 additions & 0 deletions core/ui/Manager/ItemSidebarIcon.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
title: $:/Manager/ItemSidebar/Icon
tags: $:/tags/Manager/ItemSidebar
caption: {{$:/language/Manager/Item/Icon}}

<p>
<div class="tc-manager-icon-editor">
<$button popup=<<qualify "$:/state/popup/image-picker">> class="tc-btn-invisible">
<$transclude tiddler={{!!icon}}>
{{$:/language/Manager/Item/Icon/None}}
</$transclude>
</$button>
<div class="tc-block-dropdown-wrapper" style="position: static;">
<$reveal state=<<qualify "$:/state/popup/image-picker">> type="nomatch" text="" default="" tag="div" class="tc-popup">
<div class="tc-block-dropdown tc-popup-keep" style="width: 80%; left: 10%; right: 10%; padding: 0.5em;">
<$macrocall $name="image-picker-include-tagged-images" actions="""
<$action-setfield $field="icon" $value=<<imageTitle>>/>
<$action-deletetiddler $tiddler=<<qualify "$:/state/popup/image-picker">>/>
"""/>
</div>
</$reveal>
</div>
</div>
</p>
32 changes: 32 additions & 0 deletions core/ui/Manager/ItemSidebarTags.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
title: $:/Manager/ItemSidebar/Tags
tags: $:/tags/Manager/ItemSidebar
caption: {{$:/language/Manager/Item/Tags}}

\define tag-checkbox-actions()
<$action-listops
$tiddler="$:/config/Manager/RecentTags"
$subfilter="[<tag>] [list[$:/config/Manager/RecentTags]] +[limit[12]]"
/>
\end

\define tag-picker-actions()
<<tag-checkbox-actions>>
<$action-listops
$tiddler=<<currentTiddler>>
$field="tags"
$subfilter="[<tag>] [all[current]tags[]]"
/>
\end

<p>
<$list filter="[is[current]tags[]] [list[$:/config/Manager/RecentTags]] +[sort[title]] " variable="tag">
<div>
<$checkbox tiddler=<<currentTiddler>> tag=<<tag>> actions=<<tag-checkbox-actions>>>
<$macrocall $name="tag-pill" tag=<<tag>>/>
</$checkbox>
</div>
</$list>
</p>
<p>
<$macrocall $name="tag-picker" actions=<<tag-picker-actions>>/>
</p>
10 changes: 10 additions & 0 deletions core/ui/Manager/ItemSidebarTools.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
title: $:/Manager/ItemSidebar/Tools
tags: $:/tags/Manager/ItemSidebar
caption: {{$:/language/Manager/Item/Tools}}

<p>
<$button to=<<currentTiddler>>>{{$:/core/images/link}} open</$button>
</p>
<p>
<$button message="tm-edit-tiddler" param=<<currentTiddler>>>{{$:/core/images/edit-button}} edit</$button>
</p>
8 changes: 8 additions & 0 deletions core/ui/MoreSideBar/Plugins.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
title: $:/core/ui/MoreSideBar/Plugins
tags: $:/tags/MoreSideBar
caption: {{$:/language/ControlPanel/Plugins/Caption}}


{{$:/language/ControlPanel/Plugins/Installed/Hint}}

<<tabs "[all[shadows+tiddlers]tag[$:/tags/MoreSideBar/Plugins]!has[draft.of]]" "$:/core/ui/MoreSideBar/Plugins/Plugins">>
5 changes: 5 additions & 0 deletions core/ui/MoreSideBar/plugins/Languages.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
title: $:/core/ui/MoreSideBar/Plugins/Languages
tags: $:/tags/MoreSideBar/Plugins
caption: {{$:/language/ControlPanel/Plugins/Languages/Caption}}

<$list filter="[!has[draft.of]plugin-type[language]sort[description]]" template="$:/core/ui/PluginListItemTemplate" emptyMessage={{$:/language/ControlPanel/Plugins/Empty/Hint}}/>
5 changes: 5 additions & 0 deletions core/ui/MoreSideBar/plugins/Plugins.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
title: $:/core/ui/MoreSideBar/Plugins/Plugins
tags: $:/tags/MoreSideBar/Plugins
caption: {{$:/language/ControlPanel/Plugins/Plugins/Caption}}

<$list filter="[!has[draft.of]plugin-type[plugin]sort[description]]" template="$:/core/ui/PluginListItemTemplate" emptyMessage={{$:/language/ControlPanel/Plugins/Empty/Hint}}>>/>
5 changes: 5 additions & 0 deletions core/ui/MoreSideBar/plugins/Theme.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
title: $:/core/ui/MoreSideBar/Plugins/Theme
tags: $:/tags/MoreSideBar/Plugins
caption: {{$:/language/ControlPanel/Plugins/Themes/Caption}}

<$list filter="[!has[draft.of]plugin-type[theme]sort[description]]" template="$:/core/ui/PluginListItemTemplate" emptyMessage={{$:/language/ControlPanel/Plugins/Empty/Hint}}/>
19 changes: 19 additions & 0 deletions core/ui/PageControls/manager.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
title: $:/core/ui/Buttons/manager
tags: $:/tags/PageControls
caption: {{$:/core/images/list}} {{$:/language/Buttons/Manager/Caption}}
description: {{$:/language/Buttons/Manager/Hint}}

\define manager-button(class)
<$button to="$:/Manager" tooltip={{$:/language/Buttons/Manager/Hint}} aria-label={{$:/language/Buttons/Manager/Caption}} class="""$(tv-config-toolbar-class)$ $class$""">
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]">
{{$:/core/images/list}}
</$list>
<$list filter="[<tv-config-toolbar-text>prefix[yes]]">
<span class="tc-btn-text"><$text text={{$:/language/Buttons/Manager/Caption}}/></span>
</$list>
</$button>
\end

<$list filter="[list[$:/StoryList]] +[field:title[$:/Manager]]" emptyMessage=<<manager-button>>>
<<manager-button "tc-selected">>
</$list>
5 changes: 3 additions & 2 deletions core/ui/PageControls/new-journal.tid
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: {{$:/language/Buttons/NewJournal/Hint}}

\define journalButton()
<$button tooltip={{$:/language/Buttons/NewJournal/Hint}} aria-label={{$:/language/Buttons/NewJournal/Caption}} class=<<tv-config-toolbar-class>>>
<$action-sendmessage $message="tm-new-tiddler" title=<<now "$(journalTitleTemplate)$">> tags="$(journalTags)$"/>
<$action-sendmessage $message="tm-new-tiddler" title=<<now "$(journalTitleTemplate)$">> tags="$(journalTags)$" text="$(journalText)$"/>
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]">
{{$:/core/images/new-journal-button}}
</$list>
Expand All @@ -16,5 +16,6 @@ description: {{$:/language/Buttons/NewJournal/Hint}}
\end
<$set name="journalTitleTemplate" value={{$:/config/NewJournal/Title}}>
<$set name="journalTags" value={{$:/config/NewJournal/Tags}}>
<$set name="journalText" value={{$:/config/NewJournal/Text}}>
<<journalButton>>
</$set></$set>
</$set></$set></$set>
13 changes: 13 additions & 0 deletions core/ui/PageControls/print.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
title: $:/core/ui/Buttons/print
tags: $:/tags/PageControls
caption: {{$:/core/images/print-button}} {{$:/language/Buttons/Print/Caption}}
description: {{$:/language/Buttons/Print/Hint}}

<$button message="tm-print" tooltip={{$:/language/Buttons/Print/Hint}} aria-label={{$:/language/Buttons/Print/Caption}} class=<<tv-config-toolbar-class>>>
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]">
{{$:/core/images/print-button}}
</$list>
<$list filter="[<tv-config-toolbar-text>prefix[yes]]">
<span class="tc-btn-text"><$text text={{$:/language/Buttons/Print/Caption}}/></span>
</$list>
</$button>
27 changes: 27 additions & 0 deletions core/ui/PageControls/timestamp.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
title: $:/core/ui/Buttons/timestamp
tags: $:/tags/PageControls
caption: {{$:/core/images/timestamp-on}} {{$:/language/Buttons/Timestamp/Caption}}
description: {{$:/language/Buttons/Timestamp/Hint}}

<$reveal type="nomatch" state="$:/config/TimestampDisable" text="yes">
<$button tooltip={{$:/language/Buttons/Timestamp/On/Hint}} aria-label={{$:/language/Buttons/Timestamp/On/Caption}} class=<<tv-config-toolbar-class>>>
<$action-setfield $tiddler="$:/config/TimestampDisable" $value="yes"/>
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]">
{{$:/core/images/timestamp-on}}
</$list>
<$list filter="[<tv-config-toolbar-text>prefix[yes]]">
<span class="tc-btn-text"><$text text={{$:/language/Buttons/Timestamp/On/Caption}}/></span>
</$list>
</$button>
</$reveal>
<$reveal type="match" state="$:/config/TimestampDisable" text="yes">
<$button tooltip={{$:/language/Buttons/Timestamp/Off/Hint}} aria-label={{$:/language/Buttons/Timestamp/Off/Caption}} class=<<tv-config-toolbar-class>>>
<$action-setfield $tiddler="$:/config/TimestampDisable" $value="no"/>
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]">
{{$:/core/images/timestamp-off}}
</$list>
<$list filter="[<tv-config-toolbar-text>prefix[yes]]">
<span class="tc-btn-text"><$text text={{$:/language/Buttons/Timestamp/Off/Caption}}/></span>
</$list>
</$button>
</$reveal>
2 changes: 1 addition & 1 deletion core/ui/PageTemplate.tid
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ tc-page-container tc-page-view-$(themeTitle)$ tc-language-$(languageTitle)$

<div class=<<containerClasses>>>

<$navigator story="$:/StoryList" history="$:/HistoryList" openLinkFromInsideRiver={{$:/config/Navigation/openLinkFromInsideRiver}} openLinkFromOutsideRiver={{$:/config/Navigation/openLinkFromOutsideRiver}}>
<$navigator story="$:/StoryList" history="$:/HistoryList" openLinkFromInsideRiver={{$:/config/Navigation/openLinkFromInsideRiver}} openLinkFromOutsideRiver={{$:/config/Navigation/openLinkFromOutsideRiver}} relinkOnRename={{$:/config/RelinkOnRename}}>

<$dropzone>

Expand Down
5 changes: 5 additions & 0 deletions core/ui/PluginInfo.tid
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ $(currentTiddler)$/$(languageTitle)$/$(currentTab)$
\define info-tiddler-title()
$(currentTiddler)$/$(currentTab)$
\end
\define default-tiddler-title()
$:/core/ui/PluginInfo/Default/$(currentTab)$
\end
<$transclude tiddler=<<localised-info-tiddler-title>> mode="block">
<$transclude tiddler=<<currentTiddler>> subtiddler=<<localised-info-tiddler-title>> mode="block">
<$transclude tiddler=<<currentTiddler>> subtiddler=<<info-tiddler-title>> mode="block">
<$transclude tiddler=<<default-tiddler-title>> mode="block">
{{$:/language/ControlPanel/Plugin/NoInfoFound/Hint}}
</$transclude>
</$transclude>
</$transclude>
</$transclude>
13 changes: 13 additions & 0 deletions core/ui/PluginInfoDefaultContents.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
title: $:/core/ui/PluginInfo/Default/contents

\define lingo-base() $:/language/TiddlerInfo/Advanced/PluginInfo/
<<lingo Hint>>
<ul>
<$list filter="[all[current]plugintiddlers[]sort[title]]" emptyMessage=<<lingo Empty/Hint>>>
<li>
<$link to={{!!title}}>
<$view field="title"/>
</$link>
</li>
</$list>
</ul>
9 changes: 9 additions & 0 deletions core/ui/PluginListItemTemplate.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
title: $:/core/ui/PluginListItemTemplate

<div class="tc-menu-list-item">
<$link to={{!!title}}>
<$view field="description">
<$view field="title"/>
</$view>
</$link>
</div>
24 changes: 21 additions & 3 deletions core/ui/SideBar/Open.tid
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,28 @@ tags: $:/tags/SideBar
caption: {{$:/language/SideBar/Open/Caption}}

\define lingo-base() $:/language/CloseAll/
<$list filter="[list[$:/StoryList]]" history="$:/HistoryList" storyview="pop">

<$button message="tm-close-tiddler" tooltip={{$:/language/Buttons/Close/Hint}} aria-label={{$:/language/Buttons/Close/Caption}} class="tc-btn-invisible tc-btn-mini">&times;</$button> <$link to={{!!title}}><$view field="title"/></$link>
\define drop-actions()
<$action-listops $tiddler="$:/StoryList" $subfilter="+[insertbefore:currentTiddler<actionTiddler>]"/>
\end

<$list filter="[list[$:/StoryList]]" history="$:/HistoryList" storyview="pop">
<div style="position: relative;">
<$droppable actions=<<drop-actions>>>
<div class="tc-droppable-placeholder">
&nbsp;
</div>
<div>
<$button message="tm-close-tiddler" tooltip={{$:/language/Buttons/Close/Hint}} aria-label={{$:/language/Buttons/Close/Caption}} class="tc-btn-invisible tc-btn-mini">&times;</$button> <$link to={{!!title}}><$view field="title"/></$link>
</div>
</$droppable>
</div>
</$list>

<$tiddler tiddler="">
<$droppable actions=<<drop-actions>>>
<div class="tc-droppable-placeholder">
&nbsp;
</div>
<$button message="tm-close-all-tiddlers" class="tc-btn-invisible tc-btn-mini"><<lingo Button>></$button>
</$droppable>
</$tiddler>
9 changes: 8 additions & 1 deletion core/ui/SideBarLists.tid
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ title: $:/core/ui/SideBarLists
{{$:/core/images/close-button}}
</$button>
<$button popup=<<qualify "$:/state/popup/search-dropdown">> class="tc-btn-invisible">
{{$:/core/images/down-arrow}}
<$list filter="[{$:/temp/search}minlength{$:/config/Search/MinLength}limit[1]]" variable="listItem">
<$set name="resultCount" value="""<$count filter="[!is[system]search{$(searchTiddler)$}]"/>""">
{{$:/core/images/down-arrow}} {{$:/language/Search/Matches}}
{{$:/language/Search/Matches}}
</$set>
</$list>
</$button>
</$reveal>
<$reveal state="$:/temp/search" type="match" text="">
Expand All @@ -33,8 +36,12 @@ title: $:/core/ui/SideBarLists

<$reveal tag="div" class="tc-block-dropdown tc-search-drop-down tc-popup-handle" state=<<qualify "$:/state/popup/search-dropdown">> type="nomatch" text="" default="">

<$list filter="[{$:/temp/search}minlength{$:/config/Search/MinLength}limit[1]]" emptyMessage="""<div class="tc-search-results">{{$:/language/Search/Search/TooShort}}</div>""" variable="listItem">

{{$:/core/ui/SearchResults}}

</$list>

</$reveal>

</$reveal>
Expand Down
3 changes: 2 additions & 1 deletion core/ui/TagManager.tid
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
title: $:/TagManager
icon: $:/core/images/tag-button
color: #bbb
caption: {{$:/language/TagManager/Caption}}

\define lingo-base() $:/language/TagManager/
\define iconEditorTab(type)
Expand Down Expand Up @@ -51,7 +52,7 @@ $title$$(currentTiddler)$
<$list filter="[tags[]!is[system]sort[title]]">
<tr>
<td><$edit-text field="color" tag="input" type="color"/></td>
<td><$transclude tiddler="$:/core/ui/TagTemplate"/></td>
<td><$macrocall $name="tag" tag=<<currentTiddler>>/></td>
<td><$count filter="[all[current]tagging[]]"/></td>
<td>
<$macrocall $name="iconEditor" title={{!!title}}/>
Expand Down
31 changes: 8 additions & 23 deletions core/ui/TagTemplate.tid
Original file line number Diff line number Diff line change
@@ -1,30 +1,15 @@
title: $:/core/ui/TagTemplate

\define tag-styles()
background-color:$(backgroundColor)$;
fill:$(foregroundColor)$;
color:$(foregroundColor)$;
\end

\define tag-body-inner(colour,fallbackTarget,colourA,colourB)
<$vars foregroundColor=<<contrastcolour target:"""$colour$""" fallbackTarget:"""$fallbackTarget$""" colourA:"""$colourA$""" colourB:"""$colourB$""">> backgroundColor="""$colour$""">
<$button popup=<<qualify "$:/state/popup/tag">> class="tc-btn-invisible tc-tag-label" style=<<tag-styles>>>
<$transclude tiddler={{!!icon}}/> <$view field="title" format="text" />
</$button>
<$reveal state=<<qualify "$:/state/popup/tag">> type="popup" position="below" animate="yes" class="tc-drop-down"><$transclude tiddler="$:/core/ui/ListItemTemplate"/>
<span class="tc-tag-list-item">
<$set name="transclusion" value=<<currentTiddler>>>
<$macrocall $name="tag-pill-body" tag=<<currentTiddler>> icon={{!!icon}} colour={{!!color}} palette={{$:/palette}} element-tag="""$button""" element-attributes="""popup=<<qualify "$:/state/popup/tag">> dragFilter='[all[current]tagging[]]' tag='span'"""/>
<$reveal state=<<qualify "$:/state/popup/tag">> type="popup" position="below" animate="yes" class="tc-drop-down">
<$transclude tiddler="$:/core/ui/ListItemTemplate"/>
<$list filter="[all[shadows+tiddlers]tag[$:/tags/TagDropdown]!has[draft.of]]" variable="listItem">
<$transclude tiddler=<<listItem>>/>
</$list>
</$list>
<hr>
<$list filter="[all[current]tagging[]]" template="$:/core/ui/ListItemTemplate"/>
<$macrocall $name="list-tagged-draggable" tag=<<currentTiddler>>/>
</$reveal>
</$vars>
\end

\define tag-body(colour,palette)
<span class="tc-tag-list-item">
<$macrocall $name="tag-body-inner" colour="""$colour$""" fallbackTarget={{$palette$##tag-background}} colourA={{$palette$##foreground}} colourB={{$palette$##background}}/>
</$set>
</span>
\end

<$macrocall $name="tag-body" colour={{!!color}} palette={{$:/palette}}/>
Loading