Get rid of eval() @ line 676

Now, nicEdit is ready to use in chrome extensions and apps platform :)
master
parhelionix 2015-03-25 20:35:53 +02:00 committed by Vitaliy Filippov
parent 8200365acc
commit 58c71157b1
1 changed files with 8 additions and 1 deletions

View File

@ -734,7 +734,14 @@ var nicEditorPanel = bkClass.extend({
addButton : function(buttonName,options,noOrder) {
var button = options.buttons[buttonName];
var type = (button['type']) ? eval('(typeof('+button['type']+') == "undefined") ? null : '+button['type']+';') : nicEditorButton;
var type = null;
if (button['type']) {
type = typeof(window[button['type']]) == undefined ? null : window[button['type']];
}
else {
type = nicEditorButton;
}
var hasButton = bkLib.inArray(this.buttonList,buttonName);
if(type && (hasButton || this.ne.options.fullPanel)) {
this.panelButtons.push(new type(this.panelElm,buttonName,options,this.ne));