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

Allow to insert before first node if it is an isolated node. #1200

Open
obuchtala opened this issue May 18, 2018 · 11 comments
Open

Allow to insert before first node if it is an isolated node. #1200

obuchtala opened this issue May 18, 2018 · 11 comments

Comments

@obuchtala
Copy link
Member

At the moment, it is impossible to get before the first node and to insert a node there.

@obuchtala obuchtala changed the title Allow to insert before if first node is an isolated node. Allow to insert before first node if it is an isolated node. May 18, 2018
@michael
Copy link
Member

michael commented May 18, 2018

I think the most natural solution would be to add a fake-text element (e.g. paragraph) before the IN (sth that exists only in the view not in the model). Then the user can navigate there with the cursor. Once they start typing we actually create the paragraph in the model.

Not sure how the inverse should look like, when the user wants to get rid of that text before the IN again. Probably it's ok to leave the paragraph there until removed with cmd+backspace. We could also react once this first paragraph becomes empty and delete it from the model (and again leave it in the view).

@obuchtala
Copy link
Member Author

This is unfortunately very inconsistent with respect to the selection, which is visible to the model.
So, I would say not down this route.

@obuchtala
Copy link
Member Author

We already have a flag on NodeSelection: 'before'
So the model could already deal with this.
Only visually we have no means to show this to the user.

@michael
Copy link
Member

michael commented May 18, 2018

And if we just prevent that from ever happening. I mean if we disable insertion of isolated nodes as first element in a container?

@michael
Copy link
Member

michael commented May 18, 2018

I didn't like the custom cursor style we had before... somewhat unnatural. But if we managed to do it with a native blinking cursor I think it would be fine.

@obuchtala
Copy link
Member Author

There are a bunch of ways how to run into this situation. Particularly if it comes to collab at some time.
No, we need to deal with it on a UI level

@obuchtala
Copy link
Member Author

I am not saying that we bring that cursor in general. Just for this case.
Native cursor not possible, only for <img>

@obuchtala
Copy link
Member Author

obuchtala commented May 18, 2018

You could go even further and render some more complex element in the top of the IN when sel.type is 'node' and sel.mode is 'before'

@michael
Copy link
Member

michael commented May 18, 2018

Understand.

Mhh.. native cursor also not possible if we would be ok that it's rendered at a lower height (like a text cursor) at the top-left of the IN?

@obuchtala
Copy link
Member Author

I see two alternatives (assuming that we have the mentioned special node selection) :

  • either a 'blinking line' (like you suggested)
  • or a bold div in the top of the IN that tells the user to ENTER or click to create a new paragraph

Then the question how to 'activate' this type of selection: maybe the user could press UP on the first IN. (but then there would be no other clue before)
Alternatively we 'interpret' node selections on the first node as 'node::before' and then do one of the two visuals.

@obuchtala
Copy link
Member Author

A totally different approach: allow for 'shifting' nodes via keyboard shortcut and drag.

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

No branches or pull requests

2 participants