mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-04-14 06:43:15 +00:00
Merge branch 'master' into geospatial-plugin
This commit is contained in:
commit
39daa29077
@ -72,6 +72,9 @@ function FramedEngine(options) {
|
||||
if(this.widget.editRows) {
|
||||
this.domNode.setAttribute("rows",this.widget.editRows);
|
||||
}
|
||||
if(this.widget.editDir) {
|
||||
this.domNode.setAttribute("dir",this.widget.editDir);
|
||||
}
|
||||
if(this.widget.editTabIndex) {
|
||||
this.iframeNode.setAttribute("tabindex",this.widget.editTabIndex);
|
||||
}
|
||||
@ -120,6 +123,7 @@ FramedEngine.prototype.copyStyles = function() {
|
||||
this.domNode.style["-webkit-text-fill-color"] = "currentcolor";
|
||||
// Ensure we don't force text direction to LTR
|
||||
this.domNode.style.removeProperty("direction");
|
||||
this.domNode.style.removeProperty("unicodeBidi");
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -52,6 +52,9 @@ function SimpleEngine(options) {
|
||||
if(this.widget.editTabIndex) {
|
||||
this.domNode.setAttribute("tabindex",this.widget.editTabIndex);
|
||||
}
|
||||
if(this.widget.editDir) {
|
||||
this.domNode.setAttribute("dir",this.widget.editDir);
|
||||
}
|
||||
if(this.widget.editAutoComplete) {
|
||||
this.domNode.setAttribute("autocomplete",this.widget.editAutoComplete);
|
||||
}
|
||||
|
@ -183,6 +183,7 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
|
||||
this.editFocusSelectFromStart = $tw.utils.parseNumber(this.getAttribute("focusSelectFromStart","0"));
|
||||
this.editFocusSelectFromEnd = $tw.utils.parseNumber(this.getAttribute("focusSelectFromEnd","0"));
|
||||
this.editTabIndex = this.getAttribute("tabindex");
|
||||
this.editDir = this.getAttribute("dir");
|
||||
this.editCancelPopups = this.getAttribute("cancelPopups","") === "yes";
|
||||
this.editInputActions = this.getAttribute("inputActions");
|
||||
this.editRefreshTitle = this.getAttribute("refreshTitle");
|
||||
@ -220,7 +221,7 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
|
||||
EditTextWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
// Completely rerender if any of our attributes have changed
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.placeholder || changedAttributes.size || changedAttributes.autoHeight || changedAttributes.minHeight || changedAttributes.focusPopup || changedAttributes.rows || changedAttributes.tabindex || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || changedAttributes.autocomplete || changedTiddlers[HEIGHT_MODE_TITLE] || changedTiddlers[ENABLE_TOOLBAR_TITLE] || changedTiddlers["$:/palette"] || changedAttributes.disabled || changedAttributes.fileDrop) {
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.placeholder || changedAttributes.size || changedAttributes.autoHeight || changedAttributes.minHeight || changedAttributes.focusPopup || changedAttributes.rows || changedAttributes.tabindex || changedAttributes.dir || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || changedAttributes.autocomplete || changedTiddlers[HEIGHT_MODE_TITLE] || changedTiddlers[ENABLE_TOOLBAR_TITLE] || changedTiddlers["$:/palette"] || changedAttributes.disabled || changedAttributes.fileDrop) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else if (changedTiddlers[this.editRefreshTitle]) {
|
||||
|
51
core/modules/parsers/wikiparser/rules/dir.js
Normal file
51
core/modules/parsers/wikiparser/rules/dir.js
Normal file
@ -0,0 +1,51 @@
|
||||
/*\
|
||||
title: $:/core/modules/parsers/wikiparser/rules/dir.js
|
||||
type: application/javascript
|
||||
module-type: wikirule
|
||||
|
||||
Wiki pragma rule for specifying text direction
|
||||
|
||||
```
|
||||
\dir rtl
|
||||
\dir ltr
|
||||
\dir auto
|
||||
```
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.name = "dir";
|
||||
exports.types = {pragma: true};
|
||||
|
||||
/*
|
||||
Instantiate parse rule
|
||||
*/
|
||||
exports.init = function(parser) {
|
||||
this.parser = parser;
|
||||
// Regexp to match
|
||||
this.matchRegExp = /^\\dir[^\S\n]*(\S+)\r?\n/mg;
|
||||
};
|
||||
|
||||
/*
|
||||
Parse the most recent match
|
||||
*/
|
||||
exports.parse = function() {
|
||||
var self = this;
|
||||
// Move past the pragma invocation
|
||||
this.parser.pos = this.matchRegExp.lastIndex;
|
||||
// Parse tree nodes to return
|
||||
return [{
|
||||
type: "element",
|
||||
tag: this.parser.parseAsInline ? "span" : "div",
|
||||
attributes: {
|
||||
dir: {type: "string", value: this.match[1]}
|
||||
},
|
||||
children: []
|
||||
}];
|
||||
};
|
||||
|
||||
})();
|
@ -36,6 +36,7 @@ options: see below:
|
||||
*/
|
||||
var WikiParser = function(type,text,options) {
|
||||
this.wiki = options.wiki;
|
||||
this.parseAsInline = options.parseAsInline;
|
||||
var self = this;
|
||||
// Check for an externally linked tiddler
|
||||
if($tw.browser && (text || "") === "" && options._canonical_uri) {
|
||||
|
@ -48,6 +48,7 @@ EditWidget.prototype.execute = function() {
|
||||
this.editPlaceholder = this.getAttribute("placeholder");
|
||||
this.editTabIndex = this.getAttribute("tabindex");
|
||||
this.editFocus = this.getAttribute("focus","");
|
||||
this.editDir = this.getAttribute("dir");
|
||||
this.editCancelPopups = this.getAttribute("cancelPopups","");
|
||||
this.editInputActions = this.getAttribute("inputActions");
|
||||
this.editRefreshTitle = this.getAttribute("refreshTitle");
|
||||
@ -90,7 +91,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
||||
EditWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
// Refresh if an attribute has changed, or the type associated with the target tiddler has changed
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tabindex || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || changedAttributes.autocomplete || (changedTiddlers[this.editTitle] && this.getEditorType() !== this.editorType)) {
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tabindex || changedAttributes.dir || changedAttributes.cancelPopups || changedAttributes.inputActions || changedAttributes.refreshTitle || changedAttributes.autocomplete || (changedTiddlers[this.editTitle] && this.getEditorType() !== this.editorType)) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else {
|
||||
|
@ -42,6 +42,9 @@ RevealWidget.prototype.render = function(parent,nextSibling) {
|
||||
if(this.style) {
|
||||
domNode.setAttribute("style",this.style);
|
||||
}
|
||||
if(this.direction) {
|
||||
domNode.setAttribute("dir",this.direction);
|
||||
}
|
||||
parent.insertBefore(domNode,nextSibling);
|
||||
this.renderChildren(domNode,null);
|
||||
if(!domNode.isTiddlyWikiFakeDom && this.type === "popup" && this.isOpen) {
|
||||
@ -123,6 +126,7 @@ RevealWidget.prototype.execute = function() {
|
||||
this["default"] = this.getAttribute("default","");
|
||||
this.animate = this.getAttribute("animate","no");
|
||||
this.retain = this.getAttribute("retain","no");
|
||||
this.direction = this.getAttribute("dir");
|
||||
this.openAnimation = this.animate === "no" ? undefined : "open";
|
||||
this.closeAnimation = this.animate === "no" ? undefined : "close";
|
||||
this.updatePopupPosition = this.getAttribute("updatePopupPosition","no") === "yes";
|
||||
@ -214,7 +218,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
||||
*/
|
||||
RevealWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
if(changedAttributes.state || changedAttributes.type || changedAttributes.text || changedAttributes.position || changedAttributes.positionAllowNegative || changedAttributes["default"] || changedAttributes.animate || changedAttributes.stateTitle || changedAttributes.stateField || changedAttributes.stateIndex) {
|
||||
if(changedAttributes.state || changedAttributes.type || changedAttributes.text || changedAttributes.position || changedAttributes.positionAllowNegative || changedAttributes["default"] || changedAttributes.animate || changedAttributes.stateTitle || changedAttributes.stateField || changedAttributes.stateIndex || changedAttributes.dir) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else {
|
||||
|
@ -718,23 +718,44 @@ Widget.prototype.findFirstDomNode = function() {
|
||||
};
|
||||
|
||||
/*
|
||||
Remove any DOM nodes created by this widget or its children
|
||||
Entry into destroy procedure
|
||||
*/
|
||||
Widget.prototype.destroyChildren = function() {
|
||||
$tw.utils.each(this.children,function(childWidget) {
|
||||
childWidget.destroy();
|
||||
});
|
||||
};
|
||||
/*
|
||||
Legacy entry into destroy procedure
|
||||
*/
|
||||
Widget.prototype.removeChildDomNodes = function() {
|
||||
// If this widget has directly created DOM nodes, delete them and exit. This assumes that any child widgets are contained within the created DOM nodes, which would normally be the case
|
||||
this.destroy();
|
||||
};
|
||||
/*
|
||||
Default destroy
|
||||
*/
|
||||
Widget.prototype.destroy = function() {
|
||||
// call children to remove their resources
|
||||
this.destroyChildren();
|
||||
// remove our resources
|
||||
this.children = [];
|
||||
this.removeLocalDomNodes();
|
||||
};
|
||||
|
||||
/*
|
||||
Remove any DOM nodes created by this widget
|
||||
*/
|
||||
Widget.prototype.removeLocalDomNodes = function() {
|
||||
// If this widget has directly created DOM nodes, delete them and exit.
|
||||
if(this.domNodes.length > 0) {
|
||||
$tw.utils.each(this.domNodes,function(domNode) {
|
||||
domNode.parentNode.removeChild(domNode);
|
||||
});
|
||||
this.domNodes = [];
|
||||
} else {
|
||||
// Otherwise, ask the child widgets to delete their DOM nodes
|
||||
$tw.utils.each(this.children,function(childWidget) {
|
||||
childWidget.removeChildDomNodes();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Invoke the action widgets that are descendents of the current widget.
|
||||
*/
|
||||
|
@ -12,7 +12,8 @@ tc-page-container tc-page-view-$(storyviewTitle)$ tc-language-$(languageTitle)$
|
||||
tv-config-toolbar-class={{$:/config/Toolbar/ButtonClass}}
|
||||
tv-show-missing-links={{$:/config/MissingLinks}}
|
||||
storyviewTitle={{$:/view}}
|
||||
languageTitle={{{ [{$:/language}get[name]] }}}>
|
||||
languageTitle={{{ [{$:/language}get[name]] }}}
|
||||
tv-text-direction={{$:/config/DefaultTextDirection}}>
|
||||
|
||||
<div class=<<containerClasses>>>
|
||||
|
||||
|
@ -29,6 +29,7 @@ title: $:/core/ui/EditTemplate
|
||||
data-tiddler-title=<<currentTiddler>>
|
||||
data-tags={{!!tags}}
|
||||
class={{{ [all[shadows+tiddlers]tag[$:/tags/ClassFilters/TiddlerTemplate]!is[draft]] :map:flat[subfilter{!!text}] tc-tiddler-frame tc-tiddler-edit-frame [<currentTiddler>is[tiddler]then[tc-tiddler-exists]] [<currentTiddler>is[missing]!is[shadow]then[tc-tiddler-missing]] [<currentTiddler>is[shadow]then[tc-tiddler-exists tc-tiddler-shadow]] [<currentTiddler>is[system]then[tc-tiddler-system]] [{!!class}] [<currentTiddler>tags[]encodeuricomponent[]addprefix[tc-tagged-]] +[join[ ]] }}}
|
||||
dir=<<tv-text-direction>>
|
||||
role="region"
|
||||
aria-label={{$:/language/EditTemplate/Caption}}>
|
||||
<$fieldmangler>
|
||||
|
@ -9,6 +9,7 @@ title: $:/core/ui/EditTemplate/body/editor
|
||||
placeholder={{$:/language/EditTemplate/Body/Placeholder}}
|
||||
tabindex={{$:/config/EditTabIndex}}
|
||||
focus={{{ [{$:/config/AutoFocus}match[text]then[true]] ~[[false]] }}}
|
||||
dir=<<tv-text-direction>>
|
||||
cancelPopups="yes"
|
||||
fileDrop={{{ [{$:/config/DragAndDrop/Enable}match[no]] :else[subfilter{$:/config/Editor/EnableImportFilter}then[yes]else[no]] }}}
|
||||
|
||||
|
@ -15,7 +15,7 @@ $:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$
|
||||
importState=<<qualify $:/state/ImportImage>> >
|
||||
<$dropzone importTitle=<<importTitle>> autoOpenOnImport="no" contentTypesFilter={{$:/config/Editor/ImportContentTypesFilter}} class="tc-dropzone-editor" enable={{{ [{$:/config/DragAndDrop/Enable}match[no]] :else[subfilter{$:/config/Editor/EnableImportFilter}then[yes]else[no]] }}} filesOnly="yes" actions=<<importFileActions>> >
|
||||
<$reveal stateTitle=<<edit-preview-state>> type="match" text="yes" tag="div">
|
||||
<div class="tc-tiddler-preview">
|
||||
<div class="tc-tiddler-preview" dir=<<tv-text-direction>>>
|
||||
|
||||
<$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/>
|
||||
|
||||
@ -32,7 +32,7 @@ $:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$
|
||||
</div>
|
||||
</$reveal>
|
||||
|
||||
<$reveal stateTitle=<<edit-preview-state>> type="nomatch" text="yes" tag="div">
|
||||
<$reveal stateTitle=<<edit-preview-state>> type="nomatch" text="yes" tag="div" dir=<<tv-text-direction>>>
|
||||
|
||||
<$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/>
|
||||
|
||||
|
@ -5,7 +5,7 @@ tags: $:/tags/EditTemplate
|
||||
$:/config/EditToolbarButtons/Visibility/$(listItem)$
|
||||
\end
|
||||
\whitespace trim
|
||||
<div class="tc-tiddler-title tc-tiddler-edit-title">
|
||||
<div class="tc-tiddler-title tc-tiddler-edit-title" dir=<<tv-text-direction>>>
|
||||
<$view field="title"/>
|
||||
<span class="tc-tiddler-controls tc-titlebar"><$list filter="[all[shadows+tiddlers]tag[$:/tags/EditToolbar]!has[draft.of]]" variable="listItem"><$let tv-config-toolbar-class={{{ [enlist<tv-config-toolbar-class>] [<listItem>encodeuricomponent[]addprefix[tc-btn-]] +[join[ ]]}}}><$reveal type="nomatch" state=<<config-title>> text="hide"><$transclude tiddler=<<listItem>>/></$reveal></$let></$list></span>
|
||||
<div style="clear: both;"></div>
|
||||
|
@ -74,7 +74,7 @@ $value={{{ [subfilter<get-field-value-tiddler-filter>get[text]] }}}/>
|
||||
\whitespace trim
|
||||
|
||||
<$set name="newFieldValueTiddlerPrefix" value=<<newFieldValueTiddlerPrefix>> emptyValue=<<qualify "$:/temp/NewFieldValue">> >
|
||||
<div class="tc-edit-fields">
|
||||
<div class="tc-edit-fields" dir=<<tv-text-direction>>>
|
||||
<table class={{{ [all[current]fields[]] :filter[lookup[$:/config/EditTemplateFields/Visibility/]!match[hide]] +[count[]!match[0]] +[then[tc-edit-fields]] ~[[tc-edit-fields tc-edit-fields-small]] }}}>
|
||||
<tbody>
|
||||
<$list filter="[all[current]fields[]] +[sort[title]]" variable="currentField" storyview="pop">
|
||||
@ -101,7 +101,7 @@ $value={{{ [subfilter<get-field-value-tiddler-filter>get[text]] }}}/>
|
||||
</div>
|
||||
|
||||
<$fieldmangler>
|
||||
<div class="tc-edit-field-add">
|
||||
<div class="tc-edit-field-add" dir=<<tv-text-direction>>>
|
||||
<em class="tc-edit tc-small-gap-right">
|
||||
<<lingo Fields/Add/Prompt>>
|
||||
</em>
|
||||
|
@ -14,7 +14,7 @@ tags: $:/tags/EditTemplate
|
||||
<$list filter="[all[current]shadowsource[]]" variable="pluginTitle">
|
||||
|
||||
<$set name="pluginLink" value=<<pluginLinkBody>>>
|
||||
<div class="tc-message-box">
|
||||
<div class="tc-message-box" dir=<<tv-text-direction>>>
|
||||
|
||||
<<lingo Warning>>
|
||||
|
||||
@ -29,7 +29,7 @@ tags: $:/tags/EditTemplate
|
||||
<$list filter="[all[current]shadowsource[]]" variable="pluginTitle">
|
||||
|
||||
<$set name="pluginLink" value=<<pluginLinkBody>>>
|
||||
<div class="tc-message-box">
|
||||
<div class="tc-message-box" dir=<<tv-text-direction>>>
|
||||
|
||||
<<lingo OverriddenWarning>>
|
||||
|
||||
|
@ -27,7 +27,7 @@ color:$(foregroundColor)$;
|
||||
|
||||
\define edit-tags-template(tagField:"tags")
|
||||
\whitespace trim
|
||||
<div class="tc-edit-tags">
|
||||
<div class="tc-edit-tags" dir=<<tv-text-direction>>>
|
||||
<$list filter="[list[!!$tagField$]sort[title]]" storyview="pop">
|
||||
<$macrocall $name="tag-body" colour={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerColourFilter]!is[draft]get[text]] }}} palette={{$:/palette}} icon={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerIconFilter]!is[draft]get[text]] }}} tagField=<<__tagField__>>/>
|
||||
</$list>
|
||||
|
@ -2,13 +2,13 @@ title: $:/core/ui/EditTemplate/title
|
||||
tags: $:/tags/EditTemplate
|
||||
|
||||
\whitespace trim
|
||||
<$edit-text field="draft.title" class="tc-titlebar tc-edit-texteditor" focus={{{ [{$:/config/AutoFocus}match[title]then[true]] ~[[false]] }}} tabindex={{$:/config/EditTabIndex}} cancelPopups="yes"/>
|
||||
<$edit-text field="draft.title" class="tc-titlebar tc-edit-texteditor" focus={{{ [{$:/config/AutoFocus}match[title]then[true]] ~[[false]] }}} tabindex={{$:/config/EditTabIndex}} cancelPopups="yes" dir=<<tv-text-direction>>/>
|
||||
|
||||
<$vars pattern="""[\|\[\]{}]""" bad-chars="""`| [ ] { }`""">
|
||||
|
||||
<$list filter="[all[current]regexp:draft.title<pattern>]" variable="listItem">
|
||||
|
||||
<div class="tc-message-box">
|
||||
<div class="tc-message-box" dir=<<tv-text-direction>>>
|
||||
|
||||
{{$:/core/images/warning}} {{$:/language/EditTemplate/Title/BadCharacterWarning}}
|
||||
|
||||
@ -18,7 +18,7 @@ tags: $:/tags/EditTemplate
|
||||
|
||||
</$vars>
|
||||
|
||||
<$reveal state="!!draft.title" type="nomatch" text={{!!draft.of}} tag="div">
|
||||
<$reveal state="!!draft.title" type="nomatch" text={{!!draft.of}} tag="div" dir=<<tv-text-direction>>>
|
||||
|
||||
<$list filter="[{!!draft.title}!is[missing]]" variable="listItem">
|
||||
|
||||
|
@ -9,7 +9,7 @@ first-search-filter: [all[shadows+tiddlers]prefix[$:/language/Docs/Types/]sort[d
|
||||
<div class="tc-edit-type-selector-wrapper">
|
||||
<em class="tc-edit tc-small-gap-right"><<lingo Type/Prompt>></em>
|
||||
<div class="tc-type-selector-dropdown-wrapper">
|
||||
<div class="tc-type-selector"><$fieldmangler>
|
||||
<div class="tc-type-selector" dir=<<tv-text-direction>>}><$fieldmangler>
|
||||
<$macrocall $name="keyboard-driven-input" tiddler=<<currentTiddler>> storeTitle=<<typeInputTiddler>> refreshTitle=<<refreshTitle>> selectionStateTitle=<<typeSelectionTiddler>> field="type" tag="input" default="" placeholder={{$:/language/EditTemplate/Type/Placeholder}} focusPopup=<<qualify "$:/state/popup/type-dropdown">> class="tc-edit-typeeditor tc-edit-texteditor tc-popup-handle" tabindex={{$:/config/EditTabIndex}} focus={{{ [{$:/config/AutoFocus}match[type]then[true]] ~[[false]] }}} cancelPopups="yes" configTiddlerFilter="[[$:/core/ui/EditTemplate/type]]" inputCancelActions=<<input-cancel-actions>>/><$button popup=<<qualify "$:/state/popup/type-dropdown">> class="tc-btn-invisible tc-btn-dropdown tc-small-gap" tooltip={{$:/language/EditTemplate/Type/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Type/Dropdown/Caption}}>{{$:/core/images/down-arrow}}</$button><$button message="tm-remove-field" param="type" class="tc-btn-invisible tc-btn-icon" tooltip={{$:/language/EditTemplate/Type/Delete/Hint}} aria-label={{$:/language/EditTemplate/Type/Delete/Caption}}>{{$:/core/images/delete-button}}<$action-deletetiddler $filter="[<storeTitle>] [<refreshTitle>] [<selectionStateTitle>]"/></$button>
|
||||
</$fieldmangler></div>
|
||||
|
||||
|
@ -18,7 +18,7 @@ title: $:/core/ui/EditorToolbar/link-dropdown
|
||||
|
||||
\define external-link()
|
||||
\whitespace trim
|
||||
<$button class="tc-btn-invisible" style="width: auto; display: inline-block; background-colour: inherit;" actions=<<add-link-actions>>>
|
||||
<$button class="tc-btn-invisible tc-btn-mini" style="width: auto; display: inline-block; background-colour: inherit;" actions=<<add-link-actions>>>
|
||||
{{$:/core/images/chevron-right}}
|
||||
</$button>
|
||||
\end
|
||||
@ -45,7 +45,7 @@ title: $:/core/ui/EditorToolbar/link-dropdown
|
||||
<$reveal tag="span" state=<<storeTitle>> type="nomatch" text="">
|
||||
<<external-link>>
|
||||
 
|
||||
<$button class="tc-btn-invisible" style="width: auto; display: inline-block; background-colour: inherit;">
|
||||
<$button class="tc-btn-invisible tc-btn-mini" style="width: auto; display: inline-block; background-colour: inherit;">
|
||||
<<cancel-search-actions>><$set name="cssEscapedTitle" value={{{ [<storyTiddler>escapecss[]] }}}><$action-sendmessage $message="tm-focus-selector" $param=<<get-focus-selector>>/></$set>
|
||||
{{$:/core/images/close-button}}
|
||||
</$button>
|
||||
|
@ -13,7 +13,8 @@ icon: $:/core/images/layout-button
|
||||
tv-enable-drag-and-drop={{$:/config/DragAndDrop/Enable}}
|
||||
tv-show-missing-links={{$:/config/MissingLinks}}
|
||||
storyviewTitle={{$:/view}}
|
||||
languageTitle={{{ [{$:/language}get[name]] }}}>
|
||||
languageTitle={{{ [{$:/language}get[name]] }}}
|
||||
tv-text-direction={{$:/config/DefaultTextDirection}}>
|
||||
|
||||
<div class={{{ [all[shadows+tiddlers]tag[$:/tags/ClassFilters/PageTemplate]!is[draft]] :map:flat[subfilter{!!text}] tc-page-container [[tc-page-view-]addsuffix<storyviewTitle>] [[tc-language-]addsuffix<languageTitle>] :and[unique[]join[ ]] }}} >
|
||||
|
||||
|
@ -7,7 +7,7 @@ $:/state/folded/$(currentTiddler)$
|
||||
\define cancel-delete-tiddler-actions(message) <$action-sendmessage $message="tm-$message$-tiddler"/>
|
||||
\import [all[shadows+tiddlers]tag[$:/tags/Macro/View]!is[draft]] [all[shadows+tiddlers]tag[$:/tags/Global/View]!is[draft]]
|
||||
<$vars storyTiddler=<<currentTiddler>> tiddlerInfoState=<<qualify "$:/state/popup/tiddler-info">>>
|
||||
<div data-tiddler-title=<<currentTiddler>> data-tags={{!!tags}} class={{{ [all[shadows+tiddlers]tag[$:/tags/ClassFilters/TiddlerTemplate]!is[draft]] :map:flat[subfilter{!!text}] tc-tiddler-frame tc-tiddler-view-frame [<currentTiddler>is[tiddler]then[tc-tiddler-exists]] [<currentTiddler>is[missing]!is[shadow]then[tc-tiddler-missing]] [<currentTiddler>is[shadow]then[tc-tiddler-exists tc-tiddler-shadow]] [<currentTiddler>is[shadow]is[tiddler]then[tc-tiddler-overridden-shadow]] [<currentTiddler>is[system]then[tc-tiddler-system]] [{!!class}] [<currentTiddler>tags[]encodeuricomponent[]addprefix[tc-tagged-]] +[join[ ]] }}} role="article">
|
||||
<div dir=<<tv-text-direction>> data-tiddler-title=<<currentTiddler>> data-tags={{!!tags}} class={{{ [all[shadows+tiddlers]tag[$:/tags/ClassFilters/TiddlerTemplate]!is[draft]] :map:flat[subfilter{!!text}] tc-tiddler-frame tc-tiddler-view-frame [<currentTiddler>is[tiddler]then[tc-tiddler-exists]] [<currentTiddler>is[missing]!is[shadow]then[tc-tiddler-missing]] [<currentTiddler>is[shadow]then[tc-tiddler-exists tc-tiddler-shadow]] [<currentTiddler>is[shadow]is[tiddler]then[tc-tiddler-overridden-shadow]] [<currentTiddler>is[system]then[tc-tiddler-system]] [{!!class}] [<currentTiddler>tags[]encodeuricomponent[]addprefix[tc-tagged-]] +[join[ ]] }}} role="article">
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!is[draft]]" variable="listItem">
|
||||
<$transclude tiddler=<<listItem>>/>
|
||||
</$list>
|
||||
|
@ -3,7 +3,7 @@ tags: $:/tags/ViewTemplate
|
||||
|
||||
\import [all[shadows+tiddlers]tag[$:/tags/Macro/View/Body]!is[draft]] [all[shadows+tiddlers]tag[$:/tags/Global/View/Body]!is[draft]]
|
||||
|
||||
<$reveal tag="div" class="tc-tiddler-body" type="nomatch" stateTitle=<<folded-state>> text="hide" retain="yes" animate="yes">
|
||||
<$reveal tag="div" class="tc-tiddler-body" type="nomatch" stateTitle=<<folded-state>> text="hide" retain="yes" animate="yes" dir=<<tv-text-direction>>>
|
||||
|
||||
<$transclude tiddler={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/ViewTemplateBodyFilter]!is[draft]get[text]] :and[!is[blank]else[$:/core/ui/ViewTemplate/body/default]] }}} />
|
||||
|
||||
|
@ -3,7 +3,7 @@ tags: $:/tags/ViewTemplate
|
||||
|
||||
\whitespace trim
|
||||
<$reveal type="nomatch" stateTitle=<<folded-state>> text="hide" tag="div" retain="yes" animate="yes">
|
||||
<div class="tc-subtitle">
|
||||
<div class="tc-subtitle" dir=<<tv-text-direction>>>
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate/Subtitle]!has[draft.of]]" variable="subtitleTiddler" counter="indexSubtitleTiddler">
|
||||
<$list filter="[<indexSubtitleTiddler-first>match[no]]" variable="ignore">
|
||||
|
||||
|
@ -3,5 +3,5 @@ tags: $:/tags/ViewTemplate
|
||||
|
||||
\whitespace trim
|
||||
<$reveal type="nomatch" stateTitle=<<folded-state>> text="hide" tag="div" retain="yes" animate="yes">
|
||||
<div class="tc-tags-wrapper"><$list filter="[all[current]tags[]sort[title]]" template="$:/core/ui/TagTemplate" storyview="pop"/></div>
|
||||
<div class="tc-tags-wrapper" dir=<<tv-text-direction>>><$list filter="[all[current]tags[]sort[title]]" template="$:/core/ui/TagTemplate" storyview="pop"/></div>
|
||||
</$reveal>
|
||||
|
@ -6,7 +6,7 @@ tags: $:/tags/ViewTemplate
|
||||
fill:$(foregroundColor)$;
|
||||
\end
|
||||
<div class="tc-tiddler-title">
|
||||
<div class="tc-titlebar">
|
||||
<div class="tc-titlebar" dir=<<tv-text-direction>>>
|
||||
<span class="tc-tiddler-controls">
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewToolbar]!has[draft.of]] :filter[lookup[$:/config/ViewToolbarButtons/Visibility/]!match[hide]]" storyview="pop" variable="listItem"><$set name="tv-config-toolbar-class" filter="[<tv-config-toolbar-class>] [<listItem>encodeuricomponent[]addprefix[tc-btn-]]"><$transclude tiddler=<<listItem>>/></$set></$list>
|
||||
</span>
|
||||
|
2
core/wiki/config/DefaultTextDirection.tid
Normal file
2
core/wiki/config/DefaultTextDirection.tid
Normal file
@ -0,0 +1,2 @@
|
||||
title: $:/config/DefaultTextDirection
|
||||
text: auto
|
@ -19,9 +19,9 @@ tags: $:/tags/Macro
|
||||
\define toc-body(tag,sort:"",itemClassFilter,exclude,path)
|
||||
\whitespace trim
|
||||
<ol class="tc-toc">
|
||||
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[enlist<__exclude__>]""">
|
||||
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[subfilter<__exclude__>]""">
|
||||
<$let item=<<currentTiddler>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>
|
||||
<$set name="excluded" filter="""[enlist<__exclude__>] [<__tag__>]""">
|
||||
<$set name="excluded" filter="[subfilter<__exclude__>] [<__tag__>]">
|
||||
<$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item-selected" value="toc-item">
|
||||
<li class=<<toc-item-class>>>
|
||||
<$list filter="[all[current]toc-link[no]]" emptyMessage="<$link to={{{ [<currentTiddler>get[target]else<currentTiddler>] }}}><<toc-caption>></$link>">
|
||||
@ -36,8 +36,8 @@ tags: $:/tags/Macro
|
||||
</ol>
|
||||
\end
|
||||
|
||||
\define toc(tag,sort:"",itemClassFilter:"")
|
||||
<$macrocall $name="toc-body" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> />
|
||||
\define toc(tag,sort:"",itemClassFilter:"", exclude)
|
||||
<$macrocall $name="toc-body" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<__exclude__>>/>
|
||||
\end
|
||||
|
||||
\define toc-linked-expandable-body(tag,sort:"",itemClassFilter,exclude,path)
|
||||
@ -75,7 +75,7 @@ tags: $:/tags/Macro
|
||||
<li class=<<toc-item-class>>>
|
||||
<$reveal type="nomatch" stateTitle=<<toc-state>> text="open">
|
||||
<$button setTitle=<<toc-state>> setTo="open" class="tc-btn-invisible tc-popup-keep">
|
||||
<$transclude tiddler=<<toc-closed-icon>> />
|
||||
<$transclude tiddler=<<toc-closed-icon>> />
|
||||
<<toc-caption>>
|
||||
</$button>
|
||||
</$reveal>
|
||||
@ -100,9 +100,9 @@ tags: $:/tags/Macro
|
||||
\define toc-expandable(tag,sort:"",itemClassFilter:"",exclude,path)
|
||||
\whitespace trim
|
||||
<$let tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>
|
||||
<$set name="excluded" filter="""[enlist<__exclude__>] [<__tag__>]""">
|
||||
<$set name="excluded" filter="[subfilter<__exclude__>] [<__tag__>]">
|
||||
<ol class="tc-toc toc-expandable">
|
||||
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[enlist<__exclude__>]""">
|
||||
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[subfilter<__exclude__>]""">
|
||||
<$list filter="[all[current]toc-link[no]]" emptyMessage=<<toc-expandable-empty-message>> >
|
||||
<$macrocall $name="toc-unlinked-expandable-body" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter="""itemClassFilter""" exclude=<<excluded>> path=<<path>> />
|
||||
</$list>
|
||||
@ -174,9 +174,9 @@ tags: $:/tags/Macro
|
||||
\define toc-selective-expandable(tag,sort:"",itemClassFilter,exclude,path)
|
||||
\whitespace trim
|
||||
<$let tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>
|
||||
<$set name="excluded" filter="[enlist<__exclude__>] [<__tag__>]">
|
||||
<$set name="excluded" filter="[subfilter<__exclude__>] [<__tag__>]">
|
||||
<ol class="tc-toc toc-selective-expandable">
|
||||
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[enlist<__exclude__>]""">
|
||||
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[subfilter<__exclude__>]""">
|
||||
<$list filter="[all[current]toc-link[no]]" variable="ignore" emptyMessage=<<toc-selective-expandable-empty-message>> >
|
||||
<$macrocall $name="toc-unlinked-selective-expandable-body" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<excluded>> path=<<path>>/>
|
||||
</$list>
|
||||
@ -186,13 +186,13 @@ tags: $:/tags/Macro
|
||||
</$let>
|
||||
\end
|
||||
|
||||
\define toc-tabbed-external-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText,missingText,template:"")
|
||||
\define toc-tabbed-external-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText,missingText,template:"",exclude)
|
||||
\whitespace trim
|
||||
<$tiddler tiddler={{{ [<__selectedTiddler__>get[text]] }}}>
|
||||
<div class="tc-tabbed-table-of-contents">
|
||||
<$linkcatcher to=<<__selectedTiddler__>>>
|
||||
<div class="tc-table-of-contents">
|
||||
<$macrocall $name="toc-selective-expandable" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter="[all[current]] -[<__selectedTiddler__>get[text]]"/>
|
||||
<$macrocall $name="toc-selective-expandable" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter="[all[current]] -[<__selectedTiddler__>get[text]]" exclude=<<__exclude__>>/>
|
||||
</div>
|
||||
</$linkcatcher>
|
||||
<div class="tc-tabbed-table-of-contents-content">
|
||||
@ -210,9 +210,9 @@ tags: $:/tags/Macro
|
||||
</$tiddler>
|
||||
\end
|
||||
|
||||
\define toc-tabbed-internal-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText,missingText,template:"")
|
||||
\define toc-tabbed-internal-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText,missingText,template:"",exclude)
|
||||
\whitespace trim
|
||||
<$linkcatcher to=<<__selectedTiddler__>>>
|
||||
<$macrocall $name="toc-tabbed-external-nav" tag=<<__tag__>> sort=<<__sort__>> selectedTiddler=<<__selectedTiddler__>> unselectedText=<<__unselectedText__>> missingText=<<__missingText__>> template=<<__template__>>/>
|
||||
<$macrocall $name="toc-tabbed-external-nav" tag=<<__tag__>> sort=<<__sort__>> selectedTiddler=<<__selectedTiddler__>> unselectedText=<<__unselectedText__>> missingText=<<__missingText__>> template=<<__template__>> exclude=<<__exclude__>> />
|
||||
</$linkcatcher>
|
||||
\end
|
||||
|
36
editions/dev/tiddlers/Widget `destroy` method examples.tid
Normal file
36
editions/dev/tiddlers/Widget `destroy` method examples.tid
Normal file
@ -0,0 +1,36 @@
|
||||
created: 20230601123245916
|
||||
modified: 20230601125015463
|
||||
title: Widget `destroy` method examples
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
!! When using a v-dom library
|
||||
|
||||
Virtual DOM libraries manages its internal state and apply state to DOM periodically, this is so called [["controlled" component|https://react.dev/learn/sharing-state-between-components#controlled-and-uncontrolled-components]]. When Tiddlywiki remove a DOM element controlled by a v-dom library, it may throws error.
|
||||
|
||||
So when creating a plugin providing v-dom library binding, you need to tell v-dom library (for example, React.js) the DOM element is removed. We will use `destroy` method for this.
|
||||
|
||||
```js
|
||||
render() {
|
||||
// ...other render related code
|
||||
if (this.root === undefined || this.containerElement === undefined) {
|
||||
// initialize the v-dom library
|
||||
this.root = ReactDom.createRoot(document.createElement('div'));
|
||||
}
|
||||
}
|
||||
|
||||
destroy() {
|
||||
// end the lifecycle of v-dom library
|
||||
this.root && this.root.unmount();
|
||||
}
|
||||
```
|
||||
|
||||
The `destroy` method will be called by parent widget. If you widget don't have any child widget, you can just write your own tear down logic. If it may have some child widget, don't forget to call original `destroy` method in the `Widget` class to destroy children widgets.
|
||||
|
||||
```js
|
||||
Widget.prototype.destroy();
|
||||
this.root && this.root.unmount();
|
||||
/** if you are using ESNext
|
||||
super.destroy();
|
||||
this.root?.unmount();
|
||||
*/
|
||||
```
|
@ -1,7 +1,8 @@
|
||||
title: WidgetModules
|
||||
created: 20131101130700000
|
||||
modified: 20230601130631884
|
||||
tags: dev moduletypes
|
||||
created: 201311011307
|
||||
modified: 201311011307
|
||||
title: WidgetModules
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
! Introduction
|
||||
|
||||
@ -78,4 +79,10 @@ The individual methods defined by the widget object are documented in the source
|
||||
!! Widget `refreshChildren` method
|
||||
!! Widget `findNextSiblingDomNode` method
|
||||
!! Widget `findFirstDomNode` method
|
||||
!! Widget `destroy` method
|
||||
|
||||
<<.from-version "5.3.0">> Gets called when any parent widget is unmounted from the widget tree.
|
||||
|
||||
[[Examples|Widget `destroy` method examples]]
|
||||
|
||||
!! Widget `removeChildDomNodes` method
|
||||
|
40
editions/dev/tiddlers/system/doc-styles.tid
Normal file
40
editions/dev/tiddlers/system/doc-styles.tid
Normal file
@ -0,0 +1,40 @@
|
||||
created: 20150117152612000
|
||||
modified: 20230325101137075
|
||||
tags: $:/tags/Stylesheet
|
||||
title: $:/editions/tw5.com/doc-styles
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
a.doc-from-version.tc-tiddlylink {
|
||||
display: inline-block;
|
||||
border-radius: 1em;
|
||||
background: <<colour muted-foreground>>;
|
||||
color: <<colour background>>;
|
||||
fill: <<colour background>>;
|
||||
padding: 0 0.4em;
|
||||
font-size: 0.7em;
|
||||
text-transform: uppercase;
|
||||
font-weight: bold;
|
||||
line-height: 1.5;
|
||||
vertical-align: text-bottom;
|
||||
}
|
||||
|
||||
a.doc-deprecated-version.tc-tiddlylink {
|
||||
display: inline-block;
|
||||
border-radius: 1em;
|
||||
background: red;
|
||||
color: <<colour background>>;
|
||||
fill: <<colour background>>;
|
||||
padding: 0 0.4em;
|
||||
font-size: 0.7em;
|
||||
text-transform: uppercase;
|
||||
font-weight: bold;
|
||||
line-height: 1.5;
|
||||
vertical-align: text-bottom;
|
||||
}
|
||||
|
||||
.doc-deprecated-version svg,
|
||||
.doc-from-version svg {
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
vertical-align: text-bottom;
|
||||
}
|
14
editions/dev/tiddlers/system/version-macros.tid
Normal file
14
editions/dev/tiddlers/system/version-macros.tid
Normal file
@ -0,0 +1,14 @@
|
||||
code-body: yes
|
||||
created: 20161008085627406
|
||||
modified: 20221007122259593
|
||||
tags: $:/tags/Macro
|
||||
title: $:/editions/tw5.com/version-macros
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
\define .from-version(version)
|
||||
<$link to={{{ [<__version__>addprefix[Release ]] }}} class="doc-from-version">{{$:/core/images/warning}} New in: <$text text=<<__version__>>/></$link>
|
||||
\end
|
||||
|
||||
\define .deprecated-since(version, superseded:"TODO-Link")
|
||||
<$link to="Deprecated - What does it mean" class="doc-deprecated-version tc-btn-invisible">{{$:/core/images/warning}} Deprecated since: <$text text=<<__version__>>/></$link> (see <$link to=<<__superseded__>>><$text text=<<__superseded__>>/></$link>)
|
||||
\end
|
11
editions/tw5.com/tiddlers/Right-To-Left Languages.tid
Normal file
11
editions/tw5.com/tiddlers/Right-To-Left Languages.tid
Normal file
@ -0,0 +1,11 @@
|
||||
created: 20230613162508509
|
||||
modified: 20230613162508509
|
||||
title: Right-To-Left Languages
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.from-version "5.3.0">> The [[language plugins|Languages]] in TiddlyWiki's plugin library apply the appropriate [["right-to-left" setting|https://www.w3.org/International/questions/qa-html-dir]] to the entire document. To set the right to left setting independently for an individual tiddler, use the `\dir` [[pragma|Pragma]] at the top of the tiddler:
|
||||
|
||||
```
|
||||
\dir rtl
|
||||
This text will be displayed with right-to-left formatting
|
||||
```
|
@ -1,5 +1,5 @@
|
||||
created: 20140919155729620
|
||||
modified: 20220819093733569
|
||||
modified: 20230427125500432
|
||||
tags: Macros [[Core Macros]]
|
||||
title: Table-of-Contents Macros
|
||||
type: text/vnd.tiddlywiki
|
||||
@ -53,15 +53,21 @@ These two parameters are combined into a single [[filter expression|Filter Expre
|
||||
|
||||
<<.var toc-tabbed-internal-nav>> and <<.var toc-tabbed-external-nav>> take additional parameters:
|
||||
|
||||
;selectedTiddler
|
||||
; selectedTiddler
|
||||
: The title of the [[state tiddler|StateMechanism]] for noting the currently selected tiddler, defaulting to `$:/temp/toc/selectedTiddler`. It is recommended that this be a [[system tiddler|SystemTiddlers]]
|
||||
;unselectedText
|
||||
|
||||
; unselectedText
|
||||
: The text to display when no tiddler is selected in the tree
|
||||
;missingText
|
||||
|
||||
; missingText
|
||||
: The text to display if the selected tiddler doesn't exist
|
||||
;template
|
||||
|
||||
; template
|
||||
: Optionally, the title of a tiddler to use as a [[template|TemplateTiddlers]] for transcluding the selected tiddler into the right-hand panel
|
||||
|
||||
; exclude <<.from-version "5.3.0">>
|
||||
: This optional parameter can be used to exclude tiddlers from the TOC list. It allows a [[Title List]] or a <<.olink subfilter>>. Eg: `exclude:"HelloThere [[Title with spaces]]"` or `exclude:"[has[excludeTOC]]"`. Where the former will exclude two tiddlers and the later would exclude every tiddler that has a field <<.field excludeTOC>> independent of its value.<br>''Be aware'' that eg: `[prefix[H]]` is a shortcut for `[all[tiddlers]prefix[H]]`, which can have a performance impact, if used carelessly. So use $:/AdvancedSearch -> ''Filters'' tab to test the <<.param exclude>> parameter
|
||||
|
||||
!! Custom Icons
|
||||
|
||||
<<.from-version "5.2.4">>
|
||||
|
13
editions/tw5.com/tiddlers/pragmas/Pragma_ _dir.tid
Normal file
13
editions/tw5.com/tiddlers/pragmas/Pragma_ _dir.tid
Normal file
@ -0,0 +1,13 @@
|
||||
created: 20230613162508509
|
||||
modified: 20230613162508509
|
||||
tags: Pragmas
|
||||
title: Pragma: \dir
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.from-version "5.3.0">> The ''\dir'' [[pragma|Pragmas]] is used to set the text direction of text within a tiddler -- see [[Right-To-Left Languages]].
|
||||
|
||||
The ''\dir'' pragma should be used after any procedure, function, widget or macro definitions.
|
||||
|
||||
* `\dir ltr` – sets text direction to left-to-right
|
||||
* `\dir rtl` – sets text direction to right-to-left
|
||||
* `\dir auto` – causes the browser to attempt to automatically deduce the text direction
|
@ -67,6 +67,8 @@ More/Caption: 更多
|
||||
More/Hint: 更多操作
|
||||
NewHere/Caption: 添加子条目
|
||||
NewHere/Hint: 创建一个标签为此条目名称的新条目
|
||||
NetworkActivity/Caption: 网络活动
|
||||
NetworkActivity/Hint: 取消所有网络活动
|
||||
NewJournal/Caption: 添加日志
|
||||
NewJournal/Hint: 创建一个新的日志条目
|
||||
NewJournalHere/Caption: 添加子日志
|
||||
|
@ -67,6 +67,8 @@ More/Caption: 更多
|
||||
More/Hint: 更多動作
|
||||
NewHere/Caption: 新增子條目
|
||||
NewHere/Hint: 建立一個標籤為此條目名稱的新條目
|
||||
NetworkActivity/Caption: 網路活動
|
||||
NetworkActivity/Hint: 取消所有網路活動
|
||||
NewJournal/Caption: 新增日誌
|
||||
NewJournal/Hint: 建立一個新的日誌條目
|
||||
NewJournalHere/Caption: 新增子日誌
|
||||
|
@ -28,6 +28,16 @@ This setting allows a custom alert message to be displayed when an attempt to st
|
||||
|
||||
<$link to="$:/config/BrowserStorage/QuotaExceededAlert">Quota Exceeded Alert</$link>: <$edit-text tiddler="$:/config/BrowserStorage/QuotaExceededAlert" default="" tag="input" size="50"/>
|
||||
|
||||
! Prevent browser from evicting local storage
|
||||
|
||||
Permission for local storage persistence: ''{{$:/info/browser/storage/persisted}}''
|
||||
|
||||
The first time a tiddler is saved to local storage a request will be made to prevent automatic eviction of local storage for this site. This means the data will not be cleared unless the user manually clears it.
|
||||
|
||||
Old browsers may not support this feature. New browsers might not support the feature if the wiki is hosted on a non-localhost unencrypted http connection.
|
||||
|
||||
Some browsers will explicitly prompt the user for permission. Other browsers may automatically grant or deny the request based on site usage or based on whether the site is bookmarked.
|
||||
|
||||
! Startup Log
|
||||
|
||||
The tiddler $:/temp/BrowserStorage/Log contains a log of the tiddlers that were loaded from local storage at startup:
|
||||
|
@ -19,7 +19,8 @@ exports.after = ["startup"];
|
||||
exports.synchronous = true;
|
||||
|
||||
var ENABLED_TITLE = "$:/config/BrowserStorage/Enabled",
|
||||
SAVE_FILTER_TITLE = "$:/config/BrowserStorage/SaveFilter";
|
||||
SAVE_FILTER_TITLE = "$:/config/BrowserStorage/SaveFilter",
|
||||
PERSISTED_STATE_TITLE = "$:/info/browser/storage/persisted";
|
||||
|
||||
var BrowserStorageUtil = require("$:/plugins/tiddlywiki/browser-storage/util.js").BrowserStorageUtil;
|
||||
|
||||
@ -53,6 +54,48 @@ exports.startup = function() {
|
||||
$tw.wiki.addTiddler({title: ENABLED_TITLE, text: "no"});
|
||||
$tw.browserStorage.clearLocalStorage();
|
||||
});
|
||||
// Helpers for protecting storage from eviction
|
||||
var setPersistedState = function(state) {
|
||||
$tw.wiki.addTiddler({title: PERSISTED_STATE_TITLE, text: state});
|
||||
},
|
||||
requestPersistence = function() {
|
||||
setPersistedState("requested");
|
||||
navigator.storage.persist().then(function(persisted) {
|
||||
console.log("Request for persisted storage " + (persisted ? "granted" : "denied"));
|
||||
setPersistedState(persisted ? "granted" : "denied");
|
||||
});
|
||||
},
|
||||
persistPermissionRequested = false,
|
||||
requestPersistenceOnFirstSave = function() {
|
||||
$tw.hooks.addHook("th-saving-tiddler", function(tiddler) {
|
||||
if (!persistPermissionRequested) {
|
||||
var filteredChanges = filterFn.call($tw.wiki, function(iterator) {
|
||||
iterator(tiddler,tiddler.getFieldString("title"));
|
||||
});
|
||||
if (filteredChanges.length > 0) {
|
||||
// The tiddler will be saved to local storage, so request persistence
|
||||
requestPersistence();
|
||||
persistPermissionRequested = true;
|
||||
}
|
||||
}
|
||||
return tiddler;
|
||||
});
|
||||
};
|
||||
// Request the browser to never evict the localstorage. Some browsers such as firefox
|
||||
// will prompt the user. To make the decision easier for the user only prompt them
|
||||
// when they click the save button on a tiddler which will be stored to localstorage.
|
||||
if (navigator.storage && navigator.storage.persist) {
|
||||
navigator.storage.persisted().then(function(isPersisted) {
|
||||
if (!isPersisted) {
|
||||
setPersistedState("not requested yet");
|
||||
requestPersistenceOnFirstSave();
|
||||
} else {
|
||||
setPersistedState("granted");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
setPersistedState("feature not available");
|
||||
}
|
||||
// Track tiddler changes
|
||||
$tw.wiki.addEventListener("change",function(changes) {
|
||||
// Bail if browser storage is disabled
|
||||
@ -76,6 +119,10 @@ exports.startup = function() {
|
||||
if(title === ENABLED_TITLE) {
|
||||
return;
|
||||
}
|
||||
// This should always be queried from the browser, so don't store it in local storage
|
||||
if(title === PERSISTED_STATE_TITLE) {
|
||||
return;
|
||||
}
|
||||
// Save the tiddler
|
||||
$tw.browserStorage.saveTiddlerToLocalStorage(title);
|
||||
});
|
||||
|
@ -109,6 +109,9 @@ function CodeMirrorEngine(options) {
|
||||
if(this.widget.editTabIndex) {
|
||||
config["tabindex"] = this.widget.editTabIndex;
|
||||
}
|
||||
if(this.widget.editDir) {
|
||||
config.direction = this.widget.editDir;
|
||||
}
|
||||
config.editWidget = this.widget;
|
||||
// Create the CodeMirror instance
|
||||
this.cm = window.CodeMirror(function(cmDomNode) {
|
||||
|
@ -1388,9 +1388,8 @@ html body.tc-body.tc-single-tiddler-window {
|
||||
height: 1.2em;
|
||||
}
|
||||
|
||||
.tc-editor-toolbar .tc-drop-down a,
|
||||
.tc-editor-toolbar .tc-drop-down button {
|
||||
padding: 0;
|
||||
.tc-editor-toolbar .tc-drop-down button.tc-btn-mini {
|
||||
padding: 2px 4px;
|
||||
}
|
||||
|
||||
.tc-editor-toolbar button:hover {
|
||||
|
Loading…
x
Reference in New Issue
Block a user