{ "info": { "author": "Springload", "author_email": "hello@springload.co.nz", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Internet :: WWW/HTTP :: Site Management", "Topic :: Software Development :: Libraries :: Application Frameworks", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Text Editors :: Word Processors" ], "description": ".. image:: https://travis-ci.org/springload/wagtaildraftail.svg?branch=master\n :target: https://travis-ci.org/springload/wagtaildraftail\n.. image:: https://img.shields.io/pypi/v/wagtaildraftail.svg\n :target: https://pypi.python.org/pypi/wagtaildraftail\n.. image:: https://coveralls.io/repos/github/springload/wagtaildraftail/badge.svg?branch=master\n :target: https://coveralls.io/github/springload/wagtaildraftail?branch=master\n\nwagtaildraftail \ud83d\udc26\ud83d\udcdd\ud83c\udf78\n=======================\n\n Draft.js editor for Wagtail, built upon `Draftail `_ and `draftjs_exporter `_.\n\n**This is alpha software, use at your own risk. Do not use in production (yet).**\n\nCheck out `Awesome Wagtail `_ for more awesome packages and resources from the Wagtail community.\n\nInstallation\n------------\n\nGrab the package from pip with ``pip install wagtaildraftail``, then add ``wagtaildraftail`` as an app in your Django settings.\n\n Note: this package contains compiled (bundled, minified) JavaScript and CSS, it can only be installed directly from pip.\n\nUsage\n-----\n\n There is a basic test site set up in the ``tests`` folder for reference.\n\nWith Pages\n~~~~~~~~~~\n\nFirst, add a Draftail field to some of your pages. Here is an example:\n\n.. code:: python\n\n from wagtaildraftail.fields import DraftailTextField\n\n class MyPage(Page):\n body = DraftailTextField(blank=True)\n\n panels = [\n FieldPanel('body')\n ]\n\nThen, when displaying those fields, use the ``richtext`` filter in the templates.\n\n.. code:: html\n\n {% load wagtailcore_tags %}\n\n {% block content %}\n {{ page.body|richtext }}\n {% endblock %}\n\nWith StreamField\n~~~~~~~~~~~~~~~~\n\nHere is an example using the ready-made block:\n\n.. code:: python\n\n from wagtaildraftail.blocks import DraftailTextBlock\n\n class MyStructBlock(StructBlock):\n body = DraftailTextBlock()\n\nConfiguration\n~~~~~~~~~~~~~\n\nBoth ``DraftailTextField`` and ``DraftailTextBlock`` accept a string as keyword argument ``editor`` for a per field customisation.\n\nWagtail will look for a ``WAGTAILADMIN_RICH_TEXT_EDITORS`` constants in the settings, find the requested editor, load the defined widget and pass the options (if defined) to it.\n\nEach editor defined in ``WAGTAILADMIN_RICH_TEXT_EDITORS`` is a dictionary with 2 keys:, ``WIDGET`` (mandatory) and ``OPTIONS`` (optional).\n\n- ``WIDGET`` is a mandatory string set to the widget to use\n - should always be set to ``wagtaildraftail.widgets.DraftailTextArea`` (or a subclass of it) to work with Draft.js content\n- ``OPTIONS`` is a dictionary which follows the format of `Draftail configuration options `_.\n - Draftail options which are JavaScript values are hydrated at runtime in ``client/wagtaildraftail.js``\n\n**WARNING:** The ``type`` key for ``blockTypes``, ``inlineStyles`` and ``entityTypes`` shouldn\u2019t be changed. It is what defines how content is rendered, and is saved as a JSON blob in the database which would make migrations really painful.\n\n**WARNING:** All the blocks/styles/entities defined in the editor config should have been configured to render properly in the `exporter config <#exporter-configuration>`_.\n\nHere is a sample configuration file. This should live in your Django settings.\n\n.. code:: python\n\n from draftjs_exporter.constants import BLOCK_TYPES, ENTITY_TYPES, INLINE_STYLES\n from draftjs_exporter.defaults import BLOCK_MAP\n\n TERMS_BLOCK_ID = 'TERMS_AND_CONDITIONS_TEXT'\n\n DRAFT_BLOCK_TYPE_H3 = {'label': 'H3', 'type': BLOCK_TYPES.HEADER_THREE}\n DRAFT_BLOCK_TYPE_H4 = {'label': 'H4', 'type': BLOCK_TYPES.HEADER_FOUR}\n DRAFT_BLOCK_TYPE_UL = {'label': 'UL', 'type': BLOCK_TYPES.UNORDERED_LIST_ITEM, 'icon': 'icon-list-ul'}\n DRAFT_BLOCK_TYPE_OL = {'label': 'OL', 'type': BLOCK_TYPES.ORDERED_LIST_ITEM, 'icon': 'icon-list-ol'}\n DRAFT_BLOCK_TYPE_TERMS = {'label': 'T&Cs', 'type': TERMS_BLOCK_ID, 'element': 'div', 'class': 'legals'}\n\n DRAFT_INLINE_STYLE_BOLD = {'label': 'Bold', 'type': INLINE_STYLES.BOLD, 'icon': 'icon-bold'}\n DRAFT_INLINE_STYLE_ITALIC = {'label': 'Italic', 'type': INLINE_STYLES.ITALIC, 'icon': 'icon-italic'}\n\n # It accepts a list of dicts with `label` and `value` keys (e.g. `{'label': 'Full width', 'value': 'fullwidth'}`)\n # or a special `__all__` value which will be intercepted and will load all image formats known to Wagtail.\n DRAFT_IMAGE_FORMATS = '__all__'\n\n DRAFT_ENTITY_TYPE_IMAGE = {\n 'label': 'Image',\n 'type': ENTITY_TYPES.IMAGE,\n 'icon': 'icon-image',\n 'imageFormats': DRAFT_IMAGE_FORMATS,\n 'source': 'ImageSource',\n 'decorator': 'Image',\n }\n DRAFT_ENTITY_TYPE_EMBED = {\n 'label': 'Embed',\n 'type': ENTITY_TYPES.EMBED,\n 'icon': 'icon-media',\n 'source': 'EmbedSource',\n 'decorator': 'Embed',\n }\n DRAFT_ENTITY_TYPE_LINK = {\n 'label': 'Link',\n 'type': ENTITY_TYPES.LINK,\n 'icon': 'icon-link',\n 'source': 'LinkSource',\n 'decorator': 'Link',\n }\n DRAFT_ENTITY_TYPE_DOCUMENT = {\n 'label': 'Document',\n 'type': ENTITY_TYPES.DOCUMENT,\n 'icon': 'icon-doc-full',\n 'source': 'DocumentSource',\n 'decorator': 'Document',\n }\n\n WAGTAILADMIN_RICH_TEXT_EDITORS = {\n 'default_draftail': {\n 'WIDGET': 'wagtaildraftail.widgets.DraftailTextArea',\n 'OPTIONS': {\n 'enableHorizontalRule': True,\n 'enableLineBreak': False,\n 'entityTypes': [\n DRAFT_ENTITY_TYPE_LINK,\n DRAFT_ENTITY_TYPE_DOCUMENT,\n ],\n 'blockTypes': [\n DRAFT_BLOCK_TYPE_H3,\n DRAFT_BLOCK_TYPE_UL,\n ],\n 'inlineStyles': [\n DRAFT_INLINE_STYLE_BOLD,\n DRAFT_INLINE_STYLE_ITALIC,\n ],\n }\n },\n\n 'format_and_link': {\n 'WIDGET': 'wagtaildraftail.widgets.DraftailTextArea',\n 'OPTIONS': {\n 'entityTypes': [\n DRAFT_ENTITY_TYPE_LINK,\n ],\n 'inlineStyles': [\n DRAFT_INLINE_STYLE_BOLD,\n DRAFT_INLINE_STYLE_ITALIC,\n ],\n }\n },\n\n # Wagtail dependencies\n 'default': {\n 'WIDGET': 'wagtail.wagtailadmin.rich_text.HalloRichTextArea'\n },\n\n 'custom': {\n 'WIDGET': 'wagtail.tests.testapp.rich_text.CustomRichTextArea'\n },\n }\n\n DRAFT_EXPORTER_ENTITY_DECORATORS = {\n ENTITY_TYPES.LINK: 'wagtaildraftail.decorators.Link',\n ENTITY_TYPES.DOCUMENT: 'wagtaildraftail.decorators.Document',\n ENTITY_TYPES.IMAGE: 'wagtaildraftail.decorators.Image',\n ENTITY_TYPES.EMBED: 'wagtaildraftail.decorators.Embed',\n ENTITY_TYPES.HORIZONTAL_RULE: 'wagtaildraftail.decorators.HR',\n }\n\n DRAFT_EXPORTER_COMPOSITE_DECORATORS = [\n 'wagtaildraftail.decorators.BR',\n ]\n\n DRAFT_EXPORTER_BLOCK_MAP = dict(BLOCK_MAP, **{\n BLOCK_TYPES.UNORDERED_LIST_ITEM: {\n 'element': 'li',\n 'wrapper': 'ul',\n 'wrapper_props': {'class': 'list-styled'},\n },\n BLOCK_TYPES.ORDERED_LIST_ITEM: {\n 'element': 'li',\n 'wrapper': 'ol',\n 'wrapper_props': {'class': 'list-numbered'},\n },\n TERMS_BLOCK_ID: {\n 'element': 'p',\n 'props': {'class': 'legals'},\n },\n })\n\nCreating new content formats\n----------------------------\n\nTODO\n\nCreating blocks and inline styles\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nTODO\n\nCreating entities\n~~~~~~~~~~~~~~~~~\n\nAn entity basically needs 4 elements:\n\n- a page ``decorator``.\n- an editor ``decorator``.\n- an editor ``source``.\n- an editor ``strategy``.\n\nDecorators define how the content needs to be displayed on the site's pages, as well as within the editor.\n\n- For the pages, they are defined in Python with ``draftjs_exporter``. Refer to the dedicated documentation on `the draftjs_exporter README `_.\n- For the editor, they are defined in JS/React with ``draftail``. Refer to the dedicated documentation on `the Draftail README `_.\n\nSources define the interface (usually a modal) through which the user will select an entity to insert into the editor.\n\nStrategies allow the editor to identify entities when it is loaded. Strategies are optional as the default one works fine in most cases.\n\nBoth sources and strategies are defined in JS/React with ``draftail``. Refer to the dedicated documentation on `the Draftail README `_.\n\nTo register decorators, sources or strategies to ``wagtaildraftail``, use the corresponding register function:\n\n.. code:: javascript\n\n window.wagtailDraftail.registerDecorators({ LinkDecorator, ButtonDecorator });\n window.wagtailDraftail.registerSources({ LinkSource });\n window.wagtailDraftail.registerStrategies({ LinkStrategy });\n\nNote: In order for ``wagtailDraftail`` and its register functions to be available in the global ``window`` namespace, make sure that ``wagtaildraftail`` appears before any other app which will try to register an entity in ``INSTALED_APPS``.\n\n\nDevelopment\n-----------\n\nInstallation\n~~~~~~~~~~~~\n\n Requirements: ``virtualenv``, ``pyenv``, ``twine``\n\n.. code:: sh\n\n git clone git@github.com:springload/wagtaildraftail.git\n cd wagtaildraftail/\n virtualenv .venv\n source ./.venv/bin/activate\n make init\n # Install all tested python versions\n pyenv install 2.7.11 && pyenv install 3.3.6 && pyenv install 3.4.4 && pyenv install 3.5.1\n pyenv global system 2.7.11 3.3.6 3.4.4 3.5.1\n\nCommands\n~~~~~~~~\n\n.. code:: sh\n\n make help # See what commands are available.\n make init # Install dependencies and initialise for development.\n make start # Starts the development server and compilation tools.\n make lint # Lint the project.\n make load-data # Prepares the database for usage.\n make test # Test the project.\n make test-coverage # Run the tests while generating test coverage data.\n make test-ci # Continuous integration test suite.\n make clean-pyc # Remove Python file artifacts.\n make dist # Compile the JS and CSS for release.\n make publish # Publishes a new version to pypi.\n\nDebugging\n~~~~~~~~~\n\nTo get up and running,\n\n.. code:: sh\n\n # Set up the development environment.\n make init\n # Start the development server.\n make start\n # If necessary, start the JS compilation watch\n npm run start\n\nThere are testing and linting tasks available both in the Makefile (Python) and package.json (JS).\n\nUpdating test data\n~~~~~~~~~~~~~~~~~~\n\nHere are useful commands:\n\n.. code:: sh\n\n # Create new migrations from changes to the project.\n python tests/manage.py makemigrations\n # \"Reset\" the database.\n rm db.sqlite3\n # Generate fixtures from DB data. Remember to clean them up so they do not overlap with data from migrations.\n python tests/manage.py dumpdata > tests/fixtures/test_data.json\n\nReleases\n~~~~~~~~\n\n* Make a new branch for the release of the new version.\n* Update the `CHANGELOG `_.\n* Update the version number in ``wagtaildraftail/__init__.py`` and ``package.json``, following semver.\n* Make a PR and squash merge it.\n* Back on master with the PR merged, use ``make publish`` (confirm, and enter your password).\n* Finally, go to GitHub and create a release and a tag for the new version.\n* Done!\n\nDocumentation\n-------------\n\n See the `docs `_ folder", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/springload/wagtaildraftail", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "wagtaildraftail", "package_url": "https://pypi.org/project/wagtaildraftail/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/wagtaildraftail/", "project_urls": { "Homepage": "https://github.com/springload/wagtaildraftail" }, "release_url": "https://pypi.org/project/wagtaildraftail/0.7.0/", "requires_dist": null, "requires_python": "", "summary": "Draft.js editor for Wagtail, built upon Draftail and draftjs_exporter", "version": "0.7.0" }, "last_serial": 4045265, "releases": { "0.1.0": [], "0.2.0": [ { "comment_text": "", "digests": { "md5": "a34e00134dfd456474f6dff3e47eaf60", "sha256": "369a9d7ea7b99b3dbd3d249f494ea10e916322001b769ff98f04b7de058f88af" }, "downloads": -1, "filename": "wagtaildraftail-0.2.0.tar.gz", "has_sig": false, "md5_digest": "a34e00134dfd456474f6dff3e47eaf60", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 269711, "upload_time": "2017-02-27T13:56:41", "url": "https://files.pythonhosted.org/packages/4b/6c/c467717d2182a3bf1ed7b49e4d8babe26a42975ff8da31c231aaf2925d60/wagtaildraftail-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "6f9015ee64cfd03fc10da421ba9abc4f", "sha256": "5e9e58af128bbdac245d44d1fc89c351bd79a0fc11c40d8eb1fd2a62db667cb0" }, "downloads": -1, "filename": "wagtaildraftail-0.2.1.tar.gz", "has_sig": false, "md5_digest": "6f9015ee64cfd03fc10da421ba9abc4f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 269731, "upload_time": "2017-02-27T14:00:51", "url": "https://files.pythonhosted.org/packages/bc/fb/a66629411f0f84c822100da95c65864fc8c0677d8d39cd441b7dbc991342/wagtaildraftail-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "fbf032a761b96211fe1d079dfaafca21", "sha256": "699ed3fae358e14ea046f0e2179f487fa3c7a87761372e363b598cbb048da3e1" }, "downloads": -1, "filename": "wagtaildraftail-0.2.2.tar.gz", "has_sig": false, "md5_digest": "fbf032a761b96211fe1d079dfaafca21", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 264398, "upload_time": "2017-03-12T19:24:09", "url": "https://files.pythonhosted.org/packages/8f/e7/a1938aa6689fc805fcc89c04eb409b19e56dd282c0e04ffc783b6ea10fe5/wagtaildraftail-0.2.2.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "02fbc9ea242c5fe0295a493a71506849", "sha256": "6b67dfe318edd1331d4bfd08e718cfee44a4fed95c2c381fb2b826d45d40732d" }, "downloads": -1, "filename": "wagtaildraftail-0.3.0.tar.gz", "has_sig": false, "md5_digest": "02fbc9ea242c5fe0295a493a71506849", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 264006, "upload_time": "2017-03-20T20:11:08", "url": "https://files.pythonhosted.org/packages/cd/8a/f11517cb93d274cde647e7a86d77db61fa2508a043975aae2a8a4946e814/wagtaildraftail-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "d5bebc37e33f623f1e4f33b2537e3035", "sha256": "a6130035f69cfdaf61b971b67d19eaa6838a35f550bd3c87cbc4a0642b0a96b2" }, "downloads": -1, "filename": "wagtaildraftail-0.4.0.tar.gz", "has_sig": false, "md5_digest": "d5bebc37e33f623f1e4f33b2537e3035", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 246433, "upload_time": "2017-04-05T07:22:25", "url": "https://files.pythonhosted.org/packages/fd/19/c00ec8f8306ddaa104600c13a2e0e52229563b3fc430221b1f91ffef7ae0/wagtaildraftail-0.4.0.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "25e04b13a734de2cffd47360c2858b74", "sha256": "88a4ebf8142517eb141b1b400ab9d6e6adcf28b6c196e6dec9c95781c08a82b5" }, "downloads": -1, "filename": "wagtaildraftail-0.4.1.tar.gz", "has_sig": false, "md5_digest": "25e04b13a734de2cffd47360c2858b74", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 246432, "upload_time": "2017-04-06T02:32:15", "url": "https://files.pythonhosted.org/packages/e3/a1/d3426984ac1193e5e592a6ebc38b199f5df4e8111fbb4e13fa0e79255270/wagtaildraftail-0.4.1.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "07a1e01b03a133209b8dbc4774cb5dc5", "sha256": "c07bc64067b856d96e7725810cf1decbdef8fa9a8ec4e1f224574e5cefd9c82b" }, "downloads": -1, "filename": "wagtaildraftail-0.5.0.tar.gz", "has_sig": false, "md5_digest": "07a1e01b03a133209b8dbc4774cb5dc5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 251405, "upload_time": "2017-04-26T21:26:49", "url": "https://files.pythonhosted.org/packages/21/d8/2ad997bd340f842bb705fc9510436b8134a13dbacb05fdd9ddb9386f9938/wagtaildraftail-0.5.0.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "bda7b1f4e22b923d47a0c5473069492c", "sha256": "b1cab65f907e0b6a3a3ecaed956a3893597297bc4b13e6253fc300883d835624" }, "downloads": -1, "filename": "wagtaildraftail-0.6.0.tar.gz", "has_sig": false, "md5_digest": "bda7b1f4e22b923d47a0c5473069492c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 269354, "upload_time": "2017-04-27T19:38:34", "url": "https://files.pythonhosted.org/packages/ba/18/ed44503a41847b9b72158e09d8bfd0984f9460c365c64614253430a36347/wagtaildraftail-0.6.0.tar.gz" } ], "0.6.1": [ { "comment_text": "", "digests": { "md5": "d9a9f24bc0567e9b421ada74ce7fa29d", "sha256": "e79fd5a34d83cca380a14696bcf25ca5d7d62b635b07c5a69462b4f40472a4d6" }, "downloads": -1, "filename": "wagtaildraftail-0.6.1.tar.gz", "has_sig": false, "md5_digest": "d9a9f24bc0567e9b421ada74ce7fa29d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 269413, "upload_time": "2017-04-27T20:06:52", "url": "https://files.pythonhosted.org/packages/d3/1f/88fc15740f245c9289412ce1bace557d970b1c6b9cbca1b4e685cc3dfff4/wagtaildraftail-0.6.1.tar.gz" } ], "0.6.2": [ { "comment_text": "", "digests": { "md5": "6b774a416a808dab1463738b7d70e1a7", "sha256": "4e39e5636731a59a8349c2f0e524630e308d3528a622864ad07092a65e609a4a" }, "downloads": -1, "filename": "wagtaildraftail-0.6.2.tar.gz", "has_sig": false, "md5_digest": "6b774a416a808dab1463738b7d70e1a7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 269508, "upload_time": "2017-04-27T20:25:39", "url": "https://files.pythonhosted.org/packages/08/1f/9112b39fc57606b2c8e3ed377bcb1c74a4b3681b9b2a90f4cdb69b933be7/wagtaildraftail-0.6.2.tar.gz" } ], "0.6.3": [ { "comment_text": "", "digests": { "md5": "90500e4aafaced91cf1d9d14be9e6e42", "sha256": "4ec03893b95f3b0412ba2cfea240b4c5d5afed3cfcc1dce876b3d406be151de1" }, "downloads": -1, "filename": "wagtaildraftail-0.6.3.tar.gz", "has_sig": false, "md5_digest": "90500e4aafaced91cf1d9d14be9e6e42", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 269543, "upload_time": "2017-05-16T15:30:55", "url": "https://files.pythonhosted.org/packages/f0/8b/77ad0a0031e9c192859bf00531a8b9d24b98be146c2d75b6e10f0341a270/wagtaildraftail-0.6.3.tar.gz" } ], "0.7.0": [ { "comment_text": "", "digests": { "md5": "5f1938979da1b6c6a94fd92573c295d6", "sha256": "1cf12055002e02bf471e60b1fbea37ed07aa4fa4f56e9cd8b11a581464e70e6d" }, "downloads": -1, "filename": "wagtaildraftail-0.7.0.tar.gz", "has_sig": false, "md5_digest": "5f1938979da1b6c6a94fd92573c295d6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 293829, "upload_time": "2017-06-01T23:31:21", "url": "https://files.pythonhosted.org/packages/1d/b9/92fab6f1460eb509cc85ce09f8c4afa60216bdce5db4eae4f16d0be0a000/wagtaildraftail-0.7.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5f1938979da1b6c6a94fd92573c295d6", "sha256": "1cf12055002e02bf471e60b1fbea37ed07aa4fa4f56e9cd8b11a581464e70e6d" }, "downloads": -1, "filename": "wagtaildraftail-0.7.0.tar.gz", "has_sig": false, "md5_digest": "5f1938979da1b6c6a94fd92573c295d6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 293829, "upload_time": "2017-06-01T23:31:21", "url": "https://files.pythonhosted.org/packages/1d/b9/92fab6f1460eb509cc85ce09f8c4afa60216bdce5db4eae4f16d0be0a000/wagtaildraftail-0.7.0.tar.gz" } ] }