@gradio/multimodaltextbox 0.2.2 → 0.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @gradio/multimodaltextbox
2
2
 
3
+ ## 0.2.4
4
+
5
+ ### Dependency updates
6
+
7
+ - @gradio/utils@0.3.1
8
+ - @gradio/atoms@0.6.2
9
+ - @gradio/statustracker@0.4.11
10
+ - @gradio/upload@0.8.4
11
+ - @gradio/image@0.9.11
12
+ - @gradio/client@0.15.1
13
+
14
+ ## 0.2.3
15
+
16
+ ### Features
17
+
18
+ - [#7875](https://github.com/gradio-app/gradio/pull/7875) [`e6d051d`](https://github.com/gradio-app/gradio/commit/e6d051dc8a497fdd6b4cfbd57efd4c8015b97a66) - Paste Images into MultimodalTextbox. Thanks @abidlabs!
19
+
20
+ ### Dependency updates
21
+
22
+ - @gradio/upload@0.8.3
23
+ - @gradio/client@0.15.0
24
+ - @gradio/image@0.9.10
25
+
3
26
  ## 0.2.2
4
27
 
5
28
  ### Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/multimodaltextbox",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -14,12 +14,12 @@
14
14
  "./package.json": "./package.json"
15
15
  },
16
16
  "dependencies": {
17
- "@gradio/atoms": "^0.6.1",
17
+ "@gradio/atoms": "^0.6.2",
18
18
  "@gradio/icons": "^0.3.4",
19
- "@gradio/upload": "^0.8.2",
20
- "@gradio/image": "^0.9.9",
21
- "@gradio/statustracker": "^0.4.10",
22
- "@gradio/client": "^0.14.0",
23
- "@gradio/utils": "^0.3.0"
19
+ "@gradio/statustracker": "^0.4.11",
20
+ "@gradio/upload": "^0.8.4",
21
+ "@gradio/image": "^0.9.11",
22
+ "@gradio/client": "^0.15.1",
23
+ "@gradio/utils": "^0.3.1"
24
24
  }
25
25
  }
@@ -35,6 +35,8 @@
35
35
  export let root: string;
36
36
  export let file_types: string[] | null = null;
37
37
 
38
+ let upload_component: Upload;
39
+ let hidden_upload: HTMLInputElement;
38
40
  let el: HTMLTextAreaElement | HTMLInputElement;
39
41
  let can_scroll: boolean;
40
42
  let previous_scroll_top = 0;
@@ -172,8 +174,6 @@
172
174
  value = value;
173
175
  }
174
176
 
175
- let hidden_upload: HTMLInputElement;
176
-
177
177
  function handle_upload_click(): void {
178
178
  if (hidden_upload) {
179
179
  hidden_upload.click();
@@ -183,6 +183,18 @@
183
183
  async function handle_submit(): Promise<void> {
184
184
  dispatch("submit");
185
185
  }
186
+
187
+ function handle_paste(event: ClipboardEvent): void {
188
+ if (!event.clipboardData) return;
189
+ const items = event.clipboardData.items;
190
+ for (let index in items) {
191
+ const item = items[index];
192
+ if (item.kind === "file" && item.type.includes("image")) {
193
+ const blob = item.getAsFile();
194
+ if (blob) upload_component.load_files([blob]);
195
+ }
196
+ }
197
+ }
186
198
  </script>
187
199
 
188
200
  <!-- svelte-ignore a11y-autofocus -->
@@ -190,6 +202,7 @@
190
202
  <BlockTitle {show_label} {info}>{label}</BlockTitle>
191
203
  <div class="input-container">
192
204
  <Upload
205
+ bind:this={upload_component}
193
206
  on:load={handle_upload}
194
207
  filetype={accept_file_types}
195
208
  {root}
@@ -268,6 +281,7 @@
268
281
  on:select={handle_select}
269
282
  on:focus
270
283
  on:scroll={handle_scroll}
284
+ on:paste={handle_paste}
271
285
  style={text_align ? "text-align: " + text_align : ""}
272
286
  />
273
287
  </Upload>