@atlaskit/editor-plugin-hyperlink 0.3.1 → 0.3.3

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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/editor-plugin-hyperlink
2
2
 
3
+ ## 0.3.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`33cb07de05f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/33cb07de05f) - change adf-schema to fixed versioning
8
+
9
+ ## 0.3.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [`24fc3925d73`](https://bitbucket.org/atlassian/atlassian-frontend/commits/24fc3925d73) - Add a new hook called `usePreset` accesed via `@atlaskit/editor-core/use-preset`. This hook can be used to safely access state and commands from outside the editor using `EditorContext`.
14
+ - Updated dependencies
15
+
3
16
  ## 0.3.1
4
17
 
5
18
  ### Patch Changes
@@ -16,7 +16,7 @@ function createKeymapPlugin() {
16
16
  var skipAnalytics = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
17
17
  var editorAnalyticsApi = arguments.length > 1 ? arguments[1] : undefined;
18
18
  var list = {};
19
- (0, _keymaps.bindKeymapWithPluginCommand)(_keymaps.addLink.common, (0, _commands.showLinkToolbar)(_analytics.INPUT_METHOD.SHORTCUT, editorAnalyticsApi), list);
19
+ (0, _keymaps.bindKeymapWithEditorCommand)(_keymaps.addLink.common, (0, _commands.showLinkToolbar)(_analytics.INPUT_METHOD.SHORTCUT, editorAnalyticsApi), list);
20
20
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.enter.common, mayConvertLastWordToHyperlink(skipAnalytics, editorAnalyticsApi), list);
21
21
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.insertNewLine.common, mayConvertLastWordToHyperlink(skipAnalytics, editorAnalyticsApi), list);
22
22
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.escape.common, function (state, dispatch, view) {
@@ -1,13 +1,13 @@
1
1
  import { getLinkMatch } from '@atlaskit/adf-schema';
2
2
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
- import { addLink, bindKeymapWithCommand, bindKeymapWithPluginCommand, enter, escape, insertNewLine } from '@atlaskit/editor-common/keymaps';
3
+ import { addLink, bindKeymapWithCommand, bindKeymapWithEditorCommand, enter, escape, insertNewLine } from '@atlaskit/editor-common/keymaps';
4
4
  import { findFilepaths, getLinkCreationAnalyticsEvent, isLinkInMatches } from '@atlaskit/editor-common/utils';
5
5
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
6
6
  import { hideLinkToolbar, showLinkToolbar } from '../commands';
7
7
  import { stateKey } from '../pm-plugins/main';
8
8
  export function createKeymapPlugin(skipAnalytics = false, editorAnalyticsApi) {
9
9
  const list = {};
10
- bindKeymapWithPluginCommand(addLink.common, showLinkToolbar(INPUT_METHOD.SHORTCUT, editorAnalyticsApi), list);
10
+ bindKeymapWithEditorCommand(addLink.common, showLinkToolbar(INPUT_METHOD.SHORTCUT, editorAnalyticsApi), list);
11
11
  bindKeymapWithCommand(enter.common, mayConvertLastWordToHyperlink(skipAnalytics, editorAnalyticsApi), list);
12
12
  bindKeymapWithCommand(insertNewLine.common, mayConvertLastWordToHyperlink(skipAnalytics, editorAnalyticsApi), list);
13
13
  bindKeymapWithCommand(escape.common, (state, dispatch, view) => {
@@ -1,6 +1,6 @@
1
1
  import { getLinkMatch } from '@atlaskit/adf-schema';
2
2
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
- import { addLink, bindKeymapWithCommand, bindKeymapWithPluginCommand, enter, escape, insertNewLine } from '@atlaskit/editor-common/keymaps';
3
+ import { addLink, bindKeymapWithCommand, bindKeymapWithEditorCommand, enter, escape, insertNewLine } from '@atlaskit/editor-common/keymaps';
4
4
  import { findFilepaths, getLinkCreationAnalyticsEvent, isLinkInMatches } from '@atlaskit/editor-common/utils';
5
5
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
6
6
  import { hideLinkToolbar, showLinkToolbar } from '../commands';
@@ -9,7 +9,7 @@ export function createKeymapPlugin() {
9
9
  var skipAnalytics = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
10
10
  var editorAnalyticsApi = arguments.length > 1 ? arguments[1] : undefined;
11
11
  var list = {};
12
- bindKeymapWithPluginCommand(addLink.common, showLinkToolbar(INPUT_METHOD.SHORTCUT, editorAnalyticsApi), list);
12
+ bindKeymapWithEditorCommand(addLink.common, showLinkToolbar(INPUT_METHOD.SHORTCUT, editorAnalyticsApi), list);
13
13
  bindKeymapWithCommand(enter.common, mayConvertLastWordToHyperlink(skipAnalytics, editorAnalyticsApi), list);
14
14
  bindKeymapWithCommand(insertNewLine.common, mayConvertLastWordToHyperlink(skipAnalytics, editorAnalyticsApi), list);
15
15
  bindKeymapWithCommand(escape.common, function (state, dispatch, view) {
@@ -1,7 +1,7 @@
1
1
  import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
2
2
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
3
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import type { Command, LinkInputType, PluginCommand } from '@atlaskit/editor-common/types';
4
+ import type { Command, EditorCommand, LinkInputType } from '@atlaskit/editor-common/types';
5
5
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
6
6
  export declare function setLinkHref(href: string, pos: number, editorAnalyticsApi: EditorAnalyticsAPI | undefined, to?: number, isTabPressed?: boolean): Command;
7
7
  export type UpdateLink = (href: string, text: string, pos: number, to?: number) => Command;
@@ -12,8 +12,8 @@ export declare const insertLinkWithAnalytics: (inputMethod: LinkInputType, from:
12
12
  export declare function removeLink(pos: number, editorAnalyticsApi: EditorAnalyticsAPI | undefined): Command;
13
13
  export declare function editInsertedLink(editorAnalyticsApi: EditorAnalyticsAPI | undefined): Command;
14
14
  type InputMethod = INPUT_METHOD.TOOLBAR | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.SHORTCUT | INPUT_METHOD.INSERT_MENU;
15
- export type ShowLinkToolbar = (inputMethod: InputMethod) => PluginCommand;
16
- export declare function showLinkToolbar(inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined): PluginCommand;
15
+ export type ShowLinkToolbar = (inputMethod: InputMethod) => EditorCommand;
16
+ export declare function showLinkToolbar(inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined): EditorCommand;
17
17
  export declare function hideLinkToolbar(): Command;
18
18
  export type HideLinkToolbar = (tr: Transaction) => Transaction;
19
19
  export declare const hideLinkToolbarSetMeta: HideLinkToolbar;
@@ -1,3 +1,4 @@
1
1
  export { hyperlinkPlugin } from './plugin';
2
+ export type { HyperlinkPlugin } from './plugin';
2
3
  export type { HideLinkToolbar, ShowLinkToolbar, InsertLink, UpdateLink, } from './commands';
3
4
  export type { PrependToolbarButtons } from './pm-plugins/toolbar-buttons';
@@ -4,7 +4,7 @@ import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
4
  import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
5
5
  import type { HideLinkToolbar, InsertLink, ShowLinkToolbar, UpdateLink } from './commands';
6
6
  import type { PrependToolbarButtons } from './pm-plugins/toolbar-buttons';
7
- export declare const hyperlinkPlugin: NextEditorPlugin<'hyperlink', {
7
+ export type HyperlinkPlugin = NextEditorPlugin<'hyperlink', {
8
8
  pluginConfiguration: HyperlinkPluginOptions | undefined;
9
9
  dependencies: [
10
10
  typeof featureFlagsPlugin,
@@ -26,7 +26,7 @@ export declare const hyperlinkPlugin: NextEditorPlugin<'hyperlink', {
26
26
  };
27
27
  commands: {
28
28
  /**
29
- * PluginCommand to show link toolbar.
29
+ * EditorCommand to show link toolbar.
30
30
  *
31
31
  * Example:
32
32
  *
@@ -40,3 +40,4 @@ export declare const hyperlinkPlugin: NextEditorPlugin<'hyperlink', {
40
40
  };
41
41
  sharedState: HyperlinkState | undefined;
42
42
  }>;
43
+ export declare const hyperlinkPlugin: HyperlinkPlugin;
@@ -1,7 +1,7 @@
1
1
  import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
2
2
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
3
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import type { Command, LinkInputType, PluginCommand } from '@atlaskit/editor-common/types';
4
+ import type { Command, EditorCommand, LinkInputType } from '@atlaskit/editor-common/types';
5
5
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
6
6
  export declare function setLinkHref(href: string, pos: number, editorAnalyticsApi: EditorAnalyticsAPI | undefined, to?: number, isTabPressed?: boolean): Command;
7
7
  export type UpdateLink = (href: string, text: string, pos: number, to?: number) => Command;
@@ -12,8 +12,8 @@ export declare const insertLinkWithAnalytics: (inputMethod: LinkInputType, from:
12
12
  export declare function removeLink(pos: number, editorAnalyticsApi: EditorAnalyticsAPI | undefined): Command;
13
13
  export declare function editInsertedLink(editorAnalyticsApi: EditorAnalyticsAPI | undefined): Command;
14
14
  type InputMethod = INPUT_METHOD.TOOLBAR | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.SHORTCUT | INPUT_METHOD.INSERT_MENU;
15
- export type ShowLinkToolbar = (inputMethod: InputMethod) => PluginCommand;
16
- export declare function showLinkToolbar(inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined): PluginCommand;
15
+ export type ShowLinkToolbar = (inputMethod: InputMethod) => EditorCommand;
16
+ export declare function showLinkToolbar(inputMethod: InputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined): EditorCommand;
17
17
  export declare function hideLinkToolbar(): Command;
18
18
  export type HideLinkToolbar = (tr: Transaction) => Transaction;
19
19
  export declare const hideLinkToolbarSetMeta: HideLinkToolbar;
@@ -1,3 +1,4 @@
1
1
  export { hyperlinkPlugin } from './plugin';
2
+ export type { HyperlinkPlugin } from './plugin';
2
3
  export type { HideLinkToolbar, ShowLinkToolbar, InsertLink, UpdateLink, } from './commands';
3
4
  export type { PrependToolbarButtons } from './pm-plugins/toolbar-buttons';
@@ -4,7 +4,7 @@ import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
4
  import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
5
5
  import type { HideLinkToolbar, InsertLink, ShowLinkToolbar, UpdateLink } from './commands';
6
6
  import type { PrependToolbarButtons } from './pm-plugins/toolbar-buttons';
7
- export declare const hyperlinkPlugin: NextEditorPlugin<'hyperlink', {
7
+ export type HyperlinkPlugin = NextEditorPlugin<'hyperlink', {
8
8
  pluginConfiguration: HyperlinkPluginOptions | undefined;
9
9
  dependencies: [
10
10
  typeof featureFlagsPlugin,
@@ -26,7 +26,7 @@ export declare const hyperlinkPlugin: NextEditorPlugin<'hyperlink', {
26
26
  };
27
27
  commands: {
28
28
  /**
29
- * PluginCommand to show link toolbar.
29
+ * EditorCommand to show link toolbar.
30
30
  *
31
31
  * Example:
32
32
  *
@@ -40,3 +40,4 @@ export declare const hyperlinkPlugin: NextEditorPlugin<'hyperlink', {
40
40
  };
41
41
  sharedState: HyperlinkState | undefined;
42
42
  }>;
43
+ export declare const hyperlinkPlugin: HyperlinkPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-hyperlink",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Hyperlink plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,9 +31,9 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/adf-schema": "^28.1.0",
34
+ "@atlaskit/adf-schema": "28.1.2",
35
35
  "@atlaskit/analytics-next": "^9.1.0",
36
- "@atlaskit/editor-common": "^74.42.0",
36
+ "@atlaskit/editor-common": "^74.51.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^0.1.0",
38
38
  "@atlaskit/editor-plugin-feature-flags": "^0.1.0",
39
39
  "@atlaskit/editor-prosemirror": "1.1.0",
@@ -49,7 +49,7 @@
49
49
  },
50
50
  "devDependencies": {
51
51
  "@atlaskit/activity-provider": "^2.4.0",
52
- "@atlaskit/editor-test-helpers": "^18.9.0",
52
+ "@atlaskit/editor-test-helpers": "^18.11.0",
53
53
  "@atlaskit/link-test-helpers": "^6.0.0",
54
54
  "@atlaskit/media-test-helpers": "^33.0.0",
55
55
  "@atlaskit/ssr": "*",
package/report.api.md CHANGED
@@ -17,6 +17,7 @@
17
17
  ```ts
18
18
  import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
19
19
  import type { Command } from '@atlaskit/editor-common/types';
20
+ import type { EditorCommand } from '@atlaskit/editor-common/types';
20
21
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
21
22
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
22
23
  import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
@@ -28,7 +29,6 @@ import type { IntlShape } from 'react-intl-next';
28
29
  import type { LinkInputType } from '@atlaskit/editor-common/types';
29
30
  import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
30
31
  import type { OptionalPlugin } from '@atlaskit/editor-common/types';
31
- import type { PluginCommand } from '@atlaskit/editor-common/types';
32
32
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
33
33
  import type { QueueCardsFromTransactionAction } from '@atlaskit/editor-common/card';
34
34
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
@@ -46,7 +46,7 @@ type GetToolbarItems = (
46
46
  export type HideLinkToolbar = (tr: Transaction) => Transaction;
47
47
 
48
48
  // @public (undocumented)
49
- export const hyperlinkPlugin: NextEditorPlugin<
49
+ export type HyperlinkPlugin = NextEditorPlugin<
50
50
  'hyperlink',
51
51
  {
52
52
  pluginConfiguration: HyperlinkPluginOptions | undefined;
@@ -67,6 +67,9 @@ export const hyperlinkPlugin: NextEditorPlugin<
67
67
  }
68
68
  >;
69
69
 
70
+ // @public (undocumented)
71
+ export const hyperlinkPlugin: HyperlinkPlugin;
72
+
70
73
  // @public (undocumented)
71
74
  type HyperlinkToolbarItemsState = {
72
75
  items: GetToolbarItems;
@@ -103,7 +106,7 @@ interface PrependToolbarButtonsProps extends HyperlinkToolbarItemsState {
103
106
  }
104
107
 
105
108
  // @public (undocumented)
106
- export type ShowLinkToolbar = (inputMethod: InputMethod) => PluginCommand;
109
+ export type ShowLinkToolbar = (inputMethod: InputMethod) => EditorCommand;
107
110
 
108
111
  // @public (undocumented)
109
112
  export type UpdateLink = (
@@ -6,6 +6,7 @@
6
6
 
7
7
  import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
8
8
  import type { Command } from '@atlaskit/editor-common/types';
9
+ import type { EditorCommand } from '@atlaskit/editor-common/types';
9
10
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
10
11
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
11
12
  import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
@@ -17,7 +18,6 @@ import type { IntlShape } from 'react-intl-next';
17
18
  import type { LinkInputType } from '@atlaskit/editor-common/types';
18
19
  import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
19
20
  import type { OptionalPlugin } from '@atlaskit/editor-common/types';
20
- import type { PluginCommand } from '@atlaskit/editor-common/types';
21
21
  import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
22
22
  import type { QueueCardsFromTransactionAction } from '@atlaskit/editor-common/card';
23
23
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
@@ -30,7 +30,7 @@ type GetToolbarItems = (state: EditorState, intl: IntlShape, providerFactory: Pr
30
30
  export type HideLinkToolbar = (tr: Transaction) => Transaction;
31
31
 
32
32
  // @public (undocumented)
33
- export const hyperlinkPlugin: NextEditorPlugin<'hyperlink', {
33
+ export type HyperlinkPlugin = NextEditorPlugin<'hyperlink', {
34
34
  pluginConfiguration: HyperlinkPluginOptions | undefined;
35
35
  dependencies: [
36
36
  typeof featureFlagsPlugin,
@@ -48,6 +48,9 @@ export const hyperlinkPlugin: NextEditorPlugin<'hyperlink', {
48
48
  sharedState: HyperlinkState | undefined;
49
49
  }>;
50
50
 
51
+ // @public (undocumented)
52
+ export const hyperlinkPlugin: HyperlinkPlugin;
53
+
51
54
  // @public (undocumented)
52
55
  type HyperlinkToolbarItemsState = {
53
56
  items: GetToolbarItems;
@@ -71,7 +74,7 @@ interface PrependToolbarButtonsProps extends HyperlinkToolbarItemsState {
71
74
  }
72
75
 
73
76
  // @public (undocumented)
74
- export type ShowLinkToolbar = (inputMethod: InputMethod) => PluginCommand;
77
+ export type ShowLinkToolbar = (inputMethod: InputMethod) => EditorCommand;
75
78
 
76
79
  // @public (undocumented)
77
80
  export type UpdateLink = (href: string, text: string, pos: number, to?: number) => Command;
@@ -1,5 +0,0 @@
1
- {
2
- "name": "@atlaskit/editor-plugin-hyperlink",
3
- "version": "0.3.1",
4
- "sideEffects": false
5
- }
@@ -1,5 +0,0 @@
1
- {
2
- "name": "@atlaskit/editor-plugin-hyperlink",
3
- "version": "0.3.1",
4
- "sideEffects": false
5
- }
@@ -1,5 +0,0 @@
1
- {
2
- "name": "@atlaskit/editor-plugin-hyperlink",
3
- "version": "0.3.1",
4
- "sideEffects": false
5
- }