I am attempting to write a self-centering self-sizing content editable div for a personal project. The text is centered and the width is set to 100% of the parent container, so I’m only concerned about height.
I have a function that changes the font size based on height differences between the child and parent containers. The next step is to check the difference with the applied changes and adjust if needed. Recalculation of the child height returns previous results as if the font re-sizing has not yet happened.
If the function is exited the font re-sizing happens, but I need to get the recalculation done without re-exiting. Any way to force flush the changes through?
I calculate child height through event.currentTarget.childNodes[i].offsetHeight
(looping through text lines), and change the font size through event.currentTarget.style.fontSize = (fontState + 'px');
Tried searching through the net, node documentation, and react documentation, but didn’t end up finding anything that would help.