Hi Antonio,
Since document is in protected state, navigating to bookmark doesn’t enable the editing state of document editor. Hence editing operations like insertImage is restricted on read-only mode.
Note: For insertText API, we have not considered the read-only mode. we will consider it.
You can use navigateToNextEditingRegion API to navigate to the editable region and check whether current selection is in required bookmark. If so, you can insert the image. Please check the below sample code snippet.
Sample code snippet
|
container.documentEditor.selection.navigateToNextEditingRegion();
if(container.documentEditor.selection.bookmarks.length == 1 && container.documentEditor.selection.bookmarks[0]== "REFERTO_TITOLO"){
var img = new Image();
img.addEventListener('load', (event)=> {
container.documentEditor.editor.insertImage('data:image/gif;base64,R0lGODlhCwALAIAAAAAA3pn/ZiH5BAEAAAEALAAAAAALAAsAAAIUhA+hkcuO4lmNVindo7qyrIXiGBYAOw==', 300, 100);
}, false);
img.src = 'data:image/gif;base64,R0lGODlhCwALAIAAAAAA3pn/ZiH5BAEAAAEALAAAAAALAAsAAAIUhA+hkcuO4lmNVindo7qyrIXiGBYAOw==';
}
|
Regards,
Harini C