Opened 13 years ago

Closed 11 years ago

#668 closed defect (fixed)

incorect image src handling when switching html<->WYSIWYG

Reported by: RBW Owned by: gogo
Priority: normal Milestone:
Component: Xinha Core Version: trunk
Severity: normal Keywords:
Cc:

Description

After inserting image and then swithing html/WYSIWYG modes, the path of the image becomes incorect.

Before insertion:
&lt;img height="60" alt="default.gif" src="test_img/default.gif" width="120" /&gt;

Behaviour in IE
After switching view modes it becomes
&lt;img height="60" alt="default.gif" src="xinha/test_img/default.gif" width="120" /&gt;
Then each change between WYSIWYG and html modes adds "xinha/" to the begining of the src string:
&lt;img height="60" alt="default.gif" src="xinha/xinha/test_img/default.gif" width="120" /&gt;

Behaviour in mozilla
After switching view modes it becomes
&lt;img height="60" alt="default.gif" src="xinha/xinha/plugins/ImageManager/../../../test_img/default.gif" width="120" /&gt;
and remains as such

The thing that solved this problem was to change htmlarea.js line 4375:
baseRe = new RegExp?(document.location.href.replace(/([\/]*\/?)$/, ).replace(HTMLArea.RE_Specials, '
$1'), 'g');
to
baseRe = new RegExp?(document.location.href.replace(HTMLArea.RE_Specials, '
$1'), 'g');

Change History (2)

comment:1 Changed 13 years ago by RBW

After inserting image and then swithing html/WYSIWYG modes, the path of the image becomes incorect.

Before insertion:
<img height="60" alt="default.gif" src="test_img/default.gif" width="120" />

Behaviour in IE
After switching view modes it becomes
<img height="60" alt="default.gif" src="xinha/test_img/default.gif" width="120" />
Then each change between WYSIWYG and html modes adds "xinha/" to the begining of the src string:
<img height="60" alt="default.gif" src="xinha/xinha/test_img/default.gif" width="120" />

Behaviour in mozilla
After switching view modes it becomes
<img height="60" alt="default.gif" src="xinha/xinha/plugins/ImageManager/../../../test_img/default.gif" width="120" />
and remains as such

The thing that solved this problem was to change htmlarea.js line 4375:
baseRe = new RegExp(document.location.href.replace(/([^\/]*\/?)$/, '').replace(HTMLArea.RE_Specials, '\\$1'), 'g');
to
baseRe = new RegExp(document.location.href.replace(HTMLArea.RE_Specials, '\\$1'), 'g');

comment:2 Changed 11 years ago by ray

  • Resolution set to fixed
  • Status changed from new to closed

There have been quite some changes on this part of the code, so I suppose this to fixed in the meantime

Note: See TracTickets for help on using tickets.