初始化
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
/**
|
||||
* Created by Administrator on 2017/4/1.
|
||||
*/
|
||||
var ue = UE.getEditor('editor');
|
||||
|
||||
|
||||
function isFocus(e){
|
||||
alert(UE.getEditor('editor').isFocus());
|
||||
UE.dom.domUtils.preventDefault(e)
|
||||
}
|
||||
function setblur(e){
|
||||
UE.getEditor('editor').blur();
|
||||
UE.dom.domUtils.preventDefault(e)
|
||||
}
|
||||
function insertHtml() {
|
||||
var value = prompt('????html????', '');
|
||||
UE.getEditor('editor').execCommand('insertHtml', value)
|
||||
}
|
||||
function createEditor() {
|
||||
enableBtn();
|
||||
UE.getEditor('editor');
|
||||
}
|
||||
function getAllHtml() {
|
||||
alert(UE.getEditor('editor').getAllHtml())
|
||||
}
|
||||
function getContent() {
|
||||
var arr = [];
|
||||
arr.push("");
|
||||
arr.push("");
|
||||
arr.push(UE.getEditor('editor').getContent());
|
||||
alert(arr.join("\n"));
|
||||
}
|
||||
function getPlainTxt() {
|
||||
var arr = [];
|
||||
arr.push("");
|
||||
arr.push("");
|
||||
arr.push(UE.getEditor('editor').getPlainTxt());
|
||||
alert(arr.join('\n'))
|
||||
}
|
||||
function setContent(isAppendTo) {
|
||||
var arr = [];
|
||||
arr.push("");
|
||||
UE.getEditor('editor').setContent('??????ueditor', isAppendTo);
|
||||
alert(arr.join("\n"));
|
||||
}
|
||||
function setDisabled() {
|
||||
UE.getEditor('editor').setDisabled('fullscreen');
|
||||
disableBtn("enable");
|
||||
}
|
||||
|
||||
function setEnabled() {
|
||||
UE.getEditor('editor').setEnabled();
|
||||
enableBtn();
|
||||
}
|
||||
|
||||
function getText() {
|
||||
|
||||
var range = UE.getEditor('editor').selection.getRange();
|
||||
range.select();
|
||||
var txt = UE.getEditor('editor').selection.getText();
|
||||
alert(txt)
|
||||
}
|
||||
|
||||
function getContentTxt() {
|
||||
var arr = [];
|
||||
arr.push("");
|
||||
arr.push("");
|
||||
arr.push(UE.getEditor('editor').getContentTxt());
|
||||
alert(arr.join("\n"));
|
||||
}
|
||||
function hasContent() {
|
||||
var arr = [];
|
||||
arr.push("");
|
||||
arr.push("");
|
||||
arr.push(UE.getEditor('editor').hasContents());
|
||||
alert(arr.join("\n"));
|
||||
}
|
||||
function setFocus() {
|
||||
UE.getEditor('editor').focus();
|
||||
}
|
||||
function deleteEditor() {
|
||||
disableBtn();
|
||||
UE.getEditor('editor').destroy();
|
||||
}
|
||||
function disableBtn(str) {
|
||||
var div = document.getElementById('btns');
|
||||
var btns = UE.dom.domUtils.getElementsByTagName(div, "button");
|
||||
for (var i = 0, btn; btn = btns[i++];) {
|
||||
if (btn.id == str) {
|
||||
UE.dom.domUtils.removeAttributes(btn, ["disabled"]);
|
||||
} else {
|
||||
btn.setAttribute("disabled", "true");
|
||||
}
|
||||
}
|
||||
}
|
||||
function enableBtn() {
|
||||
var div = document.getElementById('btns');
|
||||
var btns = UE.dom.domUtils.getElementsByTagName(div, "button");
|
||||
for (var i = 0, btn; btn = btns[i++];) {
|
||||
UE.dom.domUtils.removeAttributes(btn, ["disabled"]);
|
||||
}
|
||||
}
|
||||
|
||||
function getLocalData () {
|
||||
alert(UE.getEditor('editor').execCommand( "getlocaldata" ));
|
||||
}
|
||||
|
||||
function clearLocalData () {
|
||||
UE.getEditor('editor').execCommand( "clearlocaldata" );
|
||||
alert("")
|
||||
}
|
||||
Reference in New Issue
Block a user