@atlaskit/editor-plugin-hyperlink 0.0.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/.eslintrc.js +6 -0
- package/CHANGELOG.md +1 -0
- package/LICENSE.md +13 -0
- package/README.md +7 -0
- package/dist/cjs/Toolbar.js +280 -0
- package/dist/cjs/commands.js +242 -0
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/plugin.js +122 -0
- package/dist/cjs/pm-plugins/fake-curor-for-toolbar-plugin-key.js +9 -0
- package/dist/cjs/pm-plugins/fake-cursor-for-toolbar.js +68 -0
- package/dist/cjs/pm-plugins/input-rule.js +95 -0
- package/dist/cjs/pm-plugins/keymap.js +75 -0
- package/dist/cjs/pm-plugins/main.js +257 -0
- package/dist/cjs/pm-plugins/toolbar-buttons.js +43 -0
- package/dist/cjs/version.json +5 -0
- package/dist/es2019/Toolbar.js +260 -0
- package/dist/es2019/commands.js +225 -0
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/plugin.js +106 -0
- package/dist/es2019/pm-plugins/fake-curor-for-toolbar-plugin-key.js +2 -0
- package/dist/es2019/pm-plugins/fake-cursor-for-toolbar.js +63 -0
- package/dist/es2019/pm-plugins/input-rule.js +80 -0
- package/dist/es2019/pm-plugins/keymap.js +65 -0
- package/dist/es2019/pm-plugins/main.js +261 -0
- package/dist/es2019/pm-plugins/toolbar-buttons.js +39 -0
- package/dist/es2019/version.json +5 -0
- package/dist/esm/Toolbar.js +271 -0
- package/dist/esm/commands.js +222 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/plugin.js +114 -0
- package/dist/esm/pm-plugins/fake-curor-for-toolbar-plugin-key.js +2 -0
- package/dist/esm/pm-plugins/fake-cursor-for-toolbar.js +61 -0
- package/dist/esm/pm-plugins/input-rule.js +85 -0
- package/dist/esm/pm-plugins/keymap.js +67 -0
- package/dist/esm/pm-plugins/main.js +248 -0
- package/dist/esm/pm-plugins/toolbar-buttons.js +34 -0
- package/dist/esm/version.json +5 -0
- package/dist/types/Toolbar.d.ts +8 -0
- package/dist/types/commands.d.ts +20 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/plugin.d.ts +38 -0
- package/dist/types/pm-plugins/fake-curor-for-toolbar-plugin-key.d.ts +2 -0
- package/dist/types/pm-plugins/fake-cursor-for-toolbar.d.ts +3 -0
- package/dist/types/pm-plugins/input-rule.d.ts +8 -0
- package/dist/types/pm-plugins/keymap.d.ts +4 -0
- package/dist/types/pm-plugins/main.d.ts +7 -0
- package/dist/types/pm-plugins/toolbar-buttons.d.ts +21 -0
- package/dist/types-ts4.5/Toolbar.d.ts +8 -0
- package/dist/types-ts4.5/commands.d.ts +20 -0
- package/dist/types-ts4.5/index.d.ts +3 -0
- package/dist/types-ts4.5/plugin.d.ts +38 -0
- package/dist/types-ts4.5/pm-plugins/fake-curor-for-toolbar-plugin-key.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/fake-cursor-for-toolbar.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/input-rule.d.ts +8 -0
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +4 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +7 -0
- package/dist/types-ts4.5/pm-plugins/toolbar-buttons.d.ts +21 -0
- package/package.json +107 -0
- package/tmp/api-report-tmp.d.ts +68 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Schema } from 'prosemirror-model';
|
|
2
|
+
import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
|
+
import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { InputRuleWrapper } from '@atlaskit/prosemirror-input-rules';
|
|
6
|
+
export declare function createLinkInputRule(regexp: RegExp, skipAnalytics: boolean | undefined, editorAnalyticsApi: EditorAnalyticsAPI | undefined): InputRuleWrapper;
|
|
7
|
+
export declare function createInputRulePlugin(schema: Schema, skipAnalytics: boolean | undefined, featureFlags: FeatureFlags, editorAnalyticsApi: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
|
|
8
|
+
export default createInputRulePlugin;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
export declare function createKeymapPlugin(skipAnalytics: boolean | undefined, editorAnalyticsApi: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
|
|
4
|
+
export default createKeymapPlugin;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PluginKey } from 'prosemirror-state';
|
|
2
|
+
import { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
|
+
import { HyperlinkState } from '@atlaskit/editor-common/link';
|
|
4
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
|
+
import { EditorAppearance } from '@atlaskit/editor-common/types';
|
|
6
|
+
export declare const stateKey: PluginKey<HyperlinkState>;
|
|
7
|
+
export declare const plugin: (dispatch: Dispatch, editorAppearance?: EditorAppearance) => SafePlugin<HyperlinkState>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { EditorState, PluginKey, Transaction } from 'prosemirror-state';
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
import type { IntlShape } from 'react-intl-next';
|
|
4
|
+
import type { QueueCardsFromTransactionAction } from '@atlaskit/editor-common/card';
|
|
5
|
+
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
6
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
|
+
import { FloatingToolbarItem } from '@atlaskit/editor-common/types';
|
|
8
|
+
type HyperlinkToolbarItemsState = {
|
|
9
|
+
items: GetToolbarItems;
|
|
10
|
+
onEscapeCallback: ((tr: Transaction) => Transaction) | undefined;
|
|
11
|
+
onInsertLinkCallback: QueueCardsFromTransactionAction | undefined;
|
|
12
|
+
};
|
|
13
|
+
export declare const toolbarKey: PluginKey<HyperlinkToolbarItemsState | undefined>;
|
|
14
|
+
type GetToolbarItems = (state: EditorState, intl: IntlShape, providerFactory: ProviderFactory, link: string) => FloatingToolbarItem<any>[];
|
|
15
|
+
interface PrependToolbarButtonsProps extends HyperlinkToolbarItemsState {
|
|
16
|
+
view: EditorView;
|
|
17
|
+
}
|
|
18
|
+
export type PrependToolbarButtons = (props: PrependToolbarButtonsProps) => void;
|
|
19
|
+
export declare const prependToolbarButtons: ({ items, onEscapeCallback, onInsertLinkCallback, view, }: PrependToolbarButtonsProps) => void;
|
|
20
|
+
export declare const toolbarButtonsPlugin: () => SafePlugin<HyperlinkToolbarItemsState | undefined>;
|
|
21
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-plugin-hyperlink",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Hyperlink plugin 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",
|
|
12
|
+
"singleton": true,
|
|
13
|
+
"releaseModel": "continuous"
|
|
14
|
+
},
|
|
15
|
+
"repository": "https://bitbucket.org/atlassian/atlassian-frontend",
|
|
16
|
+
"main": "dist/cjs/index.js",
|
|
17
|
+
"module": "dist/esm/index.js",
|
|
18
|
+
"module:es2019": "dist/es2019/index.js",
|
|
19
|
+
"types": "dist/types/index.d.ts",
|
|
20
|
+
"typesVersions": {
|
|
21
|
+
">=4.5 <4.9": {
|
|
22
|
+
"*": [
|
|
23
|
+
"dist/types-ts4.5/*",
|
|
24
|
+
"dist/types-ts4.5/index.d.ts"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"sideEffects": false,
|
|
29
|
+
"atlaskit:src": "src/index.ts",
|
|
30
|
+
"af:exports": {
|
|
31
|
+
".": "./src/index.ts"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@atlaskit/adf-schema": "^26.1.0",
|
|
35
|
+
"@atlaskit/analytics-next": "^9.1.0",
|
|
36
|
+
"@atlaskit/editor-common": "^74.17.0",
|
|
37
|
+
"@atlaskit/editor-plugin-analytics": "^0.1.0",
|
|
38
|
+
"@atlaskit/editor-plugin-feature-flags": "^0.1.0",
|
|
39
|
+
"@atlaskit/icon": "^21.12.0",
|
|
40
|
+
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
41
|
+
"@atlaskit/prosemirror-input-rules": "^2.2.0",
|
|
42
|
+
"@babel/runtime": "^7.0.0",
|
|
43
|
+
"prosemirror-keymap": "1.1.4",
|
|
44
|
+
"prosemirror-model": "1.16.0",
|
|
45
|
+
"prosemirror-state": "1.3.4",
|
|
46
|
+
"prosemirror-view": "1.23.7",
|
|
47
|
+
"uuid": "^3.1.0"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"react": "^16.8.0",
|
|
51
|
+
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@atlaskit/activity-provider": "^2.4.0",
|
|
55
|
+
"@atlaskit/editor-test-helpers": "^18.9.0",
|
|
56
|
+
"@atlaskit/link-test-helpers": "^4.1.0",
|
|
57
|
+
"@atlaskit/media-test-helpers": "^33.0.0",
|
|
58
|
+
"@atlaskit/ssr": "*",
|
|
59
|
+
"@atlaskit/util-data-test": "^17.8.0",
|
|
60
|
+
"@atlaskit/visual-regression": "*",
|
|
61
|
+
"@atlaskit/webdriver-runner": "*",
|
|
62
|
+
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|
|
63
|
+
"@testing-library/react": "^12.1.5",
|
|
64
|
+
"raf-stub": "^2.0.1",
|
|
65
|
+
"react-dom": "^16.8.0",
|
|
66
|
+
"typescript": "~4.9.5",
|
|
67
|
+
"wait-for-expect": "^1.2.0"
|
|
68
|
+
},
|
|
69
|
+
"techstack": {
|
|
70
|
+
"@atlassian/frontend": {
|
|
71
|
+
"import-structure": [
|
|
72
|
+
"atlassian-conventions"
|
|
73
|
+
],
|
|
74
|
+
"circular-dependencies": [
|
|
75
|
+
"file-and-folder-level"
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
"@repo/internal": {
|
|
79
|
+
"dom-events": "use-bind-event-listener",
|
|
80
|
+
"analytics": [
|
|
81
|
+
"analytics-next"
|
|
82
|
+
],
|
|
83
|
+
"design-tokens": [
|
|
84
|
+
"color"
|
|
85
|
+
],
|
|
86
|
+
"theming": [
|
|
87
|
+
"react-context"
|
|
88
|
+
],
|
|
89
|
+
"ui-components": [
|
|
90
|
+
"lite-mode"
|
|
91
|
+
],
|
|
92
|
+
"deprecation": [
|
|
93
|
+
"no-deprecated-imports"
|
|
94
|
+
],
|
|
95
|
+
"styling": [
|
|
96
|
+
"static",
|
|
97
|
+
"emotion"
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0",
|
|
102
|
+
"platform-feature-flags": {
|
|
103
|
+
"platform.linking-platform.editor.fix-link-insert-analytics": {
|
|
104
|
+
"type": "boolean"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
## API Report File for "@atlaskit/editor-plugin-hyperlink"
|
|
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 { Command } from '@atlaskit/editor-common/types';
|
|
9
|
+
import { EditorState } from 'prosemirror-state';
|
|
10
|
+
import { EditorView } from 'prosemirror-view';
|
|
11
|
+
import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
12
|
+
import { FloatingToolbarItem } from '@atlaskit/editor-common/types';
|
|
13
|
+
import type { HyperlinkPluginOptions } from '@atlaskit/editor-common/types';
|
|
14
|
+
import type { HyperlinkState } from '@atlaskit/editor-common/link';
|
|
15
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
16
|
+
import type { IntlShape } from 'react-intl-next';
|
|
17
|
+
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
18
|
+
import type { OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
19
|
+
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
20
|
+
import type { QueueCardsFromTransactionAction } from '@atlaskit/editor-common/card';
|
|
21
|
+
import { Transaction } from 'prosemirror-state';
|
|
22
|
+
|
|
23
|
+
// @public (undocumented)
|
|
24
|
+
type GetToolbarItems = (state: EditorState, intl: IntlShape, providerFactory: ProviderFactory, link: string) => FloatingToolbarItem<any>[];
|
|
25
|
+
|
|
26
|
+
// @public (undocumented)
|
|
27
|
+
export type HideLinkToolbar = (tr: Transaction) => Transaction;
|
|
28
|
+
|
|
29
|
+
// @public (undocumented)
|
|
30
|
+
export const hyperlinkPlugin: NextEditorPlugin<'hyperlink', {
|
|
31
|
+
pluginConfiguration: HyperlinkPluginOptions | undefined;
|
|
32
|
+
dependencies: [
|
|
33
|
+
typeof featureFlagsPlugin,
|
|
34
|
+
OptionalPlugin<typeof analyticsPlugin>
|
|
35
|
+
];
|
|
36
|
+
actions: {
|
|
37
|
+
prependToolbarButtons: PrependToolbarButtons;
|
|
38
|
+
showLinkToolbar: ShowLinkToolbar;
|
|
39
|
+
hideLinkToolbar: HideLinkToolbar;
|
|
40
|
+
};
|
|
41
|
+
sharedState: HyperlinkState | undefined;
|
|
42
|
+
}>;
|
|
43
|
+
|
|
44
|
+
// @public (undocumented)
|
|
45
|
+
type HyperlinkToolbarItemsState = {
|
|
46
|
+
items: GetToolbarItems;
|
|
47
|
+
onEscapeCallback: ((tr: Transaction) => Transaction) | undefined;
|
|
48
|
+
onInsertLinkCallback: QueueCardsFromTransactionAction | undefined;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// @public (undocumented)
|
|
52
|
+
type InputMethod = INPUT_METHOD.INSERT_MENU | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.SHORTCUT | INPUT_METHOD.TOOLBAR;
|
|
53
|
+
|
|
54
|
+
// @public (undocumented)
|
|
55
|
+
export type PrependToolbarButtons = (props: PrependToolbarButtonsProps) => void;
|
|
56
|
+
|
|
57
|
+
// @public (undocumented)
|
|
58
|
+
interface PrependToolbarButtonsProps extends HyperlinkToolbarItemsState {
|
|
59
|
+
// (undocumented)
|
|
60
|
+
view: EditorView;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// @public (undocumented)
|
|
64
|
+
export type ShowLinkToolbar = (inputMethod: InputMethod) => Command;
|
|
65
|
+
|
|
66
|
+
// (No @packageDocumentation comment for this package)
|
|
67
|
+
|
|
68
|
+
```
|