зеркало из https://github.com/mozilla/pjs.git
Editor overlay smilie menus. r=syd, sr=sfraser, checking in for
anatoliya@netscape.com
This commit is contained in:
Родитель
8d353f7cfa
Коммит
2c65c4549c
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -836,6 +836,13 @@ function GetBackgroundElementWithColor()
|
|||
return element;
|
||||
}
|
||||
|
||||
function SetSmiley(smileyText)
|
||||
{
|
||||
editorShell.InsertText(smileyText);
|
||||
|
||||
window._content.focus();
|
||||
}
|
||||
|
||||
function EditorSelectColor(colorType)
|
||||
{
|
||||
if (!gColorObj)
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
<!DOCTYPE window SYSTEM "chrome://editor/locale/editorOverlay.dtd">
|
||||
|
||||
<?xml-stylesheet href="chrome://editor/skin/EditorToolbars.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://editor/content/EditorExtra.css" type="text/css"?>
|
||||
|
||||
<overlay id="editorOverlay"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
|
@ -129,6 +130,7 @@
|
|||
<command id="cmd_objectProperties" oncommand="goDoCommand('cmd_objectProperties')"/>
|
||||
<command id="cmd_insertChars" oncommand="goDoCommand('cmd_insertChars')" value="&insertCharsCmd.label;"/>
|
||||
<command id="cmd_insertHTML" oncommand="goDoCommand('cmd_insertHTML')" value="&insertHTMLCmd.label;"/>
|
||||
<command id="cmd_smiley" state="" oncommand="goDoCommand('cmd_smiley')"/>
|
||||
|
||||
<command id="cmd_NormalMode" oncommand="goDoCommand('cmd_NormalMode')" value="&NormalMode.label;"/>
|
||||
<command id="cmd_AllTagsMode" oncommand="goDoCommand('cmd_AllTagsMode')" value="&AllTagsMode.label;"/>
|
||||
|
@ -556,6 +558,37 @@
|
|||
</menupopup>
|
||||
</menu>
|
||||
|
||||
|
||||
<!-- smiley menu -->
|
||||
<menu id="smileButtonMenu" tooltip="aTooltip" tooltiptext="&SmileButton.tooltip;">
|
||||
<button class="button-toolbar" id="smileButton">
|
||||
</button>
|
||||
<menupopup id="smilyPopup" flex="100%">
|
||||
<menuitem oncommand="doStatefulCommand('cmd_smiley', ':-)' )">
|
||||
<button class="plain" id="insert-smile" align="left" value="&smiley1Cmd.label;"/>
|
||||
</menuitem>
|
||||
<menuitem oncommand="doStatefulCommand('cmd_smiley', ':-(' )">
|
||||
<button class="plain" id="insert-frown" align="left" value="&smiley2Cmd.label;"/>
|
||||
</menuitem>
|
||||
<menuitem oncommand="doStatefulCommand('cmd_smiley', ';-)' )">
|
||||
<button class="plain" id="insert-wink" align="left" value="&smiley3Cmd.label;"/>
|
||||
</menuitem>
|
||||
<menuitem oncommand="doStatefulCommand('cmd_smiley', ';-P' )">
|
||||
<button class="plain" id="insert-sick" align="left" value="&smiley4Cmd.label;"/>
|
||||
</menuitem>
|
||||
<menuitem oncommand="doStatefulCommand('cmd_smiley', ':)' )">
|
||||
<button class="plain" id="insert-smile5" align="left" value="&smiley5Cmd.label;"/>
|
||||
</menuitem>
|
||||
<menuitem oncommand="doStatefulCommand('cmd_smiley', ':(' )">
|
||||
<button class="plain" id="insert-smile6" align="left" value="&smiley6Cmd.label;"/>
|
||||
</menuitem>
|
||||
<menuitem oncommand="doStatefulCommand('cmd_smiley', ';)' )">
|
||||
<button class="plain" id="insert-smile7" align="left" value="&smiley7Cmd.label;"/>
|
||||
</menuitem>
|
||||
<spring flex="100%" />
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
||||
<!-- this is only used in mailnews -->
|
||||
<menupopup id="AlignmentPopup">
|
||||
<menuitem oncommand="doStatefulCommand('cmd_align', 'left')">
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -611,3 +611,14 @@
|
|||
<!ENTITY PreviewMode.accesskey "p">
|
||||
<!ENTITY PreviewMode.tooltip "Display as WYSIWYG (as in Navigator)">
|
||||
|
||||
<!-- Smiley Menu items -->
|
||||
<!ENTITY smiley1Cmd.label " Smile ">
|
||||
<!ENTITY smiley2Cmd.label " Frown ">
|
||||
<!ENTITY smiley3Cmd.label " Wink ">
|
||||
<!ENTITY smiley4Cmd.label " Sick ">
|
||||
<!ENTITY smiley5Cmd.label " Short smile">
|
||||
<!ENTITY smiley6Cmd.label " Short frown">
|
||||
<!ENTITY smiley7Cmd.label " Short wink ">
|
||||
<!ENTITY SmileButton.tooltip "Choose smiley face">
|
||||
|
||||
|
||||
|
|
|
@ -511,6 +511,9 @@
|
|||
<button id="InsertPopupButton"/>
|
||||
<menupopup id="InsertPopup"/>
|
||||
</menu>
|
||||
|
||||
<menu id="smileButtonMenu"/>
|
||||
|
||||
<spring flex="1"/>
|
||||
</toolbar>
|
||||
</toolbox>
|
||||
|
|
|
@ -139,6 +139,51 @@ button.edit-mode[selected="1"]:hover:active
|
|||
list-style-image : url("chrome://editor/skin/images/bold-hover-active.gif");
|
||||
}
|
||||
|
||||
#smileButton {
|
||||
list-style-image:url(chrome://messenger/skin/smile.gif);
|
||||
}
|
||||
|
||||
#smileButton:hover, #smileButton[toggled="true"]:hover:active {
|
||||
list-style-image:url(chrome://messenger/skin/smile.gif);
|
||||
}
|
||||
|
||||
#smileButton[toggled="true"], #smileButton:hover:active {
|
||||
list-style-image:url(chrome://messenger/skin/smile.gif);
|
||||
}
|
||||
|
||||
#smileButton[disabled="true"], #smileButton[disabled="true"]:hover:active {
|
||||
list-style-image:url(chrome://messenger/skin/smile.gif);
|
||||
}
|
||||
|
||||
#insert-smile {
|
||||
list-style-image:url(chrome://messenger/skin/smile.gif);
|
||||
}
|
||||
|
||||
#insert-sick {
|
||||
list-style-image:url(chrome://messenger/skin/sick.gif);
|
||||
}
|
||||
|
||||
#insert-frown {
|
||||
list-style-image:url(chrome://messenger/skin/frown.gif);
|
||||
}
|
||||
|
||||
#insert-wink {
|
||||
list-style-image:url(chrome://messenger/skin/wink.gif);
|
||||
}
|
||||
|
||||
#insert-smile5 {
|
||||
list-style-image:url(chrome://messenger/skin/smile.gif);
|
||||
}
|
||||
|
||||
#insert-smile6 {
|
||||
list-style-image:url(chrome://messenger/skin/frown.gif);
|
||||
}
|
||||
|
||||
#insert-smile7 {
|
||||
list-style-image:url(chrome://messenger/skin/wink.gif);
|
||||
}
|
||||
|
||||
|
||||
#italicButton
|
||||
{
|
||||
list-style-image : url("chrome://editor/skin/images/italic.gif");
|
||||
|
|
|
@ -479,6 +479,51 @@ button.edit-mode > .button-internal-box > .button.icon:hover:active
|
|||
list-style-image:url(chrome://editor/skin/images/bold_disabled.gif);
|
||||
}
|
||||
|
||||
#smileButton {
|
||||
list-style-image:url(chrome://messenger/skin/smile.gif);
|
||||
}
|
||||
|
||||
#smileButton:hover, #smileButton[toggled="true"]:hover:active {
|
||||
list-style-image:url(chrome://messenger/skin/smile.gif);
|
||||
}
|
||||
|
||||
#smileButton[toggled="true"], #smileButton:hover:active {
|
||||
list-style-image:url(chrome://messenger/skin/smile.gif);
|
||||
}
|
||||
|
||||
#smileButton[disabled="true"], #smileButton[disabled="true"]:hover:active {
|
||||
list-style-image:url(chrome://messenger/skin/smile.gif);
|
||||
}
|
||||
|
||||
#insert-smile {
|
||||
list-style-image:url(chrome://messenger/skin/smile.gif);
|
||||
}
|
||||
|
||||
#insert-sick {
|
||||
list-style-image:url(chrome://messenger/skin/sick.gif);
|
||||
}
|
||||
|
||||
#insert-frown {
|
||||
list-style-image:url(chrome://messenger/skin/frown.gif);
|
||||
}
|
||||
|
||||
#insert-wink {
|
||||
list-style-image:url(chrome://messenger/skin/wink.gif);
|
||||
}
|
||||
|
||||
#insert-smile5 {
|
||||
list-style-image:url(chrome://messenger/skin/smile.gif);
|
||||
}
|
||||
|
||||
#insert-smile6 {
|
||||
list-style-image:url(chrome://messenger/skin/frown.gif);
|
||||
}
|
||||
|
||||
#insert-smile7 {
|
||||
list-style-image:url(chrome://messenger/skin/wink.gif);
|
||||
}
|
||||
|
||||
|
||||
#italicButton {
|
||||
list-style-image:url(chrome://editor/skin/images/italic.gif);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче