@atlaskit/editor-plugin-paste-options-toolbar 0.2.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/CHANGELOG.md +1 -0
- package/LICENSE.md +13 -0
- package/README.md +9 -0
- package/dist/cjs/actions.js +15 -0
- package/dist/cjs/commands.js +146 -0
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/messages.js +29 -0
- package/dist/cjs/plugin.js +67 -0
- package/dist/cjs/pm-plugins/constants.js +13 -0
- package/dist/cjs/pm-plugins/main.js +66 -0
- package/dist/cjs/pm-plugins/plugin-factory.js +31 -0
- package/dist/cjs/reducer.js +50 -0
- package/dist/cjs/styles.js +12 -0
- package/dist/cjs/toolbar.js +95 -0
- package/dist/cjs/types.js +15 -0
- package/dist/cjs/ui/paste-icon.js +22 -0
- package/dist/cjs/ui/styles.js +12 -0
- package/dist/cjs/util/format-handlers.js +186 -0
- package/dist/cjs/util/index.js +45 -0
- package/dist/es2019/actions.js +9 -0
- package/dist/es2019/commands.js +134 -0
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/messages.js +23 -0
- package/dist/es2019/plugin.js +64 -0
- package/dist/es2019/pm-plugins/constants.js +7 -0
- package/dist/es2019/pm-plugins/main.js +63 -0
- package/dist/es2019/pm-plugins/plugin-factory.js +23 -0
- package/dist/es2019/reducer.js +44 -0
- package/dist/es2019/styles.js +1 -0
- package/dist/es2019/toolbar.js +92 -0
- package/dist/es2019/types.js +9 -0
- package/dist/es2019/ui/paste-icon.js +14 -0
- package/dist/es2019/ui/styles.js +10 -0
- package/dist/es2019/util/format-handlers.js +196 -0
- package/dist/es2019/util/index.js +37 -0
- package/dist/esm/actions.js +9 -0
- package/dist/esm/commands.js +140 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/messages.js +23 -0
- package/dist/esm/plugin.js +61 -0
- package/dist/esm/pm-plugins/constants.js +7 -0
- package/dist/esm/pm-plugins/main.js +60 -0
- package/dist/esm/pm-plugins/plugin-factory.js +25 -0
- package/dist/esm/reducer.js +43 -0
- package/dist/esm/styles.js +1 -0
- package/dist/esm/toolbar.js +88 -0
- package/dist/esm/types.js +9 -0
- package/dist/esm/ui/paste-icon.js +16 -0
- package/dist/esm/ui/styles.js +5 -0
- package/dist/esm/util/format-handlers.js +178 -0
- package/dist/esm/util/index.js +37 -0
- package/dist/types/actions.d.ts +34 -0
- package/dist/types/commands.d.ts +16 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/messages.d.ts +22 -0
- package/dist/types/plugin.d.ts +6 -0
- package/dist/types/pm-plugins/constants.d.ts +7 -0
- package/dist/types/pm-plugins/main.d.ts +3 -0
- package/dist/types/pm-plugins/plugin-factory.d.ts +2 -0
- package/dist/types/reducer.d.ts +3 -0
- package/dist/types/styles.d.ts +1 -0
- package/dist/types/toolbar.d.ts +9 -0
- package/dist/types/types.d.ts +25 -0
- package/dist/types/ui/paste-icon.d.ts +5 -0
- package/dist/types/ui/styles.d.ts +1 -0
- package/dist/types/util/format-handlers.d.ts +9 -0
- package/dist/types/util/index.d.ts +7 -0
- package/dist/types-ts4.5/actions.d.ts +34 -0
- package/dist/types-ts4.5/commands.d.ts +16 -0
- package/dist/types-ts4.5/index.d.ts +1 -0
- package/dist/types-ts4.5/messages.d.ts +22 -0
- package/dist/types-ts4.5/plugin.d.ts +9 -0
- package/dist/types-ts4.5/pm-plugins/constants.d.ts +7 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/plugin-factory.d.ts +2 -0
- package/dist/types-ts4.5/reducer.d.ts +3 -0
- package/dist/types-ts4.5/styles.d.ts +1 -0
- package/dist/types-ts4.5/toolbar.d.ts +9 -0
- package/dist/types-ts4.5/types.d.ts +25 -0
- package/dist/types-ts4.5/ui/paste-icon.d.ts +5 -0
- package/dist/types-ts4.5/ui/styles.d.ts +1 -0
- package/dist/types-ts4.5/util/format-handlers.d.ts +9 -0
- package/dist/types-ts4.5/util/index.d.ts +7 -0
- package/package.json +114 -0
- package/report.api.md +46 -0
- package/styles/package.json +15 -0
- package/tmp/api-report-tmp.d.ts +19 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { pasteOptionsToolbarPlugin } from './plugin';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const messages: {
|
|
2
|
+
pasteOptions: {
|
|
3
|
+
id: string;
|
|
4
|
+
defaultMessage: string;
|
|
5
|
+
description: string;
|
|
6
|
+
};
|
|
7
|
+
plainText: {
|
|
8
|
+
id: string;
|
|
9
|
+
defaultMessage: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
markdown: {
|
|
13
|
+
id: string;
|
|
14
|
+
defaultMessage: string;
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
richText: {
|
|
18
|
+
id: string;
|
|
19
|
+
defaultMessage: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
import type { PastePlugin } from '@atlaskit/editor-plugin-paste';
|
|
4
|
+
export declare const pasteOptionsToolbarPlugin: NextEditorPlugin<'pasteOptionsToolbarPlugin', {
|
|
5
|
+
dependencies: [
|
|
6
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
7
|
+
PastePlugin
|
|
8
|
+
];
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const PASTE_TOOLBAR_CLASS = "ak-editor-paste-toolbar";
|
|
2
|
+
export declare const PASTE_TOOLBAR_MENU_ID = "ak-editor-paste-toolbar-item-dropdownList";
|
|
3
|
+
export declare const TEXT_HIGHLIGHT_CLASS = "text-highlight";
|
|
4
|
+
export declare const PASTE_HIGHLIGHT_DECORATION_KEY = "paste-highlight-decoration-key";
|
|
5
|
+
export declare const PASTE_TOOLBAR_ITEM_CLASS = "ak-editor-paste-toolbar-item";
|
|
6
|
+
export declare const EDITOR_WRAPPER_CLASS = "akEditor";
|
|
7
|
+
export declare const PASTE_OPTIONS_TEST_ID = "paste-options-testid";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { PasteOtionsPluginState } from '../types';
|
|
2
|
+
export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch<any>, initialState: PasteOtionsPluginState | ((state: import("prosemirror-state").EditorState) => PasteOtionsPluginState)) => import("prosemirror-state").SafeStateField<PasteOtionsPluginState>, createCommand: <A = import("../actions").PastePluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => PasteOtionsPluginState;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { textHighlightStyle } from './ui/styles';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IntlShape } from 'react-intl-next';
|
|
2
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import type { Command, FloatingToolbarConfig, FloatingToolbarDropdown } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { LastContentPasted } from '@atlaskit/editor-plugin-paste';
|
|
5
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
6
|
+
import type { PasteOtionsPluginState } from './types';
|
|
7
|
+
export declare const isToolbarVisible: (state: EditorState, lastContentPasted: LastContentPasted) => boolean;
|
|
8
|
+
export declare const getToolbarMenuConfig: (pluginState: PasteOtionsPluginState, pasteStartPos: number, plaintext: string, intl: IntlShape, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => FloatingToolbarDropdown<Command>;
|
|
9
|
+
export declare const buildToolbar: (state: EditorState, pasteStartPos: number, plaintext: string, intl: IntlShape, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => FloatingToolbarConfig | undefined;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
export declare const pasteOptionsPluginKey: PluginKey<any>;
|
|
5
|
+
export declare enum ToolbarDropdownOption {
|
|
6
|
+
Markdown = 0,
|
|
7
|
+
RichText = 1,
|
|
8
|
+
PlainText = 2,
|
|
9
|
+
None = 3
|
|
10
|
+
}
|
|
11
|
+
export interface PasteOtionsPluginState {
|
|
12
|
+
showToolbar: boolean;
|
|
13
|
+
pasteStartPos: number;
|
|
14
|
+
pasteEndPos: number;
|
|
15
|
+
plaintext: string;
|
|
16
|
+
richTextSlice: Slice;
|
|
17
|
+
isPlainText: boolean;
|
|
18
|
+
highlightContent: boolean;
|
|
19
|
+
highlightDecorationSet: DecorationSet;
|
|
20
|
+
selectedOption: ToolbarDropdownOption;
|
|
21
|
+
}
|
|
22
|
+
export interface Position {
|
|
23
|
+
top?: number;
|
|
24
|
+
left?: number;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const textHighlightStyle: import("@emotion/react").SerializedStyles;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
+
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
+
export declare const formatMarkdown: (state: EditorState, pasteStartPos: number, plaintext: string) => Transaction;
|
|
6
|
+
export declare const getRichTextSlice: (state: EditorState, pasteStartPos: number) => Slice;
|
|
7
|
+
export declare const formatRichText: (state: EditorState, pasteStartPos: number, richTextSlice: Slice) => Transaction;
|
|
8
|
+
export declare const formatPlainText: (state: EditorState, pasteStartPos: number, plaintext: string) => Transaction;
|
|
9
|
+
export declare function getMarkdownSlice(text: string, schema: Schema, selection: Selection): Slice | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Schema, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export declare function isPastedFromFabricEditor(pastedFrom: string): boolean;
|
|
4
|
+
export declare function escapeLinks(text: string): string;
|
|
5
|
+
export declare const hasMediaNode: (slice: Slice | undefined) => boolean;
|
|
6
|
+
export declare const hasRuleNode: (slice: Slice, schema: Schema) => boolean;
|
|
7
|
+
export declare const hasLinkMark: (state: EditorState, pasteStartPos: number, pasteEndPos: number) => boolean;
|
package/package.json
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-plugin-paste-options-toolbar",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Paste options toolbar for @atlaskit/editor-core",
|
|
5
|
+
"author": "Atlassian Pty Ltd",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"registry": "https://registry.npmjs.org/"
|
|
9
|
+
},
|
|
10
|
+
"atlassian": {
|
|
11
|
+
"team": "Editor: Scarlet",
|
|
12
|
+
"inPublicMirror": false,
|
|
13
|
+
"releaseModel": "continuous",
|
|
14
|
+
"website": {
|
|
15
|
+
"name": "EditorPluginPasteOptionsToolbar",
|
|
16
|
+
"category": "Components"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"repository": "https://bitbucket.org/atlassian/atlassian-frontend",
|
|
20
|
+
"main": "dist/cjs/index.js",
|
|
21
|
+
"module": "dist/esm/index.js",
|
|
22
|
+
"module:es2019": "dist/es2019/index.js",
|
|
23
|
+
"types": "dist/types/index.d.ts",
|
|
24
|
+
"typesVersions": {
|
|
25
|
+
">=4.5 <4.9": {
|
|
26
|
+
"*": [
|
|
27
|
+
"dist/types-ts4.5/*",
|
|
28
|
+
"dist/types-ts4.5/index.d.ts"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"sideEffects": false,
|
|
33
|
+
"atlaskit:src": "src/index.ts",
|
|
34
|
+
"af:exports": {
|
|
35
|
+
".": "./src/index.ts",
|
|
36
|
+
"./styles": "./src/styles.ts"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@atlaskit/editor-common": "^76.14.0",
|
|
40
|
+
"@atlaskit/editor-markdown-transformer": "^5.2.5",
|
|
41
|
+
"@atlaskit/editor-plugin-analytics": "^0.2.0",
|
|
42
|
+
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
43
|
+
"@atlaskit/editor-shared-styles": "^2.8.0",
|
|
44
|
+
"@atlaskit/icon": "^21.12.0",
|
|
45
|
+
"@atlaskit/platform-feature-flags": "^0.2.4",
|
|
46
|
+
"@atlaskit/tokens": "^1.25.0",
|
|
47
|
+
"@babel/runtime": "^7.0.0",
|
|
48
|
+
"@emotion/react": "^11.7.1",
|
|
49
|
+
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"react": "^16.8.0"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@af/visual-regression": "*",
|
|
56
|
+
"@atlaskit/ssr": "*",
|
|
57
|
+
"@atlaskit/visual-regression": "*",
|
|
58
|
+
"@atlaskit/webdriver-runner": "*",
|
|
59
|
+
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|
|
60
|
+
"@testing-library/react": "^12.1.5",
|
|
61
|
+
"react-dom": "^16.8.0",
|
|
62
|
+
"typescript": "~4.9.5",
|
|
63
|
+
"wait-for-expect": "^1.2.0"
|
|
64
|
+
},
|
|
65
|
+
"techstack": {
|
|
66
|
+
"@atlassian/frontend": {
|
|
67
|
+
"code-structure": [
|
|
68
|
+
"tangerine-next"
|
|
69
|
+
],
|
|
70
|
+
"import-structure": [
|
|
71
|
+
"atlassian-conventions"
|
|
72
|
+
],
|
|
73
|
+
"circular-dependencies": [
|
|
74
|
+
"file-and-folder-level"
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
"@repo/internal": {
|
|
78
|
+
"dom-events": "use-bind-event-listener",
|
|
79
|
+
"analytics": [
|
|
80
|
+
"analytics-next"
|
|
81
|
+
],
|
|
82
|
+
"design-tokens": [
|
|
83
|
+
"color"
|
|
84
|
+
],
|
|
85
|
+
"theming": [
|
|
86
|
+
"react-context"
|
|
87
|
+
],
|
|
88
|
+
"ui-components": [
|
|
89
|
+
"lite-mode"
|
|
90
|
+
],
|
|
91
|
+
"deprecation": [
|
|
92
|
+
"no-deprecated-imports"
|
|
93
|
+
],
|
|
94
|
+
"styling": [
|
|
95
|
+
"static",
|
|
96
|
+
"emotion"
|
|
97
|
+
],
|
|
98
|
+
"imports": [
|
|
99
|
+
"import-no-extraneous-disable-for-examples-and-docs"
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"techstackIgnore": {
|
|
104
|
+
"stricter": [
|
|
105
|
+
"@atlassian/tangerine/project-structure"
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0",
|
|
109
|
+
"platform-feature-flags": {
|
|
110
|
+
"platform.editor.paste-options-toolbar": {
|
|
111
|
+
"type": "boolean"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
package/report.api.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<!-- API Report Version: 2.3 -->
|
|
2
|
+
|
|
3
|
+
## API Report File for "@atlaskit/editor-plugin-paste-options-toolbar"
|
|
4
|
+
|
|
5
|
+
> Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
|
|
6
|
+
> [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
7
|
+
|
|
8
|
+
### Table of contents
|
|
9
|
+
|
|
10
|
+
- [Main Entry Types](#main-entry-types)
|
|
11
|
+
- [Peer Dependencies](#peer-dependencies)
|
|
12
|
+
|
|
13
|
+
### Main Entry Types
|
|
14
|
+
|
|
15
|
+
<!--SECTION START: Main Entry Types-->
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
19
|
+
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
20
|
+
import type { OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
21
|
+
import type { PastePlugin } from '@atlaskit/editor-plugin-paste';
|
|
22
|
+
|
|
23
|
+
// @public (undocumented)
|
|
24
|
+
export const pasteOptionsToolbarPlugin: NextEditorPlugin<
|
|
25
|
+
'pasteOptionsToolbarPlugin',
|
|
26
|
+
{
|
|
27
|
+
dependencies: [OptionalPlugin<AnalyticsPlugin>, PastePlugin];
|
|
28
|
+
}
|
|
29
|
+
>;
|
|
30
|
+
|
|
31
|
+
// (No @packageDocumentation comment for this package)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
<!--SECTION END: Main Entry Types-->
|
|
35
|
+
|
|
36
|
+
### Peer Dependencies
|
|
37
|
+
|
|
38
|
+
<!--SECTION START: Peer Dependencies-->
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"react": "^16.8.0"
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
<!--SECTION END: Peer Dependencies-->
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-plugin-paste-options-toolbar/styles",
|
|
3
|
+
"main": "../dist/cjs/styles.js",
|
|
4
|
+
"module": "../dist/esm/styles.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/styles.js",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"types": "../dist/types/styles.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.5 <4.9": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.5/styles.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
## API Report File for "@atlaskit/editor-plugin-paste-options-toolbar"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
8
|
+
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
9
|
+
import type { OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
10
|
+
import type { PastePlugin } from '@atlaskit/editor-plugin-paste';
|
|
11
|
+
|
|
12
|
+
// @public (undocumented)
|
|
13
|
+
export const pasteOptionsToolbarPlugin: NextEditorPlugin<'pasteOptionsToolbarPlugin', {
|
|
14
|
+
dependencies: [OptionalPlugin<AnalyticsPlugin>, PastePlugin];
|
|
15
|
+
}>;
|
|
16
|
+
|
|
17
|
+
// (No @packageDocumentation comment for this package)
|
|
18
|
+
|
|
19
|
+
```
|