Skip to content

Commit

Permalink
Merge pull request #61 from infinum/release/1.4.4
Browse files Browse the repository at this point in the history
1.4.4
  • Loading branch information
goranalkovic-infinum authored Nov 6, 2024
2 parents de1eeb7 + 4a9cdc1 commit f5487f2
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 49 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,25 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a

---

## [1.4.4]

### Added

- Support for `supports` key in block manifests during block registration.

### Changed

- Built-in Paragraph block now uses the new block splitting logic from WP 6.6
- Updated dependencies

## [1.4.3]

### Fixed

- Fixing Yoast SEO plugin helpers.
- Manifests in some default blocks not using `base` as a `part`.
- Image sizing in the default Image block when set to stretch.
- Class for gradient *top* direction in wrapper.

## [1.4.2]

Expand Down Expand Up @@ -128,6 +142,7 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a
- Initial release.

[Unreleased]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/master...HEAD
[1.4.4]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.4.3...1.4.4
[1.4.3]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.4.2...1.4.3
[1.4.2]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.4.1...1.4.2
[1.4.1]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.4.0...1.4.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export const ParagraphEditor = (attributes) => {
placeholder = __('Add content', '%g_textdomain%'),
additionalClass,

onSplit,
mergeBlocks,
onReplace,
onRemove,
Expand All @@ -30,7 +29,6 @@ export const ParagraphEditor = (attributes) => {
value={paragraphContent}
onChange={(value) => setAttributes({ [getAttrKey('paragraphContent', attributes, manifest)]: value })}
allowedFormats={['core/bold', 'core/link', 'core/italic']}
onSplit={onSplit}
onMerge={mergeBlocks}
onReplace={onReplace}
onRemove={onRemove}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,13 @@
import React, { useMemo } from 'react';
import { createBlock } from '@wordpress/blocks';
import React from 'react';
import { tailwindClasses, props } from '@eightshift/frontend-libs-tailwind/scripts';
import { ParagraphEditor as EditorComponent } from '../../../components/paragraph/components/paragraph-editor';
import manifest from './../manifest.json';
import globalManifest from './../../../manifest.json';

export const ParagraphEditor = (keyProps) => {
const { attributes, setAttributes, onReplace, mergeBlocks } = keyProps;

const propsObject = props('paragraph', attributes);

/**
* Block-splitting logic. If content is available, creates
* a new block with the attributes of the original.
*
* @param {*} value Content value.
*/
const splitBlocks = (value) => {
if (!value) {
return createBlock(`${globalManifest.namespace}/${manifest.blockName}`);
}

return createBlock(`${globalManifest.namespace}/${manifest.blockName}`, {
...attributes,
[`${propsObject.prefix}Content`]: value,
});
};

export const ParagraphEditor = ({ attributes, setAttributes, onReplace, mergeBlocks }) => {
return (
<EditorComponent
{...propsObject}
{...props('paragraph', attributes)}
setAttributes={setAttributes}
onSplit={splitBlocks}
mergeBlocks={mergeBlocks}
onReplace={onReplace}
onRemove={onReplace ? () => onReplace([]) : undefined}
Expand Down
3 changes: 3 additions & 0 deletions blocks/init/src/Blocks/custom/paragraph/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,8 @@
}
}
}
},
"supports": {
"splitting": true
}
}
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eightshift/frontend-libs-tailwind",
"version": "1.4.3",
"version": "1.4.4",
"description": "A framework for creating modern Gutenberg themes with styling provided by Tailwind CSS.",
"author": {
"name": "Eightshift team",
Expand Down Expand Up @@ -34,47 +34,47 @@
"homepage": "https://github.com/infinum/eightshift-frontend-libs-tailwind#readme",
"license": "MIT",
"dependencies": {
"@eightshift/ui-components": "^1.6.1",
"@stylistic/eslint-plugin-js": "^2.8.0",
"@stylistic/stylelint-plugin": "^3.1.0",
"@swc/core": "^1.7.26",
"@wordpress/api-fetch": "^7.8.0",
"@wordpress/block-editor": "^14.3.0",
"@eightshift/ui-components": "^1.7.0",
"@stylistic/eslint-plugin-js": "^2.10.1",
"@stylistic/stylelint-plugin": "^3.1.1",
"@swc/core": "^1.8.0",
"@wordpress/api-fetch": "^7.11.0",
"@wordpress/block-editor": "^14.6.0",
"@wordpress/dependency-extraction-webpack-plugin": "^5.9.0",
"@wordpress/dom-ready": "^4.8.0",
"@wordpress/server-side-render": "^5.8.0",
"browserslist": "^4.24.0",
"@wordpress/dom-ready": "^4.11.0",
"@wordpress/server-side-render": "^5.11.0",
"browserslist": "^4.24.2",
"css-loader": "^7.1.2",
"css-minimizer-webpack-plugin": "^7.0.0",
"eslint": "^9.11.1",
"eslint": "^9.14.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"globals": "^15.9.0",
"globals": "^15.12.0",
"husky": "^9.1.6",
"lightningcss": "^1.27.0",
"mini-css-extract-plugin": "^2.9.1",
"lightningcss": "^1.28.1",
"mini-css-extract-plugin": "^2.9.2",
"postcss": "^8.4.47",
"postcss-loader": "^8.1.1",
"prettier": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.8",
"sonner": "^1.5.0",
"stylelint": "^16.9.0",
"sonner": "^1.7.0",
"stylelint": "^16.10.0",
"stylelint-config-standard": "^36.0.1",
"swc-loader": "^0.2.6",
"terser-webpack-plugin": "^5.3.10",
"webpack": "^5.95.0",
"webpack": "^5.96.1",
"webpack-cli": "^5.1.4",
"webpack-manifest-plugin": "^5.0.0",
"webpack-merge": "^6.0.1"
},
"devDependencies": {
"embla-carousel": "^8.3.0",
"embla-carousel": "^8.3.1",
"fluid-tailwind": "^1.0.3",
"lint-staged": "^15.2.10",
"micromodal": "^0.4.10",
"ol": "^10.2.1",
"ol-mapbox-style": "^12.3.5",
"tailwindcss": "^3.4.13",
"tailwindcss": "^3.4.14",
"tailwindcss-animate": "^1.0.7"
},
"sideEffects": false,
Expand Down
8 changes: 7 additions & 1 deletion scripts/editor/registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,11 @@ export const registerBlock = (
...getExample('', blockManifest),
};

// Block supports.
if (typeof blockManifest['supports'] === 'undefined') {
blockManifest['supports'] = {};
}

return {
blockName: fullBlockName,
options: {
Expand Down Expand Up @@ -887,7 +892,8 @@ export const registerBlock = (
return customName;
},
supports: {
__experimentalMetadata: true,
...blockManifest['supports'],
__experimentalMetadata: true, // Required for renaming blocks.
},
},
};
Expand Down

0 comments on commit f5487f2

Please sign in to comment.