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

Insert content between two blocks #72

Closed
jasmussen opened this issue Feb 15, 2017 · 24 comments
Closed

Insert content between two blocks #72

jasmussen opened this issue Feb 15, 2017 · 24 comments
Assignees
Labels
[Type] Task Issues or PRs that have been broken down into an individual action to take

Comments

@jasmussen
Copy link
Contributor

jasmussen commented Feb 15, 2017

Currently, the UI prototype shows the Plus to insert new blocks below the last paragraph (or the paragraph you're writing in). We should consider moving it to the side when you are on a new line. Here's a quick and dirty animatic:

move-plus

Right after that, start typing and it converts into the type switcher, showing a paragraph block as selected.

This would also tie nicely into the #24, which would then invoke the plus dialog on the left.

This should inform how we can insert content between two blocks. Hover between two blocks to show a blue line and plus on the side:

insert between

Or, make a newline and insert, like you would at the end:

insert between keyboard

@jasmussen jasmussen added the [Type] Question Questions about the design or development of the editor. label Feb 15, 2017
@JohnPixle
Copy link

I like it. I am not sure how this will work in a front-end or customizer editor context, with the theme's styles applied to the layouts. How will this feel in narrow places, columns etc? But I definitely find this better than before.

@jasmussen
Copy link
Contributor Author

I am not sure how this will work in a front-end or customizer editor context, with the theme's styles applied to the layouts. How will this feel in narrow places, columns etc? But I definitely find this better than before.

Some of those answers will likely present themselves if/when we test this out in a prototype.

@jasmussen jasmussen changed the title Consider Plus button on the side Insert content between two blocks Feb 17, 2017
@jasmussen jasmussen added [Type] Task Issues or PRs that have been broken down into an individual action to take and removed [Type] Question Questions about the design or development of the editor. labels Feb 17, 2017
@jasmussen jasmussen mentioned this issue Feb 17, 2017
@timmyc timmyc self-assigned this Feb 22, 2017
@timmyc
Copy link
Contributor

timmyc commented Feb 22, 2017

So I have been playing around with this a bit, specifically showing the blue line and plus on hover. I have taken a few different paths, one was to hard-code some <span />s between each block, which allows me to get the desired design effect, but of course this falls apart due to contenteditable, as these <span/>s are easily deleted.

The other route I have tried so far is to add an :after pseudo element - and exposing the ( + ) on hover of the block above... but this suffers from some of the issues outlined in #58 - where by using the pseudo element displayed on hover, there is no way to actually click on it.

.editor p:after {
	display: block;
	width: 24px;
	height: 24px;
	position: relative;
	top: 24px;
}

.editor p:hover:after {
	height: 0px;
	content: url("data:image/svg+xml; utf8, <svg fill='#008ec2' height='24' width='24' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><g><path d='M12 4c4.41 0 8 3.59 8 8s-3.59 8-8 8-8-3.59-8-8 3.59-8 8-8m0-2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm5 9h-4V7h-2v4H7v2h4v4h2v-4h4v-2z'></path></g></svg>")
}

in-between

Kind of feels like the markup again is creating some of our challenges here and was curious to hear other thoughts.

One other idea is to apply a background color to the section.editor and add a click handler for these in-between block scenarios.

@jasmussen
Copy link
Contributor Author

Sounds difficult.

This particular feature is not super urgent as it's a desktop only & hover only enhancement. So long as linebreak lets you insert between two items, that's good for now, then we can keep noodling on how to best solve this. Not crucial for the UI prototype.

@mapk
Copy link
Contributor

mapk commented Mar 1, 2017

DIVI handles this quite well. The insertion button is a part of the block (centered at bottom).

insert-block-divi

@ellatrix
Copy link
Member

ellatrix commented Mar 1, 2017

I love this ^ :)

@timmyc
Copy link
Contributor

timmyc commented Mar 1, 2017

That would be much easier to implement as well.

@aduth
Copy link
Member

aduth commented Mar 1, 2017

For many blocks*, I imagine it would be difficult on mobile to position the cursor such that a new linebreak could be added, which might be further evidence in favor of showing an "insert after" button to the currently focused block.

* Particularly rich content like a gallery or tweet, which can already be a bit awkward to position in the current editor.

@jasmussen
Copy link
Contributor Author

CC: @shaunandrews because I'm pretty sure I saw something Divi-esque from him yesterday in Slack, that kind of elegantly solved this.

@shaunandrews
Copy link
Contributor

Here's what I've been playing with:

adding between blocks

@jasmussen
Copy link
Contributor Author

Really, really dig this stuff, Shaun. Thanks so much for doing this.

The "Insert in between" thing feels solid. The behavior of the type switcher feels too, though it feels like that bit needs a little more polish. Same for the inserter, which should be able to contain a virtually endless amount of blocks, 50+, so will probably need a search box.

It does feel solid, though, that the type switcher sits next to the block and inline level controls, though! This seems worth trying next, along with the "insert between" behavior.

@jasmussen
Copy link
Contributor Author

The animatic really sells it @shaunandrews. But does it become a fiddly UI if you have to modify inline text close to or around the area where the button sits?

formatting click

If yes, do you feel we can expand the block boundaries for a block, without changing the spacing of paragraphs? If we were to allow the block boundaries to overlap, we could get another 3px of space between the text and the block boundaries.

@ellatrix
Copy link
Member

ellatrix commented Mar 6, 2017

I've added this to https://wordpress.github.io/gutenberg/tinymce-single/ to try it out.
It's on the some line with the arrows though, stuffing it between the the two blocks felt a bit strange. Happy to adjust to try in between the line though.

@jasmussen
Copy link
Contributor Author

Works well, thanks for doing that. I think it's worth trying it on the border, though, as it seems to suggest where the new content will appear.

In general probably best to adhere to the mockups for the prototypes. Then we can all try it and if we all agree it feels weird then we can mock up alternatives.

The thing that primarily felt weird to me is that is that it's close to the edge, and if you want to select text down there you might invoke the plus. But it's worth testing, seeing if it's actually an issue and not just one that's perceived from the mockups.

@ellatrix
Copy link
Member

ellatrix commented Mar 7, 2017

In general probably best to adhere to the mockups for the prototypes. Then we can all try it and if we all agree it feels weird then we can mock up alternatives.

You can see it as a mock up too :) I'll move it on the border.

@jasmussen
Copy link
Contributor Author

You can see it as a mock up too :) I'll move it on the border.

mindblown.gif :)

Certainly, but the purpose of the prototypes is to compare the underlying tech across the prototypes, not competing UI.

Competing UI is best mocked up as separate things and discussed in GitHub issues, like what Shaun did here. Such mockups can be gifs, pngs, html mockups, even one off prototypes or codepens for sure.

ellatrix added a commit that referenced this issue Mar 7, 2017
@ellatrix
Copy link
Member

ellatrix commented Mar 7, 2017

Adjusted so we can try in single mce. Note that I still have to add the insert menu there. Will do so tomorrow.

@jasmussen
Copy link
Contributor Author

jasmussen commented Mar 15, 2017

Having used the prototypes for a bit now, I can't help but feel like inserting between two blocks becomes less of an issue when you can insert a linebreak to get access to the inserter.

What does everyone else think?

Edit: Here are mockups for how it could work.

No inserter visible when you are interacting with a block:

text

Inserter shows up on a newline, where the up/down arrows would have been:

newlines

If we combine it with an "insert" button that permanently sits somewhere else, and an editing system where making linebreaks is as easy as pie, this is arguably fine for inserting content between two. It's keyboard friendly, and it's the same UI for mobile.

Try the LinkedIn editor, it works somewhat this way: https://www.linkedin.com/post/edit/

@ellatrix
Copy link
Member

Isn't that what we had before? The issue was that it can be harder to discover. It also may not be evident to create a line break between non text blocks.

@ellatrix
Copy link
Member

In the single prototype the non text issues is partly solved because you can move the cursor to the side (select block, then arrow left/right). Can also make it so the cursor get the right position when clicking next to it.

@aduth
Copy link
Member

aduth commented Mar 16, 2017

What does everyone else think?

Should also consider:

  • What's shown when starting a new post? Does the user first have to focus the editor to see an inserter, which assumes that the user will know to click on the blank screen?
  • Is it always easy to create a newline between blocks? I think we should strive for this, but for example it may be difficult to position the text caret such that I can insert a new line between two embed blocks. (Sorry, I think I'm repeating what @iseulde already outlined in previous comments)

@jasmussen
Copy link
Contributor Author

What's shown when starting a new post? Does the user first have to focus the editor to see an inserter, which assumes that the user will know to click on the blank screen?

I'm increasingly leaning towards us having, in addition to the plus or / invoked inserter, having a permanent button somewhere in the admin, not yet mocked up.

Though if we had that, we'd have parity on this experience compared to the current editor.

nylen pushed a commit that referenced this issue Mar 16, 2017
@ellatrix
Copy link
Member

Undo and redo buttons are also ones that might have to be permanent somewhere, so it wouldn't be the only one.

@jasmussen
Copy link
Contributor Author

Closing in favor of #323.

hypest pushed a commit that referenced this issue Nov 2, 2018
…ing-babel-runtime

Solves a problem with the resolution of @babel/runtime
ntwb added a commit that referenced this issue May 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Task Issues or PRs that have been broken down into an individual action to take
Projects
None yet
Development

No branches or pull requests

8 participants