[nodebb-plugin-buttons-galore] NodeBB: Buttons Galore
-
@psychobunny, excellent - thanks for the tips. Once things progress a bit I'll see about working on the ACP interface.
-
@Ted so what do you think it will take to do the alignment; custom CSS or something more complicated? I'm willing to help in whatever capacity I can!
-
@Tanner, I'm thinking either custom CSS or an HTML span would work. For something that's either going to be left or right aligned though, application of a CSS on the selected area seems to be a cleaner solution - just depends on how well the CSS plays with what else is in the composer.
Sorry, have been busy with a big project and classes starting back.
-
No worries man, just curious so I could have a direction if it turns out I can help. I'm starting classes soon to so I get it.
Need a hand for getting that part set? Help me out to get started and I'll see what I can do.
-
I was looking at this, but got sidetracked with a few issues I ran into, mainly the regex used. As it's not as simple as I'd of liked.
I don't think spans will work, spans need to go on the outside of the paragraph tags, not inside. Each new line in NodeBB is given a new paragraph tag, so I believe that the span will end up inside a paragraph tag. Which won't work.
What you would need to do instead is give that paragraph tag the class of
align-right
oralign-center
.I've explained it in this jsfiddle I wrote whilst caffeined to my eyeballs on energy drinks. http://jsfiddle.net/srm2dftu/1
-
You can use text-center and text-right, it's built into bootstrap. What's the regex you're trying to do maybe I can give it a shot
-
@Tanner, I might be able to lend a hand next weekend-ish.
I've got a huge project planned for this weekend in regards to getting a new server up and running with NodeBB, then launching live.
@a_5mith, that's an excellent visual representation!
@psychobunny, presently I haven't started a regex - so maybe that'll get brought about next weekend. -
@psychobunny said:
You can use text-center and text-right, it's built into bootstrap. What's the regex you're trying to do maybe I can give it a shot
Something along the lines of
composer.addButton('fa fa-align-center', function(textarea, selectionStart, selectionEnd) { if(selectionStart === selectionEnd){ controls.insertIntoTextarea(textarea, '+center+Centered Text'); controls.updateTextareaSelection(textarea, selectionStart + 8, selectionEnd + 21); } else { controls.wrapSelectionInTextareaWith(textarea, '+center+,''); controls.updateTextareaSelection(textarea, selectionStart, selectionEnd); } });
Then
.replace(/<p>+center+([\S\s]*?)<\/p>/gm, '<p class="align-center">$1</p>')
but that didn't even put the font awesome icon in. Although I installed it on the 0.5.1 test rig I've built. So I don't know what may have changed.
-
Am I right in assuming the syntax for centering is
+center+ my text
?
Also I think I already know what your problem is, make sure that this plugin is executing that hook post-markdown, so that the
<p>
tags are already in place -
@psychobunny That would be up to @Ted, it was an example rry. I'm not sure what's best in terms of actual use case.
Also the missing apostrophe on line 6 of that snipper isn't in the code, I changed it in the composer from something else to +center+, must have pulled the
'
out with it.The current hook is
{ "hook": "filter:post.parse", "method": "parse", "callbacked": true, "priority": 6 }
-
@Ted You can review this PR https://github.com/TedRinehart/nodebb-plugin-buttons-galore/pull/1
Added some features :- Solved a bug with nodebb-plugin-spoiler (duplicate code was making it not working anymore)
- Text alignements :
<-Text align left<-
->Text align center<-
->Text align right->
=>Justified text<=
(regex was challenging) - Line breaks, every
\n
inside a<p>
is converted to<br>
- Underlined text
~Underline~
-
@esiao, I just got a moment to review it. Thanks for submitting it.
Administration has taken a bit of time lately and I haven't been able to develop as I had wished.
I didn't see any issues with the input you had selected to be parsed, and thought it was quite clever that you used ~ for underlining since ~~ begins a strike-through.Already pushed it to NPM after testing on the master commit, and I couldn't detect any issues.
Now, we just need to get button re-ordering and disabling knocked out.Edit: I stumbled across a bug. Hopefully we can co-op to determine the cause and get it sorted.
-
@Ted Thanks, keep me updated
For the reorder I have an idea but need to determine how it should work in admin panel first. -
Latest PR merged in, v0.0.5 published.
-
@Ted
Updated the plugin for NodeBB 0.6.x support and code between code tags is now supported
https://github.com/TedRinehart/nodebb-plugin-buttons-galore/pull/6 -
@Ted Hey man, I'd love to see an up to date version of this plugin. A lot of the text align seems to be broken at the moment.
-
@nodecurious, this plugin doesn't get much attention so I've been neglecting it. I'll have some free time next week that I can use to do a rework of the plugin.
-
As a follow up, I'm still reworking the plugin. Free time for coding seems to be rare these days.