diff --git a/mozilla/editor/ui/composer/content/ComposerCommands.js b/mozilla/editor/ui/composer/content/ComposerCommands.js
index 0078097bfa1..c22b59db440 100644
--- a/mozilla/editor/ui/composer/content/ComposerCommands.js
+++ b/mozilla/editor/ui/composer/content/ComposerCommands.js
@@ -719,7 +719,10 @@ var nsEditHTMLCommand =
},
doCommand: function(aCommand)
{
- _EditorNotImplemented(); //TODO: IMPLEMENT ME!
+ if (gEditorDisplayMode === DisplayModeSource)
+ SetEditMode(DisplayModeNormal);
+ else
+ SetEditMode(DisplayModeSource);
}
};
@@ -736,7 +739,11 @@ function EditorInitTableMenu()
// table border? Try to figure out all cells
// included in the selection?
var menuText;
- if (editorShell.GetFirstSelectedCell())
+
+ // Use "Join selected cells if there's more than 1 cell selected
+ var tagNameObj = new Object;
+ var countObj = new Object;
+ if (window.editorShell.GetSelectedOrParentTableElement(tagNameObj, countObj) && countObj.value > 1)
menuText = GetString("JoinSelectedCells");
else
menuText = GetString("JoinCellToRight");
@@ -765,10 +772,8 @@ function EditorInitTableMenu()
function goUpdateTableMenuItems(commandset)
{
- // Insert table can be done any time (if editable document)
- goUpdateCommand("cmd_InsertTable");
-
var enabled = false;
+
var enabledIfTable = false;
if (window.editorShell && window.editorShell.documentEditable)
{
@@ -777,8 +782,7 @@ function goUpdateTableMenuItems(commandset)
var element = editorShell.GetSelectedOrParentTableElement(tagNameObj, selectedCountObj);
if (element)
{
- // We can delete or normalize table if inside a table
- // or any table element is selected
+ // Value when we need to have a selected table or inside a table
enabledIfTable = true;
// All others require being inside a cell or selected cell
@@ -786,19 +790,27 @@ function goUpdateTableMenuItems(commandset)
}
}
- goSetCommandEnabled("cmd_DeleteTable", enabledIfTable);
- goSetCommandEnabled("cmd_NormalizeTable", enabledIfTable);
-
- // Loop through command nodes to set all the others
+ // Loop through command nodes
for (var i = 0; i < commandset.childNodes.length; i++)
{
var commandID = commandset.childNodes[i].getAttribute("id");
- if (commandID &&
- commandID != "cmd_InsertTable" &&
- commandID != "cmd_DeleteTable" &&
- commandID != "cmd_NormalizeTable")
+ if (commandID)
{
- goSetCommandEnabled(commandID, enabled);
+ if (commandID == "cmd_InsertTable" ||
+ commandID == "cmd_tableJoinCells" ||
+ commandID == "cmd_tableSplitCell")
+ {
+ // Call the update method in the command class
+ goUpdateCommand(commandID);
+ }
+ // Directly set with the values calculated here
+ else if (commandID == "cmd_DeleteTable" ||
+ commandID == "cmd_NormalizeTable")
+ {
+ goSetCommandEnabled(commandID, enabledIfTable);
+ } else {
+ goSetCommandEnabled(commandID, enabled);
+ }
}
}
}
@@ -991,7 +1003,7 @@ var nsInsertTableRowAboveCommand =
{
if (this.isCommandEnabled(aCommand))
{
- window.editorShell.InsertTableRow(false);
+ window.editorShell.InsertTableRow(1, false);
window.content.focus();
}
}
@@ -1007,7 +1019,7 @@ var nsInsertTableRowBelowCommand =
{
if (this.isCommandEnabled(aCommand))
{
- window.editorShell.InsertTableRow(true);
+ window.editorShell.InsertTableRow(1,true);
window.content.focus();
}
}
@@ -1023,7 +1035,7 @@ var nsInsertTableColumnBeforeCommand =
{
if (this.isCommandEnabled(aCommand))
{
- window.editorShell.InsertTableColumn(false);
+ window.editorShell.InsertTableColumn(1, false);
window.content.focus();
}
}
@@ -1039,7 +1051,7 @@ var nsInsertTableColumnAfterCommand =
{
if (this.isCommandEnabled(aCommand))
{
- window.editorShell.InsertTableColumn(true);
+ window.editorShell.InsertTableColumn(1, true);
window.content.focus();
}
}
@@ -1054,7 +1066,7 @@ var nsInsertTableCellBeforeCommand =
doCommand: function(aCommand)
{
if (this.isCommandEnabled(aCommand))
- window.editorShell.InsertTableCell(false);
+ window.editorShell.InsertTableCell(1, false);
}
};
@@ -1068,7 +1080,7 @@ var nsInsertTableCellAfterCommand =
{
if (this.isCommandEnabled(aCommand))
{
- window.editorShell.InsertTableCell(true);
+ window.editorShell.InsertTableCell(1, true);
window.content.focus();
}
}
@@ -1177,8 +1189,22 @@ var nsJoinTableCellsCommand =
{
isCommandEnabled: function(aCommand, dummy)
{
- //TODO: This should really only be allowed if there's a cell to the right
- return IsInTableCell();
+ if (window.editorShell && window.editorShell.documentEditable)
+ {
+ var tagNameObj = new Object;
+ var countObj = new Object;
+ var cell = window.editorShell.GetSelectedOrParentTableElement(tagNameObj, countObj);
+
+ // We need a cell and either > 1 selected cell or a sibling cell to the right
+ // (Note that editorShell returns "td" for "th" also)
+ // (This is a pain! Editor and gecko use lowercase tagNames, JS uses uppercase!)
+ if (cell && tagNameObj.value != "td")
+ return ( (countObj.value > 1) ||
+ (cell.nextSibling &&
+ (cell.nextSibling.tagName == "TD" ||
+ cell.nextSibling.tagName == "TH")) );
+ }
+ return false;
},
doCommand: function(aCommand)
{
@@ -1195,8 +1221,12 @@ var nsSplitTableCellCommand =
{
isCommandEnabled: function(aCommand, dummy)
{
- //TODO: This should be allowed only if rowspan or colspan > 0;
- return IsInTableCell();
+ if (window.editorShell && window.editorShell.documentEditable)
+ {
+ var cell = window.editorShell.GetElementOrParentByTagName("td", null);
+ return (cell != null && (cell.colSpan > 1 || cell.rowSpan > 1));
+ }
+ return false;
},
doCommand: function(aCommand)
{
diff --git a/mozilla/editor/ui/composer/content/EditorAllTags.css b/mozilla/editor/ui/composer/content/EditorAllTags.css
index 9852ea7769d..124c753e8b8 100644
--- a/mozilla/editor/ui/composer/content/EditorAllTags.css
+++ b/mozilla/editor/ui/composer/content/EditorAllTags.css
@@ -37,14 +37,14 @@
background-position: top left;
}
-a:before {
- content: none;
+a[name]:before {
+ content: "";
/*url(chrome://editor/content/images/tag-a.gif);*/
}
a {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 20px;
background-image: url(chrome://editor/content/images/tag-a.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -52,7 +52,7 @@ a {
abbr {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 35px;
background-image: url(chrome://editor/content/images/tag-abr.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -61,7 +61,7 @@ abbr {
acronym {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 57px;
background-image: url(chrome://editor/content/images/tag-acr.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -69,7 +69,7 @@ acronym {
address {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-adr.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -77,7 +77,7 @@ address {
applet {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 47px;
background-image: url(chrome://editor/content/images/tag-app.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -85,7 +85,7 @@ applet {
area {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 39px;
background-image: url(chrome://editor/content/images/tag-ara.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -93,7 +93,7 @@ area {
b {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 20px;
background-image: url(chrome://editor/content/images/tag-b.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -101,7 +101,7 @@ b {
basefont {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 57px;
background-image: url(chrome://editor/content/images/tag-bsf.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -109,7 +109,7 @@ basefont {
bdo {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 31px;
background-image: url(chrome://editor/content/images/tag-bdo.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -117,7 +117,7 @@ bdo {
big {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 31px;
background-image: url(chrome://editor/content/images/tag-big.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -125,7 +125,7 @@ big {
blockquote {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-blq.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -133,7 +133,7 @@ blockquote {
body {
min-height: 35px; margin-left: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-body.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -141,7 +141,7 @@ body {
br {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 23px;
background-image: url(chrome://editor/content/images/tag-br.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -149,7 +149,7 @@ br {
button {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 57px;
background-image: url(chrome://editor/content/images/tag-btn.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -157,7 +157,7 @@ button {
caption {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 55px;
background-image: url(chrome://editor/content/images/tag-cpt.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -165,7 +165,7 @@ caption {
center {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-ctr.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -173,7 +173,7 @@ center {
cite {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 39px;
background-image: url(chrome://editor/content/images/tag-cit.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -181,7 +181,7 @@ cite {
code {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 39px;
background-image: url(chrome://editor/content/images/tag-cod.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -189,7 +189,7 @@ code {
col {
min-height: 35px; margin-left: 2px;
- padding-left: 16px;
+ padding-left: 31px;
background-image: url(chrome://editor/content/images/tag-col.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -197,7 +197,7 @@ col {
colgroup {
min-height: 35px; margin-left: 2px;
- padding-left: 16px;
+ padding-left: 51px;
background-image: url(chrome://editor/content/images/tag-clg.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -205,7 +205,7 @@ colgroup {
dd {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 23px;
background-image: url(chrome://editor/content/images/tag-dd.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -213,7 +213,7 @@ dd {
del {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 31px;
background-image: url(chrome://editor/content/images/tag-del.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -221,7 +221,7 @@ del {
dfn {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 31px;
background-image: url(chrome://editor/content/images/tag-dfn.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -229,7 +229,7 @@ dfn {
dir {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 31px;
background-image: url(chrome://editor/content/images/tag-dir.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -238,7 +238,7 @@ dir {
div {
min-height: 35px; margin-left: 2px; margin-top: 2px;
/* TEMPORARY TO COMPENSATE FOR BUG */
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-div.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -246,7 +246,7 @@ div {
dl {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-dl.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -254,7 +254,7 @@ dl {
dt {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 23px;
background-image: url(chrome://editor/content/images/tag-dt.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -262,7 +262,7 @@ dt {
em {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 23px;
background-image: url(chrome://editor/content/images/tag-em.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -270,7 +270,7 @@ em {
fieldset {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-fld.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -278,7 +278,7 @@ fieldset {
font {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 39px;
background-image: url(chrome://editor/content/images/tag-fnt.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -286,7 +286,7 @@ font {
form {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-for.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -294,7 +294,7 @@ form {
frame {
min-height: 35px; margin-left: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-frm.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -302,7 +302,7 @@ frame {
frameset {
min-height: 35px; margin-left: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-fst.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -310,7 +310,7 @@ frameset {
h1 {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-h1.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -318,7 +318,7 @@ h1 {
h2 {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-h2.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -326,7 +326,7 @@ h2 {
h3 {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-h3.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -334,7 +334,7 @@ h3 {
h4 {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-h4.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -342,7 +342,7 @@ h4 {
h5 {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-h5.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -350,7 +350,7 @@ h5 {
h6 {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-h6.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -358,7 +358,7 @@ h6 {
hr {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-hr.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -366,7 +366,7 @@ hr {
i {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 20px;
background-image: url(chrome://editor/content/images/tag-i.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -374,7 +374,7 @@ i {
iframe {
min-height: 35px; margin-left: 2px;
- padding-left: 16px;
+ padding-left: 47px;
background-image: url(chrome://editor/content/images/tag-ifr.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -382,7 +382,7 @@ iframe {
img {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 31px;
background-image: url(chrome://editor/content/images/tag-img.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -390,7 +390,7 @@ img {
input {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 39px;
background-image: url(chrome://editor/content/images/tag-inp.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -398,7 +398,7 @@ input {
ins {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 31px;
background-image: url(chrome://editor/content/images/tag-ins.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -406,7 +406,7 @@ ins {
isindex {
min-height: 35px; margin-left: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-isx.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -414,7 +414,7 @@ isindex {
kbd {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 31px;
background-image: url(chrome://editor/content/images/tag-kbd.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -422,7 +422,7 @@ kbd {
label {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 39px;
background-image: url(chrome://editor/content/images/tag-lbl.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -430,7 +430,7 @@ label {
legend {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 49px;
background-image: url(chrome://editor/content/images/tag-lgn.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -438,7 +438,7 @@ legend {
li {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 23px;
background-image: url(chrome://editor/content/images/tag-li.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -446,7 +446,7 @@ li {
listing {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 57px;
background-image: url(chrome://editor/content/images/tag-lst.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -454,7 +454,7 @@ listing {
map {
min-height: 35px; margin-left: 2px;
- padding-left: 16px;
+ padding-left: 31px;
background-image: url(chrome://editor/content/images/tag-map.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -462,7 +462,7 @@ map {
menu {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 39px;
background-image: url(chrome://editor/content/images/tag-men.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -470,7 +470,7 @@ menu {
noframes {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-nfr.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -478,7 +478,7 @@ noframes {
noscript {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-nsc.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -486,7 +486,7 @@ noscript {
object {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 49px;
background-image: url(chrome://editor/content/images/tag-obj.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -494,7 +494,7 @@ object {
ol {
min-height: 35px; margin-left: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-ol.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -502,7 +502,7 @@ ol {
optgroup {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 51px;
background-image: url(chrome://editor/content/images/tag-opg.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -510,7 +510,7 @@ optgroup {
option {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 47px;
background-image: url(chrome://editor/content/images/tag-opt.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -518,7 +518,7 @@ option {
p {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-p.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -526,7 +526,7 @@ p {
param {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 43px;
background-image: url(chrome://editor/content/images/tag-prm.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -534,7 +534,7 @@ param {
plaintext {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 57px;
background-image: url(chrome://editor/content/images/tag-pln.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -542,7 +542,7 @@ plaintext {
pre {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-pre.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -550,7 +550,7 @@ pre {
q {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 20px;
background-image: url(chrome://editor/content/images/tag-q.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -558,7 +558,7 @@ q {
s {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 20px;
background-image: url(chrome://editor/content/images/tag-s.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -566,7 +566,7 @@ s {
samp {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 39px;
background-image: url(chrome://editor/content/images/tag-smp.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -574,7 +574,7 @@ samp {
script {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 45px;
background-image: url(chrome://editor/content/images/tag-scr.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -582,7 +582,7 @@ script {
select {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 47px;
background-image: url(chrome://editor/content/images/tag-slc.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -590,7 +590,7 @@ select {
small {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 41px;
background-image: url(chrome://editor/content/images/tag-sml.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -599,7 +599,7 @@ small {
span {
min-height: 35px; margin-left: 2px; margin-top: 2px;
/* TEMPORARY TO COMPENSATE FOR BUG */
- padding-left: 16px;
+ padding-left: 39px;
background-image: url(chrome://editor/content/images/tag-spn.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -607,7 +607,7 @@ span {
strike {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 45px;
background-image: url(chrome://editor/content/images/tag-stk.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -615,7 +615,7 @@ strike {
strong {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 51px;
background-image: url(chrome://editor/content/images/tag-stn.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -623,7 +623,7 @@ strong {
sub {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 31px;
background-image: url(chrome://editor/content/images/tag-sub.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -631,7 +631,7 @@ sub {
sup {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 31px;
background-image: url(chrome://editor/content/images/tag-sup.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -643,23 +643,23 @@ sup {
table {
min-height: 35px; margin-left: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-tbl.gif);
background-repeat: no-repeat;
background-position: top left;
}
tbody {
- min-height: 35px; margin-left: 2px; margin-top: 1px;
- padding-left: 16px;
+ min-height: 42px; margin-left: 2px; margin-top: 1px;
+ padding-left: 17px;
content: url(chrome://editor/content/images/tag-tbd.gif);
background-repeat: no-repeat;
background-position: top left;
}
td {
- min-height: 35px; margin-left: 2px;
- padding-left: 16px;
+ min-height: 22px; margin-left: 2px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-td.gif);
background-repeat: no-repeat;
@@ -668,31 +668,31 @@ td {
textarea {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 59px;
background-image: url(chrome://editor/content/images/tag-txt.gif);
background-repeat: no-repeat;
background-position: top left;
}
tfoot {
- min-height: 35px; margin-left: 2px; margin-top: 1px;
- padding-left: 16px;
+ min-height: 42px; margin-left: 2px; margin-top: 1px;
+ padding-left: 17px;
content: url(chrome://editor/content/images/tag-tft.gif);
background-repeat: no-repeat;
background-position: top left;
}
th {
- min-height: 35px; margin-left: 2px;
- padding-left: 16px;
+ min-height: 22px; margin-left: 2px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-th.gif);
background-repeat: no-repeat;
background-position: top left;
}
thead {
- min-height: 35px; margin-left: 2px; margin-top: 1px;
- padding-left: 16px;
+ min-height: 42px; margin-left: 2px; margin-top: 1px;
+ padding-left: 17px;
content: url(chrome://editor/content/images/tag-thd.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -700,7 +700,7 @@ thead {
tr {
min-height: 35px; margin-left: 2px;
- padding-left: 16px;
+ padding-left: 23px;
background-image: url(chrome://editor/content/images/tag-tr.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -708,14 +708,15 @@ tr {
tt {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 23px;
background-image: url(chrome://editor/content/images/tag-tt.gif);
background-repeat: no-repeat;
background-position: top left;
}
u {
- padding-left: 16px;
+ min-height: 35px; margin-left: 2px; margin-top: 2px;
+ padding-left: 23px;
background-image: url(chrome://editor/content/images/tag-u.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -723,7 +724,7 @@ u {
ul {
min-height: 35px; margin-left: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-ul.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -731,7 +732,7 @@ ul {
var {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 31px;
background-image: url(chrome://editor/content/images/tag-var.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -739,7 +740,7 @@ var {
xmp {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 31px;
background-image: url(chrome://editor/content/images/tag-xmp.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -752,7 +753,7 @@ xmp {
html {
min-height: 35px; margin-left: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-html.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -760,7 +761,7 @@ html {
head {
min-height: 35px; margin-left: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-hed.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -770,7 +771,7 @@ These are tags that are ONLY allowed as children of HEAD:
title {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-ttl.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -778,7 +779,7 @@ title {
base {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-bas.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -786,7 +787,7 @@ base {
style {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-stl.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -794,7 +795,7 @@ style {
meta {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-met.gif);
background-repeat: no-repeat;
background-position: top left;
@@ -802,7 +803,7 @@ meta {
link {
min-height: 35px; margin-left: 2px; margin-top: 2px;
- padding-left: 16px;
+ padding-left: 17px;
background-image: url(chrome://editor/content/images/tag-lnk.gif);
background-repeat: no-repeat;
background-position: top left;
diff --git a/mozilla/editor/ui/composer/content/editor.js b/mozilla/editor/ui/composer/content/editor.js
index 908a20708e2..cd0a8896d0c 100644
--- a/mozilla/editor/ui/composer/content/editor.js
+++ b/mozilla/editor/ui/composer/content/editor.js
@@ -37,7 +37,7 @@ var DisplayModeNormal = 1;
var DisplayModeAllTags = 2;
var DisplayModeSource = 3;
var PreviousNonSourceDisplayMode = 1;
-var EditorDisplayMode = 1; // Normal Editor mode
+var gEditorDisplayMode = 1; // Normal Editor mode
var EditModeType = "";
var WebCompose = false; // Set true for Web Composer, leave false for Messenger Composer
var docWasModified = false; // Check if clean document, if clean then unload when user "Opens"
@@ -45,6 +45,7 @@ var gContentWindow = 0;
var gSourceContentWindow = 0;
var gContentWindowDeck;
var gFormatToolbar;
+var gEditModeBar;
// Bummer! Can't get at enums from nsIDocumentEncoder.h
var gOutputSelectionOnly = 1;
var gOutputFormatted = 2;
@@ -138,12 +139,13 @@ var DocumentStateListener =
function EditorStartup(editorType, editorElement)
{
- gContentWindow = window.content;
- gSourceContentWindow = document.getElementById("content-source");
gIsHTMLEditor = (editorType == "html");
if (gIsHTMLEditor)
{
+ gSourceContentWindow = document.getElementById("content-source");
+
+ gEditModeBar = document.getElementById("EditModeToolbar");
gEditModeLabel = document.getElementById("EditModeLabel");
gNormalModeButton = document.getElementById("NormalModeButton");
gTagModeButton = document.getElementById("TagModeButton");
@@ -152,7 +154,6 @@ function EditorStartup(editorType, editorElement)
// The "type" attribute persists, so use that value
// to setup edit mode buttons
-dump("Edit Mode: "+gNormalModeButton.getAttribute('type')+"\n");
ToggleEditModeType(gNormalModeButton.getAttribute("type"));
// XUL elements we use when switching from normal editor to edit source
@@ -160,12 +161,6 @@ dump("Edit Mode: "+gNormalModeButton.getAttribute('type')+"\n");
gFormatToolbar = document.getElementById("FormatToolbar");
}
- gIsWin = navigator.appVersion.indexOf("Win") != -1;
- gIsUNIX = (navigator.appVersion.indexOf("X11") ||
- navigator.appVersion.indexOf("nux")) != -1;
- gIsMac = !gIsWin && !gIsUNIX;
- dump("IsWin="+gIsWin+", IsUNIX="+gIsUNIX+", IsMac="+gIsMac+"\n");
-
// store the editor shell in the window, so that child windows can get to it.
editorShell = editorElement.editorShell;
@@ -173,17 +168,14 @@ dump("Edit Mode: "+gNormalModeButton.getAttribute('type')+"\n");
editorShell.SetEditorType(editorType);
editorShell.webShellWindow = window;
- editorShell.contentWindow = gContentWindow;
+ editorShell.contentWindow = window.content;
- // hide UI that we don't have components for
- HideInapplicableUIElements();
-
- // set up JS-implemented commands
- SetupControllerCommands();
-
// add a listener to be called when document is really done loading
editorShell.RegisterDocumentStateListener( DocumentStateListener );
-
+
+ // Startup also used by other editor users, such as Message Composer
+ EditorSharedStartup()
+
// set up our global prefs object
GetPrefsService();
@@ -193,6 +185,26 @@ dump("Edit Mode: "+gNormalModeButton.getAttribute('type')+"\n");
editorShell.LoadUrl(url);
}
+// This is the only method also called by Message Composer
+function EditorSharedStartup()
+{
+ // set up JS-implemented commands
+ SetupControllerCommands();
+
+ // Just for convenience
+ gContentWindow = window.content;
+
+ gIsWin = navigator.appVersion.indexOf("Win") != -1;
+ gIsUNIX = (navigator.appVersion.indexOf("X11") ||
+ navigator.appVersion.indexOf("nux")) != -1;
+ gIsMac = !gIsWin && !gIsUNIX;
+ dump("IsWin="+gIsWin+", IsUNIX="+gIsUNIX+", IsMac="+gIsMac+"\n");
+
+ // hide UI that we don't have components for
+ HideInapplicableUIElements();
+
+}
+
function _EditorNotImplemented()
{
dump("Function not implemented\n");
@@ -201,6 +213,7 @@ function _EditorNotImplemented()
function EditorShutdown()
{
dump("In EditorShutdown..\n");
+ return editorShell.Shutdown();
}
// We use this alot!
@@ -701,6 +714,13 @@ function SetEditMode(mode)
{
if (gIsHTMLEditor)
{
+ // Be sure toolbar is visible
+ gEditModeBar.setAttribute("hidden", "");
+ gEditModeBar.setAttribute("collapsed", "");
+ // Remember the state
+ document.persist("EditModeToolbar","hidden");
+ document.persist("EditModeToolbar","collapsed");
+
var bodyNode = editorShell.editorDocument.getElementsByTagName("body").item(0);
if (!bodyNode)
{
@@ -709,7 +729,7 @@ function SetEditMode(mode)
}
// Switch the UI mode before inserting contents
// so user can't type in source window while new window is being filled
- var previousMode = EditorDisplayMode;
+ var previousMode = gEditorDisplayMode;
if (!SetDisplayMode(mode))
return;
@@ -764,10 +784,10 @@ function SetDisplayMode(mode)
{
// Already in requested mode:
// return false to indicate we didn't switch
- if (mode == EditorDisplayMode)
+ if (mode == gEditorDisplayMode)
return false;
- EditorDisplayMode = mode;
+ gEditorDisplayMode = mode;
// Save the last non-source mode so we can cancel source editing easily
if (mode != DisplayModeSource)
@@ -788,7 +808,8 @@ function SetDisplayMode(mode)
// Switch to the sourceWindow (second in the deck)
gContentWindowDeck.setAttribute("index","1");
- // TODO: WE MUST DISABLE ALL KEYBOARD COMMANDS!
+ // TODO: WE MUST DISABLE APPROPRIATE COMMANDS
+ // and change UI to appropriate
// THIS DOESN'T WORK!
gSourceContentWindow.focus();
@@ -798,7 +819,8 @@ function SetDisplayMode(mode)
// Switch to the normal editor (first in the deck)
gContentWindowDeck.setAttribute("index","0");
- // TODO: WE MUST ENABLE ALL KEYBOARD COMMANDS!
+ // TODO: WE MUST ENABLE APPROPRIATE COMMANDS
+ // and change UI back to "normal"
gContentWindow.focus();
}
@@ -827,13 +849,16 @@ function ToggleEditModeType()
gTagModeButton.setAttribute("value","Show All Tags");
gSourceModeButton.setAttribute("value","HTML Source");
gPreviewModeButton.setAttribute("value","Edit Preview");
- gEditModeLabel.removeAttribute("hidden");
+ gEditModeLabel.setAttribute("hidden","");
}
gNormalModeButton.setAttribute("type",EditModeType);
gTagModeButton.setAttribute("type",EditModeType);
gSourceModeButton.setAttribute("type",EditModeType);
gPreviewModeButton.setAttribute("type",EditModeType);
+
+ // Remember the state
+ document.persist("NormalModeButton","type");
}
}
diff --git a/mozilla/editor/ui/composer/content/editorOverlay.xul b/mozilla/editor/ui/composer/content/editorOverlay.xul
index d16771aafdb..1cb42313ce9 100644
--- a/mozilla/editor/ui/composer/content/editorOverlay.xul
+++ b/mozilla/editor/ui/composer/content/editorOverlay.xul
@@ -545,18 +545,19 @@
-->
+