@atlaskit/editor-plugin-alignment 1.0.2 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/editor-plugin-alignment
2
2
 
3
+ ## 1.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#80679](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/80679) [`104eb9443b7e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/104eb9443b7e) - ED-22553 Updating adf-schema version to 35.6.0
8
+
9
+ ## 1.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#77222](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/77222) [`b924ab2b79f3`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b924ab2b79f3) - [ux] Add keyboard shortcuts for center and right text alignment
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies
18
+
3
19
  ## 1.0.2
4
20
 
5
21
  ### Patch Changes
@@ -6,9 +6,14 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.keymapPlugin = keymapPlugin;
7
7
  var _keymaps = require("@atlaskit/editor-common/keymaps");
8
8
  var _keymap = require("@atlaskit/editor-prosemirror/keymap");
9
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
9
10
  var _commands = require("../commands");
10
11
  function keymapPlugin() {
11
12
  var list = {};
12
13
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.alignLeft.common, (0, _commands.changeAlignment)('start'), list);
14
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.text-alignment-keyboard-shortcuts')) {
15
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.alignCenter.common, (0, _commands.changeAlignment)('center'), list);
16
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.alignRight.common, (0, _commands.changeAlignment)('end'), list);
17
+ }
13
18
  return (0, _keymap.keymap)(list);
14
19
  }
@@ -1,5 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
1
+ "use strict";
@@ -9,20 +9,29 @@ var _react = require("@emotion/react");
9
9
  var _reactIntlNext = require("react-intl-next");
10
10
  var _keymaps = require("@atlaskit/editor-common/keymaps");
11
11
  var _messages = require("@atlaskit/editor-common/messages");
12
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
13
  var _iconMap = require("../ToolbarAlignment/icon-map");
13
14
  var _AlignmentButton = _interopRequireDefault(require("./AlignmentButton"));
14
15
  var _styles = require("./styles");
15
16
  /** @jsx jsx */
16
17
 
18
+ var alignCenterKeyboardShortcut;
19
+ var alignRightKeyboardShortcut;
20
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.text-alignment-keyboard-shortcuts')) {
21
+ alignCenterKeyboardShortcut = _keymaps.alignCenter;
22
+ alignRightKeyboardShortcut = _keymaps.alignRight;
23
+ }
17
24
  var alignmentOptions = [{
18
25
  title: _messages.alignmentMessages.alignLeft,
19
26
  shortcut: _keymaps.alignLeft,
20
27
  value: 'start'
21
28
  }, {
22
29
  title: _messages.alignmentMessages.alignCenter,
30
+ shortcut: alignCenterKeyboardShortcut,
23
31
  value: 'center'
24
32
  }, {
25
33
  title: _messages.alignmentMessages.alignRight,
34
+ shortcut: alignRightKeyboardShortcut,
26
35
  value: 'end'
27
36
  }];
28
37
  function Alignment(_ref) {
@@ -10,8 +10,8 @@ var _react = _interopRequireWildcard(require("react"));
10
10
  var _hooks = require("@atlaskit/editor-common/hooks");
11
11
  var _commands = require("../commands");
12
12
  var _ToolbarAlignment = _interopRequireDefault(require("./ToolbarAlignment"));
13
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
14
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15
15
  function PrimaryToolbarComponent(_ref) {
16
16
  var api = _ref.api,
17
17
  editorView = _ref.editorView,
@@ -23,7 +23,7 @@ var _Alignment = _interopRequireDefault(require("../Alignment"));
23
23
  var _iconMap = require("./icon-map");
24
24
  var _styles2 = require("./styles");
25
25
  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); }; }
26
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
26
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** @jsx jsx */
27
27
  // eslint-disable-next-line @repo/internal/react/no-class-components
28
28
  var AlignmentToolbar = exports.AlignmentToolbar = /*#__PURE__*/function (_React$Component) {
29
29
  (0, _inherits2.default)(AlignmentToolbar, _React$Component);
@@ -1,8 +1,13 @@
1
- import { alignLeft, bindKeymapWithCommand } from '@atlaskit/editor-common/keymaps';
1
+ import { alignCenter, alignLeft, alignRight, bindKeymapWithCommand } from '@atlaskit/editor-common/keymaps';
2
2
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
3
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
3
4
  import { changeAlignment } from '../commands';
4
5
  export function keymapPlugin() {
5
6
  const list = {};
6
7
  bindKeymapWithCommand(alignLeft.common, changeAlignment('start'), list);
8
+ if (getBooleanFF('platform.editor.text-alignment-keyboard-shortcuts')) {
9
+ bindKeymapWithCommand(alignCenter.common, changeAlignment('center'), list);
10
+ bindKeymapWithCommand(alignRight.common, changeAlignment('end'), list);
11
+ }
7
12
  return keymap(list);
8
13
  }
@@ -1 +0,0 @@
1
- export {};
@@ -1,20 +1,29 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
3
  import { injectIntl } from 'react-intl-next';
4
- import { alignLeft } from '@atlaskit/editor-common/keymaps';
4
+ import { alignCenter, alignLeft, alignRight } from '@atlaskit/editor-common/keymaps';
5
5
  import { alignmentMessages } from '@atlaskit/editor-common/messages';
6
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
6
7
  import { IconMap } from '../ToolbarAlignment/icon-map';
7
8
  import AlignmentButton from './AlignmentButton';
8
9
  import { alignmentWrapper } from './styles';
10
+ let alignCenterKeyboardShortcut;
11
+ let alignRightKeyboardShortcut;
12
+ if (getBooleanFF('platform.editor.text-alignment-keyboard-shortcuts')) {
13
+ alignCenterKeyboardShortcut = alignCenter;
14
+ alignRightKeyboardShortcut = alignRight;
15
+ }
9
16
  const alignmentOptions = [{
10
17
  title: alignmentMessages.alignLeft,
11
18
  shortcut: alignLeft,
12
19
  value: 'start'
13
20
  }, {
14
21
  title: alignmentMessages.alignCenter,
22
+ shortcut: alignCenterKeyboardShortcut,
15
23
  value: 'center'
16
24
  }, {
17
25
  title: alignmentMessages.alignRight,
26
+ shortcut: alignRightKeyboardShortcut,
18
27
  value: 'end'
19
28
  }];
20
29
  function Alignment({
@@ -1,8 +1,13 @@
1
- import { alignLeft, bindKeymapWithCommand } from '@atlaskit/editor-common/keymaps';
1
+ import { alignCenter, alignLeft, alignRight, bindKeymapWithCommand } from '@atlaskit/editor-common/keymaps';
2
2
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
3
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
3
4
  import { changeAlignment } from '../commands';
4
5
  export function keymapPlugin() {
5
6
  var list = {};
6
7
  bindKeymapWithCommand(alignLeft.common, changeAlignment('start'), list);
8
+ if (getBooleanFF('platform.editor.text-alignment-keyboard-shortcuts')) {
9
+ bindKeymapWithCommand(alignCenter.common, changeAlignment('center'), list);
10
+ bindKeymapWithCommand(alignRight.common, changeAlignment('end'), list);
11
+ }
7
12
  return keymap(list);
8
13
  }
@@ -1 +0,0 @@
1
- export {};
@@ -1,20 +1,29 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
3
  import { injectIntl } from 'react-intl-next';
4
- import { alignLeft } from '@atlaskit/editor-common/keymaps';
4
+ import { alignCenter, alignLeft, alignRight } from '@atlaskit/editor-common/keymaps';
5
5
  import { alignmentMessages } from '@atlaskit/editor-common/messages';
6
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
6
7
  import { IconMap } from '../ToolbarAlignment/icon-map';
7
8
  import AlignmentButton from './AlignmentButton';
8
9
  import { alignmentWrapper } from './styles';
10
+ var alignCenterKeyboardShortcut;
11
+ var alignRightKeyboardShortcut;
12
+ if (getBooleanFF('platform.editor.text-alignment-keyboard-shortcuts')) {
13
+ alignCenterKeyboardShortcut = alignCenter;
14
+ alignRightKeyboardShortcut = alignRight;
15
+ }
9
16
  var alignmentOptions = [{
10
17
  title: alignmentMessages.alignLeft,
11
18
  shortcut: alignLeft,
12
19
  value: 'start'
13
20
  }, {
14
21
  title: alignmentMessages.alignCenter,
22
+ shortcut: alignCenterKeyboardShortcut,
15
23
  value: 'center'
16
24
  }, {
17
25
  title: alignmentMessages.alignRight,
26
+ shortcut: alignRightKeyboardShortcut,
18
27
  value: 'end'
19
28
  }];
20
29
  function Alignment(_ref) {
@@ -6,7 +6,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
6
6
  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
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
9
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
10
10
  /** @jsx jsx */
11
11
  import React from 'react';
12
12
  import { jsx } from '@emotion/react';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-alignment",
3
- "version": "1.0.2",
3
+ "version": "1.1.1",
4
4
  "description": "Alignment plugin for @atlaskit/editor-core",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -21,12 +21,13 @@
21
21
  "runReact18": false
22
22
  },
23
23
  "dependencies": {
24
- "@atlaskit/adf-schema": "^35.5.2",
25
- "@atlaskit/editor-common": "^78.10.0",
24
+ "@atlaskit/adf-schema": "^35.6.0",
25
+ "@atlaskit/editor-common": "^78.12.0",
26
26
  "@atlaskit/editor-prosemirror": "3.0.0",
27
27
  "@atlaskit/editor-tables": "^2.5.0",
28
28
  "@atlaskit/icon": "^22.1.0",
29
- "@atlaskit/tokens": "^1.39.0",
29
+ "@atlaskit/platform-feature-flags": "^0.2.0",
30
+ "@atlaskit/tokens": "^1.41.0",
30
31
  "@babel/runtime": "^7.0.0",
31
32
  "@emotion/react": "^11.7.1"
32
33
  },
@@ -93,5 +94,10 @@
93
94
  "af:exports": {
94
95
  ".": "./src/index.ts"
95
96
  },
96
- "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
97
+ "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0",
98
+ "platform-feature-flags": {
99
+ "platform.editor.text-alignment-keyboard-shortcuts": {
100
+ "type": "boolean"
101
+ }
102
+ }
97
103
  }