Is there a shortcut for strikethrough (example ) when composing text? Or a way to create one?
There is a shortcut for bolding and italics, but nothing for strikethrough. I need to manualy type ~~
around the word like this: ~~example~~
.
In other places, the shortcut is Command + Shift + X
but here in Discourse that changes the direction of the text window.
4 Likes
Lilly
August 29, 2023, 10:14am
2
Hi @donaldsoncd A strike through composer button is part of this very useful theme component by @Steven
This theme component adds few formatting options in the composer : underline, align center, align right, justify and strikethrough. You can customize the text of each button in the settings, making it compatible with every languages. Exist in rtl version (change align right to align left).
4 Likes
Thank you for flagging this potential option, @Lilly ! I’d prefer a shortcut for myself, but a button maybe be a good start for some of my forum’s users that don’t know the markdown convention.
1 Like
Lilly
August 29, 2023, 10:53am
4
An existing topic with other related info and methods:
Hello,
Github Markdown has strikethrough support like this:
~~deleted text~~
This would be extremely useful on my site. Additionally, it is sometimes useful to strikethrough an entire paragraph. Maybe it could be implemented like this?
~~~
Long paragraph of deleted text. Long paragraph of deleted text. Long paragraph of deleted text. Long paragraph of deleted text. Long paragraph of deleted text. Long paragraph of deleted text. Long paragraph of deleted text. Long paragraph of deleted text. …
2 Likes
Lilly
August 29, 2023, 11:00am
5
also this is just a strike through button theme component by itself
2 Likes
@donaldsoncd I think I understand that what you are seeking is a way to create Keyboard Shortcuts such as Command + Shift + X
to apply to other available standard formatting while writing in the composer?
Or perhaps being able to create your own collection of keyboard shortcuts specific to your Discourse site as a Theme Component would be neat.
2 Likes
Canapin
(Coin-coin le Canapin)
September 4, 2023, 12:00pm
8
Adding a shortcut to a component that adds a composer button may be possible.
Maybe this file could help?
const { siteSettings, capabilities } = opts;
this.shortcuts = {};
this.context = null;
this.groups = [
{ group: "fontStyles", buttons: [] },
{ group: "insertions", buttons: [] },
{ group: "extras", buttons: [] },
];
this.addButton({
id: "bold",
group: "fontStyles",
icon: "bold",
label: getButtonLabel("composer.bold_label", "B"),
shortcut: "B",
preventFocus: true,
trimLeading: true,
perform: (e) => e.applySurround("**", "**", "bold_text"),
});
(all Composer shortcuts start with Ctrl )
2 Likes
Yes, this is what I meant and would like more than a dedicated button at this time
I’m not savvy enough to add anything via code, but thank you!
1 Like