phrasing 4.0.0rc4 → 4.0.0rc5
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/app/assets/javascripts/editor.js +10 -10
- data/app/assets/javascripts/phrasing.js +4 -0
- data/app/helpers/inline_helper.rb +3 -3
- data/lib/phrasing/version.rb +1 -1
- data/spec/features/phrasing_spec.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b0757a83e101496cafb49039b3ab1efe078014d
|
4
|
+
data.tar.gz: 66fa7004242054c8bf4525a869aaa26b09cf6140
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eacb10e6cb2bc6267a399429b112e67eacfcd55f7a194a50c6e334831950595ea66c90a9d108c4b5e65f5451112cc89baab9316b23506316abb6e8cf187fc184
|
7
|
+
data.tar.gz: 8eb444d1fe8d14a634aaf0b1b3b0519f9c3a669b959aa1885573bd0da787c8d199f1738c7a58ad574f039468e9d134f88dcc31341d18a16f917d2ef9b2fc8ddb
|
@@ -36,7 +36,7 @@ var editor = (function() {
|
|
36
36
|
checkTextHighlighting( event );
|
37
37
|
}, 1);
|
38
38
|
};
|
39
|
-
|
39
|
+
|
40
40
|
// Window bindings
|
41
41
|
window.addEventListener( 'resize', function( event ) {
|
42
42
|
updateBubblePosition();
|
@@ -47,15 +47,15 @@ var editor = (function() {
|
|
47
47
|
// http://ejohn.org/blog/learning-from-twitter
|
48
48
|
var scrollEnabled = true;
|
49
49
|
document.body.addEventListener( 'scroll', function() {
|
50
|
-
|
50
|
+
|
51
51
|
if ( !scrollEnabled ) {
|
52
52
|
return;
|
53
53
|
}
|
54
|
-
|
54
|
+
|
55
55
|
scrollEnabled = true;
|
56
|
-
|
56
|
+
|
57
57
|
updateBubblePosition();
|
58
|
-
|
58
|
+
|
59
59
|
return setTimeout((function() {
|
60
60
|
scrollEnabled = true;
|
61
61
|
}), 250);
|
@@ -100,7 +100,7 @@ var editor = (function() {
|
|
100
100
|
if (event.target.parentNode.classList.contains("ui-inputs")){
|
101
101
|
currentNodeList = findNodes( selection.focusNode );
|
102
102
|
updateBubbleStates();
|
103
|
-
return;
|
103
|
+
return;
|
104
104
|
}
|
105
105
|
}
|
106
106
|
|
@@ -125,12 +125,12 @@ var editor = (function() {
|
|
125
125
|
|
126
126
|
lastType = selection.isCollapsed;
|
127
127
|
}
|
128
|
-
|
128
|
+
|
129
129
|
function updateBubblePosition() {
|
130
130
|
var selection = window.getSelection();
|
131
131
|
var range = selection.getRangeAt(0);
|
132
132
|
var boundary = range.getBoundingClientRect();
|
133
|
-
|
133
|
+
|
134
134
|
textOptions.style.top = boundary.top - 5 + window.pageYOffset + "px";
|
135
135
|
textOptions.style.left = (boundary.left + boundary.right)/2 + "px";
|
136
136
|
}
|
@@ -201,7 +201,7 @@ var editor = (function() {
|
|
201
201
|
//if any of its parents has the class of 'phrasable' go hooray
|
202
202
|
while ( element.parentNode ) {
|
203
203
|
if (element.className !== undefined){
|
204
|
-
if (element.className.indexOf("
|
204
|
+
if (element.className.indexOf("phrasable-on")>=0){
|
205
205
|
return true;
|
206
206
|
}
|
207
207
|
}
|
@@ -307,4 +307,4 @@ var editor = (function() {
|
|
307
307
|
init: init
|
308
308
|
}
|
309
309
|
|
310
|
-
})();
|
310
|
+
})();
|
@@ -5,6 +5,10 @@ var Phrasing = {
|
|
5
5
|
EDIT_MODE_KEY : 'editing-mode'
|
6
6
|
};
|
7
7
|
|
8
|
+
Phrasing.isEditModeEnabled = function(){
|
9
|
+
return localStorage.getItem(this.EDIT_MODE_KEY) === "true";
|
10
|
+
};
|
11
|
+
|
8
12
|
function StatusBubbleWidget(options){
|
9
13
|
this.$statusText = options.$statusText;
|
10
14
|
this.$statusIndicator = options.$statusIndicator;
|
@@ -20,12 +20,12 @@ module InlineHelper
|
|
20
20
|
return uneditable_phrase(record, attribute) unless can_edit_phrases?
|
21
21
|
|
22
22
|
klass = 'phrasable'
|
23
|
-
klass += ' inverse'
|
24
|
-
klass += options[:class] if options[:class]
|
23
|
+
klass += ' inverse' if options[:inverse]
|
24
|
+
klass += ' ' + options[:class] if options[:class]
|
25
25
|
|
26
26
|
url = phrasing_polymorphic_url(record, attribute)
|
27
27
|
|
28
|
-
content_tag(:span, class: klass,
|
28
|
+
content_tag(:span, class: klass, spellcheck: false, 'data-url' => url) do
|
29
29
|
(record.send(attribute) || record.try(:key)).to_s.html_safe
|
30
30
|
end
|
31
31
|
end
|
data/lib/phrasing/version.rb
CHANGED
@@ -14,10 +14,10 @@ feature 'edit mode bubble' do
|
|
14
14
|
expect(edit_mode_checkbox).not_to be_checked
|
15
15
|
end
|
16
16
|
|
17
|
-
it "phrases
|
17
|
+
it "phrases initially shouldn't have class 'phrasable-on' and contenteditable=true" do
|
18
18
|
expect(page.find('.header').first('.phrasable').text).to eq 'The Header'
|
19
|
-
expect(page.find('.header').first('.phrasable')['class']).to eq 'phrasable
|
20
|
-
expect(page.find('.header').first('.phrasable')['contenteditable']).to
|
19
|
+
expect(page.find('.header').first('.phrasable')['class']).to eq 'phrasable'
|
20
|
+
expect(page.find('.header').first('.phrasable')['contenteditable']).to be_nil
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'should be able to visit phrasing index via edit_all icon' do
|
@@ -406,4 +406,4 @@ feature "locales" do
|
|
406
406
|
expect(yaml).to match(/es:\s*hello: mundo/)
|
407
407
|
end
|
408
408
|
|
409
|
-
end
|
409
|
+
end
|