medium-editor-rails 1.4.4 → 1.4.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cbf348d6b92b44e3d48f0033b45a4dec0b3b8a0b
4
- data.tar.gz: 54456f0f6231b89c1a873a71f5f76cf99cf76299
3
+ metadata.gz: d0439b8eb2da727e37c1ebcc2fae29850e53a2f4
4
+ data.tar.gz: 6d591143bd341268871c05bc9715686fee0186bd
5
5
  SHA512:
6
- metadata.gz: f3ed8f0561a890ce7003daf677799590aae0fccc9ac8b1b1e2f2e188cdd956518838f2fd65494b281be482cc748f861c7615aa4d932b520d64ea5aed438cd865
7
- data.tar.gz: cab44695b359967168b53067b2cba1f86bc8f48432fdd2b893b182e2eab3eeff5368d3f7d567421a236e6b1033a19f64de1aa35ef6a6a52d4bf3d0bc82ae0d6e
6
+ metadata.gz: d299576cf03b9a432c2f683e882dfdb818711bc9a7ca4bdff6e9c6c9c7e7a87b761c799c5094658eba123714d2e1aa0f427516f87c27a6cef0a8ac7819086cfb
7
+ data.tar.gz: 82ba196bde1a183da2082f22ee083ab88e1624b7bc9f50426293033ee576df8d27777f5ecf43b48bbb26a5f4571f3a8ae8074934d967472525f07c3386c21a25
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
 
2
2
  #### [Current]
3
+ * [0b17fe4](../../commit/0b17fe4) - __(Ahmet Sezgin Duran)__ Update Medium Editor files
4
+ * [ebfc535](../../commit/ebfc535) - __(Ahmet Sezgin Duran)__ Merge tag '1.4.4' into develop
5
+
6
+ 1.4.4
7
+
8
+ #### 1.4.4
9
+ * [d1dc78e](../../commit/d1dc78e) - __(Ahmet Sezgin Duran)__ Bump versions 1.4.4 and 2.4.4
3
10
  * [c57cd48](../../commit/c57cd48) - __(Ahmet Sezgin Duran)__ Update Medium Editor files
4
11
  * [0b99797](../../commit/0b99797) - __(Ahmet Sezgin Duran)__ Merge tag '1.4.2' into develop
5
12
 
data/README.md CHANGED
@@ -8,7 +8,7 @@ This gem integrates [Medium Editor](https://github.com/daviferreira/medium-edito
8
8
 
9
9
  ## Version
10
10
 
11
- The latest version of Medium Editor bundled by this gem is [2.4.4](https://github.com/daviferreira/medium-editor/releases)
11
+ The latest version of Medium Editor bundled by this gem is [2.4.5](https://github.com/daviferreira/medium-editor/releases)
12
12
 
13
13
  ## Installation
14
14
 
@@ -1,6 +1,6 @@
1
1
  module MediumEditorRails
2
2
  module Rails
3
- VERSION = '1.4.4'
4
- MEDIUM_EDITOR_VERSION = '2.4.4'
3
+ VERSION = '1.4.5'
4
+ MEDIUM_EDITOR_VERSION = '2.4.5'
5
5
  end
6
6
  end
@@ -77,6 +77,9 @@ var mediumEditorUtil;
77
77
  },
78
78
 
79
79
  isDescendant: function isDescendant(parent, child) {
80
+ if (!parent || !child) {
81
+ return false;
82
+ }
80
83
  var node = child.parentNode;
81
84
  while (node !== null) {
82
85
  if (node === parent) {
@@ -386,7 +389,8 @@ var DefaultButton,
386
389
  },
387
390
  useQueryState: true,
388
391
  contentDefault: '<b>B</b>',
389
- contentFA: '<i class="fa fa-bold"></i>'
392
+ contentFA: '<i class="fa fa-bold"></i>',
393
+ key: 'b'
390
394
  },
391
395
  'italic': {
392
396
  name: 'italic',
@@ -399,7 +403,8 @@ var DefaultButton,
399
403
  },
400
404
  useQueryState: true,
401
405
  contentDefault: '<b><i>I</i></b>',
402
- contentFA: '<i class="fa fa-italic"></i>'
406
+ contentFA: '<i class="fa fa-italic"></i>',
407
+ key: 'i'
403
408
  },
404
409
  'underline': {
405
410
  name: 'underline',
@@ -412,7 +417,8 @@ var DefaultButton,
412
417
  },
413
418
  useQueryState: true,
414
419
  contentDefault: '<b><u>U</u></b>',
415
- contentFA: '<i class="fa fa-underline"></i>'
420
+ contentFA: '<i class="fa fa-underline"></i>',
421
+ key: 'u'
416
422
  },
417
423
  'strikethrough': {
418
424
  name: 'strikethrough',
@@ -707,6 +713,7 @@ var DefaultButton,
707
713
  }
708
714
  };
709
715
  }(window, document));
716
+
710
717
  var pasteHandler;
711
718
 
712
719
  (function (window, document) {
@@ -1340,9 +1347,18 @@ function MediumEditor(elements, options) {
1340
1347
  var self = this,
1341
1348
  blurFunction = function (e) {
1342
1349
  var isDescendantOfEditorElements = false,
1350
+ selection = self.options.contentWindow.getSelection(),
1351
+ selRange = selection.isCollapsed ?
1352
+ null :
1353
+ meSelection.getSelectedParentElement(selection.getRangeAt(0)),
1343
1354
  i;
1355
+
1356
+ // This control was introduced also to avoid the toolbar
1357
+ // to disapper when selecting from right to left and
1358
+ // the selection ends at the beginning of the text.
1344
1359
  for (i = 0; i < self.elements.length; i += 1) {
1345
- if (mediumEditorUtil.isDescendant(self.elements[i], e.target)) {
1360
+ if (mediumEditorUtil.isDescendant(self.elements[i], e.target)
1361
+ || mediumEditorUtil.isDescendant(self.elements[i], selRange)) {
1346
1362
  isDescendantOfEditorElements = true;
1347
1363
  break;
1348
1364
  }
@@ -1572,11 +1588,12 @@ function MediumEditor(elements, options) {
1572
1588
  bindKeydown: function (index) {
1573
1589
  var self = this;
1574
1590
  this.on(this.elements[index], 'keydown', function (e) {
1591
+ var node, tag, key;
1575
1592
 
1576
1593
  if (e.which === mediumEditorUtil.keyCode.TAB) {
1577
1594
  // Override tab only for pre nodes
1578
- var node = meSelection.getSelectionStart(self.options.ownerDocument),
1579
- tag = node && node.tagName.toLowerCase();
1595
+ node = meSelection.getSelectionStart(self.options.ownerDocument);
1596
+ tag = node && node.tagName.toLowerCase();
1580
1597
 
1581
1598
  if (tag === 'pre') {
1582
1599
  e.preventDefault();
@@ -1599,6 +1616,13 @@ function MediumEditor(elements, options) {
1599
1616
  // Bind keys which can create or destroy a block element: backspace, delete, return
1600
1617
  self.onBlockModifier(e);
1601
1618
 
1619
+ } else if (e.ctrlKey) {
1620
+ key = String.fromCharCode(e.which || e.keyCode).toLowerCase();
1621
+ self.commands.forEach(function (extension) {
1622
+ if (extension.options.key && extension.options.key === key) {
1623
+ extension.handleClick(e);
1624
+ }
1625
+ });
1602
1626
  }
1603
1627
  });
1604
1628
  return this;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: medium-editor-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.4
4
+ version: 1.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ahmet Sezgin Duran
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-17 00:00:00.000000000 Z
11
+ date: 2015-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties