Open Webreaper opened 4 months ago
Okay, so figured this out.
menu
object doesn't exclude it from the top-level menu. You have to use menubar
combined with menu.This code works in Blazor:
<Editor ApiKey="blah" @bind-Value="@Content"
ScriptSrc="js/tinymce/tinymce.min.js" Conf="tinyConf"/>
@code {
protected override void OnInitialized()
{
var menu = new
{
edit = new { title = "Edit", items = "undo redo | cut copy paste | selectall | searchreplace"},
insert = new { title = "Insert", items = "image link media template codesample inserttable | hr | pagebreak nonbreaking anchor toc | insertdatetime"},
format = new { title = "Format", items = "bold italic underline strikethrough superscript subscript codeformat | formats blockformats fontformats fontsizes align lineheight | forecolor backcolor | removeformat"},
view = new { title = "View", items = "code | visualaid visualchars visualblocks | spellchecker | preview fullscreen"},
table = new { title = "Table", items = "inserttable | cell row column | tableprops deletetable" },
tools = new { title = "Tools", items = "wordcount"}
};
var menubar = "edit insert format view table tools";
tinyConf = new Dictionary<string, object>
{
{ "width", "95%" },
{ "plugins", "anchor autolink autoresize emoticons fullscreen image lists advlist link quickbars media searchreplace table wordcount"},
{ "menubar", menubar},
{ "menu", menu },
};
base.OnInitialized();
}
}
}
Leaving this open because it would be nice if the TinyMCE sample in the menu documentation highlighted this fact.
I'm trying to customise the menu items in Blazor and have this:
However, the custom menu isn't being initialised, and TinyMCE is just using the basic/standard menu. I get no errors. Any clue what I'm doing wrong?