javascriptreactjstinymcetinymce-plugins

react tinymce hpw to show only preview and print under file


I'm trying to create an application. Where I'm using tinymce as editor. In the file panel, I don;t want to show new document. Corrently it's rendering:

enter image description here

But I just want to render it with thse two options:

enter image description here

Can anyone help me with it?

Here is my related config:

plugins: 'print preview ...',
menubar: 'file edit ...',        

thanks.


Solution

  • Per the documentation if you want to control what you see on each discrete menu you have to provide those choices explicitly:

    https://www.tiny.cloud/docs/configure/editor-appearance/#menu

    The defaults are:

    menu: {
        file: { title: 'File', items: 'newdocument restoredraft | preview | print ' },
        edit: { title: 'Edit', items: 'undo redo | cut copy paste | selectall | searchreplace' },
        view: { title: 'View', items: 'code | visualaid visualchars visualblocks | spellchecker | preview fullscreen' },
        insert: { title: 'Insert', items: 'image link media template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor toc | insertdatetime' },
        format: { title: 'Format', items: 'bold italic underline strikethrough superscript subscript codeformat | formats blockformats fontformats fontsizes align lineheight | forecolor backcolor | removeformat' },
        tools: { title: 'Tools', items: 'spellchecker spellcheckerlanguage | code wordcount' },
        table: { title: 'Table', items: 'inserttable | cell row column | tableprops deletetable' },
        help: { title: 'Help', items: 'help' }
      }
    

    So if you only want 2 items on the file menu you would have to state that explicitly within the broader menu option:

    file: { title: 'File', items: 'preview | print ' },
    

    Here is a TinyMCE Fiddle showing this in action: https://fiddle.tiny.cloud/hYhaab