diff --git a/mozilla/editor/ui/composer/content/editor.js b/mozilla/editor/ui/composer/content/editor.js index 3f10bd31bc7..2918636c11a 100644 --- a/mozilla/editor/ui/composer/content/editor.js +++ b/mozilla/editor/ui/composer/content/editor.js @@ -200,7 +200,7 @@ function EditorSharedStartup() gIsUNIX = (navigator.appVersion.indexOf("X11") || navigator.appVersion.indexOf("nux")) != -1; gIsMac = !gIsWin && !gIsUNIX; - dump("IsWin="+gIsWin+", IsUNIX="+gIsUNIX+", IsMac="+gIsMac+"\n"); + //dump("IsWin="+gIsWin+", IsUNIX="+gIsUNIX+", IsMac="+gIsMac+"\n"); // hide UI that we don't have components for HideInapplicableUIElements(); @@ -480,6 +480,16 @@ function EditorSetParagraphFormat(commandID, paraFormat) goDoCommand(commandID); } +function onChangeColor(colorWell, commandID) +{ + // Get the color from the command node state + var commandNode = document.getElementById(commandID); + var color = commandNode.getAttribute("state"); + //dump("onChangeColor -- Color is: "+color+"\n"); + + // Use setAttribute so colorwell can be a XUL element, such as titledbutton + colorWell.setAttribute("style", "background-color: " + color); +} function onFontFaceChange(fontFaceMenuList, commandID) { @@ -517,27 +527,6 @@ function EditorSetFontFace(commandID, fontFace) commandNode.setAttribute("state", fontFace); window.content.focus(); // needed for command dispatch to work goDoCommand(commandID); -/* - if (fontFace == "tt") - { - // The old "teletype" attribute - editorShell.SetTextProperty("tt", "", ""); - // Clear existing font face - editorShell.RemoveTextProperty("font", "face"); - } - else - { - // Remove any existing TT nodes - editorShell.RemoveTextProperty("tt", "", ""); - - if( fontFace == "" || fontFace == "normal") { - editorShell.RemoveTextProperty("font", "face"); - } else { - editorShell.SetTextProperty("font", "face", fontFace); - } - } - window.content.focus(); -*/ } function EditorSelectFontSize() @@ -584,7 +573,6 @@ function EditorSetFontSize(size) size == "medium" ) { editorShell.RemoveTextProperty("font", "size"); - dump("Removing font size\n"); } else { dump("Setting font size\n"); // Temp: convert from new CSS size strings to old HTML size strings @@ -609,26 +597,13 @@ function EditorSetFontSize(size) } editorShell.SetTextProperty("font", "size", size); } -/* - BIG BUG! Setting tag is totally horked -- stick with for beta1 - { - // XXX-THIS IS DEFINITELY WRONG! - // We need to parse the style tag to set/remove only the "font-size" - // TODO: We need a general SetInlineStyle(), RemoveInlineStyle() interface - editorShell.RemoveTextProperty("span", "style"); - dump("Removing font size\n"); - } else { - dump("Setting font size to: "+size+"\n"); - editorShell.SetTextProperty("span", "style", "font-size:"+size); - } -*/ gContentWindow.focus(); } function EditorSelectTextColor(ColorPickerID, ColorWellID) { var color = getColorAndSetColorWell(ColorPickerID, ColorWellID); -// dump("EditorSelectTextColor: "+color+"\n"); + //dump("EditorSelectTextColor: "+color+"\n"); // Close appropriate menupopup var menupopup; @@ -659,7 +634,7 @@ function EditorRemoveTextColor(ColorWellID) function EditorSelectBackColor(ColorPickerID, ColorWellID) { var color = getColorAndSetColorWell(ColorPickerID, ColorWellID); -dump("EditorSelectBackColor: "+color+"\n"); + //dump("EditorSelectBackColor: "+color+"\n"); // Close appropriate menupopup var menupopup; @@ -1052,22 +1027,61 @@ function InitBackColorPopup() SetBackColorString("BackColorCaption"); } -function InitListMenu() +function InitParagraphMenu() { - SetMenuItemCheckedFromState("menu_ul", "cmd_ul"); - SetMenuItemCheckedFromState("menu_ol", "cmd_ol"); - SetMenuItemCheckedFromState("menu_dt", "cmd_dt"); - SetMenuItemCheckedFromState("menu_dd", "cmd_dd"); + var mixedObj = new Object(); + var state = editorShell.GetParagraphState(mixedObj); + //dump("InitParagraphMenu: state="+state+"\n"); + var IDSuffix = "normal"; + + // PROBLEM: When we get blockquote, it masks other styles contained by it + // We need a separate method to get blockquote state + if (state.length > 0) + { + if (state.charAt(0) == "h") + { + // We have a heading style - remove any checkmark in this submenu + // by first setting the first item, then removing the check + document.getElementById("menu_normal").setAttribute("checked", "true"); + document.getElementById("menu_normal").removeAttribute("checked"); + return; + } + IDSuffix = state; + } + + document.getElementById("menu_"+IDSuffix).setAttribute("checked", "true"); } -function SetMenuItemCheckedFromState(menuItemID, commandID) +function InitHeadingMenu() { - var menuItem = document.getElementById(menuItemID); - var commandNode = document.getElementById(commandID); - if (menuItem && commandNode) + var mixedObj = new Object(); + var state = editorShell.GetParagraphState(mixedObj); + //dump("InitHeadingMenu: state="+state+"\n"); + var IDSuffix = "noHeading"; + + if (state.length > 0 && state.charAt(0) == "h") + IDSuffix = state; + + document.getElementById("menu_"+IDSuffix).setAttribute("checked", "true"); +} + +function InitListMenu() +{ + var mixedObj = new Object(); + var state = editorShell.GetListState(mixedObj); + //dump("InitListMenu: state="+state+"\n"); + var IDSuffix = "noList"; + + if (state.length > 0) { - menuItem.setAttribute("checked", commandNode.getAttribute("state")); + if (state == "dl") + state = editorShell.GetListItemState(mixedObj); + + if (state.length > 0) + IDSuffix = state; } + + document.getElementById("menu_"+IDSuffix).setAttribute("checked", "true"); } function EditorInitToolbars() diff --git a/mozilla/editor/ui/composer/content/editor.xul b/mozilla/editor/ui/composer/content/editor.xul index fa16ce5a276..c26f9e0aef3 100644 --- a/mozilla/editor/ui/composer/content/editor.xul +++ b/mozilla/editor/ui/composer/content/editor.xul @@ -72,6 +72,7 @@ + diff --git a/mozilla/editor/ui/composer/content/editorOverlay.xul b/mozilla/editor/ui/composer/content/editorOverlay.xul index 84852296cc1..b7b01623309 100644 --- a/mozilla/editor/ui/composer/content/editorOverlay.xul +++ b/mozilla/editor/ui/composer/content/editorOverlay.xul @@ -179,8 +179,6 @@ - - @@ -199,8 +197,15 @@ - + + + + + + + + @@ -224,7 +229,6 @@ - @@ -471,31 +475,36 @@ oncommand="EditorRemoveLinks()" position="8"/> - + + + position="10" oncreate="InitHeadingMenu()"> - - - - - - - + + + + + + + + position="11" oncreate="InitParagraphMenu()"> - - - - - + + + + + + @@ -504,18 +513,17 @@ accesskey="&formatlistmenu.accesskey;" position="12" oncreate="InitListMenu()"> - - + + + + + - - - - + - - @@ -718,9 +726,10 @@ - + + diff --git a/mozilla/editor/ui/composer/locale/en-US/editor.properties b/mozilla/editor/ui/composer/locale/en-US/editor.properties index 408e47c4dbd..ab36df2d90b 100644 --- a/mozilla/editor/ui/composer/locale/en-US/editor.properties +++ b/mozilla/editor/ui/composer/locale/en-US/editor.properties @@ -119,4 +119,5 @@ Clear=Clear #Mouse actions Click=Click Drag=Drag -Unknown=Unknown \ No newline at end of file +Unknown=Unknown +Close=Close diff --git a/mozilla/editor/ui/composer/locale/en-US/editorOverlay.dtd b/mozilla/editor/ui/composer/locale/en-US/editorOverlay.dtd index 7e6bc25fa28..208f5a6f99d 100644 --- a/mozilla/editor/ui/composer/locale/en-US/editorOverlay.dtd +++ b/mozilla/editor/ui/composer/locale/en-US/editorOverlay.dtd @@ -412,9 +412,9 @@ Menu item text for "[Page|Table|Cell] Background color" is filled from - + - + @@ -422,10 +422,13 @@ Menu item text for "[Page|Table|Cell] Background color" is filled from - + + + + diff --git a/mozilla/editor/ui/dialogs/content/EdColorProps.xul b/mozilla/editor/ui/dialogs/content/EdColorProps.xul index 39ad6f34bd7..e8e3f7358e8 100644 --- a/mozilla/editor/ui/dialogs/content/EdColorProps.xul +++ b/mozilla/editor/ui/dialogs/content/EdColorProps.xul @@ -36,6 +36,7 @@ xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="Startup()" + persist="screenX screenY" orient="vertical">