Annotation validation plugin for Annotator.js
- JQuery >=1.6
- annotatorjs 1.2.x
You can enable this plugin like any other annotator.js plugin e. g.:
// Setup the annotator on the page.
var content = $('#content').annotator();
// You can optionally specify plugin options:
var pluginOptions={
minLength: 2,
customValidators: [{
validator: function(annotation){
return annotation.text.length > 0;
},
message: "Custom validation message"
}]
}
// Add plugin.
content.annotator('addPlugin', 'Validation', pluginOptions);
You can install this package through Bower
by using the following command :
bower install annotator-validation-plugin
{
minLength: 2,
maxLength: 1000,
customValidators: [],
messages:{
minLength: 'Annotation should have at least {} characters',
maxLength: 'Please enter no more than {} characters'
},
validationMsgStyle: 'color: #E00000; padding: 5px;',
validationMsgClass: 'annotation-validation-message'
}