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.

Redactor Editor Plugin

2

Answers

  • XarcellXarcell North Carolina
    edited June 2012

    I was having an argument with another software guru about implementing Redactor. Apparently, if your website generates revenue, you gotta pay a $19 fee per domain to use this.

    which is a deal breaker for me.

  • KasperKasper Scholar of the Bits Copenhagen Vanilla Staff

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

  • @kasperisager @Xarcell That really sucks. Free but not really!

  • XarcellXarcell North Carolina
    edited June 2012

    He says that if you site generates revenue, you need to pay $19. A multi-site license is $89. That doesn't mean you can't make a free plugin out of it. I reckon fee's are based on the honor system...

    I will continue to work on this for public use. The owner of redactor basically says, add-ons, modules, or plugins with redactor can be made free to the public. Who pays for a license or not is between that person using it on his/her domain and redactor owner. Just be sure to make note of that with the application.

  • Free but not really!

    Open source doesn't mean it is free of cost. I think a lot of people assume that, but are wrong in general.

    grep is your friend.

  • XarcellXarcell North Carolina

    just a FYI, I came back to look at making this a plugin. ATM, I got everything working except the insert image(only upload part), video, and file.

    If anyone has any ideas or suggestions let me know.

  • XarcellXarcell North Carolina

    I need help getting the upload to work with Vanilla. Here is the sample code:

    // files storage folder
    $dir = '/home/web/sitecom/redactor/images/';
    
    $_FILES['file']['type'] = strtolower($_FILES['file']['type']);
    
    if ($_FILES['file']['type'] == 'image/png' 
    || $_FILES['file']['type'] == 'image/jpg' 
    || $_FILES['file']['type'] == 'image/gif' 
    || $_FILES['file']['type'] == 'image/jpeg'
    || $_FILES['file']['type'] == 'image/pjpeg')
    {   
        // setting file's mysterious name
        $file = $dir.md5(date('YmdHis')).'.jpg';
    
        // copying
        copy($_FILES['file']['tmp_name'], $file);
    
        // displaying file
        echo '<img src="/tmp/images/'.$file.'" />';
    }
    

    How can this be coded to be secure, and have the proper paths.

    Thanks.

  • Have you looked at FileUpload plugin to see if they do any better?

  • XarcellXarcell North Carolina

    yes, I've looked at it, but don't understand it. I think I can get it to work if I can get the absolute path for the $dir = '/home/web/sitecom/redactor/images/'; part.

  • XarcellXarcell North Carolina

    oh, I managed to get it to work on local files too, so it doesn't point to external javascript files. Like what you posted.

    I think if we all continue to work together, we can get this working...

  • mclovinmclovin New
    edited July 2012
     plugins
        redactor
            class.redactor.default.php
            images
            css
            js
    

    If your directory structure for the plugin is like above, you can just use relative paths to access images from inside class.redactor.default.php. You do not need to absolute path.

    It would just be:
    $dir = "images";

  • XarcellXarcell North Carolina
    edited July 2012

    I'll just post what I have for the "default.php", in case you want to tinker with it. I managed to get it working without linking to external files.

    <?php
    if(!defined('APPLICATION')) die();
    
    /*
    Plugin adds Redactor (http://redactorjs.com/) jQuery powered WYSIWYG to Vanilla 2
    
    Included files:
    1. redactor.min.js 
    2. redactor.css 
    3. images/icons.png
    
    Changelog:
    
     */
    
    $PluginInfo['RedactorEditor'] = array(
       'Name' => 'Redactor Editor',
       'Description' => 'Adds a <a href="http://jquery.com/">jQuery</a> powered <a href="http://en.wikipedia.org/wiki/WYSIWYG">WYSIWYG</a> editor to your forum so that your users can enter rich text comments.',
       'Version' => '1.0',
       'Author' => "Xarcell",
       'AuthorEmail' => 'xarcell@yahoo.com',
       'AuthorUrl' => 'http://xarthemes.com',
       'RequiredApplications' => array('Vanilla' => '>=2'),
       'RequiredTheme' => FALSE, 
       'RequiredPlugins' => FALSE,
       'HasLocale' => FALSE,
       'RegisterPermissions' => FALSE,
       'SettingsUrl' => FALSE,
       'SettingsPermission' => FALSE
    );
    
    class RedactorPlugin extends Gdn_Plugin {
        public function PostController_Render_Before(&$Sender) {
            $this->_AddRedactorEditor($Sender);
        }
        public function DiscussionController_Render_Before(&$Sender) {
            $this->_AddRedactorEditor($Sender);
        }
        private function _AddRedactorEditor($Sender) {
            $Config = Gdn::Factory(Gdn::AliasConfig);
            $Config->Set('Garden.Html.SafeStyles', FALSE);
            $Sender->RemoveJsFile('jquery.autogrow.js');
            $Sender->AddCssFile($this->GetResource('design/redactor.css', FALSE, FALSE));
            $Sender->AddJsFile($this->GetResource('js/redactor.js', FALSE, FALSE));
            $Sender->Head->AddString('      
    
            <script type="text/javascript">
                  $(document).ready(
                        function()
                        {
                                $("#Form_Body").redactor();
                        }
                  );
            </script>
            <script type="text/javascript">
                $(document).ready(
                    function()
                    {
                        $("#redactor_content").redactor({   
                            imageUpload: "../scripts/image_upload.php",
                            fileUpload: "../scripts/file_upload.php",
                            imageGetJson: "../demo/json/data.json"
                        });
                    }
                );
           </script>
            ');
       }
        public function Setup(){}
    }
    

    Now for some reason, the JS & CSS within the redactor package acts funny. However, if you copy & paste the code used on the redactor site, it will work fine.

    http://redactorjs.com/js/redactor/redactor.js

    http://redactorjs.com/js/redactor/css/redactor.css

  • @Xarcell Were you able to successfully integrate Redactor as the WYSIWYG editor in Vanilla? I'm not sure what the state of this project is, but you should consider rolling out a plugin release to the community. Maybe we can help fix some of the bugs.

  • What is the status of this project? Someone got it to work?

  • rasteronrasteron forum.rastercode.com ✭✭
    edited February 2015

    Hey guys,

    I'm a part time web developer and have always been interested on taking new and interesting projects. I just got back again developing in Vanilla/Garden forum.

    If anyone would be willing and interested in pitching in, I have started a Bountysource crowdfunding campaign to get this plugin done:

    https://www.bountysource.com/teams/rastercode/fundraisers/668-vanilla-redactor

    License will be either MIT or GPLv2, excluding Imperavi's own licensing terms.

  • whu606whu606 I'm not a SuperHero; I just like wearing tights... MVP
    edited February 2015

    I can't imagine why anyone would want to pay you to reinvent the wheel.

    Or why you decided to necropost rather than start a new thread.

    Vanilla already has, free, a choice of editors, with plans to release the editor available on this site in the near future.

    I'm also deeply suspicious of something that says:

    This campaign will receive all funds raised even if it does not reach its goal.

    Which seems to imply that if people pledge, and it doesn't get done, they have to pay anyway.

    Do you have any work you have already done on Vanilla that you could show people, to demonstrate your competence?

  • R_JR_J Ex-Fanboy Munich Admin

    I doubt that there will be enough interest so that you can collect 1000$ in 30 days. And maybe you should add that 500$ alone will be needed for the propper license from Imperavi. So if you receive 300$, nothing will happen but people have paid you 300$. But, like whu606 said, there is no real need for such a plugin. So why should I pay anyway?

    I've taken a look at your GitHub account and you have posted your homepage and that makes me thing you do not want to betray anyone, but in the end, the money I've paid for the bounty is gone, if you do not decide to pay it back. That gives me a bad feeling...

    Just in order to get some practice (and credibility for your skills) you could implement Trumbowyg ;)
    But even then, I guess you might have more luck with a unique plugin, not just YetAnotherWysiwygEditor

  • BleistivtBleistivt Moderator
    edited February 2015

    IMO, the only controls a Wysiwyg editor for vanilla should support are these:

    Meaning it should be compatible with the Garden.Html.SafeStyles option.

    Everything else like font-type, color, size, indentation, alignment or tables just leads to users abusing it, like the occasional only-writes-in-purple-and-comic-sans user.

  • rasteronrasteron forum.rastercode.com ✭✭

    Hey @whu606 thanks for the feedback. I don't think it is reinventing the wheel, if there's one, I'd be glad to check it out and please discard my message above.

    Moving on, I'm quite familiar with Redactor and a bit surprised that this is not yet implemented on Vanilla. I have created some Redactor plugin implementations before with other frameworks and custom sites for my clients and previous employers.

    Yes, contribution is voluntarily and it's a good thing if you have some credentials. I'm a generalist coder, web developer by day with 10 years programming experience in desktop and web applications. I'm currently developing and managing Vanilla and CMS sites and clients in the US, South Africa, Europe and Australia. Apparently, all of my previous work are under NDA so I can't provide any information but I will release or announce some of my upcoming plugin projects soon either free, for crowdfunding or proprietary here, if allowed.

    You can check out a lot of Bountysource projects and offers made by major companies and open source organizations. It's a trend nowadays to get things done with opensource projects, it's not just me. ;)

    Cheers.

    Ron

Sign In or Register to comment.