首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >NiceEdit单击issue

NiceEdit单击issue
EN

Stack Overflow用户
提问于 2016-03-10 19:50:44
回答 2查看 561关注 0票数 1

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

代码语言:javascript
复制
<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>

请帮帮忙。

EN

回答 2

Stack Overflow用户

发布于 2016-03-10 20:29:57

它是这样工作的。但是我不明白你想用下面的脚本做什么。

代码语言:javascript
复制
<script type="text/javascript">

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

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

下面是我的简单HTML。现在让我知道你到底想做什么。

代码语言:javascript
复制
<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>
票数 0
EN

Stack Overflow用户

发布于 2016-03-13 19:42:54

寻找这样的东西,只要告诉我,如果我在任何地方错了。

代码语言:javascript
复制
<html>
    <head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
    </head>
    <style type="text/css">
        .heightClass {
            min-height: 338px !important;
        }
        </style>
    <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() });
                //]]>
                $(document).on("focus" , ".nicEdit-selected" , function () {
                   var parentTag = $( this ).css("height" , "338px");
                   //$( this ).addClass("heightClass");
                   //alert(parentTag);
                });
            </script>
            <textarea id="demo" cols="50" id="editor" name="editor" style="width:295px;" >
            </textarea>
        </div>
    </body>
</html>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35915717

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档