@atlaskit/editor-core 187.2.0 → 187.2.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,11 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 187.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`f4f06674b2f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f4f06674b2f) - Fix additional typeahead character being added to editor when using composition.
8
+
3
9
  ## 187.2.0
4
10
 
5
11
  ### Minor Changes
@@ -8,7 +8,6 @@ var _prosemirrorState = require("prosemirror-state");
8
8
  var _selection = require("@atlaskit/editor-common/selection");
9
9
  var _key = require("../pm-plugins/key");
10
10
  var _actions = require("../pm-plugins/actions");
11
- var _utils = require("@atlaskit/editor-common/utils");
12
11
  var openTypeAhead = function openTypeAhead(props) {
13
12
  return function (tr) {
14
13
  var triggerHandler = props.triggerHandler,
@@ -61,7 +60,13 @@ var openTypeAheadAtCursor = function openTypeAheadAtCursor(_ref) {
61
60
 
62
61
  // ME-2375 remove the superfluous '@' inserted before decoration
63
62
  // by composition (https://github.com/ProseMirror/prosemirror/issues/903)
64
- if (_utils.browser.chrome && _utils.browser.android && cursorPos > 2 && !!(selection !== null && selection !== void 0 && (_selection$$head = selection.$head) !== null && _selection$$head !== void 0 && (_selection$$head$pare = _selection$$head.parent) !== null && _selection$$head$pare !== void 0 && _selection$$head$pare.textContent) && (_selection$$head$pare2 = (_selection$$head$pare3 = selection.$head.parent.textContent).endsWith) !== null && _selection$$head$pare2 !== void 0 && _selection$$head$pare2.call(_selection$$head$pare3, '@')) {
63
+ //
64
+ // Update:
65
+ // Now also handles any use case with superfluous typeahead triggers (ie. '@', ':', '/')
66
+ // being inserted due to composition by checking if we have the trigger
67
+ // directly before the typeahead. This should not happen unless it has
68
+ // been eroneously added because we require whitespace/newline for typeahead.
69
+ if (cursorPos >= 2 && !!(selection !== null && selection !== void 0 && (_selection$$head = selection.$head) !== null && _selection$$head !== void 0 && (_selection$$head$pare = _selection$$head.parent) !== null && _selection$$head$pare !== void 0 && _selection$$head$pare.textContent) && (_selection$$head$pare2 = (_selection$$head$pare3 = selection.$head.parent.textContent).endsWith) !== null && _selection$$head$pare2 !== void 0 && _selection$$head$pare2.call(_selection$$head$pare3, triggerHandler.trigger)) {
65
70
  tr.delete(cursorPos - 1, cursorPos);
66
71
  }
67
72
  }
@@ -148,7 +148,7 @@ var InputQuery = /*#__PURE__*/_react.default.memo(function (_ref) {
148
148
  // ED-14758 - Under the W3C specification, any keycode sent under IME would return a keycode 229
149
149
  // event.isComposing can't be used alone as this also included a virtual keyboard under a keyboardless device, therefore, it seems the best practice would be intercepting the event as below.
150
150
  // Some suggested the other workaround maybe listen on`keypress` instead of `keydown`
151
- if (!event.isComposing || event.which !== 229 && event.keyCode !== 229) {
151
+ if (!event.isComposing && event.which !== 229 && event.keyCode !== 229) {
152
152
  if (selectedIndex === -1) {
153
153
  if (useBetterTypeaheadNavigation) {
154
154
  /**
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = "@atlaskit/editor-core";
8
8
  exports.name = name;
9
- var version = "187.2.0";
9
+ var version = "187.2.1";
10
10
  exports.version = version;
11
11
  var nextMajorVersion = function nextMajorVersion() {
12
12
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.2.0",
3
+ "version": "187.2.1",
4
4
  "sideEffects": false
5
5
  }
@@ -2,7 +2,6 @@ import { TextSelection } from 'prosemirror-state';
2
2
  import { GapCursorSelection } from '@atlaskit/editor-common/selection';
3
3
  import { pluginKey } from '../pm-plugins/key';
4
4
  import { ACTIONS } from '../pm-plugins/actions';
5
- import { browser } from '@atlaskit/editor-common/utils';
6
5
  export const openTypeAhead = props => tr => {
7
6
  const {
8
7
  triggerHandler,
@@ -56,7 +55,13 @@ export const openTypeAheadAtCursor = ({
56
55
 
57
56
  // ME-2375 remove the superfluous '@' inserted before decoration
58
57
  // by composition (https://github.com/ProseMirror/prosemirror/issues/903)
59
- if (browser.chrome && browser.android && cursorPos > 2 && !!(selection !== null && selection !== void 0 && (_selection$$head = selection.$head) !== null && _selection$$head !== void 0 && (_selection$$head$pare = _selection$$head.parent) !== null && _selection$$head$pare !== void 0 && _selection$$head$pare.textContent) && (_selection$$head$pare2 = (_selection$$head$pare3 = selection.$head.parent.textContent).endsWith) !== null && _selection$$head$pare2 !== void 0 && _selection$$head$pare2.call(_selection$$head$pare3, '@')) {
58
+ //
59
+ // Update:
60
+ // Now also handles any use case with superfluous typeahead triggers (ie. '@', ':', '/')
61
+ // being inserted due to composition by checking if we have the trigger
62
+ // directly before the typeahead. This should not happen unless it has
63
+ // been eroneously added because we require whitespace/newline for typeahead.
64
+ if (cursorPos >= 2 && !!(selection !== null && selection !== void 0 && (_selection$$head = selection.$head) !== null && _selection$$head !== void 0 && (_selection$$head$pare = _selection$$head.parent) !== null && _selection$$head$pare !== void 0 && _selection$$head$pare.textContent) && (_selection$$head$pare2 = (_selection$$head$pare3 = selection.$head.parent.textContent).endsWith) !== null && _selection$$head$pare2 !== void 0 && _selection$$head$pare2.call(_selection$$head$pare3, triggerHandler.trigger)) {
60
65
  tr.delete(cursorPos - 1, cursorPos);
61
66
  }
62
67
  }
@@ -133,7 +133,7 @@ export const InputQuery = /*#__PURE__*/React.memo(({
133
133
  // ED-14758 - Under the W3C specification, any keycode sent under IME would return a keycode 229
134
134
  // event.isComposing can't be used alone as this also included a virtual keyboard under a keyboardless device, therefore, it seems the best practice would be intercepting the event as below.
135
135
  // Some suggested the other workaround maybe listen on`keypress` instead of `keydown`
136
- if (!event.isComposing || event.which !== 229 && event.keyCode !== 229) {
136
+ if (!event.isComposing && event.which !== 229 && event.keyCode !== 229) {
137
137
  if (selectedIndex === -1) {
138
138
  if (useBetterTypeaheadNavigation) {
139
139
  /**
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "187.2.0";
2
+ export const version = "187.2.1";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.2.0",
3
+ "version": "187.2.1",
4
4
  "sideEffects": false
5
5
  }
@@ -2,7 +2,6 @@ import { TextSelection } from 'prosemirror-state';
2
2
  import { GapCursorSelection } from '@atlaskit/editor-common/selection';
3
3
  import { pluginKey } from '../pm-plugins/key';
4
4
  import { ACTIONS } from '../pm-plugins/actions';
5
- import { browser } from '@atlaskit/editor-common/utils';
6
5
  export var openTypeAhead = function openTypeAhead(props) {
7
6
  return function (tr) {
8
7
  var triggerHandler = props.triggerHandler,
@@ -54,7 +53,13 @@ export var openTypeAheadAtCursor = function openTypeAheadAtCursor(_ref) {
54
53
 
55
54
  // ME-2375 remove the superfluous '@' inserted before decoration
56
55
  // by composition (https://github.com/ProseMirror/prosemirror/issues/903)
57
- if (browser.chrome && browser.android && cursorPos > 2 && !!(selection !== null && selection !== void 0 && (_selection$$head = selection.$head) !== null && _selection$$head !== void 0 && (_selection$$head$pare = _selection$$head.parent) !== null && _selection$$head$pare !== void 0 && _selection$$head$pare.textContent) && (_selection$$head$pare2 = (_selection$$head$pare3 = selection.$head.parent.textContent).endsWith) !== null && _selection$$head$pare2 !== void 0 && _selection$$head$pare2.call(_selection$$head$pare3, '@')) {
56
+ //
57
+ // Update:
58
+ // Now also handles any use case with superfluous typeahead triggers (ie. '@', ':', '/')
59
+ // being inserted due to composition by checking if we have the trigger
60
+ // directly before the typeahead. This should not happen unless it has
61
+ // been eroneously added because we require whitespace/newline for typeahead.
62
+ if (cursorPos >= 2 && !!(selection !== null && selection !== void 0 && (_selection$$head = selection.$head) !== null && _selection$$head !== void 0 && (_selection$$head$pare = _selection$$head.parent) !== null && _selection$$head$pare !== void 0 && _selection$$head$pare.textContent) && (_selection$$head$pare2 = (_selection$$head$pare3 = selection.$head.parent.textContent).endsWith) !== null && _selection$$head$pare2 !== void 0 && _selection$$head$pare2.call(_selection$$head$pare3, triggerHandler.trigger)) {
58
63
  tr.delete(cursorPos - 1, cursorPos);
59
64
  }
60
65
  }
@@ -138,7 +138,7 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
138
138
  // ED-14758 - Under the W3C specification, any keycode sent under IME would return a keycode 229
139
139
  // event.isComposing can't be used alone as this also included a virtual keyboard under a keyboardless device, therefore, it seems the best practice would be intercepting the event as below.
140
140
  // Some suggested the other workaround maybe listen on`keypress` instead of `keydown`
141
- if (!event.isComposing || event.which !== 229 && event.keyCode !== 229) {
141
+ if (!event.isComposing && event.which !== 229 && event.keyCode !== 229) {
142
142
  if (selectedIndex === -1) {
143
143
  if (useBetterTypeaheadNavigation) {
144
144
  /**
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.2.0";
2
+ export var version = "187.2.1";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.2.0",
3
+ "version": "187.2.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,4 +1,4 @@
1
- import { Transaction } from 'prosemirror-state';
1
+ import type { Transaction } from 'prosemirror-state';
2
2
  import type { TypeAheadHandler, TypeAheadInputMethod } from '../types';
3
3
  type Props = {
4
4
  triggerHandler: TypeAheadHandler;
@@ -1,4 +1,4 @@
1
- import { Transaction } from 'prosemirror-state';
1
+ import type { Transaction } from 'prosemirror-state';
2
2
  import type { TypeAheadHandler, TypeAheadInputMethod } from '../types';
3
3
  type Props = {
4
4
  triggerHandler: TypeAheadHandler;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.2.0",
3
+ "version": "187.2.1",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"