You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wiki/server/models/editors.js

44 lines
811 B

const Model = require('objection').Model
/* global WIKI */
/**
* Editor model
*/
module.exports = class Editor extends Model {
static get tableName() { return 'editors' }
static get idColumn() { return 'key' }
static get jsonSchema () {
return {
type: 'object',
required: ['key', 'isEnabled'],
properties: {
key: {type: 'string'},
isEnabled: {type: 'boolean'}
}
}
}
static get jsonAttributes() {
return ['config']
}
static async getEditors() {
return WIKI.models.editors.query()
}
static async getDefaultEditor(contentType) {
// TODO - hardcoded for now
switch (contentType) {
case 'markdown':
return 'markdown'
case 'html':
return 'ckeditor'
default:
return 'code'
}
}
}