medium-editor-rails 0.13.0 → 0.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +1 -1
- data/lib/medium-editor-rails/version.rb +2 -2
- data/vendor/assets/javascripts/medium-editor.js +63 -43
- data/vendor/assets/stylesheets/medium-editor/medium-editor.css +2 -4
- data/vendor/assets/stylesheets/medium-editor/themes/bootstrap.css +1 -2
- data/vendor/assets/stylesheets/medium-editor/themes/default.css +1 -2
- data/vendor/assets/stylesheets/medium-editor/themes/flat.css +2 -2
- data/vendor/assets/stylesheets/medium-editor/themes/mani.css +1 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e58ad4295ca847f565b03e3c537da4d2fa9b4a0
|
4
|
+
data.tar.gz: 6bbe1f8535d6757f37740b147eee020dadee37a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 313670ac55305d945bf64f6a0cc0daa22df1bd4079534594983270dc70a8965014101016321423cee63aedaf54b88e164c476c66d2c01133671ab7ad7c36d277
|
7
|
+
data.tar.gz: d327eaf5023ee301711ec2c814a199e6943f736206fdde1ca81b93b3f0526200d1ab6af1b503f472bb34ceef1d41f59a0ee2d3b62b3a55eefe4de492c460cb4a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
|
2
2
|
#### [Current]
|
3
|
+
* [c6b96b2](../../commit/c6b96b2) - __(Ahmet Sezgin Duran)__ Update Medium Editor files
|
4
|
+
* [8c242a1](../../commit/8c242a1) - __(Ahmet Sezgin Duran)__ Merge tag '0.13.0' into develop
|
5
|
+
|
6
|
+
0.13.0
|
7
|
+
|
8
|
+
#### 0.13.0
|
9
|
+
* [5721891](../../commit/5721891) - __(Ahmet Sezgin Duran)__ Bump versions 0.13.0 and 1.9.10
|
3
10
|
* [fdb732b](../../commit/fdb732b) - __(Ahmet Sezgin Duran)__ Update Medium Editor files
|
4
11
|
|
5
12
|
#### 0.12.0
|
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 [1.9.
|
11
|
+
The latest version of Medium Editor bundled by this gem is [1.9.13](https://github.com/daviferreira/medium-editor/releases)
|
12
12
|
|
13
13
|
## Installation
|
14
14
|
|
@@ -152,11 +152,15 @@ else if (typeof define === 'function' && define.amd) {
|
|
152
152
|
return;
|
153
153
|
}
|
154
154
|
this.parentElements = ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'blockquote', 'pre'];
|
155
|
-
this.
|
155
|
+
if (!this.options.elementsContainer) {
|
156
|
+
this.options.elementsContainer = document.body;
|
157
|
+
}
|
158
|
+
this.id = this.options.elementsContainer.querySelectorAll('.medium-editor-toolbar').length + 1;
|
156
159
|
return this.setup();
|
157
160
|
},
|
158
161
|
|
159
162
|
setup: function () {
|
163
|
+
this.events = [];
|
160
164
|
this.isActive = true;
|
161
165
|
this.initElements()
|
162
166
|
.bindSelect()
|
@@ -166,6 +170,28 @@ else if (typeof define === 'function' && define.amd) {
|
|
166
170
|
.passInstance();
|
167
171
|
},
|
168
172
|
|
173
|
+
on: function(target, event, listener, useCapture) {
|
174
|
+
target.addEventListener(event, listener, useCapture);
|
175
|
+
this.events.push([target, event, listener, useCapture]);
|
176
|
+
},
|
177
|
+
|
178
|
+
off: function(target, event, listener, useCapture) {
|
179
|
+
var index = this.events.indexOf([target, event, listener, useCapture]),
|
180
|
+
e;
|
181
|
+
if(index !== -1) {
|
182
|
+
e = this.events.splice(index, 1);
|
183
|
+
e[0].removeEventListener(e[1], e[2], e[3]);
|
184
|
+
}
|
185
|
+
},
|
186
|
+
|
187
|
+
removeAllEvents: function() {
|
188
|
+
var e = this.events.pop();
|
189
|
+
while(e) {
|
190
|
+
e[0].removeEventListener(e[1], e[2], e[3]);
|
191
|
+
e = this.events.pop();
|
192
|
+
}
|
193
|
+
},
|
194
|
+
|
169
195
|
initElements: function () {
|
170
196
|
this.updateElementList();
|
171
197
|
var i,
|
@@ -185,9 +211,6 @@ else if (typeof define === 'function' && define.amd) {
|
|
185
211
|
}
|
186
212
|
// Init toolbar
|
187
213
|
if (addToolbar) {
|
188
|
-
if (!this.options.elementsContainer) {
|
189
|
-
this.options.elementsContainer = document.body;
|
190
|
-
}
|
191
214
|
this.initToolbar()
|
192
215
|
.bindButtons()
|
193
216
|
.bindAnchorForm()
|
@@ -272,7 +295,7 @@ else if (typeof define === 'function' && define.amd) {
|
|
272
295
|
|
273
296
|
bindParagraphCreation: function (index) {
|
274
297
|
var self = this;
|
275
|
-
this.elements[index]
|
298
|
+
this.on(this.elements[index], 'keypress', function (e) {
|
276
299
|
var node = getSelectionStart.call(self),
|
277
300
|
tagName;
|
278
301
|
if (e.which === 32) {
|
@@ -283,7 +306,7 @@ else if (typeof define === 'function' && define.amd) {
|
|
283
306
|
}
|
284
307
|
});
|
285
308
|
|
286
|
-
this.elements[index]
|
309
|
+
this.on(this.elements[index], 'keyup', function (e) {
|
287
310
|
var node = getSelectionStart.call(self),
|
288
311
|
tagName,
|
289
312
|
editorElement;
|
@@ -329,7 +352,7 @@ else if (typeof define === 'function' && define.amd) {
|
|
329
352
|
|
330
353
|
bindReturn: function (index) {
|
331
354
|
var self = this;
|
332
|
-
this.elements[index]
|
355
|
+
this.on(this.elements[index], 'keypress', function (e) {
|
333
356
|
if (e.which === 13) {
|
334
357
|
if (self.options.disableReturn || this.getAttribute('data-disable-return')) {
|
335
358
|
e.preventDefault();
|
@@ -346,7 +369,7 @@ else if (typeof define === 'function' && define.amd) {
|
|
346
369
|
|
347
370
|
bindTab: function (index) {
|
348
371
|
var self = this;
|
349
|
-
this.elements[index]
|
372
|
+
this.on(this.elements[index], 'keydown', function (e) {
|
350
373
|
if (e.which === 9) {
|
351
374
|
// Override tab only for pre nodes
|
352
375
|
var tag = getSelectionStart.call(self).tagName.toLowerCase();
|
@@ -377,7 +400,7 @@ else if (typeof define === 'function' && define.amd) {
|
|
377
400
|
'bold': '<button class="medium-editor-action medium-editor-action-bold" data-action="bold" data-element="b">' + buttonLabels.bold + '</button>',
|
378
401
|
'italic': '<button class="medium-editor-action medium-editor-action-italic" data-action="italic" data-element="i">' + buttonLabels.italic + '</button>',
|
379
402
|
'underline': '<button class="medium-editor-action medium-editor-action-underline" data-action="underline" data-element="u">' + buttonLabels.underline + '</button>',
|
380
|
-
'strikethrough': '<button class="medium-editor-action medium-editor-action-strikethrough" data-action="strikethrough" data-element="strike"
|
403
|
+
'strikethrough': '<button class="medium-editor-action medium-editor-action-strikethrough" data-action="strikethrough" data-element="strike">' + buttonLabels.strikethrough +'</button>',
|
381
404
|
'superscript': '<button class="medium-editor-action medium-editor-action-superscript" data-action="superscript" data-element="sup">' + buttonLabels.superscript + '</button>',
|
382
405
|
'subscript': '<button class="medium-editor-action medium-editor-action-subscript" data-action="subscript" data-element="sub">' + buttonLabels.subscript + '</button>',
|
383
406
|
'anchor': '<button class="medium-editor-action medium-editor-action-anchor" data-action="anchor" data-element="a">' + buttonLabels.anchor + '</button>',
|
@@ -406,6 +429,7 @@ else if (typeof define === 'function' && define.amd) {
|
|
406
429
|
'bold': '<b>B</b>',
|
407
430
|
'italic': '<b><i>I</i></b>',
|
408
431
|
'underline': '<b><u>U</u></b>',
|
432
|
+
'strikethrough': '<s>A</s>',
|
409
433
|
'superscript': '<b>x<sup>1</sup></b>',
|
410
434
|
'subscript': '<b>x<sub>1</sub></b>',
|
411
435
|
'anchor': '<b>#</b>',
|
@@ -428,6 +452,7 @@ else if (typeof define === 'function' && define.amd) {
|
|
428
452
|
'bold': '<i class="fa fa-bold"></i>',
|
429
453
|
'italic': '<i class="fa fa-italic"></i>',
|
430
454
|
'underline': '<i class="fa fa-underline"></i>',
|
455
|
+
'strikethrough': '<i class="fa fa-strikethrough"></i>',
|
431
456
|
'superscript': '<i class="fa fa-superscript"></i>',
|
432
457
|
'subscript': '<i class="fa fa-subscript"></i>',
|
433
458
|
'anchor': '<i class="fa fa-link"></i>',
|
@@ -586,11 +611,11 @@ else if (typeof define === 'function' && define.amd) {
|
|
586
611
|
}, self.options.delay);
|
587
612
|
};
|
588
613
|
|
589
|
-
document.documentElement
|
614
|
+
this.on(document.documentElement, 'mouseup', this.checkSelectionWrapper);
|
590
615
|
|
591
616
|
for (i = 0; i < this.elements.length; i += 1) {
|
592
|
-
this.elements[i]
|
593
|
-
this.elements[i]
|
617
|
+
this.on(this.elements[i], 'keyup', this.checkSelectionWrapper);
|
618
|
+
this.on(this.elements[i], 'blur', this.checkSelectionWrapper);
|
594
619
|
}
|
595
620
|
return this;
|
596
621
|
},
|
@@ -772,7 +797,7 @@ else if (typeof define === 'function' && define.amd) {
|
|
772
797
|
}
|
773
798
|
};
|
774
799
|
for (i = 0; i < buttons.length; i += 1) {
|
775
|
-
buttons[i]
|
800
|
+
this.on(buttons[i], 'click', triggerAction);
|
776
801
|
}
|
777
802
|
this.setFirstAndLastItems(buttons);
|
778
803
|
return this;
|
@@ -934,12 +959,12 @@ else if (typeof define === 'function' && define.amd) {
|
|
934
959
|
linkSave = this.anchorForm.querySelector('a.medium-editor-toobar-anchor-save'),
|
935
960
|
self = this;
|
936
961
|
|
937
|
-
this.anchorForm
|
962
|
+
this.on(this.anchorForm, 'click', function (e) {
|
938
963
|
e.stopPropagation();
|
939
964
|
self.keepToolbarAlive = true;
|
940
965
|
});
|
941
966
|
|
942
|
-
this.anchorInput
|
967
|
+
this.on(this.anchorInput, 'keyup', function (e) {
|
943
968
|
var button = null,
|
944
969
|
target;
|
945
970
|
|
@@ -960,7 +985,7 @@ else if (typeof define === 'function' && define.amd) {
|
|
960
985
|
}
|
961
986
|
});
|
962
987
|
|
963
|
-
|
988
|
+
this.on(linkSave, 'click', function(e) {
|
964
989
|
var button = null,
|
965
990
|
target;
|
966
991
|
e.preventDefault();
|
@@ -978,27 +1003,27 @@ else if (typeof define === 'function' && define.amd) {
|
|
978
1003
|
self.createLink(self.anchorInput, target, button);
|
979
1004
|
}, true);
|
980
1005
|
|
981
|
-
this.anchorInput
|
1006
|
+
this.on(this.anchorInput, 'click', function (e) {
|
982
1007
|
// make sure not to hide form when cliking into the input
|
983
1008
|
e.stopPropagation();
|
984
1009
|
self.keepToolbarAlive = true;
|
985
1010
|
});
|
986
1011
|
|
987
1012
|
// Hide the anchor form when focusing outside of it.
|
988
|
-
this.options.ownerDocument.body
|
1013
|
+
this.on(this.options.ownerDocument.body, 'click', function (e) {
|
989
1014
|
if (e.target !== self.anchorForm && !isDescendant(self.anchorForm, e.target) && !isDescendant(self.toolbarActions, e.target)) {
|
990
1015
|
self.keepToolbarAlive = false;
|
991
1016
|
self.checkSelection();
|
992
1017
|
}
|
993
1018
|
}, true);
|
994
|
-
this.options.ownerDocument.body
|
1019
|
+
this.on(this.options.ownerDocument.body, 'focus', function (e) {
|
995
1020
|
if (e.target !== self.anchorForm && !isDescendant(self.anchorForm, e.target) && !isDescendant(self.toolbarActions, e.target)) {
|
996
1021
|
self.keepToolbarAlive = false;
|
997
1022
|
self.checkSelection();
|
998
1023
|
}
|
999
1024
|
}, true);
|
1000
1025
|
|
1001
|
-
|
1026
|
+
this.on(linkCancel, 'click', function (e) {
|
1002
1027
|
e.preventDefault();
|
1003
1028
|
self.showToolbarActions();
|
1004
1029
|
restoreSelection.call(self, self.savedSelection);
|
@@ -1078,18 +1103,18 @@ else if (typeof define === 'function' && define.amd) {
|
|
1078
1103
|
|
1079
1104
|
// cleanup
|
1080
1105
|
clearInterval(interval_timer);
|
1081
|
-
self.anchorPreview
|
1082
|
-
self.anchorPreview
|
1083
|
-
|
1084
|
-
|
1106
|
+
self.off(self.anchorPreview, 'mouseover', stamp);
|
1107
|
+
self.off(self.anchorPreview, 'mouseout', unstamp);
|
1108
|
+
self.off(anchorEl, 'mouseover', stamp);
|
1109
|
+
self.off(anchorEl, 'mouseout', unstamp);
|
1085
1110
|
|
1086
1111
|
}
|
1087
1112
|
}, 200);
|
1088
1113
|
|
1089
|
-
self.anchorPreview
|
1090
|
-
self.anchorPreview
|
1091
|
-
|
1092
|
-
|
1114
|
+
this.on(self.anchorPreview, 'mouseover', stamp);
|
1115
|
+
this.on(self.anchorPreview, 'mouseout', unstamp);
|
1116
|
+
this.on(anchorEl, 'mouseover', stamp);
|
1117
|
+
this.on(anchorEl, 'mouseout', unstamp);
|
1093
1118
|
},
|
1094
1119
|
|
1095
1120
|
createAnchorPreview: function () {
|
@@ -1101,7 +1126,7 @@ else if (typeof define === 'function' && define.amd) {
|
|
1101
1126
|
anchorPreview.innerHTML = this.anchorPreviewTemplate();
|
1102
1127
|
this.options.elementsContainer.appendChild(anchorPreview);
|
1103
1128
|
|
1104
|
-
|
1129
|
+
this.on(anchorPreview, 'click', function () {
|
1105
1130
|
self.anchorPreviewClickHandler();
|
1106
1131
|
});
|
1107
1132
|
|
@@ -1142,7 +1167,7 @@ else if (typeof define === 'function' && define.amd) {
|
|
1142
1167
|
leaveAnchor = function () {
|
1143
1168
|
// mark the anchor as no longer hovered, and stop listening
|
1144
1169
|
overAnchor = false;
|
1145
|
-
self.activeAnchor
|
1170
|
+
self.off(self.activeAnchor, 'mouseout', leaveAnchor);
|
1146
1171
|
};
|
1147
1172
|
|
1148
1173
|
if (e.target && e.target.tagName.toLowerCase() === 'a') {
|
@@ -1160,7 +1185,7 @@ else if (typeof define === 'function' && define.amd) {
|
|
1160
1185
|
return true;
|
1161
1186
|
}
|
1162
1187
|
this.activeAnchor = e.target;
|
1163
|
-
this.activeAnchor
|
1188
|
+
this.on(this.activeAnchor, 'mouseout', leaveAnchor);
|
1164
1189
|
// show the anchor preview according to the configured delay
|
1165
1190
|
// if the mouse has not left the anchor tag in that time
|
1166
1191
|
setTimeout(function () {
|
@@ -1179,7 +1204,7 @@ else if (typeof define === 'function' && define.amd) {
|
|
1179
1204
|
self.editorAnchorObserver(e);
|
1180
1205
|
};
|
1181
1206
|
for (i = 0; i < this.elements.length; i += 1) {
|
1182
|
-
this.elements[i]
|
1207
|
+
this.on(this.elements[i], 'mouseover', this.editorAnchorObserverWrapper);
|
1183
1208
|
}
|
1184
1209
|
return this;
|
1185
1210
|
},
|
@@ -1196,6 +1221,7 @@ else if (typeof define === 'function' && define.amd) {
|
|
1196
1221
|
el.target = '_blank';
|
1197
1222
|
} else {
|
1198
1223
|
el = el.getElementsByTagName('a');
|
1224
|
+
|
1199
1225
|
for (i = 0; i < el.length; i += 1) {
|
1200
1226
|
el[i].target = '_blank';
|
1201
1227
|
}
|
@@ -1268,7 +1294,7 @@ else if (typeof define === 'function' && define.amd) {
|
|
1268
1294
|
}
|
1269
1295
|
}, 100);
|
1270
1296
|
};
|
1271
|
-
this.options.contentWindow
|
1297
|
+
this.on(this.options.contentWindow, 'resize', this.windowResizeHandler);
|
1272
1298
|
return this;
|
1273
1299
|
},
|
1274
1300
|
|
@@ -1295,18 +1321,12 @@ else if (typeof define === 'function' && define.amd) {
|
|
1295
1321
|
delete this.anchorPreview;
|
1296
1322
|
}
|
1297
1323
|
|
1298
|
-
this.options.ownerDocument.documentElement.removeEventListener('mouseup', this.checkSelectionWrapper);
|
1299
|
-
this.options.contentWindow.removeEventListener('resize', this.windowResizeHandler);
|
1300
|
-
|
1301
1324
|
for (i = 0; i < this.elements.length; i += 1) {
|
1302
|
-
this.elements[i].removeEventListener('mouseover', this.editorAnchorObserverWrapper);
|
1303
|
-
this.elements[i].removeEventListener('keyup', this.checkSelectionWrapper);
|
1304
|
-
this.elements[i].removeEventListener('blur', this.checkSelectionWrapper);
|
1305
|
-
this.elements[i].removeEventListener('paste', this.pasteWrapper);
|
1306
1325
|
this.elements[i].removeAttribute('contentEditable');
|
1307
1326
|
this.elements[i].removeAttribute('data-medium-element');
|
1308
1327
|
}
|
1309
1328
|
|
1329
|
+
this.removeAllEvents();
|
1310
1330
|
},
|
1311
1331
|
|
1312
1332
|
htmlEntities: function (str) {
|
@@ -1352,7 +1372,7 @@ else if (typeof define === 'function' && define.amd) {
|
|
1352
1372
|
}
|
1353
1373
|
};
|
1354
1374
|
for (i = 0; i < this.elements.length; i += 1) {
|
1355
|
-
this.elements[i]
|
1375
|
+
this.on(this.elements[i], 'paste', this.pasteWrapper);
|
1356
1376
|
}
|
1357
1377
|
return this;
|
1358
1378
|
},
|
@@ -1374,8 +1394,8 @@ else if (typeof define === 'function' && define.amd) {
|
|
1374
1394
|
};
|
1375
1395
|
for (i = 0; i < this.elements.length; i += 1) {
|
1376
1396
|
activatePlaceholder(this.elements[i]);
|
1377
|
-
this.elements[i]
|
1378
|
-
this.elements[i]
|
1397
|
+
this.on(this.elements[i], 'blur', placeholderWrapper);
|
1398
|
+
this.on(this.elements[i], 'keypress', placeholderWrapper);
|
1379
1399
|
}
|
1380
1400
|
return this;
|
1381
1401
|
},
|
@@ -99,8 +99,7 @@
|
|
99
99
|
font-size: 14px;
|
100
100
|
line-height: 1.33;
|
101
101
|
text-decoration: none;
|
102
|
-
|
103
|
-
box-sizing: border-box; }
|
102
|
+
box-sizing: border-box; }
|
104
103
|
.medium-editor-toolbar li .medium-editor-action-underline, .medium-editor-anchor-preview li .medium-editor-action-underline {
|
105
104
|
text-decoration: underline; }
|
106
105
|
.medium-editor-toolbar li .medium-editor-action-pre, .medium-editor-anchor-preview li .medium-editor-action-pre {
|
@@ -140,8 +139,7 @@
|
|
140
139
|
width: 316px;
|
141
140
|
border: none;
|
142
141
|
font-size: 14px;
|
143
|
-
|
144
|
-
box-sizing: border-box; }
|
142
|
+
box-sizing: border-box; }
|
145
143
|
.medium-editor-toolbar-form-anchor .medium-editor-toolbar-anchor-input:focus, .medium-editor-toolbar-form-anchor label:focus {
|
146
144
|
outline: 0;
|
147
145
|
border: none;
|
@@ -18,8 +18,7 @@
|
|
18
18
|
border-right: 1px solid #357ebd;
|
19
19
|
background-color: transparent;
|
20
20
|
color: #fff;
|
21
|
-
|
22
|
-
box-sizing: border-box;
|
21
|
+
box-sizing: border-box;
|
23
22
|
-webkit-transition: background-color 0.2s ease-in, color 0.2s ease-in;
|
24
23
|
transition: background-color 0.2s ease-in, color 0.2s ease-in; }
|
25
24
|
.medium-editor-toolbar li button:hover {
|
@@ -14,13 +14,13 @@
|
|
14
14
|
min-width: 60px;
|
15
15
|
height: 60px;
|
16
16
|
border: none;
|
17
|
-
border-right: 1px solid #
|
17
|
+
border-right: 1px solid #9ccea6;
|
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
21
|
transition: background-color 0.2s ease-in, color 0.2s ease-in; }
|
22
22
|
.medium-editor-toolbar li button:hover {
|
23
|
-
background-color: #
|
23
|
+
background-color: #346a3f;
|
24
24
|
color: #fff; }
|
25
25
|
.medium-editor-toolbar li .medium-editor-button-active {
|
26
26
|
background-color: #23482a;
|
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.13.
|
4
|
+
version: 0.13.1
|
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-11-
|
11
|
+
date: 2014-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|