简体   繁体   English

bootstrap-wysiwyg失去焦点

[英]bootstrap-wysiwyg loses focus

I'm trying to implement bootstrap-wysiwyg editor in a project, but every time I click a button in the toolbar that has a dropdown the editor loses focus, meaning that, for example, it's impossible to add links because the text is not selected, and images are always added at the beginning of the content because the caret position in the editor was lost. 我正在尝试在项目中实现bootstrap-wysiwyg编辑器,但是每次我单击工具栏中具有下拉菜单的按钮时,编辑器都会失去焦点,这意味着,例如,由于未选择文本,因此无法添加链接,并且图像总是添加在内容的开头,因为丢失了编辑器中的插入符号位置。 This happens in Firefox and Chrome. 在Firefox和Chrome中会发生这种情况。 Here is the HTML code for the insert link button for example (quite similar to the editor documentation example, but not working) 例如,这是插入链接按钮的HTML代码(与编辑器文档示例非常相似,但不起作用)

<div class="panel panel-info">
    <div class="panel-heading">
        <div class="btn-toolbar" data-role="editor-toolbar" data-target="#editor">
            <div class="btn-group">
                <a class="btn btn-default dropdown-toggle" data-toggle="dropdown" title="Insert Link"><i class="fa fa-link text-primary"></i></a>
                <div class="dropdown-menu input-append">
                    <input class="form-control" type="text" data-edit="createLink" placeholder="URL" />
                    <button class="btn btn-success" type="button"><i class="fa fa-link"></i></button>
                </div>
            </div>
        </div>
    </div>
    <div class="panel-body">
        <div id="editor">

        </div>
    </div>
</div>

The only JS code is the editor hook: 唯一的JS代码是编辑器挂钩:

<script>
    $(document).ready(function () {
        $('#editor').wysiwyg();
    });
</script>

I'm using jQuery v2.1.4, Bootstrap v3.3.6, and bootstrap-wysiwyg v1.0.4 Thank you for your help. 我正在使用jQuery v2.1.4,Bootstrap v3.3.6和bootstrap-wysiwyg v1.0.4谢谢您的帮助。

The version of the bootstrap-wysiwyg that you are using is out of date. 您正在使用的bootstrap-wysiwyg的版本已过期。 This bug was fixed in the most recent version. 此错误已在最新版本中修复。 You can download it here . 您可以在这里下载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM