Skip to content

mwasiluk/annotator-validation-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

annotator-validation-plugin

Annotation validation plugin for Annotator.js

Requirements

  • JQuery >=1.6
  • annotatorjs 1.2.x

Usage

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

Bower

You can install this package through Bower by using the following command :

bower install annotator-validation-plugin

Demo

Plunker demo

Default options

{
    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'
}

About

Annotation validation plugin for Annotator.js

Resources

License

Stars

Watchers

Forks

Packages

No packages published