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

Clone function not compatible with MatrixMate tabs #18

Closed
Joorren opened this issue May 28, 2021 · 1 comment
Closed

Clone function not compatible with MatrixMate tabs #18

Joorren opened this issue May 28, 2021 · 1 comment

Comments

@Joorren
Copy link

Joorren commented May 28, 2021

Description
When you clone an existing matrix block, the matrix block gets cloned, but the fields inside the newly created matrix block won't get divided into their associated tabs (MatrixMate feature). This makes the matrix block messy and cluttered, and that's why we installed the MatrixMate plugin.

Screen.Recording.2021-05-28.at.15.31.50.mov

According to the MatrixMate developer, the problem most likely happens because Smith doesn't emit the same events as the native create function.

I think this is something that should be fixed in Smith, not in MatrixMate.

Most likely, the Smith plugin just needs to make sure that when it clones a block, the Matrix field's Craft.MatrixInput instance emits the same JavaScript event(s) that are emitted when blocks are added natively – specifically, the blockAdded event, which MatrixMate listens to in order to instantiate new blocks.

Steps to reproduce

  1. Create a matrix block and save it
  2. Duplicate the matrix block with Smith

Additional info

  • Plugin version: 1.1.13
  • Craft version: 3.6.15
  • Multi-site: Yes
  • MatrixMate Version: 1.2.7

Additional context
The bug report on the MatrixMate repository: vaersaagod/matrixmate#32

@engram-design
Copy link
Member

Hmmm, so Smith actually calls matrixField.addBlock()

https://github.com/craftcms/cms/blob/d754d673f2ee8dd2b914f3d1cb4db462fd0da0e3/src/web/assets/matrix/src/MatrixInput.js#L200

Which itself contains the call to the blockAdded event.

https://github.com/craftcms/cms/blob/d754d673f2ee8dd2b914f3d1cb4db462fd0da0e3/src/web/assets/matrix/src/MatrixInput.js#L276-L278

But looks like this was actually due to an underlying issue with rendering blocks, that hadn't been updated properly with Craft 3.5+ field layout changes.

Should be fixed in 1.1.14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants