安装插件后 不能正常预览
问题代码区域
c.onsubmit.add(function() {}) 的错误
下面是 wp中的js代码 那位大什么帮忙 解读一番也好
run: function() { var b = this; this.checkpost(), this.schedule = a.schedule({ time: 15e3, func: function() { wp.autosave.local.save() }, repeat: !0, protect: !0 }), a(form#post).on(submit.autosave-local, function() { var c = undefined != typeof tinymce && tinymce.get(content), d = a(#post_id).val() || 0; c && !c.ishidden() ? c.onsubmit.add(function() { wp.autosave.local.save({ post_title: a(#title).val() || , content: a(#content).val() || , excerpt: a(#excerpt).val() || }) }) : b.save({ post_title: a(#title).val() || , content: a(#content).val() || , excerpt: a(#excerpt).val() || }), wpcookies.set(wp-saving-post- + d, check) }) },
在autosave.min.js文件中
错误提示 uncaught typeerror: cannot read property 'add' of undefined
没太看懂这个js 关键是 ckeditor.utils.js 和这个文件的关系 以及 如何调用,作用域是什么完全搞不清楚。
function autosave_parse_response(a) { var b, c, d = wpajax.parseajaxresponse(a, autosave); return d && d.responses && d.responses.length && (d.responses[0].supplemental && (c = d.responses[0].supplemental, jquery.each(c, function(a, b) { a.match(/^replace-/) && jquery(# + a.replace(replace-, )).val(b) })), d.errors || ((b = parseint(d.responses[0].id, 10)) && autosave_update_slug(b), d.responses[0].data && jquery(.autosave-message).text(d.responses[0].data))), d}function autosave_saved(a) { blocksave = !1, autosave_parse_response(a), autosave_enable_buttons()}function autosave_saved_new(a) { blocksave = !1; var b, c = autosave_parse_response(a); c && c.responses.length && !c.errors ? (b = parseint(c.responses[0].id, 10), b && (notsaved = !1, jquery(#auto_draft).val(0)), autosave_enable_buttons(), autosavedelaypreview && (autosavedelaypreview = !1, dopreview())) : autosave_enable_buttons()}function autosave_update_slug(a) { undefined != makeslugeditclickable && jquery.isfunction(makeslugeditclickable) && !jquery(#edit-slug-box > *).size() && jquery.post(ajaxurl, { action: sample-permalink, post_id: a, new_title: fullscreen && fullscreen.settings.visible ? jquery(#wp-fullscreen-title).val() : jquery(#title).val(), samplepermalinknonce: jquery(#samplepermalinknonce).val() }, function(a) { if (-1 !== a) { var b = jquery(#edit-slug-box); b.html(a), b.hasclass(hidden) && b.fadein(fast, function() { b.removeclass(hidden) }), makeslugeditclickable() } })}function autosave_loading() { jquery(.autosave-message).html(autosavel10n.savingtext)}function autosave_enable_buttons() { jquery(document).trigger(autosave-enable-buttons), wp.heartbeat && wp.heartbeat.hasconnectionerror() || settimeout(function() { var a = jquery(#submitpost); a.find(:button, :submit).removeattr(disabled), a.find(.spinner).hide() }, 500)}function autosave_disable_buttons() { jquery(document).trigger(autosave-disable-buttons), jquery(#submitpost).find(:button, :submit).prop(disabled, !0), settimeout(autosave_enable_buttons, 5e3)}function delayed_autosave() { settimeout(function() { blocksave || autosave() }, 200)}var autosave, autosaveperiodical, fullscreen, dopreview, autosavelast = , autosavedelaypreview = !1, notsaved = !0, blocksave = !1, autosavelockrelease = !0;jquery(document).ready(function(a) { autosavelast = a(#wp-content-wrap).hasclass(tmce-active) && undefined != typeof switcheditors ? wp.autosave.getcomparestring({ post_title: a(#title).val() || , content: switcheditors.pre_wpautop(a(#content).val()) || , excerpt: a(#excerpt).val() || }) : wp.autosave.getcomparestring(), autosaveperiodical = a.schedule({ time: 1e3 * autosavel10n.autosaveinterval, func: function() { autosave() }, repeat: !0, protect: !0 }), a(#post).submit(function() { a.cancel(autosaveperiodical), autosavelockrelease = !1 }), a('input[type=submit], a.submitdelete', #submitpost).click(function() { blocksave = !0, window.onbeforeunload = null, a(:button, :submit, #submitpost).each(function() { var b = a(this); b.hasclass(button-primary) ? b.addclass(button-primary-disabled) : b.addclass(button-disabled) }), publish == a(this).attr(id) ? a(#major-publishing-actions .spinner).show() : a(#minor-publishing .spinner).show() }), window.onbeforeunload = function() { var b, c = undefined != typeof tinymce ? tinymce.activeeditor : !1; if (c && !c.ishidden()) { if (c.isdirty()) return autosavel10n.savealert } else if (b = fullscreen && fullscreen.settings.visible ? wp.autosave.getcomparestring({ post_title: a(#wp-fullscreen-title).val() || , content: a(#wp_mce_fullscreen).val() || , excerpt: a(#excerpt).val() || }) : wp.autosave.getcomparestring(), b != autosavelast) return autosavel10n.savealert }, a(window).unload(function(b) { autosavelockrelease && (b.target && #document != b.target.nodename || a.ajax({ type: post, url: ajaxurl, async: !1, data: { action: wp-remove-post-lock, _wpnonce: a(#_wpnonce).val(), post_id: a(#post_id).val(), active_post_lock: a(#active_post_lock).val() } })) }), a(#post-preview).click(function() { return 1 == a(#auto_draft).val() && notsaved ? (autosavedelaypreview = !0, autosave(), !1) : (dopreview(), !1) }), dopreview = function() { a(input#wp-preview).val(dopreview), a(form#post).attr(target, wp-preview).submit().attr(target, ); var b = navigator.useragent.tolowercase(); - 1 != b.indexof(safari) && -1 == b.indexof(chrome) && a(form#post).attr(action, function(a, b) { return b + ?t= + (new date).gettime() }), a(input#wp-preview).val() }, a(#title).on(keydown.editor-focus, function(b) { var c; 9 == b.which && (b.ctrlkey || b.altkey || b.shiftkey || (undefined != typeof tinymce && (c = tinymce.get(content)), c && !c.ishidden() ? a(this).one(keyup, function() { a(#content_tbl td.mcetoolbar > a).focus() }) : a(#content).focus(), b.preventdefault())) }), 1 == a(#auto_draft).val() && a(#title).blur(function() { this.value && 1 == a(#auto_draft).val() && delayed_autosave() }), a(document).on(heartbeat-connection-lost.autosave, function(b, c, d) { if (timeout === c || 503 == d) { var e = a(#lost-connection-notice); wp.autosave.local.hasstorage || e.find(.hide-if-no-sessionstorage).hide(), e.show(), autosave_disable_buttons() } }).on(heartbeat-connection-restored.autosave, function() { a(#lost-connection-notice).hide(), autosave_enable_buttons() })}), autosave = function() { var a, b, c = wp.autosave.getpostdata(); return blocksave = !0, c.autosave ? block == jquery(#tb_window).css(display) ? !1 : (a = wp.autosave.getcomparestring(c), a == autosavelast ? !1 : (autosavelast = a, jquery(document).triggerhandler(wpcountwords, [c.content]), autosave_disable_buttons(), b = 1 == c.auto_draft ? autosave_saved_new : autosave_saved, jquery.ajax({ data: c, beforesend: autosave_loading, type: post, url: ajaxurl, success: b }), !0)) : !1}, window.wp = window.wp || {}, wp.autosave = wp.autosave || {}, function(a) { wp.autosave.getpostdata = function() { var b, c, d = undefined != typeof tinymce ? tinymce.activeeditor : null, e = [], f = { action: autosave, autosave: !0, post_id: a(#post_id).val() || 0, autosavenonce: a(#autosavenonce).val() || , post_type: a(#post_type).val() || , post_author: a(#post_author).val() || , excerpt: a(#excerpt).val() || }; if (d && !d.ishidden()) { if (d.plugins.spellchecker && d.plugins.spellchecker.active) return f.autosave = !1, f; mce_fullscreen == d.id && tinymce.get(content).setcontent(d.getcontent({ format: raw }), { format: raw }), tinymce.triggersave() } return undefined != typeof fullscreen && fullscreen.settings.visible ? (f.post_title = a(#wp-fullscreen-title).val() || , f.content = a(#wp_mce_fullscreen).val() || ) : (f.post_title = a(#title).val() || , f.content = a(#content).val() || ), a('input[id^=in-category-]:checked').each(function() { e.push(this.value) }), f.catslist = e.join(,), (b = a(#post_name).val()) && (f.post_name = b), (c = a(#parent_id).val()) && (f.parent_id = c), a(#comment_status).prop(checked) && (f.comment_status = open), a(#ping_status).prop(checked) && (f.ping_status = open), 1 == a(#auto_draft).val() && (f.auto_draft = 1), f }, wp.autosave.getcomparestring = function(b) { return object == typeof b ? (b.post_title || ) + :: + (b.content || ) + :: + (b.excerpt || ) : (a(#title).val() || ) + :: + (a(#content).val() || ) + :: + (a(#excerpt).val() || ) }, wp.autosave.local = { lastsaveddata: , blog_id: 0, hasstorage: !1, checkstorage: function() { var a = math.random(), b = !1; try { sessionstorage.setitem(wp-test, a), b = sessionstorage.getitem(wp-test) == a, sessionstorage.removeitem(wp-test) } catch (c) {} return this.hasstorage = b, b }, getstorage: function() { var a = !1; return this.hasstorage && this.blog_id && (a = sessionstorage.getitem(wp-autosave- + this.blog_id), a = a ? json.parse(a) : {}), a }, setstorage: function(a) { var b; return this.hasstorage && this.blog_id ? (b = wp-autosave- + this.blog_id, sessionstorage.setitem(b, json.stringify(a)), null !== sessionstorage.getitem(b)) : !1 }, getdata: function() { var b = this.getstorage(), c = a(#post_id).val(); return b && c ? b[post_ + c] || !1 : !1 }, setdata: function(b) { var c = this.getstorage(), d = a(#post_id).val(); if (!c || !d) return !1; if (b) c[post_ + d] = b; else { if (!c.hasownproperty(post_ + d)) return !1; delete c[post_ + d] } return this.setstorage(c) }, save: function(b) { var c, d, e = !1; return b ? (c = this.getdata() || {}, a.extend(c, b), c.autosave = !0) : c = wp.autosave.getpostdata(), c.autosave ? (d = wp.autosave.getcomparestring(c), d == this.lastsaveddata ? !1 : (c.save_time = (new date).gettime(), c.status = a(#post_status).val() || , e = this.setdata(c), e && (this.lastsaveddata = d), e)) : !1 }, init: function(b) { var c = this; this.checkstorage() && (a(#content).length || a(#excerpt).length) && (b && a.extend(this, b), this.blog_id || (this.blog_id = undefined != typeof window.autosavel10n ? window.autosavel10n.blog_id : 0), a(document).ready(function() { c.run() })) }, run: function() { var b = this; this.checkpost(), this.schedule = a.schedule({ time: 15e3, func: function() { wp.autosave.local.save() }, repeat: !0, protect: !0 }), a(form#post).on(submit.autosave-local, function() { var c = undefined != typeof tinymce && tinymce.get(content), d = a(#post_id).val() || 0; c && !c.ishidden() ? c.onsubmit.add(function() { wp.autosave.local.save({ post_title: a(#title).val() || , content: a(#content).val() || , excerpt: a(#excerpt).val() || }) }) : b.save({ post_title: a(#title).val() || , content: a(#content).val() || , excerpt: a(#excerpt).val() || }), wpcookies.set(wp-saving-post- + d, check) }) }, compare: function(a, b) { function c(a) { return a.tostring().replace(/[\x20\t\r\n\f]+/g, ) } return c(a || ) == c(b || ) }, checkpost: function() { var b, c, d, e, f = this, g = this.getdata(), h = a(#post_id).val() || 0, i = wpcookies.get(wp-saving-post- + h); if (g) return i && (wpcookies.remove(wp-saving-post- + h), saved == i) ? (this.setdata(!1), void 0) : (a(#has-newer-autosave).length || (b = a(#content).val() || , c = a(#title).val() || , d = a(#excerpt).val() || , a(#wp-content-wrap).hasclass(tmce-active) && undefined != typeof switcheditors && (b = switcheditors.pre_wpautop(b)), check != i && this.compare(b, g.content) && this.compare(c, g.post_title) && this.compare(d, g.excerpt) || (this.restore_post_data = g, this.undo_post_data = { content: b, post_title: c, excerpt: d }, e = a(#local-storage-notice), a(.wrap h2).first().after(e.addclass(updated).show()), e.on(click, function(b) { var c = a(b.target); c.hasclass(restore-backup) ? (f.restorepost(f.restore_post_data), c.parent().hide(), a(this).find(p.undo-restore).show()) : c.hasclass(undo-restore-backup) && (f.restorepost(f.undo_post_data), c.parent().hide(), a(this).find(p.local-restore).show()), b.preventdefault() }))), void 0) }, restorepost: function(b) { var c; return b ? (this.lastsaveddata = wp.autosave.getcomparestring(b), a(#title).val() != b.post_title && a(#title).focus().val(b.post_title || ), a(#excerpt).val(b.excerpt || ), c = undefined != typeof tinymce && tinymce.get(content), c && !c.ishidden() && undefined != typeof switcheditors ? (c.undomanager.add(), c.setcontent(b.content ? switcheditors.wpautop(b.content) : )) : (a(#content-html).click(), a(#content).val(b.content)), !0) : !1 } }, wp.autosave.local.init()}(jquery);
ckeditor 中的js
var editorcke;jquery(document).ready(function () { ckeditorsettings.configuration['on'] = { configloaded : function ( evt ) { if (typeof(ckeditorsettings.externalplugins) != 'undefined') { var externals=new array(); for (var x in ckeditorsettings.externalplugins) { ckeditor.plugins.addexternal(x, ckeditorsettings.externalplugins[x]); externals.push(x); } } evt.editor.config.extraplugins += (evt.editor.config.extraplugins ? ','+externals.join(',') : externals.join(',')); if (evt.editor.config[evt.editor.config.toolbar +'_removebuttons']); evt.editor.config.removebuttons = evt.editor.config[evt.editor.config.toolbar +'_removebuttons']; ckeditor.addcss(evt.editor.config.extracss); } }; ckeditor.on( 'instanceready', function( ev ) { var dtd = ckeditor.dtd; for ( var e in ckeditor.tools.extend( {}, dtd.$nonbodycontent, dtd.$block, dtd.$listitem, dtd.$tablecontent ) ) { ev.editor.dataprocessor.writer.setrules( e, ckeditorsettings.outputformat); } ev.editor.dataprocessor.writer.setrules( 'br', { breakafteropen : true }); ev.editor.dataprocessor.writer.setrules( 'pre', { indent: false }); editorcke = ckeditor.instances['content']; }); if (ckeditorsettings.textarea_id != 'comment'){ edinsertcontentold = function () { return ; }; if(typeof(window.edinsertcontent) != 'undefined'){ edinsertcontentold = window.edinsertcontent; } window.edinsertcontent = function (myfield, myvalue) { if(typeof(ckeditor) != 'undefined' && typeof(editorcke) != 'undefined'){ editorcke.inserthtml(myvalue); } else { edinsertcontentold(myfield, myvalue); } }; var autosaveold = function () { return ; }; if(typeof(window.autosave) != 'undefined'){ autosaveold = window.autosave; } if(typeof(window.switcheditors) != 'undefined') { window.switcheditors.go = function(id, mode) { if ('tinymce' == mode || 'tmce' == mode) { jquery('#'+id).closest('.html-active').removeclass('html-active').addclass('tmce-active'); ckeditoron(id); } else { jquery('#'+id).closest('.tmce-active').removeclass('tmce-active').addclass('html-active'); ckeditoroff(id); jquery('.js .theeditor').attr('style', 'color: black;'); } }; } } //if qtranslate plugin enabled if ( ckeditorsettings.qtransenabled ){ //custom version of switcheditors function when qtranslate plugin is enabled if(typeof(window.switcheditors) != 'undefined') { window.switcheditors.go = function(id, lang) { id = id || 'content'; lang = lang || 'toggle'; if ( 'toggle' == lang ) { if ( ed && !ed.ishidden() ) lang = 'html'; else lang = 'tmce'; } else if( 'tinymce' == lang ) lang = 'tmce'; var inst = tinymce.get('qtrans_textarea_' + id); var vta = document.getelementbyid('qtrans_textarea_' + id); var ta = document.getelementbyid(id); var wrap_id = 'wp-'+id+'-wrap'; // update merged content if(inst && ! inst.ishidden()) { tinymce.triggersave(); } else { qtrans_save(vta.value); } // check if language is already active if(lang!='tmce' && lang!='html' && document.getelementbyid('qtrans_select_'+lang).classname=='wp-switch-editor switch-tmce switch-html') { return; } if(lang!='tmce' && lang!='html') { document.getelementbyid('qtrans_select_'+qtrans_get_active_language()).classname='wp-switch-editor'; document.getelementbyid('qtrans_select_'+lang).classname='wp-switch-editor switch-tmce switch-html'; } if(lang=='html') { if ( inst && inst.ishidden() ) return false; if ( inst ) { vta.style.height = inst.getcontentareacontainer().offsetheight + 20 + 'px'; inst.hide(); } jquery(#+wrap_id).removeclass('tmce-active'); jquery(#+wrap_id).addclass('html-active'); setusersetting( 'editor', 'html' ); } else if(lang=='tmce') { if(inst && ! inst.ishidden()) return false; if ( tinymcepreinit.mceinit[id] && tinymcepreinit.mceinit[id].wpautop ) vta.value = this.wpautop(qtrans_use(qtrans_get_active_language(),ta.value)); if (inst) { inst.show(); } else { qtrans_hook_on_tinymce(id); } jquery(#+wrap_id).removeclass('html-active'); jquery(#+wrap_id).addclass('tmce-active'); setusersetting('editor', 'tinymce'); } else { // switch content qtrans_assign('qtrans_textarea_'+id,qtrans_use(lang,ta.value)); } } } jquery('#edbuttonhtml').addclass('active'); jquery('#edbuttonpreview').removeclass('active'); if(ckeditorsettings.textarea_id != 'comment'){ ckeditorsettings.textarea_id = 'qtrans_textarea_content'; ckeditorsettings.configuration['on'].getdata = function (evt) { evt.data.datavalue = evt.data.datavalue.replace(/(^)|($)/g, ''); evt.data.datavalue = evt.data.datavalue.replace(/^
(\s|\n|\r)*
/g, '
'); evt.data.datavalue = evt.data.datavalue.replace(/(\s|\n|\r)*(\s|\n|\r)*$/g, ''); qtrans_save(evt.data.datavalue); }; if ( jquery('#'+ckeditorsettings.textarea_id).length && typeof ckeditor.instances[ckeditorsettings.textarea_id] == 'undefined' ) { ckeditor.replace(ckeditorsettings.textarea_id, ckeditorsettings.configuration); editorcke = ckeditor.instances[ckeditorsettings.textarea_id]; //add aftercommandexec exect to last created ckeditor instance editorcke.on( 'aftercommandexec', function(ev) { aftercommandevent(ev); }); } window.tinymce = tinymce = gettinymceobject(); } }else { if(ckeditorsettings.autostart && (typeof getusersetting == 'undefined' || getusersetting('editor') === '' || getusersetting('editor') == 'tinymce')){ ckeditoron(); } } jquery(#update-gallery).click(function(){ updateckegallery(); }); if (ckeditorsettings.excerpt_state && jquery(textarea#excerpt).length > 0 && jquery(#postexcerpt-hide).attr('checked') == 'checked') { //ckeditoron('excerpt'); ckeditor.replace('excerpt', ckeditorsettings.configuration); } if (typeof window.tinymce != 'undefined') { if (typeof qtags != 'undefined') { jquery(.row-actions span.reply a).live('click', function(){ if (typeof ckeditor.instances['replycontent'] != 'undefined') { ckeditoroff('replycontent'); } ckeditor.replace('replycontent', {'basicentities' : false, 'entities': false,'toolbar_comments' : [{ name: 'basicstyles', items : [ 'bold','italic','underline'] }, { name: 'links', items : [ 'link','unlink' ] },{ name: 'paragraph', items : [ 'numberedlist','bulletedlist'] }, { name: 'insert', items : [ 'image' ] } ], 'toolbar' : 'comments'}); }); jquery(#replyrow a.save).unbind('click').live('click', function(){ var data = null; if (typeof ckeditor.instances['replycontent'] != 'undefined') { data = ckeditor.instances['replycontent'].getdata(); } if (data != null && data.length > 0 ) { jquery('textarea#replycontent').html(data); ckeditoroff('replycontent'); } commentreply.send(); return; }); jquery(#replyrow a.cancel).unbind('click').live('click', function(){ commentreply.revert() ckeditoroff('replycontent'); return; }); qtags.getinstance = function (editor_id) { return window.tinymce; } } }});function ckeditoron(id) { var instance; if (typeof(id) != 'undefined' && typeof(ckeditor.instances[id]) == 'undefined' ) { setusersetting( 'editor', 'tinymce' ); jquery('#quicktags').hide(); jquery('#edbuttonpreview').addclass('active'); jquery('#edbuttonhtml').removeclass('active'); instance = ckeditor.replace(id, ckeditorsettings.configuration); } if ( jquery('textarea#'+ckeditorsettings.textarea_id).length && (typeof(ckeditor.instances) == 'undefined' || typeof(ckeditor.instances[ckeditorsettings.textarea_id]) == 'undefined' ) && jquery(#+ckeditorsettings.textarea_id).parent().parent().attr('id') != 'quick-press') { instance = ckeditor.replace(ckeditorsettings.textarea_id, ckeditorsettings.configuration); if(ckeditorsettings.textarea_id == 'content') { setusersetting( 'editor', 'tinymce' ); jquery('#quicktags').hide(); jquery('#edbuttonpreview').addclass('active'); jquery('#edbuttonhtml').removeclass('active'); } else if(ckeditorsettings.textarea_id == 'comment') { var labelobj = jquery('#'+ckeditorsettings.textarea_id).prev('label'); if (labelobj){ labelobj.hide(); } } } if (typeof(instance) != 'undefined') { //add aftercommandexec exect to last created ckeditor instance instance.on( 'aftercommandexec', function(ev) { aftercommandevent(ev); }); }}function ckeditoroff(id) { if (typeof(id) != 'undefined') { editorcke = ckeditor.instances[id]; }else { editorcke = ckeditor.instances[ckeditorsettings.textarea_id]; } if(typeof(editorcke) != 'undefined'){ editorcke.destroy(); if(ckeditorsettings.textarea_id == 'content') { setusersetting( 'editor', 'html' ); jquery('#quicktags').show(); jquery('#edbuttonhtml').addclass('active'); jquery('#edbuttonpreview').removeclass('active'); } }}if ( !ckeditorsettings.qtransenabled ){ var tinymce = window.tinymce = gettinymceobject();}function gettinymceobject(){ var tinymce = window.tinymce = (function () { var tinymce = { isopera : function() { return ckeditor.env.opera; }, onaddeditor : { add : function() { // this function did nothing else apart from resizing tinymce } }, get : function (id) { var instant = { ishidden : function (){ editor = ckeditor.instances[id]; if (typeof editorcke == 'undefined') editorcke = editor; if(typeof(editor) != 'undefined') { return false; }else{ return true; } }, isdirty : function (){ return false; }, execcommand : function (command, integer, val) { if(command == 'mcesetcontent') { editorcke.setdata(val); } if (command == 'mceinsertcontent') { editorcke.inserthtml(val); } }, onsavecontent : { add : function (func) { window.tinymceosc = func; } }, getcontentareacontainer : function () { return { offsetheight : editorcke.config.height }; }, hide : function () { ckeditoroff(id); }, show : function () { ckeditoron(id); }, save : function(){ return; }, focus : function(){ return; }, plugins: {} }; return instant; }, execcommand : function (command, integer, val) { if(command == 'mceaddcontrol'){ ckeditorsettings.textarea_id = val; if(ckeditorsettings.autostart) { ckeditoron(); } else { document.getelementbyid('qtrans_textarea_content').removeattribute('style'); } } }, triggersave : function(param) { if(typeof(ckeditor) != 'undefined' && typeof(editorcke) != 'undefined') editorcke.updateelement(); }, activeeditor : { ishidden : function (){ return false; }, isdirty : function (){ return false; }, focus : function (){ return; }, plugins : {}, execcommand : function(command, state, text) { if (command == mceinsertcontent) { //test if image has caption and make necessary text format pattern = /\[caption(.*)\](.*)\[\/caption\]/i; if (pattern.test(text)) { replace_match = pattern.exec(text); text = text.replace(//g, function( match, cont ) { cont = cont.replace(/class=(.*)/g, function( match, cont ){ tmp = 'class=' + cont + ' wp-caption'; return tmp; }); tmp = '' ; return tmp; }); } //settimeout is required in ie8 when inserting image gallery from an external modal dialog if (typeof editorcke == 'undefined') editorcke = ckeditor.instances[ckeditorsettings.textarea_id]; settimeout(function(){ editorcke.inserthtml(text); }, 0); } }, selection : { getbookmark : function(name) { return ''; } }, windowmanager : { bookmark: {} } }, editormanager :{ activeeditor: { selection : { getnode : function(){ var obj = jquery(editorcke.document.getbody().gethtml()); var index = 0; jquery.each(obj,function(i, val){ var images = jquery(img,jquery(val)); jquery.each(images, function(key, value){ if (jquery(value).hasclass('wpgallery, cke_wpgallery')) { index = i; return; } }); }); if (obj.length === 0) { obj = document.createelement(p); return obj; } return obj[index]; }, getbookmark : function(name) { return ; } }, dom :{ select : function(selector) { //get ckeditor content var obj = editorcke.document.getbody().gethtml(); images = editorcke.document.getelementsbytag('img'); if ( typeof images.$ == 'undefined' || images.$.length == 0) return []; for (var i in images.$) { if ( typeof images.$[i] != 'undefined' && ((ckeditor.env.ie && images.$[i].classname == 'wpgallery, cke_wpgallery') || images.$[i].classlist == 'wpgallery, cke_wpgallery')) { var element = new ckeditor.dom.element(images.$[i]); index = i; break; } } var results =[]; if (typeof element != 'undefined') { results[0] = images.$[index]; return results; }else { return []; } }, getattrib : function(el, selector) { return jquery(el).attr(selector); }, //function to set new gallery attributes setattrib : function(el, selector, value) { //get ckeditor content var obj = editorcke.document.getbody().gethtml(); images = editorcke.document.getelementsbytag('img'); for (var i in images.$) { if ( typeof images.$[i] != 'undefined' && ((ckeditor.env.ie && images.$[i].classname == 'wpgallery, cke_wpgallery') || images.$[i].classlist == 'wpgallery, cke_wpgallery')) { var element = new ckeditor.dom.element(images.$[i]); element.setattribute('title', value); element.setattribute('data-gallery', '['+value+']'); } } }, decode : function(text) { return text; }, hasclass : function(element, name) { var hasclass = jquery(element).attr('class'); var pattern = /wpgallery/; return pattern.test(hasclass); } } }, get : function(id) {return;} }, dom :{ removeclass : function(id, classname) {return;}, addclass : function(id, classname) {return;} }, addi18n : function(language, param){ return ; } }; return tinymce;})(); return tinymce;}var tinymcepreinit = { mceinit : function(){ language : 'en'; }};var tinymcepopup = { oninit : { add : function() {return ;} }, editor : { windowmanager : { createinstance : function(id) {return; } } }};/* * function to move cursor after fake gallery image. turn on frame show */function updateckegallery(){ jquery(#add_image).unbind('click'); jquery(#add_image).bind('click',function(){ return true; });}function aftercommandevent(ev){ if (ev.data.name != 'maximize') { return; } //if maximize button was clicked hide/show wp admin bar - prevention of hiding buttton under wp admin bar if (ev.data.command.state == ckeditor.tristate_on) { jquery(#wpadminbar).hide() } else { jquery(#wpadminbar).show() }}
回复内容: 安装插件后 不能正常预览
问题代码区域
c.onsubmit.add(function() {}) 的错误
下面是 wp中的js代码 那位大什么帮忙 解读一番也好
run: function() { var b = this; this.checkpost(), this.schedule = a.schedule({ time: 15e3, func: function() { wp.autosave.local.save() }, repeat: !0, protect: !0 }), a(form#post).on(submit.autosave-local, function() { var c = undefined != typeof tinymce && tinymce.get(content), d = a(#post_id).val() || 0; c && !c.ishidden() ? c.onsubmit.add(function() { wp.autosave.local.save({ post_title: a(#title).val() || , content: a(#content).val() || , excerpt: a(#excerpt).val() || }) }) : b.save({ post_title: a(#title).val() || , content: a(#content).val() || , excerpt: a(#excerpt).val() || }), wpcookies.set(wp-saving-post- + d, check) }) },
在autosave.min.js文件中
错误提示 uncaught typeerror: cannot read property 'add' of undefined
没太看懂这个js 关键是 ckeditor.utils.js 和这个文件的关系 以及 如何调用,作用域是什么完全搞不清楚。
function autosave_parse_response(a) { var b, c, d = wpajax.parseajaxresponse(a, autosave); return d && d.responses && d.responses.length && (d.responses[0].supplemental && (c = d.responses[0].supplemental, jquery.each(c, function(a, b) { a.match(/^replace-/) && jquery(# + a.replace(replace-, )).val(b) })), d.errors || ((b = parseint(d.responses[0].id, 10)) && autosave_update_slug(b), d.responses[0].data && jquery(.autosave-message).text(d.responses[0].data))), d}function autosave_saved(a) { blocksave = !1, autosave_parse_response(a), autosave_enable_buttons()}function autosave_saved_new(a) { blocksave = !1; var b, c = autosave_parse_response(a); c && c.responses.length && !c.errors ? (b = parseint(c.responses[0].id, 10), b && (notsaved = !1, jquery(#auto_draft).val(0)), autosave_enable_buttons(), autosavedelaypreview && (autosavedelaypreview = !1, dopreview())) : autosave_enable_buttons()}function autosave_update_slug(a) { undefined != makeslugeditclickable && jquery.isfunction(makeslugeditclickable) && !jquery(#edit-slug-box > *).size() && jquery.post(ajaxurl, { action: sample-permalink, post_id: a, new_title: fullscreen && fullscreen.settings.visible ? jquery(#wp-fullscreen-title).val() : jquery(#title).val(), samplepermalinknonce: jquery(#samplepermalinknonce).val() }, function(a) { if (-1 !== a) { var b = jquery(#edit-slug-box); b.html(a), b.hasclass(hidden) && b.fadein(fast, function() { b.removeclass(hidden) }), makeslugeditclickable() } })}function autosave_loading() { jquery(.autosave-message).html(autosavel10n.savingtext)}function autosave_enable_buttons() { jquery(document).trigger(autosave-enable-buttons), wp.heartbeat && wp.heartbeat.hasconnectionerror() || settimeout(function() { var a = jquery(#submitpost); a.find(:button, :submit).removeattr(disabled), a.find(.spinner).hide() }, 500)}function autosave_disable_buttons() { jquery(document).trigger(autosave-disable-buttons), jquery(#submitpost).find(:button, :submit).prop(disabled, !0), settimeout(autosave_enable_buttons, 5e3)}function delayed_autosave() { settimeout(function() { blocksave || autosave() }, 200)}var autosave, autosaveperiodical, fullscreen, dopreview, autosavelast = , autosavedelaypreview = !1, notsaved = !0, blocksave = !1, autosavelockrelease = !0;jquery(document).ready(function(a) { autosavelast = a(#wp-content-wrap).hasclass(tmce-active) && undefined != typeof switcheditors ? wp.autosave.getcomparestring({ post_title: a(#title).val() || , content: switcheditors.pre_wpautop(a(#content).val()) || , excerpt: a(#excerpt).val() || }) : wp.autosave.getcomparestring(), autosaveperiodical = a.schedule({ time: 1e3 * autosavel10n.autosaveinterval, func: function() { autosave() }, repeat: !0, protect: !0 }), a(#post).submit(function() { a.cancel(autosaveperiodical), autosavelockrelease = !1 }), a('input[type=submit], a.submitdelete', #submitpost).click(function() { blocksave = !0, window.onbeforeunload = null, a(:button, :submit, #submitpost).each(function() { var b = a(this); b.hasclass(button-primary) ? b.addclass(button-primary-disabled) : b.addclass(button-disabled) }), publish == a(this).attr(id) ? a(#major-publishing-actions .spinner).show() : a(#minor-publishing .spinner).show() }), window.onbeforeunload = function() { var b, c = undefined != typeof tinymce ? tinymce.activeeditor : !1; if (c && !c.ishidden()) { if (c.isdirty()) return autosavel10n.savealert } else if (b = fullscreen && fullscreen.settings.visible ? wp.autosave.getcomparestring({ post_title: a(#wp-fullscreen-title).val() || , content: a(#wp_mce_fullscreen).val() || , excerpt: a(#excerpt).val() || }) : wp.autosave.getcomparestring(), b != autosavelast) return autosavel10n.savealert }, a(window).unload(function(b) { autosavelockrelease && (b.target && #document != b.target.nodename || a.ajax({ type: post, url: ajaxurl, async: !1, data: { action: wp-remove-post-lock, _wpnonce: a(#_wpnonce).val(), post_id: a(#post_id).val(), active_post_lock: a(#active_post_lock).val() } })) }), a(#post-preview).click(function() { return 1 == a(#auto_draft).val() && notsaved ? (autosavedelaypreview = !0, autosave(), !1) : (dopreview(), !1) }), dopreview = function() { a(input#wp-preview).val(dopreview), a(form#post).attr(target, wp-preview).submit().attr(target, ); var b = navigator.useragent.tolowercase(); - 1 != b.indexof(safari) && -1 == b.indexof(chrome) && a(form#post).attr(action, function(a, b) { return b + ?t= + (new date).gettime() }), a(input#wp-preview).val() }, a(#title).on(keydown.editor-focus, function(b) { var c; 9 == b.which && (b.ctrlkey || b.altkey || b.shiftkey || (undefined != typeof tinymce && (c = tinymce.get(content)), c && !c.ishidden() ? a(this).one(keyup, function() { a(#content_tbl td.mcetoolbar > a).focus() }) : a(#content).focus(), b.preventdefault())) }), 1 == a(#auto_draft).val() && a(#title).blur(function() { this.value && 1 == a(#auto_draft).val() && delayed_autosave() }), a(document).on(heartbeat-connection-lost.autosave, function(b, c, d) { if (timeout === c || 503 == d) { var e = a(#lost-connection-notice); wp.autosave.local.hasstorage || e.find(.hide-if-no-sessionstorage).hide(), e.show(), autosave_disable_buttons() } }).on(heartbeat-connection-restored.autosave, function() { a(#lost-connection-notice).hide(), autosave_enable_buttons() })}), autosave = function() { var a, b, c = wp.autosave.getpostdata(); return blocksave = !0, c.autosave ? block == jquery(#tb_window).css(display) ? !1 : (a = wp.autosave.getcomparestring(c), a == autosavelast ? !1 : (autosavelast = a, jquery(document).triggerhandler(wpcountwords, [c.content]), autosave_disable_buttons(), b = 1 == c.auto_draft ? autosave_saved_new : autosave_saved, jquery.ajax({ data: c, beforesend: autosave_loading, type: post, url: ajaxurl, success: b }), !0)) : !1}, window.wp = window.wp || {}, wp.autosave = wp.autosave || {}, function(a) { wp.autosave.getpostdata = function() { var b, c, d = undefined != typeof tinymce ? tinymce.activeeditor : null, e = [], f = { action: autosave, autosave: !0, post_id: a(#post_id).val() || 0, autosavenonce: a(#autosavenonce).val() || , post_type: a(#post_type).val() || , post_author: a(#post_author).val() || , excerpt: a(#excerpt).val() || }; if (d && !d.ishidden()) { if (d.plugins.spellchecker && d.plugins.spellchecker.active) return f.autosave = !1, f; mce_fullscreen == d.id && tinymce.get(content).setcontent(d.getcontent({ format: raw }), { format: raw }), tinymce.triggersave() } return undefined != typeof fullscreen && fullscreen.settings.visible ? (f.post_title = a(#wp-fullscreen-title).val() || , f.content = a(#wp_mce_fullscreen).val() || ) : (f.post_title = a(#title).val() || , f.content = a(#content).val() || ), a('input[id^=in-category-]:checked').each(function() { e.push(this.value) }), f.catslist = e.join(,), (b = a(#post_name).val()) && (f.post_name = b), (c = a(#parent_id).val()) && (f.parent_id = c), a(#comment_status).prop(checked) && (f.comment_status = open), a(#ping_status).prop(checked) && (f.ping_status = open), 1 == a(#auto_draft).val() && (f.auto_draft = 1), f }, wp.autosave.getcomparestring = function(b) { return object == typeof b ? (b.post_title || ) + :: + (b.content || ) + :: + (b.excerpt || ) : (a(#title).val() || ) + :: + (a(#content).val() || ) + :: + (a(#excerpt).val() || ) }, wp.autosave.local = { lastsaveddata: , blog_id: 0, hasstorage: !1, checkstorage: function() { var a = math.random(), b = !1; try { sessionstorage.setitem(wp-test, a), b = sessionstorage.getitem(wp-test) == a, sessionstorage.removeitem(wp-test) } catch (c) {} return this.hasstorage = b, b }, getstorage: function() { var a = !1; return this.hasstorage && this.blog_id && (a = sessionstorage.getitem(wp-autosave- + this.blog_id), a = a ? json.parse(a) : {}), a }, setstorage: function(a) { var b; return this.hasstorage && this.blog_id ? (b = wp-autosave- + this.blog_id, sessionstorage.setitem(b, json.stringify(a)), null !== sessionstorage.getitem(b)) : !1 }, getdata: function() { var b = this.getstorage(), c = a(#post_id).val(); return b && c ? b[post_ + c] || !1 : !1 }, setdata: function(b) { var c = this.getstorage(), d = a(#post_id).val(); if (!c || !d) return !1; if (b) c[post_ + d] = b; else { if (!c.hasownproperty(post_ + d)) return !1; delete c[post_ + d] } return this.setstorage(c) }, save: function(b) { var c, d, e = !1; return b ? (c = this.getdata() || {}, a.extend(c, b), c.autosave = !0) : c = wp.autosave.getpostdata(), c.autosave ? (d = wp.autosave.getcomparestring(c), d == this.lastsaveddata ? !1 : (c.save_time = (new date).gettime(), c.status = a(#post_status).val() || , e = this.setdata(c), e && (this.lastsaveddata = d), e)) : !1 }, init: function(b) { var c = this; this.checkstorage() && (a(#content).length || a(#excerpt).length) && (b && a.extend(this, b), this.blog_id || (this.blog_id = undefined != typeof window.autosavel10n ? window.autosavel10n.blog_id : 0), a(document).ready(function() { c.run() })) }, run: function() { var b = this; this.checkpost(), this.schedule = a.schedule({ time: 15e3, func: function() { wp.autosave.local.save() }, repeat: !0, protect: !0 }), a(form#post).on(submit.autosave-local, function() { var c = undefined != typeof tinymce && tinymce.get(content), d = a(#post_id).val() || 0; c && !c.ishidden() ? c.onsubmit.add(function() { wp.autosave.local.save({ post_title: a(#title).val() || , content: a(#content).val() || , excerpt: a(#excerpt).val() || }) }) : b.save({ post_title: a(#title).val() || , content: a(#content).val() || , excerpt: a(#excerpt).val() || }), wpcookies.set(wp-saving-post- + d, check) }) }, compare: function(a, b) { function c(a) { return a.tostring().replace(/[\x20\t\r\n\f]+/g, ) } return c(a || ) == c(b || ) }, checkpost: function() { var b, c, d, e, f = this, g = this.getdata(), h = a(#post_id).val() || 0, i = wpcookies.get(wp-saving-post- + h); if (g) return i && (wpcookies.remove(wp-saving-post- + h), saved == i) ? (this.setdata(!1), void 0) : (a(#has-newer-autosave).length || (b = a(#content).val() || , c = a(#title).val() || , d = a(#excerpt).val() || , a(#wp-content-wrap).hasclass(tmce-active) && undefined != typeof switcheditors && (b = switcheditors.pre_wpautop(b)), check != i && this.compare(b, g.content) && this.compare(c, g.post_title) && this.compare(d, g.excerpt) || (this.restore_post_data = g, this.undo_post_data = { content: b, post_title: c, excerpt: d }, e = a(#local-storage-notice), a(.wrap h2).first().after(e.addclass(updated).show()), e.on(click, function(b) { var c = a(b.target); c.hasclass(restore-backup) ? (f.restorepost(f.restore_post_data), c.parent().hide(), a(this).find(p.undo-restore).show()) : c.hasclass(undo-restore-backup) && (f.restorepost(f.undo_post_data), c.parent().hide(), a(this).find(p.local-restore).show()), b.preventdefault() }))), void 0) }, restorepost: function(b) { var c; return b ? (this.lastsaveddata = wp.autosave.getcomparestring(b), a(#title).val() != b.post_title && a(#title).focus().val(b.post_title || ), a(#excerpt).val(b.excerpt || ), c = undefined != typeof tinymce && tinymce.get(content), c && !c.ishidden() && undefined != typeof switcheditors ? (c.undomanager.add(), c.setcontent(b.content ? switcheditors.wpautop(b.content) : )) : (a(#content-html).click(), a(#content).val(b.content)), !0) : !1 } }, wp.autosave.local.init()}(jquery);
ckeditor 中的js
var editorcke;jquery(document).ready(function () { ckeditorsettings.configuration['on'] = { configloaded : function ( evt ) { if (typeof(ckeditorsettings.externalplugins) != 'undefined') { var externals=new array(); for (var x in ckeditorsettings.externalplugins) { ckeditor.plugins.addexternal(x, ckeditorsettings.externalplugins[x]); externals.push(x); } } evt.editor.config.extraplugins += (evt.editor.config.extraplugins ? ','+externals.join(',') : externals.join(',')); if (evt.editor.config[evt.editor.config.toolbar +'_removebuttons']); evt.editor.config.removebuttons = evt.editor.config[evt.editor.config.toolbar +'_removebuttons']; ckeditor.addcss(evt.editor.config.extracss); } }; ckeditor.on( 'instanceready', function( ev ) { var dtd = ckeditor.dtd; for ( var e in ckeditor.tools.extend( {}, dtd.$nonbodycontent, dtd.$block, dtd.$listitem, dtd.$tablecontent ) ) { ev.editor.dataprocessor.writer.setrules( e, ckeditorsettings.outputformat); } ev.editor.dataprocessor.writer.setrules( 'br', { breakafteropen : true }); ev.editor.dataprocessor.writer.setrules( 'pre', { indent: false }); editorcke = ckeditor.instances['content']; }); if (ckeditorsettings.textarea_id != 'comment'){ edinsertcontentold = function () { return ; }; if(typeof(window.edinsertcontent) != 'undefined'){ edinsertcontentold = window.edinsertcontent; } window.edinsertcontent = function (myfield, myvalue) { if(typeof(ckeditor) != 'undefined' && typeof(editorcke) != 'undefined'){ editorcke.inserthtml(myvalue); } else { edinsertcontentold(myfield, myvalue); } }; var autosaveold = function () { return ; }; if(typeof(window.autosave) != 'undefined'){ autosaveold = window.autosave; } if(typeof(window.switcheditors) != 'undefined') { window.switcheditors.go = function(id, mode) { if ('tinymce' == mode || 'tmce' == mode) { jquery('#'+id).closest('.html-active').removeclass('html-active').addclass('tmce-active'); ckeditoron(id); } else { jquery('#'+id).closest('.tmce-active').removeclass('tmce-active').addclass('html-active'); ckeditoroff(id); jquery('.js .theeditor').attr('style', 'color: black;'); } }; } } //if qtranslate plugin enabled if ( ckeditorsettings.qtransenabled ){ //custom version of switcheditors function when qtranslate plugin is enabled if(typeof(window.switcheditors) != 'undefined') { window.switcheditors.go = function(id, lang) { id = id || 'content'; lang = lang || 'toggle'; if ( 'toggle' == lang ) { if ( ed && !ed.ishidden() ) lang = 'html'; else lang = 'tmce'; } else if( 'tinymce' == lang ) lang = 'tmce'; var inst = tinymce.get('qtrans_textarea_' + id); var vta = document.getelementbyid('qtrans_textarea_' + id); var ta = document.getelementbyid(id); var wrap_id = 'wp-'+id+'-wrap'; // update merged content if(inst && ! inst.ishidden()) { tinymce.triggersave(); } else { qtrans_save(vta.value); } // check if language is already active if(lang!='tmce' && lang!='html' && document.getelementbyid('qtrans_select_'+lang).classname=='wp-switch-editor switch-tmce switch-html') { return; } if(lang!='tmce' && lang!='html') { document.getelementbyid('qtrans_select_'+qtrans_get_active_language()).classname='wp-switch-editor'; document.getelementbyid('qtrans_select_'+lang).classname='wp-switch-editor switch-tmce switch-html'; } if(lang=='html') { if ( inst && inst.ishidden() ) return false; if ( inst ) { vta.style.height = inst.getcontentareacontainer().offsetheight + 20 + 'px'; inst.hide(); } jquery(#+wrap_id).removeclass('tmce-active'); jquery(#+wrap_id).addclass('html-active'); setusersetting( 'editor', 'html' ); } else if(lang=='tmce') { if(inst && ! inst.ishidden()) return false; if ( tinymcepreinit.mceinit[id] && tinymcepreinit.mceinit[id].wpautop ) vta.value = this.wpautop(qtrans_use(qtrans_get_active_language(),ta.value)); if (inst) { inst.show(); } else { qtrans_hook_on_tinymce(id); } jquery(#+wrap_id).removeclass('html-active'); jquery(#+wrap_id).addclass('tmce-active'); setusersetting('editor', 'tinymce'); } else { // switch content qtrans_assign('qtrans_textarea_'+id,qtrans_use(lang,ta.value)); } } } jquery('#edbuttonhtml').addclass('active'); jquery('#edbuttonpreview').removeclass('active'); if(ckeditorsettings.textarea_id != 'comment'){ ckeditorsettings.textarea_id = 'qtrans_textarea_content'; ckeditorsettings.configuration['on'].getdata = function (evt) { evt.data.datavalue = evt.data.datavalue.replace(/(^)|($)/g, ''); evt.data.datavalue = evt.data.datavalue.replace(/^
(\s|\n|\r)*
/g, '
'); evt.data.datavalue = evt.data.datavalue.replace(/(\s|\n|\r)*(\s|\n|\r)*$/g, ''); qtrans_save(evt.data.datavalue); }; if ( jquery('#'+ckeditorsettings.textarea_id).length && typeof ckeditor.instances[ckeditorsettings.textarea_id] == 'undefined' ) { ckeditor.replace(ckeditorsettings.textarea_id, ckeditorsettings.configuration); editorcke = ckeditor.instances[ckeditorsettings.textarea_id]; //add aftercommandexec exect to last created ckeditor instance editorcke.on( 'aftercommandexec', function(ev) { aftercommandevent(ev); }); } window.tinymce = tinymce = gettinymceobject(); } }else { if(ckeditorsettings.autostart && (typeof getusersetting == 'undefined' || getusersetting('editor') === '' || getusersetting('editor') == 'tinymce')){ ckeditoron(); } } jquery(#update-gallery).click(function(){ updateckegallery(); }); if (ckeditorsettings.excerpt_state && jquery(textarea#excerpt).length > 0 && jquery(#postexcerpt-hide).attr('checked') == 'checked') { //ckeditoron('excerpt'); ckeditor.replace('excerpt', ckeditorsettings.configuration); } if (typeof window.tinymce != 'undefined') { if (typeof qtags != 'undefined') { jquery(.row-actions span.reply a).live('click', function(){ if (typeof ckeditor.instances['replycontent'] != 'undefined') { ckeditoroff('replycontent'); } ckeditor.replace('replycontent', {'basicentities' : false, 'entities': false,'toolbar_comments' : [{ name: 'basicstyles', items : [ 'bold','italic','underline'] }, { name: 'links', items : [ 'link','unlink' ] },{ name: 'paragraph', items : [ 'numberedlist','bulletedlist'] }, { name: 'insert', items : [ 'image' ] } ], 'toolbar' : 'comments'}); }); jquery(#replyrow a.save).unbind('click').live('click', function(){ var data = null; if (typeof ckeditor.instances['replycontent'] != 'undefined') { data = ckeditor.instances['replycontent'].getdata(); } if (data != null && data.length > 0 ) { jquery('textarea#replycontent').html(data); ckeditoroff('replycontent'); } commentreply.send(); return; }); jquery(#replyrow a.cancel).unbind('click').live('click', function(){ commentreply.revert() ckeditoroff('replycontent'); return; }); qtags.getinstance = function (editor_id) { return window.tinymce; } } }});function ckeditoron(id) { var instance; if (typeof(id) != 'undefined' && typeof(ckeditor.instances[id]) == 'undefined' ) { setusersetting( 'editor', 'tinymce' ); jquery('#quicktags').hide(); jquery('#edbuttonpreview').addclass('active'); jquery('#edbuttonhtml').removeclass('active'); instance = ckeditor.replace(id, ckeditorsettings.configuration); } if ( jquery('textarea#'+ckeditorsettings.textarea_id).length && (typeof(ckeditor.instances) == 'undefined' || typeof(ckeditor.instances[ckeditorsettings.textarea_id]) == 'undefined' ) && jqu