Commit Graph

2980 Commits

Author SHA1 Message Date
jeremy@jermolene.com 166a156584 Fix typo: Safe mode should prevent globally disabling parser rules 2022-09-23 18:08:28 +01:00
Robin Munn 51bdf60ee8
Fix bug when using built-in `list` field as listField parameter to checkbox widget (#6897)
* Fix bug with checkbox widget and `list` field

The `list` field is stored as a list and frozen against modifications,
and getFieldList() returns it directly without creating a copy. So
before we modify it, we need to make a copy so we're not modifying a
frozen list. This bug doesn't manifest with custom fields, which are
stored as strings, only with the built-in `list` field.

* Fix checkboxes referencing non-existent tiddlers

This fixes the "tiddler is undefined" error when a checkbox's listField
property references a tiddler that doesn't (yet) exist.

* Better logic for checkbox listField handling

If the field contains an array, then it's almost certainly referenced
elsewhere and needs a defensive copy made. If it contained a string,
then it's safe to modify without making a defensive copy.
2022-09-22 18:52:55 +01:00
Cameron Fischer debfd42d51
Log message not to have spaces and <empty string> (#6947) 2022-09-15 12:10:33 +01:00
Jeremy Ruston 35b9faaa89
JSON Filter Operators (Revised Attempt) (#6936)
* First commit

Cherry-picked from #6666

* Adjust release version number

Just in case we decide to make a release before we merge #6666
2022-09-02 18:15:45 +01:00
jeremy@jermolene.com 127f660c91 Edit widget: remove default text "Type the text for the tiddler 'foo'"
Fixes #6152
2022-08-28 15:12:51 +01:00
Mario Pietsch 2ff5bd5a0f
Fix removing a field with empty name (#6888)
* allow us to remove a field with empty key

* fix typo in if clause
2022-08-09 18:44:45 +02:00
jeremy@jermolene.com 667da96c97 Fix crash when closing plugin library
Fixes #6855
2022-07-31 15:35:14 +01:00
jeremy@jermolene.com 34b1b8128f Server: correctly print URL when running on IPv6
Since https://github.com/nodejs/node/issues/40537 users are more likely to encounter IPv6 connections.

IPv6 URLs require square brackets around raw addresses.

With this change VS Code correctly hyperlinks the message `Serving on http://[::1]:8080`
2022-07-29 10:07:59 +01:00
Saq Imtiaz 613b3df367
Image lazy loading (#6809)
* Extend image widget with lazy loading support

* docs: added from-version to docs update
2022-07-21 15:30:56 +01:00
Saq Imtiaz 0237d9ed94
feat(filters): extend :map filter run prefix to accept a suffix to enable mapflat (#6806) 2022-07-21 09:23:01 +01:00
Saq Imtiaz fe1147c6fd
Fix: restore drag and drop on mobile chrome (#6789) 2022-07-15 18:19:44 +01:00
Saq Imtiaz 19331cc6f9
Fix: brittle selector implementation for draggable widget (#6786)
* Fix: fixes #6595, brittle selector implementation for draggable widget

* Docs: updated for fix to selector implementation for draggable widget
2022-07-15 15:38:09 +01:00
Saq Imtiaz f6e021d70f
Feat: dynamically refresh class for draggable widget DOM node instead of re-rendering the widget (#6787) 2022-07-15 15:37:27 +01:00
Robin Munn 18d8173dcc
New insertafter filter operator (#6771)
* Implement insertafter operator (like insertbefore)

Currently, the behavior of insertafter if the target is not found is to
append the inserted tiddler to the end of the list, like insertbefore
does. In the next commit, we'll add a suffix to customize what both
insertafter and insertbefore do when the target is not found.

* Add failing tests for insertafter suffixes

Also includes tests for insertbefore suffixes (start/end), since we'll
be implementing both of those at the same time.

* Add start/end suffixes for insertafter/before

The tests that exercise the start/end suffixes now pass.
2022-07-13 17:08:17 +01:00
jeremy@jermolene.com f93fe50044 Fix anchor links do not work with addressbar=permalink and animationduration=0
Fixes #6757
2022-07-05 18:39:14 +01:00
jeremy@jermolene.com ceec7b5737 Style tweaks for #6755 2022-07-05 17:47:57 +01:00
Mario Pietsch 76bc2f7524
Fix svg foreignObject that contains DIVs (#6755)
* xmlns attribute defined in element takes precedence

* use predefined tagNamespaces variable as default value

* change code as suggested by Jeremy
2022-07-05 17:46:31 +01:00
FSpark 2c607ee8e6
Add storyTiddler to render command (#6746) 2022-06-29 08:58:40 +01:00
Nolan Darilek 7ac7d26f86
Add `alert` role to notifications so they're automatically spoken by screen readers. (#6743) 2022-06-28 17:48:03 +01:00
Nolan Darilek f02bd2392f
Various accessibility improvements (#6742)
* Add `main` and `article` roles to stories and story.

* Support `role` and \aria-checked` in buttons, and integrate with sidebar tabs.

* Add `region` role to sidebar, and set caption as `aria-label`.

* Add accessibility roles and labels to static templates.

* Update test fixtures with new ARIA tab attributes.
2022-06-28 14:05:52 +01:00
jeremy@jermolene.com 5e35c8dda6 Revert "Allow global keyboard shortcuts to work in framed editor (#6705)"
This reverts commit 8e64e21039.

See https://github.com/Jermolene/TiddlyWiki5/pull/6705#issuecomment-1162738927
2022-06-22 08:18:13 +01:00
jeremy@jermolene.com 35b0833e0c Fix handling of {!!title} in a filter with no currentTiddler
Fixes #6721
2022-06-14 08:33:47 +01:00
Maurycy Zarzycki 8e64e21039
Allow global keyboard shortcuts to work in framed editor (#6705)
Co-authored-by: Maurycy Zarzycki <maurycy@evidentlycube.com>
2022-06-11 08:57:08 +01:00
jeremy@jermolene.com 7e4722f07a Fix crash with missing palette tiddler 2022-05-25 18:08:08 +01:00
Cameron Fischer 696c5c9c7a
Compiled filters are cached (#6402)
* Compiled filters are cached

* Adjusting comments, and filtercache cap
2022-05-23 11:26:56 +01:00
Max Schillinger 7cbe1e1d83
Fix toggling of the numbered list prefix in Markdown tiddlers (#6697)
* Fix toggling of the numbered list prefix in Markdown tiddlers

* Define startsWith in utils.js because it's not available in ECMAScript5.1
2022-05-17 22:31:50 +02:00
Max Schillinger 5ea315fb98
Allow toggling wrap-lines text operations (like mono block) (#6698) 2022-05-17 22:16:54 +02:00
Simon Huber b4deb7cc45
Add tv-widgetnode-width and tv-widgetnode-height (#6681)
* Add tv-widgetnode-width and tv-widgetnode-height to collectDOMVariables

* Add docs

* update docs

* Update modified field
2022-05-09 10:42:23 +01:00
Simon Huber 4b8594c4a8
Fix: eventcatcher widget - variables can be undefined (#6668)
* Fix: eventcatcher widget - variables can be undefined

* Fix: selectedNode can be an svg where offsetLeft ... are undefined

* Make check for offsetLeft short

* remove second collectDOMNodeVariables
2022-05-06 17:11:13 +01:00
jeremy@jermolene.com 0bffae2108 Add utility method for getting ordered attributes 2022-04-26 14:02:31 +01:00
Simon Huber 1410488a23
Fix my error in framed.js (#6658)
* Fix my error in framed.js

* ouch
2022-04-25 08:45:42 +01:00
Simon Huber 3cf078faeb
Write the right "color-scheme" meta tag to the iframe of the framed text-editor (#6656)
* Write the right "color-scheme" meta tag to the iframe of the framed text-editor

* Update framed.js
2022-04-24 21:45:56 +01:00
Joshua Fontany 42bf203758
Fix 6649 (#6650)
* use filesystem utils

* use filesystem utils

* don't touch syncer

* fix messaging
2022-04-19 08:18:44 +01:00
Robin Munn 8dec674121
Allow checkboxes to be indeterminate (#6593)
* Documentation for indeterminate checkboxes

* Unit tests for indeterminate checkboxes

* Implement indeterminate checkboxes

* Simplify indeterminate checkbox example

* Slightly simplify refresh logic for indeterminate

That five-line if statement can be turned into a simple assignment.

* Use "yes" and "no" for checkbox indeterminate attr

This makes the "indeterminate" attribute of the checkbox widget work the
same way as other boolean attributes of other widgets.

* Fix bug with invertTag attribute

One place in the checkbox widget code was checking invertTag for
Javascript truthiness rather than the value "yes", which could have
produced incorrect results if anyone wrote invertTag="no". Fixed.
2022-04-18 20:50:03 +01:00
Jeremy Ruston fd0b985ac5
action-setfield shouldn't write to the current tiddler if the $tiddler attribute is present but has evaluated to a missing attribute
Fixes #5916
2022-04-16 18:02:27 +01:00
lin onetwo cc25e1f5b4
fix: formatDateString with [UTC]xxx didn't use passed date (#6615)
* fix: formatDateString with [UTC]xxx didn't use passed date

* test: for formatDateString UTC

* fix: not possible to test internal date without hijack

Expected '20220410073037515' to be '20220410073037516'.

* fix: hour
2022-04-16 17:10:57 +01:00
Simon Huber 2fd17e864c
Fix: dragndrop missing variables (#6632) 2022-04-15 17:05:27 +01:00
Simon Huber 030155ec27
Add "enabled" attribute to draggable widget (#6581)
* Add "enabled" attribute to draggable widget

* Update draggable.js

* Update draggable.js

* Update draggable.js
2022-04-15 14:17:06 +01:00
Simon Huber 58dd47d128
Add "tv-selectednode-width" and "tv-selectednode-height" ... (#6582)
* Add "tv-selectednode-width" and "tv-selectednode-height" ...

... variables to dragstartactions

* Update dragndrop.js

* Update dragndrop.js

* Add docs

* Update dragndrop.js

* Update dragndrop.js

* Update DraggableWidget.tid

* Update modifier Variable.tid

* Update modifier Variable.tid

* Update eventcatcher.js

* Update dom.js

* Update dragndrop.js

* Update dragndrop.js

* Update DraggableWidget.tid

* add a space after //

* Update modifier Variable.tid
2022-04-15 13:46:09 +01:00
jeremy@jermolene.com 73138b79aa Save command exit with error when encountering missing tiddlers
Fixes #6603
2022-04-06 17:18:13 +01:00
Cameron Fischer 6624ce3716
Fix for broken style block wikitext (#6599)
* Fix for broken style block wikitext

* Fixed it so styles are correct too
2022-04-06 08:33:38 +01:00
Simon Baird 39e4e69ae7
Show server response as error message in put saver (#6589)
* Show server response as error message in put saver

I'd like to use this on Tiddlyhost so users can get more informative
error messages if the put save fails for whatever reason.

This would make the put saver a viable replacement for the legacy
upload saver, which is what Tiddlyhost uses currently.

I'm not sure what standard WebDAV servers do, but I would guess they
don't provide any response body for put requests, and hence this
patch would have no impact for a standard WebDAV server. (That said,
it would be a good idea to test it to make sure there aren't any
unexpected regressions for WebDAV or other put saver compatible
services.)

* Access http response status directly in put saver

There's no need to extract it from the error string created inside
tw.utils.httpRequest if we can get it directly from the xhr object.

* Add 'Save starting' notification for put saver

There are two related changes here:

1. Add a 'Save starting' notification for the put saver, similar to
   the upload saver. Not sure if it was intentionally omitted for
   the put saver, but it seems reasonable to have the two be
   consistent.

2. Send the 'Save starting' notifications in both upload and put
   save right before the actual request is sent. While testing I
   noticed that the save might have failed before the "Save
   starting" notification appeared which doesn't seem useful.
2022-04-05 17:06:56 +01:00
Robin Munn e28af8d594
Checkbox widget: list and filter modes (#6561)
* Docs for CheckboxWidget list and filter modes

This documents the `listField` and `filter` attributes.

* Tests for checkbox widget list mode

* Implement checkbox list mode

* WIP on implementing filter attr for checkboxes

* Improve CheckboxWidget documentation

* Refactor checkbox tests: move function to top

The big findNodeOfType function belongs at the top of the describe
block, so that the checkbox tests are more compact and easy to read.

* Move checkbox widget tests to end of file

The checkbox widget tests are long and involved, so we'll move them to
the end of the file so they aren't a huge block of code you need to read
past to find the next test.

* Improve formatting of CheckboxWidget docs

The \define() calls that are short enough to fit on one line should be
put on one line, for readability. The ones that are quite long have been
kept on multiple lines, for readability.

* Added more passing tests for checkbox widget

* Add some failing tests for checkbox widget

The filter mode where neither checked nor unchecked is specified (in
which case an empty filter result means false and a non-empty result
means true) is not working yet.

* Make failing tests pass

* Uncomment (and improve) test for field mode

We're now ready to start working on making this test pass. (There was
also one small mistake in the test, which this commit corrects).

* All tests now passing

* No indeterminate checkboxes in simple modes

The simple checkbox modes (field and index) should not produce
indeterminate checkboxes. That should be reserved for the advanced modes
(list and filter).

* Minor improvement to unit tests

* Allow indeterminate checkboxes in list and filter modes

This change may require some tweaks to the unit tests to be able to test
it properly.

* Slightly easier to read tests

* Two more tests for list mode

* Greatly simplify unit test code

Turns out there's no need to jump through Object.getPrototypeOf hoops.

* Minor simplification of unit test

* Add tests for indeterminate in list & filter modes

With this, the set of tests is complete.

* More tests to specify list mode behavior

* Unfocus tests so all tests run

* Update docs to say "new in 5.2.3" insetad of 5.2.2

* Move checkbox widget tests into their own file

The test-widget.js file was getting too long with all the checkbox
tests added, so we'll move the checkbox tests into their own file.

* Add checkbox widget tests for index mode

This commit also adds tests for index list mode (with a listIndex
attribute that will parallel the listField attribute) but leaves them
commented out because they don't pass yet: the code that implements the
listIndex attribute hasn't been written yet).

* Add listIndex attribute to checkbox widget

* Remove code that lets checkboxes be indeterminate

This reverts commit 6afcb151be. We will
add this code back in a later PR.

* Remove indeterminate tests for checkbox widget

We're currently not allowing indeterminate checkboxes, so there's no
need for the tests that check for them.

* Document listIndex attribute of CheckboxWidget

* adds class tc-checkbox-checked when checked

* equivalent to #2182 (RadioWidget)
* also applies `tc-checkbox` to checkboxes by default, always

* Move macro definitions inside example text

Since the wikitext-example-without-html macro creates a new parsing
context, it's safe to have macro definitions inside it. That makes these
examples a lot easier to write, and to read.

* Remove all mention of indeterminate checkboxes

Also improve the documentation a little bit: mention what happens in
list mode if neither checked nor unchecked is specified.

* Move filter mode to bottom of checkbox docs

The `filter` attribute should be under both `listField` and `listIndex`
rather than being between them. The documentation for filter mode should
similarly be after the `listIndex` documentation.

* Improve docs for `class` attr of checkbox widget

This brings the wording of the `class` attribute more in line with how
it's worded in the RadioWidget docs.

* Fix bug with list tiddlers

If neither checked nor unchecked was specified, then the behavior should
be "empty = false, non-empty = true". But if *both* are specified yet
neither is found, then the checkbox should be unchecked (false). It had
been falling through to the "non-empty = true" behavior, which was wrong.

* Improve listIndex example of checkbox widgets

* Remove unused function from test-widget.js

Co-authored-by: Tobias Beer <beertobias@gmail.com>
2022-04-02 15:16:08 +01:00
jeremy@jermolene.com 6dbb3ee36e Revert scrollable changes e49dda3b48
See https://talk.tiddlywiki.org/t/stroll-issue-with-5-2-2/2885/2
2022-03-29 09:49:31 +01:00
jeremy@jermolene.com 681f22b66d Remove erroneously included code
See https://github.com/Jermolene/TiddlyWiki5/pull/6540#pullrequestreview-914281218
2022-03-18 12:40:12 +00:00
Jeremy Ruston b0c4886d23
Fix action-listops unsafe use of $tw.utils.stringifyList() (#6540)
Fixes #6535
2022-03-18 10:10:43 +00:00
Saq Imtiaz 977ea24e96
Fix: only refresh styles if the CSS has changed (#6537) 2022-03-17 21:19:49 +00:00
Mario Pietsch c741978e95
Fix the button default fix (#6531) 2022-03-16 11:57:56 +00:00
Mario Pietsch 28a91aafa7
Button Widget: ensure changes to "default" attribute trigger a refresh 2022-03-15 12:35:58 +00:00
Jeremy Ruston 1d8c538e45
Eventcatcher widget: add "matchSelector" attribute (#6523)
* Initial Commit

* Allow matchSelector to be used even if selector attribute isn't used
2022-03-14 09:56:23 +00:00
Saq Imtiaz aaf1aa3821
Improve affordances for new browser windows (#6498)
* feat: extend tm-open-window to allow opening the same tiddler in multiple templates, and introduce tm-close-window to close browser windows

* fix: use a windowID parameter to uniquely identify a window and introduce tm-close-all-tiddlers

* fix: whitespace

* fix: update variable
2022-03-02 17:34:02 +00:00
Ben Webber 2c38c8351b
Make butlast[0] consistent with rest (#6483)
butlast[0] now returns the input list unchanged.

Fixes: #5833
2022-02-26 09:42:24 +00:00
Ben Webber a51191d334
Support specifying insertbefore position title as parameter (#6477)
* Support specifying insertbefore position title as parameter

Closes: #6133

* Update insertbefore calls with new variable parameter syntax

See-also: 96b52606a (Support specifying insertbefore position title as parameter, 2022-02-21)
2022-02-24 11:08:06 +00:00
Saq Imtiaz 4054566493
Extend $draggable to support an optional drag handle (#6480)
* feat: extend  to support a selector attribute identifying the DOM element to be used as the drag handle

* fix: remove redundant variable declaration

* fix: remove extranneous variable declaration
2022-02-24 11:06:18 +00:00
Ben Webber 7a7472833f
Consider non-existent tiddlers untagged (#6478)
Fixes regression introduced in 575c23359.

Fixes: #6119
See-also: 575c23359 (Update untagged filter to avoid $tw.utils.pushTop (#6034), 2021-09-18)
2022-02-23 12:46:34 +00:00
Cameron Fischer d0b5b2124a
Is draft (#6442)
* corrected [!is[draft]] to be a proper complement

* Ensuring [is[draft]] and [!is[draft]] are complements

* Made [is[draft]] more analogous to .isDraft()
2022-02-22 16:41:29 +00:00
Ben Webber 95bd694a65
Support case insensitive matching in prefix/suffix operators (#6468)
* Support case insensitive matching in prefix/suffix operators

Support `caseinsensitive`/`caseinsensitive` suffixes in the following
filter operators:

  * prefix
  * suffix
  * removeprefix
  * removesuffix

The suffixes have the same behaviour as in the match operator.

Closes: #6407

* Do not filter titles if suffix/removesuffix operand is empty

Issue: #6407
2022-02-22 16:38:40 +00:00
Jeremy Ruston 82c8fe7fa8
Introduce JSON parse utility function with error handling (#6401)
* Introduce JSON parse utility function with error handling

Fixes #6400

* Fix typo
2022-02-21 15:29:25 +00:00
Jeremy Ruston 5378b45c40
Allow newlines within filtered transclusions (#6421)
* Allow newlines within filtered transclusions

* Docs
2022-02-21 15:28:21 +00:00
Jeremy Ruston ab3109d84b
Add support for directly setting style.* attributes on HTML elements (#6388)
* Support direct style attributes on the element widget

* Fix tests

Not all parse tree nodes have an "orderedAttributes" member (eg. the error message generated at 5613bcc884/core/modules/widgets/transclude.js (L73-L75))

* Ensure ordering isn't insertion dependent if orderedAttributes is missing

* Add docs
2022-02-21 15:24:06 +00:00
Cameron Fischer a4ab42da8a
findListingsOfTiddler should cache results (#6327)
* findListingsOfTiddler uses FieldIndexer now

* Turns out FieldIndexer can't help listed[]
2022-02-21 15:07:30 +00:00
Mario Pietsch 6b4e5c74ad
Add "some" flag to search operator (#6293) 2022-02-21 15:05:34 +00:00
Joshua Fontany d6d2bc455c
Fix server options (#5899)
* removed illegal cahracter in filename

* fixes required plugin options & updates docs

* Update dev docs

* call self.displayError

* Revert "call self.displayError"

This reverts commit 5d599aa979.

* adds path based auth (backwards compatible)

* refactor per-route auth

* get status bug

* server options

* server options

* server options, new 'server-settings' param

* reflow

* fix boot.origin

* refactor new parameters

* restore sitetitle as servername option

* Soft reset to master

* docs update

* tweak wording

* docs

* cleanup

* remove literal string

* cleanup docs

* formatting

* Remove per-path auth

* revert get-status

* fold in PR 5538

* remove server-options

* remove doc

* required-plugins a server-parameter, not option
2022-02-21 09:53:06 +00:00
Joshua Fontany 1d0af90ba2
Extend lookup operator to work with fields and indexes (#5742)
* extend lookup op flexibility with 2 parameters

* bumped .from macro to .24

* aligned syntax

* lookup fixes

* bugfix

* docs

* messed up the tests somehow

* docs fix

* lookup bugfix

* docs

* docs

* call self.displayError

* Revert "call self.displayError"

This reverts commit 5d599aa979.

* storylist

* tests

* tests pass
2022-02-21 09:48:29 +00:00
Saq Imtiaz 59572cd75d
Extend tm-open-window to support optional top and left position for new browser window (#6470)
* feat: extend tm-open-window to support optional top and left position for new browser window

* fix: whitespace correction

* Update WidgetMessage_ tm-open-window.tid
2022-02-20 11:23:27 +00:00
jeremy@jermolene.com 1d16206188 Add support for tm-relink-tiddler message 2022-02-19 09:38:48 +00:00
jeremy@jermolene.com 37a6ff8521 Move tm-rename-tiddler handling from navigator widget into startup module
This reverses an August 2015 change in 68e15c10641e2eda1e64cf29954786a07326a920; the original rationale was wrong: there is nothing related to the navigator widget in the implementation of the tm-rename-tiddler message
2022-02-19 09:20:32 +00:00
Cameron Fischer 1b3c2557b8
Fixed issue: deprecated regexp could cause crash (#6438)
* Fixed issue: deprecated regexp could cause crash

* Different fix which will bother plugins less
2022-02-07 16:39:29 +00:00
jeremy@jermolene.com e49dda3b48 Fix search results cutoff on narrow screens
Fixes #6440
2022-02-01 09:36:30 +00:00
jeremy@jermolene.com 1a0c831216 Add sha256 operator 2022-01-29 11:02:47 +00:00
Saq Imtiaz 75d10a2dc3
Fix: bug with importvariables widget when importing block mode widgets. fixes #6424 (#6426) 2022-01-27 17:35:18 +00:00
Saq Imtiaz 6452eb56a9
fix: bug introduced with 88812092fd fixes #6419 (#6420) 2022-01-24 19:17:09 +00:00
Saq Imtiaz 9fce8153df
Add support to tm-scroll message for scrolling without animating (#6410)
* feat: add support for animationDuration attribute of paramObject for tm-scroll message

* docs: added docs for animationDuration attribute of tm-scroll message

* fix: use .utils.hop instead of Object.hasOwnProperty()

* fix: do not check if object before calling utils.hop()

* fix: syntax
2022-01-24 09:44:04 +00:00
Saq Imtiaz d823856082
feat: add support for renderEnd method for storyviews in widget's render() method (#6409) 2022-01-19 19:48:02 +00:00
jeremy@jermolene.com 35f7a8ea06 Fix renaming a tiddler can result in duplicate tags
Fixes #6398
2022-01-14 16:57:30 +00:00
jeremy@jermolene.com 88812092fd Fix crash with "wrap-lines" text editor operation if prefix or suffix is missing
Fixes #6376
2022-01-09 17:43:34 +00:00
jeremy@jermolene.com 4e01fc1838 Radio widget should use default if field/index is missing
Fixes #6389
2022-01-09 17:17:12 +00:00
jeremy@jermolene.com 66ae1d6930 Image widget: Add classes for loading/loaded/error 2022-01-02 17:28:54 +00:00
jeremy@jermolene.com 60187dc59e Fix importing/upgrading encrypted single file wikis
The problem was that v5.2.0 trimmed the whitespace from $:/core/templates/store.area.template.html which we'd previously been relying on during the import.

This change still allows v5.2.2 to import encrypted pre-v5.2.0 wikis

Fixes #6330
2021-12-11 19:46:20 +00:00
Saq Imtiaz 76cdc17f3b
Support macro parameters in filter run prefixes (#6164)
* Support macro params in filter run prefixes and support substitution for variables set by filter run prefixes

* feat: add support macro parameters and variable substitution for all filter run prefixes

* fix: rename options argument to opts for disambiguation

* feat: add support for macro params to cascade filterrun prefix
2021-11-23 13:51:42 +00:00
Saq Imtiaz 7fcc84156e
Fix: issues with drag and drop in Chrome 96 (#6261)
* fix: issues with drag and drop (false positives in detection for files being dropped) introduced by Chrome 96

* fix: call dragEventContainsType method more consistently.

* fix: call dragEventContainsType method more consistently.
2021-11-21 20:48:16 +00:00
Jeremy Ruston a350a76a00
Add "cascade" filter run prefix and use it to control view templates (#6168)
* Initial Commit

* Set currentTiddler and ..currentTiddler for filter evaulation

* Precompile the filters for performance

* Add explicit test for empty result when no filter passes

* Use the cascade filter run prefix to choose the view template body template

* Use the cascade mechanism to choose between the edit and view templates

* Simplify cascade filter

Thanks @saqimtiaz

* Add control panel UI for inspecting the template cascades

* Refactor import listing and plugin listing as alternate body templates

As suggested by @pmario

* Refer to $:/core/ui/{View|Edit}Template via their associated config tiddlers

* Fix typo in previous commit

* Add demo of custom story tiddler template

* Tweak control panel wording

* Standardise "Story Tiddler Template" nomenclature

* Add a cascade for the editor template body

* Add a cascade for the view template title

* Avoid unwanted whitespace

* Add a cascade for dynamically choosing tiddler icons
2021-11-15 21:06:47 +00:00
jeremy@jermolene.com 9caba544eb Fix refreshing of codeblock widget
Fixes #6171
2021-11-05 08:28:56 +00:00
Saq Imtiaz b6ce353a7d
Fix: resolved search-replace operator regexp encoding bug (#6162)
* fix: resolved search-replace operator bug with $ character in replacement strings, added test and more examples

* fix: reset regexp after each title
2021-11-01 13:24:30 +00:00
Cameron Fischer 2bfe522b72
Add $let widget (#6148)
* $let widget added and tested

* Documentation for $let, doc improvements for $vars

* let properly avoids refreshing when possible

* $let Changes as recommended by others

* Removed superfluous super method call

Also improved $let test
2021-10-30 11:42:22 +01:00
Saq Imtiaz c099bf9893
Extends :map filter run prefix to provide missing variables (#6149)
* Extends :map filter run prefix to provide the variables index, revIndex and length to bring it into line with :reduce

* update :maps examples

* docs: fix formatting issue with documentation
2021-10-30 10:04:50 +01:00
Saq Imtiaz 4f65953da9
Added zero based zth[] operator and documentation (#6150) 2021-10-30 09:52:38 +01:00
Saq Imtiaz b5c81d2721
Provide actionValue variable to actions fired by EditTextWidget (#6145)
* feat: provide actionValue variable to actions fired by EditTextWidget

* also extend CodeMirror engine to set actionValue variable when invoking actions
2021-10-28 19:15:50 +01:00
jeremy@jermolene.com 2f3f9de7be Fix typo in d5f72cb282
Fixes #6143
2021-10-28 09:18:54 +01:00
Simon Huber d695fca301
Add `focus-editor` text operation and use it where sensible (#6012)
* add and use focus-editor text operation

* add docs
2021-10-27 11:37:40 +01:00
Simon Huber a0d2392f01
Update link-widget refresh method (#6013)
* update link-widget refresh method

* update link-widget refresh method
2021-10-27 11:37:08 +01:00
Jeremy Ruston 23b4e03cd5
Extend HTML tag parser to maintain an ordered array of attribute names (#6132)
* Extend HTML tag parser to maintain an ordered array of attribute names

* Add some tests for repeated attributes

* Record entire attribute in orderedAttributes array so that we can work with duplicated attributes
2021-10-27 11:35:12 +01:00
Jeremy Ruston d5f72cb282
Set multiple fields/variables/params using filters (#6130)
* Add action-setmultiplefields and setmultiplevariables, and extend action-sendmessage

* Add getfield operator

* Remove getfield operator

See discussion at https://github.com/Jermolene/TiddlyWiki5/pull/6130#issuecomment-949911439

* Add docs

* Adjust whitespace

* Add support for assigning multiple indexes to action-setmultiplefields
2021-10-27 11:20:11 +01:00
jeremy@jermolene.com 5f57bf81cd Merge branch 'pr/4977' 2021-10-27 11:18:57 +01:00
Joshua Fontany 2a73505508
Fix overwriting of modification fields when PUTting a tiddler #6075 (#6084)
* call self.displayError

* Revert "call self.displayError"

This reverts commit 5d599aa979.

* fix PUT bug with created/modified fields
2021-10-27 11:15:30 +01:00
jeremy@jermolene.com 4d87ef4231 Add a comment on the default value of tv-action-refresh-policy 2021-10-26 09:51:00 +01:00
Telumire c543036a0f
Add missing parameter to atan2 operator (#6142)
* Added missing trigonometrics filter operators

This PR adds support to trigonometry operators, allowing to create spider graphs and other geometric shapes with filters.

* Adds the missing trigonometric filter operators

This PR adds support to the missing trigonometric filter operators (cos, sin, tan, acos, asin, atan, atan2), allowing to create spider graphs, [pie charts, donut charts, polar charts](https://ffoodd.github.io/chaarts/pie-charts.html) and other geometric shapes with filters, which was previously not possible without add-ons.

Example :

`[[2]cos[]] = -0.4161468365471424`

See also this radar chart made in wikitext by @saqimtiaz using the new trigonometric operators :
https://saqimtiaz.github.io/sq-tw/temp/radar-chart-demo.html

* Add documentation for the Trigonometric Operators 

Accompanies code changes #6127

* Fix formatting of atan2 Operator.tid

Removed two empty lines at the end of the tiddler

* Add examples for the trigonometric operators 

Accompanies code changes Jermolene#6127

* Fix version in the doc for trigonometric operators

This PR fix the content of the documentation tiddlers regarding trigonometric operators (#6131). 

<<.from-version "5.1.20">> was changed to <<.from-version "5.1.21">>

* Fix formatting of atan2 Operator.tid

Removed two empty lines at the end of the tiddler

* Add missing parameter to atan2 operator

The atan2 operator needs two parameters (Binary Mathematics Operators), this PR adds the second one that was missing.

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atan2 for more technical info on the atan2 function.
2021-10-25 21:13:18 +01:00
jeremy@jermolene.com 8ae4428332 Fix $timestamp ignored for action-setfield widget when setting index values 2021-10-24 20:19:42 +01:00
Joshua Fontany 56dae90425
Fix $tw.utils.decodeURISafe and $tw.utils.decodeURIComponentSafe not available during boot process (#6107)
* call self.displayError

* Revert "call self.displayError"

This reverts commit 5d599aa979.

* fix 5999 URI utils bug
2021-10-20 16:25:05 +01:00
Telumire 1f6ef07860
Add trigonometric filter operators (#6127)
* Added missing trigonometrics filter operators

This PR adds support to trigonometry operators, allowing to create spider graphs and other geometric shapes with filters.

* Adds the missing trigonometric filter operators

This PR adds support to the missing trigonometric filter operators (cos, sin, tan, acos, asin, atan, atan2), allowing to create spider graphs, [pie charts, donut charts, polar charts](https://ffoodd.github.io/chaarts/pie-charts.html) and other geometric shapes with filters, which was previously not possible without add-ons.

Example :

`[[2]cos[]] = -0.4161468365471424`

See also this radar chart made in wikitext by @saqimtiaz using the new trigonometric operators :
https://saqimtiaz.github.io/sq-tw/temp/radar-chart-demo.html
2021-10-19 15:56:08 +01:00
jeremy@jermolene.com d5d73e02e9 Fix bug with innerwiki template
The problem was that the innerwiki template included the tiddler $:/plugins/tiddlywiki/railroad, which was omitted from the wiki. Unexpectedly, missing tiddlers were rendered by the jsontiddler widget as an empty object {}. The fix is to always include the title when the tiddler is missing.

Also cleaned up the template to remove unneeded tiddlers
2021-10-02 16:17:07 +01:00
Cameron Fischer 9c41fe1d18
JSONTiddler a little more extensible (#6057)
As per discussion #6043
2021-09-27 14:23:52 +01:00
jeremy@jermolene.com e577cf7302 Render command: verbose mode should print title before rendering
Fixes #6067
2021-09-24 18:40:34 +01:00
jeremy@jermolene.com ebf563ac70 Additional transliteration pairs
Fixes #6066
2021-09-24 18:29:40 +01:00
jeremy@jermolene.com 59a53e695b Further refine date format tokens for day of year and weekday number
See f223896c26
2021-09-23 10:09:27 +01:00
Jeremy Ruston 36dd8ea1d2
Optimise wiki.sortTiddlers() (#6053)
* Optimise wiki.sortTiddlers()

* Remove local changes to test-filters.js that have now been made on master

Makes the subsequent merge easier

* Fix bug with numeric sorts of textual values
2021-09-22 13:44:35 +01:00
Saq Imtiaz b965ae926b
Fix(action-confirm): check if event is defined before accessing its properties (#6063) 2021-09-22 13:43:02 +01:00
jeremy@jermolene.com bdbb884be0 MessageCatcher: Fix stack overflow when re-issuing a trapped message
This makes it possible to trap a message and then re-issue the same message within the action string without an infinite loop.
2021-09-20 16:46:26 +01:00
Saq Imtiaz ef2aeac7de
Added modulesproperty filter operator and extended modules operator (#6055)
* Added modulesproperty filter operator and extended modules operator. Docs included

* Removed spurious new line
2021-09-20 08:25:53 +01:00
Cameron Fischer 157afda2fc
Change backlinks to use LinkedList (#6050) 2021-09-19 19:58:45 +01:00
jeremy@jermolene.com fb4d77ef46 Improved fix for #5701
Reverts dbd3f835bf

Fixes #6042
2021-09-19 13:28:58 +01:00
Cameron Fischer 575c233597
Update untagged filter to avoid $tw.utils.pushTop (#6034) 2021-09-18 16:47:46 +01:00
Saq Imtiaz 2e59d770f7
Fix eventcatcher widget: check for event properties before accessing (#6048) 2021-09-18 15:08:15 +01:00
jeremy@jermolene.com f223896c26 Refine date format tokens for weekday number, and add support for day of year
See discussion at https://groups.google.com/g/tiddlywiki/c/tf23ByDXzxM/m/5Wx7PV36AwAJ
2021-09-17 14:52:08 +01:00
Saq Imtiaz de33b365ae
Fixed refresh bug with radio widget where the tc-radio-selected class is not correctly updated (#6044) 2021-09-17 12:52:27 +01:00
Cameron Fischer e9d8547a81
Optimise LinkedList filter ops to return iterator instead of array (#6035)
* filter ops don't LinkedList to array anymore

* LL.tiddlerIterator -> LL.makeTiddlerIterator

LinkedList method name change.
2021-09-16 22:22:44 +01:00
jeremy@jermolene.com e9e5d37ff0 Draggable widget: Add option to hide drag image
Thanks @ericshulman

Fixes #6027
2021-09-12 14:20:03 +01:00
jeremy@jermolene.com f70cee6907 Add new date format tokens for weekday number
See https://en.wikipedia.org/wiki/ISO_8601#Week_dates
2021-09-12 11:53:46 +01:00
Cameron Fischer 7282ec5286
Fix getCacheForTiddler to cache falsy values (#5413)
* getCacheForTiddler can cache falsy values

* Switch to "!== undefined" for getCacheForTiddler
2021-09-10 21:17:35 +01:00
jeremy@jermolene.com e6fd0caf6b Update range operator to use multiple operands
We still also support the old way of packing all three parameters into one operand with a delimiter
2021-09-07 17:16:09 +01:00
jeremy@jermolene.com 62b8a83741 Avoid MSIE crash
Fixes #6014
2021-09-01 09:56:17 +01:00
Simon Huber c13f04d838
Add `m` flag for multiline matches to search-replace filter operator (#5968)
* add m flag to search-replace operator and add tests

* update documentation

* Update test-filters.js

* Update test-filters.js

* Update search-replace Operator (Examples).tid

* Fix "Hello There" title (HelloThere)
2021-08-29 17:44:34 +01:00
Joshua Fontany 33eef0202d
Adds $tw.utils.decodeURISafe and $tw.utils.decodeURIComponentSafe (#5999)
* call self.displayError

* Revert "call self.displayError"

This reverts commit 5d599aa979.

* fixes decodeURI & decodeURIComponent
2021-08-29 13:39:32 +01:00
jeremy@jermolene.com a67b1b8bb5 Fileserver: Check for valid file paths 2021-08-28 13:16:54 +01:00
jeremy@jermolene.com 124b49456a MessageCatcher: Expose lists of the message property names 2021-08-21 12:50:38 +01:00
Saq Imtiaz 24956087cc
Do not add X-Requested-With header for simple requests (#5931) 2021-08-17 09:56:52 +01:00
Cameron Fischer b3accbf9e0
Fakedom: use text encoder for html text (#5950) 2021-08-12 16:46:11 +01:00
Joshua Fontany 99249a3160
Fix syncer logout alert (#5936)
* call self.displayError

* Revert "call self.displayError"

This reverts commit 5d599aa979.

* fix Syncer logout alert
2021-08-05 14:50:22 +01:00
jeremy@jermolene.com e9613d7f12 eventcatcher widget: Add viewport-relative coordinates
This is useful because we get viewport relative coordinates from the link and action-navigate widgets
2021-08-05 08:35:44 +01:00
jeremy@jermolene.com 97dff042f7 Reveal widget: fix crash when popup tiddler is refreshed but the popup is not displayed 2021-08-04 17:00:42 +01:00
jeremy@jermolene.com 2720072b23 Text editor: fix crash when assigning new value to file input controls
Fixes #5911
2021-07-30 16:31:42 +01:00
Joshua Fontany 0413c3a38e
Fix syncer error handling for getStatus (#5914) 2021-07-30 16:21:02 +01:00
jeremy@jermolene.com a4421f50c6 Git{hub|ea|lab} saver should wikify commit messages
Proposed in discussion https://github.com/Jermolene/TiddlyWiki5/discussions/5886#discussioncomment-1012593
2021-07-16 12:04:05 +01:00
Saq Imtiaz cb726f40fa
Fix: bug with List Widget where the counter-last variable is not always accurately updated on refresh (#5883) 2021-07-15 21:59:07 +01:00
Arlen22 be026aa308
Revert "Add server sent events (#5279)" (#5880)
This reverts commit 17b4f53ba2 according to Github Desktop.

git checkout that commit
revert commit in GitHub Desktop
git switch -c revert-sse
uncommit in Github Desktop
switch to master, bringing changes
resolve deletions with command line
2021-07-14 17:16:57 +01:00
Jeremy Ruston d455072f13
Add support for JSON-formatted tiddler store, and make it the default (#5708)
* Add support for JSON-formatted tiddler store, and make it the default

The change to `getTiddlersAsJson()` is to allow experimentation

* Move JSON tiddlers into their own store area, and fix support for encrypted tiddlers

Also add a dummy old-style store area for backwards compatibility

The current arrangement is that JSON tiddlers will always override old-style tiddlers.

* Use the deserialiser mechanism to decode the content

* Refactor $:/core/modules/deserializers.js before we start extending it

Cleaning up the helper function names and ordering

* Drop support for the "systemArea" div

It was only used in really old v5.0.x

* Update deserializer to support JSON store format and add some tests

* Life UI restrictions on characters in fieldnames

* Add another test case

* Correct mis-merge

* Remove toLowerCase() methods applied to fieldnames

* Insert line breaks in output of getTiddlersAsJson (#5786)

Rather than have the entire store on one line, insert a line break
after each tiddler.

* Refactor #5786 for backwards compatibility

* Only read .tiddlywiki-tiddler-store blocks from script tags

Prompted by @simonbaird's comment here: https://github.com/Jermolene/TiddlyWiki5/pull/5708#discussion_r648833367

* Clean up escaping of unsafe script characters

It seems that escaping `<` is sufficient

* Add docs from @saqimtiaz

Thanks @saqimtiaz

* Docs tweaks

* Remove excess whitespace

Thanks @simonbaird

* Fix templates for lazy loading

* Remove obsolete item from release note

* Clean up whitespace

* Docs for the jsontiddler widget

* Fix whitespace

Fixes #5840

* Comments

* Fix newlines in JSON store area

* Remove obsolete docs change

Co-authored-by: Simon Baird <simon.baird@gmail.com>
2021-07-14 09:15:30 +01:00
Saq Imtiaz 30925ee7bf
Update syntax for Eventcatcher (#5868)
* Update syntax for Eventcatcher to be consistent with MessageCatcher while being backwards compatible

* Update docs

* Update docs
2021-07-11 20:21:35 +01:00
cdruan 23fec9e390
Fix faulty external-js single-file wiki (#5570)
* Fix problems with building single-file wiki using external-js template

* core/templates/external-js/tiddlywiki5-external-js.html.tid,
  core/templates/external-js/save-all-external-js.tid,
  core/templates/external-js/save-offline-external-js.tid
  core/templates/external-js/load-external-js.tid:
  Fix #5343. Exclude client-server plugins in tiddler imports and to
  specify a working URL for loading tiddlywiki5.js from local disk.
  Mirror save/all and save/offline templates in the regular server
  edition.

  Fix #4717 (tiddlywiki5-external-js.html.tid)

* core/modules/saver-handler.js:
  Need the change to make single file autosave work with the external-js
  template.

* editions/server-external-js/tiddlywiki.info:
  Provide external-js related build targets.

* core/language/en-GB/Snippets/ExtJSReadme.tid:
  Temporary doc to supplement TW5.com's external-js section. Demonstrate
  that upgrade could be done on single-file wikis with an externalized
  TW core.

* core/language/en-GB/Snippets/GetTiddlyWikiJS.tid:
  Documentation. Meant to be included in every wiki and to help end
  users acquire tiddlywiki5.js.

* Pre-configure save-wiki template for end-users

* Remove the newline character at the end of the file.

* Trim "template" value in saveWiki()

* Safeguard the code from extraneous whitespaces in transcluded result.

* Rename and add versioning to downloaded tiddlywiki core JS

* Rename "tiddlywiki5.js" to "twcore-VERSION.js"

* Preload $:/config/SaveWikiButton/Template tiddler with the required
  external-js template value.

* Update external-js user documentation

* Add "download tiddlywiki core JS" menu item to the "cloud" button.

* Update build's target defintions associated with external-js template.

* Move the user doc to the tw5.com edition.

* Coding style update

* Undo template name changes

* Correct text & fill colors on some disabled buttons

* Add new "export tiddlywiki core" button under page control tools

This new button can export tiddlywiki's core JS from user's wiki as
long as the wiki is served with the regular "root" template. The
button will be ineffective, thus disabled, if the core has already been
externalized by the "external-js" template.

With this button, a full standalone html wiki can obtain the matching
core JS without TiddlyWiki on node.js. Once this is done, the html wiki
can be converted to using the "external-js" template.

* Alternate version of "save tiddlywiki core for offline use"

This version will fire up a "Save File" dialogue box when clicked,
instead of directing the user to a helper doc for further instruction.
It achieves this by using the "download" attribute of the <a> html tag.
It works on most modern desktop browsers, but older browsers (e.g. IE)
may display the file instead.

* Adjust font-weight to match other menu items

* Merge two user documentations into one

* Add user-browser-cache=yes to --listen command

* Update "export tiddlywiki core" button hint

* Simpler implementation for switching btw online/offline core URL

Shave off one template by using filtered transclusion to control
online/offline core URL.

* Update user doc

Update the user doc to clarify that build index step is not needed to
initialize a new wiki.

* Rename twcore to tiddlywikicore

* Reformat the user doc

* Rework export-tiddlywikicore button

Popup an error message instead of disabling the button when export
core cannot be performed.

* Revert "Correct text & fill colors on some disabled buttons"

This reverts commit e7dbb7e712.
2021-07-06 15:02:21 +01:00
jeremy@jermolene.com 0b71f25f74 Revert "Update sync methods (#5467)"
This reverts commit 8d7930f660.

See the discussion at https://github.com/Jermolene/TiddlyWiki5/pull/5467#issuecomment-873590578https://github.com/Jermolene/TiddlyWiki5/pull/5467#issuecomment-873590578
2021-07-05 19:26:20 +01:00
jeremy@jermolene.com 56068d8215 tm-navigate: add separate properties to access bounds of client rectangle
Makes it easier to use the client rectangle information within an action handler
2021-07-05 09:52:17 +01:00
jeremy@jermolene.com 3094e06236 Add support for full refreshing of action widgets
Fixes #5791
2021-07-02 14:33:38 +01:00
jeremy@jermolene.com f87b3bfcdb Extend messagecatcher widget to allow setting multiple handlers at once 2021-06-30 16:17:59 +01:00
jeremy@jermolene.com a0a0df9655 Update action-navigate widget with metakeys to match link widget 2021-06-30 16:11:21 +01:00
jeremy@jermolene.com 31c1584b9a Extend $tw.utils.removeArrayEntries to return the array 2021-06-30 16:10:52 +01:00
Saq Imtiaz 041c3e817c
Support for macro params in filter operands (#5836)
* Exploratory pass at adding support for macro params in filter operands

* whitspace correction

* rename varInfo to varTree for disambiguation

* Refactored parseMacroInvocation to be re-usable, performance improvements for variables with no params and tests

* Revised regular expression and removed spurious white space changes

* Revised regular expression and removed spurious white space changes

* More whitespace cleanup and added more tests for edge cases

* Added test for macro params with square brackets
2021-06-29 22:21:39 +01:00
Saq Imtiaz a6990128f1
Fixed bug introduced into transclusions for blank fields in #5736 (#5835) 2021-06-29 12:07:14 +01:00
jeremy@jermolene.com 338b7c92a2 Ensure tiddlers with fieldnames containing colons don't get saved in .tid file format
Prompted by discussion over at https://github.com/Jermolene/TiddlyWiki5/pull/5708#issuecomment-862399985
2021-06-27 21:27:57 +01:00
Mario Pietsch a409536ad0
Prevent scrolling of the page when modals are displayed (#5816)
* prevent scroll-chaining in modals

* make body overflow hidden to prevent background scrolling
2021-06-27 16:24:06 +01:00
jeremy@jermolene.com 83ee363cb4 Add charcode operator to make it easier to generate strings containing control characters
Avoids some confusing hacks. @saqimtiaz I'm guessing you might have already done something like this?
2021-06-22 21:52:00 +01:00
Adam Sherwood 63fa0c4fa4
Hook for closing tiddlers (#3797) 2021-06-22 19:51:35 +01:00
Saq Imtiaz 021e9b8c4d
:map filter run prefix with docs and tests (#5813) 2021-06-21 20:59:58 +01:00
jeremy@jermolene.com 2da7ae0b73 Action-createtiddler: Ensure child widgets are refreshed before invocation
Fixes #5791
2021-06-14 18:13:51 +01:00
Mario Pietsch 9c0d6a46cc
Add "commentpragma" html style rule (#5726)
* html-comment, that can be used in the pragma area

* add commentpragma test

* fix typo

* fix typo and change comments ab bit

* combine html-comment and pragma-comment and add some docs, how to use it

* Make docs simpler by removing caching info

* change h2 wording
2021-06-14 17:39:56 +01:00
Saq Imtiaz 8f9e8c1dee
Keyboard widget: provide variable for shortcut descriptor to actions. (#5782) 2021-06-14 12:03:59 +01:00
Simon Huber f2e26927c1
Add test for event.event.target being undefined in the tm-focus-selector listener (#5771) 2021-06-14 10:59:31 +01:00
Simon Huber 6dd1887f0b
Use event.event.view.confirm for confirmation messages in navigator.js and action-confirm.js (#5776) 2021-06-11 16:56:06 +01:00
Simon Huber 219beb13cc
Add test to storyviews if targetElement is null (#5767)
* Update classic.js

* Update pop.js

* Update zoomin.js

* simplify test in classic.js

* simplify test in pop.js

* simplify test in zoomin.js
2021-06-09 10:18:15 +01:00
Simon Huber c18b7527a7
Fix #5760 - tm-focus-selector doesn't work in new windows (#5766)
* Pass the original event to invokeActionString

* Update rootwidget.js
2021-06-06 12:42:28 +01:00
Simon Huber 2f1806ab6a
Keyboard widget: don't refresh when class changes (#5758) 2021-06-06 11:03:08 +01:00
Simon Huber afa4ea3d03
Make navigation in new windows work for storyviews (#5759) 2021-06-06 10:47:19 +01:00
Simon Huber 2b911ac11f
Make the insert- and remove-animations of storyviews work in new windows (#5755)
* Make classic storyview work in new windows, too

* Make pop storyview work in new windows, too

* Make zoomin storyview insert and remove animation work in new windows, too
2021-06-04 16:59:45 +01:00
jeremy@jermolene.com 056e6541a1 Revert 582b156d5f2b9b8b92f9289aa1288e1edb637450: Refresh non-action widgets before invocation 2021-06-02 21:47:28 +01:00
jeremy@jermolene.com 753bf8fe62 Revert "Revert "Transclude widget: refresh selectively when needed (#5736)""
This reverts commit 4f9dd50382.
2021-06-02 21:45:06 +01:00
jeremy@jermolene.com 4f9dd50382 Revert "Transclude widget: refresh selectively when needed (#5736)"
This reverts commit 2e695801b1.
2021-06-02 19:14:05 +01:00
Saq Imtiaz 2e695801b1
Transclude widget: refresh selectively when needed (#5736)
* Transclude widget: only refresh when transcluded text reference has changed, includes tests

* Refactor wiki.parseTextReference so it is re-usable for getting the parser info

* Re-arrange methods in wiki.js to improve diff readability
2021-06-02 13:58:30 +01:00
jeremy@jermolene.com 55c522ab8f Improve comments
As per @pmario's comment at 582b156d5f (commitcomment-51566608)
2021-06-01 11:49:05 +01:00
jeremy@jermolene.com 9faaa31299 Extend action-createtiddler to make new title available as a variable
I'm not sure if the docs are clear, but this is quite a big deal, and along with 582b156d5f makes working with action widgets a lot easier.
2021-06-01 09:41:14 +01:00
jeremy@jermolene.com 582b156d5f Refresh non-action widgets before invoking them
Fixes #5744
2021-06-01 09:28:04 +01:00
Joe Bordes 82ec63e711
style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
Miha Lunar 9b247f6d63 Removed fallback range logic 2021-05-29 20:30:04 +02:00
jeremy@jermolene.com 082aeb92ac Revert "extend lookup op flexibility with 2 parameters (#5315)"
This reverts commit 81b5fe944a.

See https://github.com/Jermolene/TiddlyWiki5/pull/5315#issuecomment-848725198 for explanation
2021-05-26 13:25:19 +01:00
Mario Pietsch c6ed4aa84e
allow us to import formerly blocked system tiddlers (#5479) 2021-05-25 22:21:57 +01:00
Mario Pietsch 123666c240
Add th-before-importing hook mechanism (#5464) 2021-05-25 22:19:58 +01:00
Mario Pietsch 68930ceb1b
Extend keyboard widget (#5648) 2021-05-25 22:18:37 +01:00
Joshua Fontany 8d7930f660
Update sync methods (#5467) 2021-05-24 21:16:23 +01:00
Saq Imtiaz 7a41283c6b
Format:titlelist operator (#5665) 2021-05-24 19:28:43 +01:00
Mario Pietsch 2ab0474e14
Fix configuration list of HTML5 block elements (#5469) 2021-05-23 17:50:27 +01:00
Cameron Fischer 61714cbda3
Fixed super minor issue with import pragma (#5521) 2021-05-23 17:39:06 +01:00
jeremy@jermolene.com 8fbf52e419 Don't issue plugin reload warning for plugin-type: import
Fixes #5719
2021-05-23 11:19:46 +01:00
jeremy@jermolene.com 485779f5b2 Fix crash when accessing variables in filters that don't have a widget context
This should catch a large number of crashes, including:

Fixes #5716
2021-05-22 20:00:24 +01:00
Saq Imtiaz 3fc7895af2
CurrentTiddler variable consistency in subfilters and prefixes (#5691)
* Make currentTiddler variable consistent in subfilters and filter run prefixes

* Updated filterun prefix and subfilter operators to use ..currentTiddler instead of outerCurrentTiddler
2021-05-22 19:43:37 +01:00
Saq Imtiaz 10b20657cc
Deserializers[] filter operator (#5673) 2021-05-22 10:50:11 +01:00
Saq Imtiaz 0003d70132
New text operation insert-text (#5707) 2021-05-21 10:35:40 +01:00
Joshua Fontany 81b5fe944a
extend lookup op flexibility with 2 parameters (#5315) 2021-05-21 10:11:23 +01:00
Saq Imtiaz 270ead4701
Eventcatcher: Fixed FF and IE bugs, added stopPropagation attribute (#5711) 2021-05-21 09:43:20 +01:00
Nicolas Petton 1ddc3ab037
Add throttling for changed tiddlers prefixed with $:/temp/volatile/ (#5458) 2021-05-21 08:51:15 +01:00
Saq Imtiaz 05d38054c8
Drag and drop images in the editor to import and insert (#5699)
* Merge

* Clean up

* More clean up

* Ensure image import works when type is not set, clean up post import actions

* Removed spurious new line

* For non image files insert a tiddler link

* Added documentation for new settings and features
2021-05-19 21:52:43 +01:00
jeremy@jermolene.com dbd3f835bf Fix crash when sorting by non-string fields
tags, list, created, modified are not stored as strings by default.

Fixes #5701
2021-05-19 14:10:39 +01:00
Saq Imtiaz b267a71f2d
Dropzone: persistent dragover state fix (#5688) 2021-05-16 14:01:46 +01:00
FlashSystems f4d7b2c7f7
Network performance optimizations for node.js (#5436) 2021-05-08 16:05:39 +01:00
Mario Pietsch cf56a17f28
allow unusedtitle macro to use the prefix parameter and fix wiki.generateNewTitle() (#5361) 2021-05-02 19:26:50 +01:00
Saq Imtiaz 3f98686153
Extend <-popup> to create floating popups that must be manually cleared (#5655) 2021-05-02 10:20:39 +01:00
Saq Imtiaz cb44cc0f2b
Add :sort filter run prefix (#5653)
* Add :sort filter run prefix, docs and tests. Also extended .utils.makeCompareFunction with a flag for caseSensitivity.

* Documentation updates

* Move case sensitivity handling entirely to utils method so it is reusable
2021-05-01 13:58:40 +01:00
Saq Imtiaz 44df6fe52f
Fixed issue with widget not being available to filter operator, added test (#5640) 2021-05-01 10:00:32 +01:00
Saq Imtiaz 07caa16e87
Extend dropzone to also use the specified deserializer for strings either dropped or pasted on to the dropzone. (#5601) 2021-04-27 10:15:27 +01:00
Simon Baird 30d23196b6
Add 401 and 403 error messages for the put saver (#5638) 2021-04-27 10:14:04 +01:00
Jeremy Ruston bf773eb39a
Add "average" filter operator for arithmetic mean (#5612) 2021-04-27 10:09:13 +01:00
jeremy@jermolene.com 4a99e0cc7d Change "index" attribute of list widget to "counter", and use 1-based counting
Extends #5611
2021-04-26 14:41:26 +01:00
Saq Imtiaz e2379b599e
Fixes Action-listops bug (#5644) 2021-04-26 11:29:16 +01:00
Saq Imtiaz 8203ee06c3
Allow suffixes for filter runs (#5252)
* Make filter run prefixes extensible

* Make filter run prefixes extensible

* Support rich suffixes for filter runs

* merged conflicts

* Pass suffixes to filterrunprefix
2021-04-25 19:37:47 +01:00
Mario Pietsch 8849ed0d46
Fix refreshing of select widget when attributes change (#5635) 2021-04-25 16:05:02 +01:00
Miha Lunar 62fdaa633a Fixed fallback range logic + added ranges to tests 2021-04-25 16:03:35 +02:00
Miha Lunar 79f5e6b498 Merge remote-tracking branch 'origin/master' into parser-ranges 2021-04-25 13:17:44 +02:00
Miha Lunar 23bd7e7817 Replaced restructuring and added fallback comment 2021-04-25 13:12:45 +02:00
Jeremy Ruston 85ba7ac041
Extend list widget with "index" attribute (#5611)
* Extend list widget with "index" attribute

* Fix refreshing bug

* Clarify performance note
2021-04-20 09:15:11 +01:00
jeremy@jermolene.com 89546b3357 Add a hidden setting to control HTML sandboxing 2021-04-11 10:10:16 +01:00
Saq Imtiaz eced60853f
Extend Dropzone widget (#5597)
* Extend dropzone widget with optional actions invoked after tm-import-tiddlers message has been sent. Allows triggering an alternative UX for the import

* Allow restricting a dropzone to specific mimeTypes via mimeTypes and mimeTypesPrefix attributes

* Use a mimeTypesFilter instead of the mimeTypes and mimeTypesPrefix attributes

* Updated refresh handling

* Syntax cleanup

* Replace references to mimeType with content type for consistency with existing documentation. Update documentation for DropZone widget
2021-04-10 09:48:50 +01:00
jeremy@jermolene.com b9647b2c48 Ensure Fieldmangler widget doesn't propogate events that it traps
Fixes #5593
2021-04-08 16:56:36 +01:00
jeremy@jermolene.com 28521d82f3 Revert "Extend transclude widget to optionally set variables"
Actually a partial reversion, because we're keeping the minor refactoring of makeChildWidget() in widget.js

This reverts commit 80ee5adb14.
2021-04-02 09:47:38 +01:00
Cameron Fischer ef6307a64e
Do not escape double quotes in tiddler DIVs to save space (#5383)
* double quotes are no longer escaped in html bodies

* changed tiddlyweb's html-div-tiddler; documentation

French version still needs a translation though
2021-04-02 09:32:32 +01:00
cdruan 3b35411aba
Change css-escape-polyfill to a tw uitility method (#5552)
* Replace css-escape-polyfill.js with escapecss.js utility module

* Add $tw.utils.escapeCSS() method and invoke that function within the
  escapecss operator.

* Add test cases for the "escapecss" filter operator

* Fix $tw.boot.doesTaskMatchPlatform() so it works as expected if
  a module's export.platforms contains more than one values

* Add missed files to the last commit
2021-04-02 09:25:01 +01:00
jeremy@jermolene.com d6ea369f5e Edit text widgets should use default text for missing fields 2021-03-31 14:15:01 +01:00
Joshua Fontany 3d608892bd
targeted fix for 5366 (#5416) 2021-03-26 08:42:31 +00:00
Joshua Fontany 5be647b610
Fix 4461 (#5522) 2021-03-26 08:41:41 +00:00
Joshua Fontany a2e7cc51b5
Fix 5483 & 3483 (#5504) 2021-03-26 08:39:32 +00:00
jeremy@jermolene.com 7f202f35b4 Minor refactoring for clarity
See 9af68297cd (r48540814)
2021-03-22 09:50:54 +00:00
jeremy@jermolene.com 9c31ff1fb1 Use window.setTimeout(fn,0) for $tw.utils.nextTick in the browser
It seems that best practice has now moved to using zero:

https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout
2021-03-22 09:08:32 +00:00
jeremy@jermolene.com 8aad7b00ab Render command: fix bug with multiple variable usage 2021-03-19 18:35:10 +00:00
jeremy@jermolene.com a38dc17300 Extend render command to allow multiple variables to be passed 2021-03-19 17:09:53 +00:00
jeremy@jermolene.com 9af68297cd Fix transclusion refreshing
Missed off 80ee5adb14
2021-03-19 16:14:15 +00:00
jeremy@jermolene.com 80ee5adb14 Extend transclude widget to optionally set variables
Partially fixes #5199
2021-03-19 15:37:59 +00:00
jeremy@jermolene.com a6958bfe85 Fix css-escape-polyfill.js on old iOS
Fixes #5546
2021-03-14 10:34:41 +00:00
jeremy@jermolene.com 7b1a0c6e6a Fix ES5 issue
Fixes #5545
2021-03-14 10:27:05 +00:00
Mario Pietsch 05acf3dce4
fix wiki.search options invert init problem (#5542) 2021-03-12 21:12:06 +00:00
jeremy@jermolene.com 9eda02868f Introduce messagecatcher widget 2021-03-09 18:07:07 +00:00
jeremy@jermolene.com 5e4430dbf9 Fix Radio widget to refresh selectively, and use the checked attribute properly 2021-03-07 15:49:07 +00:00
jeremy@jermolene.com d56e8764a1 Button widget: apply aria-expanded attribute when controlling a popup
Addresses (1) and (5) from #5519
2021-03-01 17:59:29 +00:00
jeremy@jermolene.com ef76349c37 Add support for utils-browser modules 2021-02-22 12:11:39 +00:00
jeremy@jermolene.com 50d0b6ee50 Modals: don't crash if options.event is missing
Raised here:

https://groups.google.com/d/msgid/tiddlywiki/3E83D2D3-42B2-4AA1-A042-52AB1D7B9B15%40gmail.com
2021-02-13 10:28:31 +00:00
Cameron Fischer c0dc2669c0
Preallocating in LinkedList's toArray method (#5488) 2021-02-11 13:39:50 +00:00
Joshua Fontany bfa062f23d
Fix filesystem (#5465) 2021-02-04 16:11:07 +00:00
jeremy@jermolene.com 9f9ce6595b Make it easier to subclass the wikitext parser with a custom rule set
We can now pass arrays of rule classes to the parser constructor, overriding the rules that would normally be used by the parser.

This allows us to create custom variants of the wikitext parser with their own content type.

It could also provide a basis for a new Markdown parser based on our existing wikitext parser but with new rules.
2021-02-03 15:13:56 +00:00
Simon Baird 12f1847475
Support upload saver without username/password (#5455)
The default behaviour is unchanged, but if you write "yes" to
$:/UploadWithUrlOnly then it will assume it's possible to upload
with a blank username and password, as long as the host is set.

The motivation is to support a upload plugin compatible upload
service that uses some method to authenticate other than the legacy
upload plugin user/password params.

Without this patch, the user would need to enter something random in
the user and password fields for TW to decide the upload plugin can
be used.
2021-01-31 15:32:18 +00:00
Dyllon Gagnier 3eefb3cce6
Fix backtracking issue with regex (#5401)
There was an unnecessary
2021-01-29 15:26:25 +00:00
Cameron Fischer 4c7dcb83d1
Fix for #3306, inline/block widget glitch (#5452)
* Fix for #3306, inline/block widget glitch

* Just realized we don't need to set lastIndex anymore

* Forgot that parseBlocks doesn't use options
2021-01-29 14:57:30 +00:00
Cameron Fischer 45355a7fcf
Wikirules now use better macrocall parser (#5451)
* wikirules now use better macrocall parser

Before, wikirules would use a deficient macrocall parser which couldn't
handle certain types of arguments. Now it uses the same one that the
widget parser uses. Less code!

* style changes and removing weird switch statement

That switch statement made more sense in an earlier iteration.

* comment improvements

* oops, wikirule macrocalls could do ONE thing better

* '=' wasn't allowed for widget macros, but why?

Now they're allowed for both widget macros and macrocall macros.
2021-01-29 13:26:31 +00:00
Nicolas Petton b205da2007
Minor cleanup of startup.js (#5409)
* Remove unused var declaration
* Remove trailing whitespaces
2021-01-15 16:55:52 +00:00
Nicolas Petton 17b4f53ba2
Add server sent events (#5279)
* Create server-sent-events.js

* Create sse-change-listener.js

* Implement server sent events

* Convert to ES5 and wrap in function

* Use the host string from tiddlyweb

* Improve comments in sse-server.js

* Can't use object reference as key

* Add retry timeout

* Fix a bug

* bug fix

* Fix formatting

* Fix ES5 compat

* capitalize comments

* more fixes

* Refactor tiddlywek/sse-server.js

* Extract helper functions for handling wikis and connections.
* Replace JSDoc comments.
* Fix formatting according to TW core.
* Simplify the logic for adding and removing connections.

* Fix formatting of tiddlyweb/sse-client.js

Fix formatting according to TW core.

* Fix formatting of server-sent-events.js

Fix formatting and comments following TW core guidelines.

* Extract a debounce function in sse-client.js

* Avoid using startsWith in server-sent-events.js

startsWith is part of ES2015, while TiddlyWiki uses the 5.1 dialect.

* New sse-enabled WebServer parameter

* If not set to "yes", disabled SSE request handling.
* Add documentation for the parameter in core/language/en-GB/Help/listen.tid
* Add new tiddler editions/tw5.com/tiddlers/webserver/WebServer Parameter_ sse-enabled.tid

* Disable polling for changes if SSE is enabled

* Add sse_enabled to /status JSON response
* Store syncer polling status in $:/config/SyncDisablePolling
* Handled disabling polling in core/modules/syncer.js

* Simply boolean logic in syncer.js

* Delete trailing whitespaces in syncer.js

Co-authored-by: Arlen22 <arlenbee@gmail.com>
2021-01-15 10:37:55 +00:00
jeremy@jermolene.com ca95f1069f Fixed comment parsers to match end marker correctly
Fixes #5396
2021-01-13 11:48:42 +00:00
Cameron Fischer 65932a9b21
Memory efficient linked list (#5380)
* Outlines of the mem efficient linked list

Need to stop for now. Found problem with $tw.utils.pushTop that I need
consultation for.

* Link list throws when given non-string vals

* Think I got rid of the last LinkList infinite loops

* LinkedList push better; fixed coding conventions

* Cleaning up LinkedList code and tests

* Ready to ship new mem efficient Linked List

* Switching to double quotes in LinkedList
2021-01-09 20:52:34 +00:00
Simon Huber 4858b24cfe
Fix #5308 - WidgetSubclassingMechanism not working with widgets that add EventListeners (or logic ?) in constructor (#5382)
* add EventListeners in the render() method instead of the constructor

* scrollable widget: add EventListeners in render() method instead of constructor +

... move logic from constructor to render()

* linkcatcher: add EventListeners in render() instead of constructor

* fieldmangler: add EventListeners in render() instead of constructor

* edit-bitmap: initialise editorOperations in render() instead of constructor

* list-widget: initialise storyviews in render() instead of constructor

* vars widget: execute Widget.call(this) in render() instead of constructor

... not shure what this should do

* Update fieldmangler.js

* Update edit-bitmap.js

* Update linkcatcher.js

* Update navigator.js

* Update scrollable.js

* Update list.js

* Update vars.js
2021-01-09 13:25:48 +00:00
Cameron Fischer b632cea6b7
Fixed issue where [lookup[]] could emit undefined (#5376) 2021-01-07 18:19:50 +00:00
Cameron Fischer e280f89ca5
Converting [links[]] to use better LinkedList (#5369) 2021-01-05 17:36:18 +00:00
Cameron Fischer be70e5851d
Taking advantage of linkedLists in all operator (#5362)
* Taking advantage of linkedLists in all operator

* Test to confirm [all[]] with LinkList is the same
2021-01-04 08:38:50 +00:00
Joshua Fontany 03626bc142
always test ext in tiddler title and remove it (#5329)
* always test ext in tiddler title and remove it

* patch custom ext length vulernability
2021-01-03 11:50:14 +00:00
jeremy@jermolene.com d25e540dd2 Add support for image/vnd.microsoft.icon content type
Fixes #5357
2021-01-03 10:04:52 +00:00
jeremy@jermolene.com a9a36b641a Filename for action-confirm widget should be 'action-confirm.js' for consistency 2020-12-22 11:50:26 +00:00
Saq Imtiaz 1e9cc2b747
Fix refresh for all attributes of droppable widget. Add disabled class (#5280) 2020-12-15 11:09:32 +00:00
Joshua Fontany d50f6b406e
filesystem cleaup around hook (#5276) 2020-12-14 09:50:53 +00:00
jed c1a1e272cc
Add a hook to allow modifying the the behaviour creating tiddler paths (#5267)
* Add a hook to allow modifying the the behaviour creating tiddler paths

This is needed for Bob to use the core to generate tiddler fileInfo 

I don't know if this is the best way to make the hook, but it works for what I need

* update th-make-tiddler-path arguments

the value is the current path, the parameter passed in is the original unmodified path so it is available to subsequent hooks
2020-12-13 23:24:23 +00:00