inherit
264279
0
Feb 5, 2024 17:01:15 GMT -8
shawnatdgk
59
May 2021
shawnatdgk
|
Post by shawnatdgk on Jul 10, 2023 16:44:26 GMT -8
I know this is not proboards related but I have saked this question on Stack Overflow with no solutions. there's some smart coders here so I figured I may get an answer here. Thanks
I'm trying to enter code syntax into a textarea when a link is clicked. I'm just messing around with making my own little text editor in Notepad for writing code. I need it to display as:
<div>
</div>
not as
<div>
</div>
I have the code already enabling the TAB key and injecting text at the caret position. The only problem is that when the code syntax is multiple lines, the second through the last lines do not follow the indentations or the structure that they have originally.
Hope I explained that well. Thanks in advance.
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,018
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Jul 10, 2023 20:24:10 GMT -8
If you're seeking help with a code, it is often best to share the code you're seeking help with. You mentioned having a code already in place "already enabling the TAB key," but what code would that be? How are you injecting the text, and by the way, what code would that be? What browser and what OS are you basing these observations upon? Traditionally styling for native controls has been inconsistent across browser/OS combinations simply because the OS has something to do with creating the control and may not be as permissive as the next OS or version or the browser does not know how to gain that access. This is the very reason why custom controls are used on Proboards (jQuery created action menus, font-size menus, links rendered as buttons, dropdown selectors in profile, etc.) to give a uniform appearance across all browser/OS combinations. The situation has improved a bit with the introduction of newer APIs finally allowing the ability to add a background color or a border to a native control now commonplace where just a few years ago, it was literally impossible. That, however, does not mean the problem has been completely conquered. Your textbox may respond to a white-space:pre rule on one machine but completely ignored on another. If you have a particular browser/OS combo then it is best to share it. You may also want to explore the non-standard wrap="off" attribute which predates CSS and is possibly more widely supported on textareas when trying to force the behaviour of style="white-space:pre;"
|
|