gpt4 book ai didi

javascript - Nice编辑点击问题

转载 作者:行者123 更新时间:2023-11-28 06:16:33 24 4
gpt4 key购买 nike

我通过加载网络浏览器并在其中加载 nicEditor 在我的 winforms 中使用了 nicEditor。默认情况下,当编辑器加载后,我单击编辑器中间,焦点不会转到 nicEditor。但是,如果我在编辑器的开头单击鼠标右键,焦点就会设置到编辑器。以下是我的 HTML 文件代码。

<html>
<head>
<script type="text/javascript">
var myInstance = "";
function GetContent() {
//window.alert(""+myInstance);
//var content = tinyMCE.get('tinyMceEditor').getContent();
//content = content.replace("<body>", "<body style=\"font-size:10px;\">");
//var content = nicEditors.get('area3').getContent();
var content = myInstance.instanceById('editor').getContent();
//window.alert(myInstance.instanceById('editor').getContent());
return content;
}
function SetContent(htmlContent) {
setTimeout(function () {
//window.alert(htmlContent);
//nicEditors.get('area3').setContent(htmlContent);
myInstance.instanceById('editor').setContent(htmlContent);

if (htmlContent == undefined || htmlContent == '')
myInstance.instanceById('editor').setContent('');

//tinyMCE.get('tinyMceEditor').readOnly = true;
}, 100);
}
</script>
<script type="text/javascript" src="jscripts/nicEdit.js"></script>
<script type="text/javascript">

bkLib.onDomLoaded(function () {
//myInstance = new nicEditor().panelInstance('editor');
myInstance = new nicEditor({ maxHeight: 388 }).panelInstance('editor');

//nicEditors.allTextAreas()
});
</script>
</head>
<body style="margin-top: 0px; margin-left: 0px;">
<div id="sample">
<textarea id="demo" cols="50" id="editor" name="editor" style="width:295px;" >
</textarea>
</div>
</body>
</html>

请帮忙。

最佳答案

它就是这样工作的。但我没有得到你想要使用下面的脚本做的事情。

<script type="text/javascript">

bkLib.onDomLoaded(function () {
//myInstance = new nicEditor().panelInstance('editor');
myInstance = new nicEditor({ maxHeight: 388 }).panelInstance('editor');

//nicEditors.allTextAreas()
});
</script>

这是我的简单 HTML 。现在让我知道您到底想做什么。

<html>
<head>
</head>
<body style="margin-top: 0px; margin-left: 0px;">
<div id="sample">
<script type="text/javascript" src="http://js.nicedit.com/nicEdit-latest.js"></script>
<script type="text/javascript">
//<![CDATA[
bkLib.onDomLoaded(function() { nicEditors.allTextAreas() });
//]]>

</script>
<textarea id="demo" cols="50" id="editor" name="editor" style="width:295px;" >
</textarea>
</div>
</body>
</html>

关于javascript - Nice编辑点击问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35915717/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com