ckeditor内容跳转,震动或调整大小

时间:2017-12-25 20:38:59

标签: ckeditor

嘿,我真的可以使用一些帮助。

我正在使用ckeditor 4并且我最近注意到每当我有内容并且我将光标移动到内容的结尾并点击输入或进行移位输入时,整个内容会短暂地跳起来,可能是10-20px然后返回它应该在哪里。我启用了自动增长功能,我很确定它与ckeditor的resize方法有关,因为我试图排除自动增长并手动编写我自己的自动增长,同样的事情发生了。如果您的光标不在内容的最前端并且您点击了输入或shift + enter,则内容中没有跳转令人困惑......

我认为这可能与css有关。我使用我自己的自定义css文件并更改边距:正文标记中的20px到所有边的0px边距,而是放置10px的左右填充,因为我在IE中注意到如果单击段落的边距没有任何反应(否)选择,但如果你切换到填充而不是边距它很好。然而,当我将css切换回边距:20px时,我仍然有震动

这里是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;

这是表初始化

    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
}); 

这是我使用的自定义css文件的相关部分。我在这里修改了body标签样式,并创建了一个新的p标签样式。关于css文件的其他所有内容都与默认的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 */
}

非常感谢你的帮助。

PS我找到了一个链接https://dev.ckeditor.com/ticket/10981 有人似乎描述相同或类似的问题,但没有解决方案。

0 个答案:

没有答案