@atlaskit/editor-core 187.2.3 → 187.2.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/create-editor/ReactEditorViewInternal.js +29 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +30 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/ReactEditorViewInternal.js +30 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/ReactEditorViewInternal.d.ts +15 -14
- package/dist/types-ts4.5/create-editor/ReactEditorViewInternal.d.ts +15 -14
- package/package.json +1 -1
- package/report.api.md +5 -5
- package/tmp/api-report-tmp.d.ts +0 -2257
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.2.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`9663c3a9616`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9663c3a9616) - [ux] fix editor first focus
|
|
8
|
+
|
|
9
|
+
## 187.2.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`30f2b96479f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/30f2b96479f) - Update image upload plugin to use optional plugin upload interface
|
|
14
|
+
|
|
3
15
|
## 187.2.3
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -50,6 +50,35 @@ function handleEditorFocus(view) {
|
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
return window.setTimeout(function () {
|
|
53
|
+
if (view.hasFocus()) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (!window.getSelection) {
|
|
57
|
+
view.focus();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
var domSelection = window.getSelection();
|
|
61
|
+
if (!domSelection || domSelection.rangeCount === 0) {
|
|
62
|
+
view.focus();
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
var range = domSelection.getRangeAt(0);
|
|
66
|
+
// if selection is outside editor focus and exit
|
|
67
|
+
if (range.startContainer.contains(view.dom)) {
|
|
68
|
+
view.focus();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
// set cursor/selection and focus
|
|
72
|
+
var anchor = view.posAtDOM(range.startContainer, range.startOffset);
|
|
73
|
+
var head = view.posAtDOM(range.endContainer, range.endOffset);
|
|
74
|
+
// if anchor or head < 0 focus and exit
|
|
75
|
+
if (anchor < 0 || head < 0) {
|
|
76
|
+
view.focus();
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
var selection = _prosemirrorState.TextSelection.create(view.state.doc, anchor, head);
|
|
80
|
+
var tr = view.state.tr.setSelection(selection);
|
|
81
|
+
view.dispatch(tr);
|
|
53
82
|
view.focus();
|
|
54
83
|
}, 0);
|
|
55
84
|
}
|
|
@@ -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.
|
|
9
|
+
var version = "187.2.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,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import { EditorState, Selection } from 'prosemirror-state';
|
|
4
|
+
import { EditorState, Selection, TextSelection } from 'prosemirror-state';
|
|
5
5
|
import { EditorView } from 'prosemirror-view';
|
|
6
6
|
import { editorMessages } from './messages';
|
|
7
7
|
import { browser, getAnalyticsEventSeverity, getResponseEndTime, measureRender, startMeasure, stopMeasure, shouldForceTracking } from '@atlaskit/editor-common/utils';
|
|
@@ -35,6 +35,35 @@ function handleEditorFocus(view) {
|
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
return window.setTimeout(() => {
|
|
38
|
+
if (view.hasFocus()) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (!window.getSelection) {
|
|
42
|
+
view.focus();
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const domSelection = window.getSelection();
|
|
46
|
+
if (!domSelection || domSelection.rangeCount === 0) {
|
|
47
|
+
view.focus();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const range = domSelection.getRangeAt(0);
|
|
51
|
+
// if selection is outside editor focus and exit
|
|
52
|
+
if (range.startContainer.contains(view.dom)) {
|
|
53
|
+
view.focus();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
// set cursor/selection and focus
|
|
57
|
+
const anchor = view.posAtDOM(range.startContainer, range.startOffset);
|
|
58
|
+
const head = view.posAtDOM(range.endContainer, range.endOffset);
|
|
59
|
+
// if anchor or head < 0 focus and exit
|
|
60
|
+
if (anchor < 0 || head < 0) {
|
|
61
|
+
view.focus();
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const selection = TextSelection.create(view.state.doc, anchor, head);
|
|
65
|
+
const tr = view.state.tr.setSelection(selection);
|
|
66
|
+
view.dispatch(tr);
|
|
38
67
|
view.focus();
|
|
39
68
|
}, 0);
|
|
40
69
|
}
|
package/dist/es2019/version.json
CHANGED
|
@@ -12,7 +12,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
12
12
|
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; } }
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import PropTypes from 'prop-types';
|
|
15
|
-
import { EditorState, Selection } from 'prosemirror-state';
|
|
15
|
+
import { EditorState, Selection, TextSelection } from 'prosemirror-state';
|
|
16
16
|
import { EditorView } from 'prosemirror-view';
|
|
17
17
|
import { editorMessages } from './messages';
|
|
18
18
|
import { browser, getAnalyticsEventSeverity, getResponseEndTime, measureRender, startMeasure, stopMeasure, shouldForceTracking } from '@atlaskit/editor-common/utils';
|
|
@@ -46,6 +46,35 @@ function handleEditorFocus(view) {
|
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
return window.setTimeout(function () {
|
|
49
|
+
if (view.hasFocus()) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (!window.getSelection) {
|
|
53
|
+
view.focus();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
var domSelection = window.getSelection();
|
|
57
|
+
if (!domSelection || domSelection.rangeCount === 0) {
|
|
58
|
+
view.focus();
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
var range = domSelection.getRangeAt(0);
|
|
62
|
+
// if selection is outside editor focus and exit
|
|
63
|
+
if (range.startContainer.contains(view.dom)) {
|
|
64
|
+
view.focus();
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
// set cursor/selection and focus
|
|
68
|
+
var anchor = view.posAtDOM(range.startContainer, range.startOffset);
|
|
69
|
+
var head = view.posAtDOM(range.endContainer, range.endOffset);
|
|
70
|
+
// if anchor or head < 0 focus and exit
|
|
71
|
+
if (anchor < 0 || head < 0) {
|
|
72
|
+
view.focus();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
var selection = TextSelection.create(view.state.doc, anchor, head);
|
|
76
|
+
var tr = view.state.tr.setSelection(selection);
|
|
77
|
+
view.dispatch(tr);
|
|
49
78
|
view.focus();
|
|
50
79
|
}, 0);
|
|
51
80
|
}
|
package/dist/esm/version.json
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { EditorState } from 'prosemirror-state';
|
|
4
|
-
import { DirectEditorProps
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
4
|
+
import type { DirectEditorProps } from 'prosemirror-view';
|
|
5
|
+
import { EditorView } from 'prosemirror-view';
|
|
6
|
+
import type { Node as PMNode } from 'prosemirror-model';
|
|
7
|
+
import type { WrappedComponentProps } from 'react-intl-next';
|
|
8
|
+
import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
9
|
+
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
10
|
+
import type { ErrorReporter, SEVERITY } from '@atlaskit/editor-common/utils';
|
|
10
11
|
import { ExperienceStore } from '@atlaskit/editor-common/ufo';
|
|
11
|
-
import { Transformer, AllEditorPresetPluginTypes } from '@atlaskit/editor-common/types';
|
|
12
|
-
import { Dispatch
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
12
|
+
import type { Transformer, AllEditorPresetPluginTypes } from '@atlaskit/editor-common/types';
|
|
13
|
+
import type { Dispatch } from '../event-dispatcher';
|
|
14
|
+
import { EventDispatcher } from '../event-dispatcher';
|
|
15
|
+
import { FULL_WIDTH_MODE } from '@atlaskit/editor-common/analytics';
|
|
16
|
+
import type { EditorAppearance, EditorConfig, EditorReactContext, EditorPlugin, EditorProps } from '../types';
|
|
15
17
|
import type { EditorNextProps } from '../types/editor-props';
|
|
16
|
-
import { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
17
|
-
import { SEVERITY } from '@atlaskit/editor-common/utils';
|
|
18
|
+
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
18
19
|
import { TransactionTracker } from '../utils/performance/track-transactions';
|
|
19
|
-
import type { FireAnalyticsCallback } from '@atlaskit/editor-common/analytics';
|
|
20
|
-
import { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
|
|
20
|
+
import type { FireAnalyticsCallback, AnalyticsEventPayload, DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
21
|
+
import type { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
|
|
21
22
|
export interface EditorViewProps {
|
|
22
23
|
editorProps: EditorProps | EditorNextProps;
|
|
23
24
|
createAnalyticsEvent?: CreateUIAnalyticsEvent;
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { EditorState } from 'prosemirror-state';
|
|
4
|
-
import { DirectEditorProps
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
4
|
+
import type { DirectEditorProps } from 'prosemirror-view';
|
|
5
|
+
import { EditorView } from 'prosemirror-view';
|
|
6
|
+
import type { Node as PMNode } from 'prosemirror-model';
|
|
7
|
+
import type { WrappedComponentProps } from 'react-intl-next';
|
|
8
|
+
import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
9
|
+
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
10
|
+
import type { ErrorReporter, SEVERITY } from '@atlaskit/editor-common/utils';
|
|
10
11
|
import { ExperienceStore } from '@atlaskit/editor-common/ufo';
|
|
11
|
-
import { Transformer, AllEditorPresetPluginTypes } from '@atlaskit/editor-common/types';
|
|
12
|
-
import { Dispatch
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
12
|
+
import type { Transformer, AllEditorPresetPluginTypes } from '@atlaskit/editor-common/types';
|
|
13
|
+
import type { Dispatch } from '../event-dispatcher';
|
|
14
|
+
import { EventDispatcher } from '../event-dispatcher';
|
|
15
|
+
import { FULL_WIDTH_MODE } from '@atlaskit/editor-common/analytics';
|
|
16
|
+
import type { EditorAppearance, EditorConfig, EditorReactContext, EditorPlugin, EditorProps } from '../types';
|
|
15
17
|
import type { EditorNextProps } from '../types/editor-props';
|
|
16
|
-
import { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
17
|
-
import { SEVERITY } from '@atlaskit/editor-common/utils';
|
|
18
|
+
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
18
19
|
import { TransactionTracker } from '../utils/performance/track-transactions';
|
|
19
|
-
import type { FireAnalyticsCallback } from '@atlaskit/editor-common/analytics';
|
|
20
|
-
import { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
|
|
20
|
+
import type { FireAnalyticsCallback, AnalyticsEventPayload, DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
21
|
+
import type { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
|
|
21
22
|
export interface EditorViewProps {
|
|
22
23
|
editorProps: EditorProps | EditorNextProps;
|
|
23
24
|
createAnalyticsEvent?: CreateUIAnalyticsEvent;
|
package/package.json
CHANGED
package/report.api.md
CHANGED
|
@@ -23,7 +23,7 @@ import { ACTION } from '@atlaskit/editor-common/analytics';
|
|
|
23
23
|
import { ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
24
24
|
import { ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
25
25
|
import { ActivityProvider } from '@atlaskit/activity-provider';
|
|
26
|
-
import { AllEditorPresetPluginTypes } from '@atlaskit/editor-common/types';
|
|
26
|
+
import type { AllEditorPresetPluginTypes } from '@atlaskit/editor-common/types';
|
|
27
27
|
import { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
|
|
28
28
|
import { AnalyticsEventPayload as AnalyticsEventPayload_2 } from '@atlaskit/analytics-next/AnalyticsEvent';
|
|
29
29
|
import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
@@ -43,9 +43,9 @@ import { darkModeStatusColorPalette } from '@atlaskit/editor-common/ui-color';
|
|
|
43
43
|
import { DecorationSet } from 'prosemirror-view';
|
|
44
44
|
import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
45
45
|
import { DEFAULT_BORDER_COLOR } from '@atlaskit/editor-common/ui-color';
|
|
46
|
-
import { DirectEditorProps } from 'prosemirror-view';
|
|
46
|
+
import type { DirectEditorProps } from 'prosemirror-view';
|
|
47
47
|
import { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
48
|
-
import { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
48
|
+
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
49
49
|
import { DropdownOptionT } from '@atlaskit/editor-common/types';
|
|
50
50
|
import { EditorActionsOptions } from '@atlaskit/editor-common/types';
|
|
51
51
|
import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
@@ -148,13 +148,13 @@ import type { SearchProvider } from '@atlaskit/editor-common/provider-factory';
|
|
|
148
148
|
import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
149
149
|
import type { SelectOption } from '@atlaskit/editor-common/types';
|
|
150
150
|
import { setTextSelection } from '@atlaskit/editor-common/utils';
|
|
151
|
-
import { SEVERITY } from '@atlaskit/editor-common/utils';
|
|
151
|
+
import type { SEVERITY } from '@atlaskit/editor-common/utils';
|
|
152
152
|
import { TaskDecisionProvider } from '@atlaskit/task-decision';
|
|
153
153
|
import { TeamMentionResource } from '@atlaskit/mention/team-resource';
|
|
154
154
|
import { ToolbarUIComponentFactory } from '@atlaskit/editor-common/types';
|
|
155
155
|
import { Transaction } from 'prosemirror-state';
|
|
156
156
|
import { TransactionTracking } from '@atlaskit/editor-common/types';
|
|
157
|
-
import { Transformer as Transformer_2 } from '@atlaskit/editor-common/types';
|
|
157
|
+
import type { Transformer as Transformer_2 } from '@atlaskit/editor-common/types';
|
|
158
158
|
import type { TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
159
159
|
import type { TypeAheadItem } from '@atlaskit/editor-common/types';
|
|
160
160
|
import type { TypeAheadItem as TypeAheadItem_2 } from '@atlaskit/editor-common/provider-factory';
|