draftail | ๐Ÿ“๐Ÿธ A configurable rich text editor built with Draft.js | Editor library

ย by ย  springload TypeScript Version: 2.0.0-rc.2 License: MIT

kandi X-RAY | draftail Summary

kandi X-RAY | draftail Summary

draftail is a TypeScript library typically used in Editor, React, Wagtail applications. draftail has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

:memo::cocktail: A configurable rich text editor built with Draft.js. Check out our demos!.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              draftail has a low active ecosystem.
              It has 588 star(s) with 66 fork(s). There are 23 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 30 open issues and 139 have been closed. On average issues are closed in 307 days. There are 2 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of draftail is 2.0.0-rc.2

            kandi-Quality Quality

              draftail has 0 bugs and 0 code smells.

            kandi-Security Security

              draftail has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              draftail code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              draftail is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              draftail releases are available to install and integrate.
              draftail saves you 439 person hours of effort in developing the same functionality from scratch.
              It has 1042 lines of code, 0 functions and 146 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed draftail and discovered the below as its top functions. This is intended to give you an instant insight into draftail implemented functionality, and help decide if they suit your requirements.
            • Expands the current state of the editor into a compact block state .
            Get all kandi verified functions for this library.

            draftail Key Features

            No Key Features are available at this moment for draftail.

            draftail Examples and Code Snippets

            Draftail blockquote with it's own css class added, is this possible?
            Lines of Code : 43dot img1License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            from wagtail.admin.rich_text.converters.html_to_contentstate import BlockElementHandler
            
            @hooks.register('register_rich_text_features')
            def register_blockquote_feature(features):
                """
                Registering the `blockquote` feature, which uses

            Community Discussions

            QUESTION

            Wagtail. Ability to edit html within editor
            Asked 2022-Feb-09 at 21:08

            My editors want to have an ability to edit raw html within editor. For example, we can have simple list markup:

            ...

            ANSWER

            Answered 2022-Feb-01 at 10:36

            Wagtail does not support raw HTML editing within the page editor out of the box intentionally. The philosophy (zen) of Wagtail is to help editors and developers 'wear the right hat' when working in Wagtail.

            HTML editing is usually best provided to developers, where there is an expected knowledge of what is required for things like accessibility, security and the benefit of tooling (like git).

            However, if HTML editing is a must, you will probably need to build your own editor field for that purpose or find a suitable package that works with HTML markup such as django-markupfield. Adding image/snippet/page chooser functionality however will have to be built for whatever you end up using. You may also want to look at the Wagtail markdown package either as an alternative to HTML or a starting point, it allows for a syntax of linking to pages/images.

            Wagtail lets you use any kind of Django field or widget with the FieldPanel.

            Please ensure you consider all the risks when implementing this feature, such as accessible HTML (e.g. heading levels), security (disallow some tags such as script tags), malformed HTML leaking into the rendered template and of course the end user experience.

            Source https://stackoverflow.com/questions/70877017

            QUESTION

            How to get two RichText features to be mutually exclusive
            Asked 2022-Jan-12 at 21:16

            So basically I've added two custom features for coloring text to a RichTextBlock, and I'd like to make them so selecting one for a portion of text would automatically unselect the other color button, much like it's already the case for h tags.

            I've searched for a bit but didn't find much, so I guess I could use some help, be it advice, instruction or even code.

            My features go like this :

            ...

            ANSWER

            Answered 2022-Jan-12 at 21:16

            This is possible, but it requires jumping through many hoops in Wagtail. The h1โ€ฆh6 tags work like this out of the box because they are block-level formatting โ€“ each block within the editor can only be of one type. Here youโ€™re creating this RED_TEXT formatting as inline formatting ("inline style"), which, intentionally supports multiple formats being applied to the same text.

            If you want to achieve this mutually exclusive implementation anyway โ€“ youโ€™ll need to write custom JS code to auto-magically remove the desired styles from the text when attempting to add a new style.

            Here is a function that does just that. It goes through all of the characters in the userโ€™s selection, and removes the relevant styles from them:

            Source https://stackoverflow.com/questions/69256571

            QUESTION

            Creating Draftail entity with additional data
            Asked 2021-Apr-24 at 03:20

            I've been using Wagtail to create a website with additional text annotations. The user flow is that there is some highlighted text in a paragraph, which when clicked shows an annotation off to one side. The expected HTML result is:

            ...

            ANSWER

            Answered 2021-Apr-24 at 03:20

            to get What you want, easiest way is to create your own Template tags filters, create your own markdown replacements, let's say, in the rich text you assigned the link to part of your paragraph like this "Click here this is a hidden text" and then you put [ht] right before the "this is a hidden text" and a[th] right after that targeted hidden text,then in the template use self.field_name|replace:"[ht]"|replace:"[th]"

            in template tag file (for example myapp/templatetags/my_richtext.py):

            Source https://stackoverflow.com/questions/67228471

            QUESTION

            How to import posts from Wordpress to Wagtail 2 (Draftail editor) including images?
            Asked 2021-Feb-08 at 10:10

            I'm trying to import posts from Wordpress to Wagtail including images.

            I'm conscious about the fact that Draftail editor saves images with a dedicated tag, ex:

            ...

            ANSWER

            Answered 2021-Feb-08 at 10:10

            I found what was causing the issue.

            I was using a rendition image to fetch the id:

            Source https://stackoverflow.com/questions/66090066

            QUESTION

            Wagtail CMS Draftail Inline Elements and Classes not showing
            Asked 2021-Jan-05 at 16:14

            I have registered the following hooks:

            ...

            ANSWER

            Answered 2021-Jan-05 at 16:14

            This doesn't work because p class="has-dropcap" is not a valid HTML tag name. Injecting an attribute via the tag name might work as an unofficial hack in some places because those particular internals of Wagtail work by piecing together HTML strings, but other parts of Wagtail code (such as the Draftail editor) use the Javascript DOM API where tag names and attributes are completely distinct concepts.

            I don't know if there's a workaround, but in any case, I wouldn't advise implementing dropcaps in this way. The whole point of a CMS like Wagtail is to separate content from presentation: if a user writing website content is making decisions about typography while writing it, then something has gone wrong in that process.

            If your site design calls for the first paragraph of the body text to have a dropcap, then your CSS should represent that design choice, using a rule such as .body p:first, rather than a manually-applied class name.

            Source https://stackoverflow.com/questions/65579701

            QUESTION

            Wagtail AssertionError "Unmatched tags: expected img, got p"
            Asked 2020-Feb-25 at 16:34

            I'm running Wagtail 2.4 in Docker with a Postgres db, and getting an error when I attempt to edit a blog post in Wagtail. The initial post worked, and I can view the page fine on the site. When I go to edit the post in the Wagtail admin, it throws a 500 error: AssertionError "Unmatched tags: expected img, got p"

            I initially thought that the issue was because the blog posts were initially imported from another database (old Drupal site) and the intro and body fields contained image tags, even though the intro should not have had any HTML markup at all. However, I removed them in the db using Navicat and the error is still occurring. Not sure what else to try, but I can confirm that not all posts are getting an error on the edit view, just the ones that were imported from Drupal. Anything newer that has been added in the Wagtail admin is fine.

            The model looks like this:

            ...

            ANSWER

            Answered 2020-Feb-22 at 02:23

            The problem is that Wagtail's parser is not tolerant of badly formed HTML, and the HTML you've imported from Drupal is badly formed (e.g., it includes unclosed tags). It's a little annoying that the Wagtail editor breaks with this because you have no way to fix the content from the editor.

            What I've ended up doing in the past is fixing the bad HTML in the shell, using an HTML parser like Beautiful Soup. Something along these lines:

            Source https://stackoverflow.com/questions/60327957

            QUESTION

            Wagtail RichTextBlock extend to pick color
            Asked 2020-Jan-22 at 11:12

            I am trying to implement a color-chooser option in wagtail RichTextBlock so that I can select any color for my selected text.

            This is my wagtail_hooks.py file:

            ...

            ANSWER

            Answered 2020-Jan-21 at 20:14

            Could you add a charfield or charblock to your model or streamblock where you enter the hex value and in the template you read the field value and set the text color to that?

            Source https://stackoverflow.com/questions/59847147

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install draftail

            You can download it from GitHub.

            Support

            Getting startedAPI referenceUser guideGetting started with extensions
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • npm

            npm i draftail

          • CLONE
          • HTTPS

            https://github.com/springload/draftail.git

          • CLI

            gh repo clone springload/draftail

          • sshUrl

            git@github.com:springload/draftail.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Editor Libraries

            quill

            by quilljs

            marktext

            by marktext

            monaco-editor

            by microsoft

            CodeMirror

            by codemirror

            slate

            by ianstormtaylor

            Try Top Libraries by springload

            awesome-wagtail

            by springloadPython

            react-accessible-accordion

            by springloadTypeScript

            css-reporter

            by springloadJavaScript

            frontend-starter-kit

            by springloadTypeScript

            madewithwagtail

            by springloadPython