feat: améliorer la synchronisation des métadonnées asynchrones avec indicateurs de chargement visuels, polling pour synchroniser textarea vers Toast UI Editor, correction du chemin du script metadata.min.js avec base_path, et ajout de conteneurs d'icônes loader pour titre, description et tags avec activation conditionnelle selon retrieve_description
This commit is contained in:
@@ -1177,6 +1177,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
// Markdown editor
|
||||
if (descriptionSource && editorMount && window.toastui && window.toastui.Editor) {
|
||||
const previewStyle = window.innerWidth < 992 ? 'tab' : 'vertical';
|
||||
let sourceSyncTimer = null;
|
||||
|
||||
const markdownEditor = new window.toastui.Editor({
|
||||
el: editorMount,
|
||||
@@ -1189,7 +1190,26 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
usageStatistics: false,
|
||||
});
|
||||
|
||||
// Shaarli metadata script updates the textarea value asynchronously.
|
||||
// Mirror that value into Toast UI only if the editor is still empty.
|
||||
sourceSyncTimer = window.setInterval(() => {
|
||||
const sourceValue = (descriptionSource.value || '').trim();
|
||||
if (!sourceValue) return;
|
||||
|
||||
const editorValue = (markdownEditor.getMarkdown() || '').trim();
|
||||
if (!editorValue) {
|
||||
markdownEditor.setMarkdown(descriptionSource.value || '', false);
|
||||
}
|
||||
|
||||
window.clearInterval(sourceSyncTimer);
|
||||
sourceSyncTimer = null;
|
||||
}, 250);
|
||||
|
||||
form.addEventListener('submit', () => {
|
||||
if (sourceSyncTimer) {
|
||||
window.clearInterval(sourceSyncTimer);
|
||||
sourceSyncTimer = null;
|
||||
}
|
||||
descriptionSource.value = markdownEditor.getMarkdown();
|
||||
});
|
||||
} else if (editorMount) {
|
||||
|
||||
Reference in New Issue
Block a user