News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Integrate/Make A Better Editor

Started by SAFAD, January 22, 2010, 05:19:42 AM

Previous topic - Next topic

SAFAD

Hi All
Sorry Guys But I Must Say SMF's RC2 Editor Sux
I Wanna Integrate A Better Editor Like FCK/TinyEditor/HotEditor
And Please I Don't Wanna Wait Till the RC3 Release
Best Regards
Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

SAFAD

OK
I Have Perfectly Integrated TinyMce BUT



I Can't Post What I Made + The Previous Text Box Still THere :(
Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

Nibogo

Did you modify the Post2() function on Post.php??

Because you said:

Quote from: SAFAD on January 22, 2010, 08:26:26 AM
OK
I Have Perfectly Integrated TinyMce

So I think of you make some changes in that function to get the message from the Tinymce editor and not from the SMF Editor

Right?

SAFAD

nope
look
i discovred
if i delete

echo '
', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message');

that message box is gone
but i still coudn't discover what is the ID for the Message Input
Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

Nick Whetstone

#4
For "perfect integration", it seems there is quite a bit of work to be done.
NIBOGO is right in saying you will have to hook up the TinyMCE form with the Post2() function and remove or comment out the references to the old form. You will also, if you want things like Smileys and the BBC buttons, have to look at how the old editor did it and manually add those to the TinyMCE's form template.
The artist formerly known as (Ha)²

Former Support Specialist

Please do not solicit support via PM. Here's why!

Nibogo

Quote from: SAFAD on January 22, 2010, 08:49:43 AM
nope
look
i discovred
if i delete

echo '
', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message');

that message box is gone
but i still coudn't discover what is the ID for the Message Input

You should know what you are doing, I mean do all things isn't easy, you must modify the TinyMCE Editor too to add some BBCodes from SMF and do the same with the smiles, also modify the Post2 function requires some knowledge in PHP. Obviouslly if you make a mistake don't worry you can easily fix it, with the errors you can learn a lot.

Best Regards

Arantor

You know *why* we didn't integrate those other editors?

Two reasons.

1. License. For most of them the license is tricky.

2. Security. Both TinyMCE and FCKeditor had major exploits discovered in the holiday season. By not using them, it's not a vulnerability in SMF as a whole.
Holder of controversial views, all of which my own.


SAFAD

Ok Guys I Should Make A Vert Big Banner "PHP Developer,Thank YOu For Not MissUnderstand"
Arnator
I Don't Know But All My Ideas Has A Wrong Side For YOu :d
Ok Ok I Won't Integrate It
But Where Can I Find The JS File That Is The *Core* Of The Editor
Its Really Bad
Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

Windy

What is it that you find so bad about smf's WYSIWYG editor?

The js file is editor.js btw.
All unsolicited PM's will be ignored.  Any support requests should go in their topics.

My Mods


Image Zoom Tag
Image Quote Removal
Color Picker
Additional Polls
Simple Awards System

Mods are only updated to the latest same major version of smf on request.

SAFAD

Everything
Especially BBCode
He Parse It Very Badly
Really Badly
WHy Should He Make A BBcode For Each Line Till He Can Make A One From Start
And If There Is A /Size Tag
Wow It Destroys Everything
Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

Nibogo

Well as you know SMF 2.0 isn't ready yet, if you are using SMF 2.0 RC2 you should know that you can find bugs with your SMF. If you want a totally stable forum you should try SMF 1.1.11 instead of 2.0. I know of there are some bugs with the WYSIWYG Editor but the Developers are fixing this bugs for thw next release.

Pegasys

I'm a little late to the party, I know...  but I'd like to go on record as agreeing that the new SMF editor is not all that I had hoped for.

I wouldn't say that it "sux"... because it does work without any errors (that I have noticed) and does what it was designed to do. In BBCode mode, it appears to me to be absolutely "bullet proof". Fast, error free... and easy to use. And very simple to add new BBC tags & features. Very well designed.


But the "whizzy-wig" mode doesn't really work for me.  Well, I mean it works... but not as I wish it would.

I believe it works well for what it was designed to do. It allows message posters to see what their text will look like with the formatting. But as an html editor, it does not really measure up to other javascript-based editors... like FCKeditor... to name the one I'm most familiar with.

Normally, I do not think most forum owners want users to have access to a full html editor for messages. BBCode is safe and controlled by the forum software. Very low risk of exploits or mis-use.  Html... not so much.

But some forum owners might want a more powerful html editor. And it would be nice if there was an option to use one.


I my case, I use the SMF Articles and Downloads System mods... which both use the (Subs-editor.php) routines that the forum uses  for adding & editing articles or download descriptions, etc.  In both of these mods, it would be a God-send to be able to cut html formatted text from an html document and paste it right into the editor.  With the current SMF editor in whizzy-wig mode, that doesn't work very well. Links get broken, end tags get lost or positioned incorrectly, etc...  You usually end up with a jumbled mess. And switching between the BBCode and whizzy-wig modes, usually makes it even worse.

However, if you modify the Subs-editor.php file to use the FCKeditor script instead of the SMF provided editor.js, it all works flawlessly. With one exception. After the initial load of the editor, subsequent uses of the editor do not display any editor buttons. I believe I read earlier in this topic that may be related to the need to create a new post template file... or modify the existing one.  I haven't gotten that far yet.... and hope its not too complicated of a process.


I understand where SMF would  not want to rely on a 3rd party product that may have licensing issues and/or potential issues with exploits or other complications. That's just smart... especially for a part of the forum software (composing messages) that is the heart & soul of the program.

But... it might be worth consideration to have one of the on-staff & skilled mod writers (Arantor?) create an installable mod that would allow forum owners to easily change the editor script that is used in the admin panel. Of course, the mod itself would not provide any script; it would by default point to the default SMF script.  But the forum owner, at their own risk and licensing obligations, etc... could install a different script, like FCKeditor... and change the setting in the Admin panel to use it instead of the SMF default script.

Having such a mod available could potentially eliminate any complaints about issues or limitations of the default SMF editor. Anytime someone complains, you just post a link to the mod and become their hero.  SMF gets expanded functionality... without assuming any additional responsibility or liability.  A Win-Win... I would think.


* However, if that is not possible, perhaps a little instruction or tutorial on what needs to be done to make the proper changes ourselves?   ;)




Orstio

If you have TinyMCE already showing up in SMF, that's half the battle.  It takes about ten minutes to set this up if you know what you're doing, so don't listen to all the people saying how it's so much work.  :-\

Make sure to turn off the BBCode buttons and the smileys.

Go into Post.php, and find this line:

if (!empty($_REQUEST['message_mode']) && isset($_REQUEST['message']))

Change it to this:

if (isset($_POST['message']))

You'll also need to make the same change in PersonalMessage.php.

Pegasys

And that said... I must now recant much of what I just posted above.

In evaluating the SMF default wysiwyg editor mode for the ability to copy html from an existing html document and paste it directly into the editor, I had overlooked one important aspect of the process. That being the quality of the source html.

Where most browsers will sort through poorly structured html code and display it properly,  the SMF editor javascript will not. FCKeditor apparently does a better job of interpreting & displaying bad html code... but the SMF editor will display pasted html code just fine if that code is structured properly.


The only problem I am seeing now is that any center formatting in the html gets lost when you switch to the BBCode mode.


* I frequently cut & paste displayed text from html readme files for various downloads I provide. Being cheap & lazy, I was using a freebie WYSIWYG html editor named Trillian Webpage.  Very fast & easy to use... but if you look at the resulting html code it generates, it looks like a bunch of ticked off gorillas got in there and tossed everything around.

I just ran the same html readme documents through a better freebie, named Kompozer... and it cleaned up the html code and produced a much more compliant document. And when the resulting displayed text is cut & pasted into the SMF WYSIWYG editor, it  displays perfectly. All formating & links intact.


I guess that old "garbage in... garbage out..." adage applies.  So from my perspective, the only remaining issue is the loss of any center formatting when switching between WYSIWYG to BBCode mode. In this case, that formatting is applied with paragraphs...

eg...   <p align="center">

...which is how WYSIWYG editors commonly apply left,right & center formatting.  There is no comparable BBCode paragraph tag... so I assume that why the formatting is lost. A minor detail... but it would be nice if there was a way around it. But then, there are many ways that html can center text and objects and that might be a tad hard to code into the BBCode parser.


**  Thanks for the info, Orstio. I saw your message as I went to post this one. I'll be sure to give that a try.   ;)





Orstio

Quote**  Thanks for the info, Orstio. I saw your message as I went to post this one. I'll be sure to give that a try.   

Let me know how it goes.  I've had TinyMCE running in SMF since 2.0 RC1.

Also, once you have posts showing up, I'll pass you my copy of the TinyMCE BBC plugin.  I modified it to work better with SMF, as it's actually designed for PunBB.

Pegasys

Quote from: Orstio on April 17, 2010, 01:08:38 PM
If you have TinyMCE already showing up in SMF, that's half the battle.


In my case, I'm using FCKeditor because that installed with PortalMX... and it seems to work very well.

To get the SMF editor to use the FCKeditor script, I only had to change one line in the Subs-editor.php to point to the other javascript:

Find:
<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/editor.js?rc3"></script>

Replace with:
<script type="text/javascript" src="http://www.mydomain/forum/fckeditor/fckeditor.js?"></script>

... making sure that the path points to where your other javascript is installed.


That worked fine... except for the no editor buttons issue I mentioned earlier.


Orstio

Quote from: Ha² on January 22, 2010, 09:13:24 AM
For "perfect integration", it seems there is quite a bit of work to be done.
NIBOGO is right in saying you will have to hook up the TinyMCE form with the Post2() function and remove or comment out the references to the old form. You will also, if you want things like Smileys and the BBC buttons, have to look at how the old editor did it and manually add those to the TinyMCE's form template.

This is not even remotely close to being true, for the record.  TinyMCE plugs directly into any textarea tag.  No code modification necessary to get the TinyMCE form to display other than a script tag in the site header.  No removing or commenting out the form, you use the same form, with the same textarea.

Orstio

Have you tried turning off the WYSIWYG editor in the SMF admin panel?

Orstio

#18
Quote from: Arantor on January 22, 2010, 10:52:33 AM
You know *why* we didn't integrate those other editors?

Two reasons.

1. License. For most of them the license is tricky.


Also not true.  TinyMCE is distributed under the LGPL, which allows for it to be incorporated into any software, regardless of that software's license.  FCKEditor is available under the LGPL and MPL licenses as well, so no conflicts there either.

Seems more a case of license-ignorance than license-incompatibility.  Nothing tricky about it.

Quote2. Security. Both TinyMCE and FCKeditor had major exploits discovered in the holiday season. By not using them, it's not a vulnerability in SMF as a whole.

And?  SMF had 45 vulnerabilities made public BEFORE the holiday season, and they were only patched last month (~3 months after becoming public).  This fact alone destroys the credibility of SMF not including third party scripts due to "security".   If SMF took security seriously, those issues would have been patched within a few weeks.  Using "security" as an excuse for not including third party scripts when security is taken so lightly by SMF makes that statement laughable.

In addition, I can't find a single shred of evidence to support that FCKEditor had any security issues reported anywhere - care to back that up with something substantial?  As for TinyMCE, what was going around on Twitter at that time was nothing but FUD:  http://tinymce.moxiecode.com/punbb/viewtopic.php?id=20207

Pegasys

It seems that the browser that you copy your html from may be a factor here.

Loading the same html document into both Firefox & Chrome, the text copied from Firefox displays well after being pasted into the SMF WYSIWYG editor. But the same text copied from Chrome... does not. Lots of redundant, unused end tags.

Oddly, I pasted both into a separate html editor... and they are virtually the same as far as I can tell.

Advertisement: