Resource icon

Align Text Justified BB Code 1.0

No permission to download
That's the question I was going to ask. I suppose extending redactor to include the justify button is more than a trivial task, else you would have done it, Chris :)
 
The online demo of redactor has a Justify Text function:

bwQDzlW.png


http://imperavi.com/redactor/
 
The spritesheet also has a justify button by default.

Just really not had time to look into it properly :)
 
This add-on is no longer needed in 1.3.
It's now a simple matter to create justify bb code with an editor button via the ACP.
 
This add-on is no longer needed in 1.3.
It's now a simple matter to create justify bb code with an editor button via the ACP.

Good point, Paul.

Guess we'll just wait until 1.3 is out of beta and take care of it then.
 
I tried to get the redactor built-in justify function to work.
What I did:
edited \js\xenforo\bb_code_edit.js, the red part has been added
alignment:{title:this.getText("alignment"),func:"show",dropdown:{alignleft:{title:this.getText("align_left"),exec:"JustifyLeft",className:"icon alignLeft"},aligncenter:{title:this.getText("align_center"),
exec:"JustifyCenter",className:"icon alignCenter"},alignright:{title:this.getText("align_right"),exec:"JustifyRight",className:"icon alignRight"},alignjustify:{title:this.getText("align_justify"),exec:"JustifyFull",className:"icon Justify"}}}

edited the template "editor_js_setup", the red part has been added
align_right: "{xen:jsescape {xen:phrase align_right}}",
align_justify: "{xen:jsescape {xen:phrase align_justify}}",

edited the template "editor_ui.css", the red part has been added
.redactor_dropdown a.alignRight
{
background-position: {xen:if $pageIsRtl, '97%', '3%'} -{xen:calc '{$redactorButtons.redactor_btn_alignright} * 32 - 3'}px;
}
.redactor_dropdown a.Justify
{
background-position: {xen:if $pageIsRtl, '97%', '3%'} -{xen:calc '{$redactorButtons.redactor_btn_justify} * 32 - 3'}px;

}

added a phrase for "align_justify".

Now I have a working justify button in the alignment dropdown. The selected text is justified in the editor after clicking the justify button, the source code shows a "text-align:justify" style tag. But after saving the style is gone. Seems that there is somewhere a function that removes the style ?!

Any help would be appreciated ;)

CRc2eVa.png
 
I tried to get the redactor built-in justify function to work.
What I did:
edited \js\xenforo\bb_code_edit.js, the red part has been added


edited the template "editor_js_setup", the red part has been added


edited the template "editor_ui.css", the red part has been added


added a phrase for "align_justify".

Now I have a working justify button in the alignment dropdown. The selected text is justified in the editor after clicking the justify button, the source code shows a "text-align:justify" style tag. But after saving the style is gone. Seems that there is somewhere a function that removes the style ?!

Any help would be appreciated ;)

CRc2eVa.png

What version of XenForo are you on? If 1.3 or 1.4, this add-on is no longer needed as you can create custom BB code.
 
Thx @Maru and @oman
I am on 1.4.3.
Yes, I know about the custom BBcode and the AddOns, but I don't want to have a seperate, stand-alone button.
My intention was to "activate" the already built-in functionality in the redactor, in the same dropdown as the other alignment buttons are.
You @oman mentioned above that the justify function is available on the redactor online demo, unfortunatelly no one of the develeopers seem to have time to implement (see @Chris D 's comment) ;)

Finally I got it.
Added "case 'justify':" in 3 files and added a justify BBCode.
 
Top Bottom