Skip to content

Commit

Permalink
pr review: fix squire initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
martgil committed Sep 27, 2024
1 parent 061beed commit fb7af2d
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,11 @@ export class ComposeInputModule extends ViewModule<ComposeView> {
}

public setHandlers = () => {
this.toggleRichTextFormatting();
this.view.S.cached('add_intro').on(
'click',
this.view.setHandler(el => this.actionAddIntroHandler(el), this.view.errModule.handle(`add intro`))
);
if (this.isRichText()) {
this.initSquire(true);
}
// 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 Down Expand Up @@ -107,6 +105,14 @@ export class ComposeInputModule extends ViewModule<ComposeView> {
return isInputLimitExceeded;
};

private toggleRichTextFormatting = () => {
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

0 comments on commit fb7af2d

Please sign in to comment.