Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Conversation

@michaelgmcd
Copy link

The last PR went so well, I thought I'd keep going 👍
I found it odd when using this plugin that pressing enter at any time when within a header or blockquote block adds a new line and jumps to it. This PR ensures that the user is at the end of the line before that happens.

Before
## He[CURSOR]ader
pressing enter becomes...
## Header
[CURSOR]

> Blockquo[CURSOR]te
pressing enter becomes...
> Blockquote
[CURSOR]

After
## He[CURSOR]ader
pressing enter becomes...
## He
## [CURSOR]ader

> Blockquo[CURSOR]te
pressing enter becomes...
> Blockquo
> [CURSOR]te

I personally think this is a more intuitive behavior.

I based my knowledge of testing if we're at the end of the line from:

Copy link

@mxstbr mxstbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes a lot of sense to me from a behavioral perspective. Thanks so much for contributing!!

/cc @juliankrispel does this code seem right to you?

@juliankrispel
Copy link

Hey thanks for another PR 👌

We intentionally reset styles after splitting a block like header or blockquote because they are generally meant for one line only. I’d say that’s pretty typical behaviour. In fact we recently merged a pr that made sure that block styles are reset except for some that are clearly meant for multiple lines. So to be frank I don’t think this pr is in line with spectrum’s reading experience and therefore I’d say let’s not merge it.

I appreciate the effort though thank u so much. @mxstbr thoughts?

@mxstbr
Copy link

mxstbr commented Apr 9, 2018

Yeah true, good point @juliankrispel—the current behavior is still a bit broken though, it should really be

He[CURSOR]ader

pressing enter becomes...

He

[CURSOR]ader

So it should split the text, but not preserve the block type, right? That'd be the most expected imo

@juliankrispel
Copy link

oh yes that's true - sry I overlooked that thanks for double checking @mxstbr.

Yes - that's great. Ok now the only thing we need is resetting the new block. I'll push a change momentarily - most of it is already in place - 👍

@juliankrispel juliankrispel merged commit fcd392f into withspectrum:master Apr 10, 2018
@juliankrispel
Copy link

juliankrispel commented Apr 10, 2018

@mxstbr @michaelgmcd merged and follow-up pr here -> #50

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants