I created a template with a layout container and included a text component in the template. I Added text to the component and locked the component since I want all the pages to import the same text. But when the pages are in edit mode, there is a huge gap between this text and the next component, however in preview this gap does not exist. How do I make sure the gap does not exist in edit mode as well. Attached are the screenshots for it.
This could be possible because edit mode contains extra DOM element to support editing and your UI code may be impacted by those although you can add extra classes in WCM edit mode and with the help of extra classes you can handle it.