Merge pull request #1 from thw26/patch-1

Update to New Wrap Support
This commit is contained in:
iunctis.fr 2019-11-07 23:18:34 +01:00 committed by GitHub
commit 2482a222de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,5 @@
<script type="text/discourse-plugin" version="0.4">
<script type="text/discourse-plugin" version="0.8">
const { iconNode } = require("discourse-common/lib/icon-library");
// TOOLBAR
api.onToolbarCreate(toolbar => {
toolbar.addButton({
@ -16,7 +14,7 @@ api.onToolbarCreate(toolbar => {
id: "align_center_button",
group: "extras",
icon: "align-center",
perform: e => e.applySurround('<div align="center">\n\n', '\n</div>', 'align_center_text')
perform: e => e.applySurround('[wrap="center"]\n', '\n[/wrap]', 'align_center_text')
});
});
api.onToolbarCreate(toolbar => {
@ -24,7 +22,7 @@ api.onToolbarCreate(toolbar => {
id: "align_right_button",
group: "extras",
icon: "align-right",
perform: e => e.applySurround('<div align="right">\n\n', '\n</div>', 'align_right_text')
perform: e => e.applySurround('[wrap="right"]\n', '\n[/wrap]', 'align_right_text')
});
});
api.onToolbarCreate(toolbar => {
@ -32,11 +30,9 @@ api.onToolbarCreate(toolbar => {
id: "align_justify_button",
group: "extras",
icon: "align-justify",
perform: e => e.applySurround('<div align="justify">\n\n', '\n</div>', 'align_justify_text')
perform: e => e.applySurround('[wrap="justify"]\n', '\n[/wrap]', 'align_justify_text')
});
});
// EXTRAS
api.addToolbarPopupMenuOptionsCallback(() => {
return {
@ -52,8 +48,6 @@ api.modifyClass("controller:composer", {
},
}
});
// TEXTS
let translations = I18n.translations[I18n.currentLocale()].js;
if (!translations) {
@ -62,7 +56,6 @@ if (!translations) {
if (!translations.composer) {
translations.composer = {};
}
translations.composer.underline_button_title = settings.underline_button;
translations.composer.underline_text =
settings.underline_text;
@ -70,17 +63,13 @@ 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>