17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 3656 Views |
-
I don't want WYSIWYG

13 June 2007 at 6:12am
I would like to write my articles in source code mode instead of WYSIWYG. But how to do that? Maybe you answer me "use HTML button in editor", but when I do that, my code is changed after loading to WYSIWYG - for example all national symbols (like "ô","ä","ÄÂ","ľ" etc.) are changed to entities ("aa;culate;" etc.), and some tags then don't work properly...
Can you help me! Many thanks
-
Re: I don't want WYSIWYG

13 June 2007 at 11:13am
In your page class, you will need to remove the HTMLEditorField and add a TextAreaField.
class Page {
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->removeFieldFromTab('Root.Content.Main', 'Content');
$fields->addFieldToTab('Root.Content.Main', new TextareaField('Content'));
}
}See http://doc.silverstripe.com/assets/classes/default/TextAreaField.html for more information on what you can do with the TextareaField.
You should be aware that this will insert whatever you type into the TextareaField straight into your template, without validation. It's fine if you know what you're doing, but if you're handing this over to a non-technical author you'll want to make sure they use the draft site tool!
-
Re: I don't want WYSIWYG

7 July 2007 at 5:24pm
Hi Sam,
Thanks for this! Disabling the WYSIWYG can be quite nice.
As per development-guidelines:removefieldfromtab, this line is needed at the end of the getCMSFields() function:
return $fields;
Otherwise you will get this error:
Fatal error: Call to a member function push() on a non-object in /sites/test.silverstripe.com/elofgren/cms/code/CMSMain.php on line 268Took me a few minutes to figure out why. ;)
New bbcode is nice!
Good night,
Elijah
-
Re: I don't want WYSIWYG

8 July 2007 at 9:41pm
Elijah: Usability applies to programmers, too!
Do you perhaps want to add a check to CMSMain, where it calls getCMSFields(). If $fields returns null, have an error along the lines of
"getCMSFields returned null on a 'Page' object - it should return a FieldSet object. Perhaps you forgot to put a return statement at the end of your method?"
-
Re: I don't want WYSIWYG

9 July 2007 at 1:22pm
Thanks Sam!
------------------------------------------------------------------------
r38115 | elofgren | 2007-07-08 20:21:20 -0500 (Sun, 08 Jul 2007) | 1 lineDisplay a useful error message if getCMSFields() returns null. Thanks Sam: http://www.silverstripe.com/general-discussion/flat/1537?showPost=2042#post2042
------------------------------------------------------------------------ -
Re: I don't want WYSIWYG

24 September 2007 at 5:24am
hi,
i can't seem to get my wysiwyg disabled, i know this is tedious but can anyone please post what files they edited and the exact code they wrote. thanks very much. i hope somebody would be kind enough.
| 3656 Views | ||
|
Page:
1
|
Go to Top |



