Plugin Directory


Ignore:
Timestamp:
03/08/2026 02:36:52 PM (3 weeks ago)
Author:
daext
Message:

Committing and tagging 1.24

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ultimate-markdown/trunk/blocks/src/init.php

    r3424623 r3477447  
    1818 */
    1919function daextulma_editor_assets() {
     20
     21    // Check capability before loading block editor assets.
     22    if ( ! current_user_can( 'edit_posts' ) ) {
     23        return;
     24    }
    2025
    2126    // assign an instance of Daextulma_Shared.
     
    4146        true // Enqueue the script in the footer.
    4247    );
     48
     49    // Get the documents used to populate the selector in the "Load Document" block editor sidebar section.
     50    $document_a_alt = $shared->get_documents_for_selector();
     51
     52    // Store the JavaScript parameters in the window.DAEXTULMA_PARAMETERS object.
     53    $initialization_script  = 'window.DAEXTULMA_PARAMETERS = {';
     54    $initialization_script .= 'documents: ' . wp_json_encode( $document_a_alt ) . ',';
     55    $initialization_script .= 'ajaxUrl: "' . admin_url( 'admin-ajax.php' ) . '",';
     56    $initialization_script .= 'pluginDirectoryUrl: "' . $shared->get( 'url' ) . '",';
     57    $initialization_script .= 'editorMarkdownParser: "' . get_option('daextulma_editor_markdown_parser') . '",';
     58    $initialization_script .= 'nonce: "' . wp_create_nonce( 'daextulma' ) . '",';
     59    $initialization_script .= '};';
     60    wp_add_inline_script( $shared->get( 'slug' ) . '-editor-js', $initialization_script, 'before' );
     61
    4362}
    4463
Note: See TracChangeset for help on using the changeset viewer.