diff --git a/boot/boot.js b/boot/boot.js index 260604f95..8783779f0 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -643,9 +643,25 @@ $tw.utils.Crypto = function() { Execute the module named 'moduleName'. The name can optionally be relative to the module named 'moduleRoot' */ $tw.modules.execute = function(moduleName,moduleRoot) { - var name = moduleName[0] === "." ? $tw.utils.resolvePath(moduleName,moduleRoot) : moduleName, - moduleInfo = $tw.modules.titles[name] || $tw.modules.titles[name + ".js"] || $tw.modules.titles[moduleName] || $tw.modules.titles[moduleName + ".js"] , - tiddler = $tw.wiki.getTiddler(name) || $tw.wiki.getTiddler(name + ".js") || $tw.wiki.getTiddler(moduleName) || $tw.wiki.getTiddler(moduleName + ".js") , + var name = moduleName; + if(moduleName.charAt(0) === ".") { + name = $tw.utils.resolvePath(moduleName,moduleRoot) + } + if(!$tw.modules.titles[name]) { + if($tw.modules.titles[name + ".js"]) { + name = name + ".js"; + } else if($tw.modules.titles[name + "/index.js"]) { + name = name + "/index.js"; + } else if($tw.modules.titles[moduleName]) { + name = moduleName; + } else if($tw.modules.titles[moduleName + ".js"]) { + name = moduleName + ".js"; + } else if($tw.modules.titles[moduleName + "/index.js"]) { + name = moduleName + "/index.js"; + } + } + var moduleInfo = $tw.modules.titles[name], + tiddler = $tw.wiki.getTiddler(name), _exports = {}, sandbox = { module: {exports: _exports}, diff --git a/core/images/timestamp-off.tid b/core/images/timestamp-off.tid new file mode 100644 index 000000000..62103ec27 --- /dev/null +++ b/core/images/timestamp-off.tid @@ -0,0 +1,12 @@ +title: $:/core/images/timestamp-off +tags: $:/tags/Image + + + + + + + + + + \ No newline at end of file diff --git a/core/images/timestamp-on.tid b/core/images/timestamp-on.tid new file mode 100644 index 000000000..450fb3636 --- /dev/null +++ b/core/images/timestamp-on.tid @@ -0,0 +1,12 @@ +title: $:/core/images/timestamp-on +tags: $:/tags/Image + + + + + + + + + + \ No newline at end of file diff --git a/core/language/en-GB/Buttons.multids b/core/language/en-GB/Buttons.multids index 412e35f8f..3a8f21969 100644 --- a/core/language/en-GB/Buttons.multids +++ b/core/language/en-GB/Buttons.multids @@ -92,6 +92,12 @@ ShowSideBar/Caption: show sidebar ShowSideBar/Hint: Show sidebar TagManager/Caption: tag manager TagManager/Hint: Open tag manager +Timestamp/Caption: timestamps +Timestamp/Hint: Choose whether modifications update timestamps +Timestamp/On/Caption: timestamps are on +Timestamp/On/Hint: Update timestamps when tiddlers are modified +Timestamp/Off/Caption: timestamps are off +Timestamp/Off/Hint: Don't update timestamps when tiddlers are modified Theme/Caption: theme Theme/Hint: Choose the display theme Bold/Caption: bold diff --git a/core/language/en-GB/ControlPanel.multids b/core/language/en-GB/ControlPanel.multids index 5204d62aa..f94319c53 100644 --- a/core/language/en-GB/ControlPanel.multids +++ b/core/language/en-GB/ControlPanel.multids @@ -103,6 +103,10 @@ Settings/Caption: Settings Settings/EditorToolbar/Caption: Editor Toolbar Settings/EditorToolbar/Hint: Enable or disable the editor toolbar: Settings/EditorToolbar/Description: Show editor toolbar +Settings/InfoPanelMode/Caption: Tiddler Info Panel Mode +Settings/InfoPanelMode/Hint: Control when the tiddler info panel closes: +Settings/InfoPanelMode/Popup/Description: Tiddler info panel closes automatically +Settings/InfoPanelMode/Sticky/Description: Tiddler info panel stays open until explicitly closed Settings/Hint: These settings let you customise the behaviour of TiddlyWiki. Settings/NavigationAddressBar/Caption: Navigation Address Bar Settings/NavigationAddressBar/Hint: Behaviour of the browser address bar when navigating to a tiddler: diff --git a/core/modules/utils/fakedom.js b/core/modules/utils/fakedom.js index 85f57a503..5175cebc5 100755 --- a/core/modules/utils/fakedom.js +++ b/core/modules/utils/fakedom.js @@ -23,7 +23,7 @@ var bumpSequenceNumber = function(object) { var TW_TextNode = function(text) { bumpSequenceNumber(this); - this.textContent = text; + this.textContent = text + ""; }; Object.defineProperty(TW_TextNode.prototype, "nodeType", { @@ -66,7 +66,7 @@ TW_Element.prototype.setAttribute = function(name,value) { if(this.isRaw) { throw "Cannot setAttribute on a raw TW_Element"; } - this.attributes[name] = value; + this.attributes[name] = value + ""; }; TW_Element.prototype.setAttributeNS = function(namespace,name,value) { @@ -139,7 +139,7 @@ Object.defineProperty(TW_Element.prototype, "className", { return this.attributes["class"] || ""; }, set: function(value) { - this.attributes["class"] = value; + this.attributes["class"] = value + ""; } }); @@ -148,7 +148,7 @@ Object.defineProperty(TW_Element.prototype, "value", { return this.attributes.value || ""; }, set: function(value) { - this.attributes.value = value; + this.attributes.value = value + ""; } }); diff --git a/core/modules/widgets/checkbox.js b/core/modules/widgets/checkbox.js index 6ec2b0372..2480ff319 100644 --- a/core/modules/widgets/checkbox.js +++ b/core/modules/widgets/checkbox.js @@ -127,6 +127,10 @@ CheckboxWidget.prototype.handleChangeEvent = function(event) { if(hasChanged) { 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); + } }; /* @@ -134,6 +138,7 @@ 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"); diff --git a/core/modules/wiki.js b/core/modules/wiki.js index 63e31303c..9eed1b5f1 100755 --- a/core/modules/wiki.js +++ b/core/modules/wiki.js @@ -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: @@ -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; }; /* diff --git a/core/ui/ControlPanel/Settings/InfoPanelMode.tid b/core/ui/ControlPanel/Settings/InfoPanelMode.tid new file mode 100644 index 000000000..371b6d61b --- /dev/null +++ b/core/ui/ControlPanel/Settings/InfoPanelMode.tid @@ -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"><> + +<$radio tiddler="$:/config/TiddlerInfo/Mode" value="popup"> <> + +<$radio tiddler="$:/config/TiddlerInfo/Mode" value="sticky"> <> diff --git a/core/ui/PageControls/timestamp.tid b/core/ui/PageControls/timestamp.tid new file mode 100644 index 000000000..28cfbd74e --- /dev/null +++ b/core/ui/PageControls/timestamp.tid @@ -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=<>> +<$action-setfield $tiddler="$:/config/TimestampDisable" $value="yes"/> +<$list filter="[prefix[yes]]"> +{{$:/core/images/timestamp-on}} + +<$list filter="[prefix[yes]]"> +<$text text={{$:/language/Buttons/Timestamp/On/Caption}}/> + + + +<$reveal type="match" state="$:/config/TimestampDisable" text="yes"> +<$button tooltip={{$:/language/Buttons/Timestamp/Off/Hint}} aria-label={{$:/language/Buttons/Timestamp/Off/Caption}} class=<>> +<$action-setfield $tiddler="$:/config/TimestampDisable" $value="no"/> +<$list filter="[prefix[yes]]"> +{{$:/core/images/timestamp-off}} + +<$list filter="[prefix[yes]]"> +<$text text={{$:/language/Buttons/Timestamp/Off/Caption}}/> + + + \ No newline at end of file diff --git a/core/ui/TiddlerInfo.tid b/core/ui/TiddlerInfo.tid index 3e51e4855..f7447fea1 100644 --- a/core/ui/TiddlerInfo.tid +++ b/core/ui/TiddlerInfo.tid @@ -1,3 +1,13 @@ title: $:/core/ui/TiddlerInfo +
+
+<$reveal state="$:/config/TiddlerInfo/Mode" type="match" text="sticky"> +<$button set=<> setTo="" tooltip={{$:/language/Buttons/Info/Hint}} aria-label={{$:/language/Buttons/Info/Caption}} class="tc-btn-invisible"> +{{$:/core/images/close-button}} + + +
+
+ <$macrocall $name="tabs" tabsList="[all[shadows+tiddlers]tag[$:/tags/TiddlerInfo]!has[draft.of]]" default={{$:/config/TiddlerInfo/Default}}/> \ No newline at end of file diff --git a/core/ui/ViewToolbar/info.tid b/core/ui/ViewToolbar/info.tid index f6f40860f..5eb6cd2d4 100644 --- a/core/ui/ViewToolbar/info.tid +++ b/core/ui/ViewToolbar/info.tid @@ -3,11 +3,28 @@ tags: $:/tags/ViewToolbar caption: {{$:/core/images/info-button}} {{$:/language/Buttons/Info/Caption}} description: {{$:/language/Buttons/Info/Hint}} -<$button popup=<> tooltip={{$:/language/Buttons/Info/Hint}} aria-label={{$:/language/Buttons/Info/Caption}} class=<> selectedClass="tc-selected"> +\define button-content() <$list filter="[prefix[yes]]"> {{$:/core/images/info-button}} <$list filter="[prefix[yes]]"> <$text text={{$:/language/Buttons/Info/Caption}}/> - \ No newline at end of file +\end +<$reveal state="$:/config/TiddlerInfo/Mode" type="match" text="popup"> +<$button popup=<> tooltip={{$:/language/Buttons/Info/Hint}} aria-label={{$:/language/Buttons/Info/Caption}} class=<> selectedClass="tc-selected"> +<$macrocall $name="button-content" mode="inline"/> + + +<$reveal state="$:/config/TiddlerInfo/Mode" type="match" text="sticky"> +<$reveal state=<> type="match" text="" default=""> +<$button set=<> setTo="yes" tooltip={{$:/language/Buttons/Info/Hint}} aria-label={{$:/language/Buttons/Info/Caption}} class=<> selectedClass="tc-selected"> +<$macrocall $name="button-content" mode="inline"/> + + +<$reveal state=<> type="nomatch" text="" default=""> +<$button set=<> setTo="" tooltip={{$:/language/Buttons/Info/Hint}} aria-label={{$:/language/Buttons/Info/Caption}} class=<> selectedClass="tc-selected"> +<$macrocall $name="button-content" mode="inline"/> + + + \ No newline at end of file diff --git a/core/wiki/config/PageControlButtons.multids b/core/wiki/config/PageControlButtons.multids index 9086e8f18..7ad91db29 100644 --- a/core/wiki/config/PageControlButtons.multids +++ b/core/wiki/config/PageControlButtons.multids @@ -18,5 +18,6 @@ core/ui/Buttons/palette: hide core/ui/Buttons/permaview: hide core/ui/Buttons/print: hide core/ui/Buttons/storyview: hide +core/ui/Buttons/timestamp: hide core/ui/Buttons/theme: hide core/ui/Buttons/unfold-all: hide diff --git a/core/wiki/config/TiddlerInfoMode.tid b/core/wiki/config/TiddlerInfoMode.tid new file mode 100644 index 000000000..80947122b --- /dev/null +++ b/core/wiki/config/TiddlerInfoMode.tid @@ -0,0 +1,2 @@ +title: $:/config/TiddlerInfo/Mode +text: popup \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/system/doc-styles.tid b/editions/tw5.com/tiddlers/system/doc-styles.tid index 4d85a378a..c7e645445 100644 --- a/editions/tw5.com/tiddlers/system/doc-styles.tid +++ b/editions/tw5.com/tiddlers/system/doc-styles.tid @@ -163,9 +163,22 @@ tr.doc-table-subheading { } .doc-from-version { - display: inline-block; + display: inline-block; border: 2px solid <>; - border-radius: 0.5em; + border-radius: 1em; background: <>; padding: 0 0.4em; + font-size: 0.7em; + text-transform: uppercase; + font-weight: bold; + line-height: 1.5; + vertical-align: text-bottom; } + +.doc-from-version svg { + width: 1em; + height: 1em; + vertical-align: text-bottom; +} + + diff --git a/editions/tw5.com/tiddlers/system/theme.tid b/editions/tw5.com/tiddlers/system/theme.tid index 3952c26b3..58690c397 100644 --- a/editions/tw5.com/tiddlers/system/theme.tid +++ b/editions/tw5.com/tiddlers/system/theme.tid @@ -1,3 +1,3 @@ title: $:/theme -$:/themes/tiddlywiki/heavier \ No newline at end of file +$:/themes/tiddlywiki/snowwhite \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/system/version-macros.tid b/editions/tw5.com/tiddlers/system/version-macros.tid index cc328887e..5e0522cfc 100644 --- a/editions/tw5.com/tiddlers/system/version-macros.tid +++ b/editions/tw5.com/tiddlers/system/version-macros.tid @@ -4,5 +4,5 @@ title: $:/editions/tw5.com/version-macros tags: $:/tags/Macro \define .from-version(version) -New in $version$ +{{$:/core/images/warning}} New in $version$ \end diff --git a/editions/tw5.com/tiddlers/widgets/CheckboxWidget.tid b/editions/tw5.com/tiddlers/widgets/CheckboxWidget.tid index edde1467d..f9cb77d53 100644 --- a/editions/tw5.com/tiddlers/widgets/CheckboxWidget.tid +++ b/editions/tw5.com/tiddlers/widgets/CheckboxWidget.tid @@ -1,6 +1,6 @@ caption: checkbox created: 20131024141900000 -modified: 20150626091305445 +modified: 20161126081845399 tags: Widgets title: CheckboxWidget type: text/vnd.tiddlywiki @@ -25,6 +25,7 @@ The content of the `<$checkbox>` widget is displayed within an HTML `