@atlaskit/editor-plugin-rule 8.0.0 → 8.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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # @atlaskit/editor-plugin-rule
2
2
 
3
+ ## 8.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`fa146e17e08d6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fa146e17e08d6) -
8
+ Update README.md and 0-intro.tsx
9
+
3
10
  ## 8.0.0
4
11
 
5
12
  ### Patch Changes
package/README.md CHANGED
@@ -1,10 +1,22 @@
1
- # Editor plugin rule
1
+ # Editor Plugin Rule
2
2
 
3
3
  Rule plugin for @atlaskit/editor-core
4
4
 
5
5
  **Note:** This component is designed for internal Atlassian development.
6
6
  External contributors will be able to use this component but will not be able to submit issues.
7
7
 
8
+ ## Overview
9
+
10
+ The Rule plugin provides horizontal rule (divider) insertion capabilities for the Atlassian Editor. It enables users to insert horizontal rules within documents through multiple input methods including keyboard shortcuts, quick insert, and programmatic actions.
11
+
12
+ ## Key features
13
+
14
+ - **Horizontal rule insertion** - Insert horizontal dividers into editor content
15
+ - **Input rule support** - Use keyboard shortcut `---` to quickly insert a rule
16
+ - **Quick insert integration** - Access horizontal rule from the quick insert menu
17
+ - **Action API** - Programmatic insertion through `insertHorizontalRule` action
18
+ - **Analytics tracking** - Track horizontal rule insertion events for analytics
19
+
8
20
  ## Install
9
21
  ---
10
22
  - **Install** - *yarn add @atlaskit/editor-plugin-rule*
@@ -25,6 +37,7 @@ Please see [Atlaskit - Editor plugin rule](https://atlaskit.atlassian.com/packag
25
37
  ## Support
26
38
  ---
27
39
  For internal Atlassian, visit the slack channel [#help-editor](https://atlassian.slack.com/archives/CFG3PSQ9E) for support or visit [go/editor-help](https://go/editor-help) to submit a bug.
40
+
28
41
  ## License
29
42
  ---
30
- Please see [Atlassian Frontend - License](https://hello.atlassian.net/wiki/spaces/AF/pages/2589099144/Documentation#License) for more licensing information.
43
+ Please see [Atlassian Frontend - License](https://hello.atlassian.net/wiki/spaces/AF/pages/2589099144/Documentation#License) for more licensing information.
@@ -11,6 +11,7 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
11
11
  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
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
15
  var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
15
16
  var createHorizontalRule = exports.createHorizontalRule = function createHorizontalRule(state, start, end, inputMethod, editorAnalyticsAPI) {
16
17
  if (!state.selection.empty) {
@@ -28,12 +29,13 @@ var createHorizontalRule = exports.createHorizontalRule = function createHorizon
28
29
  if (!tr) {
29
30
  tr = state.tr.replaceRange(start, end, new _model.Slice(_model.Fragment.from(state.schema.nodes.rule.createChecked()), 0, 0));
30
31
  }
32
+ var resolvedInputMethod = (0, _platformFeatureFlags.fg)('platform_editor_element_browser_analytic') ? inputMethod : _analytics.INPUT_METHOD.QUICK_INSERT;
31
33
  editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
32
34
  action: _analytics.ACTION.INSERTED,
33
35
  actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
34
36
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.DIVIDER,
35
37
  attributes: {
36
- inputMethod: inputMethod
38
+ inputMethod: resolvedInputMethod
37
39
  },
38
40
  eventType: _analytics.EVENT_TYPE.TRACK
39
41
  })(tr);
@@ -63,7 +63,7 @@ var rulePlugin = exports.rulePlugin = function rulePlugin(_ref) {
63
63
  icon: function icon() {
64
64
  return /*#__PURE__*/_react.default.createElement(_quickInsert.IconDivider, null);
65
65
  },
66
- action: function action(insert, state) {
66
+ action: function action(insert, state, source) {
67
67
  var _api$analytics4;
68
68
  var tr = insert(state.schema.nodes.rule.createChecked());
69
69
  api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 || _api$analytics4.actions.attachAnalyticsEvent({
@@ -71,7 +71,7 @@ var rulePlugin = exports.rulePlugin = function rulePlugin(_ref) {
71
71
  actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
72
72
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.DIVIDER,
73
73
  attributes: {
74
- inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
74
+ inputMethod: source !== null && source !== void 0 ? source : _analytics.INPUT_METHOD.QUICK_INSERT
75
75
  },
76
76
  eventType: _analytics.EVENT_TYPE.TRACK
77
77
  })(tr);
@@ -4,6 +4,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
4
  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
+ import { fg } from '@atlaskit/platform-feature-flags';
7
8
  import { createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
8
9
  export const createHorizontalRule = (state, start, end, inputMethod, editorAnalyticsAPI) => {
9
10
  if (!state.selection.empty) {
@@ -23,12 +24,13 @@ export const createHorizontalRule = (state, start, end, inputMethod, editorAnaly
23
24
  if (!tr) {
24
25
  tr = state.tr.replaceRange(start, end, new Slice(Fragment.from(state.schema.nodes.rule.createChecked()), 0, 0));
25
26
  }
27
+ const resolvedInputMethod = fg('platform_editor_element_browser_analytic') ? inputMethod : INPUT_METHOD.QUICK_INSERT;
26
28
  editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
27
29
  action: ACTION.INSERTED,
28
30
  actionSubject: ACTION_SUBJECT.DOCUMENT,
29
31
  actionSubjectId: ACTION_SUBJECT_ID.DIVIDER,
30
32
  attributes: {
31
- inputMethod
33
+ inputMethod: resolvedInputMethod
32
34
  },
33
35
  eventType: EVENT_TYPE.TRACK
34
36
  })(tr);
@@ -54,7 +54,7 @@ export const rulePlugin = ({
54
54
  priority: 1200,
55
55
  keyshortcut: '---',
56
56
  icon: () => /*#__PURE__*/React.createElement(IconDivider, null),
57
- action(insert, state) {
57
+ action(insert, state, source) {
58
58
  var _api$analytics4;
59
59
  const tr = insert(state.schema.nodes.rule.createChecked());
60
60
  api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions.attachAnalyticsEvent({
@@ -62,7 +62,7 @@ export const rulePlugin = ({
62
62
  actionSubject: ACTION_SUBJECT.DOCUMENT,
63
63
  actionSubjectId: ACTION_SUBJECT_ID.DIVIDER,
64
64
  attributes: {
65
- inputMethod: INPUT_METHOD.QUICK_INSERT
65
+ inputMethod: source !== null && source !== void 0 ? source : INPUT_METHOD.QUICK_INSERT
66
66
  },
67
67
  eventType: EVENT_TYPE.TRACK
68
68
  })(tr);
@@ -4,6 +4,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
4
  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
+ import { fg } from '@atlaskit/platform-feature-flags';
7
8
  import { createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
8
9
  export var createHorizontalRule = function createHorizontalRule(state, start, end, inputMethod, editorAnalyticsAPI) {
9
10
  if (!state.selection.empty) {
@@ -21,12 +22,13 @@ export var createHorizontalRule = function createHorizontalRule(state, start, en
21
22
  if (!tr) {
22
23
  tr = state.tr.replaceRange(start, end, new Slice(Fragment.from(state.schema.nodes.rule.createChecked()), 0, 0));
23
24
  }
25
+ var resolvedInputMethod = fg('platform_editor_element_browser_analytic') ? inputMethod : INPUT_METHOD.QUICK_INSERT;
24
26
  editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
25
27
  action: ACTION.INSERTED,
26
28
  actionSubject: ACTION_SUBJECT.DOCUMENT,
27
29
  actionSubjectId: ACTION_SUBJECT_ID.DIVIDER,
28
30
  attributes: {
29
- inputMethod: inputMethod
31
+ inputMethod: resolvedInputMethod
30
32
  },
31
33
  eventType: EVENT_TYPE.TRACK
32
34
  })(tr);
@@ -54,7 +54,7 @@ export var rulePlugin = function rulePlugin(_ref) {
54
54
  icon: function icon() {
55
55
  return /*#__PURE__*/React.createElement(IconDivider, null);
56
56
  },
57
- action: function action(insert, state) {
57
+ action: function action(insert, state, source) {
58
58
  var _api$analytics4;
59
59
  var tr = insert(state.schema.nodes.rule.createChecked());
60
60
  api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 || _api$analytics4.actions.attachAnalyticsEvent({
@@ -62,7 +62,7 @@ export var rulePlugin = function rulePlugin(_ref) {
62
62
  actionSubject: ACTION_SUBJECT.DOCUMENT,
63
63
  actionSubjectId: ACTION_SUBJECT_ID.DIVIDER,
64
64
  attributes: {
65
- inputMethod: INPUT_METHOD.QUICK_INSERT
65
+ inputMethod: source !== null && source !== void 0 ? source : INPUT_METHOD.QUICK_INSERT
66
66
  },
67
67
  eventType: EVENT_TYPE.TRACK
68
68
  })(tr);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-rule",
3
- "version": "8.0.0",
3
+ "version": "8.0.1",
4
4
  "description": "Rule plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -27,7 +27,7 @@
27
27
  "sideEffects": false,
28
28
  "atlaskit:src": "src/index.ts",
29
29
  "dependencies": {
30
- "@atlaskit/adf-schema": "^52.2.0",
30
+ "@atlaskit/adf-schema": "^52.4.0",
31
31
  "@atlaskit/editor-plugin-analytics": "^8.0.0",
32
32
  "@atlaskit/editor-prosemirror": "^7.3.0",
33
33
  "@atlaskit/platform-feature-flags": "^1.1.0",
@@ -35,7 +35,7 @@
35
35
  "@babel/runtime": "^7.0.0"
36
36
  },
37
37
  "peerDependencies": {
38
- "@atlaskit/editor-common": "^112.0.0",
38
+ "@atlaskit/editor-common": "^112.19.0",
39
39
  "react": "^18.2.0",
40
40
  "react-dom": "^18.2.0"
41
41
  },
@@ -78,6 +78,9 @@
78
78
  }
79
79
  },
80
80
  "platform-feature-flags": {
81
+ "platform_editor_element_browser_analytic": {
82
+ "type": "boolean"
83
+ },
81
84
  "platform_editor_adf_with_localid": {
82
85
  "type": "boolean"
83
86
  }