Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@atlaskit/pragmatic-drag-and-drop

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atlaskit/pragmatic-drag-and-drop - npm Package Compare versions

Comparing version 1.2.3 to 1.3.0

10

CHANGELOG.md
# @atlaskit/pragmatic-drag-and-drop
## 1.3.0
### Minor Changes
- [#128458](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/128458)
[`71c5224450c8a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/71c5224450c8a) -
Adding workaround for a [bug in Firefox](https://bugzilla.mozilla.org/show_bug.cgi?id=1912164).
The external adpater optional URL utilities `containsURLs` and `getURLs` will now correctly
recognize URLs dragged from the Firefox address bar or bookmarks in to a Firefox `window`.
## 1.2.3

@@ -4,0 +14,0 @@

2

dist/cjs/adapter/element-adapter.js

@@ -157,3 +157,3 @@ "use strict";

var types = event.dataTransfer.types;
if ((0, _android.isAndroid)() && !types.includes(_textMediaType.textMediaType) && !types.includes(_urlMediaType.urlMediaType)) {
if ((0, _android.isAndroid)() && !types.includes(_textMediaType.textMediaType) && !types.includes(_urlMediaType.URLMediaType)) {
event.dataTransfer.setData(_textMediaType.textMediaType, _android.androidFallbackText);

@@ -160,0 +160,0 @@ }

@@ -9,26 +9,48 @@ "use strict";

var _urlMediaType = require("../../util/media-types/url-media-type");
/**
* 🦊🐞
* When dragging a URL from the Firefox address bar or bookmarks
* they are currently not adding an entry for "text/uri-list".
* They add "text/x-moz-url" data which contains the same information
* in a different format.
*
* [Bug report](https://bugzilla.mozilla.org/show_bug.cgi?id=1912164)
*/
var firefoxURLType = 'text/x-moz-url';
function containsURLs(_ref) {
var source = _ref.source;
return source.types.includes(_urlMediaType.urlMediaType);
return source.types.includes(_urlMediaType.URLMediaType) || source.types.includes(firefoxURLType);
}
function getURLs(_ref2) {
var source = _ref2.source;
var value = source.getStringData(_urlMediaType.urlMediaType);
// no values found
if (value == null) {
return [];
var standard = source.getStringData(_urlMediaType.URLMediaType);
if (standard != null) {
return standard
// You can have multiple urls split by CR+LF (EOL)
// - CR: Carriage Return '\r'
// - LF: Line Feed '\n'
// - EOL: End of Line '\r\n'
.split('\r\n')
// a uri-list can have comment lines starting with '#'
// so we need to remove those
.filter(function (piece) {
return !piece.startsWith('#');
});
}
var urls = value
// You can have multiple urls split by CR+LF (EOL)
// - CR: Carriage Return '\r'
// - LF: Line Feed '\n'
// - EOL: End of Line '\r\n'
.split('\r\n')
// a uri-list can have comment lines starting with '#'
// so we need to remove those
.filter(function (piece) {
return !piece.startsWith('#');
});
return urls;
var fallback = source.getStringData(firefoxURLType);
if (fallback != null) {
return fallback
// Values are split by a single LF: Line Feed (`\n`) character.
// It's not clear from the "text/x-moz-url" documentation that
// it's use `\n` and not `\r\n`, but based on testing and some
// Github code searches it seems like `\n` is correct.
// https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Recommended_drag_types#dragging_links
.split('\n')
// Every second line is the title of the url previous url.
// We are ignoring the page titles in this helper
.filter(function (_, index) {
return index % 2 === 0;
});
}
return [];
}

@@ -6,3 +6,3 @@ "use strict";

});
exports.urlMediaType = void 0;
exports.URLMediaType = void 0;
// Why we put the media types in their own files:

@@ -13,2 +13,2 @@ //

// types and not the external functions code
var urlMediaType = exports.urlMediaType = 'text/uri-list';
var URLMediaType = exports.URLMediaType = 'text/uri-list';

@@ -10,3 +10,3 @@ import { bind } from 'bind-event-listener';

import { textMediaType } from '../util/media-types/text-media-type';
import { urlMediaType } from '../util/media-types/url-media-type';
import { URLMediaType } from '../util/media-types/url-media-type';
import { elementAdapterNativeDataKey } from './element-adapter-native-data-key';

@@ -156,3 +156,3 @@ const draggableRegistry = new WeakMap();

} = event.dataTransfer;
if (isAndroid() && !types.includes(textMediaType) && !types.includes(urlMediaType)) {
if (isAndroid() && !types.includes(textMediaType) && !types.includes(URLMediaType)) {
event.dataTransfer.setData(textMediaType, androidFallbackText);

@@ -159,0 +159,0 @@ }

@@ -1,6 +0,16 @@

import { urlMediaType } from '../../util/media-types/url-media-type';
import { URLMediaType } from '../../util/media-types/url-media-type';
/**
* 🦊🐞
* When dragging a URL from the Firefox address bar or bookmarks
* they are currently not adding an entry for "text/uri-list".
* They add "text/x-moz-url" data which contains the same information
* in a different format.
*
* [Bug report](https://bugzilla.mozilla.org/show_bug.cgi?id=1912164)
*/
const firefoxURLType = 'text/x-moz-url';
export function containsURLs({
source
}) {
return source.types.includes(urlMediaType);
return source.types.includes(URLMediaType) || source.types.includes(firefoxURLType);
}

@@ -10,18 +20,28 @@ export function getURLs({

}) {
const value = source.getStringData(urlMediaType);
// no values found
if (value == null) {
return [];
const standard = source.getStringData(URLMediaType);
if (standard != null) {
return standard
// You can have multiple urls split by CR+LF (EOL)
// - CR: Carriage Return '\r'
// - LF: Line Feed '\n'
// - EOL: End of Line '\r\n'
.split('\r\n')
// a uri-list can have comment lines starting with '#'
// so we need to remove those
.filter(piece => !piece.startsWith('#'));
}
const urls = value
// You can have multiple urls split by CR+LF (EOL)
// - CR: Carriage Return '\r'
// - LF: Line Feed '\n'
// - EOL: End of Line '\r\n'
.split('\r\n')
// a uri-list can have comment lines starting with '#'
// so we need to remove those
.filter(piece => !piece.startsWith('#'));
return urls;
const fallback = source.getStringData(firefoxURLType);
if (fallback != null) {
return fallback
// Values are split by a single LF: Line Feed (`\n`) character.
// It's not clear from the "text/x-moz-url" documentation that
// it's use `\n` and not `\r\n`, but based on testing and some
// Github code searches it seems like `\n` is correct.
// https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Recommended_drag_types#dragging_links
.split('\n')
// Every second line is the title of the url previous url.
// We are ignoring the page titles in this helper
.filter((_, index) => index % 2 === 0);
}
return [];
}

@@ -6,2 +6,2 @@ // Why we put the media types in their own files:

// types and not the external functions code
export const urlMediaType = 'text/uri-list';
export const URLMediaType = 'text/uri-list';

@@ -11,3 +11,3 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";

import { textMediaType } from '../util/media-types/text-media-type';
import { urlMediaType } from '../util/media-types/url-media-type';
import { URLMediaType } from '../util/media-types/url-media-type';
import { elementAdapterNativeDataKey } from './element-adapter-native-data-key';

@@ -150,3 +150,3 @@ var draggableRegistry = new WeakMap();

var types = event.dataTransfer.types;
if (isAndroid() && !types.includes(textMediaType) && !types.includes(urlMediaType)) {
if (isAndroid() && !types.includes(textMediaType) && !types.includes(URLMediaType)) {
event.dataTransfer.setData(textMediaType, androidFallbackText);

@@ -153,0 +153,0 @@ }

@@ -1,26 +0,48 @@

import { urlMediaType } from '../../util/media-types/url-media-type';
import { URLMediaType } from '../../util/media-types/url-media-type';
/**
* 🦊🐞
* When dragging a URL from the Firefox address bar or bookmarks
* they are currently not adding an entry for "text/uri-list".
* They add "text/x-moz-url" data which contains the same information
* in a different format.
*
* [Bug report](https://bugzilla.mozilla.org/show_bug.cgi?id=1912164)
*/
var firefoxURLType = 'text/x-moz-url';
export function containsURLs(_ref) {
var source = _ref.source;
return source.types.includes(urlMediaType);
return source.types.includes(URLMediaType) || source.types.includes(firefoxURLType);
}
export function getURLs(_ref2) {
var source = _ref2.source;
var value = source.getStringData(urlMediaType);
// no values found
if (value == null) {
return [];
var standard = source.getStringData(URLMediaType);
if (standard != null) {
return standard
// You can have multiple urls split by CR+LF (EOL)
// - CR: Carriage Return '\r'
// - LF: Line Feed '\n'
// - EOL: End of Line '\r\n'
.split('\r\n')
// a uri-list can have comment lines starting with '#'
// so we need to remove those
.filter(function (piece) {
return !piece.startsWith('#');
});
}
var urls = value
// You can have multiple urls split by CR+LF (EOL)
// - CR: Carriage Return '\r'
// - LF: Line Feed '\n'
// - EOL: End of Line '\r\n'
.split('\r\n')
// a uri-list can have comment lines starting with '#'
// so we need to remove those
.filter(function (piece) {
return !piece.startsWith('#');
});
return urls;
var fallback = source.getStringData(firefoxURLType);
if (fallback != null) {
return fallback
// Values are split by a single LF: Line Feed (`\n`) character.
// It's not clear from the "text/x-moz-url" documentation that
// it's use `\n` and not `\r\n`, but based on testing and some
// Github code searches it seems like `\n` is correct.
// https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Recommended_drag_types#dragging_links
.split('\n')
// Every second line is the title of the url previous url.
// We are ignoring the page titles in this helper
.filter(function (_, index) {
return index % 2 === 0;
});
}
return [];
}

@@ -6,2 +6,2 @@ // Why we put the media types in their own files:

// types and not the external functions code
export var urlMediaType = 'text/uri-list';
export var URLMediaType = 'text/uri-list';

@@ -1,1 +0,1 @@

export declare const urlMediaType = "text/uri-list";
export declare const URLMediaType = "text/uri-list";

@@ -1,1 +0,1 @@

export declare const urlMediaType = "text/uri-list";
export declare const URLMediaType = "text/uri-list";
{
"name": "@atlaskit/pragmatic-drag-and-drop",
"version": "1.2.3",
"version": "1.3.0",
"description": "The core package for Pragmatic drag and drop - enabling fast drag and drop for any experience on any tech stack",

@@ -5,0 +5,0 @@ "repository": "https://github.com/atlassian/pragmatic-drag-and-drop",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc