By almost entirely eliminating text subsitution, we can avoid the situations where special characters in tags or titles gets the macro confused.
These are quite intricate changes, and so I'd appreciate any help reviewing and testing, many thanks.
Fixes#3427
It's a bit gross that we have to change the filename used to reference the JS file. This is to make it work with the webserver.
At the moment, the webserver exposes system tiddlers as plain text renderings, and ordinary tiddlers as full HTML renderings through a view template. So we have to use a system tiddler title for the JS file.
The workaround I'm thinking of is to remove the blanket exposure of system tiddlers, and instead have a list of system tiddlers that are specifically exposed through a namespace like `127.0.0.1:8080\lib\tiddlywiki.js`. That can't clash with a tiddler title because tiddler titles are URI encoded and so can't contain slashes.
* Explore externalising TiddlyWiki's JS core into a separate file
* Fix missing newline after copyright notice
* Add an error alert if tiddlywiki.js can't be loaded
Makes things a bit easier to follow when working in multiuser environments.
@inmysocks, @danielo515, @arlen22, @pmario, @drakor does this make sense for your use cases?
* Module-ize server routes and add static file support (#2510)
* Refactor server routes to modules
New module type: serverroute
Caveats: Loading order is not deterministic but this would only matter
if two route modules attempted to use the same path regexp (that would
be silly).
* Add static assets plugin
This plugin allows the node server to fetch static assets in the /assets
directory. I felt that this was a feature that goes above the core
functionality. That is why I added it as a plugin. with the modular
route extensions this was a breeze.
* Add serverroute description to ModuleTypes
* Coding standards tweaks
* Fix filename typo
* Move support for attachments from a plugin into the core
* Missing "else"
* Refactor server handling
* Introduce a new named parameter scheme for commands
* Move the SimpleServer class into it's own module
* Deprecate the --server command because of the unwieldy syntax
* Add a new --listen command using the new syntax
For example:
tiddlywiki mywiki --listen host:0.0.0.0 port:8090
* Add check for unknown parameters
* Add support for multiple basic authentication credentials in a CSV file
Beware: Passwords are stored in plain text. If that's a problem, use an authenticating proxy and the trusted header authentication approach.
* Refactor module locations
* Rename "serverroute" module type to "route"
* Remove support for verifying optional named command parameters
The idea was to be able to flag unknown parameter names, but requiring a command to pre-specify all the parameter names makes it harder for (say) the listen command to be extensible so that plugins can add new optional parameters that they handle. (This is particularly in the context of work in progress to encapsulate authenticators into their own modules).
* Refactor the two authenticators into separate modules and add support for authorization
* Correct mistaken path.join vs. path.resolve
See https://stackoverflow.com/a/39836259
* Docs for the named command parameters
I'd be grateful if anyone with sufficient Windows experience could confirm that the note about double quotes in "NamedCommandParameters" is correct.
* Be consistent about lower case parameter names
* Do the right thing when we have a username but no password
With a username parameter but no password parameter we'll attribute edits to that username, but not require authentication.
* Remove obsolete code
* Add support for requiring authentication without restricting the username
* Refactor authorization checks
* Return read_only status in /status response
* Fix two code typos
* Add basic support for detecting readonly status and avoiding write errors
We now have syncadaptors returning readonly status and avoid attempting to write to the server if it's going to fail
* Add readonly-styles
We hide editing-related buttons in read only mode
I've made this part of the tiddlyweb plugin but I think a case could be made for putting it into the core.
* Add custom request header as CSRF mitigation
By default we require the header X-Requested-With to be set to TiddlyWiki. Can be overriden by setting csrfdisable to "yes"
See https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)_Prevention_Cheat_Sheet#Protecting_REST_Services:_Use_of_Custom_Request_Headers
* Add support for HTTPS
* First pass at a route for serving rendered tiddlers
cc @Drakor
* Tweaks to the single tiddler static view
Adding a simple sidebar
* Switch to "dash" separated parameter names
* Typo
* Docs: Update ServerCommand and ListenCommand
* First pass at docs for the new web server stuff
Writing the docs is turning out to be quite an undertaking, much harder than writing the code!
* Get rid of extraneous paragraphs in static renderings
* Rejig anonymous user handling
Now we can support wikis that are read-only for anonymous access, but allow a user to login for read/write access.
* More docs
Slowly getting there...
* Static tiddler rendering: Fix HTML content in page title
* Docs updates
* Fix server command parameter names
Missed off 30ce7ea
* Docs: Missing quotes
* Avoid inadvertent dependency on Node.js > v9.6.0
The listenOptions parameter of the plain HTTP version of CreateServer was only introduced in v9.6.0
cc @Drakor @pmario
* Typo
Using contained actions, as we were, meant that the actions (and in this case the wikify widget) were being rendered at render time, but might have been out of date by the time the actions were triggered. Using the action attribute ensures the actions are rendered when they are executed.
Fixes#3326
Fixes problem whereby a repeated "new journal" would replace the text of the existing journal tiddler if the control panel new journal text was set.
Fixes#3028 and #3265
* Refactored the is operator for simplicity and efficiency.
* Improve `is` filter documentation.
* Update is.js
* extracted `subops.length` to `num_of_subops`
* renamed `subop` to `operator` for clarity/differentiation from `subops`
* refactored to avoid using a `Set` object.
* Update is.js
* Fix WebDAV by requesting new ETag conditionally
For me. this was saving only the first time and subsequently failing.
Having revised the requests, I noticed it didn't get a new ETag after saving.
Seems not all WebDAV implementations return a new ETag in PUT requests.
In my WebDAV service (WsgiDAV) - ETag is only served from a HEAD
request.
So if no ETag is found with PUT - we request one with HEAD.
This patch fixes error handling and should also work with servers that
provide ETag directly upon PUT.
* Add tweak from PMario
* Adds a range widget
Adds a range widget that supports all the range attributes on a input[type=range] element. These include min max and increment.
* Update range.js
* Fix spaces vs tabs.
* Added documentation.
* Modify the is operator to allow multiple types to be specified.
* Fixed indentation.
* Fixed indentation.
* Rewritten to maintain input order when multiple filters provided.
* Updated documentation.
* Update is.tid
* Invoke hook when server starts
Invokes the `th-server-command-start` hook when the server is started, with the server object as the parameter. This allows adding a WebSocket listener to the server.
* Return the HTTP server from the listen function
Returns the node HTTP server created in the listen function to allow extension
* Add node HTTP server to server-command-start hook
* Change hook to post start in case we add a pre-start hook
* Create Hook__th-server-command-post-start.tid
* sets checked ckass for radio widget wrapper
* added tc-radio as standard class for radio widgets
* removed selectedClass again, as suggested
@pmario ;-)
allows to override styles more easily via new class tc-chosen
----
updated all of storyview, theme, palette, language
» both in ControlPanel as well as PageControls
» removed "current ..." form switchers as it's redundant
» streamlined toolbar buttons in ControlPanel, especially less spacing
----
fixed dropdown hover colour override
if I wouldn't then it would go blank owed to default drop-down styles
----
polished styles
» chosen items now more emphasized while curspor not indicating a link
» removed underline when hovering, used highlighted border colours instead
----
use snippets languageswitcher for pagecontrols button, after all
----
wrap all switchers in tc-chooser
----
apply big font only to buttons, not reveals in pagecontrols
----
moved language switcher wrapper class to snippet
improved language switcher image alignment
----
make tiddler and ControlPanel view behave the same. add generic tc-check-list setting. add generic input type checklist, vertical alignment.
now using css rem to address drop-downs for pagecontrols
thanks @pmario
removed css artefacts in vanilla/base from before merging @pmario's PR
with comments being baked-in I don't think we want these in the code
css simplification for .tc-chosen and tc-chooser-item
* fixed the "0 is not a number bug" in listops and x-listops
* Fixed one comment
* "default" is not a good name for a variable
* Following code styles.
Moving getInt to utils.
* Removing unwanted spaces introduced by me
* The Excise tool only works with tiddlywiki5 format, so only display it on tiddlers that use the tiddlywiki5 parser.
* The Editor Height tool and stamp tool only make sense with text editors, so only display them when the content type starts with text
When occuring in a tiddler named "New Tiddler", the following construct should return ++ instead of +[[New Tiddler]]+
<$set name="myVariable" filter="[all[current]field:title[New Tiddler]]" value="">
+<<myVariable>>+
</$set>
fixes#2970
Also fixes the nesting. If a template is defined for the list item, it should define the link as is done for **list-tagged-draggable**, i.e. the template defines any link widget it contains.
* add option to configure new tiddler title
there may be users that don't like to see the word tiddler everywhere
this makes changing titles easier to access
* controlpanel - basics - new tiddler title prompt
* controlpanel-basics- newtiddler title prompt
* controlpanel - basics - new tiddler prompt
* tc-body transparent if background attachment
if you go fullscreen with the fullscreen button, the tc-body background color hides the background attachments - so make it transparent if $:/themes/tiddlywiki/vanilla/settings/backgroundimage isn't empty
* if background attachment macro
macro to make tc-body background transparent
Spending a bit more time with Chrome dev tools, and further to 254e1ca, this optimisation reduces the rendering time for the sample TOC from 1.9s to about 0.9s...
* extend ListWidget to enforce classes
Previously, the undocumented *class* attribute only allowed to specify
additional classes to be set.
Especially for use within a LinkCatcher, you can now apply / enforce
only the custom classes and avoid any of the defaults being applied
depending on the link target.
This will allow to implement #1161 more gracefully.
* use setClass insted of exclamation mark syntax
update docs & fix typo in docs
* fr-FR translation of additional error strings
* include SaveTrail
* Amendments to the warnings upon loading content via _canonical_uri
* Typo: add a missing THE
* Clarification on why the browser might refuse to load external content
Remove URI encoding from PUT saver and let the browser handle it as necessary. This seems to be the normal way of doing things. We have confirmed that several WebDAV servers do not expect the file names to be double-encoded.
* Replacement icon stopwatch on
As discussed in issue #2690
* Replacement icon stopwatch off
As discussed in issue #2690
* Added missing tag "Resources" (Community Resource)
* Tried to make a sentence clearer
CamelCase words are NOT joined with hyphens (copy-paste error?).
Copied "directly" from the line below to make the meaning even clearer.
* Does deleting make the conflict go?
* Recreate deleted file with updated text
* days filter example should show highlights
- show a highlight using a longer timespan (180 days)
- added a second highlight to demo timespan with start AND end in the past
- better readability
* days Operator explanation optimisations
- typo
- readability (explain { positive | negative } first; remove duplication)
* Remove additional blank line
* Remove whitespace after save button
When the save button was not the last edit button (tested by moving to another place via control panel > Appearance > Toolbars > Edit Toolbar by drag-and-drop) then we got additional spacing due to whitespace in the resulting HTML after the button. This is a fix for that, I discovered while developing additional edit buttons.
A first pass at fixing #2973 - comments are welcome. If everybody is
happy, the next step is to deprecate the existing
rendertiddler(s)/savetiddler(s) commands and replace them in all
examples and tiddlywiki.info files with the new equivalents.
This change makes it possible to perform the conversion from target
tiddler title to `href` value as a filter expression (previously a
JavaScript macro was needed to use the tv-get-export-link variable)
* Add ability to now macro to return same UTC string used in the modified and created fields.
* Revert "Add ability to now macro to return same UTC string used in the modified and created fields."
This reverts commit 7b6ad7db4a.
* Mods to formatDateString to adjust displayed date to UTC for [UTC]
format. Corresponding doc changes, and optimization for special
case.
document.location gives us an URL encoded version of the original
filename, so we decode it to recover the original filename for saving.
Fixes#2828Fixes#2819
* Trim tiddler titles imported via JSON
Otherwise, it's possible to create a tiddler with a trailing space (or a
leading one, I suppose) in its title. TiddlyWiki, in general, trims
titles before operating on a tiddler, so having a tiddler with a
trailing space ends up making that tiddler, for all intents and
purposes, uneditable.
Fixes GH #2850
* Signing the CLA
* Create the "tree" global macro file (tree.tid)
* Added styles for the new "tree" global macro
* Update Explorer tab
* Cleaning the macro of unneeded code
I have chosen to keep the slash suffix in the branch node titles to go along with the rest (e.g. root node), so the "clean-chunk" macro isn't needed anymore.
* Minor fix
A couple of fixes:
* Fixed problem with loading saver in a file URI within Beaker
* Fixed problem when saving to a directory-style URI with an implicit
“/index.html”
* Switched to double quotes for strings
It was added as a separate system tiddler, but that means updating a
lot of filters to add and exclude it as appropriate (as we do with
$:/library/sjcl.js itself)
These changes allow drag and drop to work with one issue: <a> links are
not draggable; draggable divs, spans, buttons etc. seem to work fine.
There’s some issue with IE11 that I don’t understand.
For testing, you can force links to become spans by changing line 64 of
$:/core/modules/widgets/link.js to:
var domNode = this.document.createElement("span");
We do this so that we don’t accidentally modify shadow tiddlers when we
drag them to reorder them within their tag parent. Otherwise, moving a
toolbar button like $:/core/ui/Buttons/permaview in the control panel
will override the shadow tiddler.
At the moment, we support JSON files containing an array of tiddlers.
With this change the core will import files containing a single
tiddler. Also adding templates for saving individual tiddlers in JSON
format
The problem was that `this.responseText` crashes for non-text data. We
fix it by letting the client specify which property should be returned.
@ericshulman does this work for you?
* provides a "close plugin library" button
* starting from #1718 by @inmysocks
* possibly fixes all of #1718, #1597, and #2067
* corrected code comment
* add back title
No idea why I overlooked this beforehand.
Next time I will not suggest such changes that have little to do with
the PR, but rather just comment the code.
* ah, sorry, "fixed" wrong spot
now
```
<$action-sendmessage $message="tm-load-plugin-from-library"
url={{!!url}} title={{$(assetInfo)$!!original-title}}/>
```
...should be back at the right spot.
* mhhh... still fixing the mess
load, unload, puh... let's see if I got it now
* added unloadIFrame and minor syntax fixes
We now use highlight.js in raw HTML mode on the server, rather than
trying to use it with the fakedom. This causes problems with fakedoms
inability to get textContent for a node that has been created by
assigning innerHTML. So we extend the fakedom to allow the original
text content to be saved.
See #2778 for discussion.
I used this test:
console.time();for(var t=0; t<200; t++)
{$tw.wiki.filterTiddlers("[all[tiddlers+shadows]sameday[20170210]]");};c
onsole.timeEnd()
Before this patch, I got speeds of approx 190ms, versus 140ms
afterwards.
Note that the ability to add a cache property like this is only
possible because tiddler objects are immutable.
Like the load command except retrieves the file over HTTP/HTTPS.
Allows experimentation with server-side twederation
This is a cleaned up version of code that I wrote last year at TWEUM
2016 @inmysocks @pmario @twMat @xcazin
* putSaver: detect edit conflicts to prevent clobbering, if possible
if the server supplies an ETag, we send it back when saving, allowing
the server to detect edit conflicts and respond with 412 (cf.
https://www.w3.org/1999/04/Editing/)
caveats:
* this only kicks in after the first save, as we don't have access to
the ETag when first loading the document
* there's no recovery mechanism (e.g. resetting `this.etag` in order to
force clobbering), other than manually reloading the document
* putSaver: retrieve ETag upon initialization for clobbering protection
this addresses one of the caveats from the previous commit
(2d75cb83af) - while theoretically prone
to a race condition, it seems unlikely that saving will be triggered
before the server responds
* putSaver: simplify URI extraction
this simplifies the approach introduced in
f51f6bf774, with the purpose of removing
the fragment identifier
* putSaver: localize error message
* putSaver: switch to built-in HTTP helper
in the process, fixed ETag assignment in `#save` method (was
`this.etag`, now `self.etag`) as well as a syntax error due to a missing
closing brace
* putSaver: consolidate URI handling
The code here had got a bit broken by some PRs that I should have
checked more carefully. I’ve done a major refactoring which will
hopefully make it easier to understand, and fixes a number of problems:
* Problem with eg .md tiddlers not being deleted correctly
* Problem with Windows path separators not being usable within
$:/config/FileSystemPaths on Windows
* Problem with filename clashes not being detected correctly when
saving to a different directory via $:/config/FileSystemPaths
* Enables slashes within tiddler titles to be mapped into folders
* Enables plain text files like .md and .css to be saved with .meta
files instead of as .tid files (see #2558)
* No longer replaces spaces with underscores
As this is such a major update, I’d be grateful if Node.js users could
give it a careful run through — in particular, you’ll need to try
creating new tiddlers of various types and ensure that the expected
files are created.
* allows to add a new tagname hitting enter
see: https://groups.google.com/forum/#!topic/tiddlywiki/wqQ8jPYG-X4
* revert changes to vanilla/base
* added "Special Keys" to KeyboardShortcuts
* added info to Creating and editing tiddlers
did not add current version of <<.from-version "5.1.14">> because it
would interrupt the flow. When changed from a noisy "New in 5.1.14" to
"(new in 5.1.14)" we might add the version info here
* revert setText & added inline styles to vanilla base
* remove fieldmangler
* commit initial edittemplate tags to merge master
* ok, now really revert to initial edittemplate tags
* move add tag via enter into tag-picker macro(s)
* add recursion protection first take
* fix problem with selectable expand
* ust path for toc-state variable instead of tag
* reactivate disabled macro call.
The request handler may be used by ExpressJS apps directly and can do most of the heavy lifting without any modification. Note that the self variable must be assignee using `[Function].bind(null,SimpleServer instance)`.
* allow radio widget to set an index in a data tiddler
* updated RadioWidget docs, with same demo macro as for CheckboxWidget
in #2103
* removed docs in widget code (seems the wrong place)
* added from version to docs
* revert doc maros to master
* using wikitext-example-without-html and .tip macro now
* fix quotes
given a list `A B C D` if I run `A B C D +[move:-1 [A]]` I get `B C A D`. However, if I were to do `A B C D +[move:1[D]]` it doesn't wrap around, and I get `A B C D`. This fixes that such that `A B C D +[move:-1 [A]]` gives 'A B C D`
When renaming an existing tiddler, the edit template now shows a
checkbox that determines whether or not to relink references to the
tiddler in the list or tags fields of other tiddlers.
* Make expand/collapse state be global across all tiddlers
* Remove “Show raw text” option, now that we’ve got the two expandable
areas for raw and wikified text
* Hide raw text by default
* Accentuate currently open tiddler
I’m fixing this now to show how the tabs macro can be changed to
accommodate the change, but we may yet decide to reverse out the change
in order to maintain backwards compatibility.
One problem with changes like this is that there’s no easy way to find
out where it impacts the core UI. The tabs macro is now fixed, but
perhaps there’s more obscure things that are still broken in the core.
If we do opt to reverse the change to preserve backwards compatibility,
we could add a way to explicitly trigger the new behaviour. For
example, a new attribute `updateState=“yes”`.
Yet another alternative is to make completely new alternative to the
list widget with revised semantics, that authors can opt-in to. For
example `<$loop>`. (There was another issue we discussed a year or two
ago about adding support for an index variable which may be a candidate
for fixing at the same time).
* Refactored control panel “Plugins” tab to make the elements more
reusable
* Refactored the display of plugin tiddlers to use the same format as
the control panel (as suggested, I think by @danielo515), adding the
shadow tiddler listing as an overridable extension tab
* Added a new tab in the “More” sidebar providing quick access to all
installed plugins
This fixes a problem introduced in
c7b31b0242.
The changes by @tobibeer inadvertently made the regular expression
evaluation significantly more expensive because of lookahead. The is
less elegant but reverts the performance problem.
* return all wikiparserrules w/o operand
* simpler layout & code / updated instruction details
Also wanted to link each rule to the official docs using a dictionary at
`$:/language/Docs/ParserRules/`. However, without #2194 this is not
doable.
This commit permits language plugins to carry the field
“text-direction” with the value “rtl” to trigger right-to-left layout
of the entire page. We also adjust the sidebar layout to work in RTL
mode.
There are still a number of problems to be addressed:
* Brackets and other punctuation incorrectly placed within en-GB UI text
* System tiddler titles are rendered semi-back-to-front (eg
`languages/ca-ES/:$`)
Starting to address #1845 and the discussion in #2523.
We were using `String.prototype.replace()` without addressing the
wrinkle that dollar signs in the replacement string have special
handling. This caused problems in situations where the replacement
string is derived from user input and contains dollar signs.
Fixes#2517
* Save binary tiddlers with meta file
The filesystemadaptor plugin was a little simplistic in its
understanding of a binary file. It was using the typeInfo dictionary to
choose what tiddler types were binary (and hence needed a meta file when
saving).
I looked as if it was trying to be smart by looking for the hasMetaFile
*OR* had the encoding of base64. Unfortunately the typeInfo only defined
image/jpeg and so any other base64 encoded tiddler was assumed to be of
type text/vnd.tiddlywiki.
The net effect was only JPG images got a meta file and everything else
were saved as .tid files with base64 encoding. It all still worked but
made working with binary data in a Git repo a bit daunting.
There is enough information in the $tw.config.contentTypeInfo to
determine if a tiddler type is encoded with base64 or not. A better list
is available from boot/boot.js who registers all the types thorough the
registerFileType and marks then with base64 were appropriate.
This commit uses the typeInfo dictionary first for any filesystem
specific overrides, then the contentTypeInfo, and finally defaults to
the typeInfo["text/vnd.tiddlywiki"]. It also eliminates the now
unnecessary override for image/jpeg.
I think this might have been the original intent from commit 10b192e7.
From my limited testing all files described in boot/boot.js (lines
1832-1856) with an encoding of base64 now save as the original binary
and a meta file. Meaning that when you start the node server and then
drag-n-drop a binary file (i.e. image/png) it will PUT to the server
and then save it on the filesystem as-is allowing the file to be managed
as a binary file and not a text file. (Binary diffs are better and
GitHub supports them as well).
* Prevent duplicate file extensions
A side effects of using the $tw.config.contentFileInfo in the previous
commit is that it will always append a file extension to the tiddler
title when saving. In most cases this is the correct course of action.
However, sometimes that title is already a proper filename with an
extension (for example importing 'foobar.png' would save a file named
'foobar.png.png') which seemed silly.
This commit simply checks to make sure the title does not already end
with the file extension before appending it to the filename. A little
convenience really.
Since IE apparently doesn't have the String endsWith method I took the
liberty to add a helper method to $tw.utils trying to follow the other
polyfill patterns. I figured this was more generic and readable then
attempting to use a one-off solution inline. I got the polyfill code
from MDN.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith#Polyfill
Is strEndsWith the best method name?
Passing the static content through the `$:/core/templates/html-tiddler`
template made it impossible to produce output that wasn’t HTML encoded
(eg stylesheets).
It turns out that IE11 has a horrible bug whereby setting the
placeholder attribute before setting the text will trigger an input
event:
https://social.msdn.microsoft.com/Forums/ie/en-US/ae4832b0-8eee-4729-b93
3-a9977ea1b583/internet-explorer-input-event-get-fired-when-settingunset
ting-the-placeholder?forum=iewebdevelopment
There have been long standing problems with the buttons not working in
Firefox, and now a [further
problem](https://groups.google.com/d/msg/tiddlywiki/GlsruQyPOag/BAhnI2mt
BgAJ) has come to light, and been similarly hard to resolve.
On balance, I’ve decided to remove the undo/redo buttons from the
toolbar (the ctrl/cmd-Z shortcut is still operational), thus avoiding
the problems, and saving some space in the core.
This is quite a big change: a new way to invoke action widgets.
The advantage is that it solves #2217 and #1564, a long running problem
that prevented us from adding action widgets to widgets that modify the
store.
This commit adds the new technique for the button and keyboard widgets,
but also extends the select widget to trigger action widgets for the
first time
* Change the negation logic to address an edge case
Make it possible to get an interval ending with yesterday or starting with tomorrow.
* "days" filter: adjust documentation
When saving new tiddlers on node.js, allow the user to override the path of the
generated .tid file. This is done by creating a tiddler
$:/config/FileSystemPaths which contains one or more filter expressions, one
per line. These filters are applied in turn to the tiddler to be saved, and
the first output produced is taken as a logical path relative to the wiki's
tiddlers directory. Any occurences of "/" in the logical path are replaced with
the platform's path separator, the extension ".tid" is appended, illegal
characters are replaced by "_" and the path is disambiguated (if necessary) in
order to arrive at the final tiddler file path. If none of the filters matches,
or the configuration tiddler does not exist, fall back to the previous file
naming scheme (i.e. replacing "/" by "_").
This implies we will now, for tiddlers matching the user-specified filters,
create directory trees below the tiddlers directory. In order to avoid
cluttering it with empty directory trees when renaming or removing tiddlers, any
directories that become empty by deleting a tiddler file are removed
(recursively).
Benefits of this configuration option include the ability to organize git
repositories of TiddlyWikis running on node.js, ability to replace characters
that cause trouble with particular operating systems or workflows (e.g. '$' on
unix) and the ability to replicate tiddler "paths" in the filesystem (by
including a filter like "[!has[draft.of]]") without forcing such a (potentially
problematic) change on all users.
There’s currently 249 changed files in the text-editor branch, which
exceeds github.com’s ability to display the diffs. So we’ll put the
images straight into master to get the diffs down by 32 files.
Entities such as `👷` were broken because
`String.fromCharCode()` is not fully Unicode aware. The fix is to use
`String.fromCodePoint()` where available.
Noted by @ericshulman
List fields (such as tags) when evaluated to produce tiddlers result in empty arrays. Using the exact not equals, an empty array is not the same as an empty string. By using equivelent not equals, we state that the field is either != "" or anything that can be coerced to "". Which, based on https://dorey.github.io/JavaScript-Equality-Table/ is `false` `0` `[]` or `[[]]`` neither `false` nor `0` can be set as a tiddler field as both will end up being quoted (`"false"`, `"0"`) so this should work.
Fixed a side-effect of 03519c14b0 from
@matabele whereby the current tiddler is overwritten by the
`<$tiddler>` widget, which means that it is not accessible when
rendering the caption of the tab.
This causes a problem with eg the “Add Plugins” modal where it breaks
the count on the tabs.
When using the widget with only short form SetText attributes (field="value) -- the default field (text) of the default tiddler is set to the default value ("") -- thus clearing the text field of the current tiddler. I have inserted a conditional to test for the presence of the `field` attribute.
Whilst I was about this, I have inserted code to enable the setting of any number of TextReferences -- this fixes the issue of only being able to set one index per widget and also allows different tiddlers to be targeted by the same widget.
element that has scrollbars. The wrapper element with the
scroll bar does not need to be a direct parent of the text area.
**update:** fixed a bug that came up in the discussion
This is fixed now: https://github.com/Jermolene/TiddlyWiki5/pull/1933#issuecomment-141774881
The problem was the check in getScrollContainer()
Because of the refresh problems with the other widgets triggering action-widgets I am doing this one by itself. I hadn't included it before.
This shouldn't have any more problems than the button widget does, and any problems caused by it should be fixed by any fix we use for the button widget. See #1564 for more background
Action widget designed to apply filters to the current list and save the modified list back to the list. The widget is able to manipulate lists in any field or any data index of the target tiddler, and includes an option to manipulate the tags of the target tiddler. The widget is used in conjunction with the extended list operator filters (xlistops.js)
implements #1369
when the suffix is `list`, interprets the field as a list of individual
tiddler titles and returns all titles referenced in the list field of
the source list, existing or not
The present implementation of relative dates doesn’t auto-update, nor
does it work effectively in static renderings. Until that’s fixed, I
think it is better to switch to absolute dates.
“-do-not-delete” flag for savetiddlers command was introduced in 5.1.10
without consistency with the already implemented “noclean” flag for the
rendertiddlers command
The dropdown can be summoned by clicking on the search field. It will
only appear if the search field is not empty. When the search field is
not empty the dropdown can be also be summoned by clicking on the arrow
or search result count.
There are still some wrinkles where the dropdown doesn’t appear when
expected; I’d appreciate feedback to help reproduce those cases.
This change should still work with custom search result tabs.
Triggered by the text-slicer plugin, but general purpose.
The clunky implementation shows the shortcomings of the view widget. It
was one of the first widgets to be implemented; subsequently, the
implementation of macros gives us a potentially more flexible way of
implementing these kinds of text transformations.
Now we process the rendered HTML of tiddlers, which allows us to
process HTML generated by MS Word. In fact, the HTML that MS Word
generates is so awful, I’ve instead been using Mammoth to do the
conversion: https://github.com/mwilliamson/mammoth.js
Also some necessary improvements to the fake dom implementation.
One of the changes for introducing folded tiddlers was the extra reveal
widget here, which introduces an extra DIV element, breaking some CSS
rules. To fix it, we re-use the reveal widgets generated DIV as the
tiddler body DIV
* Ignore parser rule configuration in safe mode
* Made text translatable
* Added new setting for camelcase links
* Added warning on parser rule configuration tab
See #1875
I switched this optimisation off back in
ed35d91be6, in October 2013, as part of a
big refactoring of the parsing and widget mechanism. I’ve been meaning
to switch it back on for some time.
My rough measurements suggest that this optimisation can reduce
rendering time by 5-10%.
There’s not much to making the toolbar button styles switchable: the
change to the PageTemplate introduces a new configuration tiddler that
controls the button styling. Most of this commit is the user interface
for changing that setting, including the translatable text. I think
this again demonstrates that we need to be very selective about which
configuration options have a UI included in the core. Otherwise, a few
dozen more of these settings will start to become a significant
fraction of the core.
When the info button in the TagManager was press it revealed the info
table but it was squished in one cell and that pushed the right side of
the table past the width of the tiddler. So using a colspan optimises
the spacing (plus it looks better).
@felixhayashi sorry I should have realised earlier that it’s worth
doing it this way so that we can have different settings for different
story rivers.
Using `$name` and `$value` attributes allows more flexibility in how
parameter names are specified, allowing parameter names that are not
valid attribute names.
The button deletes the local tiddlers that contain information about the library. This allows you to:
*hide the library contents
*reload the library to see any updates to the plugins it contains. If this isn't done than local information about the available plugins is never updated (this problem may need a separate fix that doesn't require reloading the library).
I have three problems that should be addressed:
*I am not sure that the location and color of the close library button is appropriate
*When you click on the close library button a message asking you if you want to delete the $:/temp/ServerConnection/(url) tiddler appears, if you click 'cancel' than the library is shown as open and empty, the only way to fix this condition is to delete the server connection tiddler manually. I think there is a simple fix to this but I can't think of anything.
*Sometimes if you try to open a library that you have just closed it won't open properly. The tiddlers that contain the plugin information are created, but the server connection tiddler isn't created until you reload the wiki. This behavior is inconsistent and sometimes opening the library again works with no problems. I do not know why. I would be fine with requiring a refresh before a library could be reopened so that the startup module acts, but I am not sure what to do about this inconsistent behaivor. I have not been able to find any cause.
Typically for JavaScript, initialising an object as an array doesn’t
break anything because an array is an object. Anyhow, it should be an
object in this case.
It thereby reduces code complexity that would arise when setting
many variables using "<$set>".
```
\define helloworld() Hello world!
<$vars greeting="Hi" me={{!!title}} sentence=<<helloworld>>>
<<greeting>>! I am <<me>> and I say: <<sentence>>
</$vars>
```
How this Widget differs from the set widget:
* Variables may be created by using the "key=value" notation
that you already know from widgets like action-setfield.
* You cannot specify a fallback ("emptyValue")
* You cannot use a filter to produce a conditional variable assignement
Original discussion that led to the creation of this widget:
https://github.com/Jermolene/TiddlyWiki5/issues/1610
Otherwise, the `sameday` macro will default to `modified`. In case the user set `dateField:"created"` when calling `timeline`, the result will be inconsitent.
Allow widgets to choose not to propagate actions. This is important for
widgets that themselves trigger actions.
Note that this change will cause problems with any existing
5.1.8-prerelease plugins that call `invokeActions()`.
The tabindex attribute was being set to the string “undefined” if the
attribute was not specified. The fix is to only set the tabindex
attribute if the attribute was specified.
Give the toolbar buttons for control panel, advanced search and tag
manager the selected state when the corresponding tiddlers are open in
the story river.
They don’t get automatically decoded when the browser reads the
resulting HTML. So, instead, we’ll solve
1e9e1a1fdc by switching to double quotes
for attribute values.
The trouble with tweaking the ViewBox was that the amount of the
adjustment is expressed in the coordinate system of the image, not the
coordinate system of the bitmap that is being rendered. That means that
the additional space doesn’t necessarily extend to the single physical
pixel needed to resolve the issue.
* Moved “add new plugin” into a modal wizard
* Adopt big friendly buttons
* Add plugin icons and readmes to “add new plugin” modal
* Use tabs for splitting plugins/themes/languages
* Consistent styling between the “add new plugin” modal and the
“installed plugins” control panel tab
* Behind the scenes, moved from addressing the library as
`recipes/defaults/tiddlers/<etc>` to `recipes/library/tiddlers<etc>`
This may cause backwards compatibility problems for people relying on
the block mode parsing, but it’s much better for the rest of us as it
avoids an unsightly paragraph tag
This was introduced to make it possible in the new stacked story view
to click on a tiddler to bring it to the front. By allowing a tiddler
in view mode to be focussed, it also prepared for view mode keyboard
shortcuts. (Eg, a key to edit the current tiddler).
However, there are several minor issues with the unexpected behaviour
of clicking on a tiddler navigating to it, so we’ll leave this out of
5.1.8
I needed a left arrow for a menu, but as the core image library doesn't have one I created one by rotating the svg of the built-in right arrow.
Also changed the corresponding class name.
Stop the logger from creating alert tiddlers on the server. They
propagate to the client but are not deletable from the client because
they are in the `$:/temp` namespace.
cc @loleg
For some reason this is causing the focus to be repeatedly set to
the title field when editing a tiddler's text. Let's revert it for
now.
See Issue #1527.
This reverts commit fdc635007b.
The previous fix changed the scrolling behaviour such that it only
scrolled to the top of a tiddler if the tiddler was entirely offscreen.
It wasn’t entirely satisfactory because scrolling was prevented even if
only a few pixels of a tiddler are in view. This commit ensures that
the scroll does occur if less than 50 pixels of the target is in view
With this enhancement, clicking on a tiddler in the story view will
navigate to that tiddler. This is needed for eg the stacked storyview,
where we want to be able to click on tiddlers to bring them to the
front of the stack.
There are some problems though - as things stand, clicking on a tiddler
in classic storyview will scroll to the top of that tiddler.
By turning the tiddler frame into a link it is now possible to click on
a tiddler to navigate to it. This is needed for the new
stacked-storyview, but it also useful in other storyviews.
Note that there are currently some issues. For example, in classic
storyview, clicking on a tiddler will scroll to the top of it, which
isn’t helpful if you’ve scrolled halfway down a long tiddler.
tv-get-export-path tells render tiddlers where to export files
tv-get-export-image-link tells images.js where to look for images
tv-get-export-link tells tells link.js where to look for links to other
exported tiddlers
@aelocson here’s an alternative fix for #981, as discussed in
https://github.com/Jermolene/TiddlyWiki5/commit/691e5719a4ff74a04d389bd1
26ba2a69e7651a2a#commitcomment-9848682
It does seem a lot nicer. It avoids the problem you raised, and also
avoids scrolling when a permalink is used.
I suspect that we’d need to make the hard-coded 50 pixels be
configurable.
This reverts commit b2b8006b58, reversing
changes made to e7e16137b2.
@welford my apologies it turns out there are a couple of problems, I’ll
comment more on the pull request
Previous changes since 5.1.7 broke the documented semantics by no
longer returning true when the versions match. It affected the upgrade
process, making it impossible to upgrade to a later pre-release (ie
where the version numbers in the upgrade.html match those in the file
being upgraded).
Also reviewed and updated the calls to checkVersions.
@felixhayashi I think that this effectively reverts the change you
original submitted. Are you OK with it?
Fixes#1415
The problem was that encodeURI() doesn’t encode slashes, which are not
legal in a data URI, although only Safari was failing. We switch to
encodeURIComponent(), which does encode slashes
The main fix is removing the fallback navigation to the first tiddler
in story.js. Also required is the fix to the startup behaviour of
zoomin.js.
Fixes#981
@tobibeer I think that this was originally from you. I think it’s
problematic listing all available tiddlers for performance and
usability reasons.
I’ve instead taken advantage of your work to template the tag links by
splitting the system and non-system tags. What do you think?
fixes#592
Introduces and preserves **_origin** field when using drag-and-drop —
bad idea? discard? different field name?
demo http://592.tiddlyspot.com
Fixes#1450
Provides support for an integrated plugin library that can be used to
install plugins from tiddlywiki.com directly to wikis hosted online or
offline. See the Plugins tab of Control Panel.
Todo:
* Error checking(eg libraryserver.js HTTP GET)
* Translatability
* Documentation
** $:/tags/ServerConnection
** savelibrarytiddlers command
as well added ControlPanel settings — reordered ControlPanel basics to
have DefaultTiddlers next to EmptyMessage but not shifting important
stuff too far down
for now, computes path to backup directory, appending the relative path
of UploadBackupDir to the absolute one from the UploadURL
Also added example for store.php to hint
Preserves compatibility with existing invokeActions call in button widget by creating a separate 'invokeActionCall' function to carry out the recursion. Triggering all descendants permits use of action widgets inside list widgets or macros. Also makes it possible to add triggering capability to select widget.
when the tiddlers are not listed in the list field, sort them by title
nonetheless, otherwise we get a real poor taglist from
**$:/core/ui/TagTemplate**
Ok, I think I've got it now. The following matches all...
1. starting with a literal `$:`
2. then any number of character not a whitespace, `<` or `|`
3. closing with anything that is, again, not a whitespace, `<` or `|`
Test here...
http://tbdemo.tiddlyspot.com/#Autolink%20System%20Tiddlers
fixes#1333
extracts the tag-link into a component template...
**$:/core/ui/Components/tag-link**
...so as to split the list in two, having two filters that list tiddlers
in the add-tags popup to...
1. firstly, list matching used tags
2. secondly, list mathcing tiddler titles, thus availabe for tagging
Does away with searching content as it is irrelevant if not distracting
for tagging.
Why two lists? Consider wanting to tag a tiddler with "Filters"...
observe how the result would otherwise be way too far down because
existing tiddler titles get in the way.
Component templates are also desireable elsewhere, e.g. #1318
enhanced extlink parser to cover system tiddler links
of course, only those without spaces in their title
didn't want to open up an extra parser for this as extlink has all the
basics
For consistency with the way that tabs work.
To see this in action, on tiddlywiki.com open the tiddler
`$:/tags/ControlPanel` and edit it to add the tag “TableOfContents”.
You’ll see the control panel appear at the bottom of the table of
contents.
In 5.1.5 we switched to using `<$action-setfield>` instead of
`<$fieldmangler>`. The problem was that in the process we lost the
validation of field names, making it possible to create fields with
illegal names
Fixes#1186
Note: I did NOT test the results as I have yet to figure out how to make
node.js...
* actually run the server without a 403
* build the core tw after me having made changes
* removed trailing whitespaces in button tids
* defined a global left margin for buttons set to 5px
* slightly less than in view-mode before
* slightly more than in edit-mode before
* but visually more appealing to me
* leaves a wee more room for the title to unfold
Cecily and Zoomin story views use a document.body that is smaller than
the document.documentElement. We were just clearing the popups on
clicks on the document.body Clicks on the document element (ie, on the
background of the page) were not being trapped, meaning that you
couldn’t dismiss a popup.
The `EditTextWidget.prototype.fixHeight()` function was defering its
work with `nextTick()`, which led to flickering on all browsers when
typing triggers a resize.
New export button appears as a page control toolbar button, a tiddler
toolbar button, and a button in the advanced search filter tab.
Initially supports exporting as static HTML, CSV, JSON or `.tid` file.
Still to do:
* Made the exporter descriptions translatable
* Hide the export button by default
* User docs
* Cleaning up the existing templates (eg,
`$:/core/templates/alltiddlers.template.html` should work by
transcluding `$:/core/templates/exporters/Static`)
* Docs for the new macros `exportButton`, `csvtiddlers` and
`jsontiddlers`
Issues:
* OS X Numbers refuses to open CSV files that have been generated in
Chrome, because it thinks they’ve been downloaded from the Internet.
Firefox works OK
* The export button won’t work within the tiddler info panel, or from
the *more* popup (this is because we don’t support nested popups)
Now the `tm-download-file` and `tm-save-file` messages use the hashmap
to specify variables to be applied when rendering the tiddler.
We also add a convention that the variable “filename” is used to
specify a filename for the download.
In practice the macros are always invoked in inline mode, meaning that
the triple braces weren’t getting parsed correctly. Now we switch to
inline code
If the target tiddler of the draft is missing (as happens after
clicking “new tiddler”), then we count the draft as modified if the
text is not empty.
Also we count the the draft as modified if the draft title has been
changed
@felixhayashi I’m afraid I haven’t used your pull request as there were
a few details that I wanted to do differently. The main change is that
these changes allow both a param string and hashmap to be specified.
In 5.1.3 we introduced the idea that the `event.param` variable could
optionally be a hashmap, allowing multiple values to be passed with the
message.
This change moves the hashmap to a separate `event.paramObject`
variable, allowing us to pass both a hashmap and a param string.
The “info”, “edit”, “close” troika has been a feature of TW5 since the
very early days. Recent discussion in Hangout #67 has made me question
whether we wouldn’t be better off with the defaults in this commit:
“more”, “edit”, “close”.
The rationale is that the primary purpose of the “info” button has
become gaining access to the tools that haven’t been elevated to being
toolbar buttons. Most of the rest of the content of the info panel is
pretty arcane. So let’s try it for a few days - I’d appreciate any
feedback.
With this commit tag pills will now choose for the foreground colour
either the current palette “foreground” or “background” colours,
according to which has the higher contrast. It’s something @gernert has
expressed an interest in in the past, and I’ve tended to agree that it
is a nice piece of polish. It opens up the possibility of paler colours
for tag pills than are currently possible.
The trouble is that in order to implement it I’ve had to bring in a
third party library for parsing CSS colours. It weighs in just over
9KB, making quite a lot of weight for such a small feature. I don’t see
any other immediate uses for the colour parsing library either.
So, I’m undecided at the moment whether this should stay in the core.
Dragging a tiddler link into a tiddler editor, or outside the browser
into another app, will now add double square brackets around the title
if it includes spaces. Suggested by @tgirod.
I’m not 100% sure about this change. It breaks one habit that I had
developed: typing `[[sometext|]]` and then dragging a title in between
the vertical bar and the first closing square bracket. What do others
think?
Clicking on the advanced search ellipsis when there is a search string
will open the advanced search tiddler, and copy the current search term
to it.
Thanks to @Spangenhelm for the idea.
Also added a “description” field for wiki folders.
Right now there’s too many editions listed. I think we should by
default only list editions whose `tiddlywiki.info` file has
`showInListings` set to `true`, and have an `--editions all` command
that lists everything.
@pmario please could you check that the editions in your
`TIDDLYWIKI_EDITION_PATH` are correctly listed?
Also fixes a problem pointed out by @Evolena whereby the advanced
search counts hadn’t been adjusted to remove `$:/temp/advancedsearch`
from the search.
Reasons:
- can show or hide the button text with CSS (assuming
tv-config-toolbar-text is yes).
- can have different looking buttons in the page controls versus the
view toolbar, etc
- more flexibility styling the button appearance, for example you
can change the text size compared to the icon size
- button appearance is more themeable
It seems that there is a broader problem with the way that the button
is embedded within the label of a checkbox; even on Chrome it meant
that the checkbox active state was triggered when clicking on any of
the buttons. The user experience was in any case confusing; it wasn’t
obvious that clicking on the label to the right of the button would
flick the checkbox.
The solution takes the buttons and labels out of the checkbox label.
Resolves some inconsistencies over the behaviour of the new tiddler
message under various circumstances.
“new journal here” when a journal for today already exists now brings
up the existing journal for editing, and adds the required tag.
I’d be very grateful for any testing of the behaviour here: try using
new tiddler, clone tiddler, new here, new journal here, and new journal
in various combinations (eg with the draft not existing, already
existing, open or closed etc), and let me know of any peculiarities.
The journal tiddler will be tagged with the name of the current
tiddler. This is similar to how the new here button works.
(Would have liked to reuse the journalButton code which is almost
identical between new-journal-here and new-journal, but I'm not
sure how to do it.)
This is a basic “new here” tiddler toolbar button that just creates a
new tiddler tagged with the title of the current tiddler.
@pmario is there anything else required?
The problem was that stylesheets were being transcluded in inline mode
(rather than block mode), which meant that triple backticks were not
being interpreted as block mode markup, but rather as a series of
single backticks.
The control panel isn’t the right place for tools; it’s a place for
settings and internal configuration.
Once again apologies to the translators for wiping out your hard work!
For example, the previous title for the tiddler containing the editor
types tab of control panel was
“$:/core/ui/ControlPanel/Advanced/EditorTypes”. We’re now removing the
“Advanced” portion, so that we don’t have to rename tiddlers like this
if we move them around between tabs
There are still some warnings about making functions in a loop, but
I’ll fix those as a separate pull request because the fixes are more
than typographic errors.
Re-introduces the “tw-auto-save-wiki” message. The previous approach of
automatically triggering autosave whenever a tiddler changed meant that
changing configuration changes in control panel was triggering an
autosave. Using the explicit message gives us better control of the
situations in which we’ll autosave.
Now we solve the earlier problem of there being outstanding tiddler
change events at the time that we process the “tw-auto-save-wiki” by
deferring the autosave until the outstanding change event comes in.
Mistakenly, I had changed the tiddler widget to refresh itself when the
value of the target tiddler changed. This is not in fact necessary; it
only needs to refresh itself when the identity of the target tiddler
changes.
Fixes#744
Previously we were using a message `tw-auto-save-wiki` to trigger an
autosave. The message was generated by certain UI actions such as
saving a tiddler. The trouble was that the message was being processed
before the wiki change event for the accompanying change had had a
chance to percolate. The end result was that the dirty indicator was
staying lit when using autosave.
The new approach abandons the autosave message and instead triggers the
autosave in the wiki change event when a relevant change occurs.
One happy side effect of these changes is that the dirty indicator now
works as expected with the client server edition - ie, when typing in a
draft tiddler the dirty indicator will flash briefly, and then clear
when the sync mechanism has completed saving the draft.
Fixing problems caused by c4b76ceb0b:
* We still need to initialise the saver-handler even when syncing to a
server, otherwise offline snapshots can’t be saved
* We need to override the default save template a bit further up the
stack, to avoid the server side serving the offline version of the wiki
at `/`
Move the CSS macros into global macros, and allow the colour macro to
fallback to the vanilla palette if the required colour isn’t found in
the current palette.
Fixes#717
The issue was that under Windows we generate text nodes that contained
CRLF as a linebreak (rather than just LF as usual).
The subtle problem is that when these strings are placed in the DOM via
createTextNode(), the CR character is treated as a printable character,
not whitespace. When creating DOM notes with innerHTML or as part of a
static HTML document the HTML parser will strip out the CR characters.
The hacky solution is to manually remove CRs before building the text
node.
@pmario and @welford - I’m not presenting this as a fix for #717
because I’m still not in a position to reproduce it.
However, I found this during a review of newline handling code, and
would be interested if it is implicated in the problems you are
reporting.
Also adds flag icon for each language.
One limitation is that the language button doesn’t work properly when
accessed via the “more” menu of the page controls.
@BramChen - could you help me choose the most appropriate flags to use
for the variants of Chinese?
The tiddlers are wikified in the context of the host wiki, which means
that mutual transclusions between imported tiddlers won’t appear
correct in the preview.