@atlaskit/editor-common 75.6.1 → 75.7.1
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 +12 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/selection/index.js +20 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/selection/index.js +19 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/selection/index.js +19 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/selection/index.d.ts +6 -1
- package/dist/types/selection/types.d.ts +6 -0
- package/dist/types/types/annotation/index.d.ts +4 -3
- package/dist/types-ts4.5/selection/index.d.ts +6 -1
- package/dist/types-ts4.5/selection/types.d.ts +6 -0
- package/dist/types-ts4.5/types/annotation/index.d.ts +4 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 75.7.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`7b3e5b2915d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7b3e5b2915d) - Dummy change to bump version
|
|
8
|
+
|
|
9
|
+
## 75.7.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`8cb8dafa05a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cb8dafa05a) - [ED-19774] Removing ../selection imports where possible. selectionPlugin imports still exist until we have an extracted package for selection.
|
|
14
|
+
|
|
3
15
|
## 75.6.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
17
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
18
18
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
19
|
-
var packageVersion = "75.
|
|
19
|
+
var packageVersion = "75.7.1";
|
|
20
20
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
21
21
|
// Remove URL as it has UGC
|
|
22
22
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -57,6 +57,7 @@ Object.defineProperty(exports, "atTheEndOfDoc", {
|
|
|
57
57
|
return _utils3.atTheEndOfDoc;
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
|
+
exports.createSelectionClickHandler = createSelectionClickHandler;
|
|
60
61
|
Object.defineProperty(exports, "endPositionOfParent", {
|
|
61
62
|
enumerable: true,
|
|
62
63
|
get: function get() {
|
|
@@ -200,4 +201,22 @@ var selectNode = function selectNode(pos) {
|
|
|
200
201
|
return true;
|
|
201
202
|
};
|
|
202
203
|
};
|
|
203
|
-
exports.selectNode = selectNode;
|
|
204
|
+
exports.selectNode = selectNode;
|
|
205
|
+
function createSelectionClickHandler(nodes, isValidTarget, options) {
|
|
206
|
+
return function handleClickOn(view, pos, node, nodePos, event, direct) {
|
|
207
|
+
if (options.useLongPressSelection) {
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
if (direct && nodes.indexOf(node.type.name) !== -1) {
|
|
211
|
+
if (event.target) {
|
|
212
|
+
var _target = event.target;
|
|
213
|
+
if (isValidTarget(_target)) {
|
|
214
|
+
var selectionPos = options.getNodeSelectionPos ? options.getNodeSelectionPos(view.state, nodePos) : nodePos;
|
|
215
|
+
selectNode(selectionPos)(view.state, view.dispatch);
|
|
216
|
+
return true;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return false;
|
|
221
|
+
};
|
|
222
|
+
}
|
|
@@ -24,7 +24,7 @@ var _templateObject, _templateObject2, _templateObject3;
|
|
|
24
24
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
25
25
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
|
|
26
26
|
var packageName = "@atlaskit/editor-common";
|
|
27
|
-
var packageVersion = "75.
|
|
27
|
+
var packageVersion = "75.7.1";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
2
2
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
3
|
-
const packageVersion = "75.
|
|
3
|
+
const packageVersion = "75.7.1";
|
|
4
4
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
5
5
|
// Remove URL as it has UGC
|
|
6
6
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -93,4 +93,22 @@ export const selectNode = pos => (state, dispatch) => {
|
|
|
93
93
|
dispatch(state.tr.setSelection(new NodeSelection(state.doc.resolve(pos))));
|
|
94
94
|
}
|
|
95
95
|
return true;
|
|
96
|
-
};
|
|
96
|
+
};
|
|
97
|
+
export function createSelectionClickHandler(nodes, isValidTarget, options) {
|
|
98
|
+
return function handleClickOn(view, pos, node, nodePos, event, direct) {
|
|
99
|
+
if (options.useLongPressSelection) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
if (direct && nodes.indexOf(node.type.name) !== -1) {
|
|
103
|
+
if (event.target) {
|
|
104
|
+
const target = event.target;
|
|
105
|
+
if (isValidTarget(target)) {
|
|
106
|
+
const selectionPos = options.getNodeSelectionPos ? options.getNodeSelectionPos(view.state, nodePos) : nodePos;
|
|
107
|
+
selectNode(selectionPos)(view.state, view.dispatch);
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return false;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
@@ -9,7 +9,7 @@ import { themed } from '@atlaskit/theme/components';
|
|
|
9
9
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
10
10
|
import Layer from '../Layer';
|
|
11
11
|
const packageName = "@atlaskit/editor-common";
|
|
12
|
-
const packageVersion = "75.
|
|
12
|
+
const packageVersion = "75.7.1";
|
|
13
13
|
const halfFocusRing = 1;
|
|
14
14
|
const dropOffset = '0, 8';
|
|
15
15
|
class DropList extends Component {
|
|
@@ -6,7 +6,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
7
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
8
8
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
9
|
-
var packageVersion = "75.
|
|
9
|
+
var packageVersion = "75.7.1";
|
|
10
10
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
11
11
|
// Remove URL as it has UGC
|
|
12
12
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -93,4 +93,22 @@ export var selectNode = function selectNode(pos) {
|
|
|
93
93
|
}
|
|
94
94
|
return true;
|
|
95
95
|
};
|
|
96
|
-
};
|
|
96
|
+
};
|
|
97
|
+
export function createSelectionClickHandler(nodes, isValidTarget, options) {
|
|
98
|
+
return function handleClickOn(view, pos, node, nodePos, event, direct) {
|
|
99
|
+
if (options.useLongPressSelection) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
if (direct && nodes.indexOf(node.type.name) !== -1) {
|
|
103
|
+
if (event.target) {
|
|
104
|
+
var _target = event.target;
|
|
105
|
+
if (isValidTarget(_target)) {
|
|
106
|
+
var selectionPos = options.getNodeSelectionPos ? options.getNodeSelectionPos(view.state, nodePos) : nodePos;
|
|
107
|
+
selectNode(selectionPos)(view.state, view.dispatch);
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return false;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
@@ -19,7 +19,7 @@ import { themed } from '@atlaskit/theme/components';
|
|
|
19
19
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
20
20
|
import Layer from '../Layer';
|
|
21
21
|
var packageName = "@atlaskit/editor-common";
|
|
22
|
-
var packageVersion = "75.
|
|
22
|
+
var packageVersion = "75.7.1";
|
|
23
23
|
var halfFocusRing = 1;
|
|
24
24
|
var dropOffset = '0, 8';
|
|
25
25
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
4
|
import type { AnalyticsEventPayload } from '../analytics';
|
|
4
5
|
import type { Command } from '../types';
|
|
5
6
|
export { RelativeSelectionPos } from './types';
|
|
6
|
-
export type { SelectionPluginState, EditorSelectionAPI } from './types';
|
|
7
|
+
export type { SelectionPluginState, EditorSelectionAPI, SelectionPluginOptions, SelectionSharedState, } from './types';
|
|
7
8
|
export { GapCursorSelection, Side, JSON_ID, GapBookmark, } from './gap-cursor/selection';
|
|
8
9
|
export { isIgnored, isValidTargetNode } from './gap-cursor/utils';
|
|
9
10
|
export { setGapCursorSelection } from './gap-cursor/utils/setGapCursorSelection';
|
|
@@ -22,3 +23,7 @@ export declare function getRangeSelectionAnalyticsPayload(selection: Selection,
|
|
|
22
23
|
* @param deletions the ranges to delete
|
|
23
24
|
*/
|
|
24
25
|
export declare const selectNode: (pos: number) => Command;
|
|
26
|
+
export declare function createSelectionClickHandler(nodes: string[], isValidTarget: (target: HTMLElement) => boolean, options: {
|
|
27
|
+
useLongPressSelection: boolean;
|
|
28
|
+
getNodeSelectionPos?: (state: EditorState, nodePos: number) => number;
|
|
29
|
+
}): (view: EditorView, pos: number, node: PmNode, nodePos: number, event: MouseEvent, direct: boolean) => boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { EditorState, Selection, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
+
import type { LongPressSelectionPluginOptions } from '../types';
|
|
3
4
|
export declare enum RelativeSelectionPos {
|
|
4
5
|
Before = "Before",
|
|
5
6
|
Start = "Start",
|
|
@@ -24,3 +25,8 @@ export type EditorSelectionAPI = {
|
|
|
24
25
|
}) => (state: EditorState) => Transaction;
|
|
25
26
|
getSelectionPluginState: (state: EditorState) => SelectionPluginState;
|
|
26
27
|
};
|
|
28
|
+
export interface SelectionPluginOptions extends LongPressSelectionPluginOptions {
|
|
29
|
+
}
|
|
30
|
+
export type SelectionSharedState = {
|
|
31
|
+
selectionRelativeToNode?: RelativeSelectionPos | undefined;
|
|
32
|
+
} | undefined;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { AnnotationId, AnnotationTypes } from '@atlaskit/adf-schema';
|
|
2
|
+
import type { AnnotationId, AnnotationTypes } from '@atlaskit/adf-schema';
|
|
3
3
|
import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
4
4
|
import type { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
5
|
-
import { AnnotationState,
|
|
5
|
+
import type { AnnotationState, AnnotationUpdateEventPayloads, OnAnnotationClickPayload } from './emitter';
|
|
6
|
+
import { AnnotationUpdateEmitter, AnnotationUpdateEvent } from './emitter';
|
|
6
7
|
export type { AnnotationState };
|
|
7
8
|
export type AnnotationByMatches = {
|
|
8
9
|
originalSelection: string;
|
|
@@ -24,7 +25,7 @@ export type InlineCommentSelectionComponentProps = {
|
|
|
24
25
|
*/
|
|
25
26
|
range: Range;
|
|
26
27
|
/**
|
|
27
|
-
* Renderer/Editor DOM element ancestors wrapping the selection
|
|
28
|
+
* Renderer/Editor DOM element ancestors wrapping the selection
|
|
28
29
|
*/
|
|
29
30
|
wrapperDOM: HTMLElement;
|
|
30
31
|
/**
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
4
|
import type { AnalyticsEventPayload } from '../analytics';
|
|
4
5
|
import type { Command } from '../types';
|
|
5
6
|
export { RelativeSelectionPos } from './types';
|
|
6
|
-
export type { SelectionPluginState, EditorSelectionAPI } from './types';
|
|
7
|
+
export type { SelectionPluginState, EditorSelectionAPI, SelectionPluginOptions, SelectionSharedState, } from './types';
|
|
7
8
|
export { GapCursorSelection, Side, JSON_ID, GapBookmark, } from './gap-cursor/selection';
|
|
8
9
|
export { isIgnored, isValidTargetNode } from './gap-cursor/utils';
|
|
9
10
|
export { setGapCursorSelection } from './gap-cursor/utils/setGapCursorSelection';
|
|
@@ -22,3 +23,7 @@ export declare function getRangeSelectionAnalyticsPayload(selection: Selection,
|
|
|
22
23
|
* @param deletions the ranges to delete
|
|
23
24
|
*/
|
|
24
25
|
export declare const selectNode: (pos: number) => Command;
|
|
26
|
+
export declare function createSelectionClickHandler(nodes: string[], isValidTarget: (target: HTMLElement) => boolean, options: {
|
|
27
|
+
useLongPressSelection: boolean;
|
|
28
|
+
getNodeSelectionPos?: (state: EditorState, nodePos: number) => number;
|
|
29
|
+
}): (view: EditorView, pos: number, node: PmNode, nodePos: number, event: MouseEvent, direct: boolean) => boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { EditorState, Selection, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
+
import type { LongPressSelectionPluginOptions } from '../types';
|
|
3
4
|
export declare enum RelativeSelectionPos {
|
|
4
5
|
Before = "Before",
|
|
5
6
|
Start = "Start",
|
|
@@ -24,3 +25,8 @@ export type EditorSelectionAPI = {
|
|
|
24
25
|
}) => (state: EditorState) => Transaction;
|
|
25
26
|
getSelectionPluginState: (state: EditorState) => SelectionPluginState;
|
|
26
27
|
};
|
|
28
|
+
export interface SelectionPluginOptions extends LongPressSelectionPluginOptions {
|
|
29
|
+
}
|
|
30
|
+
export type SelectionSharedState = {
|
|
31
|
+
selectionRelativeToNode?: RelativeSelectionPos | undefined;
|
|
32
|
+
} | undefined;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { AnnotationId, AnnotationTypes } from '@atlaskit/adf-schema';
|
|
2
|
+
import type { AnnotationId, AnnotationTypes } from '@atlaskit/adf-schema';
|
|
3
3
|
import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
|
|
4
4
|
import type { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
5
|
-
import { AnnotationState,
|
|
5
|
+
import type { AnnotationState, AnnotationUpdateEventPayloads, OnAnnotationClickPayload } from './emitter';
|
|
6
|
+
import { AnnotationUpdateEmitter, AnnotationUpdateEvent } from './emitter';
|
|
6
7
|
export type { AnnotationState };
|
|
7
8
|
export type AnnotationByMatches = {
|
|
8
9
|
originalSelection: string;
|
|
@@ -24,7 +25,7 @@ export type InlineCommentSelectionComponentProps = {
|
|
|
24
25
|
*/
|
|
25
26
|
range: Range;
|
|
26
27
|
/**
|
|
27
|
-
* Renderer/Editor DOM element ancestors wrapping the selection
|
|
28
|
+
* Renderer/Editor DOM element ancestors wrapping the selection
|
|
28
29
|
*/
|
|
29
30
|
wrapperDOM: HTMLElement;
|
|
30
31
|
/**
|
package/package.json
CHANGED