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

Blocks inside a InnerBlocks container with "insert" templateLock can be dragged outside of the container #11131

Closed
garciaalvaro opened this issue Oct 26, 2018 · 3 comments
Labels
[Feature] Drag and Drop Drag and drop functionality when working with blocks [Feature] Nested / Inner Blocks Anything related to the experience of nested/inner blocks inside a larger container, like Group or P [Feature] Templates API Related to API powering block template functionality in the Site Editor Needs Testing Needs further testing to be confirmed.

Comments

@garciaalvaro
Copy link

Describe the bug
The documentation states:

insert — prevents inserting or removing blocks, but allows moving existing ones.

I might be reading this wrong but I interpreted the lock permits moving the inner blocks within the container but not to/from the outside. So there will always be the blocks set in the template, but they can be reordered.
Currently it is possible to drag inner blocks to the outside (to a different container or the root). If my interpretation is correct this should not be allowed. However, it is not possible to drag a block from the outside to the inside.

Versions

  • Gutenberg 4.1.1
  • WordPress 4.9.8
@designsimply designsimply added [Feature] Templates API Related to API powering block template functionality in the Site Editor [Feature] Nested / Inner Blocks Anything related to the experience of nested/inner blocks inside a larger container, like Group or P [Feature] Drag and Drop Drag and drop functionality when working with blocks [Type] Question Questions about the design or development of the editor. labels Oct 26, 2018
@designsimply
Copy link
Member

May we have some basic steps for testing this? I would like to try to check it out but am not very experienced with coding Gutenberg so a code example would be really awesome. If you don't have one, that's okay and we can wait to see if we can get a response about what the intended behavior is with regard to locked blocks in a template and whether or not it should be possible to drag them out without seeing a code example.

@designsimply designsimply added the [Status] Needs More Info Follow-up required in order to be actionable. label Oct 26, 2018
@garciaalvaro
Copy link
Author

garciaalvaro commented Oct 26, 2018

Sure, no problem. For example, insert this test block in the page:

registerBlockType("qqq/qqq", {
	title: "qqq",
	icon: "carrot",
	category: "common",
	attributes: {},
	edit(props) {
		return (
			<div>
				<InnerBlocks
					template={[
						["core/quote"],
						["core/image"],
						["core/quote"]
					]}
					allowedBlocks={[
						"core/quote",
						"core/image",
					]}
					templateLock="insert"
				/>
			</div>
		);
	},
	save(props) {
		return null;
	}
});

Add the block inside the page (a quote, an image and a quote will be included inside).
Start dragging any of the three: this is expected as "insert" allows reordering the inner blocks.
Drop the block outside of the container into the root: this is where the problem happens, the drop should only be allowed before/after the sibling blocks, always inside the container block, as far as I understood.

I hope it is clear. Thanks.

@mtias mtias removed [Status] Needs More Info Follow-up required in order to be actionable. [Type] Question Questions about the design or development of the editor. labels Nov 21, 2018
@designsimply designsimply added the Needs Testing Needs further testing to be confirmed. label Feb 8, 2019
@momotofu
Copy link
Contributor

This seems to no longer be an issue, since we were unable to reproduce the bug. Blocks weren't able to be dragged out of the container when having templateLock set to "insert".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Drag and Drop Drag and drop functionality when working with blocks [Feature] Nested / Inner Blocks Anything related to the experience of nested/inner blocks inside a larger container, like Group or P [Feature] Templates API Related to API powering block template functionality in the Site Editor Needs Testing Needs further testing to be confirmed.
Projects
None yet
Development

No branches or pull requests

4 participants