SammyLin / redactor-rails

This repo is deprecated. Please check out official gem for Redactor 2. https://github.com/Redactor2/redactor2_rails
MIT License
390 stars 254 forks source link

Video plugin #133

Open napster3000 opened 9 years ago

napster3000 commented 9 years ago

I've added video plugin manually but it doesn't being showed

//= require redactor-rails //= require redactor-rails/video

config.js

$(document).ready( function(){ var csrf_token = $('meta[name=csrf-token]').attr('content'); var csrf_param = $('meta[name=csrf-param]').attr('content'); var params; if (csrf_param !== undefined && csrf_token !== undefined) { params = csrf_param + "=" + encodeURIComponent(csrf_token); } $('.redactor').redactor( { "imageUpload":"/redactor_rails/pictures?" + params, "imageGetJson":"/redactor_rails/pictures", "fileUpload":"/redactor_rails/documents?" + params, "fileGetJson":"/redactor_rails/documents", "path":"/assets/redactor-rails", "css":"style.css", "plugins": ['video']} ); });

earlbalai commented 9 years ago

I too am having this issue

koraks commented 8 years ago

how i can add new plugins? it´s imposible or what?

MattRyder commented 8 years ago

Hi folks, just had this issue and it seems like the API changed and video.js hasn't been updated since?

Simple fix, though, just change the first few lines of the script from/to: (Ensure you perform the RedactorPlugins instance check, this may be the first plugin loaded)

(function($)
{
    $.Redactor.prototype.video = function()
    {
if (!RedactorPlugins) var RedactorPlugins = {};

(function($)
{
    RedactorPlugins.video = function()
    {

@koraks: nothing is impossible, pal ;^)

timkleier commented 8 years ago

Excellent fix, thanks!

nfriend21 commented 8 years ago

For anyone else who comes across this, the exact same fix needs to be applied to any non-default plugins that you download from the redactor website. They will NOT work by default.

I can see the video button now, but I still can't insert a video without an error.

connor-t commented 8 years ago

is it not possible to use the video plugin now at all? I have the same problem as @nfriend21, can see the button but nothing happens when I click on it...

robot-den commented 8 years ago

Hi! I found the modified JS files for audio/video plugins here https://github.com/kyan/redactor-plugins Its work for me.

Also, mb it will be useful, i use .sanitize method for showing my Articles. This method cuts iframe tag what needed for video. You may change tags for .sanitize in config/application.rb:

config.action_view.sanitized_allowed_tags = %w(strong em b i p code pre tt samp kbd var sub sup dfn cite big small address hr br div span h1 h2 h3 h4 h5 h6 ul ol li dl dt dd abbr acronym a img blockquote del ins iframe)

All tags except iframe are the same as in sanitizer.rb

suramai commented 8 years ago

@robot-den Thank you so much. I can see the videos appearing now :)

suryasteja59 commented 7 years ago

I have used this and it worked for me... https://www.votzap.com/debates/how-to-add-video-plugin-to-redactor-rails-gem