fix : boutons IA dans wizard/step1.php (éditeur réel) + adaptation ids textarea

post_form.php n'était jamais inclus — les boutons IA sont ajoutés dans la vraie
page d'édition (wizard/step1.php). ai-editor.js cherche #wz-content en priorité
et extrait le titre depuis la première ligne # du Markdown.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-16 13:01:46 +02:00
parent 298f18dabe
commit e03594c22e
2 changed files with 42 additions and 6 deletions
+9 -3
View File
@@ -9,7 +9,7 @@ document.addEventListener('DOMContentLoaded', function () {
var resultEl = document.getElementById('ai-result-content');
var btnApply = document.getElementById('btn-ai-apply');
var btnClose = document.getElementById('btn-ai-close');
var ta = document.getElementById('content');
var ta = document.getElementById('wz-content') || document.getElementById('content');
var titleEl = document.getElementById('title');
var lastRewrite = '';
@@ -33,13 +33,19 @@ document.addEventListener('DOMContentLoaded', function () {
lastRewrite = '';
try {
var titleVal = titleEl ? titleEl.value : '';
if (!titleVal && ta) {
var m = ta.value.match(/^#\s+(.+)/m);
if (m) { titleVal = m[1].trim(); }
}
var res = await fetch('/?action=ai_query', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({
action: action,
title: titleEl ? titleEl.value : '',
content: ta ? ta.value : '',
title: titleVal,
content: ta ? ta.value : '',
}),
});