Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Editor.prototype.addContextMenu = function (id, filter, cfg) {
var self = this;
cfg = cfg || {};
var event = cfg.event;
if (event) {
delete cfg.event;
}
cfg.prefixCls = self.get('prefixCls') + 'editor-';
cfg.editor = self;
cfg.focusable = 1;
cfg.zIndex = Editor.baseZIndex(Editor.ZIndexManager.POPUP_MENU);
var menu = new Menu.PopupMenu(cfg);
focusFix.init(menu);
menu.on('afterRenderUI', function () {
menu.get('el').on('keydown', function (e) {
if (e.keyCode === Event.KeyCode.ESC) {
menu.hide();
}
});
});
self.docReady(function () {
var doc = self.get('document');
// 编辑器获得焦点,不会触发 menu el blur?
/**
* @ignore
* bubble or tip view for kissy editor
* @author yiminghe@gmail.com
*/
var util = require('util');
var UA = require('ua');
var Overlay = require('overlay');
var Editor = require('editor');
var BUBBLE_CFG = {
zIndex: Editor.baseZIndex(Editor.ZIndexManager.BUBBLE_VIEW),
elCls: '{prefixCls}editor-bubble',
prefixCls: '{prefixCls}editor-',
effect: {
effect: 'fade',
duration: 0.3
}
};
function inRange(t, b, r) {
return t <= r && b >= r;
}
// 是否两个bubble上下重叠?
function overlap(b1, b2) {
var b1Top = b1.get('y'),
Editor.prototype.addContextMenu = function(id, filter, cfg) {
var self = this;
cfg = cfg || {};
var event = cfg.event;
if(event) {
delete cfg.event
}
cfg.prefixCls = self.get("prefixCls") + "editor-";
cfg.editor = self;
cfg.focusable = 1;
cfg.zIndex = Editor.baseZIndex(Editor.ZIndexManager.POPUP_MENU);
var menu = new Menu.PopupMenu(cfg);
focusFix.init(menu);
menu.on("afterRenderUI", function() {
menu.get("el").on("keydown", function(e) {
if(e.keyCode === Event.KeyCode.ESC) {
menu.hide()
}
})
});
self.docReady(function() {
var doc = self.get("document");
doc.on("mousedown", function(e) {
if(e.which === 1) {
menu.hide()
}
});
var ConstrainPlugin = require("dd/plugin/constrain");
var DragPlugin = require("component/plugin/drag");
return Overlay.Dialog.extend({initializer:function() {
this.plug(new DragPlugin({handlers:[".ks-editor-dialog-header"], plugins:[new ConstrainPlugin({constrain:window})]}))
}, bindUI:function() {
focusFix.init(this)
}, show:function() {
var self = this;
self.center();
var y = self.get("y");
if(y - S.require("dom").scrollTop() > 200) {
y = S.require("dom").scrollTop() + 200;
self.set("y", y)
}
self.callSuper()
}}, {ATTRS:{prefixCls:{value:"ks-editor-"}, zIndex:{value:Editor.baseZIndex(Editor.ZIndexManager.OVERLAY)}}})
});
KISSY.add("editor/plugin/local-storage", ["editor", "overlay", "./flash-bridge"], function(S, require) {
var Editor = require("editor");
var Overlay = require("overlay");
var FlashBridge = require("./flash-bridge");
var ie = S.UA.ieMode;
if((!ie || ie > 8) && window.localStorage) {
return window.localStorage
}
var swfSrc = Editor.Utils.debugUrl("plugin/local-storage/assets/swfstore.swf?t=" + +new Date);
var css = {width:215, border:"1px solid red"}, reverseCss = {width:0, border:"none"};
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)});
o.render();
o.show();
var store = new FlashBridge({src:swfSrc, render:o.get("contentEl").one(".storage-container"), params:{flashVars:{useCompression:true}}, attrs:{height:138, width:"100%"}, methods:["setItem", "removeItem", "getItem", "setMinDiskSpace", "getValueOf"]});
S.ready(function() {
setTimeout(function() {
o.center()
}, 0)
});
store.on("pending", function() {
o.get("el").css(css);
o.center();
o.show();
setTimeout(function() {
store.retrySave()
}, 1E3)
});
self.center();
var y = self.get('y');
//居中有点偏下
if (y - Dom.scrollTop() > 200) {
y = Dom.scrollTop() + 200;
self.set('y', y);
}
self.callSuper();
}
}, {
ATTRS: {
prefixCls: {
value: 'ks-editor-'
},
'zIndex': {
value: Editor.baseZIndex(Editor.ZIndexManager.OVERLAY)
}
}
});
_$jscoverage['/dialog.js'].lineData[125]++;
return;
}
_$jscoverage['/dialog.js'].lineData[127]++;
valInput(self.imgHeight, Math.floor(v / self.imgRatioValue));
});
_$jscoverage['/dialog.js'].lineData[130]++;
cancel.on('click', function(ev) {
_$jscoverage['/dialog.js'].functionData[6]++;
_$jscoverage['/dialog.js'].lineData[131]++;
self.d.hide();
_$jscoverage['/dialog.js'].lineData[132]++;
ev.halt();
});
_$jscoverage['/dialog.js'].lineData[135]++;
var loadingCancel = new Node('<a class="' + prefixCls + 'button ks-inline-block">\u53d6\u6d88\u4e0a\u4f20</a>').appendTo(document.body, undefined);
_$jscoverage['/dialog.js'].lineData[143]++;
self.loadingCancel = loadingCancel;
_$jscoverage['/dialog.js'].lineData[145]++;
function getFileSize(file) {
_$jscoverage['/dialog.js'].functionData[7]++;
_$jscoverage['/dialog.js'].lineData[146]++;
if (visit13_146_1(file.files)) {
_$jscoverage['/dialog.js'].lineData[147]++;
return file.files[0].size;
}
_$jscoverage['/dialog.js'].lineData[156]++;
return 0;
}
_$jscoverage['/dialog.js'].lineData[159]++;
ok.on('click', function(ev) {
_$jscoverage['/dialog.js'].functionData[8]++;
border: '1px solid red'
}, reverseCss = {
width: 0,
border: 'none'
};
//Dialog 不行
var o = new Overlay({
prefixCls: 'ks-editor-',
elStyle: {
background: 'white'
},
width: '0px',
content: '<h1 style="' + 'text-align:center;">请点击允许</h1>' +
'<div class="storage-container"></div>',
zIndex: Editor.baseZIndex(Editor.ZIndexManager.STORE_FLASH_SHOW)
});
o.render();
o.show();
var store = new FlashBridge({
src: swfSrc,
render: o.get('contentEl').one('.storage-container'),
params: {
flashVars: {
useCompression: true
}
},
attrs: {
height: 138,
width: '100%'
},
Dom.css(doc.body, {
width: 0,
height: 0,
overflow: 'hidden'
});
} else {
doc.body.style.overflow = 'hidden';
}
doc.documentElement.style.overflow = 'hidden';
editorEl.css({
position: 'absolute',
zIndex: Editor.baseZIndex(Editor.ZIndexManager.MAXIMIZE),
width: viewportWidth + 'px'
});
iframe.css({
zIndex: Editor.baseZIndex(Editor.ZIndexManager.MAXIMIZE - 5),
height: viewportHeight + 'px',
width: viewportWidth + 'px'
});
editorEl.offset({
left: 0,
top: 0
});
iframe.css({
left: 0,
top: 0
});
textareaEl.parent().css({ height: viewportHeight - statusHeight - toolHeight + 'px' });
textareaEl.css({ height: viewportHeight - statusHeight - toolHeight + 'px' });
if (stop !== true) {
/*jshint noarg:false*/
arguments.callee.call(self, true);
click: function () {
var self = this, smiley, checked = self.get('checked');
if (checked) {
if (!(smiley = self.smiley)) {
smiley = self.smiley = new Overlay4E({
content: util.substitute(smileyMarkup, { prefixCls: prefixCls }),
focus4e: false,
width: 300,
elCls: prefixCls + 'editor-popup',
zIndex: Editor.baseZIndex(Editor.ZIndexManager.POPUP_MENU),
mask: false
}).render();
smiley.get('el').on('click', function (ev) {
var t = $(ev.target), icon;
if (t.nodeName() === 'a' && (icon = t.attr('data-icon'))) {
var img = $('<img src="' + icon + '">', editor.get('document')[0]);
editor.insertElement(img);
}
});
smiley.on('hide', function () {
self.set('checked', false);
});
}
smiley.set('align', {
node: this.get('el'),
points: [