javascript - Tinymce load buttons according to users selection -


we using tinymce transcription/annotation. each button type of 'thing'. have lot of things , dont want of them load.

instead ideally tiny mce editor have buttons hidden default, except drop down list contains types of documents transcribing. user can select document type , voila buttons appear.

is possible tinymce? has else done this?

this has done within tinymce editor loading editor floating window.

the key keep settings intact , modify on user-selected option in case.

i modified @pete's code little bit, , works fine.

here code:

    <script type="text/javascript">      var settings = {         selector: "textarea",         plugins: [             "advlist autolink lists link image charmap print preview anchor",             "searchreplace visualblocks code fullscreen",             "insertdatetime media table contextmenu paste"         ],         toolbar: []     };      function loadtinymce(type) {         if (type !== null) {             switch (type) {                 case "a":                     settings.toolbar = "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image";                     break;                 case "b":                     settings.toolbar = "insertfile undo redo | styleselect | bold italic";                     break;                 case "c":                     settings.toolbar = "bullist numlist outdent indent | link image";                     break;             }              tinymce.remove();              //run setup function custom set of toolbars               tinymce.init(settings);         }        }  </script>  <select onchange="loadtinymce(this.value);"> <option value="">choose</option> <option value="a">example a</option> <option value="b">example b</option> <option value="c">example c</option> </select>  <br><br> <textarea name="content" id="content"></textarea> 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -