revert 0ffcafdf3f35f7d9ac27b6b4f65d3b283ef03a49
All checks were successful
Neutral/pipeline/head This commit looks good
All checks were successful
Neutral/pipeline/head This commit looks good
revert Version 1.1.0 - Ajout de la compatibilité des images
This commit is contained in:
parent
ee556d859e
commit
52e1348613
@ -164,14 +164,7 @@ module.exports.getFile = function(root) {
|
||||
|
||||
try {
|
||||
|
||||
// Check if the file is an image and if it is return the base64
|
||||
if(mime.lookup(root).includes("image")) {
|
||||
return "data:" + mime.lookup(root) + ";base64," + fs.readFileSync(root, "base64")
|
||||
} else {
|
||||
return fs.readFileSync(root, "utf-8")
|
||||
}
|
||||
|
||||
|
||||
} catch(err) {
|
||||
console.log(err)
|
||||
return "NOT_PERMITTED"
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "neutral",
|
||||
"version": "1.1.0",
|
||||
"version": "1.0.3",
|
||||
"description": "Panel d'administration de Raphix",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
@ -590,7 +590,6 @@ explorer.createWindow(() => {
|
||||
})
|
||||
} else {
|
||||
// Make Download using result
|
||||
|
||||
const element = document.createElement('a');
|
||||
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(result));
|
||||
element.setAttribute('download', file.name);
|
||||
@ -598,6 +597,7 @@ explorer.createWindow(() => {
|
||||
document.body.appendChild(element);
|
||||
element.click();
|
||||
document.body.removeChild(element);
|
||||
|
||||
}
|
||||
})
|
||||
})
|
||||
@ -614,15 +614,7 @@ explorer.createWindow(() => {
|
||||
|
||||
function editFile() {
|
||||
const reqFiles = post("FX_GETFILE", file.fileDirectory)
|
||||
//Create a popup for the loading
|
||||
|
||||
View.createPopup({
|
||||
title: `<i class='fa-solid fa-file-pen'></i> Editeur`,
|
||||
content: `<p><i class='fa-solid fa-rotate fa-spin'></i> Chargement en cours ...</p>`
|
||||
})
|
||||
|
||||
reqFiles.then((result) => {
|
||||
View.destroyPopup(`<i class='fa-solid fa-file-pen'></i> Editeur}`)
|
||||
if(result == "NOT_PERMITTED") {
|
||||
View.createPopup({
|
||||
title: `<i class='fa fa-warning'></i> Erreur`,
|
||||
@ -632,18 +624,9 @@ explorer.createWindow(() => {
|
||||
const editor = new ViewWindow({
|
||||
title: `<i class="fa-solid fa-file-pen"></i> Editeur - ${file.fileDirectory}`,
|
||||
width: "1000px",
|
||||
height: "650px"
|
||||
height: "600px"
|
||||
})
|
||||
|
||||
|
||||
if(file.type == "image/png" | file.type == "image/jpeg") {
|
||||
editor.setContent(`
|
||||
<div style='width: 100%; text-align: center;'>
|
||||
<img style='width: 500px;' src='${result}'/>
|
||||
</div>`)
|
||||
|
||||
|
||||
} else {
|
||||
editor.setContent(`
|
||||
|
||||
<div class='fx-bar'>
|
||||
@ -651,8 +634,10 @@ explorer.createWindow(() => {
|
||||
</div>
|
||||
<textarea id='${editor.getViewTitle()}_editorContent' class='fx-editor-content'>${result}</textarea>
|
||||
|
||||
|
||||
`)
|
||||
|
||||
|
||||
const editorSave = getID(editor.getViewTitle() + "_save")
|
||||
const editorContent = getID(editor.getViewTitle() + "_editorContent")
|
||||
|
||||
@ -688,7 +673,7 @@ explorer.createWindow(() => {
|
||||
editorContent.style.resize = "none"
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user