@atlaskit/editor-plugin-hyperlink 1.0.0 → 1.0.2
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 +36 -0
- package/dist/cjs/pm-plugins/input-rule.js +4 -3
- package/dist/es2019/pm-plugins/input-rule.js +4 -3
- package/dist/esm/pm-plugins/input-rule.js +4 -3
- package/dist/types/pm-plugins/input-rule.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/input-rule.d.ts +2 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-hyperlink
|
|
2
2
|
|
|
3
|
+
## 1.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#75482](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/75482) [`18b5a6fb910a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/18b5a6fb910a) - # MAJOR CHANGE to `@atlaskit/prosemirror-input-rules` package.
|
|
8
|
+
|
|
9
|
+
## WHY?
|
|
10
|
+
|
|
11
|
+
Removing editor-common dependencies from prosemirror-input-rules package.
|
|
12
|
+
|
|
13
|
+
This makes it easier for editor updates because it simplifies our dependency graph.
|
|
14
|
+
|
|
15
|
+
## WHAT and HOW?
|
|
16
|
+
|
|
17
|
+
These are no longer available via `@atlaskit/prosemirror-input-rules` but are available from `@atlaskit/editor-common/types`:
|
|
18
|
+
|
|
19
|
+
- InputRuleWrapper
|
|
20
|
+
- InputRuleHandler
|
|
21
|
+
- OnHandlerApply
|
|
22
|
+
- createRule
|
|
23
|
+
|
|
24
|
+
These have changed from a `SafePlugin` to a `SafePluginSpec`. In order to update your code you need to instantiate a `SafePlugin` (ie. `new SafePlugin(createPlugin( ... ))`).
|
|
25
|
+
|
|
26
|
+
`SafePlugin` exists in `@atlaskit/editor-common/safe-plugin`.
|
|
27
|
+
|
|
28
|
+
- createPlugin
|
|
29
|
+
- createInputRulePlugin
|
|
30
|
+
|
|
31
|
+
- Updated dependencies
|
|
32
|
+
|
|
33
|
+
## 1.0.1
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- Updated dependencies
|
|
38
|
+
|
|
3
39
|
## 1.0.0
|
|
4
40
|
|
|
5
41
|
### Major Changes
|
|
@@ -10,12 +10,13 @@ exports.default = void 0;
|
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
12
|
var _card = require("@atlaskit/editor-common/card");
|
|
13
|
+
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
13
14
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
14
15
|
var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
|
|
15
16
|
var _toolbarButtons = require("./toolbar-buttons");
|
|
16
17
|
function createLinkInputRule(regexp, editorAnalyticsApi) {
|
|
17
18
|
// Plain typed text (eg, typing 'www.google.com') should convert to a hyperlink
|
|
18
|
-
return (0,
|
|
19
|
+
return (0, _utils.createRule)(regexp, function (state, match, start, end) {
|
|
19
20
|
var _toolbarKey$getState$, _toolbarKey$getState;
|
|
20
21
|
var schema = state.schema;
|
|
21
22
|
if (state.doc.rangeHasMark(start, end, schema.marks.link)) {
|
|
@@ -67,7 +68,7 @@ function createInputRulePlugin(schema, editorAnalyticsApi) {
|
|
|
67
68
|
var urlWithASpaceRule = createLinkInputRule(_utils.LinkMatcher.create(), editorAnalyticsApi);
|
|
68
69
|
|
|
69
70
|
// [something](link) should convert to a hyperlink
|
|
70
|
-
var markdownLinkRule = (0,
|
|
71
|
+
var markdownLinkRule = (0, _utils.createRule)(/(^|[^!])\[(.*?)\]\((\S+)\)$/, function (state, match, start, end) {
|
|
71
72
|
var _toolbarKey$getState$2, _toolbarKey$getState2;
|
|
72
73
|
var schema = state.schema;
|
|
73
74
|
var _match = (0, _slicedToArray2.default)(match, 4),
|
|
@@ -89,6 +90,6 @@ function createInputRulePlugin(schema, editorAnalyticsApi) {
|
|
|
89
90
|
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent((0, _utils.getLinkCreationAnalyticsEvent)(_analytics.INPUT_METHOD.FORMATTING, url))(tr);
|
|
90
91
|
return tr;
|
|
91
92
|
});
|
|
92
|
-
return (0, _prosemirrorInputRules.createPlugin)('hyperlink', [urlWithASpaceRule, markdownLinkRule]);
|
|
93
|
+
return new _safePlugin.SafePlugin((0, _prosemirrorInputRules.createPlugin)('hyperlink', [urlWithASpaceRule, markdownLinkRule]));
|
|
93
94
|
}
|
|
94
95
|
var _default = exports.default = createInputRulePlugin;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { addLinkMetadata } from '@atlaskit/editor-common/card';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
|
+
import { createRule, findFilepaths, getLinkCreationAnalyticsEvent, isLinkInMatches, LinkMatcher, normalizeUrl } from '@atlaskit/editor-common/utils';
|
|
5
|
+
import { createPlugin } from '@atlaskit/prosemirror-input-rules';
|
|
5
6
|
import { toolbarKey } from './toolbar-buttons';
|
|
6
7
|
export function createLinkInputRule(regexp, editorAnalyticsApi) {
|
|
7
8
|
// Plain typed text (eg, typing 'www.google.com') should convert to a hyperlink
|
|
@@ -80,6 +81,6 @@ export function createInputRulePlugin(schema, editorAnalyticsApi) {
|
|
|
80
81
|
editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent(getLinkCreationAnalyticsEvent(INPUT_METHOD.FORMATTING, url))(tr);
|
|
81
82
|
return tr;
|
|
82
83
|
});
|
|
83
|
-
return createPlugin('hyperlink', [urlWithASpaceRule, markdownLinkRule]);
|
|
84
|
+
return new SafePlugin(createPlugin('hyperlink', [urlWithASpaceRule, markdownLinkRule]));
|
|
84
85
|
}
|
|
85
86
|
export default createInputRulePlugin;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { addLinkMetadata } from '@atlaskit/editor-common/card';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
|
+
import { createRule, findFilepaths, getLinkCreationAnalyticsEvent, isLinkInMatches, LinkMatcher, normalizeUrl } from '@atlaskit/editor-common/utils';
|
|
6
|
+
import { createPlugin } from '@atlaskit/prosemirror-input-rules';
|
|
6
7
|
import { toolbarKey } from './toolbar-buttons';
|
|
7
8
|
export function createLinkInputRule(regexp, editorAnalyticsApi) {
|
|
8
9
|
// Plain typed text (eg, typing 'www.google.com') should convert to a hyperlink
|
|
@@ -80,6 +81,6 @@ export function createInputRulePlugin(schema, editorAnalyticsApi) {
|
|
|
80
81
|
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent(getLinkCreationAnalyticsEvent(INPUT_METHOD.FORMATTING, url))(tr);
|
|
81
82
|
return tr;
|
|
82
83
|
});
|
|
83
|
-
return createPlugin('hyperlink', [urlWithASpaceRule, markdownLinkRule]);
|
|
84
|
+
return new SafePlugin(createPlugin('hyperlink', [urlWithASpaceRule, markdownLinkRule]));
|
|
84
85
|
}
|
|
85
86
|
export default createInputRulePlugin;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import
|
|
2
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
import type { InputRuleWrapper } from '@atlaskit/editor-common/types';
|
|
3
4
|
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
-
import type { InputRuleWrapper } from '@atlaskit/prosemirror-input-rules';
|
|
5
5
|
export declare function createLinkInputRule(regexp: RegExp, editorAnalyticsApi: EditorAnalyticsAPI | undefined): InputRuleWrapper;
|
|
6
6
|
export declare function createInputRulePlugin(schema: Schema, editorAnalyticsApi: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
|
|
7
7
|
export default createInputRulePlugin;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import
|
|
2
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
import type { InputRuleWrapper } from '@atlaskit/editor-common/types';
|
|
3
4
|
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
-
import type { InputRuleWrapper } from '@atlaskit/prosemirror-input-rules';
|
|
5
5
|
export declare function createLinkInputRule(regexp: RegExp, editorAnalyticsApi: EditorAnalyticsAPI | undefined): InputRuleWrapper;
|
|
6
6
|
export declare function createInputRulePlugin(schema: Schema, editorAnalyticsApi: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
|
|
7
7
|
export default createInputRulePlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-hyperlink",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Hyperlink plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@atlaskit/adf-schema": "^35.5.1",
|
|
36
36
|
"@atlaskit/analytics-next": "^9.2.0",
|
|
37
|
-
"@atlaskit/editor-common": "^
|
|
37
|
+
"@atlaskit/editor-common": "^78.4.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^1.0.0",
|
|
39
39
|
"@atlaskit/editor-prosemirror": "3.0.0",
|
|
40
|
-
"@atlaskit/icon": "^22.
|
|
41
|
-
"@atlaskit/prosemirror-input-rules": "^
|
|
40
|
+
"@atlaskit/icon": "^22.1.0",
|
|
41
|
+
"@atlaskit/prosemirror-input-rules": "^3.0.0",
|
|
42
42
|
"@babel/runtime": "^7.0.0",
|
|
43
43
|
"uuid": "^3.1.0"
|
|
44
44
|
},
|