@atlaskit/editor-core 161.0.0 → 162.0.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 +44 -0
- package/dist/cjs/actions/index.js +76 -48
- package/dist/cjs/extensibility.js +2 -2
- package/dist/cjs/labs/next/full-page.js +1 -1
- package/dist/cjs/plugins/block-type/styles.js +5 -2
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/index.js +13 -11
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/styled.js +11 -7
- package/dist/cjs/plugins/card/messages.js +4 -4
- package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +29 -11
- package/dist/cjs/plugins/card/ui/LinkToolbarButtonGroup.js +66 -7
- package/dist/cjs/plugins/card/ui/LinkToolbarIconDropdown.js +166 -7
- package/dist/cjs/plugins/card/ui/ResizableEmbedCard.js +9 -6
- package/dist/cjs/plugins/card/ui/assets/card.js +1 -1
- package/dist/cjs/plugins/card/ui/assets/embed.js +1 -1
- package/dist/cjs/plugins/card/ui/assets/inline.js +1 -1
- package/dist/cjs/plugins/card/ui/assets/url.js +1 -1
- package/dist/cjs/plugins/card/ui/link-toolbar-button-group-options.js +60 -0
- package/dist/cjs/plugins/card/ui/link-toolbar-icon-dropdown-options.js +66 -0
- package/dist/cjs/plugins/card/ui/styled.js +5 -13
- package/dist/cjs/plugins/card/ui/types.js +5 -0
- package/dist/cjs/plugins/clipboard/pm-plugins/main.js +99 -3
- package/dist/cjs/plugins/code-block/styles.js +45 -38
- package/dist/cjs/plugins/extension/plugin-factory.js +4 -1
- package/dist/cjs/plugins/extension/pm-plugins/main.js +34 -11
- package/dist/cjs/plugins/extension/utils.js +57 -12
- package/dist/cjs/plugins/find-replace/ui/Find.js +12 -12
- package/dist/cjs/plugins/find-replace/ui/FindReplace.js +5 -5
- package/dist/cjs/plugins/find-replace/ui/Replace.js +5 -5
- package/dist/cjs/plugins/find-replace/ui/styles.js +12 -15
- package/dist/cjs/plugins/layout/styles.js +2 -2
- package/dist/cjs/plugins/list/actions/wrap-and-join-lists.js +180 -0
- package/dist/cjs/plugins/list/commands/index.js +35 -38
- package/dist/cjs/plugins/list/utils/replace-content.js +31 -0
- package/dist/cjs/plugins/media/nodeviews/mediaNodeUpdater.js +3 -3
- package/dist/cjs/plugins/media/styles.js +2 -2
- package/dist/cjs/plugins/media/utils/media-single.js +15 -2
- package/dist/cjs/plugins/paste/handlers.js +19 -5
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +1 -1
- package/dist/cjs/plugins/placeholder-text/index.js +45 -1
- package/dist/cjs/plugins/placeholder-text/placeholder-text-nodeview.js +66 -22
- package/dist/cjs/plugins/placeholder-text/selection-utils.js +19 -0
- package/dist/cjs/plugins/placeholder-text/styles.js +3 -1
- package/dist/cjs/plugins/table/commands/index.js +0 -6
- package/dist/cjs/plugins/table/commands/insert.js +1 -1
- package/dist/cjs/plugins/table/commands/misc.js +5 -18
- package/dist/cjs/plugins/table/commands-with-analytics.js +1 -1
- package/dist/cjs/plugins/table/handlers.js +6 -2
- package/dist/cjs/plugins/table/index.js +7 -13
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +2 -2
- package/dist/cjs/plugins/table/nodeviews/table.js +7 -38
- package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +2 -2
- package/dist/cjs/plugins/table/pm-plugins/main.js +3 -1
- package/dist/cjs/plugins/table/pm-plugins/plugin-factory.js +4 -7
- package/dist/cjs/plugins/table/pm-plugins/plugin-key.js +11 -0
- package/dist/cjs/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +2 -0
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +3 -3
- package/dist/cjs/plugins/table/reducer.js +0 -7
- package/dist/cjs/plugins/table/toolbar.js +5 -15
- package/dist/cjs/plugins/table/transforms/metadata.js +2 -2
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/index.js +3 -1
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/index.js +1 -1
- package/dist/cjs/plugins/table/ui/LayoutButton/index.js +1 -2
- package/dist/cjs/plugins/table/ui/common-styles.css.js +17 -8
- package/dist/cjs/plugins/table/ui/ui-styles.css.js +39 -25
- package/dist/cjs/plugins/table/utils/nodes.js +15 -15
- package/dist/cjs/plugins/tasks-and-decisions/commands.js +15 -1
- package/dist/cjs/plugins/text-formatting/styles.js +5 -2
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/index.js +71 -1
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +30 -0
- package/dist/cjs/plugins/text-formatting/utils.js +30 -2
- package/dist/cjs/plugins/type-ahead/api.js +32 -1
- package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -5
- package/dist/cjs/plugins/type-ahead/utils.js +22 -4
- package/dist/cjs/ui/Appearance/Comment/Comment.js +1 -1
- package/dist/cjs/ui/Appearance/FullPage/StyledComponents.js +1 -1
- package/dist/cjs/ui/ContentStyles/index.js +32 -9
- package/dist/cjs/utils/index.js +1 -8
- package/dist/cjs/utils/insert.js +1 -9
- package/dist/cjs/utils/selection.js +2 -9
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +20 -23
- package/dist/es2019/extensibility.js +1 -1
- package/dist/es2019/labs/next/full-page.js +2 -2
- package/dist/es2019/plugins/block-type/styles.js +3 -3
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/index.js +15 -12
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +19 -14
- package/dist/es2019/plugins/card/messages.js +4 -4
- package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +21 -9
- package/dist/es2019/plugins/card/ui/LinkToolbarButtonGroup.js +54 -3
- package/dist/es2019/plugins/card/ui/LinkToolbarIconDropdown.js +145 -3
- package/dist/es2019/plugins/card/ui/ResizableEmbedCard.js +10 -6
- package/dist/es2019/plugins/card/ui/assets/card.js +1 -1
- package/dist/es2019/plugins/card/ui/assets/embed.js +1 -1
- package/dist/es2019/plugins/card/ui/assets/inline.js +1 -1
- package/dist/es2019/plugins/card/ui/assets/url.js +1 -1
- package/dist/es2019/plugins/card/ui/link-toolbar-button-group-options.js +45 -0
- package/dist/es2019/plugins/card/ui/link-toolbar-icon-dropdown-options.js +51 -0
- package/dist/es2019/plugins/card/ui/styled.js +2 -2
- package/dist/es2019/plugins/card/ui/types.js +1 -0
- package/dist/es2019/plugins/clipboard/pm-plugins/main.js +91 -9
- package/dist/es2019/plugins/code-block/styles.js +14 -14
- package/dist/es2019/plugins/extension/plugin-factory.js +3 -1
- package/dist/es2019/plugins/extension/pm-plugins/main.js +38 -12
- package/dist/es2019/plugins/extension/utils.js +37 -2
- package/dist/es2019/plugins/find-replace/ui/Find.js +1 -1
- package/dist/es2019/plugins/find-replace/ui/FindReplace.js +1 -1
- package/dist/es2019/plugins/find-replace/ui/Replace.js +1 -1
- package/dist/es2019/plugins/find-replace/ui/styles.js +14 -9
- package/dist/es2019/plugins/layout/styles.js +5 -1
- package/dist/es2019/plugins/list/actions/wrap-and-join-lists.js +163 -0
- package/dist/es2019/plugins/list/commands/index.js +29 -28
- package/dist/es2019/plugins/list/utils/replace-content.js +22 -0
- package/dist/es2019/plugins/media/nodeviews/mediaNodeUpdater.js +3 -3
- package/dist/es2019/plugins/media/styles.js +1 -1
- package/dist/es2019/plugins/media/utils/media-single.js +14 -1
- package/dist/es2019/plugins/paste/handlers.js +19 -5
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +2 -2
- package/dist/es2019/plugins/placeholder-text/index.js +46 -1
- package/dist/es2019/plugins/placeholder-text/placeholder-text-nodeview.js +66 -20
- package/dist/es2019/plugins/placeholder-text/selection-utils.js +9 -0
- package/dist/es2019/plugins/placeholder-text/styles.js +22 -0
- package/dist/es2019/plugins/table/commands/index.js +1 -1
- package/dist/es2019/plugins/table/commands/insert.js +1 -1
- package/dist/es2019/plugins/table/commands/misc.js +5 -11
- package/dist/es2019/plugins/table/commands-with-analytics.js +1 -1
- package/dist/es2019/plugins/table/handlers.js +6 -2
- package/dist/es2019/plugins/table/index.js +4 -8
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +2 -2
- package/dist/es2019/plugins/table/nodeviews/table.js +2 -16
- package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +1 -1
- package/dist/es2019/plugins/table/pm-plugins/main.js +2 -1
- package/dist/es2019/plugins/table/pm-plugins/plugin-factory.js +1 -2
- package/dist/es2019/plugins/table/pm-plugins/plugin-key.js +2 -0
- package/dist/es2019/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +2 -0
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +1 -1
- package/dist/es2019/plugins/table/reducer.js +0 -9
- package/dist/es2019/plugins/table/toolbar.js +1 -4
- package/dist/es2019/plugins/table/transforms/metadata.js +1 -1
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/index.js +2 -1
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +1 -1
- package/dist/es2019/plugins/table/ui/LayoutButton/index.js +1 -2
- package/dist/es2019/plugins/table/ui/common-styles.css.js +51 -26
- package/dist/es2019/plugins/table/ui/ui-styles.css.js +57 -56
- package/dist/es2019/plugins/table/utils/nodes.js +11 -11
- package/dist/es2019/plugins/tasks-and-decisions/commands.js +13 -1
- package/dist/es2019/plugins/text-formatting/styles.js +3 -3
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/index.js +61 -2
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +30 -0
- package/dist/es2019/plugins/text-formatting/utils.js +13 -1
- package/dist/es2019/plugins/type-ahead/api.js +31 -2
- package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +17 -5
- package/dist/es2019/plugins/type-ahead/utils.js +15 -0
- package/dist/es2019/ui/Appearance/Comment/Comment.js +2 -2
- package/dist/es2019/ui/Appearance/FullPage/StyledComponents.js +2 -2
- package/dist/es2019/ui/ContentStyles/index.js +45 -23
- package/dist/es2019/utils/index.js +1 -1
- package/dist/es2019/utils/insert.js +2 -10
- package/dist/es2019/utils/selection.js +1 -6
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +76 -48
- package/dist/esm/extensibility.js +1 -1
- package/dist/esm/labs/next/full-page.js +2 -2
- package/dist/esm/plugins/block-type/styles.js +4 -2
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/index.js +14 -12
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +9 -5
- package/dist/esm/plugins/card/messages.js +4 -4
- package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +25 -9
- package/dist/esm/plugins/card/ui/LinkToolbarButtonGroup.js +57 -5
- package/dist/esm/plugins/card/ui/LinkToolbarIconDropdown.js +154 -5
- package/dist/esm/plugins/card/ui/ResizableEmbedCard.js +9 -6
- package/dist/esm/plugins/card/ui/assets/card.js +1 -1
- package/dist/esm/plugins/card/ui/assets/embed.js +1 -1
- package/dist/esm/plugins/card/ui/assets/inline.js +1 -1
- package/dist/esm/plugins/card/ui/assets/url.js +1 -1
- package/dist/esm/plugins/card/ui/link-toolbar-button-group-options.js +45 -0
- package/dist/esm/plugins/card/ui/link-toolbar-icon-dropdown-options.js +51 -0
- package/dist/esm/plugins/card/ui/styled.js +2 -2
- package/dist/esm/plugins/card/ui/types.js +1 -0
- package/dist/esm/plugins/clipboard/pm-plugins/main.js +91 -2
- package/dist/esm/plugins/code-block/styles.js +42 -38
- package/dist/esm/plugins/extension/plugin-factory.js +3 -1
- package/dist/esm/plugins/extension/pm-plugins/main.js +34 -11
- package/dist/esm/plugins/extension/utils.js +51 -9
- package/dist/esm/plugins/find-replace/ui/Find.js +1 -1
- package/dist/esm/plugins/find-replace/ui/FindReplace.js +1 -1
- package/dist/esm/plugins/find-replace/ui/Replace.js +1 -1
- package/dist/esm/plugins/find-replace/ui/styles.js +6 -10
- package/dist/esm/plugins/layout/styles.js +2 -2
- package/dist/esm/plugins/list/actions/wrap-and-join-lists.js +168 -0
- package/dist/esm/plugins/list/commands/index.js +33 -34
- package/dist/esm/plugins/list/utils/replace-content.js +21 -0
- package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +3 -3
- package/dist/esm/plugins/media/styles.js +1 -1
- package/dist/esm/plugins/media/utils/media-single.js +12 -1
- package/dist/esm/plugins/paste/handlers.js +19 -5
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +2 -2
- package/dist/esm/plugins/placeholder-text/index.js +44 -1
- package/dist/esm/plugins/placeholder-text/placeholder-text-nodeview.js +67 -20
- package/dist/esm/plugins/placeholder-text/selection-utils.js +9 -0
- package/dist/esm/plugins/placeholder-text/styles.js +2 -1
- package/dist/esm/plugins/table/commands/index.js +1 -1
- package/dist/esm/plugins/table/commands/insert.js +1 -1
- package/dist/esm/plugins/table/commands/misc.js +5 -15
- package/dist/esm/plugins/table/commands-with-analytics.js +1 -1
- package/dist/esm/plugins/table/handlers.js +6 -2
- package/dist/esm/plugins/table/index.js +6 -11
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +2 -2
- package/dist/esm/plugins/table/nodeviews/table.js +6 -37
- package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/main.js +2 -1
- package/dist/esm/plugins/table/pm-plugins/plugin-factory.js +1 -2
- package/dist/esm/plugins/table/pm-plugins/plugin-key.js +2 -0
- package/dist/esm/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +2 -0
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +1 -1
- package/dist/esm/plugins/table/reducer.js +0 -7
- package/dist/esm/plugins/table/toolbar.js +1 -10
- package/dist/esm/plugins/table/transforms/metadata.js +1 -1
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/index.js +2 -1
- package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +1 -1
- package/dist/esm/plugins/table/ui/LayoutButton/index.js +1 -2
- package/dist/esm/plugins/table/ui/common-styles.css.js +10 -6
- package/dist/esm/plugins/table/ui/ui-styles.css.js +20 -11
- package/dist/esm/plugins/table/utils/nodes.js +14 -14
- package/dist/esm/plugins/tasks-and-decisions/commands.js +13 -1
- package/dist/esm/plugins/text-formatting/styles.js +4 -2
- package/dist/esm/plugins/text-formatting/ui/Toolbar/index.js +69 -2
- package/dist/esm/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +30 -0
- package/dist/esm/plugins/text-formatting/utils.js +18 -0
- package/dist/esm/plugins/type-ahead/api.js +30 -2
- package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +16 -4
- package/dist/esm/plugins/type-ahead/utils.js +17 -3
- package/dist/esm/ui/Appearance/Comment/Comment.js +2 -2
- package/dist/esm/ui/Appearance/FullPage/StyledComponents.js +2 -2
- package/dist/esm/ui/ContentStyles/index.js +27 -9
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/insert.js +2 -10
- package/dist/esm/utils/selection.js +1 -6
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/actions/index.d.ts +2 -2
- package/dist/types/extensibility.d.ts +1 -1
- package/dist/types/plugins/analytics/types/list-events.d.ts +0 -1
- package/dist/types/plugins/block-type/styles.d.ts +2 -1
- package/dist/types/plugins/block-type/ui/ToolbarBlockType/index.d.ts +1 -0
- package/dist/types/plugins/block-type/ui/ToolbarBlockType/styled.d.ts +2 -7
- package/dist/types/plugins/card/messages.d.ts +2 -2
- package/dist/types/plugins/card/ui/LinkToolbarButtonGroup.d.ts +18 -2
- package/dist/types/plugins/card/ui/LinkToolbarIconDropdown.d.ts +23 -3
- package/dist/types/plugins/card/ui/ResizableEmbedCard.d.ts +3 -1
- package/dist/types/plugins/card/ui/link-toolbar-button-group-options.d.ts +5 -0
- package/dist/types/plugins/card/ui/link-toolbar-icon-dropdown-options.d.ts +5 -0
- package/dist/types/plugins/card/ui/styled.d.ts +2 -3
- package/dist/types/plugins/card/ui/types.d.ts +12 -0
- package/dist/types/plugins/clipboard/pm-plugins/main.d.ts +10 -1
- package/dist/types/plugins/code-block/styles.d.ts +3 -2
- package/dist/types/plugins/extension/pm-plugins/main.d.ts +2 -1
- package/dist/types/plugins/extension/types.d.ts +1 -0
- package/dist/types/plugins/extension/utils.d.ts +3 -1
- package/dist/types/plugins/find-replace/ui/FindReplace.d.ts +2 -1
- package/dist/types/plugins/find-replace/ui/styles.d.ts +5 -5
- package/dist/types/plugins/layout/styles.d.ts +1 -1
- package/dist/types/plugins/list/actions/wrap-and-join-lists.d.ts +25 -0
- package/dist/types/plugins/list/commands/index.d.ts +0 -1
- package/dist/types/plugins/list/utils/replace-content.d.ts +8 -0
- package/dist/types/plugins/media/nodeviews/mediaNodeUpdater.d.ts +2 -2
- package/dist/types/plugins/media/styles.d.ts +1 -1
- package/dist/types/plugins/media/utils/media-single.d.ts +1 -0
- package/dist/types/plugins/panel/styles.d.ts +1 -1
- package/dist/types/plugins/paste/handlers.d.ts +1 -1
- package/dist/types/plugins/placeholder-text/placeholder-text-nodeview.d.ts +3 -2
- package/dist/types/plugins/placeholder-text/selection-utils.d.ts +2 -0
- package/dist/types/plugins/rule/styles.d.ts +1 -1
- package/dist/types/plugins/table/commands/index.d.ts +1 -1
- package/dist/types/plugins/table/commands/misc.d.ts +0 -1
- package/dist/types/plugins/table/nodeviews/table.d.ts +0 -1
- package/dist/types/plugins/table/pm-plugins/plugin-factory.d.ts +1 -4
- package/dist/types/plugins/table/pm-plugins/plugin-key.d.ts +3 -0
- package/dist/types/plugins/table/types.d.ts +1 -8
- package/dist/types/plugins/table/ui/LayoutButton/index.d.ts +0 -1
- package/dist/types/plugins/table/ui/common-styles.css.d.ts +6 -3
- package/dist/types/plugins/table/ui/ui-styles.css.d.ts +15 -14
- package/dist/types/plugins/table/utils/nodes.d.ts +6 -6
- package/dist/types/plugins/text-formatting/pm-plugins/smart-input-rule.d.ts +1 -1
- package/dist/types/plugins/text-formatting/styles.d.ts +2 -1
- package/dist/types/plugins/text-formatting/ui/Toolbar/toolbar-messages.d.ts +30 -0
- package/dist/types/plugins/text-formatting/utils.d.ts +4 -0
- package/dist/types/plugins/type-ahead/api.d.ts +11 -1
- package/dist/types/plugins/type-ahead/transforms/open-typeahead-at-cursor.d.ts +1 -0
- package/dist/types/plugins/type-ahead/utils.d.ts +4 -0
- package/dist/types/ui/ContentStyles/index.d.ts +1 -0
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/selection.d.ts +0 -1
- package/package.json +28 -26
|
@@ -5,16 +5,175 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.LinkToolbarIconDropdown = exports.ICON_WIDTH = exports.ICON_HEIGHT = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
13
|
|
|
12
14
|
var _react = _interopRequireDefault(require("react"));
|
|
13
15
|
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
var _react2 = require("@emotion/react");
|
|
17
|
+
|
|
18
|
+
var _menu = require("@atlaskit/menu");
|
|
19
|
+
|
|
20
|
+
var _constants = require("@atlaskit/theme/constants");
|
|
21
|
+
|
|
22
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
23
|
+
|
|
24
|
+
var _tokens = require("@atlaskit/tokens");
|
|
25
|
+
|
|
26
|
+
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
27
|
+
|
|
28
|
+
var _Dropdown = _interopRequireDefault(require("../../floating-toolbar/ui/Dropdown"));
|
|
29
|
+
|
|
30
|
+
var _excluded = ["options"];
|
|
31
|
+
var ICON_HEIGHT = 40;
|
|
32
|
+
exports.ICON_HEIGHT = ICON_HEIGHT;
|
|
33
|
+
var ICON_WIDTH = 40;
|
|
34
|
+
exports.ICON_WIDTH = ICON_WIDTH;
|
|
35
|
+
var iconBoxStyles = (0, _react2.css)({
|
|
36
|
+
width: ICON_HEIGHT,
|
|
37
|
+
height: ICON_WIDTH,
|
|
38
|
+
overflow: 'hidden',
|
|
39
|
+
border: '1px solid rgba(223, 225, 229, 0.5)'
|
|
40
|
+
/* N60 at 50% */
|
|
41
|
+
,
|
|
42
|
+
borderRadius: (0, _constants.borderRadius)(),
|
|
43
|
+
boxSizing: 'border-box',
|
|
44
|
+
display: 'flex',
|
|
45
|
+
justifyContent: 'center',
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
backgroundColor: (0, _tokens.token)('color.background.default', 'white')
|
|
48
|
+
});
|
|
49
|
+
var primitiveStyles = (0, _react2.css)({
|
|
50
|
+
padding: '0.75rem',
|
|
51
|
+
alignItems: 'flex-start'
|
|
52
|
+
});
|
|
53
|
+
var interactiveStyles = (0, _react2.css)({
|
|
54
|
+
'&:active': {
|
|
55
|
+
backgroundColor: (0, _tokens.token)('color.background.brand.pressed', _colors.B50),
|
|
56
|
+
color: (0, _tokens.token)('color.text.accent.blue', _colors.B400)
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
var unselectedStyles = (0, _react2.css)({
|
|
60
|
+
'&:hover': {
|
|
61
|
+
backgroundColor: (0, _tokens.token)('color.background.neutral.subtle.hovered', _colors.N20),
|
|
62
|
+
color: (0, _tokens.token)('color.text.brand', 'currentColor')
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
var selectedOptionStyles = (0, _react2.css)({
|
|
66
|
+
backgroundColor: (0, _tokens.token)('color.background.brand.pressed', _colors.B50),
|
|
67
|
+
color: (0, _tokens.token)('color.text.brand', 'currentColor'),
|
|
68
|
+
'&:hover': {
|
|
69
|
+
backgroundColor: (0, _tokens.token)('color.background.brand.pressed', _colors.B50),
|
|
70
|
+
color: (0, _tokens.token)('color.text.brand', 'currentColor')
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
var titleOffsetStyles = (0, _react2.css)({
|
|
74
|
+
marginTop: '0.125rem'
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
var getCustomStyles = function getCustomStyles(selected, disabled) {
|
|
78
|
+
if (disabled) {
|
|
79
|
+
return [primitiveStyles];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (selected) {
|
|
83
|
+
return [primitiveStyles, selectedOptionStyles, interactiveStyles];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return [primitiveStyles, unselectedStyles, interactiveStyles];
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
var OptionRoot = function OptionRoot(props) {
|
|
90
|
+
return (0, _react2.jsx)("div", (0, _extends2.default)({}, props, {
|
|
91
|
+
tabIndex: 0
|
|
92
|
+
}));
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
var Option = function Option(_ref) {
|
|
96
|
+
var title = _ref.title,
|
|
97
|
+
description = _ref.description,
|
|
98
|
+
selected = _ref.selected,
|
|
99
|
+
disabled = _ref.disabled,
|
|
100
|
+
_onClick = _ref.onClick,
|
|
101
|
+
Icon = _ref.icon,
|
|
102
|
+
testId = _ref.testId,
|
|
103
|
+
tooltipContent = _ref.tooltipContent,
|
|
104
|
+
hide = _ref.hide;
|
|
105
|
+
var option = (0, _react2.jsx)(_menu.CustomItem, {
|
|
106
|
+
"aria-label": title,
|
|
107
|
+
component: OptionRoot,
|
|
108
|
+
iconBefore: (0, _react2.jsx)("div", {
|
|
109
|
+
css: iconBoxStyles
|
|
110
|
+
}, (0, _react2.jsx)(Icon, {
|
|
111
|
+
width: 38,
|
|
112
|
+
height: 38,
|
|
113
|
+
label: title
|
|
114
|
+
})),
|
|
115
|
+
css: getCustomStyles(selected, disabled),
|
|
116
|
+
description: description,
|
|
117
|
+
testId: testId,
|
|
118
|
+
onClick: function onClick(event) {
|
|
119
|
+
event.preventDefault();
|
|
120
|
+
|
|
121
|
+
if (!disabled) {
|
|
122
|
+
_onClick();
|
|
123
|
+
|
|
124
|
+
hide();
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
onKeyDown: function onKeyDown(event) {
|
|
128
|
+
if (event.key === 'Enter' || event.key === 'Space') {
|
|
129
|
+
event.preventDefault();
|
|
130
|
+
|
|
131
|
+
if (!disabled) {
|
|
132
|
+
_onClick();
|
|
133
|
+
|
|
134
|
+
hide();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
role: "option",
|
|
139
|
+
"aria-selected": selected,
|
|
140
|
+
isSelected: selected,
|
|
141
|
+
isDisabled: disabled,
|
|
142
|
+
shouldDescriptionWrap: true
|
|
143
|
+
}, (0, _react2.jsx)("div", {
|
|
144
|
+
css: titleOffsetStyles
|
|
145
|
+
}, title));
|
|
146
|
+
|
|
147
|
+
if (tooltipContent) {
|
|
148
|
+
return (0, _react2.jsx)(_tooltip.default, {
|
|
149
|
+
content: tooltipContent
|
|
150
|
+
}, option);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return option;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
var LinkToolbarIconDropdown = function LinkToolbarIconDropdown(_ref2) {
|
|
157
|
+
var options = _ref2.options,
|
|
158
|
+
rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
159
|
+
return (0, _react2.jsx)(_Dropdown.default, (0, _extends2.default)({}, rest, {
|
|
160
|
+
options: {
|
|
161
|
+
render: function render(_ref3) {
|
|
162
|
+
var hide = _ref3.hide;
|
|
163
|
+
return (0, _react2.jsx)(_menu.MenuGroup, null, (0, _react2.jsx)("div", {
|
|
164
|
+
role: "listbox"
|
|
165
|
+
}, (0, _react2.jsx)(_menu.Section, null, options.map(function (props) {
|
|
166
|
+
return (0, _react2.jsx)(Option, (0, _extends2.default)({
|
|
167
|
+
key: props.testId
|
|
168
|
+
}, props, {
|
|
169
|
+
hide: hide
|
|
170
|
+
}));
|
|
171
|
+
}))));
|
|
172
|
+
},
|
|
173
|
+
width: 320,
|
|
174
|
+
height: 200
|
|
175
|
+
}
|
|
176
|
+
}));
|
|
17
177
|
};
|
|
18
178
|
|
|
19
|
-
|
|
20
|
-
exports.default = _default;
|
|
179
|
+
exports.LinkToolbarIconDropdown = LinkToolbarIconDropdown;
|
|
@@ -25,13 +25,15 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
25
25
|
|
|
26
26
|
var _react = _interopRequireDefault(require("react"));
|
|
27
27
|
|
|
28
|
+
var _react2 = require("@emotion/react");
|
|
29
|
+
|
|
28
30
|
var _prosemirrorUtils = require("prosemirror-utils");
|
|
29
31
|
|
|
30
32
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
31
33
|
|
|
32
34
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
33
35
|
|
|
34
|
-
var
|
|
36
|
+
var _smartCard = require("@atlaskit/smart-card");
|
|
35
37
|
|
|
36
38
|
var _styled = require("../../../ui/Resizer/styled");
|
|
37
39
|
|
|
@@ -358,11 +360,11 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
|
|
|
358
360
|
// paddingBottom = (y + 32) / x
|
|
359
361
|
// which can be achieved with css calc() as (1 / (x/y)) * 100)% + 32px
|
|
360
362
|
heightDefiningStyles = {
|
|
361
|
-
paddingBottom: "calc(".concat((1 / aspectRatio * 100).toFixed(3), "% + ").concat(
|
|
363
|
+
paddingBottom: "calc(".concat((1 / aspectRatio * 100).toFixed(3), "% + ").concat(_smartCard.embedHeaderHeight, "px)")
|
|
362
364
|
};
|
|
363
365
|
}
|
|
364
366
|
|
|
365
|
-
return
|
|
367
|
+
return (0, _react2.jsx)("span", {
|
|
366
368
|
"data-testid": 'resizable-embed-card-height-definer',
|
|
367
369
|
style: _objectSpread({
|
|
368
370
|
display: 'block',
|
|
@@ -398,9 +400,10 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
|
|
|
398
400
|
}
|
|
399
401
|
});
|
|
400
402
|
|
|
401
|
-
return
|
|
403
|
+
return (0, _react2.jsx)("div", {
|
|
404
|
+
css: _styled2.embedSpacingStyles,
|
|
402
405
|
"data-testid": "resizable-embed-card-spacing"
|
|
403
|
-
},
|
|
406
|
+
}, (0, _react2.jsx)(_styled.Wrapper, {
|
|
404
407
|
layout: layout,
|
|
405
408
|
isResized: !!pctWidth,
|
|
406
409
|
containerWidth: containerWidth || _editorSharedStyles.DEFAULT_EMBED_CARD_WIDTH,
|
|
@@ -408,7 +411,7 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
|
|
|
408
411
|
return _this2.wrapper = elem;
|
|
409
412
|
},
|
|
410
413
|
fullWidthMode: fullWidthMode
|
|
411
|
-
},
|
|
414
|
+
}, (0, _react2.jsx)(_Resizer.default, (0, _extends2.default)({}, this.props, {
|
|
412
415
|
width: initialWidth // Starting or initial width of embed <iframe> itself.
|
|
413
416
|
,
|
|
414
417
|
enable: enable,
|
|
@@ -24,7 +24,7 @@ var IconCardGlyph = function IconCardGlyph(props) {
|
|
|
24
24
|
fillRule: "evenodd",
|
|
25
25
|
clipRule: "evenodd",
|
|
26
26
|
d: "M8 9c-1.10457 0-2 .89543-2 2v10c0 1.1046.89543 2 2 2h16c1.1046 0 2-.8954 2-2V11c0-1.10457-.8954-2-2-2H8Zm0 3c0-.5523.44772-1 1-1h2c.5523 0 1 .4477 1 1v2c0 .5523-.4477 1-1 1H9c-.55228 0-1-.4477-1-1v-2Zm5 1c0-.2761.2239-.5.5-.5h10c.2761 0 .5.2239.5.5s-.2239.5-.5.5h-10c-.2761 0-.5-.2239-.5-.5Zm-4 3c-.55228 0-1 .4477-1 1s.44772 1 1 1h14c.5523 0 1-.4477 1-1s-.4477-1-1-1H9Zm-1 4c0-.5523.44772-1 1-1h6c.5523 0 1 .4477 1 1s-.4477 1-1 1H9c-.55228 0-1-.4477-1-1Z",
|
|
27
|
-
fill: "
|
|
27
|
+
fill: "currentColor"
|
|
28
28
|
}));
|
|
29
29
|
};
|
|
30
30
|
|
|
@@ -24,7 +24,7 @@ var IconEmbedGlyph = function IconEmbedGlyph(props) {
|
|
|
24
24
|
fillRule: "evenodd",
|
|
25
25
|
clipRule: "evenodd",
|
|
26
26
|
d: "M8 6c-1.10457 0-2 .89543-2 2v16c0 1.1046.89543 2 2 2h16c1.1046 0 2-.8954 2-2V8c0-1.10457-.8954-2-2-2H8Zm1 2c-.55228 0-1 .44772-1 1v2c0 .5523.44772 1 1 1h2c.5523 0 1-.4477 1-1V9c0-.55228-.4477-1-1-1H9Zm4.5 1.5c-.2761 0-.5.22386-.5.5 0 .2761.2239.5.5.5h10c.2761 0 .5-.2239.5-.5 0-.27614-.2239-.5-.5-.5h-10ZM9 14c-.55228 0-1 .4477-1 1v8c0 .5523.44772 1 1 1h14c.5523 0 1-.4477 1-1v-8c0-.5523-.4477-1-1-1H9Zm6 2.5c0 .8284-.6716 1.5-1.5 1.5s-1.5-.6716-1.5-1.5.6716-1.5 1.5-1.5 1.5.6716 1.5 1.5Zm0 5.5-1-1-2 2h8v-1.8L18 19l-3 3Z",
|
|
27
|
-
fill: "
|
|
27
|
+
fill: "currentColor"
|
|
28
28
|
}));
|
|
29
29
|
};
|
|
30
30
|
|
|
@@ -24,7 +24,7 @@ var IconInlineGlyph = function IconInlineGlyph(props) {
|
|
|
24
24
|
fillRule: "evenodd",
|
|
25
25
|
clipRule: "evenodd",
|
|
26
26
|
d: "M8 12c-1.10457 0-2 .8954-2 2v4c0 1.1046.89543 2 2 2h16c1.1046 0 2-.8954 2-2v-4c0-1.1046-.8954-2-2-2H8Zm0 3c0-.5523.44772-1 1-1h2c.5523 0 1 .4477 1 1v2c0 .5523-.4477 1-1 1H9c-.55228 0-1-.4477-1-1v-2Zm5 1c0-.2761.2239-.5.5-.5h10c.2761 0 .5.2239.5.5s-.2239.5-.5.5h-10c-.2761 0-.5-.2239-.5-.5Z",
|
|
27
|
-
fill: "
|
|
27
|
+
fill: "currentColor"
|
|
28
28
|
}));
|
|
29
29
|
};
|
|
30
30
|
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getButtonGroupOption = void 0;
|
|
7
|
+
|
|
8
|
+
var _messages = require("../messages");
|
|
9
|
+
|
|
10
|
+
var _card = require("./assets/card");
|
|
11
|
+
|
|
12
|
+
var _embed = require("./assets/embed");
|
|
13
|
+
|
|
14
|
+
var _inline = require("./assets/inline");
|
|
15
|
+
|
|
16
|
+
var _url = require("./assets/url");
|
|
17
|
+
|
|
18
|
+
var appearancePropsMap = {
|
|
19
|
+
url: {
|
|
20
|
+
title: _messages.messages.urlTitle,
|
|
21
|
+
icon: _url.IconUrl
|
|
22
|
+
},
|
|
23
|
+
inline: {
|
|
24
|
+
title: _messages.messages.inlineTitle,
|
|
25
|
+
icon: _inline.IconInline
|
|
26
|
+
},
|
|
27
|
+
block: {
|
|
28
|
+
title: _messages.messages.blockTitle,
|
|
29
|
+
icon: _card.IconCard
|
|
30
|
+
},
|
|
31
|
+
embed: {
|
|
32
|
+
title: _messages.messages.embedTitle,
|
|
33
|
+
icon: _embed.IconEmbed
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
var getButtonGroupOption = function getButtonGroupOption(intl, dispatchCommand, _ref) {
|
|
38
|
+
var disabled = _ref.disabled,
|
|
39
|
+
_onClick = _ref.onClick,
|
|
40
|
+
selected = _ref.selected,
|
|
41
|
+
appearance = _ref.appearance,
|
|
42
|
+
testId = _ref.testId,
|
|
43
|
+
tooltip = _ref.tooltip;
|
|
44
|
+
var _appearancePropsMap = appearancePropsMap[appearance !== null && appearance !== void 0 ? appearance : 'url'],
|
|
45
|
+
title = _appearancePropsMap.title,
|
|
46
|
+
icon = _appearancePropsMap.icon;
|
|
47
|
+
return {
|
|
48
|
+
title: intl.formatMessage(title),
|
|
49
|
+
icon: icon,
|
|
50
|
+
onClick: function onClick() {
|
|
51
|
+
return dispatchCommand(_onClick);
|
|
52
|
+
},
|
|
53
|
+
disabled: Boolean(disabled),
|
|
54
|
+
tooltipContent: tooltip || null,
|
|
55
|
+
testId: testId,
|
|
56
|
+
selected: selected
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
exports.getButtonGroupOption = getButtonGroupOption;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getIconDropdownOption = void 0;
|
|
7
|
+
|
|
8
|
+
var _messages = require("../messages");
|
|
9
|
+
|
|
10
|
+
var _card = require("./assets/card");
|
|
11
|
+
|
|
12
|
+
var _embed = require("./assets/embed");
|
|
13
|
+
|
|
14
|
+
var _inline = require("./assets/inline");
|
|
15
|
+
|
|
16
|
+
var _url = require("./assets/url");
|
|
17
|
+
|
|
18
|
+
var appearancePropsMap = {
|
|
19
|
+
url: {
|
|
20
|
+
title: _messages.messages.urlTitle,
|
|
21
|
+
description: _messages.messages.urlDescription,
|
|
22
|
+
icon: _url.IconUrl
|
|
23
|
+
},
|
|
24
|
+
inline: {
|
|
25
|
+
title: _messages.messages.inlineTitle,
|
|
26
|
+
description: _messages.messages.inlineDescription,
|
|
27
|
+
icon: _inline.IconInline
|
|
28
|
+
},
|
|
29
|
+
block: {
|
|
30
|
+
title: _messages.messages.blockTitle,
|
|
31
|
+
description: _messages.messages.blockDescription,
|
|
32
|
+
icon: _card.IconCard
|
|
33
|
+
},
|
|
34
|
+
embed: {
|
|
35
|
+
title: _messages.messages.embedTitle,
|
|
36
|
+
description: _messages.messages.embedDescription,
|
|
37
|
+
icon: _embed.IconEmbed
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
var getIconDropdownOption = function getIconDropdownOption(intl, dispatchCommand, _ref) {
|
|
42
|
+
var disabled = _ref.disabled,
|
|
43
|
+
_onClick = _ref.onClick,
|
|
44
|
+
selected = _ref.selected,
|
|
45
|
+
appearance = _ref.appearance,
|
|
46
|
+
testId = _ref.testId,
|
|
47
|
+
tooltip = _ref.tooltip;
|
|
48
|
+
var _appearancePropsMap = appearancePropsMap[appearance !== null && appearance !== void 0 ? appearance : 'url'],
|
|
49
|
+
title = _appearancePropsMap.title,
|
|
50
|
+
description = _appearancePropsMap.description,
|
|
51
|
+
icon = _appearancePropsMap.icon;
|
|
52
|
+
return {
|
|
53
|
+
title: intl.formatMessage(title),
|
|
54
|
+
description: intl.formatMessage(description),
|
|
55
|
+
icon: icon,
|
|
56
|
+
onClick: function onClick() {
|
|
57
|
+
return dispatchCommand(_onClick);
|
|
58
|
+
},
|
|
59
|
+
selected: Boolean(selected),
|
|
60
|
+
disabled: Boolean(disabled),
|
|
61
|
+
tooltipContent: tooltip,
|
|
62
|
+
testId: testId
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
exports.getIconDropdownOption = getIconDropdownOption;
|
|
@@ -2,26 +2,18 @@
|
|
|
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
|
});
|
|
10
|
-
exports.
|
|
8
|
+
exports.embedSpacingStyles = exports.embedCardStyles = void 0;
|
|
11
9
|
|
|
12
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
11
|
|
|
14
|
-
var
|
|
12
|
+
var _react = require("@emotion/react");
|
|
15
13
|
|
|
16
14
|
var _templateObject, _templateObject2;
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
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; }
|
|
21
|
-
|
|
22
|
-
var embedCardStyles = (0, _styledComponents.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n .embedCardView-content-wrap[layout^='wrap-'] {\n max-width: 100%;\n }\n\n .embedCardView-content-wrap[layout='wrap-left'] {\n float: left;\n }\n\n .embedCardView-content-wrap[layout='wrap-right'] {\n float: right;\n }\n\n .embedCardView-content-wrap[layout='wrap-right']\n + .embedCardView-content-wrap[layout='wrap-left'] {\n clear: both;\n }\n }\n"])));
|
|
16
|
+
var embedCardStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n .embedCardView-content-wrap[layout^='wrap-'] {\n max-width: 100%;\n }\n\n .embedCardView-content-wrap[layout='wrap-left'] {\n float: left;\n }\n\n .embedCardView-content-wrap[layout='wrap-right'] {\n float: right;\n }\n\n .embedCardView-content-wrap[layout='wrap-right']\n + .embedCardView-content-wrap[layout='wrap-left'] {\n clear: both;\n }\n }\n"])));
|
|
23
17
|
exports.embedCardStyles = embedCardStyles;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
exports.EmbedSpacing = EmbedSpacing;
|
|
18
|
+
var embedSpacingStyles = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n margin: 0 10px;\n"])));
|
|
19
|
+
exports.embedSpacingStyles = embedSpacingStyles;
|
|
@@ -5,10 +5,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.sendClipboardAnalytics = exports.createPlugin = void 0;
|
|
8
|
+
exports.sendClipboardAnalytics = exports.createPlugin = exports.createClipboardSerializer = void 0;
|
|
9
9
|
|
|
10
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
11
|
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
12
14
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
13
15
|
|
|
14
16
|
var _prosemirrorState = require("prosemirror-state");
|
|
@@ -19,10 +21,33 @@ var _utils = require("../../selection/utils");
|
|
|
19
21
|
|
|
20
22
|
var _enums = require("../../analytics/types/enums");
|
|
21
23
|
|
|
24
|
+
var _prosemirrorModel = require("prosemirror-model");
|
|
25
|
+
|
|
26
|
+
var _prosemirrorUtils = require("prosemirror-utils");
|
|
27
|
+
|
|
28
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
29
|
+
|
|
30
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
31
|
+
|
|
22
32
|
var createPlugin = function createPlugin(_ref) {
|
|
23
|
-
var dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent
|
|
33
|
+
var dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
|
|
34
|
+
schema = _ref.schema;
|
|
35
|
+
var editorView;
|
|
36
|
+
|
|
37
|
+
var getEditorView = function getEditorView() {
|
|
38
|
+
return editorView;
|
|
39
|
+
};
|
|
40
|
+
|
|
24
41
|
return new _safePlugin.SafePlugin({
|
|
25
42
|
key: _pluginKey.clipboardPluginKey,
|
|
43
|
+
view: function view(_view) {
|
|
44
|
+
editorView = _view;
|
|
45
|
+
return {
|
|
46
|
+
update: function update(view) {
|
|
47
|
+
editorView = view;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
},
|
|
26
51
|
props: {
|
|
27
52
|
handleDOMEvents: {
|
|
28
53
|
cut: function cut(view) {
|
|
@@ -31,13 +56,84 @@ var createPlugin = function createPlugin(_ref) {
|
|
|
31
56
|
copy: function copy(view) {
|
|
32
57
|
return sendClipboardAnalytics(view, dispatchAnalyticsEvent, _enums.ACTION.COPIED);
|
|
33
58
|
}
|
|
34
|
-
}
|
|
59
|
+
},
|
|
60
|
+
clipboardSerializer: createClipboardSerializer(schema, getEditorView)
|
|
35
61
|
}
|
|
36
62
|
});
|
|
37
63
|
};
|
|
64
|
+
/**
|
|
65
|
+
* Overrides Prosemirror's default clipboardSerializer, in order to fix table row copy/paste bug raised in ED-13003.
|
|
66
|
+
* This allows us to store the original table’s attributes on the new table that the row is wrapped with when it is being copied.
|
|
67
|
+
* e.g. keeping the layout on a row that is copied.
|
|
68
|
+
* We store the default serializer in order to call it after we handle the table row case.
|
|
69
|
+
*/
|
|
70
|
+
|
|
38
71
|
|
|
39
72
|
exports.createPlugin = createPlugin;
|
|
40
73
|
|
|
74
|
+
var createClipboardSerializer = function createClipboardSerializer(schema, getEditorView) {
|
|
75
|
+
var oldSerializer = _prosemirrorModel.DOMSerializer.fromSchema(schema);
|
|
76
|
+
|
|
77
|
+
var newSerializer = new _prosemirrorModel.DOMSerializer(oldSerializer.nodes, oldSerializer.marks);
|
|
78
|
+
var originalSerializeFragment = newSerializer.serializeFragment.bind(newSerializer);
|
|
79
|
+
|
|
80
|
+
newSerializer.serializeFragment = function (content) {
|
|
81
|
+
var _content$firstChild;
|
|
82
|
+
|
|
83
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
84
|
+
var target = arguments.length > 2 ? arguments[2] : undefined;
|
|
85
|
+
var editorView = getEditorView();
|
|
86
|
+
var selection = editorView.state.selection; // We do not need to handle when a user copies a tableRow + other content.
|
|
87
|
+
// In that scenario it already wraps the Row with correct Table and attributes.
|
|
88
|
+
|
|
89
|
+
if (!options.tableWrapperExists) {
|
|
90
|
+
var i = 0;
|
|
91
|
+
|
|
92
|
+
while (i < content.childCount) {
|
|
93
|
+
var _content$maybeChild;
|
|
94
|
+
|
|
95
|
+
if (((_content$maybeChild = content.maybeChild(i)) === null || _content$maybeChild === void 0 ? void 0 : _content$maybeChild.type.name) === 'table') {
|
|
96
|
+
options.tableWrapperExists = true;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
i++;
|
|
101
|
+
}
|
|
102
|
+
} // When the content being copied includes a tableRow that is not already wrapped with a table,
|
|
103
|
+
// We will wrap it with one ourselves, while preserving the parent table's attributes.
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
if (((_content$firstChild = content.firstChild) === null || _content$firstChild === void 0 ? void 0 : _content$firstChild.type.name) === 'tableRow' && !options.tableWrapperExists) {
|
|
107
|
+
// We only want 1 table wrapping the rows.
|
|
108
|
+
// tableWrapperExist is a custom prop added solely for the purposes of this recursive algorithm.
|
|
109
|
+
// The function is recursively called for each node in the tree captured in the fragment.
|
|
110
|
+
// For recursive logic see the bind call above and the prosemirror-model (https://github.com/ProseMirror/prosemirror-model/blob/master/src/to_dom.js#L44
|
|
111
|
+
// and https://github.com/ProseMirror/prosemirror-model/blob/master/src/to_dom.js#L87)
|
|
112
|
+
options.tableWrapperExists = true;
|
|
113
|
+
var parentTable = (0, _prosemirrorUtils.findParentNodeOfType)(schema.nodes.table)(selection);
|
|
114
|
+
var attributes = parentTable === null || parentTable === void 0 ? void 0 : parentTable.node.attrs;
|
|
115
|
+
var newTable = schema.nodes.table;
|
|
116
|
+
var newTableNode = newTable.createChecked(_objectSpread({}, attributes), content);
|
|
117
|
+
|
|
118
|
+
var newContent = _prosemirrorModel.Fragment.from(newTableNode); // Pass updated content into original ProseMirror serializeFragment function.
|
|
119
|
+
// Currently incorrectly typed in @Types. See this GitHub thread: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/57668
|
|
120
|
+
//@ts-ignore
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
return originalSerializeFragment(newContent, options, target);
|
|
124
|
+
} // If we're not copying any rows, just run default serializeFragment function.
|
|
125
|
+
// Currently incorrectly typed in @Types. See this GitHub thread: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/57668
|
|
126
|
+
//@ts-ignore
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
return originalSerializeFragment(content, options, target);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
return newSerializer;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
exports.createClipboardSerializer = createClipboardSerializer;
|
|
136
|
+
|
|
41
137
|
var sendClipboardAnalytics = function sendClipboardAnalytics(view, dispatchAnalyticsEvent, action) {
|
|
42
138
|
var clipboardAnalyticsPayload = getAnalyticsPayload(view.state, action);
|
|
43
139
|
|