Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By Autosme on
Is there some way to have HTML code (color code) view for editors, when using a plain editor (no WYSIWYG )?
I write the HTML myself, it would be nice when it looks better formatted.
Comments
Is there some way to have
No. Text in a textarea cannot be formatted.
Although I guess you could create your own contenteditable element, and apply the formatting using that.
contenteditable element
Could you please guide how to use this contenteditable element in a drupal site.I do not find anything on that.
Unfortunately, it's not
Unfortunately, it's not something that can be explained in a forum post. There are too many small details. The best I can give you the overview of how it will work, but you'll need to spend some time learning how to code in Drupal to be able to accomplish it:
1) You'll have to add a textarea that will hold the actual text. This will need to be hidden with CSS.
2) Create a div with contenteditable set to TRUE. Add some JavaScript that copies the value of this div to the hidden textarea on keyup.
3) Apply your geshi filter to the contenteditable div with the JS, on content up.
Ok let me try once and let
Ok let me try once and let you know.
Maybe this could help?
I use https://www.drupal.org/project/ace_editor all the time.
Nice, that looks pretty good!
Nice, that looks pretty good!
yes it will be helpful.
yes it will be helpful.
re Maybe this could help
That module seems to do the job, will be trying it later. Thanks.
Tested
Tested the Ace module, works perfect. One disadvantage though is that it cannot be manually resized, and it removed the resize handle from my other CKEditor format... now why would it do that..
That's curious.
Yes, the no manual resize thing is quite annoying. I've never had it mess with CKEditor resize handles, even with multiple instances of both on a single /admin page.