This is a migrated thread and some comments may be shown as answers.

Hiding EditorToolGroups via Javascript

2 Answers 80 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 30 Nov 2017, 03:37 PM

We're wanting to use RadEditor as a robust TextArea replacement, and we want the user to have access to the full array of tools, but only if they ask for them by clicking on an icon.

We're doing this now, by hiding all of the EditorTool buttons when the Editor is loaded, but this is leaving behind a bunch of empty EditorToolGroups.  Is there a way to show/hide an EditorToolGroup instead?

            var oTool;             oTool = editor.getToolByName("Undo"); if (oTool) oTool.get_element().style.display = "none";

I've attached screenshots of what it looks like when the toolbars are closed and opened.

2 Answers, 1 is accepted

Sort by
0
Mike
Top achievements
Rank 1
answered on 30 Nov 2017, 05:09 PM

I see that the EditorToolGroup has an attribute called "Tag".  What is this, and can it be used for selecting the <ul><li> that the EditorToolGroup ultimately renders to?

<telerik:EditorToolGroup Tag="ConvertToolbar">

0
Mike
Top achievements
Rank 1
answered on 30 Nov 2017, 06:03 PM

We found our answer.

Since we want to show/hide entire EditorToolGroups, and the format of these groups when using ContentAreaMode='Div' (<div><ul><li><a>), we're now doing the following:

(the EditorTool is <a>, so we need two parentNodes to get to the <ul>)

To Hide:

oTool = editor.getToolByName("Undo"); 

if (oTool) oTool.get_element().parentNode.parentNode.style.display = "none";

To Show:

oTool = editor.getToolByName("Undo"); 
if (oTool) oTool.get_element().parentNode.parentNode.style.display = "";

 

This should work for us so long as the final rendering format of EditorTools doesn't change when using ContentAreaMode='Div'

Tags
Editor
Asked by
Mike
Top achievements
Rank 1
Answers by
Mike
Top achievements
Rank 1
Share this question
or