Comments (7)
👍
from quokka.
👍
Great!
We need to implement that in a way the editor can choose the input format. SO in the Post we need to add a field format and defaults it to DEFAULT_FORMAT settings.
A dropdown in admin Post page will switch format and the editor, so we can support HTML, Creole, Markdown, .rst and also custom formats.
from quokka.
But the channels can have some content as well, right? Are such properties not better part of the object itself (the body) rather than the post? Perhaps as an EmbeddedDocument, as I assume that 'flat' is faster in MongoDB (but I am by no means an expert).
from quokka.
I was thinking in adding content_format in the Post class https://github.com/pythonhub/quokka/blob/master/quokka/modules/posts/models.py#L8
DEFAULT_FORMAT = "html"
FORMAT_CHOICES = ("html", "rst", "creole", "markdown", "latex")
class Post(Content):
body = db.StringField(required=True)
format = db.StringField(choices=FORMAT_CHOICES, default=DEFAULT_FORMAT)
So it would be used directly in template to render the content within a template filter
{{ post.body | format_content(post.format) }}
or maybe we can define content_parser as a method of Post class
{{ post.parsed_body }}
Also for the textarea in Flask-Admin we will need to write a customized widget, which will be lazy (have to check if tinymce supports lazy binding). So inside the admin just switch from available formats and the JS editor changes from tinymce, lepture, creoleeditor etc...
What are the details of implementation you was thinking @jonasteuwen ? having body as an EmbeddedDocument? and inside it {'format': 'html', 'content': '<p>blabla</p>'}
, will it be practical to implement the editor in admin?
from quokka.
BTW: Channels are not meant to have content body only a description to be used is a list of channels, channels are just content aggregates, just like categories or folders. We can add Posts or another contents inside it, so I think we can have it only for Post. What do you think?
For new modules, if the Model needs a "body" and a "format" only need to inherit Post directly, other contents can inherit Content.
from quokka.
A lot of information!
The idea is good, I have yet to get a bit accustomed to channels/posts as the latter have .html extension, which is not my preference (but, different topic!)
It sounds good, but I would prefer if we do not need to define the parser in the template, the template should just get html. If the parser is set in the document, we can already parse out html right?
class Body(db.EmbeddedDocument):
body = ...
parser = ...
def __unicode__(self):
return parsed_body()
Or something similar, as the body should in my opinion consist of: the content, a set of rules on how to read it. Of course, it will look the same in the database so I might be missing something or be too idealistic. The main point is that once you put it in a template, it should be already parsed into html for a browser, or json for the api, etc.
All this aside, we should make sure, we do not do work that would have been done differently if we were to also implement something like createjs.org :-).
from quokka.
Implemented!
from quokka.
Related Issues (20)
- Quokka ScreenShots HOT 6
- How to setup by Using MongoDB docker
- Quokka installation more instructions. HOT 5
- Info about static files HOT 2
- Logout Action in Admin HOT 3
- Guidance and advice, if possible, please... HOT 1
- replace markdown (mistune) with Commonmark
- Quick Start: 'make adduser' throwing exception HOT 3
- jinja2.exceptions.UndefinedError: 'theme' is undefined HOT 1
- Neither pyproject.toml nor flit.ini found, and no other config file path specified HOT 1
- What license is this? HOT 4
- demo site is down? HOT 3
- removing files/modules unused from Quokka project HOT 1
- Cross Site Scripting Vulnerability in Latest Release HOT 1
- XML External Entity (XXE) Vulnerability in Latest Release HOT 1
- TODO: list from quokka/quokka/core/content/models.py HOT 2
- Change version of `dynaconf` in `requirements.txt`
- Small typo in quokka/core/content/views.py
- make adduser fail - AttributeError: module 'mistune' has no attribute 'Renderer' HOT 1
- closed
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quokka.