About brat
https://github.com/nlplab/brat http://brat.nlplab.org/
About this version
This version is full frontend working version of brat editing tools
Install and execute main app or provided examples
Prerequisites :
- Node.js >= 4.5.x
- npm >= 3.0.x
Root app as well as all examples can be executed with
cd <targetted_app>npm installnpm start #Then open browser on localhost:3000
Build dist repo
npm run prepublish
Import module in your current application##
npm install brat-frontend-editor --save
Configuration
Options | Values | Default |
---|---|---|
activateEdition | true of false | true |
ajax | 'local', 'external' or 'normal' | local |
assetsPath | path to public asset folder | static/ |
maxFragmentLength | 0=no_max 1+=max characters by fragment (applied on Entity type only for now) | 30 |
overWriteModals | true or false | false |
showTooltip | true or false | false |
webFontURLs | array of 3 paths | ['fonts/Astloch-Bold.ttf','fonts/PT_Sans-Caption-Web-Regular.ttf','fonts/Liberation_Sans-Regular.ttf'] |
allowRelations | boolnea | true |
Integration in vanilla JavaScript
{ //Making sure DOM is ready var elem = document; var collData = /*...*/ ; var docData = /*...*/ ; var yolo = elem collData docData;}
Integration in Angular2
var BratFrontendEditor: any; //TypeScript compiler; @ private brat: any; { }let { let elem = document; let collData = /* ... */ ; let docData = /* ... */ ; let options = 'ajax': 'external' //local(default), normal, external(Handle all 'ajax' actions by yourself) ; thisbrat = elem collData docData options; thisbratdispatcher; thisbratdispatcher; thisbratdispatcher; } private { // You could manage all data transformations externally (from Ng2 App) // Set option.ajax: 'external' first // Following will "work"(no span will actually be created) for createSpan action // All actions must be implemented externally if option.ajax=external thisbratdispatcher; let response = {}; thisbratdispatcher; thisbratdispatcher; } { // Right before any local_ajax.js actions } { // Right after any local_ajax.js actions }
Integration in React
; Component { superprops; } { var elem = document; var collData = /* ... */ ; var docData = /* ... */ ; var brat = elem collData docData; } { return <div id="test" /> ; }