From 0c859e3305abf47a1dc7a8219bebadbf508f2bb7 Mon Sep 17 00:00:00 2001 From: lildemon Date: Mon, 26 Dec 2011 17:37:59 +0800 Subject: [PATCH] Plz, refer to this post: http://peter.michaux.ca/articles/an-important-pair-of-parens --- src/ui/editorui.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ui/editorui.js b/src/ui/editorui.js index 75fa9e7..72dd97d 100644 --- a/src/ui/editorui.js +++ b/src/ui/editorui.js @@ -23,7 +23,7 @@ k = btnCmds.length; while (k --) { cmd = btnCmds[k]; - editorui[cmd] = function (cmd){ + editorui[cmd] = (function (cmd){ return function (editor, title){ title = title || defaultLabelMap[cmd.toLowerCase()] || ''; var ui = new editorui.Button({ @@ -45,7 +45,7 @@ }); return ui; }; - }(cmd); + })(cmd); } editorui.Justify = function (editor, side, title){ @@ -102,7 +102,7 @@ k = colorCmds.length; while (k --) { cmd = colorCmds[k]; - editorui[cmd] = function (cmd){ + editorui[cmd] = (function (cmd){ return function (editor, title){ title = title || defaultLabelMap[cmd.toLowerCase()] || ''; var ui = new editorui.ColorButton({ @@ -131,7 +131,7 @@ }); return ui; }; - }(cmd); + })(cmd); } //不需要确定取消按钮的dialog @@ -139,7 +139,7 @@ k = dialogNoButton.length; while(k --){ cmd = dialogNoButton[k]; - editorui[cmd] = function (cmd){ + editorui[cmd] = (function (cmd){ cmd = cmd.toLowerCase(); return function (editor, iframeUrl, title){ iframeUrl = iframeUrl || defaultIframeUrlMap[cmd.toLowerCase()] || 'about:blank'; @@ -179,14 +179,14 @@ }); return ui; }; - }(cmd); + })(cmd); } var dialogCmds = ['Link', 'Image', 'Map', 'Video']; k = dialogCmds.length; while (k --) { cmd = dialogCmds[k]; - editorui[cmd] = function (cmd){ + editorui[cmd] = (function (cmd){ cmd = cmd.toLowerCase(); return function (editor, iframeUrl, title){ iframeUrl = iframeUrl || defaultIframeUrlMap[cmd.toLowerCase()] || 'about:blank'; @@ -242,7 +242,7 @@ }); return ui; }; - }(cmd); + })(cmd); } var FONT_MAP = {