Override Schema defined in Telescope(Meteor)

回眸只為那壹抹淺笑 提交于 2019-12-13 02:29:31

问题


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

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

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


回答1:


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.

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'
    }
  }
});


来源:https://stackoverflow.com/questions/34306509/override-schema-defined-in-telescopemeteor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!