question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Package future with Draftail.

See original GitHub issue

Recently, Wagtail 2.0 was released and it brings a new feature: Draftail, using Draft.js, a powerful jseditor.

One of the package derivated from Wagtail, Puput, is using the new feature API for inject code in the RichTextFields: https://github.com/APSL/puput/commit/be7eacb9f580b98109397aba16876172b01dc4e5#diff-2e7915c4db5fe6d98fea8c5525939930 You can see a prism.js plugin for Draftail: https://github.com/withspectrum/draft-js-prism-plugin

So, my question is, what’s about this Package? What is the future for this package?

There is a content related issue: https://github.com/FlipperPA/wagtailcodeblock/issues/9

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
FlipperPAcommented, Oct 21, 2021

@thibaudcolas I’m going to close this issue - if we end up wanted to revisit, I’m game for it, but there hasn’t seemed to be too much pent up demand. 😃 I’m guessing it would require a total rewrite with telepath.

2reactions
thibaudcolascommented, Jun 13, 2018

I don’t think there’s that big improvements in using code blocks within the rich text editor instead of as separate StreamField block like this library does already. I guess the main advantage is having the syntax highlighting directly in the typed text, but if you copy-paste code snippets from elsewhere that doesn’t seem super important.

Of course the rich text editor has much more advanced capabilities than a textarea so it might still be worth exploring.


If/when anyone wants to tackle this, there’s already a Draft.js decorator based on Prism, compatible with Draftail, over at https://github.com/springload/draftail/blob/master/examples/components/PrismDecorator.js.

You can see it in use here: https://github.com/springload/draftail/blob/995e4c3a5286d62d94295848c8c1cc0e2a0039df/examples/index.js, as part of the Draftail demo site.

This is only a decorator (something that highlights text in some way), so it’s missing a way to select what language to use when highlighting. This could be as simple as adding a special keyword lang: python or similar to use at the top of the code blocks. It could also use a custom React component to render the block (with a language picker) – something that’s not supported in Draftail at the moment IIRC, but we could add easily if there is a need.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Draftail v1.1.0: a quality of life release
[Draftail v1.1.0](https://www.npmjs.com/package/draftail) is out; ... CPU), to be able to benchmark future additions to the editor.
Read more >
Draftail documentation · Issue #4221 · wagtail/wagtail - GitHub
I'm contributting to wagtailembedvideos (my own fork) and i implemented the embed video embed feature for hallo.js editor. I works in the same ......
Read more >
Top 5 draftail Code Examples - Snyk
Learn more about how to use draftail, based on draftail code examples created from the most popular ways ... This will need to...
Read more >
Draftail: A next generation rich text editor for Wagtail
... are leading a team focused on making a difference for future generations. ... Feel free to use Draftail, via this integration package, ......
Read more >
draftjs-filters | Yarn - Package Manager
js filters · npm Build status. Filter Draft.js content to preserve only the formatting you allow. Built for Draftail.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found