@atlaskit/editor-plugin-paste-options-toolbar 3.1.2 → 3.1.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 +16 -0
- package/dist/cjs/pasteOptionsToolbarPlugin.js +7 -20
- package/dist/es2019/pasteOptionsToolbarPlugin.js +7 -22
- package/dist/esm/pasteOptionsToolbarPlugin.js +8 -21
- package/dist/types/editor-actions/actions.d.ts +6 -6
- package/dist/types/types/types.d.ts +6 -6
- package/dist/types-ts4.5/editor-actions/actions.d.ts +6 -6
- package/dist/types-ts4.5/types/types.d.ts +6 -6
- package/package.json +4 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-paste-options-toolbar
|
|
2
2
|
|
|
3
|
+
## 3.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`8497783928a16`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8497783928a16) -
|
|
8
|
+
ED-29110: clean up sharedPluginStateHookMigratorFactory in media, mentions and paste options
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 3.1.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`265c1bf0cefa4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/265c1bf0cefa4) -
|
|
16
|
+
Sorted type and interface props to improve Atlaskit docs
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 3.1.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -10,24 +10,6 @@ var _commands = require("./editor-commands/commands");
|
|
|
10
10
|
var _main = require("./pm-plugins/main");
|
|
11
11
|
var _types = require("./types/types");
|
|
12
12
|
var _toolbar = require("./ui/toolbar");
|
|
13
|
-
var useSharedPasteState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
14
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['paste'], function (states) {
|
|
15
|
-
var _states$pasteState;
|
|
16
|
-
return {
|
|
17
|
-
lastContentPasted: (_states$pasteState = states.pasteState) === null || _states$pasteState === void 0 ? void 0 : _states$pasteState.lastContentPasted
|
|
18
|
-
};
|
|
19
|
-
}),
|
|
20
|
-
lastContentPasted = _useSharedPluginState.lastContentPasted;
|
|
21
|
-
return {
|
|
22
|
-
lastContentPasted: lastContentPasted
|
|
23
|
-
};
|
|
24
|
-
}, function (api) {
|
|
25
|
-
var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['paste']),
|
|
26
|
-
pasteState = _useSharedPluginState2.pasteState;
|
|
27
|
-
return {
|
|
28
|
-
lastContentPasted: pasteState === null || pasteState === void 0 ? void 0 : pasteState.lastContentPasted
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
13
|
var pasteOptionsToolbarPlugin = exports.pasteOptionsToolbarPlugin = function pasteOptionsToolbarPlugin(_ref) {
|
|
32
14
|
var _api$analytics;
|
|
33
15
|
var config = _ref.config,
|
|
@@ -55,8 +37,13 @@ var pasteOptionsToolbarPlugin = exports.pasteOptionsToolbarPlugin = function pas
|
|
|
55
37
|
},
|
|
56
38
|
usePluginHook: function usePluginHook(_ref3) {
|
|
57
39
|
var editorView = _ref3.editorView;
|
|
58
|
-
var
|
|
59
|
-
|
|
40
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['paste'], function (states) {
|
|
41
|
+
var _states$pasteState;
|
|
42
|
+
return {
|
|
43
|
+
lastContentPasted: (_states$pasteState = states.pasteState) === null || _states$pasteState === void 0 ? void 0 : _states$pasteState.lastContentPasted
|
|
44
|
+
};
|
|
45
|
+
}),
|
|
46
|
+
lastContentPasted = _useSharedPluginState.lastContentPasted;
|
|
60
47
|
(0, _react.useEffect)(function () {
|
|
61
48
|
if (!lastContentPasted) {
|
|
62
49
|
(0, _commands.hideToolbar)()(editorView.state, editorView.dispatch);
|
|
@@ -1,29 +1,9 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
3
3
|
import { hideToolbar, showToolbar } from './editor-commands/commands';
|
|
4
4
|
import { createPlugin } from './pm-plugins/main';
|
|
5
5
|
import { pasteOptionsPluginKey, ToolbarDropdownOption } from './types/types';
|
|
6
6
|
import { buildToolbar, isToolbarVisible } from './ui/toolbar';
|
|
7
|
-
const useSharedPasteState = sharedPluginStateHookMigratorFactory(api => {
|
|
8
|
-
const {
|
|
9
|
-
lastContentPasted
|
|
10
|
-
} = useSharedPluginStateWithSelector(api, ['paste'], states => {
|
|
11
|
-
var _states$pasteState;
|
|
12
|
-
return {
|
|
13
|
-
lastContentPasted: (_states$pasteState = states.pasteState) === null || _states$pasteState === void 0 ? void 0 : _states$pasteState.lastContentPasted
|
|
14
|
-
};
|
|
15
|
-
});
|
|
16
|
-
return {
|
|
17
|
-
lastContentPasted
|
|
18
|
-
};
|
|
19
|
-
}, api => {
|
|
20
|
-
const {
|
|
21
|
-
pasteState
|
|
22
|
-
} = useSharedPluginState(api, ['paste']);
|
|
23
|
-
return {
|
|
24
|
-
lastContentPasted: pasteState === null || pasteState === void 0 ? void 0 : pasteState.lastContentPasted
|
|
25
|
-
};
|
|
26
|
-
});
|
|
27
7
|
export const pasteOptionsToolbarPlugin = ({
|
|
28
8
|
config,
|
|
29
9
|
api
|
|
@@ -54,7 +34,12 @@ export const pasteOptionsToolbarPlugin = ({
|
|
|
54
34
|
}) {
|
|
55
35
|
const {
|
|
56
36
|
lastContentPasted
|
|
57
|
-
} =
|
|
37
|
+
} = useSharedPluginStateWithSelector(api, ['paste'], states => {
|
|
38
|
+
var _states$pasteState;
|
|
39
|
+
return {
|
|
40
|
+
lastContentPasted: (_states$pasteState = states.pasteState) === null || _states$pasteState === void 0 ? void 0 : _states$pasteState.lastContentPasted
|
|
41
|
+
};
|
|
42
|
+
});
|
|
58
43
|
useEffect(() => {
|
|
59
44
|
if (!lastContentPasted) {
|
|
60
45
|
hideToolbar()(editorView.state, editorView.dispatch);
|
|
@@ -1,27 +1,9 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
3
3
|
import { hideToolbar, showToolbar } from './editor-commands/commands';
|
|
4
4
|
import { createPlugin } from './pm-plugins/main';
|
|
5
5
|
import { pasteOptionsPluginKey, ToolbarDropdownOption } from './types/types';
|
|
6
6
|
import { buildToolbar, isToolbarVisible } from './ui/toolbar';
|
|
7
|
-
var useSharedPasteState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
8
|
-
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['paste'], function (states) {
|
|
9
|
-
var _states$pasteState;
|
|
10
|
-
return {
|
|
11
|
-
lastContentPasted: (_states$pasteState = states.pasteState) === null || _states$pasteState === void 0 ? void 0 : _states$pasteState.lastContentPasted
|
|
12
|
-
};
|
|
13
|
-
}),
|
|
14
|
-
lastContentPasted = _useSharedPluginState.lastContentPasted;
|
|
15
|
-
return {
|
|
16
|
-
lastContentPasted: lastContentPasted
|
|
17
|
-
};
|
|
18
|
-
}, function (api) {
|
|
19
|
-
var _useSharedPluginState2 = useSharedPluginState(api, ['paste']),
|
|
20
|
-
pasteState = _useSharedPluginState2.pasteState;
|
|
21
|
-
return {
|
|
22
|
-
lastContentPasted: pasteState === null || pasteState === void 0 ? void 0 : pasteState.lastContentPasted
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
7
|
export var pasteOptionsToolbarPlugin = function pasteOptionsToolbarPlugin(_ref) {
|
|
26
8
|
var _api$analytics;
|
|
27
9
|
var config = _ref.config,
|
|
@@ -49,8 +31,13 @@ export var pasteOptionsToolbarPlugin = function pasteOptionsToolbarPlugin(_ref)
|
|
|
49
31
|
},
|
|
50
32
|
usePluginHook: function usePluginHook(_ref3) {
|
|
51
33
|
var editorView = _ref3.editorView;
|
|
52
|
-
var
|
|
53
|
-
|
|
34
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['paste'], function (states) {
|
|
35
|
+
var _states$pasteState;
|
|
36
|
+
return {
|
|
37
|
+
lastContentPasted: (_states$pasteState = states.pasteState) === null || _states$pasteState === void 0 ? void 0 : _states$pasteState.lastContentPasted
|
|
38
|
+
};
|
|
39
|
+
}),
|
|
40
|
+
lastContentPasted = _useSharedPluginState.lastContentPasted;
|
|
54
41
|
useEffect(function () {
|
|
55
42
|
if (!lastContentPasted) {
|
|
56
43
|
hideToolbar()(editorView.state, editorView.dispatch);
|
|
@@ -9,15 +9,15 @@ export declare enum PastePluginActionTypes {
|
|
|
9
9
|
CHANGE_FORMAT = "CHANGE_FORMAT"
|
|
10
10
|
}
|
|
11
11
|
export interface ShowPasteOptions {
|
|
12
|
-
type: PastePluginActionTypes.SHOW_PASTE_OPTIONS;
|
|
13
12
|
data: {
|
|
14
|
-
plaintext: string;
|
|
15
|
-
selectedOption: ToolbarDropdownOption;
|
|
16
13
|
isPlainText: boolean;
|
|
17
|
-
richTextSlice: Slice;
|
|
18
|
-
pasteStartPos: number;
|
|
19
14
|
pasteEndPos: number;
|
|
15
|
+
pasteStartPos: number;
|
|
16
|
+
plaintext: string;
|
|
17
|
+
richTextSlice: Slice;
|
|
18
|
+
selectedOption: ToolbarDropdownOption;
|
|
20
19
|
};
|
|
20
|
+
type: PastePluginActionTypes.SHOW_PASTE_OPTIONS;
|
|
21
21
|
}
|
|
22
22
|
export interface HidePasteOptions {
|
|
23
23
|
type: PastePluginActionTypes.HIDE_PASTE_OPTIONS;
|
|
@@ -26,9 +26,9 @@ export interface HighlightContent {
|
|
|
26
26
|
type: PastePluginActionTypes.HIGHLIGHT_CONTENT;
|
|
27
27
|
}
|
|
28
28
|
export interface ChangeFormat {
|
|
29
|
-
type: PastePluginActionTypes.CHANGE_FORMAT;
|
|
30
29
|
data: {
|
|
31
30
|
selectedOption: ToolbarDropdownOption;
|
|
32
31
|
};
|
|
32
|
+
type: PastePluginActionTypes.CHANGE_FORMAT;
|
|
33
33
|
}
|
|
34
34
|
export type PastePluginAction = ShowPasteOptions | HidePasteOptions | HighlightContent | ChangeFormat;
|
|
@@ -9,17 +9,17 @@ export declare enum ToolbarDropdownOption {
|
|
|
9
9
|
None = 3
|
|
10
10
|
}
|
|
11
11
|
export interface PasteOtionsPluginState {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
highlightContent: boolean;
|
|
13
|
+
highlightDecorationSet: DecorationSet;
|
|
14
|
+
isPlainText: boolean;
|
|
14
15
|
pasteEndPos: number;
|
|
16
|
+
pasteStartPos: number;
|
|
15
17
|
plaintext: string;
|
|
16
18
|
richTextSlice: Slice;
|
|
17
|
-
isPlainText: boolean;
|
|
18
|
-
highlightContent: boolean;
|
|
19
|
-
highlightDecorationSet: DecorationSet;
|
|
20
19
|
selectedOption: ToolbarDropdownOption;
|
|
20
|
+
showToolbar: boolean;
|
|
21
21
|
}
|
|
22
22
|
export interface Position {
|
|
23
|
-
top?: number;
|
|
24
23
|
left?: number;
|
|
24
|
+
top?: number;
|
|
25
25
|
}
|
|
@@ -9,15 +9,15 @@ export declare enum PastePluginActionTypes {
|
|
|
9
9
|
CHANGE_FORMAT = "CHANGE_FORMAT"
|
|
10
10
|
}
|
|
11
11
|
export interface ShowPasteOptions {
|
|
12
|
-
type: PastePluginActionTypes.SHOW_PASTE_OPTIONS;
|
|
13
12
|
data: {
|
|
14
|
-
plaintext: string;
|
|
15
|
-
selectedOption: ToolbarDropdownOption;
|
|
16
13
|
isPlainText: boolean;
|
|
17
|
-
richTextSlice: Slice;
|
|
18
|
-
pasteStartPos: number;
|
|
19
14
|
pasteEndPos: number;
|
|
15
|
+
pasteStartPos: number;
|
|
16
|
+
plaintext: string;
|
|
17
|
+
richTextSlice: Slice;
|
|
18
|
+
selectedOption: ToolbarDropdownOption;
|
|
20
19
|
};
|
|
20
|
+
type: PastePluginActionTypes.SHOW_PASTE_OPTIONS;
|
|
21
21
|
}
|
|
22
22
|
export interface HidePasteOptions {
|
|
23
23
|
type: PastePluginActionTypes.HIDE_PASTE_OPTIONS;
|
|
@@ -26,9 +26,9 @@ export interface HighlightContent {
|
|
|
26
26
|
type: PastePluginActionTypes.HIGHLIGHT_CONTENT;
|
|
27
27
|
}
|
|
28
28
|
export interface ChangeFormat {
|
|
29
|
-
type: PastePluginActionTypes.CHANGE_FORMAT;
|
|
30
29
|
data: {
|
|
31
30
|
selectedOption: ToolbarDropdownOption;
|
|
32
31
|
};
|
|
32
|
+
type: PastePluginActionTypes.CHANGE_FORMAT;
|
|
33
33
|
}
|
|
34
34
|
export type PastePluginAction = ShowPasteOptions | HidePasteOptions | HighlightContent | ChangeFormat;
|
|
@@ -9,17 +9,17 @@ export declare enum ToolbarDropdownOption {
|
|
|
9
9
|
None = 3
|
|
10
10
|
}
|
|
11
11
|
export interface PasteOtionsPluginState {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
highlightContent: boolean;
|
|
13
|
+
highlightDecorationSet: DecorationSet;
|
|
14
|
+
isPlainText: boolean;
|
|
14
15
|
pasteEndPos: number;
|
|
16
|
+
pasteStartPos: number;
|
|
15
17
|
plaintext: string;
|
|
16
18
|
richTextSlice: Slice;
|
|
17
|
-
isPlainText: boolean;
|
|
18
|
-
highlightContent: boolean;
|
|
19
|
-
highlightDecorationSet: DecorationSet;
|
|
20
19
|
selectedOption: ToolbarDropdownOption;
|
|
20
|
+
showToolbar: boolean;
|
|
21
21
|
}
|
|
22
22
|
export interface Position {
|
|
23
|
-
top?: number;
|
|
24
23
|
left?: number;
|
|
24
|
+
top?: number;
|
|
25
25
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-paste-options-toolbar",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.4",
|
|
4
4
|
"description": "Paste options toolbar for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -28,31 +28,26 @@
|
|
|
28
28
|
"*.compiled.css"
|
|
29
29
|
],
|
|
30
30
|
"atlaskit:src": "src/index.ts",
|
|
31
|
-
"af:exports": {
|
|
32
|
-
".": "./src/index.ts",
|
|
33
|
-
"./styles": "./src/ui/styles.ts"
|
|
34
|
-
},
|
|
35
31
|
"dependencies": {
|
|
36
32
|
"@atlaskit/editor-markdown-transformer": "^5.16.0",
|
|
37
33
|
"@atlaskit/editor-plugin-analytics": "^3.0.0",
|
|
38
34
|
"@atlaskit/editor-plugin-paste": "^4.1.0",
|
|
39
35
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
40
36
|
"@atlaskit/editor-shared-styles": "^3.6.0",
|
|
41
|
-
"@atlaskit/icon": "^28.
|
|
42
|
-
"@atlaskit/tokens": "^6.
|
|
37
|
+
"@atlaskit/icon": "^28.1.0",
|
|
38
|
+
"@atlaskit/tokens": "^6.1.0",
|
|
43
39
|
"@babel/runtime": "^7.0.0",
|
|
44
40
|
"@emotion/react": "^11.7.1",
|
|
45
41
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
46
42
|
},
|
|
47
43
|
"peerDependencies": {
|
|
48
|
-
"@atlaskit/editor-common": "^107.
|
|
44
|
+
"@atlaskit/editor-common": "^107.33.0",
|
|
49
45
|
"react": "^18.2.0",
|
|
50
46
|
"react-dom": "^18.2.0"
|
|
51
47
|
},
|
|
52
48
|
"devDependencies": {
|
|
53
49
|
"@af/visual-regression": "workspace:^",
|
|
54
50
|
"@atlaskit/ssr": "workspace:^",
|
|
55
|
-
"@atlaskit/visual-regression": "workspace:^",
|
|
56
51
|
"@testing-library/react": "^13.4.0",
|
|
57
52
|
"wait-for-expect": "^1.2.0"
|
|
58
53
|
},
|