| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Old Sites/eadsa/plugins/editors/jce/libraries/js/ |
Upload File : |
/**
* @version $Id: editor.js 137 2009-06-26 10:22:17Z happynoodleboy $
* @package JCE
* @copyright Copyright (C) 2005 - 2009 Ryan Demmer. All rights reserved.
* @author Ryan Demmer
* @license GNU/GPL
* JCE is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
*/
/**
* JContentEditor Object
*/
var JContentEditor = {
_bookmark : {},
setBookmark : function(id) {
var t = this, DOM = tinymce.DOM, Event = tinymce.dom.Event;
// only for IE
if (tinymce.isIE) {
if (!Event.domLoaded) {
Event.add(document, 'init', function() {
t.setBookmark();
});
return;
} else {
tinyMCE.onAddEditor.add(function(mgr, ed) {
Event.add(document, 'mousedown', function(e) {
var el = e.target, ta = ed.getElement(), toggle = ta.previousSibling;
// return if mousedown is somewhere on editor
if (el == ed.getContainer() || (el == ta && ta.className == 'advcode_toggle') || el == toggle || DOM.getParent(el, 'span.mceEditor'))
return;
if (ed.selection) {
t._bookmark[ed.id] = ed.selection.getBookmark();
}
});
});
}
}
},
/**
* Set the editor content
* @param {String} id The editor id
* @param {String} html The html content to set
*/
setContent: function(id, html) {
var ed = tinyMCE.get(id);
if (ed) {
ed.setContent(html);
} else {
document.getElementById(id).value = html;
}
},
/**
* Get the editor content
* @param {String} id The editor id
*/
getContent: function(id) {
var ed = tinyMCE.get(id);
if (ed) {
return ed.getContent();
}
return document.getElementById(id).value;
},
/**
* Save the editor content
* @param {String} id The editor id
*/
save: function(id) {
var ed = tinyMCE.get(id);
if (ed && !ed.getContent()) {
ed.setContent(ed.getElement().value);
}
tinyMCE.triggerSave();
},
/**
* Insert content into the editor. This function is provided for editor-xtd buttons and includes methods for inserting into textareas
* @param {String} el The editor id
* @param {String} v The text to insert
*/
insert: function(el, v) {
if (typeof el == 'string') {
el = document.getElementById(el);
}
if (/mceEditor/.test(el.className)) {
if (tinymce.isIE) {
if (window.parent.tinymce) {
var ed = window.parent.tinyMCE.get(el.id);
if (ed) {
if (this._bookmark[ed.id]) {
ed.selection.moveToBookmark(this._bookmark[ed.id]);
}
}
}
}
tinyMCE.execInstanceCommand(el.id, 'mceInsertContent', false, v, true);
} else {
// IE
if (document.selection) {
el.focus();
s = document.selection.createRange();
s.text = v;
// Mozilla / Netscape
} else if (el.selectionStart || el.selectionStart == '0') {
var startPos = el.selectionStart;
var endPos = el.selectionEnd;
el.value = el.value.substring(0, startPos) + v + el.value.substring(endPos, el.value.length);
// Other
} else {
el.value += v;
}
}
}
};