@atlaskit/editor-plugin-status 2.1.1 → 2.1.3
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 +15 -0
- package/dist/cjs/actions.js +9 -6
- package/dist/cjs/nodeviews/status.js +4 -1
- package/dist/cjs/ui/statusPicker.js +4 -1
- package/dist/es2019/actions.js +7 -4
- package/dist/es2019/nodeviews/status.js +4 -1
- package/dist/es2019/ui/statusPicker.js +4 -1
- package/dist/esm/actions.js +7 -4
- package/dist/esm/nodeviews/status.js +4 -1
- package/dist/esm/ui/statusPicker.js +4 -1
- package/dist/types/actions.d.ts +2 -1
- package/dist/types/nodeviews/status.d.ts +4 -1
- package/dist/types-ts4.5/actions.d.ts +2 -1
- package/dist/types-ts4.5/nodeviews/status.d.ts +4 -1
- package/package.json +9 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-status
|
|
2
2
|
|
|
3
|
+
## 2.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#122612](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/122612)
|
|
8
|
+
[`01a85ce0a88ec`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/01a85ce0a88ec) -
|
|
9
|
+
[ux] ED-23705 Add logic to handle annotations on inline nodes when they are inserted or pasted.
|
|
10
|
+
Covers the following inline nodes: emoji, status, mention, date, inlineCard
|
|
11
|
+
|
|
12
|
+
## 2.1.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 2.1.1
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/dist/cjs/actions.js
CHANGED
|
@@ -9,9 +9,11 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
10
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
11
|
var _editorAnalytics = require("@atlaskit/editor-common/editor-analytics");
|
|
12
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
12
13
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
13
14
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
14
|
-
var
|
|
15
|
+
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
16
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
17
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
16
18
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
19
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -19,9 +21,9 @@ var DEFAULT_STATUS = exports.DEFAULT_STATUS = {
|
|
|
19
21
|
text: '',
|
|
20
22
|
color: 'neutral'
|
|
21
23
|
};
|
|
22
|
-
var verifyAndInsertStatus = exports.verifyAndInsertStatus = function verifyAndInsertStatus(statusNode, tr) {
|
|
23
|
-
var fragment = _model.Fragment.fromArray([statusNode, tr.doc.type.schema.text(' ')]);
|
|
24
|
-
var insertable = (0,
|
|
24
|
+
var verifyAndInsertStatus = exports.verifyAndInsertStatus = function verifyAndInsertStatus(statusNode, tr, annotationMarks) {
|
|
25
|
+
var fragment = _model.Fragment.fromArray([statusNode, tr.doc.type.schema.text(' ', (0, _platformFeatureFlags.fg)('editor_inline_comments_paste_insert_nodes') ? annotationMarks : undefined)]);
|
|
26
|
+
var insertable = (0, _utils2.canInsert)(tr.selection.$from, fragment);
|
|
25
27
|
if (!insertable) {
|
|
26
28
|
var parentSelection = _state.NodeSelection.create(tr.doc, tr.selection.from - tr.selection.$anchor.parentOffset - 1);
|
|
27
29
|
tr.insert(parentSelection.to, fragment).setSelection(_state.NodeSelection.create(tr.doc, parentSelection.to + 1));
|
|
@@ -34,10 +36,11 @@ var verifyAndInsertStatus = exports.verifyAndInsertStatus = function verifyAndIn
|
|
|
34
36
|
}).scrollIntoView();
|
|
35
37
|
};
|
|
36
38
|
var createStatus = exports.createStatus = function createStatus(tr) {
|
|
39
|
+
var annotationMarksForPos = (0, _platformFeatureFlags.fg)('editor_inline_comments_paste_insert_nodes') ? (0, _utils.getAnnotationMarksForPos)(tr.selection.$head) : undefined;
|
|
37
40
|
var statusNode = tr.doc.type.schema.nodes.status.createChecked(_objectSpread(_objectSpread({}, DEFAULT_STATUS), {}, {
|
|
38
41
|
localId: _adfSchema.uuid.generate()
|
|
39
|
-
}));
|
|
40
|
-
return verifyAndInsertStatus(statusNode, tr);
|
|
42
|
+
}), null, (0, _platformFeatureFlags.fg)('editor_inline_comments_paste_insert_nodes') ? annotationMarksForPos : undefined);
|
|
43
|
+
return verifyAndInsertStatus(statusNode, tr, (0, _platformFeatureFlags.fg)('editor_inline_comments_paste_insert_nodes') ? annotationMarksForPos : undefined);
|
|
41
44
|
};
|
|
42
45
|
var insertStatus = exports.insertStatus = function insertStatus(editorAnalyticsAPI) {
|
|
43
46
|
return function () {
|
|
@@ -10,7 +10,10 @@ var _react2 = require("@emotion/react");
|
|
|
10
10
|
var _reactIntlNext = require("react-intl-next");
|
|
11
11
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
12
12
|
var _element = require("@atlaskit/status/element");
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* @jsxRuntime classic
|
|
15
|
+
* @jsx jsx
|
|
16
|
+
*/
|
|
14
17
|
|
|
15
18
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
16
19
|
|
|
@@ -24,7 +24,10 @@ var _constants = require("@atlaskit/theme/constants");
|
|
|
24
24
|
var _actions = require("../actions");
|
|
25
25
|
var _analytics = require("../analytics");
|
|
26
26
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
27
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /**
|
|
27
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /**
|
|
28
|
+
* @jsxRuntime classic
|
|
29
|
+
* @jsx jsx
|
|
30
|
+
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
28
31
|
var PopupWithListeners = (0, _uiReact.withReactEditorViewOuterListeners)(_ui.Popup);
|
|
29
32
|
var InputMethod = exports.InputMethod = /*#__PURE__*/function (InputMethod) {
|
|
30
33
|
InputMethod["blur"] = "blur";
|
package/dist/es2019/actions.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { uuid } from '@atlaskit/adf-schema';
|
|
2
2
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
4
|
+
import { getAnnotationMarksForPos } from '@atlaskit/editor-common/utils';
|
|
4
5
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
5
6
|
import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
6
7
|
import { canInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
9
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
8
10
|
export const DEFAULT_STATUS = {
|
|
9
11
|
text: '',
|
|
10
12
|
color: 'neutral'
|
|
11
13
|
};
|
|
12
|
-
export const verifyAndInsertStatus = (statusNode, tr) => {
|
|
13
|
-
const fragment = Fragment.fromArray([statusNode, tr.doc.type.schema.text(' ')]);
|
|
14
|
+
export const verifyAndInsertStatus = (statusNode, tr, annotationMarks) => {
|
|
15
|
+
const fragment = Fragment.fromArray([statusNode, tr.doc.type.schema.text(' ', fg('editor_inline_comments_paste_insert_nodes') ? annotationMarks : undefined)]);
|
|
14
16
|
const insertable = canInsert(tr.selection.$from, fragment);
|
|
15
17
|
if (!insertable) {
|
|
16
18
|
const parentSelection = NodeSelection.create(tr.doc, tr.selection.from - tr.selection.$anchor.parentOffset - 1);
|
|
@@ -24,11 +26,12 @@ export const verifyAndInsertStatus = (statusNode, tr) => {
|
|
|
24
26
|
}).scrollIntoView();
|
|
25
27
|
};
|
|
26
28
|
export const createStatus = tr => {
|
|
29
|
+
const annotationMarksForPos = fg('editor_inline_comments_paste_insert_nodes') ? getAnnotationMarksForPos(tr.selection.$head) : undefined;
|
|
27
30
|
const statusNode = tr.doc.type.schema.nodes.status.createChecked({
|
|
28
31
|
...DEFAULT_STATUS,
|
|
29
32
|
localId: uuid.generate()
|
|
30
|
-
});
|
|
31
|
-
return verifyAndInsertStatus(statusNode, tr);
|
|
33
|
+
}, null, fg('editor_inline_comments_paste_insert_nodes') ? annotationMarksForPos : undefined);
|
|
34
|
+
return verifyAndInsertStatus(statusNode, tr, fg('editor_inline_comments_paste_insert_nodes') ? annotationMarksForPos : undefined);
|
|
32
35
|
};
|
|
33
36
|
export const insertStatus = editorAnalyticsAPI => (inputMethod = INPUT_METHOD.TOOLBAR) => ({
|
|
34
37
|
tr
|
package/dist/esm/actions.js
CHANGED
|
@@ -4,16 +4,18 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { uuid } from '@atlaskit/adf-schema';
|
|
5
5
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
7
|
+
import { getAnnotationMarksForPos } from '@atlaskit/editor-common/utils';
|
|
7
8
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
8
9
|
import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
9
10
|
import { canInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
12
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
11
13
|
export var DEFAULT_STATUS = {
|
|
12
14
|
text: '',
|
|
13
15
|
color: 'neutral'
|
|
14
16
|
};
|
|
15
|
-
export var verifyAndInsertStatus = function verifyAndInsertStatus(statusNode, tr) {
|
|
16
|
-
var fragment = Fragment.fromArray([statusNode, tr.doc.type.schema.text(' ')]);
|
|
17
|
+
export var verifyAndInsertStatus = function verifyAndInsertStatus(statusNode, tr, annotationMarks) {
|
|
18
|
+
var fragment = Fragment.fromArray([statusNode, tr.doc.type.schema.text(' ', fg('editor_inline_comments_paste_insert_nodes') ? annotationMarks : undefined)]);
|
|
17
19
|
var insertable = canInsert(tr.selection.$from, fragment);
|
|
18
20
|
if (!insertable) {
|
|
19
21
|
var parentSelection = NodeSelection.create(tr.doc, tr.selection.from - tr.selection.$anchor.parentOffset - 1);
|
|
@@ -27,10 +29,11 @@ export var verifyAndInsertStatus = function verifyAndInsertStatus(statusNode, tr
|
|
|
27
29
|
}).scrollIntoView();
|
|
28
30
|
};
|
|
29
31
|
export var createStatus = function createStatus(tr) {
|
|
32
|
+
var annotationMarksForPos = fg('editor_inline_comments_paste_insert_nodes') ? getAnnotationMarksForPos(tr.selection.$head) : undefined;
|
|
30
33
|
var statusNode = tr.doc.type.schema.nodes.status.createChecked(_objectSpread(_objectSpread({}, DEFAULT_STATUS), {}, {
|
|
31
34
|
localId: uuid.generate()
|
|
32
|
-
}));
|
|
33
|
-
return verifyAndInsertStatus(statusNode, tr);
|
|
35
|
+
}), null, fg('editor_inline_comments_paste_insert_nodes') ? annotationMarksForPos : undefined);
|
|
36
|
+
return verifyAndInsertStatus(statusNode, tr, fg('editor_inline_comments_paste_insert_nodes') ? annotationMarksForPos : undefined);
|
|
34
37
|
};
|
|
35
38
|
export var insertStatus = function insertStatus(editorAnalyticsAPI) {
|
|
36
39
|
return function () {
|
|
@@ -7,7 +7,10 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
8
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
9
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* @jsxRuntime classic
|
|
12
|
+
* @jsx jsx
|
|
13
|
+
*/
|
|
11
14
|
|
|
12
15
|
import React from 'react';
|
|
13
16
|
|
package/dist/types/actions.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { Command, CommandDispatch, EditorCommand, TOOLBAR_MENU_TYPE } from '@atlaskit/editor-common/types';
|
|
4
|
+
import { type Mark } from '@atlaskit/editor-prosemirror/model';
|
|
4
5
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
5
6
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
6
7
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
8
|
import type { ClosingPayload, StatusType } from './types';
|
|
8
9
|
export declare const DEFAULT_STATUS: StatusType;
|
|
9
|
-
export declare const verifyAndInsertStatus: (statusNode: Node, tr: Transaction) => Transaction;
|
|
10
|
+
export declare const verifyAndInsertStatus: (statusNode: Node, tr: Transaction, annotationMarks?: Mark[] | undefined) => Transaction;
|
|
10
11
|
export declare const createStatus: (tr: Transaction) => Transaction;
|
|
11
12
|
export declare const insertStatus: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod?: INPUT_METHOD.INSERT_MENU | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR) => EditorCommand;
|
|
12
13
|
export declare const updateStatus: (status?: StatusType) => Command;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { Command, CommandDispatch, EditorCommand, TOOLBAR_MENU_TYPE } from '@atlaskit/editor-common/types';
|
|
4
|
+
import { type Mark } from '@atlaskit/editor-prosemirror/model';
|
|
4
5
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
5
6
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
6
7
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
8
|
import type { ClosingPayload, StatusType } from './types';
|
|
8
9
|
export declare const DEFAULT_STATUS: StatusType;
|
|
9
|
-
export declare const verifyAndInsertStatus: (statusNode: Node, tr: Transaction) => Transaction;
|
|
10
|
+
export declare const verifyAndInsertStatus: (statusNode: Node, tr: Transaction, annotationMarks?: Mark[] | undefined) => Transaction;
|
|
10
11
|
export declare const createStatus: (tr: Transaction) => Transaction;
|
|
11
12
|
export declare const insertStatus: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod?: INPUT_METHOD.INSERT_MENU | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR) => EditorCommand;
|
|
12
13
|
export declare const updateStatus: (status?: StatusType) => Command;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-status",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"description": "Status plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,13 +35,14 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/adf-schema": "^39.0.3",
|
|
37
37
|
"@atlaskit/analytics-next": "^9.3.0",
|
|
38
|
-
"@atlaskit/editor-common": "^
|
|
38
|
+
"@atlaskit/editor-common": "^86.4.0",
|
|
39
39
|
"@atlaskit/editor-plugin-analytics": "^1.4.0",
|
|
40
40
|
"@atlaskit/editor-prosemirror": "4.0.1",
|
|
41
41
|
"@atlaskit/editor-shared-styles": "^2.13.0",
|
|
42
|
+
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
42
43
|
"@atlaskit/status": "^1.4.0",
|
|
43
44
|
"@atlaskit/theme": "^12.11.0",
|
|
44
|
-
"@atlaskit/tokens": "^1.
|
|
45
|
+
"@atlaskit/tokens": "^1.56.0",
|
|
45
46
|
"@babel/runtime": "^7.0.0",
|
|
46
47
|
"@emotion/react": "^11.7.1"
|
|
47
48
|
},
|
|
@@ -90,5 +91,10 @@
|
|
|
90
91
|
"import-no-extraneous-disable-for-examples-and-docs"
|
|
91
92
|
]
|
|
92
93
|
}
|
|
94
|
+
},
|
|
95
|
+
"platform-feature-flags": {
|
|
96
|
+
"editor_inline_comments_paste_insert_nodes": {
|
|
97
|
+
"type": "boolean"
|
|
98
|
+
}
|
|
93
99
|
}
|
|
94
100
|
}
|