documenteditor.documentEditor.editor.selection.select("0", "5");
documenteditor.documentEditor.editor.toggleHighlightColor("BrightGreen");
console.log("clicked", documenteditor.documentEditor.editor.selection);
});
But it just goes to the 0 index of the editor, is there anything that I did wrong?
Selects content based on start and end hierarchical index.
| Parameter | Type | Description |
|---|---|---|
| start | string | start hierarchical index. |
| end | string | end hierarchical index. |
Returns void
The parameters I used are in string format and i have enableSelection: true as well.
documenteditor = new ej.documenteditor.DocumentEditorContainer({
isReadOnly: false,
enableToolbar: true,
acceptTab: true,
enableAllModules: true,
enableWordExport: true,
enableEditor: true,
enableTrackChanges: true,
enableSelection: true,
serviceUrl: 'https://ej2services.syncfusion.com/production/web-services/api/documenteditor/'
});
documenteditor.pageOutline = '#E0E0E0';
//Documenteditor control rendering starts
document.getElementById("docedit-syncfu").addEventListener("dragover", function (event) {
event.preventDefault();
});
documenteditor.created = function() {
console.log("created");
console.log("syncfu", document.getElementById("docedit-syncfu"));
document.getElementById("docedit-syncfu").addEventListener("drop", function (e) {
console.log("dropped");
var text = e.dataTransfer.getData('Text').replace(/\n/g, '').replace(/\r/g, '').replace(/\r\n/g, '');
console.log("e", e.offsetX);
console.log("docedit", documenteditor.documentEditor.editor);
documenteditor.documentEditor.editor.insertText("123");
});
};
documenteditor.appendTo('#docedit-syncfus');
documenteditor.contentChange = function(e) {
console.log(e);
};
$("#test-save").click(function(e){
console.log("clicked", documenteditor.documentEditor);
documenteditor.documentEditor.editor.insertText("Welcome");
documenteditor.documentEditor.selection.select("0;0;1", "0;0;5");
});