medium-editor-rails 0.9.4 → 0.10.0

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: cdc1408f3cdef9d9412971b3e5d44bd36e427d94
4
- data.tar.gz: 2696819ef83f95dd66987d708832d62b6536bf24
3
+ metadata.gz: 4ee7ee2fc94dcc528fd70ff4099bbb0ab07ea0ba
4
+ data.tar.gz: 0f052e34fe06d46b9775a97c4073c366e28191e0
5
5
  SHA512:
6
- metadata.gz: c798de54fe83c52b9b09c9b2ce73d56cefac457d78161ac4fa3f490c17c3e44d6af28498e3764426e7b2bb04da6763c45ec0ccb732ea97032fe5baf1cc85ca62
7
- data.tar.gz: d5c7fb25b406293fa0cc15c51dda5b3a1242dcd481ee89f702d0a7af9756cc5a0cbec53b7115c023fac1b1dcb81eee043a7a4a45ded21bc456c49b57fb403410
6
+ metadata.gz: 5e88e9e38bd332452158ee112e627119c50fec8cf2c516d4543ce6d3111b879a758259ad4239a388bd4c5fc4fc46a8920a3286c722826cf469053b5a07024a06
7
+ data.tar.gz: 41bef9de1b55c3c69f3fd9c354162288015316fd87c64660ab99a5f06a1e41a65273cb9ae4946e3cc1b44ed12e4dce0a8ccac559c3cd10fc7926fdb87d3946f8
@@ -1,5 +1,12 @@
1
1
 
2
2
  #### [Current]
3
+ * [028abec](../../commit/028abec) - __(Ahmet Sezgin Duran)__ Update Medium Editor files
4
+ * [9de9ca7](../../commit/9de9ca7) - __(Ahmet Sezgin Duran)__ Merge tag '0.9.4' into develop
5
+
6
+ 0.9.4
7
+
8
+ #### 0.9.4
9
+ * [da0a1dc](../../commit/da0a1dc) - __(Ahmet Sezgin Duran)__ Bump versions 0.9.4 and 1.8.14
3
10
  * [4caf0f0](../../commit/4caf0f0) - __(Ahmet Sezgin Duran)__ Update Medium Editor files
4
11
  * [e1c1ee3](../../commit/e1c1ee3) - __(Ahmet Sezgin Duran)__ Merge tag '0.9.3' 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.14](https://github.com/daviferreira/medium-editor/releases)
10
+ The latest version of Medium Editor bundled by this gem is [1.9.0](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.4'
4
- MEDIUM_EDITOR_VERSION = '1.8.14'
3
+ VERSION = '0.10.0'
4
+ MEDIUM_EDITOR_VERSION = '1.9.0'
5
5
  end
6
6
  end
@@ -139,7 +139,8 @@ if (typeof module === 'object') {
139
139
  .bindSelect()
140
140
  .bindPaste()
141
141
  .setPlaceholders()
142
- .bindWindowActions();
142
+ .bindWindowActions()
143
+ .passInstance();
143
144
  },
144
145
 
145
146
  initElements: function () {
@@ -223,6 +224,29 @@ if (typeof module === 'object') {
223
224
  }
224
225
  },
225
226
 
227
+ /**
228
+ * Pass current Medium Editor instance to all extensions
229
+ * if extension constructor has 'parent' attribute set to 'true'
230
+ *
231
+ */
232
+ passInstance: function () {
233
+ var self = this,
234
+ ext,
235
+ name;
236
+
237
+ for (name in self.options.extensions) {
238
+ if (self.options.extensions.hasOwnProperty(name)) {
239
+ ext = self.options.extensions[name];
240
+
241
+ if (ext.parent) {
242
+ ext.base = self;
243
+ }
244
+ }
245
+ }
246
+
247
+ return self;
248
+ },
249
+
226
250
  bindParagraphCreation: function (index) {
227
251
  var self = this;
228
252
  this.elements[index].addEventListener('keypress', function (e) {
@@ -491,7 +515,8 @@ if (typeof module === 'object') {
491
515
  if (this.keepToolbarAlive !== true && !this.options.disableToolbar) {
492
516
  newSelection = window.getSelection();
493
517
  if (newSelection.toString().trim() === '' ||
494
- (this.options.allowMultiParagraphSelection === false && this.hasMultiParagraphs())) {
518
+ (this.options.allowMultiParagraphSelection === false && this.hasMultiParagraphs()) ||
519
+ this.selectionInContentEditableFalse()) {
495
520
  this.hideToolbarActions();
496
521
  } else {
497
522
  selectionElement = this.getSelectionElement();
@@ -535,14 +560,14 @@ if (typeof module === 'object') {
535
560
  this.hideToolbarActions();
536
561
  },
537
562
 
538
- getSelectionElement: function () {
563
+ findMatchingSelectionParent: function( testElementFunction ) {
539
564
  var selection = window.getSelection(),
540
565
  range, current, parent,
541
566
  result,
542
- getMediumElement = function (e) {
567
+ getElement = function (e) {
543
568
  var localParent = e;
544
569
  try {
545
- while (!localParent.getAttribute('data-medium-element')) {
570
+ while (!testElementFunction( localParent )) {
546
571
  localParent = localParent.parentNode;
547
572
  }
548
573
  } catch (errb) {
@@ -556,18 +581,30 @@ if (typeof module === 'object') {
556
581
  current = range.commonAncestorContainer;
557
582
  parent = current.parentNode;
558
583
 
559
- if (current.getAttribute('data-medium-element')) {
584
+ if (testElementFunction( current )) {
560
585
  result = current;
561
586
  } else {
562
- result = getMediumElement(parent);
587
+ result = getElement(parent);
563
588
  }
564
589
  // If not search in the parent nodes.
565
590
  } catch (err) {
566
- result = getMediumElement(parent);
591
+ result = getElement(parent);
567
592
  }
568
593
  return result;
569
594
  },
570
595
 
596
+ getSelectionElement: function () {
597
+ return this.findMatchingSelectionParent( function(el) {
598
+ return el.getAttribute('data-medium-element');
599
+ } );
600
+ },
601
+
602
+ selectionInContentEditableFalse: function () {
603
+ return this.findMatchingSelectionParent( function(el) {
604
+ return (el && el.nodeName !== '#text' && el.getAttribute('contenteditable') === 'false');
605
+ } );
606
+ },
607
+
571
608
  setToolbarPosition: function () {
572
609
  var buttonHeight = 50,
573
610
  selection = window.getSelection(),
@@ -842,7 +879,8 @@ if (typeof module === 'object') {
842
879
 
843
880
  // TODO: break method
844
881
  showAnchorPreview: function (anchorEl) {
845
- if (this.anchorPreview.classList.contains('medium-editor-anchor-preview-active')) {
882
+ if (this.anchorPreview.classList.contains('medium-editor-anchor-preview-active')
883
+ || anchorEl.getAttribute('data-disable-preview')) {
846
884
  return true;
847
885
  }
848
886
 
@@ -9,53 +9,53 @@
9
9
  @-webkit-keyframes pop-upwards {
10
10
  0% {
11
11
  -webkit-transform: matrix(0.97, 0, 0, 1, 0, 12);
12
- transform: matrix(0.97, 0, 0, 1, 0, 12);
12
+ transform: matrix(0.97, 0, 0, 1, 0, 12);
13
13
  opacity: 0; }
14
14
 
15
15
  20% {
16
16
  -webkit-transform: matrix(0.99, 0, 0, 1, 0, 2);
17
- transform: matrix(0.99, 0, 0, 1, 0, 2);
17
+ transform: matrix(0.99, 0, 0, 1, 0, 2);
18
18
  opacity: 0.7; }
19
19
 
20
20
  40% {
21
21
  -webkit-transform: matrix(1, 0, 0, 1, 0, -1);
22
- transform: matrix(1, 0, 0, 1, 0, -1);
22
+ transform: matrix(1, 0, 0, 1, 0, -1);
23
23
  opacity: 1; }
24
24
 
25
25
  70% {
26
26
  -webkit-transform: matrix(1, 0, 0, 1, 0, 0);
27
- transform: matrix(1, 0, 0, 1, 0, 0);
27
+ transform: matrix(1, 0, 0, 1, 0, 0);
28
28
  opacity: 1; }
29
29
 
30
30
  100% {
31
31
  -webkit-transform: matrix(1, 0, 0, 1, 0, 0);
32
- transform: matrix(1, 0, 0, 1, 0, 0);
32
+ transform: matrix(1, 0, 0, 1, 0, 0);
33
33
  opacity: 1; } }
34
34
 
35
35
  @keyframes pop-upwards {
36
36
  0% {
37
37
  -webkit-transform: matrix(0.97, 0, 0, 1, 0, 12);
38
- transform: matrix(0.97, 0, 0, 1, 0, 12);
38
+ transform: matrix(0.97, 0, 0, 1, 0, 12);
39
39
  opacity: 0; }
40
40
 
41
41
  20% {
42
42
  -webkit-transform: matrix(0.99, 0, 0, 1, 0, 2);
43
- transform: matrix(0.99, 0, 0, 1, 0, 2);
43
+ transform: matrix(0.99, 0, 0, 1, 0, 2);
44
44
  opacity: 0.7; }
45
45
 
46
46
  40% {
47
47
  -webkit-transform: matrix(1, 0, 0, 1, 0, -1);
48
- transform: matrix(1, 0, 0, 1, 0, -1);
48
+ transform: matrix(1, 0, 0, 1, 0, -1);
49
49
  opacity: 1; }
50
50
 
51
51
  70% {
52
52
  -webkit-transform: matrix(1, 0, 0, 1, 0, 0);
53
- transform: matrix(1, 0, 0, 1, 0, 0);
53
+ transform: matrix(1, 0, 0, 1, 0, 0);
54
54
  opacity: 1; }
55
55
 
56
56
  100% {
57
57
  -webkit-transform: matrix(1, 0, 0, 1, 0, 0);
58
- transform: matrix(1, 0, 0, 1, 0, 0);
58
+ transform: matrix(1, 0, 0, 1, 0, 0);
59
59
  opacity: 1; } }
60
60
 
61
61
  .medium-toolbar-arrow-under:after, .medium-toolbar-arrow-over:before {
@@ -99,9 +99,8 @@
99
99
  font-size: 14px;
100
100
  line-height: 1.33;
101
101
  text-decoration: none;
102
- -webkit-box-sizing: border-box;
103
102
  -moz-box-sizing: border-box;
104
- box-sizing: border-box; }
103
+ box-sizing: border-box; }
105
104
  .medium-editor-toolbar li .medium-editor-action-underline, .medium-editor-anchor-preview li .medium-editor-action-underline {
106
105
  text-decoration: underline; }
107
106
  .medium-editor-toolbar li .medium-editor-action-pre, .medium-editor-anchor-preview li .medium-editor-action-pre {
@@ -123,7 +122,7 @@
123
122
  -ms-animation: pop-upwards 160ms forwards linear;
124
123
  animation: pop-upwards 160ms forwards linear;
125
124
  -webkit-transition: top 0.075s ease-out, left 0.075s ease-out;
126
- transition: top 0.075s ease-out, left 0.075s ease-out; }
125
+ transition: top 0.075s ease-out, left 0.075s ease-out; }
127
126
 
128
127
  .medium-editor-action-bold {
129
128
  font-weight: bolder; }
@@ -141,13 +140,11 @@
141
140
  width: 316px;
142
141
  border: none;
143
142
  font-size: 14px;
144
- -webkit-box-sizing: border-box;
145
143
  -moz-box-sizing: border-box;
146
- box-sizing: border-box; }
144
+ box-sizing: border-box; }
147
145
  .medium-editor-toolbar-form-anchor input:focus {
148
146
  outline: 0;
149
147
  border: none;
150
- -webkit-box-shadow: none;
151
148
  box-shadow: none;
152
149
  -webkit-appearance: none;
153
150
  -moz-appearance: none; }
@@ -164,5 +161,5 @@
164
161
  position: absolute;
165
162
  top: 0;
166
163
  left: 0;
167
- content: attr(data-placeholder);
164
+ content: attr(data-placeholder) !important;
168
165
  font-style: italic; }
@@ -10,7 +10,7 @@
10
10
  background-color: #428bca;
11
11
  border-radius: 4px;
12
12
  -webkit-transition: top 0.075s ease-out, left 0.075s ease-out;
13
- transition: top 0.075s ease-out, left 0.075s ease-out; }
13
+ transition: top 0.075s ease-out, left 0.075s ease-out; }
14
14
  .medium-editor-toolbar li button {
15
15
  min-width: 60px;
16
16
  height: 60px;
@@ -18,11 +18,10 @@
18
18
  border-right: 1px solid #357ebd;
19
19
  background-color: transparent;
20
20
  color: #fff;
21
- -webkit-box-sizing: border-box;
22
21
  -moz-box-sizing: border-box;
23
- box-sizing: border-box;
22
+ box-sizing: border-box;
24
23
  -webkit-transition: background-color 0.2s ease-in, color 0.2s ease-in;
25
- transition: background-color 0.2s ease-in, color 0.2s ease-in; }
24
+ transition: background-color 0.2s ease-in, color 0.2s ease-in; }
26
25
  .medium-editor-toolbar li button:hover {
27
26
  background-color: #3276b1;
28
27
  color: #fff; }
@@ -9,14 +9,12 @@
9
9
  .medium-editor-toolbar {
10
10
  border: 1px solid #000;
11
11
  background-color: #242424;
12
- background: -webkit-gradient(linear, left bottom, left top, from(#242424), to(rgba(36, 36, 36, 0.75)));
13
12
  background: -webkit-linear-gradient(bottom, #242424, rgba(36, 36, 36, 0.75));
14
13
  background: linear-gradient(bottom, #242424, rgba(36, 36, 36, 0.75));
15
14
  border-radius: 5px;
16
- -webkit-box-shadow: 0 0 3px #000;
17
15
  box-shadow: 0 0 3px #000;
18
16
  -webkit-transition: top 0.075s ease-out, left 0.075s ease-out;
19
- transition: top 0.075s ease-out, left 0.075s ease-out; }
17
+ transition: top 0.075s ease-out, left 0.075s ease-out; }
20
18
  .medium-editor-toolbar li button {
21
19
  min-width: 50px;
22
20
  height: 50px;
@@ -26,13 +24,11 @@
26
24
  border-left: 1px solid rgba(255, 255, 255, 0.1);
27
25
  background-color: #242424;
28
26
  color: #fff;
29
- background: -webkit-gradient(linear, left bottom, left top, from(#242424), to(rgba(36, 36, 36, 0.89)));
30
27
  background: -webkit-linear-gradient(bottom, #242424, rgba(36, 36, 36, 0.89));
31
28
  background: linear-gradient(bottom, #242424, rgba(36, 36, 36, 0.89));
32
- -webkit-box-shadow: 0 2px 2px rgba(0, 0, 0, 0.3);
33
29
  box-shadow: 0 2px 2px rgba(0, 0, 0, 0.3);
34
30
  -webkit-transition: background-color 0.2s ease-in;
35
- transition: background-color 0.2s ease-in; }
31
+ transition: background-color 0.2s ease-in; }
36
32
  .medium-editor-toolbar li button:hover {
37
33
  background-color: #000;
38
34
  color: yellow; }
@@ -45,7 +41,6 @@
45
41
  .medium-editor-toolbar li .medium-editor-button-active {
46
42
  background-color: #000;
47
43
  color: #fff;
48
- background: -webkit-gradient(linear, left bottom, left top, from(#242424), to(rgba(0, 0, 0, 0.89)));
49
44
  background: -webkit-linear-gradient(bottom, #242424, rgba(0, 0, 0, 0.89));
50
45
  background: linear-gradient(bottom, #242424, rgba(0, 0, 0, 0.89)); }
51
46
 
@@ -57,9 +52,8 @@
57
52
  height: 50px;
58
53
  background: #242424;
59
54
  color: #ccc;
60
- -webkit-box-sizing: border-box;
61
55
  -moz-box-sizing: border-box;
62
- box-sizing: border-box; }
56
+ box-sizing: border-box; }
63
57
  .medium-editor-toolbar-form-anchor a {
64
58
  color: #fff; }
65
59
 
@@ -18,7 +18,7 @@
18
18
  background-color: transparent;
19
19
  color: #fff;
20
20
  -webkit-transition: background-color 0.2s ease-in, color 0.2s ease-in;
21
- transition: background-color 0.2s ease-in, color 0.2s ease-in; }
21
+ transition: background-color 0.2s ease-in, color 0.2s ease-in; }
22
22
  .medium-editor-toolbar li button:hover {
23
23
  background-color: #346a3e;
24
24
  color: #fff; }
@@ -5,11 +5,9 @@
5
5
  border: 1px solid #cdd6e0;
6
6
  background-color: #dee7f0;
7
7
  background-color: rgba(222, 231, 240, 0.95);
8
- background: -webkit-gradient(linear, left bottom, left top, from(#dee7f0), to(#ffffff));
9
8
  background: -webkit-linear-gradient(bottom, #dee7f0, #ffffff);
10
9
  background: linear-gradient(bottom, #dee7f0, #ffffff);
11
10
  border-radius: 2px;
12
- -webkit-box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
13
11
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45); }
14
12
  .medium-editor-toolbar li button {
15
13
  min-width: 50px;
@@ -19,7 +17,7 @@
19
17
  background-color: transparent;
20
18
  color: #40648a;
21
19
  -webkit-transition: background-color 0.2s ease-in, color 0.2s ease-in;
22
- transition: background-color 0.2s ease-in, color 0.2s ease-in; }
20
+ transition: background-color 0.2s ease-in, color 0.2s ease-in; }
23
21
  .medium-editor-toolbar li button:hover {
24
22
  background-color: #5c90c7;
25
23
  background-color: rgba(92, 144, 199, 0.45);
@@ -34,7 +32,6 @@
34
32
  background-color: #5c90c7;
35
33
  background-color: rgba(92, 144, 199, 0.45);
36
34
  color: #000;
37
- background: -webkit-gradient(linear, left bottom, left top, from(#dee7f0), to(rgba(0, 0, 0, 0.1)));
38
35
  background: -webkit-linear-gradient(bottom, #dee7f0, rgba(0, 0, 0, 0.1));
39
36
  background: linear-gradient(bottom, #dee7f0, rgba(0, 0, 0, 0.1)); }
40
37
 
@@ -46,9 +43,8 @@
46
43
  height: 50px;
47
44
  background: #dee7f0;
48
45
  color: #40648a;
49
- -webkit-box-sizing: border-box;
50
46
  -moz-box-sizing: border-box;
51
- box-sizing: border-box; }
47
+ box-sizing: border-box; }
52
48
  .medium-editor-toolbar-form-anchor a {
53
49
  color: #40648a; }
54
50
 
@@ -5,7 +5,6 @@
5
5
  background-color: #fff;
6
6
  background-color: rgba(255, 255, 255, 0.95);
7
7
  border-radius: 5px;
8
- -webkit-box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
9
8
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45); }
10
9
  .medium-editor-toolbar li button {
11
10
  min-width: 50px;
@@ -14,14 +13,12 @@
14
13
  border-right: 1px solid #a8a8a8;
15
14
  background-color: transparent;
16
15
  color: #889aac;
17
- -webkit-box-shadow: inset 0 0 3px #f8f8e6;
18
16
  box-shadow: inset 0 0 3px #f8f8e6;
19
- background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(rgba(0, 0, 0, 0.1)));
20
17
  background: -webkit-linear-gradient(top, #fff, rgba(0, 0, 0, 0.1));
21
18
  background: linear-gradient(top, #fff, rgba(0, 0, 0, 0.1));
22
19
  text-shadow: 1px 4px 6px #def, 0 0 0 #000, 1px 4px 6px #def;
23
20
  -webkit-transition: background-color 0.2s ease-in;
24
- transition: background-color 0.2s ease-in; }
21
+ transition: background-color 0.2s ease-in; }
25
22
  .medium-editor-toolbar li button:hover {
26
23
  background-color: #fff;
27
24
  color: #000;
@@ -36,7 +33,6 @@
36
33
  background-color: #ccc;
37
34
  color: #000;
38
35
  color: rgba(0, 0, 0, 0.8);
39
- background: -webkit-gradient(linear, left bottom, left top, from(#fff), to(rgba(0, 0, 0, 0.2)));
40
36
  background: -webkit-linear-gradient(bottom, #fff, rgba(0, 0, 0, 0.2));
41
37
  background: linear-gradient(bottom, #fff, rgba(0, 0, 0, 0.2)); }
42
38
 
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.4
4
+ version: 0.10.0
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-06-11 00:00:00.000000000 Z
11
+ date: 2014-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties