Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a block to manage style and contents of <summary> #91

Merged
merged 11 commits into from
Nov 6, 2024
14 changes: 14 additions & 0 deletions build/show-hide-details/block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://json.schemastore.org/block.json",
"apiVersion": 3,
"name": "happyprime/show-hide-details",
"title": "Show Hide Details",
"textdomain": "show-hide-section-block",
"category": "widgets",
"description": "The remaining content in a details section.",
"icon": "media-document",
"parent": [ "happyprime/show-hide-section" ],
"attributes": {},
"supports": {},
"editorScript": "file:index.js"
}
1 change: 1 addition & 0 deletions build/show-hide-details/index.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-i18n'), 'version' => 'f8e755a9302508f08a71');
1 change: 1 addition & 0 deletions build/show-hide-details/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/show-hide-group/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-i18n'), 'version' => '6d145d837d616cf3ec00');
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-i18n'), 'version' => '70bf254dd1647cf40738');
2 changes: 1 addition & 1 deletion build/show-hide-group/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions build/show-hide-section/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
"isOpen": {
"type": "boolean",
"default": false
},
"summary": {
"type": "string",
"source": "html",
"selector": "summary"
}
},
"supports": {
Expand Down
2 changes: 1 addition & 1 deletion build/show-hide-section/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-i18n'), 'version' => '4b0c5c44be5b8cf85a75');
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-i18n'), 'version' => 'beb08742a35f54543878');
2 changes: 1 addition & 1 deletion build/show-hide-section/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions build/show-hide-summary/block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"$schema": "https://json.schemastore.org/block.json",
"apiVersion": 3,
"name": "happyprime/show-hide-summary",
"title": "Show Hide Summary",
"textdomain": "show-hide-section-block",
"category": "widgets",
"description": "The summary element in a details section.",
"icon": "media-document",
"parent": [ "happyprime/show-hide-section" ],
"attributes": {
"summary": {
"type": "string",
"source": "html",
"selector": "summary"
}
},
"supports": {
"anchor": true,
"align": true,
"alignWide": true,
"color": {
"background": true,
"enableContrastChecker": true,
"text": true,
"link": true,
"gradients": true
},
"defaultStylePicker": true,
"dimensions": {
"minHeight": true
},
"html": false,
"multiple": true,
"position": {
"sticky": false
},
"spacing": {
"margin": true,
"padding": true
},
"typography": {
"fontSize": true,
"lineHeight": true
}
},
"editorScript": "file:index.js"
}
1 change: 1 addition & 0 deletions build/show-hide-summary/index.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-i18n'), 'version' => '10db6c2a73bed31cef63');
1 change: 1 addition & 0 deletions build/show-hide-summary/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

101 changes: 73 additions & 28 deletions languages/show-hide-section-block.pot
Original file line number Diff line number Diff line change
@@ -1,88 +1,133 @@
# Copyright (C) 2023 Happy Prime
# Copyright (C) 2024 Happy Prime
# This file is distributed under the same license as the Show / Hide Section Block plugin.
msgid ""
msgstr ""
"Project-Id-Version: Show / Hide Section Block 2.0.0\n"
"Project-Id-Version: Show / Hide Section Block 2.0.3\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/show-hide-section-block\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2023-03-03T16:41:52+00:00\n"
"POT-Creation-Date: 2024-11-05T22:28:28+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.6.0\n"
"X-Generator: WP-CLI 2.10.0\n"
"X-Domain: show-hide-section-block\n"

#. Plugin Name of the plugin
#: plugin.php
msgid "Show / Hide Section Block"
msgstr ""

#. Plugin URI of the plugin
msgid "https://github.com/happyprime/show-hide-section"
#: plugin.php
msgid "https://wordpress.org/plugins/show-hide-section-block/"
msgstr ""

#. Description of the plugin
#: plugin.php
msgid "Display an accessible show/hide interface with details and summary elements."
msgstr ""

#. Author of the plugin
#: plugin.php
msgid "Happy Prime"
msgstr ""

#. Author URI of the plugin
#: plugin.php
msgid "https://happyprime.co/"
msgstr ""

#: blocks/show-hide-group/index.js:37
#: build/show-hide-group.js:1
msgid "Close all"
msgstr ""

#: blocks/show-hide-group/index.js:47
#: blocks/show-hide-group/index.js:86
#: blocks/show-hide-group/index.js:119
#: build/show-hide-group.js:1
msgid "Open all"
#: build/show-hide-details/index.js:1
#: src/show-hide-details/index.js:12
msgid "Remaining"
msgstr ""

#: blocks/show-hide-group/index.js:57
#: build/show-hide-group.js:1
#: build/show-hide-group/index.js:1
#: src/show-hide-group/index.js:57
msgid "Has open/close all toggle"
msgstr ""

#: blocks/show-hide-group/index.js:63
#: build/show-hide-group.js:1
#: build/show-hide-group/index.js:1
#: src/show-hide-group/index.js:63
msgid "Open/close all toggle will display."
msgstr ""

#: blocks/show-hide-group/index.js:67
#: build/show-hide-group.js:1
#: build/show-hide-group/index.js:1
#: src/show-hide-group/index.js:67
msgid "Open/close all toggle will not display."
msgstr ""

#: blocks/show-hide-section/index.js:37
#: blocks/show-hide-section/index.js:38
#: build/show-hide-section.js:1
#: build/show-hide-group/index.js:1
#: src/show-hide-group/index.js:37
msgid "Close all"
msgstr ""

#: build/show-hide-group/index.js:1
#: src/show-hide-group/index.js:47
#: src/show-hide-group/index.js:86
#: src/show-hide-group/index.js:108
msgid "Open all"
msgstr ""

#: build/show-hide-section/index.js:1
#: build/show-hide-summary/index.js:1
#: src/show-hide-section/index.js:19
#: src/show-hide-summary/index.js:18
#: src/show-hide-summary/index.js:19
msgid "Summary"
msgstr ""

#: blocks/show-hide-group/block.json
#: build/show-hide-section/index.js:1
#: src/show-hide-section/index.js:23
msgid "Details"
msgstr ""

#: build/show-hide-details/block.json
#: src/show-hide-details/block.json
msgctxt "block title"
msgid "Show Hide Details"
msgstr ""

#: build/show-hide-details/block.json
#: src/show-hide-details/block.json
msgctxt "block description"
msgid "The remaining content in a details section."
msgstr ""

#: build/show-hide-group/block.json
#: src/show-hide-group/block.json
msgctxt "block title"
msgid "Show Hide Group"
msgstr ""

#: blocks/show-hide-group/block.json
#: build/show-hide-group/block.json
#: src/show-hide-group/block.json
msgctxt "block description"
msgid "A group of accessible summaries that can be toggled to show or hide additional details."
msgstr ""

#: blocks/show-hide-section/block.json
#: build/show-hide-section/block.json
#: src/show-hide-section/block.json
msgctxt "block title"
msgid "Show Hide Section"
msgstr ""

#: blocks/show-hide-section/block.json
#: build/show-hide-section/block.json
#: src/show-hide-section/block.json
msgctxt "block description"
msgid "A section of collapsible content contained in a details element with a summary."
msgstr ""

#: build/show-hide-summary/block.json
#: src/show-hide-summary/block.json
msgctxt "block title"
msgid "Show Hide Summary"
msgstr ""

#: build/show-hide-summary/block.json
#: src/show-hide-summary/block.json
msgctxt "block description"
msgid "The summary element in a details section."
msgstr ""
2 changes: 2 additions & 0 deletions plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,7 @@
define( 'HP_SHS_PLUGIN_DIR', __DIR__ );
define( 'HP_SHS_PLUGIN_FILE', __FILE__ );

require_once __DIR__ . '/src/show-hide-details/index.php';
require_once __DIR__ . '/src/show-hide-group/index.php';
require_once __DIR__ . '/src/show-hide-section/index.php';
require_once __DIR__ . '/src/show-hide-summary/index.php';
14 changes: 14 additions & 0 deletions src/show-hide-details/block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://json.schemastore.org/block.json",
"apiVersion": 3,
"name": "happyprime/show-hide-details",
"title": "Show Hide Details",
"textdomain": "show-hide-section-block",
"category": "widgets",
"description": "The remaining content in a details section.",
"icon": "media-document",
"parent": [ "happyprime/show-hide-section" ],
"attributes": {},
"supports": {},
"editorScript": "file:index.js"
}
31 changes: 31 additions & 0 deletions src/show-hide-details/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { registerBlockType } from '@wordpress/blocks';
import { InnerBlocks } from '@wordpress/block-editor';
import { __ } from '@wordpress/i18n';

// Internal dependencies.
import metadata from './block.json';

const Edit = () => {
const TEMPLATE = [
[
'core/paragraph',
{ placeholder: __('Remaining', 'show-hide-section-block') },
],
];

return (
<>
<InnerBlocks template={TEMPLATE} templateLock={false} />
</>
);
};

const Save = () => {
return <InnerBlocks.Content />;
};

// Register the block.
registerBlockType(metadata, {
edit: Edit,
save: Save,
});
Loading