All Projects → antonagestam → django-text

antonagestam / django-text

Licence: other
Intuitive text editing for humans using Django.

Programming Languages

python
139335 projects - #7 most used programming language
javascript
184084 projects - #8 most used programming language
CSS
56736 projects
HTML
75241 projects
Makefile
30231 projects

Projects that are alternatives of or similar to django-text

Laravel Filemanager
Media gallery with CKEditor, TinyMCE and Summernote support. Built on Laravel file system.
Stars: ✭ 1,688 (+2010%)
Mutual labels:  admin, wysiwyg
summernote-themes
Addon Themes for Summernote Lite WYSIWYG Editor
Stars: ✭ 42 (-47.5%)
Mutual labels:  wysiwyg
speed-admin
A rapid application development framework for Laravel.
Stars: ✭ 31 (-61.25%)
Mutual labels:  admin
vue-antdesign-admin-template
Ant Design Pro Vue Template
Stars: ✭ 127 (+58.75%)
Mutual labels:  admin
am-editor
A rich text collaborative editor framework that can use React and Vue custom plug-ins. 一个富文本实时协同编辑器框架,可以使用React和Vue自定义插件。
Stars: ✭ 542 (+577.5%)
Mutual labels:  wysiwyg
django admin chart js
An example repo showing how to add Chart.js to Django admin
Stars: ✭ 35 (-56.25%)
Mutual labels:  admin
draftjs-filters
Filter Draft.js content to preserve only the formatting you allow
Stars: ✭ 53 (-33.75%)
Mutual labels:  wysiwyg
NoSpawnChunks
Helps manage server memory by dynamically unloading chunks
Stars: ✭ 21 (-73.75%)
Mutual labels:  admin
ketabhome-shopping-cart-admin-panel
🛒 📙 📔 ketabhome is an online java book store application with admin panel based on servlet, with database c3p0 connector
Stars: ✭ 19 (-76.25%)
Mutual labels:  admin
kwig
KIWG is a WYSIWYG editor for WinForm based on summernote.
Stars: ✭ 36 (-55%)
Mutual labels:  wysiwyg
ZooKeeper-Admin
ZooKeeper 管理工具
Stars: ✭ 45 (-43.75%)
Mutual labels:  admin
go-fastdfs-web-go
go-fastdfs-web的golang版本
Stars: ✭ 31 (-61.25%)
Mutual labels:  admin
MarkDEditor
A WYSIWYG MarkDown editor for Android.
Stars: ✭ 76 (-5%)
Mutual labels:  wysiwyg
PlusAdmin-Free-Bootstrap-Admin-Template
Free Admin template featuring horizontal and vertical navbar. Built using Bootstrap 4.
Stars: ✭ 98 (+22.5%)
Mutual labels:  admin
react-web-editor
The react-web-editor is a WYSIWYG editor library. you can resize and drag your component. It also has simple rich text editor
Stars: ✭ 191 (+138.75%)
Mutual labels:  wysiwyg
mead
Mead - Dead simple markdown editor for Windows, Linux and Mac
Stars: ✭ 20 (-75%)
Mutual labels:  wysiwyg
vue3-element-admin
🎉 基于 vite2 + vue3 + element-plus 的后台管理系统vue3-element-admin;使用vue-cli可以切换webpack分支
Stars: ✭ 79 (-1.25%)
Mutual labels:  admin
ng-antd-admin
A angular style Admin based on angular, ng-zorro-antd,Efforts to update in progress...
Stars: ✭ 53 (-33.75%)
Mutual labels:  admin
remove-gutenberg-panel
Removes the Try Gutenberg panel from the WP-Admin Dashboard, introduced in WordPress 4.9.5 Beta 1. We only want to try Gutenberg once it's ready. Not now.
Stars: ✭ 16 (-80%)
Mutual labels:  admin
Laravel-CMS
Love Beautiful Code ? I do too!
Stars: ✭ 25 (-68.75%)
Mutual labels:  admin

django-text

Join the chat at https://gitter.im/antonagestam/django-text See latest build status at https://travis-ci.org/antonagestam/django-text Coverage

Intuitive text editing for humans using Django.

The django-text toolbar

This project is in early development, please test it out and report any bugs!

Installation

Install the package with pip.

$ pip install django-text

Add text to your installed packages.

# settings.py

INSTALLED_APPS = (
    # ...
    'text',
)

Add text.middleware.TextMiddleware and 'text.middleware.ToolbarMiddleware' to your middleware classes.

# settings.py

MIDDLEWARE_CLASSES = (
    # ...
    'text.middleware.TextMiddleware',
    'text.middleware.ToolbarMiddleware',
)

Make sure these context processors are installed, they come with Django.

# settings.py

TEMPLATE_CONTEXT_PROCESSORS = (
    # ...
    'django.contrib.auth.context_processors.auth',
    'django.core.context_processors.request',
)

Append text.urls to your urlpatterns in urls.py.

# urls.py

from django.conf.urls import patterns, include, url

from text.urls import urlpatterns as django_text_patterns


urlpatterns = patterns('',
    url(r'^django_text/', include(django_text_patterns, namespace='django_text')),
)

Run migrate.

$ python manage.py migrate

Usage

The text tag

Add editable tags to your templates.

{% load text %}

<h1>{% text "header" "My Header" %}</h1>

<div class="content">
    {% text "text_body" %}
</div>

The text tag takes a default text as the second argument. If no default text is passed, the name of the text node (i.e. the first argument) will be used if there is no corresponding text node in the database.

The blocktext tag

You can also use the blocktext tag that let's you wrap content to use as the default text.

{% load text %}

<div class="content">
    <h1>
        {% blocktext "header" %}
            Read My Awesome Text
        {% endblocktext %}
    </h1>

    {% blocktext "content" %}
        Put your default text here!
    {% endblocktext %}
</div>

The blocktext tags works with translation tags inside of it. So if you already have a translated site, you can wrap your content with this tag and only add text nodes for some of the languages that you support.

Specifying content type

Both the text and the blocktext tags support specifying the content type of its default text. The choices are "html", "markdown" and "text" which is the default.

{% text "html_node" "<h1>Hello World!</h1>" "html" %}

{% blocktext "markdown_node" "markdown" %}
# Hello there,

I can have markdown in my templates!
{% endblocktext %}

If content type is not provided both will default to text.

Disable instant updating

By default the templatetags will wrap all text nodes with a span element to enable "instant updating", if TEXT_TOOLBAR_INSTANT_UPDATE is set to True. Sometimes this can cause trouble, for instance when you want to have editable texts inside <title> or <meta> elements.

You can disable instant updating on per-node basis by setting the templatetag keyword argument instant_update to False:

<title>{% text "title" "Welcome!" instant_update=False %}</title>

<title>
    {% blocktext "block_title" instant_update=False %}
    Welcome one, welcome all!
    {% endblocktext %}
</title>

Content editing

The toolbar allows you to edit texts directly on your pages if you're signed in as staff and have the permission 'text.change_text' or if you're signed is as a superuser.

Missing text nodes will be added to the database automatically when their template tags are rendered.

Settings

AUTOPOPULATE_TEXT

Default: True

Set to false to disable django-text from adding missing text nodes to the database.

TEXT_TOOLBAR_ENABLED

Default: True

Set to false to disable the toolbar interface.

TEXT_TOOLBAR_FORM_PREFIX

Default: 'djtext_form'

This is passed to the toolbar form and can be changed to avoid name conflicts.

TEXT_TOOLBAR_INSTANT_UPDATE

Default: True

Set to false to disable instant updating of the DOM when saving texts in the toolbar.

TEXT_INLINE_WRAPPER

Default: ('<span data-text-name="{0}" class="{1}">', '</span>')

A tuple of two that gets wrapped around texts in the template to enable instant updating.

TEXT_INLINE_WRAPPER_CLASS

Default: 'dj_text_inline_wrapper'

Change this to change the class of the element that gets wrapped around texts.

Contribution

Contribution is very welcome. Use issues to report bugs and propose features. For pull requests to be accepted they need to be well tested.

Running tests

Install test dependencies.

$ brew install phantomjs
$ pip install -r test-requirements.txt

Run tests.

$ make test

Run tests with coverage.

$ make test-coverage

License

Copyright (c) 2015-2017 Anton Agestam. django-text is released under the MIT license. See the LICENSE file for more information and licenses for bundled code.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].