Request: Highlighted Code Metabox

Support General Request: Highlighted Code Metabox

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #19873
    LockeLocke
    Participant

    Has anyone tried to add a textarea with a highlighted code??

    I'm adding a metabox so users can add custom styles.

    I'm using a common external library to achieve this, but it would be quite cool to have this option in the core of Metabox io (also get rid of the dependencies on Jquery).

    Stay safe! Thanks!

    #19874
    Long NguyenLong Nguyen
    Moderator

    Hi Locke,

    The feature supports the textarea field as the code editor is in our roadmap. We are working to make it done and include it in the future update. Thank you.

    #33653
    Aaron PrattAaron Pratt
    Participant

    function input_admin_enqueue_scripts() {
    $cm_settings['codeEditor'] = wp_enqueue_code_editor(
    array('type' => 'text/html')
    );
    wp_localize_script('jquery', 'cm_settings', $cm_settings);
    wp_enqueue_script('wp-theme-plugin-editor');
    wp_enqueue_style('wp-codemirror');
    }

    <script>
    jQuery(document).ready(function($) {
    var evhcaCodeEditors = document.querySelectorAll( '.custom-selector-for-your-textarea-field' );
    for ( var i = 0; i < evhcaCodeEditors.length; i++ ){
    wp.codeEditor.initialize( $(evhcaCodeEditors[i]), cm_settings );
    }
    });
    </script>

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.