【问题标题】:How to sanitize the HTML on the server - WYSIWYG如何清理服务器上的 HTML - 所见即所得
【发布时间】:2016-07-30 05:10:00
【问题描述】:

我刚刚安装了 mpowaga:autoform-summernote 。在说明中它说要清理服务器上的 HTML 并将您发送到大气以安装清理包。我已经安装了djedi:sanitize-html但是我找不到任何关于如何将它与 autoform 和 simple-schema 集成/使用的说明。我假设我想在模式中定义它。我是一个菜鸟,所以一些指导将不胜感激。

如果您希望我发布我的架构或其他我可以发布的内容。

【问题讨论】:

  • link 包含使用 HTML sanitizer 的指南。请注意,该指南适用于 Node,但它应该同样适用于 Meteor。

标签: meteor meteor-autoform simple-schema


【解决方案1】:

这是一个示例代码:

body: {
    type: String,
    label: "Enter Your Content here",
    optional: false,
    autoValue: function(){
        return Meteor.isServer ? sanitizeHtml( this.value ) : this.value;
    },
    autoform: {
        afFieldInput: {
            type: 'summernote',
            class: 'editor' // optional
          //  settings: // summernote options goes here
        }
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-07-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多