TinyMCE Align Buttons

OJS development discussion, enhancement requests, third-party patches and plug-ins.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.
Posts: 71
Joined: Wed Jul 28, 2010 12:47 pm

TinyMCE Align Buttons

Postby hekutoru2kx » Mon May 30, 2011 9:04 am

Hi everybody,

I was wondering if there is a way to add buttons to the tiny control to align any paragraph?. Everytime an article is added it needs to be aligned in its information. Is a hard work sometimes to check the tags manually or use a third software to do it. I want to know because sometimes if the data is copy from a text processor (like winword) it let a lot of dirty tags and I'd had some problems with it (like incomplete information shown).

I know there's a method to enable a default alignment in the style sheets. But that's only a default for one type of alignment. Let me know pleas, to know what to do.


Posts: 945
Joined: Wed Oct 15, 2003 6:15 am
Location: Brasí­lia/DF - Brasil

Re: TinyMCE Align Buttons

Postby ramon » Mon May 30, 2011 1:26 pm

Hello hekutoru2kx,

You can add extra fields according to TinyMCE specifications here.
You'll need to change plugins/generic/tinymce/TinyMCEPlugin.inc.php to add the specific buttons, according to the code provided by Moxicode.
Another options is to change the CSS to enable paragraphs to be justified by default, which would make more sense to me, as it will change all required paragraphs.

You may have to edit ojs2/templates/article/article.tpl, near line 80:

Code: Select all


You should add a class to the div, or modify that code to be a paragraph, although TinyMCE already adds paragraphs, so you have nested paragraphs on the variable.
I would recommend adding a class="abstract" at the div, and then on my CSS I would add the following rule:

Code: Select all

div.abstract p {

It's a simple modification, not too difficult to keep track of for future upgrades.

Posts: 71
Joined: Wed Jul 28, 2010 12:47 pm

Re: TinyMCE Align Buttons

Postby hekutoru2kx » Tue May 31, 2011 2:20 pm

Thank you very much Ramon.

I chose to change the TinyMCE plugin to adapt it to our needs. Because, like I said, If I just change the style sheet then I still won't be able to select the desired alignment but the justify.

Plus, this option allows me to enable again the plugin option to auto clean paste. Option that was disable for the need.

Keep with the hard work,

Héctor J. Hernández R.

Return to “OJS Development”

Who is online

Users browsing this forum: No registered users and 1 guest