Customizing SMF > SMF Coding Discussion
How to Disable wysiwyg manually? Is it possible?
Arantor:
You mean you hacked around it instead of just putting in:
--- Code: ---$modSettings['disable_wysiwyg'] = true;
--- End code ---
before calling the editor?
@Inter: I'm not sure what you're trying to achieve, sounds almost like you just want the switch button that's already implemented?
Inter:
post.template.php
--- Code: --- <script type="text/javascript"><!-- // --><![CDATA[
function previewPost()
{
alert($("#message").val());
return false;
}
// ]]></script>';
--- End code ---
how to get the value if the text is entered using the visual editor?
Arantor:
Well, you can't do it with jQuery like that because it's all stored in an iframe (in raw HTML, I might add). I still don't understand why you need to mess around with the content actually in JavaScript.
If you want to present only bbcode, you can do that just fine.
Inter:
how to switch through js text from html to bb code when submitting a form
Arantor:
You don't do it at form submission time - SMF doesn't. It checks if it was submitted as WYSIWYG and converts it. Relevant code from Post.php:
--- Code: --- if (!empty($_REQUEST['message_mode']) && isset($_REQUEST['message']))
{
require_once($sourcedir . '/Subs-Editor.php');
$_REQUEST['message'] = html_to_bbc($_REQUEST['message']);
// We need to unhtml it now as it gets done shortly.
$_REQUEST['message'] = un_htmlspecialchars($_REQUEST['message']);
// We need this for everything else.
$_POST['message'] = $_REQUEST['message'];
}
--- End code ---
message_mode gets added and set to 1 if it is a WYSIWYG post, and it's pushed into $_POST['message'] only when the submit button is actually pressed.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version