Skip to content

Commit

Permalink
Item14323: API change to addButton in tinymce 5.x
Browse files Browse the repository at this point in the history
This is maybe a partal fix for the following JS error reported by
TinyMCE:

Failed to initialize plugin: foswiki Error: "editor.addButton has been
removed in tinymce 5x, use editor.ui.registry.addButton or
editor.ui.registry.addToggleButton or editor.ui.registry.addSplitButton
instead"

However it doesn't work.  It fails with further errors:

Failed path: (toolbarbutton) Could not find valid *strict* value for
"onAction" in { "type": "button", "title": "Typewriter text", "image":
"/pub/System/TinyMCEPlugin/plugins/foswiki/img/tt.gif" } Input object: {
"type": "button", "title": "Typewriter text", "image":
"/pub/System/TinyMCEPlugin/plugins/foswiki/img/tt.gif" }
  • Loading branch information
gac410 committed Jun 19, 2019
1 parent 075b960 commit 35bd2d6
Showing 1 changed file with 5 additions and 5 deletions.
Expand Up @@ -424,7 +424,7 @@
this.execCommand("mceSave");
});

ed.addButton('fwtt', {
ed.ui.registry.addButton('fwtt', {
title: 'Typewriter text',
onclick: function(evt) { ed.formatter.toggle('WYSIWYG_TT'); },
image: url + '/img/tt.gif',
Expand All @@ -440,7 +440,7 @@
&& !foswiki.getPreference("TOPIC").match(
/(X{10}|AUTOINC[0-9]+)/))
{
ed.addButton('fwupload', {
ed.ui.registry.addButton('fwupload', {
title: 'Upload attachment',
image: url + '/img/upload.gif',
onclick: function () {
Expand All @@ -451,15 +451,15 @@
// else browser too old (need HTML5 FormData), or the topic is
// AUTOINC

ed.addButton('fwinsertlink', {
ed.ui.registry.addButton('fwinsertlink', {
title: 'Insert link to attachment',
image: url + '/img/insertlink.gif',
onclick: function () {
getListOfAttachments(showInsertLinkDialog);
}
});

ed.addButton('fwchangelisttype', {
ed.ui.registry.addButton('fwchangelisttype', {
title: 'Change bullet/number style',
image: url + '/img/changeliststyle.gif',
onClick: function() { handleChangeListType(ed); },
Expand All @@ -474,7 +474,7 @@

});

ed.addButton('fwhide', {
ed.ui.registry.addButton('fwhide', {
title: 'Edit Foswiki markup',
image: url + '/img/hide.gif',
onClick: function () { handleHide(ed); }
Expand Down

0 comments on commit 35bd2d6

Please sign in to comment.