Browse Source

富文本编辑器

es6
guy 7 years ago
parent
commit
d2e2fcc581
  1. 19
      bi/base.js
  2. 2
      demo/js/base/editor/demo.rich_editor.js
  3. 19
      dist/base.js
  4. 19
      dist/bundle.js
  5. 2
      dist/demo.js
  6. 4
      dist/resource.css
  7. 19
      src/base/richeditor/bar/texttoolbar.js
  8. 4
      src/css/resource/font.css
  9. 7
      src/less/resource/font.less

19
bi/base.js

@ -16200,6 +16200,25 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, {
vgap: 3 vgap: 3
}) })
}, },
mounted: function () {
var self = this;
if (BI.isIE9Below()) {//IE8下必须要设置unselectable才能不blur输入框
this.element.mousedown(function () {
self._noSelect(self.element[0]);
});
this._noSelect(this.element[0]);
}
},
_noSelect: function (element) {
if (element.setAttribute && element.nodeName.toLowerCase() != 'input' && element.nodeName.toLowerCase() != 'textarea') {
element.setAttribute('unselectable', 'on');
}
for (var i = 0; i < element.childNodes.length; i++) {
this._noSelect(element.childNodes[i]);
}
}
}); });
BI.shortcut('bi.rich_editor_text_toolbar', BI.RichEditorTextToolbar);/** BI.shortcut('bi.rich_editor_text_toolbar', BI.RichEditorTextToolbar);/**
* 富文本编辑器 * 富文本编辑器

2
demo/js/base/editor/demo.rich_editor.js

@ -13,7 +13,7 @@ Demo.RichEditor = BI.inherit(BI.Widget, {
type: "bi.vertical", type: "bi.vertical",
element: this, element: this,
hgap: 30, hgap: 30,
vgap: 20, vgap: 50,
items: [this.editor] items: [this.editor]
}) })
}, },

19
dist/base.js vendored

@ -16200,6 +16200,25 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, {
vgap: 3 vgap: 3
}) })
}, },
mounted: function () {
var self = this;
if (BI.isIE9Below()) {//IE8下必须要设置unselectable才能不blur输入框
this.element.mousedown(function () {
self._noSelect(self.element[0]);
});
this._noSelect(this.element[0]);
}
},
_noSelect: function (element) {
if (element.setAttribute && element.nodeName.toLowerCase() != 'input' && element.nodeName.toLowerCase() != 'textarea') {
element.setAttribute('unselectable', 'on');
}
for (var i = 0; i < element.childNodes.length; i++) {
this._noSelect(element.childNodes[i]);
}
}
}); });
BI.shortcut('bi.rich_editor_text_toolbar', BI.RichEditorTextToolbar);/** BI.shortcut('bi.rich_editor_text_toolbar', BI.RichEditorTextToolbar);/**
* 富文本编辑器 * 富文本编辑器

19
dist/bundle.js vendored

@ -45006,6 +45006,25 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, {
vgap: 3 vgap: 3
}) })
}, },
mounted: function () {
var self = this;
if (BI.isIE9Below()) {//IE8下必须要设置unselectable才能不blur输入框
this.element.mousedown(function () {
self._noSelect(self.element[0]);
});
this._noSelect(this.element[0]);
}
},
_noSelect: function (element) {
if (element.setAttribute && element.nodeName.toLowerCase() != 'input' && element.nodeName.toLowerCase() != 'textarea') {
element.setAttribute('unselectable', 'on');
}
for (var i = 0; i < element.childNodes.length; i++) {
this._noSelect(element.childNodes[i]);
}
}
}); });
BI.shortcut('bi.rich_editor_text_toolbar', BI.RichEditorTextToolbar);/** BI.shortcut('bi.rich_editor_text_toolbar', BI.RichEditorTextToolbar);/**
* 富文本编辑器 * 富文本编辑器

2
dist/demo.js vendored

@ -824,7 +824,7 @@ BI.shortcut("demo.multifile_editor", Demo.CodeEditor);Demo.RichEditor = BI.inher
type: "bi.vertical", type: "bi.vertical",
element: this, element: this,
hgap: 30, hgap: 30,
vgap: 20, vgap: 50,
items: [this.editor] items: [this.editor]
}) })
}, },

4
dist/resource.css vendored

@ -138,6 +138,10 @@ textarea::-webkit-scrollbar-thumb:hover {
/* iOS 4.1- */ /* iOS 4.1- */
} }
@font-face {
font-family: 'bi';
src: url('font/iconfont.eot') /* IE6-IE8 */;
}
.b-font { .b-font {
font-family: "bi"; font-family: "bi";
font-style: normal; font-style: normal;

19
src/base/richeditor/bar/texttoolbar.js

@ -39,5 +39,24 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, {
vgap: 3 vgap: 3
}) })
}, },
mounted: function () {
var self = this;
if (BI.isIE9Below()) {//IE8下必须要设置unselectable才能不blur输入框
this.element.mousedown(function () {
self._noSelect(self.element[0]);
});
this._noSelect(this.element[0]);
}
},
_noSelect: function (element) {
if (element.setAttribute && element.nodeName.toLowerCase() != 'input' && element.nodeName.toLowerCase() != 'textarea') {
element.setAttribute('unselectable', 'on');
}
for (var i = 0; i < element.childNodes.length; i++) {
this._noSelect(element.childNodes[i]);
}
}
}); });
BI.shortcut('bi.rich_editor_text_toolbar', BI.RichEditorTextToolbar); BI.shortcut('bi.rich_editor_text_toolbar', BI.RichEditorTextToolbar);

4
src/css/resource/font.css

@ -4,6 +4,10 @@
/* iOS 4.1- */ /* iOS 4.1- */
} }
@font-face {
font-family: 'bi';
src: url('font/iconfont.eot') /* IE6-IE8 */;
}
.b-font { .b-font {
font-family: "bi"; font-family: "bi";
font-style: normal; font-style: normal;

7
src/less/resource/font.less

@ -7,6 +7,13 @@
src: url('@{webUrl}font/iconfont.eot'), /* IE6-IE8 */ url('@{webUrl}font/iconfont.woff') format('woff'), /* chrome、firefox */ url('@{webUrl}font/iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('@{webUrl}font/iconfont.svg#svgFontName') format('svg'); /* iOS 4.1- */ src: url('@{webUrl}font/iconfont.eot'), /* IE6-IE8 */ url('@{webUrl}font/iconfont.woff') format('woff'), /* chrome、firefox */ url('@{webUrl}font/iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('@{webUrl}font/iconfont.svg#svgFontName') format('svg'); /* iOS 4.1- */
} }
html.ie9below {
@font-face {
font-family: 'bi';
src: url('@{webUrl}font/iconfont.eot') /* IE6-IE8 */
}
}
.b-font { .b-font {
font-family: "bi"; font-family: "bi";
font-style: normal; font-style: normal;

Loading…
Cancel
Save