From d97f79f7374783ff813d3abd5bbeb8f4d7a0e55e Mon Sep 17 00:00:00 2001 From: bruno Date: Sat, 11 Jul 2026 10:34:04 -0400 Subject: [PATCH] fix: preview affichait du JSON brut au lieu du texte des pages FlowDeck MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ajout de _extractPreview(): parse le JSON Notion blocks, extrait le texte des champs .content ou .text de chaque block. Fallback sur le raw content si le format n'est pas blocks/markdown. Avant: {"blocks":[{"type":"text","content":"Hello"}]} Après: Hello --- app/templates/local_workspace.html | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/app/templates/local_workspace.html b/app/templates/local_workspace.html index f8972ee..7f1d481 100644 --- a/app/templates/local_workspace.html +++ b/app/templates/local_workspace.html @@ -504,11 +504,32 @@ document.addEventListener('alpine:init', function() { fetch('/api/local-workspace/page-content/' + node.id) .then(function(r) { return r.json(); }) .then(function(d) { - self.previewContent = (d.content || '').substring(0, 500); + self.previewContent = self._extractPreview(d.content || '', d.format); }) .catch(function() { self.previewContent = '(preview not available)'; }); } }, + _extractPreview(content, format) { + if (!content) return '(empty)'; + // Try to extract text from Notion block JSON + if (format === 'blocks' || format === 'markdown') { + try { + var blocks = typeof content === 'string' ? JSON.parse(content) : content; + if (blocks && blocks.blocks && Array.isArray(blocks.blocks)) { + var lines = []; + for (var i=0; i