覆盖 Telescope(Meteor) 中定义的模式 [英] Override Schema defined in Telescope(Meteor)

查看:46
本文介绍了覆盖 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'
    }
  }
});

这篇关于覆盖 Telescope(Meteor) 中定义的模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆