1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-13 07:24:21 +00:00
Commit Graph

988 Commits

Author SHA1 Message Date
jeremy@jermolene.com
5b271bb4f4 Fix nonstandard initialisation code for fill/parameter/slot widgets 2023-04-06 08:50:47 +01:00
jeremy@jermolene.com
f9751f19b6 Merge branch 'master' into parameterised-transclusions 2023-03-12 16:19:30 +00:00
jeremy@jermolene.com
589813f233 Improved fix for #7270 2023-03-10 09:41:36 +00:00
jeremy@jermolene.com
007b759421 Undefined variables in let widget: Revert fix for #7270
Reverts 8c378e0d24 and adds a test
2023-03-10 09:41:18 +00:00
jeremy@jermolene.com
ea055f2ba5 Merge branch 'master' into parameterised-transclusions 2023-02-28 08:45:56 +00:00
Saq Imtiaz
5bce35d90b
Fix: add twEditor attribute to paste events handled by codemirror (#7281) 2023-02-28 08:35:15 +00:00
jeremy@jermolene.com
8c378e0d24 Let widget should specify a default value for variables
Fixes #7270
2023-02-25 13:41:13 +00:00
btheado
95dc56d850
Fix importTitle and autoOpenOnImport in the tm-import-tiddler message (#7243)
* Add initial tm-import-tiddler test

* Add failing test for tm-import-tiddlers importTitle #7234

* Add failing test for tm-import-tiddlers autoOpenOnImport #7234

* Use event.paramObject instead of event to access tm-import-tiddlers options. Fixes #7234.

* Added a clarifying comment

* Allow mixing tm-import-tiddler params in both event and event.paramObject

* Added import test using tv-auto-open-on-import variable

* Removed stray punctuation
2023-02-11 09:15:44 +00:00
jeremy@jermolene.com
0d1667c467 Merge branch 'master' into parameterised-transclusions 2023-02-10 16:04:08 +00:00
Cameron Fischer
028dfe39b7
Fixed issue where $genesis didn't pass isBlock (#7230)
* Fixed issue where $genesis didn't pass isBlock

* Added $mode attribute for genesis

* Added documentation for $mode attribute
2023-02-10 10:17:32 +00:00
jeremy@jermolene.com
683414f51e Fix positional parameters in widget.evaluateVariable()
This should clear up the remaining anomalies in #7009, let me know how you get on @btheado
2023-01-23 16:34:08 +00:00
jeremy@jermolene.com
34afe4e143 Refactor function invocation
* Introduce new widget helper function to evaluate variables.Functions are evaluated as parameterised filter strings, macros as text with textual substitution of parameters and variables, and procedures and widgets as plain text
* Refactor the function operator and unknown operator to use the new helper
* Use the new helper to evaluate variables within filter strings, thus fixing a bug whereby functions called in such a way were being returned as plain text instead of being evaluated
* Refactor the transclude widget to use the new helper
* Update tests
2023-01-21 22:07:34 +00:00
jeremy@jermolene.com
a62d7f1b0d Merge branch 'master' into parameterised-transclusions 2023-01-21 20:45:21 +00:00
Jeremy Ruston
a5894946de
Extend encodeuricomponent to process additional characters (#7128)
* First commit

* Fix version number in docs

* Add code comment
2023-01-19 17:45:54 +00:00
jeremy@jermolene.com
586d44f6ce Allow missing tiddlers to be deleted (ie closed)
Fixes #7217
2023-01-18 16:50:58 +00:00
jeremy@jermolene.com
81002f9f30 Merge branch 'master' into parameterised-transclusions 2023-01-17 16:40:47 +00:00
Mario Pietsch
c51816e826
Fix pasting of multiple types at once (#6622)
* wip fix dropzone closure variable problem

* just a new commit to autocreate at test wiki
2023-01-17 15:02:57 +00:00
jeremy@jermolene.com
fecb7edca4 Fix typo in messagecatcher widget
I think this was a copy-paste error, but would appreciate other eyes on this...
2023-01-16 19:34:02 +00:00
jeremy@jermolene.com
a45349cc99 Fix detection of empty transclusions
See https://talk.tiddlywiki.org/t/exploring-default-tiddler-links-hackability-in-v5-3-0/5745/25?u=jeremyruston
2023-01-11 08:57:54 +00:00
jeremy@jermolene.com
4f96465141 Merge branch 'master' into parameterised-transclusions 2023-01-07 09:34:11 +00:00
jeremy@jermolene.com
42a408146d Empty or missing type on genesis widget should not render an element/widget
Fixes #7153
2022-12-30 21:42:07 +00:00
jeremy@jermolene.com
76e3a341da Merge branch 'master' into parameterised-transclusions 2022-12-21 17:26:10 +00:00
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@jermolene.com
31f4c1f6af Merge branch 'master' into parameterised-transclusions 2022-12-05 17:21:33 +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
jeremy@jermolene.com
9f42007899 Filter run prefixes should use widget.makeFakeWidgetWithVariables 2022-10-25 14:13:38 +01: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
jeremy@jermolene.com
b426724f35 Fix macrocall refresh issue
It turns out that this.transcludeTitle is always truthy, even if we are transcluding a variable

Fixes #7001
2022-10-20 15:08:05 +01:00
jeremy@jermolene.com
32710ef9e6 Merge branch 'master' into parameterised-transclusions 2022-10-18 17:23:57 +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
3a4589dc79 Transcluding functions: fix missing parameters passed as undefined
Thanks @btheado – see https://github.com/Jermolene/TiddlyWiki5/pull/6666#issuecomment-1276187372
2022-10-12 17:15:39 +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
93100a1c8f Remove support for conditional definitions
It was introduced for use cases associated with the global mechanism that was dropped in e3d13696c8
2022-10-03 14:39:45 +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@jermolene.com
668168dfea Some widget.js cleanups 2022-09-27 08:58:10 +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
e3d13696c8 Remove implementation of $:/globals/
Performance with this implementation is inherently poor because of the need to perform a wiki lookup for each child widget created.
2022-09-24 12:56:06 +01:00
jeremy@jermolene.com
1aba8a1f65 Slight optimisation to user defined widgets 2022-09-24 12:41:28 +01:00
jeremy@jermolene.com
fddaa9fdb1 Merge branch 'master' into parameterised-transclusions 2022-09-24 11:07:53 +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
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
jeremy@jermolene.com
8f9d5cabaa Missing tests for parameters widget 2022-09-16 16:07:32 +01:00
jeremy@jermolene.com
977a133028 Tweak comments 2022-09-09 14:16:08 +01:00
jeremy@jermolene.com
b751f7e793 Parameters widget: protect against negative $depth 2022-09-09 12:04:50 +01:00
jeremy@jermolene.com
82b22523aa Rejig genesis widget to be easier to use 2022-09-09 10:37:39 +01:00
jeremy@jermolene.com
e3697e29bb When transcluding functions, pass an empty item list to the filter, and just return the first item 2022-09-09 10:22:06 +01:00
jeremy@jermolene.com
11e0c66a4c Transcluded functions should operate on the entire store 2022-09-03 20:11:45 +01:00
jeremy@jermolene.com
a439cb58be Fix caching of parse variables/macros/procedures 2022-09-03 20:11:23 +01:00
jeremy@jermolene.com
00b6645c94 Disable overriding core widgets in safe mode 2022-09-03 12:58:10 +01:00
jeremy@jermolene.com
2b8b133d4a Merge branch 'master' into parameterised-transclusions 2022-08-17 18:11:21 +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
9317804464 FIx transcluding of functions
This first implementation concatenates the results of the filter (with no separator) and then wikifies the result.

The test in this commit is quite interesting...
2022-08-04 09:28:56 +01:00
jeremy@jermolene.com
6207ec4812 Merge branch 'master' into parameterised-transclusions 2022-08-02 17:49:28 +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
jeremy@jermolene.com
b1cf9f241e Merge branch 'master' into parameterised-transclusions 2022-07-21 10:10:49 +01:00
jeremy@jermolene.com
745707fea3 Parameters widget: Be defensive about negative depths 2022-07-19 10:27:36 +01:00
jeremy@jermolene.com
d4e0eb193b Slot widget: be more defensive about negative depth values 2022-07-19 10:26:20 +01:00
jeremy@jermolene.com
a2182255cc Simplify the fill widget
We can rely on the default processing in the base class
2022-07-19 10:02:09 +01:00
jeremy@jermolene.com
30f7b37cba Make use of type attribute consistent 2022-07-18 19:44:37 +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
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
jeremy@jermolene.com
189fe428b7 Merge branch 'master' into parameterised-transclusions 2022-07-04 21:15:42 +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
79b20bdaa8 Fix up handling of slot/fill for custom widgets
Previously we were wrapping the body in an implicit `<$fill $name="ts-body">` widget
2022-06-09 18:02:47 +01:00
jeremy@jermolene.com
defe3e42e6 Adjust naming of transclusion metaparameter 2022-06-05 16:10:41 +01:00
jeremy@jermolene.com
7680280d87 Fix typo 2022-06-05 15:59:03 +01:00
jeremy@jermolene.com
542df63ccf Simplify metaparameters implementation 2022-06-03 11:21:32 +01:00
jeremy@jermolene.com
c42df2233a Make slot fill data available to transclusions
Allows transcluded content to dynamically process <$fill> widgets within the calling transclusion
2022-06-03 08:53:51 +01:00
jeremy@jermolene.com
613f4af20f Fix refreshing of global variables
Global variables access within attributes will automatically trigger a refresh if the attribute text changes, but that wasn't happening for transclusions.
2022-05-31 09:19:01 +01:00
jeremy@jermolene.com
006ae6e759 Refactor $parameters widget
The objective is to add a $depth attribute so that it is possible to reach up to retrieve the parameters of ancestor transclusions. However, doing so requires changing the encoding of parameter names so that it is not possible for a user parameter to clash with an attribute like $depth. So now we have to double up dollars on any attribute names seen by the parameters widget, just like with the transclude widget itself.
2022-05-31 09:03:20 +01:00
jeremy@jermolene.com
150266c731 Use underscores for new system fields for global variable tiddlers
For consistency with `_canonical_uri`; unlike many system fields, the behaviour of these fields is baked into the core JS code.
2022-05-30 18:38:25 +01:00
jeremy@jermolene.com
0c3f82855b Minor cleanups 2022-05-29 10:55:15 +01:00
jeremy@jermolene.com
f636349007 Introduce true global variables
The basic idea is that if we don't find a variable `foo` then we fallback to retrieving the value from the tiddler `$:/global/foo`, if it exists.

This allows us to replace the usual importvariables-based mechanism for global definitions, avoiding cluttering up the variable namespace with every macro.

In order to permit subprocedures to be overridden, we also introduce a mechanism for conditional definitions: preceding the word definition|procedure|function|widget with a + causes the definition only to occur if the specified variable doesn't already exist. In the next commit we'll apply this mechanism to the tabs macro
2022-05-28 12:23:50 +01:00
jeremy@jermolene.com
dec45f0fc3 Fix importvariables to work with setvariables as well as set (they are aliases) 2022-05-26 21:11:32 +01:00
jeremy@jermolene.com
cbce4ebb7b Allow custom functions to be invoked as attributes 2022-05-23 20:18:54 +01:00
jeremy@jermolene.com
22e7ec2381 Procedures and widgets inherit whitespace trim setting from their definition 2022-05-23 15:30:33 +01:00
jeremy@jermolene.com
170c4b1799 Merge branch 'master' into parameterised-transclusions 2022-05-23 11:28:12 +01:00
jeremy@jermolene.com
ec1ec8ccd8 Fix invocation of JS macros 2022-05-21 16:31:34 +01:00
jeremy@jermolene.com
e50101322f Require $$ for custom widgets, and that overridden JS widgets must exist
See https://github.com/Jermolene/TiddlyWiki5/pull/6666#issuecomment-1133637763
2022-05-21 15:47:19 +01:00
jeremy@jermolene.com
bbd9e2f243 Rename <$value> widget to <$fill> 2022-05-13 09:18:25 +01:00
jeremy@jermolene.com
36cf50aa96 Use \widget for custom widget definitions, and remove need for angle brackets
Need to do some refactoring of all those isFunctionDefinition/isProcedureDefinition/isWidgetDefinition flags into a single property
2022-05-13 08:49:53 +01:00
jeremy@jermolene.com
904e30a0e2 Detect recursion by tracking widget tree depth
The old recursion marker approach was very slow, and didn't catch test cases like editions/test/tiddlers/tests/data/transclude/Recursion.tid
2022-05-12 16:26:33 +01:00
jeremy@jermolene.com
774459fa73 Transclude: replace paramNames/paramValues with more robust JSON payload
More details at https://github.com/Jermolene/TiddlyWiki5/pull/6666#issuecomment-1123719153
2022-05-11 13:51:11 +01:00
jeremy@jermolene.com
0b11b499c2 Better backwards compatibility for legacy recursion marker
Fixes the problem with tag dropdowns @btheado
2022-05-10 10:21:56 +01:00
jeremy@jermolene.com
eef7d180a5 Remove obsolete code
Left over after refactoring
2022-05-10 10:21:19 +01:00
jeremy@jermolene.com
e092113f9f Switch to using \procedure to define new-style macros, and \function for custom filter operator functions
I now need to update the OP!
2022-05-09 18:00:09 +01:00
jeremy@jermolene.com
64448ae774 Make the macrocall widget delegate to the transclude widget 2022-05-08 20:48:33 +01:00
jeremy@jermolene.com
e9630328f1 Extend transclude widget to work with old-style macros and use it for the macrocall shortcut syntax 2022-05-08 15:59:20 +01:00
jeremy@jermolene.com
9be05f6f38 Use consistent parse tree node property for params 2022-05-07 13:22:53 +01:00
jeremy@jermolene.com
2fe2d20ddf Genesis widget should pass raw attributes onto child widget...
...so that it can more efficiently handle refreshing itself.
2022-05-07 11:41:28 +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
a9938a6c67 Improve recursion detection
While retaining backwards compatibility
2022-05-06 15:00:10 +01:00
jeremy@jermolene.com
e5164113c4 Don't create variables with value undefined for missing parameters 2022-05-05 14:47:22 +01:00