@atlaskit/editor-core 167.0.3 → 169.1.0
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 +38 -0
- package/dist/cjs/create-editor/create-plugins-list.js +7 -0
- package/dist/cjs/plugins/analytics/types/toolbar-button.js +2 -0
- package/dist/cjs/plugins/annotation/pm-plugins/inline-comment.js +2 -2
- package/dist/cjs/plugins/breakout/index.js +7 -0
- package/dist/cjs/plugins/breakout/ui/LayoutButton.js +3 -1
- package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +6 -1
- package/dist/cjs/plugins/card/styles.js +4 -2
- package/dist/cjs/plugins/card/toolbar.js +6 -1
- package/dist/cjs/plugins/code-block/styles.js +17 -41
- package/dist/cjs/plugins/code-block/ui/class-names.js +5 -2
- package/dist/cjs/plugins/collab-edit/index.js +2 -2
- package/dist/cjs/plugins/collab-edit/provider/channel.js +2 -2
- package/dist/cjs/plugins/copy-button/commands.js +85 -0
- package/dist/cjs/plugins/copy-button/index.js +27 -0
- package/dist/cjs/plugins/copy-button/pm-plugins/main.js +38 -0
- package/dist/cjs/plugins/copy-button/pm-plugins/plugin-key.js +11 -0
- package/dist/cjs/plugins/copy-button/utils.js +51 -0
- package/dist/cjs/plugins/extension/context-panel.js +2 -2
- package/dist/cjs/plugins/extension/pm-plugins/main.js +2 -2
- package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
- package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +2 -2
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -2
- package/dist/cjs/plugins/indentation/messages.js +23 -0
- package/dist/cjs/plugins/index.js +16 -0
- package/dist/cjs/plugins/list/index.js +0 -43
- package/dist/cjs/plugins/macro/actions.js +2 -2
- package/dist/cjs/plugins/media/nodeviews/mediaInline.js +2 -2
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +2 -2
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +2 -2
- package/dist/cjs/plugins/panel/toolbar.js +10 -2
- package/dist/cjs/plugins/table/commands/hover.js +2 -2
- package/dist/cjs/plugins/table/toolbar.js +5 -1
- package/dist/cjs/plugins/table/utils/decoration.js +5 -1
- package/dist/cjs/plugins/toolbar-lists-indentation/index.js +65 -0
- package/dist/cjs/plugins/toolbar-lists-indentation/types.js +5 -0
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/Toolbar.js +122 -0
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +173 -0
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/index.js +58 -0
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +48 -0
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +4 -5
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadListItem.js +17 -51
- package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +2 -2
- package/dist/cjs/ui/ConfigPanel/Fields/CustomSelect.js +2 -2
- package/dist/cjs/ui/ConfigPanel/Fields/UserSelect.js +2 -2
- package/dist/cjs/ui/ConfigPanel/transformers.js +2 -2
- package/dist/cjs/ui/ElementBrowser/InsertMenu.js +12 -39
- package/dist/cjs/ui/ElementBrowser/components/ElementList/ElementList.js +31 -87
- package/dist/cjs/utils/clipboard.js +67 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/create-plugins-list.js +8 -1
- package/dist/es2019/plugins/analytics/types/toolbar-button.js +2 -0
- package/dist/es2019/plugins/breakout/index.js +7 -0
- package/dist/es2019/plugins/breakout/ui/LayoutButton.js +3 -1
- package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +6 -1
- package/dist/es2019/plugins/card/styles.js +5 -0
- package/dist/es2019/plugins/card/toolbar.js +5 -1
- package/dist/es2019/plugins/code-block/styles.js +18 -95
- package/dist/es2019/plugins/code-block/ui/class-names.js +3 -2
- package/dist/es2019/plugins/copy-button/commands.js +64 -0
- package/dist/es2019/plugins/copy-button/index.js +15 -0
- package/dist/es2019/plugins/copy-button/pm-plugins/main.js +28 -0
- package/dist/es2019/plugins/copy-button/pm-plugins/plugin-key.js +2 -0
- package/dist/es2019/plugins/copy-button/utils.js +29 -0
- package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
- package/dist/es2019/plugins/indentation/messages.js +14 -0
- package/dist/es2019/plugins/index.js +3 -1
- package/dist/es2019/plugins/list/index.js +1 -44
- package/dist/es2019/plugins/panel/toolbar.js +9 -2
- package/dist/es2019/plugins/table/commands/hover.js +2 -2
- package/dist/es2019/plugins/table/toolbar.js +5 -2
- package/dist/es2019/plugins/table/utils/decoration.js +5 -1
- package/dist/es2019/plugins/toolbar-lists-indentation/index.js +53 -0
- package/dist/es2019/plugins/toolbar-lists-indentation/types.js +1 -0
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/Toolbar.js +94 -0
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +149 -0
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/index.js +49 -0
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +35 -0
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +11 -10
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +17 -48
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +10 -30
- package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +34 -93
- package/dist/es2019/utils/clipboard.js +26 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +1 -1
- package/dist/esm/create-editor/ErrorBoundary.js +1 -1
- package/dist/esm/create-editor/create-plugins-list.js +8 -1
- package/dist/esm/editor.js +2 -1
- package/dist/esm/plugins/analytics/types/toolbar-button.js +2 -0
- package/dist/esm/plugins/annotation/pm-plugins/inline-comment.js +1 -1
- package/dist/esm/plugins/breakout/index.js +7 -0
- package/dist/esm/plugins/breakout/ui/LayoutButton.js +3 -1
- package/dist/esm/plugins/card/pm-plugins/util/resolve.js +6 -1
- package/dist/esm/plugins/card/styles.js +2 -1
- package/dist/esm/plugins/card/toolbar.js +5 -1
- package/dist/esm/plugins/code-block/styles.js +16 -35
- package/dist/esm/plugins/code-block/ui/class-names.js +3 -2
- package/dist/esm/plugins/collab-edit/index.js +1 -1
- package/dist/esm/plugins/collab-edit/provider/channel.js +1 -1
- package/dist/esm/plugins/copy-button/commands.js +66 -0
- package/dist/esm/plugins/copy-button/index.js +17 -0
- package/dist/esm/plugins/copy-button/pm-plugins/main.js +26 -0
- package/dist/esm/plugins/copy-button/pm-plugins/plugin-key.js +2 -0
- package/dist/esm/plugins/copy-button/utils.js +31 -0
- package/dist/esm/plugins/custom-autoformat/doc.js +1 -1
- package/dist/esm/plugins/custom-autoformat/index.js +1 -1
- package/dist/esm/plugins/extension/actions.js +1 -1
- package/dist/esm/plugins/extension/context-panel.js +1 -1
- package/dist/esm/plugins/extension/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/extension/ui/Extension/ExtensionComponent.js +1 -1
- package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
- package/dist/esm/plugins/feedback-dialog/index.js +1 -1
- package/dist/esm/plugins/feedback-dialog/loadJiraCollectorDialogScript.js +1 -1
- package/dist/esm/plugins/find-replace/utils/batch-decorations.js +1 -1
- package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +1 -1
- package/dist/esm/plugins/hyperlink/HyperlinkToolbarAppearance.js +1 -1
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -1
- package/dist/esm/plugins/image-upload/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/indentation/messages.js +14 -0
- package/dist/esm/plugins/index.js +3 -1
- package/dist/esm/plugins/list/index.js +1 -41
- package/dist/esm/plugins/macro/actions.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaGroup.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaInline.js +2 -1
- package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaNodeView/media.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/esm/plugins/media/picker-facade.js +1 -1
- package/dist/esm/plugins/media/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/media/toolbar/utils.js +1 -1
- package/dist/esm/plugins/media/ui/MediaPicker/PickerFacadeProvider.js +1 -1
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +1 -1
- package/dist/esm/plugins/media/utils/check-media-type.js +1 -1
- package/dist/esm/plugins/panel/toolbar.js +9 -2
- package/dist/esm/plugins/paste/handlers.js +1 -1
- package/dist/esm/plugins/paste/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/quick-insert/index.js +1 -1
- package/dist/esm/plugins/table/commands/hover.js +2 -2
- package/dist/esm/plugins/table/toolbar.js +5 -2
- package/dist/esm/plugins/table/utils/decoration.js +5 -1
- package/dist/esm/plugins/tasks-and-decisions/ui/Task/task-item-with-providers.js +1 -1
- package/dist/esm/plugins/toolbar-lists-indentation/index.js +51 -0
- package/dist/esm/plugins/toolbar-lists-indentation/types.js +1 -0
- package/dist/esm/plugins/toolbar-lists-indentation/ui/Toolbar.js +96 -0
- package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +153 -0
- package/dist/esm/plugins/toolbar-lists-indentation/ui/index.js +47 -0
- package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +39 -0
- package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +6 -8
- package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +18 -51
- package/dist/esm/ui/ConfigPanel/ConfigPanel.js +1 -1
- package/dist/esm/ui/ConfigPanel/Fields/CustomSelect.js +1 -1
- package/dist/esm/ui/ConfigPanel/Fields/UserSelect.js +1 -1
- package/dist/esm/ui/ConfigPanel/FormErrorBoundary.js +1 -1
- package/dist/esm/ui/ConfigPanel/transformers.js +1 -1
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +12 -35
- package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +31 -89
- package/dist/esm/ui/LinkSearch/index.js +1 -1
- package/dist/esm/ui/ToolbarFeedback/index.js +1 -1
- package/dist/esm/utils/action.js +1 -1
- package/dist/esm/utils/clipboard.js +56 -1
- package/dist/esm/utils/extensions.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/analytics/types/toolbar-button.d.ts +3 -1
- package/dist/types/plugins/card/styles.d.ts +1 -0
- package/dist/types/plugins/copy-button/commands.d.ts +4 -0
- package/dist/types/plugins/copy-button/index.d.ts +3 -0
- package/dist/types/plugins/copy-button/pm-plugins/main.d.ts +3 -0
- package/dist/types/plugins/copy-button/pm-plugins/plugin-key.d.ts +2 -0
- package/dist/types/plugins/copy-button/utils.d.ts +7 -0
- package/dist/types/plugins/indentation/messages.d.ts +12 -0
- package/dist/types/plugins/index.d.ts +2 -0
- package/dist/types/plugins/panel/toolbar.d.ts +1 -1
- package/dist/types/plugins/table/commands/hover.d.ts +1 -1
- package/dist/types/plugins/table/utils/decoration.d.ts +1 -1
- package/dist/types/plugins/text-formatting/utils.d.ts +1 -1
- package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +5 -0
- package/dist/types/plugins/toolbar-lists-indentation/types.d.ts +16 -0
- package/dist/types/plugins/toolbar-lists-indentation/ui/Toolbar.d.ts +4 -0
- package/dist/types/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.d.ts +9 -0
- package/dist/types/plugins/{list/ui/ToolbarLists → toolbar-lists-indentation/ui}/index.d.ts +4 -10
- package/dist/types/plugins/toolbar-lists-indentation/ui/onItemActivated.d.ts +6 -0
- package/dist/types/plugins/type-ahead/ui/TypeAheadListItem.d.ts +0 -25
- package/dist/types/types/feature-flags.d.ts +18 -0
- package/dist/types/ui/ElementBrowser/components/ElementList/ElementList.d.ts +11 -0
- package/dist/types/utils/clipboard.d.ts +1 -0
- package/package.json +25 -25
- package/report.api.md +6747 -0
- package/dist/cjs/plugins/list/ui/ToolbarLists/index.js +0 -266
- package/dist/es2019/plugins/list/ui/ToolbarLists/index.js +0 -220
- package/dist/esm/plugins/list/ui/ToolbarLists/index.js +0 -241
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 169.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`ceb3d47ff02`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ceb3d47ff02) - [ux] ED-15074 Adds indentation buttons to the Editor toolbar. Buttons are disabled by default and also behind indentationButtonsInTheToolbar feature flag.
|
|
8
|
+
- [`8ff3031db06`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8ff3031db06) - Introduce new optional argument to CardProvider.resolve
|
|
9
|
+
- [`e7659ee829a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e7659ee829a) - ED-15074 Moved list toolbar UI into toolbarListsIndentation plugin to share logic with indentation toolbar buttons.
|
|
10
|
+
- [`54079156b5a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/54079156b5a) - ED-15092 Added floatingToolbarCopyButton feature flag
|
|
11
|
+
- [`07c8b0b4504`](https://bitbucket.org/atlassian/atlassian-frontend/commits/07c8b0b4504) - [ux] ED-15102 adds a copy button to nodes with floating toolbars
|
|
12
|
+
- [`2d979ce9877`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2d979ce9877) - [ux] ED-14945: Add windowed codeblock support in renderer (This feature sits behind a flag in the featureFlags prop 'allow-windowed-code-block')
|
|
13
|
+
- [`46ddfdc949b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/46ddfdc949b) - [ux] Removing deprecated `@atlaskit/item` package and replacing with new DS component
|
|
14
|
+
- [`04746af08f6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/04746af08f6) - [ux] ED-15097 added floating toolbar copy button to table
|
|
15
|
+
- [`9de4b38fdd6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9de4b38fdd6) - ED-15073 Added indentationButtonsInTheToolbar feature flag ready for feature development.
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`cf63e4add85`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cf63e4add85) - Removes extraneous padding from around the floating toolbar when editing a link.
|
|
20
|
+
- [`450a17a332a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/450a17a332a) - [ux] ED-14654: Lower z-index values on editor elements so they do not stick out of the editor and interfere with consuming products
|
|
21
|
+
- [`215256ec669`](https://bitbucket.org/atlassian/atlassian-frontend/commits/215256ec669) - [ED-15023] Remove typescript override in text formatting toolbar utils
|
|
22
|
+
- [`30c74c32783`](https://bitbucket.org/atlassian/atlassian-frontend/commits/30c74c32783) - [ux] ED-15234: reverts ED-14654 because causing header zindex issues
|
|
23
|
+
- [`86b38a65f7f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/86b38a65f7f) - Add integration test for non image files upload
|
|
24
|
+
- [`e4dba654a71`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e4dba654a71) - [ux] ED-15233: Fix breakout button positioning for breakout supported nodes in scenarios where editor disabled props changes while Editor is visually hidden and redisplayed.
|
|
25
|
+
Fixed by skipping breakout width update work when the editorView dom element is width 0 (hidden) and deferring LayoutButton position updates to second animation frame (on window
|
|
26
|
+
and editor resizes).
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
|
|
29
|
+
## 169.0.0
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Updated dependencies
|
|
34
|
+
|
|
35
|
+
## 168.0.0
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- Updated dependencies
|
|
40
|
+
|
|
3
41
|
## 167.0.3
|
|
4
42
|
|
|
5
43
|
### Patch Changes
|
|
@@ -383,6 +383,9 @@ function createPluginsList(props, prevProps, createAnalyticsEvent) {
|
|
|
383
383
|
} // UI only plugins
|
|
384
384
|
|
|
385
385
|
|
|
386
|
+
preset.add([_plugins.toolbarListsIndentationPlugin, {
|
|
387
|
+
showIndentationButtons: !!featureFlags.indentationButtonsInTheToolbar
|
|
388
|
+
}]);
|
|
386
389
|
preset.add([_plugins.insertBlockPlugin, {
|
|
387
390
|
allowTables: !!props.allowTables,
|
|
388
391
|
allowExpand: (0, _plugins.isExpandInsertionEnabled)(props),
|
|
@@ -435,6 +438,10 @@ function createPluginsList(props, prevProps, createAnalyticsEvent) {
|
|
|
435
438
|
}]);
|
|
436
439
|
}
|
|
437
440
|
|
|
441
|
+
if (featureFlags.floatingToolbarCopyButton) {
|
|
442
|
+
preset.add(_plugins.copyButtonPlugin);
|
|
443
|
+
}
|
|
444
|
+
|
|
438
445
|
var excludes = new Set();
|
|
439
446
|
|
|
440
447
|
if (!isCodeBlockAllowed({
|
|
@@ -21,4 +21,6 @@ exports.TOOLBAR_ACTION_SUBJECT_ID = TOOLBAR_ACTION_SUBJECT_ID;
|
|
|
21
21
|
TOOLBAR_ACTION_SUBJECT_ID["TEXT_FORMATTING_ITALIC"] = "italic";
|
|
22
22
|
TOOLBAR_ACTION_SUBJECT_ID["UNDO"] = "undo";
|
|
23
23
|
TOOLBAR_ACTION_SUBJECT_ID["REDO"] = "redo";
|
|
24
|
+
TOOLBAR_ACTION_SUBJECT_ID["INDENT"] = "indent";
|
|
25
|
+
TOOLBAR_ACTION_SUBJECT_ID["OUTDENT"] = "outdent";
|
|
24
26
|
})(TOOLBAR_ACTION_SUBJECT_ID || (exports.TOOLBAR_ACTION_SUBJECT_ID = TOOLBAR_ACTION_SUBJECT_ID = {}));
|
|
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.inlineCommentPlugin = void 0;
|
|
9
9
|
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
11
|
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
14
14
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
15
|
|
|
16
16
|
var _inlineCommentEvents = require("./../../analytics/types/inline-comment-events");
|
|
@@ -45,6 +45,13 @@ var BreakoutView = /*#__PURE__*/function () {
|
|
|
45
45
|
|
|
46
46
|
(0, _classCallCheck2.default)(this, BreakoutView);
|
|
47
47
|
(0, _defineProperty2.default)(this, "updateWidth", function (widthState) {
|
|
48
|
+
// we skip updating the width of breakout nodes if the editorView dom
|
|
49
|
+
// element was hidden (to avoid breakout width and button thrashing
|
|
50
|
+
// when an editor is hidden, re-rendered and unhidden).
|
|
51
|
+
if (widthState.width === 0) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
48
55
|
var width = (0, _utils.calcBreakoutWidth)(_this.node.attrs.mode, widthState.width);
|
|
49
56
|
var newStyle = "width: ".concat(width, "; ");
|
|
50
57
|
var lineLength = widthState.lineLength;
|
|
@@ -179,7 +179,9 @@ var LayoutButton = /*#__PURE__*/function (_React$Component) {
|
|
|
179
179
|
boundariesElement: boundariesElement,
|
|
180
180
|
scrollableElement: scrollableElement,
|
|
181
181
|
stick: true,
|
|
182
|
-
forcePlacement: true
|
|
182
|
+
forcePlacement: true,
|
|
183
|
+
scheduleExtraLayoutUpdates: true,
|
|
184
|
+
waitForExtraLayoutUpdates: true
|
|
183
185
|
}, (0, _react2.jsx)("div", {
|
|
184
186
|
css: toolbarButtonWrapper
|
|
185
187
|
}, (0, _react2.jsx)(_ToolbarButton.default, {
|
|
@@ -15,7 +15,12 @@ var _doc = require("../doc");
|
|
|
15
15
|
// Used for all interactions with the EditorCardProvider.
|
|
16
16
|
// ============================================================================ //
|
|
17
17
|
var resolveWithProvider = function resolveWithProvider(view, outstandingRequests, provider, request, options) {
|
|
18
|
-
|
|
18
|
+
// When user manually changes appearance from blue link to smart link, we should respect that,
|
|
19
|
+
var shouldForceAppearance = // This flag is set to true only in one place atm:
|
|
20
|
+
// packages/editor/editor-core/src/plugins/card/pm-plugins/doc.ts @ convertHyperlinkToSmartCard
|
|
21
|
+
// Which is used when user switching from URL to smart link appearance.
|
|
22
|
+
!!request.shouldReplaceLink;
|
|
23
|
+
var handleResolve = provider.resolve(request.url, request.appearance, shouldForceAppearance).then(function (resolvedCard) {
|
|
19
24
|
delete outstandingRequests[request.url];
|
|
20
25
|
return resolvedCard;
|
|
21
26
|
}).then(handleResolved(view, request, options), handleRejected(view, request));
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.smartCardStyles = void 0;
|
|
8
|
+
exports.smartCardStyles = exports.FLOATING_TOOLBAR_LINKPICKER_CLASSNAME = void 0;
|
|
9
9
|
|
|
10
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
11
|
|
|
@@ -21,5 +21,7 @@ var _tokens = require("@atlaskit/tokens");
|
|
|
21
21
|
|
|
22
22
|
var _templateObject;
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var FLOATING_TOOLBAR_LINKPICKER_CLASSNAME = 'card-floating-toolbar--link-picker';
|
|
25
|
+
exports.FLOATING_TOOLBAR_LINKPICKER_CLASSNAME = FLOATING_TOOLBAR_LINKPICKER_CLASSNAME;
|
|
26
|
+
var smartCardStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n max-width: calc(100% - 20px);\n vertical-align: top;\n word-break: break-all;\n\n .card {\n padding-left: 2px;\n padding-right: 2px;\n padding-top: 0.5em;\n padding-bottom: 0.5em;\n margin-bottom: -0.5em;\n\n .", " > a:focus {\n ", "\n }\n }\n\n &.", "\n .", "\n > a {\n ", "\n }\n .", " > a {\n /* EDM-1717: box-shadow Safari fix start */\n z-index: 1;\n position: relative;\n /* EDM-1717: box-shadow Safari fix end */\n }\n\n &.danger {\n .", " > a {\n box-shadow: 0 0 0 1px\n ", ";\n /* EDM-1717: box-shadow Safari fix start */\n z-index: 2;\n /* EDM-1717: box-shadow Safari fix end */\n }\n }\n }\n\n .", " {\n .", " > div {\n cursor: pointer;\n &:hover {\n background-color: ", ";\n }\n }\n\n &.", "\n .", "\n > div {\n ", "\n }\n\n &.danger {\n .", " > div {\n box-shadow: 0 0 0 1px\n ", " !important;\n }\n }\n }\n\n .", " {\n .", " > div {\n cursor: pointer;\n &::after {\n transition: box-shadow 0s;\n }\n }\n &.", "\n .", "\n > div {\n ", "\n }\n\n &.", "\n .", "\n > div::after {\n ", "\n }\n\n &.danger {\n .media-card-frame::after {\n box-shadow: 0 0 0 1px\n ", " !important;\n background: ", " !important;\n }\n .richMedia-resize-handle-right::after,\n .richMedia-resize-handle-left::after {\n background: ", ";\n }\n }\n }\n\n .", " {\n padding: 0;\n }\n"])), _styles.SmartCardSharedCssClassName.INLINE_CARD_CONTAINER, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _editorSharedStyles.akEditorSelectedNodeClassName, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _tokens.token)('color.border.danger', _editorSharedStyles.akEditorDeleteBorder), _styles.SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _tokens.token)('color.background.neutral.subtle.hovered', _colors.N20), _editorSharedStyles.akEditorSelectedNodeClassName, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _tokens.token)('color.border.danger', _editorSharedStyles.akEditorDeleteBorder), _styles.SmartCardSharedCssClassName.EMBED_CARD_CONTAINER, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, _editorSharedStyles.akEditorSelectedNodeClassName, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _editorSharedStyles.akEditorSelectedNodeClassName, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), (0, _tokens.token)('color.border.danger', _editorSharedStyles.akEditorDeleteBorder), (0, _tokens.token)('color.background.danger', _editorSharedStyles.akEditorDeleteBackground), (0, _tokens.token)('color.border.danger', _editorSharedStyles.akEditorDeleteBorder), FLOATING_TOOLBAR_LINKPICKER_CLASSNAME);
|
|
25
27
|
exports.smartCardStyles = smartCardStyles;
|
|
@@ -51,6 +51,8 @@ var _MediaAndEmbedsToolbar = _interopRequireDefault(require("../../ui/MediaAndEm
|
|
|
51
51
|
|
|
52
52
|
var _linkingUtils = require("../../utils/linking-utils");
|
|
53
53
|
|
|
54
|
+
var _styles2 = require("./styles");
|
|
55
|
+
|
|
54
56
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
55
57
|
|
|
56
58
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -275,9 +277,12 @@ var floatingToolbar = function floatingToolbar(cardOptions, platform) {
|
|
|
275
277
|
|
|
276
278
|
var toolbarOffset = isEmbedCard ? {
|
|
277
279
|
offset: [0, 24]
|
|
278
|
-
} : {};
|
|
280
|
+
} : {}; // Applies padding override for when link picker is currently displayed
|
|
281
|
+
|
|
282
|
+
var className = pluginState.showLinkingToolbar ? _styles2.FLOATING_TOOLBAR_LINKPICKER_CLASSNAME : undefined;
|
|
279
283
|
return _objectSpread(_objectSpread({
|
|
280
284
|
title: intl.formatMessage(_messages2.messages.card),
|
|
285
|
+
className: className,
|
|
281
286
|
nodeType: nodeType
|
|
282
287
|
}, toolbarOffset), {}, {
|
|
283
288
|
getDomRef: function getDomRef(view) {
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
@@ -17,7 +15,7 @@ var _components = require("@atlaskit/theme/components");
|
|
|
17
15
|
|
|
18
16
|
var _constants = require("@atlaskit/theme/constants");
|
|
19
17
|
|
|
20
|
-
var
|
|
18
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
21
19
|
|
|
22
20
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
23
21
|
|
|
@@ -25,63 +23,41 @@ var _tokens = require("@atlaskit/tokens");
|
|
|
25
23
|
|
|
26
24
|
var _classNames = require("./ui/class-names");
|
|
27
25
|
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
26
|
+
var _styles = require("@atlaskit/editor-common/styles");
|
|
31
27
|
|
|
32
|
-
|
|
28
|
+
var _templateObject, _templateObject2;
|
|
33
29
|
|
|
34
30
|
var highlightingCodeBlockStyles = function highlightingCodeBlockStyles(props) {
|
|
35
31
|
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror .code-block {\n position: relative;\n background-image: ", ";\n background-repeat: no-repeat;\n background-color: ", ";\n\n --ds--code--bg-color: transparent;\n\n background-attachment: local, scroll, scroll;\n background-size: 8px 100%, 8px 100%, 8px 100%;\n background-position: 100% 0, 100% 0, 0 0;\n font-family: ", ";\n border-radius: ", "px;\n margin: ", " 0 0 0;\n counter-reset: line;\n display: flex;\n min-width: ", "px;\n cursor: pointer;\n overflow-x: auto;\n\n .", " {\n /* https://bitbucket.org/atlassian/atlassian-frontend/src/develop/packages/design-system/code/src/themes/themeBuilder.ts#packages/design-system/code/src/themes/themeBuilder.ts-19:28 */\n flex-shrink: 0;\n text-align: right;\n background-color: ", ";\n padding: ", "px;\n color: ", ";\n\n span {\n display: block;\n line-height: 0;\n font-size: 0;\n\n &::before {\n display: inline-block;\n content: counter(line);\n counter-increment: line;\n font-size: ", ";\n line-height: 1.5rem;\n color: ", ";\n }\n }\n }\n\n .", " {\n position: absolute;\n z-index: 2;\n width: 100%;\n height: 100%;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n pointer-events: none;\n overflow: hidden;\n tab-size: 4;\n\n & [data-ds--code--code-block] {\n font-size: ", ";\n line-height: 1.5rem;\n }\n }\n\n .", " {\n position: relative;\n z-index: 1;\n display: flex;\n flex: 1;\n\n > code {\n flex-grow: 1;\n tab-size: 4;\n cursor: text;\n /* https://bitbucket.org/atlassian/atlassian-frontend/src/218202daeaf527262c21841e6f88fa058d349ad4/packages/design-system/code/src/themes/themeBuilder.ts#lines-12:17 */\n font-size: ", ";\n line-height: 1.5rem;\n border-radius: ", "px;\n margin: ", "px;\n white-space: pre;\n }\n\n &[data-debounce='true'] {\n .", " {\n display: none;\n }\n }\n\n &:not([data-debounce='true']) {\n > code:not([data-language='plaintext']):not([data-language='none']):not([data-language='']) {\n color: transparent;\n caret-color: ", ";\n }\n }\n }\n }\n\n .ProseMirror li > .code-block {\n margin: 0;\n }\n\n .ProseMirror .code-block.", ":not(.danger) {\n ", "\n }\n\n /* Danger when top level node */\n .ProseMirror .danger.code-block {\n box-shadow: 0 0 0 ", "px\n ", ";\n\n .", " {\n background-color: ", ";\n color: ", ";\n }\n\n .", " {\n background-color: ", ";\n }\n }\n\n /* Danger when nested node */\n .ProseMirror .danger .code-block {\n .", " {\n background-color: ", ";\n color: ", ";\n }\n\n .", " {\n background-color: ", ";\n }\n }\n"])), (0, _editorSharedStyles.overflowShadow)({
|
|
36
32
|
// TODO: https://product-fabric.atlassian.net/browse/DSP-4118
|
|
37
33
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
38
34
|
background: (0, _components.themed)({
|
|
39
|
-
light:
|
|
40
|
-
dark:
|
|
35
|
+
light: _colors.N20,
|
|
36
|
+
dark: _colors.DN50
|
|
41
37
|
})(props),
|
|
42
38
|
width: '8px'
|
|
43
39
|
}), (0, _components.themed)({
|
|
44
|
-
light: (0, _tokens.token)('color.background.neutral',
|
|
45
|
-
dark: (0, _tokens.token)('color.background.neutral',
|
|
40
|
+
light: (0, _tokens.token)('color.background.neutral', _colors.N20),
|
|
41
|
+
dark: (0, _tokens.token)('color.background.neutral', _colors.DN50)
|
|
46
42
|
})(props), _editorSharedStyles.akEditorCodeFontFamily, (0, _constants.borderRadius)(), _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.akEditorTableCellMinWidth, _classNames.codeBlockClassNames.gutter, (0, _components.themed)({
|
|
47
|
-
light: (0, _tokens.token)('color.background.neutral',
|
|
48
|
-
dark: (0, _tokens.token)('color.background.neutral',
|
|
43
|
+
light: (0, _tokens.token)('color.background.neutral', _colors.N30),
|
|
44
|
+
dark: (0, _tokens.token)('color.background.neutral', _colors.DN20)
|
|
49
45
|
})(props), (0, _constants.gridSize)(), (0, _components.themed)({
|
|
50
|
-
light: (0, _tokens.token)('color.text.subtlest',
|
|
51
|
-
dark: (0, _tokens.token)('color.text.subtlest',
|
|
46
|
+
light: (0, _tokens.token)('color.text.subtlest', _colors.N90),
|
|
47
|
+
dark: (0, _tokens.token)('color.text.subtlest', _colors.DN90)
|
|
52
48
|
})(props), (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()), (0, _components.themed)({
|
|
53
|
-
light: (0, _tokens.token)('color.text.subtle',
|
|
54
|
-
dark: (0, _tokens.token)('color.text.subtle',
|
|
49
|
+
light: (0, _tokens.token)('color.text.subtle', _colors.N400),
|
|
50
|
+
dark: (0, _tokens.token)('color.text.subtle', _colors.DN400)
|
|
55
51
|
})(props), _classNames.codeBlockClassNames.highlighting, (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()), _classNames.codeBlockClassNames.content, (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()), (0, _constants.borderRadius)(), (0, _constants.gridSize)(), _classNames.codeBlockClassNames.highlighting, (0, _components.themed)({
|
|
56
|
-
light: (0, _tokens.token)('color.text',
|
|
57
|
-
dark: (0, _tokens.token)('color.text',
|
|
58
|
-
})(props), _editorSharedStyles.akEditorSelectedNodeClassName, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow, _editorSharedStyles.SelectionStyle.Blanket]), _editorSharedStyles.akEditorSelectedBorderSize, (0, _tokens.token)('color.border.danger', _editorSharedStyles.akEditorDeleteBorder), _classNames.codeBlockClassNames.gutter, (0, _tokens.token)('color.blanket.danger',
|
|
52
|
+
light: (0, _tokens.token)('color.text', _colors.N800),
|
|
53
|
+
dark: (0, _tokens.token)('color.text', _colors.DN500)
|
|
54
|
+
})(props), _editorSharedStyles.akEditorSelectedNodeClassName, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow, _editorSharedStyles.SelectionStyle.Blanket]), _editorSharedStyles.akEditorSelectedBorderSize, (0, _tokens.token)('color.border.danger', _editorSharedStyles.akEditorDeleteBorder), _classNames.codeBlockClassNames.gutter, (0, _tokens.token)('color.blanket.danger', _colors.R75), (0, _tokens.token)('color.text.danger', _editorSharedStyles.akEditorDeleteIconColor), _classNames.codeBlockClassNames.content, (0, _tokens.token)('color.background.danger', _editorSharedStyles.akEditorDeleteBackground), _classNames.codeBlockClassNames.gutter, (0, _tokens.token)('color.blanket.danger', 'rgba(255, 143, 115, 0.5)'), (0, _tokens.token)('color.text.danger', _editorSharedStyles.akEditorDeleteIconColor), _classNames.codeBlockClassNames.content, (0, _tokens.token)('color.background.danger', 'rgba(255, 189, 173, 0.5)'));
|
|
59
55
|
};
|
|
60
56
|
|
|
61
57
|
exports.highlightingCodeBlockStyles = highlightingCodeBlockStyles;
|
|
62
58
|
|
|
63
59
|
var codeBlockStyles = function codeBlockStyles(props) {
|
|
64
|
-
return (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror
|
|
65
|
-
// TODO: https://product-fabric.atlassian.net/browse/DSP-4118
|
|
66
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
67
|
-
background: (0, _components.themed)({
|
|
68
|
-
light: colors.N20,
|
|
69
|
-
dark: colors.DN50
|
|
70
|
-
})(props),
|
|
71
|
-
width: '8px'
|
|
72
|
-
}), (0, _components.themed)({
|
|
73
|
-
light: (0, _tokens.token)('color.background.neutral', colors.N20),
|
|
74
|
-
dark: (0, _tokens.token)('color.background.neutral', colors.DN50)
|
|
75
|
-
})(props), _editorSharedStyles.akEditorCodeFontFamily, (0, _constants.borderRadius)(), _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.akEditorTableCellMinWidth, _classNames.codeBlockClassNames.gutter, (0, _components.themed)({
|
|
76
|
-
light: (0, _tokens.token)('color.background.neutral', colors.N30),
|
|
77
|
-
dark: (0, _tokens.token)('color.background.neutral', colors.DN20)
|
|
78
|
-
})(props), (0, _constants.gridSize)(), (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()), (0, _components.themed)({
|
|
79
|
-
light: (0, _tokens.token)('color.text', colors.N400),
|
|
80
|
-
dark: (0, _tokens.token)('color.text', colors.DN400)
|
|
81
|
-
})(props), _classNames.codeBlockClassNames.content, (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()), (0, _components.themed)({
|
|
82
|
-
light: (0, _tokens.token)('color.text', colors.N800),
|
|
83
|
-
dark: (0, _tokens.token)('color.text', colors.DN800)
|
|
84
|
-
})(props), (0, _constants.borderRadius)(), (0, _constants.gridSize)(), _editorSharedStyles.akEditorSelectedNodeClassName, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow, _editorSharedStyles.SelectionStyle.Blanket]), _editorSharedStyles.akEditorSelectedBorderSize, _editorSharedStyles.akEditorDeleteBorder, _classNames.codeBlockClassNames.gutter, (0, _tokens.token)('color.blanket.danger', colors.R75), (0, _tokens.token)('color.text.danger', _editorSharedStyles.akEditorDeleteIconColor), _classNames.codeBlockClassNames.content, (0, _tokens.token)('color.background.danger', _editorSharedStyles.akEditorDeleteBackground), _classNames.codeBlockClassNames.gutter, (0, _tokens.token)('color.blanket.danger', 'rgba(255, 143, 115, 0.5)'), (0, _tokens.token)('color.text.danger', _editorSharedStyles.akEditorDeleteIconColor), _classNames.codeBlockClassNames.content, (0, _tokens.token)('color.background.danger', 'rgba(255, 189, 173, 0.5)'));
|
|
60
|
+
return (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n ", "\n }\n\n .ProseMirror li > .code-block {\n margin: 0;\n }\n\n .ProseMirror .code-block.", ":not(.danger) {\n ", "\n }\n\n /* Danger when top level node */\n .ProseMirror .danger.code-block {\n box-shadow: 0 0 0 ", "px ", ";\n\n .", " {\n background-color: ", ";\n color: ", ";\n }\n\n .", " {\n background-color: ", ";\n }\n }\n\n /* Danger when nested node */\n .ProseMirror .danger .code-block {\n .", " {\n background-color: ", ";\n color: ", ";\n }\n\n .", " {\n background-color: ", ";\n }\n }\n"])), (0, _styles.codeBlockSharedStyles)(props), _editorSharedStyles.akEditorSelectedNodeClassName, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow, _editorSharedStyles.SelectionStyle.Blanket]), _editorSharedStyles.akEditorSelectedBorderSize, _editorSharedStyles.akEditorDeleteBorder, _classNames.codeBlockClassNames.gutter, (0, _tokens.token)('color.blanket.danger', _colors.R75), (0, _tokens.token)('color.text.danger', _editorSharedStyles.akEditorDeleteIconColor), _classNames.codeBlockClassNames.content, (0, _tokens.token)('color.background.danger', _editorSharedStyles.akEditorDeleteBackground), _classNames.codeBlockClassNames.gutter, (0, _tokens.token)('color.blanket.danger', 'rgba(255, 143, 115, 0.5)'), (0, _tokens.token)('color.text.danger', _editorSharedStyles.akEditorDeleteIconColor), _classNames.codeBlockClassNames.content, (0, _tokens.token)('color.background.danger', 'rgba(255, 189, 173, 0.5)'));
|
|
85
61
|
};
|
|
86
62
|
|
|
87
63
|
exports.codeBlockStyles = codeBlockStyles;
|
|
@@ -4,9 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.codeBlockClassNames = void 0;
|
|
7
|
+
|
|
8
|
+
var _styles = require("@atlaskit/editor-common/styles");
|
|
9
|
+
|
|
7
10
|
var codeBlockClassNames = {
|
|
8
|
-
gutter:
|
|
9
|
-
content:
|
|
11
|
+
gutter: _styles.CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER,
|
|
12
|
+
content: _styles.CodeBlockSharedCssClassName.CODEBLOCK_CONTENT,
|
|
10
13
|
highlighting: 'code-highlighting'
|
|
11
14
|
};
|
|
12
15
|
exports.codeBlockClassNames = codeBlockClassNames;
|
|
@@ -13,10 +13,10 @@ Object.defineProperty(exports, "pluginKey", {
|
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
17
|
-
|
|
18
16
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
19
17
|
|
|
18
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
19
|
+
|
|
20
20
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
21
21
|
|
|
22
22
|
var _prosemirrorCollab = require("prosemirror-collab");
|
|
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.Channel = void 0;
|
|
9
9
|
|
|
10
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
|
-
|
|
12
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
11
|
|
|
12
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
|
+
|
|
14
14
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
15
|
|
|
16
16
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.resetCopiedState = exports.copy = void 0;
|
|
7
|
+
|
|
8
|
+
var _prosemirrorUtils = require("prosemirror-utils");
|
|
9
|
+
|
|
10
|
+
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
11
|
+
|
|
12
|
+
var _decoration = require("../base/pm-plugins/decoration");
|
|
13
|
+
|
|
14
|
+
var _prosemirrorModel = require("prosemirror-model");
|
|
15
|
+
|
|
16
|
+
var _clipboard = require("../../utils/clipboard");
|
|
17
|
+
|
|
18
|
+
var copy = function copy(nodeType) {
|
|
19
|
+
return function (state, dispatch) {
|
|
20
|
+
var tr = state.tr,
|
|
21
|
+
schema = state.schema; // This command should only be triggered by the Copy button in the floating toolbar
|
|
22
|
+
// which is only visible when selection is inside the target node
|
|
23
|
+
|
|
24
|
+
var node = (0, _prosemirrorUtils.findSelectedNodeOfType)(nodeType)(tr.selection);
|
|
25
|
+
|
|
26
|
+
if (!node) {
|
|
27
|
+
node = (0, _prosemirrorUtils.findParentNodeOfType)(nodeType)(tr.selection);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (!node) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
var domNode = _prosemirrorModel.DOMSerializer.fromSchema(schema).serializeNode(node.node);
|
|
35
|
+
|
|
36
|
+
var div = document.createElement('div');
|
|
37
|
+
div.appendChild(domNode); // The "0 0" refers to the start and end depth of the slice
|
|
38
|
+
// since we're coping the block node only, it will always be 0 0
|
|
39
|
+
// https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
|
|
40
|
+
|
|
41
|
+
div.firstChild.setAttribute('data-pm-slice', '0 0 []');
|
|
42
|
+
(0, _clipboard.copyHTMLToClipboard)(div.innerHTML);
|
|
43
|
+
var copyToClipboardTr = tr;
|
|
44
|
+
copyToClipboardTr.setMeta(_pluginKey.pluginKey, {
|
|
45
|
+
copied: true
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
if (dispatch) {
|
|
49
|
+
dispatch(copyToClipboardTr);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return true;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
exports.copy = copy;
|
|
57
|
+
|
|
58
|
+
var resetCopiedState = function resetCopiedState(nodeType, onMouseLeave) {
|
|
59
|
+
return function (state, dispatch) {
|
|
60
|
+
var customTr = state.tr; // Avoid multipe dispatch
|
|
61
|
+
// https://product-fabric.atlassian.net/wiki/spaces/E/pages/2241659456/All+about+dispatch+and+why+there+shouldn+t+be+multiple#How-do-I-avoid-them%3F
|
|
62
|
+
|
|
63
|
+
var customDispatch = function customDispatch(tr) {
|
|
64
|
+
customTr = tr;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
onMouseLeave ? onMouseLeave(state, customDispatch) : (0, _decoration.hoverDecoration)(nodeType, false)(state, customDispatch);
|
|
68
|
+
|
|
69
|
+
var copyButtonState = _pluginKey.pluginKey.getState(state);
|
|
70
|
+
|
|
71
|
+
if (copyButtonState !== null && copyButtonState !== void 0 && copyButtonState.copied) {
|
|
72
|
+
customTr.setMeta(_pluginKey.pluginKey, {
|
|
73
|
+
copied: false
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (dispatch) {
|
|
78
|
+
dispatch(customTr);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return true;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
exports.resetCopiedState = resetCopiedState;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _main = _interopRequireDefault(require("./pm-plugins/main"));
|
|
11
|
+
|
|
12
|
+
var copyButtonPlugin = function copyButtonPlugin() {
|
|
13
|
+
return {
|
|
14
|
+
name: 'copyButton',
|
|
15
|
+
pmPlugins: function pmPlugins() {
|
|
16
|
+
return [{
|
|
17
|
+
name: 'copyButton',
|
|
18
|
+
plugin: function plugin() {
|
|
19
|
+
return (0, _main.default)();
|
|
20
|
+
}
|
|
21
|
+
}];
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
var _default = copyButtonPlugin;
|
|
27
|
+
exports.default = _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.copyButtonPlugin = copyButtonPlugin;
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
|
|
9
|
+
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
10
|
+
|
|
11
|
+
var _pluginKey = require("./plugin-key");
|
|
12
|
+
|
|
13
|
+
function copyButtonPlugin() {
|
|
14
|
+
return new _safePlugin.SafePlugin({
|
|
15
|
+
state: {
|
|
16
|
+
init: function init() {
|
|
17
|
+
return {
|
|
18
|
+
copied: false
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
apply: function apply(tr, pluginState) {
|
|
22
|
+
var meta = tr.getMeta(_pluginKey.pluginKey);
|
|
23
|
+
|
|
24
|
+
if ((meta === null || meta === void 0 ? void 0 : meta.copied) !== undefined) {
|
|
25
|
+
return {
|
|
26
|
+
copied: meta.copied
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return pluginState;
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
key: _pluginKey.pluginKey
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
var _default = copyButtonPlugin;
|
|
38
|
+
exports.default = _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.pluginKey = void 0;
|
|
7
|
+
|
|
8
|
+
var _prosemirrorState = require("prosemirror-state");
|
|
9
|
+
|
|
10
|
+
var pluginKey = new _prosemirrorState.PluginKey('copyButtonPlugin');
|
|
11
|
+
exports.pluginKey = pluginKey;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.showCopyButton = exports.getCopyButtonConfig = void 0;
|
|
9
|
+
|
|
10
|
+
var _copy = _interopRequireDefault(require("@atlaskit/icon/glyph/copy"));
|
|
11
|
+
|
|
12
|
+
var _messages = _interopRequireDefault(require("../../messages"));
|
|
13
|
+
|
|
14
|
+
var _decoration = require("../base/pm-plugins/decoration");
|
|
15
|
+
|
|
16
|
+
var _commands = require("./commands");
|
|
17
|
+
|
|
18
|
+
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
19
|
+
|
|
20
|
+
var getCopyButtonConfig = function getCopyButtonConfig(state, formatMessage, nodeType, onMouseEnter, onMouseLeave) {
|
|
21
|
+
var copyButtonState = _pluginKey.pluginKey.getState(state);
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
id: 'editor.floatingToolbar.copy',
|
|
25
|
+
type: 'button',
|
|
26
|
+
appearance: 'subtle',
|
|
27
|
+
icon: _copy.default,
|
|
28
|
+
onClick: (0, _commands.copy)(nodeType),
|
|
29
|
+
title: formatMessage(copyButtonState !== null && copyButtonState !== void 0 && copyButtonState.copied ? _messages.default.copiedToClipboard : _messages.default.copyToClipboard),
|
|
30
|
+
onMouseEnter: onMouseEnter || (0, _decoration.hoverDecoration)(nodeType, true, 'ak-editor-selected-node'),
|
|
31
|
+
onMouseLeave: (0, _commands.resetCopiedState)(nodeType, onMouseLeave),
|
|
32
|
+
onFocus: (0, _decoration.hoverDecoration)(nodeType, true, 'ak-editor-selected-node'),
|
|
33
|
+
onBlur: (0, _decoration.hoverDecoration)(nodeType, false),
|
|
34
|
+
hideTooltipOnClick: false,
|
|
35
|
+
tabIndex: null // TODO select and delete styling needs to be removed when keyboard cursor moves away
|
|
36
|
+
// problem already exist with delete as well
|
|
37
|
+
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
exports.getCopyButtonConfig = getCopyButtonConfig;
|
|
42
|
+
|
|
43
|
+
var showCopyButton = function showCopyButton(state) {
|
|
44
|
+
return state && // Check if the Copy button plugin is enabled
|
|
45
|
+
// @ts-ignore pluginKey.key
|
|
46
|
+
state.plugins.find(function (p) {
|
|
47
|
+
return p.key === _pluginKey.pluginKey.key;
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
exports.showCopyButton = showCopyButton;
|
|
@@ -8,10 +8,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.getContextPanel = void 0;
|
|
9
9
|
exports.onChangeAction = onChangeAction;
|
|
10
10
|
|
|
11
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
-
|
|
13
11
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
14
12
|
|
|
13
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
|
+
|
|
15
15
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
16
16
|
|
|
17
17
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
@@ -26,10 +26,10 @@ Object.defineProperty(exports, "pluginKey", {
|
|
|
26
26
|
});
|
|
27
27
|
exports.updateEditButton = void 0;
|
|
28
28
|
|
|
29
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
30
|
-
|
|
31
29
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
32
30
|
|
|
31
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
32
|
+
|
|
33
33
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
34
34
|
|
|
35
35
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
@@ -30,7 +30,7 @@ var safeNumberFeatureFlag = function safeNumberFeatureFlag(value) {
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
function createFeatureFlagsFromProps(props) {
|
|
33
|
-
var _props$allowTextColor, _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$featureFlags, _props$featureFlags2, _props$allowTables, _props$featureFlags3, _props$featureFlags4, _props$allowTables2, _props$featureFlags5, _props$featureFlags6, _props$allowTables3, _props$featureFlags7, _props$featureFlags8, _props$allowTables4, _props$featureFlags9, _props$featureFlags10, _props$allowTables5, _props$allowExtension, _props$featureFlags11, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27, _props$featureFlags28, _props$featureFlags29, _props$featureFlags30, _props$featureFlags31, _props$featureFlags32, _props$featureFlags33, _props$collabEdit, _props$collabEdit2, _props$featureFlags34, _props$featureFlags35, _props$featureFlags36, _props$featureFlags37;
|
|
33
|
+
var _props$allowTextColor, _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$featureFlags, _props$featureFlags2, _props$allowTables, _props$featureFlags3, _props$featureFlags4, _props$allowTables2, _props$featureFlags5, _props$featureFlags6, _props$allowTables3, _props$featureFlags7, _props$featureFlags8, _props$allowTables4, _props$featureFlags9, _props$featureFlags10, _props$allowTables5, _props$allowExtension, _props$featureFlags11, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27, _props$featureFlags28, _props$featureFlags29, _props$featureFlags30, _props$featureFlags31, _props$featureFlags32, _props$featureFlags33, _props$collabEdit, _props$collabEdit2, _props$featureFlags34, _props$featureFlags35, _props$featureFlags36, _props$featureFlags37, _props$featureFlags38, _props$featureFlags39, _props$featureFlags40, _props$featureFlags41;
|
|
34
34
|
|
|
35
35
|
var normalizedFeatureFlags = (0, _normalizeFeatureFlags.normalizeFeatureFlags)(props.featureFlags);
|
|
36
36
|
return _objectSpread(_objectSpread({}, normalizedFeatureFlags), {}, {
|
|
@@ -68,6 +68,8 @@ function createFeatureFlagsFromProps(props) {
|
|
|
68
68
|
useNativeCollabPlugin: Boolean(typeof ((_props$collabEdit = props.collabEdit) === null || _props$collabEdit === void 0 ? void 0 : _props$collabEdit.useNativePlugin) === 'boolean' ? !!((_props$collabEdit2 = props.collabEdit) !== null && _props$collabEdit2 !== void 0 && _props$collabEdit2.useNativePlugin) : false),
|
|
69
69
|
chromeCursorHandlerFixedVersion: typeof ((_props$featureFlags34 = props.featureFlags) === null || _props$featureFlags34 === void 0 ? void 0 : _props$featureFlags34.chromeCursorHandlerFixedVersion) === 'string' ? Number(props.featureFlags.chromeCursorHandlerFixedVersion) || undefined : undefined,
|
|
70
70
|
viewChangingExperimentToolbarStyle: typeof ((_props$featureFlags35 = props.featureFlags) === null || _props$featureFlags35 === void 0 ? void 0 : _props$featureFlags35['view-changing-experiment-toolbar-style']) === 'string' ? props.featureFlags['view-changing-experiment-toolbar-style'] || undefined : undefined,
|
|
71
|
-
showHoverPreview: Boolean(typeof ((_props$featureFlags36 = props.featureFlags) === null || _props$featureFlags36 === void 0 ? void 0 : _props$featureFlags36.showHoverPreview) === 'boolean' ? !!((_props$featureFlags37 = props.featureFlags) !== null && _props$featureFlags37 !== void 0 && _props$featureFlags37.showHoverPreview) : false)
|
|
71
|
+
showHoverPreview: Boolean(typeof ((_props$featureFlags36 = props.featureFlags) === null || _props$featureFlags36 === void 0 ? void 0 : _props$featureFlags36.showHoverPreview) === 'boolean' ? !!((_props$featureFlags37 = props.featureFlags) !== null && _props$featureFlags37 !== void 0 && _props$featureFlags37.showHoverPreview) : false),
|
|
72
|
+
indentationButtonsInTheToolbar: Boolean(typeof ((_props$featureFlags38 = props.featureFlags) === null || _props$featureFlags38 === void 0 ? void 0 : _props$featureFlags38['indentation-buttons-in-the-toolbar']) === 'boolean' ? !!((_props$featureFlags39 = props.featureFlags) !== null && _props$featureFlags39 !== void 0 && _props$featureFlags39['indentation-buttons-in-the-toolbar']) : false),
|
|
73
|
+
floatingToolbarCopyButton: Boolean(typeof ((_props$featureFlags40 = props.featureFlags) === null || _props$featureFlags40 === void 0 ? void 0 : _props$featureFlags40.floatingToolbarCopyButton) === 'boolean' ? !!((_props$featureFlags41 = props.featureFlags) !== null && _props$featureFlags41 !== void 0 && _props$featureFlags41.floatingToolbarCopyButton) : false)
|
|
72
74
|
});
|
|
73
75
|
}
|