WordPress.org

Ready to get started?Download WordPress

Forums

HTML Editor Reloaded
Let me know if this save your life (1 post)

  1. chensihai
    Member
    Posted 1 year ago #

    Keep on 1.0 version, but make it like,

    <script>
            if (jQuery("#wp-content-editor-container").length > 0)
    		jQuery('Document').ready(function(){
             s=edButtons.length;  //csh
    		<?php
    		// update HTML Editor with custom buttons
    		$label = get_option('hed_label');
    		$before = get_option('hed_before');
    		$after = get_option('hed_after');
    		$shortcut = get_option('hed_shortcut');
    
    		for ( $i = 0; $i < count($label); $i++ ) { ?>
    
    		edButtons[edButtons.length] = new edButton(
    			"hed_<?php echo $i; ?>",
    			"<?php echo str_replace('"','"',$label[$i]); ?>",
    			"<?php echo str_replace('"','\"',$before[$i]); ?>",
    			"<?php echo str_replace('"','\"',$after[$i]); ?>",
    			"<?php echo str_replace('"','"',$shortcut[$i]); ?>"
    		);
    		//alert(edButtons[edButtons.length-1]);
    		<?php }
    
             ?>
    
    		jQuery("#ed_toolbar").empty();
    
    		function hedShowButtons(button, i) {
    			if ( button.id == 'ed_img' ) {
    				jQuery("#ed_toolbar").append('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertImage(edCanvas);" value="' + button.display + '" />');
    			}
    			else if (button.id == 'ed_link') {
    				jQuery("#ed_toolbar").append('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertLink(edCanvas, ' + i + ');" value="' + button.display + '" />');
    			}
    			else {
    				jQuery("#ed_toolbar").append('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" class="ed_button" onclick="edInsertTag(edCanvas, ' + i + ');" value="' + button.display + '"  />');
    			}
    		}
    		//csh, i=0 change to i=s
    		for ( var i = s; i < edButtons.length; i++ ) {
    			hedShowButtons(edButtons[i], i);
    		}
    
    		jQuery("#ed_toolbar").append('<input type="button" id="ed_tabs" class="ed_button" title="Enable and disable tabbing" value="disable tabs" />');
    		jQuery("#ed_toolbar").append('<input type="button" id="ed_fullscreen" class="ed_button" title="Enable and disable fullscreen mode" value="fullscreen" />');
    		jQuery("#ed_toolbar").append('<input type="button" id="ed_spell" class="ed_button" onclick="edSpell(edCanvas);" title="' + quicktagsL10n.dictionaryLookup + '" value="' + quicktagsL10n.lookup + '" />');
    		jQuery("#ed_toolbar").append('<input type="button" id="ed_close" class="ed_button" onclick="edCloseAllTags();" title="' + quicktagsL10n.closeAllOpenTags + '" value="' + quicktagsL10n.closeTags + '" />');
    		}
            )
    		</script>

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. Or better still - use the pastebin. As it stands, your code may now have been permanently damaged/corrupted by the forum's parser.]

    http://wordpress.org/extend/plugins/html-editor-reloaded/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.