Replies: 5 comments
-
asking to ai is there also underscroll scroll before begin As of my knowledge cutoff date in early 2023, Ace Editor does not have a built-in feature specifically called "underscroll," which would allow scrolling before the beginning of the document in the same way that "overscroll" allows scrolling beyond the end. Overscroll is a common feature in text editors because it can make it easier to view and edit the bottom part of a document without the need to have it right at the bottom edge of the editor's viewport. However, since the top part of a document is already naturally positioned at the top of the editor's viewport, an "underscroll" feature is less common and generally not necessary. If you still want to achieve a similar effect for the top of the document (for example, to provide some visual padding), you could potentially use CSS to add padding to the top of the editor's content. This wouldn't be true "underscroll" but would give the document content some space from the top edge of the editor. Here's a simple CSS approach to add padding to the top of the Ace Editor content:
Please note that adding padding in this way might interfere with the editor's line numbering and other features, so you'll need to test thoroughly to ensure it doesn't disrupt the user experience. For a more integrated solution, you could potentially modify the Ace Editor's renderer to include additional space at the top, but such a modification would require a deeper understanding of the Ace Editor's internals and is not supported out of the box. insert lines to get underscroll Here's an example of how to add empty lines to the start of an Ace Editor instance to create a simulated "underscroll" effect:
This code will add 10 empty lines to the start of the document, creating space at the top that the user can scroll into, similar to how you would scroll past the end with overscroll. Here's a complete HTML example including the JavaScript function:
When you open this HTML file in a browser, you'll see an Ace Editor instance with 10 empty lines at the top, simulating an "underscroll" effect. This approach provides a workaround for the lack of native underscroll functionality in Ace Editor. https://ldijkman.github.io/Ace_Seventh_Heaven/The_AfterWorld.html https://ldijkman.github.io/Ace_Seventh_Heaven/The_AfterWorld.html |
Beta Was this translation helpful? Give feedback.
-
there is scrollMargin allowing extra scroll in any direction https://ajaxorg.github.io/ace-api-docs/classes/Ace.VirtualRenderer.html#setScrollMargin |
Beta Was this translation helpful? Give feedback.
-
ok |
Beta Was this translation helpful? Give feedback.
-
hmmm it knows it ace editor setScrollMargin The setScrollMargin method takes four arguments: top, bottom, left, and right. To create a space at the top and bottom of the editor, you only need to specify the top and bottom values. Here's how you can use setScrollMargin to add space at the top and bottom of an Ace Editor instance:
In this example, we've added a 50px margin to the top and bottom inside the editor's viewport, which allows the user to scroll the content away from the edges of the editor, enhancing the reading and editing experience. When you load this HTML file in a web browser, you will see an Ace Editor with extra padding at the top and bottom within the editor's area, enabling you to scroll the content up and down more comfortably. https://ldijkman.github.io/Ace_Seventh_Heaven/The_AfterWorld.html |
Beta Was this translation helpful? Give feedback.
-
ace editor color picker backround, adjust / change theme color background |
Beta Was this translation helpful? Give feedback.
-
https://ldijkman.github.io/Ace_Seventh_Heaven/The_AfterWorld.html
Beta Was this translation helpful? Give feedback.
All reactions