Customizing SMF > SMF Coding Discussion

How to Disable wysiwyg manually? Is it possible?

<< < (3/5) > >>

Inter:
PHP

how to switch the mode of visual editor with java script

artificially push:
click -> BB code
click -> HTML Editor

Arantor:
Use the button specifically provided for that purpose!

SoLoGHoST:

--- Quote from: Arantor on July 29, 2012, 08:19:36 AM ---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?

--- End quote ---

You misunderstand what we are asking and are talking about...  What the question was originally and what I actually did is done via javascript, not through php:  $modSettings['disable_wysiwyg'] = true;

And we are not referring to disabling the WYSIWYG Editor.  The problem is this...

Say, you are allowing for multiple types of coding languages to be edited:  PHP, HTML, and BBC.  Now BBC being one of them, you, ofcourse, would like to show the BBC Buttons, Smilies, and the WYSIWYG Editor, with Toggle View button, when BBC is selected.  But now, if you have BBC Selected, and than you have the Toggle View button pressed down, you have different output (Not Code within the text element), but now say the user changes it from BBC to PHP, or even HTML, with the Toggle View set on Preview mode (HTML), you have to change this yourself, in code, you have to hide the iframe element and view the coding text element.

Hopefully you understand what I'm saying now and why this has to be done via Javascript.

Arantor:
Actually, no, I don't understand why you're making this so complicated.

The editor has functions for this purpose, it's the toggleView function. Check the editor object to see whether its bRichTextEnabled property is true or not (for whether it's in rich editor mode), then call its toggleView function if you need to.

The object is generally called oEditorHandle and is in global scope, of type smcEditor.

But as ever, you know best, I'm sure that's not how you did it.

SoLoGHoST:

--- Quote from: Arantor on July 29, 2012, 09:10:00 AM ---Use the button specifically provided for that purpose!

--- End quote ---

You are referring to the "Toggle View" button, and that is what I am saying, you can provide your own way of doing this, without using that button, via javascript.  And in some instances, you need to do this!  Take the example I provided above...

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version