|
@@ -14,6 +14,7 @@
|
|
|
* - 2025/06/04 - V1.4.1 - C.NELHOMME - Refactor fntManager using Modal class, add some commentary, renaming fntManager to newDeleteManager, renaming variable startingWith RG_ to normal variable
|
|
* - 2025/06/04 - V1.4.1 - C.NELHOMME - Refactor fntManager using Modal class, add some commentary, renaming fntManager to newDeleteManager, renaming variable startingWith RG_ to normal variable
|
|
|
* - 2025/06/04 - V1.5.0 - C.NELHOMME - Implement SmartButton and abstract class BaseHoverManager and Refactor newDeleteManager and newTranslateManager and moving her into NewSiteEditor function()
|
|
* - 2025/06/04 - V1.5.0 - C.NELHOMME - Implement SmartButton and abstract class BaseHoverManager and Refactor newDeleteManager and newTranslateManager and moving her into NewSiteEditor function()
|
|
|
* - 2025/06/11 - V1.5.1 - C.NELHOMME - Implement setCreateError to show error in modal, added page smartButton for selecting id of the currznt page
|
|
* - 2025/06/11 - V1.5.1 - C.NELHOMME - Implement setCreateError to show error in modal, added page smartButton for selecting id of the currznt page
|
|
|
|
|
+ * - 2025/06/12 - V.1.5.2 - C.NELHOMME (Stable test with Hugo) - Fix multiple request to mistral now one by one, when translate/delete is open all the tinymce is now closed, remove poster from video
|
|
|
* @copyright Intersel 2022-2025
|
|
* @copyright Intersel 2022-2025
|
|
|
*
|
|
*
|
|
|
*
|
|
*
|
|
@@ -24,6 +25,7 @@
|
|
|
* Todo :
|
|
* Todo :
|
|
|
* - Faire en sorte que la poubelle et la traduction puisse pas etre fait au mm moment sinon confliiit
|
|
* - Faire en sorte que la poubelle et la traduction puisse pas etre fait au mm moment sinon confliiit
|
|
|
* - Préseletionner le parent si y'a une erreur
|
|
* - Préseletionner le parent si y'a une erreur
|
|
|
|
|
+ * - Afficher erreur si Mistral bug
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
//Configuration
|
|
//Configuration
|
|
@@ -167,7 +169,7 @@ class SmartButton {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
var NEWSITEEDITOR = (function () {
|
|
var NEWSITEEDITOR = (function () {
|
|
|
- let version = "1.4.1";
|
|
|
|
|
|
|
+ let version = "1.5.2";
|
|
|
|
|
|
|
|
//set data-data for content and title
|
|
//set data-data for content and title
|
|
|
function dataData(who) {
|
|
function dataData(who) {
|
|
@@ -312,7 +314,14 @@ var NEWSITEEDITOR = (function () {
|
|
|
|
|
|
|
|
this.getElements().forEach((el) => {
|
|
this.getElements().forEach((el) => {
|
|
|
if (this.hoverActive) {
|
|
if (this.hoverActive) {
|
|
|
- tinymce?.remove?.();
|
|
|
|
|
|
|
+ //On supprime chaque instance de TinyMce sinon il s'active lors des clics
|
|
|
|
|
+ tinymce.editors.forEach((ed) => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ ed.remove();
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ console.warn("Erreur suppression éditeur :", ed.id, e);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
el.addEventListener("mouseenter", this.addHoverClass);
|
|
el.addEventListener("mouseenter", this.addHoverClass);
|
|
|
el.addEventListener("mouseleave", this.removeHoverClass);
|
|
el.addEventListener("mouseleave", this.removeHoverClass);
|
|
|
} else {
|
|
} else {
|
|
@@ -1305,7 +1314,7 @@ var NEWSITEEDITOR = (function () {
|
|
|
target: Dashboard,
|
|
target: Dashboard,
|
|
|
cropperOptions: {
|
|
cropperOptions: {
|
|
|
viewMode: 1,
|
|
viewMode: 1,
|
|
|
- autoCropArea: 1,
|
|
|
|
|
|
|
+ autoCropArea: 0.8,
|
|
|
},
|
|
},
|
|
|
actions: {
|
|
actions: {
|
|
|
revert: false,
|
|
revert: false,
|
|
@@ -1323,7 +1332,6 @@ var NEWSITEEDITOR = (function () {
|
|
|
if (file.meta.isCropped) return;
|
|
if (file.meta.isCropped) return;
|
|
|
pendingFile = file;
|
|
pendingFile = file;
|
|
|
openCropper(file);
|
|
openCropper(file);
|
|
|
- document.getElementById("generateByAi").disabled = false;
|
|
|
|
|
return false;
|
|
return false;
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -1331,10 +1339,6 @@ var NEWSITEEDITOR = (function () {
|
|
|
file.meta.fromServer = false;
|
|
file.meta.fromServer = false;
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- uppy.on("cancel-all", () => {
|
|
|
|
|
- document.getElementById("generateByAi").disabled = true;
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
return uppy;
|
|
return uppy;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1369,6 +1373,8 @@ var NEWSITEEDITOR = (function () {
|
|
|
var formData = new FormData();
|
|
var formData = new FormData();
|
|
|
formData.append("imageURL", base64);
|
|
formData.append("imageURL", base64);
|
|
|
|
|
|
|
|
|
|
+ document.getElementById("generateByAi").disabled = true;
|
|
|
|
|
+
|
|
|
const response = await fetch(
|
|
const response = await fetch(
|
|
|
baseURL + "/rest/mistral/image-alt/",
|
|
baseURL + "/rest/mistral/image-alt/",
|
|
|
{
|
|
{
|
|
@@ -1386,10 +1392,13 @@ var NEWSITEEDITOR = (function () {
|
|
|
} else {
|
|
} else {
|
|
|
console.error("No description :'(");
|
|
console.error("No description :'(");
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ document.getElementById("generateByAi").disabled = false;
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
error(err) {
|
|
error(err) {
|
|
|
console.error("Une erreur est survenue");
|
|
console.error("Une erreur est survenue");
|
|
|
|
|
+ document.getElementById("generateByAi").disabled = false;
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
@@ -1404,9 +1413,7 @@ var NEWSITEEDITOR = (function () {
|
|
|
acceptedTypes: imageTypesWithoutDots,
|
|
acceptedTypes: imageTypesWithoutDots,
|
|
|
fileType: "image",
|
|
fileType: "image",
|
|
|
uppyInstance: imageUppy,
|
|
uppyInstance: imageUppy,
|
|
|
- }).then(() => {
|
|
|
|
|
- document.getElementById("generateByAi").disabled = false;
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ })
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
document
|
|
document
|
|
@@ -1504,6 +1511,7 @@ var NEWSITEEDITOR = (function () {
|
|
|
cropper = null;
|
|
cropper = null;
|
|
|
}
|
|
}
|
|
|
pendingFile = null;
|
|
pendingFile = null;
|
|
|
|
|
+ uppyReset(imageUppy);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
document
|
|
document
|
|
@@ -1529,7 +1537,6 @@ var NEWSITEEDITOR = (function () {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
document.getElementById("cropper-modal").classList.remove("active");
|
|
document.getElementById("cropper-modal").classList.remove("active");
|
|
|
- document.getElementById("generateByAi").disabled = false;
|
|
|
|
|
|
|
|
|
|
cropper.destroy();
|
|
cropper.destroy();
|
|
|
cropper = null;
|
|
cropper = null;
|
|
@@ -1573,7 +1580,7 @@ var NEWSITEEDITOR = (function () {
|
|
|
cropper = new Cropper(cropperImage, {
|
|
cropper = new Cropper(cropperImage, {
|
|
|
viewMode: 1,
|
|
viewMode: 1,
|
|
|
aspectRatio: current.aspectRatio,
|
|
aspectRatio: current.aspectRatio,
|
|
|
- autoCropArea: 1,
|
|
|
|
|
|
|
+ autoCropArea: 0.8,
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
reader.readAsDataURL(file.data);
|
|
reader.readAsDataURL(file.data);
|
|
@@ -1619,7 +1626,6 @@ var NEWSITEEDITOR = (function () {
|
|
|
const closeButtonID = "closeVideoModal";
|
|
const closeButtonID = "closeVideoModal";
|
|
|
const ariaLabelInput = "ariaLabel";
|
|
const ariaLabelInput = "ariaLabel";
|
|
|
const submitVideoEditorID = "submitVideoEditor";
|
|
const submitVideoEditorID = "submitVideoEditor";
|
|
|
- const posterPreview = document.getElementById("posterPreview");
|
|
|
|
|
const videoPreview = document.getElementById("videoPreview");
|
|
const videoPreview = document.getElementById("videoPreview");
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1681,8 +1687,6 @@ var NEWSITEEDITOR = (function () {
|
|
|
hideModal();
|
|
hideModal();
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
- //console.log(info);
|
|
|
|
|
- posterPreview.src = info?.poster;
|
|
|
|
|
videoPreview.src = info.src;
|
|
videoPreview.src = info.src;
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -1784,7 +1788,7 @@ var NEWSITEEDITOR = (function () {
|
|
|
context_key: player.el().getAttribute("data-lang"),
|
|
context_key: player.el().getAttribute("data-lang"),
|
|
|
poster: player.poster(),
|
|
poster: player.poster(),
|
|
|
title: player.el().title,
|
|
title: player.el().title,
|
|
|
- aria: player.el().getAttribute("aria-label"),
|
|
|
|
|
|
|
+ aria: player.tech().el().getAttribute("aria-label"),
|
|
|
src: sources[0]?.src,
|
|
src: sources[0]?.src,
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
@@ -1916,8 +1920,6 @@ var NEWSITEEDITOR = (function () {
|
|
|
uppy.on("file-added", (file) => {
|
|
uppy.on("file-added", (file) => {
|
|
|
//console.log(file);
|
|
//console.log(file);
|
|
|
if (file.meta.fromServer) {
|
|
if (file.meta.fromServer) {
|
|
|
- const objectURL = URL.createObjectURL(file.data);
|
|
|
|
|
- posterPreview.src = objectURL;
|
|
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1926,25 +1928,23 @@ var NEWSITEEDITOR = (function () {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
uppy.on("file-editor:complete", (file) => {
|
|
uppy.on("file-editor:complete", (file) => {
|
|
|
- const objectURL = URL.createObjectURL(file.data);
|
|
|
|
|
file.meta.fromServer = false;
|
|
file.meta.fromServer = false;
|
|
|
- posterPreview.src = objectURL;
|
|
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- uppy.on("file-removed", () => {
|
|
|
|
|
|
|
+ /*uppy.on("file-removed", () => {
|
|
|
const info = getCurrentButtonInfo();
|
|
const info = getCurrentButtonInfo();
|
|
|
posterPreview.src = info?.poster;
|
|
posterPreview.src = info?.poster;
|
|
|
- });
|
|
|
|
|
|
|
+ });*/
|
|
|
|
|
|
|
|
uppy.on("file-editor:cancel", () => {
|
|
uppy.on("file-editor:cancel", () => {
|
|
|
uppy.cancelAll();
|
|
uppy.cancelAll();
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- uppy.on("cancel-all", () => {
|
|
|
|
|
|
|
+ /*uppy.on("cancel-all", () => {
|
|
|
if (!enable) return;
|
|
if (!enable) return;
|
|
|
const info = getCurrentButtonInfo();
|
|
const info = getCurrentButtonInfo();
|
|
|
posterPreview.src = info?.poster;
|
|
posterPreview.src = info?.poster;
|
|
|
- });
|
|
|
|
|
|
|
+ });*/
|
|
|
|
|
|
|
|
return uppy;
|
|
return uppy;
|
|
|
}
|
|
}
|
|
@@ -2236,6 +2236,13 @@ var NEWSITEEDITOR = (function () {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param {string} requestURL URL to request
|
|
|
|
|
+ * @param {string} method Type of method "POST, GET, PUT, DELETE"
|
|
|
|
|
+ * @param {FormData} Data Body of the request
|
|
|
|
|
+ * @returns
|
|
|
|
|
+ */
|
|
|
async function sendRequest(requestURL, method, Data) {
|
|
async function sendRequest(requestURL, method, Data) {
|
|
|
if (!requestURL.startsWith("http")) {
|
|
if (!requestURL.startsWith("http")) {
|
|
|
requestURL = baseURL + requestURL;
|
|
requestURL = baseURL + requestURL;
|
|
@@ -2280,6 +2287,14 @@ var NEWSITEEDITOR = (function () {
|
|
|
const modal = new Modal(modalId);
|
|
const modal = new Modal(modalId);
|
|
|
modal.setVisible(true);
|
|
modal.setVisible(true);
|
|
|
|
|
|
|
|
|
|
+ document.addEventListener('kserverbrowser:closed', (e) => {
|
|
|
|
|
+ console.log(e.detail.containerId, fileBrowserId)
|
|
|
|
|
+ if(e.detail.containerId === fileBrowserId) {
|
|
|
|
|
+ modal.setVisible(false)
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ }, {once: true});
|
|
|
|
|
+
|
|
|
modal.onBackgroundClick(() => modal.setVisible(false));
|
|
modal.onBackgroundClick(() => modal.setVisible(false));
|
|
|
modal.onCloseButtonClick();
|
|
modal.onCloseButtonClick();
|
|
|
|
|
|