Commit Graph

49 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
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 97dff042f7 Reveal widget: fix crash when popup tiddler is refreshed but the popup is not displayed 2021-08-04 17:00:42 +01:00
Joe Bordes 82ec63e711
style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
Saq Imtiaz 0911d99813
URGENT: Reveal widget - fixed problem with previous patch of refresh handling (#5260)
* Fixed problem with previous patch of refresh handling

* Update reveal.js
2020-12-11 23:24:27 +00:00
Saq Imtiaz c0dd13d446
Reveal widget should update on changed class and style attributes (#5258) 2020-12-11 15:36:00 +00:00
saqimtiaz d2f87d6200
Reveal widget allow re-positioning (#5087)
* Jeremy's original version of the event widget

* Renamed to eventcatcher, added modifier key support and mouse button support as variables

* Reveal widget: update popup position when state tiddler updates
2020-11-21 17:19:52 +00:00
Jeremy Ruston 3edaa652ee Reveal widget: add option to avoid clamping popup position
Fixes #4041
2019-07-04 15:58:27 +01:00
Jeremy Ruston 7869546fef Speed up reveal widget
It turns out that the `localeCompare` function used by `compareStateText()` is very, very slow. Replacing it with a straightforward equality test makes one of my test rigs be 10x faster...

Note that this PR reverts the behaviour of match/nomatch to that before #3157. That change was not backwards compatible in that the switch to localeCompare meant that é === e, now it doesn't again.
2019-05-10 08:47:00 +01:00
Simon Huber 662ae91067 Bugfix: reveal widget regression! (#3897) 2019-04-06 10:27:37 +01:00
Jermolene 02ae8969b2 Reveal widget: faulty logic for default handling
@BurningTreeC I think this might have been a typo in your recent refactorings; if you look back at an old version such as c0c1b557eb/core/modules/widgets/reveal.js then there is no sign of this fallback.

Fixes #3874
2019-03-20 16:50:34 +00:00
Simon Huber c9b16d88f3 Fix: reveal widget prevent undefined state (#3848)
the state didn't fall back to the default when there was no data-item to extract for a stateIndex

see the google group for a bug report: https://groups.google.com/forum/#!topic/TiddlyWiki/3jiFpayAIRc
2019-03-11 09:04:17 +00:00
Simon Huber 4228c3f9cc Fix bug in reveal widget when stateTitle tiddler is missing (#3745)
in the group this bug was reported

when the stateTitle is missing it tries to get a field string of an undefined tiddler ...
2019-02-01 16:53:29 +00:00
Jermolene 3aae643e14 Reveal widget with lazily loaded state tiddlers
Fixes #3476
2018-11-18 19:31:53 +00:00
BurningTreeC 849844be12 Add stateTitle stateField stateIndex attributes (#3529)
* make triggerPopup optionally set state directly

* update button widget for new state attributes

* update reveal widget for new state attributes

* fix errors in button widget
2018-11-18 19:16:46 +00:00
Yurii Rashkovskii c0c1b557eb Problem: revealed dropdown menu on mobiles (#3491)
On mobile phones, tiddler's dropdown menu stays partially off-screen.

Solution: ensure that the revealed coordinates are never negative

Closes #3486
2018-10-21 16:53:45 +01:00
Jermolene 2d231a2e07 Fix typo in reveal widget
Introduced in a3a4c28143
2018-07-31 13:30:00 +01:00
Jermolene a3a4c28143 Fix bug with reveal widget not refreshing when state tiddler changes 2018-07-20 17:07:48 +01:00
BurningTreeC 5626148202 Fix for sidebar not showing #3223 (#3226)
* fix for sidebar not showing

I believe this fixes #3223

* add explaining comment

* ... and fix indentation.
2018-05-02 15:31:26 +01:00
Jermolene 8e9330e484 Minor tweaks for #3157 2018-03-22 20:37:06 +00:00
Rizwan 033feda02d Adding comparative operators to reveal widget (#3157)
* Adding comparative operators to reveal widget 

>, <, >=, <=

* Adding documentation and formatting changes

* Bring Alphanumericals to the scope of comparison operation
2018-03-22 16:51:02 +00:00
Jermolene bd6472c1d1 Add style attribute to reveal widget 2015-03-23 15:28:26 +00:00
Jermolene e80a08f43b Fix problem with custom tag in reveal widget 2015-03-10 16:59:25 +00:00
Jermolene 1808b1597e Support custom HTML element tags for reveal widget 2015-03-10 12:44:47 +00:00
Skeeve 79e428757b allow empty state tiddlers and missing state attributes act as missing state tiddlers
As described here: https://groups.google.com/d/msg/tiddlywikidev/ODJhIw6-UjQ/3ZKrlA4B810J

I think it would be a good small enhancement as the reveal widget can now be used in previously impossible ways.
2014-11-24 07:38:58 +01:00
Jermolene 3a67fdb768 Obeisance to JSHint for core modules
There are still some warnings about making functions in a loop, but
I’ll fix those as a separate pull request because the fixes are more
than typographic errors.
2014-08-30 20:44:26 +01:00
Jermolene 8b10994cfe Rename more "tw-*" classes to "tc-*"
Part of #764
2014-08-28 18:59:35 +01:00
Jermolene 787481a804 Change more "tw-*" classes to "tc-*"
Part of #764
2014-08-28 18:21:08 +01:00
Jermolene 800bc639f9 Fix problem with the reveal widget not refreshing properly when used with text references
The check for changed tiddlers was failing because `this.stateTitle`
contains the entire text reference, not just the tiddler title.
2014-02-13 17:59:10 +00:00
Jermolene 5c66bc6dbc Update the reveal widget to allow control over content retention
Thus bringing back the animation of the opening and closing of the info
panel.
2014-02-12 08:32:19 +00:00
Jermolene 69d342d46a Stop the reveal widget caching hidden content
Previously, when displayed content is hidden by the reveal widget there
was an optimisation such that the content was retained in the DOM but
hidden using CSS, so that it could be shown again quickly.

It turns out that a sideeffect of that optimisation is that clicking
through all the sidebar tabs leaves them all active, so that they all
need to be refreshed whenever a character is typed in an editor.

This commit suppresses the optimisation, so that hidden content is
removed from the DOM and the render tree.
2014-01-26 09:57:46 +00:00
Jermolene b304e3fe40 Update the reveal widget to set the tw-popup class 2013-11-12 22:02:43 +00:00
Jermolene 6f1c9d88cc Improve the Widget.prototype.removeChildDomNodes() method so that most subclasses won't need to override it 2013-11-09 16:55:14 +00:00
Jeremy Ruston b7cb1d3391 Change `new_widget` to `widget`
I was avoiding doing this until after the merge.
2013-11-08 08:47:00 +00:00
Jeremy Ruston 3e3a5917b7 Move the widgets back to the right folder 2013-11-08 08:38:44 +00:00
Jeremy Ruston 20f03de712 The big purge of the old widget mechanism
Getting rid of the old widget mechanism files finally gives us a payoff
for all the refactoring. Still a bit of tidying up to do, and we need
to re-introduce the animation mechanisms.
2013-10-27 22:55:36 +00:00
Jeremy Ruston e583c1d72d Use empty string as default value for reveal widget 2013-07-03 16:00:26 +01:00
Jeremy Ruston d27cb19e22 Update titles of certain widgets that were misspelled 2013-05-31 13:23:25 +01:00
Jeremy Ruston a8b1da33de Improvements to slide animation 2013-05-28 16:47:16 +01:00
Jeremy Ruston 5cdcadd8b2 Make the reveal widget use the new animator mechanism 2013-05-28 16:28:38 +01:00
Jeremy Ruston d3fa781287 Switch to using a slider for tiddler info 2013-05-19 12:11:18 +01:00
Jeremy Ruston 8564602256 Refactor rendertree to simplify context handling
Get rid of the separate renderContext stack and instead have a parent
pointer on renderer nodes. This lets us walk back up the render tree to
resolve context references
2013-05-15 17:32:17 +01:00
Jeremy Ruston b69f87484d Remove extraneous debugging code 2013-04-04 14:24:37 +01:00
Jeremy Ruston 54d858a371 Improved default logic for the reveal widget 2013-03-27 13:48:39 +00:00
Jeremy Ruston 6d24cedbcc Refactored widget renderers to be hosted within HTML element renderers
This arrangement takes better advantage of the similarities between the
now deleted widget renderer and the element renderer. It also obviates
the need for wrapper elements around every widget.
2013-01-03 16:27:55 +00:00
Jeremy Ruston d96e0073ac Refactored widgets not to use a base class 2013-01-01 17:51:02 +00:00
Jeremy Ruston f8340bc4dc Improvements to reveal widget popup handling 2013-01-01 16:14:42 +00:00
Jeremy Ruston 8fdeefd7d1 Added reveal macro 2012-12-31 18:36:39 +00:00