code: function(iframeWin, iframe, textArea, set){
      var iframeDOM = iframeWin.document, body = $(iframeDOM.body);
      body.on('keydown', function(e){
        var keycode = e.keyCode;
        //处理回车
        if(keycode === 13){
          var range = Range(iframeDOM);
          var container = getContainer(range)
          ,parentNode = container.parentNode;
          
          if(parentNode.tagName.toLowerCase() === 'pre'){
            if(e.shiftKey) return
            layer.msg('请暂时用shift+enter');
            return false;
          }
          iframeDOM.execCommand('formatBlock', false, '<p>');
        }
      });
      
      //给textarea同步内容
      $(textArea).parents('form').on('submit', function(){
        var html = body.html();
        //IE8下将标签处理成小写
        if(device.ie == 8){
          html = html.replace(/<.+>/g, function(str){
            return str.toLowerCase();
          });
        }
        textArea.value = html;
      });
      
      //处理粘贴
      body.on('paste', function(e){
        iframeDOM.execCommand('formatBlock', false, '<p>');
        setTimeout(function(){
          filter.call(iframeWin, body);
          textArea.value = body.html();
        }, 100); 
      });
    }
docs: iframe初始化