@atlaskit/editor-plugin-base 7.2.3 → 7.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 +15 -0
- package/dist/cjs/pm-plugins/filter-steps.js +8 -3
- package/dist/cjs/pm-plugins/frozen-editor.js +6 -0
- package/dist/cjs/pm-plugins/inline-cursor-target.js +10 -0
- package/dist/cjs/pm-plugins/lazy-node-view-decoration.js +8 -0
- package/dist/cjs/pm-plugins/scroll-gutter/plugin.js +4 -0
- package/dist/es2019/pm-plugins/filter-steps.js +6 -1
- package/dist/es2019/pm-plugins/frozen-editor.js +8 -0
- package/dist/es2019/pm-plugins/inline-cursor-target.js +12 -0
- package/dist/es2019/pm-plugins/lazy-node-view-decoration.js +11 -0
- package/dist/es2019/pm-plugins/scroll-gutter/plugin.js +6 -0
- package/dist/esm/pm-plugins/filter-steps.js +8 -3
- package/dist/esm/pm-plugins/frozen-editor.js +6 -0
- package/dist/esm/pm-plugins/inline-cursor-target.js +10 -0
- package/dist/esm/pm-plugins/lazy-node-view-decoration.js +8 -0
- package/dist/esm/pm-plugins/scroll-gutter/plugin.js +4 -0
- package/package.json +3 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-base
|
|
2
2
|
|
|
3
|
+
## 7.2.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 7.2.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`4d676bbdb3ce6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4d676bbdb3ce6) -
|
|
14
|
+
ts-ignore added temporarily to unblock local consumption for help-center, will be removed once
|
|
15
|
+
project refs are setup
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 7.2.3
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -7,12 +7,17 @@ exports.default = void 0;
|
|
|
7
7
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
8
8
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
9
9
|
var hasInvalidSteps = function hasInvalidSteps(tr) {
|
|
10
|
-
return (
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
return (
|
|
11
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
12
|
+
|
|
13
|
+
(tr.steps || []).some(function (step) {
|
|
14
|
+
return step.from > step.to;
|
|
15
|
+
})
|
|
16
|
+
);
|
|
13
17
|
};
|
|
14
18
|
var _default = exports.default = function _default(dispatchAnalyticsEvent) {
|
|
15
19
|
return new _safePlugin.SafePlugin({
|
|
20
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
16
21
|
filterTransaction: function filterTransaction(transaction) {
|
|
17
22
|
if (hasInvalidSteps(transaction)) {
|
|
18
23
|
// eslint-disable-next-line no-console
|
|
@@ -123,6 +123,7 @@ var _default = exports.default = function _default(contextIdentifierPlugin) {
|
|
|
123
123
|
return new _safePlugin.SafePlugin({
|
|
124
124
|
key: frozenEditorPluginKey,
|
|
125
125
|
props: (0, _isPerformanceApiAvailable.isPerformanceAPIAvailable)() ? {
|
|
126
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
126
127
|
handleTextInput: function handleTextInput(view) {
|
|
127
128
|
if (browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType) {
|
|
128
129
|
interactionType = _analytics.BROWSER_FREEZE_INTERACTION_TYPE.TYPING;
|
|
@@ -137,16 +138,21 @@ var _default = exports.default = function _default(contextIdentifierPlugin) {
|
|
|
137
138
|
return false;
|
|
138
139
|
},
|
|
139
140
|
handleDOMEvents: browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType ? {
|
|
141
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
142
|
+
|
|
140
143
|
click: function click() {
|
|
141
144
|
interactionType = (0, _frozenEditor.setInteractionType)(_analytics.BROWSER_FREEZE_INTERACTION_TYPE.CLICKING);
|
|
142
145
|
return false;
|
|
143
146
|
},
|
|
147
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
148
|
+
|
|
144
149
|
paste: function paste() {
|
|
145
150
|
interactionType = (0, _frozenEditor.setInteractionType)(_analytics.BROWSER_FREEZE_INTERACTION_TYPE.PASTING);
|
|
146
151
|
return false;
|
|
147
152
|
}
|
|
148
153
|
} : undefined
|
|
149
154
|
} : undefined,
|
|
155
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
150
156
|
view: function view(_view) {
|
|
151
157
|
if (!(0, _isPerformanceApiAvailable.isPerformanceObserverAvailable)()) {
|
|
152
158
|
return {};
|
|
@@ -29,6 +29,7 @@ var _default = exports.default = function _default() {
|
|
|
29
29
|
cursorTarget: undefined
|
|
30
30
|
};
|
|
31
31
|
},
|
|
32
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
32
33
|
apply: function apply(tr) {
|
|
33
34
|
var selection = tr.selection,
|
|
34
35
|
doc = tr.doc;
|
|
@@ -85,6 +86,7 @@ var _default = exports.default = function _default() {
|
|
|
85
86
|
}
|
|
86
87
|
},
|
|
87
88
|
props: {
|
|
89
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
88
90
|
decorations: function decorations(state) {
|
|
89
91
|
var doc = state.doc;
|
|
90
92
|
var _ref = inlineCursorTargetStateKey.getState(state),
|
|
@@ -94,6 +96,8 @@ var _default = exports.default = function _default() {
|
|
|
94
96
|
}
|
|
95
97
|
return null;
|
|
96
98
|
},
|
|
99
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
100
|
+
|
|
97
101
|
handleDOMEvents: {
|
|
98
102
|
// Workaround to prevent the decorations created by the plugin from
|
|
99
103
|
// blocking shift + arrow left/right selections in safari. When
|
|
@@ -101,6 +105,8 @@ var _default = exports.default = function _default() {
|
|
|
101
105
|
// plugin to prevent it from creating decorations.
|
|
102
106
|
// TODO: ED-26959 - We may be able to remove this when playing the following ticket:
|
|
103
107
|
// https://product-fabric.atlassian.net/browse/ED-14938
|
|
108
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
109
|
+
|
|
104
110
|
keydown: function keydown(view, event) {
|
|
105
111
|
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
106
112
|
if (browser.safari && event instanceof KeyboardEvent && event.shiftKey && (event.key === 'ArrowLeft' || event.key === 'ArrowRight')) {
|
|
@@ -114,6 +120,8 @@ var _default = exports.default = function _default() {
|
|
|
114
120
|
// after a composition event ends. If so, manually insert the
|
|
115
121
|
// event data in order to prevent contents ending up inside
|
|
116
122
|
// of the cursor target decorations.
|
|
123
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
124
|
+
|
|
117
125
|
compositionend: function compositionend(view, incorrectlyTypedEvent) {
|
|
118
126
|
// This is typed by the prosemirror definitions as Event,
|
|
119
127
|
// this type is incorrect, and it is actually an InputEvent
|
|
@@ -135,6 +143,8 @@ var _default = exports.default = function _default() {
|
|
|
135
143
|
// before any input event. If so, manually insert the
|
|
136
144
|
// event data in order to prevent contents ending up inside
|
|
137
145
|
// of the cursor target decorations.
|
|
146
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
147
|
+
|
|
138
148
|
beforeinput: function beforeinput(view, incorrectlyTypedEvent) {
|
|
139
149
|
// This is typed by the prosemirror definitions as Event,
|
|
140
150
|
// this type is incorrect, and it is actually an InputEvent
|
|
@@ -27,11 +27,15 @@ function createLazyNodeViewDecorationPlugin() {
|
|
|
27
27
|
nodeTypes: []
|
|
28
28
|
};
|
|
29
29
|
},
|
|
30
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
30
31
|
apply: function apply(tr, _oldState, newState) {
|
|
31
32
|
var actionPayload = tr.getMeta(_lazyNodeView.lazyNodeViewDecorationPluginKey);
|
|
32
33
|
var pluginState = _lazyNodeView.lazyNodeViewDecorationPluginKey.getState(newState);
|
|
33
34
|
if ((actionPayload === null || actionPayload === void 0 ? void 0 : actionPayload.type) === 'add' && actionPayload.nodeTypes.size) {
|
|
34
35
|
var decorations = [];
|
|
36
|
+
|
|
37
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
38
|
+
|
|
35
39
|
tr.doc.nodesBetween(0, tr.doc.nodeSize - 2, function (node, pos) {
|
|
36
40
|
if (actionPayload.nodeTypes.has(node.type.name)) {
|
|
37
41
|
decorations.push(_view.Decoration.node(pos, pos + node.nodeSize, {
|
|
@@ -50,6 +54,8 @@ function createLazyNodeViewDecorationPlugin() {
|
|
|
50
54
|
}
|
|
51
55
|
if (tr.docChanged) {
|
|
52
56
|
return {
|
|
57
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
58
|
+
|
|
53
59
|
decorations: pluginState === null || pluginState === void 0 ? void 0 : pluginState.decorations.map(tr.mapping, tr.doc)
|
|
54
60
|
};
|
|
55
61
|
}
|
|
@@ -62,8 +68,10 @@ function createLazyNodeViewDecorationPlugin() {
|
|
|
62
68
|
return (_lazyNodeViewDecorati = _lazyNodeView.lazyNodeViewDecorationPluginKey.getState(state)) === null || _lazyNodeViewDecorati === void 0 ? void 0 : _lazyNodeViewDecorati.decorations;
|
|
63
69
|
}
|
|
64
70
|
},
|
|
71
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
65
72
|
view: function view(editorView) {
|
|
66
73
|
return {
|
|
74
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
67
75
|
update: function update() {
|
|
68
76
|
/**
|
|
69
77
|
* After view update can clean up decorations...
|
|
@@ -49,6 +49,8 @@ var _default = exports.default = function _default() {
|
|
|
49
49
|
init: function init() {
|
|
50
50
|
return {};
|
|
51
51
|
},
|
|
52
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
53
|
+
|
|
52
54
|
apply: function apply(tr, pluginState) {
|
|
53
55
|
if (tr.getMeta(_pluginKey.scrollGutterPluginKey)) {
|
|
54
56
|
return tr.getMeta(_pluginKey.scrollGutterPluginKey);
|
|
@@ -65,6 +67,7 @@ var _default = exports.default = function _default() {
|
|
|
65
67
|
// Defaults to 5: https://prosemirror.net/docs/ref/#view.EditorProps.scrollMargin
|
|
66
68
|
scrollMargin: gutterSize
|
|
67
69
|
},
|
|
70
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
68
71
|
view: function view(_view) {
|
|
69
72
|
var _editorElement;
|
|
70
73
|
// Store references to avoid lookups on successive checks.
|
|
@@ -76,6 +79,7 @@ var _default = exports.default = function _default() {
|
|
|
76
79
|
cleanup = createGutter(gutterSize, editorParentElement);
|
|
77
80
|
}
|
|
78
81
|
return {
|
|
82
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
79
83
|
destroy: function destroy() {
|
|
80
84
|
cleanup();
|
|
81
85
|
editorParentElement = editorElement = null;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, getAnalyticsEventsFromTransaction } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
const hasInvalidSteps = tr =>
|
|
3
|
+
const hasInvalidSteps = tr =>
|
|
4
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
5
|
+
|
|
6
|
+
(tr.steps || []).some(step => step.from > step.to);
|
|
4
7
|
export default (dispatchAnalyticsEvent => {
|
|
5
8
|
return new SafePlugin({
|
|
9
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
10
|
+
|
|
6
11
|
filterTransaction(transaction) {
|
|
7
12
|
if (hasInvalidSteps(transaction)) {
|
|
8
13
|
// eslint-disable-next-line no-console
|
|
@@ -113,6 +113,8 @@ export default (contextIdentifierPlugin => (dispatchAnalyticsEvent, inputTrackin
|
|
|
113
113
|
return new SafePlugin({
|
|
114
114
|
key: frozenEditorPluginKey,
|
|
115
115
|
props: isPerformanceAPIAvailable() ? {
|
|
116
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
117
|
+
|
|
116
118
|
handleTextInput(view) {
|
|
117
119
|
if (browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType) {
|
|
118
120
|
interactionType = BROWSER_FREEZE_INTERACTION_TYPE.TYPING;
|
|
@@ -127,16 +129,22 @@ export default (contextIdentifierPlugin => (dispatchAnalyticsEvent, inputTrackin
|
|
|
127
129
|
return false;
|
|
128
130
|
},
|
|
129
131
|
handleDOMEvents: browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType ? {
|
|
132
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
133
|
+
|
|
130
134
|
click: () => {
|
|
131
135
|
interactionType = setInteractionType(BROWSER_FREEZE_INTERACTION_TYPE.CLICKING);
|
|
132
136
|
return false;
|
|
133
137
|
},
|
|
138
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
139
|
+
|
|
134
140
|
paste: () => {
|
|
135
141
|
interactionType = setInteractionType(BROWSER_FREEZE_INTERACTION_TYPE.PASTING);
|
|
136
142
|
return false;
|
|
137
143
|
}
|
|
138
144
|
} : undefined
|
|
139
145
|
} : undefined,
|
|
146
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
147
|
+
|
|
140
148
|
view(view) {
|
|
141
149
|
if (!isPerformanceObserverAvailable()) {
|
|
142
150
|
return {};
|
|
@@ -21,6 +21,8 @@ export default (() => {
|
|
|
21
21
|
init: () => ({
|
|
22
22
|
cursorTarget: undefined
|
|
23
23
|
}),
|
|
24
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
25
|
+
|
|
24
26
|
apply(tr) {
|
|
25
27
|
const {
|
|
26
28
|
selection,
|
|
@@ -83,6 +85,8 @@ export default (() => {
|
|
|
83
85
|
}
|
|
84
86
|
},
|
|
85
87
|
props: {
|
|
88
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
89
|
+
|
|
86
90
|
decorations(state) {
|
|
87
91
|
const {
|
|
88
92
|
doc
|
|
@@ -95,6 +99,8 @@ export default (() => {
|
|
|
95
99
|
}
|
|
96
100
|
return null;
|
|
97
101
|
},
|
|
102
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
103
|
+
|
|
98
104
|
handleDOMEvents: {
|
|
99
105
|
// Workaround to prevent the decorations created by the plugin from
|
|
100
106
|
// blocking shift + arrow left/right selections in safari. When
|
|
@@ -102,6 +108,8 @@ export default (() => {
|
|
|
102
108
|
// plugin to prevent it from creating decorations.
|
|
103
109
|
// TODO: ED-26959 - We may be able to remove this when playing the following ticket:
|
|
104
110
|
// https://product-fabric.atlassian.net/browse/ED-14938
|
|
111
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
112
|
+
|
|
105
113
|
keydown: (view, event) => {
|
|
106
114
|
const browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
107
115
|
if (browser.safari && event instanceof KeyboardEvent && event.shiftKey && (event.key === 'ArrowLeft' || event.key === 'ArrowRight')) {
|
|
@@ -115,6 +123,8 @@ export default (() => {
|
|
|
115
123
|
// after a composition event ends. If so, manually insert the
|
|
116
124
|
// event data in order to prevent contents ending up inside
|
|
117
125
|
// of the cursor target decorations.
|
|
126
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
127
|
+
|
|
118
128
|
compositionend: (view, incorrectlyTypedEvent) => {
|
|
119
129
|
// This is typed by the prosemirror definitions as Event,
|
|
120
130
|
// this type is incorrect, and it is actually an InputEvent
|
|
@@ -139,6 +149,8 @@ export default (() => {
|
|
|
139
149
|
// before any input event. If so, manually insert the
|
|
140
150
|
// event data in order to prevent contents ending up inside
|
|
141
151
|
// of the cursor target decorations.
|
|
152
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
153
|
+
|
|
142
154
|
beforeinput: (view, incorrectlyTypedEvent) => {
|
|
143
155
|
// This is typed by the prosemirror definitions as Event,
|
|
144
156
|
// this type is incorrect, and it is actually an InputEvent
|
|
@@ -21,11 +21,16 @@ export function createLazyNodeViewDecorationPlugin() {
|
|
|
21
21
|
nodeTypes: []
|
|
22
22
|
};
|
|
23
23
|
},
|
|
24
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
25
|
+
|
|
24
26
|
apply(tr, _oldState, newState) {
|
|
25
27
|
const actionPayload = tr.getMeta(lazyNodeViewDecorationPluginKey);
|
|
26
28
|
const pluginState = lazyNodeViewDecorationPluginKey.getState(newState);
|
|
27
29
|
if ((actionPayload === null || actionPayload === void 0 ? void 0 : actionPayload.type) === 'add' && actionPayload.nodeTypes.size) {
|
|
28
30
|
const decorations = [];
|
|
31
|
+
|
|
32
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
33
|
+
|
|
29
34
|
tr.doc.nodesBetween(0, tr.doc.nodeSize - 2, (node, pos) => {
|
|
30
35
|
if (actionPayload.nodeTypes.has(node.type.name)) {
|
|
31
36
|
decorations.push(Decoration.node(pos, pos + node.nodeSize, {
|
|
@@ -44,6 +49,8 @@ export function createLazyNodeViewDecorationPlugin() {
|
|
|
44
49
|
}
|
|
45
50
|
if (tr.docChanged) {
|
|
46
51
|
return {
|
|
52
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
53
|
+
|
|
47
54
|
decorations: pluginState === null || pluginState === void 0 ? void 0 : pluginState.decorations.map(tr.mapping, tr.doc)
|
|
48
55
|
};
|
|
49
56
|
}
|
|
@@ -56,8 +63,12 @@ export function createLazyNodeViewDecorationPlugin() {
|
|
|
56
63
|
return (_lazyNodeViewDecorati = lazyNodeViewDecorationPluginKey.getState(state)) === null || _lazyNodeViewDecorati === void 0 ? void 0 : _lazyNodeViewDecorati.decorations;
|
|
57
64
|
}
|
|
58
65
|
},
|
|
66
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
67
|
+
|
|
59
68
|
view(editorView) {
|
|
60
69
|
return {
|
|
70
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
71
|
+
|
|
61
72
|
update() {
|
|
62
73
|
/**
|
|
63
74
|
* After view update can clean up decorations...
|
|
@@ -37,6 +37,8 @@ export default ((pluginOptions = {}) => {
|
|
|
37
37
|
key: scrollGutterPluginKey,
|
|
38
38
|
state: {
|
|
39
39
|
init: () => ({}),
|
|
40
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
41
|
+
|
|
40
42
|
apply: (tr, pluginState) => {
|
|
41
43
|
if (tr.getMeta(scrollGutterPluginKey)) {
|
|
42
44
|
return tr.getMeta(scrollGutterPluginKey);
|
|
@@ -53,6 +55,8 @@ export default ((pluginOptions = {}) => {
|
|
|
53
55
|
// Defaults to 5: https://prosemirror.net/docs/ref/#view.EditorProps.scrollMargin
|
|
54
56
|
scrollMargin: gutterSize
|
|
55
57
|
},
|
|
58
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
59
|
+
|
|
56
60
|
view(view) {
|
|
57
61
|
var _editorElement;
|
|
58
62
|
// Store references to avoid lookups on successive checks.
|
|
@@ -64,6 +68,8 @@ export default ((pluginOptions = {}) => {
|
|
|
64
68
|
cleanup = createGutter(gutterSize, editorParentElement);
|
|
65
69
|
}
|
|
66
70
|
return {
|
|
71
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
72
|
+
|
|
67
73
|
destroy() {
|
|
68
74
|
cleanup();
|
|
69
75
|
editorParentElement = editorElement = null;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, getAnalyticsEventsFromTransaction } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
3
|
var hasInvalidSteps = function hasInvalidSteps(tr) {
|
|
4
|
-
return (
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
return (
|
|
5
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
6
|
+
|
|
7
|
+
(tr.steps || []).some(function (step) {
|
|
8
|
+
return step.from > step.to;
|
|
9
|
+
})
|
|
10
|
+
);
|
|
7
11
|
};
|
|
8
12
|
export default (function (dispatchAnalyticsEvent) {
|
|
9
13
|
return new SafePlugin({
|
|
14
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
10
15
|
filterTransaction: function filterTransaction(transaction) {
|
|
11
16
|
if (hasInvalidSteps(transaction)) {
|
|
12
17
|
// eslint-disable-next-line no-console
|
|
@@ -116,6 +116,7 @@ export default (function (contextIdentifierPlugin) {
|
|
|
116
116
|
return new SafePlugin({
|
|
117
117
|
key: frozenEditorPluginKey,
|
|
118
118
|
props: isPerformanceAPIAvailable() ? {
|
|
119
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
119
120
|
handleTextInput: function handleTextInput(view) {
|
|
120
121
|
if (browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType) {
|
|
121
122
|
interactionType = BROWSER_FREEZE_INTERACTION_TYPE.TYPING;
|
|
@@ -130,16 +131,21 @@ export default (function (contextIdentifierPlugin) {
|
|
|
130
131
|
return false;
|
|
131
132
|
},
|
|
132
133
|
handleDOMEvents: browserFreezeTracking !== null && browserFreezeTracking !== void 0 && browserFreezeTracking.trackInteractionType ? {
|
|
134
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
135
|
+
|
|
133
136
|
click: function click() {
|
|
134
137
|
interactionType = setInteractionType(BROWSER_FREEZE_INTERACTION_TYPE.CLICKING);
|
|
135
138
|
return false;
|
|
136
139
|
},
|
|
140
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
141
|
+
|
|
137
142
|
paste: function paste() {
|
|
138
143
|
interactionType = setInteractionType(BROWSER_FREEZE_INTERACTION_TYPE.PASTING);
|
|
139
144
|
return false;
|
|
140
145
|
}
|
|
141
146
|
} : undefined
|
|
142
147
|
} : undefined,
|
|
148
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
143
149
|
view: function view(_view) {
|
|
144
150
|
if (!isPerformanceObserverAvailable()) {
|
|
145
151
|
return {};
|
|
@@ -23,6 +23,7 @@ export default (function () {
|
|
|
23
23
|
cursorTarget: undefined
|
|
24
24
|
};
|
|
25
25
|
},
|
|
26
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
26
27
|
apply: function apply(tr) {
|
|
27
28
|
var selection = tr.selection,
|
|
28
29
|
doc = tr.doc;
|
|
@@ -79,6 +80,7 @@ export default (function () {
|
|
|
79
80
|
}
|
|
80
81
|
},
|
|
81
82
|
props: {
|
|
83
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
82
84
|
decorations: function decorations(state) {
|
|
83
85
|
var doc = state.doc;
|
|
84
86
|
var _ref = inlineCursorTargetStateKey.getState(state),
|
|
@@ -88,6 +90,8 @@ export default (function () {
|
|
|
88
90
|
}
|
|
89
91
|
return null;
|
|
90
92
|
},
|
|
93
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
94
|
+
|
|
91
95
|
handleDOMEvents: {
|
|
92
96
|
// Workaround to prevent the decorations created by the plugin from
|
|
93
97
|
// blocking shift + arrow left/right selections in safari. When
|
|
@@ -95,6 +99,8 @@ export default (function () {
|
|
|
95
99
|
// plugin to prevent it from creating decorations.
|
|
96
100
|
// TODO: ED-26959 - We may be able to remove this when playing the following ticket:
|
|
97
101
|
// https://product-fabric.atlassian.net/browse/ED-14938
|
|
102
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
103
|
+
|
|
98
104
|
keydown: function keydown(view, event) {
|
|
99
105
|
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
100
106
|
if (browser.safari && event instanceof KeyboardEvent && event.shiftKey && (event.key === 'ArrowLeft' || event.key === 'ArrowRight')) {
|
|
@@ -108,6 +114,8 @@ export default (function () {
|
|
|
108
114
|
// after a composition event ends. If so, manually insert the
|
|
109
115
|
// event data in order to prevent contents ending up inside
|
|
110
116
|
// of the cursor target decorations.
|
|
117
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
118
|
+
|
|
111
119
|
compositionend: function compositionend(view, incorrectlyTypedEvent) {
|
|
112
120
|
// This is typed by the prosemirror definitions as Event,
|
|
113
121
|
// this type is incorrect, and it is actually an InputEvent
|
|
@@ -129,6 +137,8 @@ export default (function () {
|
|
|
129
137
|
// before any input event. If so, manually insert the
|
|
130
138
|
// event data in order to prevent contents ending up inside
|
|
131
139
|
// of the cursor target decorations.
|
|
140
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
141
|
+
|
|
132
142
|
beforeinput: function beforeinput(view, incorrectlyTypedEvent) {
|
|
133
143
|
// This is typed by the prosemirror definitions as Event,
|
|
134
144
|
// this type is incorrect, and it is actually an InputEvent
|
|
@@ -21,11 +21,15 @@ export function createLazyNodeViewDecorationPlugin() {
|
|
|
21
21
|
nodeTypes: []
|
|
22
22
|
};
|
|
23
23
|
},
|
|
24
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
24
25
|
apply: function apply(tr, _oldState, newState) {
|
|
25
26
|
var actionPayload = tr.getMeta(lazyNodeViewDecorationPluginKey);
|
|
26
27
|
var pluginState = lazyNodeViewDecorationPluginKey.getState(newState);
|
|
27
28
|
if ((actionPayload === null || actionPayload === void 0 ? void 0 : actionPayload.type) === 'add' && actionPayload.nodeTypes.size) {
|
|
28
29
|
var decorations = [];
|
|
30
|
+
|
|
31
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
32
|
+
|
|
29
33
|
tr.doc.nodesBetween(0, tr.doc.nodeSize - 2, function (node, pos) {
|
|
30
34
|
if (actionPayload.nodeTypes.has(node.type.name)) {
|
|
31
35
|
decorations.push(Decoration.node(pos, pos + node.nodeSize, {
|
|
@@ -44,6 +48,8 @@ export function createLazyNodeViewDecorationPlugin() {
|
|
|
44
48
|
}
|
|
45
49
|
if (tr.docChanged) {
|
|
46
50
|
return {
|
|
51
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
52
|
+
|
|
47
53
|
decorations: pluginState === null || pluginState === void 0 ? void 0 : pluginState.decorations.map(tr.mapping, tr.doc)
|
|
48
54
|
};
|
|
49
55
|
}
|
|
@@ -56,8 +62,10 @@ export function createLazyNodeViewDecorationPlugin() {
|
|
|
56
62
|
return (_lazyNodeViewDecorati = lazyNodeViewDecorationPluginKey.getState(state)) === null || _lazyNodeViewDecorati === void 0 ? void 0 : _lazyNodeViewDecorati.decorations;
|
|
57
63
|
}
|
|
58
64
|
},
|
|
65
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
59
66
|
view: function view(editorView) {
|
|
60
67
|
return {
|
|
68
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
61
69
|
update: function update() {
|
|
62
70
|
/**
|
|
63
71
|
* After view update can clean up decorations...
|
|
@@ -43,6 +43,8 @@ export default (function () {
|
|
|
43
43
|
init: function init() {
|
|
44
44
|
return {};
|
|
45
45
|
},
|
|
46
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
47
|
+
|
|
46
48
|
apply: function apply(tr, pluginState) {
|
|
47
49
|
if (tr.getMeta(scrollGutterPluginKey)) {
|
|
48
50
|
return tr.getMeta(scrollGutterPluginKey);
|
|
@@ -59,6 +61,7 @@ export default (function () {
|
|
|
59
61
|
// Defaults to 5: https://prosemirror.net/docs/ref/#view.EditorProps.scrollMargin
|
|
60
62
|
scrollMargin: gutterSize
|
|
61
63
|
},
|
|
64
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
62
65
|
view: function view(_view) {
|
|
63
66
|
var _editorElement;
|
|
64
67
|
// Store references to avoid lookups on successive checks.
|
|
@@ -70,6 +73,7 @@ export default (function () {
|
|
|
70
73
|
cleanup = createGutter(gutterSize, editorParentElement);
|
|
71
74
|
}
|
|
72
75
|
return {
|
|
76
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
73
77
|
destroy: function destroy() {
|
|
74
78
|
cleanup();
|
|
75
79
|
editorParentElement = editorElement = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-base",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.5",
|
|
4
4
|
"description": "Base plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,9 +31,8 @@
|
|
|
31
31
|
"@atlaskit/editor-plugin-context-identifier": "^6.0.0",
|
|
32
32
|
"@atlaskit/editor-plugin-feature-flags": "^5.0.0",
|
|
33
33
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
34
|
-
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
35
34
|
"@atlaskit/prosemirror-history": "^0.2.0",
|
|
36
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
35
|
+
"@atlaskit/tmp-editor-statsig": "^14.0.0",
|
|
37
36
|
"@babel/runtime": "^7.0.0"
|
|
38
37
|
},
|
|
39
38
|
"techstack": {
|
|
@@ -75,6 +74,6 @@
|
|
|
75
74
|
}
|
|
76
75
|
},
|
|
77
76
|
"peerDependencies": {
|
|
78
|
-
"@atlaskit/editor-common": "^110.
|
|
77
|
+
"@atlaskit/editor-common": "^110.36.0"
|
|
79
78
|
}
|
|
80
79
|
}
|