Ticket #1617 (closed New Feature: fixed)

Opened 12 months ago

Last modified 12 months ago

Implement ReplaceAllTextareas for the JavaScript integration

Reported by: fredck Owned by: fredck
Priority: Normal Milestone: FCKeditor 2.6
Component: General Version: SVN
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

1617.patch (3.5 KB) - added by fredck 12 months ago.
Patch
1617_2.patch (4.1 KB) - added by fredck 12 months ago.
Patch (version 2)

Change History

  Changed 12 months ago by fredck

  • status changed from new to assigned

Changed 12 months ago by fredck

Patch

  Changed 12 months ago by fredck

  • keywords Review? added
  • version set to 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.

  Changed 12 months ago by fredck

  • 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 months ago by fredck

Patch (version 2)

  Changed 12 months ago by fredck

  • keywords Review? added

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

follow-up: ↓ 6   Changed 12 months ago by martinkou

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

in reply to: ↑ 5   Changed 12 months ago by fredck

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.

  Changed 12 months ago by martinkou

  • keywords Review+ added; Review? removed

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

  Changed 12 months ago by fredck

  • status changed from assigned to closed
  • resolution set to fixed

Fixed with [1185].

Note: See TracTickets for help on using tickets.