Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to enable image drag+drop/copy+paste in RinEditor
This post describes how I tweaked RinEditor to enable copy+paste and drag+drop of images.

  1. Check the version of CkEditor that is being used, e.g. in file jscripts/rin/editor/
  2. Find the dependencies of the uploadimage plugin on the CkEditor website The easiest way is to click on the download corresponding to the version you find above. The popup window will inform you about the dependencies
  3. Add the required plugins to ckeditor by unzipping them into jscripts/rin/editor/plugins. These are (for version 4.7.3): button,toolbar,filetools,notification,notificationaggregator,dialog,dialogui,clipboard,lineutils,widgetselection,widget,uploadwidget,uploadimage
  4. Register the plugins with ckeditor in jscripts/rin/editor/config.js:

  5. Register the script to handle uploads in config.js (note that the path does not include the "https://your.server" part):

  6. Download the mybb ckeditor plugin
  7. Unzip somewhere and grab the ckeditor_upload directory. Put it into the path you registered in step 3
  8. In the ckeditor plugin, find the file inc/languages/english/ckeditor.lang.php and put it into the same path in your mybb installation
  9. Change the permission on the ckeditor_upload/uploads directory so that your http server can write files. On Ubuntu, this means
    chown www-data:www-data ckeditor_upload/uploads
  10. Edit ckeditor_upload/upload.php to match the standard ckeditor syntax for uploading files
    • Change
    • to
    • (six edits)
    • Change
      echo json_encode(array("status" => "error", "message" => $lang->ckeditor_upload_invalid_type));
    • to
      echo json_encode(array("uploaded" => 0, "error" => array("message" => $lang->ckeditor_upload_invalid_type)));
    • (3 edits)
    • Change the success message to
      echo json_encode(array("uploaded" => 1, "fileName" => $_FILES['upload']['name'], "url" => $mybb->settings['bburl'].'/ckeditor_upload/uploads/'.$_FILES['upload']['name']));
    • (1 edit)
Possible improvements:
  • I don't think all the files under ckeditor_upload are actually required
  • Is there a better place for the upload script and upload directory?

Forum Jump:

Users browsing this thread: 1 Guest(s)