• Hello all,

    I’m recently developing a premium theme with theme setting page.
    In theme setting page, there are many menus and when we need to go to other menu, the content will be loaded by AJAX.

    In the content ( theme setting for any sections, for ex : portfolio ), there are word editors to input the values. I use the_editor from wordpress functions.

    but unfortunately, it didn’t work. the javascript isn’t working but the media upload tab and VISUAL/HTML tab are working.

    i tried to embed with jscript file from wordpress :

    - /wp-includes/js/tinymce/wp-tinymce.php?c=1
    - /wp-includes/js/tinymce/langs/wp-langs-en.js

    and with javascript code

    <script type="text/javascript" language="javascript1.2">
    
    var quicktagsL10n = {"wordLookup":"Enter a word to look up:","dictionaryLookup":"Dictionary lookup","lookup":"lookup","closeAllOpenTags":"Close all open tags","closeTags":"close tags","enterURL":"Enter the URL","enterImageURL":"Enter the URL of the image","enterImageDescription":"Enter a description of the image","fullscreen":"fullscreen","toggleFullscreen":"Toggle fullscreen mode"};var wpLinkL10n = {"title":"Insert\/edit link","update":"Update","save":"Add Link","noTitle":"(no title)","noMatchesFound":"No matches found."};
    
    		(function(){
    			var init, ed, qt, first_init, mce = true;
    
    			console.log(tinyMCEPreInit.mceInit);
    
    			if ( typeof(tinymce) == 'object' ) {
    
    				tinymce.DOM.files[tinymce.baseURI.getURI() + '/themes/advanced/skins/wp_theme/ui.css'] = true;
    				for ( ed in tinyMCEPreInit.mceInit ) {
    					if ( first_init ) {
    						init = tinyMCEPreInit.mceInit[ed] = tinymce.extend( {}, first_init, tinyMCEPreInit.mceInit[ed] );
    					} else {
    						init = first_init = tinyMCEPreInit.mceInit[ed];
    					}
    
    					if ( mce )
    						try { tinymce.init(init); } catch(e){}
    				}
    			}
    
    			if ( typeof(QTags) == 'function' ) {
    				for ( qt in tinyMCEPreInit.qtInit ) {
    					try { quicktags( tinyMCEPreInit.qtInit[qt] ); } catch(e){}
    				}
    			}
    		})();
    
    		var wpActiveEditor;
    
    		jQuery('.wp-editor-wrap').mousedown(function(e){
    			wpActiveEditor = this.id.slice(3, -5);
    		});
    		</script>

    the editor is working. ok

    but… i found a glitch, when i went to other menu, sometimes the editor does not working ( only the tab ). or when i go to HTML tab and back to visual tab, it doesn’t work..

    i need all your help for this. if you have ever made like i described, please i need your guidance

    tahnk you all

  • The topic ‘Calling the_editor() function by AJAX’ is closed to new replies.