2016-01-03 245 views
1

我使用NicEditor(http://nicedit.com)。调整大小窗口NicEditor

首先,我设置的文本域100%的宽度,但是当我调整窗口的大小,编辑保持不变,并不会调整到窗口的新宽度为100%。

<textarea style="width: 100%;"> something .. </textarea> 

<script> 
    //<![CDATA[ 
bkLib.onDomLoaded(function() { nicEditors.allTextAreas() }); 
//]]> 

</script> 

我该如何解决这个问题?

编辑: 我发现,有效的解决方案:

$(function() { 
     editor = new nicEditor({fullPanel : false}).panelInstance('text'); 
    }) 

    $(window).resize(function() { 
    editor.removeInstance('text'); 
    editor = new nicEditor({fullPanel : false}).panelInstance('text'); 
    }); 
+0

刷新niceEdit每个窗口大小调整! –

回答

1

默认情况下,尼斯编辑器或CK编辑器没有响应功能。

尝试类似下面。通过父元素控制宽度和高度。

<textarea id="comments" style="width:100%; height:100%;"></textarea> 

在每一个窗口大小调整,调用NiceEdit

JS:

var editor; 
    function reLoadEditor() { 
     editor.removeInstance('comments'); 
     editor = new nicEditor({fullPanel : false}).panelInstance('comments'); 
    }(); 

    $(window).resize(function() { 
    reLoadEditor(); 
    }); 

参考 - 演示3:添加/删除NicEditors:
http://nicedit.com/demos.php?demo=3

+0

这不起作用(http://kod.djpw.cz/dftb)。它仍然是一样的。 – user3529020

+0

检查你的小提琴! –

+0

我找到了一个解决方案。我编辑了这个问题。 – user3529020