tinymce-react icon indicating copy to clipboard operation
tinymce-react copied to clipboard

Toolbar Sticky not working properly

Open rajraii opened this issue 1 year ago • 6 comments

What is the current behavior? Tinymce React Toolbar not working properly There are following cases here:

  1. Toolbar doesnt automatically sticks to top when scrolled down in content image

image

  1. Toolbar only gets sticked to top when there is a click event inside content Reproduced this behaviour after pressing enter inside content image

  2. It will be sticked to top of the page even when user scrolls out of the content area image

  3. Selector option in init json is not accepting a string value image

###NOTE: I was able to identify the issue: The css in parent element consist of overflow: auto. Need to rectify it

What is the expected behavior? Should have stick only to the top of content context (not at page) when users scrolls on page, Clicking or event should have not been the trigger here.

Which versions of TinyMCE, and which browser / OS are affected by this issue? Did this work in previous versions of TinyMCE or tinymce-react?

  • Browser: Chrome
  • OS: Ubuntu
  • First affected version: React Tinymce Version : 4.3.2
  • Worked in version: React Tinymce Version : 4.3.2

rajraii avatar May 23 '24 05:05 rajraii

You're using the selector prop, which is purposely overridden and won't be used, see https://www.tiny.cloud/docs/tinymce/latest/react-ref/#init.

Apart from that, could you please fork our code sandbox to replicate your issue. Or provide a codepen or something similar. Then we can help you further.

danoaky-tiny avatar May 26 '24 23:05 danoaky-tiny

@danoaky-tiny In this demo, I have tried to replicate my behavior, Though I could not make the TinyMCE resizable according to the size of the content in it. If you click inside the editor, the editor toolbar is sticky. But when you scroll outside of Editor then the behavior changes to Static

Code Sandbox

Tinymce Tollbar is not sticky when parent has a Overflow styling in it.

rajraii avatar Jun 11 '24 06:06 rajraii

I am having the same issue @rajraii

  • Sticky toolbar does not understand when I scroll back up and remains on top
  • I am having also the issue of the toolbar having different behavior when editor is focused and blurred.

Did you manage to make it work?

andresmotiva avatar Jun 27 '24 22:06 andresmotiva

This issue is stale because it has been open 30 days with no activity. Please comment if you wish to keep this issue open or it will be closed in 7 days.

tiny-stale-bot avatar Jul 28 '24 00:07 tiny-stale-bot

@andresmotiva I was able to fix this issue with a hack, manually dispatching event resize

editor.on("LoadContent", function() {
         window.dispatchEvent(new Event('resize'))
}

Note: Loadcontent event fires before the painting, You can add a setInterval as well on it

rajraii avatar Jul 28 '24 05:07 rajraii

hi, I'm having hard time reproducing the bug, it is possible that I'm doing the wrong steps to reproduce it, could you record a video just to be sure that I'm trying to reproduce it in the correct way?

lorenzo-pomili avatar Aug 05 '24 06:08 lorenzo-pomili

@lorenzo-pomili This code sandbox should show the issues. There are two editors using toolbar_sticky inside a container with an overflow applied. The toolbars don't become sticky until interacting with the content in the editor (adding a newline is the easiest way). The second editor's toolbar is hidden until the same interaction occurs. Once the toolbars are visible and sticky they do not align to the correct position in the container but instead stick to the top of the viewport.

Sandbox

andrewbarnhart avatar Sep 16 '24 17:09 andrewbarnhart

hi, to solve this problem you should add ui_mode: "split" to your init, this is the documentation of the ui_mode, let me know if you still have the problem

lorenzo-pomili avatar Sep 17 '24 06:09 lorenzo-pomili

@lorenzo-pomili Thank you that solves it. I can't believe I missed this in the docs.

andrewbarnhart avatar Sep 17 '24 13:09 andrewbarnhart