NiclasDev63 / tiptap-extension-global-drag-handle

MIT License
73 stars 13 forks source link

Line height returned 'normal' gets parsed to NaN #11

Closed Daniyaalbeg closed 6 months ago

Daniyaalbeg commented 6 months ago

When the computedStyle line height returns 'normal', it gets parsedInt to NaN causing the rect.top to also be NaN. This causes the drag handle to show at its last position the the correct left spacing but on the wrong line.

Instead proposing to use a fallback value being the fontSize * 1.2 (the average line height on most browsers).

A more accurate way would be measuring an invisible element to calculate the line height but this seems a bit unnecessary since this situation seems pretty rare.

NiclasDev63 commented 6 months ago

lgtm