Ticket #2424 (closed Bug: fixed)

Opened 6 years ago

Last modified 6 years ago

API to destroy instances

Reported by: fredck Owned by:
Priority: Normal Milestone: CKEditor 3.0
Component: General Version: FCKeditor 2.6.3
Keywords: Confirmed Cc: garry.yao

Description

There must be a way to easily remove editor instances from the page, completely freeing resources used by those instances. This feature should be able to restore the <textarea> replaced by the instance, or remove it together with the editor.

Change History

comment:1 in reply to: ↑ description Changed 6 years ago by tha_sun

Oww. I searched the past hours for a function in FCKeditor that does exactly this.

I am developing Wysiwyg API for Drupal (core), and all editors must be able to attach/detach cleanly from textareas, since the user is able to change the editor based on an external selector.

I'll try to work around this limitation now, but it would be beneficial for FCKeditor 2.6 if there were save() and remove() instance methods, similar to what other editors like TinyMCE provide.

comment:2 Changed 6 years ago by tha_sun

  • Version set to FCKeditor 2.6.3

Any updates? A fix for this does not sound that complex. Drupal's Wysiwyg API does the following to achieve the desired result:

    var editor = FCKeditorAPI.GetInstance(params.field);
    if (editor) {
      $('#' + params.field).val(editor.GetXHTML()).show();
      $('#' + params.field + '___Config').remove();
      $('#' + params.field + '___Frame').remove();
      delete FCKeditorAPI.__Instances[params.field];
    }

comment:3 Changed 6 years ago by garry.yao

  • Cc garry.yao added

comment:4 Changed 6 years ago by fredck

  • Status changed from new to closed
  • Resolution set to fixed

The "destroy" function has been introduced in V3 for this.

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