Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WYSIWYG editor

Status
Not open for further replies.

youradds

Programmer
Jun 27, 2001
817
GB
Hi,

Ok, I've really really been struggling with this one :(

I'm using this editor on a site, and it works fine
...appart from one thing:

I'm doing this to let someone preview the page, before submitting it:

<input type="button" name="preview_detailed" value="Preview Detailed Page" class="submit" onclick="window.open('<%config.db_cgi_url%>/page.cgi?p=preview_detailed','Preview_Window','scrollbars=yes'); document.addform.add.disabled=false; "/>

How, this is all fine and dandy - appart from one thing. The TEXTAREA which is "Description_Long" doesn't have a value. The only time it has a value, is if I pre-populate the TEXTAREA in the HTML itself.

I took a look at their "preview.html page" , and they have the following HTML:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Preview</title>
</head>
<script type="text/javascript" src="../scripts/wysiwyg-popup.js"></script>
<script type="text/javascript">

function preview() {	
	// get params
	var n = WYSIWYG_Popup.getParam('wysiwyg');
	// set default styles
	WYSIWYG_Core.setAttribute(document.body, "style", WYSIWYG.config[n].DefaultStyle);
	// get content
	WYSIWYG_Table.disableHighlighting(n);
	var content = WYSIWYG.getEditorWindow(n).document.body.innerHTML;
	WYSIWYG_Table.refreshHighlighting(n);
	content = content.replace(/src="([^/|^http|^https])/gi, "src=\"../$1"); // correct relative image path
	content = content.replace(/href="([^/|^http|^https|^ftp])/gi, "href=\"../$1"); // correct relative anchor path
	// set content
	document.body.innerHTML = content;
}
</script>
<body onLoad="preview();">
</body>
</html>

I've tried doing a test, and adding


Code:
		<script type="text/javascript" src="/news/static/wysiwyg/scripts/wysiwyg.js"></script>
		<script type="text/javascript" src="/news/static/wysiwyg/scripts/wysiwyg-settings.js"></script>
<script type="text/javascript" src="/news/static/wysiwyg/scripts/wysiwyg-popup.js"></script>

<script>
function preview() {	
	// get params
	var n = WYSIWYG_Popup.getParam('wysiwyg');
	// set default styles
	WYSIWYG_Core.setAttribute(document.body, "style", WYSIWYG.config[n].DefaultStyle);
	// get content
	WYSIWYG_Table.disableHighlighting(n);
	var content = WYSIWYG.getEditorWindow(n).document.body.innerHTML;
	WYSIWYG_Table.refreshHighlighting(n);
	content = content.replace(/src="([^/|^http|^https])/gi, "src=\"../$1"); // correct relative image path
	content = content.replace(/href="([^/|^http|^https|^ftp])/gi, "href=\"../$1"); // correct relative anchor path
	// set content
	document.body.innerHTML = content;
}

preview();

</script>

...but I get this error:

Error: WYSIWYG.config[n] is undefined
Source File: Line: 220

The following works just fine for EVERYTHING appart from Description_Full:

window.opener.document.getElementById('Title').value

Has anyone got any suggestions - as I'm at a real dead end with this :(

TIA

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top