Bug 1665174 - for inserting smileys just insert the smiley char, without any span around it. r=mkmelin a=wsmwk
authorKhushil Mistry <khushil324@gmail.com>
Wed, 30 Sep 2020 13:53:44 +0300
changeset 40809 faa3265fa49ca5274c89e5f0ccc7d410b1e5b6c1
parent 40808 f3023bdb92a88c675e3c4969a592cab980b3aada
child 40810 42e842ed7fef1409feb36eb274170eff27b22d2b
push id406
push userthunderbird@calypsoblue.org
push dateMon, 19 Oct 2020 19:46:44 +0000
reviewersmkmelin, wsmwk
bugs1665174
Bug 1665174 - for inserting smileys just insert the smiley char, without any span around it. r=mkmelin a=wsmwk Inserting an span element caused an unwanted change of paragraph mode at times, and was not needed for anything.
mail/components/compose/content/ComposerCommands.js
--- a/mail/components/compose/content/ComposerCommands.js
+++ b/mail/components/compose/content/ComposerCommands.js
@@ -1684,21 +1684,17 @@ var nsSetSmiley = {
     return IsDocumentEditable() && IsEditingRenderedHTML();
   },
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {
     try {
       let editor = GetCurrentEditor();
       let smileyCode = aParams.getStringValue("state_attribute");
-      let smileyElement = editor.createElementWithDefaults("span");
-      // eslint-disable-next-line no-unsanitized/property
-      smileyElement.innerHTML = smileyCode;
-
-      editor.insertElementAtSelection(smileyElement, true);
+      editor.insertHTML(smileyCode);
       window.content.focus();
     } catch (e) {
       dump("Exception occurred in smiley InsertElementAtSelection\n");
     }
   },
   // This is now deprecated in favor of "doCommandParams"
   doCommand(aCommand) {},
 };