rails_kindeditor 0.3.10 → 0.3.11

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -13,7 +13,7 @@ Deprecation: rails_kindeditor ~> v0.3.0 only support Rails3.1+!(include Rails3.1
13
13
  ### Add this to your Gemfile
14
14
 
15
15
  ```ruby
16
- gem 'rails_kindeditor', '~> 0.3.10'
16
+ gem 'rails_kindeditor', '~> 0.3.11'
17
17
  ```
18
18
 
19
19
  ### Run "bundle" command.
@@ -144,7 +144,7 @@ rails_kindeditor可以帮助你的rails程序集成kindeditor,包括了图片和
144
144
  ### 将下面代码加入Gemfile:
145
145
 
146
146
  ```ruby
147
- gem 'rails_kindeditor', '~> 0.3.10'
147
+ gem 'rails_kindeditor', '~> 0.3.11'
148
148
  ```
149
149
 
150
150
  ### 运行"bundle"命令:
@@ -1,4 +1,4 @@
1
1
  module RailsKindeditor
2
- VERSION = "0.3.10"
2
+ VERSION = "0.3.11"
3
3
  end
4
4
 
@@ -1,11 +1,11 @@
1
1
  /*******************************************************************************
2
2
  * KindEditor - WYSIWYG HTML Editor for Internet
3
- * Copyright (C) 2006-2012 kindsoft.net
3
+ * Copyright (C) 2006-2013 kindsoft.net
4
4
  *
5
5
  * @author Roddy <luolonghao@gmail.com>
6
6
  * @website http://www.kindsoft.net/
7
7
  * @licence http://www.kindsoft.net/license.php
8
- * @version 4.1.4 (2012-11-11)
8
+ * @version 4.1.5 (2013-01-20)
9
9
  *******************************************************************************/
10
10
  (function (window, undefined) {
11
11
  if (window.KindEditor) {
@@ -17,7 +17,7 @@ if (!window.console) {
17
17
  if (!console.log) {
18
18
  console.log = function () {};
19
19
  }
20
- var _VERSION = '4.1.4 (2012-11-11)',
20
+ var _VERSION = '4.1.5 (2013-01-20)',
21
21
  _ua = navigator.userAgent.toLowerCase(),
22
22
  _IE = _ua.indexOf('msie') > -1 && _ua.indexOf('opera') == -1,
23
23
  _GECKO = _ua.indexOf('gecko') > -1 && _ua.indexOf('khtml') == -1,
@@ -251,6 +251,7 @@ K.options = {
251
251
  minWidth : 650,
252
252
  minHeight : 100,
253
253
  minChangeSize : 50,
254
+ zIndex : 811213,
254
255
  items : [
255
256
  'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste',
256
257
  'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
@@ -2732,6 +2733,8 @@ _extend(KCmd, {
2732
2733
  rng = range.get(true);
2733
2734
  sel.removeAllRanges();
2734
2735
  sel.addRange(rng);
2736
+ var pos = K(rng.endContainer).pos();
2737
+ win.scrollTo(pos.x, pos.y);
2735
2738
  }
2736
2739
  win.focus();
2737
2740
  return self;
@@ -3535,7 +3538,7 @@ function _getInitHtml(themesPath, bodyClass, cssPath, cssData) {
3535
3538
  ' width:16px;',
3536
3539
  ' height:16px;',
3537
3540
  '}',
3538
- '.ke-script, .ke-noscript {',
3541
+ '.ke-script, .ke-noscript, .ke-display-none {',
3539
3542
  ' display:none;',
3540
3543
  ' font-size:0;',
3541
3544
  ' width:0;',
@@ -3631,6 +3634,13 @@ _extend(KEdit, KWidget, {
3631
3634
  }
3632
3635
  });
3633
3636
  }
3637
+ if (_IE) {
3638
+ K(document).mousedown(function() {
3639
+ if (cmd.range.isControl()) {
3640
+ self.blur();
3641
+ }
3642
+ });
3643
+ }
3634
3644
  if (_IE) {
3635
3645
  K(doc).keydown(function(e) {
3636
3646
  if (e.which == 8) {
@@ -3720,6 +3730,9 @@ _extend(KEdit, KWidget, {
3720
3730
  if (self.beforeSetHtml) {
3721
3731
  val = self.beforeSetHtml(val);
3722
3732
  }
3733
+ if (_IE && _V >= 9) {
3734
+ val = val.replace(/(<.*?checked=")checked(".*>)/ig, '$1$2');
3735
+ }
3723
3736
  K(body).html(val);
3724
3737
  if (self.afterSetHtml) {
3725
3738
  self.afterSetHtml();
@@ -4598,7 +4611,7 @@ function _bindNewlineEvent() {
4598
4611
  if (_GECKO) {
4599
4612
  var root = self.cmd.commonAncestor('p');
4600
4613
  var a = self.cmd.commonAncestor('a');
4601
- if (a.text() == '') {
4614
+ if (a && a.text() == '') {
4602
4615
  a.remove(true);
4603
4616
  self.cmd.range.selectNodeContents(root[0]).collapse(true);
4604
4617
  self.cmd.select();
@@ -5247,6 +5260,7 @@ KEditor.prototype = {
5247
5260
  pos = knode.pos();
5248
5261
  options.x = pos.x;
5249
5262
  options.y = pos.y + knode.height();
5263
+ options.z = self.options.zIndex;
5250
5264
  options.shadowMode = _undef(options.shadowMode, self.shadowMode);
5251
5265
  if (options.selectedColor !== undefined) {
5252
5266
  options.cls = 'ke-colorpicker-' + self.themeType;
@@ -5271,6 +5285,7 @@ KEditor.prototype = {
5271
5285
  },
5272
5286
  createDialog : function(options) {
5273
5287
  var self = this, name = options.name;
5288
+ options.z = self.options.zIndex;
5274
5289
  options.shadowMode = _undef(options.shadowMode, self.shadowMode);
5275
5290
  options.closeBtn = _undef(options.closeBtn, {
5276
5291
  name : self.lang('close'),
@@ -5699,7 +5714,11 @@ _plugin('core', function(K) {
5699
5714
  if (html === '') {
5700
5715
  return;
5701
5716
  }
5717
+ if (_WEBKIT) {
5718
+ html = html.replace(/(<br>)\1/ig, '$1');
5719
+ }
5702
5720
  if (self.pasteType === 2) {
5721
+ html = html.replace(/(<(?:p|p\s[^>]*)>) *(<\/p>)/ig, '');
5703
5722
  if (/schemas-microsoft-com|worddocument|mso-\w+/i.test(html)) {
5704
5723
  html = _clearMsWord(html, self.filterMode ? self.htmlTags : K.options.htmlTags);
5705
5724
  } else {
@@ -5708,15 +5727,15 @@ _plugin('core', function(K) {
5708
5727
  }
5709
5728
  }
5710
5729
  if (self.pasteType === 1) {
5730
+ html = html.replace(/&nbsp;/ig, ' ');
5731
+ html = html.replace(/\n\s*\n/g, '\n');
5711
5732
  html = html.replace(/<br[^>]*>/ig, '\n');
5712
5733
  html = html.replace(/<\/p><p[^>]*>/ig, '\n');
5713
5734
  html = html.replace(/<[^>]+>/g, '');
5714
- html = html.replace(/&nbsp;/ig, ' ');
5715
- html = html.replace(/\n\s*\n/g, '\n');
5716
5735
  html = html.replace(/ {2}/g, ' &nbsp;');
5717
5736
  if (self.newlineTag == 'p') {
5718
5737
  if (/\n/.test(html)) {
5719
- html = html.replace(/^/, '<p>').replace(/$/, '</p>').replace(/\n/g, '</p><p>');
5738
+ html = html.replace(/^/, '<p>').replace(/$/, '<br /></p>').replace(/\n/g, '<br /></p><p>');
5720
5739
  }
5721
5740
  } else {
5722
5741
  html = html.replace(/\n/g, '<br />$&');
@@ -5763,6 +5782,11 @@ _plugin('core', function(K) {
5763
5782
  });
5764
5783
  });
5765
5784
  self.beforeGetHtml(function(html) {
5785
+ if (_IE && _V <= 8) {
5786
+ html = html.replace(/<div\s+[^>]*data-ke-input-tag="([^"]*)"[^>]*>([\s\S]*?)<\/div>/ig, function(full, tag) {
5787
+ return unescape(tag);
5788
+ });
5789
+ }
5766
5790
  return html.replace(/(<(?:noscript|noscript\s[^>]*)>)([\s\S]*?)(<\/noscript>)/ig, function($0, $1, $2, $3) {
5767
5791
  return $1 + _unescape($2).replace(/\s+/g, ' ') + $3;
5768
5792
  })
@@ -5796,6 +5820,16 @@ _plugin('core', function(K) {
5796
5820
  });
5797
5821
  });
5798
5822
  self.beforeSetHtml(function(html) {
5823
+ if (_IE && _V <= 8) {
5824
+ html = html.replace(/<input[^>]*>|<(select|button)[^>]*>[\s\S]*?<\/\1>/ig, function(full) {
5825
+ var attrs = _getAttrList(full);
5826
+ var styles = _getCssList(attrs.style || '');
5827
+ if (styles.display == 'none') {
5828
+ return '<div class="ke-display-none" data-ke-input-tag="' + escape(full) + '"></div>';
5829
+ }
5830
+ return full;
5831
+ });
5832
+ }
5799
5833
  return html.replace(/<embed[^>]*type="([^"]+)"[^>]*>(?:<\/embed>)?/ig, function(full) {
5800
5834
  var attrs = _getAttrList(full);
5801
5835
  attrs.src = _undef(attrs.src, '');
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_kindeditor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.10
4
+ version: 0.3.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-19 00:00:00.000000000 Z
12
+ date: 2013-01-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: carrierwave