Initial commit
This commit is contained in:
commit
86e0446e49
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
15
README.md
Normal file
15
README.md
Normal file
@ -0,0 +1,15 @@
|
||||
## MD Composer Extras
|
||||
|
||||
Add some formatting option in your Discourse composer : underline, center, align right, justify and strikethrough
|
||||
|
||||
For more informations, see :
|
||||
|
||||
- English : https://meta.discourse.org/
|
||||
- Français : https://www.mon-discourse.fr/themes/md-composer-extras/
|
||||
|
||||
<br>
|
||||
|
||||
I took some parts of the Iconified Header Links and Slick Image Gallery theme components made by Johani :
|
||||
|
||||
https://meta.discourse.org/t/iconified-header-links/86307 (adding fa5 icons in the theme component)
|
||||
https://meta.discourse.org/t/slick-image-gallery/81952 (manager the translations inside the theme component)
|
9
about.json
Normal file
9
about.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "md-composer-extras",
|
||||
"component": true,
|
||||
"license_url": null,
|
||||
"about_url": "https://www.mon-discourse.fr/themes/md-composer-extras/",
|
||||
"authors": "Steven",
|
||||
"theme_version": "1.0",
|
||||
"learn_more": "https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966"
|
||||
}
|
86
common/head_tag.html
Normal file
86
common/head_tag.html
Normal file
@ -0,0 +1,86 @@
|
||||
<script type="text/discourse-plugin" version="0.4">
|
||||
const { iconNode } = require("discourse-common/lib/icon-library");
|
||||
|
||||
|
||||
// TOOLBAR
|
||||
api.onToolbarCreate(toolbar => {
|
||||
toolbar.addButton({
|
||||
id: "underline_button",
|
||||
group: "fontStyles",
|
||||
icon: "underline",
|
||||
perform: e => e.applySurround('[u]', '[/u]', 'underline_text')
|
||||
});
|
||||
});
|
||||
api.onToolbarCreate(toolbar => {
|
||||
toolbar.addButton({
|
||||
id: "align_center_button",
|
||||
group: "extras",
|
||||
icon: "align-center",
|
||||
perform: e => e.applySurround('<div align="center">', '</div>', 'align_center_text')
|
||||
});
|
||||
});
|
||||
api.onToolbarCreate(toolbar => {
|
||||
toolbar.addButton({
|
||||
id: "align_right_button",
|
||||
group: "extras",
|
||||
icon: "align-right",
|
||||
perform: e => e.applySurround('<div align="right">', '</div>', 'align_right_text')
|
||||
});
|
||||
});
|
||||
api.onToolbarCreate(toolbar => {
|
||||
toolbar.addButton({
|
||||
id: "align_justify_button",
|
||||
group: "extras",
|
||||
icon: "align-justify",
|
||||
perform: e => e.applySurround('<div align="justify">', '</div>', 'align_justify_text')
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// EXTRAS
|
||||
api.addToolbarPopupMenuOptionsCallback(() => {
|
||||
return {
|
||||
action: "strikethrough",
|
||||
icon: "strikethrough",
|
||||
label: "strikethrough_button"
|
||||
};
|
||||
});
|
||||
api.modifyClass("controller:composer", {
|
||||
actions: {
|
||||
strikethrough() {
|
||||
this.get("toolbarEvent").applySurround("<s>", "</s>", "strikethrough_prompt");
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// TEXTS
|
||||
let translations = I18n.translations[I18n.currentLocale()].js;
|
||||
if (!translations) {
|
||||
translations = {};
|
||||
}
|
||||
if (!translations.composer) {
|
||||
translations.composer = {};
|
||||
}
|
||||
|
||||
translations.composer.underline_button_title = settings.underline_button;
|
||||
translations.composer.underline_text =
|
||||
settings.underline_text;
|
||||
|
||||
translations.composer.align_center_button_title = settings.align_center_button;
|
||||
translations.composer.align_center_text =
|
||||
settings.align_center_text;
|
||||
|
||||
translations.composer.align_right_button_title = settings.align_right_button;
|
||||
translations.composer.align_right_text =
|
||||
settings.align_right_text;
|
||||
|
||||
translations.composer.align_justify_button_title = settings.align_justify_button;
|
||||
translations.composer.align_justify_text =
|
||||
settings.align_justify_text;
|
||||
|
||||
translations.strikethrough_button = settings.strikethrough_button;
|
||||
translations.composer.strikethrough_prompt =
|
||||
settings.strikethrough_prompt;
|
||||
|
||||
</script>
|
7
mobile/mobile.scss
Normal file
7
mobile/mobile.scss
Normal file
@ -0,0 +1,7 @@
|
||||
#reply-control .d-editor-button-bar .bullet, #reply-control .d-editor-button-bar .list, #reply-control .d-editor-button-bar .align_justify_button{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.d-editor-spacer {
|
||||
margin: 0 2px;
|
||||
}
|
47
settings.yml
Normal file
47
settings.yml
Normal file
@ -0,0 +1,47 @@
|
||||
underline_button:
|
||||
default: "Underline"
|
||||
description:
|
||||
en: Enter the text for the title of the button in the composer.
|
||||
underline_text:
|
||||
default: "Text"
|
||||
description:
|
||||
en: Enter the placeholder text that appears in the composer after the user clicks the button.
|
||||
align_center_button:
|
||||
default: "Center"
|
||||
description:
|
||||
en: Enter the text for the title of the button in the composer.
|
||||
align_center_text:
|
||||
default: "Text"
|
||||
description:
|
||||
en: Enter the placeholder text that appears in the composer after the user clicks the button.
|
||||
align_right_button:
|
||||
default: "Align right"
|
||||
description:
|
||||
en: Enter the text for the title of the button in the composer.
|
||||
align_right_text:
|
||||
default: "Text"
|
||||
description:
|
||||
en: Enter the placeholder text that appears in the composer after the user clicks the button.
|
||||
align_justify_button:
|
||||
default: "Justify"
|
||||
description:
|
||||
en: Enter the text for the title of the button in the composer.
|
||||
align_justify_text:
|
||||
default: "Text"
|
||||
description:
|
||||
en: Enter the placeholder text that appears in the composer after the user clicks the button.
|
||||
strikethrough_button:
|
||||
default: "Strike-through"
|
||||
description:
|
||||
en: Enter the text for the title of the button in the composer.
|
||||
strikethrough_prompt:
|
||||
default: "Text"
|
||||
description:
|
||||
en: Enter the placeholder text that appears in the composer after the user clicks the button.
|
||||
|
||||
Svg_icons:
|
||||
type: 'list'
|
||||
list_type: 'compact'
|
||||
default: 'fa-align-center|fa-align-right|fa-align-justify|fa-strikethrough|fa-underline'
|
||||
description:
|
||||
en: "Include FontAwesome 5 icon classes for each icon used in the list."
|
Loading…
Reference in New Issue
Block a user