Posted by
Mencey Melgar on
Jun 05, 2013; 1:37pm
URL: https://support.nabble.com/Colors-in-new-posts-tp7584692.html
Hi, I've been trying to create something like a editor_color_button but failed all the time(javascript is not my strong face). So I'm asking for help here.
I think colors are actually a good feature for all forums, at first I tried to add colors using the < h1>, 2, etc. But this is not the good way to do it.
I'm purposing to add a new tool for new posts with a dropdown showing a table of colors. I tried to do it following the smiley tool since it's very similar for what I want:
(this is just an idea, maybe I'm wrong trying to do this x)):
The smiley feature uses a default line to introduce the url to the image:
<img src=
And adds the URL depending of the smile chosen.
My idea is to use something similar, but for < span>. When you select a predefined color in the colors table, insert the span and changing the color style source. This would be the default line:
<span style="<here the color:# and color id>"> + "here the text" + <span>
So to use this, we will also need a colors_table, something like:
<macro name="color_table">
<n.comment.>
You can edit the table below if you want to customize the list of colors.
Example:
<n.color name="red" col="color:#F00"/>
</n.comment.>
<table style="text-align:center">
<tr>
<td><n.color name="red" col="color:#F00" src=(here the url to the color box that will appear in the dropdown)/></td>
<td><n.color name="yellow" col="color:#FF0"/></td>
<td><n.color name="green" col="color:#008000"/></td>
</tr>
</table>
</macro>
And a color macro:
<macro name="color" parameters="name,style">
<a href="javascript:Nabble.color('[n.style/]')">
<n.if.starts_with text="[n.style/]" prefix="color:#">
<then><span style="[n.style/]" alt="[n.name/]" border="0" /></then>
<else><img src="[n.src/]" alt="[n.name/]" border="0" /></else>
</n.if.starts_with>
</a>
</macro>
I want to say again that I couldn't do it, I don't have enough knowledge to do it.
What do you think nabble team? :)
:) Helper