@atlaskit/editor-plugin-extension 3.0.1 → 3.0.2

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,11 @@
1
1
  # @atlaskit/editor-plugin-extension
2
2
 
3
+ ## 3.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
3
9
  ## 3.0.1
4
10
 
5
11
  ### Patch Changes
@@ -215,17 +215,19 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, provid
215
215
  handleDOMEvents: {
216
216
  blur: function blur(view, event) {
217
217
  if ((0, _platformFeatureFlags.fg)('platform_editor_legacy_content_macro')) {
218
- // Ignored via go/ees005
219
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
220
- var currentTarget = event.relatedTarget;
221
- // Ignored via go/ees005
222
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
223
- var source = event.target;
224
- var maybeFromPopup = !!currentTarget.closest('[data-editor-popup="true"]');
218
+ var currentSelection = event.relatedTarget;
219
+ var previousSelection = event.target;
220
+ if (!(currentSelection instanceof HTMLElement) || !(previousSelection instanceof HTMLElement)) {
221
+ return;
222
+ }
223
+ var wasPreviousSelectionInsideExtensionEditableArea = !!previousSelection.closest('.extension-editable-area');
224
+ var isCurrentSelectionInsideExtensionEditableArea = !!currentSelection.closest('.extension-editable-area');
225
+ var maybeFromPopup = !!currentSelection.closest('[data-editor-popup="true"]');
225
226
 
226
- // If the focus is going from outside to inside an area designated as an editable area of an extension, then the extension selection is reset.
227
+ // We want to reset the user's selection if they are entering or exiting the extension editable area.
228
+ // To do so, we check if there previous selection was inside or outside, and if they are now inside or outside.
227
229
  // We want to ignore this if a blur event is originating from an editor popup.
228
- if (!maybeFromPopup && !!currentTarget.closest('.extension-editable-area') !== !!source.closest('.extension-editable-area')) {
230
+ if (!maybeFromPopup && wasPreviousSelectionInsideExtensionEditableArea !== isCurrentSelectionInsideExtensionEditableArea) {
229
231
  var emptySelection = new _state.TextSelection(view.state.doc.resolve(0));
230
232
  var tr = view.state.tr.setSelection(emptySelection);
231
233
  view.dispatch(tr);
@@ -158,17 +158,19 @@ export const createPlugin = (dispatch, providerFactory, extensionHandlers, porta
158
158
  handleDOMEvents: {
159
159
  blur: (view, event) => {
160
160
  if (fg('platform_editor_legacy_content_macro')) {
161
- // Ignored via go/ees005
162
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
163
- const currentTarget = event.relatedTarget;
164
- // Ignored via go/ees005
165
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
166
- const source = event.target;
167
- const maybeFromPopup = !!currentTarget.closest('[data-editor-popup="true"]');
161
+ const currentSelection = event.relatedTarget;
162
+ const previousSelection = event.target;
163
+ if (!(currentSelection instanceof HTMLElement) || !(previousSelection instanceof HTMLElement)) {
164
+ return;
165
+ }
166
+ const wasPreviousSelectionInsideExtensionEditableArea = !!previousSelection.closest('.extension-editable-area');
167
+ const isCurrentSelectionInsideExtensionEditableArea = !!currentSelection.closest('.extension-editable-area');
168
+ const maybeFromPopup = !!currentSelection.closest('[data-editor-popup="true"]');
168
169
 
169
- // If the focus is going from outside to inside an area designated as an editable area of an extension, then the extension selection is reset.
170
+ // We want to reset the user's selection if they are entering or exiting the extension editable area.
171
+ // To do so, we check if there previous selection was inside or outside, and if they are now inside or outside.
170
172
  // We want to ignore this if a blur event is originating from an editor popup.
171
- if (!maybeFromPopup && !!currentTarget.closest('.extension-editable-area') !== !!source.closest('.extension-editable-area')) {
173
+ if (!maybeFromPopup && wasPreviousSelectionInsideExtensionEditableArea !== isCurrentSelectionInsideExtensionEditableArea) {
172
174
  const emptySelection = new TextSelection(view.state.doc.resolve(0));
173
175
  const tr = view.state.tr.setSelection(emptySelection);
174
176
  view.dispatch(tr);
@@ -208,17 +208,19 @@ export var createPlugin = function createPlugin(dispatch, providerFactory, exten
208
208
  handleDOMEvents: {
209
209
  blur: function blur(view, event) {
210
210
  if (fg('platform_editor_legacy_content_macro')) {
211
- // Ignored via go/ees005
212
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
213
- var currentTarget = event.relatedTarget;
214
- // Ignored via go/ees005
215
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
216
- var source = event.target;
217
- var maybeFromPopup = !!currentTarget.closest('[data-editor-popup="true"]');
211
+ var currentSelection = event.relatedTarget;
212
+ var previousSelection = event.target;
213
+ if (!(currentSelection instanceof HTMLElement) || !(previousSelection instanceof HTMLElement)) {
214
+ return;
215
+ }
216
+ var wasPreviousSelectionInsideExtensionEditableArea = !!previousSelection.closest('.extension-editable-area');
217
+ var isCurrentSelectionInsideExtensionEditableArea = !!currentSelection.closest('.extension-editable-area');
218
+ var maybeFromPopup = !!currentSelection.closest('[data-editor-popup="true"]');
218
219
 
219
- // If the focus is going from outside to inside an area designated as an editable area of an extension, then the extension selection is reset.
220
+ // We want to reset the user's selection if they are entering or exiting the extension editable area.
221
+ // To do so, we check if there previous selection was inside or outside, and if they are now inside or outside.
220
222
  // We want to ignore this if a blur event is originating from an editor popup.
221
- if (!maybeFromPopup && !!currentTarget.closest('.extension-editable-area') !== !!source.closest('.extension-editable-area')) {
223
+ if (!maybeFromPopup && wasPreviousSelectionInsideExtensionEditableArea !== isCurrentSelectionInsideExtensionEditableArea) {
222
224
  var emptySelection = new TextSelection(view.state.doc.resolve(0));
223
225
  var tr = view.state.tr.setSelection(emptySelection);
224
226
  view.dispatch(tr);
@@ -96,7 +96,7 @@ export default function ExtensionNodePicker({
96
96
  setHasSelection(isSelected);
97
97
  }
98
98
 
99
- let iconProp: { elemBefore?: ReactNode } = {};
99
+ const iconProp: { elemBefore?: ReactNode } = {};
100
100
 
101
101
  if (item.icon) {
102
102
  const ExtensionIcon = Loadable<{ label: string }, never>({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-extension",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "description": "editor-plugin-extension plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -30,11 +30,11 @@
30
30
  "@atlaskit/button": "^20.3.0",
31
31
  "@atlaskit/checkbox": "^15.2.0",
32
32
  "@atlaskit/datetime-picker": "^15.10.0",
33
- "@atlaskit/editor-common": "^97.2.0",
33
+ "@atlaskit/editor-common": "^98.0.0",
34
34
  "@atlaskit/editor-json-transformer": "^8.21.0",
35
35
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
36
36
  "@atlaskit/editor-plugin-context-identifier": "^1.3.0",
37
- "@atlaskit/editor-plugin-context-panel": "^1.3.0",
37
+ "@atlaskit/editor-plugin-context-panel": "^1.4.0",
38
38
  "@atlaskit/editor-plugin-decorations": "^1.3.0",
39
39
  "@atlaskit/editor-plugin-feature-flags": "^1.2.0",
40
40
  "@atlaskit/editor-plugin-width": "^2.0.0",
@@ -56,7 +56,7 @@
56
56
  "@atlaskit/textarea": "^5.7.0",
57
57
  "@atlaskit/textfield": "^6.7.0",
58
58
  "@atlaskit/theme": "^14.0.0",
59
- "@atlaskit/tmp-editor-statsig": "^2.29.0",
59
+ "@atlaskit/tmp-editor-statsig": "^2.31.0",
60
60
  "@atlaskit/toggle": "^14.0.0",
61
61
  "@atlaskit/tokens": "^2.5.0",
62
62
  "@atlaskit/tooltip": "^19.0.0",