Commit Graph

2806 Commits

Author SHA1 Message Date
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