mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-07-06 17:44: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 self = this;
|
||||||
|
|
||||||
var el;
|
var el;
|
||||||
self.toolbar = {};
|
var toolbar_data = {};
|
||||||
|
self.toolbar = items;
|
||||||
|
|
||||||
for (var i = 0; i < items.length; i++) {
|
for (var i = 0; i < items.length; i++) {
|
||||||
if(items[i].name == "guide" && self.options.toolbarGuideIcon === false)
|
if(items[i].name == "guide" && self.options.toolbarGuideIcon === false)
|
||||||
@ -652,7 +653,7 @@ SimpleMDE.prototype.createToolbar = function(items) {
|
|||||||
el.target = '_blank';
|
el.target = '_blank';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.toolbar[item.name || item] = el;
|
toolbar_data[item.name || item] = el;
|
||||||
bar.appendChild(el);
|
bar.appendChild(el);
|
||||||
})(items[i]);
|
})(items[i]);
|
||||||
}
|
}
|
||||||
@ -661,9 +662,9 @@ SimpleMDE.prototype.createToolbar = function(items) {
|
|||||||
cm.on('cursorActivity', function() {
|
cm.on('cursorActivity', function() {
|
||||||
var stat = getState(cm);
|
var stat = getState(cm);
|
||||||
|
|
||||||
for (var key in self.toolbar) {
|
for (var key in toolbar_data) {
|
||||||
(function(key) {
|
(function(key) {
|
||||||
var el = self.toolbar[key];
|
var el = toolbar_data[key];
|
||||||
if (stat[key]) {
|
if (stat[key]) {
|
||||||
el.className += ' active';
|
el.className += ' active';
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user