Add htmlarea http://www.htmlarea.com/ tool to appdb
This commit is contained in:
206
htmlarea/popups/old_insert_image.html
Normal file
206
htmlarea/popups/old_insert_image.html
Normal file
@@ -0,0 +1,206 @@
|
||||
<!-- based on insimage.dlg -->
|
||||
|
||||
|
||||
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML 3.2//EN">
|
||||
|
||||
<HTML id=dlgImage STYLE="width: 432px; height: 194px; ">
|
||||
|
||||
<HEAD>
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
|
||||
<meta http-equiv="MSThemeCompatible" content="Yes">
|
||||
|
||||
<TITLE>Insert Image</TITLE>
|
||||
|
||||
<style>
|
||||
|
||||
html, body, button, div, input, select, fieldset { font-family: MS Shell Dlg; font-size: 8pt; position: absolute; };
|
||||
|
||||
</style>
|
||||
|
||||
<SCRIPT defer>
|
||||
|
||||
|
||||
|
||||
function _CloseOnEsc() {
|
||||
|
||||
if (event.keyCode == 27) { window.close(); return; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function _getTextRange(elm) {
|
||||
|
||||
var r = elm.parentTextEdit.createTextRange();
|
||||
|
||||
r.moveToElementText(elm);
|
||||
|
||||
return r;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
window.onerror = HandleError
|
||||
|
||||
|
||||
|
||||
function HandleError(message, url, line) {
|
||||
|
||||
var str = "An error has occurred in this dialog." + "\n\n"
|
||||
|
||||
+ "Error: " + line + "\n" + message;
|
||||
|
||||
alert(str);
|
||||
|
||||
window.close();
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function Init() {
|
||||
|
||||
var elmSelectedImage;
|
||||
|
||||
var htmlSelectionControl = "Control";
|
||||
|
||||
var globalDoc = window.dialogArguments;
|
||||
|
||||
var grngMaster = globalDoc.selection.createRange();
|
||||
|
||||
|
||||
|
||||
// event handlers
|
||||
|
||||
document.body.onkeypress = _CloseOnEsc;
|
||||
|
||||
btnOK.onclick = new Function("btnOKClick()");
|
||||
|
||||
|
||||
|
||||
txtFileName.fImageLoaded = false;
|
||||
|
||||
txtFileName.intImageWidth = 0;
|
||||
|
||||
txtFileName.intImageHeight = 0;
|
||||
|
||||
|
||||
|
||||
if (globalDoc.selection.type == htmlSelectionControl) {
|
||||
|
||||
if (grngMaster.length == 1) {
|
||||
|
||||
elmSelectedImage = grngMaster.item(0);
|
||||
|
||||
if (elmSelectedImage.tagName == "IMG") {
|
||||
|
||||
txtFileName.fImageLoaded = true;
|
||||
|
||||
if (elmSelectedImage.src) {
|
||||
|
||||
txtFileName.value = elmSelectedImage.src.replace(/^[^*]*(\*\*\*)/, "$1"); // fix placeholder src values that editor converted to abs paths
|
||||
|
||||
txtFileName.intImageHeight = elmSelectedImage.height;
|
||||
|
||||
txtFileName.intImageWidth = elmSelectedImage.width;
|
||||
|
||||
txtVertical.value = elmSelectedImage.vspace;
|
||||
|
||||
txtHorizontal.value = elmSelectedImage.hspace;
|
||||
|
||||
txtBorder.value = elmSelectedImage.border;
|
||||
|
||||
txtAltText.value = elmSelectedImage.alt;
|
||||
|
||||
selAlignment.value = elmSelectedImage.align;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
txtFileName.value = txtFileName.value || "http://";
|
||||
|
||||
txtFileName.focus();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function _isValidNumber(txtBox) {
|
||||
|
||||
var val = parseInt(txtBox);
|
||||
|
||||
if (isNaN(val) || val < 0 || val > 999) { return false; }
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function btnOKClick() {
|
||||
|
||||
var elmImage;
|
||||
|
||||
var intAlignment;
|
||||
|
||||
var htmlSelectionControl = "Control";
|
||||
|
||||
var globalDoc = window.dialogArguments;
|
||||
|
||||
var grngMaster = globalDoc.selection.createRange();
|
||||
|
||||
|
||||
|
||||
// error checking
|
||||
|
||||
|
||||
|
||||
if (!txtFileName.value || txtFileName.value == "http://") {
|
||||
|
||||
alert("Image URL must be specified.");
|
||||
|
||||
txtFileName.focus();
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (txtHorizontal.value && !_isValidNumber(txtHorizontal.value)) {
|
||||
|
||||
alert("Horizontal spacing must be a number between 0 and 999.");
|
||||
|
||||
txtHorizontal.focus();
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (txtBorder.value && !_isValidNumber(txtBorder.value)) {
|
||||
|
||||
alert("Border thickness must be a number between 0 and 999.");
|
||||
|
||||
txtBorder.focus();
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (txtVertical.value && !_isValidNumber(txtVertical.value)) {
|
||||
|
||||
alert("Vertical spacing must be a number between 0 and 999.");
|
||||
|
||||
txtVertical.focus();
|
||||
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user