Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to console.log store pluggin output getting following error ---- Could not load Tags plugin. Have you included the appropriate <script> tag? #716

Open
Sam131112 opened this issue Feb 3, 2021 · 0 comments

Comments

@Sam131112
Copy link

Sam131112 commented Feb 3, 2021

I am trying to test run annotator js 1.2 version with a very simple example which writes annotation in console log on creatin
here is my server and html code

// Server Code

const express = require("express");
const { v4: uuidv4 } = require('uuid');
const annotator = require('annotator');
var path = require('path');

const app = express();


var allowCrossDomain = function (req, res, next) {
  res.header('Access-Control-Allow-Origin', '*');
  res.header('Access-Control-Expose-Headers', 'Content-Length, Content-Type, Location');
  res.header('Access-Control-Allow-Headers', 'Content-Length, Content-Type, X-Annotator-Auth-Token, X-Requested-With');
  res.header('Access-Control-Allow-Methods', 'GET,POST,PUT,DELETE,OPTIONS');
  res.header('Access-Control-Max-Age', '86400');

  // intercept OPTIONS method
  if ('OPTIONS' == req.method) {
    res.status(200);
  }
  next();
};


app.use(allowCrossDomain);
app.use(express.static(__dirname + '/public'));
app.use(express.json({limit:'50mb'}));
app.get('/',function(req,res) {
	res.sendFile('/home/ukpuser/Downloads/fh1000/demo5.html')
	
});

app.listen(3001,()=> console.log('listening to port 3001'));


app.post('/api/annotations',(req,res)=> {
	let id = uuidv4();
	let annotobj = { "id":id , "quote":req.body.quote , "ranges":req.body.ranges , "text":req.body.text};
	console.log("POST: ");
	console.log(annoobj);
	});


// Html Code

<!DOCTYPE html>
<html>
<head>
<script src='js/jquery.js'></script>
<script src='js/json2.js'></script>

<script src='js/annotator.min.js'></script>
<link rel='stylesheet' type="text/css" href='css/annotator.min.css'>
</head>
<body>


<div id="content">
<h2>This is a heading</h2>

<p>This is a paragraph.</p>
<p>This is another paragraph.</p>

<button>Click me</button>
</div>
<script>  
jQuery(function ($) {
      var content = $(document.body).annotator();
      content.annotator('addPlugin', 'Tags'); 
  });
</script> 
</body>
</html>

This is the simplest possile example and i am not able able to understand why its not working. Any help will be highly appreciated

@Sam131112 Sam131112 changed the title Unable to console.log annotations getting following error "Could not load Tags plugin. Have you included the appropriate <script> tag? Annotator.addPlugin @ annotator.coffee:469" Unable to console.log annotations getting following error ---- Could not load Tags plugin. Have you included the appropriate <script> tag? Feb 3, 2021
@Sam131112 Sam131112 changed the title Unable to console.log annotations getting following error ---- Could not load Tags plugin. Have you included the appropriate <script> tag? Unable to console.log store pluggin output getting following error ---- Could not load Tags plugin. Have you included the appropriate <script> tag? Feb 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant