Opened 2 years ago

Closed 2 years ago

#16871 closed Bug (invalid)

paste from MS Word some text with background color

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

Description

Steps to reproduce

  1. config.pasteFromWordRemoveFontStyles = true;
  2. paste from MS Word some text with background color

Expected result

<p>some text</p>

Actual result

<p><b><span style="background:white">Come text</span></b></p>

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

Browser: Chrome

OS: Mac

CKEditor version: 4.6.1

Change History (2)

comment:1 Changed 2 years ago by anbuece

CKEDITOR.on('instanceReady', function(ev) {
ev.editor.on('afterPasteFromWord', function(evt) { evt.data.dataValue = evt.data.dataValue.replace(/<span style="([^"]*)">/g,''); evt.data.dataValue = evt.data.dataValue.replace(/<\/span>/g,''); console.log(evt.data.dataValue); }, null, null, 9);
});

the above one solves the issue, but wanted to know why config.pasteFromWordRemoveFontStyles = true; not solving this issue. Also Is this a right approach to solve the issue.

Last edited 2 years ago by Jakub Ś (previous) (diff)

comment:2 Changed 2 years ago by Jakub Ś

Resolution: invalid
Status: newclosed
Version: 4.7.0 (GitHub - major)

First of all you have reported 3 tickets concerning the same issue. Please keep the discussion in one ticket for the future.

Please read the documentation - http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-pasteFromWordRemoveFontStyles. In CKEditor 4.6.0, new PFW filter has been introduced. From that version the filtering in that filter depends on ACF settings. If for some reason you don't want to use ACF, you can use afterPasteFromWord event like you did.

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