@atlaskit/editor-plugin-tasks-and-decisions 5.1.20 → 5.1.21

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 (37) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cjs/nodeviews/{DecisionItemVanilla.js → DecisionItemNodeView.js} +25 -12
  3. package/dist/cjs/nodeviews/decisionItemNodeSpec.js +0 -1
  4. package/dist/cjs/nodeviews/taskItemNodeSpec.js +0 -1
  5. package/dist/cjs/pm-plugins/main.js +3 -10
  6. package/dist/es2019/nodeviews/DecisionItemNodeView.js +57 -0
  7. package/dist/es2019/nodeviews/decisionItemNodeSpec.js +0 -1
  8. package/dist/es2019/nodeviews/taskItemNodeSpec.js +0 -1
  9. package/dist/es2019/pm-plugins/main.js +3 -10
  10. package/dist/esm/nodeviews/DecisionItemNodeView.js +64 -0
  11. package/dist/esm/nodeviews/decisionItemNodeSpec.js +0 -1
  12. package/dist/esm/nodeviews/taskItemNodeSpec.js +0 -1
  13. package/dist/esm/pm-plugins/main.js +3 -10
  14. package/dist/types/nodeviews/DecisionItemNodeView.d.ts +37 -0
  15. package/dist/types/nodeviews/decisionItemNodeSpec.d.ts +0 -1
  16. package/dist/types-ts4.5/nodeviews/DecisionItemNodeView.d.ts +37 -0
  17. package/dist/types-ts4.5/nodeviews/decisionItemNodeSpec.d.ts +0 -1
  18. package/package.json +4 -8
  19. package/dist/cjs/nodeviews/decision-lazy-node-view.js +0 -31
  20. package/dist/cjs/nodeviews/decisionItem.js +0 -113
  21. package/dist/cjs/ui/Decision/index.js +0 -24
  22. package/dist/es2019/nodeviews/DecisionItemVanilla.js +0 -45
  23. package/dist/es2019/nodeviews/decision-lazy-node-view.js +0 -21
  24. package/dist/es2019/nodeviews/decisionItem.js +0 -74
  25. package/dist/es2019/ui/Decision/index.js +0 -20
  26. package/dist/esm/nodeviews/DecisionItemVanilla.js +0 -51
  27. package/dist/esm/nodeviews/decision-lazy-node-view.js +0 -20
  28. package/dist/esm/nodeviews/decisionItem.js +0 -106
  29. package/dist/esm/ui/Decision/index.js +0 -17
  30. package/dist/types/nodeviews/DecisionItemVanilla.d.ts +0 -25
  31. package/dist/types/nodeviews/decision-lazy-node-view.d.ts +0 -5
  32. package/dist/types/nodeviews/decisionItem.d.ts +0 -10
  33. package/dist/types/ui/Decision/index.d.ts +0 -15
  34. package/dist/types-ts4.5/nodeviews/DecisionItemVanilla.d.ts +0 -25
  35. package/dist/types-ts4.5/nodeviews/decision-lazy-node-view.d.ts +0 -5
  36. package/dist/types-ts4.5/nodeviews/decisionItem.d.ts +0 -10
  37. package/dist/types-ts4.5/ui/Decision/index.d.ts +0 -15
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/editor-plugin-tasks-and-decisions
2
2
 
3
+ ## 5.1.21
4
+
5
+ ### Patch Changes
6
+
7
+ - [#180357](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/180357)
8
+ [`4f4d1545d11af`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4f4d1545d11af) -
9
+ Cleanup feature gates for vanilla dom experiment and decision nodes
10
+ - Updated dependencies
11
+
3
12
  ## 5.1.20
4
13
 
5
14
  ### Patch Changes
@@ -4,24 +4,28 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.DecisionItemVanilla = void 0;
7
+ exports.DecisionItemNodeView = void 0;
8
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
  var _model = require("@atlaskit/editor-prosemirror/model");
12
12
  var _decisionItemNodeSpec = require("./decisionItemNodeSpec");
13
13
  /**
14
- *
14
+ * NodeView for the DecisionItem node.
15
+ * It renders the decision item with its content and exposes the contentDOM to prosemirror.
15
16
  */
16
- var DecisionItemVanilla = exports.DecisionItemVanilla = /*#__PURE__*/function () {
17
+ var DecisionItemNodeView = exports.DecisionItemNodeView = /*#__PURE__*/function () {
17
18
  /**
18
- *
19
- * @param node
20
- * @param intl
19
+ * Creates a new DecisionItemNodeView.
20
+ * @import type {PMNode} from '@atlaskit/editor-prosemirror/model';
21
+ * @import type {IntlShape} from 'react-intl-next';
22
+ * @param {PMNode} node - The ProseMirror node representing the decision item.
23
+ * @param {IntlShape} intl - The IntlShape for internationalization, used to format the placeholder text.
21
24
  * @example
25
+ * const decisionItemNodeView = new DecisionItemNodeView(node, getIntl());
22
26
  */
23
- function DecisionItemVanilla(node, intl) {
24
- (0, _classCallCheck2.default)(this, DecisionItemVanilla);
27
+ function DecisionItemNodeView(node, intl) {
28
+ (0, _classCallCheck2.default)(this, DecisionItemNodeView);
25
29
  (0, _defineProperty2.default)(this, "hasChildren", undefined);
26
30
  var spec = (0, _decisionItemNodeSpec.decisionItemToDOM)(node, intl);
27
31
  var _DOMSerializer$render = _model.DOMSerializer.renderSpec(document, spec),
@@ -32,13 +36,22 @@ var DecisionItemVanilla = exports.DecisionItemVanilla = /*#__PURE__*/function ()
32
36
  }
33
37
 
34
38
  /**
35
- *
36
- * @param node
39
+ * Updates the node view when the ProseMirror node changes.
40
+ * @import type {PMNode} from '@atlaskit/editor-prosemirror/model';
41
+ * @param {PMNode} node - The ProseMirror node to update the view with.
37
42
  * @example
43
+ * decisionItemNodeView.update(node);
44
+ * @returns {boolean} - Returns true if the view was updated successfully.
38
45
  */
39
- return (0, _createClass2.default)(DecisionItemVanilla, [{
46
+ return (0, _createClass2.default)(DecisionItemNodeView, [{
40
47
  key: "updateHasChildren",
41
- value: function updateHasChildren(node) {
48
+ value:
49
+ /**
50
+ * Updates the hasChildren state based on the node's child count by setting the `data-empty` attribute on the contentDOM.
51
+ * @param node - The ProseMirror node to check for children.
52
+ * @private
53
+ */
54
+ function updateHasChildren(node) {
42
55
  var currentlyHasChildren = node.childCount > 0;
43
56
  if (currentlyHasChildren !== this.hasChildren) {
44
57
  var _this$contentDOM;
@@ -45,7 +45,6 @@ var decisionItemToDOM = exports.decisionItemToDOM = function decisionItemToDOM(n
45
45
  return ['li', {
46
46
  'data-decision-local-id': node.attrs.localId || 'local-decision',
47
47
  'data-decision-state': node.attrs.state,
48
- 'data-prosemirror-node-view-type': 'vanilla',
49
48
  'data-prosemirror-node-name': 'decisionItem',
50
49
  class: 'decisionItemView-content-wrap'
51
50
  }, ['div', {
@@ -55,7 +55,6 @@ function taskItemToDom(node, placeholder, intl) {
55
55
  var dataAttrs = {
56
56
  'data-task-local-id': node.attrs.localId,
57
57
  'data-task-state': node.attrs.state,
58
- 'data-prosemirror-node-view-type': 'vanilla',
59
58
  'data-prosemirror-node-name': 'taskItem'
60
59
  };
61
60
  var contentDomDataAttrs = node.content.childCount > 0 ? {} : {
@@ -14,9 +14,7 @@ var _selection = require("@atlaskit/editor-common/selection");
14
14
  var _utils = require("@atlaskit/editor-common/utils");
15
15
  var _state = require("@atlaskit/editor-prosemirror/state");
16
16
  var _view = require("@atlaskit/editor-prosemirror/view");
17
- var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
18
- var _decisionLazyNodeView = require("../nodeviews/decision-lazy-node-view");
19
- var _DecisionItemVanilla = require("../nodeviews/DecisionItemVanilla");
17
+ var _DecisionItemNodeView = require("../nodeviews/DecisionItemNodeView");
20
18
  var _taskNodeView = require("../nodeviews/task-node-view");
21
19
  var _actions = require("./actions");
22
20
  var _helpers = require("./helpers");
@@ -45,13 +43,8 @@ function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api, getIntl
45
43
  props: {
46
44
  nodeViews: {
47
45
  taskItem: (0, _taskNodeView.taskView)(api, getIntl(), taskPlaceholder),
48
- decisionItem: function (node, view, getPos, decorations, innerDecorations) {
49
- if ((0, _experiments.editorExperiment)('platform_editor_vanilla_dom', true, {
50
- exposure: true
51
- })) {
52
- return new _DecisionItemVanilla.DecisionItemVanilla(node, getIntl());
53
- }
54
- return (0, _decisionLazyNodeView.lazyDecisionView)(portalProviderAPI, eventDispatcher, api)(node, view, getPos, decorations, innerDecorations);
46
+ decisionItem: function (node) {
47
+ return new _DecisionItemNodeView.DecisionItemNodeView(node, getIntl());
55
48
  }
56
49
  },
57
50
  decorations: function decorations(state) {
@@ -0,0 +1,57 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
3
+ import { decisionItemToDOM } from './decisionItemNodeSpec';
4
+
5
+ /**
6
+ * NodeView for the DecisionItem node.
7
+ * It renders the decision item with its content and exposes the contentDOM to prosemirror.
8
+ */
9
+ export class DecisionItemNodeView {
10
+ /**
11
+ * Updates the hasChildren state based on the node's child count by setting the `data-empty` attribute on the contentDOM.
12
+ * @param node - The ProseMirror node to check for children.
13
+ * @private
14
+ */
15
+ updateHasChildren(node) {
16
+ const currentlyHasChildren = node.childCount > 0;
17
+ if (currentlyHasChildren !== this.hasChildren) {
18
+ var _this$contentDOM;
19
+ this.hasChildren = currentlyHasChildren;
20
+ (_this$contentDOM = this.contentDOM) === null || _this$contentDOM === void 0 ? void 0 : _this$contentDOM.toggleAttribute('data-empty', !currentlyHasChildren);
21
+ }
22
+ return this.hasChildren;
23
+ }
24
+
25
+ /**
26
+ * Creates a new DecisionItemNodeView.
27
+ * @import type {PMNode} from '@atlaskit/editor-prosemirror/model';
28
+ * @import type {IntlShape} from 'react-intl-next';
29
+ * @param {PMNode} node - The ProseMirror node representing the decision item.
30
+ * @param {IntlShape} intl - The IntlShape for internationalization, used to format the placeholder text.
31
+ * @example
32
+ * const decisionItemNodeView = new DecisionItemNodeView(node, getIntl());
33
+ */
34
+ constructor(node, intl) {
35
+ _defineProperty(this, "hasChildren", undefined);
36
+ const spec = decisionItemToDOM(node, intl);
37
+ const {
38
+ dom,
39
+ contentDOM
40
+ } = DOMSerializer.renderSpec(document, spec);
41
+ this.dom = dom;
42
+ this.contentDOM = contentDOM;
43
+ }
44
+
45
+ /**
46
+ * Updates the node view when the ProseMirror node changes.
47
+ * @import type {PMNode} from '@atlaskit/editor-prosemirror/model';
48
+ * @param {PMNode} node - The ProseMirror node to update the view with.
49
+ * @example
50
+ * decisionItemNodeView.update(node);
51
+ * @returns {boolean} - Returns true if the view was updated successfully.
52
+ */
53
+ update(node) {
54
+ this.updateHasChildren(node);
55
+ return true;
56
+ }
57
+ }
@@ -35,7 +35,6 @@ export const decisionItemToDOM = (node, intl) => {
35
35
  return ['li', {
36
36
  'data-decision-local-id': node.attrs.localId || 'local-decision',
37
37
  'data-decision-state': node.attrs.state,
38
- 'data-prosemirror-node-view-type': 'vanilla',
39
38
  'data-prosemirror-node-name': 'decisionItem',
40
39
  class: 'decisionItemView-content-wrap'
41
40
  }, ['div', {
@@ -43,7 +43,6 @@ export function taskItemToDom(node, placeholder, intl) {
43
43
  const dataAttrs = {
44
44
  'data-task-local-id': node.attrs.localId,
45
45
  'data-task-state': node.attrs.state,
46
- 'data-prosemirror-node-view-type': 'vanilla',
47
46
  'data-prosemirror-node-name': 'taskItem'
48
47
  };
49
48
  const contentDomDataAttrs = node.content.childCount > 0 ? {} : {
@@ -5,9 +5,7 @@ import { createSelectionClickHandler, GapCursorSelection } from '@atlaskit/edito
5
5
  import { getStepRange } from '@atlaskit/editor-common/utils';
6
6
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
7
7
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
8
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
9
- import { lazyDecisionView } from '../nodeviews/decision-lazy-node-view';
10
- import { DecisionItemVanilla } from '../nodeviews/DecisionItemVanilla';
8
+ import { DecisionItemNodeView } from '../nodeviews/DecisionItemNodeView';
11
9
  import { taskView } from '../nodeviews/task-node-view';
12
10
  import { focusTaskDecision, setProvider, openRequestEditPopup } from './actions';
13
11
  import { focusCheckbox, focusCheckboxAndUpdateSelection, getTaskItemDataAtPos, getTaskItemDataToFocus, removeCheckboxFocus } from './helpers';
@@ -28,13 +26,8 @@ export function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api,
28
26
  props: {
29
27
  nodeViews: {
30
28
  taskItem: taskView(api, getIntl(), taskPlaceholder),
31
- decisionItem: (node, view, getPos, decorations, innerDecorations) => {
32
- if (editorExperiment('platform_editor_vanilla_dom', true, {
33
- exposure: true
34
- })) {
35
- return new DecisionItemVanilla(node, getIntl());
36
- }
37
- return lazyDecisionView(portalProviderAPI, eventDispatcher, api)(node, view, getPos, decorations, innerDecorations);
29
+ decisionItem: node => {
30
+ return new DecisionItemNodeView(node, getIntl());
38
31
  }
39
32
  },
40
33
  decorations(state) {
@@ -0,0 +1,64 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
+ import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
5
+ import { decisionItemToDOM } from './decisionItemNodeSpec';
6
+
7
+ /**
8
+ * NodeView for the DecisionItem node.
9
+ * It renders the decision item with its content and exposes the contentDOM to prosemirror.
10
+ */
11
+ export var DecisionItemNodeView = /*#__PURE__*/function () {
12
+ /**
13
+ * Creates a new DecisionItemNodeView.
14
+ * @import type {PMNode} from '@atlaskit/editor-prosemirror/model';
15
+ * @import type {IntlShape} from 'react-intl-next';
16
+ * @param {PMNode} node - The ProseMirror node representing the decision item.
17
+ * @param {IntlShape} intl - The IntlShape for internationalization, used to format the placeholder text.
18
+ * @example
19
+ * const decisionItemNodeView = new DecisionItemNodeView(node, getIntl());
20
+ */
21
+ function DecisionItemNodeView(node, intl) {
22
+ _classCallCheck(this, DecisionItemNodeView);
23
+ _defineProperty(this, "hasChildren", undefined);
24
+ var spec = decisionItemToDOM(node, intl);
25
+ var _DOMSerializer$render = DOMSerializer.renderSpec(document, spec),
26
+ dom = _DOMSerializer$render.dom,
27
+ contentDOM = _DOMSerializer$render.contentDOM;
28
+ this.dom = dom;
29
+ this.contentDOM = contentDOM;
30
+ }
31
+
32
+ /**
33
+ * Updates the node view when the ProseMirror node changes.
34
+ * @import type {PMNode} from '@atlaskit/editor-prosemirror/model';
35
+ * @param {PMNode} node - The ProseMirror node to update the view with.
36
+ * @example
37
+ * decisionItemNodeView.update(node);
38
+ * @returns {boolean} - Returns true if the view was updated successfully.
39
+ */
40
+ return _createClass(DecisionItemNodeView, [{
41
+ key: "updateHasChildren",
42
+ value:
43
+ /**
44
+ * Updates the hasChildren state based on the node's child count by setting the `data-empty` attribute on the contentDOM.
45
+ * @param node - The ProseMirror node to check for children.
46
+ * @private
47
+ */
48
+ function updateHasChildren(node) {
49
+ var currentlyHasChildren = node.childCount > 0;
50
+ if (currentlyHasChildren !== this.hasChildren) {
51
+ var _this$contentDOM;
52
+ this.hasChildren = currentlyHasChildren;
53
+ (_this$contentDOM = this.contentDOM) === null || _this$contentDOM === void 0 || _this$contentDOM.toggleAttribute('data-empty', !currentlyHasChildren);
54
+ }
55
+ return this.hasChildren;
56
+ }
57
+ }, {
58
+ key: "update",
59
+ value: function update(node) {
60
+ this.updateHasChildren(node);
61
+ return true;
62
+ }
63
+ }]);
64
+ }();
@@ -38,7 +38,6 @@ export var decisionItemToDOM = function decisionItemToDOM(node, intl) {
38
38
  return ['li', {
39
39
  'data-decision-local-id': node.attrs.localId || 'local-decision',
40
40
  'data-decision-state': node.attrs.state,
41
- 'data-prosemirror-node-view-type': 'vanilla',
42
41
  'data-prosemirror-node-name': 'decisionItem',
43
42
  class: 'decisionItemView-content-wrap'
44
43
  }, ['div', {
@@ -47,7 +47,6 @@ export function taskItemToDom(node, placeholder, intl) {
47
47
  var dataAttrs = {
48
48
  'data-task-local-id': node.attrs.localId,
49
49
  'data-task-state': node.attrs.state,
50
- 'data-prosemirror-node-view-type': 'vanilla',
51
50
  'data-prosemirror-node-name': 'taskItem'
52
51
  };
53
52
  var contentDomDataAttrs = node.content.childCount > 0 ? {} : {
@@ -10,9 +10,7 @@ import { createSelectionClickHandler, GapCursorSelection } from '@atlaskit/edito
10
10
  import { getStepRange } from '@atlaskit/editor-common/utils';
11
11
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
12
12
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
13
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
14
- import { lazyDecisionView } from '../nodeviews/decision-lazy-node-view';
15
- import { DecisionItemVanilla } from '../nodeviews/DecisionItemVanilla';
13
+ import { DecisionItemNodeView } from '../nodeviews/DecisionItemNodeView';
16
14
  import { taskView } from '../nodeviews/task-node-view';
17
15
  import { focusTaskDecision, setProvider, openRequestEditPopup } from './actions';
18
16
  import { focusCheckbox, focusCheckboxAndUpdateSelection, getTaskItemDataAtPos, getTaskItemDataToFocus, removeCheckboxFocus } from './helpers';
@@ -38,13 +36,8 @@ export function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api,
38
36
  props: {
39
37
  nodeViews: {
40
38
  taskItem: taskView(api, getIntl(), taskPlaceholder),
41
- decisionItem: function (node, view, getPos, decorations, innerDecorations) {
42
- if (editorExperiment('platform_editor_vanilla_dom', true, {
43
- exposure: true
44
- })) {
45
- return new DecisionItemVanilla(node, getIntl());
46
- }
47
- return lazyDecisionView(portalProviderAPI, eventDispatcher, api)(node, view, getPos, decorations, innerDecorations);
39
+ decisionItem: function (node) {
40
+ return new DecisionItemNodeView(node, getIntl());
48
41
  }
49
42
  },
50
43
  decorations: function decorations(state) {
@@ -0,0 +1,37 @@
1
+ import { type IntlShape } from 'react-intl-next';
2
+ import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
+ import { type NodeView } from '@atlaskit/editor-prosemirror/view';
4
+ /**
5
+ * NodeView for the DecisionItem node.
6
+ * It renders the decision item with its content and exposes the contentDOM to prosemirror.
7
+ */
8
+ export declare class DecisionItemNodeView implements NodeView {
9
+ dom: Node;
10
+ contentDOM?: HTMLElement;
11
+ private hasChildren;
12
+ /**
13
+ * Updates the hasChildren state based on the node's child count by setting the `data-empty` attribute on the contentDOM.
14
+ * @param node - The ProseMirror node to check for children.
15
+ * @private
16
+ */
17
+ private updateHasChildren;
18
+ /**
19
+ * Creates a new DecisionItemNodeView.
20
+ * @import type {PMNode} from '@atlaskit/editor-prosemirror/model';
21
+ * @import type {IntlShape} from 'react-intl-next';
22
+ * @param {PMNode} node - The ProseMirror node representing the decision item.
23
+ * @param {IntlShape} intl - The IntlShape for internationalization, used to format the placeholder text.
24
+ * @example
25
+ * const decisionItemNodeView = new DecisionItemNodeView(node, getIntl());
26
+ */
27
+ constructor(node: PMNode, intl: IntlShape);
28
+ /**
29
+ * Updates the node view when the ProseMirror node changes.
30
+ * @import type {PMNode} from '@atlaskit/editor-prosemirror/model';
31
+ * @param {PMNode} node - The ProseMirror node to update the view with.
32
+ * @example
33
+ * decisionItemNodeView.update(node);
34
+ * @returns {boolean} - Returns true if the view was updated successfully.
35
+ */
36
+ update(node: PMNode): boolean;
37
+ }
@@ -3,7 +3,6 @@ import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
3
  export declare const decisionItemToDOM: (node: PMNode, intl: IntlShape) => [string, {
4
4
  'data-decision-local-id': any;
5
5
  'data-decision-state': any;
6
- 'data-prosemirror-node-view-type': string;
7
6
  'data-prosemirror-node-name': string;
8
7
  class: string;
9
8
  }, (string | [string, {
@@ -0,0 +1,37 @@
1
+ import { type IntlShape } from 'react-intl-next';
2
+ import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
+ import { type NodeView } from '@atlaskit/editor-prosemirror/view';
4
+ /**
5
+ * NodeView for the DecisionItem node.
6
+ * It renders the decision item with its content and exposes the contentDOM to prosemirror.
7
+ */
8
+ export declare class DecisionItemNodeView implements NodeView {
9
+ dom: Node;
10
+ contentDOM?: HTMLElement;
11
+ private hasChildren;
12
+ /**
13
+ * Updates the hasChildren state based on the node's child count by setting the `data-empty` attribute on the contentDOM.
14
+ * @param node - The ProseMirror node to check for children.
15
+ * @private
16
+ */
17
+ private updateHasChildren;
18
+ /**
19
+ * Creates a new DecisionItemNodeView.
20
+ * @import type {PMNode} from '@atlaskit/editor-prosemirror/model';
21
+ * @import type {IntlShape} from 'react-intl-next';
22
+ * @param {PMNode} node - The ProseMirror node representing the decision item.
23
+ * @param {IntlShape} intl - The IntlShape for internationalization, used to format the placeholder text.
24
+ * @example
25
+ * const decisionItemNodeView = new DecisionItemNodeView(node, getIntl());
26
+ */
27
+ constructor(node: PMNode, intl: IntlShape);
28
+ /**
29
+ * Updates the node view when the ProseMirror node changes.
30
+ * @import type {PMNode} from '@atlaskit/editor-prosemirror/model';
31
+ * @param {PMNode} node - The ProseMirror node to update the view with.
32
+ * @example
33
+ * decisionItemNodeView.update(node);
34
+ * @returns {boolean} - Returns true if the view was updated successfully.
35
+ */
36
+ update(node: PMNode): boolean;
37
+ }
@@ -5,7 +5,6 @@ export declare const decisionItemToDOM: (node: PMNode, intl: IntlShape) => [
5
5
  {
6
6
  'data-decision-local-id': any;
7
7
  'data-decision-state': any;
8
- 'data-prosemirror-node-view-type': string;
9
8
  'data-prosemirror-node-name': string;
10
9
  class: string;
11
10
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-tasks-and-decisions",
3
- "version": "5.1.20",
3
+ "version": "5.1.21",
4
4
  "description": "Tasks and decisions plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -9,8 +9,7 @@
9
9
  },
10
10
  "atlassian": {
11
11
  "team": "Editor: AI",
12
- "singleton": true,
13
- "runReact18": true
12
+ "singleton": true
14
13
  },
15
14
  "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
16
15
  "main": "dist/cjs/index.js",
@@ -37,7 +36,7 @@
37
36
  "@atlaskit/analytics-namespaced-context": "^7.0.0",
38
37
  "@atlaskit/analytics-next": "^11.1.0",
39
38
  "@atlaskit/css": "^0.12.0",
40
- "@atlaskit/editor-common": "^107.3.0",
39
+ "@atlaskit/editor-common": "^107.4.0",
41
40
  "@atlaskit/editor-plugin-analytics": "^2.3.0",
42
41
  "@atlaskit/editor-plugin-context-identifier": "^2.1.0",
43
42
  "@atlaskit/editor-plugin-editor-viewmode": "^4.0.0",
@@ -51,7 +50,7 @@
51
50
  "@atlaskit/primitives": "^14.10.0",
52
51
  "@atlaskit/prosemirror-input-rules": "^3.3.0",
53
52
  "@atlaskit/task-decision": "^19.2.0",
54
- "@atlaskit/tmp-editor-statsig": "^8.4.0",
53
+ "@atlaskit/tmp-editor-statsig": "^8.5.0",
55
54
  "@atlaskit/tokens": "^5.4.0",
56
55
  "@babel/runtime": "^7.0.0",
57
56
  "@compiled/react": "^0.18.3",
@@ -108,9 +107,6 @@
108
107
  }
109
108
  },
110
109
  "platform-feature-flags": {
111
- "platform_editor_vanilla_dom": {
112
- "type": "boolean"
113
- },
114
110
  "should-render-to-parent-should-be-true-editor-ai": {
115
111
  "type": "boolean"
116
112
  }
@@ -1,31 +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.lazyDecisionView = void 0;
8
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
9
- var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
10
- var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
11
- var _decisionItem = require("./decisionItem");
12
- 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" != (0, _typeof2.default)(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); }
13
- var lazyDecisionView = exports.lazyDecisionView = function lazyDecisionView(portalProviderAPI, eventDispatcher, api) {
14
- if ((0, _experiments.editorExperiment)('platform_editor_exp_lazy_node_views', false)) {
15
- return (0, _decisionItem.decisionItemNodeView)(portalProviderAPI, eventDispatcher, api);
16
- }
17
- return (0, _lazyNodeView.withLazyLoading)({
18
- nodeName: 'decisionItem',
19
- getNodeViewOptions: function getNodeViewOptions() {},
20
- loader: function loader() {
21
- var result = Promise.resolve().then(function () {
22
- return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_editor-plugin-tasks-and-decisions_decision-item-nodeview" */
23
- './decisionItem'));
24
- }).then(function (_ref) {
25
- var decisionItemNodeView = _ref.decisionItemNodeView;
26
- return decisionItemNodeView(portalProviderAPI, eventDispatcher, api);
27
- });
28
- return result;
29
- }
30
- });
31
- };
@@ -1,113 +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.decisionItemNodeView = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
11
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
12
- var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
13
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
14
- var _react = _interopRequireDefault(require("react"));
15
- var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
16
- var _Decision = _interopRequireDefault(require("../ui/Decision"));
17
- var _useShowPlaceholder = require("./hooks/use-show-placeholder");
18
- function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
19
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
20
- function _superPropGet(t, o, e, r) { var p = (0, _get2.default)((0, _getPrototypeOf2.default)(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
21
- var DecisionItemWrapper = function DecisionItemWrapper(_ref) {
22
- var api = _ref.api,
23
- editorView = _ref.editorView,
24
- forwardRef = _ref.forwardRef,
25
- isContentNodeEmpty = _ref.isContentNodeEmpty,
26
- getPos = _ref.getPos;
27
- var showPlaceholder = (0, _useShowPlaceholder.useShowPlaceholder)({
28
- editorView: editorView,
29
- isContentNodeEmpty: isContentNodeEmpty,
30
- getPos: getPos,
31
- api: api
32
- });
33
- return /*#__PURE__*/_react.default.createElement(_Decision.default, {
34
- contentRef: forwardRef,
35
- showPlaceholder: showPlaceholder
36
- });
37
- };
38
- var Decision = /*#__PURE__*/function (_ReactNodeView) {
39
- function Decision() {
40
- (0, _classCallCheck2.default)(this, Decision);
41
- return _callSuper(this, Decision, arguments);
42
- }
43
- (0, _inherits2.default)(Decision, _ReactNodeView);
44
- return (0, _createClass2.default)(Decision, [{
45
- key: "isContentEmpty",
46
- value: function isContentEmpty(node) {
47
- return node.content.childCount === 0;
48
- }
49
- }, {
50
- key: "initWithAPI",
51
- value: function initWithAPI(api) {
52
- this.api = api;
53
- this.init();
54
- return this;
55
- }
56
- }, {
57
- key: "createDomRef",
58
- value: function createDomRef() {
59
- var domRef = document.createElement('li');
60
- domRef.style.listStyleType = 'none';
61
- return domRef;
62
- }
63
- }, {
64
- key: "getContentDOM",
65
- value: function getContentDOM() {
66
- var dom = document.createElement('div');
67
- // setting a className prevents PM/Chrome mutation observer from
68
- // incorrectly deleting nodes
69
- dom.className = 'decision-item';
70
- return {
71
- dom: dom
72
- };
73
- }
74
- }, {
75
- key: "render",
76
- value: function render(_props, forwardRef) {
77
- var isContentNodeEmpty = this.isContentEmpty(this.node);
78
- return /*#__PURE__*/_react.default.createElement(DecisionItemWrapper, {
79
- forwardRef: forwardRef,
80
- isContentNodeEmpty: isContentNodeEmpty,
81
- api: this.api
82
- // The getPosHandler type is wrong, there is no `boolean` in the real implementation
83
- // @ts-expect-error 2322: Type 'getPosHandler' is not assignable to type '() => number | undefined'.
84
- ,
85
- getPos: this.getPos,
86
- editorView: this.view
87
- });
88
- }
89
- }, {
90
- key: "viewShouldUpdate",
91
- value: function viewShouldUpdate(nextNode) {
92
- return this.isContentEmpty(this.node) && !this.isContentEmpty(nextNode) || this.isContentEmpty(nextNode) && !this.isContentEmpty(this.node);
93
- }
94
- }, {
95
- key: "update",
96
- value: function update(node, decorations) {
97
- return _superPropGet(Decision, "update", this, 3)([node, decorations]);
98
- }
99
- }, {
100
- key: "ignoreMutation",
101
- value: function ignoreMutation(mutation) {
102
- if (!this.contentDOM) {
103
- return true;
104
- }
105
- return !this.contentDOM.contains(mutation.target) && mutation.type !== 'selection';
106
- }
107
- }]);
108
- }(_reactNodeView.default);
109
- var decisionItemNodeView = exports.decisionItemNodeView = function decisionItemNodeView(portalProviderAPI, eventDispatcher, api) {
110
- return function (node, view, getPos) {
111
- return new Decision(node, view, getPos, portalProviderAPI, eventDispatcher, {}).initWithAPI(api);
112
- };
113
- };
@@ -1,24 +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.default = exports.Decision = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _reactIntlNext = require("react-intl-next");
10
- var _messages = require("@atlaskit/editor-common/messages");
11
- var _taskDecision = require("@atlaskit/task-decision");
12
- var Decision = exports.Decision = function Decision(_ref) {
13
- var contentRef = _ref.contentRef,
14
- showPlaceholder = _ref.showPlaceholder,
15
- formatMessage = _ref.intl.formatMessage;
16
- var placeholder = formatMessage(_messages.tasksAndDecisionsMessages.decisionPlaceholder);
17
- return /*#__PURE__*/_react.default.createElement(_taskDecision.DecisionItem, {
18
- contentRef: contentRef,
19
- placeholder: placeholder,
20
- showPlaceholder: showPlaceholder
21
- });
22
- };
23
- Decision.displayName = 'Decision';
24
- var _default = exports.default = (0, _reactIntlNext.injectIntl)(Decision);
@@ -1,45 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
3
- import { decisionItemToDOM } from './decisionItemNodeSpec';
4
-
5
- /**
6
- *
7
- */
8
- export class DecisionItemVanilla {
9
- updateHasChildren(node) {
10
- const currentlyHasChildren = node.childCount > 0;
11
- if (currentlyHasChildren !== this.hasChildren) {
12
- var _this$contentDOM;
13
- this.hasChildren = currentlyHasChildren;
14
- (_this$contentDOM = this.contentDOM) === null || _this$contentDOM === void 0 ? void 0 : _this$contentDOM.toggleAttribute('data-empty', !currentlyHasChildren);
15
- }
16
- return this.hasChildren;
17
- }
18
-
19
- /**
20
- *
21
- * @param node
22
- * @param intl
23
- * @example
24
- */
25
- constructor(node, intl) {
26
- _defineProperty(this, "hasChildren", undefined);
27
- const spec = decisionItemToDOM(node, intl);
28
- const {
29
- dom,
30
- contentDOM
31
- } = DOMSerializer.renderSpec(document, spec);
32
- this.dom = dom;
33
- this.contentDOM = contentDOM;
34
- }
35
-
36
- /**
37
- *
38
- * @param node
39
- * @example
40
- */
41
- update(node) {
42
- this.updateHasChildren(node);
43
- return true;
44
- }
45
- }
@@ -1,21 +0,0 @@
1
- import { withLazyLoading } from '@atlaskit/editor-common/lazy-node-view';
2
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
3
- import { decisionItemNodeView } from './decisionItem';
4
- export const lazyDecisionView = (portalProviderAPI, eventDispatcher, api) => {
5
- if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
6
- return decisionItemNodeView(portalProviderAPI, eventDispatcher, api);
7
- }
8
- return withLazyLoading({
9
- nodeName: 'decisionItem',
10
- getNodeViewOptions: () => {},
11
- loader: () => {
12
- const result = import( /* webpackChunkName: "@atlaskit-internal_editor-plugin-tasks-and-decisions_decision-item-nodeview" */
13
- './decisionItem').then(({
14
- decisionItemNodeView
15
- }) => {
16
- return decisionItemNodeView(portalProviderAPI, eventDispatcher, api);
17
- });
18
- return result;
19
- }
20
- });
21
- };
@@ -1,74 +0,0 @@
1
- import React from 'react';
2
- import ReactNodeView from '@atlaskit/editor-common/react-node-view';
3
- import DecisionItem from '../ui/Decision';
4
- import { useShowPlaceholder } from './hooks/use-show-placeholder';
5
- const DecisionItemWrapper = ({
6
- api,
7
- editorView,
8
- forwardRef,
9
- isContentNodeEmpty,
10
- getPos
11
- }) => {
12
- const showPlaceholder = useShowPlaceholder({
13
- editorView,
14
- isContentNodeEmpty,
15
- getPos,
16
- api
17
- });
18
- return /*#__PURE__*/React.createElement(DecisionItem, {
19
- contentRef: forwardRef,
20
- showPlaceholder: showPlaceholder
21
- });
22
- };
23
- class Decision extends ReactNodeView {
24
- isContentEmpty(node) {
25
- return node.content.childCount === 0;
26
- }
27
- initWithAPI(api) {
28
- this.api = api;
29
- this.init();
30
- return this;
31
- }
32
- createDomRef() {
33
- const domRef = document.createElement('li');
34
- domRef.style.listStyleType = 'none';
35
- return domRef;
36
- }
37
- getContentDOM() {
38
- const dom = document.createElement('div');
39
- // setting a className prevents PM/Chrome mutation observer from
40
- // incorrectly deleting nodes
41
- dom.className = 'decision-item';
42
- return {
43
- dom
44
- };
45
- }
46
- render(_props, forwardRef) {
47
- const isContentNodeEmpty = this.isContentEmpty(this.node);
48
- return /*#__PURE__*/React.createElement(DecisionItemWrapper, {
49
- forwardRef: forwardRef,
50
- isContentNodeEmpty: isContentNodeEmpty,
51
- api: this.api
52
- // The getPosHandler type is wrong, there is no `boolean` in the real implementation
53
- // @ts-expect-error 2322: Type 'getPosHandler' is not assignable to type '() => number | undefined'.
54
- ,
55
- getPos: this.getPos,
56
- editorView: this.view
57
- });
58
- }
59
- viewShouldUpdate(nextNode) {
60
- return this.isContentEmpty(this.node) && !this.isContentEmpty(nextNode) || this.isContentEmpty(nextNode) && !this.isContentEmpty(this.node);
61
- }
62
- update(node, decorations) {
63
- return super.update(node, decorations);
64
- }
65
- ignoreMutation(mutation) {
66
- if (!this.contentDOM) {
67
- return true;
68
- }
69
- return !this.contentDOM.contains(mutation.target) && mutation.type !== 'selection';
70
- }
71
- }
72
- export const decisionItemNodeView = (portalProviderAPI, eventDispatcher, api) => (node, view, getPos) => {
73
- return new Decision(node, view, getPos, portalProviderAPI, eventDispatcher, {}).initWithAPI(api);
74
- };
@@ -1,20 +0,0 @@
1
- import React from 'react';
2
- import { injectIntl } from 'react-intl-next';
3
- import { tasksAndDecisionsMessages } from '@atlaskit/editor-common/messages';
4
- import { DecisionItem } from '@atlaskit/task-decision';
5
- export const Decision = ({
6
- contentRef,
7
- showPlaceholder,
8
- intl: {
9
- formatMessage
10
- }
11
- }) => {
12
- const placeholder = formatMessage(tasksAndDecisionsMessages.decisionPlaceholder);
13
- return /*#__PURE__*/React.createElement(DecisionItem, {
14
- contentRef: contentRef,
15
- placeholder: placeholder,
16
- showPlaceholder: showPlaceholder
17
- });
18
- };
19
- Decision.displayName = 'Decision';
20
- export default injectIntl(Decision);
@@ -1,51 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
5
- import { decisionItemToDOM } from './decisionItemNodeSpec';
6
-
7
- /**
8
- *
9
- */
10
- export var DecisionItemVanilla = /*#__PURE__*/function () {
11
- /**
12
- *
13
- * @param node
14
- * @param intl
15
- * @example
16
- */
17
- function DecisionItemVanilla(node, intl) {
18
- _classCallCheck(this, DecisionItemVanilla);
19
- _defineProperty(this, "hasChildren", undefined);
20
- var spec = decisionItemToDOM(node, intl);
21
- var _DOMSerializer$render = DOMSerializer.renderSpec(document, spec),
22
- dom = _DOMSerializer$render.dom,
23
- contentDOM = _DOMSerializer$render.contentDOM;
24
- this.dom = dom;
25
- this.contentDOM = contentDOM;
26
- }
27
-
28
- /**
29
- *
30
- * @param node
31
- * @example
32
- */
33
- return _createClass(DecisionItemVanilla, [{
34
- key: "updateHasChildren",
35
- value: function updateHasChildren(node) {
36
- var currentlyHasChildren = node.childCount > 0;
37
- if (currentlyHasChildren !== this.hasChildren) {
38
- var _this$contentDOM;
39
- this.hasChildren = currentlyHasChildren;
40
- (_this$contentDOM = this.contentDOM) === null || _this$contentDOM === void 0 || _this$contentDOM.toggleAttribute('data-empty', !currentlyHasChildren);
41
- }
42
- return this.hasChildren;
43
- }
44
- }, {
45
- key: "update",
46
- value: function update(node) {
47
- this.updateHasChildren(node);
48
- return true;
49
- }
50
- }]);
51
- }();
@@ -1,20 +0,0 @@
1
- import { withLazyLoading } from '@atlaskit/editor-common/lazy-node-view';
2
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
3
- import { decisionItemNodeView } from './decisionItem';
4
- export var lazyDecisionView = function lazyDecisionView(portalProviderAPI, eventDispatcher, api) {
5
- if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
6
- return decisionItemNodeView(portalProviderAPI, eventDispatcher, api);
7
- }
8
- return withLazyLoading({
9
- nodeName: 'decisionItem',
10
- getNodeViewOptions: function getNodeViewOptions() {},
11
- loader: function loader() {
12
- var result = import( /* webpackChunkName: "@atlaskit-internal_editor-plugin-tasks-and-decisions_decision-item-nodeview" */
13
- './decisionItem').then(function (_ref) {
14
- var decisionItemNodeView = _ref.decisionItemNodeView;
15
- return decisionItemNodeView(portalProviderAPI, eventDispatcher, api);
16
- });
17
- return result;
18
- }
19
- });
20
- };
@@ -1,106 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
4
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
5
- import _get from "@babel/runtime/helpers/get";
6
- import _inherits from "@babel/runtime/helpers/inherits";
7
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
8
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
9
- function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
10
- import React from 'react';
11
- import ReactNodeView from '@atlaskit/editor-common/react-node-view';
12
- import DecisionItem from '../ui/Decision';
13
- import { useShowPlaceholder } from './hooks/use-show-placeholder';
14
- var DecisionItemWrapper = function DecisionItemWrapper(_ref) {
15
- var api = _ref.api,
16
- editorView = _ref.editorView,
17
- forwardRef = _ref.forwardRef,
18
- isContentNodeEmpty = _ref.isContentNodeEmpty,
19
- getPos = _ref.getPos;
20
- var showPlaceholder = useShowPlaceholder({
21
- editorView: editorView,
22
- isContentNodeEmpty: isContentNodeEmpty,
23
- getPos: getPos,
24
- api: api
25
- });
26
- return /*#__PURE__*/React.createElement(DecisionItem, {
27
- contentRef: forwardRef,
28
- showPlaceholder: showPlaceholder
29
- });
30
- };
31
- var Decision = /*#__PURE__*/function (_ReactNodeView) {
32
- function Decision() {
33
- _classCallCheck(this, Decision);
34
- return _callSuper(this, Decision, arguments);
35
- }
36
- _inherits(Decision, _ReactNodeView);
37
- return _createClass(Decision, [{
38
- key: "isContentEmpty",
39
- value: function isContentEmpty(node) {
40
- return node.content.childCount === 0;
41
- }
42
- }, {
43
- key: "initWithAPI",
44
- value: function initWithAPI(api) {
45
- this.api = api;
46
- this.init();
47
- return this;
48
- }
49
- }, {
50
- key: "createDomRef",
51
- value: function createDomRef() {
52
- var domRef = document.createElement('li');
53
- domRef.style.listStyleType = 'none';
54
- return domRef;
55
- }
56
- }, {
57
- key: "getContentDOM",
58
- value: function getContentDOM() {
59
- var dom = document.createElement('div');
60
- // setting a className prevents PM/Chrome mutation observer from
61
- // incorrectly deleting nodes
62
- dom.className = 'decision-item';
63
- return {
64
- dom: dom
65
- };
66
- }
67
- }, {
68
- key: "render",
69
- value: function render(_props, forwardRef) {
70
- var isContentNodeEmpty = this.isContentEmpty(this.node);
71
- return /*#__PURE__*/React.createElement(DecisionItemWrapper, {
72
- forwardRef: forwardRef,
73
- isContentNodeEmpty: isContentNodeEmpty,
74
- api: this.api
75
- // The getPosHandler type is wrong, there is no `boolean` in the real implementation
76
- // @ts-expect-error 2322: Type 'getPosHandler' is not assignable to type '() => number | undefined'.
77
- ,
78
- getPos: this.getPos,
79
- editorView: this.view
80
- });
81
- }
82
- }, {
83
- key: "viewShouldUpdate",
84
- value: function viewShouldUpdate(nextNode) {
85
- return this.isContentEmpty(this.node) && !this.isContentEmpty(nextNode) || this.isContentEmpty(nextNode) && !this.isContentEmpty(this.node);
86
- }
87
- }, {
88
- key: "update",
89
- value: function update(node, decorations) {
90
- return _superPropGet(Decision, "update", this, 3)([node, decorations]);
91
- }
92
- }, {
93
- key: "ignoreMutation",
94
- value: function ignoreMutation(mutation) {
95
- if (!this.contentDOM) {
96
- return true;
97
- }
98
- return !this.contentDOM.contains(mutation.target) && mutation.type !== 'selection';
99
- }
100
- }]);
101
- }(ReactNodeView);
102
- export var decisionItemNodeView = function decisionItemNodeView(portalProviderAPI, eventDispatcher, api) {
103
- return function (node, view, getPos) {
104
- return new Decision(node, view, getPos, portalProviderAPI, eventDispatcher, {}).initWithAPI(api);
105
- };
106
- };
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- import { injectIntl } from 'react-intl-next';
3
- import { tasksAndDecisionsMessages } from '@atlaskit/editor-common/messages';
4
- import { DecisionItem } from '@atlaskit/task-decision';
5
- export var Decision = function Decision(_ref) {
6
- var contentRef = _ref.contentRef,
7
- showPlaceholder = _ref.showPlaceholder,
8
- formatMessage = _ref.intl.formatMessage;
9
- var placeholder = formatMessage(tasksAndDecisionsMessages.decisionPlaceholder);
10
- return /*#__PURE__*/React.createElement(DecisionItem, {
11
- contentRef: contentRef,
12
- placeholder: placeholder,
13
- showPlaceholder: showPlaceholder
14
- });
15
- };
16
- Decision.displayName = 'Decision';
17
- export default injectIntl(Decision);
@@ -1,25 +0,0 @@
1
- import { type IntlShape } from 'react-intl-next';
2
- import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
- import { type NodeView } from '@atlaskit/editor-prosemirror/view';
4
- /**
5
- *
6
- */
7
- export declare class DecisionItemVanilla implements NodeView {
8
- dom: Node;
9
- contentDOM?: HTMLElement;
10
- private hasChildren;
11
- private updateHasChildren;
12
- /**
13
- *
14
- * @param node
15
- * @param intl
16
- * @example
17
- */
18
- constructor(node: PMNode, intl: IntlShape);
19
- /**
20
- *
21
- * @param node
22
- * @example
23
- */
24
- update(node: PMNode): boolean;
25
- }
@@ -1,5 +0,0 @@
1
- import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
2
- import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
- import type { TasksAndDecisionsPlugin } from '../tasksAndDecisionsPluginType';
5
- export declare const lazyDecisionView: (portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, api: ExtractInjectionAPI<TasksAndDecisionsPlugin> | undefined) => import("@atlaskit/editor-common/lazy-node-view").NodeViewConstructor;
@@ -1,10 +0,0 @@
1
- import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
2
- import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
- import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
5
- import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
6
- import type { TasksAndDecisionsPlugin } from '../tasksAndDecisionsPluginType';
7
- type getPosHandler = getPosHandlerNode | boolean;
8
- type getPosHandlerNode = () => number | undefined;
9
- export declare const decisionItemNodeView: (portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, api: ExtractInjectionAPI<TasksAndDecisionsPlugin> | undefined) => (node: PMNode, view: EditorView, getPos: getPosHandler) => NodeView;
10
- export {};
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- import type { WrappedComponentProps } from 'react-intl-next';
3
- import type { ContentRef } from '@atlaskit/task-decision';
4
- interface Props {
5
- contentRef: ContentRef;
6
- showPlaceholder?: boolean;
7
- }
8
- export declare const Decision: {
9
- ({ contentRef, showPlaceholder, intl: { formatMessage }, }: Props & WrappedComponentProps): React.JSX.Element;
10
- displayName: string;
11
- };
12
- declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps>> & {
13
- WrappedComponent: React.ComponentType<Props & WrappedComponentProps>;
14
- };
15
- export default _default;
@@ -1,25 +0,0 @@
1
- import { type IntlShape } from 'react-intl-next';
2
- import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
- import { type NodeView } from '@atlaskit/editor-prosemirror/view';
4
- /**
5
- *
6
- */
7
- export declare class DecisionItemVanilla implements NodeView {
8
- dom: Node;
9
- contentDOM?: HTMLElement;
10
- private hasChildren;
11
- private updateHasChildren;
12
- /**
13
- *
14
- * @param node
15
- * @param intl
16
- * @example
17
- */
18
- constructor(node: PMNode, intl: IntlShape);
19
- /**
20
- *
21
- * @param node
22
- * @example
23
- */
24
- update(node: PMNode): boolean;
25
- }
@@ -1,5 +0,0 @@
1
- import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
2
- import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
- import type { TasksAndDecisionsPlugin } from '../tasksAndDecisionsPluginType';
5
- export declare const lazyDecisionView: (portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, api: ExtractInjectionAPI<TasksAndDecisionsPlugin> | undefined) => import("@atlaskit/editor-common/lazy-node-view").NodeViewConstructor;
@@ -1,10 +0,0 @@
1
- import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
2
- import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
- import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
5
- import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
6
- import type { TasksAndDecisionsPlugin } from '../tasksAndDecisionsPluginType';
7
- type getPosHandler = getPosHandlerNode | boolean;
8
- type getPosHandlerNode = () => number | undefined;
9
- export declare const decisionItemNodeView: (portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, api: ExtractInjectionAPI<TasksAndDecisionsPlugin> | undefined) => (node: PMNode, view: EditorView, getPos: getPosHandler) => NodeView;
10
- export {};
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- import type { WrappedComponentProps } from 'react-intl-next';
3
- import type { ContentRef } from '@atlaskit/task-decision';
4
- interface Props {
5
- contentRef: ContentRef;
6
- showPlaceholder?: boolean;
7
- }
8
- export declare const Decision: {
9
- ({ contentRef, showPlaceholder, intl: { formatMessage }, }: Props & WrappedComponentProps): React.JSX.Element;
10
- displayName: string;
11
- };
12
- declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps>> & {
13
- WrappedComponent: React.ComponentType<Props & WrappedComponentProps>;
14
- };
15
- export default _default;