#3486: fckpanel statick zindex problem
---------------------------------+------------------------------------------
Reporter: oddhenrik | Owner:
Type: Bug | Status: new
Priority: Normal | Milestone:
Component: UI : Floating Panel | Version: FCKeditor 2.6.4
Keywords: |
---------------------------------+------------------------------------------
Our AJAX framework uses a “bringElementToFront” function/algorithm witch
job it is to make sure that a panel, window or such that should be on top
in the zindex stack will be on top/have the highest zindex. The algorithm
basically traverses the relevant stacking context of the DOM and finds the
highest zindex, then return that + 1 (can provide code if you need it).
I then have two windows/panels with FCKeditor, and up on loading the
second window the above mentioned algorithm will find the
FloatingPanelsZIndex in the stacking context and give the new window a
higher zindex. This will then in turn result in style, format etc. drop
down panels being displayed with a lower zindex and such behind the
editor/current window/panel as seen in the picture.
So the FloatingPanelsZIndex setting is not the best all round solution.
This should probably be found dynamically as described above. Or at leaset
this could be an option.
Sugested solution:
So I implementet a somwhat crude function getNextHighestZindex (Thanks to
Jason J. Jaeger http://greengeckodesign.com/blog/2007/07/get-highest-z
-index-in-javascript.html):
{{{
function getNextHighestZindex(obj) {
var highestIndex = 0;
var currentIndex = 0;
var elArray = Array();
if (obj) { elArray = obj.getElementsByTagName('*'); } else { elArray =
document.getElementsByTagName('*'); }
for (var i = 0; i < elArray.length; i++) {
if (elArray[i].currentStyle) {
currentIndex = parseFloat(elArray[i].currentStyle['zIndex']);
} else if (window.getComputedStyle) {
currentIndex =
parseFloat(document.defaultView.getComputedStyle(elArray[i],
null).getPropertyValue('z-index'));
}
if (!isNaN(currentIndex) && currentIndex > highestIndex) {
highestIndex = currentIndex; }
}
return (highestIndex + 1);
}
}}}
Then changed fckpanel.js line 78, old code:
{{{
FCKDomTools.SetElementStyles( oIFrame,
{
position : 'absolute',
zIndex : FCKConfig.FloatingPanelsZIndex
} ) ;
}}}
New code:
{{{
FCKDomTools.SetElementStyles(D,
{
position: 'absolute',
zIndex: getNextHighestZindex(this._Window.document)
});
}}}
This solves the problem. However as I said this implementation is more to
the point of proof of concept. The function getNextHighestZindex is not a
very efficient way to do this. Using the concept of stacking context to
eliminate traversing all of the DOM is a better approach but more
complicated. Also maybe the root of the problem is to where in the DOM the
new panel is appended??
Hope you can look into this and find a good, robust and efficient
solution.
--
Ticket URL: <http://dev.fckeditor.net/ticket/3486>
FCKeditor <http://www.fckeditor.net/>
The text editor for Internet
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
FCKeditor-Trac mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fckeditor-trac