@atlaskit/editor-plugin-panel 13.0.2 → 13.0.4

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/editor-plugin-panel
2
2
 
3
+ ## 13.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`4c2645b77929d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4c2645b77929d) -
8
+ [ux] EDITOR-7346 add ai and diff plugin support for panel_c1
9
+ - Updated dependencies
10
+
11
+ ## 13.0.3
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 13.0.2
4
18
 
5
19
  ### Patch Changes
@@ -15,12 +15,12 @@ var _insert = require("@atlaskit/editor-common/insert");
15
15
  var _messages = require("@atlaskit/editor-common/messages");
16
16
  var _quickInsert = require("@atlaskit/editor-common/quick-insert");
17
17
  var _utils = require("@atlaskit/editor-common/utils");
18
+ var _nodeTypeUtils = require("@atlaskit/editor-common/utils/node-type-utils");
18
19
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
19
20
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
20
21
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
21
22
  var _keymaps = _interopRequireDefault(require("./pm-plugins/keymaps"));
22
23
  var _main = require("./pm-plugins/main");
23
- var _utils2 = require("./pm-plugins/utils/utils");
24
24
  var _panelBlockMenuItem = require("./ui/panelBlockMenuItem");
25
25
  var _toolbar = require("./ui/toolbar");
26
26
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -271,7 +271,7 @@ function createPanelAction(_ref4) {
271
271
  typeAheadInsert = _ref4.typeAheadInsert,
272
272
  _ref4$inputMethod = _ref4.inputMethod,
273
273
  inputMethod = _ref4$inputMethod === void 0 ? _analytics.INPUT_METHOD.QUICK_INSERT : _ref4$inputMethod;
274
- var panelNodeType = (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) ? (0, _utils2.pickPanelTypeForInsertion)(state) : state.schema.nodes.panel;
274
+ var panelNodeType = (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) ? (0, _nodeTypeUtils.pickPanelTypeForInsertion)(state.selection.$from) : state.schema.nodes.panel;
275
275
  var tr;
276
276
  // If the selection is empty, we want to insert the panel on a new line
277
277
  if (state.selection.empty) {
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.pickPanelTypeForInsertion = exports.panelTypes = exports.panelContentCheck = exports.panelAttrsToDom = exports.isPanel = exports.handleCut = exports.findPanel = void 0;
7
+ exports.panelTypes = exports.panelContentCheck = exports.panelAttrsToDom = exports.isPanel = exports.handleCut = exports.findPanel = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _adfSchema = require("@atlaskit/adf-schema");
10
10
  var _panel = require("@atlaskit/editor-common/panel");
@@ -27,28 +27,6 @@ var panelTypes = exports.panelTypes = function panelTypes(nodes) {
27
27
  var findPanel = exports.findPanel = function findPanel(state, selection) {
28
28
  return (0, _utils.findSelectedNodeOfType)(panelTypes(state.schema.nodes))(selection || state.selection) || (0, _utils.findParentNodeOfType)(panelTypes(state.schema.nodes))(selection || state.selection);
29
29
  };
30
- var pickPanelTypeForInsertion = exports.pickPanelTypeForInsertion = function pickPanelTypeForInsertion(input) {
31
- var selection = 'selection' in input ? input.selection : input;
32
- var schema = selection.$from.doc.type.schema;
33
- var _schema$nodes = schema.nodes,
34
- panel = _schema$nodes.panel,
35
- panel_c1 = _schema$nodes.panel_c1;
36
- var $from = selection.$from;
37
- for (var depth = $from.depth; depth >= 0; depth--) {
38
- var parent = $from.node(depth);
39
- var index = $from.index(depth);
40
- if (parent.canReplaceWith(index, index, panel_c1)) {
41
- return panel_c1;
42
- }
43
- var spec = parent.type.spec;
44
- // Stop at isolating containers (e.g. expand, tableCell) — hard walls where
45
- // the panel stays inside and should use the regular panel type.
46
- if (spec.isolating) {
47
- return panel;
48
- }
49
- }
50
- return panel;
51
- };
52
30
  var panelAttrsToDom = exports.panelAttrsToDom = function panelAttrsToDom(attrs, allowCustomPanel) {
53
31
  var panelColor = attrs.panelColor,
54
32
  panelType = attrs.panelType,
@@ -9,10 +9,10 @@ var _react = _interopRequireDefault(require("react"));
9
9
  var _reactIntl = require("react-intl");
10
10
  var _analytics = require("@atlaskit/editor-common/analytics");
11
11
  var _messages = require("@atlaskit/editor-common/messages");
12
+ var _nodeTypeUtils = require("@atlaskit/editor-common/utils/node-type-utils");
12
13
  var _editorToolbar = require("@atlaskit/editor-toolbar");
13
14
  var _informationCircle = _interopRequireDefault(require("@atlaskit/icon/core/information-circle"));
14
15
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
15
- var _utils = require("../pm-plugins/utils/utils");
16
16
  var NODE_NAME = 'panel';
17
17
  var PanelBlockMenuItem = function PanelBlockMenuItem(_ref) {
18
18
  var api = _ref.api;
@@ -24,7 +24,7 @@ var PanelBlockMenuItem = function PanelBlockMenuItem(_ref) {
24
24
  api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
25
25
  var _api$blockMenu;
26
26
  var tr = _ref2.tr;
27
- var panelNodeType = (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) ? (0, _utils.pickPanelTypeForInsertion)(tr.selection) : tr.doc.type.schema.nodes.panel;
27
+ var panelNodeType = (0, _expValEquals.expValEquals)('platform_editor_nest_table_in_panel', 'isEnabled', true) ? (0, _nodeTypeUtils.pickPanelTypeForInsertion)(tr.selection.$from) : tr.doc.type.schema.nodes.panel;
28
28
  var command = api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.transformNode(panelNodeType, {
29
29
  inputMethod: inputMethod,
30
30
  triggeredFrom: triggeredFrom,
@@ -6,12 +6,12 @@ import { insertSelectedItem } from '@atlaskit/editor-common/insert';
6
6
  import { blockTypeMessages } from '@atlaskit/editor-common/messages';
7
7
  import { IconCustomPanel, IconPanel, IconPanelError, IconPanelNote, IconPanelSuccess, IconPanelWarning } from '@atlaskit/editor-common/quick-insert';
8
8
  import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
9
+ import { pickPanelTypeForInsertion } from '@atlaskit/editor-common/utils/node-type-utils';
9
10
  import { fg } from '@atlaskit/platform-feature-flags';
10
11
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
11
12
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
12
13
  import keymap from './pm-plugins/keymaps';
13
14
  import { createPlugin } from './pm-plugins/main';
14
- import { pickPanelTypeForInsertion } from './pm-plugins/utils/utils';
15
15
  import { createPanelBlockMenuItem } from './ui/panelBlockMenuItem';
16
16
  import { getToolbarConfig } from './ui/toolbar';
17
17
  const PANEL_NODE_NAME = 'panel';
@@ -246,7 +246,7 @@ function createPanelAction({
246
246
  inputMethod = INPUT_METHOD.QUICK_INSERT
247
247
  }) {
248
248
  var _tr;
249
- const panelNodeType = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? pickPanelTypeForInsertion(state) : state.schema.nodes.panel;
249
+ const panelNodeType = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? pickPanelTypeForInsertion(state.selection.$from) : state.schema.nodes.panel;
250
250
  let tr;
251
251
  // If the selection is empty, we want to insert the panel on a new line
252
252
  if (state.selection.empty) {
@@ -19,29 +19,6 @@ export const panelTypes = nodes => {
19
19
  export const findPanel = (state, selection) => {
20
20
  return findSelectedNodeOfType(panelTypes(state.schema.nodes))(selection || state.selection) || findParentNodeOfType(panelTypes(state.schema.nodes))(selection || state.selection);
21
21
  };
22
- export const pickPanelTypeForInsertion = input => {
23
- const selection = 'selection' in input ? input.selection : input;
24
- const schema = selection.$from.doc.type.schema;
25
- const {
26
- panel,
27
- panel_c1
28
- } = schema.nodes;
29
- const $from = selection.$from;
30
- for (let depth = $from.depth; depth >= 0; depth--) {
31
- const parent = $from.node(depth);
32
- const index = $from.index(depth);
33
- if (parent.canReplaceWith(index, index, panel_c1)) {
34
- return panel_c1;
35
- }
36
- const spec = parent.type.spec;
37
- // Stop at isolating containers (e.g. expand, tableCell) — hard walls where
38
- // the panel stays inside and should use the regular panel type.
39
- if (spec.isolating) {
40
- return panel;
41
- }
42
- }
43
- return panel;
44
- };
45
22
  export const panelAttrsToDom = (attrs, allowCustomPanel) => {
46
23
  const {
47
24
  panelColor,
@@ -2,10 +2,10 @@ import React from 'react';
2
2
  import { useIntl } from 'react-intl';
3
3
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import { blockTypeMessages } from '@atlaskit/editor-common/messages';
5
+ import { pickPanelTypeForInsertion } from '@atlaskit/editor-common/utils/node-type-utils';
5
6
  import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
6
7
  import InformationCircleIcon from '@atlaskit/icon/core/information-circle';
7
8
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
8
- import { pickPanelTypeForInsertion } from '../pm-plugins/utils/utils';
9
9
  const NODE_NAME = 'panel';
10
10
  const PanelBlockMenuItem = ({
11
11
  api
@@ -20,7 +20,7 @@ const PanelBlockMenuItem = ({
20
20
  tr
21
21
  }) => {
22
22
  var _api$blockMenu;
23
- const panelNodeType = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? pickPanelTypeForInsertion(tr.selection) : tr.doc.type.schema.nodes.panel;
23
+ const panelNodeType = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? pickPanelTypeForInsertion(tr.selection.$from) : tr.doc.type.schema.nodes.panel;
24
24
  const command = api === null || api === void 0 ? void 0 : (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.transformNode(panelNodeType, {
25
25
  inputMethod,
26
26
  triggeredFrom,
@@ -10,12 +10,12 @@ import { insertSelectedItem } from '@atlaskit/editor-common/insert';
10
10
  import { blockTypeMessages } from '@atlaskit/editor-common/messages';
11
11
  import { IconCustomPanel, IconPanel, IconPanelError, IconPanelNote, IconPanelSuccess, IconPanelWarning } from '@atlaskit/editor-common/quick-insert';
12
12
  import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
13
+ import { pickPanelTypeForInsertion } from '@atlaskit/editor-common/utils/node-type-utils';
13
14
  import { fg } from '@atlaskit/platform-feature-flags';
14
15
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
15
16
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
16
17
  import keymap from './pm-plugins/keymaps';
17
18
  import { createPlugin } from './pm-plugins/main';
18
- import { pickPanelTypeForInsertion } from './pm-plugins/utils/utils';
19
19
  import { createPanelBlockMenuItem } from './ui/panelBlockMenuItem';
20
20
  import { getToolbarConfig } from './ui/toolbar';
21
21
  var PANEL_NODE_NAME = 'panel';
@@ -264,7 +264,7 @@ function createPanelAction(_ref4) {
264
264
  typeAheadInsert = _ref4.typeAheadInsert,
265
265
  _ref4$inputMethod = _ref4.inputMethod,
266
266
  inputMethod = _ref4$inputMethod === void 0 ? INPUT_METHOD.QUICK_INSERT : _ref4$inputMethod;
267
- var panelNodeType = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? pickPanelTypeForInsertion(state) : state.schema.nodes.panel;
267
+ var panelNodeType = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? pickPanelTypeForInsertion(state.selection.$from) : state.schema.nodes.panel;
268
268
  var tr;
269
269
  // If the selection is empty, we want to insert the panel on a new line
270
270
  if (state.selection.empty) {
@@ -20,28 +20,6 @@ export var panelTypes = function panelTypes(nodes) {
20
20
  export var findPanel = function findPanel(state, selection) {
21
21
  return findSelectedNodeOfType(panelTypes(state.schema.nodes))(selection || state.selection) || findParentNodeOfType(panelTypes(state.schema.nodes))(selection || state.selection);
22
22
  };
23
- export var pickPanelTypeForInsertion = function pickPanelTypeForInsertion(input) {
24
- var selection = 'selection' in input ? input.selection : input;
25
- var schema = selection.$from.doc.type.schema;
26
- var _schema$nodes = schema.nodes,
27
- panel = _schema$nodes.panel,
28
- panel_c1 = _schema$nodes.panel_c1;
29
- var $from = selection.$from;
30
- for (var depth = $from.depth; depth >= 0; depth--) {
31
- var parent = $from.node(depth);
32
- var index = $from.index(depth);
33
- if (parent.canReplaceWith(index, index, panel_c1)) {
34
- return panel_c1;
35
- }
36
- var spec = parent.type.spec;
37
- // Stop at isolating containers (e.g. expand, tableCell) — hard walls where
38
- // the panel stays inside and should use the regular panel type.
39
- if (spec.isolating) {
40
- return panel;
41
- }
42
- }
43
- return panel;
44
- };
45
23
  export var panelAttrsToDom = function panelAttrsToDom(attrs, allowCustomPanel) {
46
24
  var panelColor = attrs.panelColor,
47
25
  panelType = attrs.panelType,
@@ -2,10 +2,10 @@ import React from 'react';
2
2
  import { useIntl } from 'react-intl';
3
3
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import { blockTypeMessages } from '@atlaskit/editor-common/messages';
5
+ import { pickPanelTypeForInsertion } from '@atlaskit/editor-common/utils/node-type-utils';
5
6
  import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
6
7
  import InformationCircleIcon from '@atlaskit/icon/core/information-circle';
7
8
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
8
- import { pickPanelTypeForInsertion } from '../pm-plugins/utils/utils';
9
9
  var NODE_NAME = 'panel';
10
10
  var PanelBlockMenuItem = function PanelBlockMenuItem(_ref) {
11
11
  var api = _ref.api;
@@ -17,7 +17,7 @@ var PanelBlockMenuItem = function PanelBlockMenuItem(_ref) {
17
17
  api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
18
18
  var _api$blockMenu;
19
19
  var tr = _ref2.tr;
20
- var panelNodeType = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? pickPanelTypeForInsertion(tr.selection) : tr.doc.type.schema.nodes.panel;
20
+ var panelNodeType = expValEquals('platform_editor_nest_table_in_panel', 'isEnabled', true) ? pickPanelTypeForInsertion(tr.selection.$from) : tr.doc.type.schema.nodes.panel;
21
21
  var command = api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.transformNode(panelNodeType, {
22
22
  inputMethod: inputMethod,
23
23
  triggeredFrom: triggeredFrom,
@@ -7,7 +7,6 @@ export declare const panelTypes: (nodes: {
7
7
  [key: string]: NodeType;
8
8
  }) => NodeType[];
9
9
  export declare const findPanel: (state: EditorState, selection?: Selection | null) => ReturnType<ReturnType<typeof findSelectedNodeOfType>> | ReturnType<ReturnType<typeof findParentNodeOfType>>;
10
- export declare const pickPanelTypeForInsertion: (input: EditorState | Selection) => NodeType;
11
10
  export declare const panelAttrsToDom: (attrs: PanelAttributes, allowCustomPanel: boolean) => DOMOutputSpec;
12
11
  export declare const handleCut: (newState: EditorState, oldState: EditorState) => Transaction | undefined;
13
12
  export declare const panelContentCheck: (newState: EditorState, oldState: EditorState) => boolean;
@@ -7,7 +7,6 @@ export declare const panelTypes: (nodes: {
7
7
  [key: string]: NodeType;
8
8
  }) => NodeType[];
9
9
  export declare const findPanel: (state: EditorState, selection?: Selection | null) => ReturnType<ReturnType<typeof findSelectedNodeOfType>> | ReturnType<ReturnType<typeof findParentNodeOfType>>;
10
- export declare const pickPanelTypeForInsertion: (input: EditorState | Selection) => NodeType;
11
10
  export declare const panelAttrsToDom: (attrs: PanelAttributes, allowCustomPanel: boolean) => DOMOutputSpec;
12
11
  export declare const handleCut: (newState: EditorState, oldState: EditorState) => Transaction | undefined;
13
12
  export declare const panelContentCheck: (newState: EditorState, oldState: EditorState) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-panel",
3
- "version": "13.0.2",
3
+ "version": "13.0.4",
4
4
  "description": "Panel plugin for @atlaskit/editor-core.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -41,13 +41,13 @@
41
41
  "@atlaskit/emoji": "^70.16.0",
42
42
  "@atlaskit/icon": "^35.4.0",
43
43
  "@atlaskit/platform-feature-flags": "^1.1.0",
44
- "@atlaskit/tmp-editor-statsig": "^89.1.0",
45
- "@atlaskit/tokens": "^13.1.0",
44
+ "@atlaskit/tmp-editor-statsig": "^90.2.0",
45
+ "@atlaskit/tokens": "^13.3.0",
46
46
  "@babel/runtime": "^7.0.0",
47
47
  "uuid": "^3.1.0"
48
48
  },
49
49
  "peerDependencies": {
50
- "@atlaskit/editor-common": "^115.6.0",
50
+ "@atlaskit/editor-common": "^115.7.0",
51
51
  "react": "^18.2.0",
52
52
  "react-dom": "^18.2.0",
53
53
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"