simplec 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6da431d0794fc83ae168fc4d1f2855c197d92c88
4
- data.tar.gz: 9cd04030ce94fbd255a5a5e7405acfe408950821
2
+ SHA256:
3
+ metadata.gz: 6c5c2b1f64ae1b643867b467dcf837eda87b347e10c5c993843a21c7f3fc70cf
4
+ data.tar.gz: 9c2d2e28104710ec36ca402b1c58c1f96c27d534ec5fd5b8a20efaf40e81f608
5
5
  SHA512:
6
- metadata.gz: 402d2c6060119484e6cf59095622ca890487c6e31c5d7fd1484cde6e2dc98bd8bcf57db646f76f88ddf7a3c994676511be1d4e729f1cc7ec0c293833cfc208f1
7
- data.tar.gz: 8a09931c608d7c9e30343808d587d0869be34b912a9e88c7fa98655735c9c90b9a02e391dcd066a217fcfd8049b5ccdfe8fd8458671d888b0a4f9c302b5d0819
6
+ metadata.gz: 1bc7d27d0fcfe823dba6b7be4d87fa635077f0ebdba3781ffbab53ce4c05f458a28bd837e9e3d39b3d27785057ac9338aab27e295e09b4f13ef2b135db4ac99b
7
+ data.tar.gz: c0e7ac175f44165692551c6210bca7046dde03c9a07a97a9d16e6ed8aabbab06550ab8910d70bab498a1ff0ae214c2681adee9c7b10537fd889830358c6e04b9
@@ -25,59 +25,65 @@ $.summernote.options.toolbar = [
25
25
  if (!window.simplec) window.simplec = {};
26
26
 
27
27
  window.simplec.initSummernote = function() {
28
- window.simplec.summernoteInitialized = true;
28
+ $('.editor-field').each(function(idx, el) {
29
+ var $el = $(el);
29
30
 
30
- $('.editor-field').on('summernote.init', function(event) {
31
+ if ($el.data('simplec') !== 'initialized') {
32
+ console.log('adding summernote', el);
31
33
 
32
- // Material Kit Hack
33
- //$('.note-toolbar .btn-default').
34
- // removeClass('btn-default').addClass('btn-simple');
34
+ $el.on('summernote.init', function(event) {
35
+ // Material Kit Hack
36
+ //$('.note-toolbar .btn-default').
37
+ // removeClass('btn-default').addClass('btn-simple');
35
38
 
36
- //$('.note-popover').css({'display': 'none'}); // BS4 HACK
37
- var $editor = $(event.target),
38
- $input = $($editor.data('input'));
39
- if ($input.val().length > 0) $editor.summernote('code', $input.val());
40
- }).on('summernote.change', function(event, contents, $editable) {
41
- var $editor = $(event.target),
42
- $input = $($editor.data('input'));
43
- $input.val(contents);
44
- }.bind(window)).on('summernote.image.upload', function(event, files) {
45
- console.log('upload event');
46
- for (var i = 0; i < files.length; i++) {
47
- var file = files[i],
48
- reader = new FileReader();
49
- reader.onloadend = function() {
50
- $.ajax({
51
- method: 'POST',
52
- url: '/embedded-images',
53
- dataType: 'json',
54
- contentType: 'application/json',
55
- headers: { 'X-Engine': 'simplec' },
56
- data: JSON.stringify({
57
- asset_url: reader.result,
58
- asset_name: file.name
59
- })
60
- }).fail(function(data, textStatus, jqXHR){
61
- console.log('IMAGE UPLOAD FAIL', textStatus);
62
- }).done(function(data, textStatus, jqXHR){
63
- $(event.target).summernote(
64
- 'insertImage',
65
- jqXHR.responseJSON.asset_url, jqXHR.responseJSON.asset_name
66
- );
67
- });
68
- };
69
- reader.readAsDataURL(file);
70
- }
71
- });
39
+ //$('.note-popover').css({'display': 'none'}); // BS4 HACK
40
+ var $editor = $(event.target),
41
+ $input = $($editor.data('input'));
42
+ if ($input.val().length > 0) $editor.summernote('code', $input.val());
43
+ }).on('summernote.change', function(event, contents, $editable) {
44
+ var $editor = $(event.target),
45
+ $input = $($editor.data('input'));
46
+ $input.val(contents);
47
+ }.bind(window)).on('summernote.image.upload', function(event, files) {
48
+ console.log('upload event');
49
+ for (var i = 0; i < files.length; i++) {
50
+ var file = files[i],
51
+ reader = new FileReader();
52
+ reader.onloadend = function() {
53
+ $.ajax({
54
+ method: 'POST',
55
+ url: '/embedded-images',
56
+ dataType: 'json',
57
+ contentType: 'application/json',
58
+ headers: { 'X-Engine': 'simplec' },
59
+ data: JSON.stringify({
60
+ asset_url: reader.result,
61
+ asset_name: file.name
62
+ })
63
+ }).fail(function(data, textStatus, jqXHR){
64
+ console.log('IMAGE UPLOAD FAIL', textStatus);
65
+ }).done(function(data, textStatus, jqXHR){
66
+ $(event.target).summernote(
67
+ 'insertImage',
68
+ jqXHR.responseJSON.asset_url, jqXHR.responseJSON.asset_name
69
+ );
70
+ });
71
+ };
72
+ reader.readAsDataURL(file);
73
+ }
74
+ });
72
75
 
73
- $('.editor-field').summernote({
74
- height: 500,
75
- minHeight: 100,
76
- maxHeight: 1200
77
- });
76
+ $el.summernote({
77
+ height: 500,
78
+ minHeight: 100,
79
+ maxHeight: 1200
80
+ });
78
81
 
82
+ $el.attr('data-simplec', 'initialized');
83
+ }
84
+ });
79
85
  };
80
86
 
81
87
  $(document).on('ready turbolinks:load', function() {
82
- if (!window.simplec.summernoteInitialized) window.simplec.initSummernote();
88
+ window.simplec.initSummernote();
83
89
  });
@@ -1,3 +1,3 @@
1
1
  module Simplec
2
- VERSION = '0.9.0'
2
+ VERSION = '0.9.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-16 00:00:00.000000000 Z
11
+ date: 2018-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -185,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
185
  version: '0'
186
186
  requirements: []
187
187
  rubyforge_project:
188
- rubygems_version: 2.6.11
188
+ rubygems_version: 2.7.6
189
189
  signing_key:
190
190
  specification_version: 4
191
191
  summary: Developer oriented CMS.