@atlaskit/editor-core 189.1.11 → 189.1.12

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.
Files changed (59) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/plugins/index.js +0 -7
  3. package/dist/cjs/presets/universal.js +2 -1
  4. package/dist/cjs/version-wrapper.js +1 -1
  5. package/dist/es2019/plugins/index.js +0 -1
  6. package/dist/es2019/presets/universal.js +2 -1
  7. package/dist/es2019/version-wrapper.js +1 -1
  8. package/dist/esm/plugins/index.js +0 -1
  9. package/dist/esm/presets/universal.js +2 -1
  10. package/dist/esm/version-wrapper.js +1 -1
  11. package/dist/types/plugins/index.d.ts +0 -1
  12. package/dist/types/plugins/insert-block/types.d.ts +1 -1
  13. package/dist/types/types/editor-props.d.ts +1 -1
  14. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  15. package/dist/types-ts4.5/plugins/insert-block/types.d.ts +1 -1
  16. package/dist/types-ts4.5/types/editor-props.d.ts +1 -1
  17. package/package.json +2 -1
  18. package/report.api.md +1 -10
  19. package/tmp/api-report-tmp.d.ts +1 -10
  20. package/dist/cjs/plugins/layout/actions.js +0 -345
  21. package/dist/cjs/plugins/layout/index.js +0 -91
  22. package/dist/cjs/plugins/layout/pm-plugins/main.js +0 -148
  23. package/dist/cjs/plugins/layout/pm-plugins/plugin-key.js +0 -8
  24. package/dist/cjs/plugins/layout/pm-plugins/types.js +0 -5
  25. package/dist/cjs/plugins/layout/toolbar-messages.js +0 -39
  26. package/dist/cjs/plugins/layout/toolbar.js +0 -116
  27. package/dist/cjs/plugins/layout/types.js +0 -5
  28. package/dist/es2019/plugins/layout/actions.js +0 -328
  29. package/dist/es2019/plugins/layout/index.js +0 -75
  30. package/dist/es2019/plugins/layout/pm-plugins/main.js +0 -142
  31. package/dist/es2019/plugins/layout/pm-plugins/plugin-key.js +0 -2
  32. package/dist/es2019/plugins/layout/pm-plugins/types.js +0 -1
  33. package/dist/es2019/plugins/layout/toolbar-messages.js +0 -33
  34. package/dist/es2019/plugins/layout/toolbar.js +0 -101
  35. package/dist/es2019/plugins/layout/types.js +0 -1
  36. package/dist/esm/plugins/layout/actions.js +0 -336
  37. package/dist/esm/plugins/layout/index.js +0 -79
  38. package/dist/esm/plugins/layout/pm-plugins/main.js +0 -141
  39. package/dist/esm/plugins/layout/pm-plugins/plugin-key.js +0 -2
  40. package/dist/esm/plugins/layout/pm-plugins/types.js +0 -1
  41. package/dist/esm/plugins/layout/toolbar-messages.js +0 -33
  42. package/dist/esm/plugins/layout/toolbar.js +0 -109
  43. package/dist/esm/plugins/layout/types.js +0 -1
  44. package/dist/types/plugins/layout/actions.d.ts +0 -22
  45. package/dist/types/plugins/layout/index.d.ts +0 -15
  46. package/dist/types/plugins/layout/pm-plugins/main.d.ts +0 -6
  47. package/dist/types/plugins/layout/pm-plugins/plugin-key.d.ts +0 -3
  48. package/dist/types/plugins/layout/pm-plugins/types.d.ts +0 -14
  49. package/dist/types/plugins/layout/toolbar-messages.d.ts +0 -32
  50. package/dist/types/plugins/layout/toolbar.d.ts +0 -6
  51. package/dist/types/plugins/layout/types.d.ts +0 -13
  52. package/dist/types-ts4.5/plugins/layout/actions.d.ts +0 -22
  53. package/dist/types-ts4.5/plugins/layout/index.d.ts +0 -18
  54. package/dist/types-ts4.5/plugins/layout/pm-plugins/main.d.ts +0 -6
  55. package/dist/types-ts4.5/plugins/layout/pm-plugins/plugin-key.d.ts +0 -3
  56. package/dist/types-ts4.5/plugins/layout/pm-plugins/types.d.ts +0 -14
  57. package/dist/types-ts4.5/plugins/layout/toolbar-messages.d.ts +0 -32
  58. package/dist/types-ts4.5/plugins/layout/toolbar.d.ts +0 -6
  59. package/dist/types-ts4.5/plugins/layout/types.d.ts +0 -13
@@ -1,109 +0,0 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
- import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
3
- import EditorLayoutSingleIcon from '@atlaskit/icon/glyph/editor/layout-single';
4
- import LayoutTwoEqualIcon from '@atlaskit/icon/glyph/editor/layout-two-equal';
5
- import LayoutThreeEqualIcon from '@atlaskit/icon/glyph/editor/layout-three-equal';
6
- import LayoutTwoLeftSidebarIcon from '@atlaskit/icon/glyph/editor/layout-two-left-sidebar';
7
- import LayoutTwoRightSidebarIcon from '@atlaskit/icon/glyph/editor/layout-two-right-sidebar';
8
- import LayoutThreeWithSidebarsIcon from '@atlaskit/icon/glyph/editor/layout-three-with-sidebars';
9
- import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
10
- import { toolbarMessages } from './toolbar-messages';
11
- import commonMessages from '@atlaskit/editor-common/messages';
12
- import { setPresetLayout, deleteActiveLayoutNode, getPresetLayout } from './actions';
13
- var LAYOUT_TYPES = [{
14
- id: 'editor.layout.twoEquals',
15
- type: 'two_equal',
16
- title: toolbarMessages.twoColumns,
17
- icon: LayoutTwoEqualIcon
18
- }, {
19
- id: 'editor.layout.threeEquals',
20
- type: 'three_equal',
21
- title: toolbarMessages.threeColumns,
22
- icon: LayoutThreeEqualIcon
23
- }];
24
- var LAYOUT_TYPES_WITH_SINGLE_COL = [{
25
- id: 'editor.layout.singeLayout',
26
- type: 'single',
27
- title: toolbarMessages.singleColumn,
28
- icon: EditorLayoutSingleIcon
29
- }].concat(LAYOUT_TYPES);
30
- var SIDEBAR_LAYOUT_TYPES = [{
31
- id: 'editor.layout.twoRightSidebar',
32
- type: 'two_right_sidebar',
33
- title: toolbarMessages.rightSidebar,
34
- icon: LayoutTwoRightSidebarIcon
35
- }, {
36
- id: 'editor.layout.twoLeftSidebar',
37
- type: 'two_left_sidebar',
38
- title: toolbarMessages.leftSidebar,
39
- icon: LayoutTwoLeftSidebarIcon
40
- }, {
41
- id: 'editor.layout.threeWithSidebars',
42
- type: 'three_with_sidebars',
43
- title: toolbarMessages.threeColumnsWithSidebars,
44
- icon: LayoutThreeWithSidebarsIcon
45
- }];
46
- var buildLayoutButton = function buildLayoutButton(intl, item, currentLayout, editorAnalyticsAPI) {
47
- return {
48
- id: item.id,
49
- type: 'button',
50
- icon: item.icon,
51
- testId: item.title.id ? "".concat(item.title.id) : undefined,
52
- title: intl.formatMessage(item.title),
53
- onClick: setPresetLayout(editorAnalyticsAPI)(item.type),
54
- selected: !!currentLayout && currentLayout === item.type,
55
- tabIndex: null
56
- };
57
- };
58
- export var layoutToolbarTitle = 'Layout floating controls';
59
- export var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout, addSidebarLayouts, allowSingleColumnLayout, api) {
60
- var _api$decorations$acti, _api$decorations, _api$analytics;
61
- var _ref = (_api$decorations$acti = api === null || api === void 0 || (_api$decorations = api.decorations) === null || _api$decorations === void 0 ? void 0 : _api$decorations.actions) !== null && _api$decorations$acti !== void 0 ? _api$decorations$acti : {},
62
- hoverDecoration = _ref.hoverDecoration;
63
- var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
64
- var node = state.doc.nodeAt(pos);
65
- if (node) {
66
- var currentLayout = getPresetLayout(node);
67
- var separator = {
68
- type: 'separator'
69
- };
70
- var nodeType = state.schema.nodes.layoutSection;
71
- var deleteButton = {
72
- id: 'editor.layout.delete',
73
- type: 'button',
74
- appearance: 'danger',
75
- focusEditoronEnter: true,
76
- icon: RemoveIcon,
77
- testId: commonMessages.remove.id,
78
- title: intl.formatMessage(commonMessages.remove),
79
- onClick: deleteActiveLayoutNode(editorAnalyticsAPI),
80
- onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
81
- onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
82
- onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
83
- onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
84
- tabIndex: null
85
- };
86
- var layoutTypes = allowSingleColumnLayout ? LAYOUT_TYPES_WITH_SINGLE_COL : LAYOUT_TYPES;
87
- return {
88
- title: layoutToolbarTitle,
89
- getDomRef: function getDomRef(view) {
90
- return findDomRefAtPos(pos, view.domAtPos.bind(view));
91
- },
92
- nodeType: nodeType,
93
- items: [].concat(_toConsumableArray(layoutTypes.map(function (i) {
94
- return buildLayoutButton(intl, i, currentLayout, editorAnalyticsAPI);
95
- })), _toConsumableArray(addSidebarLayouts ? SIDEBAR_LAYOUT_TYPES.map(function (i) {
96
- return buildLayoutButton(intl, i, currentLayout, editorAnalyticsAPI);
97
- }) : []), [{
98
- type: 'copy-button',
99
- items: [separator, {
100
- state: state,
101
- formatMessage: intl.formatMessage,
102
- nodeType: nodeType
103
- }]
104
- }, separator, deleteButton]),
105
- scrollable: true
106
- };
107
- }
108
- return;
109
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,22 +0,0 @@
1
- import type { Node } from '@atlaskit/editor-prosemirror/model';
2
- import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
3
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
- import type { Change, PresetLayout } from './types';
5
- import type { TOOLBAR_MENU_TYPE, Command } from '@atlaskit/editor-common/types';
6
- export declare const ONE_COL_LAYOUTS: PresetLayout[];
7
- export declare const TWO_COL_LAYOUTS: PresetLayout[];
8
- export declare const THREE_COL_LAYOUTS: PresetLayout[];
9
- /**
10
- * Finds layout preset based on the width attrs of all the layoutColumn nodes
11
- * inside the layoutSection node
12
- */
13
- export declare const getPresetLayout: (section: Node) => PresetLayout | undefined;
14
- export declare const getSelectedLayout: (maybeLayoutSection: Node | undefined, current: PresetLayout) => PresetLayout;
15
- export declare const createDefaultLayoutSection: (state: EditorState) => Node;
16
- export declare const insertLayoutColumns: Command;
17
- export declare const insertLayoutColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: TOOLBAR_MENU_TYPE) => Command;
18
- export declare function forceSectionToPresetLayout(state: EditorState, node: Node, pos: number, presetLayout: PresetLayout): Transaction;
19
- export declare const setPresetLayout: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (layout: PresetLayout) => Command;
20
- export declare const fixColumnSizes: (changedTr: Transaction, state: EditorState) => Change | undefined;
21
- export declare const fixColumnStructure: (state: EditorState) => Transaction | undefined;
22
- export declare const deleteActiveLayoutNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
@@ -1,15 +0,0 @@
1
- import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
- import { insertLayoutColumnsWithAnalytics } from './actions';
3
- import { pluginKey } from './pm-plugins/plugin-key';
4
- import type { LayoutPluginOptions } from './types';
5
- import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
6
- import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
7
- export { pluginKey };
8
- export type LayoutPlugin = NextEditorPlugin<'layout', {
9
- pluginConfiguration: LayoutPluginOptions | undefined;
10
- dependencies: [DecorationsPlugin, OptionalPlugin<AnalyticsPlugin>];
11
- actions: {
12
- insertLayoutColumns: ReturnType<typeof insertLayoutColumnsWithAnalytics>;
13
- };
14
- }>;
15
- export declare const layoutPlugin: LayoutPlugin;
@@ -1,6 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { LayoutState } from './types';
3
- import type { LayoutPluginOptions } from '../types';
4
- export declare const DEFAULT_LAYOUT = "two_equal";
5
- declare const _default: (options: LayoutPluginOptions) => SafePlugin<LayoutState>;
6
- export default _default;
@@ -1,3 +0,0 @@
1
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
- import type { LayoutState } from './types';
3
- export declare const pluginKey: PluginKey<LayoutState>;
@@ -1,14 +0,0 @@
1
- import type { Slice } from '@atlaskit/editor-prosemirror/model';
2
- import type { PresetLayout } from '../types';
3
- export type LayoutState = {
4
- pos: number | null;
5
- allowBreakout: boolean;
6
- addSidebarLayouts: boolean;
7
- selectedLayout: PresetLayout | undefined;
8
- allowSingleColumnLayout: boolean;
9
- };
10
- export type Change = {
11
- from: number;
12
- to: number;
13
- slice: Slice;
14
- };
@@ -1,32 +0,0 @@
1
- export declare const toolbarMessages: {
2
- singleColumn: {
3
- id: string;
4
- defaultMessage: string;
5
- description: string;
6
- };
7
- twoColumns: {
8
- id: string;
9
- defaultMessage: string;
10
- description: string;
11
- };
12
- threeColumns: {
13
- id: string;
14
- defaultMessage: string;
15
- description: string;
16
- };
17
- rightSidebar: {
18
- id: string;
19
- defaultMessage: string;
20
- description: string;
21
- };
22
- leftSidebar: {
23
- id: string;
24
- defaultMessage: string;
25
- description: string;
26
- };
27
- threeColumnsWithSidebars: {
28
- id: string;
29
- defaultMessage: string;
30
- description: string;
31
- };
32
- };
@@ -1,6 +0,0 @@
1
- import type { IntlShape } from 'react-intl-next';
2
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
- import type { FloatingToolbarConfig, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
- import type { LayoutPlugin } from './';
5
- export declare const layoutToolbarTitle = "Layout floating controls";
6
- export declare const buildToolbar: (state: EditorState, intl: IntlShape, pos: number, _allowBreakout: boolean, addSidebarLayouts: boolean, allowSingleColumnLayout: boolean, api: ExtractInjectionAPI<LayoutPlugin> | undefined) => FloatingToolbarConfig | undefined;
@@ -1,13 +0,0 @@
1
- import type { Slice } from '@atlaskit/editor-prosemirror/model';
2
- import type { LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types';
3
- export interface LayoutPluginOptions extends LongPressSelectionPluginOptions {
4
- allowBreakout?: boolean;
5
- UNSAFE_addSidebarLayouts?: boolean;
6
- UNSAFE_allowSingleColumnLayout?: boolean;
7
- }
8
- export type PresetLayout = 'single' | 'two_equal' | 'three_equal' | 'two_right_sidebar' | 'two_left_sidebar' | 'three_with_sidebars';
9
- export interface Change {
10
- from: number;
11
- to: number;
12
- slice: Slice;
13
- }
@@ -1,22 +0,0 @@
1
- import type { Node } from '@atlaskit/editor-prosemirror/model';
2
- import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
3
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
- import type { Change, PresetLayout } from './types';
5
- import type { TOOLBAR_MENU_TYPE, Command } from '@atlaskit/editor-common/types';
6
- export declare const ONE_COL_LAYOUTS: PresetLayout[];
7
- export declare const TWO_COL_LAYOUTS: PresetLayout[];
8
- export declare const THREE_COL_LAYOUTS: PresetLayout[];
9
- /**
10
- * Finds layout preset based on the width attrs of all the layoutColumn nodes
11
- * inside the layoutSection node
12
- */
13
- export declare const getPresetLayout: (section: Node) => PresetLayout | undefined;
14
- export declare const getSelectedLayout: (maybeLayoutSection: Node | undefined, current: PresetLayout) => PresetLayout;
15
- export declare const createDefaultLayoutSection: (state: EditorState) => Node;
16
- export declare const insertLayoutColumns: Command;
17
- export declare const insertLayoutColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: TOOLBAR_MENU_TYPE) => Command;
18
- export declare function forceSectionToPresetLayout(state: EditorState, node: Node, pos: number, presetLayout: PresetLayout): Transaction;
19
- export declare const setPresetLayout: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (layout: PresetLayout) => Command;
20
- export declare const fixColumnSizes: (changedTr: Transaction, state: EditorState) => Change | undefined;
21
- export declare const fixColumnStructure: (state: EditorState) => Transaction | undefined;
22
- export declare const deleteActiveLayoutNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
@@ -1,18 +0,0 @@
1
- import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
- import { insertLayoutColumnsWithAnalytics } from './actions';
3
- import { pluginKey } from './pm-plugins/plugin-key';
4
- import type { LayoutPluginOptions } from './types';
5
- import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
6
- import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
7
- export { pluginKey };
8
- export type LayoutPlugin = NextEditorPlugin<'layout', {
9
- pluginConfiguration: LayoutPluginOptions | undefined;
10
- dependencies: [
11
- DecorationsPlugin,
12
- OptionalPlugin<AnalyticsPlugin>
13
- ];
14
- actions: {
15
- insertLayoutColumns: ReturnType<typeof insertLayoutColumnsWithAnalytics>;
16
- };
17
- }>;
18
- export declare const layoutPlugin: LayoutPlugin;
@@ -1,6 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { LayoutState } from './types';
3
- import type { LayoutPluginOptions } from '../types';
4
- export declare const DEFAULT_LAYOUT = "two_equal";
5
- declare const _default: (options: LayoutPluginOptions) => SafePlugin<LayoutState>;
6
- export default _default;
@@ -1,3 +0,0 @@
1
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
- import type { LayoutState } from './types';
3
- export declare const pluginKey: PluginKey<LayoutState>;
@@ -1,14 +0,0 @@
1
- import type { Slice } from '@atlaskit/editor-prosemirror/model';
2
- import type { PresetLayout } from '../types';
3
- export type LayoutState = {
4
- pos: number | null;
5
- allowBreakout: boolean;
6
- addSidebarLayouts: boolean;
7
- selectedLayout: PresetLayout | undefined;
8
- allowSingleColumnLayout: boolean;
9
- };
10
- export type Change = {
11
- from: number;
12
- to: number;
13
- slice: Slice;
14
- };
@@ -1,32 +0,0 @@
1
- export declare const toolbarMessages: {
2
- singleColumn: {
3
- id: string;
4
- defaultMessage: string;
5
- description: string;
6
- };
7
- twoColumns: {
8
- id: string;
9
- defaultMessage: string;
10
- description: string;
11
- };
12
- threeColumns: {
13
- id: string;
14
- defaultMessage: string;
15
- description: string;
16
- };
17
- rightSidebar: {
18
- id: string;
19
- defaultMessage: string;
20
- description: string;
21
- };
22
- leftSidebar: {
23
- id: string;
24
- defaultMessage: string;
25
- description: string;
26
- };
27
- threeColumnsWithSidebars: {
28
- id: string;
29
- defaultMessage: string;
30
- description: string;
31
- };
32
- };
@@ -1,6 +0,0 @@
1
- import type { IntlShape } from 'react-intl-next';
2
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
- import type { FloatingToolbarConfig, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
- import type { LayoutPlugin } from './';
5
- export declare const layoutToolbarTitle = "Layout floating controls";
6
- export declare const buildToolbar: (state: EditorState, intl: IntlShape, pos: number, _allowBreakout: boolean, addSidebarLayouts: boolean, allowSingleColumnLayout: boolean, api: ExtractInjectionAPI<LayoutPlugin> | undefined) => FloatingToolbarConfig | undefined;
@@ -1,13 +0,0 @@
1
- import type { Slice } from '@atlaskit/editor-prosemirror/model';
2
- import type { LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types';
3
- export interface LayoutPluginOptions extends LongPressSelectionPluginOptions {
4
- allowBreakout?: boolean;
5
- UNSAFE_addSidebarLayouts?: boolean;
6
- UNSAFE_allowSingleColumnLayout?: boolean;
7
- }
8
- export type PresetLayout = 'single' | 'two_equal' | 'three_equal' | 'two_right_sidebar' | 'two_left_sidebar' | 'three_with_sidebars';
9
- export interface Change {
10
- from: number;
11
- to: number;
12
- slice: Slice;
13
- }