Skip to content

Commit

Permalink
revert previous changes
Browse files Browse the repository at this point in the history
  • Loading branch information
martgil committed Nov 29, 2024
1 parent 5c843f7 commit 5d7f052
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export abstract class WebmailElementReplacer {
private replacePgpElsInterval: number;

public abstract getIntervalFunctions: () => IntervalFunction[];
public abstract setReplyBoxEditable: (messageContainer?: JQuery<Element>) => Promise<void>;
public abstract setReplyBoxEditable: () => Promise<void>;
public abstract reinsertReplyBox: (replyMsgId: string) => void;
public abstract scrollToReplyBox: (replyMsgId: string) => void;
public abstract scrollToCursorInReplyBox: (replyMsgId: string, cursorOffsetTop: number) => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ export class GmailElementReplacer extends WebmailElementReplacer {
];
};

public setReplyBoxEditable = async (messageContainer?: JQuery<Element>) => {
public setReplyBoxEditable = async () => {
const replyContainerIframe = $('.reply_message_iframe_container > iframe').last();
if (replyContainerIframe.length && messageContainer) {
$(replyContainerIframe).replaceWith(this.factory.embeddedReply(this.getLastMsgReplyParams(messageContainer), true)); // xss-safe-value
if (replyContainerIframe.length) {
$(replyContainerIframe).replaceWith(this.factory.embeddedReply(this.getLastMsgReplyParams(this.getConvoRootEl(replyContainerIframe[0])), true)); // xss-safe-value
} else {
await this.replaceStandardReplyBox(undefined, true);
}
Expand Down Expand Up @@ -351,10 +351,10 @@ export class GmailElementReplacer extends WebmailElementReplacer {
return;
}
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const messageContainer: JQuery<Element> = $(btn.closest('.h7')!);
const messageContainer = $(btn.closest('.h7')!);
if (messageContainer.is(':last-child')) {
if (this.isEncrypted()) {
await this.setReplyBoxEditable(messageContainer);
await this.setReplyBoxEditable();
} else {
await this.replaceStandardReplyBox(undefined, true);
}
Expand Down Expand Up @@ -589,10 +589,8 @@ export class GmailElementReplacer extends WebmailElementReplacer {
return from ? Str.parseEmail(from) : undefined;
};

private getLastMsgReplyParams = (convoRootEl: JQuery<Element>): FactoryReplyParams => {
const msgIdElement = $(convoRootEl).find('[data-legacy-message-id], [data-message-id]');
const msgId = msgIdElement.attr('data-legacy-message-id') || msgIdElement.attr('data-message-id');
return { replyMsgId: msgId };
private getLastMsgReplyParams = (convoRootEl: JQuery): FactoryReplyParams => {
return { replyMsgId: this.determineMsgId($(convoRootEl).find(this.sel.msgInner).last()) };
};

private getConvoRootEl = (anyInnerElement: HTMLElement) => {
Expand Down

0 comments on commit 5d7f052

Please sign in to comment.