Project

General

Profile

Actions

Anomalie #792

closed

handle better word copy-paste with no user action required

Added by Simon over 6 years ago. Updated over 6 years ago.

Status:
Fermé
Priority:
Normal
Assignee:
Category:
general
Target version:
Start date:
10/20/2017
Due date:
% Done:

100%

Estimated time:
2.00 h
Resolution:

Description

Try to make copy from word and removing font family attribute.

https://ckeditor.com/old/forums/Support/FIXED-How-to-disable-the-use-of-font-family


Related issues 2 (0 open2 closed)

Related to Evolution #788: handle better word copy-pasteFerméSimon10/16/2017

Actions
Related to Evolution #794: ckeditor remove font-family when copying from wordFerméSimon10/21/2017

Actions
Actions #1

Updated by Simon over 6 years ago

  • Target version deleted (2.1)
Actions #2

Updated by Simon over 6 years ago

  • Subject changed from handle better word copy-paste to handle better word copy-paste with no user action required
Actions #3

Updated by Simon over 6 years ago

Actions #4

Updated by Simon over 6 years ago

  • Related to Evolution #794: ckeditor remove font-family when copying from word added
Actions #5

Updated by Simon over 6 years ago

see : https://codepen.io/mlewand/pen/oeaZrV

CKEDITOR.replace( 'editor1', {
    extraPlugins: 'colorbutton,font',
    on: {
        afterPasteFromWord: function( evt ) {
            // Clone the filter, so that it's based on current editor filter settings.
            // Note that this function is added in CKE 4.7.3.
            var filter = evt.editor.filter.clone(),
                fragment = CKEDITOR.htmlParser.fragment.fromHtml( evt.data.dataValue ),
                writer = new CKEDITOR.htmlParser.basicWriter();

            // Disallow certain styles.
            filter.disallow( 'span{font-family,color,font-size}' );

            // Process, and overwrite evt.data.dataValue.
            filter.applyTo( fragment );
            fragment.writeHtml( writer );
            evt.data.dataValue = writer.getHtml();
        }
    }
} );

And this code, to handle event :

CKEDITOR.on("instanceReady", function(ev) {
  var editor = ev.editor;
  editor.on("focus", function(ev) {
    alert("focused!");
  });
});

https://stackoverflow.com/questions/19805338/adding-event-handlers-globally-to-all-ckeditor-instances
Actions #6

Updated by Simon over 6 years ago

  • Target version set to 2.1
Actions #7

Updated by Simon over 6 years ago

  • Status changed from Nouveau to Fermé
  • % Done changed from 0 to 100

Applied in changeset linea21|r3284.

Actions

Also available in: Atom PDF