TiddlyWiki5/core/modules/utils
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
..
base64-utf8 Fix incorrect base64 encoding of astral-plane text (#4813) 2020-08-17 17:33:46 +01:00
diff-match-patch Incorporate “diff” engine to show visual differences (#3112) 2018-03-16 20:38:35 +00:00
dom Fixed PR to fix popup position if popup is triggered from within an offsetParent element (#7013) 2022-12-01 21:16:44 +00:00
crypto.js Introduce JSON parse utility function with error handling (#6401) 2022-02-21 15:29:25 +00:00
csv.js CSV parser improvements (#7042) 2022-11-20 17:51:01 +00:00
edition-info.js Introduce JSON parse utility function with error handling (#6401) 2022-02-21 15:29:25 +00:00
escapecss.js Change css-escape-polyfill to a tw uitility method (#5552) 2021-04-02 09:25:01 +01:00
fakedom.js Optimise fake dom 2022-09-23 18:09:45 +01:00
filesystem.js Ensure tiddlers with fieldnames containing colons don't get saved in .tid file format 2021-06-27 21:27:57 +01:00
linked-list.js Linked-List refactor (#6056) 2022-11-27 17:48:08 +00:00
logger.js Log message not to have spaces and <empty string> (#6947) 2022-09-15 12:10:33 +01:00
parsetree.js Fix handling of orderedattributes when adding classes/styles 2022-10-16 17:27:46 +01:00
performance.js style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
pluginmaker.js Introduce JSON parse utility function with error handling (#6401) 2022-02-21 15:29:25 +00:00
transliterate.js Additional transliteration pairs 2021-09-24 18:29:40 +01:00
utils.js Add Timestamp to DateFormat (#7043) 2022-11-21 16:13:34 +00:00