зеркало из https://github.com/mozilla/pjs.git
Fixed RegExp problems in forceInteger method , implemented JS for text and background color buttons relating to bug 21410 (but blocked by bug 23739). Fixed bug 18707. r=sfraser
This commit is contained in:
Родитель
a1ff78fcb1
Коммит
6a214caf31
|
@ -680,15 +680,18 @@ function EditorDecreaseFontSize()
|
|||
editorShell.DecreaseFontSize();
|
||||
}
|
||||
|
||||
function EditorSelectTextColor()
|
||||
function EditorSelectTextColor(ColorPickerID, ColorWellID)
|
||||
{
|
||||
|
||||
dump("EditorSelectTextColor\n");
|
||||
var color = getColorAndSetColorWell(ColorPickerID, ColorWellID);
|
||||
dump("EditorSelectTextColor: "+color+"\n");
|
||||
EditorSetFontColor(color);
|
||||
}
|
||||
|
||||
function EditorSelectBackColor()
|
||||
function EditorSelectBackColor(ColorPickerID, ColorWellID)
|
||||
{
|
||||
dump("EditorSelectBackColor\n");
|
||||
var color = getColorAndSetColorWell(ColorPickerID, ColorWellID);
|
||||
dump("EditorSelectBackColor: "+color+"\n");
|
||||
EditorSetBackgroundColor(color);
|
||||
}
|
||||
|
||||
function EditorSetFontColor(color)
|
||||
|
|
|
@ -61,8 +61,8 @@
|
|||
</broadcasterset>
|
||||
|
||||
<popupset>
|
||||
<popup id="TextColorPicker"/>
|
||||
<popup id="BackColorPicker"/>
|
||||
<popup id="TextColorPopup"/>
|
||||
<popup id="BackColorPopup"/>
|
||||
</popupset>
|
||||
|
||||
<!-- keys are appended from the overlay -->
|
||||
|
|
|
@ -573,17 +573,17 @@
|
|||
</menupopup>
|
||||
</menu>
|
||||
|
||||
<popup id="TextColorPicker" popupanchor="bottomleft">
|
||||
<popup id="TextColorPopup" popupanchor="bottomleft">
|
||||
<html:div id="TextColorCaption" class="color-caption" align="center">&textColorCaption.label;</html:div>
|
||||
<!-- TODO: Add "Last color picked" button and text -->
|
||||
<colorpicker palettename="standard" onclick="EditorSelectTextColor();"/>
|
||||
<colorpicker id="TextColorPicker" palettename="standard" onclick="EditorSelectTextColor('TextColorPicker','TextColorPopupButton')"/>
|
||||
</popup>
|
||||
|
||||
<popup id="BackColorPicker" popupanchor="bottomleft">
|
||||
<popup id="BackColorPopup" popupanchor="bottomleft">
|
||||
<!-- Text Caption is filled in at runtime -->
|
||||
<!-- TODO: Add "Last color picked" button and text -->
|
||||
<html:div id="BackColorCaption" class="color-caption" align="center">Background Color</html:div>
|
||||
<colorpicker palettename="standard" onclick="EditorSelectBackColor()"/>
|
||||
<colorpicker id="BackColorPicker" palettename="standard" onclick="EditorSelectBackColor('BackColorPicker','BackColorPopupButton')"/>
|
||||
</popup>
|
||||
|
||||
<menupopup id="AlignmentPopup">
|
||||
|
@ -676,8 +676,8 @@
|
|||
|
||||
<!-- The new Color Picker UI -->
|
||||
<html:div id="ColorButtons">
|
||||
<titledbutton id="TextColorPopupButton" popup="TextColorPicker"/>
|
||||
<titledbutton id="BackColorPopupButton" popup="BackColorPicker"/>
|
||||
<titledbutton id="TextColorPopupButton" popup="TextColorPopup"/>
|
||||
<titledbutton id="BackColorPopupButton" popup="BackColorPopup"/>
|
||||
</html:div>
|
||||
|
||||
<titledbutton id="DecreaseFontSizeButton" onclick="EditorDecreaseFontSize()"/>
|
||||
|
|
|
@ -367,19 +367,16 @@ function forceInteger(elementID)
|
|||
return;
|
||||
|
||||
var stringIn = editField.value;
|
||||
var pat = new RegExp("/\D+/g");
|
||||
if (pat.test(stringIn)) {
|
||||
dump("TEST SUCCEEDED\n")
|
||||
editField.value = stringIn.replace(pat,"");
|
||||
if (stringIn && stringIn.length > 0)
|
||||
{
|
||||
// Strip out all nonnumeric characters
|
||||
editField.value = stringIn.replace(/\D+/g,"");
|
||||
|
||||
// we hope to remove the following line for blur() once xp widgets land
|
||||
// cmanske (9/15) testing this now that GFX ender widget is active
|
||||
//editField.blur();
|
||||
sysBeep.Beep();
|
||||
}
|
||||
else {
|
||||
dump("TEST didn't SUCCEEDED\n")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -75,26 +75,12 @@ function Startup()
|
|||
// by AdvancedEdit(), which is shared by all property dialogs
|
||||
function InitDialog()
|
||||
{
|
||||
//******** Debuggin weird RegExp problems
|
||||
var stringIn = "123abc456";
|
||||
dump("Test string = "+stringIn+"\n");
|
||||
var pat = new RegExp("/\D+/g");
|
||||
if (pat.test(stringIn)) {
|
||||
var tempStr = stringIn.replace(pat,"");
|
||||
dump("Replaced pattern = "+tempStr+"\n");
|
||||
} else {
|
||||
dump("Failed test for nonnumeral characters\n");
|
||||
}
|
||||
//***************** end of test
|
||||
|
||||
|
||||
// Just to be confusing, "size" is used instead of height
|
||||
var height = globalElement.getAttribute("size");
|
||||
if(!height) {
|
||||
dump("NO SIZE FOUND FOR HLINE");
|
||||
height = 2; //Default value
|
||||
}
|
||||
dump("HLine size = "+height+"\n");
|
||||
|
||||
// We will use "height" here and in UI
|
||||
dialog.heightInput.value = height;
|
||||
|
|
Загрузка…
Ссылка в новой задаче