Forums

This topic is locked

removing image file path

Posted 17 Apr 2004 08:44:02
1
has voted
17 Apr 2004 08:44:02 William Moake posted:
I'm using IE's design mode for a WYSIWYG editor I'm assembling. The execCommand dialog for insert image places the absolute file path in the HTML for images. This has to be manually deleted before uploading the saved page to the web host, which isn't at all WYSIWYG.

For weeks I've been looking for a script to eliminate the file path from the image src tag, but I can't find anything that works client-side. I understand why it's necessary for an editor to use the file path to display an inserted image on the page under construction, but other WYSIWYG editors eliminate the path if the page is saved in the same folder/directory as the image. How is this done? I assume the script would have to be added to the execCommand(Save As) function.

Replies

Replied 17 Apr 2004 19:47:01
17 Apr 2004 19:47:01 Phil Shevlin replied:
I use htmlArea and just happened to see a reference in their forums to what you are trying to do:

You will see the comment
fix placeholder URLS - remove absolute paths that IE adds
in the code that is posted:

www.interactivetools.com/forum/gforum.cgi?post=4207;search_string=flash%20quotes;guest=5949945#4207

Hope that helps.
Replied 18 Apr 2004 03:12:50
18 Apr 2004 03:12:50 William Moake replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
I use htmlArea and just happened to see a reference in their forums to what you are trying to do:

You will see the comment
fix placeholder URLS - remove absolute paths that IE adds
in the code that is posted:

www.interactivetools.com/forum/gforum.cgi?post=4207;search_string=flash%20quotes;guest=5949945#4207

Hope that helps.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

It might if I can figure out what those $s mean. I'm fairly new to scripting, but $ looks more like server-side script than client-side javascript, which is what I need for an offline WYSIWYG editor.
Replied 18 Apr 2004 05:07:29
18 Apr 2004 05:07:29 Phil Shevlin replied:
its a pure javascript product. $1 and $2 relate to regilar expressions. They hold values.

www.webreference.com/js/column5/values.html
Replied 18 Apr 2004 23:02:27
18 Apr 2004 23:02:27 William Moake replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
its a pure javascript product. $1 and $2 relate to regilar expressions. They hold values.

www.webreference.com/js/column5/values.html
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

I assumed the file path fix had to go in the save function, but no matter where or how I tried to insert it, I got error messages. Mainly "tag undefined."

Any idea how I can plug this into the function below?

function saveFrame() {
var title = prompt("ENTER PAGE TITLE","My Page";
var html = iView.document.documentElement.outerHTML;
var html_txt = "&lt;html&gt;&lt;head&gt;&lt;title&gt;" + title + "&lt;/title&gt;&lt;/head&gt;\n";
html_txt += html + "\n&lt;/body&gt;&lt;/html&gt;";
iView.document.write(html_txt);
iView.document.execCommand('SaveAs',null,'index for homepage');
}

Also tried placing it in the insert image function with no better luck:

function insImg() {
iView.focus();
iView.document.execCommand('insertimage', true, null);
}
Replied 18 Apr 2004 23:36:26
18 Apr 2004 23:36:26 Phil Shevlin replied:
No, sorry. Thats why I use the freeware htmlArea.<img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>

Reply to this topic