ckeditor content jumps, shakes, or shifts up on resize - ckeditor

Hey I could really use some help.
I'm using ckeditor 4 and I've recently noticed whenever i have content and i move cursor to the end of content and hit enter or do a shift enter, the entire content briefly jumps up maybe 10-20px then lands back where it should be. I have autogrow enabled and I'm pretty sure it has something to do with ckeditor's resize method because i tried excluding autogrow and manually writing my own autogrow and the same thing happened. If your cursor is not at the immediate end of the content and you hit enter or shift+enter, there is NO jump in the content which is perplexing...
I thought it might have to do with the css. I use my own customized css file and changed the margin: 20px in the body tag to 0px margin all sides and instead put a left and right padding of 10px, because i noticed in IE if you click the margins of a paragraph nothing happens (no selection is made), but if you switch to padding instead of margin it works great. However when i switched the css back to margin: 20px only i still have the shake
here is config.js
config.removeButtons = '';
config.format_tags = 'p;h1;h2;h3;pre';
config.removeDialogTabs = 'image:advanced;link:advanced';
config.extraPlugins = 'autogrow,liststyle,dialog,panelbutton,colorbutton,justify,indent,indentlist,undo';
config.allowedContent = true;
config.removePlugins = 'resize,elementspath';
config.resize_enabled = false;
and here is the table initialization
replaceElem.html( "<texarea name='nLawTableRow" + uniqueRowId + "' class='cLawTextArea cLawTableRow" + uniqueRowId + "'>" + text + "</textarea>" );
// initialize the editor
var editor = CKEDITOR.replace( "nLawTableRow" + uniqueRowId, {
toolbar: [{ name: 'group1', items: [ 'Bold', 'Italic', 'Underline', /*'Superscript',*/ 'Strike', 'TextColor', 'BGColor' ]}, // temporarily remove superscript
{ name: 'group2', items: [ 'NumberedList', 'Indent', 'Outdent' ]}, // remove ordered list for now
{ name: 'group4', items: [ /*'Undo', 'Redo',*/ 'Maximize' ]},
],
autoGrow_onStartup: true, // grows the editor to fit its content when you ini it
autoGrow_minHeight: 0, // minimum height of the editor, setting it to 0 just means theres no min height, if there is no content height will not be
fillEmptyBlocks: false,
contentsCss: '/www/public/css/ckeditor_more.css', // get styles from this document instead of default
enterMode: 1, // enter creates a paragraph as well
});
and here is the relevant part of the custom css file I use. i modified the body tag style here and created a new p tag style as well. everything else about the css file is identical to the default contents.css
.cke_editable p {
margin-top: 14px !important;
margin-bottom: 14px !important;
}
body.cke_editable
{
/* Font */
font-family: sans-serif, Arial, Verdana, "Trebuchet MS";
font-size: 14px;
/* Text color */
color: #333;
/* Remove the background color to make it transparent */
background-color: #fff;
/* ME: set margins specifically, used to be margin: 20, now left and right 10, no top or bottom because paragraphs already have their own margins */
/* for left and right can't use margin have to use PADDING because in IE if you click on a margin instead of paragraph it doesnt make any selection, which
can make it very difficult to select start of a paragraph or far left of a a sentence. using paddding instead of margin solves that problem, hope it doesnt cause
other problems because the default is to use margin for left right which seems to work fine in Chrome but not IE I*/
margin-left: 0px !important;
margin-right: 0px !important;
padding-left: 10px !important;
padding-right: 10px !important;
margin-top: 0px !important;
margin-bottom: 0px !important;
overflow: hidden !important; /* ME: permantently prevents any scrollbars which can happen sometimes with page resize , maybe a bug */
}
Thanks a lot for the help.
PS I found a link https://dev.ckeditor.com/ticket/10981
where someone seems to describe the same or similar issue but there is no solution.

Related

Add custom arrow to Zurb-Foundation drop-down buttons

I created a button using Zurb Foundation styles and Sass mixins. I used #include dropdown-button($base-style:false); to get rid of the default arrow style. Now I want to insert my own arrow in its place (right side)
Here is the default button:
Here is my button now:
I want mine to look something like this:
Here is my html:
<a class="login width-limit" href="#" data-dropdown="drop">Client_Test_1 </a><br>
<ul id="drop" data-dropdown-content class="f-dropdown">
<li>Logout</li>
<li>Account Settings</li>
<li>Change SMTP Settings</li>
</ul>
Here is my scss:
.login {
#include grid-column(2);
#include button();
#include dropdown-button($base-style:false);
font-family: $font-stack;
font-size: .9em;
color: #fff;
background-color: $secondary-color;
height: 27px;
border-radius: 7px;
margin: 6px 0 5px 0;
padding: 5px 4px 5px 4px;
}
.width-limit {
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
-moz-box-sizing: border-box; /* Firefox, other Gecko */
box-sizing: border-box; /* Opera/IE 8+ */
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
padding-right: 2em; //shrink text
}
.login:hover {
background-color: $primary-color;
}
Here is a fiddle: http://jsfiddle.net/Yq5uU/
How can I add my own custom arrow to make it look like the third example?
Thanks in advance.
You can't make it infinitely long and not break page layout. So simple solution will be deciding how long it can get and setting button container to fill maximum amount of columns before it starts to look wired. Then you can align your button inside the container as you wish and if it gets too long you can replace part of the name with "..." css:overflow:hidden; text-overflow:ellipsis; or show the short form with js.
example: http://jsfiddle.net/z8aWL/2/
The grid column 2 mixin gives you this:
width: grid-calc($columns, $total-columns);
If you're using the default 12 grid, your inputs look like this:
width: grid-calc(2, 12);
The calc function returns the percentage of 2 divided by 12
width: 16.67%;
You are then overwriting that width value with 150px. If you're using default grid values for large rows, that should be closer to 167px wide.
You should avoid setting hard px values if you want to keep this responsive.
Now as for long names, you have two basic options. Either truncate names, by hiding overflow (as JAre suggested) or let crazy long names break your grid, but be contained in the button. Then you would need to not set a width. All the grid col mixin does is give you a width percentage. The row sets the value of the width (of which the col is a percentage). Your button is still contained in a row, so you should be good to go.
I think your best option, if you have access to your username database is to find the "worst case scenario" and design for that. Or better yet, have a shortened name value returned to your design in the first place.

HTML: white space around elements, how to remove?

My webpage contains several divs. Some are set to width: 100%, so they fill the whole page width.
But at the top of the page there is a small whitespace before the first element shows up. Moreover, that same whitespace is visible left and right from elements spanning the whole page width.
I cannot figure out why. If I set:
html, body {
width: 100%;
}
then the whitespace remains but the page is just stretched out to fit the image width of a div.
Can anyone help? It's probably pretty simple but I must be overlooking something.
Thank you.
EDIT: I must mention I'm using a parallax element. This uses a padding, so the image does fills the whole div and does not leave a black area on top. The HTML is:
<div class="js-background-1 container">
</div>
The CSS:
.container {
padding-top: 200px;
}
.js-background-1 {
background: transparent url(url/to/image) center 0 no-repeat;
}
And the javascript:
<script type="text/javascript">
var $window = $(window);
var velocity = 0.4;
function update(){
var pos = $window.scrollTop();
$('.container').each(function() {
var $element = $(this);
var height = $element.height();
$(this).css('backgroundPosition', '50% ' + Math.round((height - pos) * velocity) + 'px');
});
};
$window.bind('scroll', update);
</script>
I used the tutorial from http://www.webdesign.org/how-to-create-a-parallax-scrolling-website.22336.html, so there is where it is from. I changed the HTML a bit for my website, but the rest is the same.
I saw the comment about the margin and padding set to 0, but that leads to my div to have a blank space if you don't scroll far enough.
You must remove the margin on body:
body {
padding:0;
margin:0;
}
You can also remove padding and margin on html and body
html, body {
padding:0;
margin:0;
}
See it on jsfiddle
But I would not advise to use * (the universal selector)
* {
margin: 0px;
padding: 0px;
}
This would remove padding and margins on all elements.
The good method is to always use at the begining of the file (I forgot to metion this):
*{
margin: 0px;
padding: 0px;
}
This two line's at the begining of main CSS file fix many problem's that you can encounter.
Hope it'll help you.
padding-bottom: 20px;
border: 1px solid red !important;
margin: 0;
padding: 0;
width: 100%;

Make UL sub-menu appear behind its containing box that has a shadow effect

I have a header strip with a shadow effect and contains navigation links; when you hover over them, a sub-menu appears.
See test page here
How can I make the sub-menu appear on a layer BEHIND the header strip? I need the header's box shadow to cast on top of the sub-menu.
Currently the sub-menu ( .main-navigation li ul ) has a z-index lower than the header strip ( .site-header ) but this is having no effect. I've tried giving it a negative z-index but this puts it behind the content (therefore hidden) and the links no longer work - I've read this is a common problem so I'd like to avoid using a negative z-index.
Hope you can help.
Z-index might not be the solution in this case, due to the stacking context of elements. Without re-ordering your html, you might try this trick using box-shadow on a pseudo-element attached to your sub-menu. For example:
.main-navigation li ul { display: none; position: absolute; top: 100%; margin: 0; overflow: hidden; }
.main-navigation li ul:before { content: ""; display: block; width: 160%; height: 10px; margin-left: -30%; box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.2); }
Check this DEMO. Note that this is only one possible solution, as there are likely other ways to achieve the same effect.
The text content should already naturally appear behind the shadow of the header since it is an adjacent sibling element, ordered after the header in the html. (I added a background image to the content div in the demo to show this.)

Custom UI Element CSS Padding Issues

I have created a custom drop-down element, which is listed on this page:
http://jsfiddle.net/spryno724/2snUH/3/
Click on the drop-down menu in the "Result" secion, and you will see the problem. By rolling over the choices in the expanded drop-down list, you notice the roll-over indicators don't stretch to the available width.
While still maintaining the width of the menu when it was collapsed, how can I stretch the background color of each menu item? I'd also like each of the menu items to remain on their own line. A couple of adjustments that I made the CSS caused some of the list items to wrap their own text.
Thank you for your time.
Use negative margins with width: auto instead of width: 100% for items:
UL.dropdown.open LI {
margin: 0 -23px 0 -10px;
padding-right: 23px;
padding-left: 10px;
position: relative;
width: auto;
}
See http://jsfiddle.net/2snUH/4/ .
Or get rid of horizontal padding for UL (and specify horizontal padding for LI instead), and then you will not need negative margins for LI items.
To fix the width of the li elements use:
ul.dropdown.open {
padding: 5px 0;
}
ul.dropdown.open li {
display: block;
padding: 5px;
text-wrap: none;
width: 100%;
box-sizing: border-box;
}

Code to disable vertical scroll bar in jScroll Pane

Have seen that this piece of code could solve my problems but I don't know how or where to apply it to make it work correctly
JScrollPane.setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_NEVER);
If your aim is to hide the vertical scroll bar then use the following CSS property...
overflow-y: hidden;
In your CSS (RRD.css), you have...
.scroll-pane
{
width: 100%;
height: 670px;
overflow: hidden;
}
Try changing it to...
.scroll-pane
{
width: 100%;
height: 670px;
overflow-y: hidden;
}
More changes
And in your includes/jquery.jscrollpane.css change...
.jspPane
{
position: absolute;
width: 9660px;
}
to...
.jspPane
{
position: absolute;
width: 5880px;
}
This will remove the extended scrolling that is happening. And make sure your content-holder width is 5880px to match the jspPane scrolling ...
<div id="content-holder" style="width:5880px;">
The vertical scrollbar will not appear as long the content-holder div width is not less than the width of the content inside it. Think all your images in the content-holder div adds up to 5680px + you need to add the padding you apply as well.

Resources