Comments (2)
I had an Error 422 about 5 days ago, and I tracked it down to a change in how overleaf processes the XHtml request.
I changed my code of uploadImage() as follows:
`function uploadImage(imageBlob,hash){
try{
var xhr = new XMLHttpRequest();
var url = document.location.pathname + "/upload?folder_id=" + _ide.fileTreeManager.findEntityByPath("assets").id; //+ "&_csrf=" + csrfToken;
let formData = new FormData();
formData.append("targetFolderId", _ide.fileTreeManager.findEntityByPath("assets").id);
formData.append("name", hash + ".png");
formData.append("type", "image/png");
formData.append("qqfile", imageBlob, hash + ".png");
xhr.open("POST", url, true);
xhr.setRequestHeader('x-csrf-token', csrfToken);
//xhr.setRequestHeader("Content-Type", "application/json");
xhr.onreadystatechange = function () {
if (xhr.readyState === 4 && xhr.status === 200) {
var json = JSON.parse(xhr.responseText);
console.log(json.entity_id + " Asset created :)");
}
};
xhr.send(formData);
}catch(e)
{
console.log(e)
}
Edit: Struggeling with posting code...
Hope this helps
from overleaf-image-helper.
Just merged an update PR for Code Mirror 6. So the current version of Overleaf should now be fully supported!
from overleaf-image-helper.
Related Issues (9)
- Could you also mention Firefox Tampermonkey in readme? HOT 5
- Script loads within overleaf project, but fails to run because of uncaught TypeError (document.querySelector() is null) HOT 14
- breaks with beta version HOT 6
- Does work for me Very useful HOT 1
- bug-0001-TypeError: document.querySelector(...) is null HOT 3
- Did the script stop working? HOT 4
- Only works for Legacy HOT 1
- Script doesn't work anymore HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from overleaf-image-helper.