Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* Encapsulate KISSY toggle button for kissy editor
* @author yiminghe@gmail.com
*/
var util = require('util');
// 'editor', '../font/cmd'
var Editor = require('editor');
var Button = require('button');
/**
* add button to editor
* @param {String} id control id
* @param {Object} cfg button config
* @param {Function} ButtonType button constructor. needs to extend {@link KISSY.Button}, Defaults to {@link KISSY.Button}.
* @member KISSY.Editor
*/
Editor.prototype.addButton = function (id, cfg, ButtonType) {
if (ButtonType === undefined) {
ButtonType = Button;
}
var self = this,
prefixCls = self.get('prefixCls') + 'editor-toolbar-';
if (cfg.elCls) {
cfg.elCls = prefixCls + cfg.elCls;
}
cfg.elCls = prefixCls + 'button ' + (cfg.elCls || '');
var b = new ButtonType(util.mix({
render: self.get('toolBarEl'),
content: '
KISSY.add(function(S, require) {
_$jscoverage['/menubutton.js'].functionData[0]++;
_$jscoverage['/menubutton.js'].lineData[7]++;
var Editor = require('editor');
_$jscoverage['/menubutton.js'].lineData[8]++;
var util = require('util');
_$jscoverage['/menubutton.js'].lineData[9]++;
var MenuButton = require('menubutton');
_$jscoverage['/menubutton.js'].lineData[17]++;
Editor.prototype.addSelect = function(id, cfg, SelectType) {
_$jscoverage['/menubutton.js'].functionData[1]++;
_$jscoverage['/menubutton.js'].lineData[18]++;
SelectType = visit1_18_1(SelectType || MenuButton.Select);
_$jscoverage['/menubutton.js'].lineData[20]++;
var self = this, prefixCls = self.get('prefixCls') + 'editor-';
_$jscoverage['/menubutton.js'].lineData[22]++;
if (visit2_22_1(cfg)) {
_$jscoverage['/menubutton.js'].lineData[23]++;
cfg.editor = self;
_$jscoverage['/menubutton.js'].lineData[24]++;
if (visit3_24_1(cfg.menu)) {
_$jscoverage['/menubutton.js'].lineData[25]++;
cfg.menu.zIndex = Editor.baseZIndex(Editor.ZIndexManager.SELECT);
}
_$jscoverage['/menubutton.js'].lineData[27]++;
if (visit4_27_1(cfg.elCls)) {
/**
* @ignore
* contextmenu for kissy editor
* @author yiminghe@gmail.com
*/
var Editor = require('editor');
var Menu = require('menu');
var focusFix = require('./focus-fix');
var Event = require('event/dom');
var $ = require('node');
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);
var util = require('util');
var MenuButton = require('menubutton'); /**
* add select to editor toolbar
* @param {String} id control id
* @param {Object} cfg select config
* @param {Function} SelectType Select constructor. needs to extend {@link KISSY.MenuButton.Select}, Defaults to {@link KISSY.MenuButton.Select}.
* @member KISSY.Editor
*/
/**
* add select to editor toolbar
* @param {String} id control id
* @param {Object} cfg select config
* @param {Function} SelectType Select constructor. needs to extend {@link KISSY.MenuButton.Select}, Defaults to {@link KISSY.MenuButton.Select}.
* @member KISSY.Editor
*/
Editor.prototype.addSelect = function (id, cfg, SelectType) {
SelectType = SelectType || MenuButton.Select;
var self = this, prefixCls = self.get('prefixCls') + 'editor-';
if (cfg) {
cfg.editor = self;
if (cfg.menu) {
cfg.menu.zIndex = Editor.baseZIndex(Editor.ZIndexManager.SELECT);
}
if (cfg.elCls) {
cfg.elCls = prefixCls + cfg.elCls;
}
}
var s = new SelectType(util.mix({
render: self.get('toolBarEl'),
prefixCls: prefixCls
}, cfg)).render();
if (cfg.mode === Editor.Mode.WYSIWYG_MODE) {
var Editor = require('editor');
var Button = require('button'); /**
* add button to editor
* @param {String} id control id
* @param {Object} cfg button config
* @param {Function} ButtonType button constructor. needs to extend {@link KISSY.Button}, Defaults to {@link KISSY.Button}.
* @member KISSY.Editor
*/
/**
* add button to editor
* @param {String} id control id
* @param {Object} cfg button config
* @param {Function} ButtonType button constructor. needs to extend {@link KISSY.Button}, Defaults to {@link KISSY.Button}.
* @member KISSY.Editor
*/
Editor.prototype.addButton = function (id, cfg, ButtonType) {
if (ButtonType === undefined) {
ButtonType = Button;
}
var self = this, prefixCls = self.get('prefixCls') + 'editor-toolbar-';
if (cfg.elCls) {
cfg.elCls = prefixCls + cfg.elCls;
}
cfg.elCls = prefixCls + 'button ' + (cfg.elCls || '');
var b = new ButtonType(util.mix({
render: self.get('toolBarEl'),
content: '<span>',
prefixCls: self.get('prefixCls') + 'editor-',
editor: self
}, cfg)).render();
if (!cfg.content) {
var contentEl = b.get('el').one('span');</span>
KISSY.add("editor/plugin/menubutton", ["editor", "menubutton"], function(S, require) {
var Editor = require("editor");
var MenuButton = require("menubutton");
Editor.prototype.addSelect = function(id, cfg, SelectType) {
SelectType = SelectType || MenuButton.Select;
var self = this, prefixCls = self.get("prefixCls") + "editor-";
if(cfg) {
cfg.editor = self;
if(cfg.menu) {
cfg.menu.zIndex = Editor.baseZIndex(Editor.ZIndexManager.SELECT)
}
if(cfg.elCls) {
cfg.elCls = prefixCls + cfg.elCls
}
}
var s = (new SelectType(S.mix({render:self.get("toolBarEl"), prefixCls:prefixCls}, cfg))).render();
if(cfg.mode === Editor.Mode.WYSIWYG_MODE) {
self.on("wysiwygMode", function() {
s.set("disabled", false)
});
_$jscoverage['/bubble.js'].lineData[111]++;
if (visit25_111_1(visit26_111_2(elLeft > left) && visit27_111_3(elLeft < right))) {
_$jscoverage['/bubble.js'].lineData[112]++;
x = elLeft;
}
}
_$jscoverage['/bubble.js'].lineData[115]++;
if (visit28_115_1(visit29_115_2(x !== undefined) && visit30_115_3(y !== undefined))) {
_$jscoverage['/bubble.js'].lineData[116]++;
return [x, y];
}
_$jscoverage['/bubble.js'].lineData[118]++;
return undefined;
}
_$jscoverage['/bubble.js'].lineData[121]++;
Editor.prototype.addBubble = function(id, filter, cfg) {
_$jscoverage['/bubble.js'].functionData[6]++;
_$jscoverage['/bubble.js'].lineData[122]++;
var editor = this, prefixCls = editor.get('prefixCls'), bubble;
_$jscoverage['/bubble.js'].lineData[126]++;
cfg = visit31_126_1(cfg || {});
_$jscoverage['/bubble.js'].lineData[128]++;
cfg.editor = editor;
_$jscoverage['/bubble.js'].lineData[130]++;
util.mix(cfg, BUBBLE_CFG);
_$jscoverage['/bubble.js'].lineData[132]++;
cfg.elCls = util.substitute(cfg.elCls, {
prefixCls: prefixCls});
_$jscoverage['/bubble.js'].lineData[136]++;
cfg.prefixCls = util.substitute(cfg.prefixCls, {
prefixCls: prefixCls});
_$jscoverage['/bubble.js'].lineData[140]++;
* @ignore
* select component for kissy editor.
* @author yiminghe@gmail.com
*/
var Editor = require('editor');
var util = require('util');
var MenuButton = require('menubutton');
/**
* add select to editor toolbar
* @param {String} id control id
* @param {Object} cfg select config
* @param {Function} SelectType Select constructor. needs to extend {@link KISSY.MenuButton.Select}, Defaults to {@link KISSY.MenuButton.Select}.
* @member KISSY.Editor
*/
Editor.prototype.addSelect = function (id, cfg, SelectType) {
SelectType = SelectType || MenuButton.Select;
var self = this, prefixCls = self.get('prefixCls') + 'editor-';
if (cfg) {
cfg.editor = self;
if (cfg.menu) {
cfg.menu.zIndex = Editor.baseZIndex(Editor.ZIndexManager.SELECT);
}
if (cfg.elCls) {
cfg.elCls = prefixCls + cfg.elCls;
}
}
var s = new SelectType(util.mix({
render: self.get('toolBarEl'),
KISSY.add(function(S, require) {
_$jscoverage['/button.js'].functionData[0]++;
_$jscoverage['/button.js'].lineData[7]++;
var util = require('util');
_$jscoverage['/button.js'].lineData[9]++;
var Editor = require('editor');
_$jscoverage['/button.js'].lineData[10]++;
var Button = require('button');
_$jscoverage['/button.js'].lineData[18]++;
Editor.prototype.addButton = function(id, cfg, ButtonType) {
_$jscoverage['/button.js'].functionData[1]++;
_$jscoverage['/button.js'].lineData[20]++;
if (visit1_20_1(ButtonType === undefined)) {
_$jscoverage['/button.js'].lineData[21]++;
ButtonType = Button;
}
_$jscoverage['/button.js'].lineData[23]++;
var self = this, prefixCls = self.get('prefixCls') + 'editor-toolbar-';
_$jscoverage['/button.js'].lineData[26]++;
if (visit2_26_1(cfg.elCls)) {
_$jscoverage['/button.js'].lineData[27]++;
cfg.elCls = prefixCls + cfg.elCls;
}
_$jscoverage['/button.js'].lineData[30]++;
cfg.elCls = prefixCls + 'button ' + (visit3_30_1(cfg.elCls || ''));
_$jscoverage['/button.js'].lineData[32]++;
KISSY.add(function(S, require) {
_$jscoverage['/contextmenu.js'].functionData[0]++;
_$jscoverage['/contextmenu.js'].lineData[7]++;
var Editor = require('editor');
_$jscoverage['/contextmenu.js'].lineData[8]++;
var Menu = require('menu');
_$jscoverage['/contextmenu.js'].lineData[9]++;
var focusFix = require('./focus-fix');
_$jscoverage['/contextmenu.js'].lineData[10]++;
var Event = require('event/dom');
_$jscoverage['/contextmenu.js'].lineData[11]++;
var $ = require('node').all;
_$jscoverage['/contextmenu.js'].lineData[13]++;
Editor.prototype.addContextMenu = function(id, filter, cfg) {
_$jscoverage['/contextmenu.js'].functionData[1]++;
_$jscoverage['/contextmenu.js'].lineData[15]++;
var self = this;
_$jscoverage['/contextmenu.js'].lineData[17]++;
cfg = visit1_17_1(cfg || {});
_$jscoverage['/contextmenu.js'].lineData[19]++;
var event = cfg.event;
_$jscoverage['/contextmenu.js'].lineData[20]++;
if (visit2_20_1(event)) {
_$jscoverage['/contextmenu.js'].lineData[21]++;
delete cfg.event;
}
_$jscoverage['/contextmenu.js'].lineData[24]++;
cfg.prefixCls = self.get('prefixCls') + 'editor-';
_$jscoverage['/contextmenu.js'].lineData[25]++;
cfg.editor = self;