Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
//' ',
//' '
].join('');
}
else {
return d;
}
}
function Draft(editor, config) {
this.editor = editor;
this.config = config;
this._init();
}
var addRes = Editor.Utils.addRes,
destroyRes = Editor.Utils.destroyRes;
util.augment(Draft, {
_getSaveKey: function () {
var self = this,
cfg = self.config;
return cfg.draft && cfg.draft.saveKey || DRAFT_SAVE;
},
// parse 历史记录延后,点击 select 时才开始 parse
_getDrafts: function () {
var self = this;
if (!self.drafts) {
var str = localStorage.getItem(self._getSaveKey()),
drafts = [];
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(); // ie 中途设置 domain 后,不能获取 window 的相关属性
// 例如 window.frameEl
// 所以不能直接用 el.offset(undefined,window);
// ie 中途设置 domain 后,不能获取 window 的相关属性
// 例如 window.frameEl
// 所以不能直接用 el.offset(undefined,window);
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; // ie 图片缩放框大于编辑区域底部,bubble 点击不了了,干脆不显示
// ie 图片缩放框大于编辑区域底部,bubble 点击不了了,干脆不显示
if (UA.ie && el[0].nodeName.toLowerCase() === 'img' && elBottom > bottom) {
return undefined;
} // 对其下边
// el 位于编辑区域,下边界超了编辑区域下边界
// 对其下边
// el 位于编辑区域,下边界超了编辑区域下边界
if (elBottom > bottom && elTop < bottom) {
// 别挡着滚动条
y = bottom - 30;
} // el bottom 在编辑区域内
else // el bottom 在编辑区域内
if (elBottom > top && elBottom < bottom) {
y = elBottom;
} // 同上,对齐左边
function () {
var bubble = this,
el = bubble.get('contentEl');
el.html(util.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');
// ie focus not lose
Editor.Utils.preventFocus(el);
tipChangeEl.on('click', function (ev) {
// 回调show,传入选中元素
self.show(bubble.get('editorSelectedEl'));
ev.halt();
});
tipRemoveEl.on('click', function (ev) {
// chrome remove 后会没有焦点
if (UA.webkit) {
var r = editor.getSelection().getRanges(),
r0 = r && r[0];
if (r0) {
r0.collapse(true);
r0.select();
}
KISSY.add("editor/plugin/drag-upload", ["editor", "event"], function(S, require) {
var Editor = require("editor");
var Event = require("event");
var Node = S.Node, Utils = Editor.Utils, Dom = S.require("dom");
function dragUpload(config) {
this.config = config || {}
}
S.augment(dragUpload, {pluginRenderUI:function(editor) {
var cfg = this.config, fileInput = cfg.fileInput || "Filedata", sizeLimit = cfg.sizeLimit || Number.MAX_VALUE, serverParams = cfg.serverParams || {}, serverUrl = cfg.serverUrl || "", suffix = cfg.suffix || "png,jpg,jpeg,gif", suffixReg = new RegExp(suffix.split(/,/).join("|") + "$", "i"), inserted = {}, startMonitor = false;
function nodeInsert(ev) {
var oe = ev.originalEvent, t = oe.target;
if(Dom.nodeName(t) === "img" && t.src.match(/^file:\/\//)) {
inserted[t.src] = t
}
}
editor.docReady(function() {
var document = editor.get("document")[0];
Event.on(document, "dragenter", function() {
if(!startMonitor) {
Event.on(document, "DOMNodeInserted", nodeInsert);
_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) {
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);
}
}
});
}
}
};
var Editor = require('editor');
_$jscoverage['/local-storage.js'].lineData[8]++;
var Overlay = require('overlay');
_$jscoverage['/local-storage.js'].lineData[9]++;
var FlashBridge = require('./flash-bridge');
_$jscoverage['/local-storage.js'].lineData[10]++;
var util = require('util');
_$jscoverage['/local-storage.js'].lineData[11]++;
var ie = require('ua').ieMode;
_$jscoverage['/local-storage.js'].lineData[15]++;
if (visit1_15_1((visit2_15_2(!ie || visit3_15_3(ie > 8))) && window.localStorage)) {
_$jscoverage['/local-storage.js'].lineData[17]++;
return window.localStorage;
}
_$jscoverage['/local-storage.js'].lineData[21]++;
var swfSrc = Editor.Utils.debugUrl('plugin/local-storage/assets/swfstore.swf?t=' + (+new Date()));
_$jscoverage['/local-storage.js'].lineData[23]++;
var css = {
width: 215,
border: '1px solid red'}, reverseCss = {
width: 0,
border: 'none'};
_$jscoverage['/local-storage.js'].lineData[32]++;
var o = new Overlay({
prefixCls: 'ks-editor-',
elStyle: {
background: 'white'},
width: '0px',
content: '<h1 style="' + 'text-align:center;">\u8bf7\u70b9\u51fb\u5141\u8bb8</h1>' + '<div class="storage-container"></div>',
zIndex: Editor.baseZIndex(Editor.ZIndexManager.STORE_FLASH_SHOW)});
_$jscoverage['/local-storage.js'].lineData[42]++;
o.render();
init: function(editor) {
_$jscoverage['/cmd.js'].functionData[1]++;
_$jscoverage['/cmd.js'].lineData[17]++;
if (visit1_17_1(!editor.hasCommand(insertOrderedList))) {
_$jscoverage['/cmd.js'].lineData[18]++;
editor.addCommand(insertOrderedList, {
exec: function(editor, listStyleType) {
_$jscoverage['/cmd.js'].functionData[2]++;
_$jscoverage['/cmd.js'].lineData[20]++;
editor.focus();
_$jscoverage['/cmd.js'].lineData[21]++;
olCmd.exec(editor, listStyleType);
}});
}
_$jscoverage['/cmd.js'].lineData[26]++;
var queryOl = Editor.Utils.getQueryCmd(insertOrderedList);
_$jscoverage['/cmd.js'].lineData[28]++;
if (visit2_28_1(!editor.hasCommand(queryOl))) {
_$jscoverage['/cmd.js'].lineData[29]++;
editor.addCommand(queryOl, {
exec: function(editor) {
_$jscoverage['/cmd.js'].functionData[3]++;
_$jscoverage['/cmd.js'].lineData[31]++;
var selection = editor.getSelection();
_$jscoverage['/cmd.js'].lineData[32]++;
if (visit3_32_1(selection && !selection.isInvalid)) {
_$jscoverage['/cmd.js'].lineData[33]++;
var startElement = selection.getStartElement();
_$jscoverage['/cmd.js'].lineData[34]++;
var elementPath = new Editor.ElementPath(startElement);
_$jscoverage['/cmd.js'].lineData[35]++;
return queryActive('ol', elementPath);
self.imgUrl = content.one('.' + prefixCls + 'img-url');
self.imgHeight = content.one('.' + prefixCls + 'img-height');
self.imgWidth = content.one('.' + prefixCls + 'img-width');
self.imgRatio = content.one('.' + prefixCls + 'img-ratio');
self.imgAlign = MenuButton.Select.decorate(content.one('.' + prefixCls + 'img-align'), {
prefixCls: prefixCls + 'big-',
width: 80,
menuCfg: {
prefixCls: prefixCls + '',
render: content
}
});
self.imgMargin = content.one('.' + prefixCls + 'img-margin');
self.imgLink = content.one('.' + prefixCls + 'img-link');
self.imgLinkBlank = content.one('.' + prefixCls + 'img-link-blank');
var placeholder = Editor.Utils.placeholder;
placeholder(self.imgUrl, HTTP_TIP);
placeholder(self.imgHeight, AUTOMATIC_TIP);
placeholder(self.imgWidth, AUTOMATIC_TIP);
placeholder(self.imgLink, 'http://');
self.imgHeight.on('keyup', function () {
var v = parseInt(valInput(self.imgHeight), 10);
if (!v || !self.imgRatio[0].checked ||
self.imgRatio[0].disabled || !self.imgRatioValue) {
return;
}
valInput(self.imgWidth, Math.floor(v * self.imgRatioValue));
});
self.imgWidth.on('keyup', function () {
var v = parseInt(valInput(self.imgWidth), 10);
afterRenderUI: function () {
var bubble = this,
el = bubble.get('contentEl');
el.html(util.substitute(tipHTML, {
prefixCls: prefixCls
}));
var tipUrl = el.one('.' + prefixCls + 'editor-bubble-url'),
tipChange = el.one('.' + prefixCls + 'editor-bubble-change'),
tipRemove = el.one('.' + prefixCls + 'editor-bubble-remove');
//ie focus not lose
Editor.Utils.preventFocus(el);
tipChange.on('click', function (ev) {
showLinkEditDialog(bubble.get('editorSelectedEl'));
ev.halt();
});
tipRemove.on('click', function (ev) {
Utils.removeLink(editor, bubble.get('editorSelectedEl'));
ev.halt();
});
bubble.on('show', function () {
var a = bubble.get('editorSelectedEl');
if (!a) {
return;
}