medium-editor-rails 0.9.1 → 0.9.2

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: c65f4ad98a2ed8ae901614dec057ed8c57bd66ff
4
- data.tar.gz: 597cfde30623ba7de894052e50979f0b0282b77f
3
+ metadata.gz: 3f86fb92e17f8573cfd49a7c6ffe30da374b9e3d
4
+ data.tar.gz: 08c9f3c73a4d3f94c0aa28d3836cb546f4bc9935
5
5
  SHA512:
6
- metadata.gz: 84f4c0356d2d42046aca535830cd49125261cbecb300a1fa2e262224043dc991c3c98ebb867396b8217b976de2a8ba9428dcfadc2002c14f6290eaf93a9c4532
7
- data.tar.gz: 733fdbceb66f0f9876cb07505fdcda17c6b94289f1b743017ef75a358b58574e1825ed6ae5746e8aca95b7d49ed297d9860c78b4d8ab3b4291f49e7639fea5a8
6
+ metadata.gz: adf688674f3a41d3eade1f89d871fb0ec0aef9214035ba0963177ceae54336aecf2e5d7d34b8fdf67b4a0528b50d21955a52ad80e02e183d44cea70d6234460a
7
+ data.tar.gz: 567bf93c5626609403026cf81c7d9621e8d93701e38350c4f47fd7c2b83d34547ae8198d182b6baf8784239d393bcf6ff37014626643356ce540e121c105443c
@@ -1,5 +1,9 @@
1
1
 
2
2
  #### [Current]
3
+ * [1338bb4](../../commit/1338bb4) - __(Ahmet Sezgin Duran)__ Update Medium Editor files
4
+
5
+ #### 0.9.1
6
+ * [20ecac5](../../commit/20ecac5) - __(Ahmet Sezgin Duran)__ Bump versions 0.9.1 and 1.8.6
3
7
  * [f4f2a29](../../commit/f4f2a29) - __(Ahmet Sezgin Duran)__ Update Medium Editor files
4
8
 
5
9
  #### 0.9.0
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.6](https://github.com/daviferreira/medium-editor/releases)
10
+ The latest version of Medium Editor bundled by this gem is [1.8.8](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.1'
4
- MEDIUM_EDITOR_VERSION = '1.8.6'
3
+ VERSION = '0.9.2'
4
+ MEDIUM_EDITOR_VERSION = '1.8.8'
5
5
  end
6
6
  end
@@ -3,18 +3,19 @@ lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'medium-editor-rails/version'
5
5
 
6
- Gem::Specification.new do |s|
7
- s.name = 'medium-editor-rails'
8
- s.version = MediumEditorRails::Rails::VERSION
9
- s.authors = ['Ahmet Sezgin Duran']
10
- s.email = ['marjinalist1@gmail.com']
11
- s.summary = %q{Medium Editor integrated in Rails asset pipeline}
12
- s.description = s.summary
13
- s.homepage = 'https://github.com/marjinal1st/medium-editor-rails'
14
- s.license = 'MIT'
6
+ Gem::Specification.new do |gem|
7
+ gem.name = 'medium-editor-rails'
8
+ gem.version = MediumEditorRails::Rails::VERSION
9
+ gem.authors = ['Ahmet Sezgin Duran']
10
+ gem.email = ['marjinalist1@gmail.com']
11
+ gem.summary = %q{Medium Editor integrated in Rails asset pipeline}
12
+ gem.description = gem.summary
13
+ gem.homepage = 'https://github.com/marjinal1st/medium-editor-rails'
14
+ gem.license = 'MIT'
15
15
 
16
- s.files = `git ls-files`.split($/)
17
- s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- s.test_files = s.files.grep(%r{^(test|spec|features)/})
19
- s.require_paths = ['lib']
20
- end
16
+ gem.files = `git ls-files`.split($/)
17
+ gem.require_paths = ['lib']
18
+
19
+ gem.add_dependency 'railties', '~> 3.0'
20
+ gem.add_development_dependency 'bundler', '~> 1.0'
21
+ end
@@ -222,6 +222,17 @@ if (typeof module === 'object') {
222
222
 
223
223
  bindParagraphCreation: function (index) {
224
224
  var self = this;
225
+ this.elements[index].addEventListener('keypress', function (e) {
226
+ var node = getSelectionStart(),
227
+ tagName;
228
+ if (e.which === 32) {
229
+ tagName = node.tagName.toLowerCase();
230
+ if (tagName === 'a') {
231
+ document.execCommand('unlink', false, null);
232
+ }
233
+ }
234
+ });
235
+
225
236
  this.elements[index].addEventListener('keyup', function (e) {
226
237
  var node = getSelectionStart(),
227
238
  tagName;
@@ -596,10 +607,7 @@ if (typeof module === 'object') {
596
607
 
597
608
  checkActiveButtons: function () {
598
609
  var elements = Array.prototype.slice.call(this.elements),
599
- parentNode = this.selection.anchorNode;
600
- if (!parentNode.tagName) {
601
- parentNode = this.selection.anchorNode.parentNode;
602
- }
610
+ parentNode = this.getSelectedParentElement();
603
611
  while (parentNode.tagName !== undefined && this.parentElements.indexOf(parentNode.tagName.toLowerCase) === -1) {
604
612
  this.activateButton(parentNode.tagName.toLowerCase());
605
613
  this.callExtensions('checkState', parentNode);
@@ -668,8 +676,31 @@ if (typeof module === 'object') {
668
676
  }
669
677
  },
670
678
 
679
+ // http://stackoverflow.com/questions/15867542/range-object-get-selection-parent-node-chrome-vs-firefox
680
+ rangeSelectsSingleNode: function (range) {
681
+ var startNode = range.startContainer;
682
+ return startNode === range.endContainer &&
683
+ startNode.hasChildNodes() &&
684
+ range.endOffset === range.startOffset + 1;
685
+ },
686
+
687
+ getSelectedParentElement: function () {
688
+ var selectedParentElement = null,
689
+ range = this.selectionRange;
690
+ if (this.rangeSelectsSingleNode(range)) {
691
+ selectedParentElement = range.startContainer.childNodes[range.startOffset];
692
+ } else if (range.startContainer.nodeType === 3) {
693
+ selectedParentElement = range.startContainer.parentNode;
694
+ } else {
695
+ selectedParentElement = range.startContainer;
696
+ }
697
+ return selectedParentElement;
698
+ },
699
+
671
700
  triggerAnchorAction: function () {
672
- if (this.selection.anchorNode.parentNode.tagName.toLowerCase() === 'a') {
701
+ var selectedParentElement = this.getSelectedParentElement();
702
+ if (selectedParentElement.tagName &&
703
+ selectedParentElement.tagName.toLowerCase() === 'a') {
673
704
  document.execCommand('unlink', false, null);
674
705
  } else {
675
706
  if (this.anchorForm.style.display === 'block') {
@@ -1000,6 +1031,7 @@ if (typeof module === 'object') {
1000
1031
  if (this.options.targetBlank) {
1001
1032
  this.setTargetBlank();
1002
1033
  }
1034
+ this.checkSelection();
1003
1035
  this.showToolbarActions();
1004
1036
  input.value = '';
1005
1037
  },
@@ -1106,7 +1138,8 @@ if (typeof module === 'object') {
1106
1138
  setPlaceholders: function () {
1107
1139
  var i,
1108
1140
  activatePlaceholder = function (el) {
1109
- if (el.textContent.replace(/^\s+|\s+$/g, '') === '') {
1141
+ if (!(el.querySelector('img')) &&
1142
+ el.textContent.replace(/^\s+|\s+$/g, '') === '') {
1110
1143
  el.classList.add('medium-editor-placeholder');
1111
1144
  }
1112
1145
  },
@@ -35,31 +35,26 @@
35
35
  @keyframes pop-upwards {
36
36
  0% {
37
37
  -webkit-transform: matrix(0.97, 0, 0, 1, 0, 12);
38
- -ms-transform: matrix(0.97, 0, 0, 1, 0, 12);
39
38
  transform: matrix(0.97, 0, 0, 1, 0, 12);
40
39
  opacity: 0; }
41
40
 
42
41
  20% {
43
42
  -webkit-transform: matrix(0.99, 0, 0, 1, 0, 2);
44
- -ms-transform: matrix(0.99, 0, 0, 1, 0, 2);
45
43
  transform: matrix(0.99, 0, 0, 1, 0, 2);
46
44
  opacity: 0.7; }
47
45
 
48
46
  40% {
49
47
  -webkit-transform: matrix(1, 0, 0, 1, 0, -1);
50
- -ms-transform: matrix(1, 0, 0, 1, 0, -1);
51
48
  transform: matrix(1, 0, 0, 1, 0, -1);
52
49
  opacity: 1; }
53
50
 
54
51
  70% {
55
52
  -webkit-transform: matrix(1, 0, 0, 1, 0, 0);
56
- -ms-transform: matrix(1, 0, 0, 1, 0, 0);
57
53
  transform: matrix(1, 0, 0, 1, 0, 0);
58
54
  opacity: 1; }
59
55
 
60
56
  100% {
61
57
  -webkit-transform: matrix(1, 0, 0, 1, 0, 0);
62
- -ms-transform: matrix(1, 0, 0, 1, 0, 0);
63
58
  transform: matrix(1, 0, 0, 1, 0, 0);
64
59
  opacity: 1; } }
65
60
 
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: medium-editor-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
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-02 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2014-05-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
13
41
  description: Medium Editor integrated in Rails asset pipeline
14
42
  email:
15
43
  - marjinalist1@gmail.com