@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
|
@@ -1,10 +1,159 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
var _excluded = ["options"];
|
|
4
|
+
|
|
5
|
+
/** @jsx jsx */
|
|
2
6
|
import React from 'react';
|
|
7
|
+
import { css, jsx } from '@emotion/react';
|
|
8
|
+
import { MenuGroup, Section, CustomItem } from '@atlaskit/menu';
|
|
9
|
+
import { borderRadius } from '@atlaskit/theme/constants';
|
|
10
|
+
import { B50, N20, B400 } from '@atlaskit/theme/colors';
|
|
11
|
+
import { token } from '@atlaskit/tokens';
|
|
12
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
13
|
+
import Dropdown from '../../floating-toolbar/ui/Dropdown';
|
|
14
|
+
export var ICON_HEIGHT = 40;
|
|
15
|
+
export var ICON_WIDTH = 40;
|
|
16
|
+
var iconBoxStyles = css({
|
|
17
|
+
width: ICON_HEIGHT,
|
|
18
|
+
height: ICON_WIDTH,
|
|
19
|
+
overflow: 'hidden',
|
|
20
|
+
border: '1px solid rgba(223, 225, 229, 0.5)'
|
|
21
|
+
/* N60 at 50% */
|
|
22
|
+
,
|
|
23
|
+
borderRadius: borderRadius(),
|
|
24
|
+
boxSizing: 'border-box',
|
|
25
|
+
display: 'flex',
|
|
26
|
+
justifyContent: 'center',
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
backgroundColor: token('color.background.default', 'white')
|
|
29
|
+
});
|
|
30
|
+
var primitiveStyles = css({
|
|
31
|
+
padding: '0.75rem',
|
|
32
|
+
alignItems: 'flex-start'
|
|
33
|
+
});
|
|
34
|
+
var interactiveStyles = css({
|
|
35
|
+
'&:active': {
|
|
36
|
+
backgroundColor: token('color.background.brand.pressed', B50),
|
|
37
|
+
color: token('color.text.accent.blue', B400)
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
var unselectedStyles = css({
|
|
41
|
+
'&:hover': {
|
|
42
|
+
backgroundColor: token('color.background.neutral.subtle.hovered', N20),
|
|
43
|
+
color: token('color.text.brand', 'currentColor')
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
var selectedOptionStyles = css({
|
|
47
|
+
backgroundColor: token('color.background.brand.pressed', B50),
|
|
48
|
+
color: token('color.text.brand', 'currentColor'),
|
|
49
|
+
'&:hover': {
|
|
50
|
+
backgroundColor: token('color.background.brand.pressed', B50),
|
|
51
|
+
color: token('color.text.brand', 'currentColor')
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
var titleOffsetStyles = css({
|
|
55
|
+
marginTop: '0.125rem'
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
var getCustomStyles = function getCustomStyles(selected, disabled) {
|
|
59
|
+
if (disabled) {
|
|
60
|
+
return [primitiveStyles];
|
|
61
|
+
}
|
|
3
62
|
|
|
4
|
-
|
|
5
|
-
|
|
63
|
+
if (selected) {
|
|
64
|
+
return [primitiveStyles, selectedOptionStyles, interactiveStyles];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return [primitiveStyles, unselectedStyles, interactiveStyles];
|
|
68
|
+
};
|
|
6
69
|
|
|
7
|
-
|
|
70
|
+
var OptionRoot = function OptionRoot(props) {
|
|
71
|
+
return jsx("div", _extends({}, props, {
|
|
72
|
+
tabIndex: 0
|
|
73
|
+
}));
|
|
8
74
|
};
|
|
9
75
|
|
|
10
|
-
|
|
76
|
+
var Option = function Option(_ref) {
|
|
77
|
+
var title = _ref.title,
|
|
78
|
+
description = _ref.description,
|
|
79
|
+
selected = _ref.selected,
|
|
80
|
+
disabled = _ref.disabled,
|
|
81
|
+
_onClick = _ref.onClick,
|
|
82
|
+
Icon = _ref.icon,
|
|
83
|
+
testId = _ref.testId,
|
|
84
|
+
tooltipContent = _ref.tooltipContent,
|
|
85
|
+
hide = _ref.hide;
|
|
86
|
+
var option = jsx(CustomItem, {
|
|
87
|
+
"aria-label": title,
|
|
88
|
+
component: OptionRoot,
|
|
89
|
+
iconBefore: jsx("div", {
|
|
90
|
+
css: iconBoxStyles
|
|
91
|
+
}, jsx(Icon, {
|
|
92
|
+
width: 38,
|
|
93
|
+
height: 38,
|
|
94
|
+
label: title
|
|
95
|
+
})),
|
|
96
|
+
css: getCustomStyles(selected, disabled),
|
|
97
|
+
description: description,
|
|
98
|
+
testId: testId,
|
|
99
|
+
onClick: function onClick(event) {
|
|
100
|
+
event.preventDefault();
|
|
101
|
+
|
|
102
|
+
if (!disabled) {
|
|
103
|
+
_onClick();
|
|
104
|
+
|
|
105
|
+
hide();
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
onKeyDown: function onKeyDown(event) {
|
|
109
|
+
if (event.key === 'Enter' || event.key === 'Space') {
|
|
110
|
+
event.preventDefault();
|
|
111
|
+
|
|
112
|
+
if (!disabled) {
|
|
113
|
+
_onClick();
|
|
114
|
+
|
|
115
|
+
hide();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
role: "option",
|
|
120
|
+
"aria-selected": selected,
|
|
121
|
+
isSelected: selected,
|
|
122
|
+
isDisabled: disabled,
|
|
123
|
+
shouldDescriptionWrap: true
|
|
124
|
+
}, jsx("div", {
|
|
125
|
+
css: titleOffsetStyles
|
|
126
|
+
}, title));
|
|
127
|
+
|
|
128
|
+
if (tooltipContent) {
|
|
129
|
+
return jsx(Tooltip, {
|
|
130
|
+
content: tooltipContent
|
|
131
|
+
}, option);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return option;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export var LinkToolbarIconDropdown = function LinkToolbarIconDropdown(_ref2) {
|
|
138
|
+
var options = _ref2.options,
|
|
139
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
140
|
+
|
|
141
|
+
return jsx(Dropdown, _extends({}, rest, {
|
|
142
|
+
options: {
|
|
143
|
+
render: function render(_ref3) {
|
|
144
|
+
var hide = _ref3.hide;
|
|
145
|
+
return jsx(MenuGroup, null, jsx("div", {
|
|
146
|
+
role: "listbox"
|
|
147
|
+
}, jsx(Section, null, options.map(function (props) {
|
|
148
|
+
return jsx(Option, _extends({
|
|
149
|
+
key: props.testId
|
|
150
|
+
}, props, {
|
|
151
|
+
hide: hide
|
|
152
|
+
}));
|
|
153
|
+
}))));
|
|
154
|
+
},
|
|
155
|
+
width: 320,
|
|
156
|
+
height: 200
|
|
157
|
+
}
|
|
158
|
+
}));
|
|
159
|
+
};
|
|
@@ -15,16 +15,18 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
15
15
|
|
|
16
16
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
17
17
|
|
|
18
|
+
/** @jsx jsx */
|
|
18
19
|
import React from 'react';
|
|
20
|
+
import { jsx } from '@emotion/react';
|
|
19
21
|
import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from 'prosemirror-utils';
|
|
20
22
|
import { calcColumnsFromPx, calcPctFromPx, calcPxFromColumns, wrappedLayouts } from '@atlaskit/editor-common/ui';
|
|
21
23
|
import { akEditorMediaResizeHandlerPaddingWide, akEditorBreakoutPadding, akEditorWideLayoutWidth, breakoutWideScaleRatio, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
22
|
-
import { embedHeaderHeight } from '@atlaskit/
|
|
24
|
+
import { embedHeaderHeight } from '@atlaskit/smart-card';
|
|
23
25
|
import { Wrapper } from '../../../ui/Resizer/styled';
|
|
24
26
|
import Resizer from '../../../ui/Resizer';
|
|
25
27
|
import { handleSides, imageAlignmentMap, snapTo } from '../../../ui/Resizer/utils';
|
|
26
28
|
import { calcMediaPxWidth } from '../../../plugins/media/utils/media-single';
|
|
27
|
-
import {
|
|
29
|
+
import { embedSpacingStyles } from './styled';
|
|
28
30
|
|
|
29
31
|
var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
|
|
30
32
|
_inherits(ResizableEmbedCard, _React$Component);
|
|
@@ -344,7 +346,7 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
|
|
|
344
346
|
};
|
|
345
347
|
}
|
|
346
348
|
|
|
347
|
-
return
|
|
349
|
+
return jsx("span", {
|
|
348
350
|
"data-testid": 'resizable-embed-card-height-definer',
|
|
349
351
|
style: _objectSpread({
|
|
350
352
|
display: 'block',
|
|
@@ -376,9 +378,10 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
|
|
|
376
378
|
enable[side] = false;
|
|
377
379
|
}
|
|
378
380
|
});
|
|
379
|
-
return
|
|
381
|
+
return jsx("div", {
|
|
382
|
+
css: embedSpacingStyles,
|
|
380
383
|
"data-testid": "resizable-embed-card-spacing"
|
|
381
|
-
},
|
|
384
|
+
}, jsx(Wrapper, {
|
|
382
385
|
layout: layout,
|
|
383
386
|
isResized: !!pctWidth,
|
|
384
387
|
containerWidth: containerWidth || DEFAULT_EMBED_CARD_WIDTH,
|
|
@@ -386,7 +389,7 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
|
|
|
386
389
|
return _this2.wrapper = elem;
|
|
387
390
|
},
|
|
388
391
|
fullWidthMode: fullWidthMode
|
|
389
|
-
},
|
|
392
|
+
}, jsx(Resizer, _extends({}, this.props, {
|
|
390
393
|
width: initialWidth // Starting or initial width of embed <iframe> itself.
|
|
391
394
|
,
|
|
392
395
|
enable: enable,
|
|
@@ -13,7 +13,7 @@ var IconCardGlyph = function IconCardGlyph(props) {
|
|
|
13
13
|
fillRule: "evenodd",
|
|
14
14
|
clipRule: "evenodd",
|
|
15
15
|
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",
|
|
16
|
-
fill: "
|
|
16
|
+
fill: "currentColor"
|
|
17
17
|
}));
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -13,7 +13,7 @@ var IconEmbedGlyph = function IconEmbedGlyph(props) {
|
|
|
13
13
|
fillRule: "evenodd",
|
|
14
14
|
clipRule: "evenodd",
|
|
15
15
|
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",
|
|
16
|
-
fill: "
|
|
16
|
+
fill: "currentColor"
|
|
17
17
|
}));
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -13,7 +13,7 @@ var IconInlineGlyph = function IconInlineGlyph(props) {
|
|
|
13
13
|
fillRule: "evenodd",
|
|
14
14
|
clipRule: "evenodd",
|
|
15
15
|
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",
|
|
16
|
-
fill: "
|
|
16
|
+
fill: "currentColor"
|
|
17
17
|
}));
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { messages } from '../messages';
|
|
2
|
+
import { IconCard } from './assets/card';
|
|
3
|
+
import { IconEmbed } from './assets/embed';
|
|
4
|
+
import { IconInline } from './assets/inline';
|
|
5
|
+
import { IconUrl } from './assets/url';
|
|
6
|
+
var appearancePropsMap = {
|
|
7
|
+
url: {
|
|
8
|
+
title: messages.urlTitle,
|
|
9
|
+
icon: IconUrl
|
|
10
|
+
},
|
|
11
|
+
inline: {
|
|
12
|
+
title: messages.inlineTitle,
|
|
13
|
+
icon: IconInline
|
|
14
|
+
},
|
|
15
|
+
block: {
|
|
16
|
+
title: messages.blockTitle,
|
|
17
|
+
icon: IconCard
|
|
18
|
+
},
|
|
19
|
+
embed: {
|
|
20
|
+
title: messages.embedTitle,
|
|
21
|
+
icon: IconEmbed
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
export var getButtonGroupOption = function getButtonGroupOption(intl, dispatchCommand, _ref) {
|
|
25
|
+
var disabled = _ref.disabled,
|
|
26
|
+
_onClick = _ref.onClick,
|
|
27
|
+
selected = _ref.selected,
|
|
28
|
+
appearance = _ref.appearance,
|
|
29
|
+
testId = _ref.testId,
|
|
30
|
+
tooltip = _ref.tooltip;
|
|
31
|
+
var _appearancePropsMap = appearancePropsMap[appearance !== null && appearance !== void 0 ? appearance : 'url'],
|
|
32
|
+
title = _appearancePropsMap.title,
|
|
33
|
+
icon = _appearancePropsMap.icon;
|
|
34
|
+
return {
|
|
35
|
+
title: intl.formatMessage(title),
|
|
36
|
+
icon: icon,
|
|
37
|
+
onClick: function onClick() {
|
|
38
|
+
return dispatchCommand(_onClick);
|
|
39
|
+
},
|
|
40
|
+
disabled: Boolean(disabled),
|
|
41
|
+
tooltipContent: tooltip || null,
|
|
42
|
+
testId: testId,
|
|
43
|
+
selected: selected
|
|
44
|
+
};
|
|
45
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { messages } from '../messages';
|
|
2
|
+
import { IconCard } from './assets/card';
|
|
3
|
+
import { IconEmbed } from './assets/embed';
|
|
4
|
+
import { IconInline } from './assets/inline';
|
|
5
|
+
import { IconUrl } from './assets/url';
|
|
6
|
+
var appearancePropsMap = {
|
|
7
|
+
url: {
|
|
8
|
+
title: messages.urlTitle,
|
|
9
|
+
description: messages.urlDescription,
|
|
10
|
+
icon: IconUrl
|
|
11
|
+
},
|
|
12
|
+
inline: {
|
|
13
|
+
title: messages.inlineTitle,
|
|
14
|
+
description: messages.inlineDescription,
|
|
15
|
+
icon: IconInline
|
|
16
|
+
},
|
|
17
|
+
block: {
|
|
18
|
+
title: messages.blockTitle,
|
|
19
|
+
description: messages.blockDescription,
|
|
20
|
+
icon: IconCard
|
|
21
|
+
},
|
|
22
|
+
embed: {
|
|
23
|
+
title: messages.embedTitle,
|
|
24
|
+
description: messages.embedDescription,
|
|
25
|
+
icon: IconEmbed
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
export var getIconDropdownOption = function getIconDropdownOption(intl, dispatchCommand, _ref) {
|
|
29
|
+
var disabled = _ref.disabled,
|
|
30
|
+
_onClick = _ref.onClick,
|
|
31
|
+
selected = _ref.selected,
|
|
32
|
+
appearance = _ref.appearance,
|
|
33
|
+
testId = _ref.testId,
|
|
34
|
+
tooltip = _ref.tooltip;
|
|
35
|
+
var _appearancePropsMap = appearancePropsMap[appearance !== null && appearance !== void 0 ? appearance : 'url'],
|
|
36
|
+
title = _appearancePropsMap.title,
|
|
37
|
+
description = _appearancePropsMap.description,
|
|
38
|
+
icon = _appearancePropsMap.icon;
|
|
39
|
+
return {
|
|
40
|
+
title: intl.formatMessage(title),
|
|
41
|
+
description: intl.formatMessage(description),
|
|
42
|
+
icon: icon,
|
|
43
|
+
onClick: function onClick() {
|
|
44
|
+
return dispatchCommand(_onClick);
|
|
45
|
+
},
|
|
46
|
+
selected: Boolean(selected),
|
|
47
|
+
disabled: Boolean(disabled),
|
|
48
|
+
tooltipContent: tooltip,
|
|
49
|
+
testId: testId
|
|
50
|
+
};
|
|
51
|
+
};
|
|
@@ -2,6 +2,6 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
2
2
|
|
|
3
3
|
var _templateObject, _templateObject2;
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import { css } from '@emotion/react';
|
|
6
6
|
export var embedCardStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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"])));
|
|
7
|
-
export var
|
|
7
|
+
export var embedSpacingStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin: 0 10px;\n"])));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,13 +1,37 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
|
|
4
|
+
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; }
|
|
5
|
+
|
|
6
|
+
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) { _defineProperty(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; }
|
|
7
|
+
|
|
2
8
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
9
|
import { TextSelection } from 'prosemirror-state';
|
|
4
10
|
import { clipboardPluginKey } from '../plugin-key';
|
|
5
11
|
import { getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload } from '../../selection/utils';
|
|
6
12
|
import { EVENT_TYPE, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../../analytics/types/enums';
|
|
13
|
+
import { DOMSerializer } from 'prosemirror-model';
|
|
14
|
+
import { findParentNodeOfType } from 'prosemirror-utils';
|
|
15
|
+
import { Fragment } from 'prosemirror-model';
|
|
7
16
|
export var createPlugin = function createPlugin(_ref) {
|
|
8
|
-
var dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent
|
|
17
|
+
var dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
|
|
18
|
+
schema = _ref.schema;
|
|
19
|
+
var editorView;
|
|
20
|
+
|
|
21
|
+
var getEditorView = function getEditorView() {
|
|
22
|
+
return editorView;
|
|
23
|
+
};
|
|
24
|
+
|
|
9
25
|
return new SafePlugin({
|
|
10
26
|
key: clipboardPluginKey,
|
|
27
|
+
view: function view(_view) {
|
|
28
|
+
editorView = _view;
|
|
29
|
+
return {
|
|
30
|
+
update: function update(view) {
|
|
31
|
+
editorView = view;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
},
|
|
11
35
|
props: {
|
|
12
36
|
handleDOMEvents: {
|
|
13
37
|
cut: function cut(view) {
|
|
@@ -16,10 +40,75 @@ export var createPlugin = function createPlugin(_ref) {
|
|
|
16
40
|
copy: function copy(view) {
|
|
17
41
|
return sendClipboardAnalytics(view, dispatchAnalyticsEvent, ACTION.COPIED);
|
|
18
42
|
}
|
|
19
|
-
}
|
|
43
|
+
},
|
|
44
|
+
clipboardSerializer: createClipboardSerializer(schema, getEditorView)
|
|
20
45
|
}
|
|
21
46
|
});
|
|
22
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* Overrides Prosemirror's default clipboardSerializer, in order to fix table row copy/paste bug raised in ED-13003.
|
|
50
|
+
* 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.
|
|
51
|
+
* e.g. keeping the layout on a row that is copied.
|
|
52
|
+
* We store the default serializer in order to call it after we handle the table row case.
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
export var createClipboardSerializer = function createClipboardSerializer(schema, getEditorView) {
|
|
56
|
+
var oldSerializer = DOMSerializer.fromSchema(schema);
|
|
57
|
+
var newSerializer = new DOMSerializer(oldSerializer.nodes, oldSerializer.marks);
|
|
58
|
+
var originalSerializeFragment = newSerializer.serializeFragment.bind(newSerializer);
|
|
59
|
+
|
|
60
|
+
newSerializer.serializeFragment = function (content) {
|
|
61
|
+
var _content$firstChild;
|
|
62
|
+
|
|
63
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
64
|
+
var target = arguments.length > 2 ? arguments[2] : undefined;
|
|
65
|
+
var editorView = getEditorView();
|
|
66
|
+
var selection = editorView.state.selection; // We do not need to handle when a user copies a tableRow + other content.
|
|
67
|
+
// In that scenario it already wraps the Row with correct Table and attributes.
|
|
68
|
+
|
|
69
|
+
if (!options.tableWrapperExists) {
|
|
70
|
+
var i = 0;
|
|
71
|
+
|
|
72
|
+
while (i < content.childCount) {
|
|
73
|
+
var _content$maybeChild;
|
|
74
|
+
|
|
75
|
+
if (((_content$maybeChild = content.maybeChild(i)) === null || _content$maybeChild === void 0 ? void 0 : _content$maybeChild.type.name) === 'table') {
|
|
76
|
+
options.tableWrapperExists = true;
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
i++;
|
|
81
|
+
}
|
|
82
|
+
} // When the content being copied includes a tableRow that is not already wrapped with a table,
|
|
83
|
+
// We will wrap it with one ourselves, while preserving the parent table's attributes.
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
if (((_content$firstChild = content.firstChild) === null || _content$firstChild === void 0 ? void 0 : _content$firstChild.type.name) === 'tableRow' && !options.tableWrapperExists) {
|
|
87
|
+
// We only want 1 table wrapping the rows.
|
|
88
|
+
// tableWrapperExist is a custom prop added solely for the purposes of this recursive algorithm.
|
|
89
|
+
// The function is recursively called for each node in the tree captured in the fragment.
|
|
90
|
+
// 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
|
|
91
|
+
// and https://github.com/ProseMirror/prosemirror-model/blob/master/src/to_dom.js#L87)
|
|
92
|
+
options.tableWrapperExists = true;
|
|
93
|
+
var parentTable = findParentNodeOfType(schema.nodes.table)(selection);
|
|
94
|
+
var attributes = parentTable === null || parentTable === void 0 ? void 0 : parentTable.node.attrs;
|
|
95
|
+
var newTable = schema.nodes.table;
|
|
96
|
+
var newTableNode = newTable.createChecked(_objectSpread({}, attributes), content);
|
|
97
|
+
var newContent = Fragment.from(newTableNode); // Pass updated content into original ProseMirror serializeFragment function.
|
|
98
|
+
// Currently incorrectly typed in @Types. See this GitHub thread: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/57668
|
|
99
|
+
//@ts-ignore
|
|
100
|
+
|
|
101
|
+
return originalSerializeFragment(newContent, options, target);
|
|
102
|
+
} // If we're not copying any rows, just run default serializeFragment function.
|
|
103
|
+
// Currently incorrectly typed in @Types. See this GitHub thread: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/57668
|
|
104
|
+
//@ts-ignore
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
return originalSerializeFragment(content, options, target);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
return newSerializer;
|
|
111
|
+
};
|
|
23
112
|
export var sendClipboardAnalytics = function sendClipboardAnalytics(view, dispatchAnalyticsEvent, action) {
|
|
24
113
|
var clipboardAnalyticsPayload = getAnalyticsPayload(view.state, action);
|
|
25
114
|
|
|
@@ -2,50 +2,54 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
2
2
|
|
|
3
3
|
var _templateObject, _templateObject2;
|
|
4
4
|
|
|
5
|
-
import { css } from '
|
|
5
|
+
import { css } from '@emotion/react';
|
|
6
6
|
import { themed } from '@atlaskit/theme/components';
|
|
7
7
|
import { borderRadius, fontSize, gridSize } from '@atlaskit/theme/constants';
|
|
8
8
|
import * as colors from '@atlaskit/theme/colors';
|
|
9
9
|
import { blockNodesVerticalMargin, akEditorTableCellMinWidth, akEditorDeleteBackground, akEditorDeleteBorder, akEditorSelectedBorderSize, akEditorDeleteIconColor, SelectionStyle, getSelectionStyles, akEditorCodeFontFamily, akEditorSelectedNodeClassName, overflowShadow, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
10
10
|
import { codeBlockClassNames } from './ui/class-names';
|
|
11
|
-
export var highlightingCodeBlockStyles =
|
|
12
|
-
background:
|
|
11
|
+
export var highlightingCodeBlockStyles = function highlightingCodeBlockStyles(props) {
|
|
12
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror .code-block {\n position: relative;\n background-image: ", ";\n background-repeat: no-repeat;\n background-color: ", ";\n --ds--code--bg-color: transparent;\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 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: rgba(255, 143, 115, 0.5);\n color: ", ";\n }\n\n .", " {\n background-color: rgba(255, 189, 173, 0.5);\n }\n }\n"])), overflowShadow({
|
|
13
|
+
background: themed({
|
|
14
|
+
light: colors.N20,
|
|
15
|
+
dark: colors.DN50
|
|
16
|
+
})(props),
|
|
17
|
+
width: '8px'
|
|
18
|
+
}), themed({
|
|
13
19
|
light: colors.N20,
|
|
14
20
|
dark: colors.DN50
|
|
15
|
-
}),
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
21
|
+
})(props), akEditorCodeFontFamily, borderRadius(), blockNodesVerticalMargin, akEditorTableCellMinWidth, codeBlockClassNames.gutter, themed({
|
|
22
|
+
light: colors.N30,
|
|
23
|
+
dark: colors.DN20
|
|
24
|
+
})(props), gridSize(), themed({
|
|
25
|
+
light: colors.N90,
|
|
26
|
+
dark: colors.DN90
|
|
27
|
+
})(props), relativeFontSizeToBase16(fontSize()), themed({
|
|
28
|
+
light: colors.N400,
|
|
29
|
+
dark: colors.DN400
|
|
30
|
+
})(props), codeBlockClassNames.highlighting, relativeFontSizeToBase16(fontSize()), codeBlockClassNames.content, relativeFontSizeToBase16(fontSize()), borderRadius(), gridSize(), codeBlockClassNames.highlighting, themed({
|
|
31
|
+
light: colors.N800,
|
|
32
|
+
dark: colors.DN500
|
|
33
|
+
})(props), akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Blanket]), akEditorSelectedBorderSize, akEditorDeleteBorder, codeBlockClassNames.gutter, colors.R75, akEditorDeleteIconColor, codeBlockClassNames.content, akEditorDeleteBackground, codeBlockClassNames.gutter, akEditorDeleteIconColor, codeBlockClassNames.content);
|
|
34
|
+
};
|
|
35
|
+
export var codeBlockStyles = function codeBlockStyles(props) {
|
|
36
|
+
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .ProseMirror .code-block {\n position: relative;\n background-image: ", ";\n --ds--code--bg-color: transparent;\n background-repeat: no-repeat;\n background-color: ", ";\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\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 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 color: ", ";\n border-radius: ", "px;\n margin: ", "px;\n white-space: pre;\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 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: rgba(255, 143, 115, 0.5);\n color: ", ";\n }\n\n .", " {\n background-color: rgba(255, 189, 173, 0.5);\n }\n }\n"])), overflowShadow({
|
|
37
|
+
background: themed({
|
|
38
|
+
light: colors.N20,
|
|
39
|
+
dark: colors.DN50
|
|
40
|
+
})(props),
|
|
41
|
+
width: '8px'
|
|
42
|
+
}), themed({
|
|
35
43
|
light: colors.N20,
|
|
36
44
|
dark: colors.DN50
|
|
37
|
-
}),
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}), codeBlockClassNames.content, relativeFontSizeToBase16(fontSize()), themed({
|
|
49
|
-
light: colors.N800,
|
|
50
|
-
dark: colors.DN800
|
|
51
|
-
}), borderRadius(), gridSize(), akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Blanket]), akEditorSelectedBorderSize, akEditorDeleteBorder, codeBlockClassNames.gutter, colors.R75, akEditorDeleteIconColor, codeBlockClassNames.content, akEditorDeleteBackground, codeBlockClassNames.gutter, akEditorDeleteIconColor, codeBlockClassNames.content);
|
|
45
|
+
})(props), akEditorCodeFontFamily, borderRadius(), blockNodesVerticalMargin, akEditorTableCellMinWidth, codeBlockClassNames.gutter, themed({
|
|
46
|
+
light: colors.N30,
|
|
47
|
+
dark: colors.DN20
|
|
48
|
+
})(props), gridSize(), relativeFontSizeToBase16(fontSize()), themed({
|
|
49
|
+
light: colors.N400,
|
|
50
|
+
dark: colors.DN400
|
|
51
|
+
})(props), codeBlockClassNames.content, relativeFontSizeToBase16(fontSize()), themed({
|
|
52
|
+
light: colors.N800,
|
|
53
|
+
dark: colors.DN800
|
|
54
|
+
})(props), borderRadius(), gridSize(), akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Blanket]), akEditorSelectedBorderSize, akEditorDeleteBorder, codeBlockClassNames.gutter, colors.R75, akEditorDeleteIconColor, codeBlockClassNames.content, akEditorDeleteBackground, codeBlockClassNames.gutter, akEditorDeleteIconColor, codeBlockClassNames.content);
|
|
55
|
+
};
|
|
@@ -7,6 +7,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
7
7
|
import { pluginFactory } from '../../utils/plugin-state-factory';
|
|
8
8
|
import reducer from './reducer';
|
|
9
9
|
import { pluginKey } from './plugin-key';
|
|
10
|
+
import { onSelectionChanged } from './utils';
|
|
10
11
|
var factory = pluginFactory(pluginKey, reducer, {
|
|
11
12
|
mapping: function mapping(tr, state) {
|
|
12
13
|
var _ref = state,
|
|
@@ -25,7 +26,8 @@ var factory = pluginFactory(pluginKey, reducer, {
|
|
|
25
26
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
26
27
|
positions: positions
|
|
27
28
|
});
|
|
28
|
-
}
|
|
29
|
+
},
|
|
30
|
+
onSelectionChanged: onSelectionChanged
|
|
29
31
|
});
|
|
30
32
|
export var createPluginState = factory.createPluginState;
|
|
31
33
|
export var createCommand = factory.createCommand;
|