mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-07-06 09:34:27 -06:00
Fix toolbar overwrite issue
This commit is contained in:
parent
c75bf94de8
commit
1aad2dec4c
@ -627,7 +627,8 @@ SimpleMDE.prototype.createToolbar = function(items) {
|
||||
var self = this;
|
||||
|
||||
var el;
|
||||
self.toolbar = {};
|
||||
var toolbar_data = {};
|
||||
self.toolbar = items;
|
||||
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
if(items[i].name == "guide" && self.options.toolbarGuideIcon === false)
|
||||
@ -652,7 +653,7 @@ SimpleMDE.prototype.createToolbar = function(items) {
|
||||
el.target = '_blank';
|
||||
}
|
||||
}
|
||||
self.toolbar[item.name || item] = el;
|
||||
toolbar_data[item.name || item] = el;
|
||||
bar.appendChild(el);
|
||||
})(items[i]);
|
||||
}
|
||||
@ -661,9 +662,9 @@ SimpleMDE.prototype.createToolbar = function(items) {
|
||||
cm.on('cursorActivity', function() {
|
||||
var stat = getState(cm);
|
||||
|
||||
for (var key in self.toolbar) {
|
||||
for (var key in toolbar_data) {
|
||||
(function(key) {
|
||||
var el = self.toolbar[key];
|
||||
var el = toolbar_data[key];
|
||||
if (stat[key]) {
|
||||
el.className += ' active';
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user