diff --git a/bi/base.css b/bi/base.css
index 04bb56c65..94eca2f45 100644
--- a/bi/base.css
+++ b/bi/base.css
@@ -617,6 +617,9 @@ li.CodeMirror-hint-active {
.bi-direction-pager .direction-pager-next {
font-size: 16px;
}
+.bi-text-toolbar .text-toolbar-button {
+ font-size: 16px;
+}
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-segment > .center-element {
diff --git a/bi/base.js b/bi/base.js
index eec4127f4..7e899402e 100644
--- a/bi/base.js
+++ b/bi/base.js
@@ -16086,1332 +16086,955 @@ BI.Pager = BI.inherit(BI.Widget, {
});
BI.Pager.EVENT_CHANGE = "EVENT_CHANGE";
BI.Pager.EVENT_AFTER_POPULATE = "EVENT_AFTER_POPULATE";
-BI.shortcut("bi.pager", BI.Pager);!(function(){
- var bkExtend = function(){
- var args = arguments;
- if (args.length == 1) args = [this, args[0]];
- for (var prop in args[1]) args[0][prop] = args[1][prop];
- return args[0];
- };
- function bkClass() { }
- bkClass.prototype.construct = function() {};
- bkClass.extend = function(def) {
- var classDef = function() {
- if (arguments[0] !== bkClass) { return this.construct.apply(this, arguments); }
- };
- var proto = new this(bkClass);
- bkExtend(proto,def);
- classDef.prototype = proto;
- classDef.extend = this.extend;
- return classDef;
- };
-
- var bkElement = bkClass.extend({
- construct : function(elm,d) {
- if(typeof(elm) == "string") {
- elm = (d || document).createElement(elm);
- }
- elm = $BK(elm);
- return elm;
- },
-
- appendTo : function(elm) {
- elm.appendChild(this);
- return this;
- },
-
- appendBefore : function(elm) {
- elm.parentNode.insertBefore(this,elm);
- return this;
- },
-
- addEvent : function(type, fn) {
- bkLib.addEvent(this,type,fn);
- return this;
- },
-
- setContent : function(c) {
- this.innerHTML = c;
- return this;
- },
-
- pos : function() {
- var curleft = curtop = 0;
- var o = obj = this;
- if (obj.offsetParent) {
- do {
- curleft += obj.offsetLeft;
- curtop += obj.offsetTop;
- } while (obj = obj.offsetParent);
- }
- var b = (!window.opera) ? parseInt(this.getStyle('border-width') || this.style.border) || 0 : 0;
- return [curleft+b,curtop+b+this.offsetHeight];
- },
-
- noSelect : function() {
- bkLib.noSelect(this);
- return this;
- },
-
- parentTag : function(t) {
- var elm = this;
- do {
- if(elm && elm.nodeName && elm.nodeName.toUpperCase() == t) {
- return elm;
- }
- elm = elm.parentNode;
- } while(elm);
- return false;
- },
-
- hasClass : function(cls) {
- return this.className.match(new RegExp('(\\s|^)nicEdit-'+cls+'(\\s|$)'));
- },
-
- addClass : function(cls) {
- if (!this.hasClass(cls)) { this.className += " nicEdit-"+cls };
- return this;
- },
-
- removeClass : function(cls) {
- if (this.hasClass(cls)) {
- this.className = this.className.replace(new RegExp('(\\s|^)nicEdit-'+cls+'(\\s|$)'),' ');
- }
- return this;
- },
-
- setStyle : function(st) {
- var elmStyle = this.style;
- for(var itm in st) {
- switch(itm) {
- case 'float':
- elmStyle['cssFloat'] = elmStyle['styleFloat'] = st[itm];
- break;
- case 'opacity':
- elmStyle.opacity = st[itm];
- elmStyle.filter = "alpha(opacity=" + Math.round(st[itm]*100) + ")";
- break;
- case 'className':
- this.className = st[itm];
- break;
- default:
- //if(document.compatMode || itm != "cursor") { // Nasty Workaround for IE 5.5
- elmStyle[itm] = st[itm];
- //}
- }
- }
- return this;
- },
-
- getStyle : function( cssRule, d ) {
- var doc = (!d) ? document.defaultView : d;
- if(this.nodeType == 1)
- return (doc && doc.getComputedStyle) ? doc.getComputedStyle( this, null ).getPropertyValue(cssRule) : this.currentStyle[ bkLib.camelize(cssRule) ];
- },
-
- remove : function() {
- this.parentNode.removeChild(this);
- return this;
- },
-
- setAttributes : function(at) {
- for(var itm in at) {
- this[itm] = at[itm];
- }
- return this;
- }
- });
-
- var bkLib = {
- isMSIE : (navigator.appVersion.indexOf("MSIE") != -1),
-
- addEvent : function(obj, type, fn) {
- (obj.addEventListener) ? obj.addEventListener( type, fn, false ) : obj.attachEvent("on"+type, fn);
- },
+BI.shortcut("bi.pager", BI.Pager);/**
+ * 颜色选择
+ *
+ * Created by GUY on 2015/11/26.
+ * @class BI.TextToolbar
+ * @extends BI.Widget
+ */
+BI.RichEditorAction = BI.inherit(BI.Widget, {
+ _defaultConfig: function () {
+ return BI.extend(BI.RichEditorAction.superclass._defaultConfig.apply(this, arguments), {
+ width: 20,
+ height: 20,
+ command: "",
+ disabled: true
+ });
+ },
+
+ _init: function () {
+ BI.RichEditorAction.superclass._init.apply(this, arguments);
+ var self = this, o = this.options;
+ o.editor.on(BI.NicEditor.EVENT_SELECTED, function (ins, target) {
+ self.setEnable(true);
+ self.checkNodes(target);
+ });
+ o.editor.on(BI.NicEditor.EVENT_BLUR, function () {
+ self.setEnable(false);
+ });
+ o.editor.on(BI.NicEditor.EVENT_KEY, BI.bind(this.key, this));
+ },
+
+ checkNodes: function (e) {
+ if (!e) {
+ return false;
+ }
+ var elm = e;
+ do {
+ if (this.options.tags && this.options.tags.contains(elm.nodeName)) {
+ this.activate();
+ return true;
+ }
+ } while (elm = elm.parentNode && elm.className && elm.className.indexOf("bi-nic-editor") >= -1);
+ elm = e;
+ while (elm.nodeType == 3) {
+ elm = elm.parentNode;
+ }
+ if (this.options.css) {
+ for (var itm in this.options.css) {
+ if ($(elm).css(itm) == this.options.css[itm]) {
+ this.activate();
+ return true;
+ }
+ }
+ }
+ this.deactivate();
+ return false;
+ },
+
+ key: function () {
+
+ },
+
+ activate: function () {
+ },
+
+ deactivate: function () {
+ },
+
+ doCommand: function (args) {
+ if (this.options.command) {
+ this.options.editor.nicCommand(this.options.command, args);
+ }
+ this.options.editor.fireEvent("buttonClick", this);
+ }
+});/**
+ * 颜色选择
+ *
+ * Created by GUY on 2015/11/26.
+ * @class BI.RichEditorTextToolbar
+ * @extends BI.Widget
+ */
+BI.RichEditorTextToolbar = BI.inherit(BI.Widget, {
+ _defaultConfig: function () {
+ return BI.extend(BI.RichEditorTextToolbar.superclass._defaultConfig.apply(this, arguments), {
+ baseCls: "bi-text-toolbar bi-background",
+ buttons: [
+ {type: "bi.rich_editor_size_chooser"},
+ {type: "bi.rich_editor_bold_button"},
+ {type: "bi.rich_editor_italic_button"},
+ {type: "bi.rich_editor_underline_button"},
+ {type: "bi.rich_editor_color_chooser"},
+ {type: "bi.rich_editor_background_color_chooser"},
+ {type: "bi.rich_editor_align_left_button"},
+ {type: "bi.rich_editor_align_center_button"},
+ {type: "bi.rich_editor_align_right_button"},
+ ],
+ height: 28
+ });
+ },
- toArray : function(iterable) {
- var length = iterable.length, results = new Array(length);
- while (length--) { results[length] = iterable[length] };
- return results;
- },
+ _init: function () {
+ BI.RichEditorTextToolbar.superclass._init.apply(this, arguments);
+ var self = this, o = this.options;
+ BI.createWidget({
+ type: "bi.left",
+ element: this,
+ items: BI.map(o.buttons, function (i, btn) {
+ return BI.extend(btn, {
+ editor: o.editor
+ });
+ }),
+ hgap: 3,
+ vgap: 3
+ })
+ },
- noSelect : function(element) {
- if(element.setAttribute && element.nodeName.toLowerCase() != 'input' && element.nodeName.toLowerCase() != 'textarea') {
- element.setAttribute('unselectable','on');
- }
- for(var i=0;i
" : c;
+ this.initialContent = c;
+
+ this.elmFrame = $('iframe').attr({
+ 'src': 'javascript:;',
+ 'frameBorder': 0,
+ 'allowTransparency': 'true',
+ 'scrolling': 'no'
+ }).css({height: '100px', width: '100%'}).addClass(prefix + 'frame').appendTo(this.elm.element);
+
+ this.elmFrame.css({width: (o.width - 4) + 'px'});
+
+ var styleList = ['font-size', 'font-family', 'font-weight', 'color'];
+ for (var item in styleList) {
+ this.savedStyles[BI.camelize(item)] = this.elm.element.css(item);
+ }
+
+ setTimeout(BI.bind(this.initFrame, this), 50);
+ },
+
+ disable: function () {
+ this.elm.element.html(this.getContent());
+ },
+
+ initFrame: function () {
+ var fd = $(this.elmFrame.contentWindow.document)[0];
+ fd.designMode = "on";
+ fd.open();
+ var css = this.ne.options.externalCSS;
+ fd.write('