Browse Source

Merge branch 'master' of http://cloud.finedevelop.com:2015/scm/visual/fineui

# Conflicts:
#	dist/_fineui.min.js
#	dist/bundle.min.js
#	dist/fineui.min.js
es6
windy 6 years ago
parent
commit
0bb81da8f1
  1. 72
      dist/bundle.js
  2. 72
      dist/case.js
  3. 72
      dist/fineui.js
  4. 72
      src/case/richeditor/niceditor/niceditor.js

72
dist/bundle.js vendored

@ -83377,6 +83377,8 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
},
setValue: function (v) {
v = v || "";
v = v.startWith("<div>") ? v : "<div>" + v + "</div>";
this.instance.setContent(v);
},
@ -83400,6 +83402,7 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
BI.NicEditor.EVENT_BLUR = "blur";
BI.NicEditor.EVENT_FOCUS = "focus";
BI.NicEditor.EVENT_KEYDOWN = "keydown";
BI.NicEditor.EVENT_KEYUP = "keyup";
BI.shortcut("bi.nic_editor", BI.NicEditor);
var prefix = "niceditor-";
@ -83409,6 +83412,8 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
_init: function () {
nicEditorInstance.superclass._init.apply(this, arguments);
var o = this.options;
var initValue = o.value || "<br>";
initValue = initValue.startWith("<div>") ? initValue : "<div>" + initValue + "</div>";
this.ne = this.options.ne;
this.elm = BI.createWidget({
type: "bi.layout",
@ -83418,8 +83423,9 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
this.elm.element.css({
minHeight: BI.isNumber(o.height) ? (o.height - 8) + "px" : o.height,
outline: "none",
padding: "0 10px"
}).html(o.value);
padding: "0 10px",
wordWrap: "break-word"
}).html(initValue);
if(o.readOnly) {
this.elm.element.attr("contentEditable", false);
@ -83453,8 +83459,7 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
}
this.instanceDoc = document.defaultView;
this.elm.element.on("mousedown", BI.bind(this.selected, this));
this.elm.element.on("keyup", BI.bind(this.keyDown, this));
// this.elm.element.on("keydown", BI.bind(this.keyDown, this));
this.elm.element.on("keydown", BI.bind(this.keyDown, this));
this.elm.element.on("focus", BI.bind(this.selected, this));
this.elm.element.on("blur", BI.bind(this.blur, this));
this.elm.element.on("keyup", BI.bind(this.selected, this));
@ -83566,6 +83571,13 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
},
keyDown: function (e, t) {
if (e.keyCode === 8) {
var html = this.elm.element.html().toLowerCase().trim();
if (html === "<div><br></div>" || html === "<div></div>") {
e.preventDefault()
return;
}
}
this.ne.fireEvent("keydown", e);
},
@ -83587,6 +83599,19 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
this.isFocused = true;
this.elm.element.addClass(prefix + "selected");
}
this.ne.fireEvent("keyup", e);
if (e.keyCode !== 8) {
return;
}
var newLine;
var html = this.elm.element.html().toLowerCase().trim();
if (!html || html === '<br>') {
newLine = $("<div></div>");
this.elm.element.html('');
this.elm.element.append(newLine);
this.setFocus(newLine[0]);
}
// return false;
},
@ -83668,6 +83693,38 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
document.execCommand(cmd, false, args);
},
initSelection: function (newLine) {
var newLineHtml = this._getNewLine();
var el = this.elm.element;
var children = el.children();
if (!children.length) {
// 如果编辑器区域无内容,添加一个空行,重新设置选区
el.append(newLineHtml);
this.initSelection();
return;
}
var last = children.last();
if (newLine) {
// 新增一个空行
var html = last.html().toLowerCase();
var nodeName = last.nodeName;
if ((html !== "<br>" && html !== "<br\/>") || nodeName !== "DIV") {
// 最后一个元素不是空行,添加一个空行,重新设置选区
el.append(newLineHtml);
this.initSelection();
return;
}
}
this.setFocus(last[0]);
},
_getNewLine: function () {
return "<div><br></div>";
},
_isChildOf: function(child, parent) {
var parentNode;
if(child && parent) {
@ -83680,6 +83737,13 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
}
}
return false;
},
_isIE11Below: function() {
if (!BI.isIE()) {
return false;
}
return BI.getIEVersion() < 11;
}
});
}());

72
dist/case.js vendored

@ -10821,6 +10821,8 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
},
setValue: function (v) {
v = v || "";
v = v.startWith("<div>") ? v : "<div>" + v + "</div>";
this.instance.setContent(v);
},
@ -10844,6 +10846,7 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
BI.NicEditor.EVENT_BLUR = "blur";
BI.NicEditor.EVENT_FOCUS = "focus";
BI.NicEditor.EVENT_KEYDOWN = "keydown";
BI.NicEditor.EVENT_KEYUP = "keyup";
BI.shortcut("bi.nic_editor", BI.NicEditor);
var prefix = "niceditor-";
@ -10853,6 +10856,8 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
_init: function () {
nicEditorInstance.superclass._init.apply(this, arguments);
var o = this.options;
var initValue = o.value || "<br>";
initValue = initValue.startWith("<div>") ? initValue : "<div>" + initValue + "</div>";
this.ne = this.options.ne;
this.elm = BI.createWidget({
type: "bi.layout",
@ -10862,8 +10867,9 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
this.elm.element.css({
minHeight: BI.isNumber(o.height) ? (o.height - 8) + "px" : o.height,
outline: "none",
padding: "0 10px"
}).html(o.value);
padding: "0 10px",
wordWrap: "break-word"
}).html(initValue);
if(o.readOnly) {
this.elm.element.attr("contentEditable", false);
@ -10897,8 +10903,7 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
}
this.instanceDoc = document.defaultView;
this.elm.element.on("mousedown", BI.bind(this.selected, this));
this.elm.element.on("keyup", BI.bind(this.keyDown, this));
// this.elm.element.on("keydown", BI.bind(this.keyDown, this));
this.elm.element.on("keydown", BI.bind(this.keyDown, this));
this.elm.element.on("focus", BI.bind(this.selected, this));
this.elm.element.on("blur", BI.bind(this.blur, this));
this.elm.element.on("keyup", BI.bind(this.selected, this));
@ -11010,6 +11015,13 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
},
keyDown: function (e, t) {
if (e.keyCode === 8) {
var html = this.elm.element.html().toLowerCase().trim();
if (html === "<div><br></div>" || html === "<div></div>") {
e.preventDefault()
return;
}
}
this.ne.fireEvent("keydown", e);
},
@ -11031,6 +11043,19 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
this.isFocused = true;
this.elm.element.addClass(prefix + "selected");
}
this.ne.fireEvent("keyup", e);
if (e.keyCode !== 8) {
return;
}
var newLine;
var html = this.elm.element.html().toLowerCase().trim();
if (!html || html === '<br>') {
newLine = $("<div></div>");
this.elm.element.html('');
this.elm.element.append(newLine);
this.setFocus(newLine[0]);
}
// return false;
},
@ -11112,6 +11137,38 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
document.execCommand(cmd, false, args);
},
initSelection: function (newLine) {
var newLineHtml = this._getNewLine();
var el = this.elm.element;
var children = el.children();
if (!children.length) {
// 如果编辑器区域无内容,添加一个空行,重新设置选区
el.append(newLineHtml);
this.initSelection();
return;
}
var last = children.last();
if (newLine) {
// 新增一个空行
var html = last.html().toLowerCase();
var nodeName = last.nodeName;
if ((html !== "<br>" && html !== "<br\/>") || nodeName !== "DIV") {
// 最后一个元素不是空行,添加一个空行,重新设置选区
el.append(newLineHtml);
this.initSelection();
return;
}
}
this.setFocus(last[0]);
},
_getNewLine: function () {
return "<div><br></div>";
},
_isChildOf: function(child, parent) {
var parentNode;
if(child && parent) {
@ -11124,6 +11181,13 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
}
}
return false;
},
_isIE11Below: function() {
if (!BI.isIE()) {
return false;
}
return BI.getIEVersion() < 11;
}
});
}());

72
dist/fineui.js vendored

@ -83626,6 +83626,8 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
},
setValue: function (v) {
v = v || "";
v = v.startWith("<div>") ? v : "<div>" + v + "</div>";
this.instance.setContent(v);
},
@ -83649,6 +83651,7 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
BI.NicEditor.EVENT_BLUR = "blur";
BI.NicEditor.EVENT_FOCUS = "focus";
BI.NicEditor.EVENT_KEYDOWN = "keydown";
BI.NicEditor.EVENT_KEYUP = "keyup";
BI.shortcut("bi.nic_editor", BI.NicEditor);
var prefix = "niceditor-";
@ -83658,6 +83661,8 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
_init: function () {
nicEditorInstance.superclass._init.apply(this, arguments);
var o = this.options;
var initValue = o.value || "<br>";
initValue = initValue.startWith("<div>") ? initValue : "<div>" + initValue + "</div>";
this.ne = this.options.ne;
this.elm = BI.createWidget({
type: "bi.layout",
@ -83667,8 +83672,9 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
this.elm.element.css({
minHeight: BI.isNumber(o.height) ? (o.height - 8) + "px" : o.height,
outline: "none",
padding: "0 10px"
}).html(o.value);
padding: "0 10px",
wordWrap: "break-word"
}).html(initValue);
if(o.readOnly) {
this.elm.element.attr("contentEditable", false);
@ -83702,8 +83708,7 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
}
this.instanceDoc = document.defaultView;
this.elm.element.on("mousedown", BI.bind(this.selected, this));
this.elm.element.on("keyup", BI.bind(this.keyDown, this));
// this.elm.element.on("keydown", BI.bind(this.keyDown, this));
this.elm.element.on("keydown", BI.bind(this.keyDown, this));
this.elm.element.on("focus", BI.bind(this.selected, this));
this.elm.element.on("blur", BI.bind(this.blur, this));
this.elm.element.on("keyup", BI.bind(this.selected, this));
@ -83815,6 +83820,13 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
},
keyDown: function (e, t) {
if (e.keyCode === 8) {
var html = this.elm.element.html().toLowerCase().trim();
if (html === "<div><br></div>" || html === "<div></div>") {
e.preventDefault()
return;
}
}
this.ne.fireEvent("keydown", e);
},
@ -83836,6 +83848,19 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
this.isFocused = true;
this.elm.element.addClass(prefix + "selected");
}
this.ne.fireEvent("keyup", e);
if (e.keyCode !== 8) {
return;
}
var newLine;
var html = this.elm.element.html().toLowerCase().trim();
if (!html || html === '<br>') {
newLine = $("<div></div>");
this.elm.element.html('');
this.elm.element.append(newLine);
this.setFocus(newLine[0]);
}
// return false;
},
@ -83917,6 +83942,38 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
document.execCommand(cmd, false, args);
},
initSelection: function (newLine) {
var newLineHtml = this._getNewLine();
var el = this.elm.element;
var children = el.children();
if (!children.length) {
// 如果编辑器区域无内容,添加一个空行,重新设置选区
el.append(newLineHtml);
this.initSelection();
return;
}
var last = children.last();
if (newLine) {
// 新增一个空行
var html = last.html().toLowerCase();
var nodeName = last.nodeName;
if ((html !== "<br>" && html !== "<br\/>") || nodeName !== "DIV") {
// 最后一个元素不是空行,添加一个空行,重新设置选区
el.append(newLineHtml);
this.initSelection();
return;
}
}
this.setFocus(last[0]);
},
_getNewLine: function () {
return "<div><br></div>";
},
_isChildOf: function(child, parent) {
var parentNode;
if(child && parent) {
@ -83929,6 +83986,13 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
}
}
return false;
},
_isIE11Below: function() {
if (!BI.isIE()) {
return false;
}
return BI.getIEVersion() < 11;
}
});
}());

72
src/case/richeditor/niceditor/niceditor.js

@ -85,6 +85,8 @@
},
setValue: function (v) {
v = v || "";
v = v.startWith("<div>") ? v : "<div>" + v + "</div>";
this.instance.setContent(v);
},
@ -108,6 +110,7 @@
BI.NicEditor.EVENT_BLUR = "blur";
BI.NicEditor.EVENT_FOCUS = "focus";
BI.NicEditor.EVENT_KEYDOWN = "keydown";
BI.NicEditor.EVENT_KEYUP = "keyup";
BI.shortcut("bi.nic_editor", BI.NicEditor);
var prefix = "niceditor-";
@ -117,6 +120,8 @@
_init: function () {
nicEditorInstance.superclass._init.apply(this, arguments);
var o = this.options;
var initValue = o.value || "<br>";
initValue = initValue.startWith("<div>") ? initValue : "<div>" + initValue + "</div>";
this.ne = this.options.ne;
this.elm = BI.createWidget({
type: "bi.layout",
@ -126,8 +131,9 @@
this.elm.element.css({
minHeight: BI.isNumber(o.height) ? (o.height - 8) + "px" : o.height,
outline: "none",
padding: "0 10px"
}).html(o.value);
padding: "0 10px",
wordWrap: "break-word"
}).html(initValue);
if(o.readOnly) {
this.elm.element.attr("contentEditable", false);
@ -161,8 +167,7 @@
}
this.instanceDoc = document.defaultView;
this.elm.element.on("mousedown", BI.bind(this.selected, this));
this.elm.element.on("keyup", BI.bind(this.keyDown, this));
// this.elm.element.on("keydown", BI.bind(this.keyDown, this));
this.elm.element.on("keydown", BI.bind(this.keyDown, this));
this.elm.element.on("focus", BI.bind(this.selected, this));
this.elm.element.on("blur", BI.bind(this.blur, this));
this.elm.element.on("keyup", BI.bind(this.selected, this));
@ -274,6 +279,13 @@
},
keyDown: function (e, t) {
if (e.keyCode === 8) {
var html = this.elm.element.html().toLowerCase().trim();
if (html === "<div><br></div>" || html === "<div></div>") {
e.preventDefault()
return;
}
}
this.ne.fireEvent("keydown", e);
},
@ -295,6 +307,19 @@
this.isFocused = true;
this.elm.element.addClass(prefix + "selected");
}
this.ne.fireEvent("keyup", e);
if (e.keyCode !== 8) {
return;
}
var newLine;
var html = this.elm.element.html().toLowerCase().trim();
if (!html || html === '<br>') {
newLine = $("<div></div>");
this.elm.element.html('');
this.elm.element.append(newLine);
this.setFocus(newLine[0]);
}
// return false;
},
@ -376,6 +401,38 @@
document.execCommand(cmd, false, args);
},
initSelection: function (newLine) {
var newLineHtml = this._getNewLine();
var el = this.elm.element;
var children = el.children();
if (!children.length) {
// 如果编辑器区域无内容,添加一个空行,重新设置选区
el.append(newLineHtml);
this.initSelection();
return;
}
var last = children.last();
if (newLine) {
// 新增一个空行
var html = last.html().toLowerCase();
var nodeName = last.nodeName;
if ((html !== "<br>" && html !== "<br\/>") || nodeName !== "DIV") {
// 最后一个元素不是空行,添加一个空行,重新设置选区
el.append(newLineHtml);
this.initSelection();
return;
}
}
this.setFocus(last[0]);
},
_getNewLine: function () {
return "<div><br></div>";
},
_isChildOf: function(child, parent) {
var parentNode;
if(child && parent) {
@ -388,6 +445,13 @@
}
}
return false;
},
_isIE11Below: function() {
if (!BI.isIE()) {
return false;
}
return BI.getIEVersion() < 11;
}
});
}());

Loading…
Cancel
Save