1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-29 16:53:14 +00:00
Commit Graph

2913 Commits

Author SHA1 Message Date
jeremy@jermolene.com
a5afed9384 Fix crash with illegal tag names for element widget
Fixes #7122
2022-12-20 17:31:51 +00:00
jeremy@jermolene.com
b37a356b5e Crash with <$genesis $type="" />
Fixes #7140
2022-12-20 16:45:29 +00:00
Jeremy Ruston
0ce5788747
Fixes for JSON operators (#7105) 2022-12-09 18:31:23 +00:00
jeremy@jermolene.com
0db987da60 Minor tweaks for #7073 2022-12-04 11:03:51 +00:00
Carlo Colombo
a93a499684
Add commands command to run commands returned from a filter (#7073) 2022-12-04 10:59:59 +00:00
lin onetwo
451a3454b5
Optionally allow click outside to close modals (#7072)
* feat: option to allow click on modalBackdrop to close modal

* feat: allow switcher modals closable

* feat: allow use caption field as modal title

* refactor: make maskClosable a variable

* fix: use "true"

* fix: code style

* docs: add description about maskClosable

* fix: convention is to have double quotes for strings in the TW core

* refactor: using a "mask-closable" field on the modal tiddlers instead of as a message parameter

* docs: move to modal tid

* Update WidgetMessage_ tm-modal.tid
2022-12-03 17:26:44 +00:00
Mohammad Rahmani
45a7eb1c03
Add new focus attribute to $select widget (#7081)
* Add focus attribute to $select widget

This address https://github.com/Jermolene/TiddlyWiki5/issues/7070

* Update SelectWidget.tid

Update the documentation for $select widget to include the new attribute: focus
2022-12-03 08:22:21 +00:00
FlashSystems
3918e59cc1
Fixed PR to fix popup position if popup is triggered from within an offsetParent element (#7013)
* Fix popup location for tables

This commit introduces the `popupAbsCoords` option to the $button widget
and implements an absolut coordinate format.

Coordinates for popups are stored in the format `(x,y,w,h)`. These
coordinates are relative to the offset parent of the element that
defines the popup.

This commits adds a second format `@(x,y,w,h)`. Coordinates specified in
this format a relative to the pages root element.

The `popupAbsCoords` option of the $button widget enables the use of
this coordinates.

* Unify the declaration of the RegEx for parsing the popup-position

The regular expression was declared in three locations with the same
content. This commit supplies a new function `parseCoordinates` in
`popup.js`. This function returns the parsed coordinates and understands
the classic/absolute coordinates.

This function is used in `reveal.js` and `action-popup.js` to parse the
coordinates.

* Add documentation for coordinate systems

* Consolidate creating coordinate strings

The Popup object now contains a `buildCoordinates` method that can be
used to build coordinate strings. It takes an "enum" for the coordinate-
system to use. This makes everything easily extensible and prevents the
use of magic values.

* Add tests for `parseCoordinates` and `buildCoordinates`

* Add `tv-popup-abs-coords` to `collectDOMVariables`

This will make the absolute coordinates available for the
`DraggableWidget` and the `EventCatcherWidget`.

* Add documentation for the `tv-popup-abs-coords`

... to the `DraggableWidget` and the `EventCatcherWidget`.

* Fix crash when generating a static version of the TW

The Popup class is not initialized in `startup.js` if `$tw.browser` is
not true. After having consolidated the facilities for parsing
coordinate strings into `popup.js` this breaks because the static build
needs to parse coordinate stings even if no Popup module is initialized.
This commit solves this problem by making `readPopupState`,
`parseCoordinates` and `buildCoordinates` static methods of `popup.js`.
It also adds a comment to these functions to show that these can be called
safely even if the Popup-Class is not initialized.
2022-12-01 21:16:44 +00:00
lin onetwo
f7ccba4c25
Add "code" and "key" to propogateKeydownEvent's cloneEvent (#7071)
* feat: add key

* feat: add code
2022-11-30 10:17:10 +00:00
Cameron Fischer
856aca2f92
Linked-List refactor (#6056)
* Added failing linked-list test for #7059

* Fixed linked-list remove bug #7059

* Added failing linked-list test for #7059

* Switched LinkedList to use Map

* Removed this.last from LinkedList

* Removed this.first from LinkedList

* Switching to deleting old LinkedList entries

* LinkedList rewritten to be better

* Using null as LinkList ends to reduce hashing

* Using adhoc map... cause it's better than ECMA6 Map

* compliance with TiddlyWiki coding conventions

* Made link-list tests confirm the prev links

Co-authored-by: btheado <brian.theado@gmail.com>
2022-11-27 17:48:08 +00:00
btheado
bea1a6b14f
Fix issue with linked list remove (#7065)
* Added failing linked-list test for #7059

* Fixed linked-list remove bug #7059
2022-11-26 15:05:10 +00:00
jeremy@jermolene.com
00927d2e13 Add parsermode pragma
Fixes #7058
2022-11-23 22:35:32 +00:00
Jeremy Ruston
cb0d0cfa6d
Support nested macro definitions (#7004)
* First commit

* Switched to \end <name> instead of all those repeated backslashes

Thanks @kookma. See https://github.com/Jermolene/TiddlyWiki5/pull/7004#issuecomment-1286429236

* Docs update
2022-11-22 17:10:37 +00:00
Maurycy Zarzycki
d32d559f93
Add Timestamp to DateFormat (#7043)
* add Timestamp to DateFormat

* improve TIMESTAMP documentation
2022-11-21 16:13:34 +00:00
Maurycy Zarzycki
4f7b10e055
CSV parser improvements (#7042) 2022-11-20 17:51:01 +00:00
Maurycy Zarzycki
6955f14c3c
add a hidden config to disable Syncer logging to the console (#7049) 2022-11-20 17:26:14 +00:00
Cameron Fischer
3be9b13814
Fix for #4767: lazy-loading deletes tiddler bodies (#7014) 2022-11-02 17:26:08 +00:00
jeremy@jermolene.com
b9d27e9fd5 Revert "Fix popup position if popup is triggered from within an offsetParent element (#6887)"
This reverts commit 5b85786f73.
2022-10-22 13:22:15 +01:00
FlashSystems
5b85786f73
Fix popup position if popup is triggered from within an offsetParent element (#6887)
* Fix popup location for tables

This commit introduces the `popupAbsCoords` option to the $button widget
and implements an absolut coordinate format.

Coordinates for popups are stored in the format `(x,y,w,h)`. These
coordinates are relative to the offset parent of the element that
defines the popup.

This commits adds a second format `@(x,y,w,h)`. Coordinates specified in
this format a relative to the pages root element.

The `popupAbsCoords` option of the $button widget enables the use of
this coordinates.

* Unify the declaration of the RegEx for parsing the popup-position

The regular expression was declared in three locations with the same
content. This commit supplies a new function `parseCoordinates` in
`popup.js`. This function returns the parsed coordinates and understands
the classic/absolute coordinates.

This function is used in `reveal.js` and `action-popup.js` to parse the
coordinates.

* Add documentation for coordinate systems

* Consolidate creating coordinate strings

The Popup object now contains a `buildCoordinates` method that can be
used to build coordinate strings. It takes an "enum" for the coordinate-
system to use. This makes everything easily extensible and prevents the
use of magic values.

* Add tests for `parseCoordinates` and `buildCoordinates`

* Add `tv-popup-abs-coords` to `collectDOMVariables`

This will make the absolute coordinates available for the
`DraggableWidget` and the `EventCatcherWidget`.

* Add documentation for the `tv-popup-abs-coords`

... to the `DraggableWidget` and the `EventCatcherWidget`.
2022-10-22 13:13:39 +01:00
Rob Hoelz
24dbf69180
Fix [is[variable]] operator doesn't work for "fake" variables #6303 (#6996)
* Add tests for [is[variable]] and "faked" variables

See GH #6303

* Make is[variable] and variables[] operators resilient to fake widgets

Co-authored-by: jeremy@jermolene.com <jeremy@jermolene.com>
2022-10-18 17:08:04 +01:00
jeremy@jermolene.com
b531984f50 Restore "Add default settings for styled inline SPANs (#6877)"
This reverts commit 6f98edd6bd.
2022-10-16 17:28:36 +01:00
jeremy@jermolene.com
8f079e2d45 Fix handling of orderedattributes when adding classes/styles
Fixes issue referred to in https://github.com/Jermolene/TiddlyWiki5/pull/6877#issuecomment-1277590200
2022-10-16 17:27:46 +01:00
Maurycy Zarzycki
cfd894e6fb
allow select widget class to update if it uses a filter and is output changes (#6987)
* allow select widget class to update if it uses a filter and the filter output changes

* rewrite code to be more idiomatic + updates local property
2022-10-15 12:26:21 +01:00
jeremy@jermolene.com
6f98edd6bd Revert "Add default settings for styled inline SPANs (#6877)" because of failed tests
This reverts commit 23e0eeb556.
2022-10-07 18:43:09 +01:00
Mario Pietsch
23e0eeb556
Add default settings for styled inline SPANs (#6877)
* add default settings for styled inline SPANs

* change color names in palettes and vanilla-base

* change parser behaviour if custom class is used

* tc-inline-style will only be set if no other custom setting is appliead

* Add tests for inline-styles

* add one more test

* remove space after if
2022-10-07 18:05:49 +01:00
Maurycy Zarzycki
f33c7e2aef
Allow global keyboard shortcuts to override all other shortcuts by providing a special field (#6735)
* allow global keyboard shortcuts to override all other shortcuts by providing a special field

* rework the global shortcuts taking priority

* replace bool option with options object in KeyboardManager's keydown handler

* update keyboard shortcut documentation to add information about the new priority setting

* add support for priority global keyboard shortcuts to code mirror

* update the feature's docs to point out it was/will be introduced in 5.2.4

* rollback unnecessary change
2022-10-07 17:31:04 +01:00
jeremy@jermolene.com
1841b0fa4f Fix tests 2022-10-01 14:05:13 +01:00
jeremy@jermolene.com
47f80339b2 Update transclude widget to use error widget
Missed off #6970
2022-10-01 10:15:14 +01:00
Jeremy Ruston
db6abb9703
Improve recursion detection for transclusion and filters (#6970) 2022-10-01 10:13:40 +01:00
jeremy@jermolene.com
1df4c29d73 Relax the restriction on the let widget being unable to create variables starting with a dollar 2022-10-01 09:47:26 +01:00
Jeremy Ruston
4e9267ea58
Introduce genesis widget (#6961)
* Initial Commit

* Fix version number

* Fix docs date
2022-09-24 14:07:42 +01:00
jeremy@jermolene.com
81ac987484 Optimise variable prototype chain handling
With this improvement and 53d229592d I'm measuring a 10-15% performance improvement between v5.2.3 and master using https://github.com/Jermolene/tiddlywiki-performance-test-rig
2022-09-24 08:28:16 +01:00
jeremy@jermolene.com
0a00da6db9 Optimise fake dom
Object.setPrototypeOf() appears to be significantly faster
2022-09-23 18:09:45 +01:00
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