@atlaskit/editor-plugin-synced-block 4.7.1 → 4.8.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 +11 -0
- package/dist/cjs/pm-plugins/main.js +14 -2
- package/dist/es2019/pm-plugins/main.js +14 -2
- package/dist/esm/pm-plugins/main.js +14 -2
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-synced-block
|
|
2
2
|
|
|
3
|
+
## 4.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`f68624ad1f930`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f68624ad1f930) -
|
|
8
|
+
Do not show copied flag on drag and drop
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 4.7.1
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -48,6 +48,8 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
48
48
|
var confirmationTransactionRef = {
|
|
49
49
|
current: undefined
|
|
50
50
|
};
|
|
51
|
+
// Track if a copy event occurred to distinguish copy from drag and drop
|
|
52
|
+
var isCopyEvent = false;
|
|
51
53
|
return new _safePlugin.SafePlugin({
|
|
52
54
|
key: syncedBlockPluginKey,
|
|
53
55
|
state: {
|
|
@@ -126,6 +128,10 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
126
128
|
},
|
|
127
129
|
mousedown: function mousedown(view, event) {
|
|
128
130
|
return (0, _ignoreDomEvent.shouldIgnoreDomEvent)(view, event, api);
|
|
131
|
+
},
|
|
132
|
+
copy: function copy() {
|
|
133
|
+
isCopyEvent = true;
|
|
134
|
+
return false;
|
|
129
135
|
}
|
|
130
136
|
},
|
|
131
137
|
transformCopied: function transformCopied(slice, _ref3) {
|
|
@@ -133,12 +139,16 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
133
139
|
var pluginState = syncedBlockPluginKey.getState(state);
|
|
134
140
|
var syncBlockStore = pluginState === null || pluginState === void 0 ? void 0 : pluginState.syncBlockStore;
|
|
135
141
|
var schema = state.schema;
|
|
142
|
+
var isCopy = isCopyEvent;
|
|
143
|
+
isCopyEvent = false;
|
|
136
144
|
if (!syncBlockStore) {
|
|
137
145
|
return slice;
|
|
138
146
|
}
|
|
139
147
|
return (0, _utils.mapSlice)(slice, function (node) {
|
|
140
148
|
if (node.type.name === 'syncBlock') {
|
|
141
|
-
|
|
149
|
+
if (isCopy) {
|
|
150
|
+
showCopiedFlag(api);
|
|
151
|
+
}
|
|
142
152
|
return node;
|
|
143
153
|
}
|
|
144
154
|
if (node.type.name === 'bodiedSyncBlock' && node.attrs.resourceId) {
|
|
@@ -147,7 +157,9 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
147
157
|
if (!(0, _utils2.sliceFullyContainsNode)(slice, node)) {
|
|
148
158
|
return node.content;
|
|
149
159
|
}
|
|
150
|
-
|
|
160
|
+
if (isCopy) {
|
|
161
|
+
showCopiedFlag(api);
|
|
162
|
+
}
|
|
151
163
|
var newResourceId = syncBlockStore.referenceManager.generateResourceIdForReference(node.attrs.resourceId);
|
|
152
164
|
// Convert bodiedSyncBlock to syncBlock
|
|
153
165
|
// The paste transformation will regenrate the localId
|
|
@@ -36,6 +36,8 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
|
|
|
36
36
|
const confirmationTransactionRef = {
|
|
37
37
|
current: undefined
|
|
38
38
|
};
|
|
39
|
+
// Track if a copy event occurred to distinguish copy from drag and drop
|
|
40
|
+
let isCopyEvent = false;
|
|
39
41
|
return new SafePlugin({
|
|
40
42
|
key: syncedBlockPluginKey,
|
|
41
43
|
state: {
|
|
@@ -114,6 +116,10 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
|
|
|
114
116
|
},
|
|
115
117
|
mousedown(view, event) {
|
|
116
118
|
return shouldIgnoreDomEvent(view, event, api);
|
|
119
|
+
},
|
|
120
|
+
copy: () => {
|
|
121
|
+
isCopyEvent = true;
|
|
122
|
+
return false;
|
|
117
123
|
}
|
|
118
124
|
},
|
|
119
125
|
transformCopied: (slice, {
|
|
@@ -124,12 +130,16 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
|
|
|
124
130
|
const {
|
|
125
131
|
schema
|
|
126
132
|
} = state;
|
|
133
|
+
const isCopy = isCopyEvent;
|
|
134
|
+
isCopyEvent = false;
|
|
127
135
|
if (!syncBlockStore) {
|
|
128
136
|
return slice;
|
|
129
137
|
}
|
|
130
138
|
return mapSlice(slice, node => {
|
|
131
139
|
if (node.type.name === 'syncBlock') {
|
|
132
|
-
|
|
140
|
+
if (isCopy) {
|
|
141
|
+
showCopiedFlag(api);
|
|
142
|
+
}
|
|
133
143
|
return node;
|
|
134
144
|
}
|
|
135
145
|
if (node.type.name === 'bodiedSyncBlock' && node.attrs.resourceId) {
|
|
@@ -138,7 +148,9 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
|
|
|
138
148
|
if (!sliceFullyContainsNode(slice, node)) {
|
|
139
149
|
return node.content;
|
|
140
150
|
}
|
|
141
|
-
|
|
151
|
+
if (isCopy) {
|
|
152
|
+
showCopiedFlag(api);
|
|
153
|
+
}
|
|
142
154
|
const newResourceId = syncBlockStore.referenceManager.generateResourceIdForReference(node.attrs.resourceId);
|
|
143
155
|
// Convert bodiedSyncBlock to syncBlock
|
|
144
156
|
// The paste transformation will regenrate the localId
|
|
@@ -41,6 +41,8 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
41
41
|
var confirmationTransactionRef = {
|
|
42
42
|
current: undefined
|
|
43
43
|
};
|
|
44
|
+
// Track if a copy event occurred to distinguish copy from drag and drop
|
|
45
|
+
var isCopyEvent = false;
|
|
44
46
|
return new SafePlugin({
|
|
45
47
|
key: syncedBlockPluginKey,
|
|
46
48
|
state: {
|
|
@@ -119,6 +121,10 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
119
121
|
},
|
|
120
122
|
mousedown: function mousedown(view, event) {
|
|
121
123
|
return shouldIgnoreDomEvent(view, event, api);
|
|
124
|
+
},
|
|
125
|
+
copy: function copy() {
|
|
126
|
+
isCopyEvent = true;
|
|
127
|
+
return false;
|
|
122
128
|
}
|
|
123
129
|
},
|
|
124
130
|
transformCopied: function transformCopied(slice, _ref3) {
|
|
@@ -126,12 +132,16 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
126
132
|
var pluginState = syncedBlockPluginKey.getState(state);
|
|
127
133
|
var syncBlockStore = pluginState === null || pluginState === void 0 ? void 0 : pluginState.syncBlockStore;
|
|
128
134
|
var schema = state.schema;
|
|
135
|
+
var isCopy = isCopyEvent;
|
|
136
|
+
isCopyEvent = false;
|
|
129
137
|
if (!syncBlockStore) {
|
|
130
138
|
return slice;
|
|
131
139
|
}
|
|
132
140
|
return mapSlice(slice, function (node) {
|
|
133
141
|
if (node.type.name === 'syncBlock') {
|
|
134
|
-
|
|
142
|
+
if (isCopy) {
|
|
143
|
+
showCopiedFlag(api);
|
|
144
|
+
}
|
|
135
145
|
return node;
|
|
136
146
|
}
|
|
137
147
|
if (node.type.name === 'bodiedSyncBlock' && node.attrs.resourceId) {
|
|
@@ -140,7 +150,9 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
140
150
|
if (!sliceFullyContainsNode(slice, node)) {
|
|
141
151
|
return node.content;
|
|
142
152
|
}
|
|
143
|
-
|
|
153
|
+
if (isCopy) {
|
|
154
|
+
showCopiedFlag(api);
|
|
155
|
+
}
|
|
144
156
|
var newResourceId = syncBlockStore.referenceManager.generateResourceIdForReference(node.attrs.resourceId);
|
|
145
157
|
// Convert bodiedSyncBlock to syncBlock
|
|
146
158
|
// The paste transformation will regenrate the localId
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-synced-block",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.0",
|
|
4
4
|
"description": "SyncedBlock plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -39,16 +39,16 @@
|
|
|
39
39
|
"@atlaskit/editor-plugin-selection": "^6.1.0",
|
|
40
40
|
"@atlaskit/editor-prosemirror": "^7.2.0",
|
|
41
41
|
"@atlaskit/editor-shared-styles": "^3.10.0",
|
|
42
|
-
"@atlaskit/editor-synced-block-provider": "^2.
|
|
42
|
+
"@atlaskit/editor-synced-block-provider": "^2.16.0",
|
|
43
43
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
44
44
|
"@atlaskit/editor-toolbar": "^0.18.0",
|
|
45
45
|
"@atlaskit/flag": "^17.7.0",
|
|
46
46
|
"@atlaskit/icon": "29.3.1",
|
|
47
47
|
"@atlaskit/icon-lab": "^5.13.0",
|
|
48
|
-
"@atlaskit/lozenge": "^13.
|
|
48
|
+
"@atlaskit/lozenge": "^13.3.0",
|
|
49
49
|
"@atlaskit/modal-dialog": "^14.9.0",
|
|
50
50
|
"@atlaskit/primitives": "^17.0.0",
|
|
51
|
-
"@atlaskit/tmp-editor-statsig": "^16.
|
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^16.2.0",
|
|
52
52
|
"@atlaskit/tokens": "9.0.0",
|
|
53
53
|
"@atlaskit/tooltip": "^20.11.0",
|
|
54
54
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@atlaskit/editor-common": "^110.
|
|
59
|
+
"@atlaskit/editor-common": "^110.49.0",
|
|
60
60
|
"react": "^18.2.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|