Hi all,
I'm using jquery with ckeditor, and I'm trying to make it so that clicking on a div will turn it into an instance of ckeditor, in the same position as the div. The divs themselves are also moveable and resizable.
here's an example:
(currently seems to look best in Firefox)
http://undeen.com/simplecms/divedit.php
you'll see three divs, and "Edit Save Add" at the top.
click "Edit" and the three little squares appear on each div. the upper left square moves the div, the lower right resizes.
the upper right square turns the div into a ckeditor instance, and the ckeditor toolbars appear in the div that holds the "Edit Save Add" menu.
[this is all very ugly I know, while I try to work out these wrinkles]
My problem is, no matter how I move the div, when I create the ckeditor instance, it always appears in the upper left, under my heading.
the div that contains the ckeditor (the one we were moving around), has positioning information, but is now set to "display: none", and I can't seem to work out how to set the position of the editor container.
My current efforts (you can see in the source as well) involve something like:
var thing = div.ckeditor(function(){
this.container.$.css({
top: y,
left: x
});
$('#output').text( $('#output').text() + "<BR>" + this.container.$ );
},configs);
but that's no good, since apparently in that context css isn't a function.
any ideas on the proper way to do this?
many thanks.
Don Undeen
Thu, 01/27/2011 - 18:05
#1
Re: absolute positioning the editor with jquery
var style = "position: absolute; top: "+y+"px; left: "+x +"px; width:" +width + "; height: " + height + ";" ;
this.container.$.setAttribute("style",
style);
though I may be breaking other things, since I'm overriding any other style information there may be...
is this the right way to do it?
thanks!
Re: absolute positioning the editor with jquery
var thing = this.container.$;
$(thing).css({position: "absolute", top: y, left: x, height: h, width: w});
obviously x,y,w, and h are vars I've already set
(though chrome seems to have a min width, below which things get wierd)
in any case, that demo is still up in case anyone wants to see how I've done this, and comment.
cheers
Re: absolute positioning the editor with jquery