tinymce-rails 3.5.7.1 → 3.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,9 +6,9 @@
6
6
  var tinymce = {
7
7
  majorVersion : '3',
8
8
 
9
- minorVersion : '5.7',
9
+ minorVersion : '5.8',
10
10
 
11
- releaseDate : '2012-09-20',
11
+ releaseDate : '2012-11-20',
12
12
 
13
13
  _init : function() {
14
14
  var t = this, d = document, na = navigator, ua = na.userAgent, i, nl, n, base, p, v;
@@ -1098,7 +1098,7 @@ tinymce.create('static tinymce.util.XHR', {
1098
1098
 
1099
1099
  tinymce.util.Quirks = function(editor) {
1100
1100
  var VK = tinymce.VK, BACKSPACE = VK.BACKSPACE, DELETE = VK.DELETE, dom = editor.dom, selection = editor.selection,
1101
- settings = editor.settings, parser = editor.parser, serializer = editor.serializer;
1101
+ settings = editor.settings, parser = editor.parser, serializer = editor.serializer, each = tinymce.each;
1102
1102
 
1103
1103
  function setEditorCommandState(cmd, state) {
1104
1104
  try {
@@ -1128,40 +1128,48 @@ tinymce.util.Quirks = function(editor) {
1128
1128
  blockElm = dom.getParent(rng.startContainer, dom.isBlock);
1129
1129
 
1130
1130
  // On delete clone the root span of the next block element
1131
- if (isDelete)
1131
+ if (isDelete) {
1132
1132
  blockElm = dom.getNext(blockElm, dom.isBlock);
1133
+ }
1133
1134
 
1134
1135
  // Locate root span element and clone it since it would otherwise get merged by the "apple-style-span" on delete/backspace
1135
1136
  if (blockElm) {
1136
1137
  node = blockElm.firstChild;
1137
1138
 
1138
1139
  // Ignore empty text nodes
1139
- while (node && node.nodeType == 3 && node.nodeValue.length === 0)
1140
+ while (node && node.nodeType == 3 && node.nodeValue.length === 0) {
1140
1141
  node = node.nextSibling;
1142
+ }
1141
1143
 
1142
1144
  if (node && node.nodeName === 'SPAN') {
1143
1145
  clonedSpan = node.cloneNode(false);
1144
1146
  }
1145
1147
  }
1146
1148
 
1149
+ each(dom.select('span', blockElm), function(span) {
1150
+ span.setAttribute('data-mce-mark', '1');
1151
+ });
1152
+
1147
1153
  // Do the backspace/delete action
1148
1154
  editor.getDoc().execCommand(isDelete ? 'ForwardDelete' : 'Delete', false, null);
1149
1155
 
1150
1156
  // Find all odd apple-style-spans
1151
1157
  blockElm = dom.getParent(rng.startContainer, dom.isBlock);
1152
- tinymce.each(dom.select('span.Apple-style-span,font.Apple-style-span', blockElm), function(span) {
1158
+ each(dom.select('span', blockElm), function(span) {
1153
1159
  var bm = selection.getBookmark();
1154
1160
 
1155
1161
  if (clonedSpan) {
1156
1162
  dom.replace(clonedSpan.cloneNode(false), span, true);
1157
- } else {
1163
+ } else if (!span.getAttribute('data-mce-mark')) {
1158
1164
  dom.remove(span, true);
1165
+ } else {
1166
+ span.removeAttribute('data-mce-mark');
1159
1167
  }
1160
1168
 
1161
1169
  // Restore the selection
1162
1170
  selection.moveToBookmark(bm);
1163
1171
  });
1164
- };
1172
+ }
1165
1173
 
1166
1174
  editor.onKeyDown.add(function(editor, e) {
1167
1175
  var isDelete;
@@ -1315,7 +1323,7 @@ tinymce.util.Quirks = function(editor) {
1315
1323
  if (target !== editor.getBody()) {
1316
1324
  dom.setAttrib(target, "style", null);
1317
1325
 
1318
- tinymce.each(template, function(attr) {
1326
+ each(template, function(attr) {
1319
1327
  target.setAttributeNode(attr.cloneNode(true));
1320
1328
  });
1321
1329
  }
@@ -1565,7 +1573,7 @@ tinymce.util.Quirks = function(editor) {
1565
1573
 
1566
1574
  function addBrAfterLastLinks() {
1567
1575
  function fixLinks(editor, o) {
1568
- tinymce.each(dom.select('a'), function(node) {
1576
+ each(dom.select('a'), function(node) {
1569
1577
  var parentNode = node.parentNode, root = dom.getRoot();
1570
1578
 
1571
1579
  if (parentNode.lastChild === node) {
@@ -1633,7 +1641,7 @@ tinymce.util.Quirks = function(editor) {
1633
1641
  // IE10+
1634
1642
  if (getDocumentMode() >= 10) {
1635
1643
  emptyBlocksCSS = '';
1636
- tinymce.each('p div h1 h2 h3 h4 h5 h6'.split(' '), function(name, i) {
1644
+ each('p div h1 h2 h3 h4 h5 h6'.split(' '), function(name, i) {
1637
1645
  emptyBlocksCSS += (i > 0 ? ',' : '') + name + ':empty';
1638
1646
  });
1639
1647
 
@@ -1750,7 +1758,7 @@ tinymce.util.Quirks = function(editor) {
1750
1758
  width = height = 0;
1751
1759
  }
1752
1760
 
1753
- tinymce.each(resizeHandles, function(handle, name) {
1761
+ each(resizeHandles, function(handle, name) {
1754
1762
  var handleElm;
1755
1763
 
1756
1764
  // Get existing or render resize handle
@@ -1847,7 +1855,7 @@ tinymce.util.Quirks = function(editor) {
1847
1855
  var controlElm = dom.getParent(selection.getNode(), 'table,img');
1848
1856
 
1849
1857
  // Remove data-mce-selected from all elements since they might have been copied using Ctrl+c/v
1850
- tinymce.each(dom.select('img[data-mce-selected]'), function(img) {
1858
+ each(dom.select('img[data-mce-selected]'), function(img) {
1851
1859
  img.removeAttribute('data-mce-selected');
1852
1860
  });
1853
1861
 
@@ -3146,7 +3154,7 @@ tinymce.html.Styles = function(settings, schema) {
3146
3154
  value = name in fillAttrsMap ? name : decode(value || val2 || val3 || ''); // Handle boolean attribute than value attribute
3147
3155
 
3148
3156
  // Validate name and value
3149
- if (validate && !isInternalElement && name.indexOf('data-mce-') !== 0) {
3157
+ if (validate && !isInternalElement && name.indexOf('data-') !== 0) {
3150
3158
  attrRule = validAttributesMap[name];
3151
3159
 
3152
3160
  // Find rule by pattern matching
@@ -5209,6 +5217,11 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
5209
5217
  blockElementsMap = s.schema ? s.schema.getBlockElements() : {};
5210
5218
 
5211
5219
  t.isBlock = function(node) {
5220
+ // Fix for #5446
5221
+ if (!node) {
5222
+ return false;
5223
+ }
5224
+
5212
5225
  // This function is called in module pattern style since it might be executed with the wrong this scope
5213
5226
  var type = node.nodeType;
5214
5227
 
@@ -10318,6 +10331,16 @@ window.tinymce.dom.Sizzle = Sizzle;
10318
10331
  return self;
10319
10332
  },
10320
10333
 
10334
+ scrollIntoView: function(elm) {
10335
+ var y, viewPort, self = this, dom = self.dom;
10336
+
10337
+ viewPort = dom.getViewPort(self.editor.getWin());
10338
+ y = dom.getPos(elm).y;
10339
+ if (y < viewPort.y || y + 25 > viewPort.y + viewPort.h) {
10340
+ self.editor.getWin().scrollTo(0, y < viewPort.y ? y : y - viewPort.h + 25);
10341
+ }
10342
+ },
10343
+
10321
10344
  destroy : function(manual) {
10322
10345
  var self = this;
10323
10346
 
@@ -13667,10 +13690,12 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
13667
13690
  t.iframeHTML += '<base href="' + t.documentBaseURI.getURI() + '" />';
13668
13691
 
13669
13692
  // IE8 doesn't support carets behind images setting ie7_compat would force IE8+ to run in IE7 compat mode.
13670
- if (s.ie7_compat)
13671
- t.iframeHTML += '<meta http-equiv="X-UA-Compatible" content="IE=7" />';
13672
- else
13673
- t.iframeHTML += '<meta http-equiv="X-UA-Compatible" content="IE=edge" />';
13693
+ if (tinymce.isIE8) {
13694
+ if (s.ie7_compat)
13695
+ t.iframeHTML += '<meta http-equiv="X-UA-Compatible" content="IE=7" />';
13696
+ else
13697
+ t.iframeHTML += '<meta http-equiv="X-UA-Compatible" content="IE=edge" />';
13698
+ }
13674
13699
 
13675
13700
  t.iframeHTML += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
13676
13701
 
@@ -14300,9 +14325,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
14300
14325
  self.save();
14301
14326
 
14302
14327
  // defer the call to hide to prevent an IE9 crash #4921
14303
- setTimeout(function() {
14304
- DOM.hide(self.getContainer());
14305
- }, 1);
14328
+ DOM.hide(self.getContainer());
14306
14329
  DOM.setStyle(self.id, 'display', self.orgDisplay);
14307
14330
  },
14308
14331
 
@@ -14581,11 +14604,19 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
14581
14604
  },
14582
14605
 
14583
14606
  remove : function() {
14584
- var self = this, elm = self.getContainer();
14607
+ var self = this, elm = self.getContainer(), doc = self.getDoc();
14585
14608
 
14586
14609
  if (!self.removed) {
14587
14610
  self.removed = 1; // Cancels post remove event execution
14588
- self.hide();
14611
+
14612
+ // Fixed bug where IE has a blinking cursor left from the editor
14613
+ if (isIE && doc)
14614
+ doc.execCommand('SelectAll');
14615
+
14616
+ // We must save before we hide so Safari doesn't crash
14617
+ self.save();
14618
+
14619
+ DOM.setStyle(self.id, 'display', self.orgDisplay);
14589
14620
 
14590
14621
  // Don't clear the window or document if content editable
14591
14622
  // is enabled since other instances might still be present
@@ -15578,7 +15609,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
15578
15609
  // Add undo level on save contents, drag end and blur/focusout
15579
15610
  editor.onSaveContent.add(addNonTypingUndoLevel);
15580
15611
  editor.dom.bind(editor.dom.getRoot(), 'dragend', addNonTypingUndoLevel);
15581
- editor.dom.bind(editor.getDoc(), tinymce.isGecko ? 'blur' : 'focusout', function(e) {
15612
+ editor.dom.bind(editor.getBody(), 'focusout', function(e) {
15582
15613
  if (!editor.removed && self.typing) {
15583
15614
  addNonTypingUndoLevel();
15584
15615
  }
@@ -16941,6 +16972,11 @@ tinymce.ForceBlocks = function(editor) {
16941
16972
  function process(node) {
16942
16973
  var children, i, l, localContentEditable, lastContentEditable, hasContentEditableState;
16943
16974
 
16975
+ // Skip on text nodes as they have neither format to remove nor children
16976
+ if (node.nodeType === 3) {
16977
+ return;
16978
+ }
16979
+
16944
16980
  // Node has a contentEditable value
16945
16981
  if (node.nodeType === 1 && getContentEditable(node)) {
16946
16982
  lastContentEditable = contentEditable;
@@ -18755,7 +18791,7 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
18755
18791
 
18756
18792
  // Inserts a BR element if the forced_root_block option is set to false or empty string
18757
18793
  function insertBr() {
18758
- var brElm, extraBr;
18794
+ var brElm, extraBr, marker;
18759
18795
 
18760
18796
  if (container && container.nodeType == 3 && offset >= container.nodeValue.length) {
18761
18797
  // Insert extra BR element at the end block elements
@@ -18776,6 +18812,12 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
18776
18812
  brElm.parentNode.insertBefore(dom.doc.createTextNode('\r'), brElm);
18777
18813
  }
18778
18814
 
18815
+ // Insert temp marker and scroll to that
18816
+ marker = dom.create('span', {}, '&nbsp;');
18817
+ brElm.parentNode.insertBefore(marker, brElm);
18818
+ selection.scrollIntoView(marker);
18819
+ dom.remove(marker);
18820
+
18779
18821
  if (!extraBr) {
18780
18822
  rng.setStartAfter(brElm);
18781
18823
  rng.setEndAfter(brElm);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tinymce-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.7.1
4
+ version: 3.5.8
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-10-10 00:00:00.000000000 Z
12
+ date: 2012-11-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -77,7 +77,6 @@ files:
77
77
  - vendor/assets/javascripts/tinymce/plugins/autoresize/editor_plugin_src.js
78
78
  - vendor/assets/javascripts/tinymce/plugins/autosave/editor_plugin.js
79
79
  - vendor/assets/javascripts/tinymce/plugins/autosave/editor_plugin_src.js
80
- - vendor/assets/javascripts/tinymce/plugins/autosave/langs/en.js
81
80
  - vendor/assets/javascripts/tinymce/plugins/bbcode/editor_plugin.js
82
81
  - vendor/assets/javascripts/tinymce/plugins/bbcode/editor_plugin_src.js
83
82
  - vendor/assets/javascripts/tinymce/plugins/contextmenu/editor_plugin.js
@@ -1,4 +0,0 @@
1
- tinyMCE.addI18n('en.autosave',{
2
- restore_content: "Restore auto-saved content",
3
- warning_message: "If you restore the saved content, you will lose all the content that is currently in the editor.\n\nAre you sure you want to restore the saved content?"
4
- });