You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 16, 2017. It is now read-only.
This chunk of code should be extracted and/or wrapped into a handy API and become a utility under ckeditor5-utils/src/dom.
The mentioned code is helpful to position elements in DOM using postion: absolute. For instance, if there are components in the "body" region of the editor, which are to be positioned with respect to another element, i.e. floating toolbar aligned to the editor, balloon aligned to the link in editable, tooltip aligned to the button in the toolbar, etc., this utility helps determining the absolute position (top and left in CSS) which should be set to achieve the desired composition.
It's not a trivial task because element.getBoundingClientRect returns a rect relative to the viewport, which is only useful when positioning with position: fixed. So to work with postion: absolute (relative to <body>), lots of things must be considered (like clientRect of <body>, scrolls of the window, etc.) to translate fixed–like position into absolute–like.
I see some pieces of code repeating in various places (StickyToolbarView, BalloonPanelView) and I think it's time to DRY.
The text was updated successfully, but these errors were encountered:
Makes sense, of course, if this code is duplicated. I'm only unsure whether it better fits ckeditor5-utils/dom or ckeditir5-ui-default/utils. It's pretty specific for UI, isn't it? OTOH, I can see other using this and not the rest of our UI lib.
This chunk of code should be extracted and/or wrapped into a handy API and become a utility under
ckeditor5-utils/src/dom
.The mentioned code is helpful to position elements in DOM using
postion: absolute
. For instance, if there are components in the "body" region of the editor, which are to be positioned with respect to another element, i.e. floating toolbar aligned to the editor, balloon aligned to the link in editable, tooltip aligned to the button in the toolbar, etc., this utility helps determining the absolute position (top
andleft
in CSS) which should be set to achieve the desired composition.It's not a trivial task because
element.getBoundingClientRect
returns a rect relative to the viewport, which is only useful when positioning withposition: fixed
. So to work withpostion: absolute
(relative to<body>
), lots of things must be considered (like clientRect of<body>
, scrolls of the window, etc.) to translate fixed–like position into absolute–like.I see some pieces of code repeating in various places (
StickyToolbarView
,BalloonPanelView
) and I think it's time to DRY.The text was updated successfully, but these errors were encountered: