@atlaskit/editor-plugin-block-controls 3.15.10 → 3.15.11
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 +10 -0
- package/dist/cjs/pm-plugins/decorations-drag-handle.js +29 -11
- package/dist/cjs/pm-plugins/decorations-quick-insert-button.js +26 -9
- package/dist/es2019/pm-plugins/decorations-drag-handle.js +29 -11
- package/dist/es2019/pm-plugins/decorations-quick-insert-button.js +26 -9
- package/dist/esm/pm-plugins/decorations-drag-handle.js +29 -11
- package/dist/esm/pm-plugins/decorations-quick-insert-button.js +26 -9
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 3.15.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#166480](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/166480)
|
|
8
|
+
[`55d4dbd11d97d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/55d4dbd11d97d) -
|
|
9
|
+
Add 'marks: []' to both widgets to ensure PM renders them at the top level document, not inside
|
|
10
|
+
sibling elements wrapped with marks
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 3.15.10
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -37,6 +37,34 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
|
|
|
37
37
|
}
|
|
38
38
|
var unbind;
|
|
39
39
|
var key = (0, _uuid.default)();
|
|
40
|
+
var widgetSpec = (0, _experiments.editorExperiment)('platform_editor_breakout_resizing', true) ? {
|
|
41
|
+
side: -1,
|
|
42
|
+
type: _decorationsCommon.TYPE_HANDLE_DEC,
|
|
43
|
+
testid: "".concat(_decorationsCommon.TYPE_HANDLE_DEC, "-").concat((0, _uuid.default)()),
|
|
44
|
+
/**
|
|
45
|
+
* sigh - `marks` influences the position that the widget is drawn (as described on the `side` property).
|
|
46
|
+
* Leaving this 'undefined' causes the widget to be wrapped in the mark before this position which creates
|
|
47
|
+
* weird stacking context issues. Providing an empty array causes the widget to correctly render before
|
|
48
|
+
* this exact position at the top of the DOM.
|
|
49
|
+
*/
|
|
50
|
+
marks: [],
|
|
51
|
+
destroy: function destroy(node) {
|
|
52
|
+
unbind && unbind();
|
|
53
|
+
if ((0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true) && node instanceof HTMLElement) {
|
|
54
|
+
_reactDom.default.unmountComponentAtNode(node);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
} : {
|
|
58
|
+
side: -1,
|
|
59
|
+
type: _decorationsCommon.TYPE_HANDLE_DEC,
|
|
60
|
+
testid: "".concat(_decorationsCommon.TYPE_HANDLE_DEC, "-").concat((0, _uuid.default)()),
|
|
61
|
+
destroy: function destroy(node) {
|
|
62
|
+
unbind && unbind();
|
|
63
|
+
if ((0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true) && node instanceof HTMLElement) {
|
|
64
|
+
_reactDom.default.unmountComponentAtNode(node);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
40
68
|
return _view.Decoration.widget(pos, function (view, getPosUnsafe) {
|
|
41
69
|
var element = document.createElement('span');
|
|
42
70
|
// inline decoration causes focus issues when refocusing Editor into first line
|
|
@@ -126,15 +154,5 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
|
|
|
126
154
|
}), element);
|
|
127
155
|
}
|
|
128
156
|
return element;
|
|
129
|
-
},
|
|
130
|
-
side: -1,
|
|
131
|
-
type: _decorationsCommon.TYPE_HANDLE_DEC,
|
|
132
|
-
testid: "".concat(_decorationsCommon.TYPE_HANDLE_DEC, "-").concat((0, _uuid.default)()),
|
|
133
|
-
destroy: function destroy(node) {
|
|
134
|
-
unbind && unbind();
|
|
135
|
-
if ((0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true) && node instanceof HTMLElement) {
|
|
136
|
-
_reactDom.default.unmountComponentAtNode(node);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
});
|
|
157
|
+
}, widgetSpec);
|
|
140
158
|
};
|
|
@@ -9,6 +9,7 @@ var _react = require("react");
|
|
|
9
9
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
10
10
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
11
11
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
12
13
|
var _quickInsertButton = require("../ui/quick-insert-button");
|
|
13
14
|
var TYPE_QUICK_INSERT = 'INSERT_BUTTON';
|
|
14
15
|
var findQuickInsertInsertButtonDecoration = exports.findQuickInsertInsertButtonDecoration = function findQuickInsertInsertButtonDecoration(decorations, from, to) {
|
|
@@ -18,6 +19,30 @@ var findQuickInsertInsertButtonDecoration = exports.findQuickInsertInsertButtonD
|
|
|
18
19
|
};
|
|
19
20
|
var quickInsertButtonDecoration = exports.quickInsertButtonDecoration = function quickInsertButtonDecoration(api, formatMessage, rootPos, anchorName, nodeType, nodeViewPortalProviderAPI, rootAnchorName, rootNodeType, anchorRectCache) {
|
|
20
21
|
var key = (0, _uuid.default)();
|
|
22
|
+
var widgetSpec = (0, _experiments.editorExperiment)('platform_editor_breakout_resizing', true) ? {
|
|
23
|
+
side: -2,
|
|
24
|
+
type: TYPE_QUICK_INSERT,
|
|
25
|
+
/**
|
|
26
|
+
* sigh - `marks` influences the position that the widget is drawn (as described on the `side` property).
|
|
27
|
+
* Leaving this 'undefined' causes the widget to be wrapped in the mark before this position which creates
|
|
28
|
+
* weird stacking context issues. Providing an empty array causes the widget to correctly render before
|
|
29
|
+
* this exact position at the top of the DOM.
|
|
30
|
+
*/
|
|
31
|
+
marks: [],
|
|
32
|
+
destroy: function destroy(_) {
|
|
33
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_fix_widget_destroy')) {
|
|
34
|
+
nodeViewPortalProviderAPI.remove(key);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
} : {
|
|
38
|
+
side: -2,
|
|
39
|
+
type: TYPE_QUICK_INSERT,
|
|
40
|
+
destroy: function destroy(_) {
|
|
41
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_fix_widget_destroy')) {
|
|
42
|
+
nodeViewPortalProviderAPI.remove(key);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
21
46
|
return _view.Decoration.widget(rootPos, function (view, getPos) {
|
|
22
47
|
var element = document.createElement('span');
|
|
23
48
|
element.contentEditable = 'false';
|
|
@@ -55,13 +80,5 @@ var quickInsertButtonDecoration = exports.quickInsertButtonDecoration = function
|
|
|
55
80
|
}, element, key);
|
|
56
81
|
}
|
|
57
82
|
return element;
|
|
58
|
-
},
|
|
59
|
-
side: -2,
|
|
60
|
-
type: TYPE_QUICK_INSERT,
|
|
61
|
-
destroy: function destroy(_) {
|
|
62
|
-
if ((0, _platformFeatureFlags.fg)('platform_editor_fix_widget_destroy')) {
|
|
63
|
-
nodeViewPortalProviderAPI.remove(key);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
});
|
|
83
|
+
}, widgetSpec);
|
|
67
84
|
};
|
|
@@ -28,6 +28,34 @@ export const dragHandleDecoration = (api, formatMessage, pos, anchorName, nodeTy
|
|
|
28
28
|
}
|
|
29
29
|
let unbind;
|
|
30
30
|
const key = uuid();
|
|
31
|
+
const widgetSpec = editorExperiment('platform_editor_breakout_resizing', true) ? {
|
|
32
|
+
side: -1,
|
|
33
|
+
type: TYPE_HANDLE_DEC,
|
|
34
|
+
testid: `${TYPE_HANDLE_DEC}-${uuid()}`,
|
|
35
|
+
/**
|
|
36
|
+
* sigh - `marks` influences the position that the widget is drawn (as described on the `side` property).
|
|
37
|
+
* Leaving this 'undefined' causes the widget to be wrapped in the mark before this position which creates
|
|
38
|
+
* weird stacking context issues. Providing an empty array causes the widget to correctly render before
|
|
39
|
+
* this exact position at the top of the DOM.
|
|
40
|
+
*/
|
|
41
|
+
marks: [],
|
|
42
|
+
destroy: node => {
|
|
43
|
+
unbind && unbind();
|
|
44
|
+
if (editorExperiment('platform_editor_block_control_optimise_render', true) && node instanceof HTMLElement) {
|
|
45
|
+
ReactDOM.unmountComponentAtNode(node);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
} : {
|
|
49
|
+
side: -1,
|
|
50
|
+
type: TYPE_HANDLE_DEC,
|
|
51
|
+
testid: `${TYPE_HANDLE_DEC}-${uuid()}`,
|
|
52
|
+
destroy: node => {
|
|
53
|
+
unbind && unbind();
|
|
54
|
+
if (editorExperiment('platform_editor_block_control_optimise_render', true) && node instanceof HTMLElement) {
|
|
55
|
+
ReactDOM.unmountComponentAtNode(node);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
31
59
|
return Decoration.widget(pos, (view, getPosUnsafe) => {
|
|
32
60
|
const element = document.createElement('span');
|
|
33
61
|
// inline decoration causes focus issues when refocusing Editor into first line
|
|
@@ -117,15 +145,5 @@ export const dragHandleDecoration = (api, formatMessage, pos, anchorName, nodeTy
|
|
|
117
145
|
}), element);
|
|
118
146
|
}
|
|
119
147
|
return element;
|
|
120
|
-
},
|
|
121
|
-
side: -1,
|
|
122
|
-
type: TYPE_HANDLE_DEC,
|
|
123
|
-
testid: `${TYPE_HANDLE_DEC}-${uuid()}`,
|
|
124
|
-
destroy: node => {
|
|
125
|
-
unbind && unbind();
|
|
126
|
-
if (editorExperiment('platform_editor_block_control_optimise_render', true) && node instanceof HTMLElement) {
|
|
127
|
-
ReactDOM.unmountComponentAtNode(node);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
});
|
|
148
|
+
}, widgetSpec);
|
|
131
149
|
};
|
|
@@ -2,6 +2,7 @@ import { createElement } from 'react';
|
|
|
2
2
|
import uuid from 'uuid';
|
|
3
3
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
6
|
import { QuickInsertWithVisibility, TypeAheadControl } from '../ui/quick-insert-button';
|
|
6
7
|
const TYPE_QUICK_INSERT = 'INSERT_BUTTON';
|
|
7
8
|
export const findQuickInsertInsertButtonDecoration = (decorations, from, to) => {
|
|
@@ -9,6 +10,30 @@ export const findQuickInsertInsertButtonDecoration = (decorations, from, to) =>
|
|
|
9
10
|
};
|
|
10
11
|
export const quickInsertButtonDecoration = (api, formatMessage, rootPos, anchorName, nodeType, nodeViewPortalProviderAPI, rootAnchorName, rootNodeType, anchorRectCache) => {
|
|
11
12
|
const key = uuid();
|
|
13
|
+
const widgetSpec = editorExperiment('platform_editor_breakout_resizing', true) ? {
|
|
14
|
+
side: -2,
|
|
15
|
+
type: TYPE_QUICK_INSERT,
|
|
16
|
+
/**
|
|
17
|
+
* sigh - `marks` influences the position that the widget is drawn (as described on the `side` property).
|
|
18
|
+
* Leaving this 'undefined' causes the widget to be wrapped in the mark before this position which creates
|
|
19
|
+
* weird stacking context issues. Providing an empty array causes the widget to correctly render before
|
|
20
|
+
* this exact position at the top of the DOM.
|
|
21
|
+
*/
|
|
22
|
+
marks: [],
|
|
23
|
+
destroy: _ => {
|
|
24
|
+
if (fg('platform_editor_fix_widget_destroy')) {
|
|
25
|
+
nodeViewPortalProviderAPI.remove(key);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
} : {
|
|
29
|
+
side: -2,
|
|
30
|
+
type: TYPE_QUICK_INSERT,
|
|
31
|
+
destroy: _ => {
|
|
32
|
+
if (fg('platform_editor_fix_widget_destroy')) {
|
|
33
|
+
nodeViewPortalProviderAPI.remove(key);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
12
37
|
return Decoration.widget(rootPos, (view, getPos) => {
|
|
13
38
|
const element = document.createElement('span');
|
|
14
39
|
element.contentEditable = 'false';
|
|
@@ -42,13 +67,5 @@ export const quickInsertButtonDecoration = (api, formatMessage, rootPos, anchorN
|
|
|
42
67
|
}), element, key);
|
|
43
68
|
}
|
|
44
69
|
return element;
|
|
45
|
-
},
|
|
46
|
-
side: -2,
|
|
47
|
-
type: TYPE_QUICK_INSERT,
|
|
48
|
-
destroy: _ => {
|
|
49
|
-
if (fg('platform_editor_fix_widget_destroy')) {
|
|
50
|
-
nodeViewPortalProviderAPI.remove(key);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
});
|
|
70
|
+
}, widgetSpec);
|
|
54
71
|
};
|
|
@@ -30,6 +30,34 @@ export var dragHandleDecoration = function dragHandleDecoration(api, formatMessa
|
|
|
30
30
|
}
|
|
31
31
|
var unbind;
|
|
32
32
|
var key = uuid();
|
|
33
|
+
var widgetSpec = editorExperiment('platform_editor_breakout_resizing', true) ? {
|
|
34
|
+
side: -1,
|
|
35
|
+
type: TYPE_HANDLE_DEC,
|
|
36
|
+
testid: "".concat(TYPE_HANDLE_DEC, "-").concat(uuid()),
|
|
37
|
+
/**
|
|
38
|
+
* sigh - `marks` influences the position that the widget is drawn (as described on the `side` property).
|
|
39
|
+
* Leaving this 'undefined' causes the widget to be wrapped in the mark before this position which creates
|
|
40
|
+
* weird stacking context issues. Providing an empty array causes the widget to correctly render before
|
|
41
|
+
* this exact position at the top of the DOM.
|
|
42
|
+
*/
|
|
43
|
+
marks: [],
|
|
44
|
+
destroy: function destroy(node) {
|
|
45
|
+
unbind && unbind();
|
|
46
|
+
if (editorExperiment('platform_editor_block_control_optimise_render', true) && node instanceof HTMLElement) {
|
|
47
|
+
ReactDOM.unmountComponentAtNode(node);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
} : {
|
|
51
|
+
side: -1,
|
|
52
|
+
type: TYPE_HANDLE_DEC,
|
|
53
|
+
testid: "".concat(TYPE_HANDLE_DEC, "-").concat(uuid()),
|
|
54
|
+
destroy: function destroy(node) {
|
|
55
|
+
unbind && unbind();
|
|
56
|
+
if (editorExperiment('platform_editor_block_control_optimise_render', true) && node instanceof HTMLElement) {
|
|
57
|
+
ReactDOM.unmountComponentAtNode(node);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
33
61
|
return Decoration.widget(pos, function (view, getPosUnsafe) {
|
|
34
62
|
var element = document.createElement('span');
|
|
35
63
|
// inline decoration causes focus issues when refocusing Editor into first line
|
|
@@ -119,15 +147,5 @@ export var dragHandleDecoration = function dragHandleDecoration(api, formatMessa
|
|
|
119
147
|
}), element);
|
|
120
148
|
}
|
|
121
149
|
return element;
|
|
122
|
-
},
|
|
123
|
-
side: -1,
|
|
124
|
-
type: TYPE_HANDLE_DEC,
|
|
125
|
-
testid: "".concat(TYPE_HANDLE_DEC, "-").concat(uuid()),
|
|
126
|
-
destroy: function destroy(node) {
|
|
127
|
-
unbind && unbind();
|
|
128
|
-
if (editorExperiment('platform_editor_block_control_optimise_render', true) && node instanceof HTMLElement) {
|
|
129
|
-
ReactDOM.unmountComponentAtNode(node);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
});
|
|
150
|
+
}, widgetSpec);
|
|
133
151
|
};
|
|
@@ -2,6 +2,7 @@ import { createElement } from 'react';
|
|
|
2
2
|
import uuid from 'uuid';
|
|
3
3
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
6
|
import { QuickInsertWithVisibility, TypeAheadControl } from '../ui/quick-insert-button';
|
|
6
7
|
var TYPE_QUICK_INSERT = 'INSERT_BUTTON';
|
|
7
8
|
export var findQuickInsertInsertButtonDecoration = function findQuickInsertInsertButtonDecoration(decorations, from, to) {
|
|
@@ -11,6 +12,30 @@ export var findQuickInsertInsertButtonDecoration = function findQuickInsertInser
|
|
|
11
12
|
};
|
|
12
13
|
export var quickInsertButtonDecoration = function quickInsertButtonDecoration(api, formatMessage, rootPos, anchorName, nodeType, nodeViewPortalProviderAPI, rootAnchorName, rootNodeType, anchorRectCache) {
|
|
13
14
|
var key = uuid();
|
|
15
|
+
var widgetSpec = editorExperiment('platform_editor_breakout_resizing', true) ? {
|
|
16
|
+
side: -2,
|
|
17
|
+
type: TYPE_QUICK_INSERT,
|
|
18
|
+
/**
|
|
19
|
+
* sigh - `marks` influences the position that the widget is drawn (as described on the `side` property).
|
|
20
|
+
* Leaving this 'undefined' causes the widget to be wrapped in the mark before this position which creates
|
|
21
|
+
* weird stacking context issues. Providing an empty array causes the widget to correctly render before
|
|
22
|
+
* this exact position at the top of the DOM.
|
|
23
|
+
*/
|
|
24
|
+
marks: [],
|
|
25
|
+
destroy: function destroy(_) {
|
|
26
|
+
if (fg('platform_editor_fix_widget_destroy')) {
|
|
27
|
+
nodeViewPortalProviderAPI.remove(key);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
} : {
|
|
31
|
+
side: -2,
|
|
32
|
+
type: TYPE_QUICK_INSERT,
|
|
33
|
+
destroy: function destroy(_) {
|
|
34
|
+
if (fg('platform_editor_fix_widget_destroy')) {
|
|
35
|
+
nodeViewPortalProviderAPI.remove(key);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
14
39
|
return Decoration.widget(rootPos, function (view, getPos) {
|
|
15
40
|
var element = document.createElement('span');
|
|
16
41
|
element.contentEditable = 'false';
|
|
@@ -48,13 +73,5 @@ export var quickInsertButtonDecoration = function quickInsertButtonDecoration(ap
|
|
|
48
73
|
}, element, key);
|
|
49
74
|
}
|
|
50
75
|
return element;
|
|
51
|
-
},
|
|
52
|
-
side: -2,
|
|
53
|
-
type: TYPE_QUICK_INSERT,
|
|
54
|
-
destroy: function destroy(_) {
|
|
55
|
-
if (fg('platform_editor_fix_widget_destroy')) {
|
|
56
|
-
nodeViewPortalProviderAPI.remove(key);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
});
|
|
76
|
+
}, widgetSpec);
|
|
60
77
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "3.15.
|
|
3
|
+
"version": "3.15.11",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
36
|
-
"@atlaskit/editor-common": "^106.
|
|
36
|
+
"@atlaskit/editor-common": "^106.2.0",
|
|
37
37
|
"@atlaskit/editor-plugin-accessibility-utils": "^2.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^2.3.0",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
57
57
|
"@atlaskit/primitives": "^14.8.0",
|
|
58
58
|
"@atlaskit/theme": "^18.0.0",
|
|
59
|
-
"@atlaskit/tmp-editor-statsig": "^5.
|
|
59
|
+
"@atlaskit/tmp-editor-statsig": "^5.12.0",
|
|
60
60
|
"@atlaskit/tokens": "^5.0.0",
|
|
61
61
|
"@atlaskit/tooltip": "^20.3.0",
|
|
62
62
|
"@babel/runtime": "^7.0.0",
|