ckeditor / ckeditor4

The best enterprise-grade WYSIWYG editor. Fully customizable with countless features and plugins.
https://ckeditor.com/ckeditor-4
Other
5.8k stars 2.48k forks source link

pastefromword wordRegexp too broad - affects paste filtering #2634

Open blindspeed90 opened 5 years ago

blindspeed90 commented 5 years ago

Type of report

Bug

Provide detailed reproduction steps (if any)

The "wordRegexp" shouldn't have the ending "|<\/font>". In my case I had plain HTML with a font specified, nothing MSOffice specific. It thinks the HTML is from Word, and sets the dontFilter=true, which sidesteps the config.pasteFilter work in the clipboard plugin code "if ( transferType == CKEDITOR.DATA_TRANSFER_EXTERNAL && editor.pasteFilter && !dataObj.dontFilter )".

Expected result

It shouldn't think the use of is specific to Word.

Actual result

It thinks the HTL is from Word, and skips the filtering.

Other details

  • Browser: n/a
  • OS: n/a
  • CKEditor version: 4.6+
  • Installed CKEditor plugins: core bundled
jacekbogdanski commented 5 years ago

Hello,

could you provide example HTML which is affected by the pastefromword plugin?

blindspeed90 commented 5 years ago
  • I attached an HTML with two editors, the first with the plugin enabled, the second with it disabled
  • I attached 3 HTML files, each of which to do a selectAll/copy and then paste into each editor
  • I know <font> is deprecated, but I actually wasn't even testing it. IE11 (didn't try others) returns a <font> tag for <sub>/<sup>, which causes the plugin to think this came from MSWord, so it bypasses the paste filtering because of the dontFilter being set. Also an explicit use of it, albeit old HTML code, would cause this.

CKTest.zip

blindspeed90 commented 5 years ago

Sorry my last bullet looks whacky, I guess GitHub isn't properly escaping LT and GT!

blindspeed90 commented 5 years ago

One more thing, I just did a Shift+Insert, I didn't use the buttons. If I clicked the PasteFromWord button, I'd understand if this happens as I assume the request would go directly to that plugin.

jacekbogdanski commented 5 years ago

@blindspeed90 you have to wrap HTML content with backticks, otherwise, it will be parsed by markdown :)

I can reproduce the issue, thanks for the samples!