@atlaskit/editor-plugin-rule 1.9.11 → 1.10.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 +12 -0
- package/dist/cjs/pm-plugins/input-rule.js +4 -14
- package/dist/es2019/pm-plugins/input-rule.js +4 -14
- package/dist/esm/pm-plugins/input-rule.js +4 -14
- package/dist/types/rulePluginType.d.ts +3 -1
- package/dist/types-ts4.5/rulePluginType.d.ts +5 -3
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-rule
|
|
2
2
|
|
|
3
|
+
## 1.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#109060](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/109060)
|
|
8
|
+
[`4660ec858a305`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4660ec858a305) -
|
|
9
|
+
Update `React` from v16 to v18
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 1.9.11
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -12,10 +12,7 @@ var _utils = require("@atlaskit/editor-common/utils");
|
|
|
12
12
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
13
13
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
14
14
|
var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
|
|
15
|
-
var createHorizontalRule = exports.createHorizontalRule = function createHorizontalRule(state, start, end, inputMethod, editorAnalyticsAPI
|
|
16
|
-
// Ignored via go/ees005
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
18
|
-
) {
|
|
15
|
+
var createHorizontalRule = exports.createHorizontalRule = function createHorizontalRule(state, start, end, inputMethod, editorAnalyticsAPI) {
|
|
19
16
|
if (!state.selection.empty) {
|
|
20
17
|
return null;
|
|
21
18
|
}
|
|
@@ -42,10 +39,7 @@ var createHorizontalRule = exports.createHorizontalRule = function createHorizon
|
|
|
42
39
|
})(tr);
|
|
43
40
|
return tr;
|
|
44
41
|
};
|
|
45
|
-
var createHorizontalRuleAutoformat = function createHorizontalRuleAutoformat(state, start, end, editorAnalyticsAPI
|
|
46
|
-
// Ignored via go/ees005
|
|
47
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
48
|
-
) {
|
|
42
|
+
var createHorizontalRuleAutoformat = function createHorizontalRuleAutoformat(state, start, end, editorAnalyticsAPI) {
|
|
49
43
|
var listItem = state.schema.nodes.listItem;
|
|
50
44
|
if ((0, _utils2.hasParentNodeOfType)(listItem)(state.selection)) {
|
|
51
45
|
return null;
|
|
@@ -57,8 +51,7 @@ function inputRulePlugin(schema, editorAnalyticsAPI) {
|
|
|
57
51
|
if (schema.nodes.rule) {
|
|
58
52
|
// '---' and '***' for hr
|
|
59
53
|
rules.push(
|
|
60
|
-
//
|
|
61
|
-
// eslint-disable-next-line require-unicode-regexp, @typescript-eslint/max-params
|
|
54
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
62
55
|
(0, _utils.createRule)(/^(\-\-\-|\*\*\*)$/, function (state, _match, start, end) {
|
|
63
56
|
return createHorizontalRuleAutoformat(state, start, end, editorAnalyticsAPI);
|
|
64
57
|
}));
|
|
@@ -67,10 +60,7 @@ function inputRulePlugin(schema, editorAnalyticsAPI) {
|
|
|
67
60
|
rules.push((0, _utils.createRule)(
|
|
68
61
|
// Ignored via go/ees005
|
|
69
62
|
// eslint-disable-next-line require-unicode-regexp
|
|
70
|
-
new RegExp("".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "(\\-\\-\\-|\\*\\*\\*)")),
|
|
71
|
-
// Ignored via go/ees005
|
|
72
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
73
|
-
function (state, _match, start, end) {
|
|
63
|
+
new RegExp("".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "(\\-\\-\\-|\\*\\*\\*)")), function (state, _match, start, end) {
|
|
74
64
|
var hardBreak = state.schema.nodes.hardBreak;
|
|
75
65
|
// Ignored via go/ees005
|
|
76
66
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -5,10 +5,7 @@ import { createRule } from '@atlaskit/editor-common/utils';
|
|
|
5
5
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
7
7
|
import { createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
|
|
8
|
-
export const createHorizontalRule = (state, start, end, inputMethod, editorAnalyticsAPI
|
|
9
|
-
// Ignored via go/ees005
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
11
|
-
) => {
|
|
8
|
+
export const createHorizontalRule = (state, start, end, inputMethod, editorAnalyticsAPI) => {
|
|
12
9
|
if (!state.selection.empty) {
|
|
13
10
|
return null;
|
|
14
11
|
}
|
|
@@ -37,10 +34,7 @@ export const createHorizontalRule = (state, start, end, inputMethod, editorAnaly
|
|
|
37
34
|
})(tr);
|
|
38
35
|
return tr;
|
|
39
36
|
};
|
|
40
|
-
const createHorizontalRuleAutoformat = (state, start, end, editorAnalyticsAPI
|
|
41
|
-
// Ignored via go/ees005
|
|
42
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
43
|
-
) => {
|
|
37
|
+
const createHorizontalRuleAutoformat = (state, start, end, editorAnalyticsAPI) => {
|
|
44
38
|
const {
|
|
45
39
|
listItem
|
|
46
40
|
} = state.schema.nodes;
|
|
@@ -54,18 +48,14 @@ export function inputRulePlugin(schema, editorAnalyticsAPI) {
|
|
|
54
48
|
if (schema.nodes.rule) {
|
|
55
49
|
// '---' and '***' for hr
|
|
56
50
|
rules.push(
|
|
57
|
-
//
|
|
58
|
-
// eslint-disable-next-line require-unicode-regexp, @typescript-eslint/max-params
|
|
51
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
59
52
|
createRule(/^(\-\-\-|\*\*\*)$/, (state, _match, start, end) => createHorizontalRuleAutoformat(state, start, end, editorAnalyticsAPI)));
|
|
60
53
|
|
|
61
54
|
// '---' and '***' after shift+enter for hr
|
|
62
55
|
rules.push(createRule(
|
|
63
56
|
// Ignored via go/ees005
|
|
64
57
|
// eslint-disable-next-line require-unicode-regexp
|
|
65
|
-
new RegExp(`${leafNodeReplacementCharacter}(\\-\\-\\-|\\*\\*\\*)`),
|
|
66
|
-
// Ignored via go/ees005
|
|
67
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
68
|
-
(state, _match, start, end) => {
|
|
58
|
+
new RegExp(`${leafNodeReplacementCharacter}(\\-\\-\\-|\\*\\*\\*)`), (state, _match, start, end) => {
|
|
69
59
|
const {
|
|
70
60
|
hardBreak
|
|
71
61
|
} = state.schema.nodes;
|
|
@@ -5,10 +5,7 @@ import { createRule } from '@atlaskit/editor-common/utils';
|
|
|
5
5
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
7
7
|
import { createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
|
|
8
|
-
export var createHorizontalRule = function createHorizontalRule(state, start, end, inputMethod, editorAnalyticsAPI
|
|
9
|
-
// Ignored via go/ees005
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
11
|
-
) {
|
|
8
|
+
export var createHorizontalRule = function createHorizontalRule(state, start, end, inputMethod, editorAnalyticsAPI) {
|
|
12
9
|
if (!state.selection.empty) {
|
|
13
10
|
return null;
|
|
14
11
|
}
|
|
@@ -35,10 +32,7 @@ export var createHorizontalRule = function createHorizontalRule(state, start, en
|
|
|
35
32
|
})(tr);
|
|
36
33
|
return tr;
|
|
37
34
|
};
|
|
38
|
-
var createHorizontalRuleAutoformat = function createHorizontalRuleAutoformat(state, start, end, editorAnalyticsAPI
|
|
39
|
-
// Ignored via go/ees005
|
|
40
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
41
|
-
) {
|
|
35
|
+
var createHorizontalRuleAutoformat = function createHorizontalRuleAutoformat(state, start, end, editorAnalyticsAPI) {
|
|
42
36
|
var listItem = state.schema.nodes.listItem;
|
|
43
37
|
if (hasParentNodeOfType(listItem)(state.selection)) {
|
|
44
38
|
return null;
|
|
@@ -50,8 +44,7 @@ export function inputRulePlugin(schema, editorAnalyticsAPI) {
|
|
|
50
44
|
if (schema.nodes.rule) {
|
|
51
45
|
// '---' and '***' for hr
|
|
52
46
|
rules.push(
|
|
53
|
-
//
|
|
54
|
-
// eslint-disable-next-line require-unicode-regexp, @typescript-eslint/max-params
|
|
47
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
55
48
|
createRule(/^(\-\-\-|\*\*\*)$/, function (state, _match, start, end) {
|
|
56
49
|
return createHorizontalRuleAutoformat(state, start, end, editorAnalyticsAPI);
|
|
57
50
|
}));
|
|
@@ -60,10 +53,7 @@ export function inputRulePlugin(schema, editorAnalyticsAPI) {
|
|
|
60
53
|
rules.push(createRule(
|
|
61
54
|
// Ignored via go/ees005
|
|
62
55
|
// eslint-disable-next-line require-unicode-regexp
|
|
63
|
-
new RegExp("".concat(leafNodeReplacementCharacter, "(\\-\\-\\-|\\*\\*\\*)")),
|
|
64
|
-
// Ignored via go/ees005
|
|
65
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
66
|
-
function (state, _match, start, end) {
|
|
56
|
+
new RegExp("".concat(leafNodeReplacementCharacter, "(\\-\\-\\-|\\*\\*\\*)")), function (state, _match, start, end) {
|
|
67
57
|
var hardBreak = state.schema.nodes.hardBreak;
|
|
68
58
|
// Ignored via go/ees005
|
|
69
59
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
3
|
import type { insertHorizontalRule } from './pm-plugins/commands';
|
|
4
|
+
type RulePluginDependencies = [OptionalPlugin<AnalyticsPlugin>];
|
|
4
5
|
export type RulePlugin = NextEditorPlugin<'rule', {
|
|
5
6
|
pluginConfiguration: undefined;
|
|
6
|
-
dependencies:
|
|
7
|
+
dependencies: RulePluginDependencies;
|
|
7
8
|
actions: {
|
|
8
9
|
insertHorizontalRule: ReturnType<typeof insertHorizontalRule>;
|
|
9
10
|
};
|
|
10
11
|
}>;
|
|
12
|
+
export {};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
3
|
import type { insertHorizontalRule } from './pm-plugins/commands';
|
|
4
|
+
type RulePluginDependencies = [
|
|
5
|
+
OptionalPlugin<AnalyticsPlugin>
|
|
6
|
+
];
|
|
4
7
|
export type RulePlugin = NextEditorPlugin<'rule', {
|
|
5
8
|
pluginConfiguration: undefined;
|
|
6
|
-
dependencies:
|
|
7
|
-
OptionalPlugin<AnalyticsPlugin>
|
|
8
|
-
];
|
|
9
|
+
dependencies: RulePluginDependencies;
|
|
9
10
|
actions: {
|
|
10
11
|
insertHorizontalRule: ReturnType<typeof insertHorizontalRule>;
|
|
11
12
|
};
|
|
12
13
|
}>;
|
|
14
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-rule",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "Rule plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^46.1.0",
|
|
35
|
-
"@atlaskit/editor-common": "^99.
|
|
36
|
-
"@atlaskit/editor-plugin-analytics": "^1.
|
|
35
|
+
"@atlaskit/editor-common": "^99.6.0",
|
|
36
|
+
"@atlaskit/editor-plugin-analytics": "^1.11.0",
|
|
37
37
|
"@atlaskit/editor-prosemirror": "6.2.1",
|
|
38
38
|
"@atlaskit/prosemirror-input-rules": "^3.2.0",
|
|
39
39
|
"@babel/runtime": "^7.0.0"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.2.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@testing-library/react": "^
|
|
46
|
+
"@testing-library/react": "^13.4.0",
|
|
47
47
|
"typescript": "~5.4.2"
|
|
48
48
|
},
|
|
49
49
|
"techstack": {
|