When pasting text inside a code fence block, the rich-to-markdown support is disabled.
“plain text table” detection should be disabled as well.
When pasting text inside a code fence block, the rich-to-markdown support is disabled.
“plain text table” detection should be disabled as well.
Will have a look
Hmm, maybe I am a bit stuck here…
d-editor
has an action called paste
, in which it detects if you can paste HTML:
canPasteHtml = !isInside(pre, /(^|\n)```/g);
This returns false if you are currently inside of a code fence block. The conversion of the text into markdown happens in this function:
if (canPasteHtml && ...) {
let markdown = toMarkdown(html);
}
So, conversion to markdown only happens when not inside of a code fence block. From what I understand, the “plain text table” detection is part of the markdown-it and hence should also be disabled here, because it’s not trying to convert the pasted text.
Am I missing out on something here?
Currently plain text table detection is not part of the “HTML pasting” feature. It is happening here. I think you have to move it to the end of this if
condition.
Ouh, yeah, I see it. Thanks a lot!
EDIT: Opened a PR
https://github.com/discourse/discourse/commit/dc2ee78f7a667cd0ded8e198282def7ea51797bb
It’s done as per the above commit. Thanks for the PR! @venarius.
This topic was automatically closed after 2 hours. New replies are no longer allowed.