rtehtmlarea_bugfix_8431.patch

Administrator Admin, 2008-05-16 05:10

Download (4 kB)

 
typo3/sysext/rtehtmlarea/htmlarea/htmlarea-gecko.js (working copy)
3 3
*
4 4
*  (c) 2002-2004, interactivetools.com, inc.
5 5
*  (c) 2003-2004 dynarch.com
6
*  (c) 2004-2007 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
6
*  (c) 2004-2008 Stanislas Rolland <typo3(arobas)sjbr.ca>
7 7
*  All rights reserved
8 8
*
9 9
*  This script is part of the TYPO3 project. The TYPO3 project is
......
165 165
};
166 166

  
167 167
/*
168
 * Determine whether the node intersects the range
169
 */
170
HTMLArea.prototype.rangeIntersectsNode = function(range, node) {
171
	var nodeRange = this._doc.createRange();
172
	try {
173
		nodeRange.selectNode(node);
174
	} catch (e) {
175
		nodeRange.selectNodeContents(node);
176
	}
177
		// Note: sometimes Safari inverts the end points
178
	return (range.compareBoundaryPoints(range.END_TO_START, nodeRange) == -1 && range.compareBoundaryPoints(range.START_TO_END, nodeRange) == 1) ||
179
		(range.compareBoundaryPoints(range.END_TO_START, nodeRange) == 1 && range.compareBoundaryPoints(range.START_TO_END, nodeRange) == -1);
180
};
181

  
182
/*
168 183
 * Retrieve the HTML contents of selected block
169 184
 */
170 185
HTMLArea.prototype.getSelectedHTML = function() {
typo3/sysext/rtehtmlarea/htmlarea/htmlarea-ie.js (working copy)
3 3
*
4 4
*  (c) 2002-2004, interactivetools.com, inc.
5 5
*  (c) 2003-2004 dynarch.com
6
*  (c) 2004, 2005, 2006 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
6
*  (c) 2004-2008 Stanislas Rolland <typo3(arobas)sjbr.ca>
7 7
*  All rights reserved
8 8
*
9 9
*  This script is part of the TYPO3 project. The TYPO3 project is
......
134 134
};
135 135

  
136 136
/*
137
 * Determine whether the node intersects the range
138
 */
139
HTMLArea.prototype.rangeIntersectsNode = function(range, node) {
140
	var nodeRange = this._doc.body.createTextRange();
141
	nodeRange.moveToElementText(node);
142
	return (range.compareEndPoints("EndToStart", nodeRange) == -1 && range.compareEndPoints("StartToEnd", nodeRange) == 1) ||
143
		(range.compareEndPoints("EndToStart", nodeRange) == 1 && range.compareEndPoints("StartToEnd", nodeRange) == -1);
144
};
145

  
146
/*
137 147
 * Retrieve the HTML contents of selected block
138 148
 */
139 149
HTMLArea.prototype.getSelectedHTML = function() {
typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Browsers/typo3browsers.js (working copy)
1 1
/***************************************************************
2 2
*  Copyright notice
3 3
*
4
*  (c) 2005, 2006 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
4
*  (c) 2005-2008 Stanislas Rolland <typo3(arobas)sjbr.ca>
5 5
*  All rights reserved
6 6
*
7 7
*  This script is part of the TYPO3 project. The TYPO3 project is
......
176 176
	if (node.tagName && node.tagName.toLowerCase() == "a") {
177 177
		var nodeInRange = false;
178 178
		if (HTMLArea.is_gecko) {
179
			if(!HTMLArea.is_safari && !HTMLArea.is_opera) nodeInRange = range.intersectsNode(node);
180
				else nodeInRange = true;
179
			nodeInRange = this.rangeIntersectsNode(range, node);
181 180
		} else {
182 181
			if (this._getSelection().type.toLowerCase() == "control") {
183 182
					// we assume an image is selected
......
243 242
	if (node.tagName && node.tagName.toLowerCase() == "a") {
244 243
		var intersection = false;
245 244
		if (HTMLArea.is_gecko) {
246
			if (!HTMLArea.is_safari && !HTMLArea.is_opera) intersection = range.intersectsNode(node);
247
				else intersection = true;
245
			intersection = this.rangeIntersectsNode(range, node);
248 246
		} else {
249 247
			if (this._getSelection().type.toLowerCase() == "control") {
250 248
					// we assume an image is selected