Closed shubhamp861 closed 2 years ago
Able to get selected text and button, but still don't know how we can replace it with different text so it can reflect back same to ck editor window.
And also can we achieve Foot Note. for example refer below link
https://www.drupal.org/docs/8/modules/footnotes/adding-footnotes-to-content-via-the-ckeditor-toolbar
Your questions are out of scope of ng2-ckeditor. For more information how ckeditor works please refere the ckeditor documentation. Yes, you can replace the text or add your own element.
const selection = this.ckeditor.instance.getSelection();
const txt = selection.getSelectedText(); // or replace the text
let element: CKEDITOR.dom.element;
element = this.ckeditor.instance.document.createElement('span');
element .setAttribute('id', 'myIdXYZ');
element.setHtml(txt);
this.ckeditor.instance.insertElement(element);
Thanks this will work for me. thanks for quick response.
How to replace selected text with different text or more on to add style . For example if i select any text from editor and click on bold button it will go and change my selected text with bold style. wanted to create a button which will change or replace my selected text in editor