@atlaskit/editor-plugin-paste-options-toolbar 0.2.3 → 0.3.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 +6 -0
- package/dist/cjs/toolbar.js +1 -1
- package/dist/cjs/util/index.js +14 -2
- package/dist/es2019/toolbar.js +1 -1
- package/dist/es2019/util/index.js +12 -2
- package/dist/esm/toolbar.js +1 -1
- package/dist/esm/util/index.js +14 -2
- package/dist/types/util/index.d.ts +1 -2
- package/dist/types-ts4.5/util/index.d.ts +1 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-paste-options-toolbar
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#42718](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42718) [`954af7ba44b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/954af7ba44b) - Changing hasLinkMark function to use pasted slice instead of state.doc while searching for link in pasted text.
|
|
8
|
+
|
|
3
9
|
## 0.2.3
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/cjs/toolbar.js
CHANGED
|
@@ -32,7 +32,7 @@ var isToolbarVisible = exports.isToolbarVisible = function isToolbarVisible(stat
|
|
|
32
32
|
return false;
|
|
33
33
|
}
|
|
34
34
|
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)(
|
|
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)) {
|
|
36
36
|
return true;
|
|
37
37
|
}
|
|
38
38
|
return false;
|
package/dist/cjs/util/index.js
CHANGED
|
@@ -40,6 +40,18 @@ var hasRuleNode = exports.hasRuleNode = function hasRuleNode(slice, schema) {
|
|
|
40
40
|
});
|
|
41
41
|
return hasRuleNode;
|
|
42
42
|
};
|
|
43
|
-
var hasLinkMark = exports.hasLinkMark = function hasLinkMark(
|
|
44
|
-
|
|
43
|
+
var hasLinkMark = exports.hasLinkMark = function hasLinkMark(slice) {
|
|
44
|
+
var hasLinkMark = false;
|
|
45
|
+
slice.content.descendants(function (node) {
|
|
46
|
+
var _node$marks;
|
|
47
|
+
var marks = (_node$marks = node.marks) === null || _node$marks === void 0 ? void 0 : _node$marks.map(function (mark) {
|
|
48
|
+
return mark.type.name;
|
|
49
|
+
});
|
|
50
|
+
hasLinkMark = marks === null || marks === void 0 ? void 0 : marks.includes('link');
|
|
51
|
+
if (hasLinkMark) {
|
|
52
|
+
//break out of loop
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
return hasLinkMark;
|
|
45
57
|
};
|
package/dist/es2019/toolbar.js
CHANGED
|
@@ -25,7 +25,7 @@ export const isToolbarVisible = (state, lastContentPasted) => {
|
|
|
25
25
|
return false;
|
|
26
26
|
}
|
|
27
27
|
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(
|
|
28
|
+
if (grandParentNodeType && grandParentNodeType.name === state.schema.nodes.doc.name && !isPastedFromFabricEditor(lastContentPasted.pasteSource) && !hasLinkMark(lastContentPasted.pastedSlice) && !hasMediaNode(lastContentPasted.pastedSlice)) {
|
|
29
29
|
return true;
|
|
30
30
|
}
|
|
31
31
|
return false;
|
|
@@ -32,6 +32,16 @@ export const hasRuleNode = (slice, schema) => {
|
|
|
32
32
|
});
|
|
33
33
|
return hasRuleNode;
|
|
34
34
|
};
|
|
35
|
-
export const hasLinkMark =
|
|
36
|
-
|
|
35
|
+
export const hasLinkMark = slice => {
|
|
36
|
+
let hasLinkMark = false;
|
|
37
|
+
slice.content.descendants(node => {
|
|
38
|
+
var _node$marks;
|
|
39
|
+
const marks = (_node$marks = node.marks) === null || _node$marks === void 0 ? void 0 : _node$marks.map(mark => mark.type.name);
|
|
40
|
+
hasLinkMark = marks === null || marks === void 0 ? void 0 : marks.includes('link');
|
|
41
|
+
if (hasLinkMark) {
|
|
42
|
+
//break out of loop
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return hasLinkMark;
|
|
37
47
|
};
|
package/dist/esm/toolbar.js
CHANGED
|
@@ -25,7 +25,7 @@ export var isToolbarVisible = function isToolbarVisible(state, lastContentPasted
|
|
|
25
25
|
return false;
|
|
26
26
|
}
|
|
27
27
|
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(
|
|
28
|
+
if (grandParentNodeType && grandParentNodeType.name === state.schema.nodes.doc.name && !isPastedFromFabricEditor(lastContentPasted.pasteSource) && !hasLinkMark(lastContentPasted.pastedSlice) && !hasMediaNode(lastContentPasted.pastedSlice)) {
|
|
29
29
|
return true;
|
|
30
30
|
}
|
|
31
31
|
return false;
|
package/dist/esm/util/index.js
CHANGED
|
@@ -32,6 +32,18 @@ export var hasRuleNode = function hasRuleNode(slice, schema) {
|
|
|
32
32
|
});
|
|
33
33
|
return hasRuleNode;
|
|
34
34
|
};
|
|
35
|
-
export var hasLinkMark = function hasLinkMark(
|
|
36
|
-
|
|
35
|
+
export var hasLinkMark = function hasLinkMark(slice) {
|
|
36
|
+
var hasLinkMark = false;
|
|
37
|
+
slice.content.descendants(function (node) {
|
|
38
|
+
var _node$marks;
|
|
39
|
+
var marks = (_node$marks = node.marks) === null || _node$marks === void 0 ? void 0 : _node$marks.map(function (mark) {
|
|
40
|
+
return mark.type.name;
|
|
41
|
+
});
|
|
42
|
+
hasLinkMark = marks === null || marks === void 0 ? void 0 : marks.includes('link');
|
|
43
|
+
if (hasLinkMark) {
|
|
44
|
+
//break out of loop
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return hasLinkMark;
|
|
37
49
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Schema, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
2
|
export declare function isPastedFromFabricEditor(pastedFrom: string): boolean;
|
|
4
3
|
export declare function escapeLinks(text: string): string;
|
|
5
4
|
export declare const hasMediaNode: (slice: Slice | undefined) => boolean;
|
|
6
5
|
export declare const hasRuleNode: (slice: Slice, schema: Schema) => boolean;
|
|
7
|
-
export declare const hasLinkMark: (
|
|
6
|
+
export declare const hasLinkMark: (slice: Slice) => boolean;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Schema, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
2
|
export declare function isPastedFromFabricEditor(pastedFrom: string): boolean;
|
|
4
3
|
export declare function escapeLinks(text: string): string;
|
|
5
4
|
export declare const hasMediaNode: (slice: Slice | undefined) => boolean;
|
|
6
5
|
export declare const hasRuleNode: (slice: Slice, schema: Schema) => boolean;
|
|
7
|
-
export declare const hasLinkMark: (
|
|
6
|
+
export declare const hasLinkMark: (slice: Slice) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-paste-options-toolbar",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Paste options toolbar for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"./styles": "./src/styles.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@atlaskit/editor-common": "^76.
|
|
39
|
+
"@atlaskit/editor-common": "^76.18.0",
|
|
40
40
|
"@atlaskit/editor-markdown-transformer": "^5.2.5",
|
|
41
41
|
"@atlaskit/editor-plugin-analytics": "^0.3.0",
|
|
42
42
|
"@atlaskit/editor-plugin-paste": "^0.1.0",
|