R
R
Roman Koff2015-05-05 17:12:15
CKEditor
Roman Koff, 2015-05-05 17:12:15

How to prevent CKEditor from adding spaces ( )?

When entering text, CKEditor allows you to enter multiple spaces in a row, replacing them with the  
Is there a way to prevent the editor from automatically inserting   (leaving only the ability to insert a non-breaking space using the CTRL + SHIFT + SPACE combination)? The path just inserts spaces. I will remove them later.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladrat, 2015-06-22
@Vladrat

CKEDITOR.on('instanceReady', function(ev) {
  ev.editor.on('paste', function(evt) { 
    evt.data.dataValue = evt.data.dataValue.replace(/ /g,' ');
    evt.data.dataValue = evt.data.dataValue.replace(/<p><\/p>/g,' ');
    console.log(evt.data.dataValue);
  }, null, null, 9);
});

I
Ivan, 2017-10-29
@ikode

You need to write this in the CKEditor config:
config.basicEntities = false;
Source is here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question