tinymce-rails 3.5.5 → 3.5.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,9 +6,9 @@
6
6
  var tinymce = {
7
7
  majorVersion : '3',
8
8
 
9
- minorVersion : '5.5',
9
+ minorVersion : '5.6',
10
10
 
11
- releaseDate : '2012-07-19',
11
+ releaseDate : '2012-07-26',
12
12
 
13
13
  _init : function() {
14
14
  var t = this, d = document, na = navigator, ua = na.userAgent, i, nl, n, base, p, v;
@@ -1566,7 +1566,7 @@ tinymce.util.Quirks = function(editor) {
1566
1566
  }
1567
1567
 
1568
1568
  function isSelectionAcrossElements() {
1569
- return !selection.isCollapsed() && selection.getStart() != selection.getEnd();
1569
+ return !selection.isCollapsed() && dom.getParent(selection.getStart(), dom.isBlock) != dom.getParent(selection.getEnd(), dom.isBlock);
1570
1570
  }
1571
1571
 
1572
1572
  function blockEvent(editor, e) {
@@ -1885,7 +1885,7 @@ tinymce.util.Quirks = function(editor) {
1885
1885
  };
1886
1886
 
1887
1887
  function fakeImageResize() {
1888
- var selectedElmX, selectedElmY, selectedElm, selectedElmGhost, selectedHandle, startX, startY, startW, startH,
1888
+ var selectedElmX, selectedElmY, selectedElm, selectedElmGhost, selectedHandle, startX, startY, startW, startH, ratio,
1889
1889
  resizeHandles, width, height, rootDocument = document, editableDoc = editor.getDoc();
1890
1890
 
1891
1891
  if (!settings.object_resizing || settings.webkit_fake_resize === false) {
@@ -1909,27 +1909,26 @@ tinymce.util.Quirks = function(editor) {
1909
1909
  };
1910
1910
 
1911
1911
  function resizeElement(e) {
1912
- var deltaX, deltaY, ratio;
1912
+ var deltaX, deltaY;
1913
1913
 
1914
1914
  // Calc new width/height
1915
1915
  deltaX = e.screenX - startX;
1916
1916
  deltaY = e.screenY - startY;
1917
- ratio = Math.max((startW + deltaX) / startW, (startH + deltaY) / startH);
1918
1917
 
1919
- if (VK.modifierPressed(e)) {
1920
- // Constrain proportions
1921
- width = Math.round(startW * ratio);
1922
- height = Math.round(startH * ratio);
1923
- } else {
1924
- // Calc new size
1925
- width = deltaX * selectedHandle[2] + startW;
1926
- height = deltaY * selectedHandle[3] + startH;
1927
- }
1918
+ // Calc new size
1919
+ width = deltaX * selectedHandle[2] + startW;
1920
+ height = deltaY * selectedHandle[3] + startH;
1928
1921
 
1929
1922
  // Never scale down lower than 5 pixels
1930
1923
  width = width < 5 ? 5 : width;
1931
1924
  height = height < 5 ? 5 : height;
1932
1925
 
1926
+ // Constrain proportions when modifier key is pressed or if the nw, ne, sw, se corners are moved on an image
1927
+ if (VK.modifierPressed(e) || (selectedElm.nodeName == "IMG" && selectedHandle[2] * selectedHandle[3] !== 0)) {
1928
+ width = Math.round(height / ratio);
1929
+ height = Math.round(width * ratio);
1930
+ }
1931
+
1933
1932
  // Update ghost size
1934
1933
  dom.setStyles(selectedElmGhost, {
1935
1934
  width: width,
@@ -1938,12 +1937,12 @@ tinymce.util.Quirks = function(editor) {
1938
1937
 
1939
1938
  // Update ghost X position if needed
1940
1939
  if (selectedHandle[2] < 0 && selectedElmGhost.clientWidth <= width) {
1941
- dom.setStyle(selectedElmGhost, 'left', selectedElmX + deltaX);
1940
+ dom.setStyle(selectedElmGhost, 'left', selectedElmX + (startW - width));
1942
1941
  }
1943
1942
 
1944
1943
  // Update ghost Y position if needed
1945
1944
  if (selectedHandle[3] < 0 && selectedElmGhost.clientHeight <= height) {
1946
- dom.setStyle(selectedElmGhost, 'top', selectedElmY + deltaY);
1945
+ dom.setStyle(selectedElmGhost, 'top', selectedElmY + (startH - height));
1947
1946
  }
1948
1947
  }
1949
1948
 
@@ -2015,6 +2014,7 @@ tinymce.util.Quirks = function(editor) {
2015
2014
  startY = e.screenY;
2016
2015
  startW = selectedElm.clientWidth;
2017
2016
  startH = selectedElm.clientHeight;
2017
+ ratio = startH / startW;
2018
2018
  selectedHandle = handle;
2019
2019
 
2020
2020
  selectedElmGhost = selectedElm.cloneNode(true);
@@ -5984,7 +5984,7 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
5984
5984
  styleElm.id = 'mceDefaultStyles';
5985
5985
  styleElm.type = 'text/css';
5986
5986
 
5987
- head = doc.getElementsByTagName('head')[0]
5987
+ head = doc.getElementsByTagName('head')[0];
5988
5988
  if (head.firstChild) {
5989
5989
  head.insertBefore(styleElm, head.firstChild);
5990
5990
  } else {
@@ -13095,7 +13095,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
13095
13095
  },
13096
13096
 
13097
13097
  getContent : function(args) {
13098
- var self = this, content;
13098
+ var self = this, content, body = self.getBody();
13099
13099
 
13100
13100
  // Setup args object
13101
13101
  args = args || {};
@@ -13109,11 +13109,18 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
13109
13109
 
13110
13110
  // Get raw contents or by default the cleaned contents
13111
13111
  if (args.format == 'raw')
13112
- content = self.getBody().innerHTML;
13112
+ content = body.innerHTML;
13113
+ else if (args.format == 'text')
13114
+ content = body.innerText || body.textContent;
13113
13115
  else
13114
- content = self.serializer.serialize(self.getBody(), args);
13116
+ content = self.serializer.serialize(body, args);
13115
13117
 
13116
- args.content = tinymce.trim(content);
13118
+ // Trim whitespace in beginning/end of HTML
13119
+ if (args.format != 'text') {
13120
+ args.content = tinymce.trim(content);
13121
+ } else {
13122
+ args.content = content;
13123
+ }
13117
13124
 
13118
13125
  // Do post processing
13119
13126
  if (!args.no_events)
@@ -14447,6 +14454,14 @@ tinymce.ForceBlocks = function(editor) {
14447
14454
  node = rootNode.firstChild;
14448
14455
  while (node) {
14449
14456
  if (node.nodeType === 3 || (node.nodeType == 1 && !blockElements[node.nodeName])) {
14457
+ // Remove empty text nodes
14458
+ if (node.nodeType === 3 && node.nodeValue.length == 0) {
14459
+ tempNode = node;
14460
+ node = node.nextSibling;
14461
+ dom.remove(tempNode);
14462
+ continue;
14463
+ }
14464
+
14450
14465
  if (!rootBlockNode) {
14451
14466
  rootBlockNode = dom.create(settings.forced_root_block);
14452
14467
  node.parentNode.insertBefore(rootBlockNode, node);
@@ -17403,7 +17418,7 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
17403
17418
  if (container && container.nodeType == 3 && offset >= container.nodeValue.length) {
17404
17419
  // Insert extra BR element at the end block elements
17405
17420
  if (!tinymce.isIE && !hasRightSideBr()) {
17406
- brElm = dom.create('br')
17421
+ brElm = dom.create('br');
17407
17422
  rng.insertNode(brElm);
17408
17423
  rng.setStartAfter(brElm);
17409
17424
  rng.setEndAfter(brElm);
@@ -17488,7 +17503,7 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
17488
17503
  // Setup range items and newBlockName
17489
17504
  container = rng.startContainer;
17490
17505
  offset = rng.startOffset;
17491
- newBlockName = settings.forced_root_block;
17506
+ newBlockName = (settings.force_p_newlines ? 'p' : '') || settings.forced_root_block;
17492
17507
  newBlockName = newBlockName ? newBlockName.toUpperCase() : '';
17493
17508
  documentMode = dom.doc.documentMode;
17494
17509
  shiftKey = evt.shiftKey;
@@ -6,9 +6,9 @@
6
6
  var tinymce = {
7
7
  majorVersion : '3',
8
8
 
9
- minorVersion : '5.5',
9
+ minorVersion : '5.6',
10
10
 
11
- releaseDate : '2012-07-19',
11
+ releaseDate : '2012-07-26',
12
12
 
13
13
  _init : function() {
14
14
  var t = this, d = document, na = navigator, ua = na.userAgent, i, nl, n, base, p, v;
@@ -1314,7 +1314,7 @@ tinymce.util.Quirks = function(editor) {
1314
1314
  }
1315
1315
 
1316
1316
  function isSelectionAcrossElements() {
1317
- return !selection.isCollapsed() && selection.getStart() != selection.getEnd();
1317
+ return !selection.isCollapsed() && dom.getParent(selection.getStart(), dom.isBlock) != dom.getParent(selection.getEnd(), dom.isBlock);
1318
1318
  }
1319
1319
 
1320
1320
  function blockEvent(editor, e) {
@@ -1633,7 +1633,7 @@ tinymce.util.Quirks = function(editor) {
1633
1633
  };
1634
1634
 
1635
1635
  function fakeImageResize() {
1636
- var selectedElmX, selectedElmY, selectedElm, selectedElmGhost, selectedHandle, startX, startY, startW, startH,
1636
+ var selectedElmX, selectedElmY, selectedElm, selectedElmGhost, selectedHandle, startX, startY, startW, startH, ratio,
1637
1637
  resizeHandles, width, height, rootDocument = document, editableDoc = editor.getDoc();
1638
1638
 
1639
1639
  if (!settings.object_resizing || settings.webkit_fake_resize === false) {
@@ -1657,27 +1657,26 @@ tinymce.util.Quirks = function(editor) {
1657
1657
  };
1658
1658
 
1659
1659
  function resizeElement(e) {
1660
- var deltaX, deltaY, ratio;
1660
+ var deltaX, deltaY;
1661
1661
 
1662
1662
  // Calc new width/height
1663
1663
  deltaX = e.screenX - startX;
1664
1664
  deltaY = e.screenY - startY;
1665
- ratio = Math.max((startW + deltaX) / startW, (startH + deltaY) / startH);
1666
1665
 
1667
- if (VK.modifierPressed(e)) {
1668
- // Constrain proportions
1669
- width = Math.round(startW * ratio);
1670
- height = Math.round(startH * ratio);
1671
- } else {
1672
- // Calc new size
1673
- width = deltaX * selectedHandle[2] + startW;
1674
- height = deltaY * selectedHandle[3] + startH;
1675
- }
1666
+ // Calc new size
1667
+ width = deltaX * selectedHandle[2] + startW;
1668
+ height = deltaY * selectedHandle[3] + startH;
1676
1669
 
1677
1670
  // Never scale down lower than 5 pixels
1678
1671
  width = width < 5 ? 5 : width;
1679
1672
  height = height < 5 ? 5 : height;
1680
1673
 
1674
+ // Constrain proportions when modifier key is pressed or if the nw, ne, sw, se corners are moved on an image
1675
+ if (VK.modifierPressed(e) || (selectedElm.nodeName == "IMG" && selectedHandle[2] * selectedHandle[3] !== 0)) {
1676
+ width = Math.round(height / ratio);
1677
+ height = Math.round(width * ratio);
1678
+ }
1679
+
1681
1680
  // Update ghost size
1682
1681
  dom.setStyles(selectedElmGhost, {
1683
1682
  width: width,
@@ -1686,12 +1685,12 @@ tinymce.util.Quirks = function(editor) {
1686
1685
 
1687
1686
  // Update ghost X position if needed
1688
1687
  if (selectedHandle[2] < 0 && selectedElmGhost.clientWidth <= width) {
1689
- dom.setStyle(selectedElmGhost, 'left', selectedElmX + deltaX);
1688
+ dom.setStyle(selectedElmGhost, 'left', selectedElmX + (startW - width));
1690
1689
  }
1691
1690
 
1692
1691
  // Update ghost Y position if needed
1693
1692
  if (selectedHandle[3] < 0 && selectedElmGhost.clientHeight <= height) {
1694
- dom.setStyle(selectedElmGhost, 'top', selectedElmY + deltaY);
1693
+ dom.setStyle(selectedElmGhost, 'top', selectedElmY + (startH - height));
1695
1694
  }
1696
1695
  }
1697
1696
 
@@ -1763,6 +1762,7 @@ tinymce.util.Quirks = function(editor) {
1763
1762
  startY = e.screenY;
1764
1763
  startW = selectedElm.clientWidth;
1765
1764
  startH = selectedElm.clientHeight;
1765
+ ratio = startH / startW;
1766
1766
  selectedHandle = handle;
1767
1767
 
1768
1768
  selectedElmGhost = selectedElm.cloneNode(true);
@@ -5765,7 +5765,7 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
5765
5765
  styleElm.id = 'mceDefaultStyles';
5766
5766
  styleElm.type = 'text/css';
5767
5767
 
5768
- head = doc.getElementsByTagName('head')[0]
5768
+ head = doc.getElementsByTagName('head')[0];
5769
5769
  if (head.firstChild) {
5770
5770
  head.insertBefore(styleElm, head.firstChild);
5771
5771
  } else {
@@ -14314,7 +14314,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
14314
14314
  },
14315
14315
 
14316
14316
  getContent : function(args) {
14317
- var self = this, content;
14317
+ var self = this, content, body = self.getBody();
14318
14318
 
14319
14319
  // Setup args object
14320
14320
  args = args || {};
@@ -14328,11 +14328,18 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
14328
14328
 
14329
14329
  // Get raw contents or by default the cleaned contents
14330
14330
  if (args.format == 'raw')
14331
- content = self.getBody().innerHTML;
14331
+ content = body.innerHTML;
14332
+ else if (args.format == 'text')
14333
+ content = body.innerText || body.textContent;
14332
14334
  else
14333
- content = self.serializer.serialize(self.getBody(), args);
14335
+ content = self.serializer.serialize(body, args);
14334
14336
 
14335
- args.content = tinymce.trim(content);
14337
+ // Trim whitespace in beginning/end of HTML
14338
+ if (args.format != 'text') {
14339
+ args.content = tinymce.trim(content);
14340
+ } else {
14341
+ args.content = content;
14342
+ }
14336
14343
 
14337
14344
  // Do post processing
14338
14345
  if (!args.no_events)
@@ -15666,6 +15673,14 @@ tinymce.ForceBlocks = function(editor) {
15666
15673
  node = rootNode.firstChild;
15667
15674
  while (node) {
15668
15675
  if (node.nodeType === 3 || (node.nodeType == 1 && !blockElements[node.nodeName])) {
15676
+ // Remove empty text nodes
15677
+ if (node.nodeType === 3 && node.nodeValue.length == 0) {
15678
+ tempNode = node;
15679
+ node = node.nextSibling;
15680
+ dom.remove(tempNode);
15681
+ continue;
15682
+ }
15683
+
15669
15684
  if (!rootBlockNode) {
15670
15685
  rootBlockNode = dom.create(settings.forced_root_block);
15671
15686
  node.parentNode.insertBefore(rootBlockNode, node);
@@ -18622,7 +18637,7 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
18622
18637
  if (container && container.nodeType == 3 && offset >= container.nodeValue.length) {
18623
18638
  // Insert extra BR element at the end block elements
18624
18639
  if (!tinymce.isIE && !hasRightSideBr()) {
18625
- brElm = dom.create('br')
18640
+ brElm = dom.create('br');
18626
18641
  rng.insertNode(brElm);
18627
18642
  rng.setStartAfter(brElm);
18628
18643
  rng.setEndAfter(brElm);
@@ -18707,7 +18722,7 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
18707
18722
  // Setup range items and newBlockName
18708
18723
  container = rng.startContainer;
18709
18724
  offset = rng.startOffset;
18710
- newBlockName = settings.forced_root_block;
18725
+ newBlockName = (settings.force_p_newlines ? 'p' : '') || settings.forced_root_block;
18711
18726
  newBlockName = newBlockName ? newBlockName.toUpperCase() : '';
18712
18727
  documentMode = dom.doc.documentMode;
18713
18728
  shiftKey = evt.shiftKey;
metadata CHANGED
@@ -1,47 +1,39 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: tinymce-rails
3
- version: !ruby/object:Gem::Version
4
- hash: 25
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.5.6
5
5
  prerelease:
6
- segments:
7
- - 3
8
- - 5
9
- - 5
10
- version: 3.5.5
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Sam Pohlenz
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-07-19 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-07-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: railties
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 1
29
- segments:
30
- - 3
31
- - 1
32
- - 1
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
33
21
  version: 3.1.1
34
22
  type: :runtime
35
- version_requirements: *id001
36
- description: Seamlessly integrates TinyMCE into the Rails asset pipeline introduced in Rails 3.1.
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 3.1.1
30
+ description: Seamlessly integrates TinyMCE into the Rails asset pipeline introduced
31
+ in Rails 3.1.
37
32
  email: sam@sampohlenz.com
38
33
  executables: []
39
-
40
34
  extensions: []
41
-
42
35
  extra_rdoc_files: []
43
-
44
- files:
36
+ files:
45
37
  - README.md
46
38
  - LICENSE
47
39
  - Rakefile
@@ -317,36 +309,26 @@ files:
317
309
  - vendor/assets/javascripts/tinymce/utils/validate.js
318
310
  homepage:
319
311
  licenses: []
320
-
321
312
  post_install_message:
322
313
  rdoc_options: []
323
-
324
- require_paths:
314
+ require_paths:
325
315
  - lib
326
- required_ruby_version: !ruby/object:Gem::Requirement
316
+ required_ruby_version: !ruby/object:Gem::Requirement
327
317
  none: false
328
- requirements:
329
- - - ">="
330
- - !ruby/object:Gem::Version
331
- hash: 3
332
- segments:
333
- - 0
334
- version: "0"
335
- required_rubygems_version: !ruby/object:Gem::Requirement
318
+ requirements:
319
+ - - ! '>='
320
+ - !ruby/object:Gem::Version
321
+ version: '0'
322
+ required_rubygems_version: !ruby/object:Gem::Requirement
336
323
  none: false
337
- requirements:
338
- - - ">="
339
- - !ruby/object:Gem::Version
340
- hash: 3
341
- segments:
342
- - 0
343
- version: "0"
324
+ requirements:
325
+ - - ! '>='
326
+ - !ruby/object:Gem::Version
327
+ version: '0'
344
328
  requirements: []
345
-
346
329
  rubyforge_project:
347
- rubygems_version: 1.8.12
330
+ rubygems_version: 1.8.24
348
331
  signing_key:
349
332
  specification_version: 3
350
333
  summary: Rails asset pipeline integration for TinyMCE.
351
334
  test_files: []
352
-