瀏覽代碼

1e refactoring avec cursor... à continuer...

Intersel 1 年之前
父節點
當前提交
9c212bcdbc
共有 100 個文件被更改,包括 6225 次插入 和 2179 次删除
  1. 104 0
      classes/BaseHoverManager.js
  2. 119 0
      classes/Modal.js
  3. 134 0
      classes/README.md
  4. 53 0
      classes/SmartButton.js
  5. 120 0
      classes/newDeleteManager.js
  6. 123 0
      classes/newTranslateManager.js
  7. 788 0
      css/style.css
  8. 二進制
      images/650143.png
  9. 二進制
      images/860814.png
  10. 二進制
      images/Settings-icon-symbol-vector.png
  11. 二進制
      images/back1.png
  12. 二進制
      images/back2.png
  13. 二進制
      images/symbole-de-l-oeil-noir.png
  14. 1 0
      images/translate.svg
  15. 0 2179
      index.js
  16. 89 0
      modules/README.md
  17. 734 0
      modules/VideoEditor.js
  18. 1500 0
      newsiteeditor.js
  19. 106 0
      tests/README-nsecall.md
  20. 92 0
      tests/README.md
  21. 二進制
      tests/img/illusion-sphere.5c784939.webp
  22. 113 0
      tests/libraries/README.md
  23. 417 0
      tests/libraries/bootstrap-notify/bootstrap-notify.js
  24. 0 0
      tests/libraries/bootstrap-notify/bootstrap-notify.min.js
  25. 9 0
      tests/libraries/compressorjs/compressor.min.js
  26. 9 0
      tests/libraries/cropperjs/cropper.min.js
  27. 286 0
      tests/libraries/jquery.dotimeout.js
  28. 232 0
      tests/libraries/kserver/k-theme-primary.css
  29. 54 0
      tests/libraries/kserver/kserver.js
  30. 331 0
      tests/libraries/templates/template.js
  31. 0 0
      tests/libraries/tinymce/jquery.tinymce.min.js
  32. 3 0
      tests/libraries/tinymce/langs/readme.md
  33. 504 0
      tests/libraries/tinymce/license.txt
  34. 1 0
      tests/libraries/tinymce/plugins/advlist/plugin.min.js
  35. 1 0
      tests/libraries/tinymce/plugins/anchor/plugin.min.js
  36. 1 0
      tests/libraries/tinymce/plugins/autolink/plugin.min.js
  37. 1 0
      tests/libraries/tinymce/plugins/autoresize/plugin.min.js
  38. 0 0
      tests/libraries/tinymce/plugins/autosave/plugin.min.js
  39. 0 0
      tests/libraries/tinymce/plugins/bbcode/plugin.min.js
  40. 0 0
      tests/libraries/tinymce/plugins/charmap/plugin.min.js
  41. 1 0
      tests/libraries/tinymce/plugins/code/plugin.min.js
  42. 138 0
      tests/libraries/tinymce/plugins/codesample/css/prism.css
  43. 0 0
      tests/libraries/tinymce/plugins/codesample/plugin.min.js
  44. 1 0
      tests/libraries/tinymce/plugins/colorpicker/plugin.min.js
  45. 1 0
      tests/libraries/tinymce/plugins/contextmenu/plugin.min.js
  46. 1 0
      tests/libraries/tinymce/plugins/directionality/plugin.min.js
  47. 二進制
      tests/libraries/tinymce/plugins/emoticons/img/smiley-cool.gif
  48. 二進制
      tests/libraries/tinymce/plugins/emoticons/img/smiley-cry.gif
  49. 二進制
      tests/libraries/tinymce/plugins/emoticons/img/smiley-embarassed.gif
  50. 二進制
      tests/libraries/tinymce/plugins/emoticons/img/smiley-foot-in-mouth.gif
  51. 二進制
      tests/libraries/tinymce/plugins/emoticons/img/smiley-frown.gif
  52. 二進制
      tests/libraries/tinymce/plugins/emoticons/img/smiley-innocent.gif
  53. 二進制
      tests/libraries/tinymce/plugins/emoticons/img/smiley-kiss.gif
  54. 二進制
      tests/libraries/tinymce/plugins/emoticons/img/smiley-laughing.gif
  55. 二進制
      tests/libraries/tinymce/plugins/emoticons/img/smiley-money-mouth.gif
  56. 二進制
      tests/libraries/tinymce/plugins/emoticons/img/smiley-sealed.gif
  57. 二進制
      tests/libraries/tinymce/plugins/emoticons/img/smiley-smile.gif
  58. 二進制
      tests/libraries/tinymce/plugins/emoticons/img/smiley-surprised.gif
  59. 二進制
      tests/libraries/tinymce/plugins/emoticons/img/smiley-tongue-out.gif
  60. 二進制
      tests/libraries/tinymce/plugins/emoticons/img/smiley-undecided.gif
  61. 二進制
      tests/libraries/tinymce/plugins/emoticons/img/smiley-wink.gif
  62. 二進制
      tests/libraries/tinymce/plugins/emoticons/img/smiley-yell.gif
  63. 1 0
      tests/libraries/tinymce/plugins/emoticons/plugin.js
  64. 1 0
      tests/libraries/tinymce/plugins/emoticons/plugin.min.js
  65. 8 0
      tests/libraries/tinymce/plugins/example/dialog.html
  66. 1 0
      tests/libraries/tinymce/plugins/example/plugin.min.js
  67. 1 0
      tests/libraries/tinymce/plugins/example_dependency/plugin.min.js
  68. 0 0
      tests/libraries/tinymce/plugins/fullpage/plugin.min.js
  69. 1 0
      tests/libraries/tinymce/plugins/fullscreen/plugin.min.js
  70. 1 0
      tests/libraries/tinymce/plugins/hr/plugin.min.js
  71. 0 0
      tests/libraries/tinymce/plugins/image/plugin.min.js
  72. 0 0
      tests/libraries/tinymce/plugins/imagetools/plugin.min.js
  73. 0 0
      tests/libraries/tinymce/plugins/importcss/plugin.min.js
  74. 1 0
      tests/libraries/tinymce/plugins/insertdatetime/plugin.min.js
  75. 0 0
      tests/libraries/tinymce/plugins/layer/plugin.min.js
  76. 0 0
      tests/libraries/tinymce/plugins/legacyoutput/plugin.min.js
  77. 0 0
      tests/libraries/tinymce/plugins/link/plugin.js
  78. 0 0
      tests/libraries/tinymce/plugins/link/plugin.min.js
  79. 0 0
      tests/libraries/tinymce/plugins/lists/plugin.min.js
  80. 二進制
      tests/libraries/tinymce/plugins/media/moxieplayer.swf
  81. 0 0
      tests/libraries/tinymce/plugins/media/plugin.min.js
  82. 1 0
      tests/libraries/tinymce/plugins/nonbreaking/plugin.min.js
  83. 1 0
      tests/libraries/tinymce/plugins/noneditable/plugin.min.js
  84. 1 0
      tests/libraries/tinymce/plugins/pagebreak/plugin.min.js
  85. 0 0
      tests/libraries/tinymce/plugins/paste/plugin.js
  86. 0 0
      tests/libraries/tinymce/plugins/paste/plugin.min.js
  87. 1 0
      tests/libraries/tinymce/plugins/preview/plugin.js
  88. 1 0
      tests/libraries/tinymce/plugins/preview/plugin.min.js
  89. 1 0
      tests/libraries/tinymce/plugins/print/plugin.min.js
  90. 1 0
      tests/libraries/tinymce/plugins/save/plugin.min.js
  91. 0 0
      tests/libraries/tinymce/plugins/searchreplace/plugin.min.js
  92. 0 0
      tests/libraries/tinymce/plugins/spellchecker/plugin.min.js
  93. 1 0
      tests/libraries/tinymce/plugins/tabfocus/plugin.min.js
  94. 0 0
      tests/libraries/tinymce/plugins/table/plugin.js
  95. 0 0
      tests/libraries/tinymce/plugins/table/plugin.min.js
  96. 0 0
      tests/libraries/tinymce/plugins/template/plugin.min.js
  97. 0 0
      tests/libraries/tinymce/plugins/textcolor/plugin.js
  98. 0 0
      tests/libraries/tinymce/plugins/textcolor/plugin.min.js
  99. 0 0
      tests/libraries/tinymce/plugins/textpattern/plugin.min.js
  100. 135 0
      tests/libraries/tinymce/plugins/visualblocks/css/visualblocks.css

+ 104 - 0
classes/BaseHoverManager.js

@@ -0,0 +1,104 @@
+/**
+ * @abstract
+ * @class BaseHoverManager
+ * An abstract class that provides hover and click state management for a group of DOM elements.
+ * Extend this class to build custom managers with specific behaviors.
+ */
+export class BaseHoverManager {
+    /**
+     *
+     * @param {string} selector - CSS selector for targeting DOM elements.
+     * @param {string} [hoverClass="hovered"] - CSS class applied on hover.
+     * @param {string} [clickedClass="clicked"] - CSS class applied on click.
+     */
+    constructor(selector, hoverClass = "hovered", clickedClass = "clicked") {
+        this.selector = selector;
+        this.hoverClass = hoverClass;
+        this.clickedClass = clickedClass;
+        this.hoverActive = false;
+
+        this.addHoverClass = this.addHoverClass.bind(this);
+        this.removeHoverClass = this.removeHoverClass.bind(this);
+        this.toggleHover = this.toggleHover.bind(this);
+    }
+
+    /**
+     * Use the data-newmanager with value attribute to exclude from the selected elements
+     */
+    getElements() {
+        return Array.from(document.querySelectorAll(this.selector)).filter(
+            (el) => el.getAttribute("data-newmanager") !== "false"
+        );
+    }
+
+    disableHover() {
+        if (this.hoverActive) {
+            this.hoverActive = false;
+            this.onHoverDisabled();
+        }
+    }
+
+    toggleHover() {
+        this.hoverActive = !this.hoverActive;
+
+        this.getElements().forEach((el) => {
+            if (this.hoverActive) {
+                //On supprime chaque instance de TinyMce sinon il s'active lors des clics
+                el.addEventListener("mouseenter", this.addHoverClass);
+                el.addEventListener("mouseleave", this.removeHoverClass);
+            } else {
+                el.removeEventListener("mouseenter", this.addHoverClass);
+                el.removeEventListener("mouseleave", this.removeHoverClass);
+            }
+
+            this.clearElementState(el);
+        });
+
+        if (!this.hoverActive) {
+            // TinyMCE function will be provided by the main module
+            if (typeof TinyMCE === 'function') {
+                TinyMCE();
+            }
+            this.onHoverDisabled?.();
+        } else {
+            if (typeof tinymce !== 'undefined') {
+                tinymce.remove();
+            }
+        }
+    }
+
+
+    addHoverClass(e) {
+        e.currentTarget.classList.add(this.hoverClass);
+    }
+
+    removeHoverClass(e) {
+        e.currentTarget.classList.remove(this.hoverClass);
+    }
+
+    clearElementState(el) {
+
+    }
+
+    onHoverDisabled() {}
+
+    handleClick(e) {}
+
+    init() {
+        this.getElements().forEach((el) => {
+            el.addEventListener("click", this.handleClick);
+        });
+    }
+
+    destroy() {
+        this.getElements().forEach((e) => e.classList.remove(this.hoverClass, this.clickedClass))
+        this.smartButton.hide();
+        this.getElements().forEach((el) => {
+            el.removeEventListener("click", this.handleClick);
+        });
+        if(this.hoverActive) {
+            this.toggleHover();
+        }
+    }
+
+}

+ 119 - 0
classes/Modal.js

@@ -0,0 +1,119 @@
+/**
+ * @class Modal
+ * @description Modal is a class that enable to control easily a modal
+ */
+export class Modal {
+    /**
+     *
+     * @param {string} modalId - The ID of the element where the modal should appear.
+     */
+    constructor(modalId) {
+        this.modal = document.getElementById(modalId);
+        this.isOpen = this.modal ? this.modal.classList.contains("open") : false;
+    }
+
+    open() {
+        if (!this.modal) return;
+        this.modal.classList.add("open");
+        document.body.style.overflow = "hidden";
+        this.isOpen = true;
+    }
+
+    /**
+     * Set text error in your modal
+     * @param {String} text - The text error you want to show 
+     * @param {String} [type] The type of alert you want
+     * @param {String} alertId 
+     * @returns {Void}
+     */
+    setError(text, type, alertId = "default", loader = false) {
+        const nseHeader = this.modal.querySelector('.nseHeader');
+        const nseError = nseHeader?.querySelector(`.alert#${CSS.escape(alertId)}`);
+        if (!nseHeader || !nseError) return;
+    
+        if (!text) return nseError.style.display = "none";
+    
+        if (type) {
+            nseError.classList.forEach((e) => {
+                if (e === "alert") return;
+                nseError.classList.remove(e);
+            });
+            nseError.classList.add(type);
+        }
+    
+        nseError.textContent = text;
+    
+        if (loader) {
+            const loaderSpan = document.createElement("span");
+            loaderSpan.className = "loader";
+            nseError.appendChild(loaderSpan);
+        }
+    
+        nseError.style.display = "flex";
+    }
+
+    
+    addAlert(type = "info") {
+        const nseHeader = this.modal.querySelector('.nseHeader');
+        if (!nseHeader) return -1;
+
+        let alert = document.createElement("div");
+        alert.classList.add("alert", type);
+        alert.id = Math.random() * 1000000;
+
+        nseHeader.append(alert);
+
+        return alert.id;
+    }
+
+    close() {
+        if (!this.modal) return;
+        this.modal.classList.remove("open");
+        document.body.style.overflow = "auto";
+        this.isOpen = false;
+    }
+
+    /**
+     * Sets the visibility of the modal.
+     *
+     * @param {boolean} visible - If true, the modal is opened; if false, it is closed.
+     */
+    setVisible(visible) {
+        visible ? this.open() : this.close();
+    }
+
+    isVisible() {
+        return this.isOpen;
+    }
+
+    /**
+     * @returns {HTMLElement} - Get the the html element modal
+     */
+    getModal() {
+        return this.modal;
+    }
+
+    /**
+     * When background is clicked
+     * @param {CallableFunction} callback - Function that enable when the background is clicked
+     */
+    onBackgroundClick(callback) {
+        this.modal.addEventListener("click", (e) => {
+            if (e.target === this.modal) callback();
+        });
+    }
+
+    onValidate(callback, selector = ".validateBtn") {
+        const btn = this.modal.querySelector(selector);
+        if (btn) {
+            btn.addEventListener("click", () => callback());
+        }
+    }
+
+    onCloseButtonClick(selector = ".closeBtn") {
+        const btn = this.modal.querySelector(selector);
+        if (btn) {
+            btn.addEventListener("click", () => this.setVisible(false));
+        }
+    }
+}

+ 134 - 0
classes/README.md

@@ -0,0 +1,134 @@
+# Classes du NewSiteEditor
+
+Ce dossier contient toutes les classes extraites du fichier principal `index.js` pour une meilleure organisation et maintenabilité du code.
+
+## Structure des fichiers
+
+### Modal.js
+- **Classe** : `Modal`
+- **Description** : Gère l'affichage et le contrôle des modales
+- **Méthodes principales** :
+  - `open()` / `close()` : Ouvrir/fermer la modale
+  - `setVisible(boolean)` : Contrôler la visibilité
+  - `setError(text, type, alertId, loader)` : Afficher des erreurs
+  - `onBackgroundClick(callback)` : Gérer les clics sur le fond
+  - `onValidate(callback, selector)` : Gérer la validation
+
+### SmartButton.js
+- **Classe** : `SmartButton`
+- **Description** : Crée des boutons mobiles positionnables
+- **Méthodes principales** :
+  - `moveTo(x, y)` : Déplacer le bouton à une position
+  - `show()` / `hide()` : Afficher/masquer le bouton
+  - `onClick(callback)` : Gérer les clics
+
+### BaseHoverManager.js
+- **Classe** : `BaseHoverManager` (classe abstraite)
+- **Description** : Gère les états de survol et de clic pour des éléments DOM
+- **Méthodes principales** :
+  - `toggleHover()` : Activer/désactiver le mode survol
+  - `getElements()` : Récupérer les éléments ciblés
+  - `init()` / `destroy()` : Initialiser/détruire le manager
+
+### newDeleteManager.js
+- **Classe** : `newDeleteManager` (hérite de BaseHoverManager)
+- **Description** : Gère la suppression de ressources
+- **Fonctionnalités** :
+  - Sélection d'éléments à supprimer
+  - Confirmation via modale
+  - Appel API pour suppression
+
+### newTranslateManager.js
+- **Classe** : `newTranslateManager` (hérite de BaseHoverManager)
+- **Description** : Gère la traduction de ressources
+- **Fonctionnalités** :
+  - Sélection d'éléments à traduire
+  - Interface de traduction
+  - Gestion des ressources de page
+
+## Utilisation
+
+### Import des classes
+```javascript
+import { Modal } from './classes/Modal.js';
+import { SmartButton } from './classes/SmartButton.js';
+import { BaseHoverManager } from './classes/BaseHoverManager.js';
+import { newDeleteManager } from './classes/newDeleteManager.js';
+import { newTranslateManager } from './classes/newTranslateManager.js';
+```
+
+### Exemple d'utilisation
+```javascript
+// Créer une modale
+const modal = new Modal('myModalId');
+modal.open();
+
+// Créer un bouton intelligent
+const smartBtn = new SmartButton('myButtonId');
+smartBtn.moveTo(100, 100);
+
+// Créer un manager de suppression
+const deleteManager = new newDeleteManager();
+deleteManager.init();
+```
+
+## Dépendances
+
+- **Modal** : Aucune dépendance externe
+- **SmartButton** : Aucune dépendance externe
+- **BaseHoverManager** : Dépend de TinyMCE (fourni par le module principal)
+- **newDeleteManager** : Dépend de Modal, SmartButton, BaseHoverManager
+- **newTranslateManager** : Dépend de Modal, SmartButton, BaseHoverManager
+
+## Configuration
+
+### Préfixe REST configurable
+
+Toutes les classes qui effectuent des appels API utilisent un préfixe REST configurable. Par défaut, le préfixe est `/rest`, mais il peut être personnalisé via la configuration globale.
+
+#### Configuration du préfixe REST
+
+```javascript
+// Avant de charger les modules NewSiteEditor
+window.NEWSITEEDITOR_CONFIG = {
+    restPrefix: "/rest"  // Préfixe par défaut
+};
+```
+
+#### Exemples de configuration
+
+```javascript
+// Préfixe par défaut
+window.NEWSITEEDITOR_CONFIG = {
+    restPrefix: "/rest"  // → "/rest/dashboard/", "/rest/newsiteeditor/"
+};
+
+// Préfixe API
+window.NEWSITEEDITOR_CONFIG = {
+    restPrefix: "/api"   // → "/api/dashboard/", "/api/newsiteeditor/"
+};
+
+// Préfixe versionné
+window.NEWSITEEDITOR_CONFIG = {
+    restPrefix: "/v1"    // → "/v1/dashboard/", "/v1/newsiteeditor/"
+};
+
+// Préfixe personnalisé
+window.NEWSITEEDITOR_CONFIG = {
+    restPrefix: "/custom/path"  // → "/custom/path/dashboard/", "/custom/path/newsiteeditor/"
+};
+```
+
+#### Chemins utilisés par les classes
+
+- **newDeleteManager** : `${REST_PREFIX}/dashboard/${type}/${id}` (DELETE)
+- **newTranslateManager** : Utilise les chemins configurés dans le module principal
+- **VideoEditor** : `${REST_PREFIX}/newsiteeditor/dir`, `${REST_PREFIX}/newsiteeditor/video/`
+
+## Notes importantes
+
+1. Les classes utilisent des modules ES6 avec `export`/`import`
+2. Certaines dépendances globales (comme `baseURL`, `TinyMCE`) sont gérées dans les classes qui en ont besoin
+3. La méthode `launchTranslate()` dans `newTranslateManager` est un placeholder qui doit être implémentée selon la logique de traduction spécifique
+4. Le fichier `test.html` fournit des exemples d'utilisation pour tester les classes
+5. **Configuration REST** : Le préfixe REST est configurable globalement et s'applique à toutes les classes

+ 53 - 0
classes/SmartButton.js

@@ -0,0 +1,53 @@
+/**
+ * @class SmartButton
+ * @description SmartButton is a class that enables the creation of a movable button.
+ */
+export class SmartButton {
+    constructor(buttonId) {
+        this.button = document.getElementById(buttonId);
+        if (!this.button) throw new Error("SmartButton not found");
+        this.isVisible = false;
+    }
+
+    /**
+     * Move the smartButton to the target position
+     * @param {number} x - X Position
+     * @param {number} y - Y position
+     */
+    moveTo(x, y) {
+        Object.assign(this.button.style, {
+            left: `${x}px`,
+            top: `${y}px`,
+            position: "absolute",
+        });
+        this.show();
+    }
+
+    show() {
+        this.button.style.display = "block";
+        this.isVisible = true;
+    }
+
+    hide() {
+        this.button.style.display = "none";
+        this.isVisible = false;
+    }
+
+    setPosition(x, y) {
+        this.moveTo(x, y);
+    }
+
+    /**
+     * 
+     * @returns {HTMLElement}
+     */
+    getElement() {
+        return this.button;
+    }
+
+    onClick(callback) {
+        this.button.addEventListener("click", () => {
+            callback();
+        });
+    }
+}

+ 120 - 0
classes/newDeleteManager.js

@@ -0,0 +1,120 @@
+import { BaseHoverManager } from './BaseHoverManager.js';
+import { Modal } from './Modal.js';
+import { SmartButton } from './SmartButton.js';
+
+const baseURL = window.location.origin;
+// Configuration du préfixe REST - peut être surchargée via window.NEWSITEEDITOR_CONFIG
+const REST_PREFIX = (window.NEWSITEEDITOR_CONFIG && window.NEWSITEEDITOR_CONFIG.restPrefix) || "/rest";
+
+export class newDeleteManager extends BaseHoverManager {
+    constructor(toggleButtonId = "delete", bgModalId = "modalDelete", deleteButtonId = "btnDelete") {
+        super("[data-deleteid]", "deletable", "inDelete");
+
+        this.deleteID = null;
+
+        this.bgModal = new Modal(bgModalId);
+        this.smartButton = new SmartButton("btnDelete");
+
+        this.toggleButton = document.getElementById(toggleButtonId);
+
+        this.type = "data-deleteType";
+
+        this.storeData = this.storeData.bind(this);
+        this.removeResource = this.removeResource.bind(this);
+
+        this.onHoverDisabled = () => {
+            this.bgModal.setVisible(false);
+            this.smartButton.hide();
+            this.deleteID = null;
+        };
+
+        this.handleClick = (e) => {
+            const el = e.currentTarget;
+            this.storeData(e);
+
+            if (el.classList.contains(this.hoverClass)) {
+                this.getElements().forEach((otherEl) => {
+                    if (otherEl !== el) {
+                        otherEl.classList.remove(this.hoverClass, this.clickedClass);
+                    }
+                });
+
+                el.classList.add(this.clickedClass);
+
+                this.smartButton.setPosition(e.pageX, e.pageY - 20);
+            }
+        }
+    }
+
+    storeData(e) {
+        const id = e.currentTarget.getAttribute("data-deleteid");
+        if (id) {
+            this.deleteID = id;
+        }
+    }
+
+    init() {
+        super.init();
+
+        if (this.toggleButton) {
+            this.toggleButton.addEventListener("click", this.toggleHover);
+        }
+
+        if (this.smartButton.getElement()) {
+            this.smartButton.onClick(() => {
+                this.bgModal.setVisible(true);
+                this.smartButton.hide();
+            })
+
+            this.bgModal.onBackgroundClick(() => this.bgModal.setVisible(false));
+            this.bgModal.onCloseButtonClick(".cancelBtn");
+            this.bgModal.onValidate(() => this.removeResource());
+        }
+    }
+
+    getType() {
+        if (!this.deleteID) return null;
+        const el = document.querySelector(`[data-deleteid="${this.deleteID}"]`);
+        return el?.getAttribute(this.type) ?? null;
+    }
+
+
+    clearElementState(el) {
+        el.classList.remove(this.hoverClass, this.clickedClass);
+    }
+
+    async removeResource() {
+        try {
+            if (!this.getType()) {
+                console.error("No type define in [data-deleteType]");
+                this.bgModal.setVisible(false);
+                return;
+            }
+
+            const response = await fetch(
+                `${baseURL}${REST_PREFIX}/dashboard/${this.getType()}/${this.deleteID}`,
+                {
+                    method: "DELETE",
+                }
+            );
+
+            if (!response.ok) {
+                throw new Error(
+                    `Erreur ${response.status} : la ressource n'a pas pu être supprimée.`
+                );
+            }
+
+            const data = await response.json();
+            if (data.code === "200") {
+                document
+                    .querySelector('[data-deleteid="' + this.deleteID + '"]')
+                    .remove();
+                this.bgModal.setVisible(false);
+            }
+            return data;
+        } catch (error) {
+            console.error("Erreur lors de la suppression :", error);
+            throw error;
+        }
+    }
+}

+ 123 - 0
classes/newTranslateManager.js

@@ -0,0 +1,123 @@
+import { BaseHoverManager } from './BaseHoverManager.js';
+import { Modal } from './Modal.js';
+import { SmartButton } from './SmartButton.js';
+
+export class newTranslateManager extends BaseHoverManager {
+    constructor(openModalButtonId = "btnTranslate", bgModalId = "modalTranslateTemplate", toggleButtonId = "translate") {
+
+        super("[data-resourceid]", "clicked", "veryclicked");
+
+        this.resourceId = null;
+
+        this.modal = new Modal(bgModalId);
+        this.modal.onValidate(() => {
+                this.launchTranslate()
+        })
+
+        this.smartButton = new SmartButton(openModalButtonId);
+        this.pageSmartButton = new SmartButton("btnTranslatePage");
+        this.toggleButton = document.getElementById(toggleButtonId);
+
+        this.getSelector = this.getSelector.bind(this);
+        this.getElementWithSameId = this.getElementWithSameId.bind(this);
+        this.switchResourceId = "id_switchResourceId";
+
+        this.onHoverDisabled = () => {
+            this.modal.setVisible(false);
+            this.smartButton.hide();
+            this.resourceId = null;
+            this.getElements().forEach((element) => {
+                element.classList.remove(this.hoverClass, this.clickedClass);
+            })
+        };
+
+        this.handleClick = (e) => {
+            const el = e.currentTarget;
+            //console.log(el)
+            e.stopPropagation();
+            if (!this.hoverActive) return;
+
+            this.getElements().forEach((otherEl) => {
+                if (otherEl !== el) {
+                    otherEl.classList.remove(this.hoverClass, this.clickedClass);
+                }
+            });
+
+            let elements = this.getElementWithSameId(this.getSelector(el));
+            const rect = elements[0].getBoundingClientRect();
+
+            const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
+            const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
+
+            const button = this.smartButton.getElement();
+            const buttonWidth = button.offsetWidth;
+            const buttonHeight = button.offsetHeight;
+
+            const x = rect.left + scrollLeft + rect.width / 2 - buttonWidth / 2;
+            const y = rect.top + scrollTop - buttonHeight - 8;
+
+            this.smartButton.setPosition(x, y);
+            this.resourceId = this.getSelector(el);
+
+            elements.forEach((el) => el.classList.add(this.clickedClass));
+        };
+
+
+        if (this.smartButton.getElement()) {
+            this.modal.onBackgroundClick(() => this.modal.setVisible(false));
+            this.modal.onCloseButtonClick();
+            this.smartButton.onClick(() => {
+                this.modal.setVisible(true);
+                this.smartButton.hide();
+                document.getElementById(this.switchResourceId).value = this.resourceId;
+            });
+        }
+
+        this.pageSmartButton.onClick(() => {
+            this.modal.setVisible(true);
+            document.getElementById(this.switchResourceId).value = document.body.getAttribute('data-pageid');
+            document.getElementById('checkbox_children').checked = true;
+            document.getElementById('checkbox_hidden_children').value = 1;
+        })
+
+    }
+
+    init() {
+        this.pageSmartButton[document.body.hasAttribute('data-pageid') ? 'show' : 'hide']();
+        super.init();
+
+        if (this.toggleButton) {
+            this.toggleButton.addEventListener("click", this.toggleHover);
+        }
+    }
+
+    destroy() {
+        super.destroy();
+        this.pageSmartButton.hide();
+    }
+
+    getSelector(e) {
+        return e.getAttribute(this.selector.replace(/\[|\]/g, ""))
+    }
+
+    addHoverClass(e) {
+        this.getElements().forEach((el) => el.classList.remove(this.hoverClass));
+        this.getElementWithSameId(this.getSelector(e.target)).forEach((el) => el.classList.add(this.hoverClass));
+    }
+
+    removeHoverClass(e) {
+        this.getElementWithSameId(this.getSelector(e.target)).forEach((el) => el.classList.remove(this.hoverClass));
+    }
+
+    getElementWithSameId(id) {
+        return Array.from(document.querySelectorAll(this.selector)).filter(
+            (el) => this.getSelector(el) === id
+        );
+    }
+
+    launchTranslate() {
+        // This method should be implemented based on the translation logic
+        console.log('Launch translate functionality');
+    }
+
+}

+ 788 - 0
css/style.css

@@ -0,0 +1,788 @@
+@import url('../../../../templates/css/fonts/inter.css');
+
+:root {
+    --theme-color: #549c89;
+    --first-row-left-position: 73px;
+    --second-row-left-position: 132px;
+    --gap-btween-btn: 60px;
+    --start-bottom-position: 5px;
+    --error-color: red;
+    --info-color: rgb(38, 38, 256);
+    --sucess-color: rgb(11, 88, 28);
+}
+
+/*
+    Pour positionner facilement les boutons faites :
+
+    bottom: calc(var(--start-bottom-position) + (positionDuButton * var(--gap-btween-btn))) ;
+
+    Le bouton le plus bas commence à 1 plus c'est haut c'est élevé
+*/
+
+/*
+# Z-indexer :
+
+Maximum (loader)						            ->	10000
+
+.nseBgModal	                    				    ->	9999
+#cropper-modal	                        		    ->	3000
+#modalNseVideoBackground, #modalNseBackground     	->	2200
+.fred .fred--launcher_center	            		->	2100
+#sidebarNewSiteEditor                     			->	2000
+#btnTranslate	                    				->	1400
+.defaultNseButton	                				->	1300
+#editImageBtn                     					->	1200
+#btnTranslatePage                     				->	1100
+.bgModal                         					->	210
+.btnDelete                         					->	200
+
+Minimum (Navbar)						            ->	100
+*/
+
+.fred .fred--launcher_center {
+    position: fixed;
+    width: 100%;
+    z-index: 2100;
+    display: inline-block;
+    display: flex;
+    justify-content: center;
+    bottom: 3vh;
+}
+
+
+.fred .fred--launcher_btn {
+    border-radius: 50%;
+    border: none;
+    background: #b1b1b1 50% no-repeat;
+    background-size: 60%;
+    padding: 0;
+    height: 48px;
+    width: 48px;
+    box-shadow: 0 4px 8px rgba(39,39,39,.34);
+    transition: .3s;
+}
+
+.fred .fred--launcher_btn:hover {
+    transform: scale(1.05)
+}
+
+.fred .fred--launcher_btn i {
+    color: white;
+    font-size: 28px;
+}
+
+.fred .fred--launcher_btn_manager {
+    background-color: var(--theme-color);
+    background-image: url("../images/860814.png");
+    position: absolute;
+    bottom: calc(var(--start-bottom-position) + (3 * var(--gap-btween-btn))) ;
+    left: var(--second-row-left-position);
+    visibility : hidden;
+}/*visibility : hidden;*/
+
+/* Pour le bouton manager si message dans le bouton
+border-radius: 11px;
+    height: 48px;
+    width: 210px;
+    color: white;
+    font-size: 1.5vh;
+*/
+
+.fred .fred--launcher_btn_help {
+    background-color: var(--theme-color);
+    /* background-image: url(../images/symbole-de-l-oeil-noir.png); */
+    position: absolute;
+    bottom: calc(var(--start-bottom-position) + (0 * var(--gap-btween-btn)));
+    left: var(--second-row-left-position);
+}
+
+.fred .fred--launcher_btn_undo {
+    background-color: #ed673e;
+    background-image: url("../images/back1.png");
+    position: absolute;
+    bottom: calc(var(--start-bottom-position) + (1 * var(--gap-btween-btn)));
+    left: var(--first-row-left-position);
+}
+
+.fred .fred--launcher_btn_remove {
+    background-color: #FF0000;
+    position: absolute;
+    left: var(--first-row-left-position);
+    bottom: var(--start-bottom-position);
+    display: flex;
+    align-items: center;
+    justify-content: center;
+}
+
+.fred .fred--launcher_btn_translate {
+    background-color: var(--theme-color);
+    background-image: url("../images/translate.svg");
+    position: absolute;
+    left: var(--second-row-left-position);
+    bottom: calc(var(--start-bottom-position) + (2 * var(--gap-btween-btn)));
+}
+
+.fred .fred--launcher_btn_redo {
+    background-color: #0132b5;
+    background-image: url("../images/back2.png");
+    position: absolute;
+    bottom: calc(var(--start-bottom-position) + (1 * var(--gap-btween-btn))) ;
+    left: var(--second-row-left-position);
+}
+
+.fred .fred--launcher_btn_view {
+    background-color: var(--theme-color);
+    background-image: url("../images/symbole-de-l-oeil-noir.png");
+    position: absolute;
+    bottom: calc(var(--start-bottom-position) + (3 * var(--gap-btween-btn))) ;
+    left: var(--first-row-left-position);
+}
+
+.fred .fred--launcher_btn_edit {
+    background-color: var(--theme-color);
+    background-image: url("../images/650143.png");
+    position: absolute;
+    bottom: 5px;
+}
+
+.fred .fred--launcher_btn_sidebarToggle {
+    position: absolute;
+    bottom: calc(var(--start-bottom-position) + (2 * var(--gap-btween-btn))) ;
+    left: var(--first-row-left-position);
+    background-image: url("../images/Settings-icon-symbol-vector.png");
+    background-color : grey;
+}
+.fred .fred--launcher_btn_customerManagerPage {
+    position: absolute;
+    bottom: calc(var(--start-bottom-position) + (2 * var(--gap-btween-btn))) ;
+    left: var(--first-row-left-position);
+    background-image: url("../images/Settings-icon-symbol-vector.png");
+    background-color : grey;
+}
+
+/*.selected{
+    box-shadow: 3px 6px 50px rgb(171 168 168 / 29%) !important;
+    border: 1mm solid #d8e6ef !important;
+}*/
+
+.selected{
+    box-shadow: 1px 2px 30px #b8c6ce !important;
+}
+
+#wrapper {
+    /*display: flex;*/
+    width: 100%;
+}
+
+#sidebarNewSiteEditor  {
+    position: fixed;
+    width: 250px;
+    /*background-image: linear-gradient(to right, #3f4850 0%, #365462 46%, #3e5554 60%, #42554d 68%, #573d4e 100%);*/
+    height : 100vh;
+    z-index: 2000;
+    background-image: linear-gradient(to right, #3f4850 10%, #365462 100%);
+    box-shadow: 0 2px 0 #e4e4e4;
+}
+
+#body{
+    position: absolute;
+    right: 0;
+    width: calc(100% - 250px);
+}
+
+/*
+#topmenu {
+    position: absolute;
+    right: 0;
+}
+*/
+
+.no-sidebar #sidebarNewSiteEditor {
+    display: none;
+}
+
+.no-sidebar #body{
+    width: 100%;
+}
+
+/*
+.no-sidebar #topmenu{
+    width: 100%;
+} */
+
+#noResourceSelected{
+    margin-top: 30vh;
+    text-align: center;
+}
+
+#noResourceSelected p{
+    color: white;
+    font-family: "Helvetica Neue", Helvetica, Arial, Tahoma, sans-serif;
+}
+
+/*
+#noResource{
+    margin-top: 30vh;
+    text-align: center;
+    font-size: 37px;
+    font-weight: bold;
+    color: white;
+}*/
+
+#resourceName{
+    color: white;
+    overflow: hidden;
+    text-align: center;
+    margin-top: 6vh;
+    font: normal 24px "Helvetica Neue", Helvetica, Arial, Tahoma, sans-serif;
+}
+
+/*
+.listeDeroulante{
+    margin-left: 1vh;
+}
+*/
+
+.parametre{
+    padding: 12px;
+    font-size: 2vh;
+    margin-top: 4vh;
+}
+
+.labelInput{
+    color:white;
+    font: 16px "Helvetica Neue", Helvetica, Arial, Tahoma, sans-serif
+}
+
+.inputBox {
+    background-color: #FBFBFB;
+    background-image: none;
+    border-radius: 3px;
+    border: 1px solid #E4E4E4;
+    position: relative;
+    transition: border-color 0.25s;
+    font: 16px "Helvetica Neue", Helvetica, Arial, Tahoma, sans-serif
+}
+
+label[for="paddingTop"],[for="paddingBottom"]{
+    width:100%;
+}
+
+/* newFileEditor */
+
+
+.defaultNseButton, .uppy-StatusBar-actionBtn--upload {
+    padding: .375rem .75rem;
+    border-radius: .25rem !important;
+    background-color: var(--theme-color);
+    color: white;
+    cursor: pointer;
+}
+
+.defaultNseButton.visible {
+    background-color: white !important;
+    color: black !important;
+    box-shadow: 0px 10px 61px -3px rgba(0, 0, 0, 0.685);
+}
+
+.defaultNseButton.closed {
+    background: #ed673e !important;
+}
+
+.close {
+    position: absolute;
+    top: 20px;
+    right: 24px;
+    width: 40px;
+    padding: 0.5rem;
+    transition: 0.3s background;
+    height: 40px;
+    border-radius: 4px;
+}
+
+.close:hover {
+    background: #f5f5f5;
+}
+
+.defaultNseButton:disabled {
+    background: #EBEBE4 !important;
+    cursor: not-allowed;
+}
+
+.defaultNseButton[data-movable] {
+    position: absolute;
+    z-index: 1300;
+}
+
+.defaultNseButton.upload {
+    background: #ececec;
+    border: 1px solid #cdcdcd;
+    color: black;
+    transition: 0.3s background;
+}
+
+.defaultNseButton.upload:hover {
+    background: #d2d2d2;
+}
+
+#modalNse #uppy .uppy-u-reset .uppy-Dashboard-Item-action--remove {
+    visibility: hidden !important;
+}
+
+#modalNseVideoBackground, #modalNseBackground {
+    display: none;
+    position: fixed;
+    left: 0;
+    top: 0;
+    height: 100vh;
+    width: 100%;
+    z-index: 2200;
+    background-color: rgba(0, 0, 0, 0.247);
+    justify-content: center;
+    align-items: center;
+    cursor: pointer;
+}
+
+#modalPosterNse, #modalVideoNse, #modalNse {
+    font-family: "Inter", 'Arial Narrow Bold', sans-serif;
+    background-color: rgb(255, 255, 255);
+    border-radius: 10px;
+    box-shadow: rgba(0, 0, 0, 0.068) 0px 7px 29px 0px;
+    cursor: default;
+    padding: 1.5rem;
+    margin: 0 20px;
+    position: relative;
+
+    & h1 {
+        font-size: 20px;
+        font-weight: bold;
+        margin-bottom: 1rem;
+    }
+
+    & .modalButtonContainer {
+        display: flex;
+        margin-top: 5px;
+        justify-content: space-between;
+    }
+
+    & .modalFlex {
+        display: flex;
+        flex-direction: column;
+        margin-bottom: 1rem;
+
+        & .row {
+            display: flex;
+            flex-direction: row;
+            align-items: center;
+        }
+
+        & label {
+            font-size: 14px;
+            color: #272b33;
+            margin-bottom: 0.5rem;
+        }
+
+        & input {
+            height: 40px;
+            padding: 0.5rem;
+            padding-inline: 10px 20px;
+            outline: 1px solid #d1d5dc;
+            border-radius: 0.25rem;
+            font-size: 0.95rem;
+            color: #101828;
+            width: 100%;
+        }
+
+        & :has(button) {
+            input {
+                margin-right: 20px;
+            }
+
+        }
+    }
+}
+
+#modalNse i {
+    font-size: 10px;
+}
+
+#modalVideoNse {
+    display: none;
+}
+
+.previewCenter {
+    display: flex;
+    justify-content: center;
+    margin-top: 0.5rem;
+    margin-bottom: 1rem;
+}
+
+.preview {
+    aspect-ratio: 16 / 9;
+    max-width: 400px;
+    border-radius: 0.25rem;
+    object-fit: cover;
+}
+
+
+#cropper-modal {
+    display: none;
+    position: fixed;
+    top: 0; left: 0; right: 0; bottom: 0;
+    background: rgba(0, 0, 0, 0.7);
+    justify-content: center;
+    align-items: center;
+    z-index: 3000;
+}
+
+#cropper-modal.active {
+    display: flex;
+}
+
+#cropper-container {
+    background: white;
+    padding: 20px;
+    border-radius: 8px;
+    max-width: 90%;
+    max-height: 890px;
+    overflow: auto;
+}
+
+#cropper-container img {
+    max-width: 100%;
+    height: auto;
+    width: 400px;
+}
+
+#cropper-actions {
+    margin-top: 10px;
+    text-align: right;
+    display: flex;
+    justify-content: space-between;
+}
+
+.imageeditor {
+    transition: 300ms ease-in-out;
+}
+
+.imageeditor.selected-img{
+    filter: saturate(250%);
+    box-sizing: border-box;
+}
+
+#editImageBtn {
+    display: none;
+    position: absolute;
+    z-index: 1200;
+}
+
+#videoEditorButton {
+    display: none;
+}
+
+.deletable, .inDelete {
+    background: #ffa6aa !important;
+    outline: 4px dashed #ff4751 !important;
+}
+
+.btnDelete {
+    z-index: 200;
+    position: absolute;
+}
+
+.bgModal {
+    position: fixed;
+    width: 100vw;
+    height: 100vh;
+    background: #00000078;
+    top: 0;
+    left: 0;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    z-index: 210;
+    cursor: pointer;
+}
+
+.bgModal .customModal {
+    background: white;
+    border-radius: 10px;
+    padding: 1rem;
+    cursor: default;
+}
+
+.bgModal .customModal h1.modalTitle {
+    font-size: 20px;
+    font-weight: bold;
+    margin-bottom: 0.8rem;
+}
+
+.bgModal .customModal p.modalText {
+    color: #525252;
+    margin-bottom: 0.4rem;
+}
+
+.bgModal .customModal .modal-flex {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+}
+
+.bgModal .customModal p.modalDanger {
+    color: red;
+    font-weight: 700;
+    margin-bottom: 1.2rem;
+}
+
+[data-deleteid].deletable {
+    cursor: pointer;
+}
+
+#btnTranslatePage {
+    position: fixed;
+    bottom: 50px;
+    right: 110px;
+    z-index: 1100;
+    transition: transform 0.2s ease;
+}
+
+#btnTranslatePage:hover {
+    transform: scale(1.05);
+}
+
+/* newSiteEditor v1.1.0 */
+
+.nseBgModal {
+    display: none;
+    background: rgba(0, 0, 0, 0.452);
+    position: fixed;
+    top: 0;
+    left: 0;
+    width: 100vw;
+    height: 100vh;
+    z-index: 9999;
+    cursor: pointer;
+}
+
+.nseBgModal.open {
+    display: flex;
+    justify-content: center;
+    align-items: center;
+}
+
+.nseBgModal .nseModal {
+    position: relative;
+    padding: 1.2rem;
+    background: white;
+    border-radius: 1rem;
+    box-shadow: 0 0px 22px rgb(0 0 0 / 2%);
+    cursor: default;
+}
+
+.nseModal .nseHeader {
+}
+
+.nseModal .nseHeader .alert#default {
+    display: none;
+}
+
+.nseModal .modalFlex {
+    display: flex;
+}
+
+.nseModal .modalFlex.row {
+    align-items: center;
+    gap: 1.5rem;
+}
+
+.nseModal .nseModalContent h1 {
+    font-size: 1.5rem;
+    font-weight: 600;
+    margin-block-start: 0;
+    margin-block-end: 1rem;
+}
+
+.nseModal .nseModalContent .nseInput {
+    height: 40px;
+    padding: 0.5rem;
+    padding-inline: 10px 20px;
+    outline: 1px solid #d1d5dc;
+    border-radius: 0.25rem;
+    font-size: 0.95rem;
+    color: #101828;
+    width: 100%;
+}
+
+.nseModal .nseModalContent .alert,
+.nseModal .nseHeader .alert {
+    padding: 1rem;
+    margin-block: 0.75rem;
+    border-radius: 0.4rem;
+    display: flex;
+    gap: 0.5rem;
+}
+
+.nseModal .nseModalContent .alert .loader,
+.nseModal .nseHeader .alert .loader {
+        width: 48px;
+        height: 48px;
+        border-radius: 50%;
+        display: inline-block;
+        border-top: 3px solid #FFF;
+        border-right: 3px solid transparent;
+        box-sizing: border-box;
+        animation: rotation 1s linear infinite;
+}
+
+@keyframes rotation {
+    0% {
+        transform: rotate(0deg);
+    }
+    100% {
+        transform: rotate(360deg);
+    }
+}
+
+.nseModal .nseModalContent .alert.danger,
+.nseModal .nseHeader .alert.danger {
+    background: rgb(255, 180, 180);
+    color: var(--error-color);
+}
+
+.nseModal .nseModalContent .alert.info,
+.nseModal .nseHeader .alert.info {
+    background: rgb(180, 185, 255);
+    color: var(--info-color);
+}
+
+.nseModal .nseModalContent .alert.success,
+.nseModal .nseHeader .alert.success {
+    background: rgb(125, 255, 131);
+    color: var(--sucess-color);
+}
+
+
+.nseModal .nseModalFooter {
+    border-top: 1px solid rgb(184, 184, 184);
+}
+
+.nseModal .nseModalFooter .nseModalFooterItem {
+    padding-block-start: 10px;
+}
+
+
+.uppy-DashboardContent-panelBody {
+    overflow:auto;
+}
+
+.nseButton, .uppy-DashboardContent-save {
+    padding: .375rem .75rem;
+    border-radius: .25rem !important;
+    background: var(--theme-color);
+    border: none;
+    color: white;
+    cursor: pointer;
+}
+
+.nseButton:disabled {
+    background: #889593;
+    cursor: not-allowed;
+}
+
+.nseButton.rounded {
+    padding: .75em .95rem;
+    border-radius: 999999px !important;
+}
+
+.nseButton.danger {
+    background: var(--error-color);
+    color: white;
+}
+
+.nseButton.info {
+    background: var(--info-color);
+    color: white;
+}
+
+#btnTranslate {
+    z-index: 1400;
+}
+
+.nseFlex {
+    display: flex;
+    justify-content: space-between;
+    gap: 1rem;
+}
+
+.nseButton.secondary {
+    background: #ececec;
+    border: 1px solid #cdcdcd;
+    color: black;
+}
+
+.nseModal .closeBtn {
+    --size: 2rem;
+    border: none;
+    position: absolute;
+    top: 1rem;
+    right: 1rem;
+    padding: 0.5rem;
+    width: var(--size);
+    height: var(--size);
+    cursor: pointer;
+    border-radius: 0.2rem;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+}
+
+.nseModal .classicPadding {
+    padding: 1rem;
+}
+
+.nseModal .classicFlexing {
+    display: flex;
+    flex-direction: column;
+    gap: 0.4rem;
+}
+
+.nseModal .nseModalContent .grid-section {
+    display: grid;
+    grid-template-columns: 1fr 1fr 1fr 1fr;
+    gap: 0.4rem;
+}
+
+.nseModal .nseModalContent .grid-section .checkbox, .nseModal .nseModalContent .checkbox {
+    display: flex;
+    gap: 0.5rem;
+}
+
+.clicked, .veryclicked {
+    outline: var(--info-color) 5px solid !important;
+    position: relative;
+}
+
+.clicked::after, .veryclicked::after {
+    content: '';
+    position: absolute;
+    top: 0; left: 0;
+    width: 100%;
+    height: 100%;
+    background: rgb(180, 185, 255);
+    opacity: 0.4;
+    pointer-events: none;
+}
+
+[data-newmanager="false"] .clicked, [data-newmanager="false"] .veryclicked {
+    outline: 0px solid !important;
+}
+
+[data-newmanager="false"] .clicked::after, [data-newmanager="false"] .veryclicked::after {
+    display: none;
+}
+
+.buttonTranslate:disabled {
+    background: #889593 !important;
+    cursor: not-allowed;
+    border: 1px solid #889593;
+}

二進制
images/650143.png


二進制
images/860814.png


二進制
images/Settings-icon-symbol-vector.png


二進制
images/back1.png


二進制
images/back2.png


二進制
images/symbole-de-l-oeil-noir.png


+ 1 - 0
images/translate.svg

@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 -960 960 960" width="48px" fill="#FFFFFF"><path d="M459.17-65.87 645.3-565.09h108.4L939.26-65.87h-86.48l-38.21-98.91H582.3l-38.21 98.91h-84.92ZM155.22-182.91l-56.13-56.13 198.73-198.18q-54.95-57.52-90.58-112.58-35.63-55.07-51.94-105.11h89.31q12.61 36.21 39.82 75.95 27.22 39.74 70.53 84.61 44.87-48 82.17-114.39 37.3-66.39 52.61-126.17H23.04v-79.79h290v-80h79.79v80h290v79.79H575.48q-17.57 75.74-62.91 156.95-45.35 81.22-102.61 141.18l81.65 83.08-31.35 85.05-107.43-111.44-197.61 197.18Zm454.3-56.65h177.83l-88.92-236.7-88.91 236.7Z"/></svg>

+ 0 - 2179
index.js

@@ -1,2179 +0,0 @@
-/**
- *
- * newsiteeditor.js - gestion de l'interface de NewSiteEditor
- *
- * Modifications:
- * - 2022/07/12 - V.1.0 0 - B.Bouaphakeo - création
- * - 20250414 - V1.0.1 - E.Podvin - fix hover when siteeditor is activated with tinymce
- * - 2025/05/06 - V.1.1.0 H.Malezet & C.Nelhomme - Added newFileEditor to edit image and video.
- * - 2025/05/09 - V.1.2.0 C.Nelhomme - Added compressorJS and add request to mistralAI
- * - 2025/05/31 - V1.3.0 - E.Podvin - add redirections to dashboard and help pages
- * - 2025/06/02 - V1.3.1 - E.Podvin - call newsiteeditor/image POST
- * - 2025/06/02 - V1.3.2 - E.Podvin - fix toggle on hover when we leave nse
- * - 2025/06/06 - V1.4.0 - C.NELHOMME - Added videoEditor
- *
- * @copyright Intersel 2022-2025
- *
- */
-//debugger;
-
-const { Uppy: UppyConstructor, Dashboard, ImageEditor } = window.Uppy;
-const availableLang = Uppy.locales;
-
-const lang = `${document.documentElement.lang.toLowerCase()}_${document.documentElement.lang.toUpperCase()}`;
-const baseURL = window.location.origin;
-
-const acceptedImageTypes = [".jpg", ".jpeg", ".png", ".gif", ".webp"];
-const acceptedVideoTypes = [".mp4", ".webm"];
-
-const imageTypesWithoutDots = extensionWODot(acceptedImageTypes);
-const videoTypesWithoutDots = extensionWODot(acceptedVideoTypes);
-
-function extensionWODot(extension) {
-	return extension.map((v) => v.replace(".", ""));
-}
-
-const managerURL = window.customerManagerUrl; //set in NewSiteEditor plugin
-const managerHelpURL = window.helpManagerUrl; //set in NewSiteEditor plugin
-
-class Modal {
-	/**
-	 *
-	 * @param {HTMLElement} modalId - The ID of the element where the modal should appear.
-	 */
-	constructor(modalId) {
-		this.modal = document.getElementById(modalId);
-		this.isOpen = false;
-	}
-
-	open() {
-		this.modal.classList.add("open");
-		document.body.style.overflow = "hidden";
-		this.isOpen = true;
-	}
-
-	close() {
-		this.modal.classList.remove("open");
-		document.body.style.overflow = "auto";
-		this.isOpen = false;
-	}
-
-	/**
-	 * Sets the visibility of the modal.
-	 *
-	 * @param {boolean} visible - If true, the modal is opened; if false, it is closed.
-	 */
-	setVisible(visible) {
-		visible ? this.open() : this.close();
-	}
-
-	isVisible() {
-		return this.isOpen;
-	}
-
-	getModal() {
-		return this.modal;
-	}
-
-	onBackgroundClick(callback) {
-		this.modal.addEventListener("click", (e) => {
-			if (e.target === this.modal) callback();
-		});
-	}
-
-	onValidate(callback, selector = ".validateBtn") {
-		const btn = this.modal.querySelector(selector);
-		if (btn) {
-			btn.addEventListener("click", () => callback());
-		}
-	}
-
-	onCloseButtonClick(selector = ".closeBtn") {
-		const btn = this.modal.querySelector(selector);
-		if (btn) {
-			btn.addEventListener("click", () => this.close());
-		}
-	}
-}
-
-//Only for RG /!\
-class fntManager {
-	constructor(
-		toggleButtonId = "delete",
-		bgModalId = "modalDeleteTemplate",
-		deleteButtonId = "btnDelete"
-	) {
-		this.RG_deleteID = null;
-		this.bgModal = document.getElementById(bgModalId);
-		this.RG_hoverActive = false;
-		this.selector = "[data-deleteid]";
-		this.type = "data-deleteType";
-		this.toggleButton = document.getElementById(toggleButtonId);
-		this.deleteButton = document.getElementById(deleteButtonId);
-
-		this.id = this.generateUUID();
-
-		this.storeData = this.storeData.bind(this);
-		this.toggleHover = this.toggleHover.bind(this);
-		this.openModal = this.openModal.bind(this);
-		this.closeModal = this.closeModal.bind(this);
-		this.removeResource = this.removeResource.bind(this);
-		this.getType = this.getType.bind(this);
-		this.addHoverClass = this.addHoverClass.bind(this);
-		this.removeHoverClass = this.removeHoverClass.bind(this);
-	}
-
-	init() {
-		this.getElements().forEach((el) => {
-			el.addEventListener("click", (e) => {
-				this.storeData(e);
-
-				if (el.classList.contains("deletable")) {
-					this.getElements().forEach((otherEl) => {
-						if (otherEl !== el) {
-							otherEl.classList.remove("deletable", "inDelete");
-						}
-					});
-
-					el.classList.add("inDelete");
-
-					this.updateButtonPosition(e.pageX, e.pageY - 20);
-
-					this.deleteButton.onclick = this.openModal;
-				}
-			});
-		});
-
-		if (this.toggleButton) {
-			this.toggleButton.addEventListener("click", this.toggleHover);
-		}
-	}
-
-	destroy() {
-		if (!this.RG_hoverActive) this.RG_hoverActive = true;
-		this.toggleHover();
-
-		if (this.toggleButton) {
-			this.toggleButton.removeEventListener("click", this.toggleHover);
-		}
-	}
-
-	updateButtonPosition(x, y) {
-		Object.assign(this.deleteButton.style, {
-			visibility: "",
-			left: x + "px",
-			top: y + "px",
-		});
-	}
-
-	storeData(e) {
-		const id = e.currentTarget.getAttribute("data-deleteid");
-		if (id) {
-			this.RG_deleteID = id;
-		}
-	}
-
-	getElements() {
-		return document.querySelectorAll(this.selector);
-	}
-
-	toggleHover() {
-		this.RG_hoverActive = !this.RG_hoverActive;
-
-		this.getElements().forEach((el) => {
-			if (this.RG_hoverActive) {
-				el.addEventListener("mouseenter", this.addHoverClass);
-				el.addEventListener("mouseleave", this.removeHoverClass);
-			} else {
-				el.removeEventListener("mouseenter", this.addHoverClass);
-				el.removeEventListener("mouseleave", this.removeHoverClass);
-			}
-
-			el.classList.remove("deletable", "inDelete");
-		});
-
-		if (!this.RG_hoverActive) {
-			this.removeModal();
-			this.deleteButton.style.visibility = "hidden";
-			this.RG_deleteID = null;
-		}
-	}
-
-	addHoverClass(e) {
-		e.currentTarget.classList.add("deletable");
-	}
-
-	removeHoverClass(e) {
-		e.currentTarget.classList.remove("deletable");
-	}
-
-	openModal() {
-		this.removeModal();
-
-		const clone = this.bgModal.firstElementChild.cloneNode(true);
-		clone.id = this.id;
-		clone.addEventListener("click", this.closeModal);
-
-		const cancelBtn = clone.querySelector(".cancelBtn");
-		const deleteBtn = clone.querySelector(".deleteBtn");
-
-		cancelBtn.addEventListener("click", (e) => {
-			e.stopPropagation();
-			this.removeModal();
-		});
-
-		deleteBtn.addEventListener("click", this.removeResource);
-
-		document.body.style.overflow = "hidden";
-		this.deleteButton.style.visibility = "hidden";
-
-		document.body.appendChild(clone);
-	}
-
-	removeModal() {
-		const el = document.getElementById(this.id);
-		if (el) {
-			document.body.style.overflow = "auto";
-			el.remove();
-		}
-	}
-
-	closeModal(e) {
-		const modalContainer = document.getElementById(this.id);
-		if (e.target === modalContainer) {
-			this.removeModal();
-		}
-	}
-
-	generateUUID() {
-		return (
-			crypto.randomUUID?.() ||
-			"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
-				const r = (Math.random() * 16) | 0;
-				const v = c === "x" ? r : (r & 0x3) | 0x8;
-				return v.toString(16);
-			})
-		);
-	}
-
-	getType() {
-		return document
-			.querySelector('[data-deleteid="' + this.RG_deleteID + '"]')
-			.getAttribute(this.type);
-	}
-
-	async removeResource() {
-		try {
-			if (!this.getType()) {
-				console.error("No type define in [data-deleteType]");
-				this.removeModal();
-				return;
-			}
-
-			const response = await fetch(
-				`${baseURL}/rest/dashboard/${this.getType()}/${this.RG_deleteID}`,
-				{
-					method: "DELETE",
-				}
-			);
-
-			if (!response.ok) {
-				throw new Error(
-					`Erreur ${response.status} : la ressource n'a pas pu être supprimée.`
-				);
-			}
-
-			const data = await response.json();
-			console.log(data);
-			if (data.code === "200") {
-				document
-					.querySelector('[data-deleteid="' + this.RG_deleteID + '"]')
-					.remove();
-				this.removeModal();
-			}
-			return data;
-		} catch (error) {
-			console.error("Erreur lors de la suppression :", error);
-			throw error;
-		}
-	}
-}
-
-class translateToContext {
-	constructor(
-		openModalButtonId = "translate",
-		bgModalId = "modalTranslateTemplate"
-	) {
-		const modal = new Modal(bgModalId);
-		const button = document.getElementById(openModalButtonId);
-
-        if (button)
-        {
-    		button.addEventListener("click", () => modal.open());
-    		modal.onBackgroundClick(() => modal.close());
-    		modal.onCloseButtonClick();
-        }
-	}
-}
-
-const fnt = new fntManager();
-const translate = new translateToContext();
-
-var NEWSITEEDITOR = (function () {
-	let version = "1.4.0";
-
-	//set data-data for content and title
-	function dataData(who) {
-		let obj = {};
-		let title;
-		let field = $(who).attr("field");
-		let dirty = $(who).attr("dirty");
-		let editModeOn = $("#edit").css("visibility") != "visible";
-		const sync = { syncsite: 1 };
-		
-		//if(field === 'content') ...
-
-		if (!editModeOn || dirty == undefined)
-		{
-			$(who).attr("dirty", "0");
-		}
-		else
-		{
-			obj = JSON.parse($(who).attr("data-data"));
-			if (obj)
-			{
-				dirty = (obj[field] == who.innerHTML) ? "0" : "1";
-				$(who).attr("dirty", dirty);
-			}
-		}
-
-		if (field == "pagetitle") {
-			field = "longtitle";
-		}
-
-		if (editModeOn &&
-			(
-				who.innerText.trim() === "" ||
-				who.innerHTML.includes('<br data-mce-bogus="1">')
-			)
-		)
-		{
-			if (editModeOn) who.innerHTML = "&nbsp;&nbsp;&nbsp;";
-		}
-		
-		obj[field] = who.innerHTML;
-		Object.assign(obj, sync);
-
-		return $(who).attr("data-data", JSON.stringify(obj));
-	}
-
-	// REST : PUT method to put the content of the website in the manager
-	function saveContent() {
-		$(".siteeditor").blur(function () {
-			dataData(this);
-			if ($(this).attr("dirty") == "1")
-			{
-				blapyTools.ajaxSimpleAction(this);
-				$(this).attr("dirty", "0");
-			}
-		});
-	}
-
-	// Settings available for the richtext editor
-	function TinyMCE() {
-		$.doTimeout("startTinyMCE", 200, function () {
-			tinymce.init({
-				selector: ".siteeditor",
-				suffix: ".min",
-				inline: true,
-				plugins: "link textcolor table preview paste",
-				menubar: false,
-				toolbar: [
-					"undo redo | bold italic underline | link unlink | fontselect fontsizeselect",
-					// "forecolor backcolor | alignjustify alignleft aligncenter alignright alignfull | numlist bullist outdent indent | table | styleselect",
-					"forecolor backcolor | alignjustify alignleft aligncenter alignright alignfull | styleselect",
-				],
-				powerpaste_word_import: "clean",
-				powerpaste_html_import: "clean",
-				paste_auto_cleanup_on_paste: true,
-
-				setup: function (editor) {
-					editor.on("focus", function (event) {
-						toggleClosestButton(event.target);
-					});
-
-					editor.on("blur", function (event) {
-						toggleClosestButton(event.target);
-					});
-
-					editor.on("keydown", function (event) {
-						if (
-							["ArrowRight", "ArrowLeft", "ArrowUp", "ArrowDown"].includes(
-								event.code
-							)
-						) {
-							event.stopPropagation();
-						}
-					});
-				},
-			});
-		});
-	}
-
-	//REST : Get method to get the title of the resource in sidebar
-	function getTitle(who) {
-		var transform = $("h2").css("text-transform");
-		$(who).prepend(
-			'<p id="resourceName" method="GET" style="text-transform:' +
-				transform +
-				';"></p>'
-		);
-
-		hrefRestNse("#resourceName", "longtitle");
-		blapyTools.ajaxSimpleAction($("#resourceName"), function (data0) {
-			var title = data0.data.title;
-			if (title === "" || title == "--") {
-				hrefRestNse("#resourceName", "pagetitle");
-				blapyTools.ajaxSimpleAction($("#resourceName"), function (data1) {
-					var title1 = data1.data.title;
-					$("#resourceName").html(title1);
-					//console.log(title1+' '+3);
-				});
-			} else {
-				$("#resourceName").html(title);
-			}
-		});
-	}
-
-	function toggleClosestButton(element) {
-		const subElement = element.bodyElement;
-		const button = subElement.closest("button");
-		if (button) {
-			button.disabled = !button.disabled;
-		}
-	}
-
-	// to put href attribut in 'who' element, with 'what' tv and the element id in the url
-	function hrefRestNse(who, what) {
-		/*var pos1 = $('[status="selected"]').attr("class").indexOf("_", $('[status="selected"]').attr("class").indexOf("_") + 1)+1;
-            var pos2 = $('[status="selected"]').attr("class").indexOf(" ") ;
-            var currentId = $('[status="selected"]').attr("class").substring(pos1, pos2);*/
-		var currentId = $('[status="selected"]').attr("data-resourceid");
-		$(who).attr("href", "/rest/newsiteeditor/" + what + "/" + currentId);
-	}
-
-	// toggle from edit mode to view mode
-	function view() {
-		$("#view").click(function () {
-			//remove attr conteneditable sinon bug avec tinyMCE
-			tinymce.remove();
-			$(".mce-item-table").removeClass("mce-item-table");
-
-			$(
-				"#undo, #redo, #sidebarToggle, #customerManagerPage, #helpManagerPage, #manager, #view, #delete, #translate"
-			).css("visibility", "hidden");
-			$("#wrapper").addClass("no-sidebar");
-			$("#edit").css("visibility", "");
-
-			$('[data-managerButton="true"]')
-				.removeClass("selected")
-				.removeAttr("status")
-				.attr("data-managerbutton", "false");
-			onClickManager(false);
-			sidebar(false);
-			linkEnabled(true);
-			nseVideoEditor(false);
-			nseImageEditor(false);
-			fnt.destroy();
-		});
-	}
-
-	//désactiver les liens href sur sections
-	function linkEnabled(enableLink) {
-		if (enableLink) {
-			$(".siteeditor")
-				.parents("[data-hrefSave]")
-				.each(function () {
-					$(this).attr("href", $(this).attr("data-hrefSave"));
-					$(this).removeAttr("data-hrefSave");
-				});
-		} else {
-			$(".siteeditor")
-				.parents("[href]")
-				.each(function () {
-					console.log($(this));
-					$(this).attr("data-hrefSave", $(this).attr("href"));
-					$(this).removeAttr("href");
-				});
-		}
-	}
-
-	// toggle from view to edit mode
-	function edit() {
-		$("#edit").click(function () {
-			TinyMCE();
-			$(this).css("visibility", "hidden");
-
-			$(
-				"#undo, #redo, #sidebarToggle, #customerManagerPage, #helpManagerPage, #view, #manager, #delete, #translate"
-			).css("visibility", "");
-
-			/*$('section').each(function(){
-                          if ( $(this).attr("data-info") === "" ){
-                              var pos1 = this.getAttribute("class").indexOf("_", this.getAttribute("class").indexOf("_") + 1)+1;
-                              var pos2 = this.getAttribute("class").indexOf(" ") ;
-                              var currentId = this.getAttribute("class").substring(pos1, pos2);
-                              $(this).attr("data-info","managerButton_"+currentId);
-                          }
-                      });*/
-
-			$('[data-resourceid!=""][data-resourceid]').attr(
-				"data-managerbutton",
-				"true"
-			);
-			onClickManager(true);
-			sidebar(true);
-			linkEnabled(false);
-			nseVideoEditor(true);
-			nseImageEditor(true);
-			fnt.init();
-		});
-	}
-
-	// to set data-data after clicking undo button
-	function undo() {
-		$("#undo").click(function () {
-			$.doTimeout("TimeOut", 500, function () {
-				$(".siteeditor").each(function () {
-					var field = $(this).attr("field");
-					if (
-						$(this).attr("data-data") !=
-						'{"' + field + '":"' + this.innerHTML + '","syncsite":1}'
-					) {
-						dataData(this);
-						blapyTools.ajaxSimpleAction(this);
-					}
-				});
-			});
-		});
-	}
-
-	// to set data-data after clicking redo button
-	function redo() {
-		$("#redo").click(function () {
-			$.doTimeout("TimeOut", 500, function () {
-				$(".siteeditor").each(function () {
-					var field = $(this).attr("field");
-					if (
-						$(this).attr("data-data") !=
-						'{"' + field + '":"' + this.innerHTML + '","syncsite":1}'
-					) {
-						dataData(this);
-						blapyTools.ajaxSimpleAction(this);
-					}
-				});
-			});
-		});
-	}
-
-	// onHover on content you can edit
-	function onHover() {
-		$(".siteeditor").hover(
-			function () {
-				//debugger;
-				if (
-					$(this).attr("contenteditable") ==
-					"true" /*&& !($(this).is(":focus")) */
-				) {
-					$(this)[0].style.setProperty(
-						"background-color",
-						"rgb(0, 0, 255, 0.1)",
-						"important"
-					);
-				}
-			},
-			function () {
-				if ($(this).attr("contenteditable") == "true") {
-					$(this).css("background-color", "");
-				}
-			}
-		);
-	}
-
-	// onHover on resource you can edit
-	function onHoverManager() {
-		$("section").hover(
-			function () {
-				if (
-					this.getAttribute("data-managerbutton") &&
-					this.getAttribute("data-managerbutton") == "true"
-				) {
-					$(this).addClass("selected");
-				}
-			},
-			function () {
-				if (
-					this.getAttribute("data-managerbutton") &&
-					this.getAttribute("data-managerbutton") == "true" &&
-					!this.getAttribute("status")
-				) {
-					$(this).removeClass("selected");
-				}
-			}
-		);
-	}
-
-	// display a manager button when clicking on a resource which redirected on the resource clicked manager
-	function onClickManager(mode) {
-		//debugger;
-		if (mode) {
-			$("#body").on("click.siteeditor", function () {
-				$('[status="selected"]').removeClass("selected").removeAttr("status");
-				$("#manager").css("visibility", "hidden").removeAttr("onclick");
-			});
-			$("section").on("click.siteeditor", function () {
-				//debugger;
-				event.stopPropagation();
-
-				$('[status="selected"]').removeClass("selected").removeAttr("status");
-				$("#manager").css("visibility", "hidden").attr("onclick", "");
-
-				if (
-					this.getAttribute("data-managerbutton") &&
-					this.getAttribute("data-managerbutton") == "true"
-				) {
-					$(this).addClass("selected");
-					$(this).attr("status", "selected");
-					var currentId = this.getAttribute("data-resourceid");
-					$("#manager").attr(
-						"onclick",
-						"window.open('/manager/?a=resource/update&id=" + currentId + "');"
-					);
-					$("#manager").css("visibility", "visible");
-				}
-			});
-		} else {
-			$("#body").off("click.siteeditor");
-			$("section").off("click.siteeditor");
-		}
-	}
-
-	//toggle between sidebar and nosidebar
-	function sidebarDisplay(boolean) {
-		if (boolean) {
-			$("#noResourceSelected").css("display", "none");
-			$("#resourceSelected").css("display", "");
-		} else {
-			$("#noResourceSelected").css("display", "");
-			$("#resourceSelected").css("display", "none");
-		}
-	}
-
-	//When sidebar is open, display the info of the resource selected or "selectionner une ressource" if no resource selected
-	function sidebar(mode) {
-		if (mode) {
-			$("#body").on("click.sidebar", function () {
-				$("#resourceName").remove();
-				if ($("#wrapper").attr("class") !== "no-sidebar") {
-					sidebarDisplay(false);
-				}
-			});
-			$("section").on("click.sidebar", function (e) {
-				//debugger;
-				e.stopPropagation();
-				$("#resourceName").remove();
-				if (
-					$("#wrapper").attr("class") !== "no-sidebar" &&
-					this.getAttribute("data-resourceid")
-				) {
-					getTitle("#resourceSelected");
-					sidebarDisplay(true);
-				} else {
-					sidebarDisplay(false);
-				}
-			});
-		} else {
-			$("#body").off("click.sidebar");
-			$("section").off("click.sidebar");
-		}
-	}
-
-	//Open the sidebar when clicking on the parameter button with the information of the current selected resource or "selectionner une resssource" if no selected resource
-	function sidebarToggle() {
-		$("#sidebarToggle").on("click", function () {
-			const isNoSidebar = $("#wrapper").hasClass("no-sidebar");
-			console.log(isNoSidebar);
-
-			if (isNoSidebar) {
-				var compt = 0;
-				$("#resourceName").remove();
-
-				const styles = {
-					width: "calc(100% - 250px)",
-					marginLeft: "250px",
-				};
-
-				Object.assign(
-					document.querySelector(".teq-body-content").style,
-					styles
-				);
-				Object.assign(
-					document.querySelector("body > #wrapper > header").style,
-					styles
-				);
-
-				$("section").each(function () {
-					if ($(this).attr("status") == "selected") {
-						compt += 1;
-					}
-				});
-
-				if (compt > 0) {
-					getTitle("#resourceSelected");
-					sidebarDisplay(true);
-				} else {
-					sidebarDisplay(false);
-				}
-			} else {
-				document
-					.querySelectorAll(".teq-body-content, body > #wrapper > header")
-					.forEach((el) => {
-						el.style.width = "";
-						el.style.marginLeft = "";
-					});
-			}
-
-			$("#wrapper").toggleClass("no-sidebar");
-		});
-	}
-
-	//Open the customer manager page
-	function loadCustomerManager() {
-		$("#customerManagerPage").on("click", function () {
-			if (managerURL) location.assign(managerURL);
-		});
-	}
-	//Open the Help page
-	function loadHelpManager() {
-		$("#helpManagerPage").on("click", function () {
-			if (managerHelpURL) location.assign(managerHelpURL);
-		});
-	}
-
-	// REST : get method to know how many column the resource already occupied
-	function getNbColumn() {
-		hrefRestNse("#column-select", "nbcolumn");
-		blapyTools.ajaxSimpleAction($("#column-select"), function (data) {
-			var bootstrap = data.data.nb;
-			var nbColumn;
-			if (bootstrap === null) {
-				nbColumn = 12;
-			} else {
-				pos3 = bootstrap.lastIndexOf("-");
-				nbColumn = bootstrap.substr(pos3 + 1);
-			}
-			$("#column-select").prop("value", nbColumn);
-		});
-	}
-
-	//REST : Method PUT when a new number of column is selected in sidebar
-	//       Change instantly the number of column on page
-	function putNbColumn() {
-		$("#column-select").change(function () {
-			var valueSelected = $("#column-select").val();
-			var bootstrap;
-			//version input number
-			if (valueSelected < 1) {
-				valueSelected = 1;
-				$("#column-select").attr("value", valueSelected);
-				bootstrap = "col-sm-1";
-			} else if (valueSelected >= 12) {
-				valueSelected = 12;
-				$("#column-select").attr("value", valueSelected);
-				bootstrap = null;
-			} else {
-				$("#column-select").attr("value", valueSelected);
-				bootstrap = "col-sm-" + valueSelected;
-			}
-			//envoyer le nombre de colonne au manager version number
-			hrefRestNse('[for="column-select"]', "nbcolumn");
-			if (bootstrap === null) {
-				$('[for="column-select"]').attr(
-					"data-data",
-					'{"tv_nbBootstrapColumn":' + bootstrap + ',"syncsite":1}'
-				);
-			} else {
-				$('[for="column-select"]').attr(
-					"data-data",
-					'{"tv_nbBootstrapColumn":"' + bootstrap + '","syncsite":1}'
-				);
-			}
-			blapyTools.ajaxSimpleAction($('[for="column-select"]'));
-			//dynamique sur la page
-			var pos3 = $('[status="selected"]').attr("class").indexOf("col-sm");
-			var pos4 = $('[status="selected"]')
-				.attr("class")
-				.indexOf(" ", pos3 + 1);
-			var currentBootstrap = $('[status="selected"]')
-				.attr("class")
-				.substr(pos3, pos4 - pos3);
-			if (currentBootstrap.startsWith("col-sm")) {
-				$('[status="selected"]')
-					.removeClass(currentBootstrap)
-					.removeClass("selected");
-			} else {
-				$('[status="selected"]').removeClass("selected");
-			}
-			$('[status="selected"]').addClass(bootstrap).addClass("selected");
-			if (bootstrap === null) {
-				$('[status="selected"]').css("clear", "");
-			} else {
-				$('[status="selected"]').css("clear", "none");
-			}
-		});
-	}
-
-	//REST : get method to get the managers width in the sidebar
-	function getWidth() {
-		hrefRestNse("#width", "width");
-		blapyTools.ajaxSimpleAction($("#width"), function (data) {
-			var percentage = data.data.width;
-			//console.log(percentage);
-			var width;
-			if (percentage === null) {
-				width = 100;
-			} else {
-				pos3 = percentage.indexOf("%");
-				width = percentage.substr(0, pos3);
-				//console.log(width);
-			}
-			$("#width").prop("value", width);
-		});
-	}
-
-	//REST : Method PUT when a new number of column is selected in sidebar
-	//       Change instantly the number of column on page
-	function putWidth() {
-		$("#width").change(function () {
-			var valueSelected = $("#width").val();
-			var percentage;
-			//version input
-			if (valueSelected < 10) {
-				valueSelected = 10;
-				$("#width").prop("value", valueSelected);
-				percentage = "10%";
-			} else if (valueSelected > 100) {
-				valueSelected = 100;
-				$("#width").prop("value", valueSelected);
-				percentage = "100%";
-			} else {
-				$("#width").prop("value", valueSelected);
-				percentage = valueSelected + "%";
-			}
-			//envoyer le nombre de colonne au manager version number
-			hrefRestNse('[for="width"]', "width");
-			if (percentage === "100%") {
-				$('[for="width"]').attr(
-					"data-data",
-					'{"tv_sectionWidth":' + null + ',"syncsite":1}'
-				);
-			} else {
-				$('[for="width"]').attr(
-					"data-data",
-					'{"tv_sectionWidth":"' + percentage + '","syncsite":1}'
-				);
-			}
-			blapyTools.ajaxSimpleAction($('[for="width"]'));
-			//dynamique sur la page
-			$('[status="selected"]').find("div:first").css("width", percentage);
-		});
-	}
-
-	//REST : get method to get the manager padding in the sidebar
-	function getPadding() {
-		hrefRestNse("#paddingTop", "padding");
-		blapyTools.ajaxSimpleAction($("#paddingTop"), function (data) {
-			var css = data.data.CSS;
-			//console.log(css);
-			var posTop1;
-			var posTop2;
-			var posTop3;
-			var paddingTop;
-			if (css !== null && css.includes("padding-top")) {
-				css = css.replace(/ /g, "");
-				posTop1 = css.indexOf("padding-top");
-				posTop2 = css.indexOf(":", posTop1 + 1);
-				posTop3 = css.indexOf(";", posTop1 + 1);
-				paddingTop = css.substr(posTop2 + 1, posTop3 - posTop2 - 1);
-				//console.log(paddingTop);
-				//$('#paddingTop').prop('value',paddingTop);
-				var paddingTop2;
-				if (paddingTop.includes("px")) {
-					$("#paddingTopUnit").prop("value", "px");
-					posTop4 = paddingTop.indexOf("px");
-					paddingTop2 = paddingTop.substr(0, posTop4);
-					//console.log(paddingTop2);
-				} else if (paddingTop.includes("%")) {
-					$("#paddingTopUnit").prop("value", "%");
-					posTop4 = paddingTop.indexOf("%");
-					paddingTop2 = paddingTop.substr(0, posTop4);
-				}
-				$("#paddingTop").prop("value", paddingTop2);
-				//console.log(paddingTop2);
-			} else {
-				$("#paddingTopUnit").prop("value", "px");
-				$("#paddingTop").prop("value", "");
-			}
-		});
-
-		hrefRestNse("#paddingBottom", "padding");
-		blapyTools.ajaxSimpleAction($("#paddingBottom"), function (data) {
-			var css = data.data.CSS;
-			//console.log(css);
-			var posBot1;
-			var posBot2;
-			var posBot3;
-			var paddingBottom;
-			if (css !== null && css.includes("padding-bottom")) {
-				css = css.replace(/ /g, "");
-				posBot1 = css.indexOf("padding-bottom");
-				posBot2 = css.indexOf(":", posBot1 + 1);
-				posBot3 = css.indexOf(";", posBot1 + 1);
-				paddingBottom = css.substr(posBot2 + 1, posBot3 - posBot2 - 1);
-				var paddingBottom2;
-				if (paddingBottom.includes("px")) {
-					posBot4 = paddingBottom.indexOf("px");
-					paddingBottom2 = paddingBottom.substr(0, posBot4);
-					$("#paddingBottomUnit").prop("value", "px");
-					//console.log(paddingTop2);
-				} else if (paddingBottom.includes("%")) {
-					posBot4 = paddingBottom.indexOf("%");
-					paddingBottom2 = paddingBottom.substr(0, posBot4);
-					$("#paddingBottomUnit").prop("value", "%");
-				}
-				$("#paddingBottom").prop("value", paddingBottom2);
-			} else {
-				$("#paddingBottomUnit").prop("value", "px");
-				$("#paddingBottom").prop("value", "");
-			}
-		});
-	}
-
-	/**
-	 * Converts a File or Blob object to a Base64-encoded data URL.
-	 *
-	 * @param {File|Blob} blob - The file or blob to convert.
-	 * @returns {Promise<string>} A promise that resolves to the Base64-encoded string.
-	 */
-	function blobToBase64(blob) {
-		return new Promise((resolve, reject) => {
-			const reader = new FileReader();
-
-			reader.onloadend = () => {
-				resolve(reader.result);
-			};
-
-			reader.onerror = reject;
-
-			reader.readAsDataURL(blob);
-		});
-	}
-
-	// REST : put method to put the sidebar value in the manager
-	function putPadding() {
-		$(
-			"#paddingTop, #paddingBottom, #paddingTopUnit, #paddingBottomUnit"
-		).change(function () {
-			let paddingTop = parseInt($("#paddingTop").val());
-			if (isNaN(paddingTop)) paddingTop = 0;
-			let unitTop = $("#paddingTopUnit").val();
-			let paddingBottom = parseInt($("#paddingBottom").val());
-			if (isNaN(paddingBottom)) paddingBottom = 0;
-			let unitBottom = $("#paddingBottomUnit").val();
-			if (paddingTop > 999) {
-				paddingTop = 999;
-				$("#paddingTop").prop("value", paddingTop);
-			} else if (paddingTop < 0) {
-				paddingTop = 0;
-				$("#paddingTop").prop("value", paddingTop);
-			}
-			if (paddingBottom > 999) {
-				paddingBottom = 999;
-				$("#paddingBottom").prop("value", paddingBottom);
-			} else if (paddingBottom < 0) {
-				paddingBottom = 0;
-				$("#paddingBottom").prop("value", paddingBottom);
-			}
-			//envoyer le nombre de colonne au manager version number
-			hrefRestNse('[for="padding"]', "padding");
-			$('[for="padding"]').attr(
-				"data-data",
-				'{"tv_sectionCSS":"padding-top:' +
-					paddingTop +
-					unitTop +
-					";padding-bottom:" +
-					paddingBottom +
-					unitBottom +
-					';","syncsite":1}'
-			);
-
-			if (paddingTop === 0 && paddingBottom === 0) {
-				$('[for="padding"]').attr(
-					"data-data",
-					'{"tv_sectionCSS":"","syncsite":1}'
-				);
-			} else if (paddingTop === 0) {
-				$('[for="padding"]').attr(
-					"data-data",
-					'{"tv_sectionCSS":"padding-bottom:' +
-						paddingBottom +
-						unitBottom +
-						';","syncsite":1}'
-				);
-			}
-			blapyTools.ajaxSimpleAction($('[for="padding"]'));
-			//dynamique sur la page
-			if (
-				(paddingTop === 0 || paddingTop === "") &&
-				(paddingBottom === 0 || paddingBottom === "")
-			) {
-				$('[status="selected"]').css("padding-top", "");
-				$('[status="selected"]').css("padding-bottom", "");
-			} else if (paddingTop === 0 || paddingTop === "") {
-				$('[status="selected"]').css("padding-top", "");
-				$('[status="selected"]').css(
-					"padding-bottom",
-					paddingBottom + unitBottom
-				);
-			} else if (paddingBottom === 0 || paddingBottom === "") {
-				$('[status="selected"]').css("padding-top", paddingTop + unitTop);
-				$('[status="selected"]').css("padding-bottom", "");
-			} else {
-				$('[status="selected"]').css("padding-top", paddingTop + unitTop);
-				$('[status="selected"]').css(
-					"padding-bottom",
-					paddingBottom + unitBottom
-				);
-			}
-		});
-	}
-
-	let imageUppy = null;
-	let current = {};
-	let cropper = null;
-	let pendingFile = null;
-	let customButton = document.getElementById("editImageBtn");
-
-	async function handleImageEditor(e) {
-		const el = e.currentTarget;
-
-		const prev = document.querySelector(".imageeditor.selected-img");
-		if (prev) prev.classList.remove("selected-img");
-
-		el.classList.add("selected-img");
-
-		if (el.naturalHeight === 0) {
-			current.aspectRatio = 1;
-		} else {
-			current.aspectRatio = el.naturalWidth / el.naturalHeight;
-		}
-
-		current.element = el;
-		current.lang = el.getAttribute("data-lang");
-		current.dataRessourceId = el.getAttribute("data-resource-id");
-		current.customFields = {
-			src: el.getAttribute("data-img-src"),
-			alt: el.getAttribute("data-alt"),
-		};
-		uppyReset(imageUppy);
-
-		const blob = await fetch(el.src).then((res) => res.blob());
-		const ts = new Date().toISOString().replace(/[-:.]/g, "").replace("Z", "");
-
-		imageUppy.addFile({
-			name: ts + ".png",
-			type: blob.type,
-			data: blob,
-			meta: {
-				isCropped: true,
-				fromServer: true,
-			},
-		});
-
-		document.getElementById("altText").value = current.element.alt;
-
-		customButton.style.top = e.pageY + 10 + "px";
-		customButton.style.left = e.pageX + 10 + "px";
-		customButton.style.display = "block";
-	}
-
-	function nseImageEditor(active) {
-		if (!active) {
-			destroyUppy();
-			customButton.style.display = "none";
-			document.querySelectorAll(".imageeditor").forEach((el) => {
-				el.removeEventListener("click", handleImageEditor);
-				el.style.cursor = "";
-			});
-			return;
-		}
-
-		imageUppy = initializeUppy();
-		initializeEventListener();
-
-		customButton.addEventListener("click", () => {
-			openModal();
-		});
-
-		function initializeUppy() {
-			console.log(Uppy.locales);
-			console.log(current);
-			const uppy = new UppyConstructor({
-				locale: availableLang[lang],
-				restrictions: {
-					maxNumberOfFiles: 1,
-					allowedFileTypes: acceptedImageTypes,
-					autoProceed: true,
-				},
-			});
-
-			uppy.use(Dashboard, {
-				inline: true,
-				target: "#uppy",
-				showAddFilesButton: false,
-				hideUploadButton: true,
-				height: 400,
-			});
-
-			uppy.use(ImageEditor, {
-				target: Dashboard,
-				cropperOptions: {
-					viewMode: 1,
-					autoCropArea: 1,
-				},
-				actions: {
-					revert: false,
-					rotate: false,
-					flip: false,
-					granularRotate: false,
-					cropSquare: false,
-					cropWidescreen: false,
-					cropWidescreenVertical: false,
-				},
-			});
-
-			uppy.on("file-added", (file) => {
-				console.log(file.type);
-				if (file.meta.isCropped) return;
-				pendingFile = file;
-				openCropper(file);
-				document.getElementById("generateByAi").disabled = false;
-				return false;
-			});
-
-			uppy.on("file-editor:complete", (file) => {
-				file.meta.fromServer = false;
-			});
-
-			uppy.on("cancel-all", () => {
-				document.getElementById("generateByAi").disabled = true;
-			});
-
-			return uppy;
-		}
-
-		function destroyUppy() {
-			if (imageUppy) {
-				imageUppy.cancelAll();
-				imageUppy.destroy();
-			}
-		}
-
-		function initializeEventListener() {
-			const modal = document.getElementById("modalNseBackground");
-
-			modal.addEventListener("click", (e) => {
-				if (e.target === modal) closeModal();
-			});
-
-			document.getElementById("generateByAi").addEventListener("click", () => {
-				const [file] = imageUppy.getFiles();
-				if (file) {
-					console.log("%c[Mitral AI] - Starting", "color: #f57842");
-
-					new Compressor(file.data, {
-						quality: 0.7,
-						width: 1000,
-
-						async success(result) {
-							console.log(result.size / (1024 * 1024) + " mo");
-
-							const base64 = await blobToBase64(result);
-
-							var formData = new FormData();
-							formData.append("imageURL", base64);
-
-							const response = await fetch(
-								baseURL + "/rest/mistral/image-alt/",
-								{
-									method: "POST",
-									body: formData,
-								}
-							);
-
-							const json = await response.json();
-
-							if (json.code === "200") {
-								document.getElementById("altText").value =
-									json.data.content.choices[0].message.content;
-								console.log("%cSuccess - Alt updated", "color: #63f542");
-							} else {
-								console.error("No description :'(");
-							}
-						},
-
-						error(err) {
-							console.error("Une erreur est survenue");
-						},
-					});
-				}
-			});
-
-			document
-				.getElementById("assetsManagerImage")
-				.addEventListener("click", async () => {
-					registerFileBrowserHandler({
-						modalId: "modalImageFileBrowser",
-						fileBrowserId: "imageFileBrowser",
-						acceptedTypes: imageTypesWithoutDots,
-						fileType: "image",
-						uppyInstance: imageUppy,
-					}).then(() => {
-							document.getElementById("generateByAi").disabled = false;
-					});
-				});
-
-			document
-				.getElementById("saveImage")
-				.addEventListener("click", async () => {
-					const [file] = imageUppy.getFiles();
-					const params = new URLSearchParams();
-
-					console.log(current);
-
-					params.append("urlvalue", current.dataRessourceId);
-					params.append("alt", document.getElementById("altText").value);
-
-					if (current.customFields?.alt) {
-						params.append("altField", current.customFields.alt);
-					}
-					if (current.customFields?.src) {
-						params.append("srcField", current.customFields.src);
-					}
-
-					if (file && !file.meta.fromServer) {
-						try {
-							document.getElementById("saveImage").innerText =
-								"Uploading document";
-							const uploadResult = await uploadFile(file, current.lang);
-							if (uploadResult.code === "200") {
-								params.append(
-									"imageSrc",
-									uploadResult.data.fullname.replace(/^(images)\//, "")
-								);
-							} else {
-								console.error("Upload failed", uploadResult);
-								return;
-							}
-						} catch (err) {
-							console.error("Upload error", err);
-							return;
-						}
-					}
-
-					if (file && file.meta.updateImage && file.meta.dir) {
-						params.append("imageSrc", file.meta.dir + "/" + file.name);
-					}
-
-					try {
-						document.getElementById("saveImage").innerText = "Updating data";
-
-						const response = await sendRequest(
-							`/rest/newsiteeditor/image/${current.dataRessourceId}`,
-							"PUT",
-							params
-						);
-
-						if (response.code === "200") {
-							closeModal();
-							window.location.reload();
-						}
-					} catch (err) {
-						console.error("Save error", err);
-					}
-				});
-
-			document
-				.getElementById("closeImageModal")
-				.addEventListener("click", () => {
-					closeModal();
-				});
-
-			document.getElementById("uploadFile").addEventListener("click", (e) => {
-				openFileSelectorAndReplace(
-					imageUppy,
-					"image/webp,image/png,image/jpeg"
-				);
-			});
-
-			document.addEventListener("click", (event) => {
-				if (!event.target.classList.contains("imageeditor")) {
-					customButton.style.display = "none";
-					document.querySelectorAll(".imageeditor").forEach((el) => {
-						el.classList.remove("selected-img");
-					});
-				}
-			});
-
-			document.querySelectorAll(".imageeditor").forEach((el) => {
-				el.style.cursor = "pointer";
-				el.removeEventListener("click", handleImageEditor);
-				el.addEventListener("click", handleImageEditor);
-			});
-
-			document
-				.getElementById("cropper-cancel")
-				.addEventListener("click", () => {
-					document.getElementById("cropper-modal").classList.remove("active");
-					if (cropper) {
-						cropper.destroy();
-						cropper = null;
-					}
-					pendingFile = null;
-				});
-
-			document
-				.getElementById("cropper-confirm")
-				.addEventListener("click", () => {
-					if (!cropper || !pendingFile) return;
-
-					cropper.getCroppedCanvas().toBlob((blob) => {
-						imageUppy.removeFile(pendingFile.id);
-
-						const ts = new Date()
-							.toISOString()
-							.replace(/[-:.]/g, "")
-							.replace("Z", "");
-
-						imageUppy.addFile({
-							name: ts + ".png",
-							type: pendingFile.type,
-							data: blob,
-							meta: {
-								isCropped: true,
-							},
-						});
-
-						document.getElementById("cropper-modal").classList.remove("active");
-						document.getElementById("generateByAi").disabled = false;
-
-						cropper.destroy();
-						cropper = null;
-						pendingFile = null;
-					}, pendingFile.type);
-				});
-		}
-
-		async function uploadFile(file) {
-			console.log(current);
-			const formData = new FormData();
-			formData.append("file", file.data, file.name);
-			formData.append("inputFileFieldName", "file");
-			formData.append("context_key", current.lang);
-
-			const response = await sendRequest(
-				"/rest/newsiteeditor/image/",
-				"POST",
-				formData
-			);
-			return response;
-		}
-
-		function openCropper(file) {
-			const reader = new FileReader();
-			reader.onload = (e) => {
-				const cropperImage = document.getElementById("cropper-image");
-				cropperImage.src = e.target.result;
-
-				document.getElementById("cropper-modal").classList.add("active");
-
-				if (cropper) {
-					cropper.destroy();
-				}
-
-				cropper = new Cropper(cropperImage, {
-					viewMode: 1,
-					aspectRatio: current.aspectRatio,
-					autoCropArea: 1,
-				});
-			};
-			reader.readAsDataURL(file.data);
-		}
-
-		function openModal() {
-			document.getElementById("modalNseBackground").style.display = "flex";
-			const imageEditor = imageUppy.getPlugin("ImageEditor");
-			imageEditor.setOptions({
-				cropperOptions: {
-					viewMode: 1,
-					aspectRatio: current.aspectRatio,
-					autoCropArea: 1,
-				},
-			});
-		}
-
-		function closeModal() {
-			document.getElementById("modalNseBackground").style.display = "none";
-			current = {};
-			destroyUppy();
-			imageUppy = initializeUppy();
-		}
-	}
-
-	let posterUppy = null;
-	let videoUppy = null;
-	let isVideoEditorSetup = false;
-	/**
-	 * Editeur vidéo du newSiteEditor, permet de modifier la source, le poster, le titre et l'ariaLabel
-	 * @param {boolean} enable - Active ou désactive l'éditeur vidéo.
-	 */
-	function nseVideoEditor(enable) {
-		//C'est un truc plus ou moins comme les records en typescript
-		const videoInfos = new Map();
-
-		const buttonId = "videoEditorButton";
-		const videoBackgroundID = "modalNseVideoBackground";
-		const nextToVideo = "nextToVideo";
-		const backToPoster = "backToPoster";
-		const videoTitleInput = "videoTitle";
-		const closeButtonID = "closeVideoModal";
-		const ariaLabelInput = "ariaLabel";
-		const submitVideoEditorID = "submitVideoEditor";
-		const posterPreview = document.getElementById("posterPreview");
-		const videoPreview = document.getElementById("videoPreview");
-
-		/**
-		 * Affiche la modal à l'écran
-		 */
-		function showModal() {
-			document.body.style.overflow = "hidden";
-			document.getElementById(videoBackgroundID).style.display = "flex";
-			if (!posterUppy || !videoUppy) {
-				[posterUppy, videoUppy] = initializeUppy();
-			}
-			loadPosterToUppy();
-		}
-
-		/**
-		 * Cache la modal et réinitialise tout les uppys
-		 */
-		function hideModal() {
-			document.getElementById(videoBackgroundID).style.display = "none";
-			closeUppy();
-			showPosterStep();
-		}
-
-		/**
-		 * Affiche l'étape du poster
-		 */
-		function showPosterStep() {
-			document.querySelector("#modalPosterNse").style.display = "block";
-			document.querySelector("#modalVideoNse").style.display = "none";
-		}
-
-		/**
-		 * Affiche l'étape d'édition de vidéo avec les infos actuelles.
-		 * @param {Object} info - Informations sur la vidéo.
-		 * @param {string} info.title - Titre de la vidéo.
-		 * @param {string} info.aria - Aria-label de la vidéo.
-		 */
-		function showVideoStep(info) {
-			document.querySelector("#modalPosterNse").style.display = "none";
-			document.querySelector("#modalVideoNse").style.display = "block";
-			document.getElementById("videoTitle").value = info.title;
-			document.getElementById("ariaLabel").value = info.aria;
-		}
-
-		/**
-		 * Initialise les écouteurs d'évenements nécessaires à l'éditeur.
-		 */
-		function setupEventListeners() {
-			document.getElementById(buttonId).addEventListener("click", () => {
-				const button = document.getElementById(buttonId);
-				button.style.display = "none";
-
-				const currentId = button.getAttribute("data-currentId");
-				const info = videoInfos.get(currentId);
-
-				showModal();
-				document.body.addEventListener("keyup", (e) => {
-					if (e.code === "Escape") {
-						hideModal();
-					}
-				});
-				console.log(info);
-				posterPreview.src = info?.poster;
-				videoPreview.src = info.src;
-			});
-
-			document
-				.getElementById(videoBackgroundID)
-				.addEventListener("click", (event) => {
-					if (event.target.id === videoBackgroundID) {
-						hideModal();
-					}
-				});
-
-			document.getElementById(closeButtonID).addEventListener("click", () => {
-				hideModal();
-			});
-
-			document
-				.getElementById("uploadPosterFile")
-				.addEventListener("click", (e) => {
-					openFileSelectorAndReplace(posterUppy, "image/webp,image/png,image/jpeg");
-				});
-
-			document
-				.getElementById("assetsManagerPoster")
-				.addEventListener("click", async () => {
-					registerFileBrowserHandler({
-						modalId: "modalPosterFileBrowser",
-						fileBrowserId: "posterFileBrowser",
-						acceptedTypes: imageTypesWithoutDots,
-						fileType: "image",
-						uppyInstance: posterUppy,
-					});
-					});
-
-			document
-				.getElementById("assetsVideoManager")
-				.addEventListener("click", async () => {
-					registerFileBrowserHandler({
-						modalId: "modalVideoFileBrowser",
-						fileBrowserId: "videoFileBrowser",
-						acceptedTypes: videoTypesWithoutDots,
-						fileType: "video",
-						uppyInstance: videoUppy,
-						preview: videoPreview,
-					});
-				});
-
-			document.getElementById(nextToVideo).addEventListener("click", () => {
-				const info = getCurrentButtonInfo();
-				showVideoStep(info);
-			});
-
-			document.getElementById(backToPoster).addEventListener("click", () => {
-				showPosterStep();
-			});
-
-			document.querySelectorAll(".videoeditor").forEach((el) => {
-				const videoInfo = extractVideoInfo(videojs(el.id));
-				videoInfos.set(el.id, videoInfo);
-
-				el.addEventListener("click", (event) => {
-					event.stopPropagation();
-					event.stopImmediatePropagation();
-					updateReplaceButtonPositionAndDataId(event.pageX, event.pageY, el.id);
-				});
-			});
-
-			document
-				.getElementById("uploadVideoFile")
-				.addEventListener("click", (e) => {
-					openFileSelectorAndReplace(videoUppy, "video/mp4, video/webm");
-				});
-
-			document
-				.getElementById(submitVideoEditorID)
-				.addEventListener("click", () => {
-					submitModal();
-				});
-		}
-
-		/**
-         * Supprime les écouteurs d'évement
-
-         /**
-         * Extrait les informations d'une vidéo à partir du player video.js.
-         * @param {Object} player - Instance du lecteur video.js.
-         * @returns {{poster: string, title: string, aria: string, src: string}} - Informations extraites.
-         */
-		function extractVideoInfo(player) {
-			const sources = Array.from(player.el().querySelectorAll("source")).map(
-				(s) => ({
-					src: s.src,
-					type: s.type,
-				})
-			);
-
-			return {
-				id: player.el().id,
-				resourceId: player.el().getAttribute("data-resource-id"),
-				context_key: player.el().getAttribute("data-lang"),
-				poster: player.poster(),
-				title: player.el().title,
-				aria: player.el().getAttribute("aria-label"),
-				src: sources[0]?.src,
-			};
-		}
-
-		/**
-		 * Met à jour la position du bouton "Edit video" et le data-id courant.
-		 * @param {number} x - Position X du clic.
-		 * @param {number} y - Position Y du clic.
-		 * @param {string} videoId - ID de la vidéo cliquée.
-		 */
-		function updateReplaceButtonPositionAndDataId(x, y, videoId) {
-			const replaceButton = document.getElementById(buttonId);
-			if (replaceButton.getAttribute("data-movable") !== "true") return;
-
-			Object.assign(replaceButton.style, {
-				display: "block",
-				left: x + "px",
-				top: y + "px",
-			});
-
-			replaceButton.setAttribute("data-currentId", videoId);
-		}
-
-		/**
-		 * Initialise les instances Uppy pour le poster et la vidéo.
-		 * @returns {[UppyConstructor, UppyConstructor]} - Instances Uppy pour le poster et la vidéo.
-		 */
-		function initializeUppy() {
-			const poster = createPosterUppy();
-			const video = createVideoUppy();
-			return [poster, video];
-		}
-
-		function loadPosterToUppy() {
-			const info = getCurrentButtonInfo();
-			if (!info?.poster) return;
-
-			fetch(info.poster)
-				.then((res) => res.blob())
-				.then((blob) => {
-					const file = new File([blob], "poster.jpg", {
-						type: blob.type || "image/jpeg",
-					});
-
-					posterUppy.addFile({
-						name: file.name,
-						type: file.type,
-						data: file,
-						source: "Server",
-						meta: {
-							fromServer: true,
-						},
-					});
-				})
-				.catch(console.error);
-
-			if (!info.id) return;
-			videojs(info.id).pause();
-		}
-
-		/**
-		 * Détruit les instances Uppy existantes (poster et vidéo).
-		 */
-		function closeUppy() {
-			document.body.style.overflow = "auto";
-
-			if (posterUppy) {
-				const posterDash = posterUppy.getPlugin("Dashboard");
-				if (posterDash && typeof posterDash.destroy === "function") {
-					posterDash.destroy();
-				}
-				posterUppy = null;
-
-				const posterContainer = document.querySelector("#uppy-poster");
-				if (posterContainer) posterContainer.innerHTML = "";
-			}
-
-			if (videoUppy) {
-				const videoDash = videoUppy.getPlugin("Dashboard");
-				if (videoDash && typeof videoDash.destroy === "function") {
-					videoDash.destroy();
-				}
-				videoUppy = null;
-
-				const videoContainer = document.querySelector("#uppy-video");
-				if (videoContainer) videoContainer.innerHTML = "";
-			}
-		}
-
-		/**
-		 * Crée l'instance Uppy pour le poster.
-		 * @returns {Uppy} - Instance Uppy configurée pour les images.
-		 */
-		function createPosterUppy() {
-			const uppy = new UppyConstructor({
-				locale: availableLang[lang],
-				restrictions: {
-					maxNumberOfFiles: 1,
-					allowedFileTypes: acceptedImageTypes,
-				},
-			});
-
-			uppy.use(Dashboard, {
-				inline: true,
-				target: "#uppy-poster",
-				showAddFilesButton: false,
-				hideUploadButton: true,
-				height: 450,
-			});
-
-			uppy.use(ImageEditor, {
-				target: Dashboard,
-				cropperOptions: {
-					viewMode: 1,
-					autoCropArea: 1,
-					aspectRatio: 25 / 14,
-				},
-				actions: {
-					revert: false,
-					rotate: false,
-					flip: false,
-					granularRotate: false,
-					cropSquare: false,
-					cropWidescreen: false,
-					cropWidescreenVertical: false,
-				},
-			});
-
-			uppy.on("file-added", (file) => {
-				console.log(file);
-				if (file.meta.fromServer) {
-					const objectURL = URL.createObjectURL(file.data);
-					posterPreview.src = objectURL;
-					return;
-				}
-
-				uppy.getPlugin("Dashboard").openFileEditor(file);
-				return false;
-			});
-
-			uppy.on("file-editor:complete", (file) => {
-				const objectURL = URL.createObjectURL(file.data);
-				file.meta.fromServer = false;
-				posterPreview.src = objectURL;
-			});
-
-			uppy.on("file-removed", () => {
-				const info = getCurrentButtonInfo();
-				posterPreview.src = info?.poster;
-			});
-
-			uppy.on("file-editor:cancel", () => {
-				uppy.cancelAll();
-			});
-
-			uppy.on("cancel-all", () => {
-				if (!enable) return;
-				const info = getCurrentButtonInfo();
-				posterPreview.src = info?.poster;
-			});
-
-			return uppy;
-		}
-
-		/**
-		 * Crée l'instance Uppy pour la vidéo.
-		 * @returns {Uppy} - Instance Uppy configurée pour les vidéos.
-		 */
-		function createVideoUppy() {
-			const uppy = new UppyConstructor({
-				locale: availableLang[lang],
-				restrictions: {
-					maxNumberOfFiles: 1,
-					allowedFileTypes: acceptedVideoTypes,
-				},
-			});
-
-			uppy.use(Dashboard, {
-				inline: true,
-				target: "#uppy-video",
-				showAddFilesButton: false,
-				hideUploadButton: true,
-				height: 200,
-			});
-
-			uppy.on("file-added", (file) => {
-				videoPreview.src = URL.createObjectURL(file.data);
-			});
-
-			uppy.on("file-removed", () => {
-				const info = getCurrentButtonInfo();
-				videoPreview.src = info.src;
-			});
-
-			uppy.on("cancel-all", () => {
-				if (!enable) return;
-				const info = getCurrentButtonInfo();
-				videoPreview.src = info.src;
-			});
-
-			return uppy;
-		}
-
-		/**
-		 * Récupère les informations de la vidéo actuellement sélectionnée.
-		 * @returns {{poster: string, title: string, aria: string, src: string}} - Infos vidéo actuelle.
-		 */
-		function getCurrentButtonInfo() {
-			const button = document.getElementById(buttonId);
-			const currentId = button.getAttribute("data-currentId");
-			const info = videoInfos.get(currentId);
-			return info;
-		}
-
-		/**
-		 * Soumet les données modifiées du modal au serveur.
-		 * Met à jour les infos de la Map et le player video.js en conséquence.
-		 */
-		async function submitModal() {
-			const poster = posterUppy.getFiles()[0];
-			const video = videoUppy.getFiles()[0];
-			const title = document.getElementById(videoTitleInput)?.value?.trim();
-			const ariaLabel = document.getElementById(ariaLabelInput)?.value?.trim();
-
-			const buttonInfo = getCurrentButtonInfo();
-			const resourceId = buttonInfo.resourceId;
-
-			if (!poster && !video && !title && !ariaLabel) {
-				hideModal();
-				return;
-			}
-
-			const uploadFileIfNeeded = async (file, type) => {
-				if (file && !file.meta.fromServer) {
-					const formData = new FormData();
-					formData.append("file", file.data, file.name);
-					formData.append("inputFileFieldName", "file");
-					formData.append("context_key", buttonInfo.context_key);
-
-					try {
-						const response = await sendRequest(
-							"/rest/newsiteeditor/" + type,
-							"POST",
-							formData
-						);
-						document.getElementById(submitVideoEditorID).textContent =
-							"Uploading document...";
-						return response?.data?.fullname.replace(/^(images)\//, "");
-					} catch (error) {
-						console.error("Erreur upload fichier :", file.name, error);
-					}
-				}
-				if (
-					file &&
-					file.meta.fromServer &&
-					file.meta.updateImage &&
-					file.meta.dir
-				) {
-					return file.meta.dir + "/" + file.name;
-				}
-			};
-
-			const videoInfoParams = new URLSearchParams();
-
-			const posterLocation = await uploadFileIfNeeded(poster, "image");
-			const videoLocation = await uploadFileIfNeeded(video, "video");
-
-			document.getElementById(submitVideoEditorID).textContent =
-				"Updating data..";
-
-			videoInfoParams.append("urlvalue", resourceId);
-			videoInfoParams.append("ariaLabel", ariaLabel);
-			videoInfoParams.append("title", title);
-
-			if (posterLocation) {
-				videoInfoParams.append("poster", posterLocation);
-			}
-			if (videoLocation) {
-				videoInfoParams.append("video", videoLocation);
-			}
-
-			const updateInfo = await sendRequest(
-				"/rest/newsiteeditor/video/" + resourceId,
-				"PUT",
-				videoInfoParams
-			).then(() => {
-				window.location.reload();
-			});
-		}
-
-		if (!enable) {
-			closeUppy();
-			hideModal();
-			document.getElementById(buttonId).style.display = "none";
-			document.getElementById(buttonId).setAttribute("data-movable", false);
-			return;
-		}
-
-		if (!isVideoEditorSetup) {
-			setupEventListeners();
-			console.log("setup");
-			isVideoEditorSetup = true;
-		}
-		document.getElementById(buttonId).setAttribute("data-movable", true);
-
-		if (!posterUppy || !videoUppy) {
-			[posterUppy, videoUppy] = initializeUppy();
-		}
-	}
-
-	/**
-	 * @param {Uppy} uppyInstance Instance of Uppy that you should update
-	 * @param {string} acceptedType A comma-separated string of MIME types (e.g., "image/png,image/jpeg")
-	 */
-	function openFileSelectorAndReplace(uppyInstance, acceptedType = "image/*") {
-		const tempInput = document.createElement("input");
-		tempInput.type = "file";
-		tempInput.accept = acceptedType;
-		tempInput.style.display = "none";
-
-		const acceptedMimeTypes = acceptedType
-			.split(",")
-			.map((type) => type.trim().toLowerCase());
-
-			console.log(acceptedMimeTypes);
-
-		tempInput.addEventListener("change", (e) => {
-			const file = e.target.files[0];
-
-			if (file) {
-				const fileType = file.type.toLowerCase();
-
-				const isAccepted = acceptedMimeTypes.some((type) => {
-					if (type.endsWith("/*")) {
-						return fileType.startsWith(type.slice(0, -1));
-					}
-					return fileType === type;
-				});
-
-				if (!isAccepted) {
-					uppyInstance.info(uppyInstance.i18n('youCanOnlyUploadFileTypes',
-					{types: acceptedMimeTypes.map((type) => {
-  						const parts = type.split('/');
-						return parts[1] ? ` .${parts[1]}` : null;
-					}).filter(Boolean)}), 'error', 5000);
-					console.warn(`Type de fichier non autorisé : ${fileType}`);
-					tempInput.remove();
-					return;
-				}
-
-				uppyReset(uppyInstance);
-
-				uppyInstance.addFile({
-					name: file.name,
-					type: file.type,
-					data: file,
-					source: "Local",
-				});
-			}
-
-			tempInput.remove();
-		});
-
-		document.body.appendChild(tempInput);
-		tempInput.click();
-	}
-
-	async function openFileBrowser(
-		containerId,
-		apiLink,
-		acceptedFileType,
-		fileDirectory
-	) {
-		return new Promise((resolve) => {
-			const explorer = new Karibsen.ServerBrowser({
-				containerId: containerId,
-				theme: "primary",
-				acceptedTypeFiles: acceptedFileType,
-				lang: document.documentElement.lang.toLowerCase(),
-				onValidate(file) {
-					console.log(file);
-					resolve(file);
-					explorer.destroy();
-				},
-				dataSource:
-					baseURL + "/rest/newsiteeditor/dir?fileDirectory=" + fileDirectory,
-				autoHideEmptyFolders: true,
-			});
-
-			explorer.open();
-		});
-	}
-
-	async function uppyReset(uppyInstance) {
-		uppyInstance.getFiles().forEach((f) => uppyInstance.removeFile(f.id));
-	}
-
-	async function updateUppyInstance(
-		uppyInstance,
-		file,
-		folder,
-		videoPreview = null
-	) {
-		try {
-			let blob;
-
-			const mimeType = await getMimeTypeFromUrl(file.url);
-			if (mimeType && mimeType.startsWith("video/")) {
-				if (videoPreview) {
-					blob = "videoInfo";
-					blob.type = mimeType;
-					videoPreview.src = file.url;
-				}
-			} else {
-			const response = await fetch(file.url);
-				blob = await response.blob();
-			}
-
-			uppyReset(uppyInstance);
-
-			uppyInstance.addFile({
-				name: file.name,
-				type: blob.type,
-				data: blob,
-				meta: {
-					fromServer: true,
-					isCropped: true,
-					updateImage: true,
-					dir: folder,
-				},
-			});
-
-			return true;
-		} catch (err) {}
-	}
-
-	async function getMimeTypeFromUrl(url) {
-		try {
-			const response = await fetch(url, { method: "HEAD" });
-
-			if (!response.ok) {
-				throw new Error("Échec de la requête HEAD");
-			}
-
-			return response.headers.get("Content-Type");
-		} catch (e) {
-			console.error("Erreur HEAD fetch:", e);
-			return null;
-		}
-	}
-
-	async function sendRequest(requestURL, method, Data) {
-		if (!requestURL.startsWith("http")) {
-			requestURL = baseURL + requestURL;
-		}
-
-		const response = await fetch(requestURL, {
-			method: method,
-			body: Data,
-		});
-
-		const contentType = response.headers.get("content-type");
-
-		let result;
-
-		if (contentType && contentType.includes("application/json")) {
-			result = await response.json();
-		} else {
-			result = await response.blob();
-		}
-
-		return result;
-	}
-
-	/**
-	 *
-	 * @param {string} triggerId - Id of the trigger
-	 * @param {string} modalId - Id of the modal
-	 * @param {string} fileBrowserId - Id of Kserver container
-	 * @param {string[]} acceptedTypes - Accepted files in Kserver
-	 * @param {string} fileType -
-	 * @param {Uppy} uppyInstance - Uppy instance to update
-	 * @param {HTMLElement} [preview] - Element HTML pour mise à jour d’un aperçu vidéo ou image
-	 */
-	async function registerFileBrowserHandler({
-		modalId,
-		fileBrowserId,
-		acceptedTypes,
-		fileType,
-		uppyInstance,
-		preview = null,
-	}) {
-		const modal = new Modal(modalId);
-		modal.open();
-
-		modal.onBackgroundClick(() => modal.close());
-		modal.onCloseButtonClick();
-
-		try {
-			const selectedFile = await openFileBrowser(
-				fileBrowserId,
-				baseURL + "/rest/contexts/list/get.json",
-				acceptedTypes,
-				fileType
-			);
-
-			await updateUppyInstance(
-				uppyInstance,
-				selectedFile.file,
-				selectedFile.folder,
-				preview
-			);
-
-			modal.close();
-		} catch (error) {
-			console.error(`Erreur lors de la sélection de fichier :`, error);
-			modal.close();
-		}
-	}
-
-	// to set data-data for every element when opening the page
-	$(".siteeditor").each(function () {
-		dataData(this);
-	});
-
-	//window.addEventListener('DOMContentLoaded', newsiteeditor, false);
-	view();
-	edit();
-	onHover();
-	saveContent();
-	undo();
-	redo();
-	onHoverManager();
-	//onClickManager();
-	//sidebar();
-	//sidebarToggle();//activate sidebar
-	loadCustomerManager();
-	loadHelpManager();
-	putNbColumn();
-	putWidth();
-	putPadding();
-	//$('#body').off('click');
-	//$('section').off('click');
-
-	// define the public API
-	var API = {};
-	API.version = version;
-	// API.add = add;
-	// API.get_array = get_array;
-
-	return API;
-})();

+ 89 - 0
modules/README.md

@@ -0,0 +1,89 @@
+# Modules du NewSiteEditor
+
+Ce dossier contient les modules fonctionnels extraits du fichier principal `index.js` pour une meilleure organisation et maintenabilité du code.
+
+## Structure des modules
+
+### VideoEditor.js
+- **Fonction principale** : `nseVideoEditor(enable)`
+- **Description** : Gère l'éditeur vidéo complet du NewSiteEditor
+- **Fonctionnalités** :
+  - Modification de la source vidéo
+  - Édition du poster (image de prévisualisation)
+  - Modification du titre et de l'aria-label
+  - Upload de fichiers via Uppy
+  - Intégration avec le gestionnaire de fichiers Karibsen
+  - Interface modale multi-étapes
+
+## Dépendances
+
+### Dépendances externes
+- **Uppy** : Gestion des uploads de fichiers
+- **Video.js** : Lecteur vidéo
+- **Karibsen.ServerBrowser** : Gestionnaire de fichiers serveur
+- **jQuery** : Fonctions utilitaires (imxLoaderDisplay, etc.)
+
+### Dépendances internes
+- **Modal** : Classe pour la gestion des modales
+- **Configuration globale** : baseURL, lang, acceptedImageTypes, acceptedVideoTypes
+
+## Utilisation
+
+### Import du module
+```javascript
+import { nseVideoEditor } from './modules/VideoEditor.js';
+```
+
+### Activation/Désactivation
+```javascript
+// Activer l'éditeur vidéo
+nseVideoEditor(true);
+
+// Désactiver l'éditeur vidéo
+nseVideoEditor(false);
+```
+
+## Fonctionnalités détaillées
+
+### 1. Gestion des vidéos
+- Détection automatique des éléments `.videoeditor`
+- Extraction des informations vidéo (poster, titre, aria-label, source)
+- Mise à jour en temps réel des propriétés
+
+### 2. Interface utilisateur
+- Modal multi-étapes (poster → vidéo)
+- Bouton flottant positionnable
+- Gestion des événements clavier (Escape pour fermer)
+
+### 3. Upload de fichiers
+- Support des images (poster) : .jpg, .jpeg, .png, .gif, .webp
+- Support des vidéos : .mp4, .webm
+- Validation des types de fichiers
+- Compression et optimisation automatiques
+
+### 4. Intégration serveur
+- Upload via API REST (`/rest/newsiteeditor/image/`, `/rest/newsiteeditor/video/`)
+- Mise à jour des métadonnées (`/rest/newsiteeditor/video/{id}`)
+- Gestion des erreurs et feedback utilisateur
+
+## Variables d'état
+
+Le module gère ses propres variables d'état :
+- `posterUppy` : Instance Uppy pour les images
+- `videoUppy` : Instance Uppy pour les vidéos
+- `isVideoEditorSetup` : État d'initialisation des événements
+
+## Notes importantes
+
+1. **Isolation** : Le module est complètement autonome et gère ses propres dépendances
+2. **Performance** : Les instances Uppy sont réutilisées pour éviter les re-créations
+3. **Compatibilité** : Fonctionne avec l'architecture existante du NewSiteEditor
+4. **Extensibilité** : Facilement modifiable pour ajouter de nouvelles fonctionnalités
+
+## Tests
+
+Un fichier de test `test-video.html` est fourni pour vérifier le bon fonctionnement du module.
+
+## Migration depuis l'ancienne version
+
+L'ancienne fonction `nseVideoEditor` a été complètement extraite du fichier principal. Le module conserve exactement la même API et le même comportement, garantissant une compatibilité totale.

+ 734 - 0
modules/VideoEditor.js

@@ -0,0 +1,734 @@
+/**
+ * Module VideoEditor - Gestion de l'éditeur vidéo du NewSiteEditor
+ * Permet de modifier la source, le poster, le titre et l'ariaLabel des vidéos
+ */
+
+// Imports des dépendances
+import { Modal } from '../classes/Modal.js';
+
+// Configuration
+const baseURL = window.location.origin;
+// Configuration du préfixe REST - peut être surchargée via window.NEWSITEEDITOR_CONFIG
+const REST_PREFIX = (window.NEWSITEEDITOR_CONFIG && window.NEWSITEEDITOR_CONFIG.restPrefix) || "/rest";
+const { Uppy: UppyConstructor, Dashboard, ImageEditor } = window.Uppy;
+const availableLang = Uppy.locales;
+const lang = `${document.documentElement.lang.toLowerCase()}_${document.documentElement.lang.toUpperCase()}`;
+const acceptedImageTypes = [".jpg", ".jpeg", ".png", ".gif", ".webp"];
+const acceptedVideoTypes = [".mp4", ".webm"];
+
+// Variables d'état du module
+let posterUppy = null;
+let videoUppy = null;
+let isVideoEditorSetup = false;
+
+/**
+ * Converts a File or Blob object to a Base64-encoded data URL.
+ * @param {File|Blob} blob - The file or blob to convert.
+ * @returns {Promise<string>} A promise that resolves to the Base64-encoded string.
+ */
+function blobToBase64(blob) {
+    return new Promise((resolve, reject) => {
+        const reader = new FileReader();
+        reader.onloadend = () => {
+            resolve(reader.result);
+        };
+        reader.onerror = reject;
+        reader.readAsDataURL(blob);
+    });
+}
+
+/**
+ * @param {Uppy} uppyInstance Instance of Uppy that you should update
+ * @param {string} acceptedType A comma-separated string of MIME types (e.g., "image/png,image/jpeg")
+ */
+function openFileSelectorAndReplace(uppyInstance, acceptedType = "image/*") {
+    const tempInput = document.createElement("input");
+    tempInput.type = "file";
+    tempInput.accept = acceptedType;
+    tempInput.style.display = "none";
+
+    const acceptedMimeTypes = acceptedType
+        .split(",")
+        .map((type) => type.trim().toLowerCase());
+
+    tempInput.addEventListener("change", (e) => {
+        const file = e.target.files[0];
+
+        if (file) {
+            const fileType = file.type.toLowerCase();
+
+            const isAccepted = acceptedMimeTypes.some((type) => {
+                if (type.endsWith("/*")) {
+                    return fileType.startsWith(type.slice(0, -1));
+                }
+                return fileType === type;
+            });
+
+            if (!isAccepted) {
+                uppyInstance.info(uppyInstance.i18n('youCanOnlyUploadFileTypes',
+                    {types: acceptedMimeTypes.map((type) => {
+                            const parts = type.split('/');
+                            return parts[1] ? ` .${parts[1]}` : null;
+                        }).filter(Boolean)}), 'error', 5000);
+                console.warn(`Type de fichier non autorisé : ${fileType}`);
+                tempInput.remove();
+                return;
+            }
+
+            uppyReset(uppyInstance);
+
+            uppyInstance.addFile({
+                name: file.name,
+                type: file.type,
+                data: file,
+                source: "Local",
+            });
+        }
+
+        tempInput.remove();
+    });
+
+    document.body.appendChild(tempInput);
+    tempInput.click();
+}
+
+async function openFileBrowser(
+    containerId,
+    acceptedFileType,
+    fileDirectory
+) {
+    return new Promise((resolve) => {
+        const explorer = new Karibsen.ServerBrowser({
+            containerId: containerId,
+            theme: "primary",
+            acceptedTypeFiles: acceptedFileType,
+            lang: document.documentElement.lang.toLowerCase(),
+            onValidate(file) {
+                resolve(file);
+                explorer.destroy();
+            },
+            dataSource:
+                baseURL + REST_PREFIX + "/newsiteeditor/dir?fileDirectory=" + fileDirectory,
+            autoHideEmptyFolders: true,
+        });
+
+        explorer.open();
+    });
+}
+
+async function uppyReset(uppyInstance) {
+    uppyInstance.getFiles().forEach((f) => uppyInstance.removeFile(f.id));
+}
+
+async function updateUppyInstance(
+    uppyInstance,
+    file,
+    folder,
+    videoPreview = null
+) {
+    try {
+        let blob;
+
+        const mimeType = await getMimeTypeFromUrl(file.url);
+        if (mimeType && mimeType.startsWith("video/")) {
+            if (videoPreview) {
+                blob = "videoInfo";
+                blob.type = mimeType;
+                videoPreview.src = file.url;
+            }
+        } else {
+            const response = await fetch(file.url);
+            blob = await response.blob();
+        }
+
+        uppyReset(uppyInstance);
+
+        uppyInstance.addFile({
+            name: file.name,
+            type: blob.type,
+            data: blob,
+            meta: {
+                fromServer: true,
+                isCropped: true,
+                updateImage: true,
+                dir: folder,
+            },
+        });
+
+        return true;
+    } catch (err) {}
+}
+
+async function getMimeTypeFromUrl(url) {
+    try {
+        const response = await fetch(url, { method: "HEAD" });
+
+        if (!response.ok) {
+            throw new Error("Échec de la requête HEAD");
+        }
+
+        return response.headers.get("Content-Type");
+    } catch (e) {
+        console.error("Erreur HEAD fetch:", e);
+        return null;
+    }
+}
+
+/**
+ * @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) {
+    if (!requestURL.startsWith("http")) {
+        requestURL = baseURL + requestURL;
+    }
+
+    const response = await fetch(requestURL, {
+        method: method,
+        body: Data,
+    });
+
+    const contentType = response.headers.get("content-type");
+
+    let result;
+
+    if (contentType && contentType.includes("application/json")) {
+        result = await response.json();
+    } else {
+        result = await response.blob();
+    }
+
+    return result;
+}
+
+/**
+ * @param {string} triggerId - Id of the trigger
+ * @param {string} modalId - Id of the modal
+ * @param {string} fileBrowserId - Id of Kserver container
+ * @param {string[]} acceptedTypes - Accepted files in Kserver
+ * @param {string} fileType -
+ * @param {Uppy} uppyInstance - Uppy instance to update
+ * @param {HTMLElement} [preview] - Element HTML pour mise à jour d'un aperçu vidéo ou image
+ */
+async function registerFileBrowserHandler({
+    modalId,
+    fileBrowserId,
+    acceptedTypes,
+    fileType,
+    uppyInstance,
+    preview = null,
+    Modal,
+}) {
+    const modal = new Modal(modalId);
+    modal.setVisible(true);
+
+    document.addEventListener('kserverbrowser:closed', (e) => {
+        if(e.detail.containerId === fileBrowserId) {
+            modal.setVisible(false)
+            return
+        }
+    }, {once: true});
+
+    modal.onBackgroundClick(() => modal.setVisible(false));
+    modal.onCloseButtonClick();
+
+    try {
+        const selectedFile = await openFileBrowser(
+            fileBrowserId,
+            acceptedTypes,
+            fileType
+        );
+
+        await updateUppyInstance(
+            uppyInstance,
+            selectedFile.file,
+            selectedFile.folder,
+            preview
+        );
+
+        modal.setVisible(false);
+    } catch (error) {
+        console.error(`Erreur lors de la sélection de fichier :`, error);
+        modal.setVisible(false);
+    }
+}
+
+/**
+ * Editeur vidéo du newSiteEditor, permet de modifier la source, le poster, le titre et l'ariaLabel
+ * @param {boolean} enable - Active ou désactive l'éditeur vidéo.
+ */
+export function nseVideoEditor(enable) {
+    //C'est un truc plus ou moins comme les records en typescript
+    const videoInfos = new Map();
+
+    const buttonId = "videoEditorButton";
+    const videoBackgroundID = "modalNseVideoBackground";
+    const nextToVideo = "nextToVideo";
+    const backToPoster = "backToPoster";
+    const videoTitleInput = "videoTitle";
+    const closeButtonID = "closeVideoModal";
+    const ariaLabelInput = "ariaLabel";
+    const submitVideoEditorID = "submitVideoEditor";
+    const videoPreview = document.getElementById("videoPreview");
+
+    /**
+     * Affiche la modal à l'écran
+     */
+    function showModal() {
+        document.body.style.overflow = "hidden";
+        document.getElementById(videoBackgroundID).style.display = "flex";
+        if (!posterUppy || !videoUppy) {
+            [posterUppy, videoUppy] = initializeUppy();
+        }
+        loadPosterToUppy();
+    }
+
+    /**
+     * Cache la modal et réinitialise tout les uppys
+     */
+    function hideModal() {
+        document.getElementById(videoBackgroundID).style.display = "none";
+        closeUppy();
+        showPosterStep();
+    }
+
+    /**
+     * Affiche l'étape du poster
+     */
+    function showPosterStep() {
+        document.querySelector("#modalPosterNse").style.display = "block";
+        document.querySelector("#modalVideoNse").style.display = "none";
+    }
+
+    /**
+     * Affiche l'étape d'édition de vidéo avec les infos actuelles.
+     * @param {Object} info - Informations sur la vidéo.
+     * @param {string} info.title - Titre de la vidéo.
+     * @param {string} info.aria - Aria-label de la vidéo.
+     */
+    function showVideoStep(info) {
+        document.querySelector("#modalPosterNse").style.display = "none";
+        document.querySelector("#modalVideoNse").style.display = "block";
+        document.getElementById("videoTitle").value = info.title;
+        document.getElementById("ariaLabel").value = info.aria;
+    }
+
+    /**
+     * Initialise les écouteurs d'évenements nécessaires à l'éditeur.
+     */
+    function setupEventListeners() {
+        document.getElementById(buttonId).addEventListener("click", () => {
+            const button = document.getElementById(buttonId);
+            button.style.display = "none";
+
+            const currentId = button.getAttribute("data-currentId");
+            const info = videoInfos.get(currentId);
+
+            showModal();
+            document.body.addEventListener("keyup", (e) => {
+                if (e.code === "Escape") {
+                    hideModal();
+                }
+            });
+            videoPreview.src = info.src;
+        });
+
+        document
+            .getElementById(videoBackgroundID)
+            .addEventListener("click", (event) => {
+                if (event.target.id === videoBackgroundID) {
+                    hideModal();
+                }
+            });
+
+        document.getElementById(closeButtonID).addEventListener("click", () => {
+            hideModal();
+        });
+
+        document
+            .getElementById("uploadPosterFile")
+            .addEventListener("click", (e) => {
+                openFileSelectorAndReplace(posterUppy, "image/webp,image/png,image/jpeg");
+            });
+
+        document
+            .getElementById("assetsManagerPoster")
+            .addEventListener("click", async () => {
+                registerFileBrowserHandler({
+                    modalId: "modalPosterFileBrowser",
+                    fileBrowserId: "posterFileBrowser",
+                    acceptedTypes: acceptedImageTypes.map(t => t.replace('.', '')),
+                    fileType: "image",
+                    uppyInstance: posterUppy,
+                    Modal: window.NSEModal,
+                });
+            });
+
+        document
+            .getElementById("assetsVideoManager")
+            .addEventListener("click", async () => {
+                registerFileBrowserHandler({
+                    modalId: "modalVideoFileBrowser",
+                    fileBrowserId: "videoFileBrowser",
+                    acceptedTypes: acceptedVideoTypes.map(t => t.replace('.', '')),
+                    fileType: "video",
+                    uppyInstance: videoUppy,
+                    preview: videoPreview,
+                    Modal: window.NSEModal,
+                });
+            });
+
+        document.getElementById(nextToVideo).addEventListener("click", () => {
+            const info = getCurrentButtonInfo();
+            showVideoStep(info);
+        });
+
+        document.getElementById(backToPoster).addEventListener("click", () => {
+            showPosterStep();
+        });
+
+        document.querySelectorAll(".videoeditor").forEach((el) => {
+            const videoInfo = extractVideoInfo(videojs(el.id));
+            videoInfos.set(el.id, videoInfo);
+
+            el.addEventListener("click", (event) => {
+                event.stopPropagation();
+                event.stopImmediatePropagation();
+                updateReplaceButtonPositionAndDataId(event.pageX, event.pageY, el.id);
+            });
+        });
+
+        document
+            .getElementById("uploadVideoFile")
+            .addEventListener("click", (e) => {
+                openFileSelectorAndReplace(videoUppy, "video/mp4, video/webm");
+            });
+
+        document
+            .getElementById(submitVideoEditorID)
+            .addEventListener("click", () => {
+                $.imxLoaderDisplay('sasha');
+                $.doTimeout('hideLoader',20000,function(){
+                        $.imxLoaderHide(true);
+                });
+                submitModal();
+            });
+    }
+
+    /**
+     * Extrait les informations d'une vidéo à partir du player video.js.
+     * @param {Object} player - Instance du lecteur video.js.
+     * @returns {{poster: string, title: string, aria: string, src: string}} - Informations extraites.
+     */
+    function extractVideoInfo(player) {
+        const sources = Array.from(player.el().querySelectorAll("source")).map(
+            (s) => ({
+                src: s.src,
+                type: s.type,
+            })
+        );
+
+        //Permet de ne pas activer l'erreur dans la console (https://github.com/videojs/video.js/issues/2617)
+        const tech = player.tech(true);
+
+        return {
+            id: player.el().id,
+            resourceId: player.el().getAttribute("data-resource-id"),
+            context_key: player.el().getAttribute("data-lang"),
+            poster: player.poster(),
+            title: player.el().title,
+            aria: tech.getAttribute("aria-label"),
+            src: sources[0]?.src,
+        };
+    }
+
+    /**
+     * Met à jour la position du bouton "Edit video" et le data-id courant.
+     * @param {number} x - Position X du clic.
+     * @param {number} y - Position Y du clic.
+     * @param {string} videoId - ID de la vidéo cliquée.
+     */
+    function updateReplaceButtonPositionAndDataId(x, y, videoId) {
+        const replaceButton = document.getElementById(buttonId);
+        if (replaceButton.getAttribute("data-movable") !== "true") return;
+
+        Object.assign(replaceButton.style, {
+            display: "block",
+            left: x + "px",
+            top: y + "px",
+        });
+
+        replaceButton.setAttribute("data-currentId", videoId);
+    }
+
+    /**
+     * Initialise les instances Uppy pour le poster et la vidéo.
+     * @returns {[UppyConstructor, UppyConstructor]} - Instances Uppy pour le poster et la vidéo.
+     */
+    function initializeUppy() {
+        const poster = createPosterUppy();
+        const video = createVideoUppy();
+        return [poster, video];
+    }
+
+    function loadPosterToUppy() {
+        const info = getCurrentButtonInfo();
+        if (!info?.poster) return;
+
+        fetch(info.poster)
+            .then((res) => res.blob())
+            .then((blob) => {
+                const file = new File([blob], "poster.jpg", {
+                    type: blob.type || "image/jpeg",
+                });
+
+                posterUppy.addFile({
+                    name: file.name,
+                    type: file.type,
+                    data: file,
+                    source: "Server",
+                    meta: {
+                        fromServer: true,
+                    },
+                });
+            })
+            .catch(console.error);
+
+        if (!info.id) return;
+        videojs(info.id).pause();
+    }
+
+    /**
+     * Détruit les instances Uppy existantes (poster et vidéo).
+     */
+    function closeUppy() {
+        document.body.style.overflow = "auto";
+
+        if (posterUppy) {
+            const posterDash = posterUppy.getPlugin("Dashboard");
+            if (posterDash && typeof posterDash.destroy === "function") {
+                posterDash.destroy();
+            }
+            posterUppy = null;
+
+            const posterContainer = document.querySelector("#uppy-poster");
+            if (posterContainer) posterContainer.innerHTML = "";
+        }
+
+        if (videoUppy) {
+            const videoDash = videoUppy.getPlugin("Dashboard");
+            if (videoDash && typeof videoDash.destroy === "function") {
+                videoDash.destroy();
+            }
+            videoUppy = null;
+
+            const videoContainer = document.querySelector("#uppy-video");
+            if (videoContainer) videoContainer.innerHTML = "";
+        }
+    }
+
+    /**
+     * Crée l'instance Uppy pour le poster.
+     * @returns {Uppy} - Instance Uppy configurée pour les images.
+     */
+    function createPosterUppy() {
+        const uppy = new UppyConstructor({
+            locale: availableLang[lang],
+            restrictions: {
+                maxNumberOfFiles: 1,
+                allowedFileTypes: acceptedImageTypes,
+            },
+        });
+
+        uppy.use(Dashboard, {
+            inline: true,
+            target: "#uppy-poster",
+            showAddFilesButton: false,
+            hideUploadButton: true,
+            height: 450,
+        });
+
+        uppy.use(ImageEditor, {
+            target: Dashboard,
+            cropperOptions: {
+                viewMode: 1,
+                autoCropArea: 1,
+                aspectRatio: 25 / 14,
+            },
+            actions: {
+                revert: false,
+                rotate: false,
+                flip: false,
+                granularRotate: false,
+                cropSquare: false,
+                cropWidescreen: false,
+                cropWidescreenVertical: false,
+            },
+        });
+
+        uppy.on("file-added", (file) => {
+            if (file.meta.fromServer) {
+                return;
+            }
+            uppy.getPlugin("Dashboard").openFileEditor(file);
+            return false;
+        });
+
+        uppy.on("file-editor:complete", (file) => {
+            file.meta.fromServer = false;
+        });
+
+        uppy.on("file-editor:cancel", () => {
+            uppy.cancelAll();
+        });
+
+        return uppy;
+    }
+
+    /**
+     * Crée l'instance Uppy pour la vidéo.
+     * @returns {Uppy} - Instance Uppy configurée pour les vidéos.
+     */
+    function createVideoUppy() {
+        const uppy = new UppyConstructor({
+            locale: availableLang[lang],
+            restrictions: {
+                maxNumberOfFiles: 1,
+                allowedFileTypes: acceptedVideoTypes,
+            },
+        });
+
+        uppy.use(Dashboard, {
+            inline: true,
+            target: "#uppy-video",
+            showAddFilesButton: false,
+            hideUploadButton: true,
+            height: 200,
+        });
+
+        uppy.on("file-added", (file) => {
+            videoPreview.src = URL.createObjectURL(file.data);
+        });
+
+        uppy.on("file-removed", () => {
+            const info = getCurrentButtonInfo();
+            videoPreview.src = info.src;
+        });
+
+        uppy.on("cancel-all", () => {
+            if (!enable) return;
+            const info = getCurrentButtonInfo();
+            videoPreview.src = info.src;
+        });
+
+        return uppy;
+    }
+
+    /**
+     * Récupère les informations de la vidéo actuellement sélectionnée.
+     * @returns {{poster: string, title: string, aria: string, src: string}} - Infos vidéo actuelle.
+     */
+    function getCurrentButtonInfo() {
+        const button = document.getElementById(buttonId);
+        const currentId = button.getAttribute("data-currentId");
+        const info = videoInfos.get(currentId);
+        return info;
+    }
+
+    /**
+     * Soumet les données modifiées du modal au serveur.
+     * Met à jour les infos de la Map et le player video.js en conséquence.
+     */
+    async function submitModal() {
+        const poster = posterUppy.getFiles()[0];
+        const video = videoUppy.getFiles()[0];
+        const title = document.getElementById(videoTitleInput)?.value?.trim();
+        const ariaLabel = document.getElementById(ariaLabelInput)?.value?.trim();
+
+        const buttonInfo = getCurrentButtonInfo();
+        const resourceId = buttonInfo.resourceId;
+
+        if (!poster && !video && !title && !ariaLabel) {
+            hideModal();
+            return;
+        }
+
+        const uploadFileIfNeeded = async (file, type) => {
+            if (file && !file.meta.fromServer) {
+                const formData = new FormData();
+                formData.append("file", file.data, file.name);
+                formData.append("inputFileFieldName", "file");
+                formData.append("context_key", buttonInfo.context_key);
+
+                try {
+                    const response = await sendRequest(
+                        REST_PREFIX + "/newsiteeditor/" + type,
+                        "POST",
+                        formData
+                    );
+                    document.getElementById(submitVideoEditorID).textContent =
+                        "Uploading document...";
+                    return response?.data?.fullname.replace(/^(images)\//, "");
+                } catch (error) {
+                    console.error("Erreur upload fichier :", file.name, error);
+                    $.imxLoaderHide(true);
+                }
+            }
+            if (
+                file &&
+                file.meta.fromServer &&
+                file.meta.updateImage &&
+                file.meta.dir
+            ) {
+                return file.meta.dir + "/" + file.name;
+            }
+        };
+
+        const videoInfoParams = new URLSearchParams();
+
+        const posterLocation = await uploadFileIfNeeded(poster, "image");
+        const videoLocation = await uploadFileIfNeeded(video, "video");
+
+        document.getElementById(submitVideoEditorID).textContent =
+            "Updating data..";
+
+        videoInfoParams.append("urlvalue", resourceId);
+        videoInfoParams.append("ariaLabel", ariaLabel);
+        videoInfoParams.append("title", title);
+
+        if (posterLocation) {
+            videoInfoParams.append("poster", posterLocation);
+        }
+        if (videoLocation) {
+            videoInfoParams.append("video", videoLocation);
+        }
+
+        const updateInfo = await sendRequest(
+            REST_PREFIX + "/newsiteeditor/video/" + resourceId,
+            "PUT",
+            videoInfoParams
+        ).then(() => {
+            window.location.reload();
+        });
+    }
+
+    if (!enable) {
+        closeUppy();
+        hideModal();
+        document.getElementById(buttonId).style.display = "none";
+        document.getElementById(buttonId).setAttribute("data-movable", false);
+        return;
+    }
+
+    if (!isVideoEditorSetup) {
+        setupEventListeners();
+        isVideoEditorSetup = true;
+    }
+    document.getElementById(buttonId).setAttribute("data-movable", true);
+
+    if (!posterUppy || !videoUppy) {
+        [posterUppy, videoUppy] = initializeUppy();
+    }
+}

+ 1500 - 0
newsiteeditor.js

@@ -0,0 +1,1500 @@
+/**
+ *
+ * newsiteeditor.js - gestion de l'interface de NewSiteEditor
+ *
+ * Modifications:
+ * - 2022/07/12 - V.1.0 0 - B.Bouaphakeo - création
+ * - 2025/04/14 - V1.0.1 - E.Podvin - fix hover when siteeditor is activated with tinymce
+ * - 2025/05/06 - V.1.1.0 H.Malezet & C.Nelhomme - Added newFileEditor to edit image and video.
+ * - 2025/05/09 - V.1.2.0 C.Nelhomme - Added compressorJS and add request to mistralAI
+ * - 2025/05/31 - V1.3.0 - E.Podvin - add redirections to dashboard and help pages
+ * - 2025/06/02 - V1.3.1 - E.Podvin - call newsiteeditor/image POST
+ * - 2025/06/02 - V1.3.2 - E.Podvin - fix toggle on hover when we leave nse
+ * - 2025/06/03 - V1.4.0 - E.Podvin - can process image element that are not embeded in img but in a background for example
+ * - 2025/06/03 - V1.4.1 - C.NELHOMME - Added videoEditor, posterEditor, refactor upload function, implements Kserver
+ * - 2025/06/04 - V1.4.2 - 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/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
+ * - 2025/06/13 - V.1.5.3 - C.NELHOMME & E.Podvin - Fix TinyMCE Enter key bug (text disappearing) and merge v1.4.0 → v1.5.3
+ * - 2025/06/17 - V.1.5.4 - C.NELHOMME - Update destroy and init method for BaseHover, correct the tech problem, and implement handleClick method
+ * @copyright Intersel 2022-2025
+ *
+ *
+ */
+
+/**
+ * Todo :
+ * - 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
+ * - Afficher erreur si Mistral bug
+ */
+
+// Imports des classes
+import { Modal } from './classes/Modal.js';
+import { newDeleteManager } from './classes/newDeleteManager.js';
+import { newTranslateManager } from './classes/newTranslateManager.js';
+import { nseVideoEditor } from './modules/VideoEditor.js';
+
+//Configuration
+const { Uppy: UppyConstructor, Dashboard, ImageEditor } = window.Uppy;
+const availableLang = Uppy.locales;
+
+const lang = `${document.documentElement.lang.toLowerCase()}_${document.documentElement.lang.toUpperCase()}`;
+const baseURL = window.location.origin;
+
+// Configuration du préfixe REST - peut être surchargée via window.NEWSITEEDITOR_CONFIG
+const REST_PREFIX = (window.NEWSITEEDITOR_CONFIG && window.NEWSITEEDITOR_CONFIG.restPrefix) || "/rest";
+
+const acceptedImageTypes = [".jpg", ".jpeg", ".png", ".gif", ".webp"];
+const acceptedVideoTypes = [".mp4", ".webm"];
+
+const imageTypesWithoutDots = extensionWODot(acceptedImageTypes);
+const videoTypesWithoutDots = extensionWODot(acceptedVideoTypes);
+
+function extensionWODot(extension) {
+    return extension.map((v) => v.replace(".", ""));
+}
+
+const managerURL = window.customerManagerUrl; //set in NewSiteEditor plugin
+const managerHelpURL = window.helpManagerUrl; //set in NewSiteEditor plugin
+
+// Exposer Modal globalement pour l'utiliser dans les fonctions
+window.NSEModal = Modal;
+
+var NEWSITEEDITOR = (function () {
+    let version = "1.5.2";
+
+    //set data-data for content and title
+    function dataData(who) {
+        let obj = {};
+        //let title;
+        let field = $(who).attr("field");
+        let dirty = $(who).attr("dirty");
+        let editModeOn = $("#edit").css("visibility") != "visible";
+        const sync = { syncsite: 1 };
+
+        //if(field === 'content') ...
+        // console.log(who);
+
+        if (!editModeOn || dirty == undefined)
+            {
+            $(who).attr("dirty", "0");
+        }
+        else
+        {
+            obj = JSON.parse($(who).attr("data-data"));
+            if (obj)
+                {
+                dirty = (obj[field] == who.innerHTML) ? "0" : "1";
+                $(who).attr("dirty", dirty);
+            }
+        }
+
+        if (field == "pagetitle") {
+            field = "longtitle";
+        }
+
+        if (editModeOn &&
+            (
+                who.innerText.trim() === "" ||
+                (who.innerHTML.includes('<br data-mce-bogus="1">') && who.textContent === "")
+            )
+        )
+        {
+            if (editModeOn) who.innerHTML = "&nbsp;&nbsp;&nbsp;";
+        }
+
+        obj[field] = who.innerHTML;
+        Object.assign(obj, sync);
+
+        return $(who).attr("data-data", JSON.stringify(obj));
+    }
+
+    // REST : PUT method to put the content of the website in the manager
+    function saveContent() {
+        $(".siteeditor").blur(function () {
+            dataData(this);
+            if ($(this).attr("dirty") == "1")
+                {
+                blapyTools.ajaxSimpleAction(this);
+                $(this).attr("dirty", "0");
+            }
+        });
+    }
+
+    // Settings available for the richtext editor
+    function TinyMCE() {
+        $.doTimeout("startTinyMCE", 200, function () {
+            tinymce.init({
+                selector: ".siteeditor",
+                suffix: ".min",
+                inline: true,
+                plugins: "link textcolor table preview paste",
+                menubar: false,
+                toolbar: [
+                    "undo redo | bold italic underline | link unlink | fontselect fontsizeselect",
+                    // "forecolor backcolor | alignjustify alignleft aligncenter alignright alignfull | numlist bullist outdent indent | table | styleselect",
+                    "forecolor backcolor | alignjustify alignleft aligncenter alignright alignfull | styleselect",
+                ],
+                powerpaste_word_import: "clean",
+                powerpaste_html_import: "clean",
+                paste_auto_cleanup_on_paste: true,
+
+                setup: function (editor) {
+                    editor.on("focus", function (event) {
+                        toggleClosestButton(event.target);
+                    });
+
+                    editor.on("blur", function (event) {
+                        toggleClosestButton(event.target);
+                    });
+
+                    editor.on("keydown", function (event) {
+                        if (
+                            ["ArrowRight", "ArrowLeft", "ArrowUp", "ArrowDown"].includes(
+                                event.code
+                            )
+                        ) {
+                            event.stopPropagation();
+                        }
+                    });
+                },
+            });
+        });
+    }
+
+
+
+    
+    
+    
+    const fnt = new newDeleteManager();
+    const translate = new newTranslateManager();
+
+
+    //REST : Get method to get the title of the resource in sidebar
+    function getTitle(who) {
+        var transform = $("h2").css("text-transform");
+        $(who).prepend(
+            '<p id="resourceName" method="GET" style="text-transform:' +
+            transform +
+            ';"></p>'
+        );
+
+        hrefRestNse("#resourceName", "longtitle");
+        blapyTools.ajaxSimpleAction($("#resourceName"), function (data0) {
+            var title = data0.data.title;
+            if (title === "" || title == "--") {
+                hrefRestNse("#resourceName", "pagetitle");
+                blapyTools.ajaxSimpleAction($("#resourceName"), function (data1) {
+                    var title1 = data1.data.title;
+                    $("#resourceName").html(title1);
+                    //console.log(title1+' '+3);
+                });
+            } else {
+                $("#resourceName").html(title);
+            }
+        });
+    }
+
+    function toggleClosestButton(element) {
+        const subElement = element.bodyElement;
+        const button = subElement.closest("button");
+        if (button) {
+            button.disabled = !button.disabled;
+        }
+    }
+
+    // to put href attribut in 'who' element, with 'what' tv and the element id in the url
+    function hrefRestNse(who, what) {
+        /*var pos1 = $('[status="selected"]').attr("class").indexOf("_", $('[status="selected"]').attr("class").indexOf("_") + 1)+1;
+            var pos2 = $('[status="selected"]').attr("class").indexOf(" ") ;
+            var currentId = $('[status="selected"]').attr("class").substring(pos1, pos2);*/
+        var currentId = $('[status="selected"]').attr("data-resourceid");
+        $(who).attr("href", REST_PREFIX + "/newsiteeditor/" + what + "/" + currentId);
+    }
+
+    // toggle from edit mode to view mode
+    function view() {
+        $("#view").click(function () {
+            //remove attr conteneditable sinon bug avec tinyMCE
+            tinymce.remove();
+            $(".mce-content-body").removeAttr("contenteditable");
+            $(".mce-item-table").removeClass("mce-item-table");
+
+            $(
+                "#undo, #redo, #sidebarToggle, #customerManagerPage, #helpManagerPage, #manager, #view, #delete, #translate"
+            ).css("visibility", "hidden");
+            $("#wrapper").addClass("no-sidebar");
+            $("#edit").css("visibility", "");
+
+            $('[data-managerButton="true"]')
+                .removeClass("selected")
+                .removeAttr("status")
+                .attr("data-managerbutton", "false");
+            onClickManager(false);
+            sidebar(false);
+            linkEnabled(true);
+            nseVideoEditor(false);
+            nseImageEditor(false);
+            fnt.destroy();
+            translate.destroy();
+        });
+    }
+
+    //désactiver les liens href sur sections
+    function linkEnabled(enableLink) {
+        if (enableLink) {
+            $(".siteeditor")
+                .parents("[data-hrefSave]")
+                .each(function () {
+                    $(this).attr("href", $(this).attr("data-hrefSave"));
+                    $(this).removeAttr("data-hrefSave");
+                });
+        } else {
+            $(".siteeditor")
+                .parents("[href]")
+                .each(function () {
+                    //console.log($(this));
+                    $(this).attr("data-hrefSave", $(this).attr("href"));
+                    $(this).removeAttr("href");
+                });
+        }
+    }
+
+    // toggle from view to edit mode
+    function edit() {
+        $("#edit").click(function () {
+            TinyMCE();
+            $(this).css("visibility", "hidden");
+
+            $(
+                "#undo, #redo, #sidebarToggle, #customerManagerPage, #helpManagerPage, #view, #manager, #delete, #translate"
+            ).css("visibility", "");
+
+            /*$('section').each(function(){
+                          if ( $(this).attr("data-info") === "" ){
+                              var pos1 = this.getAttribute("class").indexOf("_", this.getAttribute("class").indexOf("_") + 1)+1;
+                              var pos2 = this.getAttribute("class").indexOf(" ") ;
+                              var currentId = this.getAttribute("class").substring(pos1, pos2);
+                              $(this).attr("data-info","managerButton_"+currentId);
+                          }
+                      });*/
+
+            $('[data-resourceid!=""][data-resourceid]').attr(
+                "data-managerbutton",
+                "true"
+            );
+            onClickManager(true);
+            sidebar(true);
+            linkEnabled(false);
+            nseVideoEditor(true);
+            nseImageEditor(true);
+            fnt.init();
+            translate.init();
+        });
+    }
+
+    // to set data-data after clicking undo button
+    function undo() {
+        $("#undo").click(function () {
+            $.doTimeout("TimeOut", 500, function () {
+                $(".siteeditor").each(function () {
+                    var field = $(this).attr("field");
+                    if (
+                        $(this).attr("data-data") !=
+                        '{"' + field + '":"' + this.innerHTML + '","syncsite":1}'
+                    ) {
+                        dataData(this);
+                        blapyTools.ajaxSimpleAction(this);
+                    }
+                });
+            });
+        });
+    }
+
+    // to set data-data after clicking redo button
+    function redo() {
+        $("#redo").click(function () {
+            $.doTimeout("TimeOut", 500, function () {
+                $(".siteeditor").each(function () {
+                    var field = $(this).attr("field");
+                    if (
+                        $(this).attr("data-data") !=
+                        '{"' + field + '":"' + this.innerHTML + '","syncsite":1}'
+                    ) {
+                        dataData(this);
+                        blapyTools.ajaxSimpleAction(this);
+                    }
+                });
+            });
+        });
+    }
+
+    // onHover on content you can edit
+    function onHover() {
+        $(".siteeditor").hover(
+            function () {
+                //debugger;
+                if (
+                    $(this).attr("contenteditable") ==
+                    "true" /*&& !($(this).is(":focus")) */
+                ) {
+                    $(this)[0].style.setProperty(
+                        "background-color",
+                        "rgb(0, 0, 255, 0.1)",
+                        "important"
+                    );
+                }
+            },
+            function () {
+                if ($(this).attr("contenteditable") == "true") {
+                    $(this).css("background-color", "");
+                }
+            }
+        );
+    }
+
+    // onHover on resource you can edit
+    function onHoverManager() {
+        $("section").hover(
+            function () {
+                if (
+                    this.getAttribute("data-managerbutton") &&
+                    this.getAttribute("data-managerbutton") == "true"
+                ) {
+                    $(this).addClass("selected");
+                }
+            },
+            function () {
+                if (
+                    this.getAttribute("data-managerbutton") &&
+                    this.getAttribute("data-managerbutton") == "true" &&
+                    !this.getAttribute("status")
+                ) {
+                    $(this).removeClass("selected");
+                }
+            }
+        );
+    }
+
+    // display a manager button when clicking on a resource which redirected on the resource clicked manager
+    function onClickManager(mode) {
+        //debugger;
+        if (mode) {
+            $("#body").on("click.siteeditor", function () {
+                $('[status="selected"]').removeClass("selected").removeAttr("status");
+                $("#manager").css("visibility", "hidden").removeAttr("onclick");
+            });
+            $("section").on("click.siteeditor", function () {
+                //debugger;
+                event.stopPropagation();
+
+                $('[status="selected"]').removeClass("selected").removeAttr("status");
+                $("#manager").css("visibility", "hidden").attr("onclick", "");
+
+                if (
+                    this.getAttribute("data-managerbutton") &&
+                    this.getAttribute("data-managerbutton") == "true"
+                ) {
+                    $(this).addClass("selected");
+                    $(this).attr("status", "selected");
+                    var currentId = this.getAttribute("data-resourceid");
+                    $("#manager").attr(
+                        "onclick",
+                        "window.open('/manager/?a=resource/update&id=" + currentId + "');"
+                    );
+                    $("#manager").css("visibility", "visible");
+                }
+            });
+        } else {
+            $("#body").off("click.siteeditor");
+            $("section").off("click.siteeditor");
+        }
+    }
+
+    //toggle between sidebar and nosidebar
+    function sidebarDisplay(boolean) {
+        if (boolean) {
+            $("#noResourceSelected").css("display", "none");
+            $("#resourceSelected").css("display", "");
+        } else {
+            $("#noResourceSelected").css("display", "");
+            $("#resourceSelected").css("display", "none");
+        }
+    }
+
+    //When sidebar is open, display the info of the resource selected or "selectionner une ressource" if no resource selected
+    function sidebar(mode) {
+        if (mode) {
+            $("#body").on("click.sidebar", function () {
+                $("#resourceName").remove();
+                if ($("#wrapper").attr("class") !== "no-sidebar") {
+                    sidebarDisplay(false);
+                }
+            });
+            $("section").on("click.sidebar", function (e) {
+                //debugger;
+                e.stopPropagation();
+                $("#resourceName").remove();
+                if (
+                    $("#wrapper").attr("class") !== "no-sidebar" &&
+                    this.getAttribute("data-resourceid")
+                ) {
+                    getTitle("#resourceSelected");
+                    sidebarDisplay(true);
+                } else {
+                    sidebarDisplay(false);
+                }
+            });
+        } else {
+            $("#body").off("click.sidebar");
+            $("section").off("click.sidebar");
+        }
+    }
+
+    //Open the sidebar when clicking on the parameter button with the information of the current selected resource or "selectionner une resssource" if no selected resource
+    function sidebarToggle() {
+        $("#sidebarToggle").on("click", function () {
+            const isNoSidebar = $("#wrapper").hasClass("no-sidebar");
+            // console.log(isNoSidebar);
+
+            if (isNoSidebar) {
+                var compt = 0;
+                $("#resourceName").remove();
+
+                const styles = {
+                    width: "calc(100% - 250px)",
+                    marginLeft: "250px",
+                };
+
+                Object.assign(
+                    document.querySelector(".teq-body-content").style,
+                    styles
+                );
+                Object.assign(
+                    document.querySelector("body > #wrapper > header").style,
+                    styles
+                );
+
+                $("section").each(function () {
+                    if ($(this).attr("status") == "selected") {
+                        compt += 1;
+                    }
+                });
+
+                if (compt > 0) {
+                    getTitle("#resourceSelected");
+                    sidebarDisplay(true);
+                } else {
+                    sidebarDisplay(false);
+                }
+            } else {
+                document
+                    .querySelectorAll(".teq-body-content, body > #wrapper > header")
+                    .forEach((el) => {
+                        el.style.width = "";
+                        el.style.marginLeft = "";
+                    });
+            }
+
+            $("#wrapper").toggleClass("no-sidebar");
+        });
+    }
+
+    //Open the customer manager page
+    function loadCustomerManager() {
+        $("#customerManagerPage").on("click", function () {
+            if (managerURL) location.assign(managerURL);
+        });
+    }
+
+    //Open the Help page
+    function loadHelpManager() {
+        $("#helpManagerPage").on("click", function () {
+            if (managerHelpURL) location.assign(managerHelpURL);
+        });
+    }
+
+    // REST : get method to know how many column the resource already occupied
+    function getNbColumn() {
+        hrefRestNse("#column-select", "nbcolumn");
+        blapyTools.ajaxSimpleAction($("#column-select"), function (data) {
+            var bootstrap = data.data.nb;
+            var nbColumn;
+            if (bootstrap === null) {
+                nbColumn = 12;
+            } else {
+                pos3 = bootstrap.lastIndexOf("-");
+                nbColumn = bootstrap.substr(pos3 + 1);
+            }
+            $("#column-select").prop("value", nbColumn);
+        });
+    }
+
+    //REST : Method PUT when a new number of column is selected in sidebar
+    //       Change instantly the number of column on page
+    function putNbColumn() {
+        $("#column-select").change(function () {
+            var valueSelected = $("#column-select").val();
+            var bootstrap;
+            //version input number
+            if (valueSelected < 1) {
+                valueSelected = 1;
+                $("#column-select").attr("value", valueSelected);
+                bootstrap = "col-sm-1";
+            } else if (valueSelected >= 12) {
+                valueSelected = 12;
+                $("#column-select").attr("value", valueSelected);
+                bootstrap = null;
+            } else {
+                $("#column-select").attr("value", valueSelected);
+                bootstrap = "col-sm-" + valueSelected;
+            }
+            //envoyer le nombre de colonne au manager version number
+            hrefRestNse('[for="column-select"]', "nbcolumn");
+            if (bootstrap === null) {
+                $('[for="column-select"]').attr(
+                    "data-data",
+                    '{"tv_nbBootstrapColumn":' + bootstrap + ',"syncsite":1}'
+                );
+            } else {
+                $('[for="column-select"]').attr(
+                    "data-data",
+                    '{"tv_nbBootstrapColumn":"' + bootstrap + '","syncsite":1}'
+                );
+            }
+            blapyTools.ajaxSimpleAction($('[for="column-select"]'));
+            //dynamique sur la page
+            var pos3 = $('[status="selected"]').attr("class").indexOf("col-sm");
+            var pos4 = $('[status="selected"]')
+                .attr("class")
+                .indexOf(" ", pos3 + 1);
+            var currentBootstrap = $('[status="selected"]')
+                .attr("class")
+                .substr(pos3, pos4 - pos3);
+            if (currentBootstrap.startsWith("col-sm")) {
+                $('[status="selected"]')
+                    .removeClass(currentBootstrap)
+                    .removeClass("selected");
+            } else {
+                $('[status="selected"]').removeClass("selected");
+            }
+            $('[status="selected"]').addClass(bootstrap).addClass("selected");
+            if (bootstrap === null) {
+                $('[status="selected"]').css("clear", "");
+            } else {
+                $('[status="selected"]').css("clear", "none");
+            }
+        });
+    }
+
+    //REST : get method to get the managers width in the sidebar
+    function getWidth() {
+        hrefRestNse("#width", "width");
+        blapyTools.ajaxSimpleAction($("#width"), function (data) {
+            var percentage = data.data.width;
+            //console.log(percentage);
+            var width;
+            if (percentage === null) {
+                width = 100;
+            } else {
+                pos3 = percentage.indexOf("%");
+                width = percentage.substr(0, pos3);
+                //console.log(width);
+            }
+            $("#width").prop("value", width);
+        });
+    }
+
+    //REST : Method PUT when a new number of column is selected in sidebar
+    //       Change instantly the number of column on page
+    function putWidth() {
+        $("#width").change(function () {
+            var valueSelected = $("#width").val();
+            var percentage;
+            //version input
+            if (valueSelected < 10) {
+                valueSelected = 10;
+                $("#width").prop("value", valueSelected);
+                percentage = "10%";
+            } else if (valueSelected > 100) {
+                valueSelected = 100;
+                $("#width").prop("value", valueSelected);
+                percentage = "100%";
+            } else {
+                $("#width").prop("value", valueSelected);
+                percentage = valueSelected + "%";
+            }
+            //envoyer le nombre de colonne au manager version number
+            hrefRestNse('[for="width"]', "width");
+            if (percentage === "100%") {
+                $('[for="width"]').attr(
+                    "data-data",
+                    '{"tv_sectionWidth":' + null + ',"syncsite":1}'
+                );
+            } else {
+                $('[for="width"]').attr(
+                    "data-data",
+                    '{"tv_sectionWidth":"' + percentage + '","syncsite":1}'
+                );
+            }
+            blapyTools.ajaxSimpleAction($('[for="width"]'));
+            //dynamique sur la page
+            $('[status="selected"]').find("div:first").css("width", percentage);
+        });
+    }
+
+    //REST : get method to get the manager padding in the sidebar
+    function getPadding() {
+        hrefRestNse("#paddingTop", "padding");
+        blapyTools.ajaxSimpleAction($("#paddingTop"), function (data) {
+            var css = data.data.CSS;
+            //console.log(css);
+            var posTop1;
+            var posTop2;
+            var posTop3;
+            var paddingTop;
+            if (css !== null && css.includes("padding-top")) {
+                css = css.replace(/ /g, "");
+                posTop1 = css.indexOf("padding-top");
+                posTop2 = css.indexOf(":", posTop1 + 1);
+                posTop3 = css.indexOf(";", posTop1 + 1);
+                paddingTop = css.substr(posTop2 + 1, posTop3 - posTop2 - 1);
+                //console.log(paddingTop);
+                //$('#paddingTop').prop('value',paddingTop);
+                var paddingTop2;
+                if (paddingTop.includes("px")) {
+                    $("#paddingTopUnit").prop("value", "px");
+                    posTop4 = paddingTop.indexOf("px");
+                    paddingTop2 = paddingTop.substr(0, posTop4);
+                    //console.log(paddingTop2);
+                } else if (paddingTop.includes("%")) {
+                    $("#paddingTopUnit").prop("value", "%");
+                    posTop4 = paddingTop.indexOf("%");
+                    paddingTop2 = paddingTop.substr(0, posTop4);
+                }
+                $("#paddingTop").prop("value", paddingTop2);
+                //console.log(paddingTop2);
+            } else {
+                $("#paddingTopUnit").prop("value", "px");
+                $("#paddingTop").prop("value", "");
+            }
+        });
+
+        hrefRestNse("#paddingBottom", "padding");
+        blapyTools.ajaxSimpleAction($("#paddingBottom"), function (data) {
+            var css = data.data.CSS;
+            //console.log(css);
+            var posBot1;
+            var posBot2;
+            var posBot3;
+            var paddingBottom;
+            if (css !== null && css.includes("padding-bottom")) {
+                css = css.replace(/ /g, "");
+                posBot1 = css.indexOf("padding-bottom");
+                posBot2 = css.indexOf(":", posBot1 + 1);
+                posBot3 = css.indexOf(";", posBot1 + 1);
+                paddingBottom = css.substr(posBot2 + 1, posBot3 - posBot2 - 1);
+                var paddingBottom2;
+                if (paddingBottom.includes("px")) {
+                    posBot4 = paddingBottom.indexOf("px");
+                    paddingBottom2 = paddingBottom.substr(0, posBot4);
+                    $("#paddingBottomUnit").prop("value", "px");
+                    //console.log(paddingTop2);
+                } else if (paddingBottom.includes("%")) {
+                    posBot4 = paddingBottom.indexOf("%");
+                    paddingBottom2 = paddingBottom.substr(0, posBot4);
+                    $("#paddingBottomUnit").prop("value", "%");
+                }
+                $("#paddingBottom").prop("value", paddingBottom2);
+            } else {
+                $("#paddingBottomUnit").prop("value", "px");
+                $("#paddingBottom").prop("value", "");
+            }
+        });
+    }
+
+    /**
+     * Converts a File or Blob object to a Base64-encoded data URL.
+     *
+     * @param {File|Blob} blob - The file or blob to convert.
+     * @returns {Promise<string>} A promise that resolves to the Base64-encoded string.
+     */
+    function blobToBase64(blob) {
+        return new Promise((resolve, reject) => {
+            const reader = new FileReader();
+
+            reader.onloadend = () => {
+                resolve(reader.result);
+            };
+
+            reader.onerror = reject;
+
+            reader.readAsDataURL(blob);
+        });
+    }
+
+    // REST : put method to put the sidebar value in the manager
+    function putPadding() {
+        $(
+            "#paddingTop, #paddingBottom, #paddingTopUnit, #paddingBottomUnit"
+        ).change(function () {
+            let paddingTop = parseInt($("#paddingTop").val());
+            if (isNaN(paddingTop)) paddingTop = 0;
+            let unitTop = $("#paddingTopUnit").val();
+            let paddingBottom = parseInt($("#paddingBottom").val());
+            if (isNaN(paddingBottom)) paddingBottom = 0;
+            let unitBottom = $("#paddingBottomUnit").val();
+            if (paddingTop > 999) {
+                paddingTop = 999;
+                $("#paddingTop").prop("value", paddingTop);
+            } else if (paddingTop < 0) {
+                paddingTop = 0;
+                $("#paddingTop").prop("value", paddingTop);
+            }
+            if (paddingBottom > 999) {
+                paddingBottom = 999;
+                $("#paddingBottom").prop("value", paddingBottom);
+            } else if (paddingBottom < 0) {
+                paddingBottom = 0;
+                $("#paddingBottom").prop("value", paddingBottom);
+            }
+            //envoyer le nombre de colonne au manager version number
+            hrefRestNse('[for="padding"]', "padding");
+            $('[for="padding"]').attr(
+                "data-data",
+                '{"tv_sectionCSS":"padding-top:' +
+                paddingTop +
+                unitTop +
+                ";padding-bottom:" +
+                paddingBottom +
+                unitBottom +
+                ';","syncsite":1}'
+            );
+
+            if (paddingTop === 0 && paddingBottom === 0) {
+                $('[for="padding"]').attr(
+                    "data-data",
+                    '{"tv_sectionCSS":"","syncsite":1}'
+                );
+            } else if (paddingTop === 0) {
+                $('[for="padding"]').attr(
+                    "data-data",
+                    '{"tv_sectionCSS":"padding-bottom:' +
+                    paddingBottom +
+                    unitBottom +
+                    ';","syncsite":1}'
+                );
+            }
+            blapyTools.ajaxSimpleAction($('[for="padding"]'));
+            //dynamique sur la page
+            if (
+                (paddingTop === 0 || paddingTop === "") &&
+                (paddingBottom === 0 || paddingBottom === "")
+            ) {
+                $('[status="selected"]').css("padding-top", "");
+                $('[status="selected"]').css("padding-bottom", "");
+            } else if (paddingTop === 0 || paddingTop === "") {
+                $('[status="selected"]').css("padding-top", "");
+                $('[status="selected"]').css(
+                    "padding-bottom",
+                    paddingBottom + unitBottom
+                );
+            } else if (paddingBottom === 0 || paddingBottom === "") {
+                $('[status="selected"]').css("padding-top", paddingTop + unitTop);
+                $('[status="selected"]').css("padding-bottom", "");
+            } else {
+                $('[status="selected"]').css("padding-top", paddingTop + unitTop);
+                $('[status="selected"]').css(
+                    "padding-bottom",
+                    paddingBottom + unitBottom
+                );
+            }
+        });
+    }
+
+    let imageUppy = null;
+    let current = {};
+    let cropper = null;
+    let pendingFile = null;
+    let customButton = document.getElementById("editImageBtn");
+
+    async function handleImageEditor(e) {
+        const el = e.currentTarget;
+
+        const prev = document.querySelector(".imageeditor.selected-img");
+        if (prev) prev.classList.remove("selected-img");
+
+        el.classList.add("selected-img");
+
+        if (el.naturalHeight === 0) {
+            current.aspectRatio = 1;
+        } else {
+            if (el.naturalWidth)
+                {
+                current.aspectRatio = el.naturalWidth / el.naturalHeight;
+            }
+            else
+            {
+                const rect = el.getBoundingClientRect();
+                current.aspectRatio = rect.height && (rect.width / rect.height);
+            }
+        }
+
+        current.element = el;
+        current.lang = el.getAttribute("data-lang");
+        current.dataRessourceId = el.getAttribute("data-resource-id");
+        current.customFields = {
+            src: el.getAttribute("data-img-src"),
+            tv: el.getAttribute("data-tv"),
+            alt: el.getAttribute("data-alt"),
+        };
+        uppyReset(imageUppy);
+
+        if (!el.src) el.src = current.customFields.src;
+        let blob = '';
+        if (el.src)
+            blob = await fetch(el.src).then((res) => res.blob());
+
+        const ts = new Date().toISOString().replace(/[-:.]/g, "").replace("Z", "");
+
+        imageUppy.addFile({
+            name: ts + ".png",
+            type: blob.type,
+            data: blob,
+            meta: {
+                isCropped: true,
+                fromServer: true,
+            },
+        });
+
+        document.getElementById("altText").value = current.element.alt;
+
+        customButton.style.top = e.pageY + 10 + "px";
+        customButton.style.left = e.pageX + 10 + "px";
+        customButton.style.display = "block";
+    }
+
+    function nseImageEditor(active) {
+        if (!active) {
+            destroyUppy();
+            customButton.style.display = "none";
+            document.querySelectorAll(".imageeditor").forEach((el) => {
+                el.removeEventListener("click", handleImageEditor);
+                el.style.cursor = "";
+            });
+            return;
+        }
+
+        imageUppy = initializeUppy();
+        initializeEventListener();
+
+        customButton.addEventListener("click", () => {
+            openModal();
+        });
+
+        function initializeUppy() {
+            //console.log(Uppy.locales);
+            //console.log(current);
+            const uppy = new UppyConstructor({
+                locale: availableLang[lang],
+                restrictions: {
+                    maxNumberOfFiles: 1,
+                    allowedFileTypes: acceptedImageTypes,
+                },
+            });
+
+            uppy.use(Dashboard, {
+                inline: true,
+                target: "#uppy",
+                showAddFilesButton: false,
+                hideUploadButton: true,
+                height: 400,
+            });
+
+            uppy.use(ImageEditor, {
+                target: Dashboard,
+                cropperOptions: {
+                    viewMode: 1,
+                },
+                actions: {
+                    revert: false,
+                    rotate: false,
+                    flip: false,
+                    granularRotate: false,
+                    cropSquare: false,
+                    cropWidescreen: false,
+                    cropWidescreenVertical: false,
+                },
+            });
+
+            uppy.on("file-added", (file) => {
+                //console.log(file.type);
+                if (file.meta.isCropped) return;
+                pendingFile = file;
+                openCropper(file);
+                return false;
+            });
+
+            uppy.on("file-editor:complete", (file) => {
+                file.meta.fromServer = false;
+            });
+
+            return uppy;
+        }
+
+        function destroyUppy() {
+            if (imageUppy) {
+                imageUppy.cancelAll();
+                imageUppy.destroy();
+            }
+        }
+
+        function initializeEventListener() {
+            const modal = document.getElementById("modalNseBackground");
+
+            modal.addEventListener("click", (e) => {
+                if (e.target === modal) closeModal();
+            });
+
+            document.getElementById("generateByAi").addEventListener("click", () => {
+                
+                    $.imxLoaderDisplay('sasha');
+                    $.doTimeout('hideLoader',10000,function(){
+                            $.imxLoaderHide(true);
+                    });
+                    
+                const [file] = imageUppy.getFiles();
+                if (file) {
+                    // console.log("%c[Mistral AI] - Starting", "color: #f57842");
+
+                    new Compressor(file.data, {
+                        quality: 0.7,
+                        width: 1000,
+
+                        async success(result) {
+                            //console.log(result.size / (1024 * 1024) + " mo");
+
+                            const base64 = await blobToBase64(result);
+
+                            var formData = new FormData();
+                            formData.append("imageURL", base64);
+                            formData.append("lang", current.lang);
+
+                            document.getElementById("generateByAi").disabled = true;
+
+                            const response = await fetch(
+                                baseURL + "/rest/mistral/image-alt/",
+                                {
+                                    method: "POST",
+                                    body: formData,
+                                }
+                            );
+
+                            const json = await response.json();
+
+                            if (json.code === "200") {
+                                document.getElementById("altText").value =
+                                    json.data.content.choices[0].message.content;
+                                // console.log("%cSuccess - Alt updated", "color: #63f542");
+                            } else {
+                                console.error("No description :'(");
+                            }
+
+                            document.getElementById("generateByAi").disabled = false;
+                            $.imxLoaderHide(true);
+                        },
+
+                        error(err) {
+                            console.error("Une erreur est survenue");
+                            document.getElementById("generateByAi").disabled = false;
+                            $.imxLoaderHide(true);
+                        },
+                    });
+                }
+            });
+
+            document
+                .getElementById("assetsManagerImage")
+                .addEventListener("click", async () => {
+                    registerFileBrowserHandler({
+                        modalId: "modalImageFileBrowser",
+                        fileBrowserId: "imageFileBrowser",
+                        acceptedTypes: imageTypesWithoutDots,
+                        fileType: "image",
+                        uppyInstance: imageUppy,
+                        Modal: window.NSEModal,
+                    })
+                });
+
+            document
+                .getElementById("saveImage")
+                .addEventListener("click", async () => {
+                    $.imxLoaderDisplay('sasha');
+                    $.doTimeout('hideLoader',20000,function(){
+                            $.imxLoaderHide(true);
+                    });
+                    const [file] = imageUppy.getFiles();
+                    const params = new URLSearchParams();
+
+                    //console.log(file)
+
+
+                    params.append("urlvalue", current.dataRessourceId);
+                    params.append("alt", document.getElementById("altText").value);
+
+                    if (current.customFields?.alt) {
+                        params.append("altField", current.customFields.alt);
+                    }
+                    if (current.customFields?.src) {
+                        params.append("srcField", current.customFields.src);
+                    }
+
+                    if (current.customFields?.tv) {
+                        params.append("tvField", current.customFields.tv);
+                    }
+
+                    if (file && !file.meta.fromServer) {
+                        try {
+                            document.getElementById("saveImage").innerText =
+                                "Uploading document";
+                            const uploadResult = await uploadFile(file, current.lang);
+                            if (uploadResult.code === "200") {
+                                params.append(
+                                    "imageSrc",
+                                    uploadResult.data.fullname.replace(/^(images)\//, "")
+                                );
+                            } else {
+                                console.error("Upload failed", uploadResult);
+                                $.imxNotify("Échec de l'upload de l'image. Veuillez réessayer.", 'warning');
+                                $.imxLoaderHide(true);
+                                return;
+                            }
+                        } catch (err) {
+                            console.error("Upload error", err);
+                            $.imxNotify("Erreur lors de l'upload de l'image. Vérifiez votre connexion.", 'warning');
+                            $.imxLoaderHide(true);
+                            return;
+                        }
+                    }
+
+                    if (file && file.meta.updateImage && file.meta.dir && file.meta.fromServer) {
+                        params.append("imageSrc", file.meta.dir + "/" + file.name);
+                    }
+
+                    try {
+                        document.getElementById("saveImage").innerText = "Updating data";
+
+                        const response = await sendRequest(
+                            `${REST_PREFIX}/newsiteeditor/image/${current.dataRessourceId}`,
+                            "PUT",
+                            params
+                        );
+
+                        if (response.code === "200") {
+                            closeModal();
+                            window.location.reload();
+                        } else {
+                            console.error("Save failed", response);
+                            $.imxNotify("Échec de la sauvegarde des métadonnées de l'image.", 'warning');
+                            $.imxLoaderHide(true);
+                        }
+                    } catch (err) {
+                        console.error("Save error", err);
+                        $.imxNotify("Erreur lors de la sauvegarde. Vérifiez votre connexion.", 'warning');
+                        $.imxLoaderHide(true);
+                    }
+                });
+
+            document
+                .getElementById("closeImageModal")
+                .addEventListener("click", () => {
+                    closeModal();
+                });
+
+            document.getElementById("uploadFile").addEventListener("click", (e) => {
+                openFileSelectorAndReplace(
+                    imageUppy,
+                    "image/webp,image/png,image/jpeg"
+                );
+            });
+
+            document.addEventListener("click", (event) => {
+                if (!event.target.classList.contains("imageeditor")) {
+                    customButton.style.display = "none";
+                    document.querySelectorAll(".imageeditor").forEach((el) => {
+                        el.classList.remove("selected-img");
+                    });
+                }
+            });
+
+            document.querySelectorAll(".imageeditor").forEach((el) => {
+                el.style.cursor = "pointer";
+                el.removeEventListener("click", handleImageEditor);
+                el.addEventListener("click", handleImageEditor);
+            });
+
+            document
+                .getElementById("cropper-cancel")
+                .addEventListener("click", () => {
+                    document.getElementById("cropper-modal").classList.remove("active");
+                    if (cropper) {
+                        cropper.destroy();
+                        cropper = null;
+                    }
+                    pendingFile = null;
+                    uppyReset(imageUppy);
+                });
+
+            document
+                .getElementById("cropper-confirm")
+                .addEventListener("click", () => {
+                    if (!cropper || !pendingFile) return;
+
+                    cropper.getCroppedCanvas().toBlob((blob) => {
+                        imageUppy.removeFile(pendingFile.id);
+
+                        const ts = new Date()
+                            .toISOString()
+                            .replace(/[-:.]/g, "")
+                            .replace("Z", "");
+
+                        imageUppy.addFile({
+                            name: ts + ".png",
+                            type: pendingFile.type,
+                            data: blob,
+                            meta: {
+                                isCropped: true,
+                            },
+                        });
+
+                        document.getElementById("cropper-modal").classList.remove("active");
+
+                        cropper.destroy();
+                        cropper = null;
+                        pendingFile = null;
+                    }, pendingFile.type);
+                });
+        }
+
+        /**
+         *
+         * @param {Blob} file - File you want to upload
+         * @returns {Response} - Response from the server with the image location
+         */
+        async function uploadFile(file) {
+            //console.log(current);
+            const formData = new FormData();
+            formData.append("file", file.data, file.name);
+            formData.append("inputFileFieldName", "file");
+            formData.append("context_key", current.lang);
+
+            const response = await sendRequest(
+                `${REST_PREFIX}/newsiteeditor/image/`,
+                "POST",
+                formData
+            );
+            return response;
+        }
+
+        function openCropper(file) {
+            const reader = new FileReader();
+            reader.onload = (e) => {
+                const cropperImage = document.getElementById("cropper-image");
+                cropperImage.src = e.target.result;
+
+                document.getElementById("cropper-modal").classList.add("active");
+
+                if (cropper) {
+                    cropper.destroy();
+                }
+
+                cropper = new Cropper(cropperImage, {
+                    viewMode: 1,
+                    aspectRatio: current.aspectRatio,
+                });
+            };
+            reader.readAsDataURL(file.data);
+        }
+
+        function openModal() {
+            document.getElementById("modalNseBackground").style.display = "flex";
+            const imageEditor = imageUppy.getPlugin("ImageEditor");
+            imageEditor.setOptions({
+                cropperOptions: {
+                    viewMode: 1,
+                    aspectRatio: current.aspectRatio,
+                    autoCropArea: 1,
+                },
+            });
+        }
+
+        function closeModal() {
+            document.getElementById("modalNseBackground").style.display = "none";
+            current = {};
+            destroyUppy();
+            imageUppy = initializeUppy();
+        }
+    }
+
+
+
+    /**
+     * @param {Uppy} uppyInstance Instance of Uppy that you should update
+     * @param {string} acceptedType A comma-separated string of MIME types (e.g., "image/png,image/jpeg")
+     */
+    function openFileSelectorAndReplace(uppyInstance, acceptedType = "image/*") {
+        const tempInput = document.createElement("input");
+        tempInput.type = "file";
+        tempInput.accept = acceptedType;
+        tempInput.style.display = "none";
+
+        const acceptedMimeTypes = acceptedType
+            .split(",")
+            .map((type) => type.trim().toLowerCase());
+
+        //console.log(acceptedMimeTypes);
+
+        tempInput.addEventListener("change", (e) => {
+            const file = e.target.files[0];
+
+            if (file) {
+                const fileType = file.type.toLowerCase();
+
+                const isAccepted = acceptedMimeTypes.some((type) => {
+                    if (type.endsWith("/*")) {
+                        return fileType.startsWith(type.slice(0, -1));
+                    }
+                    return fileType === type;
+                });
+
+                if (!isAccepted) {
+                    //Get the error from uppy and inform the user the valid fileTypes.
+                    uppyInstance.info(uppyInstance.i18n('youCanOnlyUploadFileTypes',
+                        {types: acceptedMimeTypes.map((type) => {
+                                const parts = type.split('/');
+                                return parts[1] ? ` .${parts[1]}` : null;
+                            }).filter(Boolean)}), 'error', 5000);
+                    console.warn(`Type de fichier non autorisé : ${fileType}`);
+                    tempInput.remove();
+                    return;
+                }
+
+                uppyReset(uppyInstance);
+
+                uppyInstance.addFile({
+                    name: file.name,
+                    type: file.type,
+                    data: file,
+                    source: "Local",
+                });
+            }
+
+            tempInput.remove();
+        });
+
+        document.body.appendChild(tempInput);
+        tempInput.click();
+    }
+
+    async function openFileBrowser(
+        containerId,
+        acceptedFileType,
+        fileDirectory
+    ) {
+        return new Promise((resolve) => {
+            const explorer = new Karibsen.ServerBrowser({
+                containerId: containerId,
+                theme: "primary",
+                acceptedTypeFiles: acceptedFileType,
+                lang: document.documentElement.lang.toLowerCase(),
+                onValidate(file) {
+                    //console.log(file);
+                    resolve(file);
+                    explorer.destroy();
+                },
+                dataSource:
+                    baseURL + REST_PREFIX + "/newsiteeditor/dir?fileDirectory=" + fileDirectory,
+                autoHideEmptyFolders: true,
+            });
+
+            explorer.open();
+        });
+    }
+
+    async function uppyReset(uppyInstance) {
+        uppyInstance.getFiles().forEach((f) => uppyInstance.removeFile(f.id));
+    }
+
+    async function updateUppyInstance(
+        uppyInstance,
+        file,
+        folder,
+        videoPreview = null
+    ) {
+        try {
+            let blob;
+
+            const mimeType = await getMimeTypeFromUrl(file.url);
+            if (mimeType && mimeType.startsWith("video/")) {
+                if (videoPreview) {
+                    blob = "videoInfo";
+                    blob.type = mimeType;
+                    videoPreview.src = file.url;
+                }
+            } else {
+                const response = await fetch(file.url);
+                blob = await response.blob();
+            }
+
+            uppyReset(uppyInstance);
+
+            uppyInstance.addFile({
+                name: file.name,
+                type: blob.type,
+                data: blob,
+                meta: {
+                    fromServer: true,
+                    isCropped: true,
+                    updateImage: true,
+                    dir: folder,
+                },
+            });
+
+            return true;
+        } catch (err) {}
+    }
+
+    async function getMimeTypeFromUrl(url) {
+        try {
+            const response = await fetch(url, { method: "HEAD" });
+
+            if (!response.ok) {
+                throw new Error("Échec de la requête HEAD");
+            }
+
+            return response.headers.get("Content-Type");
+        } catch (e) {
+            console.error("Erreur HEAD fetch:", e);
+            return null;
+        }
+    }
+
+    /**
+     *
+     * @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) {
+        if (!requestURL.startsWith("http")) {
+            requestURL = baseURL + requestURL;
+        }
+
+        const response = await fetch(requestURL, {
+            method: method,
+            body: Data,
+        });
+
+        const contentType = response.headers.get("content-type");
+
+        let result;
+
+        if (contentType && contentType.includes("application/json")) {
+            result = await response.json();
+        } else {
+            result = await response.blob();
+        }
+
+        return result;
+    }
+
+    /**
+     *
+     * @param {string} triggerId - Id of the trigger
+     * @param {string} modalId - Id of the modal
+     * @param {string} fileBrowserId - Id of Kserver container
+     * @param {string[]} acceptedTypes - Accepted files in Kserver
+     * @param {string} fileType -
+     * @param {Uppy} uppyInstance - Uppy instance to update
+     * @param {HTMLElement} [preview] - Element HTML pour mise à jour d’un aperçu vidéo ou image
+     */
+    async function registerFileBrowserHandler({
+        modalId,
+        fileBrowserId,
+        acceptedTypes,
+        fileType,
+        uppyInstance,
+        preview = null,
+        Modal,
+    }) {
+        const modal = new Modal(modalId);
+        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.onCloseButtonClick();
+
+        try {
+            const selectedFile = await openFileBrowser(
+                fileBrowserId,
+                acceptedTypes,
+                fileType
+            );
+
+            await updateUppyInstance(
+                uppyInstance,
+                selectedFile.file,
+                selectedFile.folder,
+                preview
+            );
+
+            modal.setVisible(false);
+        } catch (error) {
+            console.error(`Erreur lors de la sélection de fichier :`, error);
+            modal.setVisible(false);
+        }
+    }
+
+    // to set data-data for every element when opening the page
+    $(".siteeditor").each(function () {
+        dataData(this);
+    });
+
+    //window.addEventListener('DOMContentLoaded', newsiteeditor, false);
+    view();
+    edit();
+    onHover();
+    saveContent();
+    undo();
+    redo();
+    onHoverManager();
+    //onClickManager();
+    //sidebar();
+    //sidebarToggle();//activate sidebar
+    loadCustomerManager();
+    loadHelpManager();
+    putNbColumn();
+    putWidth();
+    putPadding();
+    //$('#body').off('click');
+    //$('section').off('click');
+
+    // define the public API
+    var API = {};
+    API.version = version;
+    // API.add = add;
+    // API.get_array = get_array;
+
+    return API;
+})();

+ 106 - 0
tests/README-nsecall.md

@@ -0,0 +1,106 @@
+# Test complet NewSiteEditor (nsecall.html)
+
+Ce fichier de test complet simule l'environnement réel du NewSiteEditor avec tous ses composants et fonctionnalités.
+
+## 🎯 Objectif
+
+Tester l'intégration complète de la nouvelle architecture modulaire du NewSiteEditor dans un environnement réaliste.
+
+## 📋 Fonctionnalités testées
+
+### ✅ Éléments éditable
+- **Titre** : Élément `<h3>` avec classe `siteeditor`
+- **Image** : Élément `<img>` avec classe `imageeditor`
+- **Contenu** : Élément `<div>` avec classe `siteeditor`
+
+### ✅ Boutons et contrôles
+- **Bouton d'édition** : Activation/désactivation du mode édition
+- **Bouton de suppression** : Gestionnaire de suppression
+- **Bouton de traduction** : Gestionnaire de traduction
+- **Boutons d'édition d'image** : Interface d'édition d'images
+- **Bouton d'édition vidéo** : Interface d'édition vidéo
+
+### ✅ Modales et interfaces
+- **Modale d'édition d'image** : Upload, recadrage, alt-text
+- **Modale d'édition vidéo** : Poster, source, titre, aria-label
+- **Modale de suppression** : Confirmation de suppression
+- **Modale de traduction** : Interface de traduction
+
+## 🚀 Utilisation
+
+### Prérequis
+- Serveur web local (pour les modules ES6)
+- Navigateur moderne supportant les modules ES6
+
+### Lancement
+1. Ouvrir le fichier dans un navigateur via un serveur local
+2. Ouvrir la console développeur (F12)
+3. Vérifier que tous les modules se chargent correctement
+
+### Tests à effectuer
+1. **Mode édition** : Cliquer sur le bouton "edit" pour activer le mode édition
+2. **Édition de contenu** : Cliquer sur les éléments éditable (titre, contenu)
+3. **Édition d'image** : Cliquer sur l'image pour ouvrir l'éditeur
+4. **Suppression** : Activer le mode suppression et cliquer sur un élément
+5. **Traduction** : Activer le mode traduction et sélectionner un élément
+
+## 🔧 Architecture
+
+### Dépendances externes
+- **jQuery 3.6.0** : Manipulation DOM et AJAX
+- **Cropper.js** : Recadrage d'images
+- **Compressor.js** : Compression d'images
+- **Video.js** : Lecteur vidéo
+- **Uppy** : Upload de fichiers
+- **TinyMCE** : Éditeur de texte riche
+
+### Modules internes
+- **newDeleteManager** : Gestion de la suppression
+- **newTranslateManager** : Gestion de la traduction
+- **nseVideoEditor** : Éditeur vidéo complet
+
+### Simulations
+- **Karibsen** : Gestionnaire de fichiers serveur
+- **blapyTools** : Outils AJAX
+- **$.loadFileOnce** : Chargement de fichiers
+
+## 🎨 Interface
+
+### Styles CSS
+- Interface moderne et responsive
+- Modales avec overlay
+- Boutons stylisés
+- Indicateurs visuels pour les éléments éditable
+
+### Éléments interactifs
+- Bordures en pointillés pour les éléments éditable
+- Effets de survol
+- Boutons flottants
+- Modales centrées
+
+## 🐛 Dépannage
+
+### Erreurs courantes
+1. **Erreurs CORS** : Utiliser un serveur local
+2. **Modules non trouvés** : Vérifier les chemins d'import
+3. **Dépendances manquantes** : Vérifier les CDN
+
+### Console
+- Messages de debug pour chaque étape
+- Erreurs détaillées en cas de problème
+- Logs de chargement des modules
+
+## 📝 Notes importantes
+
+1. **Serveur local requis** : Les modules ES6 nécessitent un serveur web
+2. **Dépendances CDN** : Certaines librairies sont chargées depuis des CDN
+3. **Simulations** : Certaines fonctionnalités sont simulées pour les tests
+4. **Compatibilité** : Testé sur navigateurs modernes
+
+## 🔄 Évolution
+
+Ce fichier de test peut être étendu pour :
+- Ajouter de nouveaux éléments de test
+- Tester de nouvelles fonctionnalités
+- Simuler des environnements spécifiques
+- Valider les performances

+ 92 - 0
tests/README.md

@@ -0,0 +1,92 @@
+# Tests du NewSiteEditor
+
+Ce répertoire contient tous les fichiers de test pour vérifier le bon fonctionnement des classes et modules extraits.
+
+## Fichiers de test
+
+### test-classes.html
+- **Objectif** : Tester toutes les classes extraites
+- **Classes testées** :
+  - `Modal` - Gestion des modales
+  - `SmartButton` - Boutons mobiles
+  - `BaseHoverManager` - Gestion des états de survol
+  - `newDeleteManager` - Gestionnaire de suppression
+  - `newTranslateManager` - Gestionnaire de traduction
+
+### test-video.html
+- **Objectif** : Tester le module VideoEditor
+- **Fonctionnalités testées** :
+  - Import du module
+  - Activation/désactivation de l'éditeur vidéo
+  - Gestion des dépendances externes
+
+## Utilisation
+
+### Lancer les tests
+1. Ouvrir le fichier HTML dans un navigateur
+2. Ouvrir la console développeur (F12)
+3. Suivre les instructions à l'écran
+
+### Tests des classes
+```bash
+# Ouvrir dans le navigateur
+tests/test-classes.html
+```
+
+### Tests du module vidéo
+```bash
+# Ouvrir dans le navigateur
+tests/test-video.html
+```
+
+## Structure des tests
+
+### Test des classes
+- Interface interactive pour tester chaque classe
+- Boutons pour activer/désactiver les fonctionnalités
+- Affichage des résultats dans la console et à l'écran
+
+### Test du module vidéo
+- Simulation des dépendances externes
+- Test d'activation/désactivation
+- Vérification de l'import du module
+
+## Dépendances simulées
+
+Les tests simulent les dépendances externes nécessaires :
+- **Uppy** : Gestion des uploads
+- **Video.js** : Lecteur vidéo
+- **Karibsen** : Gestionnaire de fichiers
+- **jQuery** : Fonctions utilitaires
+
+## Résultats attendus
+
+### Tests des classes
+- ✅ Import réussi de toutes les classes
+- ✅ Création d'instances sans erreur
+- ✅ Fonctionnement des méthodes principales
+- ✅ Gestion des événements
+
+### Tests du module vidéo
+- ✅ Import réussi du module
+- ✅ Activation/désactivation sans erreur
+- ✅ Gestion des dépendances externes
+
+## Dépannage
+
+### Erreurs d'import
+- Vérifier que les chemins relatifs sont corrects
+- S'assurer que les fichiers de classes/modules existent
+- Vérifier la syntaxe des imports ES6
+
+### Erreurs de dépendances
+- Vérifier que les dépendances externes sont simulées
+- S'assurer que les variables globales sont définies
+- Vérifier la console pour les erreurs JavaScript
+
+## Notes importantes
+
+1. **Serveur local** : Les tests nécessitent un serveur local pour les modules ES6
+2. **Console** : Toujours vérifier la console pour les messages de debug
+3. **Compatibilité** : Tests compatibles avec les navigateurs modernes
+4. **Maintenance** : Mettre à jour les tests lors de modifications des classes/modules

二進制
tests/img/illusion-sphere.5c784939.webp


+ 113 - 0
tests/libraries/README.md

@@ -0,0 +1,113 @@
+# Librairies du NewSiteEditor
+
+Ce répertoire contient toutes les librairies externes nécessaires au fonctionnement du NewSiteEditor.
+
+## 📚 Librairies incluses
+
+### ✅ Librairies locales
+- **cropperjs/** - Recadrage d'images
+  - `cropper.min.js` - Script principal
+- **compressorjs/** - Compression d'images
+  - `compressor.min.js` - Script principal
+- **tinymce/** - Éditeur de texte riche
+  - `tinymce.min.js` - Script principal
+- **uppy/** - Upload de fichiers
+  - `uppy.min.js` - Script principal
+  - `uppy.min.css` - Styles CSS
+- **kserver/** - Gestionnaire de fichiers serveur
+  - `kserver.js` - Script principal
+  - `k-theme-primary.css` - Thème CSS
+- **newsiteeditor/** - Styles du NewSiteEditor
+  - `css/style.css` - Styles principaux
+
+### 🌐 Librairies externes (CDN)
+- **jQuery 3.6.0** - Manipulation DOM et AJAX
+  - `https://code.jquery.com/jquery-3.6.0.min.js`
+- **Video.js 8.6.1** - Lecteur vidéo
+  - `https://vjs.zencdn.net/8.6.1/video.min.js`
+  - ⚠️ **TODO** : Ajouter localement dans `libraries/videojs/`
+
+## 🔧 Utilisation
+
+### Chargement automatique
+Les librairies sont chargées automatiquement dans `nsecall.html` :
+
+```html
+<!-- Librairies locales -->
+<script src="libraries/cropperjs/cropper.min.js"></script>
+<script src="libraries/compressorjs/compressor.min.js"></script>
+<script src="libraries/tinymce/tinymce.min.js"></script>
+<script src="libraries/uppy/uppy.min.js"></script>
+<script src="libraries/kserver/kserver.js"></script>
+
+<!-- CSS des librairies -->
+<link rel="stylesheet" href="libraries/uppy/uppy.min.css">
+<link rel="stylesheet" href="libraries/kserver/k-theme-primary.css">
+<link rel="stylesheet" href="libraries/newsiteeditor/css/style.css">
+```
+
+### Simulation de $.loadFileOnce
+Pour la compatibilité avec l'ancien système :
+
+```javascript
+$.loadFileOnce = function(url) {
+    return {
+        done: function(callback) {
+            console.log('Loading local library:', url);
+            if (callback) callback();
+            return this;
+        }
+    };
+};
+```
+
+## 📦 Versions
+
+### Librairies locales
+- **Cropper.js** : Version incluse dans le bundle
+- **Compressor.js** : Version incluse dans le bundle
+- **TinyMCE** : Version incluse dans le bundle
+- **Uppy** : Version incluse dans le bundle
+- **KServer** : Version personnalisée
+
+### Librairies CDN
+- **jQuery** : 3.6.0
+- **Video.js** : 8.6.1
+
+## 🚀 Avantages
+
+### Performance
+- ✅ Chargement local plus rapide
+- ✅ Pas de dépendance aux CDN externes
+- ✅ Fonctionnement hors ligne
+
+### Sécurité
+- ✅ Contrôle total des versions
+- ✅ Pas de risque de CDN compromis
+- ✅ Validation des intégrités
+
+### Maintenance
+- ✅ Versions figées et testées
+- ✅ Pas de breaking changes inattendus
+- ✅ Contrôle des mises à jour
+
+## 🔄 Mise à jour
+
+### Ajouter Video.js localement
+1. Télécharger Video.js depuis le site officiel
+2. Créer le répertoire `libraries/videojs/`
+3. Placer les fichiers dans ce répertoire
+4. Mettre à jour `nsecall.html` pour utiliser le chemin local
+
+### Mettre à jour une librairie
+1. Télécharger la nouvelle version
+2. Remplacer le fichier existant
+3. Tester la compatibilité
+4. Mettre à jour la documentation
+
+## 📝 Notes importantes
+
+1. **Ordre de chargement** : Respecter l'ordre des dépendances
+2. **Versions** : Documenter les versions utilisées
+3. **Tests** : Tester après chaque mise à jour
+4. **Sauvegarde** : Garder une copie des versions fonctionnelles

+ 417 - 0
tests/libraries/bootstrap-notify/bootstrap-notify.js

@@ -0,0 +1,417 @@
+/*
+* Project: Bootstrap Notify = v3.1.5
+* Description: Turns standard Bootstrap alerts into "Growl-like" notifications.
+* Author: Mouse0270 aka Robert McIntosh
+* License: MIT License
+* Website: https://github.com/mouse0270/bootstrap-growl
+*/
+
+/* global define:false, require: false, jQuery:false */
+
+(function (factory) {
+	if (typeof define === 'function' && define.amd) {
+		// AMD. Register as an anonymous module.
+		define(['jquery'], factory);
+	} else if (typeof exports === 'object') {
+		// Node/CommonJS
+		factory(require('jquery'));
+	} else {
+		// Browser globals
+		factory(jQuery);
+	}
+}(function ($) {
+	// Create the defaults once
+	var defaults = {
+		element: 'body',
+		position: null,
+		type: "info",
+		allow_dismiss: true,
+		allow_duplicates: true,
+		newest_on_top: false,
+		showProgressbar: false,
+		placement: {
+			from: "top",
+			align: "right"
+		},
+		offset: 20,
+		spacing: 10,
+		z_index: 1031,
+		delay: 5000,
+		timer: 1000,
+		url_target: '_blank',
+		mouse_over: null,
+		animate: {
+			enter: 'animated fadeInDown',
+			exit: 'animated fadeOutUp'
+		},
+		onShow: null,
+		onShown: null,
+		onClose: null,
+		onClosed: null,
+        onClick: null,
+		icon_type: 'class',
+		template: '<div data-notify="container" class="col-xs-11 col-sm-4 alert alert-{0}" role="alert"><button type="button" aria-hidden="true" class="close" data-notify="dismiss">&times;</button><span data-notify="icon"></span> <span data-notify="title">{1}</span> <span data-notify="message">{2}</span><div class="progress" data-notify="progressbar"><div class="progress-bar progress-bar-{0}" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div></div><a href="{3}" target="{4}" data-notify="url"></a></div>'
+	};
+
+	String.format = function () {
+		var args = arguments;
+        var str = arguments[0];
+        return str.replace(/(\{\{\d\}\}|\{\d\})/g, function (str) {
+            if (str.substring(0, 2) === "{{") return str;
+            var num = parseInt(str.match(/\d/)[0]);
+            return args[num + 1];
+        });
+	};
+
+	function isDuplicateNotification(notification) {
+		var isDupe = false;
+
+		$('[data-notify="container"]').each(function (i, el) {
+			var $el = $(el);
+			var title = $el.find('[data-notify="title"]').html().trim();
+			var message = $el.find('[data-notify="message"]').html().trim();
+
+			// The input string might be different than the actual parsed HTML string!
+			// (<br> vs <br /> for example)
+			// So we have to force-parse this as HTML here!
+			var isSameTitle = title === $("<div>" + notification.settings.content.title + "</div>").html().trim();
+			var isSameMsg = message === $("<div>" + notification.settings.content.message + "</div>").html().trim();
+			var isSameType = $el.hasClass('alert-' + notification.settings.type);
+
+			if (isSameTitle && isSameMsg && isSameType) {
+				//we found the dupe. Set the var and stop checking.
+				isDupe = true;
+			}
+			return !isDupe;
+		});
+
+		return isDupe;
+	}
+
+	function Notify(element, content, options) {
+		// Setup Content of Notify
+		var contentObj = {
+			content: {
+				message: typeof content === 'object' ? content.message : content,
+				title: content.title ? content.title : '',
+				icon: content.icon ? content.icon : '',
+				url: content.url ? content.url : '#',
+				target: content.target ? content.target : '-'
+			}
+		};
+
+		options = $.extend(true, {}, contentObj, options);
+		this.settings = $.extend(true, {}, defaults, options);
+		this._defaults = defaults;
+		if (this.settings.content.target === "-") {
+			this.settings.content.target = this.settings.url_target;
+		}
+		this.animations = {
+			start: 'webkitAnimationStart oanimationstart MSAnimationStart animationstart',
+			end: 'webkitAnimationEnd oanimationend MSAnimationEnd animationend'
+		};
+
+		if (typeof this.settings.offset === 'number') {
+			this.settings.offset = {
+				x: this.settings.offset,
+				y: this.settings.offset
+			};
+		}
+
+		//if duplicate messages are not allowed, then only continue if this new message is not a duplicate of one that it already showing
+		if (this.settings.allow_duplicates || (!this.settings.allow_duplicates && !isDuplicateNotification(this))) {
+			this.init();
+		}
+	}
+
+	$.extend(Notify.prototype, {
+		init: function () {
+			var self = this;
+
+			this.buildNotify();
+			if (this.settings.content.icon) {
+				this.setIcon();
+			}
+			if (this.settings.content.url != "#") {
+				this.styleURL();
+			}
+			this.styleDismiss();
+			this.placement();
+			this.bind();
+
+			this.notify = {
+				$ele: this.$ele,
+				update: function (command, update) {
+					var commands = {};
+					if (typeof command === "string") {
+						commands[command] = update;
+					} else {
+						commands = command;
+					}
+					for (var cmd in commands) {
+						switch (cmd) {
+							case "type":
+								this.$ele.removeClass('alert-' + self.settings.type);
+								this.$ele.find('[data-notify="progressbar"] > .progress-bar').removeClass('progress-bar-' + self.settings.type);
+								self.settings.type = commands[cmd];
+								this.$ele.addClass('alert-' + commands[cmd]).find('[data-notify="progressbar"] > .progress-bar').addClass('progress-bar-' + commands[cmd]);
+								break;
+							case "icon":
+								var $icon = this.$ele.find('[data-notify="icon"]');
+								if (self.settings.icon_type.toLowerCase() === 'class') {
+									$icon.removeClass(self.settings.content.icon).addClass(commands[cmd]);
+								} else {
+									if (!$icon.is('img')) {
+										$icon.find('img');
+									}
+									$icon.attr('src', commands[cmd]);
+								}
+								self.settings.content.icon = commands[command];
+								break;
+							case "progress":
+								var newDelay = self.settings.delay - (self.settings.delay * (commands[cmd] / 100));
+								this.$ele.data('notify-delay', newDelay);
+								this.$ele.find('[data-notify="progressbar"] > div').attr('aria-valuenow', commands[cmd]).css('width', commands[cmd] + '%');
+								break;
+							case "url":
+								this.$ele.find('[data-notify="url"]').attr('href', commands[cmd]);
+								break;
+							case "target":
+								this.$ele.find('[data-notify="url"]').attr('target', commands[cmd]);
+								break;
+							default:
+								this.$ele.find('[data-notify="' + cmd + '"]').html(commands[cmd]);
+						}
+					}
+					var posX = this.$ele.outerHeight() + parseInt(self.settings.spacing) + parseInt(self.settings.offset.y);
+					self.reposition(posX);
+				},
+				close: function () {
+					self.close();
+				}
+			};
+
+		},
+		buildNotify: function () {
+			var content = this.settings.content;
+			this.$ele = $(String.format(this.settings.template, this.settings.type, content.title, content.message, content.url, content.target));
+			this.$ele.attr('data-notify-position', this.settings.placement.from + '-' + this.settings.placement.align);
+			if (!this.settings.allow_dismiss) {
+				this.$ele.find('[data-notify="dismiss"]').css('display', 'none');
+			}
+			if ((this.settings.delay <= 0 && !this.settings.showProgressbar) || !this.settings.showProgressbar) {
+				this.$ele.find('[data-notify="progressbar"]').remove();
+			}
+		},
+		setIcon: function () {
+			if (this.settings.icon_type.toLowerCase() === 'class') {
+				this.$ele.find('[data-notify="icon"]').addClass(this.settings.content.icon);
+			} else {
+				if (this.$ele.find('[data-notify="icon"]').is('img')) {
+					this.$ele.find('[data-notify="icon"]').attr('src', this.settings.content.icon);
+				} else {
+					this.$ele.find('[data-notify="icon"]').append('<img src="' + this.settings.content.icon + '" alt="Notify Icon" />');
+				}
+			}
+		},
+		styleDismiss: function () {
+			this.$ele.find('[data-notify="dismiss"]').css({
+				position: 'absolute',
+				right: '10px',
+				top: '5px',
+				zIndex: this.settings.z_index + 2
+			});
+		},
+		styleURL: function () {
+			this.$ele.find('[data-notify="url"]').css({
+				backgroundImage: 'url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)',
+				height: '100%',
+				left: 0,
+				position: 'absolute',
+				top: 0,
+				width: '100%',
+				zIndex: this.settings.z_index + 1
+			});
+		},
+		placement: function () {
+			var self = this,
+				offsetAmt = this.settings.offset.y,
+				css = {
+					display: 'inline-block',
+					margin: '0px auto',
+					position: this.settings.position ? this.settings.position : (this.settings.element === 'body' ? 'fixed' : 'absolute'),
+					transition: 'all .5s ease-in-out',
+					zIndex: this.settings.z_index
+				},
+				hasAnimation = false,
+				settings = this.settings;
+
+			$('[data-notify-position="' + this.settings.placement.from + '-' + this.settings.placement.align + '"]:not([data-closing="true"])').each(function () {
+				offsetAmt = Math.max(offsetAmt, parseInt($(this).css(settings.placement.from)) + parseInt($(this).outerHeight()) + parseInt(settings.spacing));
+			});
+			if (this.settings.newest_on_top === true) {
+				offsetAmt = this.settings.offset.y;
+			}
+			css[this.settings.placement.from] = offsetAmt + 'px';
+
+			switch (this.settings.placement.align) {
+				case "left":
+				case "right":
+					css[this.settings.placement.align] = this.settings.offset.x + 'px';
+					break;
+				case "center":
+					css.left = 0;
+					css.right = 0;
+					break;
+			}
+			this.$ele.css(css).addClass(this.settings.animate.enter);
+			$.each(Array('webkit-', 'moz-', 'o-', 'ms-', ''), function (index, prefix) {
+				self.$ele[0].style[prefix + 'AnimationIterationCount'] = 1;
+			});
+
+			$(this.settings.element).append(this.$ele);
+
+			if (this.settings.newest_on_top === true) {
+				offsetAmt = (parseInt(offsetAmt) + parseInt(this.settings.spacing)) + this.$ele.outerHeight();
+				this.reposition(offsetAmt);
+			}
+
+			if ($.isFunction(self.settings.onShow)) {
+				self.settings.onShow.call(this.$ele);
+			}
+
+			this.$ele.one(this.animations.start, function () {
+				hasAnimation = true;
+			}).one(this.animations.end, function () {
+				self.$ele.removeClass(self.settings.animate.enter);
+				if ($.isFunction(self.settings.onShown)) {
+					self.settings.onShown.call(this);
+				}
+			});
+
+			setTimeout(function () {
+				if (!hasAnimation) {
+					if ($.isFunction(self.settings.onShown)) {
+						self.settings.onShown.call(this);
+					}
+				}
+			}, 600);
+		},
+		bind: function () {
+			var self = this;
+
+			this.$ele.find('[data-notify="dismiss"]').on('click', function () {
+				self.close();
+			});
+
+			if ($.isFunction(self.settings.onClick)) {
+			    this.$ele.on('click', function (event) {
+			        if (event.target != self.$ele.find('[data-notify="dismiss"]')[0]) {
+			            self.settings.onClick.call(this, event);
+			        }
+			    });
+			}
+
+			this.$ele.mouseover(function () {
+				$(this).data('data-hover', "true");
+			}).mouseout(function () {
+				$(this).data('data-hover', "false");
+			});
+			this.$ele.data('data-hover', "false");
+
+			if (this.settings.delay > 0) {
+				self.$ele.data('notify-delay', self.settings.delay);
+				var timer = setInterval(function () {
+					var delay = parseInt(self.$ele.data('notify-delay')) - self.settings.timer;
+					if ((self.$ele.data('data-hover') === 'false' && self.settings.mouse_over === "pause") || self.settings.mouse_over != "pause") {
+						var percent = ((self.settings.delay - delay) / self.settings.delay) * 100;
+						self.$ele.data('notify-delay', delay);
+						self.$ele.find('[data-notify="progressbar"] > div').attr('aria-valuenow', percent).css('width', percent + '%');
+					}
+					if (delay <= -(self.settings.timer)) {
+						clearInterval(timer);
+						self.close();
+					}
+				}, self.settings.timer);
+			}
+		},
+		close: function () {
+			var self = this,
+				posX = parseInt(this.$ele.css(this.settings.placement.from)),
+				hasAnimation = false;
+
+			this.$ele.attr('data-closing', 'true').addClass(this.settings.animate.exit);
+			self.reposition(posX);
+
+			if ($.isFunction(self.settings.onClose)) {
+				self.settings.onClose.call(this.$ele);
+			}
+
+			this.$ele.one(this.animations.start, function () {
+				hasAnimation = true;
+			}).one(this.animations.end, function () {
+				$(this).remove();
+				if ($.isFunction(self.settings.onClosed)) {
+					self.settings.onClosed.call(this);
+				}
+			});
+
+			setTimeout(function () {
+				if (!hasAnimation) {
+					self.$ele.remove();
+					if ($.isFunction(self.settings.onClosed)) {
+						self.settings.onClosed.call(this);
+					}
+				}
+			}, 600);
+		},
+		reposition: function (posX) {
+			var self = this,
+				notifies = '[data-notify-position="' + this.settings.placement.from + '-' + this.settings.placement.align + '"]:not([data-closing="true"])',
+				$elements = this.$ele.nextAll(notifies);
+			if (this.settings.newest_on_top === true) {
+				$elements = this.$ele.prevAll(notifies);
+			}
+			$elements.each(function () {
+				$(this).css(self.settings.placement.from, posX);
+				posX = (parseInt(posX) + parseInt(self.settings.spacing)) + $(this).outerHeight();
+			});
+		}
+	});
+
+	$.notify = function (content, options) {
+		var plugin = new Notify(this, content, options);
+		return plugin.notify;
+	};
+	$.notifyDefaults = function (options) {
+		defaults = $.extend(true, {}, defaults, options);
+		return defaults;
+	};
+
+	$.notifyClose = function (selector) {
+
+		if (typeof selector === "undefined" || selector === "all") {
+			$('[data-notify]').find('[data-notify="dismiss"]').trigger('click');
+		}else if(selector === 'success' || selector === 'info' || selector === 'warning' || selector === 'danger'){
+			$('.alert-' + selector + '[data-notify]').find('[data-notify="dismiss"]').trigger('click');
+		} else if(selector){
+			$(selector + '[data-notify]').find('[data-notify="dismiss"]').trigger('click');
+		}
+		else {
+			$('[data-notify-position="' + selector + '"]').find('[data-notify="dismiss"]').trigger('click');
+		}
+	};
+
+	$.notifyCloseExcept = function (selector) {
+
+		if(selector === 'success' || selector === 'info' || selector === 'warning' || selector === 'danger'){
+			$('[data-notify]').not('.alert-' + selector).find('[data-notify="dismiss"]').trigger('click');
+		} else{
+			$('[data-notify]').not(selector).find('[data-notify="dismiss"]').trigger('click');
+		}
+	};
+
+
+}));
+
+

File diff suppressed because it is too large
+ 0 - 0
tests/libraries/bootstrap-notify/bootstrap-notify.min.js


File diff suppressed because it is too large
+ 9 - 0
tests/libraries/compressorjs/compressor.min.js


File diff suppressed because it is too large
+ 9 - 0
tests/libraries/cropperjs/cropper.min.js


+ 286 - 0
tests/libraries/jquery.dotimeout.js

@@ -0,0 +1,286 @@
+/*!
+ * jQuery doTimeout: Like setTimeout, but better! - v1.0 - 3/3/2010
+ * http://benalman.com/projects/jquery-dotimeout-plugin/
+ * 
+ * Copyright (c) 2010 "Cowboy" Ben Alman
+ * Dual licensed under the MIT and GPL licenses.
+ * http://benalman.com/about/license/
+ */
+
+// Script: jQuery doTimeout: Like setTimeout, but better!
+//
+// *Version: 1.0, Last updated: 3/3/2010*
+// 
+// Project Home - http://benalman.com/projects/jquery-dotimeout-plugin/
+// GitHub       - http://github.com/cowboy/jquery-dotimeout/
+// Source       - http://github.com/cowboy/jquery-dotimeout/raw/master/jquery.ba-dotimeout.js
+// (Minified)   - http://github.com/cowboy/jquery-dotimeout/raw/master/jquery.ba-dotimeout.min.js (1.0kb)
+// 
+// About: License
+// 
+// Copyright (c) 2010 "Cowboy" Ben Alman,
+// Dual licensed under the MIT and GPL licenses.
+// http://benalman.com/about/license/
+// 
+// About: Examples
+// 
+// These working examples, complete with fully commented code, illustrate a few
+// ways in which this plugin can be used.
+// 
+// Debouncing      - http://benalman.com/code/projects/jquery-dotimeout/examples/debouncing/
+// Delays, Polling - http://benalman.com/code/projects/jquery-dotimeout/examples/delay-poll/
+// Hover Intent    - http://benalman.com/code/projects/jquery-dotimeout/examples/hoverintent/
+// 
+// About: Support and Testing
+// 
+// Information about what version or versions of jQuery this plugin has been
+// tested with, what browsers it has been tested in, and where the unit tests
+// reside (so you can test it yourself).
+// 
+// jQuery Versions - 1.3.2, 1.4.2
+// Browsers Tested - Internet Explorer 6-8, Firefox 2-3.6, Safari 3-4, Chrome 4-5, Opera 9.6-10.1.
+// Unit Tests      - http://benalman.com/code/projects/jquery-dotimeout/unit/
+// 
+// About: Release History
+// 
+// 1.0 - (3/3/2010) Callback can now be a string, in which case it will call
+//       the appropriate $.method or $.fn.method, depending on where .doTimeout
+//       was called. Callback must now return `true` (not just a truthy value)
+//       to poll.
+// 0.4 - (7/15/2009) Made the "id" argument optional, some other minor tweaks
+// 0.3 - (6/25/2009) Initial release
+
+(function($){
+    '$:nomunge'; // Used by YUI compressor.
+    
+    var cache = {},
+      
+      // Reused internal string.
+      doTimeout = 'doTimeout',
+      
+      // A convenient shortcut.
+      aps = Array.prototype.slice;
+    
+    // Method: jQuery.doTimeout
+    // 
+    // Initialize, cancel, or force execution of a callback after a delay.
+    // 
+    // If delay and callback are specified, a doTimeout is initialized. The
+    // callback will execute, asynchronously, after the delay. If an id is
+    // specified, this doTimeout will override and cancel any existing doTimeout
+    // with the same id. Any additional arguments will be passed into callback
+    // when it is executed.
+    // 
+    // If the callback returns true, the doTimeout loop will execute again, after
+    // the delay, creating a polling loop until the callback returns a non-true
+    // value.
+    // 
+    // Note that if an id is not passed as the first argument, this doTimeout will
+    // NOT be able to be manually canceled or forced. (for debouncing, be sure to
+    // specify an id).
+    // 
+    // If id is specified, but delay and callback are not, the doTimeout will be
+    // canceled without executing the callback. If force_mode is specified, the
+    // callback will be executed, synchronously, but will only be allowed to
+    // continue a polling loop if force_mode is true (provided the callback
+    // returns true, of course). If force_mode is false, no polling loop will
+    // continue, even if the callback returns true.
+    // 
+    // Usage:
+    // 
+    // > jQuery.doTimeout( [ id, ] delay, callback [, arg ... ] );
+    // > jQuery.doTimeout( id [, force_mode ] );
+    // 
+    // Arguments:
+    // 
+    //  id - (String) An optional unique identifier for this doTimeout. If id is
+    //    not specified, the doTimeout will NOT be able to be manually canceled or
+    //    forced.
+    //  delay - (Number) A zero-or-greater delay in milliseconds after which
+    //    callback will be executed. 
+    //  callback - (Function) A function to be executed after delay milliseconds.
+    //  callback - (String) A jQuery method to be executed after delay
+    //    milliseconds. This method will only poll if it explicitly returns
+    //    true.
+    //  force_mode - (Boolean) If true, execute that id's doTimeout callback
+    //    immediately and synchronously, continuing any callback return-true
+    //    polling loop. If false, execute the callback immediately and
+    //    synchronously but do NOT continue a callback return-true polling loop.
+    //    If omitted, cancel that id's doTimeout.
+    // 
+    // Returns:
+    // 
+    //  If force_mode is true, false or undefined and there is a
+    //  yet-to-be-executed callback to cancel, true is returned, but if no
+    //  callback remains to be executed, undefined is returned.
+    
+    $[doTimeout] = function() {
+      return p_doTimeout.apply( window, [ 0 ].concat( aps.call( arguments ) ) );
+    };
+    
+    // Method: jQuery.fn.doTimeout
+    // 
+    // Initialize, cancel, or force execution of a callback after a delay.
+    // Operates like <jQuery.doTimeout>, but the passed callback executes in the
+    // context of the jQuery collection of elements, and the id is stored as data
+    // on the first element in that collection.
+    // 
+    // If delay and callback are specified, a doTimeout is initialized. The
+    // callback will execute, asynchronously, after the delay. If an id is
+    // specified, this doTimeout will override and cancel any existing doTimeout
+    // with the same id. Any additional arguments will be passed into callback
+    // when it is executed.
+    // 
+    // If the callback returns true, the doTimeout loop will execute again, after
+    // the delay, creating a polling loop until the callback returns a non-true
+    // value.
+    // 
+    // Note that if an id is not passed as the first argument, this doTimeout will
+    // NOT be able to be manually canceled or forced (for debouncing, be sure to
+    // specify an id).
+    // 
+    // If id is specified, but delay and callback are not, the doTimeout will be
+    // canceled without executing the callback. If force_mode is specified, the
+    // callback will be executed, synchronously, but will only be allowed to
+    // continue a polling loop if force_mode is true (provided the callback
+    // returns true, of course). If force_mode is false, no polling loop will
+    // continue, even if the callback returns true.
+    // 
+    // Usage:
+    // 
+    // > jQuery('selector').doTimeout( [ id, ] delay, callback [, arg ... ] );
+    // > jQuery('selector').doTimeout( id [, force_mode ] );
+    // 
+    // Arguments:
+    // 
+    //  id - (String) An optional unique identifier for this doTimeout, stored as
+    //    jQuery data on the element. If id is not specified, the doTimeout will
+    //    NOT be able to be manually canceled or forced.
+    //  delay - (Number) A zero-or-greater delay in milliseconds after which
+    //    callback will be executed. 
+    //  callback - (Function) A function to be executed after delay milliseconds.
+    //  callback - (String) A jQuery.fn method to be executed after delay
+    //    milliseconds. This method will only poll if it explicitly returns
+    //    true (most jQuery.fn methods return a jQuery object, and not `true`,
+    //    which allows them to be chained and prevents polling).
+    //  force_mode - (Boolean) If true, execute that id's doTimeout callback
+    //    immediately and synchronously, continuing any callback return-true
+    //    polling loop. If false, execute the callback immediately and
+    //    synchronously but do NOT continue a callback return-true polling loop.
+    //    If omitted, cancel that id's doTimeout.
+    // 
+    // Returns:
+    // 
+    //  When creating a <jQuery.fn.doTimeout>, the initial jQuery collection of
+    //  elements is returned. Otherwise, if force_mode is true, false or undefined
+    //  and there is a yet-to-be-executed callback to cancel, true is returned,
+    //  but if no callback remains to be executed, undefined is returned.
+    
+    $.fn[doTimeout] = function() {
+      var args = aps.call( arguments ),
+        result = p_doTimeout.apply( this, [ doTimeout + args[0] ].concat( args ) );
+      
+      return typeof args[0] === 'number' || typeof args[1] === 'number'
+        ? this
+        : result;
+    };
+    
+    function p_doTimeout( jquery_data_key ) {
+      var that = this,
+        elem,
+        data = {},
+        
+        // Allows the plugin to call a string callback method.
+        method_base = jquery_data_key ? $.fn : $,
+        
+        // Any additional arguments will be passed to the callback.
+        args = arguments,
+        slice_args = 4,
+        
+        id        = args[1],
+        delay     = args[2],
+        callback  = args[3];
+      
+      if ( typeof id !== 'string' ) {
+        slice_args--;
+        
+        id        = jquery_data_key = 0;
+        delay     = args[1];
+        callback  = args[2];
+      }
+      
+      // If id is passed, store a data reference either as .data on the first
+      // element in a jQuery collection, or in the internal cache.
+      if ( jquery_data_key ) { // Note: key is 'doTimeout' + id
+        
+        // Get id-object from the first element's data, otherwise initialize it to {}.
+        elem = that.eq(0);
+        elem.data( jquery_data_key, data = elem.data( jquery_data_key ) || {} );
+        
+      } else if ( id ) {
+        // Get id-object from the cache, otherwise initialize it to {}.
+        data = cache[ id ] || ( cache[ id ] = {} );
+      }
+      
+      // Clear any existing timeout for this id.
+      data.id && clearTimeout( data.id );
+      delete data.id;
+      
+      // Clean up when necessary.
+      function cleanup() {
+        if ( jquery_data_key ) {
+          elem.removeData( jquery_data_key );
+        } else if ( id ) {
+          delete cache[ id ];
+        }
+      };
+      
+      // Yes, there actually is a setTimeout call in here!
+      function actually_setTimeout() {
+        data.id = setTimeout( function(){ data.fn(); }, delay );
+      };
+      
+      if ( callback ) {
+        // A callback (and delay) were specified. Store the callback reference for
+        // possible later use, and then setTimeout.
+        data.fn = function( no_polling_loop ) {
+          
+          // If the callback value is a string, it is assumed to be the name of a
+          // method on $ or $.fn depending on where doTimeout was executed.
+          if ( typeof callback === 'string' ) {
+            callback = method_base[ callback ];
+          }
+          
+          callback.apply( that, aps.call( args, slice_args ) ) === true && !no_polling_loop
+            
+            // Since the callback returned true, and we're not specifically
+            // canceling a polling loop, do it again!
+            ? actually_setTimeout()
+            
+            // Otherwise, clean up and quit.
+            : cleanup();
+        };
+        
+        // Set that timeout!
+        actually_setTimeout();
+        
+      } else if ( data.fn ) {
+        // No callback passed. If force_mode (delay) is true, execute the data.fn
+        // callback immediately, continuing any callback return-true polling loop.
+        // If force_mode is false, execute the data.fn callback immediately but do
+        // NOT continue a callback return-true polling loop. If force_mode is
+        // undefined, simply clean up. Since data.fn was still defined, whatever
+        // was supposed to happen hadn't yet, so return true.
+        delay === undefined ? cleanup() : data.fn( delay === false );
+        return true;
+        
+      } else {
+        // Since no callback was passed, and data.fn isn't defined, it looks like
+        // whatever was supposed to happen already did. Clean up and quit!
+        cleanup();
+      }
+      
+    };
+    
+  })(jQuery);
+  

+ 232 - 0
tests/libraries/kserver/k-theme-primary.css

@@ -0,0 +1,232 @@
+/*
+ *  @module        k-default-style.css / k-theme-primary.css
+ *  @project       Karibsen Studio
+ *  @description   Styles et thèmes pour le module de navigateur de fichiers
+ *  @author        Corentin / Karibsen
+ *  @copyright     Copyright (c) 2023-2025 Karibsen Studio
+ *  @license       MIT
+ *  @website       https://karibsen.fr
+ */
+
+/*======================
+=       THEMING        =
+======================*/
+.k-theme-primary {
+    --theme-color: #007bff;
+}
+
+/*======================
+=   CONTAINERS / BASE  =
+======================*/
+.kcontainer {
+    width: 800px;
+    margin: 0 auto;
+    height: 530px;
+    background: #ededed;
+    border: 1px solid #dddddd;
+    border-radius: 10px;
+    padding: 1rem;
+    font-family: Inter;
+    position: relative;
+    cursor: default;
+}
+
+.kfile-tree {
+    height: calc(500px - 90px);
+    overflow-y: scroll;
+    max-height: calc(500px - 90px);
+    scrollbar-width: none;
+    -ms-overflow-style: none;
+}
+
+.kfile-tree::-webkit-scrollbar {
+    display: none;
+}
+
+ul.kfile-tree {
+    list-style: none;
+    padding: 0;
+    margin: 0;
+    display: grid;
+    grid-template-columns: repeat(5, 1fr);
+    row-gap: 0.5rem;
+    cursor: default;
+}
+
+.kheader {
+    padding: 2px;
+    font-size: 14px;
+    margin-bottom: 5px;
+}
+
+.kheader .k-breadcrumb .k-breadcrumb-item:last-of-type {
+    font-weight: 600;
+}
+
+/*======================
+=        FILES         =
+======================*/
+.kfile, .kfolder {
+    display: flex;
+    flex-direction: column;
+    gap: 0.5rem;
+    cursor: pointer;
+    width: fit-content;
+    height: fit-content;
+}
+
+.kfile p, .kfolder p {
+    font-size: 14px;
+    max-width: 147.2px;
+    margin: 0;
+    overflow: hidden;
+    white-space: nowrap;
+    position: relative;
+}
+
+.kfile p.scroll, .kfolder p.scroll {
+    animation: scrollText 6s linear infinite;
+}
+
+@keyframes scrollText {
+    0% {
+        transform: translateX(0%);
+    }
+    100% {
+        transform: translateX(-100%);
+    }
+}
+
+.kfolder span, .kfile span {
+    font-size: 30px;
+    background: #e3e3e3;
+    width: 147.2px;
+    height: 147.2px;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    border-radius: 4px;
+}
+
+.kfile.selected {
+    box-shadow: 0px 0px 0px #ffffff00 !important;
+}
+
+.kfile.selected span {
+    background-color: #d0e4ff;
+}
+
+.kfile-thumb {
+    width: 90%;
+    height: 90%;
+    object-fit: cover;
+}
+
+.k-thumb-img {
+    max-width: 48px;
+    max-height: 48px;
+    border-radius: 4px;
+    margin-left: auto;
+    margin-right: 4px;
+}
+
+li.kfolder > ul {
+    display: none;
+    margin-left: 1em;
+}
+
+li.kfolder.open > ul {
+    display: block;
+}
+
+/*======================
+=        MODAL         =
+======================*/
+.k-modal {
+    position: absolute;
+    width: 100%;
+    height: 100%;
+    top: 0;
+    left: 0;
+    background: rgba(0, 0, 0, 0.48);
+    border-radius: 10px;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+}
+
+.k-modal-content {
+    display: flex;
+    justify-content: center;
+    align-items: center;
+}
+
+.k-modal-img {
+    max-width: 65%;
+    max-height: 65%;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+}
+
+/*======================
+=       BUTTONS        =
+======================*/
+.k-back-btn, .k-validate-btn, .k-preview-btn, .k-modal-close {
+    color: #fff;
+    font-size: 14px;
+    line-height: 1;
+    padding: 15px 20px;
+    border: none;
+    width: fit-content;
+    border-radius: 4px;
+    cursor: pointer;
+}
+
+.k-back-btn, .k-modal-close {
+    background-color: #ff1b1b;
+    position: absolute;
+    bottom: 1rem;
+    left: 1rem;
+}
+
+.k-preview-btn {
+    position: absolute;
+    background-color: #00d105;
+    right: 7.2rem;
+    bottom: 1rem;
+}
+
+.k-validate-btn {
+    background-color: #0059ff;
+    position: absolute;
+    bottom: 1rem;
+    right: 1rem;
+}
+
+.k-validate-btn:disabled {
+    background-color: #b6b6b6;
+    cursor: not-allowed;
+}
+
+/*======================
+=        FOOTER        =
+======================*/
+.kfooter {
+    margin-top: 1rem;
+    display: flex;
+    justify-content: flex-end;
+    gap: 8px;
+}
+
+/*======================
+=     STATE CLASSES    =
+======================*/
+.k-disabled {
+    opacity: 0.5;
+    pointer-events: none;
+}
+
+.kfile.k-disabled {
+    color: #888;
+}

File diff suppressed because it is too large
+ 54 - 0
tests/libraries/kserver/kserver.js


+ 331 - 0
tests/libraries/templates/template.js

@@ -0,0 +1,331 @@
+/** template.js ***/
+
+/**
+ $.imxNotify() - allows to display notification msg
+ msg - message to display
+ type - a bootstrap alert type message (alert, success, ...)
+ **/
+$.imxNotify = function (msg, type) {
+	let icon = 'fas fa-exclamation-triangle';
+	type = type || 'success';
+
+	switch (type) {
+		case 'primary':
+			break;
+		case 'secondary':
+			break;
+		case 'success':
+			icon = 'fas fa-check';
+			break;
+		case 'danger':
+			break;
+		case 'warning':
+			icon = 'fas fa-exclamation-circle';
+			break;
+		case 'info':
+			icon = 'fas fa-exclamation';
+			break;
+		case 'light':
+			break;
+		case 'dark':
+			break;
+		default:
+			break;
+	}
+	$.notify({
+		// options
+		message: msg,
+		icon: icon
+	}, {
+		// settings
+		type: type,
+	});
+};
+
+/**
+   *
+   * imxGetScript - Load a JavaScript file from the server using a GET HTTP request, then execute it.
+   * alternative to $.getScript -
+   *
+   * url : url to the file to load
+   * options : jQuery.ajax option - https://api.jquery.com/jQuery.Ajax/
+   *    eg : {cache:false}
+   *
+   */
+$.imxGetScript = function (url, options) {
+
+	// Allow user to set any option except for dataType, cache, and url
+	options = $.extend(options || { dataType: "script", cache: true }, {
+		url: url
+	});
+
+	// Use $.ajax() since it is more flexible than $.getScript
+	// Return the jqXHR object so we can chain callbacks
+	return jQuery.ajax(options);
+};
+
+
+/**
+   *
+   * loadFileOnce - do as $.getScript but manages to load the file only once
+   * url : url to the file to load
+   * options : jQuery.ajax option - https://api.jquery.com/jQuery.Ajax/
+   *    eg : {cache:false}
+   *
+   */
+$.loadFileOnce = (function () {
+	let loadedFiles = {};
+	let func = function (aUrlFile, options) {
+		if (!loadedFiles[aUrlFile])
+			loadedFiles[aUrlFile] = $.imxGetScript(aUrlFile, options);
+		return loadedFiles[aUrlFile];
+	};
+	return func;
+})();
+
+/**
+ * show a Loader
+ * @param aLoader@type {String} loader name
+ *  loader available:
+ *  - 'gooey'
+ *  - 'sasha'
+ */
+var imxLoaderDisplayCalls = 0;
+$.imxLoaderDisplay = function (aLoader) {
+	imxLoaderDisplayCalls++;
+	$("#waitLoader").addClass('show' + aLoader);
+	$("#waitLoader").addClass("display");
+};
+
+/**
+ * hide the wait loader
+ */
+$.imxLoaderHide = function (forceReset) {
+	imxLoaderDisplayCalls--;
+	if (forceReset == null) forceReset = false;// set to false if forceReset is undefined or null
+	if (!forceReset && imxLoaderDisplayCalls > 0) return;
+	else imxLoaderDisplayCalls = 0; //if for whatever reason imxLoaderDisplayCalls < 0,set it to 0
+
+	$("#waitLoader").removeClass();
+	$("#waitLoader").addClass("loader");
+};
+
+/*** FAVORIS Management ***/
+
+function addFavoris(idFormation) {
+	$.ajax({
+		type: 'POST',
+		url: '//' + window.location.host + '/assets/templates/php/addFavoris.php',
+		data: 'idFormation=' + idFormation,
+		success: function (data) {
+			if (data == 1) {
+				alert("La fiche a bien été ajoutée à vos favoris.");
+			}
+			else if (data == 2) {
+				alert("La fiche existe déjà dans vos favoris.");
+			}
+			else {
+				alert("Erreur lors de l'ajout de votre fiche dans les favoris.");
+			}
+		}
+	});
+};
+
+/**
+ * removeClassRegex - remove every classes of jQuery (dom) element(s) whose class names match with 'regex'
+ * @param {*} regex 
+ * @returns jQuery element(s)
+ * @example $('#hello').removeClassRegex(/^color-/)
+ */
+$.fn.removeClassRegex = function (regex) {
+	return $(this).removeClass(function (index, classes) {
+		return classes.split(/\s+/).filter(function (c) {
+			return regex.test(c);
+		}).join(' ');
+	});
+};
+
+/**
+ * removeClassStartingWith - remove every classes of jQuery (dom) element(s) whose class names start with 'filter' 
+ * @param string filter - a class name start 
+ * @returns jQuery object
+ * @example $('#hello').removeClassStartingWith('color-')
+ */
+$.fn.removeClassStartingWith = function removeClassStartingWith_custom(filter) {
+	$(this).removeClass(function (index, className) {
+		return (className.match(new RegExp("\\S*" + filter + "\\S*", 'g')) || []).join(' ')
+	});
+	return this;
+};
+
+/**
+ * jQuery alterClass plugin
+ *
+ * Remove element classes with wildcard matching. Optionally add classes:
+ *   $( '#foo' ).alterClass( 'foo-* bar-*', 'foobar' )
+ *
+ * Copyright (c) 2011 Pete Boere (the-echoplex.net)
+ * Free under terms of the MIT license: http://www.opensource.org/licenses/mit-license.php
+ *
+ */
+$.fn.alterClass = function (removals, additions) {
+
+	var self = this;
+
+	if (removals.indexOf('*') === -1) {
+		// Use native jQuery methods if there is no wildcard matching
+		self.removeClass(removals);
+		return !additions ? self : self.addClass(additions);
+	}
+
+	var patt = new RegExp('\\s' +
+		removals.
+			replace(/\*/g, '[A-Za-z0-9-_]+').
+			split(' ').
+			join('\\s|\\s') +
+		'\\s', 'g');
+
+	self.each(function (i, it) {
+		var cn = ' ' + it.className + ' ';
+		while (patt.test(cn)) {
+			cn = cn.replace(patt, ' ');
+		}
+		it.className = $.trim(cn);
+	});
+
+	return !additions ? self : self.addClass(additions);
+};
+
+/**
+ * proxies jQuery functions to emit events on show, hide, and remove events.
+ * 
+ * https://github.com/hypesystem/showandtell.js
+ * Copyright (c) 2017 Niels Abildgaard
+ * Currently supported hides: hide, fadeOut, slideUp, remove, toggle, fadeToggle, slideToggle,
+ *     css (display), animate (height: hide, opacity: hide).
+ *
+ * Examples:
+ * $("#myElement").on("showandtell.hide", function() {
+ *   alert("hide triggered");
+ * }
+ * $("#myElement").hide(); //Hides element, then triggers hide event
+ * 
+ * Events:
+ *  
+ * "showandtell.hide" on $().hide()
+ * "showandtell.remove" on $().remove()
+ * "showandtell.show" on $().show()
+ * "showandtell.cssHide" on $().css('display:xxx')  where xxx != "none"
+ * "showandtell.cssShow" on $().css('display:none')
+ * 
+ * Remarks Intersel: 
+ * - add functions Show() and Hide() called everytime events occur
+ */
+(function ($) {
+
+	// For any element that is shown or hidden, do these actions
+	// fix chrome pb when a required input is hidden, chrome do not want to validate the form
+	// so we remove "required" property on the hidden input, then reset it when shown again
+	function Show() {
+		// debugger;
+		let requiredInput = $(this).find(":input[data-wasrequired=1]");
+		requiredInput.prop("required", "required");
+	};
+
+	function Hide() {
+		// debugger;
+		let requiredInput = $(this).find(":input[required]");
+		requiredInput.attr("data-wasrequired", "1");
+		requiredInput.removeAttr("required");
+	};
+
+
+	function applyIfExistsOrNull(fun, self, args) {
+		return typeof fun !== "undefined" ? fun.apply(self, args) : null;
+	}
+
+	function proxy$Functions(functionProxies) {
+		$.each(functionProxies, function (old_function_name, proxy_settings) {
+			var old_function = $.fn[old_function_name];
+
+			$.fn[old_function_name] = function () {
+				var pre_result = applyIfExistsOrNull(proxy_settings.pre, this, arguments);
+
+				var result = old_function.apply(this, arguments);
+
+				var postArguments = [result, pre_result, arguments];
+				applyIfExistsOrNull(proxy_settings.post, this, postArguments);
+
+				return result;
+			}
+		});
+	}
+
+	function checkIfElementWasHidden() {
+		return $(this).map(function () { return $(this).is(":hidden"); });
+	}
+
+	//Only register if not already registered
+	if (!$.showandtell) {
+
+		//Indicate that showandtell has been registered.
+		$.showandtell = true;
+
+		proxy$Functions({
+			hide: {
+				pre: checkIfElementWasHidden,
+				post: function (result, elementWasHidden, old_args) {
+					$(this)
+						.filter(function (idx) { return !elementWasHidden[idx]; })
+						.each(function () {
+							$(this).triggerHandler("showandtell.hide");
+							Hide.apply(this);
+						});
+				}
+			},
+			show: {
+				pre: checkIfElementWasHidden,
+				post: function (result, elementWasHidden, old_args) {
+					$(this)
+						.filter(function (idx) { return elementWasHidden[idx]; })
+						.each(function () {
+							$(this).triggerHandler("showandtell.show");
+							Show.apply(this);
+						});
+				}
+			},
+			remove: {
+				//Remove has to trigger event before removing. After removal, there is no element to
+				//  trigger the event on.
+				pre: function () {
+					$(this)
+						.each(function () {
+							$(this).triggerHandler("showandtell.remove");
+							Hide.apply(this);
+						});
+				}
+			},
+			css: {
+				pre: checkIfElementWasHidden,
+				post: function (result, elementWasHidden, old_args) {
+					$(this)
+						.filter(function (idx) {
+							return !elementWasHidden[idx] && old_args[0] == "display" && old_args[1] == "none";
+						}).each(function () {
+							$(this).triggerHandler("showandtell.cssHide");
+							Hide.apply(this);
+						});
+
+					$(this)
+						.filter(function (idx) {
+							return elementWasHidden[idx] && old_args[0] == "display" && old_args[1] != "none";
+						}).each(function () {
+							$(this).triggerHandler("showandtell.cssShow");
+							Show.apply(this);
+						});
+				}
+			}
+		});
+
+	}
+})(jQuery);

File diff suppressed because it is too large
+ 0 - 0
tests/libraries/tinymce/jquery.tinymce.min.js


+ 3 - 0
tests/libraries/tinymce/langs/readme.md

@@ -0,0 +1,3 @@
+This is where language files should be placed.
+
+Please DO NOT translate these directly use this service: https://www.transifex.com/projects/p/tinymce/

+ 504 - 0
tests/libraries/tinymce/license.txt

@@ -0,0 +1,504 @@
+		  GNU LESSER GENERAL PUBLIC LICENSE
+		       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+		  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+			    NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
+
+

+ 1 - 0
tests/libraries/tinymce/plugins/advlist/plugin.min.js

@@ -0,0 +1 @@
+tinymce.PluginManager.add("advlist",function(a){function b(a,b){var c=[];return tinymce.each(b.split(/[ ,]/),function(a){c.push({text:a.replace(/\-/g," ").replace(/\b\w/g,function(a){return a.toUpperCase()}),data:"default"==a?"":a})}),c}function c(b,c){a.undoManager.transact(function(){var d,e=a.dom,f=a.selection;if(d=e.getParent(f.getNode(),"ol,ul"),!d||d.nodeName!=b||c===!1){var h={"list-style-type":c?c:""};a.execCommand("UL"==b?"InsertUnorderedList":"InsertOrderedList",!1,h)}c=c===!1?g[b]:c,g[b]=c,d=e.getParent(f.getNode(),"ol,ul"),d&&(e.setStyle(d,"listStyleType",c?c:null),d.removeAttribute("data-mce-style")),a.focus()})}function d(b){var c=a.dom.getStyle(a.dom.getParent(a.selection.getNode(),"ol,ul"),"listStyleType")||"";b.control.items().each(function(a){a.active(a.settings.data===c)})}var e,f,g={};e=b("OL",a.getParam("advlist_number_styles","default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman")),f=b("UL",a.getParam("advlist_bullet_styles","default,circle,disc,square")),a.addButton("numlist",{type:"splitbutton",tooltip:"Numbered list",menu:e,onshow:d,onselect:function(a){c("OL",a.control.settings.data)},onclick:function(){c("OL",!1)}}),a.addButton("bullist",{type:"splitbutton",tooltip:"Bullet list",menu:f,onshow:d,onselect:function(a){c("UL",a.control.settings.data)},onclick:function(){c("UL",!1)}})});

+ 1 - 0
tests/libraries/tinymce/plugins/anchor/plugin.min.js

@@ -0,0 +1 @@
+tinymce.PluginManager.add("anchor",function(a){function b(){var b=a.selection.getNode(),c="",d="A"==b.tagName&&""===a.dom.getAttrib(b,"href");d&&(c=b.name||b.id||""),a.windowManager.open({title:"Anchor",body:{type:"textbox",name:"name",size:40,label:"Name",value:c},onsubmit:function(c){var e=c.data.name;d?b.id=e:(a.selection.collapse(!0),a.execCommand("mceInsertContent",!1,a.dom.createHTML("a",{id:e})))}})}a.addCommand("mceAnchor",b),a.addButton("anchor",{icon:"anchor",tooltip:"Anchor",onclick:b,stateSelector:"a:not([href])"}),a.addMenuItem("anchor",{icon:"anchor",text:"Anchor",context:"insert",onclick:b})});

+ 1 - 0
tests/libraries/tinymce/plugins/autolink/plugin.min.js

@@ -0,0 +1 @@
+tinymce.PluginManager.add("autolink",function(a){function b(a){e(a,-1,"(",!0)}function c(a){e(a,0,"",!0)}function d(a){e(a,-1,"",!1)}function e(a,b,c){function d(a,b){if(0>b&&(b=0),3==a.nodeType){var c=a.data.length;b>c&&(b=c)}return b}function e(a,b){1!=a.nodeType||a.hasChildNodes()?h.setStart(a,d(a,b)):h.setStartBefore(a)}function f(a,b){1!=a.nodeType||a.hasChildNodes()?h.setEnd(a,d(a,b)):h.setEndAfter(a)}var h,i,j,k,l,m,n,o,p,q;if("A"!=a.selection.getNode().tagName){if(h=a.selection.getRng(!0).cloneRange(),h.startOffset<5){if(o=h.endContainer.previousSibling,!o){if(!h.endContainer.firstChild||!h.endContainer.firstChild.nextSibling)return;o=h.endContainer.firstChild.nextSibling}if(p=o.length,e(o,p),f(o,p),h.endOffset<5)return;i=h.endOffset,k=o}else{if(k=h.endContainer,3!=k.nodeType&&k.firstChild){for(;3!=k.nodeType&&k.firstChild;)k=k.firstChild;3==k.nodeType&&(e(k,0),f(k,k.nodeValue.length))}i=1==h.endOffset?2:h.endOffset-1-b}j=i;do e(k,i>=2?i-2:0),f(k,i>=1?i-1:0),i-=1,q=h.toString();while(" "!=q&&""!==q&&160!=q.charCodeAt(0)&&i-2>=0&&q!=c);h.toString()==c||160==h.toString().charCodeAt(0)?(e(k,i),f(k,j),i+=1):0===h.startOffset?(e(k,0),f(k,j)):(e(k,i),f(k,j)),m=h.toString(),"."==m.charAt(m.length-1)&&f(k,j-1),m=h.toString(),n=m.match(g),n&&("www."==n[1]?n[1]="http://www.":/@$/.test(n[1])&&!/^mailto:/.test(n[1])&&(n[1]="mailto:"+n[1]),l=a.selection.getBookmark(),a.selection.setRng(h),a.execCommand("createlink",!1,n[1]+n[2]),a.selection.moveToBookmark(l),a.nodeChanged())}}var f,g=/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i;return a.settings.autolink_pattern&&(g=a.settings.autolink_pattern),a.on("keydown",function(b){return 13==b.keyCode?d(a):void 0}),tinymce.Env.ie?void a.on("focus",function(){if(!f){f=!0;try{a.execCommand("AutoUrlDetect",!1,!0)}catch(b){}}}):(a.on("keypress",function(c){return 41==c.keyCode?b(a):void 0}),void a.on("keyup",function(b){return 32==b.keyCode?c(a):void 0}))});

+ 1 - 0
tests/libraries/tinymce/plugins/autoresize/plugin.min.js

@@ -0,0 +1 @@
+tinymce.PluginManager.add("autoresize",function(a){function b(){return a.plugins.fullscreen&&a.plugins.fullscreen.isFullscreen()}function c(d){var g,h,i,j,k,l,m,n,o,p,q,r,s=tinymce.DOM;if(h=a.getDoc()){if(i=h.body,j=h.documentElement,k=e.autoresize_min_height,!i||d&&"setcontent"===d.type&&d.initial||b())return void(i&&j&&(i.style.overflowY="auto",j.style.overflowY="auto"));m=a.dom.getStyle(i,"margin-top",!0),n=a.dom.getStyle(i,"margin-bottom",!0),o=a.dom.getStyle(i,"padding-top",!0),p=a.dom.getStyle(i,"padding-bottom",!0),q=a.dom.getStyle(i,"border-top-width",!0),r=a.dom.getStyle(i,"border-bottom-width",!0),l=i.offsetHeight+parseInt(m,10)+parseInt(n,10)+parseInt(o,10)+parseInt(p,10)+parseInt(q,10)+parseInt(r,10),(isNaN(l)||0>=l)&&(l=tinymce.Env.ie?i.scrollHeight:tinymce.Env.webkit&&0===i.clientHeight?0:i.offsetHeight),l>e.autoresize_min_height&&(k=l),e.autoresize_max_height&&l>e.autoresize_max_height?(k=e.autoresize_max_height,i.style.overflowY="auto",j.style.overflowY="auto"):(i.style.overflowY="hidden",j.style.overflowY="hidden",i.scrollTop=0),k!==f&&(g=k-f,s.setStyle(a.iframeElement,"height",k+"px"),f=k,tinymce.isWebKit&&0>g&&c(d))}}function d(b,e,f){tinymce.util.Delay.setEditorTimeout(a,function(){c({}),b--?d(b,e,f):f&&f()},e)}var e=a.settings,f=0;a.settings.inline||(e.autoresize_min_height=parseInt(a.getParam("autoresize_min_height",a.getElement().offsetHeight),10),e.autoresize_max_height=parseInt(a.getParam("autoresize_max_height",0),10),a.on("init",function(){var b,c;b=a.getParam("autoresize_overflow_padding",1),c=a.getParam("autoresize_bottom_margin",50),b!==!1&&a.dom.setStyles(a.getBody(),{paddingLeft:b,paddingRight:b}),c!==!1&&a.dom.setStyles(a.getBody(),{paddingBottom:c})}),a.on("nodechange setcontent keyup FullscreenStateChanged",c),a.getParam("autoresize_on_init",!0)&&a.on("init",function(){d(20,100,function(){d(5,1e3)})}),a.addCommand("mceAutoResize",c))});

File diff suppressed because it is too large
+ 0 - 0
tests/libraries/tinymce/plugins/autosave/plugin.min.js


File diff suppressed because it is too large
+ 0 - 0
tests/libraries/tinymce/plugins/bbcode/plugin.min.js


File diff suppressed because it is too large
+ 0 - 0
tests/libraries/tinymce/plugins/charmap/plugin.min.js


+ 1 - 0
tests/libraries/tinymce/plugins/code/plugin.min.js

@@ -0,0 +1 @@
+tinymce.PluginManager.add("code",function(a){function b(){var b=a.windowManager.open({title:"Source code",body:{type:"textbox",name:"code",multiline:!0,minWidth:a.getParam("code_dialog_width",600),minHeight:a.getParam("code_dialog_height",Math.min(tinymce.DOM.getViewPort().h-200,500)),spellcheck:!1,style:"direction: ltr; text-align: left"},onSubmit:function(b){a.focus(),a.undoManager.transact(function(){a.setContent(b.data.code)}),a.selection.setCursorLocation(),a.nodeChanged()}});b.find("#code").value(a.getContent({source_view:!0}))}a.addCommand("mceCodeEditor",b),a.addButton("code",{icon:"code",tooltip:"Source code",onclick:b}),a.addMenuItem("code",{icon:"code",text:"Source code",context:"tools",onclick:b})});

+ 138 - 0
tests/libraries/tinymce/plugins/codesample/css/prism.css

@@ -0,0 +1,138 @@
+/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript */
+/**
+ * prism.js default theme for JavaScript, CSS and HTML
+ * Based on dabblet (http://dabblet.com)
+ * @author Lea Verou
+ */
+
+code[class*="language-"],
+pre[class*="language-"] {
+	color: black;
+	text-shadow: 0 1px white;
+	font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
+	direction: ltr;
+	text-align: left;
+	white-space: pre;
+	word-spacing: normal;
+	word-break: normal;
+	word-wrap: normal;
+	line-height: 1.5;
+
+	-moz-tab-size: 4;
+	-o-tab-size: 4;
+	tab-size: 4;
+
+	-webkit-hyphens: none;
+	-moz-hyphens: none;
+	-ms-hyphens: none;
+	hyphens: none;
+}
+
+pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
+code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
+	text-shadow: none;
+	background: #b3d4fc;
+}
+
+pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
+code[class*="language-"]::selection, code[class*="language-"] ::selection {
+	text-shadow: none;
+	background: #b3d4fc;
+}
+
+@media print {
+	code[class*="language-"],
+	pre[class*="language-"] {
+		text-shadow: none;
+	}
+}
+
+/* Code blocks */
+pre[class*="language-"] {
+	padding: 1em;
+	margin: .5em 0;
+	overflow: auto;
+}
+
+:not(pre) > code[class*="language-"],
+pre[class*="language-"] {
+	background: #f5f2f0;
+}
+
+/* Inline code */
+:not(pre) > code[class*="language-"] {
+	padding: .1em;
+	border-radius: .3em;
+}
+
+.token.comment,
+.token.prolog,
+.token.doctype,
+.token.cdata {
+	color: slategray;
+}
+
+.token.punctuation {
+	color: #999;
+}
+
+.namespace {
+	opacity: .7;
+}
+
+.token.property,
+.token.tag,
+.token.boolean,
+.token.number,
+.token.constant,
+.token.symbol,
+.token.deleted {
+	color: #905;
+}
+
+.token.selector,
+.token.attr-name,
+.token.string,
+.token.char,
+.token.builtin,
+.token.inserted {
+	color: #690;
+}
+
+.token.operator,
+.token.entity,
+.token.url,
+.language-css .token.string,
+.style .token.string {
+	color: #a67f59;
+	background: hsla(0, 0%, 100%, .5);
+}
+
+.token.atrule,
+.token.attr-value,
+.token.keyword {
+	color: #07a;
+}
+
+.token.function {
+	color: #DD4A68;
+}
+
+.token.regex,
+.token.important,
+.token.variable {
+	color: #e90;
+}
+
+.token.important,
+.token.bold {
+	font-weight: bold;
+}
+.token.italic {
+	font-style: italic;
+}
+
+.token.entity {
+	cursor: help;
+}
+

File diff suppressed because it is too large
+ 0 - 0
tests/libraries/tinymce/plugins/codesample/plugin.min.js


+ 1 - 0
tests/libraries/tinymce/plugins/colorpicker/plugin.min.js

@@ -0,0 +1 @@
+tinymce.PluginManager.add("colorpicker",function(a){function b(b,c){function d(a){var b=new tinymce.util.Color(a),c=b.toRgb();f.fromJSON({r:c.r,g:c.g,b:c.b,hex:b.toHex().substr(1)}),e(b.toHex())}function e(a){f.find("#preview")[0].getEl().style.background=a}var f=a.windowManager.open({title:"Color",items:{type:"container",layout:"flex",direction:"row",align:"stretch",padding:5,spacing:10,items:[{type:"colorpicker",value:c,onchange:function(){var a=this.rgb();f&&(f.find("#r").value(a.r),f.find("#g").value(a.g),f.find("#b").value(a.b),f.find("#hex").value(this.value().substr(1)),e(this.value()))}},{type:"form",padding:0,labelGap:5,defaults:{type:"textbox",size:7,value:"0",flex:1,spellcheck:!1,onchange:function(){var a,b,c=f.find("colorpicker")[0];return a=this.name(),b=this.value(),"hex"==a?(b="#"+b,d(b),void c.value(b)):(b={r:f.find("#r").value(),g:f.find("#g").value(),b:f.find("#b").value()},c.value(b),void d(b))}},items:[{name:"r",label:"R",autofocus:1},{name:"g",label:"G"},{name:"b",label:"B"},{name:"hex",label:"#",value:"000000"},{name:"preview",type:"container",border:1}]}]},onSubmit:function(){b("#"+this.toJSON().hex)}});d(c)}a.settings.color_picker_callback||(a.settings.color_picker_callback=b)});

+ 1 - 0
tests/libraries/tinymce/plugins/contextmenu/plugin.min.js

@@ -0,0 +1 @@
+tinymce.PluginManager.add("contextmenu",function(a){var b,c=a.settings.contextmenu_never_use_native;a.on("contextmenu",function(d){var e,f=a.getDoc();if(!d.ctrlKey||c){if(d.preventDefault(),tinymce.Env.mac&&tinymce.Env.webkit&&2==d.button&&f.caretRangeFromPoint&&a.selection.setRng(f.caretRangeFromPoint(d.x,d.y)),e=a.settings.contextmenu||"link image inserttable | cell row column deletetable",b)b.show();else{var g=[];tinymce.each(e.split(/[ ,]/),function(b){var c=a.menuItems[b];"|"==b&&(c={text:b}),c&&(c.shortcut="",g.push(c))});for(var h=0;h<g.length;h++)"|"==g[h].text&&(0!==h&&h!=g.length-1||g.splice(h,1));b=new tinymce.ui.Menu({items:g,context:"contextmenu",classes:"contextmenu"}).renderTo(),a.on("remove",function(){b.remove(),b=null})}var i={x:d.pageX,y:d.pageY};a.inline||(i=tinymce.DOM.getPos(a.getContentAreaContainer()),i.x+=d.clientX,i.y+=d.clientY),b.moveTo(i.x,i.y)}})});

+ 1 - 0
tests/libraries/tinymce/plugins/directionality/plugin.min.js

@@ -0,0 +1 @@
+tinymce.PluginManager.add("directionality",function(a){function b(b){var c,d=a.dom,e=a.selection.getSelectedBlocks();e.length&&(c=d.getAttrib(e[0],"dir"),tinymce.each(e,function(a){d.getParent(a.parentNode,"*[dir='"+b+"']",d.getRoot())||(c!=b?d.setAttrib(a,"dir",b):d.setAttrib(a,"dir",null))}),a.nodeChanged())}function c(a){var b=[];return tinymce.each("h1 h2 h3 h4 h5 h6 div p".split(" "),function(c){b.push(c+"[dir="+a+"]")}),b.join(",")}a.addCommand("mceDirectionLTR",function(){b("ltr")}),a.addCommand("mceDirectionRTL",function(){b("rtl")}),a.addButton("ltr",{title:"Left to right",cmd:"mceDirectionLTR",stateSelector:c("ltr")}),a.addButton("rtl",{title:"Right to left",cmd:"mceDirectionRTL",stateSelector:c("rtl")})});

二進制
tests/libraries/tinymce/plugins/emoticons/img/smiley-cool.gif


二進制
tests/libraries/tinymce/plugins/emoticons/img/smiley-cry.gif


二進制
tests/libraries/tinymce/plugins/emoticons/img/smiley-embarassed.gif


二進制
tests/libraries/tinymce/plugins/emoticons/img/smiley-foot-in-mouth.gif


二進制
tests/libraries/tinymce/plugins/emoticons/img/smiley-frown.gif


二進制
tests/libraries/tinymce/plugins/emoticons/img/smiley-innocent.gif


二進制
tests/libraries/tinymce/plugins/emoticons/img/smiley-kiss.gif


二進制
tests/libraries/tinymce/plugins/emoticons/img/smiley-laughing.gif


二進制
tests/libraries/tinymce/plugins/emoticons/img/smiley-money-mouth.gif


二進制
tests/libraries/tinymce/plugins/emoticons/img/smiley-sealed.gif


二進制
tests/libraries/tinymce/plugins/emoticons/img/smiley-smile.gif


二進制
tests/libraries/tinymce/plugins/emoticons/img/smiley-surprised.gif


二進制
tests/libraries/tinymce/plugins/emoticons/img/smiley-tongue-out.gif


二進制
tests/libraries/tinymce/plugins/emoticons/img/smiley-undecided.gif


二進制
tests/libraries/tinymce/plugins/emoticons/img/smiley-wink.gif


二進制
tests/libraries/tinymce/plugins/emoticons/img/smiley-yell.gif


+ 1 - 0
tests/libraries/tinymce/plugins/emoticons/plugin.js

@@ -0,0 +1 @@
+tinymce.PluginManager.add("emoticons",function(a,b){function c(){var a;return a='<table role="list" class="mce-grid">',tinymce.each(d,function(c){a+="<tr>",tinymce.each(c,function(c){var d=b+"/img/smiley-"+c+".gif";a+='<td><a href="#" data-mce-url="'+d+'" data-mce-alt="'+c+'" tabindex="-1" role="option" aria-label="'+c+'"><img src="'+d+'" style="width: 18px; height: 18px" role="presentation" /></a></td>'}),a+="</tr>"}),a+="</table>"}var d=[["cool","cry","embarassed","foot-in-mouth"],["frown","innocent","kiss","laughing"],["money-mouth","sealed","smile","surprised"],["tongue-out","undecided","wink","yell"]];a.addButton("emoticons",{type:"panelbutton",panel:{role:"application",autohide:!0,html:c,onclick:function(b){var c=a.dom.getParent(b.target,"a");c&&(a.insertContent('<img src="'+c.getAttribute("data-mce-url")+'" alt="'+c.getAttribute("data-mce-alt")+'" />'),this.hide())}},tooltip:"Emoticons"})});

+ 1 - 0
tests/libraries/tinymce/plugins/emoticons/plugin.min.js

@@ -0,0 +1 @@
+tinymce.PluginManager.add("emoticons",function(a,b){function c(){var a;return a='<table role="list" class="mce-grid">',tinymce.each(d,function(c){a+="<tr>",tinymce.each(c,function(c){var d=b+"/img/smiley-"+c+".gif";a+='<td><a href="#" data-mce-url="'+d+'" data-mce-alt="'+c+'" tabindex="-1" role="option" aria-label="'+c+'"><img src="'+d+'" style="width: 18px; height: 18px" role="presentation" /></a></td>'}),a+="</tr>"}),a+="</table>"}var d=[["cool","cry","embarassed","foot-in-mouth"],["frown","innocent","kiss","laughing"],["money-mouth","sealed","smile","surprised"],["tongue-out","undecided","wink","yell"]];a.addButton("emoticons",{type:"panelbutton",panel:{role:"application",autohide:!0,html:c,onclick:function(b){var c=a.dom.getParent(b.target,"a");c&&(a.insertContent('<img src="'+c.getAttribute("data-mce-url")+'" alt="'+c.getAttribute("data-mce-alt")+'" />'),this.hide())}},tooltip:"Emoticons"})});

+ 8 - 0
tests/libraries/tinymce/plugins/example/dialog.html

@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<body>
+	<h3>Custom dialog</h3>
+	Input some text: <input id="content">
+	<button onclick="top.tinymce.activeEditor.windowManager.getWindows()[0].close();">Close window</button>
+</body>
+</html>

+ 1 - 0
tests/libraries/tinymce/plugins/example/plugin.min.js

@@ -0,0 +1 @@
+tinymce.PluginManager.add("example",function(a,b){a.addButton("example",{text:"My button",icon:!1,onclick:function(){a.windowManager.open({title:"Example plugin",body:[{type:"textbox",name:"title",label:"Title"}],onsubmit:function(b){a.insertContent("Title: "+b.data.title)}})}}),a.addMenuItem("example",{text:"Example plugin",context:"tools",onclick:function(){a.windowManager.open({title:"TinyMCE site",url:b+"/dialog.html",width:600,height:400,buttons:[{text:"Insert",onclick:function(){var b=a.windowManager.getWindows()[0];a.insertContent(b.getContentWindow().document.getElementById("content").value),b.close()}},{text:"Close",onclick:"close"}]})}})});

+ 1 - 0
tests/libraries/tinymce/plugins/example_dependency/plugin.min.js

@@ -0,0 +1 @@
+tinymce.PluginManager.add("example_dependency",function(){},["example"]);

File diff suppressed because it is too large
+ 0 - 0
tests/libraries/tinymce/plugins/fullpage/plugin.min.js


+ 1 - 0
tests/libraries/tinymce/plugins/fullscreen/plugin.min.js

@@ -0,0 +1 @@
+tinymce.PluginManager.add("fullscreen",function(a){function b(){var a,b,c=window,d=document,e=d.body;return e.offsetWidth&&(a=e.offsetWidth,b=e.offsetHeight),c.innerWidth&&c.innerHeight&&(a=c.innerWidth,b=c.innerHeight),{w:a,h:b}}function c(){var a=tinymce.DOM.getViewPort();return{x:a.x,y:a.y}}function d(a){scrollTo(a.x,a.y)}function e(){function e(){m.setStyle(p,"height",b().h-(o.clientHeight-p.clientHeight))}var n,o,p,q,r=document.body,s=document.documentElement;l=!l,o=a.getContainer(),n=o.style,p=a.getContentAreaContainer().firstChild,q=p.style,l?(k=c(),f=q.width,g=q.height,q.width=q.height="100%",i=n.width,j=n.height,n.width=n.height="",m.addClass(r,"mce-fullscreen"),m.addClass(s,"mce-fullscreen"),m.addClass(o,"mce-fullscreen"),m.bind(window,"resize",e),e(),h=e):(q.width=f,q.height=g,i&&(n.width=i),j&&(n.height=j),m.removeClass(r,"mce-fullscreen"),m.removeClass(s,"mce-fullscreen"),m.removeClass(o,"mce-fullscreen"),m.unbind(window,"resize",h),d(k)),a.fire("FullscreenStateChanged",{state:l})}var f,g,h,i,j,k,l=!1,m=tinymce.DOM;return a.settings.inline?void 0:(a.on("init",function(){a.addShortcut("Ctrl+Shift+F","",e)}),a.on("remove",function(){h&&m.unbind(window,"resize",h)}),a.addCommand("mceFullScreen",e),a.addMenuItem("fullscreen",{text:"Fullscreen",shortcut:"Ctrl+Shift+F",selectable:!0,onClick:function(){e(),a.focus()},onPostRender:function(){var b=this;a.on("FullscreenStateChanged",function(a){b.active(a.state)})},context:"view"}),a.addButton("fullscreen",{tooltip:"Fullscreen",shortcut:"Ctrl+Alt+F",onClick:e,onPostRender:function(){var b=this;a.on("FullscreenStateChanged",function(a){b.active(a.state)})}}),{isFullscreen:function(){return l}})});

+ 1 - 0
tests/libraries/tinymce/plugins/hr/plugin.min.js

@@ -0,0 +1 @@
+tinymce.PluginManager.add("hr",function(a){a.addCommand("InsertHorizontalRule",function(){a.execCommand("mceInsertContent",!1,"<hr />")}),a.addButton("hr",{icon:"hr",tooltip:"Horizontal line",cmd:"InsertHorizontalRule"}),a.addMenuItem("hr",{icon:"hr",text:"Horizontal line",cmd:"InsertHorizontalRule",context:"insert"})});

File diff suppressed because it is too large
+ 0 - 0
tests/libraries/tinymce/plugins/image/plugin.min.js


File diff suppressed because it is too large
+ 0 - 0
tests/libraries/tinymce/plugins/imagetools/plugin.min.js


File diff suppressed because it is too large
+ 0 - 0
tests/libraries/tinymce/plugins/importcss/plugin.min.js


+ 1 - 0
tests/libraries/tinymce/plugins/insertdatetime/plugin.min.js

@@ -0,0 +1 @@
+tinymce.PluginManager.add("insertdatetime",function(a){function b(b,c){function d(a,b){if(a=""+a,a.length<b)for(var c=0;c<b-a.length;c++)a="0"+a;return a}return c=c||new Date,b=b.replace("%D","%m/%d/%Y"),b=b.replace("%r","%I:%M:%S %p"),b=b.replace("%Y",""+c.getFullYear()),b=b.replace("%y",""+c.getYear()),b=b.replace("%m",d(c.getMonth()+1,2)),b=b.replace("%d",d(c.getDate(),2)),b=b.replace("%H",""+d(c.getHours(),2)),b=b.replace("%M",""+d(c.getMinutes(),2)),b=b.replace("%S",""+d(c.getSeconds(),2)),b=b.replace("%I",""+((c.getHours()+11)%12+1)),b=b.replace("%p",""+(c.getHours()<12?"AM":"PM")),b=b.replace("%B",""+a.translate(i[c.getMonth()])),b=b.replace("%b",""+a.translate(h[c.getMonth()])),b=b.replace("%A",""+a.translate(g[c.getDay()])),b=b.replace("%a",""+a.translate(f[c.getDay()])),b=b.replace("%%","%")}function c(c){var d=b(c);if(a.settings.insertdatetime_element){var e;e=b(/%[HMSIp]/.test(c)?"%Y-%m-%dT%H:%M":"%Y-%m-%d"),d='<time datetime="'+e+'">'+d+"</time>";var f=a.dom.getParent(a.selection.getStart(),"time");if(f)return void a.dom.setOuterHTML(f,d)}a.insertContent(d)}var d,e,f="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),g="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),h="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),i="January February March April May June July August September October November December".split(" "),j=[];a.addCommand("mceInsertDate",function(){c(a.getParam("insertdatetime_dateformat",a.translate("%Y-%m-%d")))}),a.addCommand("mceInsertTime",function(){c(a.getParam("insertdatetime_timeformat",a.translate("%H:%M:%S")))}),a.addButton("insertdatetime",{type:"splitbutton",title:"Insert date/time",onclick:function(){c(d||e)},menu:j}),tinymce.each(a.settings.insertdatetime_formats||["%H:%M:%S","%Y-%m-%d","%I:%M:%S %p","%D"],function(a){e||(e=a),j.push({text:b(a),onclick:function(){d=a,c(a)}})}),a.addMenuItem("insertdatetime",{icon:"date",text:"Insert date/time",menu:j,context:"insert"})});

File diff suppressed because it is too large
+ 0 - 0
tests/libraries/tinymce/plugins/layer/plugin.min.js


File diff suppressed because it is too large
+ 0 - 0
tests/libraries/tinymce/plugins/legacyoutput/plugin.min.js


File diff suppressed because it is too large
+ 0 - 0
tests/libraries/tinymce/plugins/link/plugin.js


File diff suppressed because it is too large
+ 0 - 0
tests/libraries/tinymce/plugins/link/plugin.min.js


File diff suppressed because it is too large
+ 0 - 0
tests/libraries/tinymce/plugins/lists/plugin.min.js


二進制
tests/libraries/tinymce/plugins/media/moxieplayer.swf


File diff suppressed because it is too large
+ 0 - 0
tests/libraries/tinymce/plugins/media/plugin.min.js


+ 1 - 0
tests/libraries/tinymce/plugins/nonbreaking/plugin.min.js

@@ -0,0 +1 @@
+tinymce.PluginManager.add("nonbreaking",function(a){var b=a.getParam("nonbreaking_force_tab");if(a.addCommand("mceNonBreaking",function(){a.insertContent(a.plugins.visualchars&&a.plugins.visualchars.state?'<span class="mce-nbsp">&nbsp;</span>':"&nbsp;"),a.dom.setAttrib(a.dom.select("span.mce-nbsp"),"data-mce-bogus","1")}),a.addButton("nonbreaking",{title:"Nonbreaking space",cmd:"mceNonBreaking"}),a.addMenuItem("nonbreaking",{text:"Nonbreaking space",cmd:"mceNonBreaking",context:"insert"}),b){var c=+b>1?+b:3;a.on("keydown",function(b){if(9==b.keyCode){if(b.shiftKey)return;b.preventDefault();for(var d=0;c>d;d++)a.execCommand("mceNonBreaking")}})}});

+ 1 - 0
tests/libraries/tinymce/plugins/noneditable/plugin.min.js

@@ -0,0 +1 @@
+tinymce.PluginManager.add("noneditable",function(a){function b(a){return function(b){return-1!==(" "+b.attr("class")+" ").indexOf(a)}}function c(b){function c(b){var c=arguments,d=c[c.length-2];return d>0&&'"'==g.charAt(d-1)?b:'<span class="'+h+'" data-mce-content="'+a.dom.encode(c[0])+'">'+a.dom.encode("string"==typeof c[1]?c[1]:c[0])+"</span>"}var d=f.length,g=b.content,h=tinymce.trim(e);if("raw"!=b.format){for(;d--;)g=g.replace(f[d],c);b.content=g}}var d,e,f,g="contenteditable";d=" "+tinymce.trim(a.getParam("noneditable_editable_class","mceEditable"))+" ",e=" "+tinymce.trim(a.getParam("noneditable_noneditable_class","mceNonEditable"))+" ";var h=b(d),i=b(e);f=a.getParam("noneditable_regexp"),f&&!f.length&&(f=[f]),a.on("PreInit",function(){f&&a.on("BeforeSetContent",c),a.parser.addAttributeFilter("class",function(a){for(var b,c=a.length;c--;)b=a[c],h(b)?b.attr(g,"true"):i(b)&&b.attr(g,"false")}),a.serializer.addAttributeFilter(g,function(a){for(var b,c=a.length;c--;)b=a[c],(h(b)||i(b))&&(f&&b.attr("data-mce-content")?(b.name="#text",b.type=3,b.raw=!0,b.value=b.attr("data-mce-content")):b.attr(g,null))})})});

+ 1 - 0
tests/libraries/tinymce/plugins/pagebreak/plugin.min.js

@@ -0,0 +1 @@
+tinymce.PluginManager.add("pagebreak",function(a){var b="mce-pagebreak",c=a.getParam("pagebreak_separator","<!-- pagebreak -->"),d=new RegExp(c.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,function(a){return"\\"+a}),"gi"),e='<img src="'+tinymce.Env.transparentSrc+'" class="'+b+'" data-mce-resize="false" data-mce-placeholder />';a.addCommand("mcePageBreak",function(){a.settings.pagebreak_split_block?a.insertContent("<p>"+e+"</p>"):a.insertContent(e)}),a.addButton("pagebreak",{title:"Page break",cmd:"mcePageBreak"}),a.addMenuItem("pagebreak",{text:"Page break",icon:"pagebreak",cmd:"mcePageBreak",context:"insert"}),a.on("ResolveName",function(c){"IMG"==c.target.nodeName&&a.dom.hasClass(c.target,b)&&(c.name="pagebreak")}),a.on("click",function(c){c=c.target,"IMG"===c.nodeName&&a.dom.hasClass(c,b)&&a.selection.select(c)}),a.on("BeforeSetContent",function(a){a.content=a.content.replace(d,e)}),a.on("PreInit",function(){a.serializer.addNodeFilter("img",function(b){for(var d,e,f=b.length;f--;)if(d=b[f],e=d.attr("class"),e&&-1!==e.indexOf("mce-pagebreak")){var g=d.parent;if(a.schema.getBlockElements()[g.name]&&a.settings.pagebreak_split_block){g.type=3,g.value=c,g.raw=!0,d.remove();continue}d.type=3,d.value=c,d.raw=!0}})})});

File diff suppressed because it is too large
+ 0 - 0
tests/libraries/tinymce/plugins/paste/plugin.js


File diff suppressed because it is too large
+ 0 - 0
tests/libraries/tinymce/plugins/paste/plugin.min.js


+ 1 - 0
tests/libraries/tinymce/plugins/preview/plugin.js

@@ -0,0 +1 @@
+tinymce.PluginManager.add("preview",function(a){var b=a.settings,c=!tinymce.Env.ie;a.addCommand("mcePreview",function(){a.windowManager.open({title:"Preview",width:parseInt(a.getParam("plugin_preview_width","650"),10),height:parseInt(a.getParam("plugin_preview_height","500"),10),html:'<iframe src="javascript:\'\'" frameborder="0"'+(c?' sandbox="allow-scripts"':"")+"></iframe>",buttons:{text:"Close",onclick:function(){this.parent().parent().close()}},onPostRender:function(){var d,e="";e+='<base href="'+a.documentBaseURI.getURI()+'">',tinymce.each(a.contentCSS,function(b){e+='<link type="text/css" rel="stylesheet" href="'+a.documentBaseURI.toAbsolute(b)+'">'});var f=b.body_id||"tinymce";-1!=f.indexOf("=")&&(f=a.getParam("body_id","","hash"),f=f[a.id]||f);var g=b.body_class||"";-1!=g.indexOf("=")&&(g=a.getParam("body_class","","hash"),g=g[a.id]||"");var h='<script>document.addEventListener && document.addEventListener("click", function(e) {for (var elm = e.target; elm; elm = elm.parentNode) {if (elm.nodeName === "A") {e.preventDefault();}}}, false);</script> ',i=a.settings.directionality?' dir="'+a.settings.directionality+'"':"";if(d="<!DOCTYPE html><html><head>"+e+'</head><body id="'+f+'" class="mce-content-body '+g+'"'+i+">"+a.getContent()+h+"</body></html>",c)this.getEl("body").firstChild.src="data:text/html;charset=utf-8,"+encodeURIComponent(d);else{var j=this.getEl("body").firstChild.contentWindow.document;j.open(),j.write(d),j.close()}}})}),a.addButton("preview",{title:"Preview",cmd:"mcePreview"}),a.addMenuItem("preview",{text:"Preview",cmd:"mcePreview",context:"view"})});

+ 1 - 0
tests/libraries/tinymce/plugins/preview/plugin.min.js

@@ -0,0 +1 @@
+tinymce.PluginManager.add("preview",function(a){var b=a.settings,c=!tinymce.Env.ie;a.addCommand("mcePreview",function(){a.windowManager.open({title:"Preview",width:parseInt(a.getParam("plugin_preview_width","650"),10),height:parseInt(a.getParam("plugin_preview_height","500"),10),html:'<iframe src="javascript:\'\'" frameborder="0"'+(c?' sandbox="allow-scripts"':"")+"></iframe>",buttons:{text:"Close",onclick:function(){this.parent().parent().close()}},onPostRender:function(){var d,e="";e+='<base href="'+a.documentBaseURI.getURI()+'">',tinymce.each(a.contentCSS,function(b){e+='<link type="text/css" rel="stylesheet" href="'+a.documentBaseURI.toAbsolute(b)+'">'});var f=b.body_id||"tinymce";-1!=f.indexOf("=")&&(f=a.getParam("body_id","","hash"),f=f[a.id]||f);var g=b.body_class||"";-1!=g.indexOf("=")&&(g=a.getParam("body_class","","hash"),g=g[a.id]||"");var h='<script>document.addEventListener && document.addEventListener("click", function(e) {for (var elm = e.target; elm; elm = elm.parentNode) {if (elm.nodeName === "A") {e.preventDefault();}}}, false);</script> ',i=a.settings.directionality?' dir="'+a.settings.directionality+'"':"";if(d="<!DOCTYPE html><html><head>"+e+'</head><body id="'+f+'" class="mce-content-body '+g+'"'+i+">"+a.getContent()+h+"</body></html>",c)this.getEl("body").firstChild.src="data:text/html;charset=utf-8,"+encodeURIComponent(d);else{var j=this.getEl("body").firstChild.contentWindow.document;j.open(),j.write(d),j.close()}}})}),a.addButton("preview",{title:"Preview",cmd:"mcePreview"}),a.addMenuItem("preview",{text:"Preview",cmd:"mcePreview",context:"view"})});

+ 1 - 0
tests/libraries/tinymce/plugins/print/plugin.min.js

@@ -0,0 +1 @@
+tinymce.PluginManager.add("print",function(a){a.addCommand("mcePrint",function(){a.getWin().print()}),a.addButton("print",{title:"Print",cmd:"mcePrint"}),a.addShortcut("Meta+P","","mcePrint"),a.addMenuItem("print",{text:"Print",cmd:"mcePrint",icon:"print",shortcut:"Meta+P",context:"file"})});

+ 1 - 0
tests/libraries/tinymce/plugins/save/plugin.min.js

@@ -0,0 +1 @@
+tinymce.PluginManager.add("save",function(a){function b(){var b;return b=tinymce.DOM.getParent(a.id,"form"),!a.getParam("save_enablewhendirty",!0)||a.isDirty()?(tinymce.triggerSave(),a.getParam("save_onsavecallback")?(a.execCallback("save_onsavecallback",a),void a.nodeChanged()):void(b?(a.setDirty(!1),b.onsubmit&&!b.onsubmit()||("function"==typeof b.submit?b.submit():c(a.translate("Error: Form submit field collision."))),a.nodeChanged()):c(a.translate("Error: No form element found.")))):void 0}function c(b){a.notificationManager.open({text:b,type:"error"})}function d(){var b=tinymce.trim(a.startContent);return a.getParam("save_oncancelcallback")?void a.execCallback("save_oncancelcallback",a):(a.setContent(b),a.undoManager.clear(),void a.nodeChanged())}function e(){var b=this;a.on("nodeChange dirty",function(){b.disabled(a.getParam("save_enablewhendirty",!0)&&!a.isDirty())})}a.addCommand("mceSave",b),a.addCommand("mceCancel",d),a.addButton("save",{icon:"save",text:"Save",cmd:"mceSave",disabled:!0,onPostRender:e}),a.addButton("cancel",{text:"Cancel",icon:!1,cmd:"mceCancel",disabled:!0,onPostRender:e}),a.addShortcut("Meta+S","","mceSave")});

File diff suppressed because it is too large
+ 0 - 0
tests/libraries/tinymce/plugins/searchreplace/plugin.min.js


File diff suppressed because it is too large
+ 0 - 0
tests/libraries/tinymce/plugins/spellchecker/plugin.min.js


+ 1 - 0
tests/libraries/tinymce/plugins/tabfocus/plugin.min.js

@@ -0,0 +1 @@
+tinymce.PluginManager.add("tabfocus",function(a){function b(a){9!==a.keyCode||a.ctrlKey||a.altKey||a.metaKey||a.preventDefault()}function c(b){function c(c){function f(a){return"BODY"===a.nodeName||"hidden"!=a.type&&"none"!=a.style.display&&"hidden"!=a.style.visibility&&f(a.parentNode)}function i(a){return/INPUT|TEXTAREA|BUTTON/.test(a.tagName)&&tinymce.get(b.id)&&-1!=a.tabIndex&&f(a)}if(h=d.select(":input:enabled,*[tabindex]:not(iframe)"),e(h,function(b,c){return b.id==a.id?(g=c,!1):void 0}),c>0){for(j=g+1;j<h.length;j++)if(i(h[j]))return h[j]}else for(j=g-1;j>=0;j--)if(i(h[j]))return h[j];return null}var g,h,i,j;if(!(9!==b.keyCode||b.ctrlKey||b.altKey||b.metaKey||b.isDefaultPrevented())&&(i=f(a.getParam("tab_focus",a.getParam("tabfocus_elements",":prev,:next"))),1==i.length&&(i[1]=i[0],i[0]=":prev"),h=b.shiftKey?":prev"==i[0]?c(-1):d.get(i[0]):":next"==i[1]?c(1):d.get(i[1]))){var k=tinymce.get(h.id||h.name);h.id&&k?k.focus():tinymce.util.Delay.setTimeout(function(){tinymce.Env.webkit||window.focus(),h.focus()},10),b.preventDefault()}}var d=tinymce.DOM,e=tinymce.each,f=tinymce.explode;a.on("init",function(){a.inline&&tinymce.DOM.setAttrib(a.getBody(),"tabIndex",null),a.on("keyup",b),tinymce.Env.gecko?a.on("keypress keydown",c):a.on("keydown",c)})});

File diff suppressed because it is too large
+ 0 - 0
tests/libraries/tinymce/plugins/table/plugin.js


File diff suppressed because it is too large
+ 0 - 0
tests/libraries/tinymce/plugins/table/plugin.min.js


File diff suppressed because it is too large
+ 0 - 0
tests/libraries/tinymce/plugins/template/plugin.min.js


File diff suppressed because it is too large
+ 0 - 0
tests/libraries/tinymce/plugins/textcolor/plugin.js


File diff suppressed because it is too large
+ 0 - 0
tests/libraries/tinymce/plugins/textcolor/plugin.min.js


File diff suppressed because it is too large
+ 0 - 0
tests/libraries/tinymce/plugins/textpattern/plugin.min.js


+ 135 - 0
tests/libraries/tinymce/plugins/visualblocks/css/visualblocks.css

@@ -0,0 +1,135 @@
+.mce-visualblocks p {
+	padding-top: 10px;
+	border: 1px dashed #BBB;
+	margin-left: 3px;
+	background: transparent no-repeat url(data:image/gif;base64,R0lGODlhCQAJAJEAAAAAAP///7u7u////yH5BAEAAAMALAAAAAAJAAkAAAIQnG+CqCN/mlyvsRUpThG6AgA7);
+}
+
+.mce-visualblocks h1 {
+	padding-top: 10px;
+	border: 1px dashed #BBB;
+	margin-left: 3px;
+	background: transparent no-repeat url(data:image/gif;base64,R0lGODlhDQAKAIABALu7u////yH5BAEAAAEALAAAAAANAAoAAAIXjI8GybGu1JuxHoAfRNRW3TWXyF2YiRUAOw==);
+}
+
+.mce-visualblocks h2 {
+	padding-top: 10px;
+	border: 1px dashed #BBB;
+	margin-left: 3px;
+	background: transparent no-repeat url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8Hybbx4oOuqgTynJd6bGlWg3DkJzoaUAAAOw==);
+}
+
+.mce-visualblocks h3 {
+	padding-top: 10px;
+	border: 1px dashed #BBB;
+	margin-left: 3px;
+	background: transparent no-repeat url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIZjI8Hybbx4oOuqgTynJf2Ln2NOHpQpmhAAQA7);
+}
+
+.mce-visualblocks h4 {
+	padding-top: 10px;
+	border: 1px dashed #BBB;
+	margin-left: 3px;
+	background: transparent no-repeat url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8HybbxInR0zqeAdhtJlXwV1oCll2HaWgAAOw==);
+}
+
+.mce-visualblocks h5 {
+	padding-top: 10px;
+	border: 1px dashed #BBB;
+	margin-left: 3px;
+	background: transparent no-repeat url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8HybbxIoiuwjane4iq5GlW05GgIkIZUAAAOw==);
+}
+
+.mce-visualblocks h6 {
+	padding-top: 10px;
+	border: 1px dashed #BBB;
+	margin-left: 3px;
+	background: transparent no-repeat url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8HybbxIoiuwjan04jep1iZ1XRlAo5bVgAAOw==);
+}
+
+.mce-visualblocks div:not([data-mce-bogus]) {
+	padding-top: 10px;
+	border: 1px dashed #BBB;
+	margin-left: 3px;
+	background: transparent no-repeat url(data:image/gif;base64,R0lGODlhEgAKAIABALu7u////yH5BAEAAAEALAAAAAASAAoAAAIfjI9poI0cgDywrhuxfbrzDEbQM2Ei5aRjmoySW4pAAQA7);
+}
+
+.mce-visualblocks section {
+	padding-top: 10px;
+	border: 1px dashed #BBB;
+	margin: 0 0 1em 3px;
+	background: transparent no-repeat url(data:image/gif;base64,R0lGODlhKAAKAIABALu7u////yH5BAEAAAEALAAAAAAoAAoAAAI5jI+pywcNY3sBWHdNrplytD2ellDeSVbp+GmWqaDqDMepc8t17Y4vBsK5hDyJMcI6KkuYU+jpjLoKADs=);
+}
+
+.mce-visualblocks article {
+	padding-top: 10px;
+	border: 1px dashed #BBB;
+	margin: 0 0 1em 3px;
+	background: transparent no-repeat url(data:image/gif;base64,R0lGODlhKgAKAIABALu7u////yH5BAEAAAEALAAAAAAqAAoAAAI6jI+pywkNY3wG0GBvrsd2tXGYSGnfiF7ikpXemTpOiJScasYoDJJrjsG9gkCJ0ag6KhmaIe3pjDYBBQA7);
+}
+
+.mce-visualblocks blockquote {
+	padding-top: 10px;
+	border: 1px dashed #BBB;
+	background: transparent no-repeat url(data:image/gif;base64,R0lGODlhPgAKAIABALu7u////yH5BAEAAAEALAAAAAA+AAoAAAJPjI+py+0Knpz0xQDyuUhvfoGgIX5iSKZYgq5uNL5q69asZ8s5rrf0yZmpNkJZzFesBTu8TOlDVAabUyatguVhWduud3EyiUk45xhTTgMBBQA7);
+}
+
+.mce-visualblocks address {
+	padding-top: 10px;
+	border: 1px dashed #BBB;
+	margin: 0 0 1em 3px;
+	background: transparent no-repeat url(data:image/gif;base64,R0lGODlhLQAKAIABALu7u////yH5BAEAAAEALAAAAAAtAAoAAAI/jI+pywwNozSP1gDyyZcjb3UaRpXkWaXmZW4OqKLhBmLs+K263DkJK7OJeifh7FicKD9A1/IpGdKkyFpNmCkAADs=);
+}
+
+.mce-visualblocks pre {
+	padding-top: 10px;
+	border: 1px dashed #BBB;
+	margin-left: 3px;
+	background: transparent no-repeat url(data:image/gif;base64,R0lGODlhFQAKAIABALu7uwAAACH5BAEAAAEALAAAAAAVAAoAAAIjjI+ZoN0cgDwSmnpz1NCueYERhnibZVKLNnbOq8IvKpJtVQAAOw==);
+}
+
+.mce-visualblocks figure {
+	padding-top: 10px;
+	border: 1px dashed #BBB;
+	margin: 0 0 1em 3px;
+	background: transparent no-repeat url(data:image/gif;base64,R0lGODlhJAAKAIAAALu7u////yH5BAEAAAEALAAAAAAkAAoAAAI0jI+py+2fwAHUSFvD3RlvG4HIp4nX5JFSpnZUJ6LlrM52OE7uSWosBHScgkSZj7dDKnWAAgA7);
+}
+
+.mce-visualblocks hgroup {
+	padding-top: 10px;
+	border: 1px dashed #BBB;
+	margin: 0 0 1em 3px;
+	background: transparent no-repeat url(data:image/gif;base64,R0lGODlhJwAKAIABALu7uwAAACH5BAEAAAEALAAAAAAnAAoAAAI3jI+pywYNI3uB0gpsRtt5fFnfNZaVSYJil4Wo03Hv6Z62uOCgiXH1kZIIJ8NiIxRrAZNMZAtQAAA7);
+}
+
+.mce-visualblocks aside {
+	padding-top: 10px;
+	border: 1px dashed #BBB;
+	margin: 0 0 1em 3px;
+	background: transparent no-repeat url(data:image/gif;base64,R0lGODlhHgAKAIABAKqqqv///yH5BAEAAAEALAAAAAAeAAoAAAItjI+pG8APjZOTzgtqy7I3f1yehmQcFY4WKZbqByutmW4aHUd6vfcVbgudgpYCADs=);
+}
+
+.mce-visualblocks figcaption {
+	border: 1px dashed #BBB;
+}
+
+.mce-visualblocks ul {
+	padding-top: 10px;
+	border: 1px dashed #BBB;
+	margin: 0 0 1em 3px;
+	background: transparent no-repeat url(data:image/gif;base64,R0lGODlhDQAKAIAAALu7u////yH5BAEAAAEALAAAAAANAAoAAAIXjI8GybGuYnqUVSjvw26DzzXiqIDlVwAAOw==)
+}
+
+.mce-visualblocks ol {
+	padding-top: 10px;
+	border: 1px dashed #BBB;
+	margin: 0 0 1em 3px;
+	background: transparent no-repeat url(data:image/gif;base64,R0lGODlhDQAKAIABALu7u////yH5BAEAAAEALAAAAAANAAoAAAIXjI8GybH6HHt0qourxC6CvzXieHyeWQAAOw==);
+}
+
+.mce-visualblocks dl {
+	padding-top: 10px;
+	border: 1px dashed #BBB;
+	margin: 0 0 1em 3px;
+	background: transparent no-repeat url(data:image/gif;base64,R0lGODlhDQAKAIABALu7u////yH5BAEAAAEALAAAAAANAAoAAAIXjI8GybEOnmOvUoWznTqeuEjNSCqeGRUAOw==);
+}

Some files were not shown because too many files changed in this diff