From 37c06bb073070304a9dcb93d69044208d388b068 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Wed, 19 Jan 2022 20:35:36 +0100 Subject: [PATCH] word/edit: image container only needed for source --- word/edit.plp | 7 +++++-- word/editor.js | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/word/edit.plp b/word/edit.plp index 40bf8af..f41b0ab 100644 --- a/word/edit.plp +++ b/word/edit.plp @@ -260,9 +260,12 @@ for my $col (@wordcols) { printf ''; print $row->input($col => $attr); if (my $imgsrc = $attr->{-src}) { - printf('%s', - $col, $_, $row->{form}, $col eq 'source' && ' hidden' + my $hide = $col eq 'source'; + printf '', $col unless $hide; + printf('%s', + $_, $row->{form}, $hide && qq( id="${col}preview" hidden) ) for grep { -e } $imgsrc->($row); + printf '' unless $hide; } print $row->input($_ => delete $wordcol{$_}) for @span; print ''; diff --git a/word/editor.js b/word/editor.js index c71faa5..a4b8d8e 100644 --- a/word/editor.js +++ b/word/editor.js @@ -184,7 +184,7 @@ document.addEventListener('DOMContentLoaded', () => { recrop(); } - imgselect.src = imgpreview.children[0].src; + imgselect.src = imgpreview.src; imgselect.style.cursor = 'grab'; imgselect.style.position = 'absolute'; recrop(); -- 2.30.0