Customizing SMF > SMF Coding Discussion

Use SMF's WYSIWYG editor

(1/1)

Yoshi:
Okay, I used SCEditor for my project but it didn't feel SMF-ish. So I want to step up to the included, buggy, SMF WYSIWYG, until 2.1 is out with SCEditor.

How can I implement that editor in my modification? Using SMF 2.0.2.

Yoshi:
Nevermind, emanuele coached me through this on IRC :)

Here's my code:
Source:

--- Code: --- // We want the default SMF WYSIWYG editor.
require_once($sourcedir . '/Subs-Editor.php');

// Some settings for it...
$editorOptions = array(
'id' => 'entry_desc',
'value' => '',
'height' => '175px',
'width' => '100%',
// XML preview.
'preview_type' => 2,
);
create_control_richedit($editorOptions);

// Store the ID.
$context['post_box_name'] = $editorOptions['id'];
--- End code ---

Template:

--- Code: --- <div id="bbcBox_message"></div>
<div id="smileyBox_message"></div>
', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'), '
--- End code ---

Arantor:
And when you're re-populating it later with content, IIRC you populate it by taking the content and using un_preparsecode() on it and putting it into $editorOptions['value'] (but it's been a while and I might be wrong... I'd just look at what I did in SimpleDesk, hahaha)

Yoshi:

--- Quote from: Arantor on July 22, 2012, 09:02:10 AM ---And when you're re-populating it later with content, IIRC you populate it by taking the content and using un_preparsecode() on it and putting it into $editorOptions['value'] (but it's been a while and I might be wrong... I'd just look at what I did in SimpleDesk, hahaha)

--- End quote ---
Thanks Arantor, I'll keep that in mind :)

I have yet to rewrite the Editing process, I'm taking care of the adding process at the moment, I'll implement all of your security-like suggestions, then :)

Navigation

[0] Message Index

Go to full version