guy 7 years ago
parent
commit
159b22a974
  1. 157
      .eslintrc
  2. 56
      bi/case.js
  3. 56
      dist/bundle.js
  4. 56
      dist/case.js
  5. 4
      src/case/richeditor/bar/action.richeditor.js
  6. 28
      src/case/richeditor/bar/texttoolbar.js
  7. 8
      src/case/richeditor/plugins/combo.backgroundcolorchooser.js
  8. 6
      src/case/richeditor/plugins/combo.colorchooser.js
  9. 10
      src/case/richeditor/plugins/combo.sizechooser.js

157
.eslintrc

@ -0,0 +1,157 @@
{
"extends": "eslint:recommended",
"rules": {
// 声明
"no-use-before-define": "error",
//禁止定义前使用
// 对象
"no-dupe-keys": "error",
// 禁止在对象字面量中出现重复的键
"quote-props": [
"error",
"as-needed"
],
// 对象属性只在需要的时候加引号
// 字符串
"quotes": [
"error",
"double",
{
"allowTemplateLiterals": true
}
],
// 字符串开头和结束使用双引号
"no-useless-concat": "error",
// 禁止没有必要的字符拼接
"no-useless-escape": "error",
// 禁用不必要的转义
// 函数
"no-dupe-args": "error",
// 禁止在 function 定义中出现重复的参数
"space-before-function-paren": "error",
// 函数括号前必须要有空格
// 变量
"no-undef": "error",
// 禁止使用未声明的变量
// 比较运算符 & 相等运算符
"eqeqeq": "error",
// 使用 === 和 !== 代替 == 和 !=
"no-unneeded-ternary": "error",
//禁止可以在有更简单的可替代的表达式时使用三元操作符
// 条件
"default-case": "error",
// 要求 Switch 语句中有 Default 分支
"no-else-return": "error",
// 如果 if 块中包含了一个 return 语句,else 块就成了多余的了。可以将其内容移至块外
// 代码块
"brace-style": [
"error",
"1tbs",
{
"allowSingleLine": true
}
],
// 代码块左括号紧跟上一行结束
"curly": [
"error",
"multi-line"
],
// if、else if、else、for、while强制使用大括号,但允许在单行中省略大括号
// 注释
"spaced-comment": "error",
// 注释前有空格
// 空白
"indent": [
"error",
4,
{
"SwitchCase": 1
}
],
// 缩进控制4空格
"no-mixed-spaces-and-tabs": "error",
// 禁止使用 空格 和 tab 混合缩进
"space-before-blocks": [
"error",
"always"
],
// 语句块之前的需要有空格
"space-infix-ops": ["error", {
"int32Hint": false
}], // 要求中缀操作符周围有空格,设置 int32Hint 选项为 true (默认 false) 允许 a|0 不带空格
"no-trailing-spaces": ["error", {
"skipBlankLines": true
}], // 禁用行尾空格
"key-spacing": ["error", {
"afterColon": true
}], // 要求在对象字面量的冒号和值之间存在至少有一个空格
// 逗号
"comma-style": "error",
// 逗号必须放在行末
"comma-dangle": [
"error",
"never"
],
// 多行对象字面量中要求不要拖尾逗号
"comma-spacing": [
"error",
{
"before": false,
"after": true
}
],
//在变量声明、数组字面量、对象字面量、函数参数 和 序列中禁止在逗号前使用空格,要求在逗号后使用一个或多个空格
// 分号
"semi": "error",
//不得省略语句结束的分号
"semi-spacing": [
"error",
{
"before": false,
"after": true
}
],
//禁止分号周围的空格
"no-extra-semi": "error",
// 禁用不必要的分号
// 类型转换
"no-extra-boolean-cast": "error",
// 禁止不必要的布尔类型转换
// 其他最佳实践或规范
"no-unexpected-multiline": "error",
// 禁止使用令人困惑的多行表达式
"no-unreachable": "error",
// 禁止在 return、throw、continue 和 break 语句后出现不可达代码
"valid-typeof": "error",
// 强制 typeof 表达式与有效的字符串进行比较
"no-new-wrappers": "error"
// 禁止通过 new 操作符使用 String、Number 和 Boolean
},
"globals": {
"window": true,
"$": true,
"WebUI": true,
"BI": true,
"BICst": true,
"Data": true,
"Fix": true,
"module": true
}
}

56
bi/case.js

@ -9419,6 +9419,10 @@ BI.RichEditorAction = BI.inherit(BI.Widget, {
keydown: function () { keydown: function () {
}, },
hideIf: function (e) {
},
activate: function () { activate: function () {
}, },
@ -9552,7 +9556,7 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, {
{type: "bi.rich_editor_align_left_button"}, {type: "bi.rich_editor_align_left_button"},
{type: "bi.rich_editor_align_center_button"}, {type: "bi.rich_editor_align_center_button"},
{type: "bi.rich_editor_align_right_button"}, {type: "bi.rich_editor_align_right_button"},
{type: "bi.rich_editor_param_button"}, {type: "bi.rich_editor_param_button"}
], ],
height: 28 height: 28
}); });
@ -9561,22 +9565,28 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, {
_init: function () { _init: function () {
BI.RichEditorTextToolbar.superclass._init.apply(this, arguments); BI.RichEditorTextToolbar.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
BI.createWidget({ var buttons = BI.createWidgets(BI.map(o.buttons, function (i, btn) {
type: "bi.left",
element: this,
items: BI.map(o.buttons, function (i, btn) {
return BI.extend(btn, { return BI.extend(btn, {
editor: o.editor editor: o.editor
}); });
}), }));
this.element.mousedown(function (e) {
BI.each(buttons, function (i, btn) {
btn.hideIf(e);
});
});
BI.createWidget({
type: "bi.left",
element: this,
items: buttons,
hgap: 3, hgap: 3,
vgap: 3 vgap: 3
}) });
}, },
mounted: function () { mounted: function () {
var self = this; var self = this;
if (BI.isIE9Below()) {//IE8下必须要设置unselectable才能不blur输入框 if (BI.isIE9Below()) {// IE8下必须要设置unselectable才能不blur输入框
this.element.mousedown(function () { this.element.mousedown(function () {
self._noSelect(self.element[0]); self._noSelect(self.element[0]);
}); });
@ -9585,15 +9595,15 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, {
}, },
_noSelect: function (element) { _noSelect: function (element) {
if (element.setAttribute && element.nodeName.toLowerCase() != 'input' && element.nodeName.toLowerCase() != 'textarea') { if (element.setAttribute && element.nodeName.toLowerCase() != "input" && element.nodeName.toLowerCase() != "textarea") {
element.setAttribute('unselectable', 'on'); element.setAttribute("unselectable", "on");
} }
for (var i = 0; i < element.childNodes.length; i++) { for (var i = 0; i < element.childNodes.length; i++) {
this._noSelect(element.childNodes[i]); this._noSelect(element.childNodes[i]);
} }
} }
}); });
BI.shortcut('bi.rich_editor_text_toolbar', BI.RichEditorTextToolbar);/** BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
* 富文本编辑器 * 富文本编辑器
* *
* Created by GUY on 2017/9/15. * Created by GUY on 2017/9/15.
@ -10281,10 +10291,16 @@ BI.RichEditorBackgroundColorChooser = BI.inherit(BI.RichEditorAction, {
}); });
}, },
hideIf: function (e) {
if(!this.colorchooser.element.find(e.target).length > 0) {
this.colorchooser.hideView();
}
},
deactivate: function () { deactivate: function () {
} }
}); });
BI.shortcut('bi.rich_editor_background_color_chooser', BI.RichEditorBackgroundColorChooser);/** BI.shortcut("bi.rich_editor_background_color_chooser", BI.RichEditorBackgroundColorChooser);/**
* 颜色选择 * 颜色选择
* *
* Created by GUY on 2015/11/26. * Created by GUY on 2015/11/26.
@ -10320,6 +10336,12 @@ BI.RichEditorColorChooser = BI.inherit(BI.RichEditorAction, {
}, },
hideIf: function (e) {
if(!this.colorchooser.element.find(e.target).length > 0) {
this.colorchooser.hideView();
}
},
deactivate: function () { deactivate: function () {
this.colorchooser.setValue(""); this.colorchooser.setValue("");
} }
@ -10396,10 +10418,16 @@ BI.RichEditorSizeChooser = BI.inherit(BI.RichEditorAction, {
self.doCommand(val); self.doCommand(val);
this.hideView(); this.hideView();
this.setValue([]); this.setValue([]);
}) });
},
hideIf: function (e) {
if(!this.combo.element.find(e.target).length > 0) {
this.combo.hideView();
}
} }
}); });
BI.shortcut('bi.rich_editor_size_chooser', BI.RichEditorSizeChooser);/** BI.shortcut("bi.rich_editor_size_chooser", BI.RichEditorSizeChooser);/**
* 富文本编辑器 * 富文本编辑器
* *
* Created by GUY on 2017/9/15. * Created by GUY on 2017/9/15.

56
dist/bundle.js vendored

@ -70881,6 +70881,10 @@ BI.RichEditorAction = BI.inherit(BI.Widget, {
keydown: function () { keydown: function () {
}, },
hideIf: function (e) {
},
activate: function () { activate: function () {
}, },
@ -71014,7 +71018,7 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, {
{type: "bi.rich_editor_align_left_button"}, {type: "bi.rich_editor_align_left_button"},
{type: "bi.rich_editor_align_center_button"}, {type: "bi.rich_editor_align_center_button"},
{type: "bi.rich_editor_align_right_button"}, {type: "bi.rich_editor_align_right_button"},
{type: "bi.rich_editor_param_button"}, {type: "bi.rich_editor_param_button"}
], ],
height: 28 height: 28
}); });
@ -71023,22 +71027,28 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, {
_init: function () { _init: function () {
BI.RichEditorTextToolbar.superclass._init.apply(this, arguments); BI.RichEditorTextToolbar.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
BI.createWidget({ var buttons = BI.createWidgets(BI.map(o.buttons, function (i, btn) {
type: "bi.left",
element: this,
items: BI.map(o.buttons, function (i, btn) {
return BI.extend(btn, { return BI.extend(btn, {
editor: o.editor editor: o.editor
}); });
}), }));
this.element.mousedown(function (e) {
BI.each(buttons, function (i, btn) {
btn.hideIf(e);
});
});
BI.createWidget({
type: "bi.left",
element: this,
items: buttons,
hgap: 3, hgap: 3,
vgap: 3 vgap: 3
}) });
}, },
mounted: function () { mounted: function () {
var self = this; var self = this;
if (BI.isIE9Below()) {//IE8下必须要设置unselectable才能不blur输入框 if (BI.isIE9Below()) {// IE8下必须要设置unselectable才能不blur输入框
this.element.mousedown(function () { this.element.mousedown(function () {
self._noSelect(self.element[0]); self._noSelect(self.element[0]);
}); });
@ -71047,15 +71057,15 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, {
}, },
_noSelect: function (element) { _noSelect: function (element) {
if (element.setAttribute && element.nodeName.toLowerCase() != 'input' && element.nodeName.toLowerCase() != 'textarea') { if (element.setAttribute && element.nodeName.toLowerCase() != "input" && element.nodeName.toLowerCase() != "textarea") {
element.setAttribute('unselectable', 'on'); element.setAttribute("unselectable", "on");
} }
for (var i = 0; i < element.childNodes.length; i++) { for (var i = 0; i < element.childNodes.length; i++) {
this._noSelect(element.childNodes[i]); this._noSelect(element.childNodes[i]);
} }
} }
}); });
BI.shortcut('bi.rich_editor_text_toolbar', BI.RichEditorTextToolbar);/** BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
* 富文本编辑器 * 富文本编辑器
* *
* Created by GUY on 2017/9/15. * Created by GUY on 2017/9/15.
@ -71743,10 +71753,16 @@ BI.RichEditorBackgroundColorChooser = BI.inherit(BI.RichEditorAction, {
}); });
}, },
hideIf: function (e) {
if(!this.colorchooser.element.find(e.target).length > 0) {
this.colorchooser.hideView();
}
},
deactivate: function () { deactivate: function () {
} }
}); });
BI.shortcut('bi.rich_editor_background_color_chooser', BI.RichEditorBackgroundColorChooser);/** BI.shortcut("bi.rich_editor_background_color_chooser", BI.RichEditorBackgroundColorChooser);/**
* 颜色选择 * 颜色选择
* *
* Created by GUY on 2015/11/26. * Created by GUY on 2015/11/26.
@ -71782,6 +71798,12 @@ BI.RichEditorColorChooser = BI.inherit(BI.RichEditorAction, {
}, },
hideIf: function (e) {
if(!this.colorchooser.element.find(e.target).length > 0) {
this.colorchooser.hideView();
}
},
deactivate: function () { deactivate: function () {
this.colorchooser.setValue(""); this.colorchooser.setValue("");
} }
@ -71858,10 +71880,16 @@ BI.RichEditorSizeChooser = BI.inherit(BI.RichEditorAction, {
self.doCommand(val); self.doCommand(val);
this.hideView(); this.hideView();
this.setValue([]); this.setValue([]);
}) });
},
hideIf: function (e) {
if(!this.combo.element.find(e.target).length > 0) {
this.combo.hideView();
}
} }
}); });
BI.shortcut('bi.rich_editor_size_chooser', BI.RichEditorSizeChooser);/** BI.shortcut("bi.rich_editor_size_chooser", BI.RichEditorSizeChooser);/**
* 富文本编辑器 * 富文本编辑器
* *
* Created by GUY on 2017/9/15. * Created by GUY on 2017/9/15.

56
dist/case.js vendored

@ -9419,6 +9419,10 @@ BI.RichEditorAction = BI.inherit(BI.Widget, {
keydown: function () { keydown: function () {
}, },
hideIf: function (e) {
},
activate: function () { activate: function () {
}, },
@ -9552,7 +9556,7 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, {
{type: "bi.rich_editor_align_left_button"}, {type: "bi.rich_editor_align_left_button"},
{type: "bi.rich_editor_align_center_button"}, {type: "bi.rich_editor_align_center_button"},
{type: "bi.rich_editor_align_right_button"}, {type: "bi.rich_editor_align_right_button"},
{type: "bi.rich_editor_param_button"}, {type: "bi.rich_editor_param_button"}
], ],
height: 28 height: 28
}); });
@ -9561,22 +9565,28 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, {
_init: function () { _init: function () {
BI.RichEditorTextToolbar.superclass._init.apply(this, arguments); BI.RichEditorTextToolbar.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
BI.createWidget({ var buttons = BI.createWidgets(BI.map(o.buttons, function (i, btn) {
type: "bi.left",
element: this,
items: BI.map(o.buttons, function (i, btn) {
return BI.extend(btn, { return BI.extend(btn, {
editor: o.editor editor: o.editor
}); });
}), }));
this.element.mousedown(function (e) {
BI.each(buttons, function (i, btn) {
btn.hideIf(e);
});
});
BI.createWidget({
type: "bi.left",
element: this,
items: buttons,
hgap: 3, hgap: 3,
vgap: 3 vgap: 3
}) });
}, },
mounted: function () { mounted: function () {
var self = this; var self = this;
if (BI.isIE9Below()) {//IE8下必须要设置unselectable才能不blur输入框 if (BI.isIE9Below()) {// IE8下必须要设置unselectable才能不blur输入框
this.element.mousedown(function () { this.element.mousedown(function () {
self._noSelect(self.element[0]); self._noSelect(self.element[0]);
}); });
@ -9585,15 +9595,15 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, {
}, },
_noSelect: function (element) { _noSelect: function (element) {
if (element.setAttribute && element.nodeName.toLowerCase() != 'input' && element.nodeName.toLowerCase() != 'textarea') { if (element.setAttribute && element.nodeName.toLowerCase() != "input" && element.nodeName.toLowerCase() != "textarea") {
element.setAttribute('unselectable', 'on'); element.setAttribute("unselectable", "on");
} }
for (var i = 0; i < element.childNodes.length; i++) { for (var i = 0; i < element.childNodes.length; i++) {
this._noSelect(element.childNodes[i]); this._noSelect(element.childNodes[i]);
} }
} }
}); });
BI.shortcut('bi.rich_editor_text_toolbar', BI.RichEditorTextToolbar);/** BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
* 富文本编辑器 * 富文本编辑器
* *
* Created by GUY on 2017/9/15. * Created by GUY on 2017/9/15.
@ -10281,10 +10291,16 @@ BI.RichEditorBackgroundColorChooser = BI.inherit(BI.RichEditorAction, {
}); });
}, },
hideIf: function (e) {
if(!this.colorchooser.element.find(e.target).length > 0) {
this.colorchooser.hideView();
}
},
deactivate: function () { deactivate: function () {
} }
}); });
BI.shortcut('bi.rich_editor_background_color_chooser', BI.RichEditorBackgroundColorChooser);/** BI.shortcut("bi.rich_editor_background_color_chooser", BI.RichEditorBackgroundColorChooser);/**
* 颜色选择 * 颜色选择
* *
* Created by GUY on 2015/11/26. * Created by GUY on 2015/11/26.
@ -10320,6 +10336,12 @@ BI.RichEditorColorChooser = BI.inherit(BI.RichEditorAction, {
}, },
hideIf: function (e) {
if(!this.colorchooser.element.find(e.target).length > 0) {
this.colorchooser.hideView();
}
},
deactivate: function () { deactivate: function () {
this.colorchooser.setValue(""); this.colorchooser.setValue("");
} }
@ -10396,10 +10418,16 @@ BI.RichEditorSizeChooser = BI.inherit(BI.RichEditorAction, {
self.doCommand(val); self.doCommand(val);
this.hideView(); this.hideView();
this.setValue([]); this.setValue([]);
}) });
},
hideIf: function (e) {
if(!this.combo.element.find(e.target).length > 0) {
this.combo.hideView();
}
} }
}); });
BI.shortcut('bi.rich_editor_size_chooser', BI.RichEditorSizeChooser);/** BI.shortcut("bi.rich_editor_size_chooser", BI.RichEditorSizeChooser);/**
* 富文本编辑器 * 富文本编辑器
* *
* Created by GUY on 2017/9/15. * Created by GUY on 2017/9/15.

4
src/case/richeditor/bar/action.richeditor.js

@ -65,6 +65,10 @@ BI.RichEditorAction = BI.inherit(BI.Widget, {
keydown: function () { keydown: function () {
}, },
hideIf: function (e) {
},
activate: function () { activate: function () {
}, },

28
src/case/richeditor/bar/texttoolbar.js

@ -19,7 +19,7 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, {
{type: "bi.rich_editor_align_left_button"}, {type: "bi.rich_editor_align_left_button"},
{type: "bi.rich_editor_align_center_button"}, {type: "bi.rich_editor_align_center_button"},
{type: "bi.rich_editor_align_right_button"}, {type: "bi.rich_editor_align_right_button"},
{type: "bi.rich_editor_param_button"}, {type: "bi.rich_editor_param_button"}
], ],
height: 28 height: 28
}); });
@ -28,22 +28,28 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, {
_init: function () { _init: function () {
BI.RichEditorTextToolbar.superclass._init.apply(this, arguments); BI.RichEditorTextToolbar.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
BI.createWidget({ var buttons = BI.createWidgets(BI.map(o.buttons, function (i, btn) {
type: "bi.left",
element: this,
items: BI.map(o.buttons, function (i, btn) {
return BI.extend(btn, { return BI.extend(btn, {
editor: o.editor editor: o.editor
}); });
}), }));
this.element.mousedown(function (e) {
BI.each(buttons, function (i, btn) {
btn.hideIf(e);
});
});
BI.createWidget({
type: "bi.left",
element: this,
items: buttons,
hgap: 3, hgap: 3,
vgap: 3 vgap: 3
}) });
}, },
mounted: function () { mounted: function () {
var self = this; var self = this;
if (BI.isIE9Below()) {//IE8下必须要设置unselectable才能不blur输入框 if (BI.isIE9Below()) {// IE8下必须要设置unselectable才能不blur输入框
this.element.mousedown(function () { this.element.mousedown(function () {
self._noSelect(self.element[0]); self._noSelect(self.element[0]);
}); });
@ -52,12 +58,12 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, {
}, },
_noSelect: function (element) { _noSelect: function (element) {
if (element.setAttribute && element.nodeName.toLowerCase() != 'input' && element.nodeName.toLowerCase() != 'textarea') { if (element.setAttribute && element.nodeName.toLowerCase() != "input" && element.nodeName.toLowerCase() != "textarea") {
element.setAttribute('unselectable', 'on'); element.setAttribute("unselectable", "on");
} }
for (var i = 0; i < element.childNodes.length; i++) { for (var i = 0; i < element.childNodes.length; i++) {
this._noSelect(element.childNodes[i]); this._noSelect(element.childNodes[i]);
} }
} }
}); });
BI.shortcut('bi.rich_editor_text_toolbar', BI.RichEditorTextToolbar); BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);

8
src/case/richeditor/plugins/combo.backgroundcolorchooser.js

@ -37,7 +37,13 @@ BI.RichEditorBackgroundColorChooser = BI.inherit(BI.RichEditorAction, {
}); });
}, },
hideIf: function (e) {
if(!this.colorchooser.element.find(e.target).length > 0) {
this.colorchooser.hideView();
}
},
deactivate: function () { deactivate: function () {
} }
}); });
BI.shortcut('bi.rich_editor_background_color_chooser', BI.RichEditorBackgroundColorChooser); BI.shortcut("bi.rich_editor_background_color_chooser", BI.RichEditorBackgroundColorChooser);

6
src/case/richeditor/plugins/combo.colorchooser.js

@ -34,6 +34,12 @@ BI.RichEditorColorChooser = BI.inherit(BI.RichEditorAction, {
}, },
hideIf: function (e) {
if(!this.colorchooser.element.find(e.target).length > 0) {
this.colorchooser.hideView();
}
},
deactivate: function () { deactivate: function () {
this.colorchooser.setValue(""); this.colorchooser.setValue("");
} }

10
src/case/richeditor/plugins/combo.sizechooser.js

@ -70,7 +70,13 @@ BI.RichEditorSizeChooser = BI.inherit(BI.RichEditorAction, {
self.doCommand(val); self.doCommand(val);
this.hideView(); this.hideView();
this.setValue([]); this.setValue([]);
}) });
},
hideIf: function (e) {
if(!this.combo.element.find(e.target).length > 0) {
this.combo.hideView();
}
} }
}); });
BI.shortcut('bi.rich_editor_size_chooser', BI.RichEditorSizeChooser); BI.shortcut("bi.rich_editor_size_chooser", BI.RichEditorSizeChooser);
Loading…
Cancel
Save