@scaleflex/widget-url 4.0.6 → 4.1.0

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2019 scaleflex
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2019 scaleflex
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,102 +1,102 @@
1
- # @scaleflex/widget-url
2
-
3
- [![Plugins][plugins-image]](#plugins)
4
- [![Website][filerobot-image]][sfx-url]
5
- [![Version][filerobot-version]][version-url]
6
- [![Scaleflex team][made-by-image]][sfx-url]
7
- [![License][license-image]][license-url]
8
- [![CodeSandbox][codeSandbox-image]][codeSandbox-url]
9
-
10
-
11
- <div align='center'>
12
- <img title="Scaleflex Widget logo" alt="Scaleflex Widget logo" src="https://assets.scaleflex.com/Corporate+Branding/%5B2025%5D+ALL+LOGOS+%2B+ICONS/SCALEFLEX/VXP+logo/Horizontal+White/VXP+logo+WHITE.png?vh=663932" width="140"/>
13
- </div>
14
-
15
- The Url plugin for [Scaleflex Media Asset Widget](https://www.npmjs.com/package/@scaleflex/widget-core)
16
- lets users import files from the Internet. Paste any URL and it’ll be added!
17
-
18
- ## Usage
19
-
20
- ### NPM
21
-
22
- ```bash
23
- npm install --save @scaleflex/widget-url
24
- ```
25
-
26
- ### YARN
27
-
28
- ```bash
29
- yarn add @scaleflex/widget-url
30
- ```
31
-
32
- then
33
-
34
- ```js
35
- import Url from '@scaleflex/widget-url'
36
- ...
37
- ...
38
- ...
39
- scaleflexWidget.use(Url, propertiesObject)
40
- ```
41
-
42
- ### CDN
43
-
44
- The plugin from CDN is found inside `Scaleflex` global object `Scaleflex.Url`
45
-
46
- ```js
47
- const url = window.ScaleflexWidget.Url
48
- ...
49
- ...
50
- ...
51
- scaleflexWidget.use(url, propertiesObject)
52
- ```
53
-
54
- ## Plugin's styles
55
-
56
- ```js
57
- import '@scaleflex/widget-core/dist/style.css'
58
- import '@scaleflex/widget-url/dist/style.css'
59
- ```
60
-
61
- or if you prefer the minified version
62
-
63
- ```js
64
- import '@scaleflex/widget-core/dist/style.min.css'
65
- import '@scaleflex/widget-url/dist/style.min.css'
66
- ```
67
-
68
- > The plugin's css file should be imported after the [Core's css file](../@scaleflex/widget-core/#modules-styles) for having the styles shown correctly.
69
-
70
- ## Properties
71
-
72
- ### `title`
73
-
74
- <u>Type:</u> `string`
75
-
76
- <u>Default:</u> `'Link'`
77
-
78
- The title/label that would be shown & used for the plugin.
79
-
80
- ### `companionHeaders`
81
-
82
- <u>Type:</u> `null` | `object`
83
-
84
- <u>Default:</u> `null`
85
-
86
- If you need to pass additional headers for in companion requests then pass them in this property.
87
-
88
- <!-- Variables -->
89
-
90
- [npm-url]: https://www.npmjs.com/package/@scaleflex/widget-url
91
- [license-url]: https://opensource.org/licenses/MIT
92
- [sfx-url]: https://www.scaleflex.com/
93
- [version-url]: https://www.npmjs.com/package/@scaleflex/widget-url
94
- [codeSandbox-url]: https://codesandbox.io/p/sandbox/scalelfex-widget-v4-sandbox-dtp6l3?file=%2Fsrc%2Findex.js
95
-
96
- [npm-image]: https://img.shields.io/npm/v/@telus/remark-config.svg?style=for-the-badge&logo=npm
97
- [license-image]: https://img.shields.io/badge/license-MIT-blue.svg?style=for-the-badge
98
- [made-by-image]: https://img.shields.io/badge/%3C%2F%3E%20with%20%E2%99%A5%20by-the%20Scaleflex%20team-6986fa.svg?style=for-the-badge
99
- [plugins-image]: https://img.shields.io/static/v1?label=Scaleflex&message=Plugins&color=yellow&style=for-the-badge
100
- [filerobot-image]: https://img.shields.io/static/v1?label=Scaleflex&message=website&color=orange&style=for-the-badge
101
- [filerobot-version]: https://img.shields.io/npm/v/@scaleflex/widget-url?label=Version&style=for-the-badge&logo=npm
102
- [codeSandbox-image]: https://img.shields.io/badge/CodeSandbox-black?style=for-the-badge&logo=CodeSandbox
1
+ # @scaleflex/widget-url
2
+
3
+ [![Plugins][plugins-image]](#plugins)
4
+ [![Website][filerobot-image]][sfx-url]
5
+ [![Version][filerobot-version]][version-url]
6
+ [![Scaleflex team][made-by-image]][sfx-url]
7
+ [![License][license-image]][license-url]
8
+ [![CodeSandbox][codeSandbox-image]][codeSandbox-url]
9
+
10
+
11
+ <div align='center'>
12
+ <img title="Scaleflex Widget logo" alt="Scaleflex Widget logo" src="https://assets.scaleflex.com/Corporate+Branding/%5B2025%5D+ALL+LOGOS+%2B+ICONS/SCALEFLEX/VXP+logo/Horizontal+White/VXP+logo+WHITE.png?vh=663932" width="140"/>
13
+ </div>
14
+
15
+ The Url plugin for [Scaleflex Media Asset Widget](https://www.npmjs.com/package/@scaleflex/widget-core)
16
+ lets users import files from the Internet. Paste any URL and it’ll be added!
17
+
18
+ ## Usage
19
+
20
+ ### NPM
21
+
22
+ ```bash
23
+ npm install --save @scaleflex/widget-url
24
+ ```
25
+
26
+ ### YARN
27
+
28
+ ```bash
29
+ yarn add @scaleflex/widget-url
30
+ ```
31
+
32
+ then
33
+
34
+ ```js
35
+ import Url from '@scaleflex/widget-url'
36
+ ...
37
+ ...
38
+ ...
39
+ scaleflexWidget.use(Url, propertiesObject)
40
+ ```
41
+
42
+ ### CDN
43
+
44
+ The plugin from CDN is found inside `Scaleflex` global object `Scaleflex.Url`
45
+
46
+ ```js
47
+ const url = window.ScaleflexWidget.Url
48
+ ...
49
+ ...
50
+ ...
51
+ scaleflexWidget.use(url, propertiesObject)
52
+ ```
53
+
54
+ ## Plugin's styles
55
+
56
+ ```js
57
+ import '@scaleflex/widget-core/dist/style.css'
58
+ import '@scaleflex/widget-url/dist/style.css'
59
+ ```
60
+
61
+ or if you prefer the minified version
62
+
63
+ ```js
64
+ import '@scaleflex/widget-core/dist/style.min.css'
65
+ import '@scaleflex/widget-url/dist/style.min.css'
66
+ ```
67
+
68
+ > The plugin's css file should be imported after the [Core's css file](../@scaleflex/widget-core/#modules-styles) for having the styles shown correctly.
69
+
70
+ ## Properties
71
+
72
+ ### `title`
73
+
74
+ <u>Type:</u> `string`
75
+
76
+ <u>Default:</u> `'Link'`
77
+
78
+ The title/label that would be shown & used for the plugin.
79
+
80
+ ### `companionHeaders`
81
+
82
+ <u>Type:</u> `null` | `object`
83
+
84
+ <u>Default:</u> `null`
85
+
86
+ If you need to pass additional headers for in companion requests then pass them in this property.
87
+
88
+ <!-- Variables -->
89
+
90
+ [npm-url]: https://www.npmjs.com/package/@scaleflex/widget-url
91
+ [license-url]: https://opensource.org/licenses/MIT
92
+ [sfx-url]: https://www.scaleflex.com/
93
+ [version-url]: https://www.npmjs.com/package/@scaleflex/widget-url
94
+ [codeSandbox-url]: https://codesandbox.io/p/sandbox/scalelfex-widget-v4-sandbox-dtp6l3?file=%2Fsrc%2Findex.js
95
+
96
+ [npm-image]: https://img.shields.io/npm/v/@telus/remark-config.svg?style=for-the-badge&logo=npm
97
+ [license-image]: https://img.shields.io/badge/license-MIT-blue.svg?style=for-the-badge
98
+ [made-by-image]: https://img.shields.io/badge/%3C%2F%3E%20with%20%E2%99%A5%20by-the%20Scaleflex%20team-6986fa.svg?style=for-the-badge
99
+ [plugins-image]: https://img.shields.io/static/v1?label=Scaleflex&message=Plugins&color=yellow&style=for-the-badge
100
+ [filerobot-image]: https://img.shields.io/static/v1?label=Scaleflex&message=website&color=orange&style=for-the-badge
101
+ [filerobot-version]: https://img.shields.io/npm/v/@scaleflex/widget-url?label=Version&style=for-the-badge&logo=npm
102
+ [codeSandbox-image]: https://img.shields.io/badge/CodeSandbox-black?style=for-the-badge&logo=CodeSandbox
@@ -1,60 +1,60 @@
1
1
  import toArray from '@scaleflex/widget-utils/lib/toArray';
2
2
 
3
- /*
4
- SITUATION
5
-
6
- 1. Cross-browser dataTransfer.items
7
-
8
- paste in chrome [Copy Image]:
9
- 0: {kind: "file", type: "image/png"}
10
- 1: {kind: "string", type: "text/html"}
11
- paste in safari [Copy Image]:
12
- 0: {kind: "file", type: "image/png"}
13
- 1: {kind: "string", type: "text/html"}
14
- 2: {kind: "string", type: "text/plain"}
15
- 3: {kind: "string", type: "text/uri-list"}
16
- paste in firefox [Copy Image]:
17
- 0: {kind: "file", type: "image/png"}
18
- 1: {kind: "string", type: "text/html"}
19
-
20
- paste in chrome [Copy Image Address]:
21
- 0: {kind: "string", type: "text/plain"}
22
- paste in safari [Copy Image Address]:
23
- 0: {kind: "string", type: "text/plain"}
24
- 1: {kind: "string", type: "text/uri-list"}
25
- paste in firefox [Copy Image Address]:
26
- 0: {kind: "string", type: "text/plain"}
27
-
28
- drop in chrome [from browser]:
29
- 0: {kind: "string", type: "text/uri-list"}
30
- 1: {kind: "string", type: "text/html"}
31
- drop in safari [from browser]:
32
- 0: {kind: "string", type: "text/uri-list"}
33
- 1: {kind: "string", type: "text/html"}
34
- 2: {kind: "file", type: "image/png"}
35
- drop in firefox [from browser]:
36
- 0: {kind: "string", type: "text/uri-list"}
37
- 1: {kind: "string", type: "text/x-moz-url"}
38
- 2: {kind: "string", type: "text/plain"}
39
-
40
- 2. We can determine if it's a 'copypaste' or a 'drop', but we can't discern between [Copy Image] and [Copy Image Address].
41
-
42
- CONCLUSION
43
-
44
- 1. 'paste' ([Copy Image] or [Copy Image Address], we can't discern between these two)
45
- Don't do anything if there is 'file' item. .handlePaste in the ExplorerPlugin will deal with all 'file' items.
46
- If there are no 'file' items - handle 'text/plain' items.
47
-
48
- 2. 'drop'
49
- Take 'text/uri-list' items. Safari has an additional item of .kind === 'file', and you may worry about the item being duplicated (first by ExplorerPlugin, and then by UrlPlugin, now), but don't. Directory handling code won't pay attention to this particular item of kind 'file'.
3
+ /*
4
+ SITUATION
5
+
6
+ 1. Cross-browser dataTransfer.items
7
+
8
+ paste in chrome [Copy Image]:
9
+ 0: {kind: "file", type: "image/png"}
10
+ 1: {kind: "string", type: "text/html"}
11
+ paste in safari [Copy Image]:
12
+ 0: {kind: "file", type: "image/png"}
13
+ 1: {kind: "string", type: "text/html"}
14
+ 2: {kind: "string", type: "text/plain"}
15
+ 3: {kind: "string", type: "text/uri-list"}
16
+ paste in firefox [Copy Image]:
17
+ 0: {kind: "file", type: "image/png"}
18
+ 1: {kind: "string", type: "text/html"}
19
+
20
+ paste in chrome [Copy Image Address]:
21
+ 0: {kind: "string", type: "text/plain"}
22
+ paste in safari [Copy Image Address]:
23
+ 0: {kind: "string", type: "text/plain"}
24
+ 1: {kind: "string", type: "text/uri-list"}
25
+ paste in firefox [Copy Image Address]:
26
+ 0: {kind: "string", type: "text/plain"}
27
+
28
+ drop in chrome [from browser]:
29
+ 0: {kind: "string", type: "text/uri-list"}
30
+ 1: {kind: "string", type: "text/html"}
31
+ drop in safari [from browser]:
32
+ 0: {kind: "string", type: "text/uri-list"}
33
+ 1: {kind: "string", type: "text/html"}
34
+ 2: {kind: "file", type: "image/png"}
35
+ drop in firefox [from browser]:
36
+ 0: {kind: "string", type: "text/uri-list"}
37
+ 1: {kind: "string", type: "text/x-moz-url"}
38
+ 2: {kind: "string", type: "text/plain"}
39
+
40
+ 2. We can determine if it's a 'copypaste' or a 'drop', but we can't discern between [Copy Image] and [Copy Image Address].
41
+
42
+ CONCLUSION
43
+
44
+ 1. 'paste' ([Copy Image] or [Copy Image Address], we can't discern between these two)
45
+ Don't do anything if there is 'file' item. .handlePaste in the ExplorerPlugin will deal with all 'file' items.
46
+ If there are no 'file' items - handle 'text/plain' items.
47
+
48
+ 2. 'drop'
49
+ Take 'text/uri-list' items. Safari has an additional item of .kind === 'file', and you may worry about the item being duplicated (first by ExplorerPlugin, and then by UrlPlugin, now), but don't. Directory handling code won't pay attention to this particular item of kind 'file'.
50
50
  */
51
51
 
52
- /**
53
- * Finds all links dropped/pasted from one browser window to another.
54
- *
55
- * @param {object} dataTransfer - DataTransfer instance, e.g. e.clipboardData, or e.dataTransfer
56
- * @param {string} isDropOrPaste - either 'drop' or 'paste'
57
- * @param {Function} callback - (urlString) => {}
52
+ /**
53
+ * Finds all links dropped/pasted from one browser window to another.
54
+ *
55
+ * @param {object} dataTransfer - DataTransfer instance, e.g. e.clipboardData, or e.dataTransfer
56
+ * @param {string} isDropOrPaste - either 'drop' or 'paste'
57
+ * @param {Function} callback - (urlString) => {}
58
58
  */
59
59
  export default function forEachDroppedOrPastedUrl(dataTransfer, isDropOrPaste, callback) {
60
60
  var items = toArray(dataTransfer.items);
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@scaleflex/widget-url",
3
3
  "description": "The Url plugin lets users import files from the Internet. Paste any URL and it’ll be added!",
4
- "version": "4.0.6",
4
+ "version": "4.1.0",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
7
7
  "style": "dist/style.min.css",
8
8
  "types": "types/index.d.ts",
9
9
  "dependencies": {
10
- "@scaleflex/widget-common": "^4.0.6",
11
- "@scaleflex/widget-companion-client": "^4.0.6",
12
- "@scaleflex/widget-icons": "^4.0.6",
13
- "@scaleflex/widget-utils": "^4.0.6"
10
+ "@scaleflex/widget-common": "^4.1.0",
11
+ "@scaleflex/widget-companion-client": "^4.1.0",
12
+ "@scaleflex/widget-icons": "^4.1.0",
13
+ "@scaleflex/widget-utils": "^4.1.0"
14
14
  },
15
15
  "devDependencies": {
16
16
  "react": "^19.0.0",
@@ -30,5 +30,5 @@
30
30
  "publishConfig": {
31
31
  "access": "public"
32
32
  },
33
- "gitHead": "17ad9b9abc2add9c8b52ab56e3a72108bee20a7a"
33
+ "gitHead": "471120d67066617a0d8824eae11b07d1f2259473"
34
34
  }
package/types/index.d.ts CHANGED
@@ -1,17 +1,17 @@
1
- import Filerobot = require("@scaleflex/widget-core");
2
- import CompanionClient = require("@scaleflex/widget-companion-client");
3
- import UrlLocale = require("./generatedLocale");
4
-
5
- declare module Url {
6
- export interface UrlOptions
7
- extends Filerobot.PluginOptions,
8
- CompanionClient.RequestClientOptions {
9
- replaceTargetContent?: boolean;
10
- target?: Filerobot.PluginTarget;
11
- locale?: UrlLocale;
12
- }
13
- }
14
-
15
- declare class Url extends Filerobot.Plugin<Url.UrlOptions> {}
16
-
17
- export = Url;
1
+ import Filerobot = require("@scaleflex/widget-core");
2
+ import CompanionClient = require("@scaleflex/widget-companion-client");
3
+ import UrlLocale = require("./generatedLocale");
4
+
5
+ declare module Url {
6
+ export interface UrlOptions
7
+ extends Filerobot.PluginOptions,
8
+ CompanionClient.RequestClientOptions {
9
+ replaceTargetContent?: boolean;
10
+ target?: Filerobot.PluginTarget;
11
+ locale?: UrlLocale;
12
+ }
13
+ }
14
+
15
+ declare class Url extends Filerobot.Plugin<Url.UrlOptions> {}
16
+
17
+ export = Url;