{"action":"opened","issue":{"url":"https://api.github.com/repos/fex-team/umeditor/issues/348","repository_url":"https://api.github.com/repos/fex-team/umeditor","labels_url":"https://api.github.com/repos/fex-team/umeditor/issues/348/labels{/name}","comments_url":"https://api.github.com/repos/fex-team/umeditor/issues/348/comments","events_url":"https://api.github.com/repos/fex-team/umeditor/issues/348/events","html_url":"https://github.com/fex-team/umeditor/issues/348","id":170999631,"number":348,"title":"umeditor.js:3577 Discontiguous selection is not supported.","user":{"login":"easyfire","id":1153452,"avatar_url":"https://avatars.githubusercontent.com/u/1153452?v=3","gravatar_id":"","url":"https://api.github.com/users/easyfire","html_url":"https://github.com/easyfire","followers_url":"https://api.github.com/users/easyfire/followers","following_url":"https://api.github.com/users/easyfire/following{/other_user}","gists_url":"https://api.github.com/users/easyfire/gists{/gist_id}","starred_url":"https://api.github.com/users/easyfire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/easyfire/subscriptions","organizations_url":"https://api.github.com/users/easyfire/orgs","repos_url":"https://api.github.com/users/easyfire/repos","events_url":"https://api.github.com/users/easyfire/events{/privacy}","received_events_url":"https://api.github.com/users/easyfire/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-13T08:31:34Z","updated_at":"2016-08-13T08:31:34Z","closed_at":null,"body":"  _setup: function (cont) {\r\n            var me = this,\r\n                options = me.options;\r\n\r\n            cont.contentEditable = true;\r\n            document.body.spellcheck = false;\r\n\r\n            me.document = document;\r\n            me.window = document.defaultView || document.parentWindow;\r\n            me.body = cont;\r\n            me.$body = $(cont);\r\n            me.selection = new dom.Selection(document,me.body);\r\n            me._isEnabled = false;\r\n            //gecko初始化就能得到range,无法判断isFocus了\r\n            var geckoSel;\r\n            if (browser.gecko && (geckoSel = this.selection.getNative())) {\r\n                geckoSel.removeAllRanges();\r\n            }\r\n            this._initEvents();\r\n            //为form提交提供一个隐藏的textarea\r\n            for (var form = cont.parentNode; form && !domUtils.isBody(form); form = form.parentNode) {\r\n                if (form.tagName == 'FORM') {\r\n                    me.form = form;\r\n                    if(me.options.autoSyncData){\r\n                        $(cont).on('blur',function(){\r\n                            setValue(form,me);\r\n                        })\r\n                    }else{\r\n                        $(form).on('submit', function () {\r\n                            setValue(this, me);\r\n                        })\r\n                    }\r\n                    break;\r\n                }\r\n            }\r\n            if (options.initialContent) {\r\n                if (options.autoClearinitialContent) {\r\n                    var oldExecCommand = me.execCommand;\r\n                    me.execCommand = function () {\r\n                        me.fireEvent('firstBeforeExecCommand');\r\n                        return oldExecCommand.apply(me, arguments);\r\n                    };\r\n                    this._setDefaultContent(options.initialContent);\r\n                } else\r\n                    this.setContent(options.initialContent, false, true);\r\n            }\r\n\r\n            //编辑器不能为空内容\r\n\r\n            if (domUtils.isEmptyNode(me.body)) {\r\n                me.body.innerHTML = '<p>' + (browser.ie ? '' : '<br/>') + '</p>';\r\n            }\r\n            //如果要求focus, 就把光标定位到内容开始\r\n            if (options.focus) {\r\n                setTimeout(function () {\r\n                    me.focus(me.options.focusInEnd);\r\n                    //如果自动清除开着，就不需要做selectionchange;\r\n                    !me.options.autoClearinitialContent && me._selectionChange();\r\n                }, 0);\r\n            }\r\n            if (!me.container) {\r\n                me.container = cont.parentNode;\r\n            }\r\n\r\n            me._bindshortcutKeys();\r\n            me.isReady = 1;\r\n            me.fireEvent('ready');\r\n            options.onready && options.onready.call(me);\r\n            if(!browser.ie || browser.ie9above){\r\n\r\n                $(me.body).on( 'blur focus', function (e) {\r\n                    var nSel = me.selection.getNative();\r\n                    //chrome下会出现alt+tab切换时，导致选区位置不对\r\n                    if (e.type == 'blur') {\r\n                        if(nSel.rangeCount > 0 ){\r\n                            me._bakRange = nSel.getRangeAt(0);\r\n                        }\r\n                    } else {\r\n                        try {\r\n                           **me._bakRange && nSel.addRange(me._bakRange)**\r\n                        } catch (e) {\r\n                        }\r\n                        me._bakRange = null;\r\n                    }\r\n                });\r\n            }\r\n\r\n            !options.isShow && me.setHide();\r\n            options.readonly && me.setDisabled();\r\n        },"}}
{"actor":{"display_login":"easyfire"}}