Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

What makes it incompatible with Vanilla 2.0?

Just installed this (you referenced it in the Word Count thread), but I'm running 2.0 still. Is there a work around?

I'm not against installing the 2.1 beta, just don't know what's involved with that process, and would hate to break things!

Comments

  • KasperKasper Scholar of the Bits Copenhagen Vanilla Staff

    Wysihtml5 uses the Gdn_Form_BeforeBodyBox_Handler() event which was implemented in 2.1. There is a workaround though: Simply put, take a look at how CLEditor implements the editor and do the same in Wysihtml5.

    Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub

  • peregrineperegrine MVP
    edited March 2013

    here's a start - I had to modify the getvalue methods and setvalue (temporarily) and the event.
    partial mods for 2.0.18

    the preview is funky with this change - but the toolbar shows.

    public function DiscussionController_BeforeBodyField_Handler($Sender) {
    
            $this->_AddWysihtml5(Gdn::Controller());
    
            // $Format = $Sender->GetValue('Format');
    
           $Format = $Sender->Discussion->Format;
    
            if ($Format) {
                $Formatter = Gdn::Factory($Format.'Formatter');
    
                if ($Formatter && method_exists($Formatter, 'FormatForWysiwyg')) {
                    //$Body = $Formatter->FormatForWysiwyg($Sender->GetValue('Body'));
                     $Body = $Formatter->FormatForWysiwyg($Sender->Discussion->Body);
                   //   $Sender->SetValue('Body', $Body);
                        $Sender->Discussion->Body = $Body;
                } elseif (!in_array($Format, array('Html', 'Wysiwyg'))) {
                  //    $Sender->SetValue('Body', Gdn_Format::To($Sender->GetValue('Body'), $Format));
                    $Sender->Discussion->Body = $Body;
                }
            }
            // $Sender->SetValue('Format', 'Wysiwyg');
             $Sender->Discussion->Format = 'Wysiwyg';
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited March 2013

    here's a fix for preview (don't display it) add this to wysihtml5.css

    
    .Tabs a.PreviewButton  {
       display:none;
    }
    

    probably some other changes needed for edit.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited March 2013

    I'm sure Kasper could do it better. This works for me to make it work in vanilla 2.0.18.4

    final changes -

    add to bottom of plugins/Wysihtml5/design/wysihtml5.css

    .Tabs a.PreviewButton {
       display:none;
    }
    
    
    .Tabs li.Active a.WriteButton {
     display:none;
     }
    

    here is the rewrite of plugins/Wysihtml5/default.php to make it work in vanilla 2.0.18.4

    download the file and rename it to default.php and replace the old one.

    if it doesn't work for you, maybe you can improve on it.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

This discussion has been closed.