Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
template.js.struts2.jquery.richtext.struts2.min.js Maven / Gradle / Ivy
/*
jquery.richtext.struts2.js
Integration of richtext editor with struts 2
Requires use of jquery.struts2.js
Copyright (c) 2010 - 2016 Johannes Geppert http://www.jgeppert.com
Dual licensed under the MIT and GPL licenses:
http://www.opensource.org/licenses/mit-license.php
http://www.gnu.org/licenses/gpl.html
*/
'use strict';(function(f){f.struts2_jquery_richtext={editors:[],editorsTinymce:[],ckeditorTimer:void 0,clean:function(d){var a=this;window.CKEDITOR&&f.each(a.editors,function(b,g){var f=CKEDITOR.instances[g];0!==d.length&&f&&f.textarea===d[0]||(a.editors.splice(b),delete CKEDITOR.instances[g])})},ckeditor:function(d,a){var b=this,g,h="s2j_ckeditor_"+a.id,e;b.log("init ckeditor with id: "+a.id);b.require("js/ckeditor/ckeditor.js");b.require("js/ckeditor/adapters/jquery.js");(g=CKEDITOR.instances[a.id])&&
CKEDITOR.remove(g);b.clean(d);e=function(){b.editors[b.editors.length]=a.id;if(a.onEditorReadyTopics){var c={};b.publishTopic(d,a.onEditorReadyTopics,c);b.publishTopic(d,a.onalw,c)}};a.language=a.editorLocal?a.editorLocal:b.local;a.resizable=!1;a.resize_enabled=a.editorResizable;a.href&&"#"!==a.href?(d.isSubscribed(h)&&d.unsubscribe(h),d.subscribe(h,function(c,b){d.ckeditor(e,a)}),a.oncom=a.oncom&&""!==a.oncom?a.oncom+","+h:h,b.container(d,a)):(b.container(d,a),d.ckeditor(e,a));g=CKEDITOR.instances[a.id];
if(a.onblurtopics)g.on("blur",function(c){c=f(b.escId(c.editor.element.$.id));b.publishTopic(c,a.onblurtopics,{editor:c});b.publishTopic(c,a.onalw,{editor:c})});if(a.onfocustopics)g.on("focus",function(c){c=f(b.escId(c.editor.element.$.id));b.publishTopic(c,a.onfocustopics,{editor:c});b.publishTopic(c,a.onalw,{editor:c})});if(a.oncha)g.on("change",function(c){c=f(b.escId(c.editor.element.$.id));b.publishTopic(c,a.oncha,{editor:c});b.publishTopic(c,a.onalw,{editor:c})})},tinymceEditor:function(d,a){var b=
this,g="s2j_tinymce_"+a.id;b.log("init tinymce with id: "+a.id);b.require("js/tinymce/jquery.tinymce.min.js");if(window.tinymce)try{window.tinymce.remove("#"+a.id)}catch(f){b.log("destroyed old tinyMCE instance for: "+a.id)}a.resizable=!1;a.editorResizable&&(a.theme_advanced_resizing=!0);b.container(d,a);a.script_url=a.path+"tinymce.min.js";a.oncha&&(a.onchange_callback=function(e){if(tinyMCE.activeEditor.isDirty()){var c={};c.editor=e;c.content=e.getBody().innerHTML;b.publishTopic(d,a.oncha,c);b.publishTopic(d,
a.onalw,c)}});a.onsavetopics&&(a.save_callback=function(e,c,g){var f={};f.editorid=e;f.html=c;f.body=g;b.publishTopic(d,a.onsavetopics,f);b.publishTopic(d,a.onalw,f);return f.html});a.oneventtopics&&(a.handle_event_callback=function(e){var c={};c.event=e;c.returnvalue=!0;b.publishTopic(d,a.oneventtopics,c);b.publishTopic(d,a.onalw,c);return c.returnvalue});a.setup=function(e){e.on("init",function(c){tinyMCE.execCommand("mceAddEditor",!0,a.id);e.getDoc();if(a.onblurtopics)e.on("blur",function(c){b.publishTopic(d,
a.onblurtopics,{editor:e});b.publishTopic(d,a.onalw,{editor:e})});if(a.onfocustopics)e.on("focus",function(c){b.publishTopic(d,a.onfocustopics,{editor:e});b.publishTopic(d,a.onalw,{editor:e})})});e.on("SaveContent",function(a){return!1});if(a.pasteplain)e.on("change",function(a){if(a.ctrlKey&&(118===a.charCode||86===a.keyCode))return e.execCommand("mcePasteText",!0),e.execCommand("mceAddUndoLevel"),tinymce.dom.Event.cancel(a)})};a.pasteplain&&(a.paste_text_sticky=!0,a.paste_text_use_dialog=!0);a.language=
a.editorLocal?a.editorLocal:b.local;a.href&&"#"!==a.href?(d.isSubscribed(g)&&d.unsubscribe(g),d.subscribe(g,function(b,c){d.tinymce(a)}),a.oncom=g,b.container(d,a)):(b.container(d,a),d.tinymce(a))}};f.extend(!0,f.struts2_jquery_richtext,f.struts2_jquery);f.struts2_jquery_richtext.debugPrefix="[struts2_jquery_richtext] "})(jQuery);