Call-back icon  Sales: Call 877.832.5289 (N America)|310.295.4144 (International)

Magento

eCommerce Software for Online Growth

Magento Forum

   
WYSIWYG for CMS
 
Andreas von Studnitz
Jr. Member
 
Avatar
Total Posts:  29
Joined:  2008-05-07
Aachen, Germany
 
norbolig - 25 July 2008 03:03 AM

Thanks a lot Andreas. I will try it as soon as ver. 1.1 is released.

1.1.1 is released grin even before your post.

Andreas

 Signature 

team in medias GmbH
Aachen, Hamburg

 
Magento Community Magento Community
Magento Community
Magento Community
 
charvan
Jr. Member
 
Total Posts:  8
Joined:  2007-11-01
 

Released, yes.

Upgraded, yes.

Problem with tiny_MCE resolved, no.

PHP.ini file fun added to the mix, yup!

I have gone through all the suggested fixes to get it running in the CMS to no avail.  Anybody?  Anything?  Please help?

UPDATE:  Thank you @focusnet!!  Your solution seems to work, even if a little buggy.  Might be enough to get by until the Magento Team comes up with a workaround.

 
Magento Community Magento Community
Magento Community
Magento Community
 
mikaelohren
Jr. Member
 
Total Posts:  5
Joined:  2008-07-28
 

I tried the solution on the Wiki for tiny mce but it does not work. The page loads, it seems like, and then turns blank.

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikosrf
Member
 
Avatar
Total Posts:  35
Joined:  2008-03-31
Thessaloniki | Greece
 
Andreas von Studnitz - 25 July 2008 04:09 AM

Hi Indian Dude,

I got that running now too.

This is my code in /magento/lib/Varien/Data/Form/Element/Editor.php starting from line 45:


public function getElementHtml()
    
{
        
if( $this->getWysiwyg() === true )
        
{
            $element 
= ($this->getState() == 'html') ? '' $this->getHtmlId();

            
$html '
                <textarea name="'
.$this->getName().'" title="'.$this->getTitle().'" id="'.$this->getHtmlId().'" class="textarea '.$this->getClass().'" '.$this->serialize($this->getHtmlAttributes()).' >'.$this->getEscapedValue().'</textarea>
<script language="javascript" type="text/javascript" src="/js/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
Event.observe(window, \'
load\', function() {
    tinyMCE.init({
        mode : "exact",
        theme : "advanced",
        elements : "'
.$this->getHtmlId().'",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_path_location : "bottom",
        extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
        theme_advanced_resize_horizontal : "true",
        theme_advanced_resizing : "true",
        apply_source_formatting : "true",
        convert_urls : "false",
        force_br_newlines : "true",
        doctype : \'
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\'
    });  
});

</script>'
;

            
$html.= $this->getAfterElementHtml();
            return 
$html;
        
}
        
else
        
{
            
return parent::getElementHtml();
        
}
    }
[
...]

Be sure to check the path of your js file: /js/tiny_mce/tiny_mce.js in my example.

Additionally, you have to set “wysiwyg=true” in /magento/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Main.php:


$fieldset->addField('content''editor', array(
            
'name'      => 'content',
            
'label'     => Mage::helper('cms')->__('Content'),
            
'title'     => Mage::helper('cms')->__('Content'),
            
'style'     => 'width:98%; height:600px;',
            
'wysiwyg'   => true,
            
'required'  => true,
        ));

This works for me now. If it doesn’t work for you, please check the output of the Firefox Error Console which gives you hints about Javascript errors.
I’ll gonna add that to the wiki.

HTH,
Andreas

P.S: I think the WYSIWYG Editor is an important feature and should be added to the next release, if possible.

I did all the previous and the page on CMS is loading and then gets blank
I got these error messages in Firefox (see attached image)

Image Attachments
Picture 7.jpg
 
Magento Community Magento Community
Magento Community
Magento Community
 
ijeweb
Jr. Member
 
Avatar
Total Posts:  21
Joined:  2008-05-29
 

Hi,

After trying to enable WYSIWYG (tinyMCE) and going through all the errors mentioned in this board I managed to get it working and I post here the solution. Someone might have changed the wiki with what seems to have worked for them - but I don’t think that’s the right solution for everyone so here I post my findings.

It’s a combination of solutions given around this board - and credits go to Dan, focusnet and winzippy

in the editor.php file (lib/Varien/Data/Form/Element) I inserted this code:

public function getElementHtml()
    {
        
if( $this->getWysiwyg(=== true )
        
{
            $element 
= ($this->getState() == 'html') ? '' $this->getHtmlId();

            
$html '<textarea name="'.$this->getName().'" title="'.$this->getTitle().'" id="'.$this->getHtmlId().'" class="textarea '.$this->getClass().'" '.$this->serialize($this->getHtmlAttributes()).' >'.$this->getEscapedValue().'</textarea>
                <script language="javascript" type="text/javascript" src="/js/tiny_mce/tiny_mce.js"></script>
                <script language="javascript" type="text/javascript">
                    tinyMCE.init({
strict_loading_mode : "true",                                                                        
                        mode : "exact",
                        theme : "advanced",
                        elements : "' 
$element '",
                        theme_advanced_toolbar_location : "top",
                        theme_advanced_toolbar_align : "left",
                        theme_advanced_path_location : "bottom",
                        extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
                        theme_advanced_resize_horizontal : "false",
                        theme_advanced_resizing : "false",
                        apply_source_formatting : "true",
                        convert_urls : "true",
                        force_br_newlines : "true",
                        doctype : \'
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\'
                    });
                </script>'

            
$html.= $this->getAfterElementHtml();
            return 
$html;
        
}
        
else
        
{
            
return parent::getElementHtml();
        
}
    }

That function should start @ around line 49 already, just replace it.

in main.php (app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/) I inserted this code:

$fieldset->addField('content''editor', array(
            
'strict_loading_mode' => false,
            
'name' => 'content',
            
'label' => __('Content'),
            
'title' => __('Content'),
            
'style' => 'width: 98%; height: 600px;',
            
'wysiwyg' => true,
            
'required' => true,
            
'theme' => 'advanced',
        ));

In edit.phtml (app/design/adminhtml/default/default/template/catalog/product) I inserted this code:

<script language="javascript" type="text/javascript" src="/js/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
Event.observe(window'load', function() {
    tinyMCE
.init({
        strict_loading_mode 
"true",
        
mode "exact",
        
theme "advanced",
        
elements "description,short_description",
        
theme_advanced_toolbar_location "top",
        
theme_advanced_toolbar_align "left",
        
theme_advanced_path_location "bottom",
        
extended_valid_elements "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
        
theme_advanced_resize_horizontal "true",
        
theme_advanced_resizing "true",
        
apply_source_formatting "true",
        
convert_urls "false",
       
force_br_newlines "true",
        
doctype '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
    
});  
});

</script>

The last problem I experienced was the blank grey area - solved by strict_loading_mode : “true”, you may need to play around with this option if you get that grey area.

BTW, I’m using the version of tinyMCE that was originally shipped with Magento - and using Magento 1.1.1 - and I’ve applied these same settings in 3 different servers and 3 different Magento instances and it has worked perfectly wink

Hope this helps anyone,

 
Magento Community Magento Community
Magento Community
Magento Community
 
rubikintegration
Jr. Member
 
Total Posts:  5
Joined:  2008-07-13
 

Thank you for the code. All things work fine on IE7, FF3 has the grey area thing you mention and the editor doesnt seem to load up completely for some reason. Weird.

 
Magento Community Magento Community
Magento Community
Magento Community
 
ijeweb
Jr. Member
 
Avatar
Total Posts:  21
Joined:  2008-05-29
 

Hi, I’m actually using FF3 and I experienced a bit of of the grey area problem. But that was only after trying to see the changes in the edit page by simply reloading it - what I did was to refresh using ctrl+F5 and/or closing the ‘Edit page’ and going back in, as it seems like something stays in the cache that produces the grey area - once I did that everything started working properly and has never happened again.

good luck!

 
Magento Community Magento Community
Magento Community
Magento Community
 
SwiftCol
Member
 
Total Posts:  75
Joined:  2008-05-22
 
rubikintegration - 05 August 2008 11:44 AM

Thank you for the code. All things work fine on IE7, FF3 has the grey area thing you mention and the editor doesnt seem to load up completely for some reason. Weird.

Rubik, check out this reply earlier in the thread. I have added this line to the Wiki as well so that people don’t have to dig through the forums to find this fix.

 
Magento Community Magento Community
Magento Community
Magento Community
 
[m] zentrale
Guru
 
Avatar
Total Posts:  400
Joined:  2007-12-06
Stuttgart, Germany
 

Hi Guys,

i cant get editor shown up in 1.1.2. I set:

$fieldset->addField('content''editor', array(
            
'name'      => 'content',
            
'label'     => Mage::helper('cms')->__('Content'),
            
'title'     => Mage::helper('cms')->__('Content'),
            
'style'     => 'width: 98%; height: 600px;',
            
'wysiwyg'   => true,
            
'required'  => true,
            
'theme' => 'advanced',
            
        ));

now, if i debug Varien_Data_Form_Element_Editor and print $this->getWysiwyg() there is no output. I also printed the attributes array in constructor. This is the result:

Array ( [name] => content [label] => Inhalt [title] => Inhalt [style] => width:98%; height:600px[wysiwyg] => [required] => ) Array ( [name] => layout_update_xml [label] => XML für Layoutänderung [style] => width:98%; height:300px; ) Array ( [name] => meta_keywords [label] => Schlüsselwörter [title] => Meta Keywords [style] => width520px; ) Array ( [name] => meta_description [label] => Beschreibung [title] => Meta Beschreibung [style] => width520px; )

You see, [wysiwyg] => is empty also if i define a string instead of bool. Theme is also not available?

Any help?

Cheers

Stefan

 Signature 

Account-User: S. Bothner & A. Jaus
[m] zentrale | InternetAgentur Stuttgart & München
Agentur für Beratung, Entwicklung & Marketing.
Magento™ Silver Partner & Community Pro Member
----
Ich habe Visionen - muss ich jetzt zum Arzt?

 
Magento Community Magento Community
Magento Community
Magento Community
 
[m] zentrale
Guru
 
Avatar
Total Posts:  400
Joined:  2007-12-06
Stuttgart, Germany
 

OMG!

i worked with the wrong file, i changed data in Mage_Adminhtml_Block_Cms_Block_Edit_Form instead of Mage_Adminhtml_Block_Cms_Page_Edit_Tab_Main! Grr. sorry smile

Cheers

Stefan

 Signature 

Account-User: S. Bothner & A. Jaus
[m] zentrale | InternetAgentur Stuttgart & München
Agentur für Beratung, Entwicklung & Marketing.
Magento™ Silver Partner & Community Pro Member
----
Ich habe Visionen - muss ich jetzt zum Arzt?

 
Magento Community Magento Community
Magento Community
Magento Community
 
andreladocruz
Sr. Member
 
Total Posts:  193
Joined:  2008-05-07
Brazil
 

Sirs,

I got it function on 1.1.2 version with just one problem!

The system says that the field is required and it´s empy when it´s not!

Any help?

 Signature 

André Cruz
http://farmadelivery.com

 
Magento Community Magento Community
Magento Community
Magento Community
 
[m] zentrale
Guru
 
Avatar
Total Posts:  400
Joined:  2007-12-06
Stuttgart, Germany
 

Hi,

have the same problem smile!

Cheers

 Signature 

Account-User: S. Bothner & A. Jaus
[m] zentrale | InternetAgentur Stuttgart & München
Agentur für Beratung, Entwicklung & Marketing.
Magento™ Silver Partner & Community Pro Member
----
Ich habe Visionen - muss ich jetzt zum Arzt?

 
Magento Community Magento Community
Magento Community
Magento Community
 
andreladocruz
Sr. Member
 
Total Posts:  193
Joined:  2008-05-07
Brazil
 

Masters?

Any Help?

I really don´t want to get the older version without the WYSIWYG.

Please the image attached…

Regards,

Image Attachments
ERRO_EDITOR_HTML.png
 Signature 

André Cruz
http://farmadelivery.com

 
Magento Community Magento Community
Magento Community
Magento Community
 
andreladocruz
Sr. Member
 
Total Posts:  193
Joined:  2008-05-07
Brazil
 

any help???

regards,

 Signature 

André Cruz
http://farmadelivery.com

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ayurvedi
Jr. Member
 
Total Posts:  5
Joined:  2008-08-08
 

Same exact problem here…

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
 
Sales: Call 877.832.5289 (North America) 310.295.4144 (International)
© Copyright 2008 Varien. Magento, eCommerce software, is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
52316 users|491 users currently online|105643 forum posts