• Stars
    star
    283
  • Rank 146,066 (Top 3 %)
  • Language
    CSS
  • Created over 10 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Package to integrate Froala WYSIWYG HTML rich text editor with Django.

Django Froala WYSIWYG Editor

django-froala-editor package helps integrate Froala WYSIWYG HTML editor with Django.

Getting started

  1. Install the package:

pip install django-froala-editor

if not update in pypi use this

pip install https://github.com/froala/django-froala-editor/archive/master.zip

OR

Add the directory froala_editor from this repo to your Python path.

  1. Add froala_editor to INSTALLED_APPS in settings.py.

  2. Add the following line to urlpatterns in your application's urls.py.

from froala_editor import views

In your urlpatterns array add

path('froala_editor/',include('froala_editor.urls'))

Skip this url inclusion if you don't want image and file upload inside WYSIWYG editor. Images from URLs can still be embedded.

To add third-party plugins

In froala_editor\widgets.py add

'froala_editor/js/third_party/embedly.min.js',
'froala_editor/js/third_party/spell_checker.min.js',
'froala_editor/js/third_party/font_awesome.min.js',
'froala_editor/js/third_party/image_tui.min.js'

Usage

from django.db import models
from froala_editor.fields import FroalaField

class Page(models.Model):
  content = FroalaField()

FroalaField uses froala_editor.widgets.FroalaEditor as its widget. You may directly use this widget with any of your forms.py:

from django import forms
from froala_editor.widgets import FroalaEditor

class PageForm(forms.ModelForm):
  content = forms.CharField(widget=FroalaEditor)

Usage outside admin

When used outside the Django admin, the media files are to be manually included in the template. Inside the <head> section or before the form is rendered, include:

{{ form.media }}

Usage with virtual environment

To use Froala Editor in virtual environment, see https://tutorial.djangogirls.org/en/django_installation/ for how to setup virtual environment & to start your application in virtual environment.

Options

Froala Editor provides several options for customizing the editor. See https://froala.com/wysiwyg-editor/docs for all available options. You can provide a dictionary of these options as FROALA_EDITOR_OPTIONS setting in settings.py. These options would then be used for all instances of the WYSIWYG editor in the project.

Options for individual field can also be provided via FroalaField or FroalaEditor class. This overrides any options set via FROALA_EDITOR_OPTIONS:

from django.db import models
from froala_editor.fields import FroalaField

class Page(models.Model):
  content = FroalaField(options={
    'toolbarInline': True,
  })
from django import forms
from froala_editor.widgets import FroalaEditor

class PageForm(forms.ModelForm):
  content = forms.TextField(widget=FroalaEditor(options={
    'toolbarInline': True,
  }))

Theme

You may provide the name of the theme to be used as theme argument to FroalaField or FroalaEditor.

from django.db import models
from froala_editor.fields import FroalaField

class Page(models.Model):
  content = FroalaField(theme='dark')

FROALA_EDITOR_THEME can be set in settings.py making all instances of the editor to use a theme. However, theme argument in FroalaField and FroalaEditor overrides FROALA_EDITOR_THEME. Using a theme named 'dark' would require the existence of the file froala_editor/static/froala_editor/css/themes/dark.min.css. Available themes are: 'dark', 'gray' and 'red'.

Plugins

Froala Editor comes with the plugins: block style, text & background colors, font size, font family, insert video, insert table, media manager, lists and file upload. By default, all plugins are enabled by default in this package. See https://froala.com/wysiwyg-editor/docs/plugins for all available plugins.

FROALA_EDITOR_PLUGINS can be set in settings.py to tell which plugins should all instances of Froala Editor be using. By default, it is

FROALA_EDITOR_PLUGINS = ('align', 'char_counter', 'code_beautifier' ,'code_view', 'colors', 'draggable', 'emoticons',
        'entities', 'file', 'font_family', 'font_size', 'fullscreen', 'image_manager', 'image', 'inline_style',
        'line_breaker', 'link', 'lists', 'paragraph_format', 'paragraph_style', 'quick_insert', 'quote', 'save', 'table',
        'url', 'video')

The usage of plugins argument with FroalaEditor or FroalaField overrides this for that particular instance.

from django.db import models
from froala_editor.fields import FroalaField

class Page(models.Model):
  content = FroalaField(plugins=('font_size', 'font_family'))

Third party integrations

FROALA_EDITOR_THIRD_PARTY setting can be used to configure third party integrations. Aviary Image Editor and SCAYT Web SpellChecker are available for now. To enable, in settings.py:

FRAOLA_EDITOR_THIRD_PARTY = ('image_aviary', 'spell_checker')

Similar to plugin configuration, this can also be overridden on ForalaEditor and FroalaField.

Use your key for SCAYT Web SpellChecker with SCAYT_CUSTOMER_ID in your project setings.

Image upload

FroalaEditor and FroalaField optionally take in a boolean value for image_upload argument to enable or disable image uploads. Image uploads are enabled by default if the urls of this package are included in your urls.py.

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.

Other Settings

USE_FROALA_EDITOR - default True
If set to Falsein your Django settings disables Froala editor and uses a TextArea instead.

FROALA_STORAGE_BACKEND
This allows for the storage used for uploaded images and files to be changed through settings. If nothing is provided it uses default_storage, otherwise it uses this backend. Using this you can specify a different storage backend like S3 only for Froala.

FROALA_JS_COOKIE - default False.
If set to True, it assumes js-cookie is installed and included to get the CSRF token using js-cookie.

Release

To publish to PyPi, the following command should be run:

python setup.py sdist upload -r pypi

License

This package is available under BSD License. However, in order to use Froala WYSIWYG HTML Editor plugin you should purchase a license for it.

See https://froala.com/wysiwyg-editor/pricing for licensing the Froala Editor.

If you bought a license and got your key, the easiest way to implement it is to put it into the FROALA_EDITOR_OPTIONS setting in settings.py:

FROALA_EDITOR_OPTIONS = {
  'key': '<our key goes here>',
  # other options
  # ...
}

More Repositories

1

design-blocks

A set of 170+ Bootstrap based design blocks ready to be used to create clean modern websites.
HTML
13,506
star
2

wysiwyg-editor

The next generation Javascript WYSIWYG HTML Editor.
CSS
5,259
star
3

angular-froala-wysiwyg

Angular 4, 5, 6, 7, 8 and 9 plugin for Froala WYSIWYG HTML Rich Text Editor.
TypeScript
732
star
4

vue-froala-wysiwyg

Vue component for Froala WYSIWYG HTML Rich Text Editor.
JavaScript
632
star
5

react-froala-wysiwyg

React component for Froala WYSIWYG HTML Rich Text Editor.
JavaScript
562
star
6

wysiwyg-rails

Ruby gem for Froala jQuery WYSIWYG HTML Rich Text Editor.
CSS
465
star
7

angular-froala

Angular.js bindings for Froala WYSIWYG HTML Rich Text Editor.
JavaScript
306
star
8

nova-froala-field

A Laravel Nova Froala WYSIWYG Editor Field.
PHP
113
star
9

react-froala-design-blocks

React implementation for Froala Design Blocks.
JavaScript
108
star
10

KMSFroalaEditorBundle

Symfony bundle for Froala WYSIWYG HTML Rich Text Editor.
PHP
105
star
11

yii2-froala-editor

Yii 2 widget for the Froala WYSIWYG HTML Editor.
PHP
103
star
12

meteor-froala

Meteor bindings for the Froala WYSIWYG HTML Editor.
CSS
68
star
13

ember-froala-editor

Ember component for Froala WYSIWYG HTML Rich Text Editor.
JavaScript
68
star
14

vue-froala-design-blocks

Vue JS implementation for Froala Design Blocks.
Vue
60
star
15

design-framework-demo

CSS
59
star
16

wordpress-froala-wysiwyg

Wordpress plugin for Froala WYSIWYG HTML Editor.
CSS
42
star
17

wysiwyg-editor-php-sdk

PHP SDK to ease the integration of Froala WYSIWYG Editor on server side.
PHP
40
star
18

wysiwyg-editor-release

Froala wysiwyg editor release
HTML
30
star
19

wysiwyg-editor-dotnet-sdk

.NET SDK to ease the integration of Froala WYSIWYG Editor on server side.
JavaScript
29
star
20

aurelia-froala-editor

Aurelia plugin for Froala WYSIWYG HTML Rich Text Editor.
JavaScript
28
star
21

ember-froala

[DEPRECATED] Please use https://github.com/froala/ember-froala-editor instead.
JavaScript
28
star
22

angular-froala-design-blocks

Angular implementation for Froala Design Blocks.
HTML
27
star
23

froala-reactive

A Meteor reactive template wrapper around Froala WYSIWYG HTML Editor.
JavaScript
25
star
24

wysiwyg-editor-node-sdk

Node.JS SDK to ease the integration of Froala WYSIWYG Editor on server side.
JavaScript
25
star
25

froala-pages

HTML
21
star
26

wysiwyg-editor-v1

A flat designed jQuery WYSIWYG Rich Text Editor based on HTML5.
JavaScript
21
star
27

wysiwyg-editor-python-sdk

Python SDK to ease the integration of Froala WYSIWYG Editor on server side.
Python
21
star
28

Craft-3-Froala-WYSIWYG

Craft 3 CMS plugin for Froala WYSIWYG HTML Rich Text Editor.
PHP
16
star
29

Craft-Froala-WYSIWYG

Craft CMS plugin for Froala WYSIWYG HTML Rich Text Editor.
JavaScript
16
star
30

wysiwyg-editor-java-sdk

Java SDK to ease the integration of Froala WYSIWYG Editor on server side.
HTML
15
star
31

editor-php-sdk-example

Example for using the Froala Editor PHP SDK
PHP
11
star
32

wysiwyg-cake2

CakePHP Plugin for Froala Javascript WYSIWYG Rich Text Editor.
CSS
11
star
33

knockout-froala

Knockout.js binding for Froala WYSIWYG HTML Rich Text Editor
Shell
10
star
34

wysiwyg-editor-ruby-sdk

Ruby
9
star
35

wysiwyg-cake

CakePHP Plugin for Froala Javascript WYSIWYG Rich Text Editor.
CSS
8
star
36

editor-ruby-sdk-example

Ruby
7
star
37

vue-froalacharts

Simple and lightweight official Vue component for FroalaCharts.
JavaScript
5
star
38

froala-gatsby

JavaScript
3
star
39

froala-editor-nuget

Nuget package for Froala WYSIWYG Editor
3
star
40

angular-froala-systemjs-demo

A quick starter to use angular-froala with system js
TypeScript
2
star
41

froala-image-uploader-example

Sample PHP application demo for Froala Image Uploader
PHP
2
star
42

froalacharts

JavaScript
2
star
43

.github

1
star
44

react-froalacharts-component

Simple and lightweight official React component for FroalaCharts.
JavaScript
1
star
45

ember-froalacharts

Simple and lightweight official Ember component for FroalaCharts.
JavaScript
1
star
46

xt-themes

JavaScript
1
star