@atlaskit/editor-core 187.47.0 → 187.47.3
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 +13 -0
- package/dist/cjs/plugins/annotation/commands/index.js +5 -2
- package/dist/cjs/plugins/annotation/pm-plugins/inline-comment.js +1 -1
- package/dist/cjs/plugins/annotation/pm-plugins/reducer.js +4 -2
- package/dist/cjs/plugins/annotation/ui/InlineCommentView.js +6 -3
- package/dist/cjs/plugins/floating-toolbar/index.js +8 -0
- package/dist/cjs/ui/Appearance/Comment/Comment.js +2 -1
- package/dist/cjs/ui/FloatingToolbar/index.js +2 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/annotation/commands/index.js +5 -2
- package/dist/es2019/plugins/annotation/pm-plugins/inline-comment.js +1 -1
- package/dist/es2019/plugins/annotation/pm-plugins/reducer.js +4 -2
- package/dist/es2019/plugins/annotation/ui/InlineCommentView.js +6 -3
- package/dist/es2019/plugins/floating-toolbar/index.js +7 -0
- package/dist/es2019/ui/Appearance/Comment/Comment.js +2 -2
- package/dist/es2019/ui/FloatingToolbar/index.js +2 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/annotation/commands/index.js +5 -2
- package/dist/esm/plugins/annotation/pm-plugins/inline-comment.js +1 -1
- package/dist/esm/plugins/annotation/pm-plugins/reducer.js +4 -2
- package/dist/esm/plugins/annotation/ui/InlineCommentView.js +6 -3
- package/dist/esm/plugins/floating-toolbar/index.js +8 -0
- package/dist/esm/ui/Appearance/Comment/Comment.js +2 -1
- package/dist/esm/ui/FloatingToolbar/index.js +2 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/annotation/commands/index.d.ts +2 -1
- package/dist/types/plugins/annotation/pm-plugins/types.d.ts +4 -0
- package/dist/types/ui/FloatingToolbar/index.d.ts +2 -0
- package/dist/types-ts4.5/plugins/annotation/commands/index.d.ts +2 -1
- package/dist/types-ts4.5/plugins/annotation/pm-plugins/types.d.ts +4 -0
- package/dist/types-ts4.5/ui/FloatingToolbar/index.d.ts +2 -0
- package/package.json +9 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.47.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`3aaff60be08`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3aaff60be08) - ED-18988 Updates overflow property for content area of comment editor when table sticky scrollbar is enabled.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
10
|
+
## 187.47.2
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`c89c55c6d49`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c89c55c6d49) - [ux] ED-19508 fixes closed inline comments reopening when user toggles an expand node
|
|
15
|
+
|
|
3
16
|
## 187.47.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -27,9 +27,12 @@ var updateInlineCommentResolvedState = function updateInlineCommentResolvedState
|
|
|
27
27
|
return (0, _pluginFactory.createCommand)(command);
|
|
28
28
|
};
|
|
29
29
|
exports.updateInlineCommentResolvedState = updateInlineCommentResolvedState;
|
|
30
|
-
var closeComponent = function closeComponent() {
|
|
30
|
+
var closeComponent = function closeComponent(state) {
|
|
31
31
|
return (0, _pluginFactory.createCommand)({
|
|
32
|
-
type: _types.ACTIONS.CLOSE_COMPONENT
|
|
32
|
+
type: _types.ACTIONS.CLOSE_COMPONENT,
|
|
33
|
+
data: {
|
|
34
|
+
lastClosedPos: state.selection.$head.pos
|
|
35
|
+
}
|
|
33
36
|
});
|
|
34
37
|
};
|
|
35
38
|
exports.closeComponent = closeComponent;
|
|
@@ -156,7 +156,7 @@ var inlineCommentPlugin = function inlineCommentPlugin(options) {
|
|
|
156
156
|
};
|
|
157
157
|
var setSelectedAnnotationFn = function setSelectedAnnotationFn(annotationId) {
|
|
158
158
|
if (!annotationId) {
|
|
159
|
-
(0, _commands.closeComponent)()(editorView.state, editorView.dispatch);
|
|
159
|
+
(0, _commands.closeComponent)(editorView.state)(editorView.state, editorView.dispatch);
|
|
160
160
|
} else {
|
|
161
161
|
(0, _commands.setSelectedAnnotation)(annotationId)(editorView.state, editorView.dispatch);
|
|
162
162
|
}
|
|
@@ -21,7 +21,8 @@ var _default = function _default(pluginState, action) {
|
|
|
21
21
|
case _types.ACTIONS.INLINE_COMMENT_UPDATE_MOUSE_STATE:
|
|
22
22
|
var mouseData = Object.assign({}, pluginState.mouseData, action.data.mouseData);
|
|
23
23
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
24
|
-
mouseData: mouseData
|
|
24
|
+
mouseData: mouseData,
|
|
25
|
+
lastClosedPos: undefined
|
|
25
26
|
});
|
|
26
27
|
case _types.ACTIONS.SET_INLINE_COMMENT_DRAFT_STATE:
|
|
27
28
|
return getNewDraftState(pluginState, action.data.drafting, action.data.editorState);
|
|
@@ -32,7 +33,8 @@ var _default = function _default(pluginState, action) {
|
|
|
32
33
|
});
|
|
33
34
|
case _types.ACTIONS.CLOSE_COMPONENT:
|
|
34
35
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
35
|
-
selectedAnnotations: []
|
|
36
|
+
selectedAnnotations: [],
|
|
37
|
+
lastClosedPos: action.data.lastClosedPos
|
|
36
38
|
});
|
|
37
39
|
case _types.ACTIONS.ADD_INLINE_COMMENT:
|
|
38
40
|
var updatedPluginState = getNewDraftState(pluginState, action.data.drafting, action.data.editorState);
|
|
@@ -45,7 +45,8 @@ function InlineCommentView(_ref) {
|
|
|
45
45
|
var _ref2 = inlineCommentState || {},
|
|
46
46
|
bookmark = _ref2.bookmark,
|
|
47
47
|
selectedAnnotations = _ref2.selectedAnnotations,
|
|
48
|
-
annotations = _ref2.annotations
|
|
48
|
+
annotations = _ref2.annotations,
|
|
49
|
+
lastClosedPos = _ref2.lastClosedPos;
|
|
49
50
|
var annotationsList = (0, _utils2.getAllAnnotations)(editorView.state.doc);
|
|
50
51
|
var selection = (0, _utils2.getSelectionPositions)(state, inlineCommentState);
|
|
51
52
|
var position = findPosForDOM(selection);
|
|
@@ -107,7 +108,9 @@ function InlineCommentView(_ref) {
|
|
|
107
108
|
var activeAnnotations = (selectedAnnotations === null || selectedAnnotations === void 0 ? void 0 : selectedAnnotations.filter(function (mark) {
|
|
108
109
|
return annotations && annotations[mark.id] === false;
|
|
109
110
|
})) || [];
|
|
110
|
-
if (!ViewComponent || activeAnnotations.length === 0
|
|
111
|
+
if (!ViewComponent || activeAnnotations.length === 0 ||
|
|
112
|
+
// Check if the user has moved the selection since closing the previous comment
|
|
113
|
+
editorView.state.selection.$head.pos === lastClosedPos) {
|
|
111
114
|
return null;
|
|
112
115
|
}
|
|
113
116
|
var onAnnotationViewed = function onAnnotationViewed() {
|
|
@@ -145,7 +148,7 @@ function InlineCommentView(_ref) {
|
|
|
145
148
|
return (0, _commands.updateInlineCommentResolvedState)((0, _defineProperty2.default)({}, id, true), _inlineCommentEvents.RESOLVE_METHOD.COMPONENT)(editorView.state, editorView.dispatch);
|
|
146
149
|
},
|
|
147
150
|
onClose: function onClose() {
|
|
148
|
-
(0, _commands.closeComponent)()(editorView.state, editorView.dispatch);
|
|
151
|
+
(0, _commands.closeComponent)(editorView.state)(editorView.state, editorView.dispatch);
|
|
149
152
|
}
|
|
150
153
|
}));
|
|
151
154
|
}
|
|
@@ -223,6 +223,13 @@ function ContentComponent(_ref5) {
|
|
|
223
223
|
forcePlacement = config.forcePlacement,
|
|
224
224
|
preventPopupOverflow = config.preventPopupOverflow,
|
|
225
225
|
onPositionCalculated = config.onPositionCalculated,
|
|
226
|
+
_config$absoluteOffse = config.absoluteOffset,
|
|
227
|
+
absoluteOffset = _config$absoluteOffse === void 0 ? {
|
|
228
|
+
top: 0,
|
|
229
|
+
left: 0,
|
|
230
|
+
right: 0,
|
|
231
|
+
bottom: 0
|
|
232
|
+
} : _config$absoluteOffse,
|
|
226
233
|
focusTrap = config.focusTrap;
|
|
227
234
|
var targetRef = getDomRef(editorView, dispatchAnalyticsEvent);
|
|
228
235
|
if (!targetRef || editorDisabledState && editorDisabledState.editorDisabled) {
|
|
@@ -258,6 +265,7 @@ function ContentComponent(_ref5) {
|
|
|
258
265
|
forcePlacement: forcePlacement,
|
|
259
266
|
fitHeight: height,
|
|
260
267
|
fitWidth: width,
|
|
268
|
+
absoluteOffset: absoluteOffset,
|
|
261
269
|
alignX: align,
|
|
262
270
|
stick: true,
|
|
263
271
|
zIndex: zIndex,
|
|
@@ -30,6 +30,7 @@ var _WithFlash = _interopRequireDefault(require("../../WithFlash"));
|
|
|
30
30
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
31
31
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
32
32
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
33
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
33
34
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
34
35
|
var _reactIntlNext = require("react-intl-next");
|
|
35
36
|
var _messages = _interopRequireDefault(require("../../../messages"));
|
|
@@ -42,7 +43,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
42
43
|
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; } }
|
|
43
44
|
var CommentEditorMargin = 14;
|
|
44
45
|
var commentEditorStyle = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n\n .less-margin .ProseMirror {\n margin: ", " ", "\n ", ";\n }\n\n min-width: 272px;\n /* Border + Toolbar + Footer + (Paragraph + ((Paragraph + Margin) * (DefaultLines - 1)) */\n /* calc(2px + 40px + 24px + ( 20px + (32px * 2))) */\n\n height: auto;\n background-color: ", ";\n border: 1px solid ", ";\n box-sizing: border-box;\n border-radius: ", "px;\n\n max-width: inherit;\n word-wrap: break-word;\n"])), "var(--ds-space-150, 12px)", "var(--ds-space-100, 8px)", "var(--ds-space-100, 8px)", "var(--ds-background-input, white)", "var(--ds-border, ".concat(_colors.N40, ")"), (0, _constants.borderRadius)());
|
|
45
|
-
var ContentArea = (0, _ContentStyles.createEditorContentStyle)((0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n flex-grow: 1;\n overflow-x:
|
|
46
|
+
var ContentArea = (0, _ContentStyles.createEditorContentStyle)((0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n flex-grow: 1;\n overflow-x: ", ";\n line-height: 24px;\n\n /** Hack for Bitbucket to ensure entire editorView gets drop event; see ED-3294 **/\n /** Hack for table controls. Otherwise margin collapse and controls are misplaced. **/\n .ProseMirror {\n margin: ", " ", "px\n ", "px;\n }\n\n .gridParent {\n margin-left: ", "px;\n margin-right: ", "px;\n width: calc(100% + ", "px);\n }\n\n padding: ", "px;\n\n ", ";\n"])), (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table-sticky-scrollbar') ? 'clip' : 'hidden', "var(--ds-space-150, 12px)", CommentEditorMargin, CommentEditorMargin, CommentEditorMargin - _styles.GRID_GUTTER, CommentEditorMargin - _styles.GRID_GUTTER, CommentEditorMargin - _styles.GRID_GUTTER, _Toolbar2.TableControlsPadding, _commonStyles.tableCommentEditorStyles));
|
|
46
47
|
ContentArea.displayName = 'ContentArea';
|
|
47
48
|
var secondaryToolbarStyle = (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n box-sizing: border-box;\n justify-content: flex-end;\n align-items: center;\n display: flex;\n padding: ", " 1px;\n"])), "var(--ds-space-150, 12px)");
|
|
48
49
|
var Editor = /*#__PURE__*/function (_React$Component) {
|
|
@@ -56,6 +56,7 @@ var FloatingToolbar = /*#__PURE__*/function (_PureComponent) {
|
|
|
56
56
|
popupsMountPoint = _this$props.popupsMountPoint,
|
|
57
57
|
popupsBoundariesElement = _this$props.popupsBoundariesElement,
|
|
58
58
|
className = _this$props.className,
|
|
59
|
+
absoluteOffset = _this$props.absoluteOffset,
|
|
59
60
|
alignX = _this$props.alignX,
|
|
60
61
|
alignY = _this$props.alignY,
|
|
61
62
|
zIndex = _this$props.zIndex;
|
|
@@ -63,6 +64,7 @@ var FloatingToolbar = /*#__PURE__*/function (_PureComponent) {
|
|
|
63
64
|
return null;
|
|
64
65
|
}
|
|
65
66
|
return (0, _react.jsx)(_ui.Popup, {
|
|
67
|
+
absoluteOffset: absoluteOffset,
|
|
66
68
|
alignX: alignX,
|
|
67
69
|
alignY: alignY,
|
|
68
70
|
target: target,
|
|
@@ -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.47.
|
|
9
|
+
var version = "187.47.3";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
@@ -16,8 +16,11 @@ export const updateInlineCommentResolvedState = (partialNewState, resolveMethod)
|
|
|
16
16
|
}
|
|
17
17
|
return createCommand(command);
|
|
18
18
|
};
|
|
19
|
-
export const closeComponent =
|
|
20
|
-
type: ACTIONS.CLOSE_COMPONENT
|
|
19
|
+
export const closeComponent = state => createCommand({
|
|
20
|
+
type: ACTIONS.CLOSE_COMPONENT,
|
|
21
|
+
data: {
|
|
22
|
+
lastClosedPos: state.selection.$head.pos
|
|
23
|
+
}
|
|
21
24
|
});
|
|
22
25
|
export const clearDirtyMark = () => createCommand({
|
|
23
26
|
type: ACTIONS.INLINE_COMMENT_CLEAR_DIRTY_MARK
|
|
@@ -99,7 +99,7 @@ export const inlineCommentPlugin = options => {
|
|
|
99
99
|
const setVisibility = isVisible => onSetVisibility(editorView)(isVisible);
|
|
100
100
|
const setSelectedAnnotationFn = annotationId => {
|
|
101
101
|
if (!annotationId) {
|
|
102
|
-
closeComponent()(editorView.state, editorView.dispatch);
|
|
102
|
+
closeComponent(editorView.state)(editorView.state, editorView.dispatch);
|
|
103
103
|
} else {
|
|
104
104
|
setSelectedAnnotation(annotationId)(editorView.state, editorView.dispatch);
|
|
105
105
|
}
|
|
@@ -15,7 +15,8 @@ export default ((pluginState, action) => {
|
|
|
15
15
|
const mouseData = Object.assign({}, pluginState.mouseData, action.data.mouseData);
|
|
16
16
|
return {
|
|
17
17
|
...pluginState,
|
|
18
|
-
mouseData
|
|
18
|
+
mouseData,
|
|
19
|
+
lastClosedPos: undefined
|
|
19
20
|
};
|
|
20
21
|
case ACTIONS.SET_INLINE_COMMENT_DRAFT_STATE:
|
|
21
22
|
return getNewDraftState(pluginState, action.data.drafting, action.data.editorState);
|
|
@@ -28,7 +29,8 @@ export default ((pluginState, action) => {
|
|
|
28
29
|
case ACTIONS.CLOSE_COMPONENT:
|
|
29
30
|
return {
|
|
30
31
|
...pluginState,
|
|
31
|
-
selectedAnnotations: []
|
|
32
|
+
selectedAnnotations: [],
|
|
33
|
+
lastClosedPos: action.data.lastClosedPos
|
|
32
34
|
};
|
|
33
35
|
case ACTIONS.ADD_INLINE_COMMENT:
|
|
34
36
|
const updatedPluginState = getNewDraftState(pluginState, action.data.drafting, action.data.editorState);
|
|
@@ -44,7 +44,8 @@ export function InlineCommentView({
|
|
|
44
44
|
const {
|
|
45
45
|
bookmark,
|
|
46
46
|
selectedAnnotations,
|
|
47
|
-
annotations
|
|
47
|
+
annotations,
|
|
48
|
+
lastClosedPos
|
|
48
49
|
} = inlineCommentState || {};
|
|
49
50
|
const annotationsList = getAllAnnotations(editorView.state.doc);
|
|
50
51
|
const selection = getSelectionPositions(state, inlineCommentState);
|
|
@@ -105,7 +106,9 @@ export function InlineCommentView({
|
|
|
105
106
|
|
|
106
107
|
// View Component
|
|
107
108
|
const activeAnnotations = (selectedAnnotations === null || selectedAnnotations === void 0 ? void 0 : selectedAnnotations.filter(mark => annotations && annotations[mark.id] === false)) || [];
|
|
108
|
-
if (!ViewComponent || activeAnnotations.length === 0
|
|
109
|
+
if (!ViewComponent || activeAnnotations.length === 0 ||
|
|
110
|
+
// Check if the user has moved the selection since closing the previous comment
|
|
111
|
+
editorView.state.selection.$head.pos === lastClosedPos) {
|
|
109
112
|
return null;
|
|
110
113
|
}
|
|
111
114
|
const onAnnotationViewed = () => {
|
|
@@ -141,7 +144,7 @@ export function InlineCommentView({
|
|
|
141
144
|
[id]: true
|
|
142
145
|
}, RESOLVE_METHOD.COMPONENT)(editorView.state, editorView.dispatch),
|
|
143
146
|
onClose: () => {
|
|
144
|
-
closeComponent()(editorView.state, editorView.dispatch);
|
|
147
|
+
closeComponent(editorView.state)(editorView.state, editorView.dispatch);
|
|
145
148
|
}
|
|
146
149
|
}));
|
|
147
150
|
}
|
|
@@ -211,6 +211,12 @@ function ContentComponent({
|
|
|
211
211
|
forcePlacement,
|
|
212
212
|
preventPopupOverflow,
|
|
213
213
|
onPositionCalculated,
|
|
214
|
+
absoluteOffset = {
|
|
215
|
+
top: 0,
|
|
216
|
+
left: 0,
|
|
217
|
+
right: 0,
|
|
218
|
+
bottom: 0
|
|
219
|
+
},
|
|
214
220
|
focusTrap
|
|
215
221
|
} = config;
|
|
216
222
|
const targetRef = getDomRef(editorView, dispatchAnalyticsEvent);
|
|
@@ -246,6 +252,7 @@ function ContentComponent({
|
|
|
246
252
|
forcePlacement: forcePlacement,
|
|
247
253
|
fitHeight: height,
|
|
248
254
|
fitWidth: width,
|
|
255
|
+
absoluteOffset: absoluteOffset,
|
|
249
256
|
alignX: align,
|
|
250
257
|
stick: true,
|
|
251
258
|
zIndex: zIndex,
|
|
@@ -17,6 +17,7 @@ import WithFlash from '../../WithFlash';
|
|
|
17
17
|
import { WidthConsumer } from '@atlaskit/editor-common/ui';
|
|
18
18
|
import { akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
19
19
|
import { GRID_GUTTER } from '@atlaskit/editor-common/styles';
|
|
20
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
20
21
|
import classnames from 'classnames';
|
|
21
22
|
import { injectIntl } from 'react-intl-next';
|
|
22
23
|
import messages from '../../../messages';
|
|
@@ -48,8 +49,7 @@ const commentEditorStyle = css`
|
|
|
48
49
|
`;
|
|
49
50
|
const ContentArea = createEditorContentStyle(css`
|
|
50
51
|
flex-grow: 1;
|
|
51
|
-
overflow-x: hidden;
|
|
52
|
-
overflow-y: auto;
|
|
52
|
+
overflow-x: ${getBooleanFF('platform.editor.table-sticky-scrollbar') ? 'clip' : 'hidden'};
|
|
53
53
|
line-height: 24px;
|
|
54
54
|
|
|
55
55
|
/** Hack for Bitbucket to ensure entire editorView gets drop event; see ED-3294 **/
|
|
@@ -16,6 +16,7 @@ export default class FloatingToolbar extends PureComponent {
|
|
|
16
16
|
popupsMountPoint,
|
|
17
17
|
popupsBoundariesElement,
|
|
18
18
|
className,
|
|
19
|
+
absoluteOffset,
|
|
19
20
|
alignX,
|
|
20
21
|
alignY,
|
|
21
22
|
zIndex
|
|
@@ -24,6 +25,7 @@ export default class FloatingToolbar extends PureComponent {
|
|
|
24
25
|
return null;
|
|
25
26
|
}
|
|
26
27
|
return jsx(Popup, {
|
|
28
|
+
absoluteOffset: absoluteOffset,
|
|
27
29
|
alignX: alignX,
|
|
28
30
|
alignY: alignY,
|
|
29
31
|
target: target,
|
|
@@ -19,9 +19,12 @@ export var updateInlineCommentResolvedState = function updateInlineCommentResolv
|
|
|
19
19
|
}
|
|
20
20
|
return createCommand(command);
|
|
21
21
|
};
|
|
22
|
-
export var closeComponent = function closeComponent() {
|
|
22
|
+
export var closeComponent = function closeComponent(state) {
|
|
23
23
|
return createCommand({
|
|
24
|
-
type: ACTIONS.CLOSE_COMPONENT
|
|
24
|
+
type: ACTIONS.CLOSE_COMPONENT,
|
|
25
|
+
data: {
|
|
26
|
+
lastClosedPos: state.selection.$head.pos
|
|
27
|
+
}
|
|
25
28
|
});
|
|
26
29
|
};
|
|
27
30
|
export var clearDirtyMark = function clearDirtyMark() {
|
|
@@ -149,7 +149,7 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
|
|
|
149
149
|
};
|
|
150
150
|
var setSelectedAnnotationFn = function setSelectedAnnotationFn(annotationId) {
|
|
151
151
|
if (!annotationId) {
|
|
152
|
-
closeComponent()(editorView.state, editorView.dispatch);
|
|
152
|
+
closeComponent(editorView.state)(editorView.state, editorView.dispatch);
|
|
153
153
|
} else {
|
|
154
154
|
setSelectedAnnotation(annotationId)(editorView.state, editorView.dispatch);
|
|
155
155
|
}
|
|
@@ -14,7 +14,8 @@ export default (function (pluginState, action) {
|
|
|
14
14
|
case ACTIONS.INLINE_COMMENT_UPDATE_MOUSE_STATE:
|
|
15
15
|
var mouseData = Object.assign({}, pluginState.mouseData, action.data.mouseData);
|
|
16
16
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
17
|
-
mouseData: mouseData
|
|
17
|
+
mouseData: mouseData,
|
|
18
|
+
lastClosedPos: undefined
|
|
18
19
|
});
|
|
19
20
|
case ACTIONS.SET_INLINE_COMMENT_DRAFT_STATE:
|
|
20
21
|
return getNewDraftState(pluginState, action.data.drafting, action.data.editorState);
|
|
@@ -25,7 +26,8 @@ export default (function (pluginState, action) {
|
|
|
25
26
|
});
|
|
26
27
|
case ACTIONS.CLOSE_COMPONENT:
|
|
27
28
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
28
|
-
selectedAnnotations: []
|
|
29
|
+
selectedAnnotations: [],
|
|
30
|
+
lastClosedPos: action.data.lastClosedPos
|
|
29
31
|
});
|
|
30
32
|
case ACTIONS.ADD_INLINE_COMMENT:
|
|
31
33
|
var updatedPluginState = getNewDraftState(pluginState, action.data.drafting, action.data.editorState);
|
|
@@ -38,7 +38,8 @@ export function InlineCommentView(_ref) {
|
|
|
38
38
|
var _ref2 = inlineCommentState || {},
|
|
39
39
|
bookmark = _ref2.bookmark,
|
|
40
40
|
selectedAnnotations = _ref2.selectedAnnotations,
|
|
41
|
-
annotations = _ref2.annotations
|
|
41
|
+
annotations = _ref2.annotations,
|
|
42
|
+
lastClosedPos = _ref2.lastClosedPos;
|
|
42
43
|
var annotationsList = getAllAnnotations(editorView.state.doc);
|
|
43
44
|
var selection = getSelectionPositions(state, inlineCommentState);
|
|
44
45
|
var position = findPosForDOM(selection);
|
|
@@ -100,7 +101,9 @@ export function InlineCommentView(_ref) {
|
|
|
100
101
|
var activeAnnotations = (selectedAnnotations === null || selectedAnnotations === void 0 ? void 0 : selectedAnnotations.filter(function (mark) {
|
|
101
102
|
return annotations && annotations[mark.id] === false;
|
|
102
103
|
})) || [];
|
|
103
|
-
if (!ViewComponent || activeAnnotations.length === 0
|
|
104
|
+
if (!ViewComponent || activeAnnotations.length === 0 ||
|
|
105
|
+
// Check if the user has moved the selection since closing the previous comment
|
|
106
|
+
editorView.state.selection.$head.pos === lastClosedPos) {
|
|
104
107
|
return null;
|
|
105
108
|
}
|
|
106
109
|
var onAnnotationViewed = function onAnnotationViewed() {
|
|
@@ -138,7 +141,7 @@ export function InlineCommentView(_ref) {
|
|
|
138
141
|
return updateInlineCommentResolvedState(_defineProperty({}, id, true), RESOLVE_METHOD.COMPONENT)(editorView.state, editorView.dispatch);
|
|
139
142
|
},
|
|
140
143
|
onClose: function onClose() {
|
|
141
|
-
closeComponent()(editorView.state, editorView.dispatch);
|
|
144
|
+
closeComponent(editorView.state)(editorView.state, editorView.dispatch);
|
|
142
145
|
}
|
|
143
146
|
}));
|
|
144
147
|
}
|
|
@@ -213,6 +213,13 @@ function ContentComponent(_ref5) {
|
|
|
213
213
|
forcePlacement = config.forcePlacement,
|
|
214
214
|
preventPopupOverflow = config.preventPopupOverflow,
|
|
215
215
|
onPositionCalculated = config.onPositionCalculated,
|
|
216
|
+
_config$absoluteOffse = config.absoluteOffset,
|
|
217
|
+
absoluteOffset = _config$absoluteOffse === void 0 ? {
|
|
218
|
+
top: 0,
|
|
219
|
+
left: 0,
|
|
220
|
+
right: 0,
|
|
221
|
+
bottom: 0
|
|
222
|
+
} : _config$absoluteOffse,
|
|
216
223
|
focusTrap = config.focusTrap;
|
|
217
224
|
var targetRef = getDomRef(editorView, dispatchAnalyticsEvent);
|
|
218
225
|
if (!targetRef || editorDisabledState && editorDisabledState.editorDisabled) {
|
|
@@ -248,6 +255,7 @@ function ContentComponent(_ref5) {
|
|
|
248
255
|
forcePlacement: forcePlacement,
|
|
249
256
|
fitHeight: height,
|
|
250
257
|
fitWidth: width,
|
|
258
|
+
absoluteOffset: absoluteOffset,
|
|
251
259
|
alignX: align,
|
|
252
260
|
stick: true,
|
|
253
261
|
zIndex: zIndex,
|
|
@@ -27,6 +27,7 @@ import WithFlash from '../../WithFlash';
|
|
|
27
27
|
import { WidthConsumer } from '@atlaskit/editor-common/ui';
|
|
28
28
|
import { akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
29
29
|
import { GRID_GUTTER } from '@atlaskit/editor-common/styles';
|
|
30
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
30
31
|
import classnames from 'classnames';
|
|
31
32
|
import { injectIntl } from 'react-intl-next';
|
|
32
33
|
import messages from '../../../messages';
|
|
@@ -35,7 +36,7 @@ import { createEditorContentStyle } from '../../ContentStyles';
|
|
|
35
36
|
import { ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
|
|
36
37
|
var CommentEditorMargin = 14;
|
|
37
38
|
var commentEditorStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n\n .less-margin .ProseMirror {\n margin: ", " ", "\n ", ";\n }\n\n min-width: 272px;\n /* Border + Toolbar + Footer + (Paragraph + ((Paragraph + Margin) * (DefaultLines - 1)) */\n /* calc(2px + 40px + 24px + ( 20px + (32px * 2))) */\n\n height: auto;\n background-color: ", ";\n border: 1px solid ", ";\n box-sizing: border-box;\n border-radius: ", "px;\n\n max-width: inherit;\n word-wrap: break-word;\n"])), "var(--ds-space-150, 12px)", "var(--ds-space-100, 8px)", "var(--ds-space-100, 8px)", "var(--ds-background-input, white)", "var(--ds-border, ".concat(N40, ")"), borderRadius());
|
|
38
|
-
var ContentArea = createEditorContentStyle(css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n flex-grow: 1;\n overflow-x:
|
|
39
|
+
var ContentArea = createEditorContentStyle(css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n flex-grow: 1;\n overflow-x: ", ";\n line-height: 24px;\n\n /** Hack for Bitbucket to ensure entire editorView gets drop event; see ED-3294 **/\n /** Hack for table controls. Otherwise margin collapse and controls are misplaced. **/\n .ProseMirror {\n margin: ", " ", "px\n ", "px;\n }\n\n .gridParent {\n margin-left: ", "px;\n margin-right: ", "px;\n width: calc(100% + ", "px);\n }\n\n padding: ", "px;\n\n ", ";\n"])), getBooleanFF('platform.editor.table-sticky-scrollbar') ? 'clip' : 'hidden', "var(--ds-space-150, 12px)", CommentEditorMargin, CommentEditorMargin, CommentEditorMargin - GRID_GUTTER, CommentEditorMargin - GRID_GUTTER, CommentEditorMargin - GRID_GUTTER, TableControlsPadding, tableCommentEditorStyles));
|
|
39
40
|
ContentArea.displayName = 'ContentArea';
|
|
40
41
|
var secondaryToolbarStyle = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n box-sizing: border-box;\n justify-content: flex-end;\n align-items: center;\n display: flex;\n padding: ", " 1px;\n"])), "var(--ds-space-150, 12px)");
|
|
41
42
|
var Editor = /*#__PURE__*/function (_React$Component) {
|
|
@@ -32,6 +32,7 @@ var FloatingToolbar = /*#__PURE__*/function (_PureComponent) {
|
|
|
32
32
|
popupsMountPoint = _this$props.popupsMountPoint,
|
|
33
33
|
popupsBoundariesElement = _this$props.popupsBoundariesElement,
|
|
34
34
|
className = _this$props.className,
|
|
35
|
+
absoluteOffset = _this$props.absoluteOffset,
|
|
35
36
|
alignX = _this$props.alignX,
|
|
36
37
|
alignY = _this$props.alignY,
|
|
37
38
|
zIndex = _this$props.zIndex;
|
|
@@ -39,6 +40,7 @@ var FloatingToolbar = /*#__PURE__*/function (_PureComponent) {
|
|
|
39
40
|
return null;
|
|
40
41
|
}
|
|
41
42
|
return jsx(Popup, {
|
|
43
|
+
absoluteOffset: absoluteOffset,
|
|
42
44
|
alignX: alignX,
|
|
43
45
|
alignY: alignY,
|
|
44
46
|
target: target,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
1
2
|
import type { RESOLVE_METHOD } from './../../analytics/types/inline-comment-events';
|
|
2
3
|
import type { Command } from '../../../types';
|
|
3
4
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
4
5
|
import { INPUT_METHOD } from '../../analytics';
|
|
5
6
|
import type { InlineCommentMap, InlineCommentMouseData } from '../pm-plugins/types';
|
|
6
7
|
export declare const updateInlineCommentResolvedState: (partialNewState: InlineCommentMap, resolveMethod?: RESOLVE_METHOD) => Command;
|
|
7
|
-
export declare const closeComponent: () => Command;
|
|
8
|
+
export declare const closeComponent: (state: EditorState) => Command;
|
|
8
9
|
export declare const clearDirtyMark: () => Command;
|
|
9
10
|
export declare const removeInlineCommentNearSelection: (id: string) => Command;
|
|
10
11
|
export declare const setInlineCommentDraftState: (drafting: boolean, inputMethod?: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT) => Command;
|
|
@@ -43,6 +43,9 @@ export type InlineCommentAction = {
|
|
|
43
43
|
type: ACTIONS.INLINE_COMMENT_CLEAR_DIRTY_MARK;
|
|
44
44
|
} | {
|
|
45
45
|
type: ACTIONS.CLOSE_COMPONENT;
|
|
46
|
+
data: {
|
|
47
|
+
lastClosedPos: number;
|
|
48
|
+
};
|
|
46
49
|
} | {
|
|
47
50
|
type: ACTIONS.ADD_INLINE_COMMENT;
|
|
48
51
|
data: {
|
|
@@ -71,4 +74,5 @@ export type InlineCommentPluginState = {
|
|
|
71
74
|
bookmark?: SelectionBookmark;
|
|
72
75
|
disallowOnWhitespace: boolean;
|
|
73
76
|
isVisible: boolean;
|
|
77
|
+
lastClosedPos?: number;
|
|
74
78
|
};
|
|
@@ -7,6 +7,7 @@ export type Coordinates = {
|
|
|
7
7
|
top?: number;
|
|
8
8
|
bottom?: number;
|
|
9
9
|
};
|
|
10
|
+
export type PositionOffset = Coordinates;
|
|
10
11
|
export interface Props {
|
|
11
12
|
zIndex?: number;
|
|
12
13
|
className?: string;
|
|
@@ -16,6 +17,7 @@ export interface Props {
|
|
|
16
17
|
offset?: number[];
|
|
17
18
|
fitWidth?: number;
|
|
18
19
|
fitHeight?: number;
|
|
20
|
+
absoluteOffset?: PositionOffset;
|
|
19
21
|
alignX?: 'left' | 'center' | 'right';
|
|
20
22
|
alignY?: 'bottom' | 'top';
|
|
21
23
|
onPositionCalculated?: (position: Coordinates) => any;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
1
2
|
import type { RESOLVE_METHOD } from './../../analytics/types/inline-comment-events';
|
|
2
3
|
import type { Command } from '../../../types';
|
|
3
4
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
4
5
|
import { INPUT_METHOD } from '../../analytics';
|
|
5
6
|
import type { InlineCommentMap, InlineCommentMouseData } from '../pm-plugins/types';
|
|
6
7
|
export declare const updateInlineCommentResolvedState: (partialNewState: InlineCommentMap, resolveMethod?: RESOLVE_METHOD) => Command;
|
|
7
|
-
export declare const closeComponent: () => Command;
|
|
8
|
+
export declare const closeComponent: (state: EditorState) => Command;
|
|
8
9
|
export declare const clearDirtyMark: () => Command;
|
|
9
10
|
export declare const removeInlineCommentNearSelection: (id: string) => Command;
|
|
10
11
|
export declare const setInlineCommentDraftState: (drafting: boolean, inputMethod?: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT) => Command;
|
|
@@ -43,6 +43,9 @@ export type InlineCommentAction = {
|
|
|
43
43
|
type: ACTIONS.INLINE_COMMENT_CLEAR_DIRTY_MARK;
|
|
44
44
|
} | {
|
|
45
45
|
type: ACTIONS.CLOSE_COMPONENT;
|
|
46
|
+
data: {
|
|
47
|
+
lastClosedPos: number;
|
|
48
|
+
};
|
|
46
49
|
} | {
|
|
47
50
|
type: ACTIONS.ADD_INLINE_COMMENT;
|
|
48
51
|
data: {
|
|
@@ -71,4 +74,5 @@ export type InlineCommentPluginState = {
|
|
|
71
74
|
bookmark?: SelectionBookmark;
|
|
72
75
|
disallowOnWhitespace: boolean;
|
|
73
76
|
isVisible: boolean;
|
|
77
|
+
lastClosedPos?: number;
|
|
74
78
|
};
|
|
@@ -7,6 +7,7 @@ export type Coordinates = {
|
|
|
7
7
|
top?: number;
|
|
8
8
|
bottom?: number;
|
|
9
9
|
};
|
|
10
|
+
export type PositionOffset = Coordinates;
|
|
10
11
|
export interface Props {
|
|
11
12
|
zIndex?: number;
|
|
12
13
|
className?: string;
|
|
@@ -16,6 +17,7 @@ export interface Props {
|
|
|
16
17
|
offset?: number[];
|
|
17
18
|
fitWidth?: number;
|
|
18
19
|
fitHeight?: number;
|
|
20
|
+
absoluteOffset?: PositionOffset;
|
|
19
21
|
alignX?: 'left' | 'center' | 'right';
|
|
20
22
|
alignY?: 'bottom' | 'top';
|
|
21
23
|
onPositionCalculated?: (position: Coordinates) => any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "187.47.
|
|
3
|
+
"version": "187.47.3",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@atlaskit/code": "^14.6.0",
|
|
56
56
|
"@atlaskit/date": "^0.10.0",
|
|
57
57
|
"@atlaskit/datetime-picker": "^12.10.0",
|
|
58
|
-
"@atlaskit/editor-common": "^75.
|
|
58
|
+
"@atlaskit/editor-common": "^75.8.0",
|
|
59
59
|
"@atlaskit/editor-json-transformer": "^8.10.0",
|
|
60
60
|
"@atlaskit/editor-markdown-transformer": "^5.2.5",
|
|
61
61
|
"@atlaskit/editor-palette": "1.5.1",
|
|
@@ -81,13 +81,13 @@
|
|
|
81
81
|
"@atlaskit/editor-plugin-placeholder": "^0.1.0",
|
|
82
82
|
"@atlaskit/editor-plugin-quick-insert": "^0.1.0",
|
|
83
83
|
"@atlaskit/editor-plugin-rule": "^0.1.0",
|
|
84
|
-
"@atlaskit/editor-plugin-table": "^3.
|
|
84
|
+
"@atlaskit/editor-plugin-table": "^3.2.0",
|
|
85
85
|
"@atlaskit/editor-plugin-text-formatting": "^0.4.0",
|
|
86
86
|
"@atlaskit/editor-plugin-type-ahead": "^0.3.0",
|
|
87
87
|
"@atlaskit/editor-plugin-unsupported-content": "^0.2.0",
|
|
88
88
|
"@atlaskit/editor-plugin-width": "^0.2.0",
|
|
89
89
|
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
90
|
-
"@atlaskit/editor-shared-styles": "^2.
|
|
90
|
+
"@atlaskit/editor-shared-styles": "^2.8.0",
|
|
91
91
|
"@atlaskit/editor-tables": "^2.3.0",
|
|
92
92
|
"@atlaskit/emoji": "^67.5.0",
|
|
93
93
|
"@atlaskit/empty-state": "^7.6.0",
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
"@atlaskit/collab-provider": "9.12.3",
|
|
157
157
|
"@atlaskit/dropdown-menu": "^11.14.0",
|
|
158
158
|
"@atlaskit/editor-extension-dropbox": "^0.4.0",
|
|
159
|
-
"@atlaskit/editor-plugin-table": "^3.
|
|
159
|
+
"@atlaskit/editor-plugin-table": "^3.2.0",
|
|
160
160
|
"@atlaskit/flag": "^15.2.0",
|
|
161
161
|
"@atlaskit/icon-object": "^6.3.0",
|
|
162
162
|
"@atlaskit/inline-dialog": "^13.6.0",
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
"@atlaskit/visual-regression": "*",
|
|
180
180
|
"@atlaskit/webdriver-runner": "*",
|
|
181
181
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
182
|
-
"@atlassian/editor-extension-link-create": "^0.
|
|
182
|
+
"@atlassian/editor-extension-link-create": "^0.4.0",
|
|
183
183
|
"@atlassian/feature-flags-test-utils": "^0.1.1",
|
|
184
184
|
"@atlassian/link-picker-plugins": "^23.0.0",
|
|
185
185
|
"@atlassian/search-provider": "2.4.7",
|
|
@@ -248,6 +248,9 @@
|
|
|
248
248
|
"type": "boolean",
|
|
249
249
|
"referenceOnly": "true"
|
|
250
250
|
},
|
|
251
|
+
"platform.editor.table-sticky-scrollbar": {
|
|
252
|
+
"type": "boolean"
|
|
253
|
+
},
|
|
251
254
|
"platform.editor.update-table-cell-width-via-step": {
|
|
252
255
|
"type": "boolean",
|
|
253
256
|
"referenceOnly": "true"
|