From 4aba3af98b57c26906a571204381428c7085e6e4 Mon Sep 17 00:00:00 2001 From: GuYue Date: Sat, 8 Feb 2014 14:32:53 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BD=BF=E6=8F=92=E5=85=A5=E5=A4=9A?= =?UTF-8?q?=E5=BC=A0=E5=9B=BE=E7=89=87=E5=92=8C=E6=8F=92=E5=85=A5=E5=8D=95?= =?UTF-8?q?=E5=BC=A0=E5=9B=BE=E7=89=87=E7=9A=84=E9=80=BB=E8=BE=91=E4=BF=9D?= =?UTF-8?q?=E6=8C=81=E4=B8=80=E8=87=B4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _src/plugins/image.js | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/_src/plugins/image.js b/_src/plugins/image.js index 5b53ca0b..dde3ff29 100755 --- a/_src/plugins/image.js +++ b/_src/plugins/image.js @@ -11,15 +11,8 @@ */ UM.commands['insertimage'] = { execCommand:function (cmd, opt) { - opt = utils.isArray(opt) ? opt : [opt]; - if (!opt.length) { - return; - } - var me = this; - var html = [], str = '', ci; - ci = opt[0]; - if (opt.length == 1) { - str = '' + ci.alt + ''; + } + + opt = utils.isArray(opt) ? opt : [opt]; + if (!opt.length) { + return; + } + var me = this; + var html = [], str = '', ci; + ci = opt[0]; + if (opt.length == 1) { + str = image(ci); if (ci['floatStyle'] == 'center') { str = '

' + str + '

'; } @@ -35,16 +39,11 @@ UM.commands['insertimage'] = { } else { for (var i = 0; ci = opt[i++];) { - str = '

'; + str = '

' + image(ci) + '

'; html.push(str); } } me.execCommand('insertHtml', html.join(''), true); } -}; \ No newline at end of file +}; From ebf77f46ef0ece5b8f9a2dcb91f4fe6e3fd95d0a Mon Sep 17 00:00:00 2001 From: GuYue Date: Tue, 11 Feb 2014 16:56:02 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=B7=BB=E5=8A=A0unselectable=E9=80=89?= =?UTF-8?q?=E9=A1=B9=E8=AE=BE=E7=BD=AE=EF=BC=8C=E4=BD=BF=E6=8F=92=E5=85=A5?= =?UTF-8?q?=E7=9A=84=E5=9B=BE=E7=89=87=E5=8F=AF=E4=BB=A5=E7=A6=81=E7=94=A8?= =?UTF-8?q?=E6=8B=96=E6=8B=BD=E6=94=BE=E5=A4=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _src/plugins/image.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/_src/plugins/image.js b/_src/plugins/image.js index dde3ff29..5950818b 100755 --- a/_src/plugins/image.js +++ b/_src/plugins/image.js @@ -12,10 +12,21 @@ UM.commands['insertimage'] = { execCommand:function (cmd, opt) { function image(ci) { + var style = ci['floatStyle'] == 'left' || ci['floatStyle'] == 'right' ? 'float:' + ci['floatStyle'] + ';' : ''; + + if (ci.unselectable) { + style += '-moz-user-select: none;' + /*火狐*/ + '-webkit-user-select: none;' + /*webkit浏览器*/ + '-ms-user-select: none;' + /*IE10*/ + '-khtml-user-select: none;' + /*早期浏览器*/ + 'user-select: none;'; + } + return '' + ci.alt + ' Date: Tue, 11 Feb 2014 17:01:50 +0800 Subject: [PATCH 3/5] =?UTF-8?q?insertimage=E6=B7=BB=E5=8A=A0unselectable?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=90=8E=EF=BC=8C=E5=90=8C=E6=AD=A5=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=AD=A4=E5=A4=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _src/adapter/imagescale.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/_src/adapter/imagescale.js b/_src/adapter/imagescale.js index 5cd006cd..f9fe1d80 100644 --- a/_src/adapter/imagescale.js +++ b/_src/adapter/imagescale.js @@ -64,11 +64,12 @@ UM.registerUI('imagescale',function () { }); me.addListener('click', function (type, e) { - if (e.target.tagName == 'IMG' && me.body.contentEditable!="false") { + // 使用unselectable属性(IE私有)标识是否可选 + if (e.target.tagName == 'IMG' && me.body.contentEditable!="false" && e.target.getAttribute('unselectable') !== 'on') { var range = new dom.Range(me.document, me.body); range.selectNode(e.target).select(); } }); } -}); \ No newline at end of file +}); From 06b9805c476b33b608ffad4a9446c7f237ebf415 Mon Sep 17 00:00:00 2001 From: GuYue Date: Tue, 11 Feb 2014 20:34:10 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E7=94=A8edui-unselectable=E7=B1=BB?= =?UTF-8?q?=E4=BB=A3=E6=9B=BFstyle=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _src/plugins/image.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/_src/plugins/image.js b/_src/plugins/image.js index 5950818b..a7641d39 100755 --- a/_src/plugins/image.js +++ b/_src/plugins/image.js @@ -14,16 +14,8 @@ UM.commands['insertimage'] = { function image(ci) { var style = ci['floatStyle'] == 'left' || ci['floatStyle'] == 'right' ? 'float:' + ci['floatStyle'] + ';' : ''; - if (ci.unselectable) { - style += '-moz-user-select: none;' + /*火狐*/ - '-webkit-user-select: none;' + /*webkit浏览器*/ - '-ms-user-select: none;' + /*IE10*/ - '-khtml-user-select: none;' + /*早期浏览器*/ - 'user-select: none;'; - } - return ' Date: Tue, 11 Feb 2014 20:36:34 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=A2=9E=E5=8A=A0.edui-unselectable?= =?UTF-8?q?=E9=80=9A=E7=94=A8=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/default/_css/editor.css | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/themes/default/_css/editor.css b/themes/default/_css/editor.css index aac7c387..febacda5 100755 --- a/themes/default/_css/editor.css +++ b/themes/default/_css/editor.css @@ -36,4 +36,11 @@ } .edui-editor-body.focus{border:1px solid #5c9dff} .edui-editor-body table{margin:10px 0 10px;border-collapse:collapse;display:table;} -.edui-editor-body td{padding: 5px 10px;border: 1px solid #DDD;} \ No newline at end of file +.edui-editor-body td{padding: 5px 10px;border: 1px solid #DDD;} +.edui-unselectable{ + -moz-user-select: none; + -webkit-user-select: none; + -ms-user-select: none; + -khtml-user-select: none; + user-select: none; +}