Formatting toolbar

I integrated the code in my plugin, I needed the create some bbcode (float for example), it was easier to add everything, and a have “all in one” plugin.

So you’re saying that your plugin will clash with the official bbcode plugin?

If so, shouldn’t that be noted in the OP, and potentially on the topic for the official plugin?

If a plugin clashes with an official plugin, shouldn’t it be tagged as broken?

2 Likes

Good point, sam added a warning in the first post

3 Likes

I just installed this formatting toolbar (my first plugin!) and created a video to help any other neophytes, like me, who would like to see a demonstration of how to install this or any other plugins!

5 Likes

FYI git pull has nothing to do with the installation of a plugin :wink:

It pulls the changes (if any) from https://github.com/discourse/discourse_docker to your local copy.

The nice thing, is that it’s not even needed as it is included when you do ./launcher rebuild app (:raised_hands: for less work)

4 Likes

is it possible to add this feature?

I think so, I personnaly use the gallery theme component from the same author without any issue.

Does anyone know how to add a horizontal rule? I have some members doing it with the <hr> tag, but others ask, “How can they do that!?”

I love the plugin.

like


this?

vvvvvvvvvvv

like

---

this?

^^^^^^^^^^^^^

You can create a button in the Customize section, in </head>

<script type="text/discourse-plugin" version="0.4">
    api.onToolbarCreate(toolbar => {
      I18n.translations.en.js.hrule_timestamp = "Horizontal rule";
      toolbar.addButton({
        id: "hrule_button",
        group: "extras",
        icon: "level-down",
        title: "hrule_timestamp",
        perform: e => e.addText("<hr>")
      });
    });
</script>

When you click on the button, it will add a <hr>

The best way would be to create a github account, fork the plugin and edit it

Most of the action after that is in

:file_folder: assets/javascripts/discourse/initializers/ for the buttons
:file_folder: config/ for the language

4 Likes

Indeed, but I want something on the bar so the users who don’t know the secrets can easily do it.

That is beautiful. I can’t thank you enough. It’s up and running on all my themes.

I think you should just repurpose this plugin and call it a “Extended WYSIWYG Editor” or something along those lines.

It seems you added visuals for a lot that the other BBCode plugin adds, but they conflict with each other, which means people can’t use both unfortunately.

No, absolutely not. It’s not a WYSIWYG in any sense of the term. Discourse has a Markdown editor with a preview pane.

A WYSIWYG editor previews the styles and formatting in-line - think Microsoft Word or the TinyMCE editor.

3 Likes

Essentially the same thing when using the preview. I’m sure he understands what I mean even if terminology are different between others.

No, they aren’t, not even remotely close. This isn’t a point of debate, it’s the meaning of the term and it’s not something you can redefine at will.

Okay, well, my suggestion still stands.

I think WYSIWYG will be misleading, as Stephen said. My plugin is not that advanced

I don’t think there’s a bbcode that’s not in my plugin, I used the official as a base for mine at the time. I needed to add some bbcodes (float left and right, justify) myself for the plugin, so it’s easier to use all bbcodes in this plugin instead of asking users to install both.

1 Like

New version available, I fixed the incompatibility of some icons with the latest version of Discourse (that includes FontAwesome 5).

It was easier that I thought, but if you have any issue, let me know

I also changed the icon of the color’s button : instead of the paint brush, we will use the palette. Here are all the icons available:

I think it suits the button better.


If you have a fork on this plugin with custom buttons, the update is pretty easy, you just have to edit your plugin.rb file (example : line 20 to 27 : discourse-formatting-toolbar/plugin.rb at master · iunctis/discourse-formatting-toolbar · GitHub)

You have to register any icon you use. Search for your icon here : Font Awesome

If the icon is in ‘solid’ category, add :
register_svg_icon "fa-icon_name" if respond_to?(:register_svg_icon)
ex : register_svg_icon "fa-underline" if respond_to?(:register_svg_icon)

If the icon is in ‘regular’ category, add
register_svg_icon "far-icon_name" if respond_to?(:register_svg_icon)
ex : register_svg_icon "far-address-book" if respond_to?(:register_svg_icon)

If the icon is in ‘brand’ category, add
register_svg_icon "fab-icon_name" if respond_to?(:register_svg_icon)
ex : register_svg_icon "fab-apple" if respond_to?(:register_svg_icon)

8 Likes

I just installed the plugin on the v2.2.0.beta7 and i have a problem: line spacing between paragraphs collapse when using text formatting: [right], [left], [center], [justify]

See the following example:

The preview on the right window is correct. But then… see next post

1 Like