Fixed error on drawing edit on markdown editor

Was preventing save of drawings.
For #2313
This commit is contained in:
Dan Brown 2020-10-13 22:36:07 +01:00
parent f3ee8f2d4c
commit bb1f1a9ecd
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9

View File

@ -440,10 +440,10 @@ class MarkdownEditor {
const data = { const data = {
image: pngData, image: pngData,
uploaded_to: Number(document.getElementById('page-editor').getAttribute('page-id')) uploaded_to: Number(this.pageId),
}; };
window.$http.post(window.baseUrl('/images/drawio'), data).then(resp => { window.$http.post("/images/drawio", data).then(resp => {
this.insertDrawing(resp.data, cursorPos); this.insertDrawing(resp.data, cursorPos);
DrawIO.close(); DrawIO.close();
}).catch(err => { }).catch(err => {
@ -476,10 +476,10 @@ class MarkdownEditor {
let data = { let data = {
image: pngData, image: pngData,
uploaded_to: Number(document.getElementById('page-editor').getAttribute('page-id')) uploaded_to: Number(this.pageId),
}; };
window.$http.post(window.baseUrl(`/images/drawio`), data).then(resp => { window.$http.post("/images/drawio", data).then(resp => {
let newText = `<div drawio-diagram="${resp.data.id}"><img src="${resp.data.url}"></div>`; let newText = `<div drawio-diagram="${resp.data.id}"><img src="${resp.data.url}"></div>`;
let newContent = this.cm.getValue().split('\n').map(line => { let newContent = this.cm.getValue().split('\n').map(line => {
if (line.indexOf(`drawio-diagram="${drawingId}"`) !== -1) { if (line.indexOf(`drawio-diagram="${drawingId}"`) !== -1) {