admin管理员组

文章数量:1394228

I am trying to add a link/unlink and image button to my TinyMCE editor. Now I have the following code:

tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  toolbar1: 'link unlink image',
  toolbar2: 'undo redo | styleselect | bold italic | link | alignleft aligncenter alignright'
});

However its showing an empty first toolbar. Please see my fiddle: JSFiddle

I am trying to add a link/unlink and image button to my TinyMCE editor. Now I have the following code:

tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  toolbar1: 'link unlink image',
  toolbar2: 'undo redo | styleselect | bold italic | link | alignleft aligncenter alignright'
});

However its showing an empty first toolbar. Please see my fiddle: JSFiddle

Share Improve this question asked Mar 11, 2016 at 10:19 Arko ElsenaarArko Elsenaar 1,7394 gold badges18 silver badges36 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 7

You have used two toolbars though the issue seems to be with plugins, try instead using below:

tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  plugins: [
        "advlist autolink lists link image charmap print preview anchor",
        "searchreplace visualblocks code fullscreen",
        "insertdatetime media table contextmenu paste"
  ],
  toolbar: 'undo redo | styleselect | bold italic | link | alignleft aligncenter alignright | link image',

});

DEMO

You just need to add needed plugins:

tinymce.init({
      selector: 'textarea',  // change this value according to your HTML
      toolbar1: 'link unlink image',
      toolbar2: 'undo redo | styleselect | bold italic | link | alignleft aligncenter alignright',
      plugins: ["link image"],
    });

Default icons are required to be imported in TinyMCE 5.3 or above.

import 'tinymce/icons/default';

Here are the references:

  • TinyMCE Official Doc https://www.tiny.cloud/docs/advanced/usage-with-module-loaders/

本文标签: javascriptTinyMCE some buttons are not showing upStack Overflow