Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simditor报错The given range isn't in document. #510

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yanima
Copy link

@yanima yanima commented Dec 26, 2017

当我在angular中想使用simditor的插入链接功能是报错The given range isn't in document.

directive('editor', function () {
return {
restrict: 'A',
link: function (scope, element, attrs) {
let toolbar = ['title', 'bold', 'italic', 'underline', 'strikethrough', 'fontScale', 'color', '|', 'ol', 'ul', 'blockquote', 'code', 'table', '|', 'link', 'image', 'hr', '|', 'indent', 'outdent', 'alignment'];
let mobileToolbar = ["bold", "underline", "strikethrough", "color", "ul", "ol"];
let fileUrl = "/upload"

                var editor = new Simditor({
                    textarea: element,
                    toolbar: toolbar,
                    pasteImage: true,
                    //编辑器插入图片时使用的默认图片  
                    defaultImage: 'http://7xvm87.com1.z0.glb.clouddn.com/random@55684e0e77e',
                    upload: {
                        url: fileUrl, //文件上传的接口地址  
                        //键值对,指定文件上传接口的额外参数,上传的时候随文件一起提交  
                        params: { 'filename': 'versions' },
                        fileKey: 'file', //服务器端获取文件数据的参数名  
                        connectionCount: 3,
                        leaveConfirm: '正在上传文件',
                    }
                });                                   
                editor.setValue(element.val())

if (element.length > 0) {
function hide() {
editor.on('valuechanged', function (e) {
var index = element.eq(0).attr("id").split('')[1]
scope.content[index].Content = editor.getValue()
return element.html(editor.getValue());
});
editor.on('blur', function (e) {
var index = element.eq(0).attr("id").split('
')[1]
editor.setValue(scope.content[index].Content)
})
editor.on('focus', function (e) {
var index = element.eq(0).attr("id").split('_')[1]
editor.setValue(scope.content[index].Content)
})
}
return hide()

                }
            }

@bochen111
Copy link

该插件在ie9下面无法 粘贴文字内容

@lwsyc
Copy link

lwsyc commented Apr 12, 2018

simditor报错The given range isn't in document 这个问题太频繁了报的,不知道如何解决,不停的点击ul 在点击删除 很容易出现的

2 similar comments
@lwsyc
Copy link

lwsyc commented Apr 12, 2018

simditor报错The given range isn't in document 这个问题太频繁了报的,不知道如何解决,不停的点击ul 在点击删除 很容易出现的

@lwsyc
Copy link

lwsyc commented Apr 12, 2018

simditor报错The given range isn't in document 这个问题太频繁了报的,不知道如何解决,不停的点击ul 在点击删除 很容易出现的

@lwsyc
Copy link

lwsyc commented Apr 12, 2018

Uncaught TypeError: Cannot read property 'first' of undefined
at Object.* (simditor.js:1102)
at Keystroke.respondTo (simditor.js:1033)
at InputManager._onKeyDown (simditor.js:949)
at HTMLDivElement.f (jquery.min.js:2)
at HTMLDivElement.dispatch (jquery.min.js:3)
at HTMLDivElement.r.handle (jquery.min.js:3)

@lwsyc
Copy link

lwsyc commented Apr 12, 2018

官网的例子 随便点击一下,各种脚本错误,如上

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants