From 9145bda0cf0ffa71371afe09a33426a0fb0bdcd5 Mon Sep 17 00:00:00 2001 From: shreypasari-accolite Date: Tue, 2 Apr 2019 11:19:14 +0530 Subject: [PATCH] Update to v.3 --- README.md | 19 ------------------- froala_editor/fields.py | 5 ++--- froala_editor/widgets.py | 11 ++--------- setup.py | 2 +- 4 files changed, 5 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index a467a04c..b9e20a19 100644 --- a/README.md +++ b/README.md @@ -54,21 +54,6 @@ When used outside the Django admin, the media files are to be manually included {{ form.media }} ``` -In case of jQuery conflict (when your project template already has jQuery), you need to include the following files instead of `{{ form.media }}` plus the static files for theme (if not default) and required plugins. - -```python - - - - -``` - -Or simply, you may use the following in your `settings.py` if you don't want Froala to include jQuery by itself, thus preventing any conflicts: - -```python -FROALA_INCLUDE_JQUERY = False -``` - ### Options Froala Editor provides several options for customizing the editor. See [https://froala.com/wysiwyg-editor/docs](https://froala.com/wysiwyg-editor/docs) for all available options. @@ -153,10 +138,6 @@ Use your key for SCAYT Web SpellChecker with `SCAYT_CUSTOMER_ID` in your project You can use `FROALA_UPLOAD_PATH` setting in `settings.py` to change the path where uploaded files are stored within the `MEDIA_ROOT`. By default, `uploads/froala_editor/images` is used for storing uploaded images. -### Include jQuery - -jQuery is included by default in form media. If you don't want to include jQuery, you may pass `include_jquery=False` to `FroalaEditor` or `FroalaField`. `FROALA_INCLUDE_JQUERY` can be also set in `settings.py` for project wide effects. - ### Other Settings `USE_FROALA_EDITOR` - default True diff --git a/froala_editor/fields.py b/froala_editor/fields.py index f223479c..a1cc4cf0 100644 --- a/froala_editor/fields.py +++ b/froala_editor/fields.py @@ -15,10 +15,9 @@ def __init__(self, *args, **kwargs): self.theme = kwargs.pop('theme', getattr(settings, 'FROALA_EDITOR_THEME', None)) self.plugins = kwargs.pop('plugins', getattr(settings, 'FROALA_EDITOR_PLUGINS', PLUGINS)) self.third_party = kwargs.pop('plugins', getattr(settings, 'FROALA_EDITOR_THIRD_PARTY', THIRD_PARTY)) - self.include_jquery = kwargs.pop('include_jquery', getattr(settings, 'FROALA_INCLUDE_JQUERY', True)) self.image_upload = kwargs.pop('image_upload', True) self.file_upload = kwargs.pop('file_upload', True) - self.use_froala = kwargs.pop('include_jquery', getattr(settings, 'USE_FROALA_EDITOR', True)) + self.use_froala = kwargs.pop('', getattr(settings, 'USE_FROALA_EDITOR', True)) super(FroalaField, self).__init__(*args, **kwargs) def get_internal_type(self): @@ -27,7 +26,7 @@ def get_internal_type(self): def formfield(self, **kwargs): if self.use_froala: widget = FroalaEditor(options=self.options, theme=self.theme, plugins=self.plugins, - include_jquery=self.include_jquery, image_upload=self.image_upload, + image_upload=self.image_upload, file_upload=self.file_upload, third_party=self.third_party) else: widget = Textarea() diff --git a/froala_editor/widgets.py b/froala_editor/widgets.py index e8061634..3e1893e9 100644 --- a/froala_editor/widgets.py +++ b/froala_editor/widgets.py @@ -16,7 +16,6 @@ def __init__(self, *args, **kwargs): self.plugins = kwargs.pop('plugins', getattr(settings, 'FROALA_EDITOR_PLUGINS', PLUGINS)) self.third_party = kwargs.pop('third_party', getattr(settings, 'FROALA_EDITOR_THIRD_PARTY', THIRD_PARTY)) self.theme = kwargs.pop('theme', getattr(settings, 'FROALA_EDITOR_THEME', None)) - self.include_jquery = kwargs.pop('include_jquery', getattr(settings, 'FROALA_INCLUDE_JQUERY', True)) self.image_upload = kwargs.pop('image_upload', True) self.file_upload = kwargs.pop('file_upload', True) self.language = (getattr(settings, 'FROALA_EDITOR_OPTIONS', {})).get('language', '') @@ -71,23 +70,17 @@ def trigger_froala(self, el_id, options): str = """ """ % (el_id, options) return str def _media(self): css = { - 'all': ('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css', - 'froala_editor/css/froala_editor.min.css', 'froala_editor/css/froala_style.min.css', + 'all': ('froala_editor/css/froala_editor.min.css', 'froala_editor/css/froala_style.min.css', 'froala_editor/css/froala-django.css') } js = ('froala_editor/js/froala_editor.min.js', 'froala_editor/js/froala-django.js',) - if self.include_jquery: - js = ('https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.0/jquery.min.js',) + js - if self.theme: css['all'] += ('froala_editor/css/themes/' + self.theme + '.min.css',) diff --git a/setup.py b/setup.py index f0cc40e4..7ce0578f 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='django-froala-editor', - version='2.9.3', + version='3.0.0-beta.1', author='Dipesh Acharya', author_email='dipesh@awecode.com', maintainer='Froala Labs',