Need to make a single toolbar to work on all form fields. Any ideas?
We're discussing how it would be possible to make a single toolbar across the top of the page which has the same functions at the HTML Editor (e.g. alignment, bold, italics, insert hyperlink etc.) that would work on the textarea that is currently in focus.
The idea is that you would be able to make text bold anywhere on a form by selecting it, without having to have a toolbar above every textarea (e.g. by using multiple HTML Editor controls).
Eventually we'd like to have all of the functions of something like TinyMCE and be able to specify a configuration for each textarea so that certain buttons could be greyed out depending on what field is focused.
To begin with though we'd just like to get an idea of whether it's possible and where to start?
The functions that tinyMCE and Ext's HTML editor use are browser-level functions. In other words, Mozilla and Microsoft created low-level api's for these that are called by the HTML editors. So what you are talking about is possible. I would start by researching these low level api's and then going from there.
What I would do instead is a major hack. I would take one Ext HTML editor and have it act as a central unit. Override it's class methods so that the actual text field doesn't appear. Then, I would make all of the buttons' functions return the HTML they process rather than putting it in the text field. This would be one class, maybe call it HtmlEditorManager.
The other class would be another extension of HtmlEditor that would instead hide the toolbar. This way, you keep all the work Ext has already done for you.