@atlaskit/editor-plugin-paste-options-toolbar 0.3.1 → 0.3.3

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,17 @@
1
1
  # @atlaskit/editor-plugin-paste-options-toolbar
2
2
 
3
+ ## 0.3.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 0.3.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [#43282](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43282) [`ea6aae16859`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ea6aae16859) - Fixed extra paragraph added on pasting codeblock and modified relevant testcases
14
+
3
15
  ## 0.3.1
4
16
 
5
17
  ### Patch Changes
@@ -14,7 +14,7 @@ var _types = require("./types");
14
14
  var _pasteIcon = _interopRequireDefault(require("./ui/paste-icon"));
15
15
  var _util = require("./util");
16
16
  var isToolbarVisible = exports.isToolbarVisible = function isToolbarVisible(state, lastContentPasted) {
17
- var _$from$node;
17
+ var _$from$parent, _$from$node;
18
18
  /**
19
19
  * Conditions for not showing the toolbar:
20
20
  * 1. Feature flag is disabled
@@ -23,6 +23,7 @@ var isToolbarVisible = exports.isToolbarVisible = function isToolbarVisible(stat
23
23
  * 4. Pasting link, media or text containing media(note: markdown link and images are allowed)
24
24
  * 5. Content is pasted in a nested node(i.e. inside a table, panel etc.).
25
25
  * (grandParent node should be root doc for showing up the toolbar)
26
+ * 6. Cursor is inside the codeblock.
26
27
  */
27
28
  if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.paste-options-toolbar')) {
28
29
  return false;
@@ -31,8 +32,9 @@ var isToolbarVisible = exports.isToolbarVisible = function isToolbarVisible(stat
31
32
  if ((0, _util.hasRuleNode)(lastContentPasted.pastedSlice, state.schema)) {
32
33
  return false;
33
34
  }
35
+ var parentNodeType = (_$from$parent = $from.parent) === null || _$from$parent === void 0 ? void 0 : _$from$parent.type;
34
36
  var grandParentNodeType = (_$from$node = $from.node($from.depth - 1)) === null || _$from$node === void 0 ? void 0 : _$from$node.type;
35
- if (grandParentNodeType && grandParentNodeType.name === state.schema.nodes.doc.name && !(0, _util.isPastedFromFabricEditor)(lastContentPasted.pasteSource) && !(0, _util.hasLinkMark)(lastContentPasted.pastedSlice) && !(0, _util.hasMediaNode)(lastContentPasted.pastedSlice)) {
37
+ if (grandParentNodeType && grandParentNodeType.name === state.schema.nodes.doc.name && parentNodeType.name !== state.schema.nodes.codeBlock.name && !(0, _util.isPastedFromFabricEditor)(lastContentPasted.pasteSource) && !(0, _util.hasLinkMark)(lastContentPasted.pastedSlice) && !(0, _util.hasMediaNode)(lastContentPasted.pastedSlice)) {
36
38
  return true;
37
39
  }
38
40
  return false;
@@ -7,7 +7,7 @@ import { pasteOptionsPluginKey, ToolbarDropdownOption } from './types';
7
7
  import EditorPasteIcon from './ui/paste-icon';
8
8
  import { hasLinkMark, hasMediaNode, hasRuleNode, isPastedFromFabricEditor } from './util';
9
9
  export const isToolbarVisible = (state, lastContentPasted) => {
10
- var _$from$node;
10
+ var _$from$parent, _$from$node;
11
11
  /**
12
12
  * Conditions for not showing the toolbar:
13
13
  * 1. Feature flag is disabled
@@ -16,6 +16,7 @@ export const isToolbarVisible = (state, lastContentPasted) => {
16
16
  * 4. Pasting link, media or text containing media(note: markdown link and images are allowed)
17
17
  * 5. Content is pasted in a nested node(i.e. inside a table, panel etc.).
18
18
  * (grandParent node should be root doc for showing up the toolbar)
19
+ * 6. Cursor is inside the codeblock.
19
20
  */
20
21
  if (!getBooleanFF('platform.editor.paste-options-toolbar')) {
21
22
  return false;
@@ -24,8 +25,9 @@ export const isToolbarVisible = (state, lastContentPasted) => {
24
25
  if (hasRuleNode(lastContentPasted.pastedSlice, state.schema)) {
25
26
  return false;
26
27
  }
28
+ const parentNodeType = (_$from$parent = $from.parent) === null || _$from$parent === void 0 ? void 0 : _$from$parent.type;
27
29
  const grandParentNodeType = (_$from$node = $from.node($from.depth - 1)) === null || _$from$node === void 0 ? void 0 : _$from$node.type;
28
- if (grandParentNodeType && grandParentNodeType.name === state.schema.nodes.doc.name && !isPastedFromFabricEditor(lastContentPasted.pasteSource) && !hasLinkMark(lastContentPasted.pastedSlice) && !hasMediaNode(lastContentPasted.pastedSlice)) {
30
+ if (grandParentNodeType && grandParentNodeType.name === state.schema.nodes.doc.name && parentNodeType.name !== state.schema.nodes.codeBlock.name && !isPastedFromFabricEditor(lastContentPasted.pasteSource) && !hasLinkMark(lastContentPasted.pastedSlice) && !hasMediaNode(lastContentPasted.pastedSlice)) {
29
31
  return true;
30
32
  }
31
33
  return false;
@@ -7,7 +7,7 @@ import { pasteOptionsPluginKey, ToolbarDropdownOption } from './types';
7
7
  import EditorPasteIcon from './ui/paste-icon';
8
8
  import { hasLinkMark, hasMediaNode, hasRuleNode, isPastedFromFabricEditor } from './util';
9
9
  export var isToolbarVisible = function isToolbarVisible(state, lastContentPasted) {
10
- var _$from$node;
10
+ var _$from$parent, _$from$node;
11
11
  /**
12
12
  * Conditions for not showing the toolbar:
13
13
  * 1. Feature flag is disabled
@@ -16,6 +16,7 @@ export var isToolbarVisible = function isToolbarVisible(state, lastContentPasted
16
16
  * 4. Pasting link, media or text containing media(note: markdown link and images are allowed)
17
17
  * 5. Content is pasted in a nested node(i.e. inside a table, panel etc.).
18
18
  * (grandParent node should be root doc for showing up the toolbar)
19
+ * 6. Cursor is inside the codeblock.
19
20
  */
20
21
  if (!getBooleanFF('platform.editor.paste-options-toolbar')) {
21
22
  return false;
@@ -24,8 +25,9 @@ export var isToolbarVisible = function isToolbarVisible(state, lastContentPasted
24
25
  if (hasRuleNode(lastContentPasted.pastedSlice, state.schema)) {
25
26
  return false;
26
27
  }
28
+ var parentNodeType = (_$from$parent = $from.parent) === null || _$from$parent === void 0 ? void 0 : _$from$parent.type;
27
29
  var grandParentNodeType = (_$from$node = $from.node($from.depth - 1)) === null || _$from$node === void 0 ? void 0 : _$from$node.type;
28
- if (grandParentNodeType && grandParentNodeType.name === state.schema.nodes.doc.name && !isPastedFromFabricEditor(lastContentPasted.pasteSource) && !hasLinkMark(lastContentPasted.pastedSlice) && !hasMediaNode(lastContentPasted.pastedSlice)) {
30
+ if (grandParentNodeType && grandParentNodeType.name === state.schema.nodes.doc.name && parentNodeType.name !== state.schema.nodes.codeBlock.name && !isPastedFromFabricEditor(lastContentPasted.pasteSource) && !hasLinkMark(lastContentPasted.pastedSlice) && !hasMediaNode(lastContentPasted.pastedSlice)) {
29
31
  return true;
30
32
  }
31
33
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste-options-toolbar",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Paste options toolbar for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -36,15 +36,15 @@
36
36
  "./styles": "./src/styles.ts"
37
37
  },
38
38
  "dependencies": {
39
- "@atlaskit/editor-common": "^76.22.0",
39
+ "@atlaskit/editor-common": "^76.26.0",
40
40
  "@atlaskit/editor-markdown-transformer": "^5.2.5",
41
- "@atlaskit/editor-plugin-analytics": "^0.3.0",
41
+ "@atlaskit/editor-plugin-analytics": "^0.4.0",
42
42
  "@atlaskit/editor-plugin-paste": "^0.1.0",
43
43
  "@atlaskit/editor-prosemirror": "1.1.0",
44
44
  "@atlaskit/editor-shared-styles": "^2.8.0",
45
45
  "@atlaskit/icon": "^22.0.0",
46
46
  "@atlaskit/platform-feature-flags": "^0.2.4",
47
- "@atlaskit/tokens": "^1.25.0",
47
+ "@atlaskit/tokens": "^1.29.0",
48
48
  "@babel/runtime": "^7.0.0",
49
49
  "@emotion/react": "^11.7.1",
50
50
  "react-intl-next": "npm:react-intl@^5.18.1"
@@ -1,19 +0,0 @@
1
- ## API Report File for "@atlaskit/editor-plugin-paste-options-toolbar"
2
-
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
-
5
- ```ts
6
-
7
- import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
8
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
9
- import type { OptionalPlugin } from '@atlaskit/editor-common/types';
10
- import type { PastePlugin } from '@atlaskit/editor-plugin-paste';
11
-
12
- // @public (undocumented)
13
- export const pasteOptionsToolbarPlugin: NextEditorPlugin<'pasteOptionsToolbarPlugin', {
14
- dependencies: [OptionalPlugin<AnalyticsPlugin>, PastePlugin];
15
- }>;
16
-
17
- // (No @packageDocumentation comment for this package)
18
-
19
- ```