Commit Graph

33 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
Joe Bordes 82ec63e711
style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
Simon Huber d01b781283 Restore previous popup mechanism (no cancelling when focusing inputs) (#4305)
* remove cancelpopups from factory.js

* remove handleFocusEvent from framed engine

* remove cancelPopups from simple engine

* Update popup.js
2019-10-12 14:08:52 +01:00
Simon Huber e1bb532d98 Fix popups not being cancelled correctly (#4158) 2019-08-04 13:01:24 +01:00
Simon Huber 64fe260f4d Fix: correct handling of tc-popup-keep when cancelling ... (#4144)
... popups through focussing inputs
2019-08-02 08:49:06 +01:00
Simon Huber b30746813b Fix: store noStateReference in popup.js (#4115) 2019-07-26 17:13:53 +01:00
Simon Huber 66dc7df745
Update popup.js 2019-07-14 09:37:53 +02:00
Simon Huber ba2f4822dd
Merge branch 'master' into patch-10 2019-07-11 18:19:49 +02:00
Simon Huber ecbbe87a0d
popup cancelling - use state reference
in the google group there's a discussion: https://groups.google.com/forum/#!topic/tiddlywiki/_mDDZ1jpMgU

buttons allow setting a state-reference for popups but the popup mechanism doesn't respect that
2019-07-11 07:35:06 +02:00
Simon Huber 7811614d53
Update popup.js 2019-07-10 09:55:32 +02:00
BurningTreeC 0396af849a Undo #3490 - error in popup-cancelling logic (#3586) 2018-11-29 09:49:11 +00:00
Rob Hoelz 09ea59240a Cancel non-ancestor popups when showing a new popup (#3490)
Addresses GH #3484

As far as I can tell, the popup level checks in this module are
meant to handle nested popups.  It seems to me that the goal is
for at most a single hierarchy of popups to exist at any given time
- bearing that in mind, this change checks any popups currently tracked
by the module, canceling any that don't share an element hierarchy with
the new popup.
2018-11-25 10:42:21 +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
Jermolene 7b9dc7557c Popup manager enhancements 2018-08-09 19:39:58 +01:00
Jermolene 5cc1f2b313 Fix problem with search popup disappearing
This one took quite a lot of tracking down…

Fixes #2172
2016-01-03 18:05:08 +00:00
Jermolene 755693766a Removing debugging statements from popup mechanism 2014-12-10 17:09:14 +00:00
Jermolene d6c5e51501 Fix popup handling in Cecily and Zoomin view
Cecily and Zoomin story views use a document.body that is smaller than
the document.documentElement. We were just clearing the popups on
clicks on the document.body Clicks on the document element (ie, on the
background of the page) were not being trapped, meaning that you
couldn’t dismiss a popup.
2014-11-22 10:19:03 +00:00
Jermolene b882a0dff1 Fixes to make nested popups work
Thus making the export button a lot more useful
2014-11-21 17:07:03 +00:00
Jermolene 787481a804 Change more "tw-*" classes to "tc-*"
Part of #764
2014-08-28 18:21:08 +01:00
Jermolene 06a66cf24e Improve popup dismissal
Now we ignore clicks if they come from an element that has an ancestor
with the class `tw-popup`
2013-11-12 22:02:26 +00:00
Jeremy Ruston f2ac04943f Fixed tag autocomplete popup on focus 2013-10-23 17:41:12 +01:00
Jeremy Ruston 94c2eacdc9 Support selectedClass properly in the button widget 2013-10-14 16:56:13 +01:00
Jeremy Ruston 2c8352c442 Update the popup manager to allow popup state to be forced, rather than toggled
We'll be needing this shortly
2013-06-09 19:24:21 +01:00
Jeremy Ruston 069bb624e5 Fix popup removal 2013-03-19 16:44:32 +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
Jeremy Ruston f1089c1c92 Use temporary tiddlers for popup locations 2012-11-11 15:03:34 +00:00
Jeremy Ruston 083ac7a4bf Encapsulate logic for handling popups 2012-11-06 14:11:11 +00:00
Jeremy Ruston 5ef77ae3dd Removing dead code 2012-10-16 23:06:53 +01:00
Jeremy Ruston daff9c10f3 Tighten terminology for plugins vs. modules
"Plugins" are bundles of tiddlers managed as one, "modules" are
JavaScript tiddlers with a module type identifying when and how they
should be executed.
2012-08-03 15:09:48 +01:00
Jeremy Ruston 6d278ea4a1 Reorganisations
Part three
2012-07-14 15:58:41 +01:00