Add float and columns, move strikethrough.
This commit is contained in:
parent
51ba2452c1
commit
95dbbc6962
@ -4,6 +4,6 @@
|
||||
"license_url": null,
|
||||
"about_url": "https://www.mon-discourse.fr/themes/md-composer-extras/",
|
||||
"authors": "Steven",
|
||||
"theme_version": "1.2",
|
||||
"theme_version": "1.3",
|
||||
"learn_more": "https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966"
|
||||
}
|
||||
|
@ -9,3 +9,18 @@
|
||||
[data-wrap="justify"] {
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
[data-wrap="columns"] {
|
||||
width: 50%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
[data-wrap="floatl"] {
|
||||
float: left;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
[data-wrap="floatr"] {
|
||||
float: right;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
<script type="text/discourse-plugin" version="0.8">
|
||||
const { iconNode } = require("discourse-common/lib/icon-library");
|
||||
|
||||
|
||||
// TOOLBAR
|
||||
api.onToolbarCreate(toolbar => {
|
||||
toolbar.addButton({
|
||||
@ -11,6 +9,14 @@ api.onToolbarCreate(toolbar => {
|
||||
perform: e => e.applySurround('[u]', '[/u]', 'underline_text')
|
||||
});
|
||||
});
|
||||
api.onToolbarCreate(toolbar => {
|
||||
toolbar.addButton({
|
||||
id: "strikethrough_button",
|
||||
group: "fontStyles",
|
||||
icon: "strikethrough",
|
||||
perform: e => e.applySurround('<s>', '</s>', 'strikethrough_prompt')
|
||||
});
|
||||
});
|
||||
api.onToolbarCreate(toolbar => {
|
||||
toolbar.addButton({
|
||||
id: "align_center_button",
|
||||
@ -35,25 +41,22 @@ api.onToolbarCreate(toolbar => {
|
||||
perform: e => e.applySurround('[wrap="justify"]\n', '\n[/wrap]', 'align_justify_text')
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// EXTRAS
|
||||
api.addToolbarPopupMenuOptionsCallback(() => {
|
||||
return {
|
||||
action: "strikethrough",
|
||||
icon: "strikethrough",
|
||||
label: "strikethrough_button"
|
||||
};
|
||||
api.onToolbarCreate(toolbar => {
|
||||
toolbar.addButton({
|
||||
id: "columns_button",
|
||||
group: "extras",
|
||||
icon: "columns",
|
||||
perform: e => e.applySurround('[wrap="columns"]\n', '\n[/wrap]', 'columns_text')
|
||||
});
|
||||
});
|
||||
api.modifyClass("controller:composer", {
|
||||
actions: {
|
||||
strikethrough() {
|
||||
this.get("toolbarEvent").applySurround("<s>", "</s>", "strikethrough_prompt");
|
||||
},
|
||||
}
|
||||
api.onToolbarCreate(toolbar => {
|
||||
toolbar.addButton({
|
||||
id: "float_left_button",
|
||||
group: "extras",
|
||||
icon: "indent",
|
||||
perform: e => e.applySurround('[wrap="floatl"]\n', '\n[/wrap]', 'float_left_text')
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// TEXTS
|
||||
let translations = I18n.translations[I18n.currentLocale()].js;
|
||||
if (!translations) {
|
||||
@ -69,16 +72,19 @@ translations.composer.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>
|
||||
translations.composer.columns_button_title = settings.columns_button;
|
||||
translations.composer.columns_text =
|
||||
settings.columns_text;
|
||||
translations.composer.float_left_button_title = settings.float_left_button;
|
||||
translations.composer.float_left_text =
|
||||
settings.float_left_text;
|
||||
</script>
|
||||
|
20
settings.yml
20
settings.yml
@ -38,10 +38,26 @@ strikethrough_prompt:
|
||||
default: "Text"
|
||||
description:
|
||||
en: Enter the placeholder text that appears in the composer after the user clicks the button.
|
||||
float_left_button:
|
||||
default: "Float left"
|
||||
description:
|
||||
en: Enter the text for the title of the button in the composer.
|
||||
float_left_text:
|
||||
default: "Text"
|
||||
description:
|
||||
en: Enter the placeholder text that appears in the composer after the user clicks the button.
|
||||
columns_button:
|
||||
default: "Columns"
|
||||
description:
|
||||
en: Enter the text for the title of the button in the composer.
|
||||
columns_text:
|
||||
default: "Use the closing tag to mark where the column ends."
|
||||
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'
|
||||
default: 'fa-align-center|fa-align-right|fa-align-justify|fa-strikethrough|fa-underline|fa-indent|fa-columns'
|
||||
description:
|
||||
en: "Include FontAwesome 5 icon classes for each icon used in the list."
|
||||
en: "Include FontAwesome 5 icon classes for each icon used in the list."
|
||||
|
Loading…
Reference in New Issue
Block a user