https://t.me/RX1948
Server : Apache
System : Linux server.lienzindia.com 4.18.0-348.7.1.el8_5.x86_64 #1 SMP Wed Dec 22 13:25:12 UTC 2021 x86_64
User : plutus ( 1007)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /home/plutus/public_html/wp-content/plugins/mathml-block/src/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/plutus/public_html/wp-content/plugins/mathml-block/src/mathml-block.js
import { v4 as uuid } from 'uuid';
import icon from './icon';

const { __ }                = wp.i18n;
const { registerBlockType } = wp.blocks;

const renderMathML = ( id ) => {
	setTimeout( () => {
		MathJax.Hub.Queue( [ 'Typeset', MathJax.Hub, document.getElementById( id ) ] );
	}, 100 );
};

registerBlockType( 'mathml/mathmlblock', {
	title: 'MathML',
	icon,
	category: 'common',
	attributes: {
		formula: {
			source: 'html',
			selector: 'div',
			type: 'string',
		},
	},

	edit: ( props ) => {

		const { isSelected, attributes, setAttributes, className } = props;
		const { formula } = attributes;
		const id = uuid();

		renderMathML( id );

		if ( isSelected ) {
			return (
				<div className={ className }>
					<label htmlFor={ id }>{ __( 'MathML formula:', 'mathml-block' ) }</label>
					<textarea
						id={ id }
						className="mathml-formula"
						data-tagname="div"
						onChange={ ( event ) => {
							setAttributes( { formula: event.target.value } );
						} }
						value={ formula }
						style={ { width: '100%' } }
					/>
				</div>
			);
		} else {
			return (
				<div
					id={ id }
					className="mathml-block"
				>
					{ formula }
				</div>
			);
		}
	},

	save: function save( { attributes, className } ) {
		const { formula } = attributes;

		return (
			<div className={ className }>
				{ formula }
			</div>
		);
	},
} );

https://t.me/RX1948 - 2025