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

Premiun features? #238

Open
ewartmouton opened this issue Aug 19, 2024 · 2 comments
Open

Premiun features? #238

ewartmouton opened this issue Aug 19, 2024 · 2 comments

Comments

@ewartmouton
Copy link

Is it possible to use premium features like export to PDF?
https://ckeditor.com/docs/ckeditor5/latest/features/converters/export-pdf.html#installation
where do you specify API details like token URL etc

@ewartmouton
Copy link
Author

ewartmouton commented Aug 28, 2024

For anybody finding this. I did manage to insert the editor into my admin form but wasn't able to configure it to use paid features like ExportPdf which to be honest is the only reason I need CKEditor instead of more well documented options like tinyMCE.
My imports in the forms.modelAdmin form:

from django.templatetags.static import static

class Media:
        js = (
            static('myapp/js/ckeditor-init.js'),
            format_html(
                '<script type="importmap"> \
                {{ \
                    "imports": {{ \
                        "ckeditor5": "https://cdn.ckeditor.com/ckeditor5/43.0.0/ckeditor5.js", \
                        "ckeditor5/": "https://cdn.ckeditor.com/ckeditor5/43.0.0/", \
                        "ckeditor5-premium-features": "https://cdn.ckeditor.com/ckeditor5-premium-features/43.0.0/ckeditor5-premium-features.js", \
                        "ckeditor5-premium-features/": "https://cdn.ckeditor.com/ckeditor5-premium-features/43.0.0/" \
                    }} \
                }} \
                </script>'
            ),
            format_html('<script type="module" src="{}"></script>', static('myapp/js/ckeditor-init.js'))
        )
        css = {
            'all': (
                'https://cdn.ckeditor.com/ckeditor5/43.0.0/ckeditor5.css',
                'https://cdn.ckeditor.com/ckeditor5-premium-features/43.0.0/ckeditor5-premium-features.css',
            ),
        }

The only other change is the ckeditor-init.js file in static which was generated by https://ckeditor.com/ckeditor-5/builder/ and modified to replace the relevant django admin form fields with ckeditor

@goapunk
Copy link
Contributor

goapunk commented Sep 19, 2024

@ewartmouton This is currently not supported but adding it should not be too complicated (especially once we upgrade to ckeditor 42.x)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants