@atlaskit/editor-plugin-paste-options-toolbar 27.0.3 → 27.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/editor-commands/commands.js +24 -23
- package/dist/cjs/pasteOptionsToolbarPlugin.js +2 -2
- package/dist/cjs/pm-plugins/plugin-factory.js +2 -2
- package/dist/cjs/pm-plugins/util/format-handlers.js +4 -4
- package/dist/cjs/ui/on-paste-actions-menu/PasteActionsMenu.js +30 -28
- package/dist/cjs/ui/on-paste-actions-menu/PasteActionsMenuContent.js +6 -6
- package/dist/cjs/ui/on-paste-actions-menu/PasteMenuComponents.js +52 -48
- package/dist/cjs/ui/on-paste-actions-menu/PasteOptionsDropdownButton.js +4 -3
- package/dist/cjs/ui/toolbar.js +13 -13
- package/dist/es2019/editor-commands/commands.js +3 -2
- package/dist/es2019/pasteOptionsToolbarPlugin.js +1 -1
- package/dist/es2019/pm-plugins/plugin-factory.js +1 -1
- package/dist/es2019/pm-plugins/util/format-handlers.js +2 -2
- package/dist/es2019/ui/on-paste-actions-menu/PasteActionsMenu.js +9 -7
- package/dist/es2019/ui/on-paste-actions-menu/PasteActionsMenuContent.js +2 -2
- package/dist/es2019/ui/on-paste-actions-menu/PasteMenuComponents.js +8 -4
- package/dist/es2019/ui/on-paste-actions-menu/PasteOptionsDropdownButton.js +2 -1
- package/dist/es2019/ui/toolbar.js +2 -2
- package/dist/esm/editor-commands/commands.js +3 -2
- package/dist/esm/pasteOptionsToolbarPlugin.js +1 -1
- package/dist/esm/pm-plugins/plugin-factory.js +1 -1
- package/dist/esm/pm-plugins/util/format-handlers.js +2 -2
- package/dist/esm/ui/on-paste-actions-menu/PasteActionsMenu.js +9 -7
- package/dist/esm/ui/on-paste-actions-menu/PasteActionsMenuContent.js +2 -2
- package/dist/esm/ui/on-paste-actions-menu/PasteMenuComponents.js +8 -4
- package/dist/esm/ui/on-paste-actions-menu/PasteOptionsDropdownButton.js +2 -1
- package/dist/esm/ui/toolbar.js +2 -2
- package/dist/types/editor-commands/commands.d.ts +3 -3
- package/dist/types/pasteOptionsToolbarPluginType.d.ts +5 -5
- package/dist/types/pm-plugins/plugin-factory.d.ts +1 -1
- package/dist/types/ui/on-paste-actions-menu/PasteActionsMenu.d.ts +1 -1
- package/dist/types/ui/on-paste-actions-menu/PasteMenuComponents.d.ts +2 -2
- package/dist/types/ui/on-paste-actions-menu/hasVisibleButton.d.ts +1 -1
- package/dist/types/ui/toolbar.d.ts +4 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.showToolbar = exports.highlightContent = exports.hideToolbar = exports.dropdownClickHandler = exports.checkAndHideToolbar = exports.changeToRichTextWithAnalytics = exports.changeToRichText = exports.changeToPlainTextWithAnalytics = exports.changeToPlainText = exports.changeToMarkdownWithAnalytics = exports.changeToMarkDown = void 0;
|
|
7
|
-
var
|
|
8
|
-
var
|
|
7
|
+
var _enums = require("@atlaskit/editor-common/analytics/types/enums");
|
|
8
|
+
var _pasteEvents = require("@atlaskit/editor-common/analytics/types/paste-events");
|
|
9
|
+
var _withAnalytics = require("@atlaskit/editor-common/withAnalytics");
|
|
9
10
|
var _actions = require("../editor-actions/actions");
|
|
10
11
|
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
11
12
|
var _formatHandlers = require("../pm-plugins/util/format-handlers");
|
|
@@ -51,14 +52,14 @@ var changeToPlainText = exports.changeToPlainText = function changeToPlainText()
|
|
|
51
52
|
};
|
|
52
53
|
var changeToPlainTextWithAnalytics = exports.changeToPlainTextWithAnalytics = function changeToPlainTextWithAnalytics(editorAnalyticsAPI, sliceSize, invokedFrom) {
|
|
53
54
|
return function () {
|
|
54
|
-
return (0,
|
|
55
|
-
action:
|
|
56
|
-
actionSubject:
|
|
57
|
-
eventType:
|
|
55
|
+
return (0, _withAnalytics.withAnalytics)(editorAnalyticsAPI, {
|
|
56
|
+
action: _enums.ACTION.PASTED,
|
|
57
|
+
actionSubject: _enums.ACTION_SUBJECT.DOCUMENT,
|
|
58
|
+
eventType: _enums.EVENT_TYPE.TRACK,
|
|
58
59
|
attributes: {
|
|
59
|
-
inputMethod:
|
|
60
|
-
type:
|
|
61
|
-
content:
|
|
60
|
+
inputMethod: _enums.INPUT_METHOD.TOOLBAR,
|
|
61
|
+
type: _pasteEvents.PasteTypes.plain,
|
|
62
|
+
content: _pasteEvents.PasteContents.text,
|
|
62
63
|
pasteSize: sliceSize,
|
|
63
64
|
invokedFrom: invokedFrom
|
|
64
65
|
}
|
|
@@ -92,19 +93,19 @@ var changeToRichTextWithAnalytics = exports.changeToRichTextWithAnalytics = func
|
|
|
92
93
|
var _pastePluginState$ric;
|
|
93
94
|
var pastePluginState = _types.pasteOptionsPluginKey.getState(state);
|
|
94
95
|
return {
|
|
95
|
-
action:
|
|
96
|
-
actionSubject:
|
|
97
|
-
eventType:
|
|
96
|
+
action: _enums.ACTION.PASTED,
|
|
97
|
+
actionSubject: _enums.ACTION_SUBJECT.DOCUMENT,
|
|
98
|
+
eventType: _enums.EVENT_TYPE.TRACK,
|
|
98
99
|
attributes: {
|
|
99
|
-
inputMethod:
|
|
100
|
-
type:
|
|
101
|
-
content:
|
|
100
|
+
inputMethod: _enums.INPUT_METHOD.TOOLBAR,
|
|
101
|
+
type: _pasteEvents.PasteTypes.richText,
|
|
102
|
+
content: _pasteEvents.PasteContents.text,
|
|
102
103
|
pasteSize: ((_pastePluginState$ric = pastePluginState.richTextSlice) === null || _pastePluginState$ric === void 0 ? void 0 : _pastePluginState$ric.size) || 0,
|
|
103
104
|
invokedFrom: invokedFrom
|
|
104
105
|
}
|
|
105
106
|
};
|
|
106
107
|
};
|
|
107
|
-
return (0,
|
|
108
|
+
return (0, _withAnalytics.withAnalytics)(editorAnalyticsAPI, payloadCallback)(changeToRichText());
|
|
108
109
|
};
|
|
109
110
|
};
|
|
110
111
|
var changeToMarkDown = exports.changeToMarkDown = function changeToMarkDown(markdownToPmConverter) {
|
|
@@ -127,14 +128,14 @@ var changeToMarkDown = exports.changeToMarkDown = function changeToMarkDown(mark
|
|
|
127
128
|
};
|
|
128
129
|
var changeToMarkdownWithAnalytics = exports.changeToMarkdownWithAnalytics = function changeToMarkdownWithAnalytics(editorAnalyticsAPI, sliceSize, invokedFrom, markdownToPmConverter) {
|
|
129
130
|
return function () {
|
|
130
|
-
return (0,
|
|
131
|
-
action:
|
|
132
|
-
actionSubject:
|
|
133
|
-
eventType:
|
|
131
|
+
return (0, _withAnalytics.withAnalytics)(editorAnalyticsAPI, {
|
|
132
|
+
action: _enums.ACTION.PASTED,
|
|
133
|
+
actionSubject: _enums.ACTION_SUBJECT.DOCUMENT,
|
|
134
|
+
eventType: _enums.EVENT_TYPE.TRACK,
|
|
134
135
|
attributes: {
|
|
135
|
-
inputMethod:
|
|
136
|
-
type:
|
|
137
|
-
content:
|
|
136
|
+
inputMethod: _enums.INPUT_METHOD.TOOLBAR,
|
|
137
|
+
type: _pasteEvents.PasteTypes.markdown,
|
|
138
|
+
content: _pasteEvents.PasteContents.text,
|
|
138
139
|
pasteSize: sliceSize,
|
|
139
140
|
invokedFrom: invokedFrom
|
|
140
141
|
}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.pasteOptionsToolbarPlugin = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var
|
|
9
|
+
var _useSharedPluginStateWithSelector = require("@atlaskit/editor-common/useSharedPluginStateWithSelector");
|
|
10
10
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
11
11
|
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
12
12
|
var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
|
|
@@ -195,7 +195,7 @@ var pasteOptionsToolbarPlugin = exports.pasteOptionsToolbarPlugin = function pas
|
|
|
195
195
|
},
|
|
196
196
|
usePluginHook: function usePluginHook(_ref4) {
|
|
197
197
|
var editorView = _ref4.editorView;
|
|
198
|
-
var _useSharedPluginState = (0,
|
|
198
|
+
var _useSharedPluginState = (0, _useSharedPluginStateWithSelector.useSharedPluginStateWithSelector)(api, ['paste'], function (states) {
|
|
199
199
|
var _states$pasteState;
|
|
200
200
|
return {
|
|
201
201
|
lastContentPasted: (_states$pasteState = states.pasteState) === null || _states$pasteState === void 0 ? void 0 : _states$pasteState.lastContentPasted
|
|
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.getPluginState = exports.createPluginState = exports.createCommand = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var
|
|
9
|
+
var _pluginStateFactory = require("@atlaskit/editor-common/utils/plugin-state-factory");
|
|
10
10
|
var _actions = require("../editor-actions/actions");
|
|
11
11
|
var _types = require("../types/types");
|
|
12
12
|
var _constants = require("./constants");
|
|
13
13
|
var _reducer = require("./reducer");
|
|
14
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; }
|
|
15
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; }
|
|
16
|
-
var dest = (0,
|
|
16
|
+
var dest = (0, _pluginStateFactory.pluginFactory)(_types.pasteOptionsPluginKey, _reducer.reducer, {
|
|
17
17
|
mapping: function mapping(tr, pluginState) {
|
|
18
18
|
if (!tr.docChanged || !pluginState.showToolbar) {
|
|
19
19
|
return pluginState;
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.formatRichText = exports.formatPlainText = exports.formatMarkdown = void 0;
|
|
7
7
|
exports.getMarkdownSlice = getMarkdownSlice;
|
|
8
8
|
var _codeBlock = require("@atlaskit/editor-common/code-block");
|
|
9
|
-
var
|
|
10
|
-
var
|
|
9
|
+
var _error = require("@atlaskit/editor-common/monitoring/error");
|
|
10
|
+
var _md = require("@atlaskit/editor-common/paste/md");
|
|
11
11
|
var _editorMarkdownTransformer = require("@atlaskit/editor-markdown-transformer");
|
|
12
12
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
13
13
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
@@ -172,7 +172,7 @@ function getMarkdownSlice(text, schema, selection, markdownToPmConverter) {
|
|
|
172
172
|
var doc = markdownToPmConverter && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_paste_as_md_use_gfm') ? schema.nodes.doc.createAndFill({}, markdownToPmConverter({
|
|
173
173
|
markdown: textInput,
|
|
174
174
|
schema: schema
|
|
175
|
-
})) : new _editorMarkdownTransformer.MarkdownTransformer(schema,
|
|
175
|
+
})) : new _editorMarkdownTransformer.MarkdownTransformer(schema, _md.md).parse((0, _index.escapeLinks)(textInput));
|
|
176
176
|
if (!doc || !doc.content) {
|
|
177
177
|
return;
|
|
178
178
|
}
|
|
@@ -184,7 +184,7 @@ function getMarkdownSlice(text, schema, selection, markdownToPmConverter) {
|
|
|
184
184
|
var openEnd = canMergeOpenEnd ? $end.depth : 0;
|
|
185
185
|
return (0, _codeBlock.normalizeMarkdownCodeBlockAttrsInSlice)(new _model.Slice(doc.content, openStart, openEnd), schema);
|
|
186
186
|
} catch (error) {
|
|
187
|
-
(0,
|
|
187
|
+
(0, _error.logException)(error, {
|
|
188
188
|
location: 'editor-plugin-paste-options-toolbar/util'
|
|
189
189
|
});
|
|
190
190
|
return;
|
|
@@ -15,26 +15,28 @@ exports.resolveTableAfterPos = resolveTableAfterPos;
|
|
|
15
15
|
exports.shouldSuppressPasteActionsForSingleLink = exports.shouldSuppressPasteActionsForAgentMention = void 0;
|
|
16
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
17
|
var _react = _interopRequireWildcard(require("react"));
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
var
|
|
18
|
+
var _enums = require("@atlaskit/editor-common/analytics/types/enums");
|
|
19
|
+
var _Popup = _interopRequireDefault(require("@atlaskit/editor-common/Popup"));
|
|
20
|
+
var _utils = require("@atlaskit/editor-common/Popup/utils");
|
|
21
|
+
var _context = require("@atlaskit/editor-common/toolbar/context");
|
|
22
|
+
var _keys = require("@atlaskit/editor-common/toolbar/keys");
|
|
23
|
+
var _withReactEditorViewOuterListeners = _interopRequireDefault(require("@atlaskit/editor-common/ui-react/with-react-editor-view-outer-listeners"));
|
|
24
|
+
var _useSharedPluginStateWithSelector = require("@atlaskit/editor-common/useSharedPluginStateWithSelector");
|
|
25
|
+
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
26
|
+
var _constants = require("@atlaskit/editor-shared-styles/constants");
|
|
27
|
+
var _toolbarDropdownMenuContext = require("@atlaskit/editor-toolbar/toolbar-dropdown-menu-context");
|
|
26
28
|
var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
|
|
27
29
|
var _commands = require("../../editor-commands/commands");
|
|
28
|
-
var
|
|
30
|
+
var _constants2 = require("../../pm-plugins/constants");
|
|
29
31
|
var _types = require("../../types/types");
|
|
30
|
-
var
|
|
32
|
+
var _toolbar = require("../toolbar");
|
|
31
33
|
var _isNotSingleLink = require("../utils/paste-menu-rules/isNotSingleLink");
|
|
32
34
|
var _hasVisibleButton = require("./hasVisibleButton");
|
|
33
35
|
var _PasteActionsMenuContent = require("./PasteActionsMenuContent");
|
|
34
36
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
35
37
|
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; }
|
|
36
38
|
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; }
|
|
37
|
-
var PopupWithListeners = (0,
|
|
39
|
+
var PopupWithListeners = (0, _withReactEditorViewOuterListeners.default)(_Popup.default);
|
|
38
40
|
var isAgentMentionUserType = function isAgentMentionUserType(userType) {
|
|
39
41
|
return userType === 'APP' || userType === 'AGENT';
|
|
40
42
|
};
|
|
@@ -66,7 +68,7 @@ var shouldSuppressPasteActionsForSingleLink = exports.shouldSuppressPasteActions
|
|
|
66
68
|
*/
|
|
67
69
|
function getTargetElement(editorView, pos) {
|
|
68
70
|
try {
|
|
69
|
-
var domRef = (0,
|
|
71
|
+
var domRef = (0, _utils2.findDomRefAtPos)(pos, editorView.domAtPos.bind(editorView));
|
|
70
72
|
if (domRef instanceof HTMLElement) {
|
|
71
73
|
// Empty blocks render a <br> placeholder whose bounding rect has no
|
|
72
74
|
// meaningful dimensions (height ≈ 0). Using it as the Popup anchor
|
|
@@ -224,7 +226,7 @@ function onPositionCalculated(editorView, pasteStartPos, pasteEndPos, targetElem
|
|
|
224
226
|
if (scrollableElement) {
|
|
225
227
|
var scrollContainerTop = scrollableElement.getBoundingClientRect().top;
|
|
226
228
|
if (startCoords.top < scrollContainerTop && endBottom > scrollContainerTop) {
|
|
227
|
-
adjustedTop += scrollContainerTop - startCoords.top +
|
|
229
|
+
adjustedTop += scrollContainerTop - startCoords.top + _constants2.PASTE_MENU_GAP_TOP;
|
|
228
230
|
}
|
|
229
231
|
}
|
|
230
232
|
|
|
@@ -260,7 +262,7 @@ var PasteActionsMenu = exports.PasteActionsMenu = function PasteActionsMenu(_ref
|
|
|
260
262
|
boundariesElement = _ref.boundariesElement,
|
|
261
263
|
scrollableElement = _ref.scrollableElement;
|
|
262
264
|
var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
263
|
-
var _useSharedPluginState = (0,
|
|
265
|
+
var _useSharedPluginState = (0, _useSharedPluginStateWithSelector.useSharedPluginStateWithSelector)(api, ['paste'], function (states) {
|
|
264
266
|
var _states$pasteState;
|
|
265
267
|
return {
|
|
266
268
|
lastContentPasted: (_states$pasteState = states.pasteState) === null || _states$pasteState === void 0 ? void 0 : _states$pasteState.lastContentPasted
|
|
@@ -268,13 +270,13 @@ var PasteActionsMenu = exports.PasteActionsMenu = function PasteActionsMenu(_ref
|
|
|
268
270
|
}),
|
|
269
271
|
lastContentPasted = _useSharedPluginState.lastContentPasted;
|
|
270
272
|
var sliceForAgentMentionSuppression = lastContentPasted === null || lastContentPasted === void 0 ? void 0 : lastContentPasted.sourcePastedSlice;
|
|
271
|
-
var pasteMenuComponents = (_api$uiControlRegistr = api === null || api === void 0 || (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(
|
|
273
|
+
var pasteMenuComponents = (_api$uiControlRegistr = api === null || api === void 0 || (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(_keys.PASTE_MENU.key)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : [];
|
|
272
274
|
|
|
273
275
|
// eslint-disable-next-line @atlassian/perf-linting/no-expensive-computations-in-render -- pasteMenuComponents changes by reference each render; filter is small (< 10 items)
|
|
274
276
|
var aiMenuItems = pasteMenuComponents.filter(function (c) {
|
|
275
277
|
var _c$parents;
|
|
276
278
|
return c.type === 'menu-item' && ((_c$parents = c.parents) === null || _c$parents === void 0 ? void 0 : _c$parents.some(function (p) {
|
|
277
|
-
return p.key ===
|
|
279
|
+
return p.key === _keys.AI_PASTE_MENU_SECTION.key;
|
|
278
280
|
}));
|
|
279
281
|
});
|
|
280
282
|
var visibleAiActionKeys = (0, _hasVisibleButton.getVisibleKeys)(aiMenuItems, ['menu-item']);
|
|
@@ -313,10 +315,10 @@ var PasteActionsMenu = exports.PasteActionsMenu = function PasteActionsMenu(_ref
|
|
|
313
315
|
pasteAncestorNodeNames.push($pos.node(depth).type.name);
|
|
314
316
|
}
|
|
315
317
|
}
|
|
316
|
-
var legacyVisible = (0,
|
|
318
|
+
var legacyVisible = (0, _toolbar.isToolbarVisible)(editorView.state, lastContentPasted);
|
|
317
319
|
(0, _commands.showToolbar)(lastContentPasted, selectedOption, legacyVisible, pasteAncestorNodeNames)(editorView.state, editorView.dispatch);
|
|
318
320
|
}, [lastContentPasted, shouldSuppressPasteActions, editorView]);
|
|
319
|
-
var _useSharedPluginState2 = (0,
|
|
321
|
+
var _useSharedPluginState2 = (0, _useSharedPluginStateWithSelector.useSharedPluginStateWithSelector)(api, ['pasteOptionsToolbarPlugin'], function (states) {
|
|
320
322
|
var _pluginState$showTool, _pluginState$pasteSta, _pluginState$pasteEnd;
|
|
321
323
|
var pluginState = states.pasteOptionsToolbarPluginState;
|
|
322
324
|
return {
|
|
@@ -358,12 +360,12 @@ var PasteActionsMenu = exports.PasteActionsMenu = function PasteActionsMenu(_ref
|
|
|
358
360
|
// so the Popup attaches its built-in scroll listener, which calls
|
|
359
361
|
// scheduledUpdatePosition (RAF-throttled) on each scroll event — triggering
|
|
360
362
|
// onPositionCalculated with fresh viewport coordinates.
|
|
361
|
-
var overflowScrollParent = shouldRenderToolbar ? (0,
|
|
363
|
+
var overflowScrollParent = shouldRenderToolbar ? (0, _utils.findOverflowScrollParent)(editorView.dom) : false;
|
|
362
364
|
var effectiveScrollableElement = overflowScrollParent || scrollableElement;
|
|
363
365
|
var anyComponentVisible = (0, _hasVisibleButton.hasVisibleButton)(pasteMenuComponents);
|
|
364
366
|
|
|
365
367
|
// Whether the card plugin's "Display as" section is visible when the menu opens.
|
|
366
|
-
var displayAsVisible = (0, _hasVisibleButton.getVisibleKeys)(pasteMenuComponents, ['menu-section']).includes(
|
|
368
|
+
var displayAsVisible = (0, _hasVisibleButton.getVisibleKeys)(pasteMenuComponents, ['menu-section']).includes(_keys.SMART_LINK_DISPLAY_AS_PASTE_MENU_SECTION.key);
|
|
367
369
|
// Two positioning modes:
|
|
368
370
|
// 1. Inline: no AI actions visible — menu appears to the right of the cursor,
|
|
369
371
|
// vertically centered with the text line.
|
|
@@ -372,9 +374,9 @@ var PasteActionsMenu = exports.PasteActionsMenu = function PasteActionsMenu(_ref
|
|
|
372
374
|
(0, _react.useEffect)(function () {
|
|
373
375
|
if (!prevShowToolbarRef.current && shouldRenderToolbar) {
|
|
374
376
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.fireAnalyticsEvent({
|
|
375
|
-
action:
|
|
376
|
-
actionSubject:
|
|
377
|
-
eventType:
|
|
377
|
+
action: _enums.ACTION.OPENED,
|
|
378
|
+
actionSubject: _enums.ACTION_SUBJECT.PASTE_ACTIONS_MENU,
|
|
379
|
+
eventType: _enums.EVENT_TYPE.UI,
|
|
378
380
|
attributes: {
|
|
379
381
|
visibleAiActions: visibleAiActionKeys,
|
|
380
382
|
displayAsVisible: displayAsVisible
|
|
@@ -415,18 +417,18 @@ var PasteActionsMenu = exports.PasteActionsMenu = function PasteActionsMenu(_ref
|
|
|
415
417
|
mountTo: mountTo,
|
|
416
418
|
boundariesElement: boundariesElement,
|
|
417
419
|
scrollableElement: effectiveScrollableElement,
|
|
418
|
-
minPopupMargin:
|
|
419
|
-
zIndex:
|
|
420
|
+
minPopupMargin: _constants2.PASTE_MENU_GAP_HORIZONTAL,
|
|
421
|
+
zIndex: _constants.akEditorFloatingPanelZIndex,
|
|
420
422
|
alignX: "end",
|
|
421
423
|
alignY: useInlinePosition ? 'top' : 'bottom'
|
|
422
424
|
/* eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed) */,
|
|
423
|
-
offset: [
|
|
425
|
+
offset: [_constants2.PASTE_MENU_GAP_HORIZONTAL, 0],
|
|
424
426
|
onPositionCalculated: positionCalculator,
|
|
425
427
|
handleClickOutside: handleClickOutside,
|
|
426
428
|
handleEscapeKeydown: handleDismiss
|
|
427
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
429
|
+
}, /*#__PURE__*/_react.default.createElement(_context.EditorToolbarProvider, {
|
|
428
430
|
editorView: editorView
|
|
429
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
431
|
+
}, /*#__PURE__*/_react.default.createElement(_toolbarDropdownMenuContext.ToolbarDropdownMenuProvider, {
|
|
430
432
|
isOpen: isToolbarShown,
|
|
431
433
|
setIsOpen: handleSetIsOpen
|
|
432
434
|
}, /*#__PURE__*/_react.default.createElement(_PasteActionsMenuContent.PasteActionsMenuContent, {
|
|
@@ -12,10 +12,10 @@ var _runtime = require("@compiled/react/runtime");
|
|
|
12
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
13
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
14
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
-
var
|
|
15
|
+
var _keys = require("@atlaskit/editor-common/toolbar/keys");
|
|
16
16
|
var _uiReact = require("@atlaskit/editor-common/ui-react");
|
|
17
17
|
var _toolbarMenuContainer = require("@atlaskit/editor-toolbar/toolbar-menu-container");
|
|
18
|
-
var
|
|
18
|
+
var _surfaceRenderer = require("@atlaskit/editor-ui-control-model/surface-renderer");
|
|
19
19
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
20
20
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
21
21
|
var _currentPastedSmartLink = require("../utils/current-pasted-smart-link");
|
|
@@ -30,8 +30,8 @@ var styles = {
|
|
|
30
30
|
container: "_2rko12b0 _bfhk1bhr _16qs130s"
|
|
31
31
|
};
|
|
32
32
|
var pasteMenuSurface = {
|
|
33
|
-
type:
|
|
34
|
-
key:
|
|
33
|
+
type: _keys.PASTE_MENU.type,
|
|
34
|
+
key: _keys.PASTE_MENU.key
|
|
35
35
|
};
|
|
36
36
|
var PasteActionsMenuContent = exports.PasteActionsMenuContent = function PasteActionsMenuContent(_ref) {
|
|
37
37
|
var onMouseDown = _ref.onMouseDown,
|
|
@@ -124,7 +124,7 @@ var PasteActionsMenuContent = exports.PasteActionsMenuContent = function PasteAc
|
|
|
124
124
|
ref: mergedRef,
|
|
125
125
|
onMouseDown: onMouseDown,
|
|
126
126
|
onMouseEnter: onMouseEnter
|
|
127
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
127
|
+
}, /*#__PURE__*/_react.default.createElement(_surfaceRenderer.SurfaceRenderer, {
|
|
128
128
|
surface: pasteMenuSurface,
|
|
129
129
|
components: visibleComponents
|
|
130
130
|
}));
|
|
@@ -134,7 +134,7 @@ var PasteActionsMenuContent = exports.PasteActionsMenuContent = function PasteAc
|
|
|
134
134
|
xcss: styles.container,
|
|
135
135
|
onMouseDown: onMouseDown,
|
|
136
136
|
onMouseEnter: onMouseEnter
|
|
137
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
137
|
+
}, /*#__PURE__*/_react.default.createElement(_surfaceRenderer.SurfaceRenderer, {
|
|
138
138
|
surface: pasteMenuSurface,
|
|
139
139
|
components: visibleComponents
|
|
140
140
|
}));
|
|
@@ -12,10 +12,14 @@ var _runtime = require("@compiled/react/runtime");
|
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _react2 = require("@compiled/react");
|
|
14
14
|
var _reactIntl = require("react-intl");
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
15
|
+
var _pasteOptionsToolbar = require("@atlaskit/editor-common/messages/paste-options-toolbar");
|
|
16
|
+
var _context = require("@atlaskit/editor-common/toolbar/context");
|
|
17
|
+
var _keys = require("@atlaskit/editor-common/toolbar/keys");
|
|
18
|
+
var _rank = require("@atlaskit/editor-common/toolbar/rank");
|
|
19
|
+
var _useSharedPluginStateWithSelector = require("@atlaskit/editor-common/useSharedPluginStateWithSelector");
|
|
20
|
+
var _toolbarDropdownItem = require("@atlaskit/editor-toolbar/toolbar-dropdown-item");
|
|
21
|
+
var _toolbarDropdownItemSection = require("@atlaskit/editor-toolbar/toolbar-dropdown-item-section");
|
|
22
|
+
var _toolbarNestedDropdownMenu = require("@atlaskit/editor-toolbar/toolbar-nested-dropdown-menu");
|
|
19
23
|
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/core/chevron-down"));
|
|
20
24
|
var _chevronRight = _interopRequireDefault(require("@atlaskit/icon/core/chevron-right"));
|
|
21
25
|
var _clipboard = _interopRequireDefault(require("@atlaskit/icon/core/clipboard"));
|
|
@@ -46,10 +50,10 @@ var PasteMenuItem = function PasteMenuItem(_ref) {
|
|
|
46
50
|
pasteType = _ref.pasteType,
|
|
47
51
|
markdownToPmConverter = _ref.markdownToPmConverter;
|
|
48
52
|
var intl = (0, _reactIntl.useIntl)();
|
|
49
|
-
var _useEditorToolbar = (0,
|
|
53
|
+
var _useEditorToolbar = (0, _context.useEditorToolbar)(),
|
|
50
54
|
editorView = _useEditorToolbar.editorView;
|
|
51
55
|
var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
52
|
-
var _useSharedPluginState = (0,
|
|
56
|
+
var _useSharedPluginState = (0, _useSharedPluginStateWithSelector.useSharedPluginStateWithSelector)(api, ['pasteOptionsToolbarPlugin'], function (states) {
|
|
53
57
|
var _pluginState$selected, _pluginState$plaintex, _pluginState$isPlainT;
|
|
54
58
|
var pluginState = states.pasteOptionsToolbarPluginState;
|
|
55
59
|
return {
|
|
@@ -64,11 +68,11 @@ var PasteMenuItem = function PasteMenuItem(_ref) {
|
|
|
64
68
|
var getDefaultLabel = (0, _react.useCallback)(function (type) {
|
|
65
69
|
switch (type) {
|
|
66
70
|
case 'rich-text':
|
|
67
|
-
return intl.formatMessage(
|
|
71
|
+
return intl.formatMessage(_pasteOptionsToolbar.pasteOptionsToolbarMessages.richTextAction);
|
|
68
72
|
case 'markdown':
|
|
69
|
-
return intl.formatMessage(
|
|
73
|
+
return intl.formatMessage(_pasteOptionsToolbar.pasteOptionsToolbarMessages.markdownAction);
|
|
70
74
|
case 'plain-text':
|
|
71
|
-
return intl.formatMessage(
|
|
75
|
+
return intl.formatMessage(_pasteOptionsToolbar.pasteOptionsToolbarMessages.plainTextAction);
|
|
72
76
|
default:
|
|
73
77
|
return type;
|
|
74
78
|
}
|
|
@@ -95,7 +99,7 @@ var PasteMenuItem = function PasteMenuItem(_ref) {
|
|
|
95
99
|
}
|
|
96
100
|
var displayLabel = getDefaultLabel(pasteType);
|
|
97
101
|
var isSelected = isPasteOptionSelected(pasteType, selectedOption);
|
|
98
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
102
|
+
return /*#__PURE__*/_react.default.createElement(_toolbarDropdownItem.ToolbarDropdownItem, {
|
|
99
103
|
onClick: handleClick,
|
|
100
104
|
isSelected: isSelected,
|
|
101
105
|
testId: "paste-".concat(pasteType, "-menu-item"),
|
|
@@ -106,7 +110,7 @@ var PasteOptionsNestedMenu = function PasteOptionsNestedMenu(_ref2) {
|
|
|
106
110
|
var children = _ref2.children,
|
|
107
111
|
hasVisibleAiActions = _ref2.hasVisibleAiActions;
|
|
108
112
|
var intl = (0, _reactIntl.useIntl)();
|
|
109
|
-
var label = intl.formatMessage(
|
|
113
|
+
var label = intl.formatMessage(_pasteOptionsToolbar.pasteOptionsToolbarMessages.pasteMenuActionsPasteAs);
|
|
110
114
|
if (!hasVisibleAiActions) {
|
|
111
115
|
return /*#__PURE__*/_react.default.createElement(_PasteOptionsDropdownButton.PasteOptionsDropdownButton, {
|
|
112
116
|
elemBefore: /*#__PURE__*/_react.default.createElement(_clipboard.default, {
|
|
@@ -122,7 +126,7 @@ var PasteOptionsNestedMenu = function PasteOptionsNestedMenu(_ref2) {
|
|
|
122
126
|
tooltipContent: label
|
|
123
127
|
}, children);
|
|
124
128
|
}
|
|
125
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
129
|
+
return /*#__PURE__*/_react.default.createElement(_toolbarNestedDropdownMenu.ToolbarNestedDropdownMenu, {
|
|
126
130
|
elemBefore: /*#__PURE__*/_react.default.createElement(_clipboard.default, {
|
|
127
131
|
size: "small",
|
|
128
132
|
label: label
|
|
@@ -137,11 +141,11 @@ var PasteOptionsNestedMenu = function PasteOptionsNestedMenu(_ref2) {
|
|
|
137
141
|
};
|
|
138
142
|
var getHasVisibleAiActions = function getHasVisibleAiActions(api) {
|
|
139
143
|
var _api$uiControlRegistr, _api$uiControlRegistr2;
|
|
140
|
-
var allComponents = (_api$uiControlRegistr = api === null || api === void 0 || (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(
|
|
144
|
+
var allComponents = (_api$uiControlRegistr = api === null || api === void 0 || (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(_keys.PASTE_MENU.key)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : [];
|
|
141
145
|
var aiMenuItems = allComponents.filter(function (c) {
|
|
142
146
|
var _c$parents;
|
|
143
147
|
return c.type === 'menu-item' && ((_c$parents = c.parents) === null || _c$parents === void 0 ? void 0 : _c$parents.some(function (p) {
|
|
144
|
-
return p.key ===
|
|
148
|
+
return p.key === _keys.AI_PASTE_MENU_SECTION.key;
|
|
145
149
|
}));
|
|
146
150
|
});
|
|
147
151
|
return (0, _hasVisibleButton.getVisibleKeys)(aiMenuItems, ['menu-item']).length > 0;
|
|
@@ -150,15 +154,15 @@ var getPasteMenuComponents = exports.getPasteMenuComponents = function getPasteM
|
|
|
150
154
|
var api = _ref3.api,
|
|
151
155
|
markdownToPmConverter = _ref3.markdownToPmConverter;
|
|
152
156
|
return [{
|
|
153
|
-
type:
|
|
154
|
-
key:
|
|
157
|
+
type: _keys.PASTE_MENU.type,
|
|
158
|
+
key: _keys.PASTE_MENU.key
|
|
155
159
|
}, {
|
|
156
|
-
type:
|
|
157
|
-
key:
|
|
160
|
+
type: _keys.PASTE_MENU_SECTION.type,
|
|
161
|
+
key: _keys.PASTE_MENU_SECTION.key,
|
|
158
162
|
parents: [{
|
|
159
|
-
type:
|
|
160
|
-
key:
|
|
161
|
-
rank:
|
|
163
|
+
type: _keys.PASTE_MENU.type,
|
|
164
|
+
key: _keys.PASTE_MENU.key,
|
|
165
|
+
rank: _rank.PASTE_MENU_RANK[_keys.PASTE_MENU_SECTION.key]
|
|
162
166
|
}],
|
|
163
167
|
isHidden: function isHidden() {
|
|
164
168
|
var _api$pasteOptionsTool, _pluginState$showLega;
|
|
@@ -172,17 +176,17 @@ var getPasteMenuComponents = exports.getPasteMenuComponents = function getPasteM
|
|
|
172
176
|
padding: "space.100"
|
|
173
177
|
}, props.children);
|
|
174
178
|
}
|
|
175
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
179
|
+
return /*#__PURE__*/_react.default.createElement(_toolbarDropdownItemSection.ToolbarDropdownItemSection, {
|
|
176
180
|
hasSeparator: true
|
|
177
181
|
}, props.children);
|
|
178
182
|
}
|
|
179
183
|
}, {
|
|
180
|
-
type:
|
|
181
|
-
key:
|
|
184
|
+
type: _keys.PASTE_NESTED_MENU.type,
|
|
185
|
+
key: _keys.PASTE_NESTED_MENU.key,
|
|
182
186
|
parents: [{
|
|
183
|
-
type:
|
|
184
|
-
key:
|
|
185
|
-
rank:
|
|
187
|
+
type: _keys.PASTE_MENU_SECTION.type,
|
|
188
|
+
key: _keys.PASTE_MENU_SECTION.key,
|
|
189
|
+
rank: _rank.PASTE_MENU_SECTION_RANK[_keys.PASTE_NESTED_MENU.key]
|
|
186
190
|
}],
|
|
187
191
|
component: function component(props) {
|
|
188
192
|
var hasVisibleAiActions = getHasVisibleAiActions(api);
|
|
@@ -191,21 +195,21 @@ var getPasteMenuComponents = exports.getPasteMenuComponents = function getPasteM
|
|
|
191
195
|
}, props.children);
|
|
192
196
|
}
|
|
193
197
|
}, {
|
|
194
|
-
type:
|
|
195
|
-
key:
|
|
198
|
+
type: _keys.PASTE_MENU_NESTED_SECTION.type,
|
|
199
|
+
key: _keys.PASTE_MENU_NESTED_SECTION.key,
|
|
196
200
|
parents: [{
|
|
197
|
-
type:
|
|
198
|
-
key:
|
|
199
|
-
rank:
|
|
201
|
+
type: _keys.PASTE_NESTED_MENU.type,
|
|
202
|
+
key: _keys.PASTE_NESTED_MENU.key,
|
|
203
|
+
rank: _rank.PASTE_NESTED_MENU_RANK[_keys.PASTE_MENU_NESTED_SECTION.key]
|
|
200
204
|
}],
|
|
201
205
|
component: function component(props) {
|
|
202
206
|
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
203
207
|
xcss: (0, _react2.cx)(nestedMenuStyles.narrowSection)
|
|
204
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
208
|
+
}, /*#__PURE__*/_react.default.createElement(_toolbarDropdownItemSection.ToolbarDropdownItemSection, null, props.children));
|
|
205
209
|
}
|
|
206
210
|
}, {
|
|
207
|
-
key:
|
|
208
|
-
type:
|
|
211
|
+
key: _keys.PASTE_RICH_TEXT_MENU_ITEM.key,
|
|
212
|
+
type: _keys.PASTE_RICH_TEXT_MENU_ITEM.type,
|
|
209
213
|
component: function component() {
|
|
210
214
|
return /*#__PURE__*/_react.default.createElement(PasteMenuItem, {
|
|
211
215
|
api: api,
|
|
@@ -213,13 +217,13 @@ var getPasteMenuComponents = exports.getPasteMenuComponents = function getPasteM
|
|
|
213
217
|
});
|
|
214
218
|
},
|
|
215
219
|
parents: [{
|
|
216
|
-
key:
|
|
217
|
-
type:
|
|
218
|
-
rank:
|
|
220
|
+
key: _keys.PASTE_MENU_NESTED_SECTION.key,
|
|
221
|
+
type: _keys.PASTE_MENU_NESTED_SECTION.type,
|
|
222
|
+
rank: _rank.PASTE_MENU_NESTED_SECTION_RANK[_keys.PASTE_RICH_TEXT_MENU_ITEM.key]
|
|
219
223
|
}]
|
|
220
224
|
}, {
|
|
221
|
-
key:
|
|
222
|
-
type:
|
|
225
|
+
key: _keys.PASTE_MARKDOWN_MENU_ITEM.key,
|
|
226
|
+
type: _keys.PASTE_MARKDOWN_MENU_ITEM.type,
|
|
223
227
|
component: function component() {
|
|
224
228
|
return /*#__PURE__*/_react.default.createElement(PasteMenuItem, {
|
|
225
229
|
api: api,
|
|
@@ -228,13 +232,13 @@ var getPasteMenuComponents = exports.getPasteMenuComponents = function getPasteM
|
|
|
228
232
|
});
|
|
229
233
|
},
|
|
230
234
|
parents: [{
|
|
231
|
-
key:
|
|
232
|
-
type:
|
|
233
|
-
rank:
|
|
235
|
+
key: _keys.PASTE_MENU_NESTED_SECTION.key,
|
|
236
|
+
type: _keys.PASTE_MENU_NESTED_SECTION.type,
|
|
237
|
+
rank: _rank.PASTE_MENU_NESTED_SECTION_RANK[_keys.PASTE_MARKDOWN_MENU_ITEM.key]
|
|
234
238
|
}]
|
|
235
239
|
}, {
|
|
236
|
-
key:
|
|
237
|
-
type:
|
|
240
|
+
key: _keys.PASTE_PLAIN_TEXT_MENU_ITEM.key,
|
|
241
|
+
type: _keys.PASTE_PLAIN_TEXT_MENU_ITEM.type,
|
|
238
242
|
component: function component() {
|
|
239
243
|
return /*#__PURE__*/_react.default.createElement(PasteMenuItem, {
|
|
240
244
|
api: api,
|
|
@@ -242,9 +246,9 @@ var getPasteMenuComponents = exports.getPasteMenuComponents = function getPasteM
|
|
|
242
246
|
});
|
|
243
247
|
},
|
|
244
248
|
parents: [{
|
|
245
|
-
key:
|
|
246
|
-
type:
|
|
247
|
-
rank:
|
|
249
|
+
key: _keys.PASTE_MENU_NESTED_SECTION.key,
|
|
250
|
+
type: _keys.PASTE_MENU_NESTED_SECTION.type,
|
|
251
|
+
rank: _rank.PASTE_MENU_NESTED_SECTION_RANK[_keys.PASTE_PLAIN_TEXT_MENU_ITEM.key]
|
|
248
252
|
}]
|
|
249
253
|
}];
|
|
250
254
|
};
|
|
@@ -10,7 +10,8 @@ exports.PasteOptionsDropdownButton = void 0;
|
|
|
10
10
|
var _runtime = require("@compiled/react/runtime");
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _dropdownMenu = _interopRequireDefault(require("@atlaskit/dropdown-menu/dropdown-menu"));
|
|
13
|
-
var
|
|
13
|
+
var _toolbarButton = require("@atlaskit/editor-toolbar/toolbar-button");
|
|
14
|
+
var _toolbarTooltip = require("@atlaskit/editor-toolbar/toolbar-tooltip");
|
|
14
15
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
15
16
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
16
17
|
/**
|
|
@@ -27,7 +28,7 @@ var PasteOptionsDropdownButton = exports.PasteOptionsDropdownButton = function P
|
|
|
27
28
|
testId = _ref.testId,
|
|
28
29
|
tooltipContent = _ref.tooltipContent;
|
|
29
30
|
var trigger = (0, _react.useCallback)(function (triggerProps) {
|
|
30
|
-
var button = /*#__PURE__*/_react.default.createElement(
|
|
31
|
+
var button = /*#__PURE__*/_react.default.createElement(_toolbarButton.ToolbarButton, {
|
|
31
32
|
ref: triggerProps.triggerRef,
|
|
32
33
|
isSelected: triggerProps.isSelected,
|
|
33
34
|
"aria-expanded": triggerProps['aria-expanded'],
|
|
@@ -38,7 +39,7 @@ var PasteOptionsDropdownButton = exports.PasteOptionsDropdownButton = function P
|
|
|
38
39
|
label: label
|
|
39
40
|
}, elemAfter);
|
|
40
41
|
if (tooltipContent) {
|
|
41
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement(_toolbarTooltip.ToolbarTooltip, {
|
|
42
43
|
content: tooltipContent,
|
|
43
44
|
position: "top"
|
|
44
45
|
}, button);
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -5,12 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.isToolbarVisible = exports.getToolbarMenuConfig = exports.buildToolbar = void 0;
|
|
8
|
-
var
|
|
9
|
-
var
|
|
8
|
+
var _pasteOptionsToolbar = require("@atlaskit/editor-common/messages/paste-options-toolbar");
|
|
9
|
+
var _constants = require("@atlaskit/editor-shared-styles/constants");
|
|
10
10
|
var _clipboard = _interopRequireDefault(require("@atlaskit/icon/core/clipboard"));
|
|
11
11
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
12
12
|
var _commands = require("../editor-commands/commands");
|
|
13
|
-
var
|
|
13
|
+
var _constants2 = require("../pm-plugins/constants");
|
|
14
14
|
var _util = require("../pm-plugins/util");
|
|
15
15
|
var _types = require("../types/types");
|
|
16
16
|
var TOP_LEVEL_LIST_NODE_NAMES = ['bulletList', 'orderedList', 'taskList'];
|
|
@@ -53,27 +53,27 @@ var isToolbarVisible = exports.isToolbarVisible = function isToolbarVisible(stat
|
|
|
53
53
|
var getToolbarMenuConfig = exports.getToolbarMenuConfig = function getToolbarMenuConfig(pluginState, intl, editorAnalyticsAPI, markdownToPmConverter) {
|
|
54
54
|
var options = [{
|
|
55
55
|
id: 'editor.paste.richText',
|
|
56
|
-
title: intl.formatMessage(
|
|
56
|
+
title: intl.formatMessage(_pasteOptionsToolbar.pasteOptionsToolbarMessages.richText),
|
|
57
57
|
selected: pluginState.selectedOption === _types.ToolbarDropdownOption.RichText,
|
|
58
58
|
hidden: pluginState.isPlainText,
|
|
59
59
|
onClick: (0, _commands.changeToRichTextWithAnalytics)(editorAnalyticsAPI)()
|
|
60
60
|
}, {
|
|
61
61
|
id: 'editor.paste.markdown',
|
|
62
|
-
title: intl.formatMessage(
|
|
62
|
+
title: intl.formatMessage(_pasteOptionsToolbar.pasteOptionsToolbarMessages.markdown),
|
|
63
63
|
selected: pluginState.selectedOption === _types.ToolbarDropdownOption.Markdown,
|
|
64
64
|
onClick: (0, _commands.changeToMarkdownWithAnalytics)(editorAnalyticsAPI, pluginState.plaintext.length, undefined, markdownToPmConverter)()
|
|
65
65
|
}, {
|
|
66
66
|
id: 'editor.paste.plainText',
|
|
67
|
-
title: intl.formatMessage(
|
|
67
|
+
title: intl.formatMessage(_pasteOptionsToolbar.pasteOptionsToolbarMessages.plainText),
|
|
68
68
|
selected: pluginState.selectedOption === _types.ToolbarDropdownOption.PlainText,
|
|
69
69
|
onClick: (0, _commands.changeToPlainTextWithAnalytics)(editorAnalyticsAPI, pluginState.plaintext.length)()
|
|
70
70
|
}];
|
|
71
71
|
return {
|
|
72
|
-
id:
|
|
72
|
+
id: _constants2.PASTE_TOOLBAR_ITEM_CLASS,
|
|
73
73
|
icon: _clipboard.default,
|
|
74
74
|
type: 'dropdown',
|
|
75
|
-
testId:
|
|
76
|
-
title: intl.formatMessage(
|
|
75
|
+
testId: _constants2.PASTE_OPTIONS_TEST_ID,
|
|
76
|
+
title: intl.formatMessage(_pasteOptionsToolbar.pasteOptionsToolbarMessages.pasteOptions),
|
|
77
77
|
options: options,
|
|
78
78
|
onToggle: onToggleHandler
|
|
79
79
|
};
|
|
@@ -87,10 +87,10 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(state, intl, edi
|
|
|
87
87
|
var pluginState = _types.pasteOptionsPluginKey.getState(state);
|
|
88
88
|
var menu = getToolbarMenuConfig(pluginState, intl, editorAnalyticsAPI, markdownToPmConverter);
|
|
89
89
|
return {
|
|
90
|
-
title: intl.formatMessage(
|
|
90
|
+
title: intl.formatMessage(_pasteOptionsToolbar.pasteOptionsToolbarMessages.pasteOptions),
|
|
91
91
|
nodeType: validNodes,
|
|
92
|
-
zIndex:
|
|
93
|
-
className:
|
|
92
|
+
zIndex: _constants.akEditorFloatingPanelZIndex,
|
|
93
|
+
className: _constants2.PASTE_TOOLBAR_CLASS,
|
|
94
94
|
items: [menu],
|
|
95
95
|
align: 'right',
|
|
96
96
|
onPositionCalculated: onPositionCalculated
|
|
@@ -102,7 +102,7 @@ var onPositionCalculated = function onPositionCalculated(editorView, _nextPos) {
|
|
|
102
102
|
|
|
103
103
|
// Ignored via go/ees005
|
|
104
104
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
105
|
-
var toolbar = document.querySelector("div[aria-label=\"".concat(
|
|
105
|
+
var toolbar = document.querySelector("div[aria-label=\"".concat(_pasteOptionsToolbar.pasteOptionsToolbarMessages.pasteOptions.defaultMessage, "\"]"));
|
|
106
106
|
var offsetParent = (toolbar === null || toolbar === void 0 ? void 0 : toolbar.offsetParent) || editorView.dom;
|
|
107
107
|
var offsetParentRect = offsetParent === null || offsetParent === void 0 ? void 0 : offsetParent.getBoundingClientRect();
|
|
108
108
|
var offsetTop = (offsetParentRect === null || offsetParentRect === void 0 ? void 0 : offsetParentRect.top) || 0;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD
|
|
2
|
-
import {
|
|
1
|
+
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics/types/enums';
|
|
2
|
+
import { PasteContents, PasteTypes } from '@atlaskit/editor-common/analytics/types/paste-events';
|
|
3
|
+
import { withAnalytics } from '@atlaskit/editor-common/withAnalytics';
|
|
3
4
|
import { PastePluginActionTypes as ActionTypes } from '../editor-actions/actions';
|
|
4
5
|
import { createCommand } from '../pm-plugins/plugin-factory';
|
|
5
6
|
import { formatMarkdown, formatPlainText, formatRichText } from '../pm-plugins/util/format-handlers';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
|
-
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/
|
|
2
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
4
4
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
5
5
|
import { expValNoExposure } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { pluginFactory } from '@atlaskit/editor-common/utils';
|
|
1
|
+
import { pluginFactory } from '@atlaskit/editor-common/utils/plugin-state-factory';
|
|
2
2
|
import { PastePluginActionTypes } from '../editor-actions/actions';
|
|
3
3
|
import { pasteOptionsPluginKey } from '../types/types';
|
|
4
4
|
import { PASTE_OPTIONS_META_ID } from './constants';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { normalizeMarkdownCodeBlockAttrsInSlice } from '@atlaskit/editor-common/code-block';
|
|
2
|
-
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
3
|
-
import { md } from '@atlaskit/editor-common/paste';
|
|
2
|
+
import { logException } from '@atlaskit/editor-common/monitoring/error';
|
|
3
|
+
import { md } from '@atlaskit/editor-common/paste/md';
|
|
4
4
|
import { MarkdownTransformer } from '@atlaskit/editor-markdown-transformer';
|
|
5
5
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
2
|
-
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics/types/enums';
|
|
3
|
+
import Popup from '@atlaskit/editor-common/Popup';
|
|
4
|
+
import { findOverflowScrollParent } from '@atlaskit/editor-common/Popup/utils';
|
|
5
|
+
import { EditorToolbarProvider } from '@atlaskit/editor-common/toolbar/context';
|
|
6
|
+
import { AI_PASTE_MENU_SECTION, PASTE_MENU, SMART_LINK_DISPLAY_AS_PASTE_MENU_SECTION } from '@atlaskit/editor-common/toolbar/keys';
|
|
7
|
+
import withReactEditorViewOuterListeners from '@atlaskit/editor-common/ui-react/with-react-editor-view-outer-listeners';
|
|
8
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
|
|
7
9
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
8
|
-
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
9
|
-
import { ToolbarDropdownMenuProvider } from '@atlaskit/editor-toolbar';
|
|
10
|
+
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles/constants';
|
|
11
|
+
import { ToolbarDropdownMenuProvider } from '@atlaskit/editor-toolbar/toolbar-dropdown-menu-context';
|
|
10
12
|
import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
11
13
|
import { hideToolbar, highlightContent, showToolbar } from '../../editor-commands/commands';
|
|
12
14
|
import { PASTE_MENU_GAP_HORIZONTAL, PASTE_MENU_GAP_TOP } from '../../pm-plugins/constants';
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import "./PasteActionsMenuContent.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React, { useCallback, useContext, useEffect, useRef, useState } from 'react';
|
|
5
|
-
import { PASTE_MENU } from '@atlaskit/editor-common/toolbar';
|
|
5
|
+
import { PASTE_MENU } from '@atlaskit/editor-common/toolbar/keys';
|
|
6
6
|
import { OutsideClickTargetRefContext } from '@atlaskit/editor-common/ui-react';
|
|
7
7
|
import { ToolbarMenuContainer } from '@atlaskit/editor-toolbar/toolbar-menu-container';
|
|
8
|
-
import { SurfaceRenderer } from '@atlaskit/editor-ui-control-model';
|
|
8
|
+
import { SurfaceRenderer } from '@atlaskit/editor-ui-control-model/surface-renderer';
|
|
9
9
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
10
10
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
11
11
|
import { getSingleSmartLinkUrlFromSlice } from '../utils/current-pasted-smart-link';
|
|
@@ -4,10 +4,14 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
4
4
|
import React, { useCallback } from 'react';
|
|
5
5
|
import { cx } from '@compiled/react';
|
|
6
6
|
import { useIntl } from 'react-intl';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import { pasteOptionsToolbarMessages as messages } from '@atlaskit/editor-common/messages/paste-options-toolbar';
|
|
8
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar/context';
|
|
9
|
+
import { PASTE_MENU, PASTE_MENU_SECTION, PASTE_NESTED_MENU, PASTE_MENU_NESTED_SECTION, PASTE_RICH_TEXT_MENU_ITEM, PASTE_MARKDOWN_MENU_ITEM, PASTE_PLAIN_TEXT_MENU_ITEM, AI_PASTE_MENU_SECTION } from '@atlaskit/editor-common/toolbar/keys';
|
|
10
|
+
import { PASTE_MENU_RANK, PASTE_MENU_SECTION_RANK, PASTE_NESTED_MENU_RANK, PASTE_MENU_NESTED_SECTION_RANK } from '@atlaskit/editor-common/toolbar/rank';
|
|
11
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
|
|
12
|
+
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar/toolbar-dropdown-item';
|
|
13
|
+
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar/toolbar-dropdown-item-section';
|
|
14
|
+
import { ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar/toolbar-nested-dropdown-menu';
|
|
11
15
|
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
12
16
|
import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
|
|
13
17
|
import ClipboardIcon from '@atlaskit/icon/core/clipboard';
|
|
@@ -5,7 +5,8 @@ import React, { useCallback } from 'react';
|
|
|
5
5
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
6
|
|
|
7
7
|
import DropdownMenu from '@atlaskit/dropdown-menu/dropdown-menu';
|
|
8
|
-
import { ToolbarButton
|
|
8
|
+
import { ToolbarButton } from '@atlaskit/editor-toolbar/toolbar-button';
|
|
9
|
+
import { ToolbarTooltip } from '@atlaskit/editor-toolbar/toolbar-tooltip';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* A compact dropdown button for paste options, styled like floating toolbar buttons.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { pasteOptionsToolbarMessages as messages } from '@atlaskit/editor-common/messages';
|
|
2
|
-
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
1
|
+
import { pasteOptionsToolbarMessages as messages } from '@atlaskit/editor-common/messages/paste-options-toolbar';
|
|
2
|
+
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles/constants';
|
|
3
3
|
import ClipboardIcon from '@atlaskit/icon/core/clipboard';
|
|
4
4
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
5
5
|
import { changeToMarkdownWithAnalytics, changeToPlainTextWithAnalytics, changeToRichTextWithAnalytics, dropdownClickHandler } from '../editor-commands/commands';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD
|
|
2
|
-
import {
|
|
1
|
+
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics/types/enums';
|
|
2
|
+
import { PasteContents, PasteTypes } from '@atlaskit/editor-common/analytics/types/paste-events';
|
|
3
|
+
import { withAnalytics } from '@atlaskit/editor-common/withAnalytics';
|
|
3
4
|
import { PastePluginActionTypes as ActionTypes } from '../editor-actions/actions';
|
|
4
5
|
import { createCommand } from '../pm-plugins/plugin-factory';
|
|
5
6
|
import { formatMarkdown, formatPlainText, formatRichText } from '../pm-plugins/util/format-handlers';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
|
-
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/
|
|
2
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
4
4
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
5
5
|
import { expValNoExposure } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
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
|
-
import { pluginFactory } from '@atlaskit/editor-common/utils';
|
|
4
|
+
import { pluginFactory } from '@atlaskit/editor-common/utils/plugin-state-factory';
|
|
5
5
|
import { PastePluginActionTypes } from '../editor-actions/actions';
|
|
6
6
|
import { pasteOptionsPluginKey } from '../types/types';
|
|
7
7
|
import { PASTE_OPTIONS_META_ID } from './constants';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { normalizeMarkdownCodeBlockAttrsInSlice } from '@atlaskit/editor-common/code-block';
|
|
2
|
-
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
3
|
-
import { md } from '@atlaskit/editor-common/paste';
|
|
2
|
+
import { logException } from '@atlaskit/editor-common/monitoring/error';
|
|
3
|
+
import { md } from '@atlaskit/editor-common/paste/md';
|
|
4
4
|
import { MarkdownTransformer } from '@atlaskit/editor-markdown-transformer';
|
|
5
5
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -2,14 +2,16 @@ 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 React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
5
|
-
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
5
|
+
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics/types/enums';
|
|
6
|
+
import Popup from '@atlaskit/editor-common/Popup';
|
|
7
|
+
import { findOverflowScrollParent } from '@atlaskit/editor-common/Popup/utils';
|
|
8
|
+
import { EditorToolbarProvider } from '@atlaskit/editor-common/toolbar/context';
|
|
9
|
+
import { AI_PASTE_MENU_SECTION, PASTE_MENU, SMART_LINK_DISPLAY_AS_PASTE_MENU_SECTION } from '@atlaskit/editor-common/toolbar/keys';
|
|
10
|
+
import withReactEditorViewOuterListeners from '@atlaskit/editor-common/ui-react/with-react-editor-view-outer-listeners';
|
|
11
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
|
|
10
12
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
11
|
-
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
12
|
-
import { ToolbarDropdownMenuProvider } from '@atlaskit/editor-toolbar';
|
|
13
|
+
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles/constants';
|
|
14
|
+
import { ToolbarDropdownMenuProvider } from '@atlaskit/editor-toolbar/toolbar-dropdown-menu-context';
|
|
13
15
|
import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
14
16
|
import { hideToolbar, highlightContent, showToolbar } from '../../editor-commands/commands';
|
|
15
17
|
import { PASTE_MENU_GAP_HORIZONTAL, PASTE_MENU_GAP_TOP } from '../../pm-plugins/constants';
|
|
@@ -9,10 +9,10 @@ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol
|
|
|
9
9
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
10
10
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
11
11
|
import React, { useCallback, useContext, useEffect, useRef, useState } from 'react';
|
|
12
|
-
import { PASTE_MENU } from '@atlaskit/editor-common/toolbar';
|
|
12
|
+
import { PASTE_MENU } from '@atlaskit/editor-common/toolbar/keys';
|
|
13
13
|
import { OutsideClickTargetRefContext } from '@atlaskit/editor-common/ui-react';
|
|
14
14
|
import { ToolbarMenuContainer } from '@atlaskit/editor-toolbar/toolbar-menu-container';
|
|
15
|
-
import { SurfaceRenderer } from '@atlaskit/editor-ui-control-model';
|
|
15
|
+
import { SurfaceRenderer } from '@atlaskit/editor-ui-control-model/surface-renderer';
|
|
16
16
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
17
17
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
18
18
|
import { getSingleSmartLinkUrlFromSlice } from '../utils/current-pasted-smart-link';
|
|
@@ -4,10 +4,14 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
4
4
|
import React, { useCallback } from 'react';
|
|
5
5
|
import { cx } from '@compiled/react';
|
|
6
6
|
import { useIntl } from 'react-intl';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import { pasteOptionsToolbarMessages as messages } from '@atlaskit/editor-common/messages/paste-options-toolbar';
|
|
8
|
+
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar/context';
|
|
9
|
+
import { PASTE_MENU, PASTE_MENU_SECTION, PASTE_NESTED_MENU, PASTE_MENU_NESTED_SECTION, PASTE_RICH_TEXT_MENU_ITEM, PASTE_MARKDOWN_MENU_ITEM, PASTE_PLAIN_TEXT_MENU_ITEM, AI_PASTE_MENU_SECTION } from '@atlaskit/editor-common/toolbar/keys';
|
|
10
|
+
import { PASTE_MENU_RANK, PASTE_MENU_SECTION_RANK, PASTE_NESTED_MENU_RANK, PASTE_MENU_NESTED_SECTION_RANK } from '@atlaskit/editor-common/toolbar/rank';
|
|
11
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
|
|
12
|
+
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar/toolbar-dropdown-item';
|
|
13
|
+
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar/toolbar-dropdown-item-section';
|
|
14
|
+
import { ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar/toolbar-nested-dropdown-menu';
|
|
11
15
|
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
12
16
|
import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
|
|
13
17
|
import ClipboardIcon from '@atlaskit/icon/core/clipboard';
|
|
@@ -5,7 +5,8 @@ import React, { useCallback } from 'react';
|
|
|
5
5
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
6
|
|
|
7
7
|
import DropdownMenu from '@atlaskit/dropdown-menu/dropdown-menu';
|
|
8
|
-
import { ToolbarButton
|
|
8
|
+
import { ToolbarButton } from '@atlaskit/editor-toolbar/toolbar-button';
|
|
9
|
+
import { ToolbarTooltip } from '@atlaskit/editor-toolbar/toolbar-tooltip';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* A compact dropdown button for paste options, styled like floating toolbar buttons.
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { pasteOptionsToolbarMessages as messages } from '@atlaskit/editor-common/messages';
|
|
2
|
-
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
1
|
+
import { pasteOptionsToolbarMessages as messages } from '@atlaskit/editor-common/messages/paste-options-toolbar';
|
|
2
|
+
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles/constants';
|
|
3
3
|
import ClipboardIcon from '@atlaskit/icon/core/clipboard';
|
|
4
4
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
5
5
|
import { changeToMarkdownWithAnalytics, changeToPlainTextWithAnalytics, changeToRichTextWithAnalytics, dropdownClickHandler } from '../editor-commands/commands';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { Command } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { LastContentPasted } from '@atlaskit/editor-plugin-paste';
|
|
1
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics/api';
|
|
2
|
+
import type { Command } from '@atlaskit/editor-common/types/command';
|
|
3
|
+
import type { LastContentPasted } from '@atlaskit/editor-plugin-paste/paste-plugin-type';
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import type { MarkdownToPmConverter } from '../pasteOptionsToolbarPluginType';
|
|
6
6
|
import { ToolbarDropdownOption } from '../types/types';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
-
import type { PastePlugin } from '@atlaskit/editor-plugin-paste';
|
|
4
|
-
import type { UiControlRegistryPlugin } from '@atlaskit/editor-plugin-ui-control-registry';
|
|
1
|
+
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types/next-editor-plugin';
|
|
2
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics/analyticsPluginType';
|
|
3
|
+
import type { PastePlugin } from '@atlaskit/editor-plugin-paste/paste-plugin-type';
|
|
4
|
+
import type { UiControlRegistryPlugin } from '@atlaskit/editor-plugin-ui-control-registry/ui-control-registry-plugin-type';
|
|
5
5
|
import type { Fragment, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
6
|
-
import type { RegisterComponent } from '@atlaskit/editor-ui-control-model';
|
|
6
|
+
import type { RegisterComponent } from '@atlaskit/editor-ui-control-model/types';
|
|
7
7
|
import type { ToolbarDropdownOption } from './types/types';
|
|
8
8
|
import type { PasteMenuRuleFactories } from './ui/utils/paste-menu-rules/types';
|
|
9
9
|
export type PasteOptionsToolbarPluginDependencies = [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
2
|
-
import type { Command } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { Command } from '@atlaskit/editor-common/types/command';
|
|
3
3
|
import type { EditorState, SafeStateField, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { type PastePluginAction } from '../editor-actions/actions';
|
|
5
5
|
import type { PasteOptionsPluginState } from '../types/types';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types/next-editor-plugin';
|
|
3
3
|
import type { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import type { PasteOptionsToolbarPlugin } from '../../pasteOptionsToolbarPluginType';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { RegisterComponent } from '@atlaskit/editor-ui-control-model';
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types/next-editor-plugin';
|
|
2
|
+
import type { RegisterComponent } from '@atlaskit/editor-ui-control-model/types';
|
|
3
3
|
import type { MarkdownToPmConverter, PasteOptionsToolbarPlugin } from '../../pasteOptionsToolbarPluginType';
|
|
4
4
|
import { ToolbarDropdownOption, type PasteType } from '../../types/types';
|
|
5
5
|
export declare const isPasteOptionSelected: (pasteType: PasteType, selectedOption: ToolbarDropdownOption) => boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RegisterComponent } from '@atlaskit/editor-ui-control-model';
|
|
1
|
+
import type { RegisterComponent } from '@atlaskit/editor-ui-control-model/types';
|
|
2
2
|
/**
|
|
3
3
|
* Returns the keys of visible button/menu-item components in the list.
|
|
4
4
|
* A component is visible when neither it nor any of its ancestors are hidden.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl';
|
|
2
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import type { Command
|
|
4
|
-
import type {
|
|
2
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics/api';
|
|
3
|
+
import type { Command } from '@atlaskit/editor-common/types/command';
|
|
4
|
+
import type { FloatingToolbarConfig, FloatingToolbarDropdown } from '@atlaskit/editor-common/types/floating-toolbar';
|
|
5
|
+
import type { LastContentPasted } from '@atlaskit/editor-plugin-paste/paste-plugin-type';
|
|
5
6
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
6
7
|
import type { MarkdownToPmConverter } from '../pasteOptionsToolbarPluginType';
|
|
7
8
|
import type { PasteOptionsPluginState } from '../types/types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-paste-options-toolbar",
|
|
3
|
-
"version": "27.0.
|
|
3
|
+
"version": "27.0.5",
|
|
4
4
|
"description": "Paste options toolbar for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
36
36
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
37
37
|
"@atlaskit/primitives": "^22.5.0",
|
|
38
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
38
|
+
"@atlaskit/tmp-editor-statsig": "^232.0.0",
|
|
39
39
|
"@atlaskit/tokens": "^20.4.0",
|
|
40
40
|
"@babel/runtime": "^7.0.0",
|
|
41
41
|
"@compiled/react": "^1.0.2",
|