Upgrading TinyMCE v4 to v5

Published by Richard GoodwinFiled under Quickies

Notes on the changes made to get editor working with TinyMCE v5:

No icons in IE11; SVG doesn't have a viewbox. Replace:
(<svg) (width="([0-9]+)" height="([0-9]+)">)
$1 viewbox="0 0 $3 $4" $2

addMenuItem and context in menus doesn't work any more; menus have to be pre-declared:

menu: {
   tools: { title: 'Tools', items: 'code changecase addcontents pdf_linefeeds' }


ed.ui.registry.addMenuItem('addcontents', {
  text: 'Add contents list',
  type: 'menuitem',
  onAction: function () {
    ed.insertContent('<div class="contents-list">&nbsp;</div>');
    color_map: [
"e32b23","Main colour",
"0a44b1","Darker blue",
      "FFccbb", "Light red",
"FFFF99", "Light yellow",
"bbeebb", "Light green",
"ccddff", "Light blue",
"FFbbFF", "Light purple",
      "636262", "Darkest grey",
"999999", "Dark grey",
"c6c6c6", "Mid grey",
"d8d8d6", "Light grey",
"f2f2f0", "Lightest grey",
      "000000", "Black",
"FFFFFF", "White",