torchbox / wagtail-footnotes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"The editor just crashed" on fresh install

codekoriko opened this issue · comments

wagtail==2.11.3
wagtail-footnotes==0.4.1
Django==3.1.4

When I click on the "Fn" button, I get:

Error: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.

Error: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
    at Pl (http://localhost:8000/static/wagtailadmin/js/vendor.js?v=c42ede84:22:109822)
    at c (http://localhost:8000/static/wagtailadmin/js/vendor.js?v=c42ede84:22:52404)
    at h (http://localhost:8000/static/wagtailadmin/js/vendor.js?v=c42ede84:22:53763)
    at v (http://localhost:8000/static/wagtailadmin/js/vendor.js?v=c42ede84:22:54338)
    at http://localhost:8000/static/wagtailadmin/js/vendor.js?v=c42ede84:22:56318
    at Mu (http://localhost:8000/static/wagtailadmin/js/vendor.js?v=c42ede84:22:65804)
    at ya (http://localhost:8000/static/wagtailadmin/js/vendor.js?v=c42ede84:22:106175)
    at cl (http://localhost:8000/static/wagtailadmin/js/vendor.js?v=c42ede84:22:96716)
    at al (http://localhost:8000/static/wagtailadmin/js/vendor.js?v=c42ede84:22:96641)
    at Za (http://localhost:8000/static/wagtailadmin/js/vendor.js?v=c42ede84:22:93671)

    in div
    in e
    in e

Hi, the problem can be solved by removing:

@hooks.register("insert_editor_js")
def editor_js():
    js_files = ['wagtailadmin/js/draftail.js', 'footnotes/js/footnotes.js']
    js_includes = format_html_join('\n', '<script src="{0}"></script>',
        ((static(filename),) for filename in js_files)
    )
    return js_includes

from wagtail_hooks.py and adding: js = ['wagtailadmin/js/draftail.js', 'footnotes/js/footnotes.js'] into:

features.register_editor_plugin(
        "draftail",
        feature_name,
        draftail_features.EntityFeature(
            control,
            js = ['wagtailadmin/js/draftail.js', 'footnotes/js/footnotes.js']
        ),
    )

within the register_footnotes_feature(features) function.

I'm not sure why registring of js files is not working. It seems to be a problem since wagtail 2.11.

Thanks, @alexgorji for spotting that, I have made this change and included it in the latest release 0.5.0
(Apologies for taking a while to get to this, I've been quite busy the past few months)