From 38717daffeb1bd3c2f15a8f88c11fb530a4dbe5c Mon Sep 17 00:00:00 2001 From: Jonathan Date: Thu, 19 May 2022 22:49:29 +0200 Subject: [PATCH 1/7] Add support for text buttons --- src/js/easymde.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/js/easymde.js b/src/js/easymde.js index 639d27c..31273ed 100644 --- a/src/js/easymde.js +++ b/src/js/easymde.js @@ -236,7 +236,11 @@ function createToolbarButton(options, enableActions, enableTooltips, shortcuts, el.setAttribute('type', markup); enableTooltips = (enableTooltips == undefined) ? true : enableTooltips; - // Properly hande custom shortcuts + if (options.text) { + el.innerText = options.text; + } + + // Properly handle custom shortcuts if (options.name && options.name in shortcuts) { bindings[options.name] = options.action; } From 855a5d72f57b81093afa3319e454930cf8c284e7 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Thu, 19 May 2022 22:57:16 +0200 Subject: [PATCH 2/7] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e50c377..d0af330 100644 --- a/README.md +++ b/README.md @@ -355,7 +355,7 @@ const easyMDE = new EasyMDE({ }); ``` -All information and/or add your own icons +All information and/or add your own icons or text ```js const easyMDE = new EasyMDE({ @@ -373,6 +373,7 @@ const easyMDE = new EasyMDE({ // Add your own code }, className: "fa fa-star", + text: "Starred", title: "Custom Button", attributes: { // for custom attributes id: "custom-id", From 5a4af7e38a0cd68851dc8e28c2b42c808e24818a Mon Sep 17 00:00:00 2001 From: Jonathan Date: Sun, 22 May 2022 00:02:10 +0200 Subject: [PATCH 3/7] Update easymde.css --- src/css/easymde.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/css/easymde.css b/src/css/easymde.css index d7a3249..1878b5d 100644 --- a/src/css/easymde.css +++ b/src/css/easymde.css @@ -140,7 +140,7 @@ } .editor-toolbar button { - width: 30px; + min-width: 30px; } .editor-toolbar button.active, From b675e611a426c0feeb9122c24089d7e92b17deb3 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Sun, 22 May 2022 12:22:39 +0200 Subject: [PATCH 4/7] Update easymde.css --- src/css/easymde.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/css/easymde.css b/src/css/easymde.css index 1878b5d..b645f9c 100644 --- a/src/css/easymde.css +++ b/src/css/easymde.css @@ -141,6 +141,7 @@ .editor-toolbar button { min-width: 30px; + white-space: nowrap; } .editor-toolbar button.active, @@ -365,6 +366,10 @@ visibility: visible; } +.easymde-dropdown-content button { + display: block; +} + span[data-img-src]::after { content: ''; /*noinspection CssUnresolvedCustomProperty, added through JS*/ From eee701ef8638e86956eaade39bd7f1059a25ac1d Mon Sep 17 00:00:00 2001 From: Jonathan Date: Sun, 22 May 2022 18:15:02 +0200 Subject: [PATCH 5/7] Update easymde.js --- src/js/easymde.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/js/easymde.js b/src/js/easymde.js index 31273ed..5ba1ea0 100644 --- a/src/js/easymde.js +++ b/src/js/easymde.js @@ -283,13 +283,15 @@ function createToolbarButton(options, enableActions, enableTooltips, shortcuts, el.tabIndex = -1; - // Create icon element and append as a child to the button - var icon = document.createElement('i'); - for (var iconClassIndex = 0; iconClassIndex < iconClasses.length; iconClassIndex++) { - var iconClass = iconClasses[iconClassIndex]; - icon.classList.add(iconClass); + if (iconClasses.length > 0) { + // Create icon element and append as a child to the button + var icon = document.createElement('i'); + for (var iconClassIndex = 0; iconClassIndex < iconClasses.length; iconClassIndex++) { + var iconClass = iconClasses[iconClassIndex]; + icon.classList.add(iconClass); + } + el.appendChild(icon); } - el.appendChild(icon); // If there is a custom icon markup set, use that if (typeof options.icon !== 'undefined') { From 2972b280a50d59a2578bca18c6918d6928de673a Mon Sep 17 00:00:00 2001 From: Jonathan Date: Sun, 22 May 2022 18:19:21 +0200 Subject: [PATCH 6/7] Update easymde.css --- src/css/easymde.css | 1 + 1 file changed, 1 insertion(+) diff --git a/src/css/easymde.css b/src/css/easymde.css index b645f9c..760f19d 100644 --- a/src/css/easymde.css +++ b/src/css/easymde.css @@ -140,6 +140,7 @@ } .editor-toolbar button { + font-weight: bold; min-width: 30px; white-space: nowrap; } From 554112b05f5940a452bf11e2d900104c9b1bf4ee Mon Sep 17 00:00:00 2001 From: Jonathan Date: Sun, 22 May 2022 18:25:49 +0200 Subject: [PATCH 7/7] Update easymde.css --- src/css/easymde.css | 1 + 1 file changed, 1 insertion(+) diff --git a/src/css/easymde.css b/src/css/easymde.css index 760f19d..1ec4a0b 100644 --- a/src/css/easymde.css +++ b/src/css/easymde.css @@ -142,6 +142,7 @@ .editor-toolbar button { font-weight: bold; min-width: 30px; + padding: 0 6px; white-space: nowrap; }