scrivito_editors 0.0.8 → 0.0.9
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8932ef4918333e5dfaaf6f17709443047b70d43a
|
4
|
+
data.tar.gz: 6bc0d6dc0e4ed00f1448552050de29219e31435b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 029b31a17c912f02275c8b7736d5275e6cabc7d7c440bc792a74d7f3ef4768d6ce07b057113bf854edee920c043e17d57ee305c26946d3e8f876ced682e0ef21
|
7
|
+
data.tar.gz: 19fe0d897f4d49b9b0ea350c71e2b87964a105a653191935acdb23f8c066a22547c08ddec9eacd452e6b52f2ea73c4b46f50eb339aaf923e78a5b086a247201a
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
+
# v0.0.9
|
2
|
+
* Bugfix: It is now possible to have multiple string and text editors active at the same time.
|
3
|
+
|
1
4
|
# v0.0.8
|
2
5
|
* Use Twitter Bootstrap styling for enum and multienum select fields.
|
3
|
-
|
6
|
+
|
4
7
|
# v0.0.7
|
5
8
|
* Linklist and referencelist editors now better handle all aspects of the inplace editing process
|
6
9
|
for these two attributes. The "add" button no longer has to be rendered by the application code.
|
@@ -1,74 +1,69 @@
|
|
1
1
|
$ ->
|
2
2
|
# This file integrates contenteditable for string attributes.
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
cmsFieldAndPastedContent = ->
|
67
|
-
cmsField.siblings().addBack().not(cmsField.data('siblings_before_edit'))
|
68
|
-
|
4
|
+
timeout = undefined
|
5
|
+
|
6
|
+
onKey = (event) ->
|
7
|
+
if timeout?
|
8
|
+
clearTimeout(timeout)
|
9
|
+
|
10
|
+
cmsField = $(event.currentTarget)
|
11
|
+
key = event.keyCode || event.which
|
12
|
+
|
13
|
+
switch key
|
14
|
+
when 13 # Enter
|
15
|
+
event.preventDefault()
|
16
|
+
cmsField.blur()
|
17
|
+
when 27 # Esc
|
18
|
+
if event.type == 'keyup'
|
19
|
+
event.stopPropagation()
|
20
|
+
cmsField
|
21
|
+
.off('blur')
|
22
|
+
.trigger('scrivito_reload')
|
23
|
+
else
|
24
|
+
setTimeout ->
|
25
|
+
cleanUp(cmsField)
|
26
|
+
|
27
|
+
timeout = setTimeout ( ->
|
28
|
+
save(cmsField, false)
|
29
|
+
), 3000
|
30
|
+
|
31
|
+
onBlur = (event) ->
|
32
|
+
cmsField = $(event.currentTarget)
|
33
|
+
|
34
|
+
save(cmsField, true).done ->
|
35
|
+
if cmsField.attr('data-reload') == 'true'
|
36
|
+
cmsField.trigger('scrivito_reload')
|
37
|
+
|
38
|
+
save = (cmsField, andClose) ->
|
39
|
+
if timeout?
|
40
|
+
clearTimeout(timeout)
|
41
|
+
|
42
|
+
cleanUp(cmsField)
|
43
|
+
|
44
|
+
clone = cmsFieldAndPastedContent(cmsField).clone()
|
45
|
+
clone.find('br').replaceWith('\n')
|
46
|
+
content = clone.text()
|
47
|
+
clone.remove()
|
48
|
+
|
49
|
+
if andClose
|
50
|
+
cmsField.text(content)
|
51
|
+
|
52
|
+
cmsField.scrivito('save', content)
|
53
|
+
|
54
|
+
cleanUp = (cmsField) ->
|
55
|
+
siblings = cmsFieldAndPastedContent(cmsField)
|
56
|
+
pasted = siblings.not(cmsField)
|
57
|
+
if pasted.length > 0
|
58
|
+
pasted.remove()
|
59
|
+
cmsField.text(siblings.text())
|
60
|
+
|
61
|
+
cmsFieldAndPastedContent = (cmsField) ->
|
62
|
+
cmsField.siblings().addBack().not(cmsField.data('siblings_before_edit'))
|
63
|
+
|
64
|
+
initialize = ->
|
69
65
|
$('body').on 'mouseenter', '[data-scrivito-field-type="string"]:not([data-editor]), [data-editor="string"]', (event) ->
|
70
|
-
|
71
|
-
cmsField = $(event.currentTarget)
|
66
|
+
cmsField = $(event.currentTarget)
|
72
67
|
|
73
68
|
unless cmsField.attr('contenteditable')?
|
74
69
|
cmsField
|
@@ -81,3 +76,6 @@ $ ->
|
|
81
76
|
# Prevent editable link strings to follow the link target on click.
|
82
77
|
$('body').on 'click', '[data-scrivito-field-type="string"]:not([data-editor]), [data-editor="string"]', (event) ->
|
83
78
|
event.preventDefault()
|
79
|
+
|
80
|
+
scrivito.on 'editing', ->
|
81
|
+
initialize()
|
@@ -2,77 +2,73 @@ $ ->
|
|
2
2
|
# This file integrates contenteditable for text attributes.
|
3
3
|
# It provides multiline editing support.
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
cmsFieldAndPastedContent = ->
|
65
|
-
cmsField.siblings().addBack().not(cmsField.data('siblings_before_edit'))
|
66
|
-
|
5
|
+
timeout = undefined
|
6
|
+
|
7
|
+
onKey = (event) ->
|
8
|
+
if timeout?
|
9
|
+
clearTimeout(timeout)
|
10
|
+
|
11
|
+
cmsField = $(event.currentTarget)
|
12
|
+
key = event.keyCode || event.which
|
13
|
+
|
14
|
+
switch key
|
15
|
+
when 27 # Esc
|
16
|
+
if event.type == 'keyup'
|
17
|
+
event.stopPropagation()
|
18
|
+
cmsField
|
19
|
+
.off('blur')
|
20
|
+
.trigger('scrivito_reload')
|
21
|
+
else
|
22
|
+
setTimeout ->
|
23
|
+
cleanUp(cmsField)
|
24
|
+
|
25
|
+
timeout = setTimeout ( ->
|
26
|
+
save(cmsField, false)
|
27
|
+
), 3000
|
28
|
+
|
29
|
+
onBlur = (event) ->
|
30
|
+
cmsField = $(event.currentTarget)
|
31
|
+
|
32
|
+
save(cmsField, true).done ->
|
33
|
+
if cmsField.attr('data-reload') == 'true'
|
34
|
+
cmsField.trigger('scrivito_reload')
|
35
|
+
|
36
|
+
save = (cmsField, andClose) ->
|
37
|
+
if timeout?
|
38
|
+
clearTimeout(timeout)
|
39
|
+
|
40
|
+
cleanUp(cmsField)
|
41
|
+
|
42
|
+
clone = cmsFieldAndPastedContent(cmsField).clone()
|
43
|
+
clone.find('br').replaceWith('\n')
|
44
|
+
content = clone.text()
|
45
|
+
clone.remove()
|
46
|
+
|
47
|
+
if andClose
|
48
|
+
cmsField.text(content)
|
49
|
+
|
50
|
+
cmsField.scrivito('save', content)
|
51
|
+
|
52
|
+
cleanUp = (cmsField) ->
|
53
|
+
siblings = cmsFieldAndPastedContent(cmsField)
|
54
|
+
pasted = siblings.not(cmsField)
|
55
|
+
if pasted.length > 0
|
56
|
+
pasted.remove()
|
57
|
+
cmsField.text(siblings.text())
|
58
|
+
|
59
|
+
cmsFieldAndPastedContent = (cmsField) ->
|
60
|
+
cmsField.siblings().addBack().not(cmsField.data('siblings_before_edit'))
|
61
|
+
|
62
|
+
initialize = ->
|
67
63
|
$('body').on 'mouseenter', '[data-scrivito-field-type="text"]:not([data-editor]), [data-editor="text"]', (event) ->
|
68
|
-
|
69
|
-
cmsField = $(event.currentTarget)
|
70
|
-
|
71
|
-
html = cmsField.html()
|
72
|
-
html_nl2br = html.replace(/\n/g, '<br />')
|
73
|
-
cmsField.html(html_nl2br) if html != html_nl2br
|
64
|
+
cmsField = $(event.currentTarget)
|
74
65
|
|
75
66
|
unless cmsField.attr('contenteditable')?
|
67
|
+
html = cmsField.html()
|
68
|
+
html_nl2br = html.replace(/\n/g, '<br />')
|
69
|
+
if html != html_nl2br
|
70
|
+
cmsField.html(html_nl2br)
|
71
|
+
|
76
72
|
cmsField
|
77
73
|
.data('siblings_before_edit', cmsField.siblings())
|
78
74
|
.attr('contenteditable', true)
|
@@ -83,3 +79,6 @@ $ ->
|
|
83
79
|
# Prevent editable link text to follow the link target on click.
|
84
80
|
$('body').on 'click', '[data-scrivito-field-type="text"]:not([data-editor]), [data-editor="text"]', (event) ->
|
85
81
|
event.preventDefault()
|
82
|
+
|
83
|
+
scrivito.on 'editing', ->
|
84
|
+
initialize()
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scrivito_editors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scrivito
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|