@atlaskit/editor-plugin-selection-marker 1.0.1 → 1.1.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 +12 -0
- package/dist/cjs/plugin.js +50 -5
- package/dist/cjs/pm-plugins/main.js +9 -11
- package/dist/es2019/plugin.js +45 -2
- package/dist/es2019/pm-plugins/main.js +9 -11
- package/dist/esm/plugin.js +51 -6
- package/dist/esm/pm-plugins/main.js +9 -11
- package/dist/types/index.d.ts +1 -1
- package/dist/types/pm-plugins/main.d.ts +2 -0
- package/dist/types/types.d.ts +7 -0
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +2 -0
- package/dist/types-ts4.5/types.d.ts +7 -0
- package/package.json +6 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-selection-marker
|
|
2
2
|
|
|
3
|
+
## 1.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 1.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#80131](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/80131) [`336116d18762`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/336116d18762) - Expose a new method hideDecoration on selection marker which can be used to temporarily disable the selection marker behaviour.
|
|
14
|
+
|
|
3
15
|
## 1.0.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -23,14 +23,43 @@ var selectionMarkerPlugin = exports.selectionMarkerPlugin = function selectionMa
|
|
|
23
23
|
}
|
|
24
24
|
}];
|
|
25
25
|
},
|
|
26
|
-
|
|
27
|
-
var
|
|
26
|
+
getSharedState: function getSharedState(editorState) {
|
|
27
|
+
var _key$getState$forceHi, _key$getState;
|
|
28
|
+
if (!editorState) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
isForcedHidden: (_key$getState$forceHi = (_key$getState = _main.key.getState(editorState)) === null || _key$getState === void 0 ? void 0 : _key$getState.forceHide) !== null && _key$getState$forceHi !== void 0 ? _key$getState$forceHi : false
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
actions: {
|
|
36
|
+
// For now this is a very simple locking mechanism that only allows one
|
|
37
|
+
// plugin to hide / release at a time.
|
|
38
|
+
hideDecoration: function hideDecoration() {
|
|
39
|
+
var _api$selectionMarker, _api$core;
|
|
40
|
+
if (api !== null && api !== void 0 && (_api$selectionMarker = api.selectionMarker) !== null && _api$selectionMarker !== void 0 && (_api$selectionMarker = _api$selectionMarker.sharedState.currentState()) !== null && _api$selectionMarker !== void 0 && _api$selectionMarker.isForcedHidden) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
var success = api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(function (_ref2) {
|
|
44
|
+
var tr = _ref2.tr;
|
|
45
|
+
return tr.setMeta(_main.key, {
|
|
46
|
+
forceHide: true
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
if (!success) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
return cleanupHiddenDecoration(api);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
usePluginHook: function usePluginHook(_ref3) {
|
|
56
|
+
var editorView = _ref3.editorView;
|
|
28
57
|
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['focus', 'typeAhead']),
|
|
29
58
|
focusState = _useSharedPluginState.focusState,
|
|
30
59
|
typeAheadState = _useSharedPluginState.typeAheadState;
|
|
31
60
|
(0, _react.useEffect)(function () {
|
|
32
|
-
var
|
|
33
|
-
var shouldHide = (
|
|
61
|
+
var _ref4, _typeAheadState$isOpe;
|
|
62
|
+
var shouldHide = (_ref4 = (focusState === null || focusState === void 0 ? void 0 : focusState.hasFocus) || ((_typeAheadState$isOpe = typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.isOpen) !== null && _typeAheadState$isOpe !== void 0 ? _typeAheadState$isOpe : false)) !== null && _ref4 !== void 0 ? _ref4 : true;
|
|
34
63
|
requestAnimationFrame(function () {
|
|
35
64
|
return (0, _main.dispatchShouldHideDecorations)(editorView, shouldHide);
|
|
36
65
|
});
|
|
@@ -40,4 +69,20 @@ var selectionMarkerPlugin = exports.selectionMarkerPlugin = function selectionMa
|
|
|
40
69
|
return /*#__PURE__*/_react.default.createElement(_globalStyles.GlobalStylesWrapper, null);
|
|
41
70
|
}
|
|
42
71
|
};
|
|
43
|
-
};
|
|
72
|
+
};
|
|
73
|
+
function cleanupHiddenDecoration(api) {
|
|
74
|
+
var hasRun = false;
|
|
75
|
+
return function () {
|
|
76
|
+
var _api$selectionMarker2;
|
|
77
|
+
if (!hasRun && api !== null && api !== void 0 && (_api$selectionMarker2 = api.selectionMarker) !== null && _api$selectionMarker2 !== void 0 && (_api$selectionMarker2 = _api$selectionMarker2.sharedState.currentState()) !== null && _api$selectionMarker2 !== void 0 && _api$selectionMarker2.isForcedHidden) {
|
|
78
|
+
var _api$core2;
|
|
79
|
+
hasRun = true;
|
|
80
|
+
return api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(function (_ref5) {
|
|
81
|
+
var tr = _ref5.tr;
|
|
82
|
+
return tr.setMeta(_main.key, {
|
|
83
|
+
forceHide: false
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
@@ -21,22 +21,20 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
|
|
|
21
21
|
init: function init() {
|
|
22
22
|
return {
|
|
23
23
|
decorations: _view.DecorationSet.empty,
|
|
24
|
-
shouldHideDecorations: true
|
|
24
|
+
shouldHideDecorations: true,
|
|
25
|
+
forceHide: false
|
|
25
26
|
};
|
|
26
27
|
},
|
|
27
28
|
apply: function apply(tr, currentState) {
|
|
28
|
-
var _tr$getMeta$shouldHid, _tr$
|
|
29
|
-
var
|
|
29
|
+
var _tr$getMeta$forceHide, _tr$getMeta, _tr$getMeta$shouldHid, _tr$getMeta2;
|
|
30
|
+
var forceHide = (_tr$getMeta$forceHide = (_tr$getMeta = tr.getMeta(key)) === null || _tr$getMeta === void 0 ? void 0 : _tr$getMeta.forceHide) !== null && _tr$getMeta$forceHide !== void 0 ? _tr$getMeta$forceHide : currentState.forceHide;
|
|
31
|
+
var shouldHideDecorations = (_tr$getMeta$shouldHid = (_tr$getMeta2 = tr.getMeta(key)) === null || _tr$getMeta2 === void 0 ? void 0 : _tr$getMeta2.shouldHideDecorations) !== null && _tr$getMeta$shouldHid !== void 0 ? _tr$getMeta$shouldHid : currentState.shouldHideDecorations;
|
|
30
32
|
var selection = tr.selection;
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
decorations: _view.DecorationSet.empty,
|
|
34
|
-
shouldHideDecorations: shouldHideDecorations
|
|
35
|
-
};
|
|
36
|
-
}
|
|
33
|
+
var decorations = shouldHideDecorations || forceHide ? _view.DecorationSet.empty : _view.DecorationSet.create(tr.doc, [].concat((0, _toConsumableArray2.default)((0, _widgetDecoration.createWidgetDecoration)(selection.$anchor, 'anchor', selection)), [(0, _selectionDecoration.selectionDecoration)(selection)], (0, _toConsumableArray2.default)((0, _widgetDecoration.createWidgetDecoration)(selection.$head, 'head', selection))));
|
|
37
34
|
return {
|
|
38
|
-
decorations:
|
|
39
|
-
shouldHideDecorations: shouldHideDecorations
|
|
35
|
+
decorations: decorations,
|
|
36
|
+
shouldHideDecorations: shouldHideDecorations,
|
|
37
|
+
forceHide: forceHide
|
|
40
38
|
};
|
|
41
39
|
}
|
|
42
40
|
},
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
3
|
-
import { createPlugin, dispatchShouldHideDecorations } from './pm-plugins/main';
|
|
3
|
+
import { createPlugin, dispatchShouldHideDecorations, key } from './pm-plugins/main';
|
|
4
4
|
import { GlobalStylesWrapper } from './ui/global-styles';
|
|
5
5
|
export const selectionMarkerPlugin = ({
|
|
6
6
|
api
|
|
@@ -13,6 +13,34 @@ export const selectionMarkerPlugin = ({
|
|
|
13
13
|
plugin: () => createPlugin(api)
|
|
14
14
|
}];
|
|
15
15
|
},
|
|
16
|
+
getSharedState(editorState) {
|
|
17
|
+
var _key$getState$forceHi, _key$getState;
|
|
18
|
+
if (!editorState) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
isForcedHidden: (_key$getState$forceHi = (_key$getState = key.getState(editorState)) === null || _key$getState === void 0 ? void 0 : _key$getState.forceHide) !== null && _key$getState$forceHi !== void 0 ? _key$getState$forceHi : false
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
actions: {
|
|
26
|
+
// For now this is a very simple locking mechanism that only allows one
|
|
27
|
+
// plugin to hide / release at a time.
|
|
28
|
+
hideDecoration: () => {
|
|
29
|
+
var _api$selectionMarker, _api$selectionMarker$, _api$core;
|
|
30
|
+
if (api !== null && api !== void 0 && (_api$selectionMarker = api.selectionMarker) !== null && _api$selectionMarker !== void 0 && (_api$selectionMarker$ = _api$selectionMarker.sharedState.currentState()) !== null && _api$selectionMarker$ !== void 0 && _api$selectionMarker$.isForcedHidden) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
const success = api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(({
|
|
34
|
+
tr
|
|
35
|
+
}) => tr.setMeta(key, {
|
|
36
|
+
forceHide: true
|
|
37
|
+
}));
|
|
38
|
+
if (!success) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
return cleanupHiddenDecoration(api);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
16
44
|
usePluginHook({
|
|
17
45
|
editorView
|
|
18
46
|
}) {
|
|
@@ -30,4 +58,19 @@ export const selectionMarkerPlugin = ({
|
|
|
30
58
|
return /*#__PURE__*/React.createElement(GlobalStylesWrapper, null);
|
|
31
59
|
}
|
|
32
60
|
};
|
|
33
|
-
};
|
|
61
|
+
};
|
|
62
|
+
function cleanupHiddenDecoration(api) {
|
|
63
|
+
let hasRun = false;
|
|
64
|
+
return () => {
|
|
65
|
+
var _api$selectionMarker2, _api$selectionMarker3;
|
|
66
|
+
if (!hasRun && api !== null && api !== void 0 && (_api$selectionMarker2 = api.selectionMarker) !== null && _api$selectionMarker2 !== void 0 && (_api$selectionMarker3 = _api$selectionMarker2.sharedState.currentState()) !== null && _api$selectionMarker3 !== void 0 && _api$selectionMarker3.isForcedHidden) {
|
|
67
|
+
var _api$core2;
|
|
68
|
+
hasRun = true;
|
|
69
|
+
return api === null || api === void 0 ? void 0 : (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(({
|
|
70
|
+
tr
|
|
71
|
+
}) => tr.setMeta(key, {
|
|
72
|
+
forceHide: false
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
@@ -11,24 +11,22 @@ export const createPlugin = api => {
|
|
|
11
11
|
init() {
|
|
12
12
|
return {
|
|
13
13
|
decorations: DecorationSet.empty,
|
|
14
|
-
shouldHideDecorations: true
|
|
14
|
+
shouldHideDecorations: true,
|
|
15
|
+
forceHide: false
|
|
15
16
|
};
|
|
16
17
|
},
|
|
17
18
|
apply(tr, currentState) {
|
|
18
|
-
var _tr$getMeta$shouldHid, _tr$
|
|
19
|
-
const
|
|
19
|
+
var _tr$getMeta$forceHide, _tr$getMeta, _tr$getMeta$shouldHid, _tr$getMeta2;
|
|
20
|
+
const forceHide = (_tr$getMeta$forceHide = (_tr$getMeta = tr.getMeta(key)) === null || _tr$getMeta === void 0 ? void 0 : _tr$getMeta.forceHide) !== null && _tr$getMeta$forceHide !== void 0 ? _tr$getMeta$forceHide : currentState.forceHide;
|
|
21
|
+
const shouldHideDecorations = (_tr$getMeta$shouldHid = (_tr$getMeta2 = tr.getMeta(key)) === null || _tr$getMeta2 === void 0 ? void 0 : _tr$getMeta2.shouldHideDecorations) !== null && _tr$getMeta$shouldHid !== void 0 ? _tr$getMeta$shouldHid : currentState.shouldHideDecorations;
|
|
20
22
|
const {
|
|
21
23
|
selection
|
|
22
24
|
} = tr;
|
|
23
|
-
|
|
24
|
-
return {
|
|
25
|
-
decorations: DecorationSet.empty,
|
|
26
|
-
shouldHideDecorations
|
|
27
|
-
};
|
|
28
|
-
}
|
|
25
|
+
const decorations = shouldHideDecorations || forceHide ? DecorationSet.empty : DecorationSet.create(tr.doc, [...createWidgetDecoration(selection.$anchor, 'anchor', selection), selectionDecoration(selection), ...createWidgetDecoration(selection.$head, 'head', selection)]);
|
|
29
26
|
return {
|
|
30
|
-
decorations
|
|
31
|
-
shouldHideDecorations
|
|
27
|
+
decorations,
|
|
28
|
+
shouldHideDecorations,
|
|
29
|
+
forceHide
|
|
32
30
|
};
|
|
33
31
|
}
|
|
34
32
|
},
|
package/dist/esm/plugin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
3
|
-
import { createPlugin, dispatchShouldHideDecorations } from './pm-plugins/main';
|
|
3
|
+
import { createPlugin, dispatchShouldHideDecorations, key } from './pm-plugins/main';
|
|
4
4
|
import { GlobalStylesWrapper } from './ui/global-styles';
|
|
5
5
|
export var selectionMarkerPlugin = function selectionMarkerPlugin(_ref) {
|
|
6
6
|
var api = _ref.api;
|
|
@@ -14,14 +14,43 @@ export var selectionMarkerPlugin = function selectionMarkerPlugin(_ref) {
|
|
|
14
14
|
}
|
|
15
15
|
}];
|
|
16
16
|
},
|
|
17
|
-
|
|
18
|
-
var
|
|
17
|
+
getSharedState: function getSharedState(editorState) {
|
|
18
|
+
var _key$getState$forceHi, _key$getState;
|
|
19
|
+
if (!editorState) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
isForcedHidden: (_key$getState$forceHi = (_key$getState = key.getState(editorState)) === null || _key$getState === void 0 ? void 0 : _key$getState.forceHide) !== null && _key$getState$forceHi !== void 0 ? _key$getState$forceHi : false
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
actions: {
|
|
27
|
+
// For now this is a very simple locking mechanism that only allows one
|
|
28
|
+
// plugin to hide / release at a time.
|
|
29
|
+
hideDecoration: function hideDecoration() {
|
|
30
|
+
var _api$selectionMarker, _api$core;
|
|
31
|
+
if (api !== null && api !== void 0 && (_api$selectionMarker = api.selectionMarker) !== null && _api$selectionMarker !== void 0 && (_api$selectionMarker = _api$selectionMarker.sharedState.currentState()) !== null && _api$selectionMarker !== void 0 && _api$selectionMarker.isForcedHidden) {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
var success = api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(function (_ref2) {
|
|
35
|
+
var tr = _ref2.tr;
|
|
36
|
+
return tr.setMeta(key, {
|
|
37
|
+
forceHide: true
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
if (!success) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
return cleanupHiddenDecoration(api);
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
usePluginHook: function usePluginHook(_ref3) {
|
|
47
|
+
var editorView = _ref3.editorView;
|
|
19
48
|
var _useSharedPluginState = useSharedPluginState(api, ['focus', 'typeAhead']),
|
|
20
49
|
focusState = _useSharedPluginState.focusState,
|
|
21
50
|
typeAheadState = _useSharedPluginState.typeAheadState;
|
|
22
51
|
useEffect(function () {
|
|
23
|
-
var
|
|
24
|
-
var shouldHide = (
|
|
52
|
+
var _ref4, _typeAheadState$isOpe;
|
|
53
|
+
var shouldHide = (_ref4 = (focusState === null || focusState === void 0 ? void 0 : focusState.hasFocus) || ((_typeAheadState$isOpe = typeAheadState === null || typeAheadState === void 0 ? void 0 : typeAheadState.isOpen) !== null && _typeAheadState$isOpe !== void 0 ? _typeAheadState$isOpe : false)) !== null && _ref4 !== void 0 ? _ref4 : true;
|
|
25
54
|
requestAnimationFrame(function () {
|
|
26
55
|
return dispatchShouldHideDecorations(editorView, shouldHide);
|
|
27
56
|
});
|
|
@@ -31,4 +60,20 @@ export var selectionMarkerPlugin = function selectionMarkerPlugin(_ref) {
|
|
|
31
60
|
return /*#__PURE__*/React.createElement(GlobalStylesWrapper, null);
|
|
32
61
|
}
|
|
33
62
|
};
|
|
34
|
-
};
|
|
63
|
+
};
|
|
64
|
+
function cleanupHiddenDecoration(api) {
|
|
65
|
+
var hasRun = false;
|
|
66
|
+
return function () {
|
|
67
|
+
var _api$selectionMarker2;
|
|
68
|
+
if (!hasRun && api !== null && api !== void 0 && (_api$selectionMarker2 = api.selectionMarker) !== null && _api$selectionMarker2 !== void 0 && (_api$selectionMarker2 = _api$selectionMarker2.sharedState.currentState()) !== null && _api$selectionMarker2 !== void 0 && _api$selectionMarker2.isForcedHidden) {
|
|
69
|
+
var _api$core2;
|
|
70
|
+
hasRun = true;
|
|
71
|
+
return api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(function (_ref5) {
|
|
72
|
+
var tr = _ref5.tr;
|
|
73
|
+
return tr.setMeta(key, {
|
|
74
|
+
forceHide: false
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
@@ -12,22 +12,20 @@ export var createPlugin = function createPlugin(api) {
|
|
|
12
12
|
init: function init() {
|
|
13
13
|
return {
|
|
14
14
|
decorations: DecorationSet.empty,
|
|
15
|
-
shouldHideDecorations: true
|
|
15
|
+
shouldHideDecorations: true,
|
|
16
|
+
forceHide: false
|
|
16
17
|
};
|
|
17
18
|
},
|
|
18
19
|
apply: function apply(tr, currentState) {
|
|
19
|
-
var _tr$getMeta$shouldHid, _tr$
|
|
20
|
-
var
|
|
20
|
+
var _tr$getMeta$forceHide, _tr$getMeta, _tr$getMeta$shouldHid, _tr$getMeta2;
|
|
21
|
+
var forceHide = (_tr$getMeta$forceHide = (_tr$getMeta = tr.getMeta(key)) === null || _tr$getMeta === void 0 ? void 0 : _tr$getMeta.forceHide) !== null && _tr$getMeta$forceHide !== void 0 ? _tr$getMeta$forceHide : currentState.forceHide;
|
|
22
|
+
var shouldHideDecorations = (_tr$getMeta$shouldHid = (_tr$getMeta2 = tr.getMeta(key)) === null || _tr$getMeta2 === void 0 ? void 0 : _tr$getMeta2.shouldHideDecorations) !== null && _tr$getMeta$shouldHid !== void 0 ? _tr$getMeta$shouldHid : currentState.shouldHideDecorations;
|
|
21
23
|
var selection = tr.selection;
|
|
22
|
-
|
|
23
|
-
return {
|
|
24
|
-
decorations: DecorationSet.empty,
|
|
25
|
-
shouldHideDecorations: shouldHideDecorations
|
|
26
|
-
};
|
|
27
|
-
}
|
|
24
|
+
var decorations = shouldHideDecorations || forceHide ? DecorationSet.empty : DecorationSet.create(tr.doc, [].concat(_toConsumableArray(createWidgetDecoration(selection.$anchor, 'anchor', selection)), [selectionDecoration(selection)], _toConsumableArray(createWidgetDecoration(selection.$head, 'head', selection))));
|
|
28
25
|
return {
|
|
29
|
-
decorations:
|
|
30
|
-
shouldHideDecorations: shouldHideDecorations
|
|
26
|
+
decorations: decorations,
|
|
27
|
+
shouldHideDecorations: shouldHideDecorations,
|
|
28
|
+
forceHide: forceHide
|
|
31
29
|
};
|
|
32
30
|
}
|
|
33
31
|
},
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { selectionMarkerPlugin } from './plugin';
|
|
2
|
-
export type { SelectionMarkerPlugin } from './types';
|
|
2
|
+
export type { SelectionMarkerPlugin, ReleaseHiddenDecoration } from './types';
|
|
@@ -7,11 +7,13 @@ import type { SelectionMarkerPlugin } from '../types';
|
|
|
7
7
|
interface PluginState {
|
|
8
8
|
decorations: DecorationSet;
|
|
9
9
|
shouldHideDecorations: boolean;
|
|
10
|
+
forceHide: boolean;
|
|
10
11
|
}
|
|
11
12
|
export declare const key: PluginKey<PluginState>;
|
|
12
13
|
export declare const createPlugin: (api: ExtractInjectionAPI<SelectionMarkerPlugin> | undefined) => SafePlugin<{
|
|
13
14
|
decorations: DecorationSet;
|
|
14
15
|
shouldHideDecorations: any;
|
|
16
|
+
forceHide: any;
|
|
15
17
|
}>;
|
|
16
18
|
export declare function dispatchShouldHideDecorations(editorView: EditorView, shouldHideDecorations: boolean): void;
|
|
17
19
|
export {};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { FocusPlugin } from '@atlaskit/editor-plugin-focus';
|
|
3
3
|
import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
4
|
+
export type ReleaseHiddenDecoration = () => boolean | undefined;
|
|
4
5
|
export type SelectionMarkerPlugin = NextEditorPlugin<'selectionMarker', {
|
|
5
6
|
dependencies: [FocusPlugin, OptionalPlugin<TypeAheadPlugin>];
|
|
7
|
+
sharedState: {
|
|
8
|
+
isForcedHidden: boolean;
|
|
9
|
+
} | undefined;
|
|
10
|
+
actions: {
|
|
11
|
+
hideDecoration: () => ReleaseHiddenDecoration | undefined;
|
|
12
|
+
};
|
|
6
13
|
}>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { selectionMarkerPlugin } from './plugin';
|
|
2
|
-
export type { SelectionMarkerPlugin } from './types';
|
|
2
|
+
export type { SelectionMarkerPlugin, ReleaseHiddenDecoration } from './types';
|
|
@@ -7,11 +7,13 @@ import type { SelectionMarkerPlugin } from '../types';
|
|
|
7
7
|
interface PluginState {
|
|
8
8
|
decorations: DecorationSet;
|
|
9
9
|
shouldHideDecorations: boolean;
|
|
10
|
+
forceHide: boolean;
|
|
10
11
|
}
|
|
11
12
|
export declare const key: PluginKey<PluginState>;
|
|
12
13
|
export declare const createPlugin: (api: ExtractInjectionAPI<SelectionMarkerPlugin> | undefined) => SafePlugin<{
|
|
13
14
|
decorations: DecorationSet;
|
|
14
15
|
shouldHideDecorations: any;
|
|
16
|
+
forceHide: any;
|
|
15
17
|
}>;
|
|
16
18
|
export declare function dispatchShouldHideDecorations(editorView: EditorView, shouldHideDecorations: boolean): void;
|
|
17
19
|
export {};
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { FocusPlugin } from '@atlaskit/editor-plugin-focus';
|
|
3
3
|
import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
4
|
+
export type ReleaseHiddenDecoration = () => boolean | undefined;
|
|
4
5
|
export type SelectionMarkerPlugin = NextEditorPlugin<'selectionMarker', {
|
|
5
6
|
dependencies: [
|
|
6
7
|
FocusPlugin,
|
|
7
8
|
OptionalPlugin<TypeAheadPlugin>
|
|
8
9
|
];
|
|
10
|
+
sharedState: {
|
|
11
|
+
isForcedHidden: boolean;
|
|
12
|
+
} | undefined;
|
|
13
|
+
actions: {
|
|
14
|
+
hideDecoration: () => ReleaseHiddenDecoration | undefined;
|
|
15
|
+
};
|
|
9
16
|
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-selection-marker",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Selection marker plugin for @atlaskit/editor-core.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
".": "./src/index.ts"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@atlaskit/editor-common": "^78.
|
|
34
|
+
"@atlaskit/editor-common": "^78.14.0",
|
|
35
35
|
"@atlaskit/editor-plugin-focus": "^1.1.0",
|
|
36
36
|
"@atlaskit/editor-plugin-type-ahead": "^1.0.2",
|
|
37
37
|
"@atlaskit/editor-prosemirror": "3.0.0",
|
|
38
|
-
"@atlaskit/primitives": "^
|
|
38
|
+
"@atlaskit/primitives": "^5.0.0",
|
|
39
39
|
"@atlaskit/tokens": "^1.41.0",
|
|
40
40
|
"@babel/runtime": "^7.0.0",
|
|
41
41
|
"@emotion/react": "^11.7.1"
|
|
@@ -78,11 +78,9 @@
|
|
|
78
78
|
"ui-components": [
|
|
79
79
|
"lite-mode"
|
|
80
80
|
],
|
|
81
|
-
"deprecation":
|
|
82
|
-
"no-deprecated-imports"
|
|
83
|
-
],
|
|
81
|
+
"deprecation": "no-deprecated-imports",
|
|
84
82
|
"styling": [
|
|
85
|
-
"
|
|
83
|
+
"emotion",
|
|
86
84
|
"compiled"
|
|
87
85
|
],
|
|
88
86
|
"imports": [
|
|
@@ -91,4 +89,4 @@
|
|
|
91
89
|
}
|
|
92
90
|
},
|
|
93
91
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
|
|
94
|
-
}
|
|
92
|
+
}
|