Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor #9

Closed
sh4nks opened this issue Oct 24, 2013 · 8 comments
Closed

Editor #9

sh4nks opened this issue Oct 24, 2013 · 8 comments

Comments

@sh4nks
Copy link
Member

sh4nks commented Oct 24, 2013

I have played a bit with the javascript editors (TinyMCE, MarkItUp, SCEditor) but I couldn't get familar with any of them.. I want a really simple editor like http://toopay.github.io/bootstrap-markdown. It doesn't needs to be WYSIWYG editor. But I actually have no knowledge in javascript to write one :/

@hbrls
Copy link

hbrls commented Mar 10, 2014

I support the idea that Markdown Only rather than WYSIWYG. I'm a frontend. What can I do for you?

@sh4nks
Copy link
Member Author

sh4nks commented Mar 11, 2014

I would like to have both (bbcode and markdown) options. So the admin can choose when creating the forum which markup language he wants to use. What do you think about that?

@hbrls
Copy link

hbrls commented Mar 11, 2014

I'm blueprinting a forum for tech/geek, so I'd like to force the users to use markdown only. Having options is always better suiting general purpose forums.
But I'm still going nowhere, can not decide which is the best markdown editor. WYSIWYG is so proven. Markdown is relatively new.

@manistal
Copy link
Contributor

I really like SCEditor. In order to pick that up the python side would have to include a bbcode parser as well (since SCEditor doesn't parse BBCode client side). I'm thinking all you'd have to do is update the assets for their CSS/JS, add in the JQuery constructor for the editor, add the data-attribute to the form, and parse the content after POST (bbcode.render_html(self.content.data)) and make sure the escaping is done properly on display.

I'll create a pull request if I get a chance to play with this more, for reference here's the libs I was thinking:

http://www.sceditor.com/documentation/getting-started/
https://pypi.python.org/pypi/bbcode/1.0.19

@sh4nks
Copy link
Member Author

sh4nks commented Dec 12, 2014

Ok, keep me updated on this. :)

@manistal
Copy link
Contributor

Took a quick crack at implementing it, here's what I have so far:

https://github.com/manistal/flaskbb/tree/editor

A couple issues I ran into:
-- Wasn't sure where to stick the JS/CSS includes, looks like most of them are in layout.html which exists once for each theme and the default so I updated all of them
-- Wasn't sure where to stick the JS constructor so I added it to topic.js and added topic.js to any template rendering the text area
-- I couldn't get the icons to center properly on the toolbar, but I suck at CSS, I'm probably missing something simple

Quick notes about the serverside bbcode parsing:
-- The bbcode parser escapes HTML strings that are passed in with the editor content so I removed the |markup out of the Jinja template assuming that everythings coming from the editor (may be a bad assumption?)
-- The bbcode parser might not support all the tags that come on that editor, two options, one is limit the toolbar to only show tags supported by default, or can add the tags as custom tags to the parser (i.e. import the parser into some util and add the tags you and import the modified parser into the forms)

@sh4nks
Copy link
Member Author

sh4nks commented Dec 13, 2014

We are already using a bbcode parser btw (postmarkup) and the markup rendering thing is done here: https://github.com/sh4nks/flaskbb/blob/master/flaskbb/utils/helpers.py#L284-L293

and maybe it would be better to just add the static files (css/js) for the editor to just those files where it is needed :)

-- The bbcode parser might not support all the tags that come on that editor, two options, one is limit the toolbar to only show tags supported by default, or can add the tags as custom tags to the parser (i.e. import the parser into some util and add the tags you and import the modified parser into the forms)

i think removing the tags from the editor is the best idea.

btw, i suck at css and js too, thats way i have never implemented this

@manistal
Copy link
Contributor

Haven't had a chance to clean everything up yet, but thanks for the heads up on the bbcode parser! I didn't even look through the utils like I should've. I'll try and clean everything up and get you a solid branch of the fork to take a look at and decide if you like how the editor fits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants