first commit
This commit is contained in:
30
wp-content/plugins/weglot/blocks/weglot-menu/.gitignore
vendored
Normal file
30
wp-content/plugins/weglot/blocks/weglot-menu/.gitignore
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Output of `npm pack`
|
||||
*.tgz
|
||||
|
||||
# Output of `wp-scripts plugin-zip`
|
||||
*.zip
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2,
|
||||
"name": "create-block/weglot-menu",
|
||||
"version": "0.1.0",
|
||||
"title": "Weglot Widget menu",
|
||||
"category": "widgets",
|
||||
"parent": ["core/navigation"],
|
||||
"icon": "smiley",
|
||||
"description": "Weglot switcher menu",
|
||||
"supports": {
|
||||
"html": true
|
||||
},
|
||||
"textdomain": "weglot-menu",
|
||||
"editorScript": "file:./index.js",
|
||||
"editorStyle": "file:./index.css",
|
||||
"style": "file:./style-index.css"
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 82 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 52 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 62 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 164 B |
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-element', 'wp-i18n', 'wp-server-side-render'), 'version' => 'c32346d2d7f9ab48d67c439f11567927');
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
!function(){"use strict";var L={n:function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return L.d(t,{a:t}),t},d:function(e,t){for(var n in t)L.o(t,n)&&!L.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o:function(L,e){return Object.prototype.hasOwnProperty.call(L,e)}},e=window.wp.blocks,t=window.wp.element;const n={};n.weglot=(0,t.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,t.createElement)("path",{d:"M12.9831 0.0472697L13.4682 0.0945448L13.9462 0.164576L14.4172 0.250364L14.8829 0.355413L15.3417 0.477971L15.7916 0.618033L16.2346 0.775604L16.6706 0.950685L17.0961 1.14152L17.5146 1.34811L17.9208 1.56872L18.32 1.80508L18.7087 2.05719L19.0851 2.32331L19.4528 2.60344L19.803 2.89758L20.1532 3.20397L20.4859 3.52261L20.8046 3.85352L21.111 4.20368L21.4051 4.55384L21.6853 4.9215L21.9514 5.29793L22.2018 5.68661L22.4399 6.08404L22.6605 6.49197L22.8672 6.90867L23.0563 7.33586L23.2314 7.77006L23.3872 8.21302L23.529 8.66472L23.6516 9.12168L23.7566 9.5874L23.8424 10.0601L23.9107 10.5381L23.9597 11.0213L23.9895 11.5115L24 12.0053L23.9895 12.5007L23.9597 12.9892L23.9107 13.4724L23.8424 13.9521L23.7566 14.4231L23.6516 14.8888L23.529 15.3458L23.3872 15.7975L23.2314 16.2404L23.0563 16.6764L22.8672 17.1018L22.6605 17.5185L22.4399 17.9265L22.2018 18.3256L21.9514 18.7126L21.6853 19.089L21.4051 19.4567L21.111 19.8068L20.8046 20.157L20.4859 20.4896L20.1532 20.8083L19.803 21.1147L19.4528 21.4071L19.0851 21.6872L18.7087 21.9533L18.32 22.2037L17.9208 22.44L17.5146 22.6624L17.0961 22.8637L16.6706 23.0546L16.2346 23.2296L15.7916 23.3872L15.3417 23.5273L14.8829 23.6498L14.4172 23.7549L13.9462 23.8424L13.4682 23.9107L12.9831 23.9597L12.4946 23.9895L11.9991 24L11.5054 23.9895L11.0151 23.9597L10.5318 23.9142L10.0538 23.8459L9.58109 23.7584L9.1171 23.6533L8.65835 23.5308L8.20311 23.389L7.75837 23.2314L7.32415 23.0563L6.90392 22.8637L6.48545 22.6589L6.07748 22.4365L5.68002 22.2002L5.29306 21.9498L4.91486 21.6819L4.54717 21.4018L4.19698 21.1094L3.84679 20.803L3.51412 20.4844L3.19545 20.1517L2.88904 19.8016L2.59488 19.4514L2.31473 19.0837L2.04859 18.7056L1.79821 18.3186L1.56183 17.9195L1.33946 17.5115L1.13285 17.0948L0.943754 16.6694L0.768661 16.2334L0.612826 15.7905L0.472753 15.3388L0.348439 14.8818L0.243382 14.4161L0.157583 13.9451L0.0892992 13.4654L0.0402733 12.9822L0.0105052 12.4937L0 11.9983L0.0105052 11.5045L0.0402733 11.0143L0.0892992 10.5311L0.157583 10.0531L0.243382 9.58039L0.348439 9.11468L0.472753 8.65772L0.612826 8.20601L0.768661 7.76306L0.943754 7.32886L1.13285 6.90166L1.33946 6.48497L1.56183 6.07703L1.79821 5.6796L2.04859 5.29093L2.31473 4.9145L2.59488 4.54683L2.88904 4.19667L3.19545 3.84651L3.51412 3.51561L3.84679 3.19697L4.19698 2.89058L4.54717 2.59644L4.91486 2.31631L5.29306 2.05019L5.68002 1.79807L6.07748 1.56171L6.48545 1.34112L6.90392 1.13452L7.3294 0.94368L7.76363 0.7686L8.20836 0.611028L8.65835 0.470966L9.1171 0.348408L9.58109 0.243359L10.0538 0.157571L10.5318 0.0875401L11.0151 0.0402704L11.5054 0.00875188L11.9991 0L12.4946 0.00875188L12.9831 0.0472697Z",fill:"#18164C"}),(0,t.createElement)("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M13.1629 9.00676C14.0613 8.08877 15.1601 7.64917 16.4463 7.64917C17.6781 7.65415 18.8591 8.14147 19.7361 9.00676L18.424 10.3191C17.8617 9.77606 17.2089 9.49808 16.4592 9.49808C15.7171 9.48861 15.004 9.78563 14.4879 10.3191C13.945 10.8686 13.6735 11.528 13.6735 12.2908C13.6616 13.0323 13.9563 13.7457 14.4879 14.2626C15.1252 14.9082 16.0385 15.2003 16.9321 15.0442C17.8257 14.8881 18.5861 14.3038 18.967 13.4803H16.3558V11.7284H21.0546C21.2285 13.1474 20.7371 14.5672 19.7232 15.5749C18.8118 16.48 17.7131 16.939 16.4398 16.939C15.2057 16.9581 14.019 16.4641 13.1629 15.5749C12.2895 14.7137 11.8376 13.6744 11.8015 12.4513L9.9843 17.0943L8.26446 12.529L6.58987 17.0943L2.91095 7.71111H4.89589L6.58987 12.0563L8.29032 7.71111L9.9843 12.0563L11.6718 7.71111H13.6568L13.1415 9.02764C13.1486 9.02066 13.1557 9.0137 13.1629 9.00676Z",fill:"white"}));var o=n,r=(window.wp.i18n,window.wp.blockEditor),l=window.wp.serverSideRender,i=L.n(l);(0,e.registerBlockType)("create-block/weglot-menu",{icon:o.weglot,edit:function(L){const e=(0,r.useBlockProps)();return(0,t.createElement)("div",e,(0,t.createElement)(i(),{block:"create-block/weglot-widget",attributes:L.attributes}))},save:function(){return null}})}();
|
||||
55
wp-content/plugins/weglot/blocks/weglot-menu/readme.txt
Normal file
55
wp-content/plugins/weglot/blocks/weglot-menu/readme.txt
Normal file
@@ -0,0 +1,55 @@
|
||||
=== Weglot Menu ===
|
||||
Contributors: The WordPress Contributors
|
||||
Tags: block
|
||||
Tested up to: 5.9
|
||||
Stable tag: 0.1.0
|
||||
License: GPL-2.0-or-later
|
||||
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Example block written with ESNext standard and JSX support – build step required.
|
||||
|
||||
== Description ==
|
||||
|
||||
This is the long description. No limit, and you can use Markdown (as well as in the following sections).
|
||||
|
||||
For backwards compatibility, if this section is missing, the full length of the short description will be used, and
|
||||
Markdown parsed.
|
||||
|
||||
== Installation ==
|
||||
|
||||
This section describes how to install the plugin and get it working.
|
||||
|
||||
e.g.
|
||||
|
||||
1. Upload the plugin files to the `/wp-content/plugins/weglot-menu` directory, or install the plugin through the WordPress plugins screen directly.
|
||||
1. Activate the plugin through the 'Plugins' screen in WordPress
|
||||
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
= A question that someone might have =
|
||||
|
||||
An answer to that question.
|
||||
|
||||
= What about foo bar? =
|
||||
|
||||
Answer to foo bar dilemma.
|
||||
|
||||
== Screenshots ==
|
||||
|
||||
1. This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif). Note that the screenshot is taken from
|
||||
the /assets directory or the directory that contains the stable readme.txt (tags or trunk). Screenshots in the /assets
|
||||
directory take precedence. For example, `/assets/screenshot-1.png` would win over `/tags/4.3/screenshot-1.png`
|
||||
(or jpg, jpeg, gif).
|
||||
2. This is the second screen shot
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 0.1.0 =
|
||||
* Release
|
||||
|
||||
== Arbitrary section ==
|
||||
|
||||
You may provide arbitrary sections, in the same format as the ones above. This may be of use for extremely complicated
|
||||
plugins where more information needs to be conveyed that doesn't fit into the categories of "description" or
|
||||
"installation." Arbitrary sections will be shown below the built-in sections outlined above.
|
||||
18
wp-content/plugins/weglot/blocks/weglot-menu/src/block.json
Normal file
18
wp-content/plugins/weglot/blocks/weglot-menu/src/block.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2,
|
||||
"name": "create-block/weglot-menu",
|
||||
"version": "0.1.0",
|
||||
"title": "Weglot Widget menu",
|
||||
"category": "widgets",
|
||||
"parent": ["core/navigation"],
|
||||
"icon": "smiley",
|
||||
"description": "Weglot switcher menu",
|
||||
"supports": {
|
||||
"html": true
|
||||
},
|
||||
"textdomain": "weglot-menu",
|
||||
"editorScript": "file:./index.js",
|
||||
"editorStyle": "file:./index.css",
|
||||
"style": "file:./style-index.css"
|
||||
}
|
||||
43
wp-content/plugins/weglot/blocks/weglot-menu/src/edit.js
Normal file
43
wp-content/plugins/weglot/blocks/weglot-menu/src/edit.js
Normal file
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Retrieves the translation of text.
|
||||
*
|
||||
* @see https://developer.wordpress.org/block-editor/packages/packages-i18n/
|
||||
*/
|
||||
import {__} from '@wordpress/i18n';
|
||||
|
||||
/**
|
||||
* React hook that is used to mark the block wrapper element.
|
||||
* It provides all the necessary props like the class name.
|
||||
*
|
||||
* @see https://developer.wordpress.org/block-editor/packages/packages-block-editor/#useBlockProps
|
||||
*/
|
||||
import {useBlockProps} from '@wordpress/block-editor';
|
||||
import ServerSideRender from '@wordpress/server-side-render';
|
||||
|
||||
/**
|
||||
* Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files.
|
||||
* Those files can contain any CSS code that gets applied to the editor.
|
||||
*
|
||||
* @see https://www.npmjs.com/package/@wordpress/scripts#using-css
|
||||
*/
|
||||
import './editor.scss';
|
||||
|
||||
/**
|
||||
* The edit function describes the structure of your block in the context of the
|
||||
* editor. This represents what the editor will render when the block is used.
|
||||
*
|
||||
* @see https://developer.wordpress.org/block-editor/developers/block-api/block-edit-save/#edit
|
||||
*
|
||||
* @return {WPElement} Element to render.
|
||||
*/
|
||||
export default function Edit(props) {
|
||||
const blockProps = useBlockProps();
|
||||
return (
|
||||
<div {...blockProps}>
|
||||
<ServerSideRender
|
||||
block="create-block/weglot-widget"
|
||||
attributes={props.attributes}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
|
||||
const icons = {};
|
||||
|
||||
icons.weglot = <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M12.9831 0.0472697L13.4682 0.0945448L13.9462 0.164576L14.4172 0.250364L14.8829 0.355413L15.3417 0.477971L15.7916 0.618033L16.2346 0.775604L16.6706 0.950685L17.0961 1.14152L17.5146 1.34811L17.9208 1.56872L18.32 1.80508L18.7087 2.05719L19.0851 2.32331L19.4528 2.60344L19.803 2.89758L20.1532 3.20397L20.4859 3.52261L20.8046 3.85352L21.111 4.20368L21.4051 4.55384L21.6853 4.9215L21.9514 5.29793L22.2018 5.68661L22.4399 6.08404L22.6605 6.49197L22.8672 6.90867L23.0563 7.33586L23.2314 7.77006L23.3872 8.21302L23.529 8.66472L23.6516 9.12168L23.7566 9.5874L23.8424 10.0601L23.9107 10.5381L23.9597 11.0213L23.9895 11.5115L24 12.0053L23.9895 12.5007L23.9597 12.9892L23.9107 13.4724L23.8424 13.9521L23.7566 14.4231L23.6516 14.8888L23.529 15.3458L23.3872 15.7975L23.2314 16.2404L23.0563 16.6764L22.8672 17.1018L22.6605 17.5185L22.4399 17.9265L22.2018 18.3256L21.9514 18.7126L21.6853 19.089L21.4051 19.4567L21.111 19.8068L20.8046 20.157L20.4859 20.4896L20.1532 20.8083L19.803 21.1147L19.4528 21.4071L19.0851 21.6872L18.7087 21.9533L18.32 22.2037L17.9208 22.44L17.5146 22.6624L17.0961 22.8637L16.6706 23.0546L16.2346 23.2296L15.7916 23.3872L15.3417 23.5273L14.8829 23.6498L14.4172 23.7549L13.9462 23.8424L13.4682 23.9107L12.9831 23.9597L12.4946 23.9895L11.9991 24L11.5054 23.9895L11.0151 23.9597L10.5318 23.9142L10.0538 23.8459L9.58109 23.7584L9.1171 23.6533L8.65835 23.5308L8.20311 23.389L7.75837 23.2314L7.32415 23.0563L6.90392 22.8637L6.48545 22.6589L6.07748 22.4365L5.68002 22.2002L5.29306 21.9498L4.91486 21.6819L4.54717 21.4018L4.19698 21.1094L3.84679 20.803L3.51412 20.4844L3.19545 20.1517L2.88904 19.8016L2.59488 19.4514L2.31473 19.0837L2.04859 18.7056L1.79821 18.3186L1.56183 17.9195L1.33946 17.5115L1.13285 17.0948L0.943754 16.6694L0.768661 16.2334L0.612826 15.7905L0.472753 15.3388L0.348439 14.8818L0.243382 14.4161L0.157583 13.9451L0.0892992 13.4654L0.0402733 12.9822L0.0105052 12.4937L0 11.9983L0.0105052 11.5045L0.0402733 11.0143L0.0892992 10.5311L0.157583 10.0531L0.243382 9.58039L0.348439 9.11468L0.472753 8.65772L0.612826 8.20601L0.768661 7.76306L0.943754 7.32886L1.13285 6.90166L1.33946 6.48497L1.56183 6.07703L1.79821 5.6796L2.04859 5.29093L2.31473 4.9145L2.59488 4.54683L2.88904 4.19667L3.19545 3.84651L3.51412 3.51561L3.84679 3.19697L4.19698 2.89058L4.54717 2.59644L4.91486 2.31631L5.29306 2.05019L5.68002 1.79807L6.07748 1.56171L6.48545 1.34112L6.90392 1.13452L7.3294 0.94368L7.76363 0.7686L8.20836 0.611028L8.65835 0.470966L9.1171 0.348408L9.58109 0.243359L10.0538 0.157571L10.5318 0.0875401L11.0151 0.0402704L11.5054 0.00875188L11.9991 0L12.4946 0.00875188L12.9831 0.0472697Z" fill="#18164C"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.1629 9.00676C14.0613 8.08877 15.1601 7.64917 16.4463 7.64917C17.6781 7.65415 18.8591 8.14147 19.7361 9.00676L18.424 10.3191C17.8617 9.77606 17.2089 9.49808 16.4592 9.49808C15.7171 9.48861 15.004 9.78563 14.4879 10.3191C13.945 10.8686 13.6735 11.528 13.6735 12.2908C13.6616 13.0323 13.9563 13.7457 14.4879 14.2626C15.1252 14.9082 16.0385 15.2003 16.9321 15.0442C17.8257 14.8881 18.5861 14.3038 18.967 13.4803H16.3558V11.7284H21.0546C21.2285 13.1474 20.7371 14.5672 19.7232 15.5749C18.8118 16.48 17.7131 16.939 16.4398 16.939C15.2057 16.9581 14.019 16.4641 13.1629 15.5749C12.2895 14.7137 11.8376 13.6744 11.8015 12.4513L9.9843 17.0943L8.26446 12.529L6.58987 17.0943L2.91095 7.71111H4.89589L6.58987 12.0563L8.29032 7.71111L9.9843 12.0563L11.6718 7.71111H13.6568L13.1415 9.02764C13.1486 9.02066 13.1557 9.0137 13.1629 9.00676Z" fill="white"/>
|
||||
</svg>
|
||||
|
||||
export default icons;
|
||||
39
wp-content/plugins/weglot/blocks/weglot-menu/src/index.js
Normal file
39
wp-content/plugins/weglot/blocks/weglot-menu/src/index.js
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Registers a new block provided a unique name and an object defining its behavior.
|
||||
*
|
||||
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/
|
||||
*/
|
||||
import { registerBlockType } from '@wordpress/blocks';
|
||||
|
||||
/**
|
||||
* Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files.
|
||||
* All files containing `style` keyword are bundled together. The code used
|
||||
* gets applied both to the front of your site and to the editor.
|
||||
*
|
||||
* @see https://www.npmjs.com/package/@wordpress/scripts#using-css
|
||||
*/
|
||||
import icons from './icons.js'
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import Edit from './edit';
|
||||
import save from './save';
|
||||
|
||||
/**
|
||||
* Every block starts by registering a new block type definition.
|
||||
*
|
||||
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/
|
||||
*/
|
||||
registerBlockType( 'create-block/weglot-menu', {
|
||||
icon: icons.weglot, // The Weglot icon
|
||||
/**
|
||||
* @see ./edit.js
|
||||
*/
|
||||
edit: Edit,
|
||||
|
||||
/**
|
||||
* @see ./save.js
|
||||
*/
|
||||
save,
|
||||
} );
|
||||
27
wp-content/plugins/weglot/blocks/weglot-menu/src/save.js
Normal file
27
wp-content/plugins/weglot/blocks/weglot-menu/src/save.js
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Retrieves the translation of text.
|
||||
*
|
||||
* @see https://developer.wordpress.org/block-editor/packages/packages-i18n/
|
||||
*/
|
||||
import { __ } from '@wordpress/i18n';
|
||||
|
||||
/**
|
||||
* React hook that is used to mark the block wrapper element.
|
||||
* It provides all the necessary props like the class name.
|
||||
*
|
||||
* @see https://developer.wordpress.org/block-editor/packages/packages-block-editor/#useBlockProps
|
||||
*/
|
||||
import { useBlockProps } from '@wordpress/block-editor';
|
||||
|
||||
/**
|
||||
* The save function defines the way in which the different attributes should
|
||||
* be combined into the final markup, which is then serialized by the block
|
||||
* editor into `post_content`.
|
||||
*
|
||||
* @see https://developer.wordpress.org/block-editor/developers/block-api/block-edit-save/#save
|
||||
*
|
||||
* @return {WPElement} Element to render.
|
||||
*/
|
||||
export default function save() {
|
||||
return null;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* The following styles get applied both on the front of your site
|
||||
* and in the editor.
|
||||
*
|
||||
* Replace them with your own styles or remove the file completely.
|
||||
*/
|
||||
26
wp-content/plugins/weglot/blocks/weglot-menu/weglot-menu.php
Normal file
26
wp-content/plugins/weglot/blocks/weglot-menu/weglot-menu.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: Weglot Menu
|
||||
* Description: Example block written with ESNext standard and JSX support – build step required.
|
||||
* Requires at least: 5.8
|
||||
* Requires PHP: 7.0
|
||||
* Version: 0.1.0
|
||||
* Author: The WordPress Contributors
|
||||
* License: GPL-2.0-or-later
|
||||
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||
* Text Domain: weglot-menu
|
||||
*
|
||||
* @package create-block
|
||||
*/
|
||||
|
||||
/**
|
||||
* Registers the block using the metadata loaded from the `block.json` file.
|
||||
* Behind the scenes, it registers also all assets so they can be enqueued
|
||||
* through the block editor in the corresponding context.
|
||||
*
|
||||
* @see https://developer.wordpress.org/reference/functions/register_block_type/
|
||||
*/
|
||||
function create_block_weglot_menu_block_init() {
|
||||
register_block_type( __DIR__ . '/build' );
|
||||
}
|
||||
add_action( 'init', 'create_block_weglot_menu_block_init' );
|
||||
Reference in New Issue
Block a user