@atlaskit/editor-plugin-rule 1.1.0 → 1.1.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 +37 -0
- package/dist/cjs/pm-plugins/input-rule.js +8 -6
- package/dist/es2019/pm-plugins/input-rule.js +5 -3
- package/dist/esm/pm-plugins/input-rule.js +5 -3
- package/dist/types/pm-plugins/input-rule.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/input-rule.d.ts +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-rule
|
|
2
2
|
|
|
3
|
+
## 1.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#78224](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/78224) [`6b4c9dd4ad34`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6b4c9dd4ad34) - ED-22219: adf-schema updated to 35.5.2
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
10
|
+
## 1.1.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#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.
|
|
15
|
+
|
|
16
|
+
## WHY?
|
|
17
|
+
|
|
18
|
+
Removing editor-common dependencies from prosemirror-input-rules package.
|
|
19
|
+
|
|
20
|
+
This makes it easier for editor updates because it simplifies our dependency graph.
|
|
21
|
+
|
|
22
|
+
## WHAT and HOW?
|
|
23
|
+
|
|
24
|
+
These are no longer available via `@atlaskit/prosemirror-input-rules` but are available from `@atlaskit/editor-common/types`:
|
|
25
|
+
|
|
26
|
+
- InputRuleWrapper
|
|
27
|
+
- InputRuleHandler
|
|
28
|
+
- OnHandlerApply
|
|
29
|
+
- createRule
|
|
30
|
+
|
|
31
|
+
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( ... ))`).
|
|
32
|
+
|
|
33
|
+
`SafePlugin` exists in `@atlaskit/editor-common/safe-plugin`.
|
|
34
|
+
|
|
35
|
+
- createPlugin
|
|
36
|
+
- createInputRulePlugin
|
|
37
|
+
|
|
38
|
+
- Updated dependencies
|
|
39
|
+
|
|
3
40
|
## 1.1.0
|
|
4
41
|
|
|
5
42
|
### Minor Changes
|
|
@@ -7,8 +7,10 @@ exports.default = exports.createHorizontalRule = void 0;
|
|
|
7
7
|
exports.inputRulePlugin = inputRulePlugin;
|
|
8
8
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
9
9
|
var _insert = require("@atlaskit/editor-common/insert");
|
|
10
|
+
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
11
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
10
12
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
11
|
-
var
|
|
13
|
+
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
12
14
|
var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
|
|
13
15
|
var createHorizontalRule = exports.createHorizontalRule = function createHorizontalRule(state, start, end, inputMethod, editorAnalyticsAPI) {
|
|
14
16
|
if (!state.selection.empty) {
|
|
@@ -39,7 +41,7 @@ var createHorizontalRule = exports.createHorizontalRule = function createHorizon
|
|
|
39
41
|
};
|
|
40
42
|
var createHorizontalRuleAutoformat = function createHorizontalRuleAutoformat(state, start, end, editorAnalyticsAPI) {
|
|
41
43
|
var listItem = state.schema.nodes.listItem;
|
|
42
|
-
if ((0,
|
|
44
|
+
if ((0, _utils2.hasParentNodeOfType)(listItem)(state.selection)) {
|
|
43
45
|
return null;
|
|
44
46
|
}
|
|
45
47
|
return createHorizontalRule(state, start, end, _analytics.INPUT_METHOD.FORMATTING, editorAnalyticsAPI);
|
|
@@ -48,12 +50,12 @@ function inputRulePlugin(schema, editorAnalyticsAPI) {
|
|
|
48
50
|
var rules = [];
|
|
49
51
|
if (schema.nodes.rule) {
|
|
50
52
|
// '---' and '***' for hr
|
|
51
|
-
rules.push((0,
|
|
53
|
+
rules.push((0, _utils.createRule)(/^(\-\-\-|\*\*\*)$/, function (state, _match, start, end) {
|
|
52
54
|
return createHorizontalRuleAutoformat(state, start, end, editorAnalyticsAPI);
|
|
53
55
|
}));
|
|
54
56
|
|
|
55
57
|
// '---' and '***' after shift+enter for hr
|
|
56
|
-
rules.push((0,
|
|
58
|
+
rules.push((0, _utils.createRule)(new RegExp("".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "(\\-\\-\\-|\\*\\*\\*)")), function (state, _match, start, end) {
|
|
57
59
|
var hardBreak = state.schema.nodes.hardBreak;
|
|
58
60
|
if (state.doc.resolve(start).nodeAfter.type !== hardBreak) {
|
|
59
61
|
return null;
|
|
@@ -62,9 +64,9 @@ function inputRulePlugin(schema, editorAnalyticsAPI) {
|
|
|
62
64
|
}));
|
|
63
65
|
}
|
|
64
66
|
if (rules.length !== 0) {
|
|
65
|
-
return (0, _prosemirrorInputRules.createPlugin)('rule', rules, {
|
|
67
|
+
return new _safePlugin.SafePlugin((0, _prosemirrorInputRules.createPlugin)('rule', rules, {
|
|
66
68
|
isBlockNodeRule: true
|
|
67
|
-
});
|
|
69
|
+
}));
|
|
68
70
|
}
|
|
69
71
|
return;
|
|
70
72
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { safeInsert } from '@atlaskit/editor-common/insert';
|
|
3
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
|
+
import { createRule } from '@atlaskit/editor-common/utils';
|
|
3
5
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
4
6
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
-
import { createPlugin,
|
|
7
|
+
import { createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
|
|
6
8
|
export const createHorizontalRule = (state, start, end, inputMethod, editorAnalyticsAPI) => {
|
|
7
9
|
if (!state.selection.empty) {
|
|
8
10
|
return null;
|
|
@@ -59,9 +61,9 @@ export function inputRulePlugin(schema, editorAnalyticsAPI) {
|
|
|
59
61
|
}));
|
|
60
62
|
}
|
|
61
63
|
if (rules.length !== 0) {
|
|
62
|
-
return createPlugin('rule', rules, {
|
|
64
|
+
return new SafePlugin(createPlugin('rule', rules, {
|
|
63
65
|
isBlockNodeRule: true
|
|
64
|
-
});
|
|
66
|
+
}));
|
|
65
67
|
}
|
|
66
68
|
return;
|
|
67
69
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { safeInsert } from '@atlaskit/editor-common/insert';
|
|
3
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
|
+
import { createRule } from '@atlaskit/editor-common/utils';
|
|
3
5
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
4
6
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
-
import { createPlugin,
|
|
7
|
+
import { createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
|
|
6
8
|
export var createHorizontalRule = function createHorizontalRule(state, start, end, inputMethod, editorAnalyticsAPI) {
|
|
7
9
|
if (!state.selection.empty) {
|
|
8
10
|
return null;
|
|
@@ -55,9 +57,9 @@ export function inputRulePlugin(schema, editorAnalyticsAPI) {
|
|
|
55
57
|
}));
|
|
56
58
|
}
|
|
57
59
|
if (rules.length !== 0) {
|
|
58
|
-
return createPlugin('rule', rules, {
|
|
60
|
+
return new SafePlugin(createPlugin('rule', rules, {
|
|
59
61
|
isBlockNodeRule: true
|
|
60
|
-
});
|
|
62
|
+
}));
|
|
61
63
|
}
|
|
62
64
|
return;
|
|
63
65
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import
|
|
3
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
4
|
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
export declare const createHorizontalRule: (state: EditorState, start: number, end: number, inputMethod: INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.FORMATTING | INPUT_METHOD.SHORTCUT, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Transaction | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import
|
|
3
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
4
|
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
export declare const createHorizontalRule: (state: EditorState, start: number, end: number, inputMethod: INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.FORMATTING | INPUT_METHOD.SHORTCUT, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Transaction | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-rule",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Rule plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
".": "./src/index.ts"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@atlaskit/adf-schema": "^35.5.
|
|
36
|
-
"@atlaskit/editor-common": "^78.
|
|
35
|
+
"@atlaskit/adf-schema": "^35.5.2",
|
|
36
|
+
"@atlaskit/editor-common": "^78.10.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^1.0.0",
|
|
38
38
|
"@atlaskit/editor-prosemirror": "3.0.0",
|
|
39
|
-
"@atlaskit/prosemirror-input-rules": "^
|
|
39
|
+
"@atlaskit/prosemirror-input-rules": "^3.0.0",
|
|
40
40
|
"@babel/runtime": "^7.0.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|