Opened 12 years ago

Closed 12 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)

1617.patch (3.5 KB) - added by Frederico Caldeira Knabben 12 years ago.
Patch
1617_2.patch (4.1 KB) - added by Frederico Caldeira Knabben 12 years ago.
Patch (version 2)

Download all attachments as: .zip

Change History (10)

comment:1 Changed 12 years ago by Frederico Caldeira Knabben

Status: newassigned

Changed 12 years ago by Frederico Caldeira Knabben

Attachment: 1617.patch added

Patch

comment:2 Changed 12 years ago by Frederico Caldeira Knabben

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 12 years ago by Frederico Caldeira Knabben

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.

Changed 12 years ago by Frederico Caldeira Knabben

Attachment: 1617_2.patch added

Patch (version 2)

comment:4 Changed 12 years ago by Frederico Caldeira Knabben

Keywords: Review? added

I've attached a new patch. The textarea size is now reflected when replacing.

comment:5 Changed 12 years ago by Martin Kou

Would it make sense if the position and left, top CSS attributes are emulated as well?

comment:6 in reply to:  5 Changed 12 years ago by Frederico Caldeira Knabben

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 12 years ago by Martin Kou

Keywords: Review+ added; Review? removed

Then I have no more objections to the patch. It works well for my test cases.

comment:8 Changed 12 years ago by Frederico Caldeira Knabben

Resolution: fixed
Status: assignedclosed

Fixed with [1185].

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy