@atlaskit/editor-plugin-rule 20.0.0 → 21.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,45 @@
1
1
  # @atlaskit/editor-plugin-rule
2
2
 
3
+ ## 21.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`a034f535638cc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a034f535638cc) -
8
+ Add structured Quick Insert previews with localised title, description and attribution under
9
+ platform_editor_slash_command.
10
+
11
+ Exclude footer and category navigation actions from previews. Left-align attribution, use subtle
12
+ title and attribution text, and default description text.
13
+
14
+ Show text previews even without preview metadata, and reserve a fixed image area while images load
15
+ or when they fail. Keep previews within the viewport, flipping left when needed, with compact
16
+ panel dimensions and typography.
17
+
18
+ Replace baked panel screenshots with image-only assets. Remove image fields from text-only legacy
19
+ previews while preserving their attribution.
20
+
21
+ Let extension providers own their preview images and attribution. Pass preview metadata through
22
+ the Company Hub manifest factory and remove Editor's fallback preview registry.
23
+
24
+ Localize provider attribution names and display Confluence and Jira product icons instead of the
25
+ attribution prefix when an icon is present. Allow the Dropbox manifest to receive the host's
26
+ message formatter.
27
+
28
+ - Updated dependencies
29
+
30
+ ## 21.0.0
31
+
32
+ ### Minor Changes
33
+
34
+ - [`5c5d7a5bbff74`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5c5d7a5bbff74) -
35
+ Cleanup `feature_gate` `platform_editor_element_browser_analytic`. Insert analytics permanently
36
+ report the caller's actual input method rather than always attributing the insertion to
37
+ `quickInsert`.
38
+
39
+ ### Patch Changes
40
+
41
+ - Updated dependencies
42
+
3
43
  ## 20.0.0
4
44
 
5
45
  ### Patch Changes
@@ -11,7 +11,6 @@ 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 _fg = require("@atlaskit/platform-feature-flags/fg");
15
14
  var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
16
15
  var createHorizontalRule = exports.createHorizontalRule = function createHorizontalRule(state, start, end, inputMethod, editorAnalyticsAPI) {
17
16
  if (!state.selection.empty) {
@@ -29,13 +28,12 @@ var createHorizontalRule = exports.createHorizontalRule = function createHorizon
29
28
  if (!tr) {
30
29
  tr = state.tr.replaceRange(start, end, new _model.Slice(_model.Fragment.from(state.schema.nodes.rule.createChecked()), 0, 0));
31
30
  }
32
- var resolvedInputMethod = (0, _fg.fg)('platform_editor_element_browser_analytic') ? inputMethod : _analytics.INPUT_METHOD.QUICK_INSERT;
33
31
  editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
34
32
  action: _analytics.ACTION.INSERTED,
35
33
  actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
36
34
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.DIVIDER,
37
35
  attributes: {
38
- inputMethod: resolvedInputMethod
36
+ inputMethod: inputMethod
39
37
  },
40
38
  eventType: _analytics.EVENT_TYPE.TRACK
41
39
  })(tr);
@@ -11,6 +11,7 @@ var _reactIntl = require("react-intl");
11
11
  var _analytics = require("@atlaskit/editor-common/analytics");
12
12
  var _messages = require("@atlaskit/editor-common/messages");
13
13
  var _menuItem = require("@atlaskit/editor-common/quick-insert/menu-item");
14
+ var _messages2 = require("@atlaskit/editor-common/quick-insert/messages");
14
15
  var _minus = _interopRequireDefault(require("@atlaskit/icon/core/minus"));
15
16
  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); }
16
17
  var RuleQuickInsertMenuItem = exports.RuleQuickInsertMenuItem = function RuleQuickInsertMenuItem(_ref) {
@@ -18,6 +19,14 @@ var RuleQuickInsertMenuItem = exports.RuleQuickInsertMenuItem = function RuleQui
18
19
  previewImageUrls = _ref.previewImageUrls;
19
20
  var _useIntl = (0, _reactIntl.useIntl)(),
20
21
  formatMessage = _useIntl.formatMessage;
22
+ var preview = (0, _react.useMemo)(function () {
23
+ return previewImageUrls ? {
24
+ image: previewImageUrls,
25
+ attribution: {
26
+ name: formatMessage(_messages2.messages.previewAttributionAtlassian)
27
+ }
28
+ } : undefined;
29
+ }, [formatMessage, previewImageUrls]);
21
30
  var onSelect = (0, _react.useCallback)(function (_ref2) {
22
31
  var _api$analytics;
23
32
  var editorView = _ref2.editorView,
@@ -36,11 +45,12 @@ var RuleQuickInsertMenuItem = exports.RuleQuickInsertMenuItem = function RuleQui
36
45
  return tr;
37
46
  }, [api]);
38
47
  return /*#__PURE__*/_react.default.createElement(_menuItem.QuickInsertMenuItem, {
48
+ description: formatMessage(_messages.toolbarInsertBlockMessages.horizontalRuleDescription),
39
49
  iconBefore: /*#__PURE__*/_react.default.createElement(_minus.default, {
40
50
  label: ""
41
51
  }),
42
52
  onSelect: onSelect,
43
- previewImageUrls: previewImageUrls,
53
+ preview: preview,
44
54
  shortcut: "---",
45
55
  title: formatMessage(_messages.toolbarInsertBlockMessages.horizontalRule)
46
56
  });
@@ -12,8 +12,8 @@ var _keys = require("@atlaskit/editor-common/quick-insert/keys");
12
12
  var _rank = require("@atlaskit/editor-common/quick-insert/rank");
13
13
  var _RuleQuickInsertMenuItem = require("./RuleQuickInsertMenuItem");
14
14
  var previewImageUrls = {
15
- light: 'https://dam-cdn.atl.orangelogic.com/AssetLink/p53x1j2j1855123gdr8fw4jri2f6mn1h.png',
16
- dark: 'https://dam-cdn.atl.orangelogic.com/AssetLink/i2o73i23qw321aj6i5r14wtvfsyqg784.png'
15
+ light: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVL8.png',
16
+ dark: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVK1.png'
17
17
  };
18
18
  var getRuleQuickInsertComponents = exports.getRuleQuickInsertComponents = function getRuleQuickInsertComponents(_ref) {
19
19
  var api = _ref.api;
@@ -4,7 +4,6 @@ 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/fg';
8
7
  import { createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
9
8
  export const createHorizontalRule = (state, start, end, inputMethod, editorAnalyticsAPI) => {
10
9
  if (!state.selection.empty) {
@@ -24,13 +23,12 @@ export const createHorizontalRule = (state, start, end, inputMethod, editorAnaly
24
23
  if (!tr) {
25
24
  tr = state.tr.replaceRange(start, end, new Slice(Fragment.from(state.schema.nodes.rule.createChecked()), 0, 0));
26
25
  }
27
- const resolvedInputMethod = fg('platform_editor_element_browser_analytic') ? inputMethod : INPUT_METHOD.QUICK_INSERT;
28
26
  editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
29
27
  action: ACTION.INSERTED,
30
28
  actionSubject: ACTION_SUBJECT.DOCUMENT,
31
29
  actionSubjectId: ACTION_SUBJECT_ID.DIVIDER,
32
30
  attributes: {
33
- inputMethod: resolvedInputMethod
31
+ inputMethod
34
32
  },
35
33
  eventType: EVENT_TYPE.TRACK
36
34
  })(tr);
@@ -1,8 +1,9 @@
1
- import React, { useCallback } from 'react';
1
+ import React, { useCallback, useMemo } from 'react';
2
2
  import { useIntl } from 'react-intl';
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
5
  import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
6
+ import { messages as quickInsertMessages } from '@atlaskit/editor-common/quick-insert/messages';
6
7
  import MinusIcon from '@atlaskit/icon/core/minus';
7
8
  export const RuleQuickInsertMenuItem = ({
8
9
  api,
@@ -11,6 +12,12 @@ export const RuleQuickInsertMenuItem = ({
11
12
  const {
12
13
  formatMessage
13
14
  } = useIntl();
15
+ const preview = useMemo(() => previewImageUrls ? {
16
+ image: previewImageUrls,
17
+ attribution: {
18
+ name: formatMessage(quickInsertMessages.previewAttributionAtlassian)
19
+ }
20
+ } : undefined, [formatMessage, previewImageUrls]);
14
21
  const onSelect = useCallback(({
15
22
  editorView,
16
23
  insert,
@@ -30,11 +37,12 @@ export const RuleQuickInsertMenuItem = ({
30
37
  return tr;
31
38
  }, [api]);
32
39
  return /*#__PURE__*/React.createElement(QuickInsertMenuItem, {
40
+ description: formatMessage(messages.horizontalRuleDescription),
33
41
  iconBefore: /*#__PURE__*/React.createElement(MinusIcon, {
34
42
  label: ""
35
43
  }),
36
44
  onSelect: onSelect,
37
- previewImageUrls: previewImageUrls,
45
+ preview: preview,
38
46
  shortcut: "---",
39
47
  title: formatMessage(messages.horizontalRule)
40
48
  });
@@ -5,8 +5,8 @@ import { RULE_MENU_ITEM, STRUCTURE_SECTION } from '@atlaskit/editor-common/quick
5
5
  import { STRUCTURE_SECTION_RANK } from '@atlaskit/editor-common/quick-insert/rank';
6
6
  import { RuleQuickInsertMenuItem } from './RuleQuickInsertMenuItem';
7
7
  const previewImageUrls = {
8
- light: 'https://dam-cdn.atl.orangelogic.com/AssetLink/p53x1j2j1855123gdr8fw4jri2f6mn1h.png',
9
- dark: 'https://dam-cdn.atl.orangelogic.com/AssetLink/i2o73i23qw321aj6i5r14wtvfsyqg784.png'
8
+ light: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVL8.png',
9
+ dark: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVK1.png'
10
10
  };
11
11
  export const getRuleQuickInsertComponents = ({
12
12
  api
@@ -4,7 +4,6 @@ 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/fg';
8
7
  import { createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
9
8
  export var createHorizontalRule = function createHorizontalRule(state, start, end, inputMethod, editorAnalyticsAPI) {
10
9
  if (!state.selection.empty) {
@@ -22,13 +21,12 @@ export var createHorizontalRule = function createHorizontalRule(state, start, en
22
21
  if (!tr) {
23
22
  tr = state.tr.replaceRange(start, end, new Slice(Fragment.from(state.schema.nodes.rule.createChecked()), 0, 0));
24
23
  }
25
- var resolvedInputMethod = fg('platform_editor_element_browser_analytic') ? inputMethod : INPUT_METHOD.QUICK_INSERT;
26
24
  editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
27
25
  action: ACTION.INSERTED,
28
26
  actionSubject: ACTION_SUBJECT.DOCUMENT,
29
27
  actionSubjectId: ACTION_SUBJECT_ID.DIVIDER,
30
28
  attributes: {
31
- inputMethod: resolvedInputMethod
29
+ inputMethod: inputMethod
32
30
  },
33
31
  eventType: EVENT_TYPE.TRACK
34
32
  })(tr);
@@ -1,14 +1,23 @@
1
- import React, { useCallback } from 'react';
1
+ import React, { useCallback, useMemo } from 'react';
2
2
  import { useIntl } from 'react-intl';
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
5
  import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
6
+ import { messages as quickInsertMessages } from '@atlaskit/editor-common/quick-insert/messages';
6
7
  import MinusIcon from '@atlaskit/icon/core/minus';
7
8
  export var RuleQuickInsertMenuItem = function RuleQuickInsertMenuItem(_ref) {
8
9
  var api = _ref.api,
9
10
  previewImageUrls = _ref.previewImageUrls;
10
11
  var _useIntl = useIntl(),
11
12
  formatMessage = _useIntl.formatMessage;
13
+ var preview = useMemo(function () {
14
+ return previewImageUrls ? {
15
+ image: previewImageUrls,
16
+ attribution: {
17
+ name: formatMessage(quickInsertMessages.previewAttributionAtlassian)
18
+ }
19
+ } : undefined;
20
+ }, [formatMessage, previewImageUrls]);
12
21
  var onSelect = useCallback(function (_ref2) {
13
22
  var _api$analytics;
14
23
  var editorView = _ref2.editorView,
@@ -27,11 +36,12 @@ export var RuleQuickInsertMenuItem = function RuleQuickInsertMenuItem(_ref) {
27
36
  return tr;
28
37
  }, [api]);
29
38
  return /*#__PURE__*/React.createElement(QuickInsertMenuItem, {
39
+ description: formatMessage(messages.horizontalRuleDescription),
30
40
  iconBefore: /*#__PURE__*/React.createElement(MinusIcon, {
31
41
  label: ""
32
42
  }),
33
43
  onSelect: onSelect,
34
- previewImageUrls: previewImageUrls,
44
+ preview: preview,
35
45
  shortcut: "---",
36
46
  title: formatMessage(messages.horizontalRule)
37
47
  });
@@ -5,8 +5,8 @@ import { RULE_MENU_ITEM, STRUCTURE_SECTION } from '@atlaskit/editor-common/quick
5
5
  import { STRUCTURE_SECTION_RANK } from '@atlaskit/editor-common/quick-insert/rank';
6
6
  import { RuleQuickInsertMenuItem } from './RuleQuickInsertMenuItem';
7
7
  var previewImageUrls = {
8
- light: 'https://dam-cdn.atl.orangelogic.com/AssetLink/p53x1j2j1855123gdr8fw4jri2f6mn1h.png',
9
- dark: 'https://dam-cdn.atl.orangelogic.com/AssetLink/i2o73i23qw321aj6i5r14wtvfsyqg784.png'
8
+ light: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVL8.png',
9
+ dark: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVK1.png'
10
10
  };
11
11
  export var getRuleQuickInsertComponents = function getRuleQuickInsertComponents(_ref) {
12
12
  var api = _ref.api;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-rule",
3
- "version": "20.0.0",
3
+ "version": "21.0.1",
4
4
  "description": "Rule plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -22,23 +22,23 @@
22
22
  "@atlaskit/adf-schema": "^57.6.0",
23
23
  "@atlaskit/button": "^25.4.0",
24
24
  "@atlaskit/css": "^1.1.0",
25
- "@atlaskit/editor-plugin-analytics": "^20.0.0",
26
- "@atlaskit/editor-plugin-floating-toolbar": "^22.0.0",
27
- "@atlaskit/editor-plugin-ui-control-registry": "^14.0.0",
25
+ "@atlaskit/editor-plugin-analytics": "^21.0.0",
26
+ "@atlaskit/editor-plugin-floating-toolbar": "^23.0.0",
27
+ "@atlaskit/editor-plugin-ui-control-registry": "^15.0.0",
28
28
  "@atlaskit/editor-prosemirror": "^9.0.0",
29
29
  "@atlaskit/editor-shared-styles": "^4.3.0",
30
- "@atlaskit/icon": "^37.7.0",
30
+ "@atlaskit/icon": "^38.0.0",
31
31
  "@atlaskit/platform-feature-experiments": "^0.3.0",
32
32
  "@atlaskit/platform-feature-flags": "^2.2.0",
33
33
  "@atlaskit/primitives": "^22.5.0",
34
34
  "@atlaskit/prosemirror-input-rules": "^4.1.0",
35
- "@atlaskit/tokens": "^19.0.0",
35
+ "@atlaskit/tokens": "^20.0.0",
36
36
  "@babel/runtime": "^7.0.0",
37
37
  "@compiled/react": "^1.0.2",
38
38
  "react-intl": "^7.0.0"
39
39
  },
40
40
  "peerDependencies": {
41
- "@atlaskit/editor-common": "^124.0.0",
41
+ "@atlaskit/editor-common": "^125.4.0",
42
42
  "react": "^18.2.0 || ^19.2.0",
43
43
  "react-dom": "^18.2.0 || ^19.2.0"
44
44
  },
@@ -48,9 +48,6 @@
48
48
  "react-dom": "^19.2.0"
49
49
  },
50
50
  "platform-feature-flags": {
51
- "platform_editor_element_browser_analytic": {
52
- "type": "boolean"
53
- },
54
51
  "platform_editor_adf_with_localid": {
55
52
  "type": "boolean"
56
53
  }