create() {
this.rteObj.inputElement.addEventListener("keydown", function(e){
this.selection = new NodeSelection();
this.range = this.selection.getRange(document);
var currentNode = this.range.startContainer.nodeName === "#text" ? this.range.startContainer.parentElement : this.range.startContainer;
var table = closest(currentNode, "Table")
if (isNullOrUndefined(table) || (!isNullOrUndefined(table) && table.nodeName !== "TABLE") ) {
e.preventDefault();
}
});
}
render() {
return (<div className='control-pane'>
<div className='control-section' id="rteTools">
<div className='rte-control-section'>
<RichTextEditorComponent id="toolsRTE" ref={(richtexteditor) => { this.rteObj = richtexteditor; }
} toolbarSettings={this.toolbarSettings} created={this.create.bind(this)}>
<Inject services={[Toolbar, Image, Link, HtmlEditor, Count, QuickToolbar, Table]}/>
</RichTextEditorComponent>
</div>
</div>
</div>);
} |
.e-rte-table {
pointer-events: none;
touch-action: none;
} |
.e-rte-table { pointer-events: none; touch-action: none; } |
create() {
...
...
...
this.rteObj.executeCommand("insertTable", {
row: 5,
columns: 5,
selection: this.selection
});
var tabElem = this.rteObj.inputElement.querySelector(".e-rte-table");
tabElem.setAttribute("contentEditable", false);
}
beforeQTOpen(args) {
if (args.targetElement.closest("table").tagName === "TABLE") {
args.cancel = true;
}
} |
<RichTextEditorComponent id="toolsRTE"
ref={richtexteditor => { this.rteObj = richtexteditor; }} toolbarSettings={this.toolbarSettings}
created={this.create.bind(this)} beforeQuickToolbarOpen={this.beforeQTOpen.bind(this)} >
</RichTextEditorComponent> |
Hi Arul,Good day to you.We have validated your query “Restricting the edit access works fine in the web, but in mobile view the scrollable not working, because of `pointer-events: none` styles. I want non-editable table with scrollable”.The edit access for the table can be prevented differently without using the CSS style, by making the `contentEditable` as false for the table element and also prevent the quick toolbar open by setting the `cancel` argument as true using the `beforeQuickToolbarOpen` event in the Rich Text Editor. We have prepared a sample for your reference,Code Snippet:
create() {.........this.rteObj.executeCommand("insertTable", {row: 5,columns: 5,selection: this.selection});var tabElem = this.rteObj.inputElement.querySelector(".e-rte-table");tabElem.setAttribute("contentEditable", false);}beforeQTOpen(args) {if (args.targetElement.closest("table").tagName === "TABLE") {args.cancel = true;}}
<RichTextEditorComponent id="toolsRTE"ref={richtexteditor => { this.rteObj = richtexteditor; }} toolbarSettings={this.toolbarSettings}created={this.create.bind(this)} beforeQuickToolbarOpen={this.beforeQTOpen.bind(this)} ></RichTextEditorComponent>Please check the above code snippet and the sample and let us know if it resolves your issue.Regards,Revanth