@atlaskit/editor-core 190.0.0 → 190.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 +16 -0
- package/dist/cjs/i18n/ja.js +1 -0
- package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/index.js +0 -6
- package/dist/cjs/plugins/annotation/pm-plugins/inline-comment.js +7 -2
- package/dist/cjs/plugins/annotation/pm-plugins/plugin-factory.js +43 -2
- package/dist/cjs/plugins/annotation/pm-plugins/reducer.js +10 -2
- package/dist/cjs/plugins/annotation/ui/InlineCommentView.js +4 -2
- package/dist/cjs/plugins/annotation/utils.js +17 -1
- package/dist/cjs/plugins/extension/pm-plugins/unique-id.js +2 -2
- package/dist/cjs/plugins/extension/toolbar.js +17 -2
- package/dist/cjs/ui/Alignment/index.js +1 -0
- package/dist/cjs/ui/ContentStyles/extension.js +1 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/i18n/ja.js +1 -0
- package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/index.js +0 -7
- package/dist/es2019/plugins/annotation/pm-plugins/inline-comment.js +5 -2
- package/dist/es2019/plugins/annotation/pm-plugins/plugin-factory.js +50 -3
- package/dist/es2019/plugins/annotation/pm-plugins/reducer.js +15 -4
- package/dist/es2019/plugins/annotation/ui/InlineCommentView.js +4 -2
- package/dist/es2019/plugins/annotation/utils.js +10 -0
- package/dist/es2019/plugins/extension/pm-plugins/unique-id.js +2 -2
- package/dist/es2019/plugins/extension/toolbar.js +23 -2
- package/dist/es2019/ui/Alignment/index.js +1 -0
- package/dist/es2019/ui/ContentStyles/extension.js +12 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/i18n/ja.js +1 -0
- package/dist/esm/plugins/alignment/ui/ToolbarAlignment/index.js +0 -6
- package/dist/esm/plugins/annotation/pm-plugins/inline-comment.js +7 -2
- package/dist/esm/plugins/annotation/pm-plugins/plugin-factory.js +44 -3
- package/dist/esm/plugins/annotation/pm-plugins/reducer.js +10 -2
- package/dist/esm/plugins/annotation/ui/InlineCommentView.js +4 -2
- package/dist/esm/plugins/annotation/utils.js +14 -0
- package/dist/esm/plugins/extension/pm-plugins/unique-id.js +2 -2
- package/dist/esm/plugins/extension/toolbar.js +17 -2
- package/dist/esm/ui/Alignment/index.js +1 -0
- package/dist/esm/ui/ContentStyles/extension.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/i18n/ja.d.ts +1 -0
- package/dist/types/plugins/annotation/pm-plugins/types.d.ts +1 -0
- package/dist/types/plugins/annotation/utils.d.ts +5 -0
- package/dist/types-ts4.5/i18n/ja.d.ts +1 -0
- package/dist/types-ts4.5/plugins/annotation/pm-plugins/types.d.ts +1 -0
- package/dist/types-ts4.5/plugins/annotation/utils.d.ts +5 -0
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 190.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#61696](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/61696) [`fcc2b35ad97b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fcc2b35ad97b) - ED-21505: Added better selections and highlights for MBE nodes on Editor
|
|
8
|
+
|
|
9
|
+
## 190.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#59443](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/59443) [`c9c6e1634058`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c9c6e1634058) - [ux] ED-20733: Decouple selected annotation logic from logic to close the inline comment view. This fixes the bug where the inline comment view can be unexpectedly opened from doc changes (through remote editors or non-selection altering changes such as expanding / collapsing expand blocks). Changes are behind platform.editor.annotation.decouple-inline-comment-closed_flmox.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#62137](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/62137) [`503cb77af9ce`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/503cb77af9ce) - [ux] Fix: Clicking on alignment button did not close the alignment popup.
|
|
18
|
+
|
|
3
19
|
## 190.0.0
|
|
4
20
|
|
|
5
21
|
### Major Changes
|
package/dist/cjs/i18n/ja.js
CHANGED
|
@@ -33,6 +33,7 @@ var _default = exports.default = {
|
|
|
33
33
|
'fabric.editor.configPanel.fieldTypeError.isMultipleAndRadio': '「isMultiple」と「style: radio」を組み合わせることはできません',
|
|
34
34
|
'fabric.editor.configPanel.formType.addField': 'フィールドを追加',
|
|
35
35
|
'fabric.editor.configPanel.formType.removeField': 'フィールドを削除',
|
|
36
|
+
'fabric.editor.configPanel.help': 'お困りですか?',
|
|
36
37
|
'fabric.editor.configPanel.invalid': '無効なフィールド',
|
|
37
38
|
'fabric.editor.configPanel.required': '必須フィールド',
|
|
38
39
|
'fabric.editor.configPanel.submit': '送信',
|
|
@@ -97,12 +97,6 @@ var AlignmentToolbar = exports.AlignmentToolbar = /*#__PURE__*/function (_React$
|
|
|
97
97
|
boundariesElement: popupsBoundariesElement,
|
|
98
98
|
scrollableElement: popupsScrollableElement,
|
|
99
99
|
isOpen: isOpen,
|
|
100
|
-
onOpenChange: function onOpenChange(_ref) {
|
|
101
|
-
var isOpen = _ref.isOpen;
|
|
102
|
-
_this2.setState({
|
|
103
|
-
isOpen: isOpen
|
|
104
|
-
});
|
|
105
|
-
},
|
|
106
100
|
handleClickOutside: function handleClickOutside(event) {
|
|
107
101
|
if (event instanceof MouseEvent) {
|
|
108
102
|
_this2.hide({
|
|
@@ -13,6 +13,7 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
|
13
13
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
14
14
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
15
15
|
var _nodeviews = require("../nodeviews");
|
|
16
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
17
|
var _commands = require("../commands");
|
|
17
18
|
var _utils = require("../utils");
|
|
18
19
|
var _pluginFactory = require("./plugin-factory");
|
|
@@ -84,6 +85,7 @@ var initialState = function initialState() {
|
|
|
84
85
|
isSelecting: false
|
|
85
86
|
},
|
|
86
87
|
disallowOnWhitespace: disallowOnWhitespace,
|
|
88
|
+
isInlineCommentViewClosed: false,
|
|
87
89
|
isVisible: true,
|
|
88
90
|
skipSelectionHandling: false
|
|
89
91
|
};
|
|
@@ -211,14 +213,17 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
211
213
|
draftDecorationSet = _ref5.draftDecorationSet,
|
|
212
214
|
annotations = _ref5.annotations,
|
|
213
215
|
selectedAnnotations = _ref5.selectedAnnotations,
|
|
214
|
-
isVisible = _ref5.isVisible
|
|
216
|
+
isVisible = _ref5.isVisible,
|
|
217
|
+
isInlineCommentViewClosed = _ref5.isInlineCommentViewClosed;
|
|
215
218
|
var decorations = draftDecorationSet !== null && draftDecorationSet !== void 0 ? draftDecorationSet : _view.DecorationSet.empty;
|
|
216
219
|
var focusDecorations = [];
|
|
217
220
|
state.doc.descendants(function (node, pos) {
|
|
218
221
|
node.marks.filter(function (mark) {
|
|
219
222
|
return mark.type === state.schema.marks.annotation;
|
|
220
223
|
}).forEach(function (mark) {
|
|
221
|
-
var isSelected = !!(selectedAnnotations !== null && selectedAnnotations !== void 0 && selectedAnnotations.some(function (selectedAnnotation) {
|
|
224
|
+
var isSelected = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.annotation.decouple-inline-comment-closed_flmox') ? !isInlineCommentViewClosed && !!(selectedAnnotations !== null && selectedAnnotations !== void 0 && selectedAnnotations.some(function (selectedAnnotation) {
|
|
225
|
+
return selectedAnnotation.id === mark.attrs.id;
|
|
226
|
+
})) : !!(selectedAnnotations !== null && selectedAnnotations !== void 0 && selectedAnnotations.some(function (selectedAnnotation) {
|
|
222
227
|
return selectedAnnotation.id === mark.attrs.id;
|
|
223
228
|
}));
|
|
224
229
|
var isUnresolved = !!annotations && annotations[mark.attrs.id] === false;
|
|
@@ -8,12 +8,13 @@ exports.createPluginState = exports.createCommand = void 0;
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _pluginStateFactory = require("../../../utils/plugin-state-factory");
|
|
10
10
|
var _utils = require("../utils");
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
12
|
var _reducer = _interopRequireDefault(require("./reducer"));
|
|
12
13
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
14
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
15
|
var handleDocChanged = function handleDocChanged(tr, prevPluginState) {
|
|
15
16
|
if (!tr.getMeta('replaceDocument')) {
|
|
16
|
-
return handleSelectionChanged(tr, prevPluginState);
|
|
17
|
+
return (0, _platformFeatureFlags.getBooleanFF)('platform.editor.annotation.decouple-inline-comment-closed_flmox') ? getSelectionChangedHandler(false)(tr, prevPluginState) : handleSelectionChanged(tr, prevPluginState);
|
|
17
18
|
}
|
|
18
19
|
return _objectSpread(_objectSpread({}, prevPluginState), {}, {
|
|
19
20
|
dirtyAnnotations: true
|
|
@@ -38,8 +39,48 @@ var handleSelectionChanged = function handleSelectionChanged(tr, pluginState) {
|
|
|
38
39
|
}
|
|
39
40
|
return pluginState;
|
|
40
41
|
};
|
|
42
|
+
var getSelectionChangedHandler = function getSelectionChangedHandler(reopenCommentView) {
|
|
43
|
+
return function (tr, pluginState) {
|
|
44
|
+
/**
|
|
45
|
+
* If feature flag is **OFF** we want to keep the old behavior. Note that
|
|
46
|
+
* reopenCommentView is not relevant here when using old behaviour.
|
|
47
|
+
*
|
|
48
|
+
* Feature flag is evaluated here rather than directly in onSelectionChanged where it is assigned
|
|
49
|
+
* to prevent the plugin from setting up the handler before the feature flag is evaluated.
|
|
50
|
+
*
|
|
51
|
+
* This comment / logic can be cleaned up once the feature flag is removed.
|
|
52
|
+
*/
|
|
53
|
+
if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.annotation.decouple-inline-comment-closed_flmox')) {
|
|
54
|
+
return handleSelectionChanged(tr, pluginState);
|
|
55
|
+
}
|
|
56
|
+
if (pluginState.skipSelectionHandling) {
|
|
57
|
+
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
58
|
+
skipSelectionHandling: false
|
|
59
|
+
}, reopenCommentView && {
|
|
60
|
+
isInlineCommentViewClosed: false
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
var selectedAnnotations = (0, _utils.findAnnotationsInSelection)(tr.selection, tr.doc);
|
|
64
|
+
if (selectedAnnotations.length === 0) {
|
|
65
|
+
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
66
|
+
selectedAnnotations: selectedAnnotations,
|
|
67
|
+
isInlineCommentViewClosed: true
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if ((0, _utils.isSelectedAnnotationsChanged)(selectedAnnotations, pluginState.selectedAnnotations)) {
|
|
71
|
+
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
72
|
+
selectedAnnotations: selectedAnnotations
|
|
73
|
+
}, reopenCommentView && {
|
|
74
|
+
isInlineCommentViewClosed: false
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
return _objectSpread(_objectSpread({}, pluginState), reopenCommentView && {
|
|
78
|
+
isInlineCommentViewClosed: false
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
};
|
|
41
82
|
var _pluginFactory = (0, _pluginStateFactory.pluginFactory)(_utils.inlineCommentPluginKey, _reducer.default, {
|
|
42
|
-
onSelectionChanged:
|
|
83
|
+
onSelectionChanged: getSelectionChangedHandler(true),
|
|
43
84
|
onDocChanged: handleDocChanged,
|
|
44
85
|
mapping: function mapping(tr, pluginState) {
|
|
45
86
|
var draftDecorationSet = pluginState.draftDecorationSet,
|
|
@@ -7,9 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
-
var _types = require("./types");
|
|
11
10
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
12
|
var _utils = require("../utils");
|
|
13
|
+
var _types = require("./types");
|
|
13
14
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
15
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
16
|
var _default = exports.default = function _default(pluginState, action) {
|
|
@@ -31,7 +32,9 @@ var _default = exports.default = function _default(pluginState, action) {
|
|
|
31
32
|
annotations: {}
|
|
32
33
|
});
|
|
33
34
|
case _types.ACTIONS.CLOSE_COMPONENT:
|
|
34
|
-
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
35
|
+
return (0, _platformFeatureFlags.getBooleanFF)('platform.editor.annotation.decouple-inline-comment-closed_flmox') ? _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
36
|
+
isInlineCommentViewClosed: true
|
|
37
|
+
}) : _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
35
38
|
selectedAnnotations: []
|
|
36
39
|
});
|
|
37
40
|
case _types.ACTIONS.ADD_INLINE_COMMENT:
|
|
@@ -39,6 +42,8 @@ var _default = exports.default = function _default(pluginState, action) {
|
|
|
39
42
|
return _objectSpread(_objectSpread({}, updatedPluginState), {}, {
|
|
40
43
|
selectedAnnotations: [].concat((0, _toConsumableArray2.default)(updatedPluginState.selectedAnnotations), (0, _toConsumableArray2.default)(action.data.selectedAnnotations)),
|
|
41
44
|
annotations: _objectSpread(_objectSpread({}, pluginState.annotations), action.data.inlineComments)
|
|
45
|
+
}, (0, _platformFeatureFlags.getBooleanFF)('platform.editor.annotation.decouple-inline-comment-closed_flmox') && {
|
|
46
|
+
isInlineCommentViewClosed: false
|
|
42
47
|
});
|
|
43
48
|
case _types.ACTIONS.INLINE_COMMENT_SET_VISIBLE:
|
|
44
49
|
var isVisible = action.data.isVisible;
|
|
@@ -52,6 +57,9 @@ var _default = exports.default = function _default(pluginState, action) {
|
|
|
52
57
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
53
58
|
selectedAnnotations: (0, _toConsumableArray2.default)(action.data.selectedAnnotations),
|
|
54
59
|
skipSelectionHandling: true
|
|
60
|
+
}, (0, _platformFeatureFlags.getBooleanFF)('platform.editor.annotation.decouple-inline-comment-closed_flmox') && {
|
|
61
|
+
// if selecting annotation explicitly, reopen the comment view
|
|
62
|
+
isInlineCommentViewClosed: false
|
|
55
63
|
});
|
|
56
64
|
default:
|
|
57
65
|
return pluginState;
|
|
@@ -8,6 +8,7 @@ exports.InlineCommentView = InlineCommentView;
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
12
|
var _AnnotationViewWrapper = require("./AnnotationViewWrapper");
|
|
12
13
|
var _types = require("../types");
|
|
13
14
|
var _utils2 = require("../utils");
|
|
@@ -44,7 +45,8 @@ function InlineCommentView(_ref) {
|
|
|
44
45
|
var _ref2 = inlineCommentState || {},
|
|
45
46
|
bookmark = _ref2.bookmark,
|
|
46
47
|
selectedAnnotations = _ref2.selectedAnnotations,
|
|
47
|
-
annotations = _ref2.annotations
|
|
48
|
+
annotations = _ref2.annotations,
|
|
49
|
+
isInlineCommentViewClosed = _ref2.isInlineCommentViewClosed;
|
|
48
50
|
var annotationsList = (0, _utils2.getAllAnnotations)(editorView.state.doc);
|
|
49
51
|
var selection = (0, _utils2.getSelectionPositions)(state, inlineCommentState);
|
|
50
52
|
var position = findPosForDOM(selection);
|
|
@@ -122,7 +124,7 @@ function InlineCommentView(_ref) {
|
|
|
122
124
|
};
|
|
123
125
|
dispatchAnalyticsEvent(payload);
|
|
124
126
|
};
|
|
125
|
-
if (!selectedAnnotations) {
|
|
127
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.annotation.decouple-inline-comment-closed_flmox') && isInlineCommentViewClosed || !selectedAnnotations) {
|
|
126
128
|
return null;
|
|
127
129
|
}
|
|
128
130
|
return /*#__PURE__*/_react.default.createElement(_AnnotationViewWrapper.AnnotationViewWrapper, {
|
|
@@ -21,7 +21,9 @@ Object.defineProperty(exports, "hasAnnotationMark", {
|
|
|
21
21
|
});
|
|
22
22
|
exports.hasInvalidNodes = void 0;
|
|
23
23
|
exports.hasInvalidWhitespaceNode = hasInvalidWhitespaceNode;
|
|
24
|
-
exports.
|
|
24
|
+
exports.inlineCommentPluginKey = void 0;
|
|
25
|
+
exports.isSelectedAnnotationsChanged = isSelectedAnnotationsChanged;
|
|
26
|
+
exports.isSelectionValid = void 0;
|
|
25
27
|
exports.stripNonExistingAnnotations = stripNonExistingAnnotations;
|
|
26
28
|
exports.surroundingMarks = void 0;
|
|
27
29
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
@@ -353,4 +355,18 @@ function stripNonExistingAnnotationsFromNode(node, state) {
|
|
|
353
355
|
});
|
|
354
356
|
}
|
|
355
357
|
return node;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Compares two sets of annotationInfos to see if the annotations have changed
|
|
362
|
+
* This function assumes annotations will have unique id's for simplicity
|
|
363
|
+
*/
|
|
364
|
+
function isSelectedAnnotationsChanged(oldSelectedAnnotations, newSelectedAnnotations) {
|
|
365
|
+
return newSelectedAnnotations.length !== oldSelectedAnnotations.length ||
|
|
366
|
+
// assuming annotations have unique id's for simplicity
|
|
367
|
+
newSelectedAnnotations.some(function (annotation) {
|
|
368
|
+
return !oldSelectedAnnotations.find(function (pluginStateAnnotation) {
|
|
369
|
+
return annotation.id === pluginStateAnnotation.id && annotation.type === pluginStateAnnotation.type;
|
|
370
|
+
});
|
|
371
|
+
});
|
|
356
372
|
}
|
|
@@ -51,8 +51,8 @@ var createPlugin = exports.createPlugin = function createPlugin() {
|
|
|
51
51
|
}));
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
|
-
* If it's a bodiedExtension, we'll need to keep digging;
|
|
55
|
-
* can have more extension nodes within the contents of that
|
|
54
|
+
* If it's a multiBodiedExtension or bodiedExtension, we'll need to keep digging;
|
|
55
|
+
* since we can have more extension nodes within the contents of that
|
|
56
56
|
*/
|
|
57
57
|
if ([multiBodiedExtension, bodiedExtension].includes(node.type)) {
|
|
58
58
|
return true;
|
|
@@ -65,6 +65,16 @@ var isLayoutSupported = function isLayoutSupported(state, selectedExtNode) {
|
|
|
65
65
|
}
|
|
66
66
|
return !!((selectedExtNode.node.type === bodiedExtension || selectedExtNode.node.type === extension && !(0, _utils.hasParentNodeOfType)([bodiedExtension, table, expand].filter(Boolean))(selection)) && !(0, _utils.hasParentNodeOfType)([layoutSection])(selection));
|
|
67
67
|
};
|
|
68
|
+
|
|
69
|
+
// Edit is not supported for multiBodiedExtension
|
|
70
|
+
var isEditSupported = function isEditSupported(state, selectedExtNode) {
|
|
71
|
+
var _selectedExtNode$node;
|
|
72
|
+
var multiBodiedExtension = state.schema.nodes.multiBodiedExtension;
|
|
73
|
+
if (!selectedExtNode || (selectedExtNode === null || selectedExtNode === void 0 || (_selectedExtNode$node = selectedExtNode.node) === null || _selectedExtNode$node === void 0 ? void 0 : _selectedExtNode$node.type) === multiBodiedExtension) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
return true;
|
|
77
|
+
};
|
|
68
78
|
var breakoutOptions = function breakoutOptions(state, formatMessage, extensionState, breakoutEnabled) {
|
|
69
79
|
var nodeWithPos = (0, _utils2.getSelectedExtension)(state, true);
|
|
70
80
|
|
|
@@ -96,10 +106,15 @@ var breakoutOptions = function breakoutOptions(state, formatMessage, extensionSt
|
|
|
96
106
|
}
|
|
97
107
|
return [];
|
|
98
108
|
};
|
|
99
|
-
var editButton = function editButton(formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI) {
|
|
109
|
+
var editButton = function editButton(state, formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI) {
|
|
110
|
+
var nodeWithPos = (0, _utils2.getSelectedExtension)(state, true);
|
|
100
111
|
if (!extensionState.showEditButton) {
|
|
101
112
|
return [];
|
|
102
113
|
}
|
|
114
|
+
// For multiBodiedExtension case, edit is not supported
|
|
115
|
+
if (nodeWithPos && !isEditSupported(state, nodeWithPos)) {
|
|
116
|
+
return [];
|
|
117
|
+
}
|
|
103
118
|
return [{
|
|
104
119
|
id: 'editor.extension.edit',
|
|
105
120
|
type: 'button',
|
|
@@ -129,7 +144,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(_ref
|
|
|
129
144
|
var extensionState = (0, _main.getPluginState)(state);
|
|
130
145
|
if (extensionState && !extensionState.showContextPanel && extensionState.element) {
|
|
131
146
|
var nodeType = [state.schema.nodes.extension, state.schema.nodes.inlineExtension, state.schema.nodes.bodiedExtension, state.schema.nodes.multiBodiedExtension];
|
|
132
|
-
var editButtonArray = editButton(formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI);
|
|
147
|
+
var editButtonArray = editButton(state, formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI);
|
|
133
148
|
var breakoutButtonArray = breakoutOptions(state, formatMessage, extensionState, breakoutEnabled);
|
|
134
149
|
var extensionObj = (0, _utils2.getSelectedExtension)(state, true);
|
|
135
150
|
|
|
@@ -47,6 +47,7 @@ var Alignment = /*#__PURE__*/function (_PureComponent) {
|
|
|
47
47
|
className = _this$props.className,
|
|
48
48
|
intl = _this$props.intl;
|
|
49
49
|
return (0, _react.jsx)("div", {
|
|
50
|
+
"data-testid": "alignment-buttons",
|
|
50
51
|
css: _styles.alignmentWrapper,
|
|
51
52
|
className: className
|
|
52
53
|
}, alignmentOptions.map(function (alignment) {
|
|
@@ -10,4 +10,4 @@ var _react = require("@emotion/react");
|
|
|
10
10
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
11
11
|
var _templateObject;
|
|
12
12
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
13
|
-
var extensionStyles = exports.extensionStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .multiBodiedExtensionView-content-wrap.", ":not(.danger) {\n ", "\n }\n\n .extensionView-content-wrap,\n .multiBodiedExtensionView-content-wrap,\n .bodiedExtensionView-content-wrap {\n margin: ", " 0;\n\n &:first-of-type {\n margin-top: 0;\n }\n\n &:last-of-type {\n margin-bottom: 0;\n }\n\n &:not(.danger).", " {\n & > span > .extension-container {\n ", "\n }\n }\n\n &.danger > span > .extension-container {\n box-shadow: 0 0 0 ", "px\n ", ";\n background-color: ", ";\n }\n\n &.inline {\n word-wrap: break-all;\n }\n }\n\n .extensionView-content-wrap .extension-container {\n overflow: hidden;\n }\n\n .bodiedExtensionView-content-wrap\n .extensionView-content-wrap\n .extension-container {\n width: 100%;\n max-width: 100%; // ensure width can't go over 100%;\n }\n\n [data-mark-type='fragment'] {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin: ", " 0;\n }\n\n & > [data-mark-type='dataConsumer'] {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin: ", " 0;\n }\n }\n\n &:first-child {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin-top: 0;\n }\n\n & > [data-mark-type='dataConsumer'] {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin-top: 0;\n }\n }\n }\n\n &:nth-last-of-type(-n + 2):not(:first-of-type) {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin-bottom: 0;\n }\n\n & > [data-mark-type='dataConsumer'] {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin-bottom: 0;\n }\n }\n }\n }\n"])), _editorSharedStyles.akEditorSelectedNodeClassName, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow, _editorSharedStyles.SelectionStyle.Blanket]), _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.akEditorSelectedNodeClassName, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _editorSharedStyles.akEditorSelectedBorderSize, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), "var(--ds-background-danger, ".concat(_editorSharedStyles.akEditorDeleteBackground, ")"), _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.blockNodesVerticalMargin);
|
|
13
|
+
var extensionStyles = exports.extensionStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .multiBodiedExtensionView-content-wrap.", ":not(.danger) {\n ", "\n }\n\n .multiBodiedExtensionView-content-wrap {\n &.danger > span > .multiBodiedExtension--container {\n box-shadow: 0 0 0 ", "px\n ", ";\n background-color: ", ";\n }\n .multiBodiedExtension--container {\n width: 100%;\n max-width: 100%; // ensure width can't go over 100%;\n }\n }\n\n .extensionView-content-wrap,\n .multiBodiedExtensionView-content-wrap,\n .bodiedExtensionView-content-wrap {\n margin: ", " 0;\n\n &:first-of-type {\n margin-top: 0;\n }\n\n &:last-of-type {\n margin-bottom: 0;\n }\n\n &:not(.danger).", " {\n & > span > .extension-container {\n ", "\n }\n }\n\n &.danger > span > .extension-container {\n box-shadow: 0 0 0 ", "px\n ", ";\n background-color: ", ";\n }\n\n &.inline {\n word-wrap: break-all;\n }\n }\n\n .extensionView-content-wrap .extension-container {\n overflow: hidden;\n }\n\n .bodiedExtensionView-content-wrap\n .extensionView-content-wrap\n .extension-container {\n width: 100%;\n max-width: 100%; // ensure width can't go over 100%;\n }\n\n [data-mark-type='fragment'] {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin: ", " 0;\n }\n\n & > [data-mark-type='dataConsumer'] {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin: ", " 0;\n }\n }\n\n &:first-child {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin-top: 0;\n }\n\n & > [data-mark-type='dataConsumer'] {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin-top: 0;\n }\n }\n }\n\n &:nth-last-of-type(-n + 2):not(:first-of-type) {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin-bottom: 0;\n }\n\n & > [data-mark-type='dataConsumer'] {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin-bottom: 0;\n }\n }\n }\n }\n"])), _editorSharedStyles.akEditorSelectedNodeClassName, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow, _editorSharedStyles.SelectionStyle.Blanket]), _editorSharedStyles.akEditorSelectedBorderSize, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), "var(--ds-background-danger, ".concat(_editorSharedStyles.akEditorDeleteBackground, ")"), _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.akEditorSelectedNodeClassName, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _editorSharedStyles.akEditorSelectedBorderSize, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), "var(--ds-background-danger, ".concat(_editorSharedStyles.akEditorDeleteBackground, ")"), _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.blockNodesVerticalMargin);
|
package/dist/es2019/i18n/ja.js
CHANGED
|
@@ -27,6 +27,7 @@ export default {
|
|
|
27
27
|
'fabric.editor.configPanel.fieldTypeError.isMultipleAndRadio': '「isMultiple」と「style: radio」を組み合わせることはできません',
|
|
28
28
|
'fabric.editor.configPanel.formType.addField': 'フィールドを追加',
|
|
29
29
|
'fabric.editor.configPanel.formType.removeField': 'フィールドを削除',
|
|
30
|
+
'fabric.editor.configPanel.help': 'お困りですか?',
|
|
30
31
|
'fabric.editor.configPanel.invalid': '無効なフィールド',
|
|
31
32
|
'fabric.editor.configPanel.required': '必須フィールド',
|
|
32
33
|
'fabric.editor.configPanel.submit': '送信',
|
|
@@ -75,13 +75,6 @@ export class AlignmentToolbar extends React.Component {
|
|
|
75
75
|
boundariesElement: popupsBoundariesElement,
|
|
76
76
|
scrollableElement: popupsScrollableElement,
|
|
77
77
|
isOpen: isOpen,
|
|
78
|
-
onOpenChange: ({
|
|
79
|
-
isOpen
|
|
80
|
-
}) => {
|
|
81
|
-
this.setState({
|
|
82
|
-
isOpen
|
|
83
|
-
});
|
|
84
|
-
},
|
|
85
78
|
handleClickOutside: event => {
|
|
86
79
|
if (event instanceof MouseEvent) {
|
|
87
80
|
this.hide({
|
|
@@ -3,6 +3,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
3
3
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
4
4
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
5
5
|
import { AnnotationNodeView, getAnnotationViewClassname } from '../nodeviews';
|
|
6
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { updateInlineCommentResolvedState, updateMouseState, clearDirtyMark, setInlineCommentsVisibility, setSelectedAnnotation, closeComponent } from '../commands';
|
|
7
8
|
import { getAllAnnotations, inlineCommentPluginKey, getPluginState } from '../utils';
|
|
8
9
|
import { createPluginState } from './plugin-factory';
|
|
@@ -36,6 +37,7 @@ const initialState = (disallowOnWhitespace = false) => {
|
|
|
36
37
|
isSelecting: false
|
|
37
38
|
},
|
|
38
39
|
disallowOnWhitespace,
|
|
40
|
+
isInlineCommentViewClosed: false,
|
|
39
41
|
isVisible: true,
|
|
40
42
|
skipSelectionHandling: false
|
|
41
43
|
};
|
|
@@ -151,13 +153,14 @@ export const inlineCommentPlugin = options => {
|
|
|
151
153
|
draftDecorationSet,
|
|
152
154
|
annotations,
|
|
153
155
|
selectedAnnotations,
|
|
154
|
-
isVisible
|
|
156
|
+
isVisible,
|
|
157
|
+
isInlineCommentViewClosed
|
|
155
158
|
} = getPluginState(state) || {};
|
|
156
159
|
let decorations = draftDecorationSet !== null && draftDecorationSet !== void 0 ? draftDecorationSet : DecorationSet.empty;
|
|
157
160
|
const focusDecorations = [];
|
|
158
161
|
state.doc.descendants((node, pos) => {
|
|
159
162
|
node.marks.filter(mark => mark.type === state.schema.marks.annotation).forEach(mark => {
|
|
160
|
-
const isSelected = !!(selectedAnnotations !== null && selectedAnnotations !== void 0 && selectedAnnotations.some(selectedAnnotation => selectedAnnotation.id === mark.attrs.id));
|
|
163
|
+
const isSelected = getBooleanFF('platform.editor.annotation.decouple-inline-comment-closed_flmox') ? !isInlineCommentViewClosed && !!(selectedAnnotations !== null && selectedAnnotations !== void 0 && selectedAnnotations.some(selectedAnnotation => selectedAnnotation.id === mark.attrs.id)) : !!(selectedAnnotations !== null && selectedAnnotations !== void 0 && selectedAnnotations.some(selectedAnnotation => selectedAnnotation.id === mark.attrs.id));
|
|
161
164
|
const isUnresolved = !!annotations && annotations[mark.attrs.id] === false;
|
|
162
165
|
if (isVisible) {
|
|
163
166
|
focusDecorations.push(Decoration.inline(pos, pos + node.nodeSize, {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { pluginFactory } from '../../../utils/plugin-state-factory';
|
|
2
|
-
import { findAnnotationsInSelection, inlineCommentPluginKey } from '../utils';
|
|
2
|
+
import { findAnnotationsInSelection, inlineCommentPluginKey, isSelectedAnnotationsChanged } from '../utils';
|
|
3
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import reducer from './reducer';
|
|
4
5
|
const handleDocChanged = (tr, prevPluginState) => {
|
|
5
6
|
if (!tr.getMeta('replaceDocument')) {
|
|
6
|
-
return handleSelectionChanged(tr, prevPluginState);
|
|
7
|
+
return getBooleanFF('platform.editor.annotation.decouple-inline-comment-closed_flmox') ? getSelectionChangedHandler(false)(tr, prevPluginState) : handleSelectionChanged(tr, prevPluginState);
|
|
7
8
|
}
|
|
8
9
|
return {
|
|
9
10
|
...prevPluginState,
|
|
@@ -29,11 +30,57 @@ const handleSelectionChanged = (tr, pluginState) => {
|
|
|
29
30
|
}
|
|
30
31
|
return pluginState;
|
|
31
32
|
};
|
|
33
|
+
const getSelectionChangedHandler = reopenCommentView => (tr, pluginState) => {
|
|
34
|
+
/**
|
|
35
|
+
* If feature flag is **OFF** we want to keep the old behavior. Note that
|
|
36
|
+
* reopenCommentView is not relevant here when using old behaviour.
|
|
37
|
+
*
|
|
38
|
+
* Feature flag is evaluated here rather than directly in onSelectionChanged where it is assigned
|
|
39
|
+
* to prevent the plugin from setting up the handler before the feature flag is evaluated.
|
|
40
|
+
*
|
|
41
|
+
* This comment / logic can be cleaned up once the feature flag is removed.
|
|
42
|
+
*/
|
|
43
|
+
if (!getBooleanFF('platform.editor.annotation.decouple-inline-comment-closed_flmox')) {
|
|
44
|
+
return handleSelectionChanged(tr, pluginState);
|
|
45
|
+
}
|
|
46
|
+
if (pluginState.skipSelectionHandling) {
|
|
47
|
+
return {
|
|
48
|
+
...pluginState,
|
|
49
|
+
skipSelectionHandling: false,
|
|
50
|
+
...(reopenCommentView && {
|
|
51
|
+
isInlineCommentViewClosed: false
|
|
52
|
+
})
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
const selectedAnnotations = findAnnotationsInSelection(tr.selection, tr.doc);
|
|
56
|
+
if (selectedAnnotations.length === 0) {
|
|
57
|
+
return {
|
|
58
|
+
...pluginState,
|
|
59
|
+
selectedAnnotations,
|
|
60
|
+
isInlineCommentViewClosed: true
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
if (isSelectedAnnotationsChanged(selectedAnnotations, pluginState.selectedAnnotations)) {
|
|
64
|
+
return {
|
|
65
|
+
...pluginState,
|
|
66
|
+
selectedAnnotations,
|
|
67
|
+
...(reopenCommentView && {
|
|
68
|
+
isInlineCommentViewClosed: false
|
|
69
|
+
})
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
...pluginState,
|
|
74
|
+
...(reopenCommentView && {
|
|
75
|
+
isInlineCommentViewClosed: false
|
|
76
|
+
})
|
|
77
|
+
};
|
|
78
|
+
};
|
|
32
79
|
export const {
|
|
33
80
|
createPluginState,
|
|
34
81
|
createCommand
|
|
35
82
|
} = pluginFactory(inlineCommentPluginKey, reducer, {
|
|
36
|
-
onSelectionChanged:
|
|
83
|
+
onSelectionChanged: getSelectionChangedHandler(true),
|
|
37
84
|
onDocChanged: handleDocChanged,
|
|
38
85
|
mapping: (tr, pluginState) => {
|
|
39
86
|
let {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ACTIONS } from './types';
|
|
2
1
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
3
3
|
import { addDraftDecoration } from '../utils';
|
|
4
|
+
import { ACTIONS } from './types';
|
|
4
5
|
export default ((pluginState, action) => {
|
|
5
6
|
switch (action.type) {
|
|
6
7
|
case ACTIONS.UPDATE_INLINE_COMMENT_STATE:
|
|
@@ -26,7 +27,10 @@ export default ((pluginState, action) => {
|
|
|
26
27
|
annotations: {}
|
|
27
28
|
};
|
|
28
29
|
case ACTIONS.CLOSE_COMPONENT:
|
|
29
|
-
return {
|
|
30
|
+
return getBooleanFF('platform.editor.annotation.decouple-inline-comment-closed_flmox') ? {
|
|
31
|
+
...pluginState,
|
|
32
|
+
isInlineCommentViewClosed: true
|
|
33
|
+
} : {
|
|
30
34
|
...pluginState,
|
|
31
35
|
selectedAnnotations: []
|
|
32
36
|
};
|
|
@@ -38,7 +42,10 @@ export default ((pluginState, action) => {
|
|
|
38
42
|
annotations: {
|
|
39
43
|
...pluginState.annotations,
|
|
40
44
|
...action.data.inlineComments
|
|
41
|
-
}
|
|
45
|
+
},
|
|
46
|
+
...(getBooleanFF('platform.editor.annotation.decouple-inline-comment-closed_flmox') && {
|
|
47
|
+
isInlineCommentViewClosed: false
|
|
48
|
+
})
|
|
42
49
|
};
|
|
43
50
|
case ACTIONS.INLINE_COMMENT_SET_VISIBLE:
|
|
44
51
|
const {
|
|
@@ -55,7 +62,11 @@ export default ((pluginState, action) => {
|
|
|
55
62
|
return {
|
|
56
63
|
...pluginState,
|
|
57
64
|
selectedAnnotations: [...action.data.selectedAnnotations],
|
|
58
|
-
skipSelectionHandling: true
|
|
65
|
+
skipSelectionHandling: true,
|
|
66
|
+
...(getBooleanFF('platform.editor.annotation.decouple-inline-comment-closed_flmox') && {
|
|
67
|
+
// if selecting annotation explicitly, reopen the comment view
|
|
68
|
+
isInlineCommentViewClosed: false
|
|
69
|
+
})
|
|
59
70
|
};
|
|
60
71
|
default:
|
|
61
72
|
return pluginState;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
3
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { AnnotationViewWrapper } from './AnnotationViewWrapper';
|
|
4
5
|
import { AnnotationTestIds } from '../types';
|
|
5
6
|
import { getAnnotationViewKey, getSelectionPositions, getPluginState, getAllAnnotations } from '../utils';
|
|
@@ -45,7 +46,8 @@ export function InlineCommentView({
|
|
|
45
46
|
const {
|
|
46
47
|
bookmark,
|
|
47
48
|
selectedAnnotations,
|
|
48
|
-
annotations
|
|
49
|
+
annotations,
|
|
50
|
+
isInlineCommentViewClosed
|
|
49
51
|
} = inlineCommentState || {};
|
|
50
52
|
const annotationsList = getAllAnnotations(editorView.state.doc);
|
|
51
53
|
const selection = getSelectionPositions(state, inlineCommentState);
|
|
@@ -122,7 +124,7 @@ export function InlineCommentView({
|
|
|
122
124
|
};
|
|
123
125
|
dispatchAnalyticsEvent(payload);
|
|
124
126
|
};
|
|
125
|
-
if (!selectedAnnotations) {
|
|
127
|
+
if (getBooleanFF('platform.editor.annotation.decouple-inline-comment-closed_flmox') && isInlineCommentViewClosed || !selectedAnnotations) {
|
|
126
128
|
return null;
|
|
127
129
|
}
|
|
128
130
|
return /*#__PURE__*/React.createElement(AnnotationViewWrapper, {
|
|
@@ -321,4 +321,14 @@ function stripNonExistingAnnotationsFromNode(node, state) {
|
|
|
321
321
|
});
|
|
322
322
|
}
|
|
323
323
|
return node;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Compares two sets of annotationInfos to see if the annotations have changed
|
|
328
|
+
* This function assumes annotations will have unique id's for simplicity
|
|
329
|
+
*/
|
|
330
|
+
export function isSelectedAnnotationsChanged(oldSelectedAnnotations, newSelectedAnnotations) {
|
|
331
|
+
return newSelectedAnnotations.length !== oldSelectedAnnotations.length ||
|
|
332
|
+
// assuming annotations have unique id's for simplicity
|
|
333
|
+
newSelectedAnnotations.some(annotation => !oldSelectedAnnotations.find(pluginStateAnnotation => annotation.id === pluginStateAnnotation.id && annotation.type === pluginStateAnnotation.type));
|
|
324
334
|
}
|
|
@@ -40,8 +40,8 @@ const createPlugin = () => new SafePlugin({
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
|
-
* If it's a bodiedExtension, we'll need to keep digging;
|
|
44
|
-
* can have more extension nodes within the contents of that
|
|
43
|
+
* If it's a multiBodiedExtension or bodiedExtension, we'll need to keep digging;
|
|
44
|
+
* since we can have more extension nodes within the contents of that
|
|
45
45
|
*/
|
|
46
46
|
if ([multiBodiedExtension, bodiedExtension].includes(node.type)) {
|
|
47
47
|
return true;
|
|
@@ -62,6 +62,22 @@ const isLayoutSupported = (state, selectedExtNode) => {
|
|
|
62
62
|
}
|
|
63
63
|
return !!((selectedExtNode.node.type === bodiedExtension || selectedExtNode.node.type === extension && !hasParentNodeOfType([bodiedExtension, table, expand].filter(Boolean))(selection)) && !hasParentNodeOfType([layoutSection])(selection));
|
|
64
64
|
};
|
|
65
|
+
|
|
66
|
+
// Edit is not supported for multiBodiedExtension
|
|
67
|
+
const isEditSupported = (state, selectedExtNode) => {
|
|
68
|
+
var _selectedExtNode$node;
|
|
69
|
+
const {
|
|
70
|
+
schema: {
|
|
71
|
+
nodes: {
|
|
72
|
+
multiBodiedExtension
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
} = state;
|
|
76
|
+
if (!selectedExtNode || (selectedExtNode === null || selectedExtNode === void 0 ? void 0 : (_selectedExtNode$node = selectedExtNode.node) === null || _selectedExtNode$node === void 0 ? void 0 : _selectedExtNode$node.type) === multiBodiedExtension) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
return true;
|
|
80
|
+
};
|
|
65
81
|
const breakoutOptions = (state, formatMessage, extensionState, breakoutEnabled) => {
|
|
66
82
|
const nodeWithPos = getSelectedExtension(state, true);
|
|
67
83
|
|
|
@@ -95,10 +111,15 @@ const breakoutOptions = (state, formatMessage, extensionState, breakoutEnabled)
|
|
|
95
111
|
}
|
|
96
112
|
return [];
|
|
97
113
|
};
|
|
98
|
-
const editButton = (formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI) => {
|
|
114
|
+
const editButton = (state, formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI) => {
|
|
115
|
+
const nodeWithPos = getSelectedExtension(state, true);
|
|
99
116
|
if (!extensionState.showEditButton) {
|
|
100
117
|
return [];
|
|
101
118
|
}
|
|
119
|
+
// For multiBodiedExtension case, edit is not supported
|
|
120
|
+
if (nodeWithPos && !isEditSupported(state, nodeWithPos)) {
|
|
121
|
+
return [];
|
|
122
|
+
}
|
|
102
123
|
return [{
|
|
103
124
|
id: 'editor.extension.edit',
|
|
104
125
|
type: 'button',
|
|
@@ -130,7 +151,7 @@ export const getToolbarConfig = ({
|
|
|
130
151
|
const extensionState = getPluginState(state);
|
|
131
152
|
if (extensionState && !extensionState.showContextPanel && extensionState.element) {
|
|
132
153
|
const nodeType = [state.schema.nodes.extension, state.schema.nodes.inlineExtension, state.schema.nodes.bodiedExtension, state.schema.nodes.multiBodiedExtension];
|
|
133
|
-
const editButtonArray = editButton(formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI);
|
|
154
|
+
const editButtonArray = editButton(state, formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI);
|
|
134
155
|
const breakoutButtonArray = breakoutOptions(state, formatMessage, extensionState, breakoutEnabled);
|
|
135
156
|
const extensionObj = getSelectedExtension(state, true);
|
|
136
157
|
|
|
@@ -6,6 +6,18 @@ export const extensionStyles = css`
|
|
|
6
6
|
${getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Blanket])}
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
.multiBodiedExtensionView-content-wrap {
|
|
10
|
+
&.danger > span > .multiBodiedExtension--container {
|
|
11
|
+
box-shadow: 0 0 0 ${akEditorSelectedBorderSize}px
|
|
12
|
+
${`var(--ds-border-danger, ${akEditorDeleteBorder})`};
|
|
13
|
+
background-color: ${`var(--ds-background-danger, ${akEditorDeleteBackground})`};
|
|
14
|
+
}
|
|
15
|
+
.multiBodiedExtension--container {
|
|
16
|
+
width: 100%;
|
|
17
|
+
max-width: 100%; // ensure width can't go over 100%;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
9
21
|
.extensionView-content-wrap,
|
|
10
22
|
.multiBodiedExtensionView-content-wrap,
|
|
11
23
|
.bodiedExtensionView-content-wrap {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = "@atlaskit/editor-core";
|
|
2
|
-
export const version = "190.
|
|
2
|
+
export const version = "190.1.1";
|
package/dist/esm/i18n/ja.js
CHANGED
|
@@ -27,6 +27,7 @@ export default {
|
|
|
27
27
|
'fabric.editor.configPanel.fieldTypeError.isMultipleAndRadio': '「isMultiple」と「style: radio」を組み合わせることはできません',
|
|
28
28
|
'fabric.editor.configPanel.formType.addField': 'フィールドを追加',
|
|
29
29
|
'fabric.editor.configPanel.formType.removeField': 'フィールドを削除',
|
|
30
|
+
'fabric.editor.configPanel.help': 'お困りですか?',
|
|
30
31
|
'fabric.editor.configPanel.invalid': '無効なフィールド',
|
|
31
32
|
'fabric.editor.configPanel.required': '必須フィールド',
|
|
32
33
|
'fabric.editor.configPanel.submit': '送信',
|
|
@@ -91,12 +91,6 @@ export var AlignmentToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
91
91
|
boundariesElement: popupsBoundariesElement,
|
|
92
92
|
scrollableElement: popupsScrollableElement,
|
|
93
93
|
isOpen: isOpen,
|
|
94
|
-
onOpenChange: function onOpenChange(_ref) {
|
|
95
|
-
var isOpen = _ref.isOpen;
|
|
96
|
-
_this2.setState({
|
|
97
|
-
isOpen: isOpen
|
|
98
|
-
});
|
|
99
|
-
},
|
|
100
94
|
handleClickOutside: function handleClickOutside(event) {
|
|
101
95
|
if (event instanceof MouseEvent) {
|
|
102
96
|
_this2.hide({
|
|
@@ -6,6 +6,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
6
6
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
8
8
|
import { AnnotationNodeView, getAnnotationViewClassname } from '../nodeviews';
|
|
9
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
import { updateInlineCommentResolvedState, updateMouseState, clearDirtyMark, setInlineCommentsVisibility, setSelectedAnnotation, closeComponent } from '../commands';
|
|
10
11
|
import { getAllAnnotations, inlineCommentPluginKey, getPluginState } from '../utils';
|
|
11
12
|
import { createPluginState } from './plugin-factory';
|
|
@@ -77,6 +78,7 @@ var initialState = function initialState() {
|
|
|
77
78
|
isSelecting: false
|
|
78
79
|
},
|
|
79
80
|
disallowOnWhitespace: disallowOnWhitespace,
|
|
81
|
+
isInlineCommentViewClosed: false,
|
|
80
82
|
isVisible: true,
|
|
81
83
|
skipSelectionHandling: false
|
|
82
84
|
};
|
|
@@ -204,14 +206,17 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
|
|
|
204
206
|
draftDecorationSet = _ref5.draftDecorationSet,
|
|
205
207
|
annotations = _ref5.annotations,
|
|
206
208
|
selectedAnnotations = _ref5.selectedAnnotations,
|
|
207
|
-
isVisible = _ref5.isVisible
|
|
209
|
+
isVisible = _ref5.isVisible,
|
|
210
|
+
isInlineCommentViewClosed = _ref5.isInlineCommentViewClosed;
|
|
208
211
|
var decorations = draftDecorationSet !== null && draftDecorationSet !== void 0 ? draftDecorationSet : DecorationSet.empty;
|
|
209
212
|
var focusDecorations = [];
|
|
210
213
|
state.doc.descendants(function (node, pos) {
|
|
211
214
|
node.marks.filter(function (mark) {
|
|
212
215
|
return mark.type === state.schema.marks.annotation;
|
|
213
216
|
}).forEach(function (mark) {
|
|
214
|
-
var isSelected = !!(selectedAnnotations !== null && selectedAnnotations !== void 0 && selectedAnnotations.some(function (selectedAnnotation) {
|
|
217
|
+
var isSelected = getBooleanFF('platform.editor.annotation.decouple-inline-comment-closed_flmox') ? !isInlineCommentViewClosed && !!(selectedAnnotations !== null && selectedAnnotations !== void 0 && selectedAnnotations.some(function (selectedAnnotation) {
|
|
218
|
+
return selectedAnnotation.id === mark.attrs.id;
|
|
219
|
+
})) : !!(selectedAnnotations !== null && selectedAnnotations !== void 0 && selectedAnnotations.some(function (selectedAnnotation) {
|
|
215
220
|
return selectedAnnotation.id === mark.attrs.id;
|
|
216
221
|
}));
|
|
217
222
|
var isUnresolved = !!annotations && annotations[mark.attrs.id] === false;
|
|
@@ -2,11 +2,12 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import { pluginFactory } from '../../../utils/plugin-state-factory';
|
|
5
|
-
import { findAnnotationsInSelection, inlineCommentPluginKey } from '../utils';
|
|
5
|
+
import { findAnnotationsInSelection, inlineCommentPluginKey, isSelectedAnnotationsChanged } from '../utils';
|
|
6
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import reducer from './reducer';
|
|
7
8
|
var handleDocChanged = function handleDocChanged(tr, prevPluginState) {
|
|
8
9
|
if (!tr.getMeta('replaceDocument')) {
|
|
9
|
-
return handleSelectionChanged(tr, prevPluginState);
|
|
10
|
+
return getBooleanFF('platform.editor.annotation.decouple-inline-comment-closed_flmox') ? getSelectionChangedHandler(false)(tr, prevPluginState) : handleSelectionChanged(tr, prevPluginState);
|
|
10
11
|
}
|
|
11
12
|
return _objectSpread(_objectSpread({}, prevPluginState), {}, {
|
|
12
13
|
dirtyAnnotations: true
|
|
@@ -31,8 +32,48 @@ var handleSelectionChanged = function handleSelectionChanged(tr, pluginState) {
|
|
|
31
32
|
}
|
|
32
33
|
return pluginState;
|
|
33
34
|
};
|
|
35
|
+
var getSelectionChangedHandler = function getSelectionChangedHandler(reopenCommentView) {
|
|
36
|
+
return function (tr, pluginState) {
|
|
37
|
+
/**
|
|
38
|
+
* If feature flag is **OFF** we want to keep the old behavior. Note that
|
|
39
|
+
* reopenCommentView is not relevant here when using old behaviour.
|
|
40
|
+
*
|
|
41
|
+
* Feature flag is evaluated here rather than directly in onSelectionChanged where it is assigned
|
|
42
|
+
* to prevent the plugin from setting up the handler before the feature flag is evaluated.
|
|
43
|
+
*
|
|
44
|
+
* This comment / logic can be cleaned up once the feature flag is removed.
|
|
45
|
+
*/
|
|
46
|
+
if (!getBooleanFF('platform.editor.annotation.decouple-inline-comment-closed_flmox')) {
|
|
47
|
+
return handleSelectionChanged(tr, pluginState);
|
|
48
|
+
}
|
|
49
|
+
if (pluginState.skipSelectionHandling) {
|
|
50
|
+
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
51
|
+
skipSelectionHandling: false
|
|
52
|
+
}, reopenCommentView && {
|
|
53
|
+
isInlineCommentViewClosed: false
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
var selectedAnnotations = findAnnotationsInSelection(tr.selection, tr.doc);
|
|
57
|
+
if (selectedAnnotations.length === 0) {
|
|
58
|
+
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
59
|
+
selectedAnnotations: selectedAnnotations,
|
|
60
|
+
isInlineCommentViewClosed: true
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (isSelectedAnnotationsChanged(selectedAnnotations, pluginState.selectedAnnotations)) {
|
|
64
|
+
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
65
|
+
selectedAnnotations: selectedAnnotations
|
|
66
|
+
}, reopenCommentView && {
|
|
67
|
+
isInlineCommentViewClosed: false
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return _objectSpread(_objectSpread({}, pluginState), reopenCommentView && {
|
|
71
|
+
isInlineCommentViewClosed: false
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
};
|
|
34
75
|
var _pluginFactory = pluginFactory(inlineCommentPluginKey, reducer, {
|
|
35
|
-
onSelectionChanged:
|
|
76
|
+
onSelectionChanged: getSelectionChangedHandler(true),
|
|
36
77
|
onDocChanged: handleDocChanged,
|
|
37
78
|
mapping: function mapping(tr, pluginState) {
|
|
38
79
|
var draftDecorationSet = pluginState.draftDecorationSet,
|
|
@@ -2,9 +2,10 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
-
import { ACTIONS } from './types';
|
|
6
5
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import { addDraftDecoration } from '../utils';
|
|
8
|
+
import { ACTIONS } from './types';
|
|
8
9
|
export default (function (pluginState, action) {
|
|
9
10
|
switch (action.type) {
|
|
10
11
|
case ACTIONS.UPDATE_INLINE_COMMENT_STATE:
|
|
@@ -24,7 +25,9 @@ export default (function (pluginState, action) {
|
|
|
24
25
|
annotations: {}
|
|
25
26
|
});
|
|
26
27
|
case ACTIONS.CLOSE_COMPONENT:
|
|
27
|
-
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
28
|
+
return getBooleanFF('platform.editor.annotation.decouple-inline-comment-closed_flmox') ? _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
29
|
+
isInlineCommentViewClosed: true
|
|
30
|
+
}) : _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
28
31
|
selectedAnnotations: []
|
|
29
32
|
});
|
|
30
33
|
case ACTIONS.ADD_INLINE_COMMENT:
|
|
@@ -32,6 +35,8 @@ export default (function (pluginState, action) {
|
|
|
32
35
|
return _objectSpread(_objectSpread({}, updatedPluginState), {}, {
|
|
33
36
|
selectedAnnotations: [].concat(_toConsumableArray(updatedPluginState.selectedAnnotations), _toConsumableArray(action.data.selectedAnnotations)),
|
|
34
37
|
annotations: _objectSpread(_objectSpread({}, pluginState.annotations), action.data.inlineComments)
|
|
38
|
+
}, getBooleanFF('platform.editor.annotation.decouple-inline-comment-closed_flmox') && {
|
|
39
|
+
isInlineCommentViewClosed: false
|
|
35
40
|
});
|
|
36
41
|
case ACTIONS.INLINE_COMMENT_SET_VISIBLE:
|
|
37
42
|
var isVisible = action.data.isVisible;
|
|
@@ -45,6 +50,9 @@ export default (function (pluginState, action) {
|
|
|
45
50
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
46
51
|
selectedAnnotations: _toConsumableArray(action.data.selectedAnnotations),
|
|
47
52
|
skipSelectionHandling: true
|
|
53
|
+
}, getBooleanFF('platform.editor.annotation.decouple-inline-comment-closed_flmox') && {
|
|
54
|
+
// if selecting annotation explicitly, reopen the comment view
|
|
55
|
+
isInlineCommentViewClosed: false
|
|
48
56
|
});
|
|
49
57
|
default:
|
|
50
58
|
return pluginState;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
4
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { AnnotationViewWrapper } from './AnnotationViewWrapper';
|
|
5
6
|
import { AnnotationTestIds } from '../types';
|
|
6
7
|
import { getAnnotationViewKey, getSelectionPositions, getPluginState, getAllAnnotations } from '../utils';
|
|
@@ -39,7 +40,8 @@ export function InlineCommentView(_ref) {
|
|
|
39
40
|
var _ref2 = inlineCommentState || {},
|
|
40
41
|
bookmark = _ref2.bookmark,
|
|
41
42
|
selectedAnnotations = _ref2.selectedAnnotations,
|
|
42
|
-
annotations = _ref2.annotations
|
|
43
|
+
annotations = _ref2.annotations,
|
|
44
|
+
isInlineCommentViewClosed = _ref2.isInlineCommentViewClosed;
|
|
43
45
|
var annotationsList = getAllAnnotations(editorView.state.doc);
|
|
44
46
|
var selection = getSelectionPositions(state, inlineCommentState);
|
|
45
47
|
var position = findPosForDOM(selection);
|
|
@@ -117,7 +119,7 @@ export function InlineCommentView(_ref) {
|
|
|
117
119
|
};
|
|
118
120
|
dispatchAnalyticsEvent(payload);
|
|
119
121
|
};
|
|
120
|
-
if (!selectedAnnotations) {
|
|
122
|
+
if (getBooleanFF('platform.editor.annotation.decouple-inline-comment-closed_flmox') && isInlineCommentViewClosed || !selectedAnnotations) {
|
|
121
123
|
return null;
|
|
122
124
|
}
|
|
123
125
|
return /*#__PURE__*/React.createElement(AnnotationViewWrapper, {
|
|
@@ -328,4 +328,18 @@ function stripNonExistingAnnotationsFromNode(node, state) {
|
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
330
|
return node;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Compares two sets of annotationInfos to see if the annotations have changed
|
|
335
|
+
* This function assumes annotations will have unique id's for simplicity
|
|
336
|
+
*/
|
|
337
|
+
export function isSelectedAnnotationsChanged(oldSelectedAnnotations, newSelectedAnnotations) {
|
|
338
|
+
return newSelectedAnnotations.length !== oldSelectedAnnotations.length ||
|
|
339
|
+
// assuming annotations have unique id's for simplicity
|
|
340
|
+
newSelectedAnnotations.some(function (annotation) {
|
|
341
|
+
return !oldSelectedAnnotations.find(function (pluginStateAnnotation) {
|
|
342
|
+
return annotation.id === pluginStateAnnotation.id && annotation.type === pluginStateAnnotation.type;
|
|
343
|
+
});
|
|
344
|
+
});
|
|
331
345
|
}
|
|
@@ -44,8 +44,8 @@ var createPlugin = function createPlugin() {
|
|
|
44
44
|
}));
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
* If it's a bodiedExtension, we'll need to keep digging;
|
|
48
|
-
* can have more extension nodes within the contents of that
|
|
47
|
+
* If it's a multiBodiedExtension or bodiedExtension, we'll need to keep digging;
|
|
48
|
+
* since we can have more extension nodes within the contents of that
|
|
49
49
|
*/
|
|
50
50
|
if ([multiBodiedExtension, bodiedExtension].includes(node.type)) {
|
|
51
51
|
return true;
|
|
@@ -58,6 +58,16 @@ var isLayoutSupported = function isLayoutSupported(state, selectedExtNode) {
|
|
|
58
58
|
}
|
|
59
59
|
return !!((selectedExtNode.node.type === bodiedExtension || selectedExtNode.node.type === extension && !hasParentNodeOfType([bodiedExtension, table, expand].filter(Boolean))(selection)) && !hasParentNodeOfType([layoutSection])(selection));
|
|
60
60
|
};
|
|
61
|
+
|
|
62
|
+
// Edit is not supported for multiBodiedExtension
|
|
63
|
+
var isEditSupported = function isEditSupported(state, selectedExtNode) {
|
|
64
|
+
var _selectedExtNode$node;
|
|
65
|
+
var multiBodiedExtension = state.schema.nodes.multiBodiedExtension;
|
|
66
|
+
if (!selectedExtNode || (selectedExtNode === null || selectedExtNode === void 0 || (_selectedExtNode$node = selectedExtNode.node) === null || _selectedExtNode$node === void 0 ? void 0 : _selectedExtNode$node.type) === multiBodiedExtension) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
return true;
|
|
70
|
+
};
|
|
61
71
|
var breakoutOptions = function breakoutOptions(state, formatMessage, extensionState, breakoutEnabled) {
|
|
62
72
|
var nodeWithPos = getSelectedExtension(state, true);
|
|
63
73
|
|
|
@@ -89,10 +99,15 @@ var breakoutOptions = function breakoutOptions(state, formatMessage, extensionSt
|
|
|
89
99
|
}
|
|
90
100
|
return [];
|
|
91
101
|
};
|
|
92
|
-
var editButton = function editButton(formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI) {
|
|
102
|
+
var editButton = function editButton(state, formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI) {
|
|
103
|
+
var nodeWithPos = getSelectedExtension(state, true);
|
|
93
104
|
if (!extensionState.showEditButton) {
|
|
94
105
|
return [];
|
|
95
106
|
}
|
|
107
|
+
// For multiBodiedExtension case, edit is not supported
|
|
108
|
+
if (nodeWithPos && !isEditSupported(state, nodeWithPos)) {
|
|
109
|
+
return [];
|
|
110
|
+
}
|
|
96
111
|
return [{
|
|
97
112
|
id: 'editor.extension.edit',
|
|
98
113
|
type: 'button',
|
|
@@ -122,7 +137,7 @@ export var getToolbarConfig = function getToolbarConfig(_ref) {
|
|
|
122
137
|
var extensionState = getPluginState(state);
|
|
123
138
|
if (extensionState && !extensionState.showContextPanel && extensionState.element) {
|
|
124
139
|
var nodeType = [state.schema.nodes.extension, state.schema.nodes.inlineExtension, state.schema.nodes.bodiedExtension, state.schema.nodes.multiBodiedExtension];
|
|
125
|
-
var editButtonArray = editButton(formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI);
|
|
140
|
+
var editButtonArray = editButton(state, formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI);
|
|
126
141
|
var breakoutButtonArray = breakoutOptions(state, formatMessage, extensionState, breakoutEnabled);
|
|
127
142
|
var extensionObj = getSelectedExtension(state, true);
|
|
128
143
|
|
|
@@ -41,6 +41,7 @@ var Alignment = /*#__PURE__*/function (_PureComponent) {
|
|
|
41
41
|
className = _this$props.className,
|
|
42
42
|
intl = _this$props.intl;
|
|
43
43
|
return jsx("div", {
|
|
44
|
+
"data-testid": "alignment-buttons",
|
|
44
45
|
css: alignmentWrapper,
|
|
45
46
|
className: className
|
|
46
47
|
}, alignmentOptions.map(function (alignment) {
|
|
@@ -3,4 +3,4 @@ var _templateObject;
|
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { blockNodesVerticalMargin, akEditorSelectedBorderSize, akEditorDeleteBorder, akEditorDeleteBackground, SelectionStyle, getSelectionStyles, akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
|
|
5
5
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
6
|
-
export var extensionStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .multiBodiedExtensionView-content-wrap.", ":not(.danger) {\n ", "\n }\n\n .extensionView-content-wrap,\n .multiBodiedExtensionView-content-wrap,\n .bodiedExtensionView-content-wrap {\n margin: ", " 0;\n\n &:first-of-type {\n margin-top: 0;\n }\n\n &:last-of-type {\n margin-bottom: 0;\n }\n\n &:not(.danger).", " {\n & > span > .extension-container {\n ", "\n }\n }\n\n &.danger > span > .extension-container {\n box-shadow: 0 0 0 ", "px\n ", ";\n background-color: ", ";\n }\n\n &.inline {\n word-wrap: break-all;\n }\n }\n\n .extensionView-content-wrap .extension-container {\n overflow: hidden;\n }\n\n .bodiedExtensionView-content-wrap\n .extensionView-content-wrap\n .extension-container {\n width: 100%;\n max-width: 100%; // ensure width can't go over 100%;\n }\n\n [data-mark-type='fragment'] {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin: ", " 0;\n }\n\n & > [data-mark-type='dataConsumer'] {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin: ", " 0;\n }\n }\n\n &:first-child {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin-top: 0;\n }\n\n & > [data-mark-type='dataConsumer'] {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin-top: 0;\n }\n }\n }\n\n &:nth-last-of-type(-n + 2):not(:first-of-type) {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin-bottom: 0;\n }\n\n & > [data-mark-type='dataConsumer'] {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin-bottom: 0;\n }\n }\n }\n }\n"])), akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Blanket]), blockNodesVerticalMargin, akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow]), akEditorSelectedBorderSize, "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), "var(--ds-background-danger, ".concat(akEditorDeleteBackground, ")"), blockNodesVerticalMargin, blockNodesVerticalMargin);
|
|
6
|
+
export var extensionStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .multiBodiedExtensionView-content-wrap.", ":not(.danger) {\n ", "\n }\n\n .multiBodiedExtensionView-content-wrap {\n &.danger > span > .multiBodiedExtension--container {\n box-shadow: 0 0 0 ", "px\n ", ";\n background-color: ", ";\n }\n .multiBodiedExtension--container {\n width: 100%;\n max-width: 100%; // ensure width can't go over 100%;\n }\n }\n\n .extensionView-content-wrap,\n .multiBodiedExtensionView-content-wrap,\n .bodiedExtensionView-content-wrap {\n margin: ", " 0;\n\n &:first-of-type {\n margin-top: 0;\n }\n\n &:last-of-type {\n margin-bottom: 0;\n }\n\n &:not(.danger).", " {\n & > span > .extension-container {\n ", "\n }\n }\n\n &.danger > span > .extension-container {\n box-shadow: 0 0 0 ", "px\n ", ";\n background-color: ", ";\n }\n\n &.inline {\n word-wrap: break-all;\n }\n }\n\n .extensionView-content-wrap .extension-container {\n overflow: hidden;\n }\n\n .bodiedExtensionView-content-wrap\n .extensionView-content-wrap\n .extension-container {\n width: 100%;\n max-width: 100%; // ensure width can't go over 100%;\n }\n\n [data-mark-type='fragment'] {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin: ", " 0;\n }\n\n & > [data-mark-type='dataConsumer'] {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin: ", " 0;\n }\n }\n\n &:first-child {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin-top: 0;\n }\n\n & > [data-mark-type='dataConsumer'] {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin-top: 0;\n }\n }\n }\n\n &:nth-last-of-type(-n + 2):not(:first-of-type) {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin-bottom: 0;\n }\n\n & > [data-mark-type='dataConsumer'] {\n & > .extensionView-content-wrap,\n & > .bodiedExtensionView-content-wrap {\n margin-bottom: 0;\n }\n }\n }\n }\n"])), akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Blanket]), akEditorSelectedBorderSize, "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), "var(--ds-background-danger, ".concat(akEditorDeleteBackground, ")"), blockNodesVerticalMargin, akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow]), akEditorSelectedBorderSize, "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), "var(--ds-background-danger, ".concat(akEditorDeleteBackground, ")"), blockNodesVerticalMargin, blockNodesVerticalMargin);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export var name = "@atlaskit/editor-core";
|
|
2
|
-
export var version = "190.
|
|
2
|
+
export var version = "190.1.1";
|
package/dist/types/i18n/ja.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ declare const _default: {
|
|
|
25
25
|
'fabric.editor.configPanel.fieldTypeError.isMultipleAndRadio': string;
|
|
26
26
|
'fabric.editor.configPanel.formType.addField': string;
|
|
27
27
|
'fabric.editor.configPanel.formType.removeField': string;
|
|
28
|
+
'fabric.editor.configPanel.help': string;
|
|
28
29
|
'fabric.editor.configPanel.invalid': string;
|
|
29
30
|
'fabric.editor.configPanel.required': string;
|
|
30
31
|
'fabric.editor.configPanel.submit': string;
|
|
@@ -38,3 +38,8 @@ export declare const hasInvalidNodes: (state: EditorState) => boolean;
|
|
|
38
38
|
export declare function hasInvalidWhitespaceNode(selection: TextSelection | AllSelection, schema: Schema): boolean;
|
|
39
39
|
export declare function annotationExists(annotationId: string, state: EditorState): boolean;
|
|
40
40
|
export declare function stripNonExistingAnnotations(slice: Slice, state: EditorState): false | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Compares two sets of annotationInfos to see if the annotations have changed
|
|
43
|
+
* This function assumes annotations will have unique id's for simplicity
|
|
44
|
+
*/
|
|
45
|
+
export declare function isSelectedAnnotationsChanged(oldSelectedAnnotations: AnnotationInfo[], newSelectedAnnotations: AnnotationInfo[]): boolean;
|
|
@@ -25,6 +25,7 @@ declare const _default: {
|
|
|
25
25
|
'fabric.editor.configPanel.fieldTypeError.isMultipleAndRadio': string;
|
|
26
26
|
'fabric.editor.configPanel.formType.addField': string;
|
|
27
27
|
'fabric.editor.configPanel.formType.removeField': string;
|
|
28
|
+
'fabric.editor.configPanel.help': string;
|
|
28
29
|
'fabric.editor.configPanel.invalid': string;
|
|
29
30
|
'fabric.editor.configPanel.required': string;
|
|
30
31
|
'fabric.editor.configPanel.submit': string;
|
|
@@ -38,3 +38,8 @@ export declare const hasInvalidNodes: (state: EditorState) => boolean;
|
|
|
38
38
|
export declare function hasInvalidWhitespaceNode(selection: TextSelection | AllSelection, schema: Schema): boolean;
|
|
39
39
|
export declare function annotationExists(annotationId: string, state: EditorState): boolean;
|
|
40
40
|
export declare function stripNonExistingAnnotations(slice: Slice, state: EditorState): false | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Compares two sets of annotationInfos to see if the annotations have changed
|
|
43
|
+
* This function assumes annotations will have unique id's for simplicity
|
|
44
|
+
*/
|
|
45
|
+
export declare function isSelectedAnnotationsChanged(oldSelectedAnnotations: AnnotationInfo[], newSelectedAnnotations: AnnotationInfo[]): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "190.
|
|
3
|
+
"version": "190.1.1",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -362,6 +362,9 @@
|
|
|
362
362
|
"platform.editor.allow-list-in-blockquote": {
|
|
363
363
|
"type": "boolean",
|
|
364
364
|
"referenceOnly": "true"
|
|
365
|
+
},
|
|
366
|
+
"platform.editor.annotation.decouple-inline-comment-closed_flmox": {
|
|
367
|
+
"type": "boolean"
|
|
365
368
|
}
|
|
366
369
|
}
|
|
367
370
|
}
|