medium-editor-rails 1.4.2 → 1.4.4
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 +49 -4
- 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: cbf348d6b92b44e3d48f0033b45a4dec0b3b8a0b
|
4
|
+
data.tar.gz: 54456f0f6231b89c1a873a71f5f76cf99cf76299
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3ed8f0561a890ce7003daf677799590aae0fccc9ac8b1b1e2f2e188cdd956518838f2fd65494b281be482cc748f861c7615aa4d932b520d64ea5aed438cd865
|
7
|
+
data.tar.gz: cab44695b359967168b53067b2cba1f86bc8f48432fdd2b893b182e2eab3eeff5368d3f7d567421a236e6b1033a19f64de1aa35ef6a6a52d4bf3d0bc82ae0d6e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
|
2
2
|
#### [Current]
|
3
|
+
* [c57cd48](../../commit/c57cd48) - __(Ahmet Sezgin Duran)__ Update Medium Editor files
|
4
|
+
* [0b99797](../../commit/0b99797) - __(Ahmet Sezgin Duran)__ Merge tag '1.4.2' into develop
|
5
|
+
|
6
|
+
1.4.2
|
7
|
+
|
8
|
+
#### 1.4.2
|
9
|
+
* [edda875](../../commit/edda875) - __(Ahmet Sezgin Duran)__ Bump versions 1.4.2 and 2.4.2
|
3
10
|
* [cad5c5c](../../commit/cad5c5c) - __(Ahmet Sezgin Duran)__ Update Medium Editor files
|
4
11
|
* [2666922](../../commit/2666922) - __(Ahmet Sezgin Duran)__ Merge tag '1.3.0' into develop
|
5
12
|
|
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 [2.4.
|
11
|
+
The latest version of Medium Editor bundled by this gem is [2.4.4](https://github.com/daviferreira/medium-editor/releases)
|
12
12
|
|
13
13
|
## Installation
|
14
14
|
|
@@ -2127,11 +2127,38 @@ function MediumEditor(elements, options) {
|
|
2127
2127
|
},
|
2128
2128
|
|
2129
2129
|
execAction: function (action, e) {
|
2130
|
-
|
2131
|
-
|
2130
|
+
/*jslint regexp: true*/
|
2131
|
+
var fullAction = /^full-(.+)$/gi,
|
2132
|
+
appendAction = /^append-(.+)$/gi,
|
2133
|
+
justifyAction = /^justify(left|center|right|full)$/gi,
|
2134
|
+
match;
|
2135
|
+
/*jslint regexp: false*/
|
2136
|
+
|
2137
|
+
// Actions starting with 'full-' should be applied to to the entire contents of the editable element
|
2138
|
+
// (ie full-bold, full-append-pre, etc.)
|
2139
|
+
match = fullAction.exec(action);
|
2140
|
+
if (match) {
|
2141
|
+
// Store the current selection to be restored after applying the action
|
2142
|
+
this.saveSelection();
|
2143
|
+
// Select all of the contents before calling the action
|
2144
|
+
this.selectAllContents();
|
2145
|
+
this.execAction(match[1], e);
|
2146
|
+
// Restore the previous selection
|
2147
|
+
this.restoreSelection();
|
2148
|
+
return;
|
2149
|
+
}
|
2150
|
+
|
2151
|
+
// Actions starting with 'append-' should attempt to format a block of text ('formatBlock') using a specific
|
2152
|
+
// type of block element (ie append-blockquote, append-h1, append-pre, etc.)
|
2153
|
+
match = appendAction.exec(action);
|
2154
|
+
if (match) {
|
2155
|
+
this.execFormatBlock(match[1]);
|
2132
2156
|
this.setToolbarPosition();
|
2133
2157
|
this.setToolbarButtonStates();
|
2134
|
-
|
2158
|
+
return;
|
2159
|
+
}
|
2160
|
+
|
2161
|
+
if (action === 'anchor') {
|
2135
2162
|
if (!this.options.disableAnchorForm) {
|
2136
2163
|
this.triggerAnchorAction(e);
|
2137
2164
|
}
|
@@ -2140,7 +2167,8 @@ function MediumEditor(elements, options) {
|
|
2140
2167
|
} else {
|
2141
2168
|
this.options.ownerDocument.execCommand(action, false, null);
|
2142
2169
|
this.setToolbarPosition();
|
2143
|
-
|
2170
|
+
// Manually update the toolbar for text-alignment actions
|
2171
|
+
if (justifyAction.test(action)) {
|
2144
2172
|
this.setToolbarButtonStates();
|
2145
2173
|
}
|
2146
2174
|
}
|
@@ -2276,6 +2304,23 @@ function MediumEditor(elements, options) {
|
|
2276
2304
|
});
|
2277
2305
|
},
|
2278
2306
|
|
2307
|
+
selectAllContents: function () {
|
2308
|
+
var range = this.options.ownerDocument.createRange(),
|
2309
|
+
sel = this.options.contentWindow.getSelection(),
|
2310
|
+
currNode = meSelection.getSelectionElement(this.options.contentWindow);
|
2311
|
+
|
2312
|
+
if (currNode) {
|
2313
|
+
// Move to the lowest descendant node that still selects all of the contents
|
2314
|
+
while (currNode.children.length === 1) {
|
2315
|
+
currNode = currNode.children[0];
|
2316
|
+
}
|
2317
|
+
|
2318
|
+
range.selectNodeContents(currNode);
|
2319
|
+
sel.removeAllRanges();
|
2320
|
+
sel.addRange(range);
|
2321
|
+
}
|
2322
|
+
},
|
2323
|
+
|
2279
2324
|
// http://stackoverflow.com/questions/17678843/cant-restore-selection-after-html-modify-even-if-its-the-same-html
|
2280
2325
|
// Tim Down
|
2281
2326
|
// TODO: move to selection.js and clean up old methods there
|
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: 1.4.
|
4
|
+
version: 1.4.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: 2015-02-
|
11
|
+
date: 2015-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|