MyBB Community Forums

Full Version: Tutorial: Adding Extra Function Buttons to the Editor v2
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Ups, I just see that now. Sorry, my bad. Sad
thanks for the tutorial...

but can we add a new line after this?

this.createToolbarContainer('bottom');

		this.createToolbar('insertables', {
			container: 'bottom',
			alignment: 'right',
			items: [
				{type: 'button', name: 'list_num', sprite: 'list_num', insert: 'list', extra: 1, title: this.options.lang.title_numlist},
				{type: 'button', name: 'list_bullet', sprite: 'list_bullet', insert: 'list', title: this.options.lang.title_bulletlist},
				{type: 'separator'},
				{type: 'button', name: 'img', sprite: 'image', insert: 'image', extra: 1, title: this.options.lang.title_image},
				{type: 'button', name: 'url', sprite: 'link', insert: 'url', title: this.options.lang.title_hyperlink},
				{type: 'button', name: 'email', sprite: 'email', insert: 'email', extra: 1, title: this.options.lang.title_email},
				{type: 'separator'},
				{type: 'button', name: 'quote', sprite: 'quote', insert: 'quote', title: this.options.lang.title_quote},
				{type: 'button', name: 'code', sprite: 'code', insert: 'code', title: this.options.lang.title_code},
				{type: 'button', name: 'php', sprite: 'php', insert: 'php', title: this.options.lang.title_php},
				{type: 'button', name: 'video', insert: 'video', image: 'television.gif', dropdown: true, title: this.options.lang.title_video, options: this.videos}
			]
		});
		this.createToolbar('formatting', {
			container: 'bottom',
			items: [
				{type: 'button', name: 'b', sprite: 'bold', insert: 'b', title: this.options.lang.title_bold},
				{type: 'button', name: 'i', sprite: 'italic', insert: 'i', title: this.options.lang.title_italic},
				{type: 'button', name: 'u', sprite: 'underline', insert: 'u', title: this.options.lang.title_underline},
				{type: 'separator'},
				{type: 'button', name: 'align_left', sprite: 'align_left', insert: 'align', extra: 'left', title: this.options.lang.title_left},
				{type: 'button', name: 'align_center', sprite: 'align_center', insert: 'align', extra: 'center', title: this.options.lang.title_center},
				{type: 'button', name: 'align_right', sprite: 'align_right', insert: 'align', extra: 'right', title: this.options.lang.title_right},
				{type: 'button', name: 'align_justify', sprite: 'align_justify', insert: 'align', extra: 'justify', title: this.options.lang.title_justify}
			]
		});

so it's like this?


		this.createToolbarContainer('lastline');

		this.createToolbar('insertables', {
			container: 'lastline',
			items: [
				{type: 'button', name: 'spoiler', insert: 'spoiler', image: 'spoiler.gif', title: 'Spoiler'},
				{type: 'button', name: 'youtube', insert: 'youtube', image: 'youtube.gif', title: 'youtube'}
			]
		});
I made the edits & this was working great but now when any of the buttons is used it shows
[undefined=undefined] instead of the proper mycode so am needing some help in what to change or edit please.

edit: the mycode's do still work if typed in, just the buttons not working.

thanks
(2012-10-21, 01:41 PM)__JJ__ Wrote: [ -> ]I made the edits & this was working great but now when any of the buttons is used it shows
[undefined=undefined] instead of the proper mycode so am needing some help in what to change or edit please.

edit: the mycode's do still work if typed in, just the buttons not working.

thanks

That is a bug that is unrelated to having added codebuttons through the techniques described in this tutorial.

Here is the official fix: http://community.mybb.com/thread-127322-...#pid922533
Thanks for pointing me in the right direction Wildcard +1
This is no longer work I thought!
Just tried to do that and what happend was that after adding the line exactly as in the example above, after that no codebuttons at all were shown anymore. After I put the unaltered editor.js file back, all was back to normal.

Why is that ?
Did you remember to install the codebutton images?

Could you have had an error in your syntax?

Did you forget a comma? Semi-colon?

This tutorial has worked for me every time.
If you mean that if Codebuttons are active, yes they are. And I did use the exact example and just changed the image icon and the name, thats it. Will try again.

Wolf

Never mind, works now. Wink Adding code now. Wink Thank you !

Cheers

Wolfseye
Thank you it helps me alot Smile
Pages: 1 2 3