editormd.amd.js
function() {
            var _this               = this;
            var settings            = this.settings;
            
            if (!settings.toolbar || settings.readOnly) {
                return this;
            }
            
            var toolbar             = this.toolbar;
            var cm                  = this.cm;
            var classPrefix         = this.classPrefix;           
            var toolbarIcons        = this.toolbarIcons = toolbar.find("." + classPrefix + "menu > li > a");  
            var toolbarIconHandlers = this.getToolbarHandles();  
                
            toolbarIcons.bind(editormd.mouseOrTouch("click", "touchend"), function(event) {

                var icon                = $(this).children(".fa");
                var name                = icon.attr("name");
                var cursor              = cm.getCursor();
                var selection           = cm.getSelection();

                if (name === "") {
                    return ;
                }
                
                _this.activeIcon = icon;

                if (typeof toolbarIconHandlers[name] !== "undefined") 
                {
                    $.proxy(toolbarIconHandlers[name], _this)(cm);
                }
                else 
                {
                    if (typeof settings.toolbarHandlers[name] !== "undefined") 
                    {
                        $.proxy(settings.toolbarHandlers[name], _this)(cm, icon, cursor, selection);
                    }
                }
                
                if (name !== "link" && name !== "reference-link" && name !== "image" && name !== "code-block" && 
                    name !== "preformatted-text" && name !== "watch" && name !== "preview" && name !== "search" && name !== "fullscreen" && name !== "info") 
                {
                    cm.focus();
                }

                return false;

            });

            return this;
        }
function() {
            var _this               = this;
            var settings            = this.settings;
            
            if (!settings.toolbar || settings.readOnly) {
                return this;
            }
            
            var toolbar             = this.toolbar;
            var cm                  = this.cm;
            var classPrefix         = this.classPrefix;           
            var toolbarIcons        = this.toolbarIcons = toolbar.find("." + classPrefix + "menu > li > a");  
            var toolbarIconHandlers = this.getToolbarHandles();  
                
            toolbarIcons.bind(editormd.mouseOrTouch("click", "touchend"), function(event) {

                var icon                = $(this).children(".fa");
                var name                = icon.attr("name");
                var cursor              = cm.getCursor();
                var selection           = cm.getSelection();

                if (name === "") {
                    return ;
                }
                
                _this.activeIcon = icon;

                if (typeof toolbarIconHandlers[name] !== "undefined") 
                {
                    $.proxy(toolbarIconHandlers[name], _this)(cm);
                }
                else 
                {
                    if (typeof settings.toolbarHandlers[name] !== "undefined") 
                    {
                        $.proxy(settings.toolbarHandlers[name], _this)(cm, icon, cursor, selection);
                    }
                }
                
                if (name !== "link" && name !== "reference-link" && name !== "image" && name !== "code-block" && 
                    name !== "preformatted-text" && name !== "watch" && name !== "preview" && name !== "search" && name !== "fullscreen" && name !== "info") 
                {
                    cm.focus();
                }

                return false;

            });

            return this;
        }
function ( ) { var _this = this ; var settings = this . settings ; if ( ! settings . toolbar || settings . readOnly ) { return this ; } var toolbar = this . toolbar ; var cm = this . cm ; var classPrefix = this . classPrefix ; var toolbarIcons = this . toolbarIcons = toolbar . find ( "." + classPrefix + "menu > li > a" ) ; var toolbarIconHandlers = this . getToolbarHandles ( ) ; toolbarIcons . bind ( editormd . mouseOrTouch ( "click" , "touchend" ) , function ( event ) { var icon = $ ( this ) . children ( ".fa" ) ; var name = icon . attr ( "name" ) ; var cursor = cm . getCursor ( ) ; var selection = cm . getSelection ( ) ; if ( name === "" ) { return ; } _this . activeIcon = icon ; if ( typeof toolbarIconHandlers [ name ] !== "undefined" ) { $ . proxy ( toolbarIconHandlers [ name ] , _this ) ( cm ) ; } else { if ( typeof settings . toolbarHandlers [ name ] !== "undefined" ) { $ . proxy ( settings . toolbarHandlers [ name ] , _this ) ( cm , icon , cursor , selection ) ; } } if ( name !== "link" && name !== "reference-link" && name !== "image" && name !== "code-block" && name !== "preformatted-text" && name !== "watch" && name !== "preview" && name !== "search" && name !== "fullscreen" && name !== "info" ) { cm . focus ( ) ; } return false ; } ) ; return this ; }
工具栏图标事件处理器
Bind toolbar icons event handle

@returns {editormd}  返回editormd的实例对象
工具栏图标事件处理器 Bind toolbar icons event handle