Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-06-14 10:24:47

wata1946
New Member
Registered: 2010-06-14
Posts: 6

hak_tinymce add button issue

Hi,

I have an issue with adding a custom button to the toolbar menu. I have placed that code:

  theme_advanced_buttons1 : 'example'
   setup : function(ed) {
      // Register example button
      ed.addButton('example', {
         title : 'example.desc',
         image : '../jscripts/tiny_mce/plugins/example/img/example.gif',
         onclick : function() {
            ed.windowManager.alert('Hello world!! Selection: ' + ed.selection.getContent({format : 'text'}));
         }
      });
   }

in the “Initialization for article body editor” @ hak_tinymce_prefs, but nothing is different than the editor without it. The init config is sensitive for other settings like theme_advanced_buttons1, but the setup call seems to be ignored.

Many, many thanks in advance for any help,
wata1946

Last edited by wata1946 (2010-06-14 10:30:05)

Offline

#2 2010-06-14 13:48:26

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

Re: hak_tinymce add button issue

Don’t know if you can do that on setup. The docs only mention creating events. You could try moving that to onInit but the best thing would probably be to just create a plugin.

(function() {
	tinymce.create('tinymce.plugins.ExamplePlugin', {
		init : function(ed, url) {
			ed.addCommand('mceExample', function() {
				ed.windowManager.alert('Hello world!! Selection: ' + ed.selection.getContent({format : 'text'}));
			});
			ed.addButton('example', {
				title : 'example.desc',
				cmd : 'mceExample',
				image : url + '/img/example.gif'
			});

		}
	});
	tinymce.PluginManager.add('example', tinymce.plugins.ExamplePlugin);
})();

Last edited by hakjoon (2010-06-14 13:48:43)


Shoving is the answer – pusher robot

Offline

#3 2010-06-14 14:41:15

wata1946
New Member
Registered: 2010-06-14
Posts: 6

Re: hak_tinymce add button issue

Thanks very much hakjoon. For some reason I’ve got the 2.x version so I had to create a plugin with an old plugin-code structure. However, it works !

cheers,
wata1946

Offline

Board footer

Powered by FluxBB