medium-editor-rails 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a19fa274fa39b3f1da19bc01acdff480be5adf1e
4
- data.tar.gz: db5b2f6fae586e9f9b6016d0d32b249b1ce38e2c
3
+ metadata.gz: cdc1408f3cdef9d9412971b3e5d44bd36e427d94
4
+ data.tar.gz: 2696819ef83f95dd66987d708832d62b6536bf24
5
5
  SHA512:
6
- metadata.gz: 9bcb54380987cc4cac31d782713e24f2c44d4c93bb4ff213cf70ff6c2cd46a9f69b90e16fb98cfe77581c8d723c4fb97ec1de589e31f377830d42277fe2a7749
7
- data.tar.gz: 7de151830f3dece51d84cece27f981dca391ddd7777911bbeed1cbd0a9385cc610aef6801e0780ccdb0ba1eceb021bc0a65382599673c421084c4da844f00b73
6
+ metadata.gz: c798de54fe83c52b9b09c9b2ce73d56cefac457d78161ac4fa3f490c17c3e44d6af28498e3764426e7b2bb04da6763c45ec0ccb732ea97032fe5baf1cc85ca62
7
+ data.tar.gz: d5c7fb25b406293fa0cc15c51dda5b3a1242dcd481ee89f702d0a7af9756cc5a0cbec53b7115c023fac1b1dcb81eee043a7a4a45ded21bc456c49b57fb403410
@@ -1,5 +1,12 @@
1
1
 
2
2
  #### [Current]
3
+ * [4caf0f0](../../commit/4caf0f0) - __(Ahmet Sezgin Duran)__ Update Medium Editor files
4
+ * [e1c1ee3](../../commit/e1c1ee3) - __(Ahmet Sezgin Duran)__ Merge tag '0.9.3' into develop
5
+
6
+ 0.9.3
7
+
8
+ #### 0.9.3
9
+ * [96fb2c5](../../commit/96fb2c5) - __(Ahmet Sezgin Duran)__ [#2](../../issues/2) Bump version 0.9.3
3
10
  * [9abd0e7](../../commit/9abd0e7) - __(Ahmet Sezgin Duran)__ [#2](../../issues/2) Fix dependency problem
4
11
  * [a9fe34d](../../commit/a9fe34d) - __(Ahmet Sezgin Duran)__ Merge tag '0.9.2' into develop
5
12
 
data/README.md CHANGED
@@ -7,7 +7,7 @@ This gem integrates [Medium Editor](https://github.com/daviferreira/medium-edito
7
7
 
8
8
  ## Version
9
9
 
10
- The latest version of Medium Editor bundled by this gem is [1.8.8](https://github.com/daviferreira/medium-editor/releases)
10
+ The latest version of Medium Editor bundled by this gem is [1.8.14](https://github.com/daviferreira/medium-editor/releases)
11
11
 
12
12
  ## Installation
13
13
 
@@ -1,6 +1,6 @@
1
1
  module MediumEditorRails
2
2
  module Rails
3
- VERSION = '0.9.3'
4
- MEDIUM_EDITOR_VERSION = '1.8.8'
3
+ VERSION = '0.9.4'
4
+ MEDIUM_EDITOR_VERSION = '1.8.14'
5
5
  end
6
6
  end
@@ -112,7 +112,10 @@ if (typeof module === 'object') {
112
112
  placeholder: 'Type your text',
113
113
  secondHeader: 'h4',
114
114
  targetBlank: false,
115
- extensions: {}
115
+ extensions: {},
116
+ activeButtonClass: 'medium-editor-button-active',
117
+ firstButtonClass: 'medium-editor-button-first',
118
+ lastButtonClass: 'medium-editor-button-last'
116
119
  },
117
120
 
118
121
  // http://stackoverflow.com/questions/17907445/how-to-detect-ie11#comment30165888_17907562
@@ -599,7 +602,7 @@ if (typeof module === 'object') {
599
602
  var buttons = this.toolbarActions.querySelectorAll('button'),
600
603
  i;
601
604
  for (i = 0; i < buttons.length; i += 1) {
602
- buttons[i].classList.remove('medium-editor-button-active');
605
+ buttons[i].classList.remove(this.options.activeButtonClass);
603
606
  }
604
607
  this.checkActiveButtons();
605
608
  return this;
@@ -622,8 +625,8 @@ if (typeof module === 'object') {
622
625
 
623
626
  activateButton: function (tag) {
624
627
  var el = this.toolbar.querySelector('[data-element="' + tag + '"]');
625
- if (el !== null && el.className.indexOf('medium-editor-button-active') === -1) {
626
- el.className += ' medium-editor-button-active';
628
+ if (el !== null && el.className.indexOf(this.options.activeButtonClass) === -1) {
629
+ el.className += ' ' + this.options.activeButtonClass;
627
630
  }
628
631
  },
629
632
 
@@ -637,10 +640,10 @@ if (typeof module === 'object') {
637
640
  if (self.selection === undefined) {
638
641
  self.checkSelection();
639
642
  }
640
- if (this.className.indexOf('medium-editor-button-active') > -1) {
641
- this.classList.remove('medium-editor-button-active');
643
+ if (this.className.indexOf(self.options.activeButtonClass) > -1) {
644
+ this.classList.remove(self.options.activeButtonClass);
642
645
  } else {
643
- this.className += ' medium-editor-button-active';
646
+ this.className += ' ' + self.options.activeButtonClass;
644
647
  }
645
648
  if (this.hasAttribute('data-action')) {
646
649
  self.execAction(this.getAttribute('data-action'), e);
@@ -655,8 +658,8 @@ if (typeof module === 'object') {
655
658
 
656
659
  setFirstAndLastItems: function (buttons) {
657
660
  if (buttons.length > 0) {
658
- buttons[0].className += ' medium-editor-button-first';
659
- buttons[buttons.length - 1].className += ' medium-editor-button-last';
661
+ buttons[0].className += ' ' + this.options.firstButtonClass;
662
+ buttons[buttons.length - 1].className += ' ' + this.options.lastButtonClass;
660
663
  }
661
664
  return this;
662
665
  },
@@ -786,9 +789,17 @@ if (typeof module === 'object') {
786
789
  }, 100);
787
790
  },
788
791
 
792
+ saveSelection: function() {
793
+ this.savedSelection = saveSelection();
794
+ },
795
+
796
+ restoreSelection: function() {
797
+ restoreSelection(this.savedSelection);
798
+ },
799
+
789
800
  showAnchorForm: function (link_value) {
790
801
  this.toolbarActions.style.display = 'none';
791
- this.savedSelection = saveSelection();
802
+ this.saveSelection();
792
803
  this.anchorForm.style.display = 'block';
793
804
  this.keepToolbarAlive = true;
794
805
  this.anchorInput.focus();
@@ -1002,11 +1013,8 @@ if (typeof module === 'object') {
1002
1013
  },
1003
1014
 
1004
1015
  checkLinkFormat: function (value) {
1005
- var re = /^https?:\/\//;
1006
- if (value.match(re)) {
1007
- return value;
1008
- }
1009
- return "http://" + value;
1016
+ var re = /^(https?|ftps?|rtmpt?):\/\/|mailto:/;
1017
+ return (re.test(value) ? '' : 'http://') + value;
1010
1018
  },
1011
1019
 
1012
1020
  setTargetBlank: function () {
@@ -1023,6 +1031,10 @@ if (typeof module === 'object') {
1023
1031
  },
1024
1032
 
1025
1033
  createLink: function (input) {
1034
+ if (input.value.trim().length === 0) {
1035
+ this.hideToolbarActions();
1036
+ return;
1037
+ }
1026
1038
  restoreSelection(this.savedSelection);
1027
1039
  if (this.options.checkLinkFormat) {
1028
1040
  input.value = this.checkLinkFormat(input.value);
@@ -1139,6 +1151,7 @@ if (typeof module === 'object') {
1139
1151
  var i,
1140
1152
  activatePlaceholder = function (el) {
1141
1153
  if (!(el.querySelector('img')) &&
1154
+ !(el.querySelector('blockquote')) &&
1142
1155
  el.textContent.replace(/^\s+|\s+$/g, '') === '') {
1143
1156
  el.classList.add('medium-editor-placeholder');
1144
1157
  }
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: 0.9.3
4
+ version: 0.9.4
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: 2014-05-29 00:00:00.000000000 Z
11
+ date: 2014-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties