Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Blocks should have a way of expressing that mergeBlock or splitBlock cannot occur between its children and an outside block

See original GitHub issue

Do you want to request a feature or report a bug?


What’s the current behavior?

Several bug reports have been popping up that effectively have a root cause of mergeNode being applied to nodes that should not be mergable. In almost every report, it in some way involves the contents of a Table Cell being merged with some other block the reporter does not expect

What’s the expected behavior?

The reports tend to recommend not merging the blocks in these situations, but often merging blocks is the correct behavior and the merging of a table cell is a corner case.

It is tempting to say that “we should not merge blocks if they have two different parents” but one case where that falls apart is lists. It is desirable behavior that we can merge a block following a list item to that list item with delete.

The reason the Table Cell is expected to not merge is that a Table is seen as some isolated container that should have an impermeable barrier with other content in the document that is not within the table. IE, when we paste a table, the first block of the table should not be merged with the block preceding the paste region.

Tables and their contents are not the only block where this is a desirable. For instance, some editors (like Confluence) have a Title block where one cannot split the block, or merge blocks with it via delete or paste. The content of the Title Block is effectively within that title block and cant cross that boundary.

Given that there are a couple of cases where we do not want merge or split to cross some arbitrary block barrier, it would be nice if there was a way to express to slate that a block is a boundary where merge with external blocks cannot occur. This would solve a lot of corner cases with pasting, drag and drop, and delete range, and it would allow for blocks where the contents are more “securely” contained.

Something that comes to mind is maybe a boolean flag like isVoid except the flag is checked before mergeNode changes are applied.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:5
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

camerackercommented, Apr 30, 2018

Hey guys wanted to give an update. I’ve not had much time to dive into this, but I did get as far as to identify a bunch of use cases for this behavior, write the corresponding tests, and then get an isAtomic property defined on the schema for a given block type. The isAtomic name is being used also for decorations to define a similar concept, so we’re in a good position where we are using consistent terminology.

It’s still pretty far from working. Hopefully I’ll have time this month!

camerackercommented, Mar 30, 2018

There are certain block types like paragraph and quote, or list item and paragraph that contextually make sense to merge together. Most editors (that I’ve seen) have this merging behavior.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Block Options - Qualtrics
About Block Options. Blocks are sets of questions within your survey. Typically, questions are separated into blocks for the purpose of conditionally ...
Read more >
llvm/SimpleLoopUnswitch.cpp at master - GitHub
nodes into the unswitched basic block to select between the value in the ... "Must have different loop exit and unswitched blocks!");.
Read more >
lib/Transforms/Utils/DialectConversion.cpp Source File - MLIR
575 /// A collection of blocks that have had their arguments converted. This is a. 576 /// map from the new replacement block,...
Read more >
Blocks - Taekwondo - Google Sites
You should perform these blocks with speed & power because they can "hurt" an opponent (as you counter their attack) and make them...
Read more >
Using Blocks to Develop 21st Century Skills | NAEYC
Many early childhood educators are struggling to create a balance between ... Young children need to come back to their block structures and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found