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 indent/outdentBlocks commands #2331

Closed
ianstormtaylor opened this issue Oct 26, 2018 · 3 comments
Closed

add indent/outdentBlocks commands #2331

ianstormtaylor opened this issue Oct 26, 2018 · 3 comments
Labels

Comments

@ianstormtaylor
Copy link
Owner

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

Feature.

What's the expected behavior?

There are lots of use cases that make use of "indenting" and "outdenting". The native beforeinput events even tap into them too. I think it would be good to standardize change.indentBlocks and change.outdentBlocks, so that other plugins can build on them. For example, a quote behavior plugin could listen for 'indentBlocks' and do quote-specific behaviors.

By default, I think it should look for the top-level blocks and double nest them. Such that this:

<quote>
  <paragraph>
    <anchor />one
  </paragraph>
  <paragraph>
    two<focus />
  </paragraph>
</quote>

Would turn into:

<quote>
  <quote>
    <paragraph>
      <anchor />one
    </paragraph>
    <paragraph>
      two<focus />
    </paragraph>
  </quote>
</quote>
@Dundercover
Copy link
Contributor

I think there are quite a few different approaches people take to denote indentation. Those I've guessed are the most used:

  • Double nest single block. Like you described above. Could also be leaf block.
  • Double nest multiple blocks. Like with html ul/ol + li.
  • Additional data on block node. Like { indent: 2 } or something.

Default behaviour of this command wouldn't be able to handle all of these but support for them would be nice somehow.

Maybe we could make a plugin which you could configure for your use case? (If it doesn't already exist such plugin?)

@ianstormtaylor
Copy link
Owner Author

Nice, thanks @Dundercover! I think the ul/ol/li case is too complex to try to handle in core well, at least from my experience. Maybe there's a different way of thinking about that one that my brain's not finding though. And for the data on blocks, that one seems easy enough for people to override.

I think it's a good question though to ask whether the default behavior should exist at all, or whether it should be be standardizing the "indent/outdent" command intent names for people to use in all cases.

@ianstormtaylor ianstormtaylor mentioned this issue Nov 6, 2019
@ianstormtaylor
Copy link
Owner Author

As of #3093 (which was just merged), I believe this issue is no longer applicable, because a lot has changed. I'm going through and closing out any potential issues that are not out of date with the overhaul. Thanks for understanding.

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

No branches or pull requests

2 participants