Example #1
0
 }, {listeners:{afterRenderUI:function() {
   var bubble = this, el = bubble.get("contentEl");
   el.html(S.substitute(tipHTML, {label:self.get("label"), prefixCls:prefixCls}));
   var tipUrlEl = el.one("." + prefixCls + "editor-bubble-url"), tipChangeEl = el.one("." + prefixCls + "editor-bubble-change"), tipRemoveEl = el.one("." + prefixCls + "editor-bubble-remove");
   Editor.Utils.preventFocus(el);
   tipChangeEl.on("click", function(ev) {
     self.show(bubble.get("editorSelectedEl"));
     ev.halt()
   });
   tipRemoveEl.on("click", function(ev) {
     if(S.UA.webkit) {
       var r = editor.getSelection().getRanges(), r0 = r && r[0];
       if(r0) {
         r0.collapse(true);
         r0.select()
       }
     }
     bubble.get("editorSelectedEl").remove();
     bubble.hide();
     editor.notifySelectionChange();
     ev.halt()
   });
   bubble.on("show", function() {
     var a = bubble.get("editorSelectedEl");
     if(a) {
       self._updateTip(tipUrlEl, a)
     }
   })
 }}});
Example #2
0
File: cmd.js Project: Xyzal/kissy
  init: function(editor) {
  _$jscoverage['/cmd.js'].functionData[1]++;
  _$jscoverage['/cmd.js'].lineData[14]++;
  addCommand(editor, "outdent");
  _$jscoverage['/cmd.js'].lineData[15]++;
  var queryCmd = Editor.Utils.getQueryCmd("outdent");
  _$jscoverage['/cmd.js'].lineData[16]++;
  if (visit1_16_1(!editor.hasCommand(queryCmd))) {
    _$jscoverage['/cmd.js'].lineData[17]++;
    editor.addCommand(queryCmd, {
  exec: function(editor) {
  _$jscoverage['/cmd.js'].functionData[2]++;
  _$jscoverage['/cmd.js'].lineData[19]++;
  var selection = editor.getSelection();
  _$jscoverage['/cmd.js'].lineData[20]++;
  if (visit2_20_1(selection && !selection.isInvalid)) {
    _$jscoverage['/cmd.js'].lineData[21]++;
    var startElement = selection.getStartElement();
    _$jscoverage['/cmd.js'].lineData[22]++;
    var elementPath = new Editor.ElementPath(startElement);
    _$jscoverage['/cmd.js'].lineData[23]++;
    return checkOutdentActive(elementPath);
  }
}});
  }
}};
 _updateD: function () {
     var self = this,
         editor = self.editor,
         prefixCls = editor.get('prefixCls'),
         f = self.selectedFlash;
     if (f) {
         self._xiamiInput.val(f.attr('title'));
         self._xiamiTitle.html(f.attr('title'));
         self.dAlign.set('value', f.css('float'));
         self.dMargin.val(parseInt(f.style('margin'), 10) || 0);
         self._xiamiUrlWrap.hide();
         self.dialog.get('footer').show();
         self._xiamiTitle.show();
     } else {
         Editor.Utils.resetInput(self._xiamiInput);
         self.dAlign.set('value', 'none');
         self.dMargin.val(MARGIN_DEFAULT);
         self._xiamiUrlWrap.show();
         self.dialog.get('footer').hide();
         self._xiamiTitle.hide();
         self._xiamiSubmit.removeClass(prefixCls + 'editor-button-disabled', undefined);
     }
     self._xiamiaList.hide();
     self._xiamiaList.html('');
 },
Example #4
0
 function getXy(bubble) {
   var el = bubble.get("editorSelectedEl");
   if(!el) {
     return undefined
   }
   var editor = bubble.get("editor"), editorWin = editor.get("window"), iframeXY = editor.get("iframe").offset(), top = iframeXY.top, left = iframeXY.left, right = left + editorWin.width(), bottom = top + editorWin.height();
   var elXY = el.offset();
   elXY = Editor.Utils.getXY(elXY, editor);
   var elTop = elXY.top, elLeft = elXY.left, elRight = elLeft + el.width(), elBottom = elTop + el.height(), x, y;
   if(S.UA.ie && el[0].nodeName.toLowerCase() === "img" && elBottom > bottom) {
     return undefined
   }
   if(elBottom > bottom && elTop < bottom) {
     y = bottom - 30
   }else {
     if(elBottom > top && elBottom < bottom) {
       y = elBottom
     }
   }
   if(elRight > left && elLeft < left) {
     x = left
   }else {
     if(elLeft > left && elLeft < right) {
       x = elLeft
     }
   }
   if(x !== undefined && y !== undefined) {
     return[x, y]
   }
   return undefined
 }
Example #5
0
 return{init:function(editor) {
   if(!editor.hasCommand("heading")) {
     editor.addCommand("heading", {exec:function(editor, tag) {
       var currentValue;
       editor.execCommand("save");
       if(tag !== "p") {
         currentValue = editor.queryCommandValue("heading")
       }
       if(tag === currentValue) {
         tag = "p"
       }
       (new Editor.Style({element:tag})).apply(editor.get("document")[0]);
       editor.execCommand("save")
     }});
     var queryCmd = Editor.Utils.getQueryCmd("heading");
     editor.addCommand(queryCmd, {exec:function(editor) {
       var selection = editor.getSelection();
       if(selection && !selection.isInvalid) {
         var startElement = selection.getStartElement();
         var currentPath = new Editor.ElementPath(startElement);
         var block = currentPath.block || currentPath.blockLimit;
         var nodeName = block && block.nodeName() || "";
         if(nodeName.match(/^h\d$/) || nodeName === "p") {
           return nodeName
         }
       }
     }})
   }
 }}
Example #6
0
File: cmd.js Project: 4simple/kissy
        init: function (editor) {
            if (!editor.hasCommand(insertOrderedList)) {
                editor.addCommand(insertOrderedList, {
                    exec: function (editor, listStyleType) {
                        editor.focus();
                        olCmd.exec(editor, listStyleType);
                    }
                });
            }

            var queryOl = Editor.Utils.getQueryCmd(insertOrderedList);

            if (!editor.hasCommand(queryOl)) {
                editor.addCommand(queryOl, {
                    exec: function (editor) {
                        var selection = editor.getSelection();
                        if (selection && !selection.isInvalid) {
                            var startElement = selection.getStartElement();
                            var elementPath = new Editor.ElementPath(startElement);
                            return queryActive('ol', elementPath);
                        }
                    }
                });
            }
        }
Example #7
0
 function FlashDialog(editor, config) {
     var self = this;
     self.editor = editor;
     self.config = config || {};
     Editor.Utils.lazyRun(self, '_prepareShow', '_realShow');
     self._config();
 }
Example #8
0
 reader.onload = function(ev) {
   var fileName = file.name, fileData = ev.target.result, boundary = "----kissy-editor-yiminghe", xhr = new XMLHttpRequest;
   xhr.open("POST", serverUrl, true);
   xhr.onreadystatechange = function() {
     if(xhr.readyState === 4) {
       if(xhr.status === 200 || xhr.status === 304) {
         if(xhr.responseText !== "") {
           var info = S.parseJson(xhr.responseText);
           img[0].src = info.imgUrl
         }
       }else {
         window.alert("\u670d\u52a1\u5668\u7aef\u51fa\u9519\uff01");
         img.remove()
       }
       xhr.onreadystatechange = null
     }
   };
   var body = "\r\n--" + boundary + "\r\n";
   body += "Content-Disposition: form-data; name='" + fileInput + "'; filename='" + encodeURIComponent(fileName) + "'\r\n";
   body += "Content-Type: " + (file.type || "application/octet-stream") + "\r\n\r\n";
   body += fileData + "\r\n";
   serverParams = Editor.Utils.normParams(serverParams);
   for(var p in serverParams) {
     body += "--" + boundary + "\r\n";
     body += "Content-Disposition: form-data; name='" + p + "'\r\n\r\n";
     body += serverParams[p] + "\r\n"
   }
   body += "--" + boundary + "--";
   xhr.setRequestHeader("Content-Type", "multipart/form-data, boundary=" + boundary);
   xhr.sendAsBinary("Content-Type: multipart/form-data; boundary=" + boundary + "\r\nContent-Length: " + body.length + "\r\n" + body + "\r\n");
   reader.onload = null
 };
Example #9
0
 _gen: function (ev) {
     if (ev) {
         ev.halt();
     }
     var self = this,
         editor = self.editor,
         dinfo = self._getDInfo(),
         url = dinfo && S.trim(dinfo.url),
         attrs = dinfo && dinfo.attrs;
     if (!dinfo) {
         return;
     }
     var re = Editor.Utils.verifyInputs(self.dialog.get('el').all('input'));
     if (!re) {
         return;
     }
     self.dialog.hide();
     var substitute = flashUtils.insertFlash(editor, url, attrs, self._cls, self._type);
     //如果是修改,就再选中
     if (self.selectedFlash) {
         editor.getSelection()
             .selectElement(substitute);
     }
     editor.notifySelectionChange();
 },
Example #10
0
        _initD: function () {
            var self = this,
                d = self.dialog,
                editor = self.editor,
                prefixCls = editor.get('prefixCls'),
                el = d.get('el');
            self.dHeight = el.one('.' + prefixCls + 'editor-flash-height');
            self.dWidth = el.one('.' + prefixCls + 'editor-flash-width');
            self.dUrl = el.one('.' + prefixCls + 'editor-flash-url');
            self.dAlign = MenuButton.Select.decorate(el.one('.' + prefixCls +
                'editor-flash-align'), {
                prefixCls: prefixCls + 'editor-big-',
                width: 80,
                menuCfg: {
                    prefixCls: prefixCls + 'editor-',
                    render: el
                }
            });
            self.dMargin = el.one('.' + prefixCls + 'editor-flash-margin');
            var action = el.one('.' + prefixCls + 'editor-flash-ok'),
                cancel = el.one('.' + prefixCls + 'editor-flash-cancel');
            action.on('click', self._gen, self);
            cancel.on('click', function (ev) {
                d.hide();
                ev.halt();
            });

            Editor.Utils.placeholder(self.dUrl, self._urlTip);
            self.addRes(self.dAlign);
        },
Example #11
0
 }, _real:function() {
   var self = this, cfg = self.config, d = self.dialog, _selectedEl = self._selectedEl;
   if(_selectedEl) {
     var url = _selectedEl.attr(savedHref) || _selectedEl.attr("href");
     Editor.Utils.valInput(d.urlEl, url);
     d.urlTitle.val(_selectedEl.attr("title") || "");
     d.targetEl[0].checked = _selectedEl.attr("target") === "_blank"
   }else {
     Editor.Utils.resetInput(d.urlEl);
     d.urlTitle.val("");
     if(cfg.target) {
       d.targetEl[0].checked = true
     }
   }
   d.show()
 }, show:function(_selectedEl) {
Example #12
0
 S.augment(ElementPaths, {_init:function() {
   var self = this, cfg = self.cfg, editor = cfg.editor;
   self.holder = new Node("<span>");
   self.holder.appendTo(editor.get("statusBarEl"), undefined);
   editor.on("selectionChange", self._selectionChange, self);
   Editor.Utils.sourceDisable(editor, self)
 }, disable:function() {
    function showNow(ev) {
        var t = $(ev.target);

        // ie 右键作用中,不会发生焦点转移,光标移动
        // 只能右键作用完后才能,才会发生光标移动,range变化
        // 异步右键操作
        // qc #3764,#3767
        var x = ev.pageX,
            y = ev.pageY;
        if (!x) {
            return;
        } else {
            var translate = Editor.Utils.getXY({
                left: x,
                top: y
            }, self);
            x = translate.left;
            y = translate.top;
        }
        setTimeout(function () {
            menu.set('editorSelectedEl', t, {
                silent: 1
            });
            menu.move(x, y);
            self.fire('contextmenu', {
                contextmenu: menu
            });
            menu.show();
            window.focus();
            document.body.focus();
            // 防止焦点一直在 el,focus 无效
            menu.focus();
        }, 30);
    }
Example #14
0
 editor.addBubble("image", checkImg, {listeners:{afterRenderUI:function() {
   var bubble = this, el = bubble.get("contentEl");
   el.html(S.substitute(tipHTML, {prefixCls:prefixCls}));
   var tipUrlEl = el.one("." + prefixCls + "editor-bubble-url"), tipChangeEl = el.one("." + prefixCls + "editor-bubble-change"), tipRemoveEl = el.one("." + prefixCls + "editor-bubble-remove");
   Editor.Utils.preventFocus(el);
   tipChangeEl.on("click", function(ev) {
     showImageEditor(bubble.get("editorSelectedEl"));
     ev.halt()
   });
   tipRemoveEl.on("click", function(ev) {
     if(UA.webkit) {
       var r = editor.getSelection().getRanges();
       if(r && r[0]) {
         r[0].collapse();
         r[0].select()
       }
     }
     bubble.get("editorSelectedEl").remove();
     bubble.hide();
     editor.notifySelectionChange();
     ev.halt()
   });
   bubble.on("show", function() {
     var a = bubble.get("editorSelectedEl");
     if(a) {
       var src = a.attr("_keSaved_src") || a.attr("src");
       tipUrlEl.attr("href", src)
     }
   })
 }}})
Example #15
0
        addCommand: function (editor, command, textAlign) {
            if (!editor.hasCommand(command)) {

                editor.addCommand(command, {
                    exec: function (editor) {
                        exec(editor, textAlign);
                    }
                });

                editor.addCommand(Editor.Utils.getQueryCmd(command), {
                    exec: function (editor) {
                        var selection = editor.getSelection();
                        if (selection && !selection.isInvalid) {
                            var startElement = selection.getStartElement();
                            var path = new Editor.ElementPath(startElement);
                            var block = path.block || path.blockLimit;
                            if (!block || block.nodeName() === 'body') {
                                return false;
                            }
                            return isAlign(block, textAlign);
                        }
                    }
                });

            }
        }
Example #16
0
 function getSelectedCells(selection) {
   var bookmarks = selection.createBookmarks(), ranges = selection.getRanges(), retval = [], database = {};
   function moveOutOfCellGuard(node) {
     if(retval.length > 0) {
       return
     }
     if(node[0].nodeType === Dom.NodeType.ELEMENT_NODE && cellNodeRegex.test(node.nodeName()) && !node.data("selected_cell")) {
       node._4eSetMarker(database, "selected_cell", true, undefined);
       retval.push(node)
     }
   }
   for(var i = 0;i < ranges.length;i++) {
     var range = ranges[i];
     if(range.collapsed) {
       var startNode = range.getCommonAncestor(), nearestCell = startNode.closest("td", undefined) || startNode.closest("th", undefined);
       if(nearestCell) {
         retval.push(nearestCell)
       }
     }else {
       var walker = new Walker(range), node;
       walker.guard = moveOutOfCellGuard;
       while(node = walker.next()) {
         var parent = node.parent();
         if(parent && cellNodeRegex.test(parent.nodeName()) && !parent.data("selected_cell")) {
           parent._4eSetMarker(database, "selected_cell", true, undefined);
           retval.push(parent)
         }
       }
     }
   }
   Editor.Utils.clearAllMarkers(database);
   selection.selectBookmarks(bookmarks);
   return retval
 }
Example #17
0
        _tableOk: function (ev) {
            ev.halt();
            var self = this,
                tableDialog = self.dialog,
                inputs = tableDialog.get('el').all('input');

            if (tableDialog.twidthunit.get('value') === '%') {
                var tw = parseInt(tableDialog.twidth.val(),10);
                if (
                    !tw || (
                        tw > 100 ||
                            tw < 0
                        )
                    ) {
                    alert('宽度百分比:' + '请输入1-100之间');
                    return;
                }
            }
            var re = Editor.Utils.verifyInputs(inputs);
            if (!re) {
                return;
            }
            self.dialog.hide();
            setTimeout(function () {
                if (!self.selectedTable) {
                    self._genTable();
                } else {
                    self._modifyTable();
                }
            }, 0);
        },
Example #18
0
 _init: function () {
     var self = this, cfg = self.cfg, editor = cfg.editor;
     self.holder = $('<span>');
     self.holder.appendTo(editor.get('statusBarEl'), undefined);
     editor.on('selectionChange', self._selectionChange, self);
     Editor.Utils.sourceDisable(editor, self);
 },
 _prepareShow: function () {
     var self = this,
         editor = self.editor,
         prefixCls = editor.get('prefixCls'),
         d = new Dialog4E({
             width: 500,
             headerContent: '链接',
             bodyContent: util.substitute(bodyHTML, {
                 prefixCls: prefixCls
             }),
             footerContent: util.substitute(footHTML, {
                 prefixCls: prefixCls
             }),
             mask: true
         }).render();
     self.dialog = d;
     var body = d.get('body'),
         foot = d.get('footer');
     d.urlEl = body.one('.' + prefixCls + 'editor-link-url');
     d.urlTitle = body.one('.' + prefixCls + 'editor-link-title');
     d.targetEl = body.one('.' + prefixCls + 'editor-link-blank');
     var cancel = foot.one('.' + prefixCls + 'editor-link-cancel'),
         ok = foot.one('.' + prefixCls + 'editor-link-ok');
     ok.on('click', self._link, self);
     cancel.on('click', function (ev) {
         ev.halt();
         d.hide();
     });
     Editor.Utils.placeholder(d.urlEl, 'http://');
 },
Example #20
0
 afterRenderUI: function () {
     var bubble = this, el = bubble.get('contentEl');
     el.html(util.substitute(tipHTML, { prefixCls: prefixCls }));
     var tipUrlEl = el.one('.' + prefixCls + 'editor-bubble-url'), tipChangeEl = el.one('.' + prefixCls + 'editor-bubble-change'), tipRemoveEl = el.one('.' + prefixCls + 'editor-bubble-remove');
     Editor.Utils.preventFocus(el);
     tipChangeEl.on('click', function (ev) {
         showImageEditor(bubble.get('editorSelectedEl'));
         ev.halt();
     });
     tipRemoveEl.on('click', function (ev) {
         if (UA.webkit) {
             var r = editor.getSelection().getRanges();
             if (r && r[0]) {
                 r[0].collapse();
                 r[0].select();
             }
         }
         bubble.get('editorSelectedEl').remove();
         bubble.hide();
         editor.notifySelectionChange();
         ev.halt();
     });
     bubble.on('show', function () {
         var a = bubble.get('editorSelectedEl');
         if (a) {
             var src = a.attr('_ke_saved_src') || a.attr('src');
             tipUrlEl.attr('href', src);
         }
     });
 }
Example #21
0
 _real: function () {
     var self = this, cfg = self.config, d = self.dialog, _selectedEl = self._selectedEl;    //是修改行为
     //是修改行为
     if (_selectedEl) {
         var url = _selectedEl.attr(savedHref) || _selectedEl.attr('href');
         Editor.Utils.valInput(d.urlEl, url);
         d.urlTitle.val(_selectedEl.attr('title') || '');
         d.targetEl[0].checked = _selectedEl.attr('target') === '_blank';
     } else {
         Editor.Utils.resetInput(d.urlEl);
         d.urlTitle.val('');
         if (cfg.target) {
             d.targetEl[0].checked = true;
         }
     }
     d.show();
 },
Example #22
0
    reader.onload = function(ev) {
  _$jscoverage['/drag-upload.js'].functionData[10]++;
  _$jscoverage['/drag-upload.js'].lineData[122]++;
  var fileName = file.name, fileData = ev.target.result, boundary = '----kissy-editor-yiminghe', xhr = new XMLHttpRequest();
  _$jscoverage['/drag-upload.js'].lineData[127]++;
  xhr.open('POST', serverUrl, true);
  _$jscoverage['/drag-upload.js'].lineData[128]++;
  xhr.onreadystatechange = function() {
  _$jscoverage['/drag-upload.js'].functionData[11]++;
  _$jscoverage['/drag-upload.js'].lineData[129]++;
  if (visit22_129_1(xhr.readyState === 4)) {
    _$jscoverage['/drag-upload.js'].lineData[130]++;
    if (visit23_130_1(visit24_130_2(xhr.status === 200) || visit25_130_3(xhr.status === 304))) {
      _$jscoverage['/drag-upload.js'].lineData[131]++;
      if (visit26_131_1(xhr.responseText !== '')) {
        _$jscoverage['/drag-upload.js'].lineData[132]++;
        var info = S.parseJson(xhr.responseText);
        _$jscoverage['/drag-upload.js'].lineData[133]++;
        img[0].src = info.imgUrl;
      }
    } else {
      _$jscoverage['/drag-upload.js'].lineData[136]++;
      window.alert('\u670d\u52a1\u5668\u7aef\u51fa\u9519\uff01');
      _$jscoverage['/drag-upload.js'].lineData[137]++;
      img.remove();
    }
    _$jscoverage['/drag-upload.js'].lineData[139]++;
    xhr.onreadystatechange = null;
  }
};
  _$jscoverage['/drag-upload.js'].lineData[143]++;
  var body = '\r\n--' + boundary + '\r\n';
  _$jscoverage['/drag-upload.js'].lineData[144]++;
  body += 'Content-Disposition: form-data; name=\'' + fileInput + '\'; filename=\'' + encodeURIComponent(fileName) + '\'\r\n';
  _$jscoverage['/drag-upload.js'].lineData[146]++;
  body += 'Content-Type: ' + (visit27_146_1(file.type || 'application/octet-stream')) + '\r\n\r\n';
  _$jscoverage['/drag-upload.js'].lineData[147]++;
  body += fileData + '\r\n';
  _$jscoverage['/drag-upload.js'].lineData[148]++;
  serverParams = Editor.Utils.normParams(serverParams);
  _$jscoverage['/drag-upload.js'].lineData[149]++;
  for (var p in serverParams) {
    _$jscoverage['/drag-upload.js'].lineData[151]++;
    body += '--' + boundary + '\r\n';
    _$jscoverage['/drag-upload.js'].lineData[152]++;
    body += 'Content-Disposition: form-data; name=\'' + p + '\'\r\n\r\n';
    _$jscoverage['/drag-upload.js'].lineData[154]++;
    body += serverParams[p] + '\r\n';
  }
  _$jscoverage['/drag-upload.js'].lineData[157]++;
  body += '--' + boundary + '--';
  _$jscoverage['/drag-upload.js'].lineData[159]++;
  xhr.setRequestHeader('Content-Type', 'multipart/form-data, boundary=' + boundary);
  _$jscoverage['/drag-upload.js'].lineData[163]++;
  xhr.sendAsBinary('Content-Type: multipart/form-data; boundary=' + boundary + '\r\nContent-Length: ' + body.length + '\r\n' + body + '\r\n');
  _$jscoverage['/drag-upload.js'].lineData[165]++;
  reader.onload = null;
};
Example #23
0
  afterRenderUI: function() {
  _$jscoverage['/image.js'].functionData[13]++;
  _$jscoverage['/image.js'].lineData[126]++;
  var bubble = this, el = bubble.get('contentEl');
  _$jscoverage['/image.js'].lineData[128]++;
  el.html(S.substitute(tipHTML, {
  prefixCls: prefixCls}));
  _$jscoverage['/image.js'].lineData[131]++;
  var tipUrlEl = el.one('.' + prefixCls + 'editor-bubble-url'), tipChangeEl = el.one('.' + prefixCls + 'editor-bubble-change'), tipRemoveEl = el.one('.' + prefixCls + 'editor-bubble-remove');
  _$jscoverage['/image.js'].lineData[134]++;
  Editor.Utils.preventFocus(el);
  _$jscoverage['/image.js'].lineData[135]++;
  tipChangeEl.on('click', function(ev) {
  _$jscoverage['/image.js'].functionData[14]++;
  _$jscoverage['/image.js'].lineData[136]++;
  showImageEditor(bubble.get('editorSelectedEl'));
  _$jscoverage['/image.js'].lineData[137]++;
  ev.halt();
});
  _$jscoverage['/image.js'].lineData[139]++;
  tipRemoveEl.on('click', function(ev) {
  _$jscoverage['/image.js'].functionData[15]++;
  _$jscoverage['/image.js'].lineData[140]++;
  if (visit8_140_1(UA.webkit)) {
    _$jscoverage['/image.js'].lineData[141]++;
    var r = editor.getSelection().getRanges();
    _$jscoverage['/image.js'].lineData[142]++;
    if (visit9_142_1(r && r[0])) {
      _$jscoverage['/image.js'].lineData[143]++;
      r[0].collapse();
      _$jscoverage['/image.js'].lineData[144]++;
      r[0].select();
    }
  }
  _$jscoverage['/image.js'].lineData[147]++;
  bubble.get('editorSelectedEl').remove();
  _$jscoverage['/image.js'].lineData[148]++;
  bubble.hide();
  _$jscoverage['/image.js'].lineData[149]++;
  editor.notifySelectionChange();
  _$jscoverage['/image.js'].lineData[150]++;
  ev.halt();
});
  _$jscoverage['/image.js'].lineData[152]++;
  bubble.on('show', function() {
  _$jscoverage['/image.js'].functionData[16]++;
  _$jscoverage['/image.js'].lineData[153]++;
  var a = bubble.get('editorSelectedEl');
  _$jscoverage['/image.js'].lineData[154]++;
  if (visit10_154_1(a)) {
    _$jscoverage['/image.js'].lineData[155]++;
    var src = visit11_155_1(a.attr('_keSaved_src') || a.attr('src'));
    _$jscoverage['/image.js'].lineData[156]++;
    tipUrlEl.attr('href', src);
  }
});
}}});
Example #24
0
 }, _initD:function() {
   var self = this, d = self.dialog, editor = self.editor, prefixCls = editor.get("prefixCls"), el = d.get("el");
   self.dUrl = el.one("." + prefixCls + "editor-video-url");
   self.dAlign = MenuButton.Select.decorate(el.one("." + prefixCls + "editor-video-align"), {prefixCls:prefixCls + "editor-big-", width:80, menuCfg:{prefixCls:prefixCls + "editor-", render:el}});
   self.dMargin = el.one("." + prefixCls + "editor-video-margin");
   self.dWidth = el.one("." + prefixCls + "editor-video-width");
   self.dHeight = el.one("." + prefixCls + "editor-video-height");
   var action = el.one("." + prefixCls + "editor-video-ok"), cancel = el.one("." + prefixCls + "editor-video-cancel");
   action.on("click", self._gen, self);
   cancel.on("click", function(ev) {
     d.hide();
     ev.halt()
   });
   Editor.Utils.placeholder(self.dUrl, self._urlTip);
   Editor.Utils.placeholder(self.dWidth, DTIP);
   Editor.Utils.placeholder(self.dHeight, DTIP);
   self.addRes(self.dAlign)
 }, _getDInfo:function() {
Example #25
0
  afterRenderUI: function() {
  _$jscoverage['/base-class.js'].functionData[5]++;
  _$jscoverage['/base-class.js'].lineData[58]++;
  var bubble = this, el = bubble.get('contentEl');
  _$jscoverage['/base-class.js'].lineData[60]++;
  el.html(S.substitute(tipHTML, {
  label: self.get('label'), 
  prefixCls: prefixCls}));
  _$jscoverage['/base-class.js'].lineData[64]++;
  var tipUrlEl = el.one('.' + prefixCls + 'editor-bubble-url'), tipChangeEl = el.one('.' + prefixCls + 'editor-bubble-change'), tipRemoveEl = el.one('.' + prefixCls + 'editor-bubble-remove');
  _$jscoverage['/base-class.js'].lineData[69]++;
  Editor.Utils.preventFocus(el);
  _$jscoverage['/base-class.js'].lineData[71]++;
  tipChangeEl.on('click', function(ev) {
  _$jscoverage['/base-class.js'].functionData[6]++;
  _$jscoverage['/base-class.js'].lineData[73]++;
  self.show(bubble.get('editorSelectedEl'));
  _$jscoverage['/base-class.js'].lineData[74]++;
  ev.halt();
});
  _$jscoverage['/base-class.js'].lineData[77]++;
  tipRemoveEl.on('click', function(ev) {
  _$jscoverage['/base-class.js'].functionData[7]++;
  _$jscoverage['/base-class.js'].lineData[79]++;
  if (visit3_79_1(S.UA.webkit)) {
    _$jscoverage['/base-class.js'].lineData[80]++;
    var r = editor.getSelection().getRanges(), r0 = visit4_81_1(r && r[0]);
    _$jscoverage['/base-class.js'].lineData[82]++;
    if (visit5_82_1(r0)) {
      _$jscoverage['/base-class.js'].lineData[83]++;
      r0.collapse(true);
      _$jscoverage['/base-class.js'].lineData[84]++;
      r0.select();
    }
  }
  _$jscoverage['/base-class.js'].lineData[87]++;
  bubble.get('editorSelectedEl').remove();
  _$jscoverage['/base-class.js'].lineData[88]++;
  bubble.hide();
  _$jscoverage['/base-class.js'].lineData[89]++;
  editor.notifySelectionChange();
  _$jscoverage['/base-class.js'].lineData[90]++;
  ev.halt();
});
  _$jscoverage['/base-class.js'].lineData[96]++;
  bubble.on('show', function() {
  _$jscoverage['/base-class.js'].functionData[8]++;
  _$jscoverage['/base-class.js'].lineData[97]++;
  var a = bubble.get('editorSelectedEl');
  _$jscoverage['/base-class.js'].lineData[98]++;
  if (visit6_98_1(a)) {
    _$jscoverage['/base-class.js'].lineData[99]++;
    self._updateTip(tipUrlEl, a);
  }
});
}}});
Example #26
0
File: cmd.js Project: 4simple/kissy
  init: function(editor) {
  _$jscoverage['/cmd.js'].functionData[1]++;
  _$jscoverage['/cmd.js'].lineData[13]++;
  if (visit1_13_1(!editor.hasCommand('heading'))) {
    _$jscoverage['/cmd.js'].lineData[14]++;
    editor.addCommand('heading', {
  exec: function(editor, tag) {
  _$jscoverage['/cmd.js'].functionData[2]++;
  _$jscoverage['/cmd.js'].lineData[16]++;
  var currentValue;
  _$jscoverage['/cmd.js'].lineData[17]++;
  editor.execCommand('save');
  _$jscoverage['/cmd.js'].lineData[18]++;
  if (visit2_18_1(tag !== 'p')) {
    _$jscoverage['/cmd.js'].lineData[19]++;
    currentValue = editor.queryCommandValue('heading');
  }
  _$jscoverage['/cmd.js'].lineData[21]++;
  if (visit3_21_1(tag === currentValue)) {
    _$jscoverage['/cmd.js'].lineData[22]++;
    tag = 'p';
  }
  _$jscoverage['/cmd.js'].lineData[24]++;
  new Editor.Style({
  element: tag}).apply(editor.get('document')[0]);
  _$jscoverage['/cmd.js'].lineData[27]++;
  editor.execCommand('save');
}});
    _$jscoverage['/cmd.js'].lineData[31]++;
    var queryCmd = Editor.Utils.getQueryCmd('heading');
    _$jscoverage['/cmd.js'].lineData[33]++;
    editor.addCommand(queryCmd, {
  exec: function(editor) {
  _$jscoverage['/cmd.js'].functionData[3]++;
  _$jscoverage['/cmd.js'].lineData[35]++;
  var selection = editor.getSelection();
  _$jscoverage['/cmd.js'].lineData[36]++;
  if (visit4_36_1(selection && !selection.isInvalid)) {
    _$jscoverage['/cmd.js'].lineData[37]++;
    var startElement = selection.getStartElement();
    _$jscoverage['/cmd.js'].lineData[38]++;
    var currentPath = new Editor.ElementPath(startElement);
    _$jscoverage['/cmd.js'].lineData[39]++;
    var block = visit5_39_1(currentPath.block || currentPath.blockLimit);
    _$jscoverage['/cmd.js'].lineData[40]++;
    var nodeName = visit6_40_1(visit7_40_2(block && block.nodeName()) || '');
    _$jscoverage['/cmd.js'].lineData[41]++;
    if (visit8_41_1(nodeName.match(/^h\d$/) || visit9_41_2(nodeName === 'p'))) {
      _$jscoverage['/cmd.js'].lineData[42]++;
      return nodeName;
    }
  }
}});
  }
}};
Example #27
0
  _updateD: function() {
  _$jscoverage['/dialog.js'].functionData[6]++;
  _$jscoverage['/dialog.js'].lineData[132]++;
  var self = this, editor = self.editor, cfg = self.config, f = self.selectedFlash;
  _$jscoverage['/dialog.js'].lineData[136]++;
  if (visit3_136_1(f)) {
    _$jscoverage['/dialog.js'].lineData[137]++;
    var r = editor.restoreRealElement(f);
    _$jscoverage['/dialog.js'].lineData[138]++;
    if (visit4_138_1(!r)) {
      _$jscoverage['/dialog.js'].lineData[139]++;
      return;
    }
    _$jscoverage['/dialog.js'].lineData[141]++;
    if (visit5_141_1(f.css("width"))) {
      _$jscoverage['/dialog.js'].lineData[142]++;
      self.dWidth.val(parseInt(f.css("width")));
    }
    _$jscoverage['/dialog.js'].lineData[144]++;
    if (visit6_144_1(f.css("height"))) {
      _$jscoverage['/dialog.js'].lineData[145]++;
      self.dHeight.val(parseInt(f.css("height")));
    }
    _$jscoverage['/dialog.js'].lineData[147]++;
    self.dAlign.set("value", f.css("float"));
    _$jscoverage['/dialog.js'].lineData[148]++;
    Editor.Utils.valInput(self.dUrl, self._getFlashUrl(r));
    _$jscoverage['/dialog.js'].lineData[149]++;
    self.dMargin.val(visit7_149_1(parseInt(r.style("margin")) || 0));
  } else {
    _$jscoverage['/dialog.js'].lineData[151]++;
    Editor.Utils.resetInput(self.dUrl);
    _$jscoverage['/dialog.js'].lineData[152]++;
    self.dWidth.val(visit8_152_1(cfg['defaultWidth'] || ""));
    _$jscoverage['/dialog.js'].lineData[153]++;
    self.dHeight.val(visit9_153_1(cfg['defaultHeight'] || ""));
    _$jscoverage['/dialog.js'].lineData[154]++;
    self.dAlign.set("value", "none");
    _$jscoverage['/dialog.js'].lineData[155]++;
    self.dMargin.val("5");
  }
}, 
Example #28
0
 function LinkDialog(editor, config) {
   _$jscoverage['/dialog.js'].functionData[1]++;
   _$jscoverage['/dialog.js'].lineData[52]++;
   var self = this;
   _$jscoverage['/dialog.js'].lineData[53]++;
   self.editor = editor;
   _$jscoverage['/dialog.js'].lineData[54]++;
   self.config = visit1_54_1(config || {});
   _$jscoverage['/dialog.js'].lineData[55]++;
   Editor.Utils.lazyRun(self, '_prepareShow', '_real');
 }
Example #29
0
 ok.on("click", function(ev) {
   ev.halt();
   if((self.imageCfg.remote === false || S.indexOf(self.tab.getSelectedTab(), self.tab.getTabs()) === 1) && self.cfg) {
     if(!verifyInputs(commonSettingTable.all("input"))) {
       return
     }
     if(self.imgLocalUrl.val() === warning) {
       alert("\u8bf7\u5148\u9009\u62e9\u6587\u4ef6!");
       return
     }
     if(!self.suffixReg.test(self.imgLocalUrl.val())) {
       alert(self.suffixWarning);
       self.uploadForm[0].reset();
       self.imgLocalUrl.val(warning);
       return
     }
     var size = getFileSize(self.fileInput[0]);
     if(sizeLimit && sizeLimit < size / 1E3) {
       alert("\u4e0a\u4f20\u56fe\u7247\u6700\u5927\uff1a" + sizeLimit / 1E3 + "M");
       return
     }
     self.d.loading();
     loadingCancel.on("click", function(ev) {
       ev.halt();
       uploadIO.abort()
     });
     var serverParams = Editor.Utils.normParams(self.cfg.serverParams) || {};
     serverParams["document-domain"] = document.domain;
     var uploadIO = IO({data:serverParams, url:self.cfg.serverUrl, form:self.uploadForm[0], dataType:"json", type:"post", complete:function(data, status) {
       loadingCancel.css({left:-9999, top:-9999});
       self.d.unloading();
       if(status === "abort") {
         return
       }
       if(!data) {
         data = {error:"\u670d\u52a1\u5668\u51fa\u9519\uff0c\u8bf7\u91cd\u8bd5"}
       }
       if(data.error) {
         alert(data.error);
         return
       }
       valInput(self.imgUrl, data.imgUrl);
       (new Image).src = data.imgUrl;
       self._insert()
     }});
     var loadingMaskEl = self.d.get("el"), offset = loadingMaskEl.offset(), width = loadingMaskEl[0].offsetWidth, height = loadingMaskEl[0].offsetHeight;
     loadingCancel.css({left:offset.left + width / 2.5, top:offset.top + height / 1.5})
   }else {
     if(!verifyInputs(content.all("input"))) {
       return
     }
     self._insert()
   }
 });
Example #30
0
 }, _link:function(ev) {
   ev.halt();
   var self = this, d = self.dialog, url = d.urlEl.val();
   if(!Editor.Utils.verifyInputs(d.get("el").all("input"))) {
     return
   }
   d.hide();
   var attr = {href:url, target:d.targetEl[0].checked ? "_blank" : "_self", title:S.trim(d.urlTitle.val())};
   setTimeout(function() {
     Utils.applyLink(self.editor, attr, self._selectedEl)
   }, 0)
 }, _real:function() {