@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,12 +5,12 @@ import ReactNodeView from '../../../nodeviews/ReactNodeView';
|
|
|
5
5
|
import WithPluginState from '../../../ui/WithPluginState';
|
|
6
6
|
import { pluginKey as widthPluginKey } from '../../width';
|
|
7
7
|
import { pluginConfig as getPluginConfig } from '../create-plugin-config';
|
|
8
|
-
import { getPluginState
|
|
8
|
+
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
9
|
+
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
9
10
|
import { pluginKey as tableResizingPluginKey } from '../pm-plugins/table-resizing';
|
|
10
11
|
import { generateColgroup } from '../pm-plugins/table-resizing/utils';
|
|
11
12
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
12
13
|
import TableComponent from './TableComponent';
|
|
13
|
-
import { setTableSize } from '../commands';
|
|
14
14
|
import { getFeatureFlags } from '../../feature-flags-context';
|
|
15
15
|
import { EmitterEvents } from '../../../extensibility';
|
|
16
16
|
|
|
@@ -44,31 +44,17 @@ export default class TableView extends ReactNodeView {
|
|
|
44
44
|
_defineProperty(this, "hasHoveredRows", false);
|
|
45
45
|
|
|
46
46
|
this.getPos = props.getPos;
|
|
47
|
-
this.editorView = props.view;
|
|
48
47
|
this.tableRenderOptimization = props.tableRenderOptimization;
|
|
49
48
|
this.eventDispatcher = props.eventDispatcher;
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
getContentDOM() {
|
|
53
|
-
var _window;
|
|
54
|
-
|
|
55
52
|
const rendered = DOMSerializer.renderSpec(document, toDOM(this.node, this.reactComponentProps));
|
|
56
53
|
|
|
57
54
|
if (rendered.dom) {
|
|
58
55
|
this.table = rendered.dom;
|
|
59
56
|
}
|
|
60
57
|
|
|
61
|
-
if (this.tableRenderOptimization && this.table && !this.resizeObserver && (_window = window) !== null && _window !== void 0 && _window.ResizeObserver) {
|
|
62
|
-
this.resizeObserver = new ResizeObserver(entries => {
|
|
63
|
-
for (let entry of entries) {
|
|
64
|
-
const height = entry.contentRect ? entry.contentRect.height : entry.target.offsetHeight;
|
|
65
|
-
const width = entry.contentRect ? entry.contentRect.width : entry.target.offsetWidth;
|
|
66
|
-
setTableSize(height, width)(this.editorView.state, this.editorView.dispatch);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
this.resizeObserver.observe(this.table);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
58
|
return rendered;
|
|
73
59
|
}
|
|
74
60
|
|
|
@@ -2,7 +2,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
2
2
|
import { PluginKey } from 'prosemirror-state';
|
|
3
3
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
4
4
|
import { DecorationSet } from 'prosemirror-view';
|
|
5
|
-
import { pluginKey as tablePluginKey } from '../plugin-
|
|
5
|
+
import { pluginKey as tablePluginKey } from '../plugin-key';
|
|
6
6
|
import { buildColumnControlsDecorations, maybeUpdateColumnControlsSelectedDecoration } from './utils';
|
|
7
7
|
export const pluginKey = new PluginKey('tableDecorationsPlugin');
|
|
8
8
|
export const getDecorations = state => pluginKey.getState(state);
|
|
@@ -12,7 +12,8 @@ import { TableCssClassName as ClassName } from '../types';
|
|
|
12
12
|
import { findControlsHoverDecoration, updateResizeHandles } from '../utils';
|
|
13
13
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '../../analytics';
|
|
14
14
|
import { defaultTableSelection } from './default-table-selection';
|
|
15
|
-
import { createPluginState, getPluginState
|
|
15
|
+
import { createPluginState, getPluginState } from './plugin-factory';
|
|
16
|
+
import { pluginKey } from './plugin-key';
|
|
16
17
|
import TableCellNodeView from '../nodeviews/tableCell';
|
|
17
18
|
let isBreakoutEnabled;
|
|
18
19
|
let isDynamicTextSizingEnabled;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { PluginKey } from 'prosemirror-state';
|
|
2
1
|
import { pluginFactory } from '../../../utils/plugin-state-factory';
|
|
3
2
|
import { handleDocOrSelectionChanged } from '../handlers';
|
|
4
3
|
import reducer from '../reducer';
|
|
5
|
-
|
|
4
|
+
import { pluginKey } from './plugin-key';
|
|
6
5
|
export const {
|
|
7
6
|
createPluginState,
|
|
8
7
|
createCommand,
|
package/dist/es2019/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js
CHANGED
|
@@ -22,6 +22,8 @@ export const createPlugin = () => {
|
|
|
22
22
|
// DOM selection syncing during pointer drag.
|
|
23
23
|
//
|
|
24
24
|
// https://github.com/ProseMirror/prosemirror-view/commit/885258b80551ac87b81601d3ed25f552aeb22293
|
|
25
|
+
// NOTE: this workaround can be removed when next upgrading prosemirror as the issue will be fixed
|
|
26
|
+
// https://github.com/ProseMirror/prosemirror-view/pull/116
|
|
25
27
|
// This fix removes the selectionToDOM from the view
|
|
26
28
|
// prior to selectionToDOM being called.
|
|
27
29
|
// selectionToDOM checks if there is an "active"
|
|
@@ -4,7 +4,7 @@ import { pluginKey as widthPluginKey } from '../../../../../plugins/width';
|
|
|
4
4
|
import { mapChildren } from '../../../../../utils/slice';
|
|
5
5
|
import { TableCssClassName as ClassName, TableCssClassName } from '../../../types';
|
|
6
6
|
import { stickyHeaderBorderBottomWidth, stickyRowOffsetTop, tableControlsSpacing, tableScrollbarOffset } from '../../../ui/consts';
|
|
7
|
-
import { pluginKey as tablePluginKey } from '../../plugin-
|
|
7
|
+
import { pluginKey as tablePluginKey } from '../../plugin-key';
|
|
8
8
|
import { syncStickyRowToTable, updateStickyMargins as updateTableMargin } from '../../table-resizing/utils/dom';
|
|
9
9
|
import { updateStickyState } from '../commands';
|
|
10
10
|
import { getTop, getTree } from './dom';
|
|
@@ -86,15 +86,6 @@ export default ((pluginState, action) => {
|
|
|
86
86
|
...action.data
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
-
case 'SET_TABLE_SIZE':
|
|
90
|
-
if (pluginState.tableWidth !== action.data.tableWidth || pluginState.tableHeight !== action.data.tableHeight) {
|
|
91
|
-
return { ...pluginState,
|
|
92
|
-
...action.data
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return pluginState;
|
|
97
|
-
|
|
98
89
|
case 'SET_TABLE_REF':
|
|
99
90
|
case 'HOVER_ROWS':
|
|
100
91
|
case 'HOVER_COLUMNS':
|
|
@@ -6,7 +6,6 @@ import { deleteTableWithAnalytics, toggleHeaderColumnWithAnalytics, toggleHeader
|
|
|
6
6
|
import { getPluginState } from './pm-plugins/plugin-factory';
|
|
7
7
|
import { pluginKey as tableResizingPluginKey } from './pm-plugins/table-resizing';
|
|
8
8
|
import { TableCssClassName } from './types';
|
|
9
|
-
import { checkIfNumberColumnEnabled } from './utils';
|
|
10
9
|
import { isReferencedSource } from './utils/referentiality';
|
|
11
10
|
import { INPUT_METHOD } from '../analytics';
|
|
12
11
|
import { findCellRectClosestToPos, findTable, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
|
|
@@ -208,9 +207,7 @@ export const getToolbarConfig = config => (state, intl) => {
|
|
|
208
207
|
|
|
209
208
|
if (tableObject && pluginState.editorHasFocus) {
|
|
210
209
|
const nodeType = state.schema.nodes.table;
|
|
211
|
-
const menu = getToolbarMenuConfig(config,
|
|
212
|
-
isNumberColumnEnabled: checkIfNumberColumnEnabled(state)
|
|
213
|
-
}, intl);
|
|
210
|
+
const menu = getToolbarMenuConfig(config, pluginState, intl);
|
|
214
211
|
const cellItems = getCellItems(config, state, intl); // Check if we need to show confirm dialog for delete button
|
|
215
212
|
|
|
216
213
|
let confirmDialog;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { pluginKey } from '../pm-plugins/plugin-
|
|
1
|
+
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
2
2
|
import { fireAnalytics } from './fix-tables'; // Set metadata on a ProseMirror transaction for debugging purposes in Synchrony
|
|
3
3
|
|
|
4
4
|
export const setMeta = meta => tr => {
|
|
@@ -4,7 +4,8 @@ import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@at
|
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
6
6
|
import { akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
7
|
-
import { getPluginState
|
|
7
|
+
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
8
|
+
import { pluginKey } from '../../pm-plugins/plugin-key';
|
|
8
9
|
import { contextualMenuDropdownWidth, contextualMenuTriggerSize } from '../consts';
|
|
9
10
|
import { tablePopupStyles } from './styles.css';
|
|
10
11
|
import ContextualMenu from './ContextualMenu';
|
|
@@ -110,7 +110,7 @@ export class FloatingInsertButton extends React.Component {
|
|
|
110
110
|
const tableContainerWrapper = closestElement(targetCellRef, `.${ClassName.TABLE_CONTAINER}`);
|
|
111
111
|
const tableWrapper = closestElement(targetCellRef, `.${ClassName.TABLE_NODE_WRAPPER}`);
|
|
112
112
|
const index = type === 'column' ? insertColumnButtonIndex : insertRowButtonIndex;
|
|
113
|
-
const hasNumberedColumns = checkIfNumberColumnEnabled(editorView.state);
|
|
113
|
+
const hasNumberedColumns = checkIfNumberColumnEnabled(editorView.state.selection);
|
|
114
114
|
return /*#__PURE__*/React.createElement(Popup, _extends({
|
|
115
115
|
target: targetCellRef,
|
|
116
116
|
mountTo: tableContainerWrapper || mountPoint,
|
|
@@ -181,10 +181,9 @@ class LayoutButton extends React.Component {
|
|
|
181
181
|
targetRef,
|
|
182
182
|
layout,
|
|
183
183
|
isResizing,
|
|
184
|
-
tableWidth,
|
|
185
184
|
stickyHeader
|
|
186
185
|
} = this.props;
|
|
187
|
-
return stickyHeader !== nextProps.stickyHeader || targetRef !== nextProps.targetRef || layout !== nextProps.layout || isResizing !== nextProps.isResizing
|
|
186
|
+
return stickyHeader !== nextProps.stickyHeader || targetRef !== nextProps.targetRef || layout !== nextProps.layout || isResizing !== nextProps.isResizing;
|
|
188
187
|
}
|
|
189
188
|
|
|
190
189
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { css } from '
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
import { css as deprecatedCss } from 'styled-components';
|
|
2
3
|
import { tableMarginTop, tableSharedStyle } from '@atlaskit/editor-common/styles';
|
|
3
4
|
import { fontSize } from '@atlaskit/theme/constants';
|
|
4
5
|
import { N40A, B300, N300, N20A, N0, R500 } from '@atlaskit/theme/colors';
|
|
@@ -40,7 +41,10 @@ const sentinelStyles = `.${ClassName.TABLE_CONTAINER} {
|
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
}`;
|
|
43
|
-
export const tableStyles =
|
|
44
|
+
export const tableStyles = props => {
|
|
45
|
+
var _props$featureFlags;
|
|
46
|
+
|
|
47
|
+
return css`
|
|
44
48
|
.${ClassName.LAYOUT_BUTTON} button {
|
|
45
49
|
background: ${N20A};
|
|
46
50
|
color: ${N300};
|
|
@@ -54,8 +58,8 @@ export const tableStyles = css`
|
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
.ProseMirror {
|
|
57
|
-
${tableSharedStyle};
|
|
58
|
-
${columnControlsLineMarker};
|
|
61
|
+
${tableSharedStyle(props)};
|
|
62
|
+
${columnControlsLineMarker(props)};
|
|
59
63
|
${hoveredDeleteButton};
|
|
60
64
|
${hoveredCell};
|
|
61
65
|
${hoveredWarningCell};
|
|
@@ -73,7 +77,7 @@ export const tableStyles = css`
|
|
|
73
77
|
}
|
|
74
78
|
|
|
75
79
|
td.${ClassName.TABLE_CELL} {
|
|
76
|
-
background-color: ${tableCellBackgroundColor};
|
|
80
|
+
background-color: ${tableCellBackgroundColor(props)};
|
|
77
81
|
}
|
|
78
82
|
}
|
|
79
83
|
|
|
@@ -175,7 +179,7 @@ export const tableStyles = css`
|
|
|
175
179
|
|
|
176
180
|
tr.sticky th {
|
|
177
181
|
border-bottom: ${stickyHeaderBorderBottomWidth}px solid
|
|
178
|
-
${tableBorderColor};
|
|
182
|
+
${tableBorderColor(props)};
|
|
179
183
|
margin-right: -1px;
|
|
180
184
|
}
|
|
181
185
|
|
|
@@ -183,7 +187,7 @@ export const tableStyles = css`
|
|
|
183
187
|
border-right-width: 1px;
|
|
184
188
|
}
|
|
185
189
|
|
|
186
|
-
|
|
190
|
+
/* add left edge for first cell */
|
|
187
191
|
.${ClassName.TABLE_STICKY} tr.sticky > th:first-child {
|
|
188
192
|
margin-left: 0px;
|
|
189
193
|
}
|
|
@@ -242,16 +246,13 @@ export const tableStyles = css`
|
|
|
242
246
|
border-top: ${tableControlsSpacing - tableToolbarSize + 2}px solid white;
|
|
243
247
|
}
|
|
244
248
|
|
|
245
|
-
${props
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
return (_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.stickyHeadersOptimization ? sentinelStyles : '';
|
|
249
|
-
}}
|
|
249
|
+
${(_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.stickyHeadersOptimization ? sentinelStyles : ''}
|
|
250
|
+
${OverflowShadow(props)}
|
|
250
251
|
|
|
251
|
-
${OverflowShadow}
|
|
252
252
|
.${ClassName.TABLE_STICKY} .${ClassName.TABLE_STICKY_SHADOW} {
|
|
253
253
|
height: 0; // stop overflow flash & set correct height in update-overflow-shadows.ts
|
|
254
254
|
}
|
|
255
|
+
|
|
255
256
|
.less-padding {
|
|
256
257
|
padding: 0 ${tablePadding}px;
|
|
257
258
|
|
|
@@ -288,7 +289,7 @@ export const tableStyles = css`
|
|
|
288
289
|
width: 100% !important;
|
|
289
290
|
}
|
|
290
291
|
|
|
291
|
-
${columnControlsDecoration};
|
|
292
|
+
${columnControlsDecoration(props)};
|
|
292
293
|
|
|
293
294
|
/* Corner controls */
|
|
294
295
|
.${ClassName.CORNER_CONTROLS} {
|
|
@@ -299,7 +300,7 @@ export const tableStyles = css`
|
|
|
299
300
|
.${ClassName.CORNER_CONTROLS_INSERT_ROW_MARKER} {
|
|
300
301
|
position: relative;
|
|
301
302
|
|
|
302
|
-
${InsertMarker(`
|
|
303
|
+
${InsertMarker(props, `
|
|
303
304
|
left: -11px;
|
|
304
305
|
top: 9px;
|
|
305
306
|
`)};
|
|
@@ -308,27 +309,29 @@ export const tableStyles = css`
|
|
|
308
309
|
.${ClassName.CORNER_CONTROLS_INSERT_COLUMN_MARKER} {
|
|
309
310
|
position: relative;
|
|
310
311
|
|
|
311
|
-
${InsertMarker(`
|
|
312
|
+
${InsertMarker(props, `
|
|
312
313
|
right: -1px;
|
|
313
314
|
top: -12px;
|
|
314
315
|
`)};
|
|
315
316
|
}
|
|
316
317
|
}
|
|
318
|
+
|
|
317
319
|
.${ClassName.CORNER_CONTROLS}.sticky {
|
|
318
320
|
.${ClassName.CORNER_CONTROLS_INSERT_ROW_MARKER} {
|
|
319
321
|
/* sticky row insert dot overlaps other row insert and messes things up */
|
|
320
322
|
display: none !important;
|
|
321
323
|
}
|
|
322
324
|
}
|
|
325
|
+
|
|
323
326
|
.${ClassName.CONTROLS_CORNER_BUTTON} {
|
|
324
327
|
position: absolute;
|
|
325
328
|
top: 0;
|
|
326
329
|
width: ${tableToolbarSize + 1}px;
|
|
327
330
|
height: ${tableToolbarSize + 1}px;
|
|
328
|
-
border: 1px solid ${tableBorderColor};
|
|
331
|
+
border: 1px solid ${tableBorderColor(props)};
|
|
329
332
|
border-radius: 0;
|
|
330
333
|
border-top-left-radius: ${tableBorderRadiusSize}px;
|
|
331
|
-
background: ${tableToolbarColor};
|
|
334
|
+
background: ${tableToolbarColor(props)};
|
|
332
335
|
box-sizing: border-box;
|
|
333
336
|
padding: 0;
|
|
334
337
|
:focus {
|
|
@@ -339,6 +342,7 @@ export const tableStyles = css`
|
|
|
339
342
|
border-color: ${tableBorderSelectedColor};
|
|
340
343
|
background: ${tableToolbarSelectedColor};
|
|
341
344
|
}
|
|
345
|
+
|
|
342
346
|
.${ClassName.TABLE_CONTAINER}[data-number-column='true'] {
|
|
343
347
|
.${ClassName.CORNER_CONTROLS}, .${ClassName.CONTROLS_CORNER_BUTTON} {
|
|
344
348
|
width: ${akEditorTableToolbarSize + akEditorTableNumberColumnWidth}px;
|
|
@@ -347,11 +351,13 @@ export const tableStyles = css`
|
|
|
347
351
|
border-right-width: 0;
|
|
348
352
|
}
|
|
349
353
|
}
|
|
354
|
+
|
|
350
355
|
:not(.${ClassName.IS_RESIZING}) .${ClassName.CONTROLS_CORNER_BUTTON}:hover {
|
|
351
356
|
border-color: ${tableBorderSelectedColor};
|
|
352
357
|
background: ${tableToolbarSelectedColor};
|
|
353
358
|
cursor: pointer;
|
|
354
359
|
}
|
|
360
|
+
|
|
355
361
|
:not(.${ClassName.IS_RESIZING})
|
|
356
362
|
.${ClassName.CONTROLS_CORNER_BUTTON}.${ClassName.HOVERED_CELL_IN_DANGER} {
|
|
357
363
|
border-color: ${tableBorderDeleteColor};
|
|
@@ -365,7 +371,7 @@ export const tableStyles = css`
|
|
|
365
371
|
display: none;
|
|
366
372
|
position: relative;
|
|
367
373
|
|
|
368
|
-
${InsertMarker(`
|
|
374
|
+
${InsertMarker(props, `
|
|
369
375
|
bottom: -1px;
|
|
370
376
|
left: -11px;
|
|
371
377
|
`)};
|
|
@@ -387,8 +393,8 @@ export const tableStyles = css`
|
|
|
387
393
|
z-index: ${akEditorUnitZIndex};
|
|
388
394
|
}
|
|
389
395
|
|
|
390
|
-
${HeaderButton(`
|
|
391
|
-
border-bottom: 1px solid ${tableBorderColor};
|
|
396
|
+
${HeaderButton(props, `
|
|
397
|
+
border-bottom: 1px solid ${tableBorderColor(props)};
|
|
392
398
|
border-right: 0px;
|
|
393
399
|
border-radius: 0;
|
|
394
400
|
height: 100%;
|
|
@@ -406,6 +412,7 @@ export const tableStyles = css`
|
|
|
406
412
|
}
|
|
407
413
|
`)}
|
|
408
414
|
}
|
|
415
|
+
|
|
409
416
|
:not(.${ClassName.IS_RESIZING}) .${ClassName.ROW_CONTROLS} {
|
|
410
417
|
${HeaderButtonHover()}
|
|
411
418
|
${HeaderButtonDanger()}
|
|
@@ -420,25 +427,27 @@ export const tableStyles = css`
|
|
|
420
427
|
width: ${akEditorTableNumberColumnWidth + 1}px;
|
|
421
428
|
box-sizing: border-box;
|
|
422
429
|
}
|
|
430
|
+
|
|
423
431
|
.${ClassName.NUMBERED_COLUMN_BUTTON} {
|
|
424
|
-
border: 1px solid ${tableBorderColor};
|
|
432
|
+
border: 1px solid ${tableBorderColor(props)};
|
|
425
433
|
box-sizing: border-box;
|
|
426
434
|
margin-top: -1px;
|
|
427
435
|
padding-bottom: 2px;
|
|
428
436
|
padding: 10px 2px;
|
|
429
437
|
text-align: center;
|
|
430
438
|
font-size: ${relativeFontSizeToBase16(fontSize())};
|
|
431
|
-
background-color: ${tableToolbarColor};
|
|
432
|
-
color: ${tableTextColor};
|
|
433
|
-
border-color: ${tableBorderColor};
|
|
439
|
+
background-color: ${tableToolbarColor(props)};
|
|
440
|
+
color: ${tableTextColor(props)};
|
|
441
|
+
border-color: ${tableBorderColor(props)};
|
|
434
442
|
|
|
435
443
|
:first-child {
|
|
436
444
|
margin-top: 0;
|
|
437
445
|
}
|
|
438
446
|
:last-child {
|
|
439
|
-
border-bottom: 1px solid ${tableBorderColor};
|
|
447
|
+
border-bottom: 1px solid ${tableBorderColor(props)};
|
|
440
448
|
}
|
|
441
449
|
}
|
|
450
|
+
|
|
442
451
|
.${ClassName.WITH_CONTROLS} {
|
|
443
452
|
.${ClassName.CORNER_CONTROLS}, .${ClassName.ROW_CONTROLS} {
|
|
444
453
|
display: block;
|
|
@@ -567,6 +576,7 @@ export const tableStyles = css`
|
|
|
567
576
|
cursor: col-resize;
|
|
568
577
|
}
|
|
569
578
|
`;
|
|
579
|
+
};
|
|
570
580
|
export const tableFullPageEditorStyles = css`
|
|
571
581
|
.ProseMirror .${ClassName.TABLE_NODE_WRAPPER} > table {
|
|
572
582
|
margin-left: 0;
|
|
@@ -574,10 +584,25 @@ export const tableFullPageEditorStyles = css`
|
|
|
574
584
|
width: 100%;
|
|
575
585
|
}
|
|
576
586
|
`;
|
|
587
|
+
export const deprecatedTableFullPageEditorStyles = deprecatedCss`
|
|
588
|
+
.ProseMirror .${ClassName.TABLE_NODE_WRAPPER} > table {
|
|
589
|
+
margin-left: 0;
|
|
590
|
+
margin-right: 0;
|
|
591
|
+
width: 100%;
|
|
592
|
+
}
|
|
593
|
+
`;
|
|
577
594
|
export const tableCommentEditorStyles = css`
|
|
578
595
|
.ProseMirror .${ClassName.TABLE_NODE_WRAPPER} > table {
|
|
579
596
|
margin-left: 0;
|
|
580
597
|
margin-right: 0;
|
|
581
598
|
${scrollbarStyles};
|
|
582
599
|
}
|
|
600
|
+
`; // TODO remove this after migrated off styled-component
|
|
601
|
+
|
|
602
|
+
export const deprecatedTableCommentEditorStyles = deprecatedCss`
|
|
603
|
+
.ProseMirror .${ClassName.TABLE_NODE_WRAPPER} > table {
|
|
604
|
+
margin-left: 0;
|
|
605
|
+
margin-right: 0;
|
|
606
|
+
${scrollbarStyles};
|
|
607
|
+
}
|
|
583
608
|
`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { css } from '
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
2
|
import { tableCellBorderWidth, tableMarginBottom, tableMarginTop } from '@atlaskit/editor-common/styles';
|
|
3
3
|
import { akEditorShadowZIndex, akEditorTableNumberColumnWidth, akEditorUnitZIndex } from '@atlaskit/editor-shared-styles';
|
|
4
4
|
import { N40A, B300, N300, R300, N20A, N60A, N0, Y50, Y200 } from '@atlaskit/theme/colors';
|
|
@@ -16,17 +16,18 @@ const InsertLine = cssString => css`
|
|
|
16
16
|
}
|
|
17
17
|
`;
|
|
18
18
|
|
|
19
|
-
const Marker = css`
|
|
20
|
-
background-color: ${tableBorderColor};
|
|
19
|
+
const Marker = props => css`
|
|
20
|
+
background-color: ${tableBorderColor(props)};
|
|
21
21
|
position: absolute;
|
|
22
22
|
height: ${lineMarkerSize}px;
|
|
23
23
|
width: ${lineMarkerSize}px;
|
|
24
24
|
border-radius: 50%;
|
|
25
25
|
pointer-events: none;
|
|
26
26
|
`;
|
|
27
|
-
|
|
27
|
+
|
|
28
|
+
export const InsertMarker = (props, cssString) => css`
|
|
28
29
|
.${ClassName.CONTROLS_INSERT_MARKER} {
|
|
29
|
-
${Marker};
|
|
30
|
+
${Marker(props)};
|
|
30
31
|
${cssString}
|
|
31
32
|
}
|
|
32
33
|
`;
|
|
@@ -52,10 +53,10 @@ const Button = cssString => css`
|
|
|
52
53
|
${cssString}
|
|
53
54
|
`;
|
|
54
55
|
|
|
55
|
-
export const HeaderButton = cssString => css`
|
|
56
|
+
export const HeaderButton = (props, cssString) => css`
|
|
56
57
|
.${ClassName.CONTROLS_BUTTON} {
|
|
57
|
-
background: ${tableToolbarColor};
|
|
58
|
-
border: 1px solid ${tableBorderColor};
|
|
58
|
+
background: ${tableToolbarColor(props)};
|
|
59
|
+
border: 1px solid ${tableBorderColor(props)};
|
|
59
60
|
display: block;
|
|
60
61
|
box-sizing: border-box;
|
|
61
62
|
padding: 0;
|
|
@@ -151,14 +152,14 @@ export const insertRowButtonWrapper = css`
|
|
|
151
152
|
left: ${tableInsertColumnButtonSize - 1}px;
|
|
152
153
|
`)}
|
|
153
154
|
`;
|
|
154
|
-
export const columnControlsLineMarker = css`
|
|
155
|
+
export const columnControlsLineMarker = props => css`
|
|
155
156
|
.${ClassName.TABLE_CONTAINER}.${ClassName.WITH_CONTROLS} table tr:first-child td,
|
|
156
157
|
.${ClassName.TABLE_CONTAINER}.${ClassName.WITH_CONTROLS} table tr:first-child th {
|
|
157
158
|
position: relative;
|
|
158
159
|
|
|
159
160
|
&::before {
|
|
160
161
|
content: ' ';
|
|
161
|
-
${Marker};
|
|
162
|
+
${Marker(props)};
|
|
162
163
|
top: -${tableToolbarSize + lineMarkerOffsetFromColumnControls}px;
|
|
163
164
|
right: -${lineMarkerSize / 2}px;
|
|
164
165
|
}
|
|
@@ -185,57 +186,57 @@ export const DeleteButton = css`
|
|
|
185
186
|
cursor: pointer;
|
|
186
187
|
}
|
|
187
188
|
`;
|
|
188
|
-
export const OverflowShadow = css`
|
|
189
|
-
.${ClassName.TABLE_RIGHT_SHADOW},
|
|
190
|
-
.${ClassName.TABLE_LEFT_SHADOW}{
|
|
191
|
-
display: block;
|
|
192
|
-
height: calc(100% - ${tableMarginTop + tableMarginBottom + tableToolbarSize - 2}px);
|
|
193
|
-
position: absolute;
|
|
194
|
-
pointer-events: none;
|
|
195
|
-
top: ${tableMarginTop + tableToolbarSize - 1}px;
|
|
196
|
-
z-index: ${akEditorShadowZIndex};
|
|
197
|
-
width: 8px;
|
|
198
|
-
}
|
|
199
|
-
.${ClassName.TABLE_LEFT_SHADOW} {
|
|
200
|
-
background: linear-gradient(
|
|
201
|
-
to left,
|
|
202
|
-
rgba(99, 114, 130, 0) 0,
|
|
203
|
-
${N40A} 100%
|
|
204
|
-
);
|
|
205
|
-
left: 0px;
|
|
206
|
-
}
|
|
207
|
-
.${ClassName.TABLE_CONTAINER}[data-number-column='true'] > :not(.${ClassName.TABLE_STICKY_SHADOW}).${ClassName.TABLE_LEFT_SHADOW} {
|
|
208
|
-
left: ${akEditorTableNumberColumnWidth - 1}px;
|
|
209
|
-
}
|
|
210
|
-
.${ClassName.TABLE_RIGHT_SHADOW} {
|
|
211
|
-
background: linear-gradient(
|
|
212
|
-
to right,
|
|
213
|
-
rgba(99, 114, 130, 0) 0,
|
|
214
|
-
${N40A} 100%
|
|
215
|
-
);
|
|
216
|
-
left: calc(100% + 2px);
|
|
217
|
-
}
|
|
218
|
-
.${ClassName.WITH_CONTROLS} {
|
|
189
|
+
export const OverflowShadow = props => css`
|
|
219
190
|
.${ClassName.TABLE_RIGHT_SHADOW},
|
|
220
191
|
.${ClassName.TABLE_LEFT_SHADOW}{
|
|
221
|
-
|
|
222
|
-
|
|
192
|
+
display: block;
|
|
193
|
+
height: calc(100% - ${tableMarginTop + tableMarginBottom + tableToolbarSize - 2}px);
|
|
194
|
+
position: absolute;
|
|
195
|
+
pointer-events: none;
|
|
196
|
+
top: ${tableMarginTop + tableToolbarSize - 1}px;
|
|
197
|
+
z-index: ${akEditorShadowZIndex};
|
|
198
|
+
width: 8px;
|
|
223
199
|
}
|
|
224
200
|
.${ClassName.TABLE_LEFT_SHADOW} {
|
|
225
|
-
|
|
201
|
+
background: linear-gradient(
|
|
202
|
+
to left,
|
|
203
|
+
rgba(99, 114, 130, 0) 0,
|
|
204
|
+
${N40A} 100%
|
|
205
|
+
);
|
|
206
|
+
left: 0px;
|
|
226
207
|
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
.${ClassName.
|
|
231
|
-
|
|
208
|
+
.${ClassName.TABLE_CONTAINER}[data-number-column='true'] > :not(.${ClassName.TABLE_STICKY_SHADOW}).${ClassName.TABLE_LEFT_SHADOW} {
|
|
209
|
+
left: ${akEditorTableNumberColumnWidth - 1}px;
|
|
210
|
+
}
|
|
211
|
+
.${ClassName.TABLE_RIGHT_SHADOW} {
|
|
212
|
+
background: linear-gradient(
|
|
213
|
+
to right,
|
|
214
|
+
rgba(99, 114, 130, 0) 0,
|
|
215
|
+
${N40A} 100%
|
|
216
|
+
);
|
|
217
|
+
left: calc(100% + 2px);
|
|
218
|
+
}
|
|
219
|
+
.${ClassName.WITH_CONTROLS} {
|
|
220
|
+
.${ClassName.TABLE_RIGHT_SHADOW},
|
|
221
|
+
.${ClassName.TABLE_LEFT_SHADOW}{
|
|
222
|
+
height: calc(100% - ${tableMarginTop + tableMarginBottom - 2}px);
|
|
223
|
+
top: ${tableMarginTop - 1}px;
|
|
224
|
+
}
|
|
225
|
+
.${ClassName.TABLE_LEFT_SHADOW} {
|
|
226
|
+
border-left: 1px solid ${tableBorderColor(props)};
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
.${ClassName.WITH_CONTROLS}.${ClassName.TABLE_STICKY} {
|
|
230
|
+
.${ClassName.TABLE_RIGHT_SHADOW},
|
|
231
|
+
.${ClassName.TABLE_LEFT_SHADOW} {
|
|
232
|
+
top: ${tableControlsSpacing}px;
|
|
233
|
+
}
|
|
232
234
|
}
|
|
233
|
-
}
|
|
234
235
|
`;
|
|
235
236
|
|
|
236
|
-
const columnHeaderButton = cssString => css`
|
|
237
|
-
background: ${tableToolbarColor};
|
|
238
|
-
border: 1px solid ${tableBorderColor};
|
|
237
|
+
const columnHeaderButton = (props, cssString) => css`
|
|
238
|
+
background: ${tableToolbarColor(props)};
|
|
239
|
+
border: 1px solid ${tableBorderColor(props)};
|
|
239
240
|
display: block;
|
|
240
241
|
box-sizing: border-box;
|
|
241
242
|
padding: 0;
|
|
@@ -253,7 +254,7 @@ const columnHeaderButtonSelected = css`
|
|
|
253
254
|
border-color: ${tableBorderSelectedColor};
|
|
254
255
|
z-index: ${columnControlsSelectedZIndex};
|
|
255
256
|
`;
|
|
256
|
-
export const columnControlsDecoration = css`
|
|
257
|
+
export const columnControlsDecoration = props => css`
|
|
257
258
|
.${ClassName.COLUMN_CONTROLS_DECORATIONS} {
|
|
258
259
|
display: none;
|
|
259
260
|
cursor: pointer;
|
|
@@ -266,8 +267,8 @@ export const columnControlsDecoration = css`
|
|
|
266
267
|
&::after {
|
|
267
268
|
content: ' ';
|
|
268
269
|
|
|
269
|
-
${columnHeaderButton(`
|
|
270
|
-
border-right: ${tableCellBorderWidth}px solid ${tableBorderColor};
|
|
270
|
+
${columnHeaderButton(props, `
|
|
271
|
+
border-right: ${tableCellBorderWidth}px solid ${tableBorderColor(props)};
|
|
271
272
|
border-bottom: none;
|
|
272
273
|
height: ${tableToolbarSize}px;
|
|
273
274
|
width: 100%;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
2
2
|
import { hasParentNodeOfType } from 'prosemirror-utils';
|
|
3
3
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
4
|
-
import { pluginKey } from '../pm-plugins/plugin-
|
|
4
|
+
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
5
5
|
export const isIsolating = node => {
|
|
6
6
|
return !!node.type.spec.isolating;
|
|
7
7
|
};
|
|
8
|
-
export const containsHeaderColumn =
|
|
8
|
+
export const containsHeaderColumn = table => {
|
|
9
9
|
const map = TableMap.get(table); // Get cell positions for first column.
|
|
10
10
|
|
|
11
11
|
const cellPositions = map.cellsInRect({
|
|
@@ -19,7 +19,7 @@ export const containsHeaderColumn = (state, table) => {
|
|
|
19
19
|
try {
|
|
20
20
|
const cell = table.nodeAt(cellPositions[i]);
|
|
21
21
|
|
|
22
|
-
if (cell && cell.type !==
|
|
22
|
+
if (cell && cell.type !== table.type.schema.nodes.tableHeader) {
|
|
23
23
|
return false;
|
|
24
24
|
}
|
|
25
25
|
} catch (e) {
|
|
@@ -29,22 +29,22 @@ export const containsHeaderColumn = (state, table) => {
|
|
|
29
29
|
|
|
30
30
|
return true;
|
|
31
31
|
};
|
|
32
|
-
export const containsHeaderRow =
|
|
32
|
+
export const containsHeaderRow = table => {
|
|
33
33
|
const map = TableMap.get(table);
|
|
34
34
|
|
|
35
35
|
for (let i = 0; i < map.width; i++) {
|
|
36
36
|
const cell = table.nodeAt(map.map[i]);
|
|
37
37
|
|
|
38
|
-
if (cell && cell.type !==
|
|
38
|
+
if (cell && cell.type !== table.type.schema.nodes.tableHeader) {
|
|
39
39
|
return false;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
return true;
|
|
44
44
|
};
|
|
45
|
-
export const checkIfHeaderColumnEnabled =
|
|
46
|
-
export const checkIfHeaderRowEnabled =
|
|
47
|
-
export const checkIfNumberColumnEnabled =
|
|
45
|
+
export const checkIfHeaderColumnEnabled = selection => filterNearSelection(selection, findTable, containsHeaderColumn, false);
|
|
46
|
+
export const checkIfHeaderRowEnabled = selection => filterNearSelection(selection, findTable, containsHeaderRow, false);
|
|
47
|
+
export const checkIfNumberColumnEnabled = selection => filterNearSelection(selection, findTable, table => !!table.attrs.isNumberColumnEnabled, false);
|
|
48
48
|
export const isLayoutSupported = state => {
|
|
49
49
|
const {
|
|
50
50
|
permittedLayouts
|
|
@@ -78,14 +78,14 @@ export const tablesHaveDifferentNoOfColumns = (currentTable, previousTable) => {
|
|
|
78
78
|
return prevMap.width !== currentMap.width;
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
-
function filterNearSelection(
|
|
82
|
-
const found = findNode(
|
|
81
|
+
function filterNearSelection(selection, findNode, predicate, defaultValue) {
|
|
82
|
+
const found = findNode(selection);
|
|
83
83
|
|
|
84
84
|
if (!found) {
|
|
85
85
|
return defaultValue;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
return predicate(
|
|
88
|
+
return predicate(found.node, found.pos);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
function getTableWidths(node) {
|