Problem/Motivation

CKEditor plugins cannot access/return html content of selections unless they are wrapped in a containing div. data.content will return plaintext when wrapper is not present, due to CKEditor's selection.getSelectedElement() returning false in wysiwyg/editors/js/ckeditor-3.0.js.

Steps to reproduce

  1. Create or install a simple ckeditor plugin that uses a user's content selection
  2. Highlight some text in the wysiwyg that contains html, for example `button<strong>bold</strong>`
  3. Observe that data.content from that selection returns plaintext with tags stripped out to your plugin

Proposed resolution

Use CKEditor's own methods for dealing with unwrapped HTML selections to wrap the selection in a containing div so it can be returned and used without stripping html from the selection.

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#2 wysiwyg--3166182--2.patch766 bytesaudrey.brockhaus
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

audrey.brockhaus created an issue. See original summary.

audrey.brockhaus’s picture

FileSize
766 bytes

This patch works for me to access html selections in a plugin.

audrey.brockhaus’s picture

Status: Active » Needs review