medium-editor-rails 0.11.0 → 0.12.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/lib/medium-editor-rails/version.rb +2 -2
- data/vendor/assets/javascripts/medium-editor.js +47 -35
- 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: e6334aa6f7d7de244f56a2f69a38f76f7ff1e0f4
|
4
|
+
data.tar.gz: 7bbdaa4722048e7014a1f7f547916c02609ab331
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5340ce94ec2f120238764d75f94011a81edf06190197efd8e06fff0be2fd77430a127e0ac198d56d46ad4eaddf733226044ca1dc2bad6a4a8e1d0c78fab7287c
|
7
|
+
data.tar.gz: 7aa1dfda439284dd0c437e8a138c4d27f73420804b35f9fda37b018e0a5d682edecbe447debefb4a7e82be59a08215a2b00a295507821cc8adb79c4af3eaafa8
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
|
2
2
|
#### [Current]
|
3
|
+
* [3e8148f](../../commit/3e8148f) - __(Ahmet Sezgin Duran)__ Update Medium Editor files
|
4
|
+
|
5
|
+
#### 0.11.0
|
6
|
+
* [90cef00](../../commit/90cef00) - __(Ahmet Sezgin Duran)__ Bump versions 0.11.0 and 1.9.4
|
3
7
|
* [c949af6](../../commit/c949af6) - __(Ahmet Sezgin Duran)__ Update Medium Editor files
|
4
8
|
* [6e867bb](../../commit/6e867bb) - __(Ahmet Sezgin Duran)__ Add Gemnasium badge
|
5
9
|
* [618bf25](../../commit/618bf25) - __(Ahmet Sezgin Duran)__ Merge tag '0.10.0' into develop
|
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.8](https://github.com/daviferreira/medium-editor/releases)
|
12
12
|
|
13
13
|
## Installation
|
14
14
|
|
@@ -276,14 +276,18 @@ if (typeof module === 'object') {
|
|
276
276
|
|
277
277
|
this.elements[index].addEventListener('keyup', function (e) {
|
278
278
|
var node = getSelectionStart(),
|
279
|
-
tagName
|
279
|
+
tagName,
|
280
|
+
editorElement;
|
281
|
+
|
280
282
|
if (node && node.getAttribute('data-medium-element') && node.children.length === 0 && !(self.options.disableReturn || node.getAttribute('data-disable-return'))) {
|
281
283
|
document.execCommand('formatBlock', false, 'p');
|
282
284
|
}
|
283
285
|
if (e.which === 13) {
|
284
286
|
node = getSelectionStart();
|
285
287
|
tagName = node.tagName.toLowerCase();
|
286
|
-
|
288
|
+
editorElement = self.getSelectionElement();
|
289
|
+
|
290
|
+
if (!(self.options.disableReturn || editorElement.getAttribute('data-disable-return')) &&
|
287
291
|
tagName !== 'li' && !self.isListItemChild(node)) {
|
288
292
|
if (!e.shiftKey) {
|
289
293
|
document.execCommand('formatBlock', false, 'p');
|
@@ -375,7 +379,11 @@ if (typeof module === 'object') {
|
|
375
379
|
'unorderedlist': '<button class="medium-editor-action medium-editor-action-unorderedlist" data-action="insertunorderedlist" data-element="ul">' + buttonLabels.unorderedlist + '</button>',
|
376
380
|
'pre': '<button class="medium-editor-action medium-editor-action-pre" data-action="append-pre" data-element="pre">' + buttonLabels.pre + '</button>',
|
377
381
|
'indent': '<button class="medium-editor-action medium-editor-action-indent" data-action="indent" data-element="ul">' + buttonLabels.indent + '</button>',
|
378
|
-
'outdent': '<button class="medium-editor-action medium-editor-action-outdent" data-action="outdent" data-element="ul">' + buttonLabels.outdent + '</button>'
|
382
|
+
'outdent': '<button class="medium-editor-action medium-editor-action-outdent" data-action="outdent" data-element="ul">' + buttonLabels.outdent + '</button>',
|
383
|
+
'justifyCenter': '<button class="medium-editor-action medium-editor-action-justifyCenter" data-action="justifyCenter" data-element="">' + buttonLabels.justifyCenter + '</button>',
|
384
|
+
'justifyFull': '<button class="medium-editor-action medium-editor-action-justifyFull" data-action="justifyFull" data-element="">' + buttonLabels.justifyFull + '</button>',
|
385
|
+
'justifyLeft': '<button class="medium-editor-action medium-editor-action-justifyLeft" data-action="justifyLeft" data-element="">' + buttonLabels.justifyLeft + '</button>',
|
386
|
+
'justifyRight': '<button class="medium-editor-action medium-editor-action-justifyRight" data-action="justifyRight" data-element="">' + buttonLabels.justifyRight + '</button>'
|
379
387
|
};
|
380
388
|
return buttonTemplates[btnType] || false;
|
381
389
|
},
|
@@ -399,7 +407,11 @@ if (typeof module === 'object') {
|
|
399
407
|
'unorderedlist': '<b>•</b>',
|
400
408
|
'pre': '<b>0101</b>',
|
401
409
|
'indent': '<b>→</b>',
|
402
|
-
'outdent': '<b>←</b>'
|
410
|
+
'outdent': '<b>←</b>',
|
411
|
+
'justifyCenter': '<b>C</b>',
|
412
|
+
'justifyFull': '<b>J</b>',
|
413
|
+
'justifyLeft': '<b>L</b>',
|
414
|
+
'justifyRight': '<b>R</b>'
|
403
415
|
};
|
404
416
|
if (buttonLabelType === 'fontawesome') {
|
405
417
|
customButtonLabels = {
|
@@ -415,7 +427,11 @@ if (typeof module === 'object') {
|
|
415
427
|
'unorderedlist': '<i class="fa fa-list-ul"></i>',
|
416
428
|
'pre': '<i class="fa fa-code fa-lg"></i>',
|
417
429
|
'indent': '<i class="fa fa-indent"></i>',
|
418
|
-
'outdent': '<i class="fa fa-outdent"></i>'
|
430
|
+
'outdent': '<i class="fa fa-outdent"></i>',
|
431
|
+
'justifyCenter': '<i class="fa fa-align-center"></i>',
|
432
|
+
'justifyFull': '<i class="fa fa-align-justify"></i>',
|
433
|
+
'justifyLeft': '<i class="fa fa-align-left"></i>',
|
434
|
+
'justifyRight': '<i class="fa fa-align-right"></i>'
|
419
435
|
};
|
420
436
|
} else if (typeof buttonLabelType === 'object') {
|
421
437
|
customButtonLabels = buttonLabelType;
|
@@ -625,36 +641,31 @@ if (typeof module === 'object') {
|
|
625
641
|
},
|
626
642
|
|
627
643
|
findMatchingSelectionParent: function(testElementFunction) {
|
628
|
-
var selection = window.getSelection(),
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
var localParent = e;
|
633
|
-
try {
|
634
|
-
while (!testElementFunction(localParent)) {
|
635
|
-
localParent = localParent.parentNode;
|
636
|
-
}
|
637
|
-
} catch (errb) {
|
638
|
-
return false;
|
639
|
-
}
|
640
|
-
return localParent;
|
641
|
-
};
|
642
|
-
// First try on current node
|
643
|
-
try {
|
644
|
-
range = selection.getRangeAt(0);
|
645
|
-
current = range.commonAncestorContainer;
|
646
|
-
parent = current.parentNode;
|
647
|
-
|
648
|
-
if (testElementFunction(current)) {
|
649
|
-
result = current;
|
650
|
-
} else {
|
651
|
-
result = getElement(parent);
|
652
|
-
}
|
653
|
-
// If not search in the parent nodes.
|
654
|
-
} catch (err) {
|
655
|
-
result = getElement(parent);
|
644
|
+
var selection = window.getSelection(), range, current;
|
645
|
+
|
646
|
+
if (selection.rangeCount === 0) {
|
647
|
+
return false;
|
656
648
|
}
|
657
|
-
|
649
|
+
|
650
|
+
range = selection.getRangeAt(0);
|
651
|
+
current = range.commonAncestorContainer;
|
652
|
+
|
653
|
+
do {
|
654
|
+
if (current.nodeType === 1){
|
655
|
+
if ( testElementFunction(current) )
|
656
|
+
{
|
657
|
+
return current;
|
658
|
+
}
|
659
|
+
// do not traverse upwards past the nearest containing editor
|
660
|
+
if (current.getAttribute('data-medium-element')) {
|
661
|
+
return false;
|
662
|
+
}
|
663
|
+
}
|
664
|
+
|
665
|
+
current = current.parentNode;
|
666
|
+
} while (current);
|
667
|
+
|
668
|
+
return false;
|
658
669
|
},
|
659
670
|
|
660
671
|
getSelectionElement: function () {
|
@@ -1325,7 +1336,8 @@ if (typeof module === 'object') {
|
|
1325
1336
|
}
|
1326
1337
|
document.execCommand('insertHTML', false, html);
|
1327
1338
|
} else {
|
1328
|
-
|
1339
|
+
html = self.htmlEntities(e.clipboardData.getData('text/plain'));
|
1340
|
+
document.execCommand('insertHTML', false, html);
|
1329
1341
|
}
|
1330
1342
|
}
|
1331
1343
|
};
|
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.
|
4
|
+
version: 0.12.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-
|
11
|
+
date: 2014-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|