effective_bootstrap 0.9.40 → 0.9.44

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
  SHA256:
3
- metadata.gz: 3ec7aa9c72ddbc58533cf76bf8eb8843f957bc2f79be9604f35a41948bbd03e4
4
- data.tar.gz: 064e9a0da7b7d2721953348524dcc38f16cd9fb0bffcaca88fe181aa4d7b9e6e
3
+ metadata.gz: '092f884d4e2928c9cda4247f62caeba2dc0a7b7e7c56b42a4292d611c5d62ee1'
4
+ data.tar.gz: 8059eaec1762f8846cc1d16d668d0e29dd5fa4e7b27edfbb91434c1f9e8d70f0
5
5
  SHA512:
6
- metadata.gz: 1237917f4abb0ab752d26a6c7af13169ed0a971c048cfeb1b984912dc54bfa58e7f6bdf312a9b54fa1108d8cf725fba038e0a876ee492522a7a53345ce99537b
7
- data.tar.gz: 368f386c0683a11fb99060a79a60cd9d6b6870cf9299173b7a1cb7da865ce23c976af625397f6f2fd0c715999d6b266387efb66b8af02ef73792ac6d88696ace
6
+ metadata.gz: f9a5de0079ce76d9fe570233344b892ddb8b56407611cb231dbefe9e46c996894a73f3a48f0df377269a0fbd5472ee8bcbb7fae19968da52f50ff3b1ca0b7926
7
+ data.tar.gz: af189c0bd213dd06adb690673221582d47838ef9ab711e03fc9058c70a8938bfef2da2d6a8c38e14a74c1e4b99f6cc98b004e21e9477355c22c9091fef21ba5b
@@ -6,7 +6,25 @@ uploadActiveStorage = (editor, data) ->
6
6
 
7
7
  upload.create (error, blob) =>
8
8
  url = '/rails/active_storage/blobs/redirect/' + blob.signed_id + '/' + blob.filename
9
- editor.complete({ file: { url: url }}, data.e)
9
+ editor.complete({ file: { url: url, name: blob.filename, content_type: blob.content_type }}, data.e)
10
+
11
+ insertUploadByDrop = (response, e) ->
12
+ if @app.block.is()
13
+ instance = @app.block.get()
14
+ target = e.target
15
+ type = instance.getType()
16
+
17
+ if ((type == 'card' && target && target.tagName == 'IMG' && instance.hasImage()) || type == 'image')
18
+ return @change(response)
19
+ else if (e && type != 'card' && instance.isEditable())
20
+ @app.insertion.insertPoint(e)
21
+
22
+ content_type = (response.file.content_type || '')
23
+
24
+ unless content_type.startsWith('image') && @app.filelink
25
+ @app.filelink._insert(response)
26
+ else
27
+ @insert(response)
10
28
 
11
29
  (this.EffectiveBootstrap || {}).effective_article_editor = ($element, options) ->
12
30
 
@@ -15,4 +33,9 @@ uploadActiveStorage = (editor, data) ->
15
33
  upload: (editor, data) -> uploadActiveStorage(editor, data)
16
34
  }
17
35
 
18
- ArticleEditor($element, options)
36
+ options['filelink'] = {
37
+ upload: (editor, data) -> uploadActiveStorage(editor, data)
38
+ }
39
+
40
+ editor = ArticleEditor($element, options)
41
+ editor.app.image.insertByDrop = insertUploadByDrop
@@ -4,19 +4,27 @@ if <%= !!EffectiveBootstrap.use_custom_data_confirm %> && (window.Rails || $.rai
4
4
  $(document).on 'confirm', (event) ->
5
5
  $obj = $(event.target)
6
6
 
7
- if $obj.data('confirmed')
8
- true
9
- else
10
- $obj.data('confirm-original', $obj.html())
11
- $obj.html($obj.data('confirm'))
12
- $obj.data('confirmed', true)
7
+ # Already confirmed
8
+ return true if $obj.data('confirmed')
9
+
10
+ # Otherwise unconfirmed
11
+ $obj.data('confirm-original', $obj.html())
12
+ $obj.html($obj.data('confirm'))
13
+ $obj.data('confirmed', true)
14
+
15
+ # When using the direct to s3 active storage javascript library
16
+ $activeStorageUpload = $obj.closest('form').find('input[type=file][data-direct-upload-url]')
17
+
18
+ if $activeStorageUpload.length == 0
13
19
  setTimeout(
14
20
  (->
15
21
  $obj.data('confirmed', false)
16
22
  $obj.html($obj.data('confirm-original'))
17
23
  )
18
24
  , 4000)
19
- false # don't show the confirmation dialog
25
+
26
+ # Do not display the confirmation dialog
27
+ false
20
28
 
21
29
  if window.Rails
22
30
  window.Rails.confirm = (message) -> true
@@ -13,7 +13,12 @@ $(document).on 'direct-upload:error', (event) ->
13
13
  $("[data-direct-upload-id=#{event.detail.id}]").addClass('direct-upload--error').attr('title', event.detail.error)
14
14
 
15
15
  $(document).on 'direct-upload:end', (event) ->
16
- $("[data-direct-upload-id=#{event.detail.id}]").addClass('direct-upload--complete')
16
+ $obj = $("[data-direct-upload-id=#{event.detail.id}]")
17
+
18
+ $obj.addClass('direct-upload--complete')
19
+
20
+ # Rails UJS fix
21
+ $obj.closest('form').find('[type=submit][data-confirm]').data('confirmed', true)
17
22
 
18
23
  $(document).on 'change', "input[type='file'][data-click-submit]", (event) ->
19
24
  $(event.currentTarget).closest('form').find('button[type=submit],input[type=submit]').first().click()
@@ -68,7 +68,9 @@ $(document).on 'click', '[data-effective-form-has-many-remove]', (event) ->
68
68
  event.preventDefault()
69
69
 
70
70
  $obj = $(event.currentTarget)
71
- return unless $obj.data('confirmed') if $obj.data('confirm')
71
+
72
+ if (window.Rails && window.Rails.effective_bootstrap_custom_data_confirm) || ($.rails && $.rails.effective_bootstrap_custom_data_confirm)
73
+ return unless $obj.data('confirmed') if $obj.data('confirm')
72
74
 
73
75
  $hasMany = $obj.closest('.form-has-many')
74
76
  return unless $hasMany.length > 0
@@ -371,22 +371,7 @@ module Effective
371
371
  when String
372
372
  defaults.merge(text: obj)
373
373
  when Hash
374
- html_classes = ((obj[:class] || '').split(' ') + (defaults[:class] || '').split(' ')).uniq
375
-
376
- # Try to smart merge bootstrap classes
377
- if (exclusive = html_classes.select { |c| c.include?('-') }).length > 1
378
- EXCLUSIVE_CLASS_PREFIXES.each do |prefix|
379
- prefixed = exclusive.select { |c| c.start_with?(prefix) }
380
- prefixed[1..-1].each { |c| html_classes.delete(c) } if prefixed.length > 1
381
- end
382
-
383
- suffixed = exclusive.select { |c| EXCLUSIVE_CLASS_SUFFIXES.any? { |suffix| c.end_with?(suffix) } }
384
- suffixed[1..-1].each { |c| html_classes.delete(c) } if suffixed.length > 1
385
- end
386
-
387
- obj[:class] = html_classes.join(' ') if html_classes.present?
388
- obj.reverse_merge!(defaults)
389
- obj
374
+ obj.reverse_merge!(defaults); obj
390
375
  else
391
376
  defaults.merge(text: obj.to_s)
392
377
  end
@@ -14,6 +14,7 @@ module Effective
14
14
  body: 'article-editor-body',
15
15
  table: 'table'
16
16
  },
17
+ filelink: nil,
17
18
  grid: {
18
19
  classname: 'row',
19
20
  columns: 12,
@@ -40,7 +41,7 @@ module Effective
40
41
  '12': 'col-sm-12'
41
42
  }
42
43
  },
43
- plugins: ['blockcode', 'cellcolor', 'imageposition', 'imageresize', 'inlineformat', 'listitem', 'removeformat', 'reorder', 'style'],
44
+ plugins: ['blockcode', 'cellcolor', 'imageposition', 'imageresize', 'inlineformat', 'listitem', 'removeformat', 'reorder', 'style', 'filelink'],
44
45
  quote: {
45
46
  template: '<blockquote><p></p></blockquote>'
46
47
  },
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.9.40'.freeze
2
+ VERSION = '0.9.44'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.40
4
+ version: 0.9.44
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-06 00:00:00.000000000 Z
11
+ date: 2021-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails