Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ export class ComposeInputModule extends ViewModule<ComposeView> {
}

public setHandlers = () => {
this.configureRichTextFormatting();
this.view.S.cached('add_intro').on(
'click',
this.view.setHandler(el => this.actionAddIntroHandler(el), this.view.errModule.handle(`add intro`))
);
this.initSquire(this.isRichText());
// Set lastDraftBody to current empty squire content ex: <div><br></div>)
// https://github.com/FlowCrypt/flowcrypt-browser/issues/5184
this.view.draftModule.setLastDraftBody(this.squire.getHTML());
Expand All @@ -54,7 +54,7 @@ export class ComposeInputModule extends ViewModule<ComposeView> {
};

public removeRichTextFormatting = () => {
if (this.view.inputModule.isRichText()) {
if (this.isRichText()) {
this.initSquire(false, true);
}
};
Expand Down Expand Up @@ -105,6 +105,14 @@ export class ComposeInputModule extends ViewModule<ComposeView> {
return isInputLimitExceeded;
};

private configureRichTextFormatting = () => {
if (this.isRichText()) {
this.addRichTextFormatting();
} else {
this.removeRichTextFormatting();
}
};

private initSquire = (addLinks: boolean, removeExistingLinks = false) => {
const squireHtml = this.squire?.getHTML();
const el = this.view.S.cached('input_text').get(0);
Expand Down
2 changes: 1 addition & 1 deletion test/source/tests/compose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1686,7 +1686,7 @@ export const defineComposeTests = (testVariant: TestVariant, testWithBrowser: Te
expect(await composePage.read('.swal2-html-container')).to.include('Send empty message?');
await composePage.waitAndClick('.swal2-cancel');
const footer = await composePage.read('@input-body');
expect(footer).to.eq('\n\n\n\n--\n\nflowcrypt.compatibility test footer with an img\n\nand second line\n');
expect(footer).to.eq('\n\n\n--\nflowcrypt.compatibility test footer with an img\nand second line');
await composePage.waitAndClick(`@action-send`);
expect(await composePage.read('.swal2-html-container')).to.include('Send empty message?');
await composePage.waitAndClick('.swal2-cancel');
Expand Down
Loading