mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-10-31 00:12:39 +00:00
fix: keep the above-quote frame off the quote toggle and the footer, and give email-footer the message id
This commit is contained in:
@@ -159,6 +159,14 @@ describe('reader-header and reader-below-subject', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('email-footer', () => {
|
||||
it('hands the frame the id of the open message', () => {
|
||||
offerSlots('p1', ['email-footer']);
|
||||
viewer(textMail('Hi'));
|
||||
expect(slotProps(screen.getByTestId('slot-email-footer'))).toEqual({ emailId: 'e1' });
|
||||
});
|
||||
});
|
||||
|
||||
describe('reader-above-quote', () => {
|
||||
it('sits between the new text of a plain-text reply and its folded quote', () => {
|
||||
offerSlots('p1', ['reader-above-quote']);
|
||||
@@ -170,6 +178,11 @@ describe('reader-above-quote', () => {
|
||||
expect(follows(frame, quote)).toBe(true);
|
||||
expect(follows(screen.getByText(/Sounds good/), frame)).toBe(true);
|
||||
expect((slotProps(frame).email as { id: string }).id).toBe('e1');
|
||||
// The frame renders inside the anchor, so the anchor must grow with it
|
||||
// instead of letting the frame spill over the quote toggle and the footer.
|
||||
const anchor = container.querySelector<HTMLElement>(`[${QUOTE_ANCHOR_ATTR}]`)!;
|
||||
expect(anchor.contains(frame)).toBe(true);
|
||||
expect(anchor.style.height).toBe('');
|
||||
});
|
||||
|
||||
it('is not mounted for a message without a quote, or without a plugin', () => {
|
||||
|
||||
@@ -1437,6 +1437,7 @@ export function EmailViewer({
|
||||
);
|
||||
const pluginEmailProps = useMemo(() => ({ email: pluginEmailView }), [pluginEmailView]);
|
||||
const readerActionContext = useMemo(() => ({ emailId: email?.id }), [email?.id]);
|
||||
const pluginFooterProps = useMemo(() => ({ emailId: email?.id }), [email?.id]);
|
||||
const [detailSidebarCollapsed, setDetailSidebarCollapsed] = useState<boolean>(() => {
|
||||
if (typeof window === 'undefined') return false;
|
||||
try { return localStorage.getItem('emailDetailSidebarCollapsed') === '1'; } catch { return false; }
|
||||
@@ -5952,7 +5953,7 @@ export function EmailViewer({
|
||||
)}
|
||||
</div>
|
||||
|
||||
<PluginSlot name="email-footer" />
|
||||
<PluginSlot name="email-footer" extraProps={pluginFooterProps} />
|
||||
|
||||
{/* Mountain View: the conversation's later messages, folded. */}
|
||||
{mvAfter.length > 0 && (
|
||||
|
||||
@@ -145,7 +145,10 @@ export function insertQuoteAnchor(root: HTMLElement): HTMLElement | null {
|
||||
if (!toggle?.parentNode) return null;
|
||||
const anchor = root.ownerDocument.createElement("div");
|
||||
anchor.setAttribute(QUOTE_ANCHOR_ATTR, "");
|
||||
anchor.style.cssText = "display:block;margin:0;padding:0;border:0;height:0;white-space:normal;";
|
||||
// No fixed height: in a plain-text body the frame renders inside the anchor
|
||||
// and must push the quote toggle down, not lie over it. QuoteOverlay sets
|
||||
// the height itself for an HTML body.
|
||||
anchor.style.cssText = "display:block;margin:0;padding:0;border:0;white-space:normal;";
|
||||
toggle.parentNode.insertBefore(anchor, toggle);
|
||||
return anchor;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user