@atlaskit/editor-plugin-status 2.5.10 → 2.6.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/index.js +2 -2
  3. package/dist/cjs/{actions.js → pm-plugins/actions.js} +1 -1
  4. package/dist/cjs/pm-plugins/keymap.js +2 -2
  5. package/dist/cjs/pm-plugins/plugin.js +1 -1
  6. package/dist/cjs/statusPlugin.js +145 -0
  7. package/dist/cjs/types/index.js +5 -0
  8. package/dist/cjs/ui/ContentComponent.js +1 -1
  9. package/dist/cjs/ui/statusPicker.js +2 -2
  10. package/dist/es2019/index.js +1 -1
  11. package/dist/es2019/{actions.js → pm-plugins/actions.js} +1 -1
  12. package/dist/es2019/pm-plugins/keymap.js +2 -2
  13. package/dist/es2019/pm-plugins/plugin.js +1 -1
  14. package/dist/es2019/statusPlugin.js +135 -0
  15. package/dist/es2019/ui/ContentComponent.js +1 -1
  16. package/dist/es2019/ui/statusPicker.js +2 -2
  17. package/dist/esm/index.js +1 -1
  18. package/dist/esm/{actions.js → pm-plugins/actions.js} +1 -1
  19. package/dist/esm/pm-plugins/keymap.js +2 -2
  20. package/dist/esm/pm-plugins/plugin.js +1 -1
  21. package/dist/esm/statusPlugin.js +138 -0
  22. package/dist/esm/statusPluginType.js +1 -0
  23. package/dist/esm/types/index.js +1 -0
  24. package/dist/esm/ui/ContentComponent.js +1 -1
  25. package/dist/esm/ui/statusPicker.js +2 -2
  26. package/dist/types/index.d.ts +3 -3
  27. package/dist/types/{actions.d.ts → pm-plugins/actions.d.ts} +1 -1
  28. package/dist/types/{utils.d.ts → pm-plugins/utils.d.ts} +1 -1
  29. package/dist/types/statusPlugin.d.ts +2 -0
  30. package/dist/types/statusPluginType.d.ts +41 -0
  31. package/dist/{types-ts4.5/types.d.ts → types/types/index.d.ts} +1 -1
  32. package/dist/types/ui/ContentComponent.d.ts +1 -1
  33. package/dist/types-ts4.5/index.d.ts +3 -3
  34. package/dist/types-ts4.5/{actions.d.ts → pm-plugins/actions.d.ts} +1 -1
  35. package/dist/types-ts4.5/{utils.d.ts → pm-plugins/utils.d.ts} +1 -1
  36. package/dist/types-ts4.5/statusPlugin.d.ts +2 -0
  37. package/dist/types-ts4.5/statusPluginType.d.ts +41 -0
  38. package/dist/{types/types.d.ts → types-ts4.5/types/index.d.ts} +1 -1
  39. package/dist/types-ts4.5/ui/ContentComponent.d.ts +1 -1
  40. package/package.json +10 -3
  41. package/dist/cjs/plugin.js +0 -111
  42. package/dist/es2019/plugin.js +0 -100
  43. package/dist/esm/plugin.js +0 -104
  44. package/dist/types/plugin.d.ts +0 -19
  45. package/dist/types-ts4.5/plugin.d.ts +0 -21
  46. /package/dist/cjs/{utils.js → pm-plugins/utils.js} +0 -0
  47. /package/dist/cjs/{types.js → statusPluginType.js} +0 -0
  48. /package/dist/cjs/{analytics.js → ui/analytics.js} +0 -0
  49. /package/dist/es2019/{utils.js → pm-plugins/utils.js} +0 -0
  50. /package/dist/es2019/{types.js → statusPluginType.js} +0 -0
  51. /package/dist/{esm/types.js → es2019/types/index.js} +0 -0
  52. /package/dist/es2019/{analytics.js → ui/analytics.js} +0 -0
  53. /package/dist/esm/{utils.js → pm-plugins/utils.js} +0 -0
  54. /package/dist/esm/{analytics.js → ui/analytics.js} +0 -0
  55. /package/dist/types/{analytics.d.ts → ui/analytics.d.ts} +0 -0
  56. /package/dist/types-ts4.5/{analytics.d.ts → ui/analytics.d.ts} +0 -0
@@ -24,8 +24,8 @@ import { fg } from '@atlaskit/platform-feature-flags';
24
24
  import { StatusPicker as AkStatusPicker } from '@atlaskit/status/picker';
25
25
  import { N0 } from '@atlaskit/theme/colors';
26
26
  import { borderRadius } from '@atlaskit/theme/constants';
27
- import { DEFAULT_STATUS } from '../actions';
28
- import { analyticsState, createStatusAnalyticsAndFire } from '../analytics';
27
+ import { DEFAULT_STATUS } from '../pm-plugins/actions';
28
+ import { analyticsState, createStatusAnalyticsAndFire } from './analytics';
29
29
  var PopupWithListeners = withOuterListeners(Popup);
30
30
  export var InputMethod = /*#__PURE__*/function (InputMethod) {
31
31
  InputMethod["blur"] = "blur";
@@ -1,4 +1,4 @@
1
- export { statusPlugin } from './plugin';
2
- export type { StatusPlugin } from './plugin';
1
+ export { statusPlugin } from './statusPlugin';
2
+ export type { StatusPlugin } from './statusPluginType';
3
3
  export type { StatusState, StatusType, StatusPluginOptions, ClosingPayload } from './types';
4
- export type { UpdateStatus } from './actions';
4
+ export type { UpdateStatus } from './pm-plugins/actions';
@@ -5,7 +5,7 @@ import { type Mark } from '@atlaskit/editor-prosemirror/model';
5
5
  import type { Node } from '@atlaskit/editor-prosemirror/model';
6
6
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
7
7
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
8
- import type { ClosingPayload, StatusType } from './types';
8
+ import type { ClosingPayload, StatusType } from '../types';
9
9
  export declare const DEFAULT_STATUS: StatusType;
10
10
  export declare const verifyAndInsertStatus: (statusNode: Node, tr: Transaction, annotationMarks?: Mark[] | undefined) => Transaction;
11
11
  export declare const createStatus: (tr: Transaction) => Transaction;
@@ -1,5 +1,5 @@
1
1
  import type { Selection, Transaction } from '@atlaskit/editor-prosemirror/state';
2
- import type { StatusType } from './types';
2
+ import type { StatusType } from '../types';
3
3
  export declare const mayGetStatusAtSelection: (selection: Selection) => StatusType | null;
4
4
  export declare const isEmptyStatus: (node: StatusType) => boolean;
5
5
  export declare const setNodeSelectionNearPos: (tr: Transaction, pos: number) => Transaction;
@@ -0,0 +1,2 @@
1
+ import type { StatusPlugin } from './statusPluginType';
2
+ export declare const statusPlugin: StatusPlugin;
@@ -0,0 +1,41 @@
1
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
+ import type { NextEditorPlugin, OptionalPlugin, Command } from '@atlaskit/editor-common/types';
3
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
+ import type { commitStatusPicker, insertStatus, removeStatus, UpdateStatus } from './pm-plugins/actions';
5
+ import type { StatusPluginOptions, StatusState } from './types';
6
+ type DummyAnnotationPlugin = NextEditorPlugin<'annotation', {
7
+ actions: {
8
+ setInlineCommentDraftState: (isDraft: boolean, inputMethod: INPUT_METHOD) => Command;
9
+ };
10
+ sharedState: {
11
+ annotations: Record<string, boolean>;
12
+ isVisible: boolean;
13
+ bookmark: boolean;
14
+ mouseData: {
15
+ isSelecting: boolean;
16
+ };
17
+ };
18
+ }>;
19
+ type DummyEditorViewModePlugin = NextEditorPlugin<'editorViewMode', {
20
+ sharedState: {
21
+ mode: 'view' | 'edit';
22
+ };
23
+ }>;
24
+ export type StatusPlugin = NextEditorPlugin<'status', {
25
+ dependencies: [
26
+ OptionalPlugin<AnalyticsPlugin>,
27
+ OptionalPlugin<DummyAnnotationPlugin>,
28
+ OptionalPlugin<DummyEditorViewModePlugin>
29
+ ];
30
+ pluginConfiguration: StatusPluginOptions | undefined;
31
+ actions: {
32
+ commitStatusPicker: typeof commitStatusPicker;
33
+ updateStatus: UpdateStatus;
34
+ };
35
+ commands: {
36
+ removeStatus: typeof removeStatus;
37
+ insertStatus: ReturnType<typeof insertStatus>;
38
+ };
39
+ sharedState: StatusState | undefined;
40
+ }>;
41
+ export {};
@@ -1,5 +1,5 @@
1
1
  import type { Color as ColorType } from '@atlaskit/status/element';
2
- import type { closingMethods } from './ui/statusPicker';
2
+ import type { closingMethods } from '../ui/statusPicker';
3
3
  export type StatusType = {
4
4
  color: ColorType;
5
5
  text: string;
@@ -2,7 +2,7 @@
2
2
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { DomAtPos } from '@atlaskit/editor-prosemirror/utils';
4
4
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
- import type { StatusPlugin } from '../plugin';
5
+ import type { StatusPlugin } from '../statusPluginType';
6
6
  interface ContentComponentProps {
7
7
  api: ExtractInjectionAPI<StatusPlugin> | undefined;
8
8
  popupsMountPoint?: HTMLElement;
@@ -1,4 +1,4 @@
1
- export { statusPlugin } from './plugin';
2
- export type { StatusPlugin } from './plugin';
1
+ export { statusPlugin } from './statusPlugin';
2
+ export type { StatusPlugin } from './statusPluginType';
3
3
  export type { StatusState, StatusType, StatusPluginOptions, ClosingPayload } from './types';
4
- export type { UpdateStatus } from './actions';
4
+ export type { UpdateStatus } from './pm-plugins/actions';
@@ -5,7 +5,7 @@ import { type Mark } from '@atlaskit/editor-prosemirror/model';
5
5
  import type { Node } from '@atlaskit/editor-prosemirror/model';
6
6
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
7
7
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
8
- import type { ClosingPayload, StatusType } from './types';
8
+ import type { ClosingPayload, StatusType } from '../types';
9
9
  export declare const DEFAULT_STATUS: StatusType;
10
10
  export declare const verifyAndInsertStatus: (statusNode: Node, tr: Transaction, annotationMarks?: Mark[] | undefined) => Transaction;
11
11
  export declare const createStatus: (tr: Transaction) => Transaction;
@@ -1,5 +1,5 @@
1
1
  import type { Selection, Transaction } from '@atlaskit/editor-prosemirror/state';
2
- import type { StatusType } from './types';
2
+ import type { StatusType } from '../types';
3
3
  export declare const mayGetStatusAtSelection: (selection: Selection) => StatusType | null;
4
4
  export declare const isEmptyStatus: (node: StatusType) => boolean;
5
5
  export declare const setNodeSelectionNearPos: (tr: Transaction, pos: number) => Transaction;
@@ -0,0 +1,2 @@
1
+ import type { StatusPlugin } from './statusPluginType';
2
+ export declare const statusPlugin: StatusPlugin;
@@ -0,0 +1,41 @@
1
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
+ import type { NextEditorPlugin, OptionalPlugin, Command } from '@atlaskit/editor-common/types';
3
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
+ import type { commitStatusPicker, insertStatus, removeStatus, UpdateStatus } from './pm-plugins/actions';
5
+ import type { StatusPluginOptions, StatusState } from './types';
6
+ type DummyAnnotationPlugin = NextEditorPlugin<'annotation', {
7
+ actions: {
8
+ setInlineCommentDraftState: (isDraft: boolean, inputMethod: INPUT_METHOD) => Command;
9
+ };
10
+ sharedState: {
11
+ annotations: Record<string, boolean>;
12
+ isVisible: boolean;
13
+ bookmark: boolean;
14
+ mouseData: {
15
+ isSelecting: boolean;
16
+ };
17
+ };
18
+ }>;
19
+ type DummyEditorViewModePlugin = NextEditorPlugin<'editorViewMode', {
20
+ sharedState: {
21
+ mode: 'view' | 'edit';
22
+ };
23
+ }>;
24
+ export type StatusPlugin = NextEditorPlugin<'status', {
25
+ dependencies: [
26
+ OptionalPlugin<AnalyticsPlugin>,
27
+ OptionalPlugin<DummyAnnotationPlugin>,
28
+ OptionalPlugin<DummyEditorViewModePlugin>
29
+ ];
30
+ pluginConfiguration: StatusPluginOptions | undefined;
31
+ actions: {
32
+ commitStatusPicker: typeof commitStatusPicker;
33
+ updateStatus: UpdateStatus;
34
+ };
35
+ commands: {
36
+ removeStatus: typeof removeStatus;
37
+ insertStatus: ReturnType<typeof insertStatus>;
38
+ };
39
+ sharedState: StatusState | undefined;
40
+ }>;
41
+ export {};
@@ -1,5 +1,5 @@
1
1
  import type { Color as ColorType } from '@atlaskit/status/element';
2
- import type { closingMethods } from './ui/statusPicker';
2
+ import type { closingMethods } from '../ui/statusPicker';
3
3
  export type StatusType = {
4
4
  color: ColorType;
5
5
  text: string;
@@ -2,7 +2,7 @@
2
2
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { DomAtPos } from '@atlaskit/editor-prosemirror/utils';
4
4
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
- import type { StatusPlugin } from '../plugin';
5
+ import type { StatusPlugin } from '../statusPluginType';
6
6
  interface ContentComponentProps {
7
7
  api: ExtractInjectionAPI<StatusPlugin> | undefined;
8
8
  popupsMountPoint?: HTMLElement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-status",
3
- "version": "2.5.10",
3
+ "version": "2.6.1",
4
4
  "description": "Status plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,11 +32,12 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^46.1.0",
35
- "@atlaskit/analytics-next": "^10.1.0",
36
- "@atlaskit/editor-common": "^96.0.0",
35
+ "@atlaskit/analytics-next": "^10.2.0",
36
+ "@atlaskit/editor-common": "^96.3.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
38
38
  "@atlaskit/editor-prosemirror": "6.2.1",
39
39
  "@atlaskit/editor-shared-styles": "^3.2.0",
40
+ "@atlaskit/icon": "^23.1.0",
40
41
  "@atlaskit/platform-feature-flags": "^0.3.0",
41
42
  "@atlaskit/status": "^1.8.0",
42
43
  "@atlaskit/theme": "^14.0.0",
@@ -59,6 +60,9 @@
59
60
  },
60
61
  "techstack": {
61
62
  "@atlassian/frontend": {
63
+ "code-structure": [
64
+ "editor-plugin"
65
+ ],
62
66
  "import-structure": [
63
67
  "atlassian-conventions"
64
68
  ],
@@ -99,6 +103,9 @@
99
103
  },
100
104
  "platform_editor_replace_finddomnode_in_common": {
101
105
  "type": "boolean"
106
+ },
107
+ "platform_inline_node_as_valid_annotation_selection": {
108
+ "type": "boolean"
102
109
  }
103
110
  }
104
111
  }
@@ -1,111 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.statusPlugin = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _adfSchema = require("@atlaskit/adf-schema");
10
- var _analytics = require("@atlaskit/editor-common/analytics");
11
- var _messages = require("@atlaskit/editor-common/messages");
12
- var _quickInsert = require("@atlaskit/editor-common/quick-insert");
13
- var _actions = require("./actions");
14
- var _keymap = require("./pm-plugins/keymap");
15
- var _plugin = _interopRequireDefault(require("./pm-plugins/plugin"));
16
- var _pluginKey = require("./pm-plugins/plugin-key");
17
- var _ContentComponent = require("./ui/ContentComponent");
18
- var baseStatusPlugin = function baseStatusPlugin(_ref) {
19
- var _api$analytics, _api$analytics2;
20
- var options = _ref.config,
21
- api = _ref.api;
22
- return {
23
- name: 'status',
24
- nodes: function nodes() {
25
- return [{
26
- name: 'status',
27
- node: _adfSchema.status
28
- }];
29
- },
30
- pmPlugins: function pmPlugins() {
31
- return [{
32
- name: 'status',
33
- plugin: function plugin(pmPluginFactoryParams) {
34
- return (0, _plugin.default)(pmPluginFactoryParams, options);
35
- }
36
- }, {
37
- name: 'statusKeymap',
38
- plugin: _keymap.keymapPlugin
39
- }];
40
- },
41
- actions: {
42
- commitStatusPicker: _actions.commitStatusPicker,
43
- updateStatus: (0, _actions.updateStatusWithAnalytics)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
44
- },
45
- commands: {
46
- removeStatus: _actions.removeStatus,
47
- insertStatus: (0, _actions.insertStatus)(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)
48
- },
49
- getSharedState: function getSharedState(state) {
50
- if (!state) {
51
- return undefined;
52
- }
53
- var pluginState = _pluginKey.pluginKey.getState(state);
54
- return pluginState ? {
55
- isNew: pluginState.isNew,
56
- showStatusPickerAt: pluginState.showStatusPickerAt,
57
- focusStatusInput: pluginState.focusStatusInput
58
- } : undefined;
59
- },
60
- contentComponent: function contentComponent(_ref2) {
61
- var editorView = _ref2.editorView,
62
- popupsMountPoint = _ref2.popupsMountPoint,
63
- popupsBoundariesElement = _ref2.popupsBoundariesElement,
64
- popupsScrollableElement = _ref2.popupsScrollableElement;
65
- var domAtPos = editorView.domAtPos.bind(editorView);
66
- return /*#__PURE__*/_react.default.createElement(_ContentComponent.ContentComponent, {
67
- domAtPos: domAtPos,
68
- api: api,
69
- editorView: editorView,
70
- popupsMountPoint: popupsMountPoint,
71
- popupsBoundariesElement: popupsBoundariesElement,
72
- popupsScrollableElement: popupsScrollableElement
73
- });
74
- }
75
- };
76
- };
77
- var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, options, api) {
78
- if ((options === null || options === void 0 ? void 0 : options.menuDisabled) === true) {
79
- return plugin;
80
- }
81
- plugin.pluginsOptions = {
82
- quickInsert: function quickInsert(_ref3) {
83
- var formatMessage = _ref3.formatMessage;
84
- return [{
85
- id: 'status',
86
- title: formatMessage(_messages.toolbarInsertBlockMessages.status),
87
- description: formatMessage(_messages.toolbarInsertBlockMessages.statusDescription),
88
- priority: 700,
89
- keywords: ['lozenge'],
90
- icon: function icon() {
91
- return /*#__PURE__*/_react.default.createElement(_quickInsert.IconStatus, null);
92
- },
93
- action: function action(insert, state) {
94
- var _insertStatus, _api$analytics3;
95
- return (_insertStatus = (0, _actions.insertStatus)(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions)(_analytics.INPUT_METHOD.QUICK_INSERT)({
96
- tr: state.tr
97
- })) !== null && _insertStatus !== void 0 ? _insertStatus : state.tr;
98
- }
99
- }];
100
- }
101
- };
102
- return plugin;
103
- };
104
- var statusPlugin = exports.statusPlugin = function statusPlugin(_ref4) {
105
- var options = _ref4.config,
106
- api = _ref4.api;
107
- return decorateWithPluginOptions(baseStatusPlugin({
108
- config: options,
109
- api: api
110
- }), options, api);
111
- };
@@ -1,100 +0,0 @@
1
- import React from 'react';
2
- import { status } from '@atlaskit/adf-schema';
3
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
5
- import { IconStatus } from '@atlaskit/editor-common/quick-insert';
6
- import { commitStatusPicker, insertStatus, removeStatus, updateStatusWithAnalytics } from './actions';
7
- import { keymapPlugin } from './pm-plugins/keymap';
8
- import createStatusPlugin from './pm-plugins/plugin';
9
- import { pluginKey } from './pm-plugins/plugin-key';
10
- import { ContentComponent } from './ui/ContentComponent';
11
- const baseStatusPlugin = ({
12
- config: options,
13
- api
14
- }) => {
15
- var _api$analytics, _api$analytics2;
16
- return {
17
- name: 'status',
18
- nodes() {
19
- return [{
20
- name: 'status',
21
- node: status
22
- }];
23
- },
24
- pmPlugins() {
25
- return [{
26
- name: 'status',
27
- plugin: pmPluginFactoryParams => createStatusPlugin(pmPluginFactoryParams, options)
28
- }, {
29
- name: 'statusKeymap',
30
- plugin: keymapPlugin
31
- }];
32
- },
33
- actions: {
34
- commitStatusPicker,
35
- updateStatus: updateStatusWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
36
- },
37
- commands: {
38
- removeStatus,
39
- insertStatus: insertStatus(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)
40
- },
41
- getSharedState(state) {
42
- if (!state) {
43
- return undefined;
44
- }
45
- const pluginState = pluginKey.getState(state);
46
- return pluginState ? {
47
- isNew: pluginState.isNew,
48
- showStatusPickerAt: pluginState.showStatusPickerAt,
49
- focusStatusInput: pluginState.focusStatusInput
50
- } : undefined;
51
- },
52
- contentComponent({
53
- editorView,
54
- popupsMountPoint,
55
- popupsBoundariesElement,
56
- popupsScrollableElement
57
- }) {
58
- const domAtPos = editorView.domAtPos.bind(editorView);
59
- return /*#__PURE__*/React.createElement(ContentComponent, {
60
- domAtPos: domAtPos,
61
- api: api,
62
- editorView: editorView,
63
- popupsMountPoint: popupsMountPoint,
64
- popupsBoundariesElement: popupsBoundariesElement,
65
- popupsScrollableElement: popupsScrollableElement
66
- });
67
- }
68
- };
69
- };
70
- const decorateWithPluginOptions = (plugin, options, api) => {
71
- if ((options === null || options === void 0 ? void 0 : options.menuDisabled) === true) {
72
- return plugin;
73
- }
74
- plugin.pluginsOptions = {
75
- quickInsert: ({
76
- formatMessage
77
- }) => [{
78
- id: 'status',
79
- title: formatMessage(messages.status),
80
- description: formatMessage(messages.statusDescription),
81
- priority: 700,
82
- keywords: ['lozenge'],
83
- icon: () => /*#__PURE__*/React.createElement(IconStatus, null),
84
- action(insert, state) {
85
- var _insertStatus, _api$analytics3;
86
- return (_insertStatus = insertStatus(api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions)(INPUT_METHOD.QUICK_INSERT)({
87
- tr: state.tr
88
- })) !== null && _insertStatus !== void 0 ? _insertStatus : state.tr;
89
- }
90
- }]
91
- };
92
- return plugin;
93
- };
94
- export const statusPlugin = ({
95
- config: options,
96
- api
97
- }) => decorateWithPluginOptions(baseStatusPlugin({
98
- config: options,
99
- api
100
- }), options, api);
@@ -1,104 +0,0 @@
1
- import React from 'react';
2
- import { status } from '@atlaskit/adf-schema';
3
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
5
- import { IconStatus } from '@atlaskit/editor-common/quick-insert';
6
- import { commitStatusPicker, insertStatus, removeStatus, updateStatusWithAnalytics } from './actions';
7
- import { keymapPlugin } from './pm-plugins/keymap';
8
- import createStatusPlugin from './pm-plugins/plugin';
9
- import { pluginKey } from './pm-plugins/plugin-key';
10
- import { ContentComponent } from './ui/ContentComponent';
11
- var baseStatusPlugin = function baseStatusPlugin(_ref) {
12
- var _api$analytics, _api$analytics2;
13
- var options = _ref.config,
14
- api = _ref.api;
15
- return {
16
- name: 'status',
17
- nodes: function nodes() {
18
- return [{
19
- name: 'status',
20
- node: status
21
- }];
22
- },
23
- pmPlugins: function pmPlugins() {
24
- return [{
25
- name: 'status',
26
- plugin: function plugin(pmPluginFactoryParams) {
27
- return createStatusPlugin(pmPluginFactoryParams, options);
28
- }
29
- }, {
30
- name: 'statusKeymap',
31
- plugin: keymapPlugin
32
- }];
33
- },
34
- actions: {
35
- commitStatusPicker: commitStatusPicker,
36
- updateStatus: updateStatusWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
37
- },
38
- commands: {
39
- removeStatus: removeStatus,
40
- insertStatus: insertStatus(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)
41
- },
42
- getSharedState: function getSharedState(state) {
43
- if (!state) {
44
- return undefined;
45
- }
46
- var pluginState = pluginKey.getState(state);
47
- return pluginState ? {
48
- isNew: pluginState.isNew,
49
- showStatusPickerAt: pluginState.showStatusPickerAt,
50
- focusStatusInput: pluginState.focusStatusInput
51
- } : undefined;
52
- },
53
- contentComponent: function contentComponent(_ref2) {
54
- var editorView = _ref2.editorView,
55
- popupsMountPoint = _ref2.popupsMountPoint,
56
- popupsBoundariesElement = _ref2.popupsBoundariesElement,
57
- popupsScrollableElement = _ref2.popupsScrollableElement;
58
- var domAtPos = editorView.domAtPos.bind(editorView);
59
- return /*#__PURE__*/React.createElement(ContentComponent, {
60
- domAtPos: domAtPos,
61
- api: api,
62
- editorView: editorView,
63
- popupsMountPoint: popupsMountPoint,
64
- popupsBoundariesElement: popupsBoundariesElement,
65
- popupsScrollableElement: popupsScrollableElement
66
- });
67
- }
68
- };
69
- };
70
- var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, options, api) {
71
- if ((options === null || options === void 0 ? void 0 : options.menuDisabled) === true) {
72
- return plugin;
73
- }
74
- plugin.pluginsOptions = {
75
- quickInsert: function quickInsert(_ref3) {
76
- var formatMessage = _ref3.formatMessage;
77
- return [{
78
- id: 'status',
79
- title: formatMessage(messages.status),
80
- description: formatMessage(messages.statusDescription),
81
- priority: 700,
82
- keywords: ['lozenge'],
83
- icon: function icon() {
84
- return /*#__PURE__*/React.createElement(IconStatus, null);
85
- },
86
- action: function action(insert, state) {
87
- var _insertStatus, _api$analytics3;
88
- return (_insertStatus = insertStatus(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions)(INPUT_METHOD.QUICK_INSERT)({
89
- tr: state.tr
90
- })) !== null && _insertStatus !== void 0 ? _insertStatus : state.tr;
91
- }
92
- }];
93
- }
94
- };
95
- return plugin;
96
- };
97
- export var statusPlugin = function statusPlugin(_ref4) {
98
- var options = _ref4.config,
99
- api = _ref4.api;
100
- return decorateWithPluginOptions(baseStatusPlugin({
101
- config: options,
102
- api: api
103
- }), options, api);
104
- };
@@ -1,19 +0,0 @@
1
- import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
- import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
- import type { UpdateStatus } from './actions';
4
- import { commitStatusPicker, insertStatus, removeStatus } from './actions';
5
- import type { StatusPluginOptions, StatusState } from './types';
6
- export type StatusPlugin = NextEditorPlugin<'status', {
7
- dependencies: [OptionalPlugin<AnalyticsPlugin>];
8
- pluginConfiguration: StatusPluginOptions | undefined;
9
- actions: {
10
- commitStatusPicker: typeof commitStatusPicker;
11
- updateStatus: UpdateStatus;
12
- };
13
- commands: {
14
- removeStatus: typeof removeStatus;
15
- insertStatus: ReturnType<typeof insertStatus>;
16
- };
17
- sharedState: StatusState | undefined;
18
- }>;
19
- export declare const statusPlugin: StatusPlugin;
@@ -1,21 +0,0 @@
1
- import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
- import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
- import type { UpdateStatus } from './actions';
4
- import { commitStatusPicker, insertStatus, removeStatus } from './actions';
5
- import type { StatusPluginOptions, StatusState } from './types';
6
- export type StatusPlugin = NextEditorPlugin<'status', {
7
- dependencies: [
8
- OptionalPlugin<AnalyticsPlugin>
9
- ];
10
- pluginConfiguration: StatusPluginOptions | undefined;
11
- actions: {
12
- commitStatusPicker: typeof commitStatusPicker;
13
- updateStatus: UpdateStatus;
14
- };
15
- commands: {
16
- removeStatus: typeof removeStatus;
17
- insertStatus: ReturnType<typeof insertStatus>;
18
- };
19
- sharedState: StatusState | undefined;
20
- }>;
21
- export declare const statusPlugin: StatusPlugin;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes