gpt4 book ai didi

rich-text-editor - 有什么办法可以在 Rails 6 中禁用 Action 文本的图像/附件部分吗?

转载 作者:行者123 更新时间:2023-12-03 16:56:46 28 4
gpt4 key购买 nike

我们有办法禁用操作文本的附件吗?像下面这样的东西
has_rich_text :内容,附件:假

这样,我们就可以从数据库中删除 active_storage_blobs、active_storage_attachments 表。在这种情况下,只有 action_text_rich_texts 表才能满足目的。

最佳答案

绝对地!

  • 将此添加到您的 application.js 以阻止附件:
  •     window.addEventListener("trix-file-accept", function(event) {
    event.preventDefault()
    alert("File attachment not supported!")
    })
  • 隐藏 css 附件按钮 - 在 application.scss 中添加:
  •     .trix-button-group--file-tools { display: none !important; }

    更重要的是,这是在实际应用程序中完成的提交(前 2 个文件):

    https://github.com/yshmarov/pikaburuby/commit/77aaa3e072de943470e4bd2c2b3512727c30232d

    关于rich-text-editor - 有什么办法可以在 Rails 6 中禁用 Action 文本的图像/附件部分吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61880076/

    28 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com