Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unused iconClassMap option #501

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 8 additions & 26 deletions src/js/easymde.js
Original file line number Diff line number Diff line change
Expand Up @@ -1490,58 +1490,49 @@ var toolbarBuiltInButtons = {
'bold': {
name: 'bold',
action: toggleBold,
className: iconClassMap['bold'],
title: 'Bold',
default: true,
},
'italic': {
name: 'italic',
action: toggleItalic,
className: iconClassMap['italic'],
title: 'Italic',
default: true,
},
'strikethrough': {
name: 'strikethrough',
action: toggleStrikethrough,
className: iconClassMap['strikethrough'],
title: 'Strikethrough',
},
'heading': {
name: 'heading',
action: toggleHeadingSmaller,
className: iconClassMap['heading'],
title: 'Heading',
default: true,
},
'heading-smaller': {
name: 'heading-smaller',
action: toggleHeadingSmaller,
className: iconClassMap['heading-smaller'],
title: 'Smaller Heading',
},
'heading-bigger': {
name: 'heading-bigger',
action: toggleHeadingBigger,
className: iconClassMap['heading-bigger'],
title: 'Bigger Heading',
},
'heading-1': {
name: 'heading-1',
action: toggleHeading1,
className: iconClassMap['heading-1'],
title: 'Big Heading',
},
'heading-2': {
name: 'heading-2',
action: toggleHeading2,
className: iconClassMap['heading-2'],
title: 'Medium Heading',
},
'heading-3': {
name: 'heading-3',
action: toggleHeading3,
className: iconClassMap['heading-3'],
title: 'Small Heading',
},
'separator-1': {
Expand All @@ -1550,34 +1541,29 @@ var toolbarBuiltInButtons = {
'code': {
name: 'code',
action: toggleCodeBlock,
className: iconClassMap['code'],
title: 'Code',
},
'quote': {
name: 'quote',
action: toggleBlockquote,
className: iconClassMap['quote'],
title: 'Quote',
default: true,
},
'unordered-list': {
name: 'unordered-list',
action: toggleUnorderedList,
className: iconClassMap['unordered-list'],
title: 'Generic List',
default: true,
},
'ordered-list': {
name: 'ordered-list',
action: toggleOrderedList,
className: iconClassMap['ordered-list'],
title: 'Numbered List',
default: true,
},
'clean-block': {
name: 'clean-block',
action: cleanBlock,
className: iconClassMap['clean-block'],
title: 'Clean block',
},
'separator-2': {
Expand All @@ -1586,33 +1572,28 @@ var toolbarBuiltInButtons = {
'link': {
name: 'link',
action: drawLink,
className: iconClassMap['link'],
title: 'Create Link',
default: true,
},
'image': {
name: 'image',
action: drawImage,
className: iconClassMap['image'],
title: 'Insert Image',
default: true,
},
'upload-image': {
name: 'upload-image',
action: drawUploadedImage,
className: iconClassMap['upload-image'],
title: 'Import an image',
},
'table': {
name: 'table',
action: drawTable,
className: iconClassMap['table'],
title: 'Insert Table',
},
'horizontal-rule': {
name: 'horizontal-rule',
action: drawHorizontalRule,
className: iconClassMap['horizontal-rule'],
title: 'Insert Horizontal Line',
},
'separator-3': {
Expand All @@ -1621,15 +1602,13 @@ var toolbarBuiltInButtons = {
'preview': {
name: 'preview',
action: togglePreview,
className: iconClassMap['preview'],
noDisable: true,
title: 'Toggle Preview',
default: true,
},
'side-by-side': {
name: 'side-by-side',
action: toggleSideBySide,
className: iconClassMap['side-by-side'],
noDisable: true,
noMobile: true,
title: 'Toggle Side by Side',
Expand All @@ -1638,7 +1617,6 @@ var toolbarBuiltInButtons = {
'fullscreen': {
name: 'fullscreen',
action: toggleFullScreen,
className: iconClassMap['fullscreen'],
noDisable: true,
noMobile: true,
title: 'Toggle Fullscreen',
Expand All @@ -1650,7 +1628,6 @@ var toolbarBuiltInButtons = {
'guide': {
name: 'guide',
action: 'https://www.markdownguide.org/basic-syntax/',
className: iconClassMap['guide'],
noDisable: true,
title: 'Markdown Guide',
default: true,
Expand All @@ -1661,14 +1638,12 @@ var toolbarBuiltInButtons = {
'undo': {
name: 'undo',
action: undo,
className: iconClassMap['undo'],
noDisable: true,
title: 'Undo',
},
'redo': {
name: 'redo',
action: redo,
className: iconClassMap['redo'],
noDisable: true,
title: 'Redo',
},
Expand Down Expand Up @@ -2626,7 +2601,14 @@ EasyMDE.prototype.createToolbar = function (items) {
var i;
for (i = 0; i < items.length; i++) {
if (toolbarBuiltInButtons[items[i]] != undefined) {
items[i] = toolbarBuiltInButtons[items[i]];
var button = toolbarBuiltInButtons[items[i]];

if (button.className === undefined
&& this.options.iconClassMap[items[i]] !== undefined) {
button.className = this.options.iconClassMap[items[i]];
}

items[i] = button;
}
}

Expand Down