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.
How would one remove the center and align left + right buttons?
love this component by the way.
Hi!
You can add these css lines in your theme or in a component:
.align_center_button, .align_right_button, .align_justify_button {
display: none;
}
I guess you meant justify button, since align left has not been added in the same component
Is it possible to move all of these new buttons within the Options button/menu?
Itâs possible but youâd need to dig in the code a little bit
In the Desktop > Head youâll have all the javascript, you need to change a few lines.
Example the code for a button in the toolbar looks like this
api.onToolbarCreate(toolbar => {
toolbar.addButton({
id: "underline_button",
group: "fontStyles",
icon: "underline",
perform: e => e.applySurround('[u]', '[/u]', 'underline_text')
});
});
You need to change by using this
api.addToolbarPopupMenuOptionsCallback(() => {
return {
action: "underline",
icon: "underline",
label: "underline_button"
};
});
And add the action in this part:
api.modifyClass("controller:composer", {
actions: {
underline() {
this.get("toolbarEvent").applySurround('[u]', '[/u]', "underline_text");
},
floatleft() {
this.get("toolbarEvent").applySurround('[wrap="floatl"]\n', '\n[/wrap]', "float_left_text");
},
columns() {
this.get("toolbarEvent").applySurround('[wrap="columns"]\n', '\n[/wrap]', "columns_text");
}
}
});
The translation should be ok
Youâll quickly see if anything is wrong since Discourse give some error message when you save the changes.
Great component @Steven
Would be awesome if we could also have H1, H2 and H3
Can the [color] [/color] be added to this theme component? If it can, then it would be perfect because then one can use the official discourse bbcode+md composer. Iâm currently using formatting toolbar + mdcomposer. Sure I can use CSS to hide the extra buttons, but there are places where CSS is not used like in the admin panel or pavilionâs Custom Wizard plugin. The color button is used a lot.
This is what I have with CSS: (which is perfect)
This is what I have without:
My plan is to have a component for people who donât want to have a plugin. But Iâll make a branch with color bbcode. Iâll try it in a few hours if I have the time. Iâll let you know when itâs ready and how to install
Iâll probably use the time to reorganize the theme component, I prefer a simple tc by default, Iâll use a all-options branch with subscript buttons, a bbcode branch for those who have official bbcode plugin
Thanks, the subscript/superscript buttons is one of the reasons to keep using md composer which other plugins and theme components lack. The official bbcode has many things included that are not in the formatting toolbar plugin like the [spoiler] [/spoiler]. To have best of both worlds, I think itâs better to keep the discourse bbcode and then add the buttons we need through mdcomposer.
I didnât think the script buttons were popular, Iâll keep them in the base component.
Iâll do a few branch, a simple one with only some basic formatting buttons, color branch that adds a color bbcode
Hey guys,
Just wanted to let you know that a new color branch has been added to the md composer. Now you can use the official discourse bbcode plugin + md composer (color branch) + discourse spoiler-alert (blur spoilers). I believe that this is the best combo available for composer buttons on Discourse.
Thereâs also an idea of adding a color picker using this free library:
https://github.com/Simonwep/pickr
If anyone wants to help and knows how to add a color picker, feel free to help Steven out!
How would I completely hide or remove some of these buttons? We only need a few of them and I noticed removing a button will not removing the item being still listed (it will still be a blank space with no visible icon).
The best way is to add some css lines in your current theme
I gave these examples for the align buttons, if you want to get rid of them
.align_center_button, .align_right_button, .align_justify_button {
display: none;
}
I can also give you the css code for the specific buttons you want hidden
Ciao Steven, ottimo componente. Grazie per averlo condiviso!
Una domanda veloce: sarebbe possibile implementare alcuni pulsanti per aggiungere spazi unificati (ad esempio nbsp; ensp; emsp)? Cosa dovrei usare al posto di applySurround?
Alcuni membri della mia community hanno difficoltĂ a formattare i post (principalmente lâindentazione) e credo che sarebbe utile per loro.
Grazie!
SĂŹ, puoi facilmente aggiungere un pulsante e, invece di applySurround, utilizzo addText
Ho questo vecchio esempio che puoi usare
api.onToolbarCreate(toolbar => {
toolbar.addButton({
id: "br_button",
group: "extras",
icon: "level-down-alt",
perform: e => e.addText('<br>', 'br_text')
});
});
Grazie! Questo risolverĂ il problema!
Hmm⌠Non sembra che tu abbia il barrato nella barra degli strumenti di formattazione di Discourse, ma qui sÏ. Preferisco comunque la barra degli strumenti di formattazione poichÊ ha tutto il resto e anche di piÚ, ma mi piacerebbe avere il barrato come opzione. Cosa consigli, visto che la compatibilità tra questi due è un problema?
Potrei aggiungere un pulsante barrato nella barra degli strumenti del plugin, potrebbe essere rilevante in futuro.
Ci penserò, ma nel frattempo, puoi usare il plugin e aggiungere questo componente: GitHub - MonDiscourse/discourse-strikethrough: Add a strikethrough button in the composer
AggiungerĂ un pulsante barrato nellâazione del menu popup, è compatibile con il plugin
Ho inviato una PR: https://github.com/MonDiscourse/md-composer-extras/pull/10 che, a meno che non abbia sbagliato una virgola o qualcosa del genere, dovrebbe risolvere
Per prevenire errori nei test, aggiungi una chiave `pluginId` alla tua chiamata `modifyClass`. Questo garantirĂ che la modifica venga applicata solo una volta.
