bard-attachment_field 0.6.1 → 0.6.3

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: 6bef7d86b4bd8938fe4944c96dde471a868af65c72817f254bad2ef989840eb3
4
- data.tar.gz: b40d5ad52b14aa85e4a695dbc7f2aaa58cf2ae6d75b11860100a7818805a1e51
3
+ metadata.gz: edba1eefd3a08f4e68003f8fdb54f1c56d182c7fa7861a3a776a0bc03b144720
4
+ data.tar.gz: fe58cfe7d8528cb324bcce8b2b5dc5c786a9ab25e8f05cf24673a6f87e6b8542
5
5
  SHA512:
6
- metadata.gz: 8907713c89cfab1718f7a812a23c49b604abe65e4a613669760f63d8a22790ffaed0ac19af0682262237a9557d3c45221f7c5f4ede50255cbec48564e412418f
7
- data.tar.gz: cf825d567f49628992b93247ac2668b6adf35204dda72c0aa1701fe537bf247d9214bfb14d688e64d2e4593e70b4720dc449d3a345c1d4451ccaf62b48243395
6
+ metadata.gz: d3d9fc5faa9d0d7b195e7c15dce24fc9484644da25df67adb254362927d397ddd409de1a0a8e023f9e91c060633219a9bd3456a20c146973947ebcd38d8deba7
7
+ data.tar.gz: 134d8975835697d189f17da80a3aaa1832b115b0b7d632245acd5d29f9ae24a05de4cef61110097dae50bbbbee25465ef6aebc89de74b7dbbb784121792a62f3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.6.2] - 2026-07-23
4
+
5
+ ### Bug Fixes
6
+
7
+ - Clicking a `<video>` preview to play/pause no longer opens the file picker.
8
+ The click handler now stops propagation so it doesn't bubble to the
9
+ `<file-drop>` wrapper, which opens the upload dialog on click.
10
+
3
11
  ## [0.6.1] - 2026-06-24
4
12
 
5
13
  ### Bug Fixes
@@ -4087,7 +4087,7 @@ var a = proxyCustomElement(class extends H {
4087
4087
  src;
4088
4088
  filetype;
4089
4089
  render() {
4090
- return h(Host, { key: "429f17fda03ded975255da6335ba23a663ee662e", class: this.computeClass() }, this.isImage() && h("img", { key: "daa4e38cb1375db7d8852ab1cb401f048efbbdc7", src: this.src }), this.isVideo() && h("video", { key: "1b7860bc3edf2f4ba4951dd0bd8a88f14db078a0", src: this.src, onClick: n }), this.isOther() && "This file does not offer a preview", h("slot", { key: "b8a894bcc9ae11619d543b20f2bd2ee9167616d8" }));
4090
+ return h(Host, { key: "429f17fda03ded975255da6335ba23a663ee662e", class: this.computeClass() }, this.isImage() && h("img", { key: "daa4e38cb1375db7d8852ab1cb401f048efbbdc7", src: this.src }), this.isVideo() && h("video", { key: "1b7860bc3edf2f4ba4951dd0bd8a88f14db078a0", src: this.src, onClick: c }), this.isOther() && "This file does not offer a preview", h("slot", { key: "b8a894bcc9ae11619d543b20f2bd2ee9167616d8" }));
4091
4091
  }
4092
4092
  computeClass() {
4093
4093
  return this.isImage() ? "image" : this.isVideo() ? "video" : "other";
@@ -4105,8 +4105,8 @@ var a = proxyCustomElement(class extends H {
4105
4105
  return ":host{display:block;font-size:13px}img,video{max-width:100%;margin-top:10px}";
4106
4106
  }
4107
4107
  }, [769, "attachment-preview", { src: [513], filetype: [513] }]);
4108
- var n = function() {
4109
- return this.paused ? this.play() : this.pause(), false;
4108
+ var c = function(e3) {
4109
+ e3.stopPropagation(), this.paused ? this.play() : this.pause();
4110
4110
  };
4111
4111
 
4112
4112
  // dist/components/attachment-file2.js
@@ -8,4 +8,31 @@ describe('attachment-preview', () => {
8
8
  const element = await page.find('attachment-preview');
9
9
  expect(element).toHaveClass('hydrated');
10
10
  });
11
+
12
+ it('does not bubble video preview clicks to ancestor upload handlers', async () => {
13
+ const page = await newE2EPage();
14
+ await page.setContent(`
15
+ <div id="drop">
16
+ <attachment-preview filetype="video" src="data:video/mp4;base64,AAAA"></attachment-preview>
17
+ </div>
18
+ `);
19
+ await page.evaluate(() => {
20
+ (window as any).ancestorClicked = false;
21
+ document
22
+ .getElementById('drop')
23
+ .addEventListener('click', () => { (window as any).ancestorClicked = true; });
24
+ const video = document
25
+ .querySelector('attachment-preview')
26
+ .shadowRoot.querySelector('video') as any;
27
+ video.play = () => Promise.resolve();
28
+ video.pause = () => {};
29
+ });
30
+
31
+ const video = await page.find('attachment-preview >>> video');
32
+ await video.click();
33
+ await page.waitForChanges();
34
+
35
+ const ancestorClicked = await page.evaluate(() => (window as any).ancestorClicked);
36
+ expect(ancestorClicked).toBe(false);
37
+ });
11
38
  });
@@ -39,4 +39,7 @@ export class AttachmentPreview {
39
39
  }
40
40
  }
41
41
 
42
- const toggle = function() { this.paused ? this.play() : this.pause(); return false }
42
+ const toggle = function(event) {
43
+ event.stopPropagation()
44
+ this.paused ? this.play() : this.pause()
45
+ }
@@ -92,7 +92,7 @@ module Bard::AttachmentField::TestHelper
92
92
  end
93
93
 
94
94
  def get_files(field)
95
- field.all("attachment-file").map { |e| e[:filename] }
95
+ field.all("attachment-file", minimum: 0).map { |e| e[:filename] }
96
96
  end
97
97
 
98
98
  def validation_messages(session, element)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Bard
4
4
  module AttachmentField
5
- VERSION = "0.6.1"
5
+ VERSION = "0.6.3"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bard-attachment_field
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-06-24 00:00:00.000000000 Z
11
+ date: 2026-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activestorage