覆盖 Telescope(Meteor) 中定义的模式

问题描述:

我目前正在大量定制 Telescope,它是用 Meteor 编写的.

I am currently customizing Telescope heavily, which is written in Meteor.

我需要检查 Telescope 的 Posts 架构的 body 定义的 3,000 个字符 此处 在源代码中.

I need to go over the 3,000 character defined in Telescope's Posts schema's body defined here in the source.

我可以自定义 HTML 和 JS,但不能自定义模型.我该怎么做?

I've been able to customize the HTML and JS, but not the models. How would I do so?

只需在 lib 文件夹下创建一个文件并使用此处的文档:http://docs.telescopeapp.org/docs/custom-fields 删除或添加字段到该架构.

Just create a file under your lib folder and use the documentation here: http://docs.telescopeapp.org/docs/custom-fields to remove or add fields to that Schema.

编辑:抱歉,但仔细阅读您的评论我明白您想要修改 autoForm 道具而不是架构本身.要更改最大允许值,请执行以下操作:

EDIT: Sorry, but reading carefully your comment I understood you want to modify the autoForm props rather than the Schema itself. To change the maximum allowed value, do something along these lines:

Posts.removeField("body");
Posts.addField({
  fieldName: 'body',
  fieldSchema: {
    type: String,
    optional: true,
    max: 5000,
    editableBy: ["member", "admin"],
    autoform: {
      placeholder: 'Cannot exceed the maximum length of 5000 characters',
      row: 10,
      type: 'textarea'
    }
  }
});