Opened 3 years ago

Closed 3 years ago

#14341 closed Bug (wontfix)

TypeError in InsertText with MS Word Tags

Reported by: Andreas Soroko Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:

Description

Steps to reproduce

  1. Create editor
  2. execute
    CKEDITOR.instances.editor.setData('<html><head></head><body><o:p><FONT face=Calibri>&nbsp;</FONT></o:p></body></html>')
  3. click in the font tag ( <FONT face=Calibri>|&nbsp;</FONT> )
  4. then CKEDITOR.instances.editor.insertText('hi')

Expected result

text 'hi' has been inserted

<o:p>
<FONT face=Calibri>hi</FONT>
</o:p>

Actual result

  • TypeError: w is undefined
  • two font tags created

<o:p>
<FONT face=Calibri></FONT>
<FONT face=Calibri></FONT>
</o:p>

Other details (browser, OS, CKEditor version, installed plugins)

  • Browser : Xulrunner/Gecko 29 - Firefox 43
  • OS : Windows 7,8,10
  • CKEDITOR : 4.5.2 / 4.5.6

Attachments (2)

build-config.js (2.0 KB) - added by Andreas Soroko 3 years ago.
config.js (357 bytes) - added by Andreas Soroko 3 years ago.
minimal config

Download all attachments as: .zip

Change History (5)

Changed 3 years ago by Andreas Soroko

Attachment: build-config.js added

Changed 3 years ago by Andreas Soroko

Attachment: config.js added

minimal config

comment:1 Changed 3 years ago by Jakub Ś

Keywords: inserttext o:p word typeerror removed
Status: newpending
Version: 4.5.6

I have been able to reproduce this issue with allowedContent : true only.

Ok, there is an error thrown but this example is very non-standard to say the least. Why did you turn off ACF and why are you using non-html tags inside HTML editor? Is there any real-life use case behind this?

I know <o:p> tags are MS Word tags but they are removed by ACF and paste from word filter. At the moment it just looks like you have troubled yourself to create configuration so bad that it results in error when performing non-standard action.

comment:2 Changed 3 years ago by Andreas Soroko

We use the editor to create and display emails ( also external ) , with allowContent : false, the email will be modified and the view does not resemble the original mail in many cases

comment:3 Changed 3 years ago by Jakub Ś

Resolution: wontfix
Status: pendingclosed

I have discussed this issue with my colleagues and we have to consider it a "won't fix" issue.

First of all CKEditor is HTML and not XML editor. Second is that there might be 1000 other cases like that one. ACF and pastefromword filter prevent that from happening.
I personally think it would be much better if you turn on ACF and extend it accordingly to your needs so that it allows entering a predefined set of tags, attributes, styles and perhaps classes.

Some parts of pasted content may be changed, especially if they are created with some weak tools which don't follow HTML specification. You can however control what gets removed by defining what is allowed. Users will also have ability to fix their content using CKEditor features and such email should be displayed properly in email client.

I personally think this is much better than allowing your users to paste every junk HTML there is. With such "HTML", emails may not look as intended in email client.

To learn more about ACF please see:
http://docs.ckeditor.com/#!/guide/dev_acf
http://docs.ckeditor.com/#!/guide/dev_advanced_content_filter
http://docs.ckeditor.com/#!/guide/dev_disallowed_content
http://docs.ckeditor.com/#!/api/CKEDITOR.filter-method-addTransformations
http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-allowedContent
http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-extraAllowedContent

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