diff --git a/editor/jar.mn b/editor/jar.mn index f891356ab38..4edebf4ad27 100644 --- a/editor/jar.mn +++ b/editor/jar.mn @@ -9,10 +9,11 @@ comm.jar: content/editor/EditorContextMenuOverlay.xul (ui/composer/content/EditorContextMenuOverlay.xul) content/editor/EditorInitPage.html (ui/composer/content/EditorInitPage.html) content/editor/EditorInitPagePlain.html (ui/composer/content/EditorInitPagePlain.html) - content/editor/EditorContent.css (ui/composer/content/EditorContent.css) + content/editor/EditorExtra.css (ui/composer/content/EditorExtra.css) content/editor/EditorAllTags.css (ui/composer/content/EditorAllTags.css) content/editor/EditorOverride.css (ui/composer/content/EditorOverride.css) - content/editor/EditorParagraphMarks.css (ui/composer/content/EditorParagraphMarks.css) + content/editor/EditorParagraphMarks.css (ui/composer/content/EditorParagraphMarks.css) + content/editor/EditorContent.css (ui/composer/content/EditorContent.css) content/editor/sidebar-editor.rdf (ui/composer/content/sidebar-editor.rdf) content/editor/sidebar-editor.xul (ui/composer/content/sidebar-editor.xul) content/editor/sb-bookmarks-panel.xul (ui/composer/content/sb-bookmarks-panel.xul) @@ -124,6 +125,13 @@ comm.jar: content/editor/images/tag-ul.gif (ui/composer/content/images/tag-ul.gif) content/editor/images/tag-var.gif (ui/composer/content/images/tag-var.gif) content/editor/images/tag-userdefined.gif (ui/composer/content/images/tag-userdefined.gif) + content/editor/images/smile.gif (ui/composer/content/images/smile.gif) + content/editor/images/smile_active.gif (ui/composer/content/images/smile_active.gif) + content/editor/images/smile_disabled.gif (ui/composer/content/images/smile_disabled.gif) + content/editor/images/smile_hover.gif (ui/composer/content/images/smile_hover.gif) + content/editor/images/frown.gif (ui/composer/content/images/frown.gif) + content/editor/images/wink.gif (ui/composer/content/images/wink.gif) + content/editor/images/sick.gif (ui/composer/content/images/sick.gif) content/editor/EdDialogCommon.js (ui/dialogs/content/EdDialogCommon.js) content/editor/EdLinkProps.xul (ui/dialogs/content/EdLinkProps.xul) content/editor/EdLinkProps.js (ui/dialogs/content/EdLinkProps.js) diff --git a/editor/ui/composer/content/ComposerCommands.js b/editor/ui/composer/content/ComposerCommands.js index ce395bdfa68..d7073cad75f 100644 --- a/editor/ui/composer/content/ComposerCommands.js +++ b/editor/ui/composer/content/ComposerCommands.js @@ -86,6 +86,7 @@ function SetupHTMLEditorCommands() gHTMLEditorCommandManager.registerCommand("cmd_NormalizeTable", nsNormalizeTableCommand); gHTMLEditorCommandManager.registerCommand("cmd_FinishHTMLSource", nsFinishHTMLSource); gHTMLEditorCommandManager.registerCommand("cmd_CancelHTMLSource", nsCancelHTMLSource); +gHTMLEditorCommandManager.registerCommand("cmd_smiley", nsSetSmiley); } function SetupComposerWindowCommands() @@ -869,6 +870,76 @@ var nsObjectPropertiesCommand = } }; +//----------------------------------------------------------------------------------- +var nsSetSmiley = +{ + isCommandEnabled: function(aCommand, dummy) + { + var selection = window.editorShell.editorSelection; + var focNode = selection.focusNode; + var userChoice = selection.isCollapsed && (focNode.nodeType == Node.TEXT_NODE); + + return (userChoice && window.editorShell && window.editorShell.documentEditable); + }, + + doCommand: function(aCommand) + { + var prevChar; + var nextChar; + + var leftAdd; + var rightAdd; + + var curNode; + + var endRightNode; + + var commandNode = document.getElementById(aCommand); + var smileyCode = commandNode.getAttribute("state"); + + var selection = window.editorShell.editorSelection; + var focusInd = selection.focusOffset; + + + if (selection) + { + var focusN = selection.focusNode; + + var outputText = focusN.nodeValue; + + prevChar = outputText.charAt(focusInd - 1); + nextChar = outputText.charAt(focusInd); + + switch(prevChar) + { + case "": + case " ": + leftAdd =""; + break; + default: + leftAdd = " " ; + break; + } + + switch(nextChar) + { + case "": + case " ": + rightAdd =""; + break; + default: + rightAdd = " " ; + break; + } + + + editorShell.InsertSource(leftAdd + smileyCode + rightAdd); + window._content.focus(); + } + } +}; + + function doAdvancedProperties(element) { if (element) diff --git a/editor/ui/composer/content/MANIFEST b/editor/ui/composer/content/MANIFEST index dab051b7524..1238d8f26b7 100644 --- a/editor/ui/composer/content/MANIFEST +++ b/editor/ui/composer/content/MANIFEST @@ -31,10 +31,11 @@ EditorContextMenu.js EditorContextMenuOverlay.xul EditorInitPage.html EditorInitPagePlain.html -EditorContent.css +EditorExtra.css EditorAllTags.css EditorOverride.css EditorParagraphMarks.css +EditorContent.css editorOverlay.js editorOverlay.xul sidebar-editor.rdf @@ -146,3 +147,11 @@ images:tag-u.gif images:tag-ul.gif images:tag-var.gif images:tag-userdefined.gif +images:smile.gif +images:smile_active.gif +images:smile_disabled.gif +images:smile_hover.gif +images:frown.gif +images:wink.gif +images:sick.gi + diff --git a/editor/ui/composer/content/editor.js b/editor/ui/composer/content/editor.js index 33fa4c9cac5..0588255968e 100644 --- a/editor/ui/composer/content/editor.js +++ b/editor/ui/composer/content/editor.js @@ -836,6 +836,13 @@ function GetBackgroundElementWithColor() return element; } +function SetSmiley(smileyText) +{ + editorShell.InsertText(smileyText); + + window._content.focus(); +} + function EditorSelectColor(colorType) { if (!gColorObj) diff --git a/editor/ui/composer/content/editorOverlay.xul b/editor/ui/composer/content/editorOverlay.xul index 100c36312c4..500b923226d 100644 --- a/editor/ui/composer/content/editorOverlay.xul +++ b/editor/ui/composer/content/editorOverlay.xul @@ -25,6 +25,7 @@ + + @@ -556,6 +558,37 @@ + + + + + + + + diff --git a/editor/ui/composer/content/makefile.win b/editor/ui/composer/content/makefile.win index a9f0c7c8cde..76168322f0b 100644 --- a/editor/ui/composer/content/makefile.win +++ b/editor/ui/composer/content/makefile.win @@ -35,6 +35,7 @@ CHROME_CONTENT = \ .\EditorContextMenuOverlay.xul \ .\EditorInitPage.html \ .\EditorInitPagePlain.html \ + .\EditorExtra.css \ .\EditorContent.css \ .\EditorAllTags.css \ .\EditorOverride.css \ @@ -153,6 +154,13 @@ CHROME_MISC = \ .\images\tag-ul.gif \ .\images\tag-var.gif \ .\images\tag-userdefined.gif \ + .\images\smile.gif \ + .\images\smile_active.gif \ + .\images\smile_disabled.gif \ + .\images\smile_hover.gif \ + .\images\frown.gif \ + .\images\wink.gif \ + .\images\sick.gif \ $(NULL) include <$(DEPTH)\config\rules.mak> diff --git a/editor/ui/composer/locale/en-US/editorOverlay.dtd b/editor/ui/composer/locale/en-US/editorOverlay.dtd index afc89adc0fb..04cee223bfb 100644 --- a/editor/ui/composer/locale/en-US/editorOverlay.dtd +++ b/editor/ui/composer/locale/en-US/editorOverlay.dtd @@ -611,3 +611,14 @@ + + + + + + + + + + + diff --git a/mailnews/compose/resources/content/messengercompose.xul b/mailnews/compose/resources/content/messengercompose.xul index 210b4d2fc9f..6a7c98a3264 100644 --- a/mailnews/compose/resources/content/messengercompose.xul +++ b/mailnews/compose/resources/content/messengercompose.xul @@ -511,6 +511,9 @@