mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-07-05 09:04:28 -06:00
Merge pull request #461 from vanillajonathan/patch-12
This commit is contained in:
commit
e57c16bc5c
@ -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
|
```js
|
||||||
const easyMDE = new EasyMDE({
|
const easyMDE = new EasyMDE({
|
||||||
@ -373,6 +373,7 @@ const easyMDE = new EasyMDE({
|
|||||||
// Add your own code
|
// Add your own code
|
||||||
},
|
},
|
||||||
className: "fa fa-star",
|
className: "fa fa-star",
|
||||||
|
text: "Starred",
|
||||||
title: "Custom Button",
|
title: "Custom Button",
|
||||||
attributes: { // for custom attributes
|
attributes: { // for custom attributes
|
||||||
id: "custom-id",
|
id: "custom-id",
|
||||||
|
@ -140,7 +140,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.editor-toolbar button {
|
.editor-toolbar button {
|
||||||
width: 30px;
|
font-weight: bold;
|
||||||
|
min-width: 30px;
|
||||||
|
padding: 0 6px;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor-toolbar button.active,
|
.editor-toolbar button.active,
|
||||||
@ -365,6 +368,10 @@
|
|||||||
visibility: visible;
|
visibility: visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.easymde-dropdown-content button {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
span[data-img-src]::after {
|
span[data-img-src]::after {
|
||||||
content: '';
|
content: '';
|
||||||
/*noinspection CssUnresolvedCustomProperty, added through JS*/
|
/*noinspection CssUnresolvedCustomProperty, added through JS*/
|
||||||
|
@ -242,7 +242,11 @@ function createToolbarButton(options, enableActions, enableTooltips, shortcuts,
|
|||||||
el.setAttribute('type', markup);
|
el.setAttribute('type', markup);
|
||||||
enableTooltips = (enableTooltips == undefined) ? true : enableTooltips;
|
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) {
|
if (options.name && options.name in shortcuts) {
|
||||||
bindings[options.name] = options.action;
|
bindings[options.name] = options.action;
|
||||||
}
|
}
|
||||||
@ -289,13 +293,15 @@ function createToolbarButton(options, enableActions, enableTooltips, shortcuts,
|
|||||||
|
|
||||||
el.tabIndex = -1;
|
el.tabIndex = -1;
|
||||||
|
|
||||||
// Create icon element and append as a child to the button
|
if (iconClasses.length > 0) {
|
||||||
var icon = document.createElement('i');
|
// Create icon element and append as a child to the button
|
||||||
for (var iconClassIndex = 0; iconClassIndex < iconClasses.length; iconClassIndex++) {
|
var icon = document.createElement('i');
|
||||||
var iconClass = iconClasses[iconClassIndex];
|
for (var iconClassIndex = 0; iconClassIndex < iconClasses.length; iconClassIndex++) {
|
||||||
icon.classList.add(iconClass);
|
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 there is a custom icon markup set, use that
|
||||||
if (typeof options.icon !== 'undefined') {
|
if (typeof options.icon !== 'undefined') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user