alchemy_cms 8.2.4 → 8.2.5

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.
@@ -10,12 +10,12 @@ module Alchemy
10
10
  end
11
11
 
12
12
  def call
13
- form_tag(helpers.url_for, method: :get) do
14
- if auto_submit
13
+ if auto_submit
14
+ form_tag(helpers.url_for, method: :get) do
15
15
  content_tag("alchemy-auto-submit", locale_select)
16
- else
17
- locale_select
18
16
  end
17
+ else
18
+ locale_select
19
19
  end
20
20
  end
21
21
 
@@ -89,7 +89,20 @@ export default class ImageCropper {
89
89
  }
90
90
 
91
91
  reset() {
92
- this.#cropper.setData(this.defaultBoxSize)
92
+ const cropper = this.#cropper
93
+ // Apply the default size. cropperjs clamps the crop box to its maximum size.
94
+ cropper.setData(this.defaultBoxSize)
95
+ // When the default box sits at the maximum crop box size, sub-pixel rounding
96
+ // makes cropperjs treat setData's box as oversized and revert its position
97
+ // (renderCropBox resets top/left to their old values). Re-apply the position
98
+ // in canvas coordinates afterwards – that does not touch the size, so it is
99
+ // not reverted and the mask actually moves to the default box.
100
+ const canvas = cropper.getCanvasData()
101
+ const scale = canvas.width / canvas.naturalWidth
102
+ cropper.setCropBoxData({
103
+ left: canvas.left + this.defaultBoxSize.x * scale,
104
+ top: canvas.top + this.defaultBoxSize.y * scale
105
+ })
93
106
  this.update(this.defaultBoxSize)
94
107
  }
95
108
 
@@ -66,7 +66,7 @@ module Alchemy
66
66
  end
67
67
 
68
68
  def get_item_class(item_type)
69
- "Alchemy::Configuration::#{item_type.to_s.classify}Option".constantize
69
+ "Alchemy::Configuration::#{item_type.to_s.camelcase}Option".constantize
70
70
  end
71
71
  end
72
72
  end
@@ -16,11 +16,21 @@ module Alchemy
16
16
  @request = request
17
17
  @params = @request.params
18
18
 
19
- handable_format? && no_rails_route?
19
+ handable_format? && no_dotfile_route? && no_rails_route?
20
20
  end
21
21
 
22
22
  private
23
23
 
24
+ # We don't want to handle requests to dotfile URLs.
25
+ #
26
+ # A page urlname never starts with a dot, so any such request
27
+ # (/.well-known/ ACME challenges, /.env or /.git probes, etc.)
28
+ # should never be served by a page.
29
+ #
30
+ def no_dotfile_route?
31
+ !@params["urlname"].start_with?(".")
32
+ end
33
+
24
34
  # We only want html requests to be handled by us.
25
35
  #
26
36
  # If an unknown format is requested we want to handle this,
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Alchemy
4
- VERSION = "8.2.4"
4
+ VERSION = "8.2.5"
5
5
 
6
6
  def self.version
7
7
  VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.2.4
4
+ version: 8.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen