@atlaskit/editor-plugin-interaction 1.1.0 → 1.1.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 +9 -0
- package/afm-cc/tsconfig.json +3 -0
- package/afm-jira/tsconfig.json +3 -0
- package/afm-post-office/tsconfig.json +3 -0
- package/dist/cjs/interactionPlugin.js +17 -7
- package/dist/cjs/pm-plugins/main.js +3 -1
- package/dist/es2019/interactionPlugin.js +15 -6
- package/dist/es2019/pm-plugins/main.js +3 -1
- package/dist/esm/interactionPlugin.js +17 -7
- package/dist/esm/pm-plugins/main.js +3 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/interactionPluginType.d.ts +5 -2
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/interactionPluginType.d.ts +5 -2
- package/package.json +8 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-interaction
|
|
2
2
|
|
|
3
|
+
## 1.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#159390](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/159390)
|
|
8
|
+
[`cc1d530fb6ed2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cc1d530fb6ed2) -
|
|
9
|
+
[ux] [ED-28074] Fix media selection state and remove css-based targeting
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 1.1.0
|
|
4
13
|
|
|
5
14
|
### Minor Changes
|
package/afm-cc/tsconfig.json
CHANGED
package/afm-jira/tsconfig.json
CHANGED
|
@@ -5,24 +5,34 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.interactionPlugin = void 0;
|
|
7
7
|
var _main = require("./pm-plugins/main");
|
|
8
|
-
var interactionPlugin = exports.interactionPlugin = function interactionPlugin(
|
|
9
|
-
var api = _ref.api;
|
|
8
|
+
var interactionPlugin = exports.interactionPlugin = function interactionPlugin() {
|
|
10
9
|
return {
|
|
11
10
|
name: 'interaction',
|
|
12
11
|
getSharedState: function getSharedState(editorState) {
|
|
13
|
-
var _key$getState;
|
|
12
|
+
var _key$getState, _key$getState2;
|
|
14
13
|
if (!editorState) {
|
|
15
14
|
return {
|
|
16
|
-
|
|
15
|
+
// Clean up with platform_editor_interaction_api_refactor
|
|
16
|
+
hasHadInteraction: false,
|
|
17
|
+
interactionState: 'hasNotHadInteraction'
|
|
17
18
|
};
|
|
18
19
|
}
|
|
19
20
|
return {
|
|
20
|
-
|
|
21
|
+
// Clean up with platform_editor_interaction_api_refactor
|
|
22
|
+
hasHadInteraction: Boolean((_key$getState = _main.key.getState(editorState)) === null || _key$getState === void 0 ? void 0 : _key$getState.hasHadInteraction),
|
|
23
|
+
/**
|
|
24
|
+
* Interaction state can either be null or 'hasNotHadInteraction'. We
|
|
25
|
+
* are specifically only returning an explicit value for 'hasNotHadInteraction'
|
|
26
|
+
* because behaviour should only change when the user has _not_ ineteracted
|
|
27
|
+
* with the editor. The behaviour of when `hasHadInteraction` is true and
|
|
28
|
+
* when the plugin is undefined should be the same.
|
|
29
|
+
*/
|
|
30
|
+
interactionState: (_key$getState2 = _main.key.getState(editorState)) !== null && _key$getState2 !== void 0 && _key$getState2.hasHadInteraction ? null : 'hasNotHadInteraction'
|
|
21
31
|
};
|
|
22
32
|
},
|
|
23
33
|
commands: {
|
|
24
|
-
handleInteraction: function handleInteraction(
|
|
25
|
-
var tr =
|
|
34
|
+
handleInteraction: function handleInteraction(_ref) {
|
|
35
|
+
var tr = _ref.tr;
|
|
26
36
|
return tr.setMeta(_main.key, {
|
|
27
37
|
hasHadInteraction: true
|
|
28
38
|
});
|
|
@@ -8,6 +8,7 @@ exports.key = exports.createPlugin = void 0;
|
|
|
8
8
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
9
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
10
10
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
12
|
var key = exports.key = new _state.PluginKey('interactionPluginHandler');
|
|
12
13
|
var handleInteraction = function handleInteraction(view) {
|
|
13
14
|
var interactionState = key.getState(view.state);
|
|
@@ -47,7 +48,8 @@ var createPlugin = exports.createPlugin = function createPlugin() {
|
|
|
47
48
|
// on the "next focused" element)
|
|
48
49
|
keyup: handleInteraction,
|
|
49
50
|
// Handle drag and drop _into_ the editor from outside. Eg image DnD
|
|
50
|
-
drop: handleInteraction
|
|
51
|
+
drop: handleInteraction,
|
|
52
|
+
focus: (0, _platformFeatureFlags.fg)('platform_editor_interaction_api_refactor') ? handleInteraction : undefined
|
|
51
53
|
}
|
|
52
54
|
}
|
|
53
55
|
});
|
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
import { createPlugin, key } from './pm-plugins/main';
|
|
2
|
-
export const interactionPlugin = ({
|
|
3
|
-
api
|
|
4
|
-
}) => {
|
|
2
|
+
export const interactionPlugin = () => {
|
|
5
3
|
return {
|
|
6
4
|
name: 'interaction',
|
|
7
5
|
getSharedState(editorState) {
|
|
8
|
-
var _key$getState;
|
|
6
|
+
var _key$getState, _key$getState2;
|
|
9
7
|
if (!editorState) {
|
|
10
8
|
return {
|
|
11
|
-
|
|
9
|
+
// Clean up with platform_editor_interaction_api_refactor
|
|
10
|
+
hasHadInteraction: false,
|
|
11
|
+
interactionState: 'hasNotHadInteraction'
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
return {
|
|
15
|
-
|
|
15
|
+
// Clean up with platform_editor_interaction_api_refactor
|
|
16
|
+
hasHadInteraction: Boolean((_key$getState = key.getState(editorState)) === null || _key$getState === void 0 ? void 0 : _key$getState.hasHadInteraction),
|
|
17
|
+
/**
|
|
18
|
+
* Interaction state can either be null or 'hasNotHadInteraction'. We
|
|
19
|
+
* are specifically only returning an explicit value for 'hasNotHadInteraction'
|
|
20
|
+
* because behaviour should only change when the user has _not_ ineteracted
|
|
21
|
+
* with the editor. The behaviour of when `hasHadInteraction` is true and
|
|
22
|
+
* when the plugin is undefined should be the same.
|
|
23
|
+
*/
|
|
24
|
+
interactionState: (_key$getState2 = key.getState(editorState)) !== null && _key$getState2 !== void 0 && _key$getState2.hasHadInteraction ? null : 'hasNotHadInteraction'
|
|
16
25
|
};
|
|
17
26
|
},
|
|
18
27
|
commands: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
export const key = new PluginKey('interactionPluginHandler');
|
|
4
5
|
const handleInteraction = view => {
|
|
5
6
|
const interactionState = key.getState(view.state);
|
|
@@ -38,7 +39,8 @@ export const createPlugin = () => new SafePlugin({
|
|
|
38
39
|
// on the "next focused" element)
|
|
39
40
|
keyup: handleInteraction,
|
|
40
41
|
// Handle drag and drop _into_ the editor from outside. Eg image DnD
|
|
41
|
-
drop: handleInteraction
|
|
42
|
+
drop: handleInteraction,
|
|
43
|
+
focus: fg('platform_editor_interaction_api_refactor') ? handleInteraction : undefined
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
});
|
|
@@ -1,22 +1,32 @@
|
|
|
1
1
|
import { createPlugin, key } from './pm-plugins/main';
|
|
2
|
-
export var interactionPlugin = function interactionPlugin(
|
|
3
|
-
var api = _ref.api;
|
|
2
|
+
export var interactionPlugin = function interactionPlugin() {
|
|
4
3
|
return {
|
|
5
4
|
name: 'interaction',
|
|
6
5
|
getSharedState: function getSharedState(editorState) {
|
|
7
|
-
var _key$getState;
|
|
6
|
+
var _key$getState, _key$getState2;
|
|
8
7
|
if (!editorState) {
|
|
9
8
|
return {
|
|
10
|
-
|
|
9
|
+
// Clean up with platform_editor_interaction_api_refactor
|
|
10
|
+
hasHadInteraction: false,
|
|
11
|
+
interactionState: 'hasNotHadInteraction'
|
|
11
12
|
};
|
|
12
13
|
}
|
|
13
14
|
return {
|
|
14
|
-
|
|
15
|
+
// Clean up with platform_editor_interaction_api_refactor
|
|
16
|
+
hasHadInteraction: Boolean((_key$getState = key.getState(editorState)) === null || _key$getState === void 0 ? void 0 : _key$getState.hasHadInteraction),
|
|
17
|
+
/**
|
|
18
|
+
* Interaction state can either be null or 'hasNotHadInteraction'. We
|
|
19
|
+
* are specifically only returning an explicit value for 'hasNotHadInteraction'
|
|
20
|
+
* because behaviour should only change when the user has _not_ ineteracted
|
|
21
|
+
* with the editor. The behaviour of when `hasHadInteraction` is true and
|
|
22
|
+
* when the plugin is undefined should be the same.
|
|
23
|
+
*/
|
|
24
|
+
interactionState: (_key$getState2 = key.getState(editorState)) !== null && _key$getState2 !== void 0 && _key$getState2.hasHadInteraction ? null : 'hasNotHadInteraction'
|
|
15
25
|
};
|
|
16
26
|
},
|
|
17
27
|
commands: {
|
|
18
|
-
handleInteraction: function handleInteraction(
|
|
19
|
-
var tr =
|
|
28
|
+
handleInteraction: function handleInteraction(_ref) {
|
|
29
|
+
var tr = _ref.tr;
|
|
20
30
|
return tr.setMeta(key, {
|
|
21
31
|
hasHadInteraction: true
|
|
22
32
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
3
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
export var key = new PluginKey('interactionPluginHandler');
|
|
5
6
|
var handleInteraction = function handleInteraction(view) {
|
|
6
7
|
var interactionState = key.getState(view.state);
|
|
@@ -40,7 +41,8 @@ export var createPlugin = function createPlugin() {
|
|
|
40
41
|
// on the "next focused" element)
|
|
41
42
|
keyup: handleInteraction,
|
|
42
43
|
// Handle drag and drop _into_ the editor from outside. Eg image DnD
|
|
43
|
-
drop: handleInteraction
|
|
44
|
+
drop: handleInteraction,
|
|
45
|
+
focus: fg('platform_editor_interaction_api_refactor') ? handleInteraction : undefined
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
});
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { EditorCommand, NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
-
import { type InteractionState } from './types';
|
|
3
2
|
type InteractionCommands = {
|
|
4
3
|
handleInteraction: EditorCommand;
|
|
5
4
|
};
|
|
5
|
+
export type SharedInteractionState = {
|
|
6
|
+
hasHadInteraction: boolean;
|
|
7
|
+
interactionState: null | 'hasNotHadInteraction';
|
|
8
|
+
};
|
|
6
9
|
export type InteractionPlugin = NextEditorPlugin<'interaction', {
|
|
7
|
-
sharedState:
|
|
10
|
+
sharedState: SharedInteractionState;
|
|
8
11
|
commands: InteractionCommands;
|
|
9
12
|
}>;
|
|
10
13
|
export {};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { EditorCommand, NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
-
import { type InteractionState } from './types';
|
|
3
2
|
type InteractionCommands = {
|
|
4
3
|
handleInteraction: EditorCommand;
|
|
5
4
|
};
|
|
5
|
+
export type SharedInteractionState = {
|
|
6
|
+
hasHadInteraction: boolean;
|
|
7
|
+
interactionState: null | 'hasNotHadInteraction';
|
|
8
|
+
};
|
|
6
9
|
export type InteractionPlugin = NextEditorPlugin<'interaction', {
|
|
7
|
-
sharedState:
|
|
10
|
+
sharedState: SharedInteractionState;
|
|
8
11
|
commands: InteractionCommands;
|
|
9
12
|
}>;
|
|
10
13
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-interaction",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Interaction plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -23,8 +23,9 @@
|
|
|
23
23
|
".": "./src/index.ts"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@atlaskit/editor-common": "^105.
|
|
26
|
+
"@atlaskit/editor-common": "^105.9.0",
|
|
27
27
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
28
|
+
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
28
29
|
"@babel/runtime": "^7.0.0"
|
|
29
30
|
},
|
|
30
31
|
"peerDependencies": {
|
|
@@ -35,6 +36,11 @@
|
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"typescript": "~5.4.2"
|
|
37
38
|
},
|
|
39
|
+
"platform-feature-flags": {
|
|
40
|
+
"platform_editor_interaction_api_refactor": {
|
|
41
|
+
"type": "boolean"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
38
44
|
"techstack": {
|
|
39
45
|
"@atlassian/frontend": {
|
|
40
46
|
"code-structure": [
|