@atlaskit/editor-core 187.3.0 → 187.3.5
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 +12 -0
- package/dist/cjs/plugins/base/pm-plugins/composition.js +25 -2
- package/dist/cjs/ui/Addon/click-area-helper.js +4 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/base/pm-plugins/composition.js +23 -2
- package/dist/es2019/ui/Addon/click-area-helper.js +4 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/base/pm-plugins/composition.js +25 -2
- package/dist/esm/ui/Addon/click-area-helper.js +4 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/base/pm-plugins/composition.d.ts +1 -0
- package/dist/types/ui/Addon/click-area-helper.d.ts +1 -1
- package/dist/types-ts4.5/plugins/base/pm-plugins/composition.d.ts +1 -0
- package/dist/types-ts4.5/ui/Addon/click-area-helper.d.ts +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.3.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`f10d32545d2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f10d32545d2) - Fix bug where clicking anything in column picker inside Datasource table triggers editor focus toggling
|
|
8
|
+
|
|
9
|
+
## 187.3.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`dbc45526d36`](https://bitbucket.org/atlassian/atlassian-frontend/commits/dbc45526d36) - ED-18879 prevent cursor from appearing at incorrect position after IME composition
|
|
14
|
+
|
|
3
15
|
## 187.3.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -6,28 +6,35 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.isComposing = exports.default = void 0;
|
|
7
7
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
8
8
|
var _prosemirrorState = require("prosemirror-state");
|
|
9
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
9
10
|
var compositionPluginKey = new _prosemirrorState.PluginKey('compositionPlugin');
|
|
10
11
|
var isComposing = function isComposing(state) {
|
|
11
12
|
var _compositionPluginKey;
|
|
12
13
|
return !!((_compositionPluginKey = compositionPluginKey.getState(state)) !== null && _compositionPluginKey !== void 0 && _compositionPluginKey.isComposing);
|
|
13
14
|
};
|
|
14
15
|
exports.isComposing = isComposing;
|
|
16
|
+
var isLinux = function isLinux() {
|
|
17
|
+
return navigator.userAgent.indexOf('Linux') >= 0;
|
|
18
|
+
};
|
|
15
19
|
var _default = function _default() {
|
|
16
20
|
return new _safePlugin.SafePlugin({
|
|
17
21
|
key: compositionPluginKey,
|
|
18
22
|
state: {
|
|
19
23
|
init: function init() {
|
|
20
24
|
return {
|
|
21
|
-
isComposing: false
|
|
25
|
+
isComposing: false,
|
|
26
|
+
zeroWidthSpacePos: undefined
|
|
22
27
|
};
|
|
23
28
|
},
|
|
24
29
|
apply: function apply(tr, value) {
|
|
25
30
|
var isComposing = tr.getMeta(compositionPluginKey);
|
|
31
|
+
var zeroWidthSpacePos = tr.getMeta('zeroWidthSpacePos');
|
|
26
32
|
if (typeof isComposing === 'undefined') {
|
|
27
33
|
return value;
|
|
28
34
|
}
|
|
29
35
|
return {
|
|
30
|
-
isComposing: isComposing
|
|
36
|
+
isComposing: isComposing,
|
|
37
|
+
zeroWidthSpacePos: zeroWidthSpacePos
|
|
31
38
|
};
|
|
32
39
|
}
|
|
33
40
|
},
|
|
@@ -36,12 +43,28 @@ var _default = function _default() {
|
|
|
36
43
|
compositionstart: function compositionstart(view, event) {
|
|
37
44
|
var tr = view.state.tr;
|
|
38
45
|
tr.setMeta(compositionPluginKey, true);
|
|
46
|
+
|
|
47
|
+
// only apply for linux and cursor is at start of line
|
|
48
|
+
if (isLinux() && view.state.selection.$from.parentOffset === 0) {
|
|
49
|
+
tr.insertText(_utils.ZERO_WIDTH_SPACE);
|
|
50
|
+
|
|
51
|
+
// remember the position of inserted zero width space
|
|
52
|
+
tr.setMeta('zeroWidthSpacePos', view.state.selection.$from.pos);
|
|
53
|
+
}
|
|
39
54
|
view.dispatch(tr);
|
|
40
55
|
return false;
|
|
41
56
|
},
|
|
42
57
|
compositionend: function compositionend(view, event) {
|
|
43
58
|
var tr = view.state.tr;
|
|
44
59
|
tr.setMeta(compositionPluginKey, false);
|
|
60
|
+
if (isLinux()) {
|
|
61
|
+
var _compositionPluginKey2;
|
|
62
|
+
var zeroWidthSpacePos = (_compositionPluginKey2 = compositionPluginKey.getState(view.state)) === null || _compositionPluginKey2 === void 0 ? void 0 : _compositionPluginKey2.zeroWidthSpacePos;
|
|
63
|
+
if (typeof zeroWidthSpacePos !== 'undefined') {
|
|
64
|
+
tr.deleteRange(zeroWidthSpacePos, zeroWidthSpacePos + 1);
|
|
65
|
+
}
|
|
66
|
+
tr.setMeta('zeroWidthSpacePos', undefined);
|
|
67
|
+
}
|
|
45
68
|
view.dispatch(tr);
|
|
46
69
|
return false;
|
|
47
70
|
}
|
|
@@ -74,12 +74,15 @@ var clickAreaClickHandler = function clickAreaClickHandler(view, event) {
|
|
|
74
74
|
var isButtonClicked = Boolean((0, _dom.closestElement)(event.currentTarget, 'button')) || Boolean((0, _dom.closestElement)(target, 'button')) || ((_event$currentTarget = event.currentTarget) === null || _event$currentTarget === void 0 ? void 0 : _event$currentTarget.nodeName) === 'BUTTON' || target.nodeName === 'BUTTON';
|
|
75
75
|
var isTargetInsideContentArea = Boolean(isTargetChildOfContentArea);
|
|
76
76
|
var isBetweenContentAreaAndEditableContent = isTargetInsideContentArea && !isTargetInsideEditableArea;
|
|
77
|
+
|
|
78
|
+
// Column Picker dropdown in Datasources table
|
|
79
|
+
var isDatasourcePopupClicked = !!(target !== null && target !== void 0 && target.closest('#column-picker-popup'));
|
|
77
80
|
var edgeCaseScenario1 = (isBetweenContentAreaAndEditableContent || !isEventComingFromContentArea) && !isEditorFocused;
|
|
78
81
|
var edgeCaseScenario2 = !isTargetInsideContentArea && isEditorFocused;
|
|
79
82
|
var edgeCaseScenario3 = isTargetContentArea && !isTargetInsideContentArea && !isEditorFocused;
|
|
80
83
|
var edgeCaseScenario4 = isEventComingFromContentArea && !isTargetContentArea && !isTargetInsideContentArea && !isEditorFocused;
|
|
81
84
|
var edgeCases = edgeCaseScenario1 || edgeCaseScenario2 || edgeCaseScenario3 || edgeCaseScenario4;
|
|
82
|
-
var isClickOutsideEditor = edgeCases && !isEventComingFromInlineCommentPopup && !isButtonClicked && !isInputClicked && !isTextAreaClicked && !isPopupClicked && !isBreadcrumbClicked && !isEditorPopupTextSelected && checkForModal(target);
|
|
85
|
+
var isClickOutsideEditor = edgeCases && !isDatasourcePopupClicked && !isEventComingFromInlineCommentPopup && !isButtonClicked && !isInputClicked && !isTextAreaClicked && !isPopupClicked && !isBreadcrumbClicked && !isEditorPopupTextSelected && checkForModal(target);
|
|
83
86
|
|
|
84
87
|
// click was within editor container and focus should be brought to input
|
|
85
88
|
if (isClickOutsideEditor && view) {
|
|
@@ -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.3.
|
|
9
|
+
var version = "187.3.5";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { PluginKey } from 'prosemirror-state';
|
|
3
|
+
import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
|
|
3
4
|
const compositionPluginKey = new PluginKey('compositionPlugin');
|
|
4
5
|
export const isComposing = state => {
|
|
5
6
|
var _compositionPluginKey;
|
|
6
7
|
return !!((_compositionPluginKey = compositionPluginKey.getState(state)) !== null && _compositionPluginKey !== void 0 && _compositionPluginKey.isComposing);
|
|
7
8
|
};
|
|
9
|
+
const isLinux = () => navigator.userAgent.indexOf('Linux') >= 0;
|
|
8
10
|
export default (() => new SafePlugin({
|
|
9
11
|
key: compositionPluginKey,
|
|
10
12
|
state: {
|
|
11
13
|
init: () => ({
|
|
12
|
-
isComposing: false
|
|
14
|
+
isComposing: false,
|
|
15
|
+
zeroWidthSpacePos: undefined
|
|
13
16
|
}),
|
|
14
17
|
apply: (tr, value) => {
|
|
15
18
|
const isComposing = tr.getMeta(compositionPluginKey);
|
|
19
|
+
const zeroWidthSpacePos = tr.getMeta('zeroWidthSpacePos');
|
|
16
20
|
if (typeof isComposing === 'undefined') {
|
|
17
21
|
return value;
|
|
18
22
|
}
|
|
19
23
|
return {
|
|
20
|
-
isComposing
|
|
24
|
+
isComposing,
|
|
25
|
+
zeroWidthSpacePos
|
|
21
26
|
};
|
|
22
27
|
}
|
|
23
28
|
},
|
|
@@ -28,6 +33,14 @@ export default (() => new SafePlugin({
|
|
|
28
33
|
tr
|
|
29
34
|
} = view.state;
|
|
30
35
|
tr.setMeta(compositionPluginKey, true);
|
|
36
|
+
|
|
37
|
+
// only apply for linux and cursor is at start of line
|
|
38
|
+
if (isLinux() && view.state.selection.$from.parentOffset === 0) {
|
|
39
|
+
tr.insertText(ZERO_WIDTH_SPACE);
|
|
40
|
+
|
|
41
|
+
// remember the position of inserted zero width space
|
|
42
|
+
tr.setMeta('zeroWidthSpacePos', view.state.selection.$from.pos);
|
|
43
|
+
}
|
|
31
44
|
view.dispatch(tr);
|
|
32
45
|
return false;
|
|
33
46
|
},
|
|
@@ -36,6 +49,14 @@ export default (() => new SafePlugin({
|
|
|
36
49
|
tr
|
|
37
50
|
} = view.state;
|
|
38
51
|
tr.setMeta(compositionPluginKey, false);
|
|
52
|
+
if (isLinux()) {
|
|
53
|
+
var _compositionPluginKey2;
|
|
54
|
+
const zeroWidthSpacePos = (_compositionPluginKey2 = compositionPluginKey.getState(view.state)) === null || _compositionPluginKey2 === void 0 ? void 0 : _compositionPluginKey2.zeroWidthSpacePos;
|
|
55
|
+
if (typeof zeroWidthSpacePos !== 'undefined') {
|
|
56
|
+
tr.deleteRange(zeroWidthSpacePos, zeroWidthSpacePos + 1);
|
|
57
|
+
}
|
|
58
|
+
tr.setMeta('zeroWidthSpacePos', undefined);
|
|
59
|
+
}
|
|
39
60
|
view.dispatch(tr);
|
|
40
61
|
return false;
|
|
41
62
|
}
|
|
@@ -68,12 +68,15 @@ const clickAreaClickHandler = (view, event) => {
|
|
|
68
68
|
const isButtonClicked = Boolean(closestElement(event.currentTarget, 'button')) || Boolean(closestElement(target, 'button')) || ((_event$currentTarget = event.currentTarget) === null || _event$currentTarget === void 0 ? void 0 : _event$currentTarget.nodeName) === 'BUTTON' || target.nodeName === 'BUTTON';
|
|
69
69
|
const isTargetInsideContentArea = Boolean(isTargetChildOfContentArea);
|
|
70
70
|
const isBetweenContentAreaAndEditableContent = isTargetInsideContentArea && !isTargetInsideEditableArea;
|
|
71
|
+
|
|
72
|
+
// Column Picker dropdown in Datasources table
|
|
73
|
+
const isDatasourcePopupClicked = !!(target !== null && target !== void 0 && target.closest('#column-picker-popup'));
|
|
71
74
|
const edgeCaseScenario1 = (isBetweenContentAreaAndEditableContent || !isEventComingFromContentArea) && !isEditorFocused;
|
|
72
75
|
const edgeCaseScenario2 = !isTargetInsideContentArea && isEditorFocused;
|
|
73
76
|
const edgeCaseScenario3 = isTargetContentArea && !isTargetInsideContentArea && !isEditorFocused;
|
|
74
77
|
const edgeCaseScenario4 = isEventComingFromContentArea && !isTargetContentArea && !isTargetInsideContentArea && !isEditorFocused;
|
|
75
78
|
const edgeCases = edgeCaseScenario1 || edgeCaseScenario2 || edgeCaseScenario3 || edgeCaseScenario4;
|
|
76
|
-
const isClickOutsideEditor = edgeCases && !isEventComingFromInlineCommentPopup && !isButtonClicked && !isInputClicked && !isTextAreaClicked && !isPopupClicked && !isBreadcrumbClicked && !isEditorPopupTextSelected && checkForModal(target);
|
|
79
|
+
const isClickOutsideEditor = edgeCases && !isDatasourcePopupClicked && !isEventComingFromInlineCommentPopup && !isButtonClicked && !isInputClicked && !isTextAreaClicked && !isPopupClicked && !isBreadcrumbClicked && !isEditorPopupTextSelected && checkForModal(target);
|
|
77
80
|
|
|
78
81
|
// click was within editor container and focus should be brought to input
|
|
79
82
|
if (isClickOutsideEditor && view) {
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { PluginKey } from 'prosemirror-state';
|
|
3
|
+
import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
|
|
3
4
|
var compositionPluginKey = new PluginKey('compositionPlugin');
|
|
4
5
|
export var isComposing = function isComposing(state) {
|
|
5
6
|
var _compositionPluginKey;
|
|
6
7
|
return !!((_compositionPluginKey = compositionPluginKey.getState(state)) !== null && _compositionPluginKey !== void 0 && _compositionPluginKey.isComposing);
|
|
7
8
|
};
|
|
9
|
+
var isLinux = function isLinux() {
|
|
10
|
+
return navigator.userAgent.indexOf('Linux') >= 0;
|
|
11
|
+
};
|
|
8
12
|
export default (function () {
|
|
9
13
|
return new SafePlugin({
|
|
10
14
|
key: compositionPluginKey,
|
|
11
15
|
state: {
|
|
12
16
|
init: function init() {
|
|
13
17
|
return {
|
|
14
|
-
isComposing: false
|
|
18
|
+
isComposing: false,
|
|
19
|
+
zeroWidthSpacePos: undefined
|
|
15
20
|
};
|
|
16
21
|
},
|
|
17
22
|
apply: function apply(tr, value) {
|
|
18
23
|
var isComposing = tr.getMeta(compositionPluginKey);
|
|
24
|
+
var zeroWidthSpacePos = tr.getMeta('zeroWidthSpacePos');
|
|
19
25
|
if (typeof isComposing === 'undefined') {
|
|
20
26
|
return value;
|
|
21
27
|
}
|
|
22
28
|
return {
|
|
23
|
-
isComposing: isComposing
|
|
29
|
+
isComposing: isComposing,
|
|
30
|
+
zeroWidthSpacePos: zeroWidthSpacePos
|
|
24
31
|
};
|
|
25
32
|
}
|
|
26
33
|
},
|
|
@@ -29,12 +36,28 @@ export default (function () {
|
|
|
29
36
|
compositionstart: function compositionstart(view, event) {
|
|
30
37
|
var tr = view.state.tr;
|
|
31
38
|
tr.setMeta(compositionPluginKey, true);
|
|
39
|
+
|
|
40
|
+
// only apply for linux and cursor is at start of line
|
|
41
|
+
if (isLinux() && view.state.selection.$from.parentOffset === 0) {
|
|
42
|
+
tr.insertText(ZERO_WIDTH_SPACE);
|
|
43
|
+
|
|
44
|
+
// remember the position of inserted zero width space
|
|
45
|
+
tr.setMeta('zeroWidthSpacePos', view.state.selection.$from.pos);
|
|
46
|
+
}
|
|
32
47
|
view.dispatch(tr);
|
|
33
48
|
return false;
|
|
34
49
|
},
|
|
35
50
|
compositionend: function compositionend(view, event) {
|
|
36
51
|
var tr = view.state.tr;
|
|
37
52
|
tr.setMeta(compositionPluginKey, false);
|
|
53
|
+
if (isLinux()) {
|
|
54
|
+
var _compositionPluginKey2;
|
|
55
|
+
var zeroWidthSpacePos = (_compositionPluginKey2 = compositionPluginKey.getState(view.state)) === null || _compositionPluginKey2 === void 0 ? void 0 : _compositionPluginKey2.zeroWidthSpacePos;
|
|
56
|
+
if (typeof zeroWidthSpacePos !== 'undefined') {
|
|
57
|
+
tr.deleteRange(zeroWidthSpacePos, zeroWidthSpacePos + 1);
|
|
58
|
+
}
|
|
59
|
+
tr.setMeta('zeroWidthSpacePos', undefined);
|
|
60
|
+
}
|
|
38
61
|
view.dispatch(tr);
|
|
39
62
|
return false;
|
|
40
63
|
}
|
|
@@ -68,12 +68,15 @@ var clickAreaClickHandler = function clickAreaClickHandler(view, event) {
|
|
|
68
68
|
var isButtonClicked = Boolean(closestElement(event.currentTarget, 'button')) || Boolean(closestElement(target, 'button')) || ((_event$currentTarget = event.currentTarget) === null || _event$currentTarget === void 0 ? void 0 : _event$currentTarget.nodeName) === 'BUTTON' || target.nodeName === 'BUTTON';
|
|
69
69
|
var isTargetInsideContentArea = Boolean(isTargetChildOfContentArea);
|
|
70
70
|
var isBetweenContentAreaAndEditableContent = isTargetInsideContentArea && !isTargetInsideEditableArea;
|
|
71
|
+
|
|
72
|
+
// Column Picker dropdown in Datasources table
|
|
73
|
+
var isDatasourcePopupClicked = !!(target !== null && target !== void 0 && target.closest('#column-picker-popup'));
|
|
71
74
|
var edgeCaseScenario1 = (isBetweenContentAreaAndEditableContent || !isEventComingFromContentArea) && !isEditorFocused;
|
|
72
75
|
var edgeCaseScenario2 = !isTargetInsideContentArea && isEditorFocused;
|
|
73
76
|
var edgeCaseScenario3 = isTargetContentArea && !isTargetInsideContentArea && !isEditorFocused;
|
|
74
77
|
var edgeCaseScenario4 = isEventComingFromContentArea && !isTargetContentArea && !isTargetInsideContentArea && !isEditorFocused;
|
|
75
78
|
var edgeCases = edgeCaseScenario1 || edgeCaseScenario2 || edgeCaseScenario3 || edgeCaseScenario4;
|
|
76
|
-
var isClickOutsideEditor = edgeCases && !isEventComingFromInlineCommentPopup && !isButtonClicked && !isInputClicked && !isTextAreaClicked && !isPopupClicked && !isBreadcrumbClicked && !isEditorPopupTextSelected && checkForModal(target);
|
|
79
|
+
var isClickOutsideEditor = edgeCases && !isDatasourcePopupClicked && !isEventComingFromInlineCommentPopup && !isButtonClicked && !isInputClicked && !isTextAreaClicked && !isPopupClicked && !isBreadcrumbClicked && !isEditorPopupTextSelected && checkForModal(target);
|
|
77
80
|
|
|
78
81
|
// click was within editor container and focus should be brought to input
|
|
79
82
|
if (isClickOutsideEditor && view) {
|
package/dist/esm/version.json
CHANGED
|
@@ -2,6 +2,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
2
2
|
import { EditorState } from 'prosemirror-state';
|
|
3
3
|
interface CompositionPluginState {
|
|
4
4
|
isComposing: boolean;
|
|
5
|
+
zeroWidthSpacePos?: number;
|
|
5
6
|
}
|
|
6
7
|
export declare const isComposing: (state: EditorState) => boolean;
|
|
7
8
|
declare const _default: () => SafePlugin<CompositionPluginState>;
|
|
@@ -2,6 +2,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
2
2
|
import { EditorState } from 'prosemirror-state';
|
|
3
3
|
interface CompositionPluginState {
|
|
4
4
|
isComposing: boolean;
|
|
5
|
+
zeroWidthSpacePos?: number;
|
|
5
6
|
}
|
|
6
7
|
export declare const isComposing: (state: EditorState) => boolean;
|
|
7
8
|
declare const _default: () => SafePlugin<CompositionPluginState>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "187.3.
|
|
3
|
+
"version": "187.3.5",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -157,7 +157,7 @@
|
|
|
157
157
|
"@atlaskit/inline-dialog": "^13.6.0",
|
|
158
158
|
"@atlaskit/link-analytics": "^8.2.0",
|
|
159
159
|
"@atlaskit/link-provider": "^1.6.0",
|
|
160
|
-
"@atlaskit/link-test-helpers": "^4.
|
|
160
|
+
"@atlaskit/link-test-helpers": "^4.2.0",
|
|
161
161
|
"@atlaskit/media-core": "^34.1.0",
|
|
162
162
|
"@atlaskit/media-integration-test-helpers": "^3.0.0",
|
|
163
163
|
"@atlaskit/media-test-helpers": "^33.0.0",
|