mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-08-11 19:22:45 -06:00
Small fixes for this change
* Removed redundant code. * Renamed function to better reflect its behaviour. * Marked `noDisable` and `noMobile` as optional.
This commit is contained in:
parent
4385d733e5
commit
f50c96bc01
2
dist/easymde.min.js
vendored
2
dist/easymde.min.js
vendored
File diff suppressed because one or more lines are too long
@ -113,9 +113,9 @@ function fixShortcut(name) {
|
||||
|
||||
|
||||
/**
|
||||
* Create icon element for toolbar.
|
||||
* Create button element for toolbar.
|
||||
*/
|
||||
function createIcon(options, enableTooltips, shortcuts) {
|
||||
function createToolbarButton(options, enableTooltips, shortcuts) {
|
||||
options = options || {};
|
||||
var el = document.createElement('button');
|
||||
el.className = options.name;
|
||||
@ -131,11 +131,11 @@ function createIcon(options, enableTooltips, shortcuts) {
|
||||
}
|
||||
}
|
||||
|
||||
if (options.noDisable || options.className.indexOf('no-disable') !== -1) {
|
||||
if (options.noDisable) {
|
||||
el.classList.add('no-disable');
|
||||
}
|
||||
|
||||
if (options.noMobile || options.className.indexOf('no-mobile') !== -1) {
|
||||
if (options.noMobile) {
|
||||
el.classList.add('no-mobile');
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ function createIcon(options, enableTooltips, shortcuts) {
|
||||
var icon = document.createElement('i');
|
||||
for (var iconClassIndex = 0; iconClassIndex < iconClasses.length; iconClassIndex++) {
|
||||
var iconClass = iconClasses[iconClassIndex];
|
||||
icon.classList.add(iconClass)
|
||||
icon.classList.add(iconClass);
|
||||
}
|
||||
el.appendChild(icon);
|
||||
|
||||
@ -1841,7 +1841,7 @@ EasyMDE.prototype.createToolbar = function (items) {
|
||||
if (item === '|') {
|
||||
el = createSep();
|
||||
} else {
|
||||
el = createIcon(item, self.options.toolbarTips, self.options.shortcuts);
|
||||
el = createToolbarButton(item, self.options.toolbarTips, self.options.shortcuts);
|
||||
}
|
||||
|
||||
// bind events, special for info
|
||||
|
4
types/easymde.d.ts
vendored
4
types/easymde.d.ts
vendored
@ -81,8 +81,8 @@ declare namespace EasyMDE {
|
||||
action: string|((editor: EasyMDE) => void);
|
||||
className: string;
|
||||
title: string;
|
||||
noDisable: boolean;
|
||||
noMobile: boolean;
|
||||
noDisable?: boolean;
|
||||
noMobile?: boolean;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
|
Loading…
x
Reference in New Issue
Block a user