BoldDeskWe are launching BoldDesk on Product Hunt soon. Learn more & follow us.
Good day
I have an issue with the selectionChanged event as I doesn't fire when I click into the document editor selection another position.
var documenteditorContainer = new ej.documenteditor.DocumentEditorContainer({ enableToolbar: true,enableSelection: true, enableSearch: true, enableEditor: true, isReadOnly: false, enableOptionsPane: true, height: "100vh", width: "100%"});
let contentChanged = false;
//Inject require modules.
ej.documenteditor.DocumentEditorContainer.Inject(ej.documenteditor.Toolbar,ej.documenteditor.Selection, ej.documenteditor.Search, ej.documenteditor.Editor, ej.documenteditor.OptionsPane);
documenteditorContainer.contentChange = () => {
contentChanged=true;
};
documenteditorContainer.selectionChanged = () => {
alert(documenteditorContainer.documentEditor.selection);
documenteditorContainer.documentEditor.selection.select();
};
The contentChange event works but the selectionChanged doesn't. I tried it with documenteditorContainer.documentEditor.selectionChanged without any luck.
We are using the EssentialStudio2 Version Javascript.
Please help to resolve this issue. If you need more information let me know.
Best Regards
Hi David,
We have checked with the above code (selectionChange event). We have added simple code to alert with the selection text and attached a screenshot and simple sample for your reference. please cross-check that and let us know if you need any other assistance.
Sample Link: https://stackblitz.com/edit/z2ksfw-x3nkdx?file=index.ts
#documenteditorContainer.documentEditor.selection.select();
We suggest you
use the select API
as
documenteditorContainer.documentEditor.selection.select(start,end); |
Please refer the below documentation link to know more about select API
UG Link:https://ej2.syncfusion.com/documentation/api/document-editor/selection/#select-1
Regards,
Kavitha M
Hi Thank you so much for your support.
However this doesn't resolve my issue. I change the code now how you suggested but the alert never shows.
I have cleared all my caches. It seems like the selectionChanged event never fires.
As I stated above the contentChange event does fire. So it doesn't seem to be a issue with the events in general but just the selectionChanged event.
Best Regards Da
documenteditorContainer.selectionChanged = () => {
let selectedText = documenteditorContainer.documentEditor.selection.text;
if (selectedText !== undefined && selectedText !== '') {
alert(selectedText);
}
};
I wrote selectionChanged instead of just selectionChange
Issue is resolved. I am sorry
Thanks for the update, David.
We are happy to hear that your issue has been resolved. Please get back to us if you need any other assistance. We would be happy to assist you as always.