@atlaskit/editor-core 190.1.6 → 190.1.8

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 (155) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/afm-cc/tsconfig.json +3 -0
  3. package/dist/cjs/plugins/index.js +0 -28
  4. package/dist/cjs/presets/universal.js +2 -16
  5. package/dist/cjs/ui/Addon/ClickAreaInline/index.js +1 -1
  6. package/dist/cjs/ui/AppearanceComponents/Mobile.js +3 -0
  7. package/dist/cjs/utils/action.js +0 -28
  8. package/dist/cjs/version-wrapper.js +1 -1
  9. package/dist/es2019/plugins/index.js +0 -4
  10. package/dist/es2019/presets/universal.js +2 -16
  11. package/dist/es2019/ui/Addon/ClickAreaInline/index.js +1 -1
  12. package/dist/es2019/ui/AppearanceComponents/Mobile.js +4 -0
  13. package/dist/es2019/utils/action.js +0 -28
  14. package/dist/es2019/version-wrapper.js +1 -1
  15. package/dist/esm/plugins/index.js +0 -4
  16. package/dist/esm/presets/universal.js +2 -16
  17. package/dist/esm/ui/Addon/ClickAreaInline/index.js +1 -1
  18. package/dist/esm/ui/AppearanceComponents/Mobile.js +4 -0
  19. package/dist/esm/utils/action.js +0 -28
  20. package/dist/esm/version-wrapper.js +1 -1
  21. package/dist/types/plugins/index.d.ts +0 -4
  22. package/dist/types/utils/action.d.ts +0 -6
  23. package/dist/types-ts4.5/plugins/index.d.ts +0 -4
  24. package/dist/types-ts4.5/utils/action.d.ts +0 -6
  25. package/package.json +2 -1
  26. package/dist/cjs/commands/index.js +0 -42
  27. package/dist/cjs/plugins/alignment/commands/index.js +0 -36
  28. package/dist/cjs/plugins/alignment/index.js +0 -70
  29. package/dist/cjs/plugins/alignment/pm-plugins/keymap.js +0 -14
  30. package/dist/cjs/plugins/alignment/pm-plugins/main.js +0 -45
  31. package/dist/cjs/plugins/alignment/pm-plugins/types.js +0 -5
  32. package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/icon-map.js +0 -36
  33. package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/index.js +0 -169
  34. package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/messages.js +0 -29
  35. package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/styles.js +0 -13
  36. package/dist/cjs/plugins/alignment/utils/index.js +0 -27
  37. package/dist/cjs/plugins/mobile-dimensions/actions.js +0 -12
  38. package/dist/cjs/plugins/mobile-dimensions/commands.js +0 -26
  39. package/dist/cjs/plugins/mobile-dimensions/index.js +0 -99
  40. package/dist/cjs/plugins/mobile-dimensions/plugin-factory.js +0 -15
  41. package/dist/cjs/plugins/mobile-dimensions/reducer.js +0 -28
  42. package/dist/cjs/plugins/mobile-dimensions/types.js +0 -5
  43. package/dist/cjs/plugins/mobile-selection/content-in-selection.js +0 -24
  44. package/dist/cjs/plugins/mobile-selection/index.js +0 -18
  45. package/dist/cjs/plugins/mobile-selection/mobile-selection-plugin.js +0 -59
  46. package/dist/cjs/plugins/mobile-selection/types.js +0 -5
  47. package/dist/cjs/plugins/view-update-subscription/index.js +0 -90
  48. package/dist/cjs/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +0 -109
  49. package/dist/cjs/ui/Alignment/AlignmentButton/index.js +0 -71
  50. package/dist/cjs/ui/Alignment/index.js +0 -74
  51. package/dist/cjs/ui/Alignment/styles.js +0 -11
  52. package/dist/es2019/commands/index.js +0 -1
  53. package/dist/es2019/plugins/alignment/commands/index.js +0 -30
  54. package/dist/es2019/plugins/alignment/index.js +0 -58
  55. package/dist/es2019/plugins/alignment/pm-plugins/keymap.js +0 -8
  56. package/dist/es2019/plugins/alignment/pm-plugins/main.js +0 -34
  57. package/dist/es2019/plugins/alignment/pm-plugins/types.js +0 -1
  58. package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/icon-map.js +0 -30
  59. package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/index.js +0 -140
  60. package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/messages.js +0 -23
  61. package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/styles.js +0 -14
  62. package/dist/es2019/plugins/alignment/utils/index.js +0 -15
  63. package/dist/es2019/plugins/mobile-dimensions/actions.js +0 -6
  64. package/dist/es2019/plugins/mobile-dimensions/commands.js +0 -14
  65. package/dist/es2019/plugins/mobile-dimensions/index.js +0 -88
  66. package/dist/es2019/plugins/mobile-dimensions/plugin-factory.js +0 -9
  67. package/dist/es2019/plugins/mobile-dimensions/reducer.js +0 -21
  68. package/dist/es2019/plugins/mobile-dimensions/types.js +0 -1
  69. package/dist/es2019/plugins/mobile-selection/content-in-selection.js +0 -17
  70. package/dist/es2019/plugins/mobile-selection/index.js +0 -1
  71. package/dist/es2019/plugins/mobile-selection/mobile-selection-plugin.js +0 -53
  72. package/dist/es2019/plugins/mobile-selection/types.js +0 -1
  73. package/dist/es2019/plugins/view-update-subscription/index.js +0 -73
  74. package/dist/es2019/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +0 -106
  75. package/dist/es2019/ui/Alignment/AlignmentButton/index.js +0 -44
  76. package/dist/es2019/ui/Alignment/index.js +0 -54
  77. package/dist/es2019/ui/Alignment/styles.js +0 -7
  78. package/dist/esm/commands/index.js +0 -1
  79. package/dist/esm/plugins/alignment/commands/index.js +0 -30
  80. package/dist/esm/plugins/alignment/index.js +0 -63
  81. package/dist/esm/plugins/alignment/pm-plugins/keymap.js +0 -8
  82. package/dist/esm/plugins/alignment/pm-plugins/main.js +0 -36
  83. package/dist/esm/plugins/alignment/pm-plugins/types.js +0 -1
  84. package/dist/esm/plugins/alignment/ui/ToolbarAlignment/icon-map.js +0 -29
  85. package/dist/esm/plugins/alignment/ui/ToolbarAlignment/index.js +0 -163
  86. package/dist/esm/plugins/alignment/ui/ToolbarAlignment/messages.js +0 -23
  87. package/dist/esm/plugins/alignment/ui/ToolbarAlignment/styles.js +0 -6
  88. package/dist/esm/plugins/alignment/utils/index.js +0 -21
  89. package/dist/esm/plugins/mobile-dimensions/actions.js +0 -6
  90. package/dist/esm/plugins/mobile-dimensions/commands.js +0 -20
  91. package/dist/esm/plugins/mobile-dimensions/index.js +0 -93
  92. package/dist/esm/plugins/mobile-dimensions/plugin-factory.js +0 -9
  93. package/dist/esm/plugins/mobile-dimensions/reducer.js +0 -21
  94. package/dist/esm/plugins/mobile-dimensions/types.js +0 -1
  95. package/dist/esm/plugins/mobile-selection/content-in-selection.js +0 -18
  96. package/dist/esm/plugins/mobile-selection/index.js +0 -1
  97. package/dist/esm/plugins/mobile-selection/mobile-selection-plugin.js +0 -53
  98. package/dist/esm/plugins/mobile-selection/types.js +0 -1
  99. package/dist/esm/plugins/view-update-subscription/index.js +0 -83
  100. package/dist/esm/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +0 -103
  101. package/dist/esm/ui/Alignment/AlignmentButton/index.js +0 -62
  102. package/dist/esm/ui/Alignment/index.js +0 -68
  103. package/dist/esm/ui/Alignment/styles.js +0 -4
  104. package/dist/types/commands/index.d.ts +0 -1
  105. package/dist/types/plugins/alignment/commands/index.d.ts +0 -4
  106. package/dist/types/plugins/alignment/index.d.ts +0 -5
  107. package/dist/types/plugins/alignment/pm-plugins/keymap.d.ts +0 -2
  108. package/dist/types/plugins/alignment/pm-plugins/main.d.ts +0 -8
  109. package/dist/types/plugins/alignment/pm-plugins/types.d.ts +0 -5
  110. package/dist/types/plugins/alignment/ui/ToolbarAlignment/icon-map.d.ts +0 -6
  111. package/dist/types/plugins/alignment/ui/ToolbarAlignment/index.d.ts +0 -33
  112. package/dist/types/plugins/alignment/ui/ToolbarAlignment/messages.d.ts +0 -22
  113. package/dist/types/plugins/alignment/ui/ToolbarAlignment/styles.d.ts +0 -3
  114. package/dist/types/plugins/alignment/utils/index.d.ts +0 -3
  115. package/dist/types/plugins/mobile-dimensions/actions.d.ts +0 -18
  116. package/dist/types/plugins/mobile-dimensions/commands.d.ts +0 -3
  117. package/dist/types/plugins/mobile-dimensions/index.d.ts +0 -7
  118. package/dist/types/plugins/mobile-dimensions/plugin-factory.d.ts +0 -5
  119. package/dist/types/plugins/mobile-dimensions/reducer.d.ts +0 -3
  120. package/dist/types/plugins/mobile-dimensions/types.d.ts +0 -8
  121. package/dist/types/plugins/mobile-selection/content-in-selection.d.ts +0 -5
  122. package/dist/types/plugins/mobile-selection/index.d.ts +0 -2
  123. package/dist/types/plugins/mobile-selection/mobile-selection-plugin.d.ts +0 -7
  124. package/dist/types/plugins/mobile-selection/types.d.ts +0 -32
  125. package/dist/types/plugins/view-update-subscription/index.d.ts +0 -19
  126. package/dist/types/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.d.ts +0 -12
  127. package/dist/types/ui/Alignment/AlignmentButton/index.d.ts +0 -17
  128. package/dist/types/ui/Alignment/index.d.ts +0 -12
  129. package/dist/types/ui/Alignment/styles.d.ts +0 -1
  130. package/dist/types-ts4.5/commands/index.d.ts +0 -1
  131. package/dist/types-ts4.5/plugins/alignment/commands/index.d.ts +0 -4
  132. package/dist/types-ts4.5/plugins/alignment/index.d.ts +0 -5
  133. package/dist/types-ts4.5/plugins/alignment/pm-plugins/keymap.d.ts +0 -2
  134. package/dist/types-ts4.5/plugins/alignment/pm-plugins/main.d.ts +0 -8
  135. package/dist/types-ts4.5/plugins/alignment/pm-plugins/types.d.ts +0 -5
  136. package/dist/types-ts4.5/plugins/alignment/ui/ToolbarAlignment/icon-map.d.ts +0 -6
  137. package/dist/types-ts4.5/plugins/alignment/ui/ToolbarAlignment/index.d.ts +0 -33
  138. package/dist/types-ts4.5/plugins/alignment/ui/ToolbarAlignment/messages.d.ts +0 -22
  139. package/dist/types-ts4.5/plugins/alignment/ui/ToolbarAlignment/styles.d.ts +0 -3
  140. package/dist/types-ts4.5/plugins/alignment/utils/index.d.ts +0 -3
  141. package/dist/types-ts4.5/plugins/mobile-dimensions/actions.d.ts +0 -18
  142. package/dist/types-ts4.5/plugins/mobile-dimensions/commands.d.ts +0 -3
  143. package/dist/types-ts4.5/plugins/mobile-dimensions/index.d.ts +0 -7
  144. package/dist/types-ts4.5/plugins/mobile-dimensions/plugin-factory.d.ts +0 -5
  145. package/dist/types-ts4.5/plugins/mobile-dimensions/reducer.d.ts +0 -3
  146. package/dist/types-ts4.5/plugins/mobile-dimensions/types.d.ts +0 -8
  147. package/dist/types-ts4.5/plugins/mobile-selection/content-in-selection.d.ts +0 -5
  148. package/dist/types-ts4.5/plugins/mobile-selection/index.d.ts +0 -2
  149. package/dist/types-ts4.5/plugins/mobile-selection/mobile-selection-plugin.d.ts +0 -7
  150. package/dist/types-ts4.5/plugins/mobile-selection/types.d.ts +0 -32
  151. package/dist/types-ts4.5/plugins/view-update-subscription/index.d.ts +0 -19
  152. package/dist/types-ts4.5/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.d.ts +0 -12
  153. package/dist/types-ts4.5/ui/Alignment/AlignmentButton/index.d.ts +0 -17
  154. package/dist/types-ts4.5/ui/Alignment/index.d.ts +0 -12
  155. package/dist/types-ts4.5/ui/Alignment/styles.d.ts +0 -1
@@ -1,53 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
4
- import { contentInSelection } from './content-in-selection';
5
- export var selectionPluginKey = new PluginKey('mobile-selection');
6
- export var createProseMirrorPlugin = function createProseMirrorPlugin(dispatch) {
7
- return new SafePlugin({
8
- view: function view(editorView) {
9
- var domAtPos = editorView.domAtPos.bind(editorView);
10
- return {
11
- update: function update(view, previousState) {
12
- var state = view.state,
13
- _view$state = view.state,
14
- selection = _view$state.selection,
15
- doc = _view$state.doc;
16
- if (previousState.doc.eq(doc) && previousState.selection.eq(selection)) {
17
- return;
18
- }
19
- var ref = findDomRefAtPos(selection.$anchor.pos, domAtPos);
20
- var _ref$getBoundingClien = ref.getBoundingClientRect(),
21
- top = _ref$getBoundingClien.top,
22
- left = _ref$getBoundingClien.left;
23
- var _contentInSelection = contentInSelection(state),
24
- nodeTypes = _contentInSelection.nodeTypes,
25
- markTypes = _contentInSelection.markTypes;
26
- dispatch(selectionPluginKey, {
27
- rect: {
28
- top: Math.round(top),
29
- left: Math.round(left)
30
- },
31
- selection: state.selection.toJSON(),
32
- nodeTypes: nodeTypes,
33
- markTypes: markTypes
34
- });
35
- }
36
- };
37
- }
38
- });
39
- };
40
- export var mobileSelectionPlugin = function mobileSelectionPlugin() {
41
- return {
42
- name: 'mobileSelection',
43
- pmPlugins: function pmPlugins() {
44
- return [{
45
- name: 'mobileSelection',
46
- plugin: function plugin(_ref) {
47
- var dispatch = _ref.dispatch;
48
- return createProseMirrorPlugin(dispatch);
49
- }
50
- }];
51
- }
52
- };
53
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,83 +0,0 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
6
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
7
- export var trackerStore = new WeakMap();
8
- var Tracker = /*#__PURE__*/_createClass(function Tracker() {
9
- var _this = this;
10
- _classCallCheck(this, Tracker);
11
- _defineProperty(this, "update", function (props) {
12
- _this.subscriptions.forEach(function (cb) {
13
- return cb(props);
14
- });
15
- });
16
- _defineProperty(this, "add", function (subscription) {
17
- _this.subscriptions.push(subscription);
18
- });
19
- _defineProperty(this, "remove", function (subscription) {
20
- _this.subscriptions = _this.subscriptions.filter(function (s) {
21
- return s !== subscription;
22
- });
23
- });
24
- this.subscriptions = [];
25
- });
26
- var pluginKey = new PluginKey('viewUpdateSubscriptionKey');
27
- var createViewUpdateSubscriptionPlugin = function createViewUpdateSubscriptionPlugin() {
28
- var tracker;
29
- var lastUpdateRef = {
30
- current: null,
31
- initial: null,
32
- transactions: [],
33
- queued: false
34
- };
35
- return {
36
- name: 'viewUpdateSubscription',
37
- pmPlugins: function pmPlugins() {
38
- var createPlugin = function createPlugin() {
39
- return new SafePlugin({
40
- key: pluginKey,
41
- view: function view(editorView) {
42
- tracker = trackerStore.get(editorView);
43
- if (!tracker) {
44
- tracker = new Tracker();
45
- trackerStore.set(editorView, tracker);
46
- }
47
- return {};
48
- }
49
- });
50
- };
51
- return [{
52
- name: 'viewUpdateSubscription',
53
- plugin: createPlugin
54
- }];
55
- },
56
- onEditorViewStateUpdated: function onEditorViewStateUpdated(props) {
57
- var _lastUpdateRef$transa;
58
- lastUpdateRef.current = props;
59
- (_lastUpdateRef$transa = lastUpdateRef.transactions).push.apply(_lastUpdateRef$transa, _toConsumableArray(props.transactions));
60
- if (!lastUpdateRef.queued) {
61
- lastUpdateRef.initial = props;
62
- lastUpdateRef.queued = true;
63
- queueMicrotask(function () {
64
- if (!lastUpdateRef.current || !lastUpdateRef.initial) {
65
- return;
66
- }
67
- if (tracker) {
68
- var _lastUpdateRef$initia;
69
- tracker.update({
70
- newEditorState: lastUpdateRef.current.newEditorState,
71
- oldEditorState: (_lastUpdateRef$initia = lastUpdateRef.initial) === null || _lastUpdateRef$initia === void 0 ? void 0 : _lastUpdateRef$initia.oldEditorState,
72
- transactions: lastUpdateRef.transactions
73
- });
74
- }
75
- lastUpdateRef.queued = false;
76
- lastUpdateRef.current = null;
77
- lastUpdateRef.transactions = [];
78
- });
79
- }
80
- }
81
- };
82
- };
83
- export default createViewUpdateSubscriptionPlugin;
@@ -1,103 +0,0 @@
1
- import { areSameItems } from '@atlaskit/editor-common/floating-toolbar';
2
- import { trackerStore } from '..';
3
- var areToolbarsSame = function areToolbarsSame(left, right) {
4
- if (!left && !right) {
5
- return true;
6
- }
7
- if (left && !right || !left && right) {
8
- return false;
9
- }
10
- var leftConfig = left.config;
11
- var rightConfig = right.config;
12
- if (!leftConfig && !rightConfig) {
13
- return true;
14
- }
15
- if (!leftConfig && rightConfig || leftConfig && !rightConfig) {
16
- return false;
17
- }
18
- var leftItems = Array.isArray(leftConfig.items) ? leftConfig.items : leftConfig.items(left.node);
19
- var rightItems = Array.isArray(rightConfig.items) ? rightConfig.items : rightConfig.items(right.node);
20
- return areSameItems(leftItems, rightItems);
21
- };
22
- export var subscribeToToolbarAndPickerUpdates = function subscribeToToolbarAndPickerUpdates(editorView, cb) {
23
- var lastUpdatedState = null;
24
- var subscription = function subscription(_ref) {
25
- var newEditorState = _ref.newEditorState;
26
- // Creating fake plugin keys for these plugins for the mean time until all these plugins are extracted.
27
- var typeAheadPluginKey = {
28
- key: 'typeAheadPlugin$',
29
- getState: function getState(state) {
30
- return state['typeAheadPlugin$'];
31
- }
32
- };
33
- var datePluginKey = {
34
- key: 'datePlugin$',
35
- getState: function getState(state) {
36
- return state['datePlugin$'];
37
- }
38
- };
39
- var statusPluginKey = {
40
- key: 'statusPlugin$',
41
- getState: function getState(state) {
42
- return state['statusPlugin$'];
43
- }
44
- };
45
- var floatingToolbarPluginKey = {
46
- key: 'floatingToolbarPluginKey$',
47
- getState: function getState(state) {
48
- return state['floatingToolbarPluginKey$'];
49
- }
50
- };
51
- var isTypeAheadOpen = function isTypeAheadOpen(editorState) {
52
- var _typeAheadState$decor;
53
- var typeAheadState = typeAheadPluginKey.getState(newEditorState);
54
- return !!((_typeAheadState$decor = typeAheadState.decorationSet) !== null && _typeAheadState$decor !== void 0 && _typeAheadState$decor.find().length);
55
- };
56
- // TypeAhead has priority in the mobile-bridge
57
- // In case it is open we don't need to send
58
- // any toolbar updates don't need to be send
59
- if (isTypeAheadOpen(newEditorState)) {
60
- return;
61
- }
62
- var dateState = datePluginKey.getState(newEditorState);
63
- var statusState = statusPluginKey.getState(newEditorState);
64
- var _ref2 = floatingToolbarPluginKey.getState(newEditorState),
65
- getConfigWithNodeInfo = _ref2.getConfigWithNodeInfo;
66
- var toolbarConfig = getConfigWithNodeInfo(newEditorState);
67
- var shouldCallback = false;
68
- if (lastUpdatedState) {
69
- var oldDateState = datePluginKey.getState(lastUpdatedState);
70
- var oldStatusState = statusPluginKey.getState(lastUpdatedState);
71
- var _ref3 = floatingToolbarPluginKey.getState(lastUpdatedState),
72
- getOldConfigWithNodeInfo = _ref3.getConfigWithNodeInfo;
73
- var oldToolbarConfig = getOldConfigWithNodeInfo(lastUpdatedState);
74
- var isToolbarEqual = areToolbarsSame(toolbarConfig, oldToolbarConfig);
75
- if (dateState !== oldDateState || statusState !== oldStatusState ||
76
- // Sometimes the toolbar changes while a picker is open, we dont care about this
77
- // EG A nested status or date node in a table
78
- !isToolbarEqual && !(statusState !== null && statusState !== void 0 && statusState.showStatusPickerAt) && !(dateState !== null && dateState !== void 0 && dateState.showDatePickerAt)) {
79
- shouldCallback = true;
80
- }
81
- } else {
82
- shouldCallback = true;
83
- }
84
- if (shouldCallback) {
85
- cb({
86
- dateState: dateState,
87
- statusState: statusState,
88
- toolbarConfig: toolbarConfig
89
- });
90
- }
91
- lastUpdatedState = newEditorState;
92
- };
93
- var tracker = trackerStore.get(editorView);
94
- if (tracker) {
95
- tracker.add(subscription);
96
- }
97
- return function () {
98
- var tracker = trackerStore.get(editorView);
99
- if (tracker) {
100
- tracker.remove(subscription);
101
- }
102
- };
103
- };
@@ -1,62 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
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; } }
10
- import React from 'react';
11
- import { PureComponent } from 'react';
12
- import ToolbarButton from '../../ToolbarButton';
13
- import { ToolTipContent, tooltip } from '../../../keymaps';
14
- import { getAriaKeyshortcuts } from '@atlaskit/editor-common/keymaps';
15
- var AlignmentButton = /*#__PURE__*/function (_PureComponent) {
16
- _inherits(AlignmentButton, _PureComponent);
17
- var _super = _createSuper(AlignmentButton);
18
- function AlignmentButton() {
19
- var _this;
20
- _classCallCheck(this, AlignmentButton);
21
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
22
- args[_key] = arguments[_key];
23
- }
24
- _this = _super.call.apply(_super, [this].concat(args));
25
- _defineProperty(_assertThisInitialized(_this), "onClick", function (e) {
26
- var _this$props = _this.props,
27
- onClick = _this$props.onClick,
28
- value = _this$props.value;
29
-
30
- // detect if the click event comes from keyboard where screenX and screenY are 0
31
- var isMouseEvent = e instanceof MouseEvent;
32
- e.preventDefault();
33
- onClick(value, isMouseEvent);
34
- });
35
- return _this;
36
- }
37
- _createClass(AlignmentButton, [{
38
- key: "render",
39
- value: function render() {
40
- var _this$props2 = this.props,
41
- label = _this$props2.label,
42
- isSelected = _this$props2.isSelected,
43
- content = _this$props2.content,
44
- shortcut = _this$props2.shortcut;
45
- return /*#__PURE__*/React.createElement(ToolbarButton, {
46
- disabled: false,
47
- selected: isSelected,
48
- title: /*#__PURE__*/React.createElement(ToolTipContent, {
49
- description: label,
50
- keymap: shortcut
51
- }),
52
- "aria-label": shortcut ? tooltip(shortcut, label) : label,
53
- "aria-pressed": isSelected,
54
- "aria-keyshortcuts": getAriaKeyshortcuts(shortcut),
55
- onClick: this.onClick,
56
- iconBefore: content
57
- });
58
- }
59
- }]);
60
- return AlignmentButton;
61
- }(PureComponent);
62
- export default AlignmentButton;
@@ -1,68 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _inherits from "@babel/runtime/helpers/inherits";
4
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
- 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); }; }
7
- 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; } }
8
- /** @jsx jsx */
9
- import { jsx } from '@emotion/react';
10
- import { PureComponent } from 'react';
11
- import { injectIntl } from 'react-intl-next';
12
- import { IconMap } from '../../plugins/alignment/ui/ToolbarAlignment/icon-map';
13
- import AlignmentButton from './AlignmentButton';
14
- import { alignmentMessages } from '@atlaskit/editor-common/messages';
15
- import { alignmentWrapper } from './styles';
16
- import { alignLeft } from '../../keymaps';
17
- var alignmentOptions = [{
18
- title: alignmentMessages.alignLeft,
19
- shortcut: alignLeft,
20
- value: 'start'
21
- }, {
22
- title: alignmentMessages.alignCenter,
23
- value: 'center'
24
- }, {
25
- title: alignmentMessages.alignRight,
26
- value: 'end'
27
- }];
28
- var Alignment = /*#__PURE__*/function (_PureComponent) {
29
- _inherits(Alignment, _PureComponent);
30
- var _super = _createSuper(Alignment);
31
- function Alignment() {
32
- _classCallCheck(this, Alignment);
33
- return _super.apply(this, arguments);
34
- }
35
- _createClass(Alignment, [{
36
- key: "render",
37
- value: function render() {
38
- var _this$props = this.props,
39
- onClick = _this$props.onClick,
40
- selectedAlignment = _this$props.selectedAlignment,
41
- className = _this$props.className,
42
- intl = _this$props.intl;
43
- return jsx("div", {
44
- "data-testid": "alignment-buttons",
45
- css: alignmentWrapper,
46
- className: className
47
- }, alignmentOptions.map(function (alignment) {
48
- var value = alignment.value,
49
- title = alignment.title,
50
- shortcut = alignment.shortcut;
51
- var message = intl.formatMessage(title);
52
- return jsx(AlignmentButton, {
53
- content: jsx(IconMap, {
54
- alignment: value
55
- }),
56
- key: value,
57
- value: value,
58
- label: message,
59
- shortcut: shortcut,
60
- onClick: onClick,
61
- isSelected: value === selectedAlignment
62
- });
63
- }));
64
- }
65
- }]);
66
- return Alignment;
67
- }(PureComponent);
68
- export default injectIntl(Alignment);
@@ -1,4 +0,0 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject;
3
- import { css } from '@emotion/react';
4
- export var alignmentWrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 0 ", ";\n display: flex;\n flex-wrap: wrap;\n max-width: ", "px;\n"])), "var(--ds-space-100, 8px)", 3 * 32);
@@ -1 +0,0 @@
1
- export { addParagraphAtEnd, createParagraphAtEnd, changeImageAlignment, createToggleBlockMarkOnRange, toggleBlockMark, clearEditorContent, } from '@atlaskit/editor-common/commands';
@@ -1,4 +0,0 @@
1
- import { Command } from '../../../types/command';
2
- import { AlignmentState } from '../pm-plugins/types';
3
- export declare const isAlignable: (align?: AlignmentState) => Command;
4
- export declare const changeAlignment: (align?: AlignmentState) => Command;
@@ -1,5 +0,0 @@
1
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
- import { AlignmentPluginState } from './pm-plugins/types';
3
- export declare const defaultConfig: AlignmentPluginState;
4
- declare const alignmentPlugin: NextEditorPlugin<'alignment'>;
5
- export default alignmentPlugin;
@@ -1,2 +0,0 @@
1
- import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- export declare function keymapPlugin(): SafePlugin;
@@ -1,8 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
4
- import type { Dispatch } from '../../../event-dispatcher';
5
- import type { AlignmentPluginState } from './types';
6
- export declare function createInitialPluginState(editorState: EditorState, pluginConfig: AlignmentPluginState): AlignmentPluginState;
7
- export declare const pluginKey: PluginKey<AlignmentPluginState>;
8
- export declare function createPlugin(dispatch: Dispatch, pluginConfig: AlignmentPluginState): SafePlugin;
@@ -1,5 +0,0 @@
1
- export type AlignmentState = 'start' | 'end' | 'center';
2
- export type AlignmentPluginState = {
3
- align: AlignmentState;
4
- isEnabled?: boolean;
5
- };
@@ -1,6 +0,0 @@
1
- /// <reference types="react" />
2
- type Props = {
3
- alignment: string;
4
- };
5
- export declare const IconMap: (props: Props) => JSX.Element;
6
- export {};
@@ -1,33 +0,0 @@
1
- /** @jsx jsx */
2
- import React from 'react';
3
- import { jsx } from '@emotion/react';
4
- import type { WrappedComponentProps } from 'react-intl-next';
5
- import type { AlignmentPluginState, AlignmentState } from '../../pm-plugins/types';
6
- export interface State {
7
- isOpen: boolean;
8
- }
9
- export interface Props {
10
- pluginState: AlignmentPluginState;
11
- changeAlignment: (align: AlignmentState) => void;
12
- popupsMountPoint?: HTMLElement;
13
- popupsBoundariesElement?: HTMLElement;
14
- popupsScrollableElement?: HTMLElement;
15
- isReducedSpacing?: boolean;
16
- disabled?: boolean;
17
- }
18
- export declare class AlignmentToolbar extends React.Component<Props & WrappedComponentProps, State> {
19
- static displayName: string;
20
- private toolbarItemRef;
21
- state: State;
22
- render(): jsx.JSX.Element;
23
- componentDidUpdate(prevProps: Props): void;
24
- private changeAlignment;
25
- private toggleOpen;
26
- private toggleOpenByKeyboard;
27
- private hide;
28
- private hideOnEscape;
29
- }
30
- declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps<"intl">>> & {
31
- WrappedComponent: React.ComponentType<Props & WrappedComponentProps<"intl">>;
32
- };
33
- export default _default;
@@ -1,22 +0,0 @@
1
- export declare const messages: {
2
- alignment: {
3
- id: string;
4
- defaultMessage: string;
5
- description: string;
6
- };
7
- alignLeft: {
8
- id: string;
9
- defaultMessage: string;
10
- description: string;
11
- };
12
- alignRight: {
13
- id: string;
14
- defaultMessage: string;
15
- description: string;
16
- };
17
- alignCenter: {
18
- id: string;
19
- defaultMessage: string;
20
- description: string;
21
- };
22
- };
@@ -1,3 +0,0 @@
1
- export declare const triggerWrapper: import("@emotion/react").SerializedStyles;
2
- export declare const wrapper: import("@emotion/react").SerializedStyles;
3
- export declare const expandIconWrapper: import("@emotion/react").SerializedStyles;
@@ -1,3 +0,0 @@
1
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
- import type { AlignmentState } from '../pm-plugins/types';
3
- export declare const getActiveAlignment: (state: EditorState) => AlignmentState | undefined;
@@ -1,18 +0,0 @@
1
- export declare enum MobileDimensionsActionTypes {
2
- SET_WINDOW_HEIGHT = "SET_WINDOW_HEIGHT",
3
- SET_MOBILE_PADDING_TOP = "SET_MOBILE_PADDING_TOP",
4
- SET_IS_EXPANDED = "SET_IS_EXPANDED"
5
- }
6
- export interface SetMobilePaddingTop {
7
- type: MobileDimensionsActionTypes.SET_MOBILE_PADDING_TOP;
8
- paddingTop: number;
9
- }
10
- export interface SetWindowHeight {
11
- type: MobileDimensionsActionTypes.SET_WINDOW_HEIGHT;
12
- windowHeight: number;
13
- }
14
- export interface SetIsExpanded {
15
- type: MobileDimensionsActionTypes.SET_IS_EXPANDED;
16
- isExpanded: boolean;
17
- }
18
- export type MobileDimensionsAction = SetWindowHeight | SetMobilePaddingTop | SetIsExpanded;
@@ -1,3 +0,0 @@
1
- export declare const setWindowHeight: (windowHeight: number) => import("@atlaskit/editor-common/types").Command;
2
- export declare const setMobilePaddingTop: (paddingTop: number) => import("@atlaskit/editor-common/types").Command;
3
- export declare const setIsExpanded: (isExpanded: boolean) => import("@atlaskit/editor-common/types").Command;
@@ -1,7 +0,0 @@
1
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
- import type { MobileDimensionsPluginState } from './types';
3
- export type MobileDimensionsPlugin = NextEditorPlugin<'mobileDimensions', {
4
- sharedState: MobileDimensionsPluginState | undefined;
5
- }>;
6
- declare const mobileDimensionsPlugin: MobileDimensionsPlugin;
7
- export default mobileDimensionsPlugin;
@@ -1,5 +0,0 @@
1
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
- import type { MobileDimensionsPluginState } from './types';
3
- import type { MobileDimensionsAction } from './actions';
4
- export declare const mobileDimensionsPluginKey: PluginKey<any>;
5
- export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch<any>, initialState: MobileDimensionsPluginState | ((state: import("prosemirror-state").EditorState) => MobileDimensionsPluginState)) => import("prosemirror-state").SafeStateField<MobileDimensionsPluginState>, getPluginState: (state: import("prosemirror-state").EditorState) => MobileDimensionsPluginState, createCommand: <A = MobileDimensionsAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command;
@@ -1,3 +0,0 @@
1
- import type { MobileDimensionsAction } from './actions';
2
- import type { MobileDimensionsPluginState } from './types';
3
- export default function (state: MobileDimensionsPluginState, action: MobileDimensionsAction): MobileDimensionsPluginState;
@@ -1,8 +0,0 @@
1
- export type MobileDimensionsPluginState = {
2
- /** Current value of window.innerHeight, on Android this changes when keyboards shows/hides */
3
- windowHeight: number;
4
- /** Current value of padding top set from native (see WebBridge abstract class implementation) */
5
- mobilePaddingTop: number;
6
- /** Hybrid editor is always expanded, compact editor is collapsed or expanded */
7
- isExpanded: boolean;
8
- };
@@ -1,5 +0,0 @@
1
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
- export declare const contentInSelection: ({ selection, doc, }: EditorState) => {
3
- nodeTypes: string[];
4
- markTypes: string[];
5
- };
@@ -1,2 +0,0 @@
1
- export type { SelectionData, SelectionDataState } from './types';
2
- export { mobileSelectionPlugin as default, selectionPluginKey, } from './mobile-selection-plugin';
@@ -1,7 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- import type { Dispatch } from '../../event-dispatcher';
4
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
5
- export declare const selectionPluginKey: PluginKey<any>;
6
- export declare const createProseMirrorPlugin: (dispatch: Dispatch) => SafePlugin;
7
- export declare const mobileSelectionPlugin: NextEditorPlugin<'mobileSelection'>;
@@ -1,32 +0,0 @@
1
- export interface SelectionDataState {
2
- rect: RectData;
3
- selection: SelectionData;
4
- nodeTypes: string[];
5
- markTypes: string[];
6
- }
7
- export type SelectionData = AllSelectionData | NodeSelectionData | TextSelectionData | GapSelectionData | CellSelectionData;
8
- export interface RectData {
9
- top: number;
10
- left: number;
11
- }
12
- export interface AllSelectionData {
13
- type: 'all';
14
- }
15
- export interface NodeSelectionData {
16
- type: 'node';
17
- anchor: number;
18
- }
19
- export interface TextSelectionData {
20
- type: 'text';
21
- anchor: number;
22
- head: number;
23
- }
24
- export interface GapSelectionData {
25
- type: 'gapcursor';
26
- pos: number;
27
- }
28
- export interface CellSelectionData {
29
- type: 'cell';
30
- anchor: number;
31
- head: number;
32
- }
@@ -1,19 +0,0 @@
1
- import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
2
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
4
- type UpdateArgs = {
5
- newEditorState: EditorState;
6
- oldEditorState: EditorState;
7
- transactions: readonly Transaction[];
8
- };
9
- export type ViewUpdateSubscription = (args: UpdateArgs) => void;
10
- export declare const trackerStore: WeakMap<EditorView, Tracker>;
11
- declare class Tracker {
12
- private subscriptions;
13
- constructor();
14
- update: (props: UpdateArgs) => void;
15
- add: (subscription: ViewUpdateSubscription) => void;
16
- remove: (subscription: ViewUpdateSubscription) => void;
17
- }
18
- declare const createViewUpdateSubscriptionPlugin: NextEditorPlugin<'viewUpdateSubscription'>;
19
- export default createViewUpdateSubscriptionPlugin;
@@ -1,12 +0,0 @@
1
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
- import type { DatePluginSharedState } from '@atlaskit/editor-plugin-date';
3
- import type { ConfigWithNodeInfo } from '@atlaskit/editor-plugin-floating-toolbar';
4
- import type { StatusState } from '@atlaskit/editor-plugin-status';
5
- type SubscribeToToolbarAndPickerUpdatesCallbackArgs = {
6
- dateState?: DatePluginSharedState;
7
- statusState?: StatusState;
8
- toolbarConfig: ConfigWithNodeInfo | null | undefined;
9
- };
10
- type SubscribeToToolbarAndPickerUpdates = (editorView: EditorView, cb: (args: SubscribeToToolbarAndPickerUpdatesCallbackArgs) => void) => () => void;
11
- export declare const subscribeToToolbarAndPickerUpdates: SubscribeToToolbarAndPickerUpdates;
12
- export {};