Skip to content

Instantly share code, notes, and snippets.

@ronisaha
Created June 4, 2016 03:33
Show Gist options
  • Select an option

  • Save ronisaha/eff5c4fea41f00c3bfc3a877c10abb70 to your computer and use it in GitHub Desktop.

Select an option

Save ronisaha/eff5c4fea41f00c3bfc3a877c10abb70 to your computer and use it in GitHub Desktop.
Ckeditor Replace and focus on last/ alternatte http://ckeditor.com/addon/autocorrect
CKEDITOR.on('instanceReady', function(ev) {
var editor = ev.editor;
editor.on('key', function (event) {
setTimeout(function () {
var edata = editor.getData();
var replaced_text = edata.replace("#1", "one"); // you could also use a regex in the replace
editor.setData('', function () {
editor.insertHtml(replaced_text);
})
}, 10);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment