MD Composer extras

I upgraded the component to add those extra lines by default, now, when you use a align button and the underline button, you’ll have something like this

What are the disadvantages of using the theme-component?

The plugin is easier to customize, we can choose which buttons will appear or not, and there are some additional options like color or a float button that can do something like this with the image

3 Likes

Quite amazing what can be done with theme components! Well done.

2 Likes

Nicely done :slight_smile:
Do you think it’s possible to somehow to convert the HTML tags to some default tag like [Center] and something in the backend will convert it back (for UI reasons)? :slight_smile:

At the time, it wasn’t possible to create some bbcodes easily with theme components, I don’t know if it is now.

For now, if you want bbcode center and a button in the composer, the best way is to use the plugin : Formatting toolbar

1 Like

A tag like [center] will still require a plugin but you’re correct @Steven :+1:

At the time of this component’s creation you had to use HTML <div> tags. However, you can now use [wrap="foo"][/wrap] in themes / components.

You can read more about that here

Here’s a simple example

[wrap="center"] 
Some center aligned text 
[/wrap]

would create this markup when the post is cooked

<div class="d-wrap" data-wrap="center">
  <p>Some center aligned text</p>
</div>

which you can then target with a CSS attribute selector like so

[data-wrap="center"] {
  text-align: center;
}

and that would create something like this in both the composer preview and the rendered post

or

[wrap="right"] 
Some right aligned text 
[/wrap]

and that would result in this cooked markup

<div class="d-wrap" data-wrap="right">
  <p>Some center aligned text</p>
</div>

You can then add this CSS

[data-wrap="right"] {
  text-align: right;
}

for this result

Since the component currently uses the HTML align attribute, this change should be 100% backwards compatible.

Give it a go whenever you have the time and feel free to PM me if you have any questions about that.

10 Likes

I just submitted pull requests for the wrap components.



5 Likes

I added further pull requests for float left, with a CSS option for float right, moving the strikethrough button to be with the bold, italics, and underline buttons, and created a basic columns button. The last may be better as its own component or pushed to the pop up menu.

I removed the pull request; it needs further modifications. I am also looking to add superscript and subscript buttons, but once you add in calendar events, slick, and tiles, there are too many buttons on the composer in mobile’s vertical composer. It shouldn’t be a problem in horizontal, but if all buttons should be accessible from either menu, then they should be moved into the pop up.

Any thoughts, @Steven, on how you want to handle this?

I will just split the main js into two files and work on some responsive CSS.

Ideally we should also add settings to disable/hide the buttons as desired.


EDIT: I’ve implemented the changes mentioned (but elements do not have an option to be hid outside of CSS) and just need to test the changes before submitting a PR.

3 Likes

That PR should be good now, @Steven.

Responsiveness and New Buttons by thw26 · Pull Request #8 · iunctis/md-composer-extras · GitHub

This PR implements responsiveness, floats, columns, superscript, and subscript. See the README for how columns work.

2 Likes

Hello,
No idea why I am. Getting this. Just uploaded the other day. I’m on the lastest version of this. At least that’s what it tells me.
Thanks

1 Like

I pushed an upgrade recently but it should work correctly, I just tested on a website on desktop and mobile

Can you try deleting the component and reinstall it ? It seems broken on your forum

Or do you use also the formatting toolbar plugin ? It might create double icons

3 Likes

OK thanks I’ll look and do what you say happy birthday too :slight_smile:

3 Likes

Is it possible to hide some icons?

Which ones do you want to hide? I’ll help you do that

Strike, sub, sup Thanks!

Easiest way would be to add these css lines in your theme, in Common > CSS

.d-editor-button-bar .strikethrough_button, .d-editor-button-bar .superscript_button, .d-editor-button-bar .subscript_button {
    display: none;
}
5 Likes

Is it possible to move the Build Poll option (on desktop) out of the extra menu and next to the rest of the formatting buttons?

Like your request on mobile, it requires a bit more complex editing, that I can’t add on this theme component. But it should be doable on a custom component for desktop following the logic presented by angus and spirobel.

3 Likes

How would one remove the center and align left + right buttons?

love this component by the way.