{"id":16135295,"url":"https://github.com/xnuinside/sanic-quill","last_synced_at":"2025-04-06T16:18:15.833Z","repository":{"id":116643698,"uuid":"266218006","full_name":"xnuinside/sanic-quill","owner":"xnuinside","description":"Sanic-quill is a port of Flask-quill (python widget for Quill.js WYSIWYG-editor)","archived":false,"fork":false,"pushed_at":"2020-05-22T22:18:06.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-12T22:17:39.557Z","etag":null,"topics":["fullstack-python","python-wysiwyg","python3","quill-editor","quilljs","sanic","sanic-framework","wysiwyg","wysiwyg-editor"],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xnuinside.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-22T22:17:34.000Z","updated_at":"2020-05-22T22:33:06.000Z","dependencies_parsed_at":"2023-03-13T12:57:03.589Z","dependency_job_id":null,"html_url":"https://github.com/xnuinside/sanic-quill","commit_stats":{"total_commits":1,"total_committers":1,"mean_commits":1.0,"dds":0.0,"last_synced_commit":"7f82b141de0dd87152e8188859e679cc590a3b6f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnuinside%2Fsanic-quill","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnuinside%2Fsanic-quill/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnuinside%2Fsanic-quill/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnuinside%2Fsanic-quill/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xnuinside","download_url":"https://codeload.github.com/xnuinside/sanic-quill/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247509241,"owners_count":20950232,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fullstack-python","python-wysiwyg","python3","quill-editor","quilljs","sanic","sanic-framework","wysiwyg","wysiwyg-editor"],"created_at":"2024-10-09T23:06:50.420Z","updated_at":"2025-04-06T16:18:15.813Z","avatar_url":"https://github.com/xnuinside.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"sanic-quill\n-----------\n\nSanic-quill is a port of Flask-quill (https://github.com/drewdru/flask-quill/) to Sanic ecosystem. (wtforms widget for quill.js editor (https://github.com/quilljs/quill))\n\nQuill.js is a modern WYSIWYG editor built for compatibility and extensibility.\n\n\n\nTo add routes with edit form:\n\nfrom sanic_quill import add_editor\n\neditor will be able on the route /edit\n\nHow to use\n----------\n\nCheck sample in 'examples'.\n\n\nTo add  WYSIWYG editor to edit any data/fields you need to define 2 methods:\n\n- get_data (used by editor to get information for model to edit in form)\n- save_data (used by editor to save changes from the form)\n\nEditor expect 3 fields in data:\n\n    -  'title',\n    -  'body',\n    -  'preview'\n\n.. code-block:: python\n\n\n\n    from sanic_quill import add_editor\n\n    ...\n\n    # your Sanic app code\n    # with defining app = Sanic()\n\n    ...\n\n    def get_data(_id):\n        \"\"\" this method defines logic to send to 'edit' form data of the object \"\"\"\n        for post in posts:\n            if post['id'] == _id:\n                post['title'] = post['title']\n                post['content'] = post['text']\n                post['preview'] = post['preview']\n                return post\n\n\n    def save_data(_id, data):\n        \"\"\"\n            this method defines logic to save data from 'edit' form\n\n            data comes like a dict with: content, content_preview and title fields,\n            you need map it to your structure\n        \"\"\"\n        for num, post in enumerate(posts):\n            if post['id'] == _id:\n                print('Update post')\n                post['title'] = data['title']\n                post['text'] = data['content']\n                post['description'] = data['preview']\n                break\n\n    add_editor(app, get_data, save_data)\n\nAfter that you will have routes '/edit?'id=$id_of_your_data_item_to_edit\n\nAlso you can define a path where to save an images and route that will be used to serve uploaded images by default it is '/img':\n\n.. code-block:: python\n\n    add_editor(app, get_data, save_data, img_folder=\"/path/for/images\", route_for_img='/custom_route')\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxnuinside%2Fsanic-quill","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxnuinside%2Fsanic-quill","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxnuinside%2Fsanic-quill/lists"}