new file: wp-config.php
new file: wp-content/plugins/example-static/.editorconfig new file: wp-content/plugins/example-static/.gitignore new file: wp-content/plugins/example-static/build/block.json new file: wp-content/plugins/example-static/build/index.asset.php new file: wp-content/plugins/example-static/build/index.css new file: wp-content/plugins/example-static/build/index.css.map new file: wp-content/plugins/example-static/build/index.js new file: wp-content/plugins/example-static/build/index.js.map new file: wp-content/plugins/example-static/build/style-index.css new file: wp-content/plugins/example-static/build/view.asset.php new file: wp-content/plugins/example-static/build/view.js new file: wp-content/plugins/example-static/example-static.php new file: wp-content/plugins/example-static/package-lock.json new file: wp-content/plugins/example-static/package.json new file: wp-content/plugins/example-static/readme.txt new file: wp-content/plugins/example-static/src/block.json new file: wp-content/plugins/example-static/src/edit.js new file: wp-content/plugins/example-static/src/editor.scss new file: wp-content/plugins/example-static/src/index.js new file: wp-content/plugins/example-static/src/save.js new file: wp-content/plugins/example-static/src/style.scss new file: wp-content/plugins/example-static/src/view.js deleted: wp-content/plugins/hello.php new file: wp-content/plugins/package-lock.json new file: wp-content/plugins/todo-list/.editorconfig new file: wp-content/plugins/todo-list/.gitignore new file: wp-content/plugins/todo-list/build/block.json new file: wp-content/plugins/todo-list/build/index.asset.php new file: wp-content/plugins/todo-list/build/index.css new file: wp-content/plugins/todo-list/build/index.js new file: wp-content/plugins/todo-list/build/style-index.css new file: wp-content/plugins/todo-list/build/view.asset.php new file: wp-content/plugins/todo-list/build/view.js new file: wp-content/plugins/todo-list/package-lock.json new file: wp-content/plugins/todo-list/package.json new file: wp-content/plugins/todo-list/readme.txt new file: wp-content/plugins/todo-list/src/block.json new file: wp-content/plugins/todo-list/src/edit.js new file: wp-content/plugins/todo-list/src/editor.scss new file: wp-content/plugins/todo-list/src/index.js new file: wp-content/plugins/todo-list/src/save.js new file: wp-content/plugins/todo-list/src/style.scss new file: wp-content/plugins/todo-list/src/view.js new file: wp-content/plugins/todo-list/todo-list.php
This commit is contained in:
parent
d86d26bd27
commit
40ad1237ce
|
@ -0,0 +1,142 @@
|
|||
<?php
|
||||
/**
|
||||
* The base configuration for WordPress
|
||||
*
|
||||
* The wp-config.php creation script uses this file during the installation.
|
||||
* You don't have to use the website, you can copy this file to "wp-config.php"
|
||||
* and fill in the values.
|
||||
*
|
||||
* This file contains the following configurations:
|
||||
*
|
||||
* * Database settings
|
||||
* * Secret keys
|
||||
* * Database table prefix
|
||||
* * ABSPATH
|
||||
*
|
||||
* This has been slightly modified (to read environment variables) for use in Docker.
|
||||
*
|
||||
* @link https://developer.wordpress.org/advanced-administration/wordpress/wp-config/
|
||||
*
|
||||
* @package WordPress
|
||||
*/
|
||||
|
||||
// IMPORTANT: this file needs to stay in-sync with https://github.com/WordPress/WordPress/blob/master/wp-config-sample.php
|
||||
// (it gets parsed by the upstream wizard in https://github.com/WordPress/WordPress/blob/f27cb65e1ef25d11b535695a660e7282b98eb742/wp-admin/setup-config.php#L356-L392)
|
||||
|
||||
// a helper function to lookup "env_FILE", "env", then fallback
|
||||
if (!function_exists('getenv_docker')) {
|
||||
// https://github.com/docker-library/wordpress/issues/588 (WP-CLI will load this file 2x)
|
||||
function getenv_docker($env, $default) {
|
||||
if ($fileEnv = getenv($env . '_FILE')) {
|
||||
return rtrim(file_get_contents($fileEnv), "\r\n");
|
||||
}
|
||||
else if (($val = getenv($env)) !== false) {
|
||||
return $val;
|
||||
}
|
||||
else {
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ** Database settings - You can get this info from your web host ** //
|
||||
/** The name of the database for WordPress */
|
||||
define( 'DB_NAME', getenv_docker('WORDPRESS_DB_NAME', 'wordpress') );
|
||||
|
||||
/** Database username */
|
||||
define( 'DB_USER', getenv_docker('WORDPRESS_DB_USER', 'example username') );
|
||||
|
||||
/** Database password */
|
||||
define( 'DB_PASSWORD', getenv_docker('WORDPRESS_DB_PASSWORD', 'example password') );
|
||||
|
||||
/**
|
||||
* Docker image fallback values above are sourced from the official WordPress installation wizard:
|
||||
* https://github.com/WordPress/WordPress/blob/1356f6537220ffdc32b9dad2a6cdbe2d010b7a88/wp-admin/setup-config.php#L224-L238
|
||||
* (However, using "example username" and "example password" in your database is strongly discouraged. Please use strong, random credentials!)
|
||||
*/
|
||||
|
||||
/** Database hostname */
|
||||
define( 'DB_HOST', getenv_docker('WORDPRESS_DB_HOST', 'mysql') );
|
||||
|
||||
/** Database charset to use in creating database tables. */
|
||||
define( 'DB_CHARSET', getenv_docker('WORDPRESS_DB_CHARSET', 'utf8') );
|
||||
|
||||
/** The database collate type. Don't change this if in doubt. */
|
||||
define( 'DB_COLLATE', getenv_docker('WORDPRESS_DB_COLLATE', '') );
|
||||
|
||||
/**#@+
|
||||
* Authentication unique keys and salts.
|
||||
*
|
||||
* Change these to different unique phrases! You can generate these using
|
||||
* the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}.
|
||||
*
|
||||
* You can change these at any point in time to invalidate all existing cookies.
|
||||
* This will force all users to have to log in again.
|
||||
*
|
||||
* @since 2.6.0
|
||||
*/
|
||||
define( 'AUTH_KEY', getenv_docker('WORDPRESS_AUTH_KEY', 'a0c65417ad172b83badad59aaee64ceef558e136') );
|
||||
define( 'SECURE_AUTH_KEY', getenv_docker('WORDPRESS_SECURE_AUTH_KEY', '0359a2bb1faa3d094de1140969f0c7b13509e2e6') );
|
||||
define( 'LOGGED_IN_KEY', getenv_docker('WORDPRESS_LOGGED_IN_KEY', '982d7e89d0718af15a1b88217241dc1847aad85c') );
|
||||
define( 'NONCE_KEY', getenv_docker('WORDPRESS_NONCE_KEY', '0e9cb3dc11903a7c3abce1df5ee7ecac9f4daefd') );
|
||||
define( 'AUTH_SALT', getenv_docker('WORDPRESS_AUTH_SALT', '221ad97a2e0979ac46cfc9d79c84c0fb44b054cd') );
|
||||
define( 'SECURE_AUTH_SALT', getenv_docker('WORDPRESS_SECURE_AUTH_SALT', '5e65dabcb3759b99cf81a4aea97b396917217202') );
|
||||
define( 'LOGGED_IN_SALT', getenv_docker('WORDPRESS_LOGGED_IN_SALT', '7385aa6ec4c35a374ad2da64775d2d491485d662') );
|
||||
define( 'NONCE_SALT', getenv_docker('WORDPRESS_NONCE_SALT', '7e1bee95a3b2fc85732493ddda7571526c4ab3fc') );
|
||||
// (See also https://wordpress.stackexchange.com/a/152905/199287)
|
||||
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* WordPress database table prefix.
|
||||
*
|
||||
* You can have multiple installations in one database if you give each
|
||||
* a unique prefix. Only numbers, letters, and underscores please!
|
||||
*/
|
||||
$table_prefix = getenv_docker('WORDPRESS_TABLE_PREFIX', 'wp_');
|
||||
|
||||
/**
|
||||
* For developers: WordPress debugging mode.
|
||||
*
|
||||
* Change this to true to enable the display of notices during development.
|
||||
* It is strongly recommended that plugin and theme developers use WP_DEBUG
|
||||
* in their development environments.
|
||||
*
|
||||
* For information on other constants that can be used for debugging,
|
||||
* visit the documentation.
|
||||
*
|
||||
* @link https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/
|
||||
*/
|
||||
define( 'FS_METHOD', 'direct' );
|
||||
define( 'SCRIPT_DEBUG', true );
|
||||
define( 'WP_ENVIRONMENT_TYPE', 'local' );
|
||||
define( 'WP_PHP_BINARY', 'php' );
|
||||
define( 'WP_TESTS_EMAIL', 'admin@example.org' );
|
||||
define( 'WP_TESTS_TITLE', 'Test Blog' );
|
||||
define( 'WP_TESTS_DOMAIN', 'localhost:8888' );
|
||||
define( 'WP_SITEURL', 'http://localhost:8888' );
|
||||
define( 'WP_HOME', 'http://localhost:8888' );
|
||||
define( 'WP_DEBUG', true );
|
||||
|
||||
/* Add any custom values between this line and the "stop editing" line. */
|
||||
|
||||
// If we're behind a proxy server and using HTTPS, we need to alert WordPress of that fact
|
||||
// see also https://wordpress.org/support/article/administration-over-ssl/#using-a-reverse-proxy
|
||||
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) {
|
||||
$_SERVER['HTTPS'] = 'on';
|
||||
}
|
||||
// (we include this by default because reverse proxying is extremely common in container environments)
|
||||
|
||||
if ($configExtra = getenv_docker('WORDPRESS_CONFIG_EXTRA', '')) {
|
||||
eval($configExtra);
|
||||
}
|
||||
|
||||
/* That's all, stop editing! Happy publishing. */
|
||||
|
||||
/** Absolute path to the WordPress directory. */
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
define( 'ABSPATH', __DIR__ . '/' );
|
||||
}
|
||||
|
||||
/** Sets up WordPress vars and included files. */
|
||||
require_once ABSPATH . 'wp-settings.php';
|
|
@ -0,0 +1,18 @@
|
|||
# This file is for unifying the coding style for different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
# WordPress Coding Standards
|
||||
# https://make.wordpress.org/core/handbook/coding-standards/
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
indent_style = tab
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
|
@ -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,30 @@
|
|||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 3,
|
||||
"name": "lelafa/example-static",
|
||||
"version": "0.1.0",
|
||||
"title": "Example-static",
|
||||
"category": "text",
|
||||
"icon": "smiley",
|
||||
"description": "Example block scaffolded with Create Block tool.",
|
||||
"example": {},
|
||||
"supports": {
|
||||
"html": false
|
||||
},
|
||||
"textdomain": "example-static",
|
||||
"editorScript": "file:./index.js",
|
||||
"editorStyle": "file:./index.css",
|
||||
"style": "file:./style-index.css",
|
||||
"viewScript": "file:./view.js",
|
||||
"attributes": {
|
||||
"content": {
|
||||
"type": "string",
|
||||
"source": "html",
|
||||
"selector": "p"
|
||||
}
|
||||
},
|
||||
"align": {
|
||||
"type": "string",
|
||||
"default": "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-i18n'), 'version' => 'd36cbdff2f9b4b64aae7');
|
|
@ -0,0 +1,13 @@
|
|||
/*!****************************************************************************************************************************************************************************************************************************************!*\
|
||||
!*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].use[3]!./src/editor.scss ***!
|
||||
\****************************************************************************************************************************************************************************************************************************************/
|
||||
/**
|
||||
* The following styles get applied inside the editor only.
|
||||
*
|
||||
* Replace them with your own styles or remove the file completely.
|
||||
*/
|
||||
.wp-block-lelafa-example-static {
|
||||
border: 1px dotted #f00;
|
||||
}
|
||||
|
||||
/*# sourceMappingURL=index.css.map*/
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.css","mappings":";;;AAAA;;;;EAAA;AAMA;EACC;AAAD,C","sources":["webpack://example-static/./src/editor.scss"],"sourcesContent":["/**\n * The following styles get applied inside the editor only.\n *\n * Replace them with your own styles or remove the file completely.\n */\n\n.wp-block-lelafa-example-static {\n\tborder: 1px dotted #f00;\n}\n"],"names":[],"sourceRoot":""}
|
|
@ -0,0 +1,374 @@
|
|||
/******/ (() => { // webpackBootstrap
|
||||
/******/ "use strict";
|
||||
/******/ var __webpack_modules__ = ({
|
||||
|
||||
/***/ "./src/edit.js":
|
||||
/*!*********************!*\
|
||||
!*** ./src/edit.js ***!
|
||||
\*********************/
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "default": () => (/* binding */ Edit)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
||||
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
||||
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
||||
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);
|
||||
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
|
||||
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__);
|
||||
/* harmony import */ var _editor_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./editor.scss */ "./src/editor.scss");
|
||||
|
||||
|
||||
|
||||
|
||||
function Edit({
|
||||
attributes,
|
||||
setAttributes
|
||||
}) {
|
||||
const blockProps = (0,_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.useBlockProps)();
|
||||
const onChangeContent = newContent => {
|
||||
setAttributes({
|
||||
content: newContent
|
||||
});
|
||||
};
|
||||
return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.RichText, {
|
||||
...blockProps,
|
||||
tagName: "p",
|
||||
onChange: onChangeContent,
|
||||
allowedFormats: ['core/bold', 'core/italic'],
|
||||
value: attributes.content,
|
||||
placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Write your text...')
|
||||
});
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/index.js":
|
||||
/*!**********************!*\
|
||||
!*** ./src/index.js ***!
|
||||
\**********************/
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks");
|
||||
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__);
|
||||
/* harmony import */ var _style_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./style.scss */ "./src/style.scss");
|
||||
/* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./edit */ "./src/edit.js");
|
||||
/* harmony import */ var _save__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./save */ "./src/save.js");
|
||||
/* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./block.json */ "./src/block.json");
|
||||
/**
|
||||
* 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/
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Every block starts by registering a new block type definition.
|
||||
*
|
||||
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/
|
||||
*/
|
||||
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockType)(_block_json__WEBPACK_IMPORTED_MODULE_4__.name, {
|
||||
/**
|
||||
* @see ./edit.js
|
||||
*/
|
||||
edit: _edit__WEBPACK_IMPORTED_MODULE_2__["default"],
|
||||
/**
|
||||
* @see ./save.js
|
||||
*/
|
||||
save: _save__WEBPACK_IMPORTED_MODULE_3__["default"]
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/save.js":
|
||||
/*!*********************!*\
|
||||
!*** ./src/save.js ***!
|
||||
\*********************/
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "default": () => (/* binding */ save)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
||||
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
||||
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
||||
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);
|
||||
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
|
||||
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__);
|
||||
|
||||
|
||||
|
||||
function save({
|
||||
attributes
|
||||
}) {
|
||||
const blockProps = _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.useBlockProps.save();
|
||||
return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.RichText.Content, {
|
||||
...blockProps,
|
||||
tagName: "p",
|
||||
value: attributes.content
|
||||
});
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/editor.scss":
|
||||
/*!*************************!*\
|
||||
!*** ./src/editor.scss ***!
|
||||
\*************************/
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
// extracted by mini-css-extract-plugin
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/style.scss":
|
||||
/*!************************!*\
|
||||
!*** ./src/style.scss ***!
|
||||
\************************/
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
// extracted by mini-css-extract-plugin
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "react":
|
||||
/*!************************!*\
|
||||
!*** external "React" ***!
|
||||
\************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = window["React"];
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "@wordpress/block-editor":
|
||||
/*!*************************************!*\
|
||||
!*** external ["wp","blockEditor"] ***!
|
||||
\*************************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = window["wp"]["blockEditor"];
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "@wordpress/blocks":
|
||||
/*!********************************!*\
|
||||
!*** external ["wp","blocks"] ***!
|
||||
\********************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = window["wp"]["blocks"];
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "@wordpress/i18n":
|
||||
/*!******************************!*\
|
||||
!*** external ["wp","i18n"] ***!
|
||||
\******************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = window["wp"]["i18n"];
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/block.json":
|
||||
/*!************************!*\
|
||||
!*** ./src/block.json ***!
|
||||
\************************/
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = /*#__PURE__*/JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"lelafa/example-static","version":"0.1.0","title":"Example-static","category":"text","icon":"smiley","description":"Example block scaffolded with Create Block tool.","example":{},"supports":{"html":false},"textdomain":"example-static","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","viewScript":"file:./view.js","attributes":{"content":{"type":"string","source":"html","selector":"p"}},"align":{"type":"string","default":"none"}}');
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
/************************************************************************/
|
||||
/******/ // The module cache
|
||||
/******/ var __webpack_module_cache__ = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/ // Check if module is in cache
|
||||
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
||||
/******/ if (cachedModule !== undefined) {
|
||||
/******/ return cachedModule.exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = __webpack_module_cache__[moduleId] = {
|
||||
/******/ // no module.id needed
|
||||
/******/ // no module.loaded needed
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = __webpack_modules__;
|
||||
/******/
|
||||
/************************************************************************/
|
||||
/******/ /* webpack/runtime/chunk loaded */
|
||||
/******/ (() => {
|
||||
/******/ var deferred = [];
|
||||
/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
|
||||
/******/ if(chunkIds) {
|
||||
/******/ priority = priority || 0;
|
||||
/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
|
||||
/******/ deferred[i] = [chunkIds, fn, priority];
|
||||
/******/ return;
|
||||
/******/ }
|
||||
/******/ var notFulfilled = Infinity;
|
||||
/******/ for (var i = 0; i < deferred.length; i++) {
|
||||
/******/ var [chunkIds, fn, priority] = deferred[i];
|
||||
/******/ var fulfilled = true;
|
||||
/******/ for (var j = 0; j < chunkIds.length; j++) {
|
||||
/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
|
||||
/******/ chunkIds.splice(j--, 1);
|
||||
/******/ } else {
|
||||
/******/ fulfilled = false;
|
||||
/******/ if(priority < notFulfilled) notFulfilled = priority;
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ if(fulfilled) {
|
||||
/******/ deferred.splice(i--, 1)
|
||||
/******/ var r = fn();
|
||||
/******/ if (r !== undefined) result = r;
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ return result;
|
||||
/******/ };
|
||||
/******/ })();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/compat get default export */
|
||||
/******/ (() => {
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = (module) => {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ () => (module['default']) :
|
||||
/******/ () => (module);
|
||||
/******/ __webpack_require__.d(getter, { a: getter });
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/ })();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/define property getters */
|
||||
/******/ (() => {
|
||||
/******/ // define getter functions for harmony exports
|
||||
/******/ __webpack_require__.d = (exports, definition) => {
|
||||
/******/ for(var key in definition) {
|
||||
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
||||
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/ })();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
||||
/******/ (() => {
|
||||
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
||||
/******/ })();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/make namespace object */
|
||||
/******/ (() => {
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = (exports) => {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/ })();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/jsonp chunk loading */
|
||||
/******/ (() => {
|
||||
/******/ // no baseURI
|
||||
/******/
|
||||
/******/ // object to store loaded and loading chunks
|
||||
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
||||
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
|
||||
/******/ var installedChunks = {
|
||||
/******/ "index": 0,
|
||||
/******/ "./style-index": 0
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // no chunk on demand loading
|
||||
/******/
|
||||
/******/ // no prefetching
|
||||
/******/
|
||||
/******/ // no preloaded
|
||||
/******/
|
||||
/******/ // no HMR
|
||||
/******/
|
||||
/******/ // no HMR manifest
|
||||
/******/
|
||||
/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);
|
||||
/******/
|
||||
/******/ // install a JSONP callback for chunk loading
|
||||
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
|
||||
/******/ var [chunkIds, moreModules, runtime] = data;
|
||||
/******/ // add "moreModules" to the modules object,
|
||||
/******/ // then flag all "chunkIds" as loaded and fire callback
|
||||
/******/ var moduleId, chunkId, i = 0;
|
||||
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
|
||||
/******/ for(moduleId in moreModules) {
|
||||
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
|
||||
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
|
||||
/******/ }
|
||||
/******/ }
|
||||
/******/ if(runtime) var result = runtime(__webpack_require__);
|
||||
/******/ }
|
||||
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
|
||||
/******/ for(;i < chunkIds.length; i++) {
|
||||
/******/ chunkId = chunkIds[i];
|
||||
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
|
||||
/******/ installedChunks[chunkId][0]();
|
||||
/******/ }
|
||||
/******/ installedChunks[chunkId] = 0;
|
||||
/******/ }
|
||||
/******/ return __webpack_require__.O(result);
|
||||
/******/ }
|
||||
/******/
|
||||
/******/ var chunkLoadingGlobal = globalThis["webpackChunkexample_static"] = globalThis["webpackChunkexample_static"] || [];
|
||||
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
|
||||
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
|
||||
/******/ })();
|
||||
/******/
|
||||
/************************************************************************/
|
||||
/******/
|
||||
/******/ // startup
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ // This entry module depends on other loaded chunks and execution need to be delayed
|
||||
/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["./style-index"], () => (__webpack_require__("./src/index.js")))
|
||||
/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
|
||||
/******/
|
||||
/******/ })()
|
||||
;
|
||||
//# sourceMappingURL=index.js.map
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1 @@
|
|||
.wp-block-lelafa-example-static{background-color:#21759b;color:#fff;padding:2px}
|
|
@ -0,0 +1 @@
|
|||
<?php return array('dependencies' => array(), 'version' => '433e1dcc0f40cd5a574e');
|
|
@ -0,0 +1 @@
|
|||
console.log("Hello World! (from lelafa-example-static block)");
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
/**
|
||||
* Plugin Name: Example-static
|
||||
* Description: Example block scaffolded with Create Block tool.
|
||||
* Requires at least: 6.1
|
||||
* 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: example-static
|
||||
*
|
||||
* @package lelafa
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 example_static_example_static_block_init() {
|
||||
register_block_type( __DIR__ . '/build' );
|
||||
}
|
||||
add_action( 'init', 'example_static_example_static_block_init' );
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"name": "example-static",
|
||||
"version": "0.1.0",
|
||||
"description": "Example block scaffolded with Create Block tool.",
|
||||
"author": "The WordPress Contributors",
|
||||
"license": "GPL-2.0-or-later",
|
||||
"main": "build/index.js",
|
||||
"scripts": {
|
||||
"build": "wp-scripts build",
|
||||
"format": "wp-scripts format",
|
||||
"lint:css": "wp-scripts lint-style",
|
||||
"lint:js": "wp-scripts lint-js",
|
||||
"packages-update": "wp-scripts packages-update",
|
||||
"plugin-zip": "wp-scripts plugin-zip",
|
||||
"start": "wp-scripts start"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@wordpress/scripts": "^27.5.0"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
=== Example-static ===
|
||||
Contributors: The WordPress Contributors
|
||||
Tags: block
|
||||
Tested up to: 6.1
|
||||
Stable tag: 0.1.0
|
||||
License: GPL-2.0-or-later
|
||||
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Example block scaffolded with Create Block tool.
|
||||
|
||||
== 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/example-static` 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.
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 3,
|
||||
"name": "lelafa/example-static",
|
||||
"version": "0.1.0",
|
||||
"title": "Example-static",
|
||||
"category": "text",
|
||||
"icon": "smiley",
|
||||
"description": "Example block scaffolded with Create Block tool.",
|
||||
"example": {},
|
||||
"supports": {
|
||||
"html": false
|
||||
},
|
||||
"textdomain": "example-static",
|
||||
"editorScript": "file:./index.js",
|
||||
"editorStyle": "file:./index.css",
|
||||
"style": "file:./style-index.css",
|
||||
"viewScript": "file:./view.js",
|
||||
"attributes": {
|
||||
"content": {
|
||||
"type": "string",
|
||||
"source": "html",
|
||||
"selector": "p"
|
||||
}
|
||||
},
|
||||
"align": {
|
||||
"type": "string",
|
||||
"default": "none"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
import { __ } from '@wordpress/i18n';
|
||||
import { useBlockProps, RichText } from '@wordpress/block-editor';
|
||||
import './editor.scss';
|
||||
|
||||
export default function Edit( { attributes, setAttributes } ) {
|
||||
const blockProps = useBlockProps();
|
||||
|
||||
const onChangeContent = ( newContent ) => {
|
||||
setAttributes( { content: newContent } )
|
||||
}
|
||||
|
||||
return (
|
||||
<RichText
|
||||
{ ...blockProps }
|
||||
tagName="p"
|
||||
onChange={ onChangeContent }
|
||||
allowedFormats={ [ 'core/bold', 'core/italic' ] }
|
||||
value={ attributes.content }
|
||||
placeholder={ __( 'Write your text...' ) }
|
||||
/>
|
||||
);
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* The following styles get applied inside the editor only.
|
||||
*
|
||||
* Replace them with your own styles or remove the file completely.
|
||||
*/
|
||||
|
||||
.wp-block-lelafa-example-static {
|
||||
border: 1px dotted #f00;
|
||||
}
|
|
@ -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 './style.scss';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import Edit from './edit';
|
||||
import save from './save';
|
||||
import metadata from './block.json';
|
||||
|
||||
/**
|
||||
* Every block starts by registering a new block type definition.
|
||||
*
|
||||
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/
|
||||
*/
|
||||
registerBlockType( metadata.name, {
|
||||
/**
|
||||
* @see ./edit.js
|
||||
*/
|
||||
edit: Edit,
|
||||
|
||||
/**
|
||||
* @see ./save.js
|
||||
*/
|
||||
save,
|
||||
} );
|
|
@ -0,0 +1,13 @@
|
|||
import { __ } from '@wordpress/i18n';
|
||||
import { useBlockProps, RichText } from '@wordpress/block-editor';
|
||||
|
||||
export default function save( { attributes } ) {
|
||||
const blockProps = useBlockProps.save();
|
||||
return (
|
||||
<RichText.Content
|
||||
{ ...blockProps }
|
||||
tagName="p"
|
||||
value={ attributes.content }
|
||||
/>
|
||||
);
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
.wp-block-lelafa-example-static {
|
||||
background-color: #21759b;
|
||||
color: #fff;
|
||||
padding: 2px;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/**
|
||||
* Use this file for JavaScript code that you want to run in the front-end
|
||||
* on posts/pages that contain this block.
|
||||
*
|
||||
* When this file is defined as the value of the `viewScript` property
|
||||
* in `block.json` it will be enqueued on the front end of the site.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```js
|
||||
* {
|
||||
* "viewScript": "file:./view.js"
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* If you're not making any changes to this file because your project doesn't need any
|
||||
* JavaScript running in the front-end, then you should delete this file and remove
|
||||
* the `viewScript` property from `block.json`.
|
||||
*
|
||||
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#view-script
|
||||
*/
|
||||
|
||||
/* eslint-disable no-console */
|
||||
console.log( 'Hello World! (from lelafa-example-static block)' );
|
||||
/* eslint-enable no-console */
|
|
@ -1,100 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Hello_Dolly
|
||||
* @version 1.7.2
|
||||
*/
|
||||
/*
|
||||
Plugin Name: Hello Dolly
|
||||
Plugin URI: http://wordpress.org/plugins/hello-dolly/
|
||||
Description: This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from <cite>Hello, Dolly</cite> in the upper right of your admin screen on every page.
|
||||
Author: Matt Mullenweg
|
||||
Version: 1.7.2
|
||||
Author URI: http://ma.tt/
|
||||
*/
|
||||
|
||||
function hello_dolly_get_lyric() {
|
||||
/** These are the lyrics to Hello Dolly */
|
||||
$lyrics = "Hello, Dolly
|
||||
Well, hello, Dolly
|
||||
It's so nice to have you back where you belong
|
||||
You're lookin' swell, Dolly
|
||||
I can tell, Dolly
|
||||
You're still glowin', you're still crowin'
|
||||
You're still goin' strong
|
||||
I feel the room swayin'
|
||||
While the band's playin'
|
||||
One of our old favorite songs from way back when
|
||||
So, take her wrap, fellas
|
||||
Dolly, never go away again
|
||||
Hello, Dolly
|
||||
Well, hello, Dolly
|
||||
It's so nice to have you back where you belong
|
||||
You're lookin' swell, Dolly
|
||||
I can tell, Dolly
|
||||
You're still glowin', you're still crowin'
|
||||
You're still goin' strong
|
||||
I feel the room swayin'
|
||||
While the band's playin'
|
||||
One of our old favorite songs from way back when
|
||||
So, golly, gee, fellas
|
||||
Have a little faith in me, fellas
|
||||
Dolly, never go away
|
||||
Promise, you'll never go away
|
||||
Dolly'll never go away again";
|
||||
|
||||
// Here we split it into lines.
|
||||
$lyrics = explode( "\n", $lyrics );
|
||||
|
||||
// And then randomly choose a line.
|
||||
return wptexturize( $lyrics[ mt_rand( 0, count( $lyrics ) - 1 ) ] );
|
||||
}
|
||||
|
||||
// This just echoes the chosen line, we'll position it later.
|
||||
function hello_dolly() {
|
||||
$chosen = hello_dolly_get_lyric();
|
||||
$lang = '';
|
||||
if ( 'en_' !== substr( get_user_locale(), 0, 3 ) ) {
|
||||
$lang = ' lang="en"';
|
||||
}
|
||||
|
||||
printf(
|
||||
'<p id="dolly"><span class="screen-reader-text">%s </span><span dir="ltr"%s>%s</span></p>',
|
||||
__( 'Quote from Hello Dolly song, by Jerry Herman:' ),
|
||||
$lang,
|
||||
$chosen
|
||||
);
|
||||
}
|
||||
|
||||
// Now we set that function up to execute when the admin_notices action is called.
|
||||
add_action( 'admin_notices', 'hello_dolly' );
|
||||
|
||||
// We need some CSS to position the paragraph.
|
||||
function dolly_css() {
|
||||
echo "
|
||||
<style type='text/css'>
|
||||
#dolly {
|
||||
float: right;
|
||||
padding: 5px 10px;
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
line-height: 1.6666;
|
||||
}
|
||||
.rtl #dolly {
|
||||
float: left;
|
||||
}
|
||||
.block-editor-page #dolly {
|
||||
display: none;
|
||||
}
|
||||
@media screen and (max-width: 782px) {
|
||||
#dolly,
|
||||
.rtl #dolly {
|
||||
float: none;
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
";
|
||||
}
|
||||
|
||||
add_action( 'admin_head', 'dolly_css' );
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"name": "plugins",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
# This file is for unifying the coding style for different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
# WordPress Coding Standards
|
||||
# https://make.wordpress.org/core/handbook/coding-standards/
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
indent_style = tab
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
|
@ -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,19 @@
|
|||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 3,
|
||||
"name": "create-block/todo-list",
|
||||
"version": "0.1.0",
|
||||
"title": "Todo List",
|
||||
"category": "widgets",
|
||||
"icon": "smiley",
|
||||
"description": "Example block scaffolded with Create Block tool.",
|
||||
"example": {},
|
||||
"supports": {
|
||||
"html": false
|
||||
},
|
||||
"textdomain": "todo-list",
|
||||
"editorScript": "file:./index.js",
|
||||
"editorStyle": "file:./index.css",
|
||||
"style": "file:./style-index.css",
|
||||
"viewScript": "file:./view.js"
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-i18n'), 'version' => '5a0c178db3b8185cd4f6');
|
|
@ -0,0 +1 @@
|
|||
.wp-block-create-block-todo-list{border:1px dotted red}
|
|
@ -0,0 +1 @@
|
|||
(()=>{"use strict";var o,e={758:()=>{const o=window.wp.blocks,e=window.React,r=window.wp.i18n,t=window.wp.blockEditor,i=JSON.parse('{"UU":"create-block/todo-list"}');(0,o.registerBlockType)(i.UU,{edit:function(){return(0,e.createElement)("p",{...(0,t.useBlockProps)()},(0,r.__)("Todo List – hello from the editor!","todo-list"))},save:function(){return(0,e.createElement)("p",{...t.useBlockProps.save()},"Todo List – hello from the saved content!")}})}},r={};function t(o){var i=r[o];if(void 0!==i)return i.exports;var n=r[o]={exports:{}};return e[o](n,n.exports,t),n.exports}t.m=e,o=[],t.O=(e,r,i,n)=>{if(!r){var l=1/0;for(p=0;p<o.length;p++){for(var[r,i,n]=o[p],s=!0,a=0;a<r.length;a++)(!1&n||l>=n)&&Object.keys(t.O).every((o=>t.O[o](r[a])))?r.splice(a--,1):(s=!1,n<l&&(l=n));if(s){o.splice(p--,1);var c=i();void 0!==c&&(e=c)}}return e}n=n||0;for(var p=o.length;p>0&&o[p-1][2]>n;p--)o[p]=o[p-1];o[p]=[r,i,n]},t.o=(o,e)=>Object.prototype.hasOwnProperty.call(o,e),(()=>{var o={57:0,350:0};t.O.j=e=>0===o[e];var e=(e,r)=>{var i,n,[l,s,a]=r,c=0;if(l.some((e=>0!==o[e]))){for(i in s)t.o(s,i)&&(t.m[i]=s[i]);if(a)var p=a(t)}for(e&&e(r);c<l.length;c++)n=l[c],t.o(o,n)&&o[n]&&o[n][0](),o[n]=0;return t.O(p)},r=globalThis.webpackChunktodo_list=globalThis.webpackChunktodo_list||[];r.forEach(e.bind(null,0)),r.push=e.bind(null,r.push.bind(r))})();var i=t.O(void 0,[350],(()=>t(758)));i=t.O(i)})();
|
|
@ -0,0 +1 @@
|
|||
.wp-block-create-block-todo-list{background-color:#21759b;color:#fff;padding:2px}
|
|
@ -0,0 +1 @@
|
|||
<?php return array('dependencies' => array(), 'version' => '7ca23fe6db2e4bfa97aa');
|
|
@ -0,0 +1 @@
|
|||
console.log("Hello World! (from create-block-todo-list block)");
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"name": "todo-list",
|
||||
"version": "0.1.0",
|
||||
"description": "Example block scaffolded with Create Block tool.",
|
||||
"author": "The WordPress Contributors",
|
||||
"license": "GPL-2.0-or-later",
|
||||
"main": "build/index.js",
|
||||
"scripts": {
|
||||
"build": "wp-scripts build",
|
||||
"format": "wp-scripts format",
|
||||
"lint:css": "wp-scripts lint-style",
|
||||
"lint:js": "wp-scripts lint-js",
|
||||
"packages-update": "wp-scripts packages-update",
|
||||
"plugin-zip": "wp-scripts plugin-zip",
|
||||
"start": "wp-scripts start"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@wordpress/scripts": "^27.6.0"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
=== Todo List ===
|
||||
Contributors: The WordPress Contributors
|
||||
Tags: block
|
||||
Tested up to: 6.1
|
||||
Stable tag: 0.1.0
|
||||
License: GPL-2.0-or-later
|
||||
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Example block scaffolded with Create Block tool.
|
||||
|
||||
== 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/todo-list` 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.
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 3,
|
||||
"name": "create-block/todo-list",
|
||||
"version": "0.1.0",
|
||||
"title": "Todo List",
|
||||
"category": "widgets",
|
||||
"icon": "smiley",
|
||||
"description": "Example block scaffolded with Create Block tool.",
|
||||
"example": {},
|
||||
"supports": {
|
||||
"html": false
|
||||
},
|
||||
"textdomain": "todo-list",
|
||||
"editorScript": "file:./index.js",
|
||||
"editorStyle": "file:./index.css",
|
||||
"style": "file:./style-index.css",
|
||||
"viewScript": "file:./view.js"
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/**
|
||||
* Retrieves the translation of text.
|
||||
*
|
||||
* @see https://developer.wordpress.org/block-editor/reference-guides/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/reference-guides/packages/packages-block-editor/#useblockprops
|
||||
*/
|
||||
import { useBlockProps } from '@wordpress/block-editor';
|
||||
|
||||
/**
|
||||
* 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/reference-guides/block-api/block-edit-save/#edit
|
||||
*
|
||||
* @return {Element} Element to render.
|
||||
*/
|
||||
export default function Edit() {
|
||||
return (
|
||||
<p { ...useBlockProps() }>
|
||||
{ __( 'Todo List – hello from the editor!', 'todo-list' ) }
|
||||
</p>
|
||||
);
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* The following styles get applied inside the editor only.
|
||||
*
|
||||
* Replace them with your own styles or remove the file completely.
|
||||
*/
|
||||
|
||||
.wp-block-create-block-todo-list {
|
||||
border: 1px dotted #f00;
|
||||
}
|
|
@ -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 './style.scss';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import Edit from './edit';
|
||||
import save from './save';
|
||||
import metadata from './block.json';
|
||||
|
||||
/**
|
||||
* Every block starts by registering a new block type definition.
|
||||
*
|
||||
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/
|
||||
*/
|
||||
registerBlockType( metadata.name, {
|
||||
/**
|
||||
* @see ./edit.js
|
||||
*/
|
||||
edit: Edit,
|
||||
|
||||
/**
|
||||
* @see ./save.js
|
||||
*/
|
||||
save,
|
||||
} );
|
|
@ -0,0 +1,24 @@
|
|||
/**
|
||||
* 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/reference-guides/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/reference-guides/block-api/block-edit-save/#save
|
||||
*
|
||||
* @return {Element} Element to render.
|
||||
*/
|
||||
export default function save() {
|
||||
return (
|
||||
<p { ...useBlockProps.save() }>
|
||||
{ 'Todo List – hello from the saved content!' }
|
||||
</p>
|
||||
);
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
.wp-block-create-block-todo-list {
|
||||
background-color: #21759b;
|
||||
color: #fff;
|
||||
padding: 2px;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/**
|
||||
* Use this file for JavaScript code that you want to run in the front-end
|
||||
* on posts/pages that contain this block.
|
||||
*
|
||||
* When this file is defined as the value of the `viewScript` property
|
||||
* in `block.json` it will be enqueued on the front end of the site.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```js
|
||||
* {
|
||||
* "viewScript": "file:./view.js"
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* If you're not making any changes to this file because your project doesn't need any
|
||||
* JavaScript running in the front-end, then you should delete this file and remove
|
||||
* the `viewScript` property from `block.json`.
|
||||
*
|
||||
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#view-script
|
||||
*/
|
||||
|
||||
/* eslint-disable no-console */
|
||||
console.log( 'Hello World! (from create-block-todo-list block)' );
|
||||
/* eslint-enable no-console */
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
/**
|
||||
* Plugin Name: Todo List
|
||||
* Description: Example block scaffolded with Create Block tool.
|
||||
* Requires at least: 6.1
|
||||
* 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: todo-list
|
||||
*
|
||||
* @package CreateBlock
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* 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_todo_list_block_init() {
|
||||
register_block_type( __DIR__ . '/build' );
|
||||
}
|
||||
add_action( 'init', 'create_block_todo_list_block_init' );
|
Loading…
Reference in New Issue