From 95dbbc6962986f735cb33ed1452811e342a774e8 Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Wed, 13 Nov 2019 10:34:59 -0500 Subject: [PATCH 01/26] Add float and columns, move strikethrough. --- about.json | 2 +- common/common.scss | 15 +++++++++++++ common/head_tag.html | 52 ++++++++++++++++++++++++-------------------- settings.yml | 20 +++++++++++++++-- 4 files changed, 63 insertions(+), 26 deletions(-) diff --git a/about.json b/about.json index 30e719b..c62091f 100644 --- a/about.json +++ b/about.json @@ -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" } diff --git a/common/common.scss b/common/common.scss index b05689c..dbf7c7c 100644 --- a/common/common.scss +++ b/common/common.scss @@ -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; +} diff --git a/common/head_tag.html b/common/head_tag.html index e35f487..8285fe3 100644 --- a/common/head_tag.html +++ b/common/head_tag.html @@ -1,7 +1,5 @@ \ No newline at end of file +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; + diff --git a/settings.yml b/settings.yml index 2075af4..4e4322b 100644 --- a/settings.yml +++ b/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." \ No newline at end of file + en: "Include FontAwesome 5 icon classes for each icon used in the list." From 5c4009e818aeedce65ee29d69672288ed6217fbf Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Wed, 13 Nov 2019 11:04:49 -0500 Subject: [PATCH 02/26] Move components to pop up menu; add superscript, subscript --- about.json | 2 +- common/head_tag.html | 62 ++++++++++++++++++++++++++++++++------------ settings.yml | 21 +++++++++++++-- 3 files changed, 66 insertions(+), 19 deletions(-) diff --git a/about.json b/about.json index c62091f..a816477 100644 --- a/about.json +++ b/about.json @@ -4,6 +4,6 @@ "license_url": null, "about_url": "https://www.mon-discourse.fr/themes/md-composer-extras/", "authors": "Steven", - "theme_version": "1.3", + "theme_version": "1.4", "learn_more": "https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966" } diff --git a/common/head_tag.html b/common/head_tag.html index 8285fe3..d68d2ce 100644 --- a/common/head_tag.html +++ b/common/head_tag.html @@ -14,7 +14,7 @@ api.onToolbarCreate(toolbar => { id: "strikethrough_button", group: "fontStyles", icon: "strikethrough", - perform: e => e.applySurround('', '', 'strikethrough_prompt') + perform: e => e.applySurround('', '', 'strikethrough_text') }); }); api.onToolbarCreate(toolbar => { @@ -41,22 +41,46 @@ api.onToolbarCreate(toolbar => { perform: e => e.applySurround('[wrap="justify"]\n', '\n[/wrap]', 'align_justify_text') }); }); -api.onToolbarCreate(toolbar => { - toolbar.addButton({ - id: "columns_button", - group: "extras", - icon: "columns", - perform: e => e.applySurround('[wrap="columns"]\n', '\n[/wrap]', 'columns_text') - }); + +// EXTRAS +api.addToolbarPopupMenuOptionsCallback(() => { + return { + action: "floatleft", + icon: "indent", + label: "float_left_button" + }; }); -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') - }); +api.addToolbarPopupMenuOptionsCallback(() => { + return { + action: "columns", + icon: "columns", + label: "columns_button" + }; }); +api.addToolbarPopupMenuOptionsCallback(() => { + return { + action: "superscript", + icon: "superscript", + label: "superscript_button" + }; +}); +api.modifyClass("controller:composer", { + actions: { + floatleft() { + this.get("toolbarEvent").applySurround('[wrap="floatl"]\n', '\n[/wrap]', "float_left_text"); + }, + columns() { + this.get("toolbarEvent").applySurround('[wrap="columns"]\n'), '\n[/wrap]', "columns_text")); + }, + superscript() { + this.get("toolbarEvent").applySurround("", "", "superscript_text"); + }, + subscript() { + this.get("toolbarEvent").applySurround("", "", "suvscript_text"); + } + } +}); + // TEXTS let translations = I18n.translations[I18n.currentLocale()].js; if (!translations) { @@ -80,7 +104,13 @@ translations.composer.align_justify_text = settings.align_justify_text; translations.strikethrough_button = settings.strikethrough_button; translations.composer.strikethrough_prompt = - settings.strikethrough_prompt; + settings.strikethrough_text; +translations.superscript_button = settings.superscript_button; +translations.composer.superscript_text = + settings.superscript_text; +translations.subscript_button = settings.subscript_button; +translations.composer.subscript_prompt = + settings.subscript_text; translations.composer.columns_button_title = settings.columns_button; translations.composer.columns_text = settings.columns_text; diff --git a/settings.yml b/settings.yml index 4e4322b..537f625 100644 --- a/settings.yml +++ b/settings.yml @@ -34,7 +34,7 @@ strikethrough_button: default: "Strike-through" description: en: Enter the text for the title of the button in the composer. -strikethrough_prompt: +strikethrough_text: default: "Text" description: en: Enter the placeholder text that appears in the composer after the user clicks the button. @@ -46,6 +46,23 @@ float_left_text: default: "Text" description: en: Enter the placeholder text that appears in the composer after the user clicks the button. +superscript_button: + default: "Superscript" + description: + en: Enter the text for the title of the button in the composer. +superscript_text: + default: "Text" + description: + en: Enter the placeholder text that appears in the composer after the user clicks the button. +subscript_button: + default: "Subscript" + description: + en: Enter the text for the title of the button in the composer. +subscript_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: @@ -58,6 +75,6 @@ columns_text: Svg_icons: type: 'list' list_type: 'compact' - default: 'fa-align-center|fa-align-right|fa-align-justify|fa-strikethrough|fa-underline|fa-indent|fa-columns' + default: 'fa-align-center|fa-align-right|fa-align-justify|fa-strikethrough|fa-underline|fa-indent|fa-columns|fa-superscript|fa-subscript' description: en: "Include FontAwesome 5 icon classes for each icon used in the list." From 2b609e53771c9e6572a0ec86b59a2180703ca8d2 Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Wed, 13 Nov 2019 11:10:20 -0500 Subject: [PATCH 03/26] Minor corrections; fix missing. --- common/head_tag.html | 14 ++++++++++---- settings.yml | 1 - 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/common/head_tag.html b/common/head_tag.html index d68d2ce..8a4aa75 100644 --- a/common/head_tag.html +++ b/common/head_tag.html @@ -64,6 +64,13 @@ api.addToolbarPopupMenuOptionsCallback(() => { label: "superscript_button" }; }); +api.addToolbarPopupMenuOptionsCallback(() => { + return { + action: "subscript", + icon: "subscript", + label: "subscript_button" + }; +}); api.modifyClass("controller:composer", { actions: { floatleft() { @@ -91,8 +98,7 @@ if (!translations.composer) { } translations.composer.underline_button_title = settings.underline_button; translations.composer.underline_text = - settings.underline_text; - + settings.underline_text; translations.composer.align_center_button_title = settings.align_center_button; translations.composer.align_center_text = settings.align_center_text; @@ -103,13 +109,13 @@ 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 = +translations.composer.strikethrough_text = settings.strikethrough_text; translations.superscript_button = settings.superscript_button; translations.composer.superscript_text = settings.superscript_text; translations.subscript_button = settings.subscript_button; -translations.composer.subscript_prompt = +translations.composer.subscript_text = settings.subscript_text; translations.composer.columns_button_title = settings.columns_button; translations.composer.columns_text = diff --git a/settings.yml b/settings.yml index 537f625..f372453 100644 --- a/settings.yml +++ b/settings.yml @@ -62,7 +62,6 @@ subscript_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: From 86b88d73dd593eca4dc7d0fda05cf760cf12f5ff Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Wed, 13 Nov 2019 11:17:34 -0500 Subject: [PATCH 04/26] Syntax fix. --- common/head_tag.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/head_tag.html b/common/head_tag.html index 8a4aa75..630ade2 100644 --- a/common/head_tag.html +++ b/common/head_tag.html @@ -77,7 +77,7 @@ api.modifyClass("controller:composer", { this.get("toolbarEvent").applySurround('[wrap="floatl"]\n', '\n[/wrap]', "float_left_text"); }, columns() { - this.get("toolbarEvent").applySurround('[wrap="columns"]\n'), '\n[/wrap]', "columns_text")); + this.get("toolbarEvent").applySurround('[wrap="columns"]\n', '\n[/wrap]', "columns_text"); }, superscript() { this.get("toolbarEvent").applySurround("", "", "superscript_text"); From dccad779fc33bba409b99c62218387deef3c197f Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Wed, 13 Nov 2019 11:24:30 -0500 Subject: [PATCH 05/26] Move strikethrough back to pop up menu. Minor corrections. --- common/head_tag.html | 21 ++++++++++++--------- settings.yml | 2 +- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/common/head_tag.html b/common/head_tag.html index 630ade2..cc97eed 100644 --- a/common/head_tag.html +++ b/common/head_tag.html @@ -9,14 +9,6 @@ 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('', '', 'strikethrough_text') - }); -}); api.onToolbarCreate(toolbar => { toolbar.addButton({ id: "align_center_button", @@ -43,6 +35,13 @@ api.onToolbarCreate(toolbar => { }); // EXTRAS +api.addToolbarPopupMenuOptionsCallback(() => { + return { + action: "strikethrough", + icon: "strikethrough", + label: "strikethrough_button" + }; +}); api.addToolbarPopupMenuOptionsCallback(() => { return { action: "floatleft", @@ -71,8 +70,12 @@ api.addToolbarPopupMenuOptionsCallback(() => { label: "subscript_button" }; }); + api.modifyClass("controller:composer", { actions: { + strikethrough() { + this.get("toolbarEvent").applySurround("", "", "strikethrough_prompt"); + }, floatleft() { this.get("toolbarEvent").applySurround('[wrap="floatl"]\n', '\n[/wrap]', "float_left_text"); }, @@ -83,7 +86,7 @@ api.modifyClass("controller:composer", { this.get("toolbarEvent").applySurround("", "", "superscript_text"); }, subscript() { - this.get("toolbarEvent").applySurround("", "", "suvscript_text"); + this.get("toolbarEvent").applySurround("", "", "subscript_text"); } } }); diff --git a/settings.yml b/settings.yml index f372453..379b590 100644 --- a/settings.yml +++ b/settings.yml @@ -67,7 +67,7 @@ columns_button: 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." + default: "Use the closing tag to mark where the column ends. Once done. Columns must be equal height." description: en: Enter the placeholder text that appears in the composer after the user clicks the button. From 56762c03420b17ef895fe9e2333bc9926f122e91 Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Wed, 13 Nov 2019 11:32:55 -0500 Subject: [PATCH 06/26] Button label corrections. --- common/head_tag.html | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/common/head_tag.html b/common/head_tag.html index cc97eed..a857500 100644 --- a/common/head_tag.html +++ b/common/head_tag.html @@ -101,29 +101,38 @@ if (!translations.composer) { } translations.composer.underline_button_title = settings.underline_button; translations.composer.underline_text = - settings.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_text = settings.strikethrough_text; + translations.superscript_button = settings.superscript_button; translations.composer.superscript_text = settings.superscript_text; + translations.subscript_button = settings.subscript_button; translations.composer.subscript_text = settings.subscript_text; -translations.composer.columns_button_title = settings.columns_button; + +translations.composer.columns_button = settings.columns_button; translations.composer.columns_text = settings.columns_text; -translations.composer.float_left_button_title = settings.float_left_button; + +translations.composer.float_left_button = settings.float_left_button; translations.composer.float_left_text = settings.float_left_text; + From 989e3c0d231873716fbcadf82842b83d82332ce8 Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Wed, 13 Nov 2019 11:38:01 -0500 Subject: [PATCH 07/26] Another attempted label correction. --- common/head_tag.html | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/common/head_tag.html b/common/head_tag.html index a857500..daa5d22 100644 --- a/common/head_tag.html +++ b/common/head_tag.html @@ -99,6 +99,7 @@ if (!translations) { if (!translations.composer) { translations.composer = {}; } + translations.composer.underline_button_title = settings.underline_button; translations.composer.underline_text = settings.underline_text; @@ -115,23 +116,23 @@ 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.strikethrough_button_title = settings.strikethrough_button; translations.composer.strikethrough_text = settings.strikethrough_text; -translations.superscript_button = settings.superscript_button; +translations.superscript_button_title = settings.superscript_button; translations.composer.superscript_text = settings.superscript_text; -translations.subscript_button = settings.subscript_button; +translations.subscript_button_title = settings.subscript_button; translations.composer.subscript_text = settings.subscript_text; -translations.composer.columns_button = settings.columns_button; +translations.composer.columns_button_title = settings.columns_button; translations.composer.columns_text = settings.columns_text; -translations.composer.float_left_button = settings.float_left_button; +translations.composer.float_left_button_title = settings.float_left_button; translations.composer.float_left_text = settings.float_left_text; From 29ce3d80852fec587261b9094e7d4b6692be6bd5 Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Wed, 13 Nov 2019 11:43:47 -0500 Subject: [PATCH 08/26] Another attempt at label fix. --- common/head_tag.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/head_tag.html b/common/head_tag.html index daa5d22..ed415eb 100644 --- a/common/head_tag.html +++ b/common/head_tag.html @@ -74,7 +74,7 @@ api.addToolbarPopupMenuOptionsCallback(() => { api.modifyClass("controller:composer", { actions: { strikethrough() { - this.get("toolbarEvent").applySurround("", "", "strikethrough_prompt"); + this.get("toolbarEvent").applySurround("", "", "strikethrough_text"); }, floatleft() { this.get("toolbarEvent").applySurround('[wrap="floatl"]\n', '\n[/wrap]', "float_left_text"); From 3c2aeeef15ce383ed7aea6e18e23033afd41dfb6 Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Wed, 13 Nov 2019 11:46:30 -0500 Subject: [PATCH 09/26] Another attempt at label fix. --- common/head_tag.html | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/common/head_tag.html b/common/head_tag.html index ed415eb..2f295a6 100644 --- a/common/head_tag.html +++ b/common/head_tag.html @@ -75,19 +75,19 @@ api.modifyClass("controller:composer", { actions: { strikethrough() { this.get("toolbarEvent").applySurround("", "", "strikethrough_text"); + }, + superscript() { + this.get("toolbarEvent").applySurround("", "", "superscript_text"); + }, + subscript() { + this.get("toolbarEvent").applySurround("", "", "subscript_text"); }, floatleft() { this.get("toolbarEvent").applySurround('[wrap="floatl"]\n', '\n[/wrap]', "float_left_text"); }, columns() { this.get("toolbarEvent").applySurround('[wrap="columns"]\n', '\n[/wrap]', "columns_text"); - }, - superscript() { - this.get("toolbarEvent").applySurround("", "", "superscript_text"); - }, - subscript() { - this.get("toolbarEvent").applySurround("", "", "subscript_text"); - } + } } }); @@ -116,23 +116,23 @@ translations.composer.align_justify_button_title = settings.align_justify_button translations.composer.align_justify_text = settings.align_justify_text; -translations.strikethrough_button_title = settings.strikethrough_button; +translations.strikethrough_button = settings.strikethrough_button; translations.composer.strikethrough_text = settings.strikethrough_text; -translations.superscript_button_title = settings.superscript_button; +translations.superscript_button = settings.superscript_button; translations.composer.superscript_text = settings.superscript_text; -translations.subscript_button_title = settings.subscript_button; +translations.subscript_button = settings.subscript_button; translations.composer.subscript_text = settings.subscript_text; -translations.composer.columns_button_title = settings.columns_button; +translations.composer.columns_button = settings.columns_button; translations.composer.columns_text = settings.columns_text; -translations.composer.float_left_button_title = settings.float_left_button; +translations.composer.float_left_button = settings.float_left_button; translations.composer.float_left_text = settings.float_left_text; From 5a1391c9790a56b905f7c12a180796e8b54967c6 Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Wed, 13 Nov 2019 11:47:21 -0500 Subject: [PATCH 10/26] Fix labels. --- common/head_tag.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/head_tag.html b/common/head_tag.html index 2f295a6..af62cba 100644 --- a/common/head_tag.html +++ b/common/head_tag.html @@ -128,11 +128,11 @@ translations.subscript_button = settings.subscript_button; translations.composer.subscript_text = settings.subscript_text; -translations.composer.columns_button = settings.columns_button; +translations.columns_button = settings.columns_button; translations.composer.columns_text = settings.columns_text; -translations.composer.float_left_button = settings.float_left_button; +translations.float_left_button = settings.float_left_button; translations.composer.float_left_text = settings.float_left_text; From eab25ce9ca316c3f80a706a99b68e957586b0925 Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Wed, 13 Nov 2019 11:48:42 -0500 Subject: [PATCH 11/26] Reorder popup fontStyles buttons. --- common/head_tag.html | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/common/head_tag.html b/common/head_tag.html index af62cba..5d5fa50 100644 --- a/common/head_tag.html +++ b/common/head_tag.html @@ -42,20 +42,6 @@ api.addToolbarPopupMenuOptionsCallback(() => { label: "strikethrough_button" }; }); -api.addToolbarPopupMenuOptionsCallback(() => { - return { - action: "floatleft", - icon: "indent", - label: "float_left_button" - }; -}); -api.addToolbarPopupMenuOptionsCallback(() => { - return { - action: "columns", - icon: "columns", - label: "columns_button" - }; -}); api.addToolbarPopupMenuOptionsCallback(() => { return { action: "superscript", @@ -70,6 +56,20 @@ api.addToolbarPopupMenuOptionsCallback(() => { label: "subscript_button" }; }); +api.addToolbarPopupMenuOptionsCallback(() => { + return { + action: "floatleft", + icon: "indent", + label: "float_left_button" + }; +}); +api.addToolbarPopupMenuOptionsCallback(() => { + return { + action: "columns", + icon: "columns", + label: "columns_button" + }; +}); api.modifyClass("controller:composer", { actions: { From 4257ebe6e247000860181fdd83ae66c9a4882682 Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Wed, 13 Nov 2019 13:11:06 -0500 Subject: [PATCH 12/26] Initial responsive update. --- about.json | 2 +- common/common.scss | 26 ------ desktop/desktop.scss | 26 ++++++ desktop/head_tag.html | 134 +++++++++++++++++++++++++++++++ {common => mobile}/head_tag.html | 54 +++++++------ mobile/mobile.scss | 6 +- 6 files changed, 196 insertions(+), 52 deletions(-) create mode 100644 desktop/desktop.scss create mode 100644 desktop/head_tag.html rename {common => mobile}/head_tag.html (79%) diff --git a/about.json b/about.json index a816477..376fa5f 100644 --- a/about.json +++ b/about.json @@ -4,6 +4,6 @@ "license_url": null, "about_url": "https://www.mon-discourse.fr/themes/md-composer-extras/", "authors": "Steven", - "theme_version": "1.4", + "theme_version": "1.5", "learn_more": "https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966" } diff --git a/common/common.scss b/common/common.scss index dbf7c7c..e69de29 100644 --- a/common/common.scss +++ b/common/common.scss @@ -1,26 +0,0 @@ -[data-wrap="center"] { - text-align: center; -} - -[data-wrap="right"] { - text-align: right; -} - -[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; -} diff --git a/desktop/desktop.scss b/desktop/desktop.scss new file mode 100644 index 0000000..dbf7c7c --- /dev/null +++ b/desktop/desktop.scss @@ -0,0 +1,26 @@ +[data-wrap="center"] { + text-align: center; +} + +[data-wrap="right"] { + text-align: right; +} + +[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; +} diff --git a/desktop/head_tag.html b/desktop/head_tag.html new file mode 100644 index 0000000..46e6d3d --- /dev/null +++ b/desktop/head_tag.html @@ -0,0 +1,134 @@ + diff --git a/common/head_tag.html b/mobile/head_tag.html similarity index 79% rename from common/head_tag.html rename to mobile/head_tag.html index 5d5fa50..519c9bc 100644 --- a/common/head_tag.html +++ b/mobile/head_tag.html @@ -9,30 +9,6 @@ api.onToolbarCreate(toolbar => { 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('[wrap="center"]\n', '\n[/wrap]', 'align_center_text') - }); -}); -api.onToolbarCreate(toolbar => { - toolbar.addButton({ - id: "align_right_button", - group: "extras", - icon: "align-right", - perform: e => e.applySurround('[wrap="right"]\n', '\n[/wrap]', 'align_right_text') - }); -}); -api.onToolbarCreate(toolbar => { - toolbar.addButton({ - id: "align_justify_button", - group: "extras", - icon: "align-justify", - perform: e => e.applySurround('[wrap="justify"]\n', '\n[/wrap]', 'align_justify_text') - }); -}); // EXTRAS api.addToolbarPopupMenuOptionsCallback(() => { @@ -56,6 +32,27 @@ api.addToolbarPopupMenuOptionsCallback(() => { label: "subscript_button" }; }); +api.addToolbarPopupMenuOptionsCallback(() => { + return { + action: "aligncenter", + icon: "align-center", + label: "align_center_button" + }; +}); +api.addToolbarPopupMenuOptionsCallback(() => { + return { + action: "alignright", + icon: "align-right", + label: "align_right_button" + }; +}); +api.addToolbarPopupMenuOptionsCallback(() => { + return { + action: "alignjustify", + icon: "align-justify", + label: "align_justify_button" + }; +}); api.addToolbarPopupMenuOptionsCallback(() => { return { action: "floatleft", @@ -81,6 +78,15 @@ api.modifyClass("controller:composer", { }, subscript() { this.get("toolbarEvent").applySurround("", "", "subscript_text"); + }, + aligncenter() { + this.get("toolbarEvent").applySurround('[wrap="center"]\n', '\n[/wrap]', "align_center_text"); + }, + alignright() { + this.get("toolbarEvent").applySurround('[wrap="right"]\n', '\n[/wrap]', "align_right_text"); + }, + alignjustify() { + this.get("toolbarEvent").applySurround('[wrap="justify"]\n', '\n[/wrap]', "align_justify_text"); }, floatleft() { this.get("toolbarEvent").applySurround('[wrap="floatl"]\n', '\n[/wrap]', "float_left_text"); diff --git a/mobile/mobile.scss b/mobile/mobile.scss index e57a9fd..5a60373 100644 --- a/mobile/mobile.scss +++ b/mobile/mobile.scss @@ -4,4 +4,8 @@ .d-editor-spacer { margin: 0 2px; -} \ No newline at end of file +} + +[data-wrap="columns"] { +} + From 2182b08cc041b39cdf63a21165523e5aad8652e9 Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Wed, 13 Nov 2019 13:15:36 -0500 Subject: [PATCH 13/26] Remove columns from mobile. --- mobile/head_tag.html | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/mobile/head_tag.html b/mobile/head_tag.html index 519c9bc..812b564 100644 --- a/mobile/head_tag.html +++ b/mobile/head_tag.html @@ -60,13 +60,6 @@ api.addToolbarPopupMenuOptionsCallback(() => { label: "float_left_button" }; }); -api.addToolbarPopupMenuOptionsCallback(() => { - return { - action: "columns", - icon: "columns", - label: "columns_button" - }; -}); api.modifyClass("controller:composer", { actions: { @@ -90,10 +83,7 @@ api.modifyClass("controller:composer", { }, floatleft() { this.get("toolbarEvent").applySurround('[wrap="floatl"]\n', '\n[/wrap]', "float_left_text"); - }, - columns() { - this.get("toolbarEvent").applySurround('[wrap="columns"]\n', '\n[/wrap]', "columns_text"); - } + } } }); From 2d7d93f702730587d0de9777aca1501f90507a37 Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Wed, 13 Nov 2019 13:56:20 -0500 Subject: [PATCH 14/26] Label correction. --- mobile/head_tag.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mobile/head_tag.html b/mobile/head_tag.html index 812b564..39c1539 100644 --- a/mobile/head_tag.html +++ b/mobile/head_tag.html @@ -100,15 +100,15 @@ 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.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 = +translations.align_right_button_title = settings.align_right_button; +translations.align_right_text = settings.align_right_text; -translations.composer.align_justify_button_title = settings.align_justify_button; +translations.align_justify_button_title = settings.align_justify_button; translations.composer.align_justify_text = settings.align_justify_text; From 3eff839fc64d7962c517946ddd56d4a4f104c185 Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Wed, 13 Nov 2019 13:57:13 -0500 Subject: [PATCH 15/26] Fix error in desktop. --- desktop/head_tag.html | 1 - 1 file changed, 1 deletion(-) diff --git a/desktop/head_tag.html b/desktop/head_tag.html index 46e6d3d..7ee503c 100644 --- a/desktop/head_tag.html +++ b/desktop/head_tag.html @@ -76,7 +76,6 @@ api.addToolbarPopupMenuOptionsCallback(() => { api.modifyClass("controller:composer", { actions: { - strikethrough() { floatleft() { this.get("toolbarEvent").applySurround('[wrap="floatl"]\n', '\n[/wrap]', "float_left_text"); }, From e788b66686d492861c2433b296acbc8e178bb75a Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Wed, 13 Nov 2019 14:01:20 -0500 Subject: [PATCH 16/26] More label correction. --- mobile/head_tag.html | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mobile/head_tag.html b/mobile/head_tag.html index 39c1539..d4e54ee 100644 --- a/mobile/head_tag.html +++ b/mobile/head_tag.html @@ -101,7 +101,7 @@ translations.composer.underline_text = settings.underline_text; translations.align_center_button_title = settings.align_center_button; -translations.composer.align_center_text = +translations.align_center_text = settings.align_center_text; translations.align_right_button_title = settings.align_right_button; @@ -109,27 +109,27 @@ translations.align_right_text = settings.align_right_text; translations.align_justify_button_title = settings.align_justify_button; -translations.composer.align_justify_text = +translations.align_justify_text = settings.align_justify_text; translations.strikethrough_button = settings.strikethrough_button; -translations.composer.strikethrough_text = +translations.strikethrough_text = settings.strikethrough_text; translations.superscript_button = settings.superscript_button; -translations.composer.superscript_text = +translations.superscript_text = settings.superscript_text; translations.subscript_button = settings.subscript_button; -translations.composer.subscript_text = +translations.subscript_text = settings.subscript_text; translations.columns_button = settings.columns_button; -translations.composer.columns_text = +translations.columns_text = settings.columns_text; translations.float_left_button = settings.float_left_button; -translations.composer.float_left_text = +translations.float_left_text = settings.float_left_text; From 71110b8607e4349fd8ea723927b9fc5896de02a2 Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Wed, 13 Nov 2019 14:03:22 -0500 Subject: [PATCH 17/26] More label correction. --- mobile/head_tag.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mobile/head_tag.html b/mobile/head_tag.html index d4e54ee..3e4d5ce 100644 --- a/mobile/head_tag.html +++ b/mobile/head_tag.html @@ -100,15 +100,15 @@ translations.composer.underline_button_title = settings.underline_button; translations.composer.underline_text = settings.underline_text; -translations.align_center_button_title = settings.align_center_button; +translations.align_center_button = settings.align_center_button; translations.align_center_text = settings.align_center_text; -translations.align_right_button_title = settings.align_right_button; +translations.align_right_button = settings.align_right_button; translations.align_right_text = settings.align_right_text; -translations.align_justify_button_title = settings.align_justify_button; +translations.align_justify_button = settings.align_justify_button; translations.align_justify_text = settings.align_justify_text; From 92025e0991d8fbff7ddb9b844811adbf9802785e Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Wed, 13 Nov 2019 14:05:34 -0500 Subject: [PATCH 18/26] Fix button default texts. --- mobile/head_tag.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mobile/head_tag.html b/mobile/head_tag.html index 3e4d5ce..04782be 100644 --- a/mobile/head_tag.html +++ b/mobile/head_tag.html @@ -101,35 +101,35 @@ translations.composer.underline_text = settings.underline_text; translations.align_center_button = settings.align_center_button; -translations.align_center_text = +translations.composer.align_center_text = settings.align_center_text; translations.align_right_button = settings.align_right_button; -translations.align_right_text = +translations.composer.align_right_text = settings.align_right_text; translations.align_justify_button = settings.align_justify_button; -translations.align_justify_text = +translations.composer.align_justify_text = settings.align_justify_text; translations.strikethrough_button = settings.strikethrough_button; -translations.strikethrough_text = +translations.composer.strikethrough_text = settings.strikethrough_text; translations.superscript_button = settings.superscript_button; -translations.superscript_text = +translations.composer.superscript_text = settings.superscript_text; translations.subscript_button = settings.subscript_button; -translations.subscript_text = +translations.composer.subscript_text = settings.subscript_text; translations.columns_button = settings.columns_button; -translations.columns_text = +translations.comoposer.columns_text = settings.columns_text; translations.float_left_button = settings.float_left_button; -translations.float_left_text = +translations.composer.float_left_text = settings.float_left_text; From 01bf4a3db1e707434912a9fb7cd83f9f0a67e8de Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Wed, 13 Nov 2019 14:52:32 -0500 Subject: [PATCH 19/26] Small correction. --- mobile/head_tag.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/head_tag.html b/mobile/head_tag.html index 04782be..15d015b 100644 --- a/mobile/head_tag.html +++ b/mobile/head_tag.html @@ -125,7 +125,7 @@ translations.composer.subscript_text = settings.subscript_text; translations.columns_button = settings.columns_button; -translations.comoposer.columns_text = +translations.composer.columns_text = settings.columns_text; translations.float_left_button = settings.float_left_button; From d2144ba19d9bbcf61fa395b16a63b6aaa2cf76bc Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Wed, 13 Nov 2019 14:59:20 -0500 Subject: [PATCH 20/26] Delineate CSS by common, desktop, mobile --- common/common.scss | 12 ++++++++++++ desktop/desktop.scss | 12 ------------ mobile/mobile.scss | 6 ++++++ 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/common/common.scss b/common/common.scss index e69de29..02b102c 100644 --- a/common/common.scss +++ b/common/common.scss @@ -0,0 +1,12 @@ +[data-wrap="center"] { + text-align: center; +} + +[data-wrap="right"] { + text-align: right; +} + +[data-wrap="justify"] { + text-align: justify; +} + diff --git a/desktop/desktop.scss b/desktop/desktop.scss index dbf7c7c..b562027 100644 --- a/desktop/desktop.scss +++ b/desktop/desktop.scss @@ -1,15 +1,3 @@ -[data-wrap="center"] { - text-align: center; -} - -[data-wrap="right"] { - text-align: right; -} - -[data-wrap="justify"] { - text-align: justify; -} - [data-wrap="columns"] { width: 50%; float: left; diff --git a/mobile/mobile.scss b/mobile/mobile.scss index 5a60373..ce05862 100644 --- a/mobile/mobile.scss +++ b/mobile/mobile.scss @@ -9,3 +9,9 @@ [data-wrap="columns"] { } +[data-wrap="floatl"] { +} + +[data-wrap="floatr"] { +} + From 638f278eff94784ff95700ccca040fc2c708fb2e Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Sat, 16 Nov 2019 01:03:22 -0500 Subject: [PATCH 21/26] Minor correction. --- desktop/head_tag.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/desktop/head_tag.html b/desktop/head_tag.html index 7ee503c..d06c12f 100644 --- a/desktop/head_tag.html +++ b/desktop/head_tag.html @@ -14,7 +14,7 @@ api.onToolbarCreate(toolbar => { id: "strikethrough_button", group: "fontStyles", icon: "strikethrough", - perform: e => e.applySurround('', '[/s]', 'strikethrough_text') + perform: e => e.applySurround('', '', 'strikethrough_text') }); }); api.onToolbarCreate(toolbar => { @@ -110,15 +110,15 @@ translations.composer.align_justify_button_title = settings.align_justify_button translations.composer.align_justify_text = settings.align_justify_text; -translations.composer.strikethrough_button = settings.strikethrough_button; +translations.composer.strikethrough_button_title = settings.strikethrough_button; translations.composer.strikethrough_text = settings.strikethrough_text; -translations.composer.superscript_button = settings.superscript_button; +translations.composer.superscript_button_title = settings.superscript_button; translations.composer.superscript_text = settings.superscript_text; -translations.composer.subscript_button = settings.subscript_button; +translations.composer.subscript_button_title = settings.subscript_button; translations.composer.subscript_text = settings.subscript_text; From 405f17c7075a2a9a3797e8ad94aa6ba740b3ad66 Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Sat, 16 Nov 2019 01:07:26 -0500 Subject: [PATCH 22/26] Columns clarification. --- settings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.yml b/settings.yml index 379b590..2382838 100644 --- a/settings.yml +++ b/settings.yml @@ -67,7 +67,7 @@ columns_button: 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. Once done. Columns must be equal height." + default: "Use the closing tag to mark where the first column ends. The second column will autobreak." description: en: Enter the placeholder text that appears in the composer after the user clicks the button. From f73b25b4dffd3cede5c74805682ff68cbf6903bf Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Sat, 16 Nov 2019 01:20:14 -0500 Subject: [PATCH 23/26] Update README; modify columns CSS --- README.md | 33 +++++++++++++++++++++++++++++++-- desktop/desktop.scss | 3 +++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0d03d2c..ded295f 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,42 @@ ## MD Composer Extras -Add some formatting option in your Discourse composer : underline, center, align right, justify and strikethrough +Add some formatting option in your Discourse composer : underline, strikethrough, superscript, subscript, center, align right, justify , float left, float right, and columns. + +The CSS for columns and floats is disabled on mobile. By default on mobile columns and float will appear as single column content. The missing CSS can be added in again manually. + +## Columns and Floats + +When using columns and floats, note that the text will autobreak once an appropriate amount of content has been placed in the second column or to the side of the float. + +Columns have a CSS border to for ease of viewing. + +A column is broken by placing `[/wrap]` at the end of the first column's content. + +**Column Example** + +Place the following in your editor to see how columns work. + +``` +Test + +[wrap="columns"] +1 +2 +3 +[/wrap] +1 +2 +3 + +Test +``` For more informations, see : - English : https://meta.discourse.org/t/md-composer-extras/118912 - Français : https://www.mon-discourse.fr/themes/md-composer-extras/ -
+## Credits Wrap support by thw26 : https://github.com/thw26 diff --git a/desktop/desktop.scss b/desktop/desktop.scss index b562027..af01b47 100644 --- a/desktop/desktop.scss +++ b/desktop/desktop.scss @@ -1,6 +1,9 @@ [data-wrap="columns"] { width: 50%; float: left; + border-right: 1px solid black; + padding-right: 5px; + margin-right: 5px; } [data-wrap="floatl"] { From fc7c577654003e2efa5beb980d77e742ae56dd16 Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Sat, 16 Nov 2019 01:25:32 -0500 Subject: [PATCH 24/26] Fix CSS margins for columns inner paragraph --- desktop/desktop.scss | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/desktop/desktop.scss b/desktop/desktop.scss index af01b47..af0b2f6 100644 --- a/desktop/desktop.scss +++ b/desktop/desktop.scss @@ -6,6 +6,11 @@ margin-right: 5px; } +[data-wrap="columns"] > p { + margin-top: 0; + margin-bottom: 0; +} + [data-wrap="floatl"] { float: left; margin-right: 10px; From c4ee0f1da13f9d117a9e39b4af50c8ad1e39409f Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Sat, 16 Nov 2019 01:28:33 -0500 Subject: [PATCH 25/26] Fix CSS margins for floats inner paragraph --- desktop/desktop.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop/desktop.scss b/desktop/desktop.scss index af0b2f6..e00e26b 100644 --- a/desktop/desktop.scss +++ b/desktop/desktop.scss @@ -6,7 +6,7 @@ margin-right: 5px; } -[data-wrap="columns"] > p { +[data-wrap="columns"] > p, [data-wrap="floatl"] > p, [data-wrap="floatr"] > p { margin-top: 0; margin-bottom: 0; } From d97f1ccdcdfffea9cf6d0bf8f8db863518484614 Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Sat, 16 Nov 2019 01:39:35 -0500 Subject: [PATCH 26/26] Further README modifications. --- README.md | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ded295f..f67c1fc 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,21 @@ -## MD Composer Extras +# MD Composer Extras -Add some formatting option in your Discourse composer : underline, strikethrough, superscript, subscript, center, align right, justify , float left, float right, and columns. +This Discourse theme component adds formatting options to your Discourse composer. -The CSS for columns and floats is disabled on mobile. By default on mobile columns and float will appear as single column content. The missing CSS can be added in again manually. +* underline +* strikethrough +* superscript +* subscript +* center +* align right +* justify +* float left +* float right +* columns. + +These additions are responsive for desktops and phones, but not for horizon orientation or tablets. These additions have taken into consideration (Slick)[https://github.com/discourse/Discourse-Slick-image-gallery], (Tiles)[https://github.com/discourse/Discourse-Tiles-image-gallery], and (Events)[https://github.com/angusmcleod/discourse-events] when determining what should be placed on the composer bar or in the composer pop out menu. + +There is currently no implemented option for disabling particular buttons, but this can be done through CSS. ## Columns and Floats @@ -12,6 +25,8 @@ Columns have a CSS border to for ease of viewing. A column is broken by placing `[/wrap]` at the end of the first column's content. +The CSS for columns and floats is disabled on mobile. By default on mobile columns and float will appear as single column content. The missing CSS can be added in again manually. + **Column Example** Place the following in your editor to see how columns work. @@ -31,14 +46,16 @@ Test Test ``` -For more informations, see : +## Questions + +For more informations, see: - English : https://meta.discourse.org/t/md-composer-extras/118912 - Français : https://www.mon-discourse.fr/themes/md-composer-extras/ ## Credits -Wrap support by thw26 : https://github.com/thw26 +Wrap support by thw26: https://github.com/thw26