@atlaskit/editor-plugin-synced-block 4.1.2 → 4.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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-plugin-synced-block
2
2
 
3
+ ## 4.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`7bb84f91500cf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7bb84f91500cf) -
8
+ [ux] EDITOR-2442 update warning modal on source sync block deletion
9
+ - Updated dependencies
10
+
3
11
  ## 4.1.2
4
12
 
5
13
  ### Patch Changes
@@ -8,8 +8,11 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.DeleteConfirmationModal = void 0;
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
10
  var _react = _interopRequireWildcard(require("react"));
11
+ var _reactIntlNext = require("react-intl-next");
11
12
  var _new = _interopRequireDefault(require("@atlaskit/button/new"));
13
+ var _messages = require("@atlaskit/editor-common/messages");
12
14
  var _modalDialog = _interopRequireWildcard(require("@atlaskit/modal-dialog"));
15
+ var _compiled = require("@atlaskit/primitives/compiled");
13
16
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
14
17
  var DeleteConfirmationModal = exports.DeleteConfirmationModal = function DeleteConfirmationModal(_ref) {
15
18
  var syncBlockStoreManager = _ref.syncBlockStoreManager;
@@ -17,6 +20,12 @@ var DeleteConfirmationModal = exports.DeleteConfirmationModal = function DeleteC
17
20
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
18
21
  isOpen = _useState2[0],
19
22
  setIsOpen = _useState2[1];
23
+ var _useState3 = (0, _react.useState)(1),
24
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
25
+ syncBlockCount = _useState4[0],
26
+ setSyncBlockCount = _useState4[1];
27
+ var _useIntl = (0, _reactIntlNext.useIntl)(),
28
+ formatMessage = _useIntl.formatMessage;
20
29
  var resolverRef = _react.default.useRef(undefined);
21
30
  var handleClose = (0, _react.useCallback)(function (confirm) {
22
31
  return function () {
@@ -27,8 +36,9 @@ var DeleteConfirmationModal = exports.DeleteConfirmationModal = function DeleteC
27
36
  setIsOpen(false);
28
37
  };
29
38
  }, []);
30
- var confirmationCallback = (0, _react.useCallback)(function () {
39
+ var confirmationCallback = (0, _react.useCallback)(function (syncBlockCount) {
31
40
  setIsOpen(true);
41
+ setSyncBlockCount(syncBlockCount);
32
42
  var confirmedPromise = new Promise(function (resolve) {
33
43
  resolverRef.current = resolve;
34
44
  });
@@ -44,12 +54,16 @@ var DeleteConfirmationModal = exports.DeleteConfirmationModal = function DeleteC
44
54
  onClose: handleClose(false)
45
55
  }, /*#__PURE__*/_react.default.createElement(_modalDialog.ModalHeader, {
46
56
  hasCloseButton: true
47
- }, /*#__PURE__*/_react.default.createElement(_modalDialog.ModalTitle, null, "Confirmation")), /*#__PURE__*/_react.default.createElement(_modalDialog.ModalBody, null, /*#__PURE__*/_react.default.createElement("div", null, "Are you sure you want to delete this synced block?")), /*#__PURE__*/_react.default.createElement(_modalDialog.ModalFooter, null, /*#__PURE__*/_react.default.createElement(_new.default, {
57
+ }, /*#__PURE__*/_react.default.createElement(_modalDialog.ModalTitle, {
58
+ appearance: "warning"
59
+ }, formatMessage(_messages.syncBlockMessages.deleteConfirmationModalTitle))), /*#__PURE__*/_react.default.createElement(_modalDialog.ModalBody, null, /*#__PURE__*/_react.default.createElement(_compiled.Text, null, formatMessage(_messages.syncBlockMessages.deleteConfirmationModalDescription, {
60
+ syncBlockCount: syncBlockCount
61
+ }))), /*#__PURE__*/_react.default.createElement(_modalDialog.ModalFooter, null, /*#__PURE__*/_react.default.createElement(_new.default, {
48
62
  appearance: "subtle",
49
63
  onClick: handleClose(false)
50
- }, "Cancel"), /*#__PURE__*/_react.default.createElement(_new.default, {
51
- appearance: "danger",
64
+ }, formatMessage(_messages.syncBlockMessages.deleteConfirmationModalCancelButton)), /*#__PURE__*/_react.default.createElement(_new.default, {
65
+ appearance: "warning",
52
66
  onClick: handleClose(true),
53
67
  autoFocus: true
54
- }, "Delete"))));
68
+ }, formatMessage(_messages.syncBlockMessages.deleteConfirmationModalDeleteButton)))));
55
69
  };
@@ -1,10 +1,17 @@
1
1
  import React, { useCallback, useEffect, useState } from 'react';
2
+ import { useIntl } from 'react-intl-next';
2
3
  import Button from '@atlaskit/button/new';
4
+ import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
3
5
  import ModalDialog, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
6
+ import { Text } from '@atlaskit/primitives/compiled';
4
7
  export const DeleteConfirmationModal = ({
5
8
  syncBlockStoreManager
6
9
  }) => {
7
10
  const [isOpen, setIsOpen] = useState(false);
11
+ const [syncBlockCount, setSyncBlockCount] = useState(1);
12
+ const {
13
+ formatMessage
14
+ } = useIntl();
8
15
  const resolverRef = React.useRef(undefined);
9
16
  const handleClose = useCallback(confirm => () => {
10
17
  if (resolverRef.current) {
@@ -13,8 +20,9 @@ export const DeleteConfirmationModal = ({
13
20
  }
14
21
  setIsOpen(false);
15
22
  }, []);
16
- const confirmationCallback = useCallback(() => {
23
+ const confirmationCallback = useCallback(syncBlockCount => {
17
24
  setIsOpen(true);
25
+ setSyncBlockCount(syncBlockCount);
18
26
  const confirmedPromise = new Promise(resolve => {
19
27
  resolverRef.current = resolve;
20
28
  });
@@ -30,12 +38,16 @@ export const DeleteConfirmationModal = ({
30
38
  onClose: handleClose(false)
31
39
  }, /*#__PURE__*/React.createElement(ModalHeader, {
32
40
  hasCloseButton: true
33
- }, /*#__PURE__*/React.createElement(ModalTitle, null, "Confirmation")), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement("div", null, "Are you sure you want to delete this synced block?")), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
41
+ }, /*#__PURE__*/React.createElement(ModalTitle, {
42
+ appearance: "warning"
43
+ }, formatMessage(messages.deleteConfirmationModalTitle))), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(Text, null, formatMessage(messages.deleteConfirmationModalDescription, {
44
+ syncBlockCount
45
+ }))), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
34
46
  appearance: "subtle",
35
47
  onClick: handleClose(false)
36
- }, "Cancel"), /*#__PURE__*/React.createElement(Button, {
37
- appearance: "danger",
48
+ }, formatMessage(messages.deleteConfirmationModalCancelButton)), /*#__PURE__*/React.createElement(Button, {
49
+ appearance: "warning",
38
50
  onClick: handleClose(true),
39
51
  autoFocus: true
40
- }, "Delete"))));
52
+ }, formatMessage(messages.deleteConfirmationModalDeleteButton)))));
41
53
  };
@@ -1,13 +1,22 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import React, { useCallback, useEffect, useState } from 'react';
3
+ import { useIntl } from 'react-intl-next';
3
4
  import Button from '@atlaskit/button/new';
5
+ import { syncBlockMessages as messages } from '@atlaskit/editor-common/messages';
4
6
  import ModalDialog, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
7
+ import { Text } from '@atlaskit/primitives/compiled';
5
8
  export var DeleteConfirmationModal = function DeleteConfirmationModal(_ref) {
6
9
  var syncBlockStoreManager = _ref.syncBlockStoreManager;
7
10
  var _useState = useState(false),
8
11
  _useState2 = _slicedToArray(_useState, 2),
9
12
  isOpen = _useState2[0],
10
13
  setIsOpen = _useState2[1];
14
+ var _useState3 = useState(1),
15
+ _useState4 = _slicedToArray(_useState3, 2),
16
+ syncBlockCount = _useState4[0],
17
+ setSyncBlockCount = _useState4[1];
18
+ var _useIntl = useIntl(),
19
+ formatMessage = _useIntl.formatMessage;
11
20
  var resolverRef = React.useRef(undefined);
12
21
  var handleClose = useCallback(function (confirm) {
13
22
  return function () {
@@ -18,8 +27,9 @@ export var DeleteConfirmationModal = function DeleteConfirmationModal(_ref) {
18
27
  setIsOpen(false);
19
28
  };
20
29
  }, []);
21
- var confirmationCallback = useCallback(function () {
30
+ var confirmationCallback = useCallback(function (syncBlockCount) {
22
31
  setIsOpen(true);
32
+ setSyncBlockCount(syncBlockCount);
23
33
  var confirmedPromise = new Promise(function (resolve) {
24
34
  resolverRef.current = resolve;
25
35
  });
@@ -35,12 +45,16 @@ export var DeleteConfirmationModal = function DeleteConfirmationModal(_ref) {
35
45
  onClose: handleClose(false)
36
46
  }, /*#__PURE__*/React.createElement(ModalHeader, {
37
47
  hasCloseButton: true
38
- }, /*#__PURE__*/React.createElement(ModalTitle, null, "Confirmation")), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement("div", null, "Are you sure you want to delete this synced block?")), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
48
+ }, /*#__PURE__*/React.createElement(ModalTitle, {
49
+ appearance: "warning"
50
+ }, formatMessage(messages.deleteConfirmationModalTitle))), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(Text, null, formatMessage(messages.deleteConfirmationModalDescription, {
51
+ syncBlockCount: syncBlockCount
52
+ }))), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
39
53
  appearance: "subtle",
40
54
  onClick: handleClose(false)
41
- }, "Cancel"), /*#__PURE__*/React.createElement(Button, {
42
- appearance: "danger",
55
+ }, formatMessage(messages.deleteConfirmationModalCancelButton)), /*#__PURE__*/React.createElement(Button, {
56
+ appearance: "warning",
43
57
  onClick: handleClose(true),
44
58
  autoFocus: true
45
- }, "Delete"))));
59
+ }, formatMessage(messages.deleteConfirmationModalDeleteButton)))));
46
60
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-synced-block",
3
- "version": "4.1.2",
3
+ "version": "4.1.3",
4
4
  "description": "SyncedBlock plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",