如何在CKEditor中加载脚本代码

时间:2018-02-02 15:49:34

标签: javascript html laravel ckeditor

我正在使用ckeditor,我想加载一些代码。

例如:

  def create

    flash[:error] = "There is no group with that token."
    redirect_to somewhere unless group

    flash[:error] = "You must be a member of this group to add a link."
    redirect_to somewhere unless member

    flash[:error] = "That link does not exist."
    redirect_to somewhere unless link

    flash[:error] = "You shared this link in '#{group.name}' already."
    redirect_to mylinks_path if group_link

    flash[:error] = nil

    @group_link = member.group_links.build(link: link)
    if group_link.save
      group_link.toggle!(:shared)
      flash[:success] = "You shared your link in '#{group.name}'."
      redirect_to mylinks_path
    else
      render :new
    end

  end

如何在我的内容之间加载此脚本?

1 个答案:

答案 0 :(得分:0)

这是不可能的。 CKEditor剥离或编码所有script元素,因为它们是执行XSS攻击的最简单方法。

但是,如果你想嵌入一些媒体,CKEditor 4 has dedicated plugin for it