phoenix_live_view 0.19.2 → 0.19.4

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.
@@ -61,7 +61,7 @@ let DOM = {
61
61
  wantsNewTab(e){
62
62
  let wantsNewTab = e.ctrlKey || e.shiftKey || e.metaKey || (e.button && e.button === 1)
63
63
  let isDownload = (e.target instanceof HTMLAnchorElement && e.target.hasAttribute("download"))
64
- let isTargetBlank = e.target.getAttribute("target") === "_blank"
64
+ let isTargetBlank = e.target.hasAttribute("target") && e.target.getAttribute("target").toLowerCase() === "_blank"
65
65
  return wantsNewTab || isTargetBlank || isDownload
66
66
  },
67
67
 
@@ -488,4 +488,4 @@ let DOM = {
488
488
  }
489
489
  }
490
490
 
491
- export default DOM
491
+ export default DOM
@@ -9,12 +9,14 @@ export default class EntryUploader {
9
9
  this.offset = 0
10
10
  this.chunkSize = chunkSize
11
11
  this.chunkTimer = null
12
+ this.errored = false
12
13
  this.uploadChannel = liveSocket.channel(`lvu:${entry.ref}`, {token: entry.metadata()})
13
14
  }
14
15
 
15
16
  error(reason){
17
+ if(this.errored){ return }
18
+ this.errored = true
16
19
  clearTimeout(this.chunkTimer)
17
- this.uploadChannel.leave()
18
20
  this.entry.error(reason)
19
21
  }
20
22
 
@@ -50,5 +52,6 @@ export default class EntryUploader {
50
52
  this.chunkTimer = setTimeout(() => this.readNextChunk(), this.liveSocket.getLatencySim() || 0)
51
53
  }
52
54
  })
55
+ .receive("error", ({reason}) => this.error(reason))
53
56
  }
54
57
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phoenix_live_view",
3
- "version": "0.19.2",
3
+ "version": "0.19.4",
4
4
  "description": "The Phoenix LiveView JavaScript client.",
5
5
  "license": "MIT",
6
6
  "repository": {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phoenix_live_view",
3
- "version": "0.19.2",
3
+ "version": "0.19.4",
4
4
  "description": "The Phoenix LiveView JavaScript client.",
5
5
  "license": "MIT",
6
6
  "module": "./priv/static/phoenix_live_view.esm.js",
@@ -109,11 +109,15 @@ var EntryUploader = class {
109
109
  this.offset = 0;
110
110
  this.chunkSize = chunkSize;
111
111
  this.chunkTimer = null;
112
+ this.errored = false;
112
113
  this.uploadChannel = liveSocket.channel(`lvu:${entry.ref}`, { token: entry.metadata() });
113
114
  }
114
115
  error(reason) {
116
+ if (this.errored) {
117
+ return;
118
+ }
119
+ this.errored = true;
115
120
  clearTimeout(this.chunkTimer);
116
- this.uploadChannel.leave();
117
121
  this.entry.error(reason);
118
122
  }
119
123
  upload() {
@@ -145,7 +149,7 @@ var EntryUploader = class {
145
149
  if (!this.isDone()) {
146
150
  this.chunkTimer = setTimeout(() => this.readNextChunk(), this.liveSocket.getLatencySim() || 0);
147
151
  }
148
- });
152
+ }).receive("error", ({ reason }) => this.error(reason));
149
153
  }
150
154
  };
151
155
 
@@ -312,7 +316,7 @@ var DOM = {
312
316
  wantsNewTab(e) {
313
317
  let wantsNewTab = e.ctrlKey || e.shiftKey || e.metaKey || e.button && e.button === 1;
314
318
  let isDownload = e.target instanceof HTMLAnchorElement && e.target.hasAttribute("download");
315
- let isTargetBlank = e.target.getAttribute("target") === "_blank";
319
+ let isTargetBlank = e.target.hasAttribute("target") && e.target.getAttribute("target").toLowerCase() === "_blank";
316
320
  return wantsNewTab || isTargetBlank || isDownload;
317
321
  },
318
322
  isUnloadableFormSubmit(e) {