WYSIWYG Editor for Phorum (edit: CKEditor spamvertisement)

Posted by klgordon 
Re: WYSIWYG Editor for Phorum (edit: CKEditor spamvertisement)
October 14, 2010 06:44AM
Quote
Maurice Makaay
No, that is not an option. The stripping is done by first formatting the message into HTML and then stripping the HTML from the resulting message. So all HTML is removed in the end.
Yes, one thing I notice is that while quoting the line breaks are getting stripped off, for "previously not-ckeditor formatted text. But that is a problem I can manage I think (and is mostly a ck editor related issue, I assume).

Quote
Maurice Makaay
Quote
Sreenadh OG
Now whether I use CK Editor or BBCode for formatting it is appearing correctly in the forum. Mostly it is working the way I want itself - and that is why I am wondering what you mean by "That is not an option" etc. (Anyway the outgoing mails are stripped-off of both BBCode and HTML. If you are talking about that only then sorry for the misunderstanding)

That's what I'm talking about. You requested info about stripping only the BBcode and I responded that there is no option available for that.
Got it. Thanks.
Regards,
Sreenadh
Re: WYSIWYG Editor for Phorum (edit: CKEditor spamvertisement)
October 14, 2010 07:42AM
Quote
Sreenadh OG
Yes, one thing I notice is that while quoting the line breaks are getting stripped off, for "previously not-ckeditor formatted text. But that is a problem I can manage I think (and is mostly a ck editor related issue, I assume).

What I think is that the issue here is that, from the perspective of HTML, there are no line breaks in the formatting. There are newlines in there, but for HTML that counts as a whitespace. In HTML, you need real <br/> tags for getting the line breaks in there. Since you put the text in the wysiwyg HTML editor, that editor will see
> some comment
> that is quoted in
> a message
as
> some comment > that is quoted in > a message
To get this fixed, the quoting needs to be fed to the editor as
> some comment<br/>
> that is quoted in<br/>
> a message<br/>

One approach that could work, is to run Phorum's message formatting on a message that is prepared for a new editing session. That will turn the message data into HTML. That would also convert the [quote] code to HTML. If after that the generated HTML code is fed to the editor, things will work, since the data is HTML as expected by that editor. Doing a Phorum formatting call in the preparation of a new editor is probably the most clean way to get things to work, since that will take care of handling any data that is created in the prepare phase.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: WYSIWYG Editor for Phorum (edit: CKEditor spamvertisement)
October 14, 2010 08:01AM
Quote
Maurice Makaay
One approach that could work, is to run Phorum's message formatting on a message that is prepared for a new editing session. That will turn the message data into HTML. That would also convert the [quote] code to HTML. If after that the generated HTML code is fed to the editor, things will work, since the data is HTML as expected by that editor. Doing a Phorum formatting call in the preparation of a new editor is probably the most clean way to get things to work, since that will take care of handling any data that is created in the prepare phase.
Can you please provide the syntax for making such a call please. Then I will include that call just "before" passing the data to CK Editor in postings.tpl.
Regards,
Sreenadh
Re: WYSIWYG Editor for Phorum (edit: CKEditor spamvertisement)
October 14, 2010 08:09AM
Are you asking for syntax or for a full solution? I can give you the syntax for the formatting, but that you can find in the read.php script. Only the syntax would not be enough though. This is not an issue to solve with a simple template hack. It's an issue to solve with a module. Trying to explain how that would work probably requires me to write the module, since you don't seem the programming type that can handle the task on its own.

Okay, here we go. Syntax:
include_once './include/format_function.php';
$formatted = phorum_format_messages($unformatted);


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: WYSIWYG Editor for Phorum (edit: CKEditor spamvertisement)
October 14, 2010 08:33AM
Quote
Maurice Makaay
you don't seem the programming type.
You are right. :(
Re: WYSIWYG Editor for Phorum (edit: CKEditor spamvertisement)
October 14, 2010 09:57AM
Try this single file module. It might just work. Simply drop it in your Phorum's mods folder and enable "Prepare editor data as HTML" in the modules screen.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Attachments:
open | download - mod_prepare_editor_data_as_html.php (1.3 KB)
Re: WYSIWYG Editor for Phorum (edit: CKEditor spamvertisement)
October 14, 2010 11:26PM
Quote
Maurice Makaay
Try this single file module. It might just work. Simply drop it in your Phorum's mods folder and enable "Prepare editor data as HTML" in the modules screen.

Perfect! Thanks!

There was still a minor problem when [quote] gets converted into <blockquote> that it was difficult to identify the ending of the block in CK Editor. For me I resolved this issue by enabling "config.startupOutlineBlocks = true" in CK Editor Config.js file. Now the text becomes well formatted even for the previously non-ckeditor edited data and also the quote blocks are becoming properly highlighted. :) Thanks.

A screen shot attached.

Thanks and Regards,
Sreenadh
Attachments:
open | download - WYSIWYG Editor.JPG (160.6 KB)
Re: WYSIWYG Editor for Phorum (edit: CKEditor spamvertisement)
October 15, 2010 03:06AM
Hi Maurice Makaay,
Now I have a new problem (possibly caused by the above fix itself). Now every time I 'Edit' and update a message unnecessory <br> tags are getting inserted into the messages.
That means for example if a messages was -

hi
hi

Then after 3-4 edits and saves it will look like




hi




hi



This was not intended/expected to happen. :( May be this happens because with every message/edit save the carriage returns are getting replaced by <br> tags I think. Please comment.

Instead of turning off this module, I would prefer to use it, because it helps in converting bbcode tags into html which might be an advantage in sending out html mails as well. The point is if there is already a <br> then I don't want an extra <br> to get inserted which possibly happens with every message edit.

Thanks and regards for the help provided,
Sreenadh



Edited 1 time(s). Last edit at 10/15/2010 03:13AM by Sreenadh OG.
Re: WYSIWYG Editor for Phorum (edit: CKEditor spamvertisement)
October 15, 2010 03:13AM
It happens because at every editor start, the HTML formatting is applied to the message. However, on edit this is not necessary, since the formatting was already taken care of at post time.

Try the updated module.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: WYSIWYG Editor for Phorum (edit: CKEditor spamvertisement)
October 15, 2010 03:16AM
Wow! That was an instantaneous reply! Thanks!
Sorry, only registered users may post in this forum.

Click here to login