tinymce / tinymce-vue

Official TinyMCE Vue component
MIT License
2.06k stars 207 forks source link

Dynamically generate custom menu items #333

Closed nhatimme closed 1 year ago

nhatimme commented 2 years ago

What is the current behavior? Currently we have created a function inside fetch. Which should generate a array of objects.

Please provide the steps to reproduce and if possible a minimal demo of the problem https://codesandbox.io/s/tinymce-vue-y504od

Click on the button "My button" and check console. Now I get the following errors:

Unknown item in general menu 
{value: "generated-menu-item_7770287682291661522230581", type: "menuItem", text: "[customer_firstname]"}
Unknown item in general menu 
{value: "generated-menu-item_1540549822281661522230581", type: "menuItem", text: "[customer_lastname]"}

What is the expected behavior? In my opinion it should provide me the list which is created from the function CreateShortcodes.

Which versions of TinyMCE, and which browser / OS are affected by this issue? Did this work in previous versions of TinyMCE or tinymce-vue? 6.0.2

exalate-issue-sync[bot] commented 2 years ago

Ref: INT-2999

nhatimme commented 2 years ago

Any solution guys? Can't go further with the projects.

lnewson commented 2 years ago

@nhatimme your problem here is that you have a typo... if you change menuItem to menuitem with all lowercase it should fix the issue. You'll see it uses a lowercased version in the docs for the menubutton as well, see https://www.tiny.cloud/docs/tinymce/6/custom-menu-toolbar-button/

jscasca commented 1 year ago

Closing as resolved