rails_kindeditor 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/app/uploaders/kindeditor/asset_uploader.rb +1 -1
  2. data/lib/rails_kindeditor/engine.rb +1 -1
  3. data/lib/rails_kindeditor/version.rb +1 -1
  4. data/rails_kindeditor.gemspec +0 -1
  5. data/vendor/assets/javascripts/kindeditor/kindeditor.js +122 -58
  6. data/vendor/assets/javascripts/kindeditor/lang/ar.js +16 -0
  7. data/vendor/assets/javascripts/kindeditor/lang/en.js +16 -0
  8. data/vendor/assets/javascripts/kindeditor/lang/zh_CN.js +23 -7
  9. data/vendor/assets/javascripts/kindeditor/lang/zh_TW.js +17 -1
  10. data/vendor/assets/javascripts/kindeditor/plugins/anchor/anchor.js +1 -1
  11. data/vendor/assets/javascripts/kindeditor/plugins/baidumap/baidumap.js +77 -0
  12. data/vendor/assets/javascripts/kindeditor/plugins/baidumap/map.html +43 -0
  13. data/vendor/assets/javascripts/kindeditor/plugins/code/prettify.css +13 -13
  14. data/vendor/assets/javascripts/kindeditor/plugins/code/prettify.js +28 -28
  15. data/vendor/assets/javascripts/kindeditor/plugins/filemanager/filemanager.js +1 -1
  16. data/vendor/assets/javascripts/kindeditor/plugins/filemanager/images/file-64.gif +0 -0
  17. data/vendor/assets/javascripts/kindeditor/plugins/filemanager/images/folder-64.gif +0 -0
  18. data/vendor/assets/javascripts/kindeditor/plugins/flash/flash.js +8 -4
  19. data/vendor/assets/javascripts/kindeditor/plugins/image/image.js +61 -40
  20. data/vendor/assets/javascripts/kindeditor/plugins/insertfile/insertfile.js +8 -5
  21. data/vendor/assets/javascripts/kindeditor/plugins/link/link.js +5 -5
  22. data/vendor/assets/javascripts/kindeditor/plugins/media/media.js +8 -3
  23. data/vendor/assets/javascripts/kindeditor/plugins/multiimage/images/image.png +0 -0
  24. data/vendor/assets/javascripts/kindeditor/plugins/multiimage/images/select-files-en.png +0 -0
  25. data/vendor/assets/javascripts/kindeditor/plugins/multiimage/images/select-files-zh_CN.png +0 -0
  26. data/vendor/assets/javascripts/kindeditor/plugins/multiimage/images/swfupload.swf +0 -0
  27. data/vendor/assets/javascripts/kindeditor/plugins/multiimage/multiimage.js +1368 -0
  28. data/vendor/assets/javascripts/kindeditor/plugins/table/table.js +2 -4
  29. data/vendor/assets/javascripts/kindeditor/plugins/template/html/1.html +13 -13
  30. data/vendor/assets/javascripts/kindeditor/plugins/template/html/2.html +41 -41
  31. data/vendor/assets/javascripts/kindeditor/plugins/template/html/3.html +35 -35
  32. data/vendor/assets/javascripts/kindeditor/themes/default/default.css +124 -5
  33. data/vendor/assets/javascripts/kindeditor/themes/default/default.png +0 -0
  34. data/vendor/assets/javascripts/kindeditor/themes/qq/editor.gif +0 -0
  35. data/vendor/assets/javascripts/kindeditor/themes/qq/qq.css +143 -0
  36. data/vendor/assets/javascripts/kindeditor/themes/simple/simple.css +100 -100
  37. metadata +12 -3
@@ -68,7 +68,7 @@ class Kindeditor::AssetUploader < CarrierWave::Uploader::Base
68
68
  end
69
69
 
70
70
  def filename
71
- @name ||= Time.now.to_s(:number)
71
+ @name ||= "#{Time.now.to_s(:number)}#{rand(100000)}"
72
72
  "#{@name}#{File.extname(original_filename).downcase}" if original_filename
73
73
  end
74
74
 
@@ -15,7 +15,7 @@ module RailsKindeditor
15
15
 
16
16
  initializer "rails_kindeditor.simple_form_and_formtastic" do
17
17
  require "rails_kindeditor/simple_form" if Object.const_defined?("SimpleForm")
18
- require "ckeditor/hooks/formtastic" if Object.const_defined?("Formtastic")
18
+ require "rails_kindeditor/formtastic" if Object.const_defined?("Formtastic")
19
19
  end
20
20
 
21
21
  initializer "rails_kindeditor.helper_and_builder" do
@@ -1,4 +1,4 @@
1
1
  module RailsKindeditor
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
4
4
 
@@ -19,6 +19,5 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  s.add_dependency("carrierwave")
22
- # s.add_dependency("carrierwave-mongoid")
23
22
  s.add_dependency("mini_magick")
24
23
  end
@@ -5,7 +5,7 @@
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.0.6 (2012-03-18)
8
+ * @version 4.1.1 (2012-06-10)
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.0.6 (2012-03-18)',
20
+ var _VERSION = '4.1.1 (2012-06-10)',
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,
@@ -226,7 +226,7 @@ K.basePath = '/assets/kindeditor/'; //_getBasePath(); ##### Modified by Macrow #
226
226
  K.options = {
227
227
  designMode : true,
228
228
  fullscreenMode : false,
229
- filterMode : false,
229
+ filterMode : true,
230
230
  wellFormatMode : true,
231
231
  shadowMode : true,
232
232
  loadStyleMode : true,
@@ -243,6 +243,7 @@ K.options = {
243
243
  pasteType : 2,
244
244
  dialogAlignType : 'page',
245
245
  useContextmenu : true,
246
+ fullscreenShortcut : true,
246
247
  bodyClass : 'ke-content',
247
248
  indentChar : '\t',
248
249
  cssPath : '',
@@ -251,13 +252,14 @@ K.options = {
251
252
  minHeight : 100,
252
253
  minChangeSize : 5,
253
254
  items : [
254
- 'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'cut', 'copy', 'paste',
255
+ 'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste',
255
256
  'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
256
257
  'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
257
258
  'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
258
259
  'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
259
- 'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image',
260
- 'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'map', 'code', 'pagebreak', 'anchor', 'link', 'unlink', '|', 'about'
260
+ 'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'multiimage',
261
+ 'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
262
+ 'anchor', 'link', 'unlink', '|', 'about'
261
263
  ],
262
264
  noDisableItems : ['source', 'fullscreen'],
263
265
  colorTable : [
@@ -634,6 +636,7 @@ function _formatCss(css) {
634
636
  }
635
637
  function _formatUrl(url, mode, host, pathname) {
636
638
  mode = _undef(mode, '').toLowerCase();
639
+ url = url.replace(/([^:])\/\//g, '$1/');
637
640
  if (_inArray(mode, ['absolute', 'relative', 'domain']) < 0) {
638
641
  return url;
639
642
  }
@@ -724,7 +727,7 @@ function _formatHtml(html, htmlTags, urlType, wellFormatted, indentChar) {
724
727
  html = html.replace(/(<(?:style|style\s[^>]*)>)([\s\S]*?)(<\/style>)/ig, '');
725
728
  }
726
729
  }
727
- var re = /(\s*)<(\/)?([\w\-:]+)((?:\s+|(?:\s+[\w\-:]+)|(?:\s+[\w\-:]+=[^\s"'<>]+)|(?:\s+[\w\-:"]+="[^"]*")|(?:\s+[\w\-:"]+='[^']*'))*)(\/)?>(\s*)/g;
730
+ var re = /([ \t\n\r]*)<(\/)?([\w\-:]+)((?:\s+|(?:\s+[\w\-:]+)|(?:\s+[\w\-:]+=[^\s"'<>]+)|(?:\s+[\w\-:"]+="[^"]*")|(?:\s+[\w\-:"]+='[^']*'))*)(\/)?>([ \t\n\r]*)/g;
728
731
  var tagStack = [];
729
732
  html = html.replace(re, function($0, $1, $2, $3, $4, $5, $6) {
730
733
  var full = $0,
@@ -925,6 +928,19 @@ function _mediaImg(blankPath, attrs) {
925
928
  html += 'data-ke-tag="' + escape(srcTag) + '" alt="" />';
926
929
  return html;
927
930
  }
931
+ function _tmpl(str, data) {
932
+ var fn = new Function("obj",
933
+ "var p=[],print=function(){p.push.apply(p,arguments);};" +
934
+ "with(obj){p.push('" +
935
+ str.replace(/[\r\t\n]/g, " ")
936
+ .split("<%").join("\t")
937
+ .replace(/((^|%>)[^\t]*)'/g, "$1\r")
938
+ .replace(/\t=(.*?)%>/g, "',$1,'")
939
+ .split("\t").join("');")
940
+ .split("%>").join("p.push('")
941
+ .split("\r").join("\\'") + "');}return p.join('');");
942
+ return data ? fn(data) : fn;
943
+ }
928
944
  K.formatUrl = _formatUrl;
929
945
  K.formatHtml = _formatHtml;
930
946
  K.getCssList = _getCssList;
@@ -934,6 +950,7 @@ K.mediaAttrs = _mediaAttrs;
934
950
  K.mediaEmbed = _mediaEmbed;
935
951
  K.mediaImg = _mediaImg;
936
952
  K.clearMsWord = _clearMsWord;
953
+ K.tmpl = _tmpl;
937
954
  function _contains(nodeA, nodeB) {
938
955
  if (nodeA.nodeType == 9 && nodeB.nodeType != 9) {
939
956
  return true;
@@ -1249,10 +1266,15 @@ function KNode(node) {
1249
1266
  _extend(KNode, {
1250
1267
  init : function(node) {
1251
1268
  var self = this;
1269
+ node = _isArray(node) ? node : [node];
1270
+ var length = 0;
1252
1271
  for (var i = 0, len = node.length; i < len; i++) {
1253
- self[i] = node[i].constructor === KNode ? node[i][0] : node[i];
1272
+ if (node[i]) {
1273
+ self[i] = node[i].constructor === KNode ? node[i][0] : node[i];
1274
+ length++;
1275
+ }
1254
1276
  }
1255
- self.length = node.length;
1277
+ self.length = length;
1256
1278
  self.doc = _getDoc(self[0]);
1257
1279
  self.name = _getNodeName(self[0]);
1258
1280
  self.type = self.length > 0 ? self[0].nodeType : null;
@@ -1329,7 +1351,7 @@ _extend(KNode, {
1329
1351
  if (this.length < 1) {
1330
1352
  return null;
1331
1353
  }
1332
- return new KNode([this[i]]);
1354
+ return this[i] ? new KNode(this[i]) : null;
1333
1355
  },
1334
1356
  hasClass : function(cls) {
1335
1357
  if (this.length < 1) {
@@ -1479,7 +1501,7 @@ _extend(KNode, {
1479
1501
  if (this.length < 1) {
1480
1502
  return new KNode([]);
1481
1503
  }
1482
- return new KNode([this[0].cloneNode(bool)]);
1504
+ return new KNode(this[0].cloneNode(bool));
1483
1505
  },
1484
1506
  append : function(expr) {
1485
1507
  this.each(function() {
@@ -1601,28 +1623,28 @@ _extend(KNode, {
1601
1623
  return null;
1602
1624
  }
1603
1625
  var node = this[0].parentNode;
1604
- return node ? new KNode([node]) : null;
1626
+ return node ? new KNode(node) : null;
1605
1627
  },
1606
1628
  children : function() {
1607
1629
  if (this.length < 1) {
1608
- return [];
1630
+ return new KNode([]);
1609
1631
  }
1610
1632
  var list = [], child = this[0].firstChild;
1611
1633
  while (child) {
1612
1634
  if (child.nodeType != 3 || _trim(child.nodeValue) !== '') {
1613
- list.push(new KNode([child]));
1635
+ list.push(child);
1614
1636
  }
1615
1637
  child = child.nextSibling;
1616
1638
  }
1617
- return list;
1639
+ return new KNode(list);
1618
1640
  },
1619
1641
  first : function() {
1620
1642
  var list = this.children();
1621
- return list.length > 0 ? list[0] : null;
1643
+ return list.length > 0 ? list.eq(0) : null;
1622
1644
  },
1623
1645
  last : function() {
1624
1646
  var list = this.children();
1625
- return list.length > 0 ? list[list.length - 1] : null;
1647
+ return list.length > 0 ? list.eq(list.length - 1) : null;
1626
1648
  },
1627
1649
  index : function() {
1628
1650
  if (this.length < 1) {
@@ -1640,14 +1662,14 @@ _extend(KNode, {
1640
1662
  return null;
1641
1663
  }
1642
1664
  var node = this[0].previousSibling;
1643
- return node ? new KNode([node]) : null;
1665
+ return node ? new KNode(node) : null;
1644
1666
  },
1645
1667
  next : function() {
1646
1668
  if (this.length < 1) {
1647
1669
  return null;
1648
1670
  }
1649
1671
  var node = this[0].nextSibling;
1650
- return node ? new KNode([node]) : null;
1672
+ return node ? new KNode(node) : null;
1651
1673
  },
1652
1674
  scan : function(fn, order) {
1653
1675
  if (this.length < 1) {
@@ -2095,7 +2117,7 @@ _extend(KRange, {
2095
2117
  }
2096
2118
  var children = knode.children();
2097
2119
  if (children.length > 0) {
2098
- return this.setStartBefore(children[0][0]).setEndAfter(children[children.length - 1][0]);
2120
+ return this.setStartBefore(children[0]).setEndAfter(children[children.length - 1]);
2099
2121
  }
2100
2122
  return this.setStart(node, 0).setEnd(node, 0);
2101
2123
  },
@@ -2281,10 +2303,10 @@ _extend(KRange, {
2281
2303
  }
2282
2304
  var left, right, child, offset;
2283
2305
  if (pos > 0) {
2284
- left = children[pos - 1];
2306
+ left = children.eq(pos - 1);
2285
2307
  }
2286
2308
  if (pos < children.length) {
2287
- right = children[pos];
2309
+ right = children.eq(pos);
2288
2310
  }
2289
2311
  if (left && left.type == 3) {
2290
2312
  child = left[0];
@@ -3454,9 +3476,14 @@ function _iframeDoc(iframe) {
3454
3476
  iframe = _get(iframe);
3455
3477
  return iframe.contentDocument || iframe.contentWindow.document;
3456
3478
  }
3479
+ var html, _direction = '';
3480
+ if ((html = document.getElementsByTagName('html'))) {
3481
+ _direction = html[0].dir;
3482
+ }
3457
3483
  function _getInitHtml(themesPath, bodyClass, cssPath, cssData) {
3458
3484
  var arr = [
3459
- '<html><head><meta charset="utf-8" /><title>KindEditor</title>',
3485
+ (_direction === '' ? '<html>' : '<html dir="' + _direction + '">'),
3486
+ '<head><meta charset="utf-8" /><title></title>',
3460
3487
  '<style>',
3461
3488
  'html {margin:0;padding:0;}',
3462
3489
  'body {margin:0;padding:5px;}',
@@ -3465,6 +3492,7 @@ function _getInitHtml(themesPath, bodyClass, cssPath, cssData) {
3465
3492
  'p {margin:5px 0;}',
3466
3493
  'table {border-collapse:collapse;}',
3467
3494
  'img {border:0;}',
3495
+ 'noscript {display:none;}',
3468
3496
  'table.ke-zeroborder td {border:1px dotted #AAA;}',
3469
3497
  'img.ke-flash {',
3470
3498
  ' border:1px solid #AAA;',
@@ -3495,7 +3523,7 @@ function _getInitHtml(themesPath, bodyClass, cssPath, cssData) {
3495
3523
  ' width:16px;',
3496
3524
  ' height:16px;',
3497
3525
  '}',
3498
- '.ke-script {',
3526
+ '.ke-script, .ke-noscript {',
3499
3527
  ' display:none;',
3500
3528
  ' font-size:0;',
3501
3529
  ' width:0;',
@@ -4037,27 +4065,34 @@ _extend(KUploadButton, {
4037
4065
  fieldName = options.fieldName || 'file',
4038
4066
  url = options.url || '',
4039
4067
  title = button.val(),
4068
+ extraParams = options.extraParams || {},
4040
4069
  cls = button[0].className || '',
4041
- target = 'kindeditor_upload_iframe_' + new Date().getTime();
4070
+ target = options.target || 'kindeditor_upload_iframe_' + new Date().getTime();
4042
4071
  options.afterError = options.afterError || function(str) {
4043
4072
  alert(str);
4044
4073
  };
4074
+ var hiddenElements = [];
4075
+ for(var k in extraParams){
4076
+ hiddenElements.push('<input type="hidden" name="' + k + '" value="' + extraParams[k] + '" />');
4077
+ }
4045
4078
  var html = [
4046
4079
  '<div class="ke-inline-block ' + cls + '">',
4047
- '<iframe name="' + target + '" style="display:none;"></iframe>',
4048
- '<form class="ke-upload-area ke-form" method="post" enctype="multipart/form-data" target="' + target + '" action="' + url + '">',
4080
+ (options.target ? '' : '<iframe name="' + target + '" style="display:none;"></iframe>'),
4081
+ (options.form ? '<div class="ke-upload-area">' : '<form class="ke-upload-area ke-form" method="post" enctype="multipart/form-data" target="' + target + '" action="' + url + '">'),
4049
4082
  '<span class="ke-button-common">',
4083
+ hiddenElements.join(''),
4050
4084
  '<input type="button" class="ke-button-common ke-button" value="' + title + '" />',
4051
4085
  '</span>',
4052
4086
  '<input type="file" class="ke-upload-file" name="' + fieldName + '" tabindex="-1" />',
4053
- '</form></div>'].join('');
4087
+ (options.form ? '</div>' : '</form>'),
4088
+ '</div>'].join('');
4054
4089
  var div = K(html, button.doc);
4055
4090
  button.hide();
4056
4091
  button.before(div);
4057
4092
  self.div = div;
4058
4093
  self.button = button;
4059
- self.iframe = K('iframe', div);
4060
- self.form = K('form', div);
4094
+ self.iframe = options.target ? K('iframe[name="' + target + '"]') : K('iframe', div);
4095
+ self.form = options.form ? K(options.form) : K('form', div);
4061
4096
  var width = options.width || K('.ke-button-common', div).width();
4062
4097
  self.fileBox = K('.ke-upload-file', div).width(width);
4063
4098
  self.options = options;
@@ -4195,6 +4230,7 @@ _extend(KDialog, KWidget, {
4195
4230
  self.footerDiv = footerDiv;
4196
4231
  self.bodyDiv = bodyDiv;
4197
4232
  self.headerDiv = headerDiv;
4233
+ self.isLoading = false;
4198
4234
  },
4199
4235
  setMaskIndex : function(z) {
4200
4236
  var self = this;
@@ -4207,11 +4243,13 @@ _extend(KDialog, KWidget, {
4207
4243
  .width(body.width()).height(body.height())
4208
4244
  .css('top', self.headerDiv.height() + 'px');
4209
4245
  body.css('visibility', 'hidden').after(self.loading);
4246
+ self.isLoading = true;
4210
4247
  return self;
4211
4248
  },
4212
4249
  hideLoading : function() {
4213
4250
  this.loading && this.loading.remove();
4214
4251
  this.bodyDiv.css('visibility', 'visible');
4252
+ this.isLoading = false;
4215
4253
  return this;
4216
4254
  },
4217
4255
  remove : function() {
@@ -4490,7 +4528,7 @@ function _bindNewlineEvent() {
4490
4528
  if (_GECKO && _V < 3 && newlineTag !== 'p') {
4491
4529
  return;
4492
4530
  }
4493
- if (_OPERA) {
4531
+ if (_OPERA && _V < 9) {
4494
4532
  return;
4495
4533
  }
4496
4534
  var brSkipTagMap = _toMap('h1,h2,h3,h4,h5,h6,pre,li'),
@@ -4516,7 +4554,7 @@ function _bindNewlineEvent() {
4516
4554
  }
4517
4555
  if (newlineTag === 'br' && !brSkipTagMap[tagName]) {
4518
4556
  e.preventDefault();
4519
- self.insertHtml('<br />');
4557
+ self.insertHtml('<br />' + (_IE && _V < 9 ? '' : '\u200B'));
4520
4558
  return;
4521
4559
  }
4522
4560
  if (!pSkipTagMap[tagName]) {
@@ -4650,6 +4688,13 @@ function KEditor(options) {
4650
4688
  setOption(key, val);
4651
4689
  }
4652
4690
  });
4691
+ var se = K(self.srcElement || '<textarea/>');
4692
+ if (!self.width) {
4693
+ self.width = se[0].style.width || se.width();
4694
+ }
4695
+ if (!self.height) {
4696
+ self.height = se[0].style.height || se.height();
4697
+ }
4653
4698
  setOption('width', _undef(self.width, self.minWidth));
4654
4699
  setOption('height', _undef(self.height, self.minHeight));
4655
4700
  setOption('width', _addUnit(self.width));
@@ -4657,7 +4702,6 @@ function KEditor(options) {
4657
4702
  if (_MOBILE && (!_IOS || _V < 534)) {
4658
4703
  self.designMode = false;
4659
4704
  }
4660
- var se = K(self.srcElement || '<textarea/>');
4661
4705
  self.srcElement = se;
4662
4706
  self.initContent = '';
4663
4707
  self.plugin = {};
@@ -5251,6 +5295,7 @@ KEditor.prototype = {
5251
5295
  function _editor(options) {
5252
5296
  return new KEditor(options);
5253
5297
  }
5298
+ _instances = [];
5254
5299
  function _create(expr, options) {
5255
5300
  options = options || {};
5256
5301
  options.basePath = _undef(options.basePath, K.basePath);
@@ -5272,19 +5317,20 @@ function _create(expr, options) {
5272
5317
  if (!knode) {
5273
5318
  return;
5274
5319
  }
5275
- options.srcElement = knode[0];
5276
- if (!options.width) {
5277
- options.width = knode[0].style.width || knode.width();
5278
- }
5279
- if (!options.height) {
5280
- options.height = knode[0].style.height || knode.height();
5320
+ if (knode.length > 1) {
5321
+ knode.each(function() {
5322
+ _create(this, options);
5323
+ });
5324
+ return _instances[0];
5281
5325
  }
5326
+ options.srcElement = knode[0];
5282
5327
  var editor = new KEditor(options);
5328
+ _instances.push(editor);
5283
5329
  if (_language[editor.langType]) {
5284
5330
  return create(editor);
5285
5331
  }
5286
5332
  _loadScript(editor.langPath + editor.langType + '.js?ver=' + encodeURIComponent(K.DEBUG ? _TIME : _VERSION), function() {
5287
- return create(editor);
5333
+ create(editor);
5288
5334
  });
5289
5335
  return editor;
5290
5336
  }
@@ -5294,6 +5340,7 @@ if (_IE && _V < 7) {
5294
5340
  K.EditorClass = KEditor;
5295
5341
  K.editor = _editor;
5296
5342
  K.create = _create;
5343
+ K.instances = _instances;
5297
5344
  K.plugin = _plugin;
5298
5345
  K.lang = _lang;
5299
5346
  _plugin('core', function(K) {
@@ -5355,25 +5402,27 @@ _plugin('core', function(K) {
5355
5402
  self.clickToolbar('fullscreen', function() {
5356
5403
  self.fullscreen();
5357
5404
  });
5358
- var loaded = false;
5359
- self.afterCreate(function() {
5360
- K(self.edit.doc, self.edit.textarea).keyup(function(e) {
5361
- if (e.which == 27) {
5362
- setTimeout(function() {
5363
- self.fullscreen();
5364
- }, 0);
5405
+ if (self.fullscreenShortcut) {
5406
+ var loaded = false;
5407
+ self.afterCreate(function() {
5408
+ K(self.edit.doc, self.edit.textarea).keyup(function(e) {
5409
+ if (e.which == 27) {
5410
+ setTimeout(function() {
5411
+ self.fullscreen();
5412
+ }, 0);
5413
+ }
5414
+ });
5415
+ if (loaded) {
5416
+ if (_IE && !self.designMode) {
5417
+ return;
5418
+ }
5419
+ self.focus();
5365
5420
  }
5366
- });
5367
- if (loaded) {
5368
- if (_IE && !self.designMode) {
5369
- return;
5421
+ if (!loaded) {
5422
+ loaded = true;
5370
5423
  }
5371
- self.focus();
5372
- }
5373
- if (!loaded) {
5374
- loaded = true;
5375
- }
5376
- });
5424
+ });
5425
+ }
5377
5426
  _each('undo,redo'.split(','), function(i, name) {
5378
5427
  if (shortcutKeys[name]) {
5379
5428
  self.afterCreate(function() {
@@ -5575,6 +5624,12 @@ _plugin('core', function(K) {
5575
5624
  K(this).after('<br />').remove(true);
5576
5625
  });
5577
5626
  K('span.Apple-style-span', div).remove(true);
5627
+ K('span.Apple-tab-span', div).remove(true);
5628
+ K('span[style]', div).each(function() {
5629
+ if (K(this).css('white-space') == 'nowrap') {
5630
+ K(this).remove(true);
5631
+ }
5632
+ });
5578
5633
  K('meta', div).remove();
5579
5634
  }
5580
5635
  var html = div[0].innerHTML;
@@ -5646,7 +5701,10 @@ _plugin('core', function(K) {
5646
5701
  });
5647
5702
  });
5648
5703
  self.beforeGetHtml(function(html) {
5649
- return html.replace(/<img[^>]*class="?ke-(flash|rm|media)"?[^>]*>/ig, function(full) {
5704
+ return html.replace(/(<(?:noscript|noscript\s[^>]*)>)([\s\S]*?)(<\/noscript>)/ig, function($0, $1, $2, $3) {
5705
+ return $1 + _unescape($2).replace(/\s+/g, ' ') + $3;
5706
+ })
5707
+ .replace(/<img[^>]*class="?ke-(flash|rm|media)"?[^>]*>/ig, function(full) {
5650
5708
  var imgAttrs = _getAttrList(full),
5651
5709
  styles = _getCssList(imgAttrs.style || ''),
5652
5710
  attrs = _mediaAttrs(imgAttrs['data-ke-tag']);
@@ -5661,6 +5719,9 @@ _plugin('core', function(K) {
5661
5719
  .replace(/<div\s+[^>]*data-ke-script-attr="([^"]*)"[^>]*>([\s\S]*?)<\/div>/ig, function(full, attr, code) {
5662
5720
  return '<script' + unescape(attr) + '>' + unescape(code) + '</script>';
5663
5721
  })
5722
+ .replace(/<div\s+[^>]*data-ke-noscript-attr="([^"]*)"[^>]*>([\s\S]*?)<\/div>/ig, function(full, attr, code) {
5723
+ return '<noscript' + unescape(attr) + '>' + unescape(code) + '</noscript>';
5724
+ })
5664
5725
  .replace(/(<[^>]*)data-ke-src="([^"]*)"([^>]*>)/ig, function(full, start, src, end) {
5665
5726
  full = full.replace(/(\s+(?:href|src)=")[^"]*(")/i, '$1' + src + '$2');
5666
5727
  full = full.replace(/\s+data-ke-src="[^"]*"/i, '');
@@ -5688,6 +5749,9 @@ _plugin('core', function(K) {
5688
5749
  .replace(/<script([^>]*)>([\s\S]*?)<\/script>/ig, function(full, attr, code) {
5689
5750
  return '<div class="ke-script" data-ke-script-attr="' + escape(attr) + '">' + escape(code) + '</div>';
5690
5751
  })
5752
+ .replace(/<noscript([^>]*)>([\s\S]*?)<\/noscript>/ig, function(full, attr, code) {
5753
+ return '<div class="ke-noscript" data-ke-noscript-attr="' + escape(attr) + '">' + escape(code) + '</div>';
5754
+ })
5691
5755
  .replace(/(<[^>]*)(href|src)="([^"]*)"([^>]*>)/ig, function(full, start, key, src, end) {
5692
5756
  if (full.match(/\sdata-ke-src="[^"]*"/i)) {
5693
5757
  return full;