Merge pull request #461 from vanillajonathan/patch-12

pull/467/head
Jeroen Akkerman 2 years ago committed by GitHub
commit e57c16bc5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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",

@ -140,7 +140,10 @@
}
.editor-toolbar button {
width: 30px;
font-weight: bold;
min-width: 30px;
padding: 0 6px;
white-space: nowrap;
}
.editor-toolbar button.active,
@ -365,6 +368,10 @@
visibility: visible;
}
.easymde-dropdown-content button {
display: block;
}
span[data-img-src]::after {
content: '';
/*noinspection CssUnresolvedCustomProperty, added through JS*/

@ -242,7 +242,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;
}
@ -289,13 +293,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') {

Loading…
Cancel
Save