Customizing SMF > SMF Coding Discussion

How to Disable wysiwyg manually? Is it possible?

(1/5) > >>

SoLoGHoST:
Ok, I know that this is a built in prototype, but am wanting to manually disable this upon a different click (Not the Toggle View button).  Looking in editor.js, I am seeing this:


--- Code: ---// Toggle wysiwyg/normal mode.
smc_Editor.prototype.toggleView = function(bView)
{
if (!this.bRichTextPossible)
{
alert(oEditorStrings['wont_work']);
return false;
}

// Overriding or alternating?
if (typeof(bView) == 'undefined')
bView = !this.bRichTextEnabled;

this.requestParsedMessage(bView);

return true;
}
--- End code ---

The smc_Editor, obtains the handle of this:  oEditorHandle_body

Is there anyway I can use this to call the toggleView function and turn wysiwyg off?  Perhaps in javascript?  Just want to turn it off on the page that it is on (for a page that I created), if I select a different option on that page.  Ofcourse, would help if I am able to tell if it is even on.  In any case, turning it off and switching the text to the way it is without the wysiwyg editor on, would be most helpful.

I am still needing the wysiwyg editor to be available, but just need to switch it off when another button is clicked on, if you know what I mean.

Cheers :)

SoLoGHoST:
Nevermind, got it all figured out!  Topic Solved!

Inter:
how you did it?

SoLoGHoST:
It was tricky... You see the WYSIWYG Editor, when turned on, is actually hiding the bbc code typing element and displaying another element in its place.  So, all you need to do is just display: "" to show it, and display: "none" to hide it.  Ofcourse, you'll want to use Javascript for this instead.  It was actually a bit tricky, but through trial and error, I got a FULL BULLET-PROOF way of doing this.  But I already implemented this into the Dream Pages section of Dream Portal 1.1.  So, if you want, you can see how I do it in there, exactly, if you really want to understand it.  Or you could just inspect the Element and see the changes it makes when you click on it (in almost any browser).

Inter:
I need to when you click on the button prior Prosmot button or send a text if you typed in the visual editor, he switched to a simple form bb code  :)

Navigation

[0] Message Index

[#] Next page

Go to full version