first commit

This commit is contained in:
2024-11-10 21:08:49 +01:00
commit 0d932ce5ee
14455 changed files with 2567501 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
( function( wp ) {
var el = wp.element.createElement;
var __ = wp.i18n.__;
var ServerSideRender = wp.components.ServerSideRender;
var InspectorControls = wp.editor.InspectorControls;
var SelectControl = wp.components.SelectControl;
wp.blocks.registerBlockType( 'widget-shortcode/block', {
title: __( 'Widget Shortcode', 'widget-shortcode' ),
icon: 'welcome-widgets-menus',
category: 'widgets',
attributes : {
id: {
default : '',
},
},
// Display block preview and UI
edit( props ) {
return el( 'div', {}, [
el( ServerSideRender, {
block: "widget-shortcode/block",
attributes: props.attributes
} ),
el( InspectorControls, {}, [
el( SelectControl, {
value : props.attributes.id,
label : __( 'Widget', 'widget-shortcode' ),
options : widgetShortcodeGutenberg.widgets,
onChange : function( id ) {
props.setAttributes( { id } );
},
} )
] )
] )
},
save() {
// nothing to see here, ServerSideRender handles this
return null;
},
} );
}(
window.wp
) );

View File

@@ -0,0 +1,30 @@
(function($) {
if ( typeof widgetShortcodeTinyMCE === 'undefined' )
return;
if ( widgetShortcodeTinyMCE.widgets.length < 1 )
return;
tinymce.PluginManager.add( 'widgetShortcode', function( editor, url ) {
var items = [];
$.each( widgetShortcodeTinyMCE.widgets, function( i, v ) {
var item = {
'text' : v.label,
'body': {
'type': v.label
},
'onclick' : function(){
editor.insertContent( '[widget id="' + v.value + '"]' );
}
};
items.push( item );
} );
editor.addButton( 'widgetShortcode', {
title: widgetShortcodeTinyMCE.title,
type : 'menubutton',
image : widgetShortcodeTinyMCE.image,
menu : items
});
});
})(jQuery);

Binary file not shown.

After

Width:  |  Height:  |  Size: 786 B