Update to New Wrap Support

https://meta.discourse.org/t/md-composer-extras/118912/10?u=thwright
This commit is contained in:
T. H. Wright 2019-11-06 08:59:47 -05:00 committed by GitHub
parent 01b6792f22
commit cd866ce7c0
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>
</script>