@atlaskit/editor-plugin-rule 15.0.0 → 15.0.1
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 +8 -0
- package/dist/cjs/rulePlugin.js +14 -5
- package/dist/cjs/ui/quick-insert/RuleQuickInsertMenuItem.js +42 -0
- package/dist/cjs/ui/quick-insert/getRuleQuickInsertComponents.js +39 -0
- package/dist/es2019/rulePlugin.js +12 -3
- package/dist/es2019/ui/quick-insert/RuleQuickInsertMenuItem.js +37 -0
- package/dist/es2019/ui/quick-insert/getRuleQuickInsertComponents.js +28 -0
- package/dist/esm/rulePlugin.js +12 -3
- package/dist/esm/ui/quick-insert/RuleQuickInsertMenuItem.js +34 -0
- package/dist/esm/ui/quick-insert/getRuleQuickInsertComponents.js +32 -0
- package/dist/types/rulePluginType.d.ts +5 -1
- package/dist/types/ui/quick-insert/RuleQuickInsertMenuItem.d.ts +6 -0
- package/dist/types/ui/quick-insert/getRuleQuickInsertComponents.d.ts +6 -0
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-rule
|
|
2
2
|
|
|
3
|
+
## 15.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`4273da2e1a648`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4273da2e1a648) -
|
|
8
|
+
Register native Quick Insert items behind `platform_editor_slash_command`.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 15.0.0
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/dist/cjs/rulePlugin.js
CHANGED
|
@@ -9,11 +9,13 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
10
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
11
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
12
|
-
var
|
|
13
|
-
var
|
|
12
|
+
var _assets = require("@atlaskit/editor-common/assets");
|
|
13
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
14
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
14
15
|
var _commands = require("./pm-plugins/commands");
|
|
15
16
|
var _inputRule = _interopRequireDefault(require("./pm-plugins/input-rule"));
|
|
16
17
|
var _keymap = _interopRequireDefault(require("./pm-plugins/keymap"));
|
|
18
|
+
var _getRuleQuickInsertComponents = require("./ui/quick-insert/getRuleQuickInsertComponents");
|
|
17
19
|
// Ignored via go/ees005
|
|
18
20
|
// eslint-disable-next-line import/no-named-as-default
|
|
19
21
|
|
|
@@ -23,12 +25,19 @@ var _keymap = _interopRequireDefault(require("./pm-plugins/keymap"));
|
|
|
23
25
|
var rulePlugin = exports.rulePlugin = function rulePlugin(_ref) {
|
|
24
26
|
var _api$analytics;
|
|
25
27
|
var api = _ref.api;
|
|
28
|
+
var isRegisteredSlashCommandEnabled = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_slash_command');
|
|
29
|
+
if (isRegisteredSlashCommandEnabled) {
|
|
30
|
+
var _api$uiControlRegistr;
|
|
31
|
+
api === null || api === void 0 || (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 || _api$uiControlRegistr.actions.register((0, _getRuleQuickInsertComponents.getRuleQuickInsertComponents)({
|
|
32
|
+
api: api
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
26
35
|
return {
|
|
27
36
|
name: 'rule',
|
|
28
37
|
nodes: function nodes() {
|
|
29
38
|
return [{
|
|
30
39
|
name: 'rule',
|
|
31
|
-
node: (0,
|
|
40
|
+
node: (0, _fg.fg)('platform_editor_adf_with_localid') ? _adfSchema.ruleWithLocalId : _adfSchema.rule
|
|
32
41
|
}];
|
|
33
42
|
},
|
|
34
43
|
actions: {
|
|
@@ -51,7 +60,7 @@ var rulePlugin = exports.rulePlugin = function rulePlugin(_ref) {
|
|
|
51
60
|
}];
|
|
52
61
|
},
|
|
53
62
|
pluginsOptions: {
|
|
54
|
-
quickInsert: function
|
|
63
|
+
quickInsert: isRegisteredSlashCommandEnabled ? undefined : function (_ref3) {
|
|
55
64
|
var formatMessage = _ref3.formatMessage;
|
|
56
65
|
return [{
|
|
57
66
|
id: 'rule',
|
|
@@ -61,7 +70,7 @@ var rulePlugin = exports.rulePlugin = function rulePlugin(_ref) {
|
|
|
61
70
|
priority: 1200,
|
|
62
71
|
keyshortcut: '---',
|
|
63
72
|
icon: function icon() {
|
|
64
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
73
|
+
return /*#__PURE__*/_react.default.createElement(_assets.IconDivider, null);
|
|
65
74
|
},
|
|
66
75
|
action: function action(insert, state, source) {
|
|
67
76
|
var _api$analytics4;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.RuleQuickInsertMenuItem = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _reactIntl = require("react-intl");
|
|
10
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
|
+
var _assets = require("@atlaskit/editor-common/assets");
|
|
12
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
|
+
var _menuItem = require("@atlaskit/editor-common/quick-insert/menu-item");
|
|
14
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
15
|
+
var RuleQuickInsertMenuItem = exports.RuleQuickInsertMenuItem = function RuleQuickInsertMenuItem(_ref) {
|
|
16
|
+
var api = _ref.api;
|
|
17
|
+
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
18
|
+
formatMessage = _useIntl.formatMessage;
|
|
19
|
+
var onSelect = (0, _react.useCallback)(function (_ref2) {
|
|
20
|
+
var _api$analytics;
|
|
21
|
+
var editorView = _ref2.editorView,
|
|
22
|
+
insert = _ref2.insert,
|
|
23
|
+
source = _ref2.source;
|
|
24
|
+
var tr = insert(editorView.state.schema.nodes.rule.createChecked());
|
|
25
|
+
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.attachAnalyticsEvent({
|
|
26
|
+
action: _analytics.ACTION.INSERTED,
|
|
27
|
+
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
28
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.DIVIDER,
|
|
29
|
+
attributes: {
|
|
30
|
+
inputMethod: source !== null && source !== void 0 ? source : _analytics.INPUT_METHOD.QUICK_INSERT
|
|
31
|
+
},
|
|
32
|
+
eventType: _analytics.EVENT_TYPE.TRACK
|
|
33
|
+
})(tr);
|
|
34
|
+
return tr;
|
|
35
|
+
}, [api]);
|
|
36
|
+
return /*#__PURE__*/_react.default.createElement(_menuItem.QuickInsertMenuItem, {
|
|
37
|
+
iconBefore: /*#__PURE__*/_react.default.createElement(_assets.IconDivider, null),
|
|
38
|
+
onSelect: onSelect,
|
|
39
|
+
shortcut: "---",
|
|
40
|
+
title: formatMessage(_messages.toolbarInsertBlockMessages.horizontalRule)
|
|
41
|
+
});
|
|
42
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getRuleQuickInsertComponents = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
10
|
+
var _createQuickInsertMatcher = require("@atlaskit/editor-common/quick-insert/create-quick-insert-matcher");
|
|
11
|
+
var _keys = require("@atlaskit/editor-common/quick-insert/keys");
|
|
12
|
+
var _rank = require("@atlaskit/editor-common/quick-insert/rank");
|
|
13
|
+
var _RuleQuickInsertMenuItem = require("./RuleQuickInsertMenuItem");
|
|
14
|
+
var getRuleQuickInsertComponents = exports.getRuleQuickInsertComponents = function getRuleQuickInsertComponents(_ref) {
|
|
15
|
+
var api = _ref.api;
|
|
16
|
+
return [{
|
|
17
|
+
key: _keys.RULE_MENU_ITEM.key,
|
|
18
|
+
type: _keys.RULE_MENU_ITEM.type,
|
|
19
|
+
parents: [{
|
|
20
|
+
key: _keys.TEXT_FORMATTING_SECTION.key,
|
|
21
|
+
type: _keys.TEXT_FORMATTING_SECTION.type,
|
|
22
|
+
rank: _rank.TEXT_FORMATTING_SECTION_RANK[_keys.RULE_MENU_ITEM.key]
|
|
23
|
+
}],
|
|
24
|
+
match: (0, _createQuickInsertMatcher.createQuickInsertMatcher)(function (_ref2) {
|
|
25
|
+
var formatMessage = _ref2.formatMessage;
|
|
26
|
+
return {
|
|
27
|
+
description: formatMessage(_messages.toolbarInsertBlockMessages.horizontalRuleDescription),
|
|
28
|
+
keywords: ['horizontal', 'rule', 'line', 'hr'],
|
|
29
|
+
shortcut: '---',
|
|
30
|
+
title: formatMessage(_messages.toolbarInsertBlockMessages.horizontalRule)
|
|
31
|
+
};
|
|
32
|
+
}),
|
|
33
|
+
component: function component() {
|
|
34
|
+
return /*#__PURE__*/_react.default.createElement(_RuleQuickInsertMenuItem.RuleQuickInsertMenuItem, {
|
|
35
|
+
api: api
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}];
|
|
39
|
+
};
|
|
@@ -2,8 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { rule, ruleWithLocalId } from '@atlaskit/adf-schema';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
|
-
import { IconDivider } from '@atlaskit/editor-common/
|
|
6
|
-
import {
|
|
5
|
+
import { IconDivider } from '@atlaskit/editor-common/assets';
|
|
6
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
7
8
|
import { insertHorizontalRule } from './pm-plugins/commands';
|
|
8
9
|
// Ignored via go/ees005
|
|
9
10
|
// eslint-disable-next-line import/no-named-as-default
|
|
@@ -11,10 +12,18 @@ import inputRulePlugin from './pm-plugins/input-rule';
|
|
|
11
12
|
// Ignored via go/ees005
|
|
12
13
|
// eslint-disable-next-line import/no-named-as-default
|
|
13
14
|
import keymapPlugin from './pm-plugins/keymap';
|
|
15
|
+
import { getRuleQuickInsertComponents } from './ui/quick-insert/getRuleQuickInsertComponents';
|
|
14
16
|
export const rulePlugin = ({
|
|
15
17
|
api
|
|
16
18
|
}) => {
|
|
17
19
|
var _api$analytics;
|
|
20
|
+
const isRegisteredSlashCommandEnabled = isExperimentEnabled('platform_editor_slash_command');
|
|
21
|
+
if (isRegisteredSlashCommandEnabled) {
|
|
22
|
+
var _api$uiControlRegistr;
|
|
23
|
+
api === null || api === void 0 ? void 0 : (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 ? void 0 : _api$uiControlRegistr.actions.register(getRuleQuickInsertComponents({
|
|
24
|
+
api
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
18
27
|
return {
|
|
19
28
|
name: 'rule',
|
|
20
29
|
nodes() {
|
|
@@ -44,7 +53,7 @@ export const rulePlugin = ({
|
|
|
44
53
|
}];
|
|
45
54
|
},
|
|
46
55
|
pluginsOptions: {
|
|
47
|
-
quickInsert: ({
|
|
56
|
+
quickInsert: isRegisteredSlashCommandEnabled ? undefined : ({
|
|
48
57
|
formatMessage
|
|
49
58
|
}) => [{
|
|
50
59
|
id: 'rule',
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { IconDivider } from '@atlaskit/editor-common/assets';
|
|
5
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
+
import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
|
|
7
|
+
export const RuleQuickInsertMenuItem = ({
|
|
8
|
+
api
|
|
9
|
+
}) => {
|
|
10
|
+
const {
|
|
11
|
+
formatMessage
|
|
12
|
+
} = useIntl();
|
|
13
|
+
const onSelect = useCallback(({
|
|
14
|
+
editorView,
|
|
15
|
+
insert,
|
|
16
|
+
source
|
|
17
|
+
}) => {
|
|
18
|
+
var _api$analytics;
|
|
19
|
+
const tr = insert(editorView.state.schema.nodes.rule.createChecked());
|
|
20
|
+
api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.attachAnalyticsEvent({
|
|
21
|
+
action: ACTION.INSERTED,
|
|
22
|
+
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
23
|
+
actionSubjectId: ACTION_SUBJECT_ID.DIVIDER,
|
|
24
|
+
attributes: {
|
|
25
|
+
inputMethod: source !== null && source !== void 0 ? source : INPUT_METHOD.QUICK_INSERT
|
|
26
|
+
},
|
|
27
|
+
eventType: EVENT_TYPE.TRACK
|
|
28
|
+
})(tr);
|
|
29
|
+
return tr;
|
|
30
|
+
}, [api]);
|
|
31
|
+
return /*#__PURE__*/React.createElement(QuickInsertMenuItem, {
|
|
32
|
+
iconBefore: /*#__PURE__*/React.createElement(IconDivider, null),
|
|
33
|
+
onSelect: onSelect,
|
|
34
|
+
shortcut: "---",
|
|
35
|
+
title: formatMessage(messages.horizontalRule)
|
|
36
|
+
});
|
|
37
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
3
|
+
import { createQuickInsertMatcher } from '@atlaskit/editor-common/quick-insert/create-quick-insert-matcher';
|
|
4
|
+
import { RULE_MENU_ITEM, TEXT_FORMATTING_SECTION } from '@atlaskit/editor-common/quick-insert/keys';
|
|
5
|
+
import { TEXT_FORMATTING_SECTION_RANK } from '@atlaskit/editor-common/quick-insert/rank';
|
|
6
|
+
import { RuleQuickInsertMenuItem } from './RuleQuickInsertMenuItem';
|
|
7
|
+
export const getRuleQuickInsertComponents = ({
|
|
8
|
+
api
|
|
9
|
+
}) => [{
|
|
10
|
+
key: RULE_MENU_ITEM.key,
|
|
11
|
+
type: RULE_MENU_ITEM.type,
|
|
12
|
+
parents: [{
|
|
13
|
+
key: TEXT_FORMATTING_SECTION.key,
|
|
14
|
+
type: TEXT_FORMATTING_SECTION.type,
|
|
15
|
+
rank: TEXT_FORMATTING_SECTION_RANK[RULE_MENU_ITEM.key]
|
|
16
|
+
}],
|
|
17
|
+
match: createQuickInsertMatcher(({
|
|
18
|
+
formatMessage
|
|
19
|
+
}) => ({
|
|
20
|
+
description: formatMessage(messages.horizontalRuleDescription),
|
|
21
|
+
keywords: ['horizontal', 'rule', 'line', 'hr'],
|
|
22
|
+
shortcut: '---',
|
|
23
|
+
title: formatMessage(messages.horizontalRule)
|
|
24
|
+
})),
|
|
25
|
+
component: () => /*#__PURE__*/React.createElement(RuleQuickInsertMenuItem, {
|
|
26
|
+
api: api
|
|
27
|
+
})
|
|
28
|
+
}];
|
package/dist/esm/rulePlugin.js
CHANGED
|
@@ -2,8 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { rule, ruleWithLocalId } from '@atlaskit/adf-schema';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
|
-
import { IconDivider } from '@atlaskit/editor-common/
|
|
6
|
-
import {
|
|
5
|
+
import { IconDivider } from '@atlaskit/editor-common/assets';
|
|
6
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
7
8
|
import { insertHorizontalRule } from './pm-plugins/commands';
|
|
8
9
|
// Ignored via go/ees005
|
|
9
10
|
// eslint-disable-next-line import/no-named-as-default
|
|
@@ -11,9 +12,17 @@ import inputRulePlugin from './pm-plugins/input-rule';
|
|
|
11
12
|
// Ignored via go/ees005
|
|
12
13
|
// eslint-disable-next-line import/no-named-as-default
|
|
13
14
|
import keymapPlugin from './pm-plugins/keymap';
|
|
15
|
+
import { getRuleQuickInsertComponents } from './ui/quick-insert/getRuleQuickInsertComponents';
|
|
14
16
|
export var rulePlugin = function rulePlugin(_ref) {
|
|
15
17
|
var _api$analytics;
|
|
16
18
|
var api = _ref.api;
|
|
19
|
+
var isRegisteredSlashCommandEnabled = isExperimentEnabled('platform_editor_slash_command');
|
|
20
|
+
if (isRegisteredSlashCommandEnabled) {
|
|
21
|
+
var _api$uiControlRegistr;
|
|
22
|
+
api === null || api === void 0 || (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 || _api$uiControlRegistr.actions.register(getRuleQuickInsertComponents({
|
|
23
|
+
api: api
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
17
26
|
return {
|
|
18
27
|
name: 'rule',
|
|
19
28
|
nodes: function nodes() {
|
|
@@ -42,7 +51,7 @@ export var rulePlugin = function rulePlugin(_ref) {
|
|
|
42
51
|
}];
|
|
43
52
|
},
|
|
44
53
|
pluginsOptions: {
|
|
45
|
-
quickInsert: function
|
|
54
|
+
quickInsert: isRegisteredSlashCommandEnabled ? undefined : function (_ref3) {
|
|
46
55
|
var formatMessage = _ref3.formatMessage;
|
|
47
56
|
return [{
|
|
48
57
|
id: 'rule',
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { IconDivider } from '@atlaskit/editor-common/assets';
|
|
5
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
+
import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
|
|
7
|
+
export var RuleQuickInsertMenuItem = function RuleQuickInsertMenuItem(_ref) {
|
|
8
|
+
var api = _ref.api;
|
|
9
|
+
var _useIntl = useIntl(),
|
|
10
|
+
formatMessage = _useIntl.formatMessage;
|
|
11
|
+
var onSelect = useCallback(function (_ref2) {
|
|
12
|
+
var _api$analytics;
|
|
13
|
+
var editorView = _ref2.editorView,
|
|
14
|
+
insert = _ref2.insert,
|
|
15
|
+
source = _ref2.source;
|
|
16
|
+
var tr = insert(editorView.state.schema.nodes.rule.createChecked());
|
|
17
|
+
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.attachAnalyticsEvent({
|
|
18
|
+
action: ACTION.INSERTED,
|
|
19
|
+
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
20
|
+
actionSubjectId: ACTION_SUBJECT_ID.DIVIDER,
|
|
21
|
+
attributes: {
|
|
22
|
+
inputMethod: source !== null && source !== void 0 ? source : INPUT_METHOD.QUICK_INSERT
|
|
23
|
+
},
|
|
24
|
+
eventType: EVENT_TYPE.TRACK
|
|
25
|
+
})(tr);
|
|
26
|
+
return tr;
|
|
27
|
+
}, [api]);
|
|
28
|
+
return /*#__PURE__*/React.createElement(QuickInsertMenuItem, {
|
|
29
|
+
iconBefore: /*#__PURE__*/React.createElement(IconDivider, null),
|
|
30
|
+
onSelect: onSelect,
|
|
31
|
+
shortcut: "---",
|
|
32
|
+
title: formatMessage(messages.horizontalRule)
|
|
33
|
+
});
|
|
34
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
3
|
+
import { createQuickInsertMatcher } from '@atlaskit/editor-common/quick-insert/create-quick-insert-matcher';
|
|
4
|
+
import { RULE_MENU_ITEM, TEXT_FORMATTING_SECTION } from '@atlaskit/editor-common/quick-insert/keys';
|
|
5
|
+
import { TEXT_FORMATTING_SECTION_RANK } from '@atlaskit/editor-common/quick-insert/rank';
|
|
6
|
+
import { RuleQuickInsertMenuItem } from './RuleQuickInsertMenuItem';
|
|
7
|
+
export var getRuleQuickInsertComponents = function getRuleQuickInsertComponents(_ref) {
|
|
8
|
+
var api = _ref.api;
|
|
9
|
+
return [{
|
|
10
|
+
key: RULE_MENU_ITEM.key,
|
|
11
|
+
type: RULE_MENU_ITEM.type,
|
|
12
|
+
parents: [{
|
|
13
|
+
key: TEXT_FORMATTING_SECTION.key,
|
|
14
|
+
type: TEXT_FORMATTING_SECTION.type,
|
|
15
|
+
rank: TEXT_FORMATTING_SECTION_RANK[RULE_MENU_ITEM.key]
|
|
16
|
+
}],
|
|
17
|
+
match: createQuickInsertMatcher(function (_ref2) {
|
|
18
|
+
var formatMessage = _ref2.formatMessage;
|
|
19
|
+
return {
|
|
20
|
+
description: formatMessage(messages.horizontalRuleDescription),
|
|
21
|
+
keywords: ['horizontal', 'rule', 'line', 'hr'],
|
|
22
|
+
shortcut: '---',
|
|
23
|
+
title: formatMessage(messages.horizontalRule)
|
|
24
|
+
};
|
|
25
|
+
}),
|
|
26
|
+
component: function component() {
|
|
27
|
+
return /*#__PURE__*/React.createElement(RuleQuickInsertMenuItem, {
|
|
28
|
+
api: api
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}];
|
|
32
|
+
};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
import type { UiControlRegistryPlugin } from '@atlaskit/editor-plugin-ui-control-registry';
|
|
3
4
|
import type { insertHorizontalRule } from './pm-plugins/commands';
|
|
4
|
-
type RulePluginDependencies = [
|
|
5
|
+
type RulePluginDependencies = [
|
|
6
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
7
|
+
OptionalPlugin<UiControlRegistryPlugin>
|
|
8
|
+
];
|
|
5
9
|
export type RulePlugin = NextEditorPlugin<'rule', {
|
|
6
10
|
actions: {
|
|
7
11
|
insertHorizontalRule: ReturnType<typeof insertHorizontalRule>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { RulePlugin } from '../../rulePluginType';
|
|
4
|
+
export declare const RuleQuickInsertMenuItem: ({ api, }: {
|
|
5
|
+
api: ExtractInjectionAPI<RulePlugin> | undefined;
|
|
6
|
+
}) => React.JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { RegisterMenuItem } from '@atlaskit/editor-ui-control-model/types';
|
|
3
|
+
import type { RulePlugin } from '../../rulePluginType';
|
|
4
|
+
export declare const getRuleQuickInsertComponents: ({ api, }: {
|
|
5
|
+
api: ExtractInjectionAPI<RulePlugin> | undefined;
|
|
6
|
+
}) => RegisterMenuItem[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-rule",
|
|
3
|
-
"version": "15.0.
|
|
3
|
+
"version": "15.0.1",
|
|
4
4
|
"description": "Rule plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -21,13 +21,16 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@atlaskit/adf-schema": "^56.7.0",
|
|
23
23
|
"@atlaskit/editor-plugin-analytics": "^15.0.0",
|
|
24
|
+
"@atlaskit/editor-plugin-ui-control-registry": "^9.0.0",
|
|
24
25
|
"@atlaskit/editor-prosemirror": "^8.0.0",
|
|
26
|
+
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
25
27
|
"@atlaskit/platform-feature-flags": "^2.1.0",
|
|
26
28
|
"@atlaskit/prosemirror-input-rules": "^4.0.0",
|
|
27
|
-
"@babel/runtime": "^7.0.0"
|
|
29
|
+
"@babel/runtime": "^7.0.0",
|
|
30
|
+
"react-intl": "^7.0.0"
|
|
28
31
|
},
|
|
29
32
|
"peerDependencies": {
|
|
30
|
-
"@atlaskit/editor-common": "^119.
|
|
33
|
+
"@atlaskit/editor-common": "^119.1.0",
|
|
31
34
|
"react": "^18.2.0 || ^19.2.0",
|
|
32
35
|
"react-dom": "^18.2.0 || ^19.2.0"
|
|
33
36
|
},
|