Plugin Directory

Changeset 3088010

Timestamp:
05/17/2024 12:16:50 AM (3 months ago)
Author:
neffff
Message:

1.1.0-e

Location:
merpress/trunk
Files:
32 added
3 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • merpress/trunk/README.txt

    r2839602 r3088010  
    33Tags: posts, mermaid, diagrams, gantt, sequence, class, erd, entity-relationship, actor, flowchart, block
    44Requires at least: 5.0
    5 Tested up to: 6.1
    6 Stable tag: 1.0.9
     5Tested up to: 6.
     6Stable tag: 1.
    77Requires PHP: 7.0
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
    1010
    11 Merpress lets you create diagrams and visualizations using <a href="https://mermaid-js.github.io/mermaid/">MermaidJS</a>.
     11Merpress lets you create diagrams and visualizations using <a href="https://mermaid/">MermaidJS</a>.
    1212
    1313== Description ==
    1414
    15 Merpress lets you create diagrams and visualizations using [MermaidJS](https://mermaid-js.github.io/mermaid/).
     15Merpress lets you create diagrams and visualizations using [MermaidJS](https://mermaid/).
    1616
    1717== Frequently Asked Questions ==
     
    1919= Can you make diagrams with this? =
    2020
    21 Yes.  Checkout [MermaidJS](https://mermaid-js.github.io/mermaid/#/n00b-syntaxReference) for syntax reference and example diagrams.
     21Yes.  Checkout [MermaidJS](https://mermaid) for syntax reference and example diagrams.
    2222
    2323== Screenshots ==
     
    3131== Changelog ==
    3232
    33 = 1.0.9 =
    34 * Update mermaid to 9.3.0.
     33= 1.1.0-e =
     34* Update mermaid to 10.9.1.
     35* Adds *_beta_* feature to store PNG of diagram. Currently broken in Firefox.
    3536
    3637== Upgrade Notice ==
    3738
    38 = 1.0.9 =
    39 Mermaid update (9.3.0)
     39= 1. =
     40M
  • merpress/trunk/merpress.php

    r2839602 r3088010  
    11<?php
    2 
    32/**
    43 * Plugin Name: MerPress
    54 * Plugin URI: https://github.com/n3f/merpress
    65 * Description: Merpress lets you create diagrams and visualizations using <a href="https://mermaid-js.github.io/mermaid/">MermaidJS</a>.
    7  * Version: 1.0.9
     6 * Version: 1.
    87 * Requires at least: 4.6
    98 *
     
    1110 */
    1211
    13 define( 'MERMAID_JS_VERSION', '9.3.0' );
    14 define( 'MERMAID_PLUGIN_VERSION', '1.0.9' );
     12declare( strict_types=1 );
     13
     14// If this file is called directly, abort.
     15if ( ! defined( 'ABSPATH' ) ) {
     16    exit;
     17}
     18
     19define( 'MERMAID_PLUGIN_VERSION', '1.1.0-e' );
     20define( 'MERMAID_JS_VERSION', '10.9.1' );
    1521
    1622add_action(
    1723    'init',
    1824    function () {
    19         wp_register_script( 'mermaid', plugin_dir_url( __FILE__ ) . 'assets/mermaid.min.js', [], MERMAID_JS_VERSION, true );
     25        $mermaid_config = [
     26            'mermaid_version' => MERMAID_JS_VERSION,
     27            'mermaid_url'     => plugin_dir_url( __FILE__ ) . 'public/mermaid.min.js',
     28        ];
    2029
    2130        wp_register_script(
    22             'mermaid-init',
    23             plugin_dir_url( __FILE__ ) . 'assets/mermaid-init.js',
    24             [
    25                 'jquery',
    26                 'mermaid',
    27             ],
    28             MERMAID_PLUGIN_VERSION,
    29             true
    30         );
    31 
    32         wp_register_script(
    33             'mermaid-gutenberg-block',
    34             plugin_dir_url( __FILE__ ) . 'assets/mermaid-block.js',
    35             [ 'mermaid' ],
    36             MERMAID_PLUGIN_VERSION,
    37             true
     31            'mermaid',
     32            $mermaid_config['mermaid_url'],
     33            [],
     34            $mermaid_config['mermaid_version'],
     35            false
    3836        );
    3937
    4038        wp_register_style(
    4139            'mermaid-gutenberg-block',
    42             plugin_dir_url( __FILE__ ) . 'assets/mermaid-block.css',
    43             [ 'wp-edit-blocks' ],
     40            plugin_dir_url( __FILE__ ) . '/mermaid-block.css',
     41            [],
    4442            MERMAID_PLUGIN_VERSION
    4543        );
    4644
    47         register_block_type(
    48             'merpress/mermaidjs',
    49             [
    50                 'editor_script' => 'mermaid-gutenberg-block',
    51                 'editor_style' => 'mermaid-gutenberg-block',
    52             ]
    53         );
    54 
    55         $enqueue_mermaid = function () {
    56             wp_enqueue_script( 'mermaid-init' );
    57         };
    58 
    59         add_action( 'loop_end', $enqueue_mermaid );
    60         add_action( 'loop_no_results', $enqueue_mermaid );
     45        // Register the mermaidjs block.
     46        $result = register_block_type( __DIR__ . '/build' );
     47        if ( false === $result ) {
     48            error_log( 'Failed to register block type' );
     49        }
    6150    }
    6251);
Note: See TracChangeset for help on using the changeset viewer.