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

Support converting pasted markdown content / Paste Markdown feedback. #2321

Open
mlewand opened this issue Sep 26, 2019 · 18 comments · Fixed by #15393
Open

Support converting pasted markdown content / Paste Markdown feedback. #2321

mlewand opened this issue Sep 26, 2019 · 18 comments · Fixed by #15393
Labels
domain:ui/ux This issue reports a problem related to UI or UX. package:markdown-gfm support:2 An issue reported by a commercially licensed client. type:feature This issue reports a feature request (an idea for a new functionality or a missing option).

Comments

@mlewand
Copy link
Contributor

mlewand commented Sep 26, 2019

[UPDATE] We have implemented the Paste Markdown feature, which is currently in the experimental phase. Please be aware that bugs may occur, and it is not recommended for use in production environments.

We keep this issue open to gather the feedback for the potential production release of this feature.


If you'd like to see this feature implemented, add 👍 to this post.

@mlewand mlewand transferred this issue from ckeditor/ckeditor5-markdown-gfm Oct 8, 2019
@mlewand mlewand added status:confirmed type:feature This issue reports a feature request (an idea for a new functionality or a missing option). package:markdown-gfm labels Oct 8, 2019
@mlewand mlewand added this to the unknown milestone Oct 8, 2019
@bhayward93
Copy link

Hey, do you have any idea when this feature may be released?

@Reinmar Reinmar modified the milestones: unknown, nice-to-have Jul 14, 2020
@mlewand mlewand added the domain:ui/ux This issue reports a problem related to UI or UX. label Jul 14, 2020
@ottman
Copy link

ottman commented Aug 14, 2020

This feature is actually really essential for enabling bloggers to migrate their content to platforms using ckeditor. Any way we can escalate?

@AliBayat
Copy link

AliBayat commented Aug 26, 2021

according to documentations, ckeditor-autoformat does the formating as you type into the editor.. there should be some way we can listen for the paste event and do a whole reformatting on the pasted contents

@Reinmar Reinmar added squad:platform Issue to be handled by the Platform team. and removed squad:platform Issue to be handled by the Platform team. labels Oct 28, 2021
@martynawierzbicka martynawierzbicka added the support:2 An issue reported by a commercially licensed client. label Feb 15, 2022
@pomek pomek removed this from the nice-to-have milestone Feb 21, 2022
@dcblogdev
Copy link

It would be great for have support for pasted markdown, this is planned?

@wimleers
Copy link

wimleers commented Apr 26, 2023

Since this was opened, CKEditor 5 gained a "Source" plugin. Why not just enable that, expect the user to switch to the Source view, paste there, toggle back? That actually works fine at https://ckeditor.com/docs/ckeditor5/latest/features/markdown.html!

I think this arguably can be closed, or at best is a very low priority.

@Witoso
Copy link
Member

Witoso commented Apr 26, 2023

Thanks, @wimleers, I think we will keep it open to gather interest. I can imagine someone wants to paste the markdown and see the HTML source 😅.

@dcblogdev
Copy link

I'd be happy to use the source button to see the HTML. But the main issue is being able to paste Markdown and have it rendered as Markdown.

@kevinquillen
Copy link

CKEditor 5 gained a "Source" plugin. Why not just enable that, expect the user to switch to the Source view, paste there, toggle back?

This assumes all formats have the Source button enabled, but isn't good UX for the user even if present, I think.

One area I was hoping to leverage this was with API integrations, specifically AI in this case. It will return items formatted as Markdown to me, but since pasted text is not supported, this is the result:

Screenshot from 2023-06-11 14-05-11

@Witoso
Copy link
Member

Witoso commented Jun 12, 2023

@kevinquillen interesting use case! @scofalik do we have some way to stream the response through the markdown data pipeline so that it will be rendered properly?

@kevinquillen
Copy link

Yes, see the example here:

https://jetpack.com/blog/introducing-jetpack-ai-assistant/

I assume this is the approach they had. Markdown is an order of magnitude smaller than HTML in a payload (where length costs money) and easier for CKEditor to work with in this context. Stitching together HTML from a chunked response doesn't work too well.

Anyway, I think that if it could apply itself on write, it would work. When the response is streamed in, it updates CKEditor like so:

const text = new TextDecoder().decode(value);

// code omitted...

editor.model.insertContent(
  writer.createText(text)
);

text could be anywhere from 1 to 6 characters depending on what the API is returning (its keeping a connection alive until there is no more input to read from the server). To CKEditor, I would think it looks like a user typing, so it should be able to support this. Although I am not sure if the insertContent bit is correct or not, I picked this up from the docs.

@pomek pomek added the squad:platform Issue to be handled by the Platform team. label Oct 13, 2023
@martnpaneq
Copy link
Contributor

internal notes

I've prepared a PoC for this feature on a branch: 4dce8d9

It probably does not meet all of the corner cases yet, but it seems to be working for simple markdown copy and paste cases that I tested.

@martnpaneq
Copy link
Contributor

internal notes

The first version handled markdown code copied from any text editor, but did not transform any markdown copied from a website, e.g. a GitHub issue description.
There's a new version of the POC that handles pasting simple markdown copied from a website on Windows, Linux and Mac.

We went through the currently available solutions, and this is something we came up with:
aeb964e

@Witoso
Copy link
Member

Witoso commented Nov 8, 2023

A question to everyone interested in this feature, from which tools do you copy the markdown to paste it into the editor?

@CKEditorBot CKEditorBot added the status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. label Nov 23, 2023
niegowski added a commit that referenced this issue Dec 5, 2023
Feature (markdown-gfm): Added an experimental support for pasting from markdown. Closes #2321.
@CKEditorBot CKEditorBot removed the status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. label Dec 5, 2023
@CKEditorBot CKEditorBot added this to the iteration 69 milestone Dec 5, 2023
@DvzH
Copy link

DvzH commented Feb 22, 2024

Hello @Witoso, @niegowski, @martnpaneq

I have a scenario, where I would like to support copy-pasting markdown content into EDITOR. However, I always want the output of the editor to be in the HTML format. I am assuming that the current plugin support inputing and outputing only in markdown format.

Also, if it supports I would like to know how to add the plugin to the online-build generated from online ckeditor tool.
Currently, adding the plugin as mentioned in the tutorial is throwing me duplicate module errors

@Witoso
Copy link
Member

Witoso commented Mar 4, 2024

@DvzH this is precisely what experimental Paste Markdown is doing. It works in HTML and Markdown editor. 

> Also, if it supports I would like to know how to add the plugin to the online-build generated from online ckeditor tool.

It's still experimental, that's why it's not added there yet. Make sure you install the package in the online builder folder, add the plugin to list in the src/ckeditor.ts, and rebuild.

@DvzH
Copy link

DvzH commented Mar 4, 2024

@DvzH this is precisely what experimental Paste Markdown is doing. It works in HTML and Markdown editor. 

Also, if it supports I would like to know how to add the plugin to the online-build generated from online ckeditor tool.

It's still experimental, that's why it's not added there yet. Make sure you install the package in the online builder folder, add the plugin to list in the src/ckeditor.ts, and rebuild.

Thank you @Witoso for the information, As a workaround what I did is, I used marked library to convert the markdown to html string format then used it to initiate the editor. However, will try the approach u mentioned and will see how it goes.

@mabryl
Copy link
Contributor

mabryl commented Aug 20, 2024

At the moment, when using the PasteFromMarkdownExperimental functionality in combination with AutoMediaEmbed, the pasted media link will not be automatically embedded. The issue is reproducible only when using Paste Markdown.

@Witoso
Copy link
Member

Witoso commented Dec 16, 2024

Let's keep this issue open for gathering feedback.

@Witoso Witoso reopened this Dec 16, 2024
@pomek pomek removed the squad:platform Issue to be handled by the Platform team. label Dec 16, 2024
@Witoso Witoso changed the title Support converting pasted markdown content Support converting pasted markdown content / Paste Markdown feedback. Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:ui/ux This issue reports a problem related to UI or UX. package:markdown-gfm support:2 An issue reported by a commercially licensed client. type:feature This issue reports a feature request (an idea for a new functionality or a missing option).
Projects
None yet
Development

Successfully merging a pull request may close this issue.