gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

TinyMCE Core v4.6: add inline boundaries for links and code

Open mtias opened this issue 9 years ago • 19 comments

Behaviour: moving cursor from the left towards a link should have two spaces, one where it goes to the edge of the link, and another where it goes inside the link but to the left of the first character within the link.

Example: https://cloudup.com/c49BKKIE7SW

mtias avatar Feb 17 '17 16:02 mtias

Thanks Matias, we're taking a look at this.

androb avatar Feb 17 '17 17:02 androb

I've started working on this issue. I expect it to be finished before the end of this week.

spocke avatar Feb 21 '17 20:02 spocke

The video above has padding to the left and right of the hyperlink and Quip does not.

Do we believe that there should be padding?

androb avatar Mar 01 '17 01:03 androb

Quip is better visually, this was mostly to illustrate how it works.

mtias avatar Mar 01 '17 12:03 mtias

The video above has padding to the left and right of the hyperlink and Quip does not. Do we believe that there should be padding?

The video above is from the UI prototype, where we built the feature for vanilla contentEditable.

Quip works great, in that in the stop immediately before the caret enters the link tag, the link looks like it usually does. Moving the caret one more stop to the right highlights the link with a boundary, implying you're now "inside the link tag".

Since we're essentially adding an arrow-key stop where none intuitively should exist, we need either the Quip-style highlight effect to visually imply what's happening, or extra padding on the side. I'm partial to the highlighting.

jasmussen avatar Mar 01 '17 13:03 jasmussen

I have now merged the first version of the link/code boundary feature a demo can be found here: http://fiddle.tinymce.com/RKfaab

We will continue to work on this next week to fix a few more issues with it but so far the approach we took seem to be working pretty good.

spocke avatar Mar 03 '17 14:03 spocke

I have now merged the first version of the link/code boundary feature a demo can be found here: http://fiddle.tinymce.com/RKfaab

Feels great! Looks good too! Nice work.

jasmussen avatar Mar 03 '17 14:03 jasmussen

Agreed - Nice job 👍 Question: should pressing space at the end of the link exit out of the link insertion mode? Right now, the only way to get out of the "inside link" mode is to press the right arrow key. Should ESC also exit out of the "inside link" mode?

anna-harrison avatar Mar 03 '17 19:03 anna-harrison

Question: should pressing space at the end of the link exit out of the link insertion mode? Right now, the only way to get out of the "inside link" mode is to press the right arrow key. Should ESC also exit out of the "inside link" mode?

To me it seems as though pressing space within the link boundaries should not escape out of the linked text, since otherwise it would be difficult to add additional words to an existing link. Escape could be more reasonable, though what would happen when pressing escape while in the middle of linked text, not at the end?

aduth avatar Mar 03 '17 20:03 aduth

Question: should pressing space at the end of the link exit out of the link insertion mode? Right now, the only way to get out of the "inside link" mode is to press the right arrow key. Should ESC also exit out of the "inside link" mode?

The benefit of the tweak to how links behave, with an extra arrow key stop before and after, is that it becomes clear to the user when you are extending the link, and when you are not. If space exits you out of this, it seems like you can't write anything but single words with no spaces in them, as you are typing inside a link.

Esc is a fine keyboard shortcut to keep in mind for escaping out of modes. But I'm not sure the link boundary feature counts as a "mode" — the caret would have to move out of the link as you press escape, which seems disruptive.

jasmussen avatar Mar 06 '17 08:03 jasmussen

Feature is working great — we discovered over the weekend that it doesn't work on an iPad with a connected keyboard. Is it technically possible for us to make it work here? I do realize that WebKit is the new IE and this may be difficult.

CC: @spocke

jasmussen avatar Mar 06 '17 08:03 jasmussen

I can investigate that but it might be that the iOS selection model doesn't support us mutating it once the keyboard is enabled.

spocke avatar Mar 07 '17 10:03 spocke

I can investigate that but it might be that the iOS selection model doesn't support us mutating it once the keyboard is enabled.

Would love to see if this was possible. I'm getting signals that Quip might have solved this, but alas I can't test since I don't have a bluetooth keyboard.

jasmussen avatar Mar 07 '17 10:03 jasmussen

Yeah we need to get a BT keyboard as well, and a more recent Android device. But our Brisbane team is well setup to test mobile once we get to building more on the mobile side of things.

Afraithe avatar Mar 07 '17 11:03 Afraithe

I quickly tested trying to position the cursor before the "p" but within the link by tap-and-dragging and that didn't work either, so perhaps it's just a general mobile safari issue?

mtias avatar Mar 07 '17 12:03 mtias

Added a related issue #207 to this one since the first deliverable is done and out there. I added the iOS testing to that one. I leave this one open as some form of master bug for this feature.

spocke avatar Mar 08 '17 12:03 spocke

Looked into the bluetooth keyboard issue. I think it's impossible to solve since iOS isn't firing any events on the arrow keys tested keydown,keypress,keyup a bug report has been reported and is in Apples internal radar issue tracker: https://bugs.webkit.org/show_bug.cgi?id=149054 might also be solved if they ever support beforeinput event on iOS.

spocke avatar Mar 21 '17 13:03 spocke

@spocke I think we can close this one and just open individual issues for other improvements.

mtias avatar Mar 23 '17 12:03 mtias

Closing in favor of the other tasks.

jasmussen avatar Apr 20 '17 08:04 jasmussen