@atlaskit/editor-plugin-synced-block 4.3.1 → 4.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 +16 -0
- package/dist/cjs/pm-plugins/main.js +15 -2
- package/dist/cjs/pm-plugins/utils/utils.js +2 -6
- package/dist/es2019/pm-plugins/main.js +14 -1
- package/dist/es2019/pm-plugins/utils/utils.js +2 -6
- package/dist/esm/pm-plugins/main.js +15 -2
- package/dist/esm/pm-plugins/utils/utils.js +2 -6
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-synced-block
|
|
2
2
|
|
|
3
|
+
## 4.3.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`3a76fffa63310`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3a76fffa63310) -
|
|
8
|
+
Revert EDITOR-2913
|
|
9
|
+
|
|
10
|
+
## 4.3.2
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`4d676bbdb3ce6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4d676bbdb3ce6) -
|
|
15
|
+
ts-ignore added temporarily to unblock local consumption for help-center, will be removed once
|
|
16
|
+
project refs are setup
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 4.3.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -24,6 +24,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
24
24
|
return new _safePlugin.SafePlugin({
|
|
25
25
|
key: syncedBlockPluginKey,
|
|
26
26
|
state: {
|
|
27
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
27
28
|
init: function init(_, instance) {
|
|
28
29
|
var syncBlockNodes = instance.doc.children.filter(function (node) {
|
|
29
30
|
return node.type.name === 'syncBlock';
|
|
@@ -35,6 +36,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
35
36
|
syncBlockStore: syncBlockStore
|
|
36
37
|
};
|
|
37
38
|
},
|
|
39
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
38
40
|
apply: function apply(tr, currentPluginState, oldEditorState) {
|
|
39
41
|
var _meta$showFlag;
|
|
40
42
|
var meta = tr.getMeta(syncedBlockPluginKey);
|
|
@@ -64,6 +66,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
64
66
|
api: api
|
|
65
67
|
})
|
|
66
68
|
},
|
|
69
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
67
70
|
decorations: function decorations(state) {
|
|
68
71
|
var _syncedBlockPluginKey, _syncedBlockPluginKey2, _api$connectivity, _api$editorViewMode;
|
|
69
72
|
var selectionDecorationSet = (_syncedBlockPluginKey = (_syncedBlockPluginKey2 = syncedBlockPluginKey.getState(state)) === null || _syncedBlockPluginKey2 === void 0 ? void 0 : _syncedBlockPluginKey2.selectionDecorationSet) !== null && _syncedBlockPluginKey !== void 0 ? _syncedBlockPluginKey : _view.DecorationSet.empty;
|
|
@@ -72,6 +75,8 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
72
75
|
var isViewMode = (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view';
|
|
73
76
|
var offlineDecorations = [];
|
|
74
77
|
var viewModeDecorations = [];
|
|
78
|
+
|
|
79
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
75
80
|
state.doc.descendants(function (node, pos) {
|
|
76
81
|
if (node.type.name === 'bodiedSyncBlock' && isOffline) {
|
|
77
82
|
offlineDecorations.push(_view.Decoration.node(pos, pos + node.nodeSize, {
|
|
@@ -92,9 +97,11 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
92
97
|
useLongPressSelection: useLongPressSelection
|
|
93
98
|
}),
|
|
94
99
|
handleDOMEvents: {
|
|
100
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
95
101
|
mouseover: function mouseover(view, event) {
|
|
96
102
|
return (0, _ignoreDomEvent.shouldIgnoreDomEvent)(view, event, api);
|
|
97
103
|
},
|
|
104
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
98
105
|
mousedown: function mousedown(view, event) {
|
|
99
106
|
return (0, _ignoreDomEvent.shouldIgnoreDomEvent)(view, event, api);
|
|
100
107
|
}
|
|
@@ -108,6 +115,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
108
115
|
}
|
|
109
116
|
};
|
|
110
117
|
},
|
|
118
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
111
119
|
filterTransaction: function filterTransaction(tr, state) {
|
|
112
120
|
var _api$connectivity2;
|
|
113
121
|
var isOffline = (api === null || api === void 0 || (_api$connectivity2 = api.connectivity) === null || _api$connectivity2 === void 0 || (_api$connectivity2 = _api$connectivity2.sharedState.currentState()) === null || _api$connectivity2 === void 0 ? void 0 : _api$connectivity2.mode) === 'offline';
|
|
@@ -174,10 +182,15 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pmPlugi
|
|
|
174
182
|
}
|
|
175
183
|
return true;
|
|
176
184
|
},
|
|
185
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
177
186
|
appendTransaction: function appendTransaction(trs, _oldState, newState) {
|
|
178
|
-
trs
|
|
187
|
+
trs
|
|
188
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
189
|
+
.filter(function (tr) {
|
|
179
190
|
return tr.docChanged;
|
|
180
|
-
})
|
|
191
|
+
})
|
|
192
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
193
|
+
.forEach(function (tr) {
|
|
181
194
|
syncBlockStore === null || syncBlockStore === void 0 || syncBlockStore.sourceManager.rebaseTransaction(tr, newState);
|
|
182
195
|
});
|
|
183
196
|
return null;
|
|
@@ -78,12 +78,8 @@ var removeBreakoutMarks = function removeBreakoutMarks(content) {
|
|
|
78
78
|
var filteredMarks = node.marks.filter(function (mark) {
|
|
79
79
|
return mark.type.name !== 'breakout';
|
|
80
80
|
});
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
} else {
|
|
84
|
-
var newNode = node.type.create(node.attrs, node.content, filteredMarks);
|
|
85
|
-
nodes.push(newNode);
|
|
86
|
-
}
|
|
81
|
+
var newNode = node.type.create(node.attrs, node.content, filteredMarks);
|
|
82
|
+
nodes.push(newNode);
|
|
87
83
|
});
|
|
88
84
|
return _model.Fragment.from(nodes);
|
|
89
85
|
};
|
|
@@ -18,6 +18,7 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
|
|
|
18
18
|
return new SafePlugin({
|
|
19
19
|
key: syncedBlockPluginKey,
|
|
20
20
|
state: {
|
|
21
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
21
22
|
init(_, instance) {
|
|
22
23
|
const syncBlockNodes = instance.doc.children.filter(node => node.type.name === 'syncBlock');
|
|
23
24
|
syncBlockStore.referenceManager.fetchSyncBlocksData(convertPMNodesToSyncBlockNodes(syncBlockNodes));
|
|
@@ -27,6 +28,7 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
|
|
|
27
28
|
syncBlockStore: syncBlockStore
|
|
28
29
|
};
|
|
29
30
|
},
|
|
31
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
30
32
|
apply: (tr, currentPluginState, oldEditorState) => {
|
|
31
33
|
var _meta$showFlag;
|
|
32
34
|
const meta = tr.getMeta(syncedBlockPluginKey);
|
|
@@ -58,6 +60,7 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
|
|
|
58
60
|
api
|
|
59
61
|
})
|
|
60
62
|
},
|
|
63
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
61
64
|
decorations: state => {
|
|
62
65
|
var _syncedBlockPluginKey, _syncedBlockPluginKey2, _api$connectivity, _api$connectivity$sha, _api$editorViewMode, _api$editorViewMode$s;
|
|
63
66
|
const selectionDecorationSet = (_syncedBlockPluginKey = (_syncedBlockPluginKey2 = syncedBlockPluginKey.getState(state)) === null || _syncedBlockPluginKey2 === void 0 ? void 0 : _syncedBlockPluginKey2.selectionDecorationSet) !== null && _syncedBlockPluginKey !== void 0 ? _syncedBlockPluginKey : DecorationSet.empty;
|
|
@@ -68,6 +71,8 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
|
|
|
68
71
|
const isViewMode = (api === null || api === void 0 ? void 0 : (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : (_api$editorViewMode$s = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode$s === void 0 ? void 0 : _api$editorViewMode$s.mode) === 'view';
|
|
69
72
|
const offlineDecorations = [];
|
|
70
73
|
const viewModeDecorations = [];
|
|
74
|
+
|
|
75
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
71
76
|
state.doc.descendants((node, pos) => {
|
|
72
77
|
if (node.type.name === 'bodiedSyncBlock' && isOffline) {
|
|
73
78
|
offlineDecorations.push(Decoration.node(pos, pos + node.nodeSize, {
|
|
@@ -86,9 +91,11 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
|
|
|
86
91
|
useLongPressSelection
|
|
87
92
|
}),
|
|
88
93
|
handleDOMEvents: {
|
|
94
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
89
95
|
mouseover(view, event) {
|
|
90
96
|
return shouldIgnoreDomEvent(view, event, api);
|
|
91
97
|
},
|
|
98
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
92
99
|
mousedown(view, event) {
|
|
93
100
|
return shouldIgnoreDomEvent(view, event, api);
|
|
94
101
|
}
|
|
@@ -102,6 +109,7 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
|
|
|
102
109
|
}
|
|
103
110
|
};
|
|
104
111
|
},
|
|
112
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
105
113
|
filterTransaction: (tr, state) => {
|
|
106
114
|
var _api$connectivity2, _api$connectivity2$sh;
|
|
107
115
|
const isOffline = (api === null || api === void 0 ? void 0 : (_api$connectivity2 = api.connectivity) === null || _api$connectivity2 === void 0 ? void 0 : (_api$connectivity2$sh = _api$connectivity2.sharedState.currentState()) === null || _api$connectivity2$sh === void 0 ? void 0 : _api$connectivity2$sh.mode) === 'offline';
|
|
@@ -169,8 +177,13 @@ export const createPlugin = (options, pmPluginFactoryParams, syncBlockStore, api
|
|
|
169
177
|
}
|
|
170
178
|
return true;
|
|
171
179
|
},
|
|
180
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
172
181
|
appendTransaction: (trs, _oldState, newState) => {
|
|
173
|
-
trs
|
|
182
|
+
trs
|
|
183
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
184
|
+
.filter(tr => tr.docChanged)
|
|
185
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
186
|
+
.forEach(tr => {
|
|
174
187
|
syncBlockStore === null || syncBlockStore === void 0 ? void 0 : syncBlockStore.sourceManager.rebaseTransaction(tr, newState);
|
|
175
188
|
});
|
|
176
189
|
return null;
|
|
@@ -72,12 +72,8 @@ const removeBreakoutMarks = content => {
|
|
|
72
72
|
// we only need to recurse at the top level, because breakout has to be on a top level
|
|
73
73
|
content.forEach(node => {
|
|
74
74
|
const filteredMarks = node.marks.filter(mark => mark.type.name !== 'breakout');
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
} else {
|
|
78
|
-
const newNode = node.type.create(node.attrs, node.content, filteredMarks);
|
|
79
|
-
nodes.push(newNode);
|
|
80
|
-
}
|
|
75
|
+
const newNode = node.type.create(node.attrs, node.content, filteredMarks);
|
|
76
|
+
nodes.push(newNode);
|
|
81
77
|
});
|
|
82
78
|
return Fragment.from(nodes);
|
|
83
79
|
};
|
|
@@ -18,6 +18,7 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
18
18
|
return new SafePlugin({
|
|
19
19
|
key: syncedBlockPluginKey,
|
|
20
20
|
state: {
|
|
21
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
21
22
|
init: function init(_, instance) {
|
|
22
23
|
var syncBlockNodes = instance.doc.children.filter(function (node) {
|
|
23
24
|
return node.type.name === 'syncBlock';
|
|
@@ -29,6 +30,7 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
29
30
|
syncBlockStore: syncBlockStore
|
|
30
31
|
};
|
|
31
32
|
},
|
|
33
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
32
34
|
apply: function apply(tr, currentPluginState, oldEditorState) {
|
|
33
35
|
var _meta$showFlag;
|
|
34
36
|
var meta = tr.getMeta(syncedBlockPluginKey);
|
|
@@ -58,6 +60,7 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
58
60
|
api: api
|
|
59
61
|
})
|
|
60
62
|
},
|
|
63
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
61
64
|
decorations: function decorations(state) {
|
|
62
65
|
var _syncedBlockPluginKey, _syncedBlockPluginKey2, _api$connectivity, _api$editorViewMode;
|
|
63
66
|
var selectionDecorationSet = (_syncedBlockPluginKey = (_syncedBlockPluginKey2 = syncedBlockPluginKey.getState(state)) === null || _syncedBlockPluginKey2 === void 0 ? void 0 : _syncedBlockPluginKey2.selectionDecorationSet) !== null && _syncedBlockPluginKey !== void 0 ? _syncedBlockPluginKey : DecorationSet.empty;
|
|
@@ -66,6 +69,8 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
66
69
|
var isViewMode = (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view';
|
|
67
70
|
var offlineDecorations = [];
|
|
68
71
|
var viewModeDecorations = [];
|
|
72
|
+
|
|
73
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
69
74
|
state.doc.descendants(function (node, pos) {
|
|
70
75
|
if (node.type.name === 'bodiedSyncBlock' && isOffline) {
|
|
71
76
|
offlineDecorations.push(Decoration.node(pos, pos + node.nodeSize, {
|
|
@@ -86,9 +91,11 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
86
91
|
useLongPressSelection: useLongPressSelection
|
|
87
92
|
}),
|
|
88
93
|
handleDOMEvents: {
|
|
94
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
89
95
|
mouseover: function mouseover(view, event) {
|
|
90
96
|
return shouldIgnoreDomEvent(view, event, api);
|
|
91
97
|
},
|
|
98
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
92
99
|
mousedown: function mousedown(view, event) {
|
|
93
100
|
return shouldIgnoreDomEvent(view, event, api);
|
|
94
101
|
}
|
|
@@ -102,6 +109,7 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
102
109
|
}
|
|
103
110
|
};
|
|
104
111
|
},
|
|
112
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
105
113
|
filterTransaction: function filterTransaction(tr, state) {
|
|
106
114
|
var _api$connectivity2;
|
|
107
115
|
var isOffline = (api === null || api === void 0 || (_api$connectivity2 = api.connectivity) === null || _api$connectivity2 === void 0 || (_api$connectivity2 = _api$connectivity2.sharedState.currentState()) === null || _api$connectivity2 === void 0 ? void 0 : _api$connectivity2.mode) === 'offline';
|
|
@@ -168,10 +176,15 @@ export var createPlugin = function createPlugin(options, pmPluginFactoryParams,
|
|
|
168
176
|
}
|
|
169
177
|
return true;
|
|
170
178
|
},
|
|
179
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
171
180
|
appendTransaction: function appendTransaction(trs, _oldState, newState) {
|
|
172
|
-
trs
|
|
181
|
+
trs
|
|
182
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
183
|
+
.filter(function (tr) {
|
|
173
184
|
return tr.docChanged;
|
|
174
|
-
})
|
|
185
|
+
})
|
|
186
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
187
|
+
.forEach(function (tr) {
|
|
175
188
|
syncBlockStore === null || syncBlockStore === void 0 || syncBlockStore.sourceManager.rebaseTransaction(tr, newState);
|
|
176
189
|
});
|
|
177
190
|
return null;
|
|
@@ -72,12 +72,8 @@ var removeBreakoutMarks = function removeBreakoutMarks(content) {
|
|
|
72
72
|
var filteredMarks = node.marks.filter(function (mark) {
|
|
73
73
|
return mark.type.name !== 'breakout';
|
|
74
74
|
});
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
} else {
|
|
78
|
-
var newNode = node.type.create(node.attrs, node.content, filteredMarks);
|
|
79
|
-
nodes.push(newNode);
|
|
80
|
-
}
|
|
75
|
+
var newNode = node.type.create(node.attrs, node.content, filteredMarks);
|
|
76
|
+
nodes.push(newNode);
|
|
81
77
|
});
|
|
82
78
|
return Fragment.from(nodes);
|
|
83
79
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-synced-block",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.3",
|
|
4
4
|
"description": "SyncedBlock plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@atlaskit/logo": "^19.9.0",
|
|
49
49
|
"@atlaskit/lozenge": "^13.1.0",
|
|
50
50
|
"@atlaskit/modal-dialog": "^14.7.0",
|
|
51
|
-
"@atlaskit/primitives": "^16.
|
|
51
|
+
"@atlaskit/primitives": "^16.4.0",
|
|
52
52
|
"@atlaskit/tokens": "8.3.0",
|
|
53
53
|
"@atlaskit/tooltip": "^20.10.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.35.0",
|
|
60
60
|
"react": "^18.2.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|