2
0
mirror of https://github.com/Ionaru/easy-markdown-editor synced 2025-09-24 16:40:55 -06:00

Update toolbar titles

Signed-off-by: Dmitry Mazurov <dimabzz@gmail.com>
This commit is contained in:
Dmitry Mazurov 2020-04-09 18:07:16 +03:00
parent 32f3feb4a0
commit 1837d697f5

View File

@ -1656,6 +1656,9 @@ function EasyMDE(options) {
options.autosave.timeFormat = extend({}, timeFormat, options.autosave.timeFormat || {}); options.autosave.timeFormat = extend({}, timeFormat, options.autosave.timeFormat || {});
} }
// Merging the toolbar title, with the given options
toolbarBuiltInButtons = extend({}, toolbarBuiltInButtons, options.toolbarTitles || {});
// Merging the shortcuts, with the given options // Merging the shortcuts, with the given options
options.shortcuts = extend({}, shortcuts, options.shortcuts || {}); options.shortcuts = extend({}, shortcuts, options.shortcuts || {});
@ -2279,13 +2282,9 @@ EasyMDE.prototype.createToolbar = function (items) {
var i; var i;
for (i = 0; i < items.length; i++) { for (i = 0; i < items.length; i++) {
if (toolbarBuiltInButtons[items[i]] != undefined) { if (toolbarBuiltInButtons[items[i]] != undefined) {
if (this.options.toolbarTitles != undefined && this.options.toolbarTitles[items[i]] != undefined) {
items[i] = extend({}, toolbarBuiltInButtons[items[i]], this.options.toolbarTitles[items[i]]);
} else {
items[i] = toolbarBuiltInButtons[items[i]]; items[i] = toolbarBuiltInButtons[items[i]];
} }
} }
}
var bar = document.createElement('div'); var bar = document.createElement('div');
bar.className = 'editor-toolbar'; bar.className = 'editor-toolbar';