ckeditor / ckeditor5

Powerful rich text editor framework with a modular architecture, modern integrations, and features like collaborative editing.
https://ckeditor.com/ckeditor-5
Other
9.36k stars 3.68k forks source link

Improvements to auto-embedding of links #1300

Closed winzig closed 10 months ago

winzig commented 5 years ago

Is this a bug report or feature request? (choose one)

🆕 Feature request

💻 Version of CKEditor

11.1.1 Balloon Editor build

Feature Description

We use iFramely for embed services, and are interested in integrating this with the new embed feature of ckeditor5. Ideally what we would like to do is detect when the user has pasted a URL (which we would want to auto-link), or the user links some text manually, and in that scenario, we would want to automatically insert the iFramely iframe embed (if there is one returned by them).

We would typically insert the embed below the link if the link is on a line by itself, or below the entire paragraph, if the link is part of a paragraph of text. We would only want to insert the embed one time per unique link (if the person is linking to the same thing over and over, just the first instance would auto-embed).

The auto-embed box would need some sort of capability of removing it.

If you're familiar with Slack, this is sort of similar behavior. Someone includes a link in their message, Slack "unfurls" it with a link preview (akin to the iframely embeds), and then the user can turn off the preview (embed) if they don't want it appearing with their message. Most of the time the embed is useful, so it's rare to remove them, and I think the same thing would likely be true for auto-embed in ckeditor.

We would likely also want to specify an ignore list of domains we never want to auto-embed.

Assuming these features are not something that is already available in ckeditor5, what would be the best mechanism for me to build it? I've looked through the plugin documentation, but it's not clear to me yet where I would start, or if this functionality would even be something to put in a separate plugin, versus just listening and acting upon existing ckeditor events?

winzig commented 5 years ago

After working more with the new embed feature, and discovering the existing auto-embed functionality, I'm changing the title of this request and the intent, to offer some feedback on possible improvements (or options) for the auto-embed functionality. (@Reinmar, is there a better place for me to put this request?)

The current auto-embed behavior seems a bit user-unfriendly. It removes the user's original URL and replaces it with the embed, and there's no obvious way for the user to reverse this action. It would be great if this could be tweaked so that the embed frame had an "X" remove button in the upper/right corner. If removed, the link is put back, ideally with some sort of data-attribute indicating the user explicitly requested it not be turned into an embed.

Auto-embed linked text. It would be nice if the auto-embed functionality could be triggered if the user links some text (rather than just when pasting a URL). If the text is in the middle of a paragraph or list, the embed would go directly after the paragraph/list. In that scenario, you obviously would not remove the linked text when the embed is placed, but like the other scenario above, if the user removes the embed with the "X" button, the link should have a data-attribute added to indicate the user does not want it embedded.

If there's no interest in these kinds of changes, I'm interested in finding out the best way for us to tweak the embed functionality, if possible. I've been reading the documentation, but it's still not clear to me how (or whether) there are events we can observe to modify what's happening during the embed process?

Reinmar commented 5 years ago

Hi! First of all, I'm very sorry for a late reply. We somehow missed your ticket.

I agree that the current way how the media embed feature autoembeds links doesn't make for the best UX. In fact, the only way to revert that action is to undo it... but this option may not be available on mobile devices where due to the limited size of the screen the undo/redo buttons are often removed.

Some sort of UI for reverting that action might help. Also, we might consider not embedding things completely automatically, but e.g. displaying some notification next to a pasted link that this can become a media embed if you click "here".

That said, we're not planning to work on improvements for this feature for now. There wasn't much feedback about media embed (that would indicate some problems) and we've got other features that we'd love to bring.

If you'd like to give this a try yourself, then here are a couple of tips:

I hope that this would help.

Reinmar commented 5 years ago

cc @oleq

CKEditorBot commented 11 months ago

There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may be relevant, so if you're interested in the solution, leave a comment or reaction under this issue.

CKEditorBot commented 10 months ago

We've closed your issue due to inactivity over the last year. We understand that the issue may still be relevant. If so, feel free to open a new one (and link this issue to it).