Opened 17 years ago
Closed 17 years ago
#1617 closed New Feature (fixed)
Implement ReplaceAllTextareas for the JavaScript integration
Reported by: | Frederico Caldeira Knabben | Owned by: | Frederico Caldeira Knabben |
---|---|---|---|
Priority: | Normal | Milestone: | FCKeditor 2.6 |
Component: | General | Version: | SVN (FCKeditor) - Retired |
Keywords: | Review+ | Cc: |
Description
There is a well known approach to replace all <textarea> fields in the page with FCKeditor instances. It has been published at our Wiki.
It would be nice to introduce such feature in the editor code, making some enhancements to it:
// Replace all <textarea> elements in the page. FCKeditor.ReplaceAllTextareas() ; // Replace all <textarea class="myClassName"> elements in the page. FCKeditor.ReplaceAllTextareas( 'myClassName' ) ; // Selectively replace <textarea> elements, based on custom assertions. FCKeditor.ReplaceAllTextareas( function( textarea, editor ) { // Custom code to evaluate the replace, returning false if it // must not be done. // It also passes the "editor" parameter, so the developer can // customize the instance. } ) ;
This is a follow up for a discussion started at our forums.
Attachments (2)
Change History (10)
comment:1 Changed 17 years ago by
Status: | new → assigned |
---|
Changed 17 years ago by
Attachment: | 1617.patch added |
---|
comment:2 Changed 17 years ago by
Keywords: | Review? added |
---|---|
Version: | → SVN |
The attached patch also includes a way to defined the default BasePath for all instances. This is quite useful when talking about automatically replace many <textarea> instances, without having to define a replacement evaluation function.
comment:3 Changed 17 years ago by
Keywords: | Review? removed |
---|
Discussing it with Martin, we have agreed that this function should also automatically set the editor size to match the textareas. Probably a minimum size should also be enforced. A new path should be provided.
comment:4 Changed 17 years ago by
Keywords: | Review? added |
---|
I've attached a new patch. The textarea size is now reflected when replacing.
comment:5 follow-up: 6 Changed 17 years ago by
Would it make sense if the position and left, top CSS attributes are emulated as well?
comment:6 Changed 17 years ago by
Replying to martinkou:
Would it make sense if the position and left, top CSS attributes are emulated as well?
While the width and height of textareas are almost always set by developers, I'm not sure about its position. It is quite rare to have the textarea only absolutely positioned. In such cases, it if often inside a floating container, and so the editor will end up there in the right place.
Maybe it would be too much automation, easy to get something wrong. I think it is ok for now. We could implement this feature in the feature if we found that there is request for it.
comment:7 Changed 17 years ago by
Keywords: | Review+ added; Review? removed |
---|
Then I have no more objections to the patch. It works well for my test cases.
Patch