Metadata-Version: 2.1
Name: wagtail_word
Version: 1.1.1
Summary: Easily upload your word documents to Wagtail as pages
Home-page: https://github.com/Nigel2392/wagtail_word
Author: Nigel
Author-email: nigel@goodadvice.it
License: GPL-3.0-only
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 4.2
Classifier: Framework :: Wagtail
Classifier: Framework :: Wagtail :: 5
Classifier: Framework :: Wagtail :: 6
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Django>=4.2
Requires-Dist: Wagtail>=4.2
Requires-Dist: python-docx>=1.1.0

wagtail_word
============

A Wagtail module to display Word documents in the frontend.
Converts your word documents to richtext for easy editing in the Wagtail admin.

**Currently supported filetypes:**
- .docx
- .doc

**Currently supported content:**
- Text (Bold, underlines, italic, strikethrough)
   - Text suports colors with allow_styling=True
   - Colors get reset after saving the page in Wagtail admin for a second time.
- Images
- Tables
- Hyperlinks
- Lists
   - All will be converted to bullet points
   - Single level lists only

Quick start
-----------

1. Add 'wagtail_word' to your INSTALLED_APPS setting like this:

   ```
   INSTALLED_APPS = [
   ...,
   'wagtail_word',
   ]
   ```
2. Simply go to your Wagtail Admin.
3. Create a new Word Page.
4. Upload a file in the File field.
5. Save or publish the page and see the magic!

Base Class
-----------
We provide a base class to extend from. This class will provide you a predefined FieldPanel for the File, has the allow_styling attribute and a custom method to set the content to the right field for you to override.

```python
# Example class
class WordDocumentPage(BaseWordDocumentPage):
    template = 'wagtail_word/page.html'

    content = RichTextField(
        blank=True,
        null=True,
        features=[
            # Minimal required features for richtext
            "h1", "h2", "h3", "h4", "h5", "h6", 
            "bold", "italic", "ol", "ul", "link" "image", "embed", 
            "blockquote",
        ]
    )

    edit_panels = [
        FieldPanel('content'),
    ]

    edit_handler = TabbedInterface([
        ObjectList(BaseWordDocumentPage.content_panels, heading=_('Upload')),
        ObjectList(edit_panels, heading=_('Edit')),
        ...
    ])
    
    # Override this method to set the content to the right field
    def set_content(self, content: str):
        self.content = content

```
