Properties Panel - set text tab by default

Hello,
we are using yours DocumentEditor control from Angular library.
We have one small problem with properties pane - exactly with Table properties. 
We want to implement functionality that is setting up Text properties by default when some one sets up cursor on table in text.
Now in properties pane by default "table" tab is chosen - we want to have "text" by default. (look screen) 
Is there any workaround for that? 




Kind regards,
Czarek

3 Replies 1 reply marked as answer

HC Harini Chellappa Syncfusion Team August 27, 2020 02:09 PM UTC

Hi Cezary, 

When current selection context type is within table, then table tab will be in selected state. There is no direct public API to switch between properties pane tab. 

In use case level, once table is selected or selection is within table, then you need table tab to be selected by default for applying table properties.  

Can you please share why you need text tab to be default when selection is within table? It will be helpful for us to provide solution at the earliest. 

Regards, 

Harini C 



CS Cezary Szacherski August 27, 2020 02:36 PM UTC

I need that because this is requirement from our clients. 
If there is no standard/easy way using API at the moment to achieve that, I will try to explain that to them. 


HC Harini Chellappa Syncfusion Team August 28, 2020 05:03 PM UTC

Hi Cezary, 

There is no direct API to achieve your requirement. As a workaround, you can select the text tab by taking tab object from element, since it’s an EJ2 tab component. 

Selection change event will trigger whenever there is a selection in editor. 

In that event, you can check whether current context type is table, if so, you can get the tab object and select the text tab using EJ2 tab component API. 

Code snippet 

onSelectionChange(): void { 
    var propertyPaneTab = document.querySelector(".e-de-prop-pane>.e-de-property-tab"); 
    if(this.container.documentEditor.selection.contextType.indexOf("Table") >= 0 && propertyPaneTab){ 
      (propertyPaneTab as any).ej2_instances[0].selectedItem = 1; 
    } 
  } 
 
 
For your reference, we have prepared the sample. Kindly check it. 


But, due to this there will be some changes in the current tab behavior which I mentioned in the previous update. In the above sample, whenever the current selection is within table, text tab will be shown as default. Hence if you select the whole table or row or cell, then text tab will be in default, instead of table tab. Once if you switch to table tab and apply table properties, it will switch to text tab based on current selection. Kindly check whether this satisfy your need. 

Please find the video of above mentioned behavior from below link. 


Regards, 

Harini C 


Marked as answer
Loader.
Up arrow icon