@atlaskit/editor-core 164.0.3 → 166.0.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 +43 -0
- package/dist/cjs/actions/index.js +9 -0
- package/dist/cjs/create-editor/ReactEditorView.js +14 -6
- package/dist/cjs/create-editor/create-plugins-list.js +1 -2
- package/dist/cjs/editor.js +32 -1
- package/dist/cjs/event-dispatcher/index.js +9 -0
- package/dist/cjs/nodeviews/ReactNodeView.js +1 -11
- package/dist/cjs/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
- package/dist/cjs/nodeviews/getPerformanceOptions.js +1 -1
- package/dist/cjs/plugins/analytics/types/enums.js +1 -0
- package/dist/cjs/plugins/base/pm-plugins/frozen-editor.js +128 -79
- package/dist/cjs/plugins/base/utils/input-latency-tracking.js +157 -0
- package/dist/cjs/plugins/card/styles.js +3 -1
- package/dist/cjs/plugins/code-block/styles.js +6 -4
- package/dist/cjs/plugins/collab-edit/plugin-state.js +23 -5
- package/dist/cjs/plugins/date/styles.js +3 -1
- package/dist/cjs/plugins/emoji/index.js +30 -34
- package/dist/cjs/plugins/emoji/nodeviews/emoji.js +12 -66
- package/dist/cjs/plugins/emoji/styles.js +3 -17
- package/dist/cjs/plugins/expand/ui/styles.js +2 -2
- package/dist/cjs/plugins/extension/ui/styles.js +3 -1
- package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +20 -22
- package/dist/cjs/plugins/hyperlink/pm-plugins/input-rule.js +1 -9
- package/dist/cjs/plugins/hyperlink/pm-plugins/keymap.js +1 -9
- package/dist/cjs/plugins/layout/styles.js +3 -1
- package/dist/cjs/plugins/list/commands/indent-list.js +5 -1
- package/dist/cjs/plugins/list/commands/outdent-list.js +5 -1
- package/dist/cjs/plugins/list/transforms.js +11 -3
- package/dist/cjs/plugins/media/styles.js +3 -1
- package/dist/cjs/plugins/mentions/index.js +10 -14
- package/dist/cjs/plugins/mentions/nodeviews/mention.js +15 -67
- package/dist/cjs/plugins/mentions/pm-plugins/main.js +19 -10
- package/dist/cjs/plugins/mentions/type-ahead/index.js +7 -2
- package/dist/cjs/plugins/panel/styles.js +3 -1
- package/dist/cjs/plugins/placeholder-text/placeholder-text-nodeview.js +3 -1
- package/dist/cjs/plugins/rule/styles.js +3 -1
- package/dist/cjs/plugins/selection/utils.js +39 -23
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +24 -0
- package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
- package/dist/cjs/plugins/table/ui/consts.js +6 -4
- package/dist/cjs/plugins/tasks-and-decisions/styles.js +3 -1
- package/dist/cjs/plugins/type-ahead/index.js +6 -2
- package/dist/cjs/plugins/unsupported-content/index.js +22 -10
- package/dist/cjs/plugins/unsupported-content/styles.js +4 -2
- package/dist/cjs/plugins/unsupported-content/unsupported-inline-node-view.js +21 -0
- package/dist/cjs/ui/Appearance/Chromeless.js +6 -3
- package/dist/cjs/ui/Appearance/Comment/Comment.js +6 -4
- package/dist/cjs/ui/ChromeCollapsed/styles.js +3 -1
- package/dist/cjs/ui/ContentStyles/index.js +2 -2
- package/dist/cjs/ui/PortalProvider/PortalProviderThemesProvider.js +57 -0
- package/dist/cjs/ui/PortalProvider/index.js +66 -19
- package/dist/cjs/utils/check-if-mobile-bridge.js +19 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/actions/index.js +12 -1
- package/dist/es2019/create-editor/ReactEditorView.js +14 -6
- package/dist/es2019/create-editor/create-plugins-list.js +1 -2
- package/dist/es2019/editor.js +33 -2
- package/dist/es2019/event-dispatcher/index.js +8 -0
- package/dist/es2019/nodeviews/ReactNodeView.js +1 -10
- package/dist/es2019/nodeviews/getInlineNodeViewProducer.styles.js +9 -0
- package/dist/es2019/plugins/analytics/types/enums.js +1 -0
- package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +138 -80
- package/dist/es2019/plugins/base/utils/input-latency-tracking.js +128 -0
- package/dist/es2019/plugins/card/styles.js +9 -5
- package/dist/es2019/plugins/code-block/styles.js +11 -8
- package/dist/es2019/plugins/collab-edit/plugin-state.js +23 -8
- package/dist/es2019/plugins/date/styles.js +3 -1
- package/dist/es2019/plugins/emoji/index.js +16 -21
- package/dist/es2019/plugins/emoji/nodeviews/emoji.js +12 -31
- package/dist/es2019/plugins/emoji/styles.js +1 -82
- package/dist/es2019/plugins/expand/ui/styles.js +2 -2
- package/dist/es2019/plugins/extension/ui/styles.js +4 -2
- package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +20 -22
- package/dist/es2019/plugins/hyperlink/pm-plugins/input-rule.js +1 -8
- package/dist/es2019/plugins/hyperlink/pm-plugins/keymap.js +1 -8
- package/dist/es2019/plugins/layout/styles.js +3 -2
- package/dist/es2019/plugins/list/commands/indent-list.js +4 -1
- package/dist/es2019/plugins/list/commands/outdent-list.js +4 -1
- package/dist/es2019/plugins/list/transforms.js +9 -4
- package/dist/es2019/plugins/media/styles.js +9 -7
- package/dist/es2019/plugins/mentions/index.js +1 -6
- package/dist/es2019/plugins/mentions/nodeviews/mention.js +16 -35
- package/dist/es2019/plugins/mentions/pm-plugins/main.js +18 -10
- package/dist/es2019/plugins/mentions/type-ahead/index.js +7 -2
- package/dist/es2019/plugins/panel/styles.js +5 -4
- package/dist/es2019/plugins/placeholder-text/placeholder-text-nodeview.js +3 -1
- package/dist/es2019/plugins/rule/styles.js +2 -1
- package/dist/es2019/plugins/selection/utils.js +35 -20
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +22 -0
- package/dist/es2019/plugins/table/ui/common-styles.js +4 -0
- package/dist/es2019/plugins/table/ui/consts.js +5 -4
- package/dist/es2019/plugins/tasks-and-decisions/styles.js +4 -2
- package/dist/es2019/plugins/type-ahead/index.js +5 -1
- package/dist/es2019/plugins/unsupported-content/index.js +23 -12
- package/dist/es2019/plugins/unsupported-content/styles.js +5 -3
- package/dist/es2019/plugins/unsupported-content/unsupported-inline-node-view.js +7 -0
- package/dist/es2019/ui/Appearance/Chromeless.js +5 -2
- package/dist/es2019/ui/Appearance/Comment/Comment.js +5 -2
- package/dist/es2019/ui/ChromeCollapsed/styles.js +2 -1
- package/dist/es2019/ui/ContentStyles/index.js +3 -3
- package/dist/es2019/ui/PortalProvider/PortalProviderThemesProvider.js +39 -0
- package/dist/es2019/ui/PortalProvider/index.js +39 -3
- package/dist/es2019/utils/check-if-mobile-bridge.js +12 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions/index.js +8 -0
- package/dist/esm/create-editor/ReactEditorView.js +14 -6
- package/dist/esm/create-editor/create-plugins-list.js +1 -2
- package/dist/esm/editor.js +33 -2
- package/dist/esm/event-dispatcher/index.js +9 -0
- package/dist/esm/nodeviews/ReactNodeView.js +1 -10
- package/dist/esm/nodeviews/getInlineNodeViewProducer.styles.js +1 -1
- package/dist/esm/plugins/analytics/types/enums.js +1 -0
- package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +128 -79
- package/dist/esm/plugins/base/utils/input-latency-tracking.js +149 -0
- package/dist/esm/plugins/card/styles.js +2 -1
- package/dist/esm/plugins/code-block/styles.js +5 -4
- package/dist/esm/plugins/collab-edit/plugin-state.js +21 -6
- package/dist/esm/plugins/date/styles.js +2 -1
- package/dist/esm/plugins/emoji/index.js +26 -29
- package/dist/esm/plugins/emoji/nodeviews/emoji.js +11 -56
- package/dist/esm/plugins/emoji/styles.js +3 -14
- package/dist/esm/plugins/expand/ui/styles.js +2 -2
- package/dist/esm/plugins/extension/ui/styles.js +2 -1
- package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +20 -22
- package/dist/esm/plugins/hyperlink/pm-plugins/input-rule.js +1 -8
- package/dist/esm/plugins/hyperlink/pm-plugins/keymap.js +1 -8
- package/dist/esm/plugins/layout/styles.js +2 -1
- package/dist/esm/plugins/list/commands/indent-list.js +4 -1
- package/dist/esm/plugins/list/commands/outdent-list.js +4 -1
- package/dist/esm/plugins/list/transforms.js +9 -4
- package/dist/esm/plugins/media/styles.js +2 -1
- package/dist/esm/plugins/mentions/index.js +10 -14
- package/dist/esm/plugins/mentions/nodeviews/mention.js +13 -58
- package/dist/esm/plugins/mentions/pm-plugins/main.js +18 -10
- package/dist/esm/plugins/mentions/type-ahead/index.js +7 -2
- package/dist/esm/plugins/panel/styles.js +2 -1
- package/dist/esm/plugins/placeholder-text/placeholder-text-nodeview.js +3 -1
- package/dist/esm/plugins/rule/styles.js +2 -1
- package/dist/esm/plugins/selection/utils.js +35 -20
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +23 -0
- package/dist/esm/plugins/table/ui/common-styles.js +1 -1
- package/dist/esm/plugins/table/ui/consts.js +5 -4
- package/dist/esm/plugins/tasks-and-decisions/styles.js +2 -1
- package/dist/esm/plugins/type-ahead/index.js +6 -2
- package/dist/esm/plugins/unsupported-content/index.js +21 -11
- package/dist/esm/plugins/unsupported-content/styles.js +3 -2
- package/dist/esm/plugins/unsupported-content/unsupported-inline-node-view.js +7 -0
- package/dist/esm/ui/Appearance/Chromeless.js +6 -3
- package/dist/esm/ui/Appearance/Comment/Comment.js +6 -4
- package/dist/esm/ui/ChromeCollapsed/styles.js +2 -1
- package/dist/esm/ui/ContentStyles/index.js +3 -3
- package/dist/esm/ui/PortalProvider/PortalProviderThemesProvider.js +39 -0
- package/dist/esm/ui/PortalProvider/index.js +61 -19
- package/dist/esm/utils/check-if-mobile-bridge.js +12 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/actions/index.d.ts +3 -1
- package/dist/types/editor.d.ts +3 -0
- package/dist/types/event-dispatcher/index.d.ts +1 -0
- package/dist/types/nodeviews/ReactNodeView.d.ts +1 -5
- package/dist/types/plugins/analytics/types/enums.d.ts +1 -0
- package/dist/types/plugins/analytics/types/events.d.ts +2 -2
- package/dist/types/plugins/analytics/types/general-events.d.ts +10 -1
- package/dist/types/plugins/base/utils/input-latency-tracking.d.ts +44 -0
- package/dist/types/plugins/collab-edit/plugin-state.d.ts +4 -0
- package/dist/types/plugins/emoji/index.d.ts +2 -6
- package/dist/types/plugins/emoji/nodeviews/emoji.d.ts +4 -14
- package/dist/types/plugins/emoji/styles.d.ts +0 -1
- package/dist/types/plugins/emoji/types.d.ts +0 -1
- package/dist/types/plugins/list/transforms.d.ts +10 -1
- package/dist/types/plugins/mentions/nodeviews/mention.d.ts +6 -14
- package/dist/types/plugins/mentions/pm-plugins/main.d.ts +2 -5
- package/dist/types/plugins/selection/utils.d.ts +7 -15
- package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +3 -0
- package/dist/types/plugins/table/ui/consts.d.ts +2 -2
- package/dist/types/plugins/type-ahead/types.d.ts +1 -0
- package/dist/types/plugins/unsupported-content/unsupported-inline-node-view.d.ts +11 -0
- package/dist/types/types/editor-appearance-component.d.ts +1 -0
- package/dist/types/types/editor-props.d.ts +1 -0
- package/dist/types/types/feature-flags.d.ts +0 -14
- package/dist/types/ui/Appearance/Chromeless.d.ts +1 -0
- package/dist/types/ui/Appearance/Comment/Comment.d.ts +1 -0
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +5 -5
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/ui/PortalProvider/PortalProviderThemesProvider.d.ts +6 -0
- package/dist/types/ui/PortalProvider/index.d.ts +5 -1
- package/dist/types/utils/check-if-mobile-bridge.d.ts +1 -0
- package/package.json +24 -23
- package/dist/cjs/plugins/emoji/nodeviews/emoji-next.js +0 -250
- package/dist/es2019/plugins/emoji/nodeviews/emoji-next.js +0 -177
- package/dist/esm/plugins/emoji/nodeviews/emoji-next.js +0 -234
- package/dist/types/plugins/emoji/nodeviews/emoji-next.d.ts +0 -31
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
import { getTimeSince } from '../../../utils/performance/get-performance-timing';
|
|
5
|
+
import { getAnalyticsEventSeverity } from '@atlaskit/editor-common/utils';
|
|
6
|
+
|
|
7
|
+
var InputLatencyTracker = /*#__PURE__*/function () {
|
|
8
|
+
function InputLatencyTracker(_ref) {
|
|
9
|
+
var samplingRate = _ref.samplingRate,
|
|
10
|
+
slowThreshold = _ref.slowThreshold,
|
|
11
|
+
normalThreshold = _ref.normalThreshold,
|
|
12
|
+
degradedThreshold = _ref.degradedThreshold,
|
|
13
|
+
dispatchAverage = _ref.dispatchAverage,
|
|
14
|
+
dispatchSample = _ref.dispatchSample,
|
|
15
|
+
onSampleStart = _ref.onSampleStart,
|
|
16
|
+
onSampleEnd = _ref.onSampleEnd,
|
|
17
|
+
onSlowInput = _ref.onSlowInput;
|
|
18
|
+
|
|
19
|
+
_classCallCheck(this, InputLatencyTracker);
|
|
20
|
+
|
|
21
|
+
_defineProperty(this, "samples", []);
|
|
22
|
+
|
|
23
|
+
_defineProperty(this, "total", 0);
|
|
24
|
+
|
|
25
|
+
this.currentStart = null;
|
|
26
|
+
this.samplingRate = samplingRate;
|
|
27
|
+
this.slowThreshold = slowThreshold;
|
|
28
|
+
this.normalThreshold = normalThreshold;
|
|
29
|
+
this.degradedThreshold = degradedThreshold;
|
|
30
|
+
this.dispatchAverage = dispatchAverage;
|
|
31
|
+
this.dispatchSample = dispatchSample;
|
|
32
|
+
this.onSampleStart = onSampleStart;
|
|
33
|
+
this.onSampleEnd = onSampleEnd;
|
|
34
|
+
this.onSlowInput = onSlowInput;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
_createClass(InputLatencyTracker, [{
|
|
38
|
+
key: "start",
|
|
39
|
+
value: function start() {
|
|
40
|
+
this.currentStart = performance.now();
|
|
41
|
+
|
|
42
|
+
if (this.samples.length + 1 === this.samplingRate) {
|
|
43
|
+
var _this$onSampleStart;
|
|
44
|
+
|
|
45
|
+
(_this$onSampleStart = this.onSampleStart) === null || _this$onSampleStart === void 0 ? void 0 : _this$onSampleStart.call(this);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}, {
|
|
49
|
+
key: "end",
|
|
50
|
+
value: function end() {
|
|
51
|
+
if (this.currentStart === null) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
var isSlow = false;
|
|
56
|
+
var time = getTimeSince(this.currentStart);
|
|
57
|
+
this.push(time);
|
|
58
|
+
|
|
59
|
+
if (time > this.slowThreshold) {
|
|
60
|
+
var _this$onSlowInput;
|
|
61
|
+
|
|
62
|
+
(_this$onSlowInput = this.onSlowInput) === null || _this$onSlowInput === void 0 ? void 0 : _this$onSlowInput.call(this, time);
|
|
63
|
+
isSlow = true;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (this.samples.length === this.samplingRate) {
|
|
67
|
+
var _this$onSampleEnd;
|
|
68
|
+
|
|
69
|
+
this.flush();
|
|
70
|
+
(_this$onSampleEnd = this.onSampleEnd) === null || _this$onSampleEnd === void 0 ? void 0 : _this$onSampleEnd.call(this, time, {
|
|
71
|
+
isSlow: isSlow,
|
|
72
|
+
severity: this.severity(time)
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}, {
|
|
77
|
+
key: "flush",
|
|
78
|
+
value: function flush() {
|
|
79
|
+
if (this.samples.length === 0) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
this.dispatch();
|
|
84
|
+
this.samples = [];
|
|
85
|
+
this.total = 0;
|
|
86
|
+
}
|
|
87
|
+
}, {
|
|
88
|
+
key: "dispatch",
|
|
89
|
+
value: function dispatch() {
|
|
90
|
+
var _this$dispatchSample, _this$dispatchAverage;
|
|
91
|
+
|
|
92
|
+
(_this$dispatchSample = this.dispatchSample) === null || _this$dispatchSample === void 0 ? void 0 : _this$dispatchSample.call(this, this.getLast(), this.severity(this.getLast())); // cache
|
|
93
|
+
|
|
94
|
+
var median = this.getMedian();
|
|
95
|
+
(_this$dispatchAverage = this.dispatchAverage) === null || _this$dispatchAverage === void 0 ? void 0 : _this$dispatchAverage.call(this, {
|
|
96
|
+
mean: this.getMean(),
|
|
97
|
+
median: median,
|
|
98
|
+
sampleSize: this.samples.length
|
|
99
|
+
}, this.severity(median));
|
|
100
|
+
}
|
|
101
|
+
}, {
|
|
102
|
+
key: "push",
|
|
103
|
+
value: function push(latency) {
|
|
104
|
+
this.samples.push(latency);
|
|
105
|
+
this.total += latency;
|
|
106
|
+
}
|
|
107
|
+
}, {
|
|
108
|
+
key: "severity",
|
|
109
|
+
value: function severity(time) {
|
|
110
|
+
return getAnalyticsEventSeverity(time, this.normalThreshold, this.degradedThreshold);
|
|
111
|
+
}
|
|
112
|
+
}, {
|
|
113
|
+
key: "getLast",
|
|
114
|
+
value: function getLast() {
|
|
115
|
+
return this.samples[this.samples.length - 1];
|
|
116
|
+
}
|
|
117
|
+
}, {
|
|
118
|
+
key: "getMean",
|
|
119
|
+
value: function getMean() {
|
|
120
|
+
return this.total / this.samples.length;
|
|
121
|
+
}
|
|
122
|
+
}, {
|
|
123
|
+
key: "getMedian",
|
|
124
|
+
value: function getMedian() {
|
|
125
|
+
if (this.samples.length === 1) {
|
|
126
|
+
return this.samples[0];
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
this.samples.sort(function (a, b) {
|
|
130
|
+
return a - b;
|
|
131
|
+
});
|
|
132
|
+
var middle = (this.samples.length + 1) / 2;
|
|
133
|
+
var floorMiddle = Math.floor(middle);
|
|
134
|
+
var remainder = middle % floorMiddle;
|
|
135
|
+
|
|
136
|
+
if (remainder === 0) {
|
|
137
|
+
return this.samples[middle - 1];
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
var left = this.samples[floorMiddle - 1];
|
|
141
|
+
var right = this.samples[floorMiddle];
|
|
142
|
+
return (left + right) / 2;
|
|
143
|
+
}
|
|
144
|
+
}]);
|
|
145
|
+
|
|
146
|
+
return InputLatencyTracker;
|
|
147
|
+
}();
|
|
148
|
+
|
|
149
|
+
export { InputLatencyTracker as default };
|
|
@@ -7,4 +7,5 @@ import { SelectionStyle, getSelectionStyles, akEditorDeleteBorder, akEditorDelet
|
|
|
7
7
|
import { N20 } from '@atlaskit/theme/colors';
|
|
8
8
|
import { SmartCardSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
9
9
|
import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
|
|
10
|
-
|
|
10
|
+
import { token } from '@atlaskit/tokens';
|
|
11
|
+
export var smartCardStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n max-width: calc(100% - 20px);\n vertical-align: top;\n word-break: break-all;\n\n .card {\n padding-left: 2px;\n padding-right: 2px;\n\n .", " > a:focus {\n ", "\n }\n }\n\n &.", "\n .", "\n > a {\n ", "\n }\n .", " > a {\n /* EDM-1717: box-shadow Safari fix start */\n z-index: 1;\n position: relative;\n /* EDM-1717: box-shadow Safari fix end */\n }\n\n &.danger {\n .", " > a {\n box-shadow: 0 0 0 1px\n ", ";\n /* EDM-1717: box-shadow Safari fix start */\n z-index: 2;\n /* EDM-1717: box-shadow Safari fix end */\n }\n }\n }\n\n .", " {\n .", " > div {\n cursor: pointer;\n &:hover {\n background-color: ", ";\n }\n }\n\n &.", "\n .", "\n > div {\n ", "\n }\n\n &.danger {\n .", " > div {\n box-shadow: 0 0 0 1px\n ", " !important;\n }\n }\n }\n\n .", " {\n .", " > div {\n cursor: pointer;\n &::after {\n transition: box-shadow 0s;\n }\n }\n &.", "\n .", "\n > div {\n ", "\n }\n\n &.", "\n .", "\n > div::after {\n ", "\n }\n\n &.danger {\n .media-card-frame::after {\n box-shadow: 0 0 0 1px\n ", " !important;\n background: ", " !important;\n }\n .richMedia-resize-handle-right::after,\n .richMedia-resize-handle-left::after {\n background: ", ";\n }\n }\n }\n"])), SmartCardSharedCssClassName.INLINE_CARD_CONTAINER, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), SmartCardSharedCssClassName.LOADER_WRAPPER, SmartCardSharedCssClassName.LOADER_WRAPPER, token('color.border.danger', akEditorDeleteBorder), SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, SmartCardSharedCssClassName.LOADER_WRAPPER, N20, akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), SmartCardSharedCssClassName.LOADER_WRAPPER, token('color.border.danger', akEditorDeleteBorder), SmartCardSharedCssClassName.EMBED_CARD_CONTAINER, SmartCardSharedCssClassName.LOADER_WRAPPER, akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), token('color.border.danger', akEditorDeleteBorder), token('color.background.danger', akEditorDeleteBackground), token('color.border.danger', akEditorDeleteBorder));
|
|
@@ -6,10 +6,11 @@ import { css } from '@emotion/react';
|
|
|
6
6
|
import { themed } from '@atlaskit/theme/components';
|
|
7
7
|
import { borderRadius, fontSize, gridSize } from '@atlaskit/theme/constants';
|
|
8
8
|
import * as colors from '@atlaskit/theme/colors';
|
|
9
|
+
import { token } from '@atlaskit/tokens';
|
|
9
10
|
import { blockNodesVerticalMargin, akEditorTableCellMinWidth, akEditorDeleteBackground, akEditorDeleteBorder, akEditorSelectedBorderSize, akEditorDeleteIconColor, SelectionStyle, getSelectionStyles, akEditorCodeFontFamily, akEditorSelectedNodeClassName, overflowShadow, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
10
11
|
import { codeBlockClassNames } from './ui/class-names';
|
|
11
12
|
export var highlightingCodeBlockStyles = function highlightingCodeBlockStyles(props) {
|
|
12
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror .code-block {\n position: relative;\n background-image: ", ";\n background-repeat: no-repeat;\n background-color: ", ";\n\n --ds--code--bg-color: transparent;\n\n background-attachment: local, scroll, scroll;\n background-size: 8px 100%, 8px 100%, 8px 100%;\n background-position: 100% 0, 100% 0, 0 0;\n font-family: ", ";\n border-radius: ", "px;\n margin: ", " 0 0 0;\n counter-reset: line;\n display: flex;\n min-width: ", "px;\n cursor: pointer;\n overflow-x: auto;\n\n .", " {\n /* https://bitbucket.org/atlassian/atlassian-frontend/src/develop/packages/design-system/code/src/themes/themeBuilder.ts#packages/design-system/code/src/themes/themeBuilder.ts-19:28 */\n flex-shrink: 0;\n text-align: right;\n background-color: ", ";\n padding: ", "px;\n color: ", ";\n\n span {\n display: block;\n line-height: 0;\n font-size: 0;\n\n &::before {\n display: inline-block;\n content: counter(line);\n counter-increment: line;\n font-size: ", ";\n line-height: 1.5rem;\n color: ", ";\n }\n }\n }\n\n .", " {\n position: absolute;\n z-index: 2;\n width: 100%;\n height: 100%;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n pointer-events: none;\n overflow: hidden;\n tab-size: 4;\n\n & [data-ds--code--code-block] {\n font-size: ", ";\n line-height: 1.5rem;\n }\n }\n\n .", " {\n position: relative;\n z-index: 1;\n display: flex;\n flex: 1;\n\n > code {\n flex-grow: 1;\n tab-size: 4;\n cursor: text;\n /* https://bitbucket.org/atlassian/atlassian-frontend/src/218202daeaf527262c21841e6f88fa058d349ad4/packages/design-system/code/src/themes/themeBuilder.ts#lines-12:17 */\n font-size: ", ";\n line-height: 1.5rem;\n border-radius: ", "px;\n margin: ", "px;\n white-space: pre;\n }\n\n &[data-debounce='true'] {\n .", " {\n display: none;\n }\n }\n\n &:not([data-debounce='true']) {\n > code:not([data-language='plaintext']):not([data-language='none']):not([data-language='']) {\n color: transparent;\n caret-color: ", ";\n }\n }\n }\n }\n\n .ProseMirror li > .code-block {\n margin: 0;\n }\n\n .ProseMirror .code-block.", ":not(.danger) {\n ", "\n }\n\n /* Danger when top level node */\n .ProseMirror .danger.code-block {\n box-shadow: 0 0 0 ", "px
|
|
13
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror .code-block {\n position: relative;\n background-image: ", ";\n background-repeat: no-repeat;\n background-color: ", ";\n\n --ds--code--bg-color: transparent;\n\n background-attachment: local, scroll, scroll;\n background-size: 8px 100%, 8px 100%, 8px 100%;\n background-position: 100% 0, 100% 0, 0 0;\n font-family: ", ";\n border-radius: ", "px;\n margin: ", " 0 0 0;\n counter-reset: line;\n display: flex;\n min-width: ", "px;\n cursor: pointer;\n overflow-x: auto;\n\n .", " {\n /* https://bitbucket.org/atlassian/atlassian-frontend/src/develop/packages/design-system/code/src/themes/themeBuilder.ts#packages/design-system/code/src/themes/themeBuilder.ts-19:28 */\n flex-shrink: 0;\n text-align: right;\n background-color: ", ";\n padding: ", "px;\n color: ", ";\n\n span {\n display: block;\n line-height: 0;\n font-size: 0;\n\n &::before {\n display: inline-block;\n content: counter(line);\n counter-increment: line;\n font-size: ", ";\n line-height: 1.5rem;\n color: ", ";\n }\n }\n }\n\n .", " {\n position: absolute;\n z-index: 2;\n width: 100%;\n height: 100%;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n pointer-events: none;\n overflow: hidden;\n tab-size: 4;\n\n & [data-ds--code--code-block] {\n font-size: ", ";\n line-height: 1.5rem;\n }\n }\n\n .", " {\n position: relative;\n z-index: 1;\n display: flex;\n flex: 1;\n\n > code {\n flex-grow: 1;\n tab-size: 4;\n cursor: text;\n /* https://bitbucket.org/atlassian/atlassian-frontend/src/218202daeaf527262c21841e6f88fa058d349ad4/packages/design-system/code/src/themes/themeBuilder.ts#lines-12:17 */\n font-size: ", ";\n line-height: 1.5rem;\n border-radius: ", "px;\n margin: ", "px;\n white-space: pre;\n }\n\n &[data-debounce='true'] {\n .", " {\n display: none;\n }\n }\n\n &:not([data-debounce='true']) {\n > code:not([data-language='plaintext']):not([data-language='none']):not([data-language='']) {\n color: transparent;\n caret-color: ", ";\n }\n }\n }\n }\n\n .ProseMirror li > .code-block {\n margin: 0;\n }\n\n .ProseMirror .code-block.", ":not(.danger) {\n ", "\n }\n\n /* Danger when top level node */\n .ProseMirror .danger.code-block {\n box-shadow: 0 0 0 ", "px\n ", ";\n\n .", " {\n background-color: ", ";\n color: ", ";\n }\n\n .", " {\n background-color: ", ";\n }\n }\n\n /* Danger when nested node */\n .ProseMirror .danger .code-block {\n .", " {\n background-color: rgba(255, 143, 115, 0.5);\n color: ", ";\n }\n\n .", " {\n background-color: rgba(255, 189, 173, 0.5);\n }\n }\n"])), overflowShadow({
|
|
13
14
|
background: themed({
|
|
14
15
|
light: colors.N20,
|
|
15
16
|
dark: colors.DN50
|
|
@@ -30,10 +31,10 @@ export var highlightingCodeBlockStyles = function highlightingCodeBlockStyles(pr
|
|
|
30
31
|
})(props), codeBlockClassNames.highlighting, relativeFontSizeToBase16(fontSize()), codeBlockClassNames.content, relativeFontSizeToBase16(fontSize()), borderRadius(), gridSize(), codeBlockClassNames.highlighting, themed({
|
|
31
32
|
light: colors.N800,
|
|
32
33
|
dark: colors.DN500
|
|
33
|
-
})(props), akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Blanket]), akEditorSelectedBorderSize, akEditorDeleteBorder, codeBlockClassNames.gutter, colors.R75, akEditorDeleteIconColor, codeBlockClassNames.content, akEditorDeleteBackground, codeBlockClassNames.gutter, akEditorDeleteIconColor, codeBlockClassNames.content);
|
|
34
|
+
})(props), akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Blanket]), akEditorSelectedBorderSize, token('color.border.danger', akEditorDeleteBorder), codeBlockClassNames.gutter, colors.R75, token('color.text.danger', akEditorDeleteIconColor), codeBlockClassNames.content, token('color.background.danger', akEditorDeleteBackground), codeBlockClassNames.gutter, token('color.text.danger', akEditorDeleteIconColor), codeBlockClassNames.content);
|
|
34
35
|
};
|
|
35
36
|
export var codeBlockStyles = function codeBlockStyles(props) {
|
|
36
|
-
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .ProseMirror .code-block {\n position: relative;\n background-image: ", ";\n\n --ds--code--bg-color: transparent;\n\n background-repeat: no-repeat;\n background-color: ", ";\n background-attachment: local, scroll, scroll;\n background-size: 8px 100%, 8px 100%, 8px 100%;\n background-position: 100% 0, 100% 0, 0 0;\n font-family: ", ";\n border-radius: ", "px;\n margin: ", " 0 0 0;\n counter-reset: line;\n display: flex;\n min-width: ", "px;\n cursor: pointer;\n overflow-x: auto;\n\n .", " {\n /* https://bitbucket.org/atlassian/atlassian-frontend/src/develop/packages/design-system/code/src/themes/themeBuilder.ts#packages/design-system/code/src/themes/themeBuilder.ts-19:28 */\n flex-shrink: 0;\n text-align: right;\n background-color: ", ";\n padding: ", "px;\n\n span {\n display: block;\n line-height: 0;\n font-size: 0;\n\n &::before {\n display: inline-block;\n content: counter(line);\n counter-increment: line;\n font-size: ", ";\n line-height: 1.5rem;\n color: ", ";\n }\n }\n }\n\n .", " {\n display: flex;\n flex: 1;\n\n code {\n flex-grow: 1;\n tab-size: 4;\n cursor: text;\n /* https://bitbucket.org/atlassian/atlassian-frontend/src/218202daeaf527262c21841e6f88fa058d349ad4/packages/design-system/code/src/themes/themeBuilder.ts#lines-12:17 */\n font-size: ", ";\n line-height: 1.5rem;\n color: ", ";\n border-radius: ", "px;\n margin: ", "px;\n white-space: pre;\n }\n }\n }\n\n .ProseMirror li > .code-block {\n margin: 0;\n }\n\n .ProseMirror .code-block.", ":not(.danger) {\n ", "\n }\n\n /* Danger when top level node */\n .ProseMirror .danger.code-block {\n box-shadow: 0 0 0 ", "px
|
|
37
|
+
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .ProseMirror .code-block {\n position: relative;\n background-image: ", ";\n\n --ds--code--bg-color: transparent;\n\n background-repeat: no-repeat;\n background-color: ", ";\n background-attachment: local, scroll, scroll;\n background-size: 8px 100%, 8px 100%, 8px 100%;\n background-position: 100% 0, 100% 0, 0 0;\n font-family: ", ";\n border-radius: ", "px;\n margin: ", " 0 0 0;\n counter-reset: line;\n display: flex;\n min-width: ", "px;\n cursor: pointer;\n overflow-x: auto;\n\n .", " {\n /* https://bitbucket.org/atlassian/atlassian-frontend/src/develop/packages/design-system/code/src/themes/themeBuilder.ts#packages/design-system/code/src/themes/themeBuilder.ts-19:28 */\n flex-shrink: 0;\n text-align: right;\n background-color: ", ";\n padding: ", "px;\n\n span {\n display: block;\n line-height: 0;\n font-size: 0;\n\n &::before {\n display: inline-block;\n content: counter(line);\n counter-increment: line;\n font-size: ", ";\n line-height: 1.5rem;\n color: ", ";\n }\n }\n }\n\n .", " {\n display: flex;\n flex: 1;\n\n code {\n flex-grow: 1;\n tab-size: 4;\n cursor: text;\n /* https://bitbucket.org/atlassian/atlassian-frontend/src/218202daeaf527262c21841e6f88fa058d349ad4/packages/design-system/code/src/themes/themeBuilder.ts#lines-12:17 */\n font-size: ", ";\n line-height: 1.5rem;\n color: ", ";\n border-radius: ", "px;\n margin: ", "px;\n white-space: pre;\n }\n }\n }\n\n .ProseMirror li > .code-block {\n margin: 0;\n }\n\n .ProseMirror .code-block.", ":not(.danger) {\n ", "\n }\n\n /* Danger when top level node */\n .ProseMirror .danger.code-block {\n box-shadow: 0 0 0 ", "px\n ", ";\n\n .", " {\n background-color: ", ";\n color: ", ";\n }\n\n .", " {\n background-color: ", ";\n }\n }\n\n /* Danger when nested node */\n .ProseMirror .danger .code-block {\n .", " {\n background-color: rgba(255, 143, 115, 0.5);\n color: ", ";\n }\n\n .", " {\n background-color: rgba(255, 189, 173, 0.5);\n }\n }\n"])), overflowShadow({
|
|
37
38
|
background: themed({
|
|
38
39
|
light: colors.N20,
|
|
39
40
|
dark: colors.DN50
|
|
@@ -51,5 +52,5 @@ export var codeBlockStyles = function codeBlockStyles(props) {
|
|
|
51
52
|
})(props), codeBlockClassNames.content, relativeFontSizeToBase16(fontSize()), themed({
|
|
52
53
|
light: colors.N800,
|
|
53
54
|
dark: colors.DN800
|
|
54
|
-
})(props), borderRadius(), gridSize(), akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Blanket]), akEditorSelectedBorderSize, akEditorDeleteBorder, codeBlockClassNames.gutter, colors.R75, akEditorDeleteIconColor, codeBlockClassNames.content, akEditorDeleteBackground, codeBlockClassNames.gutter, akEditorDeleteIconColor, codeBlockClassNames.content);
|
|
55
|
+
})(props), borderRadius(), gridSize(), akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Blanket]), akEditorSelectedBorderSize, token('color.border.danger', akEditorDeleteBorder), codeBlockClassNames.gutter, colors.R75, token('color.text.danger', akEditorDeleteIconColor), codeBlockClassNames.content, token('color.background.danger', akEditorDeleteBackground), codeBlockClassNames.gutter, token('color.text.danger', akEditorDeleteIconColor), codeBlockClassNames.content);
|
|
55
56
|
};
|
|
@@ -16,14 +16,19 @@ export var TELEPOINTER_DIM_CLASS = 'telepointer-dim';
|
|
|
16
16
|
* Returns position where it's possible to place a decoration.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
var getValidPos = function getValidPos(tr, pos) {
|
|
20
|
-
var
|
|
21
|
-
var backwardSelection = Selection.findFrom(resolvedPos, -1, true); // if there's no correct cursor position before the `pos`, we try to find it after the `pos`
|
|
19
|
+
export var getValidPos = function getValidPos(tr, pos) {
|
|
20
|
+
var endOfDocPos = tr.doc.nodeSize - 2;
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
if (pos <= endOfDocPos) {
|
|
23
|
+
var resolvedPos = tr.doc.resolve(pos);
|
|
24
|
+
var backwardSelection = Selection.findFrom(resolvedPos, -1, true); // if there's no correct cursor position before the `pos`, we try to find it after the `pos`
|
|
25
|
+
|
|
26
|
+
var forwardSelection = Selection.findFrom(resolvedPos, 1, true);
|
|
27
|
+
return backwardSelection ? backwardSelection.from : forwardSelection ? forwardSelection.from : pos;
|
|
28
|
+
}
|
|
26
29
|
|
|
30
|
+
return endOfDocPos;
|
|
31
|
+
};
|
|
27
32
|
export var PluginState = /*#__PURE__*/function () {
|
|
28
33
|
function PluginState(decorations, participants, sessionId) {
|
|
29
34
|
var collabInitalised = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
@@ -117,11 +122,21 @@ export var PluginState = /*#__PURE__*/function () {
|
|
|
117
122
|
remove = remove.concat(oldPointers);
|
|
118
123
|
}
|
|
119
124
|
|
|
125
|
+
var endOfDocPos = tr.doc.nodeSize - 2;
|
|
120
126
|
var _telepointerData$sele = telepointerData.selection,
|
|
121
127
|
anchor = _telepointerData$sele.anchor,
|
|
122
128
|
head = _telepointerData$sele.head;
|
|
123
129
|
var rawFrom = anchor < head ? anchor : head;
|
|
124
130
|
var rawTo = anchor >= head ? anchor : head;
|
|
131
|
+
|
|
132
|
+
if (rawFrom > endOfDocPos) {
|
|
133
|
+
rawFrom = endOfDocPos;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (rawTo > endOfDocPos) {
|
|
137
|
+
rawTo = endOfDocPos;
|
|
138
|
+
}
|
|
139
|
+
|
|
125
140
|
var isSelection = rawTo - rawFrom > 0;
|
|
126
141
|
var from = 1;
|
|
127
142
|
var to = 1;
|
|
@@ -4,5 +4,6 @@ var _templateObject;
|
|
|
4
4
|
|
|
5
5
|
import { css } from '@emotion/react';
|
|
6
6
|
import { DateSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
7
|
+
import { token } from '@atlaskit/tokens';
|
|
7
8
|
import { SelectionStyle, getSelectionStyles, akEditorSelectedBorderSize, akEditorDeleteBorder, akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
|
|
8
|
-
export var dateStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n .", " {\n line-height: initial;\n cursor: pointer;\n }\n\n &.", " {\n .", " > span {\n ", "\n }\n }\n }\n\n .danger {\n .", ".", "\n .", "\n > span {\n box-shadow: 0 0 0 ", "px
|
|
9
|
+
export var dateStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n .", " {\n line-height: initial;\n cursor: pointer;\n }\n\n &.", " {\n .", " > span {\n ", "\n }\n }\n }\n\n .danger {\n .", ".", "\n .", "\n > span {\n box-shadow: 0 0 0 ", "px\n ", ";\n }\n }\n"])), DateSharedCssClassName.DATE_CONTAINER, DateSharedCssClassName.DATE_WRAPPER, akEditorSelectedNodeClassName, DateSharedCssClassName.DATE_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), DateSharedCssClassName.DATE_CONTAINER, akEditorSelectedNodeClassName, DateSharedCssClassName.DATE_WRAPPER, akEditorSelectedBorderSize, token('color.border.danger', akEditorDeleteBorder));
|
|
@@ -11,14 +11,13 @@ import { emoji } from '@atlaskit/adf-schema';
|
|
|
11
11
|
import { Fragment } from 'prosemirror-model';
|
|
12
12
|
import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
|
|
13
13
|
import { EmojiTypeAheadItem, SearchSort, recordSelectionSucceededSli, recordSelectionFailedSli } from '@atlaskit/emoji';
|
|
14
|
+
import { getInlineNodeViewProducer } from '../../nodeviews/getInlineNodeViewProducer';
|
|
14
15
|
import { inputRulePlugin as asciiInputRulePlugin } from './pm-plugins/ascii-input-rules';
|
|
15
16
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, EVENT_TYPE, INPUT_METHOD } from '../analytics';
|
|
16
17
|
import { IconEmoji } from '../quick-insert/assets';
|
|
17
|
-
import
|
|
18
|
-
import emojiNodeViewNext from './nodeviews/emoji-next';
|
|
18
|
+
import { EmojiNodeView } from './nodeviews/emoji';
|
|
19
19
|
import { EmojiContextProvider } from './ui/EmojiContextProvider';
|
|
20
20
|
import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
|
|
21
|
-
import { getFeatureFlags } from '../feature-flags-context';
|
|
22
21
|
import { openTypeAheadAtCursor } from '../type-ahead/transforms/open-typeahead-at-cursor';
|
|
23
22
|
export var emojiToTypeaheadItem = function emojiToTypeaheadItem(emoji, emojiProvider) {
|
|
24
23
|
return {
|
|
@@ -184,26 +183,22 @@ var emojiPlugin = function emojiPlugin(options) {
|
|
|
184
183
|
pmPlugins: function pmPlugins() {
|
|
185
184
|
return [{
|
|
186
185
|
name: 'emoji',
|
|
187
|
-
plugin: function plugin(
|
|
188
|
-
|
|
189
|
-
dispatch = _ref5.dispatch,
|
|
190
|
-
portalProviderAPI = _ref5.portalProviderAPI,
|
|
191
|
-
eventDispatcher = _ref5.eventDispatcher;
|
|
192
|
-
return emojiPluginFactory(dispatch, providerFactory, portalProviderAPI, eventDispatcher, options);
|
|
186
|
+
plugin: function plugin(pmPluginFactoryParams) {
|
|
187
|
+
return createEmojiPlugin(pmPluginFactoryParams);
|
|
193
188
|
}
|
|
194
189
|
}, {
|
|
195
190
|
name: 'emojiAsciiInputRule',
|
|
196
|
-
plugin: function plugin(
|
|
197
|
-
var schema =
|
|
198
|
-
providerFactory =
|
|
199
|
-
featureFlags =
|
|
191
|
+
plugin: function plugin(_ref5) {
|
|
192
|
+
var schema = _ref5.schema,
|
|
193
|
+
providerFactory = _ref5.providerFactory,
|
|
194
|
+
featureFlags = _ref5.featureFlags;
|
|
200
195
|
return asciiInputRulePlugin(schema, providerFactory, featureFlags);
|
|
201
196
|
}
|
|
202
197
|
}];
|
|
203
198
|
},
|
|
204
199
|
pluginsOptions: {
|
|
205
|
-
quickInsert: function quickInsert(
|
|
206
|
-
var formatMessage =
|
|
200
|
+
quickInsert: function quickInsert(_ref6) {
|
|
201
|
+
var formatMessage = _ref6.formatMessage;
|
|
207
202
|
return [{
|
|
208
203
|
id: 'emoji',
|
|
209
204
|
title: formatMessage(messages.emoji),
|
|
@@ -280,7 +275,7 @@ export var emojiPluginKey = new PluginKey('emojiPlugin');
|
|
|
280
275
|
export function getEmojiPluginState(state) {
|
|
281
276
|
return emojiPluginKey.getState(state) || {};
|
|
282
277
|
}
|
|
283
|
-
export function
|
|
278
|
+
export function createEmojiPlugin(pmPluginFactoryParams) {
|
|
284
279
|
return new SafePlugin({
|
|
285
280
|
key: emojiPluginKey,
|
|
286
281
|
state: {
|
|
@@ -288,12 +283,12 @@ export function emojiPluginFactory(dispatch, providerFactory, portalProviderAPI,
|
|
|
288
283
|
return {};
|
|
289
284
|
},
|
|
290
285
|
apply: function apply(tr, pluginState) {
|
|
291
|
-
var
|
|
286
|
+
var _ref7 = tr.getMeta(emojiPluginKey) || {
|
|
292
287
|
action: null,
|
|
293
288
|
params: null
|
|
294
289
|
},
|
|
295
|
-
action =
|
|
296
|
-
params =
|
|
290
|
+
action = _ref7.action,
|
|
291
|
+
params = _ref7.params;
|
|
297
292
|
|
|
298
293
|
var newPluginState = pluginState;
|
|
299
294
|
|
|
@@ -302,14 +297,14 @@ export function emojiPluginFactory(dispatch, providerFactory, portalProviderAPI,
|
|
|
302
297
|
newPluginState = _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
303
298
|
emojiProvider: params.provider
|
|
304
299
|
});
|
|
305
|
-
dispatch(emojiPluginKey, newPluginState);
|
|
300
|
+
pmPluginFactoryParams.dispatch(emojiPluginKey, newPluginState);
|
|
306
301
|
return newPluginState;
|
|
307
302
|
|
|
308
303
|
case ACTIONS.SET_ASCII_MAP:
|
|
309
304
|
newPluginState = _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
310
305
|
asciiMap: params.asciiMap
|
|
311
306
|
});
|
|
312
|
-
dispatch(emojiPluginKey, newPluginState);
|
|
307
|
+
pmPluginFactoryParams.dispatch(emojiPluginKey, newPluginState);
|
|
313
308
|
return newPluginState;
|
|
314
309
|
}
|
|
315
310
|
|
|
@@ -318,11 +313,13 @@ export function emojiPluginFactory(dispatch, providerFactory, portalProviderAPI,
|
|
|
318
313
|
},
|
|
319
314
|
props: {
|
|
320
315
|
nodeViews: {
|
|
321
|
-
emoji:
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
316
|
+
emoji: getInlineNodeViewProducer({
|
|
317
|
+
pmPluginFactoryParams: pmPluginFactoryParams,
|
|
318
|
+
Component: EmojiNodeView,
|
|
319
|
+
extraComponentProps: {
|
|
320
|
+
providerFactory: pmPluginFactoryParams.providerFactory
|
|
321
|
+
}
|
|
322
|
+
})
|
|
326
323
|
}
|
|
327
324
|
},
|
|
328
325
|
view: function view(editorView) {
|
|
@@ -347,11 +344,11 @@ export function emojiPluginFactory(dispatch, providerFactory, portalProviderAPI,
|
|
|
347
344
|
return;
|
|
348
345
|
};
|
|
349
346
|
|
|
350
|
-
providerFactory.subscribe('emojiProvider', providerHandler);
|
|
347
|
+
pmPluginFactoryParams.providerFactory.subscribe('emojiProvider', providerHandler);
|
|
351
348
|
return {
|
|
352
349
|
destroy: function destroy() {
|
|
353
|
-
if (providerFactory) {
|
|
354
|
-
providerFactory.unsubscribe('emojiProvider', providerHandler);
|
|
350
|
+
if (pmPluginFactoryParams.providerFactory) {
|
|
351
|
+
pmPluginFactoryParams.providerFactory.unsubscribe('emojiProvider', providerHandler);
|
|
355
352
|
}
|
|
356
353
|
}
|
|
357
354
|
};
|
|
@@ -1,59 +1,14 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _get from "@babel/runtime/helpers/get";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
-
|
|
8
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
|
-
|
|
10
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
11
|
-
|
|
12
1
|
import React from 'react';
|
|
13
|
-
import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
|
|
14
2
|
import Emoji from '../ui/Emoji';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
_createClass(EmojiNodeView, [{
|
|
28
|
-
key: "createDomRef",
|
|
29
|
-
value: function createDomRef() {
|
|
30
|
-
return _get(_getPrototypeOf(EmojiNodeView.prototype), "createDomRef", this).call(this);
|
|
31
|
-
}
|
|
32
|
-
}, {
|
|
33
|
-
key: "render",
|
|
34
|
-
value: function render(props) {
|
|
35
|
-
var providerFactory = props.providerFactory,
|
|
36
|
-
options = props.options;
|
|
37
|
-
var _this$node$attrs = this.node.attrs,
|
|
38
|
-
shortName = _this$node$attrs.shortName,
|
|
39
|
-
id = _this$node$attrs.id,
|
|
40
|
-
text = _this$node$attrs.text;
|
|
41
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Emoji, {
|
|
42
|
-
providers: providerFactory,
|
|
43
|
-
id: id,
|
|
44
|
-
shortName: shortName,
|
|
45
|
-
fallback: text
|
|
46
|
-
}), options && options.allowZeroWidthSpaceAfter && ZERO_WIDTH_SPACE);
|
|
47
|
-
}
|
|
48
|
-
}]);
|
|
49
|
-
|
|
50
|
-
return EmojiNodeView;
|
|
51
|
-
}(ReactNodeView);
|
|
52
|
-
export default function emojiNodeView(portalProviderAPI, eventDispatcher, providerFactory, options) {
|
|
53
|
-
return function (node, view, getPos) {
|
|
54
|
-
return new EmojiNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {
|
|
55
|
-
providerFactory: providerFactory,
|
|
56
|
-
options: options
|
|
57
|
-
}).init();
|
|
58
|
-
};
|
|
3
|
+
export function EmojiNodeView(props) {
|
|
4
|
+
var _props$node$attrs = props.node.attrs,
|
|
5
|
+
shortName = _props$node$attrs.shortName,
|
|
6
|
+
id = _props$node$attrs.id,
|
|
7
|
+
text = _props$node$attrs.text;
|
|
8
|
+
return /*#__PURE__*/React.createElement(Emoji, {
|
|
9
|
+
providers: props.providerFactory,
|
|
10
|
+
id: id,
|
|
11
|
+
shortName: shortName,
|
|
12
|
+
fallback: text
|
|
13
|
+
});
|
|
59
14
|
}
|
|
@@ -1,19 +1,8 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
|
|
3
|
-
var _templateObject
|
|
3
|
+
var _templateObject;
|
|
4
4
|
|
|
5
5
|
import { css } from '@emotion/react';
|
|
6
|
-
import { N0, N20, N900 } from '@atlaskit/theme/colors';
|
|
7
|
-
import { borderRadius, fontSizeSmall, gridSize } from '@atlaskit/theme/constants';
|
|
8
6
|
import { EmojiSharedCssClassName } from '@atlaskit/editor-common/emoji';
|
|
9
|
-
import { SelectionStyle, getSelectionStyles, akEditorSelectedNodeClassName
|
|
10
|
-
export var emojiStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n display: inline-block;\n\n .", " {\n cursor: pointer;\n\n &.", " > span {\n /** needed for selection style to cover custom emoji image properly */\n display: flex;\n }\n }\n\n &.", " {\n .", ",\n .", " {\n border-radius: 2px;\n ", "\n }\n }\n }\n"])), EmojiSharedCssClassName.EMOJI_CONTAINER, EmojiSharedCssClassName.EMOJI_NODE, EmojiSharedCssClassName.EMOJI_IMAGE, akEditorSelectedNodeClassName, EmojiSharedCssClassName.EMOJI_SPRITE, EmojiSharedCssClassName.EMOJI_IMAGE, getSelectionStyles([SelectionStyle.Blanket, SelectionStyle.BoxShadow]));
|
|
11
|
-
var grid = gridSize() / 2;
|
|
12
|
-
var fontSize = fontSizeSmall();
|
|
13
|
-
var lineHeight = 4 * grid / fontSize;
|
|
14
|
-
var maxWidth = 105 * grid; // ~420px
|
|
15
|
-
|
|
16
|
-
var leftAndRightTextPadding = 2 * grid;
|
|
17
|
-
var topAndBottomPadding = grid / 4;
|
|
18
|
-
var marginDistance = 2 * grid;
|
|
19
|
-
export var emojiStylesNext = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .editor-emoji {\n position: relative;\n display: inline-block;\n width: 20px;\n height: 20px;\n background-repeat: none;\n background-size: contain;\n cursor: pointer;\n vertical-align: middle;\n\n &.editor-emoji-loading {\n border-radius: ", "px;\n background: ", ";\n }\n\n &.editor-emoji-fallback {\n display: inline;\n background: transparent;\n vertical-align: baseline;\n }\n\n &.ProseMirror-selectednode:empty {\n outline: none;\n }\n\n &:not(.editor-emoji-fallback) {\n font-size: 0px;\n }\n\n &:not(.editor-emoji-fallback)::before {\n content: attr(data-emoji-shortname);\n display: block;\n box-sizing: border-box;\n width: auto;\n position: absolute;\n top: 100%;\n left: 50%;\n transform: translate(-50%, ", "px);\n\n // packages/css-packs/reduced-ui-pack/src/tooltip.js:25\n color: ", ";\n background-color: ", ";\n font-size: ", ";\n line-height: ", ";\n max-width: ", "px;\n border-radius: ", "px;\n overflow: hidden;\n padding: ", "px ", "px;\n pointer-events: none;\n text-decoration: none;\n text-overflow: ellipsis;\n white-space: nowrap;\n z-index: 10000;\n\n opacity: 0; // invisible by default\n transition: opacity 0.35s; // (durationStep * 14)\n }\n\n &:not(.editor-emoji-fallback):hover::before {\n opacity: 1;\n transition: opacity 0s 0.35s; // (durationStep * 14)\n }\n\n &.", " {\n z-index: 2;\n border-radius: 2px;\n ", "\n }\n }\n"])), borderRadius(), N20, marginDistance, N0, N900, relativeFontSizeToBase16(fontSize), lineHeight, maxWidth, borderRadius(), topAndBottomPadding, leftAndRightTextPadding, akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.Blanket, SelectionStyle.BoxShadow]));
|
|
7
|
+
import { SelectionStyle, getSelectionStyles, akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
|
|
8
|
+
export var emojiStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n display: inline-block;\n\n .", " {\n cursor: pointer;\n\n &.", " > span {\n /** needed for selection style to cover custom emoji image properly */\n display: flex;\n }\n }\n\n &.", " {\n .", ",\n .", " {\n border-radius: 2px;\n ", "\n }\n }\n }\n"])), EmojiSharedCssClassName.EMOJI_CONTAINER, EmojiSharedCssClassName.EMOJI_NODE, EmojiSharedCssClassName.EMOJI_IMAGE, akEditorSelectedNodeClassName, EmojiSharedCssClassName.EMOJI_SPRITE, EmojiSharedCssClassName.EMOJI_IMAGE, getSelectionStyles([SelectionStyle.Blanket, SelectionStyle.BoxShadow]));
|
|
@@ -23,10 +23,10 @@ var EXPAND_ICON_COLOR = function EXPAND_ICON_COLOR(props) {
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
var ACTIVE_STATE_BACKGROUND_COLOR = themed({
|
|
26
|
-
dark: "#
|
|
26
|
+
dark: "#0C294F4B"
|
|
27
27
|
});
|
|
28
28
|
var ACTIVE_STATE_BORDER = themed({
|
|
29
|
-
dark: "1px solid #
|
|
29
|
+
dark: "1px solid #4794ff4B"
|
|
30
30
|
});
|
|
31
31
|
var ACTIVE_STATE_BORDER_RADIUS = themed({
|
|
32
32
|
dark: '3px'
|
|
@@ -4,4 +4,5 @@ var _templateObject;
|
|
|
4
4
|
|
|
5
5
|
import { css } from '@emotion/react';
|
|
6
6
|
import { blockNodesVerticalMargin, akEditorSelectedBorderSize, akEditorDeleteBorder, akEditorDeleteBackground, SelectionStyle, getSelectionStyles, akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
|
|
7
|
-
|
|
7
|
+
import { token } from '@atlaskit/tokens';
|
|
8
|
+
export var extensionStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .extensionView-content-wrap,\n .bodiedExtensionView-content-wrap {\n margin: ", " 0;\n\n &:first-of-type {\n margin-top: 0;\n }\n\n &:last-of-type {\n margin-bottom: 0;\n }\n\n &:not(.danger).", " {\n & > span > .extension-container {\n ", "\n }\n }\n\n &.danger > span > .extension-container {\n box-shadow: 0 0 0 ", "px\n ", ";\n background-color: ", ";\n }\n\n &.inline {\n word-wrap: break-all;\n }\n }\n\n .extensionView-content-wrap .extension-container {\n overflow: hidden;\n }\n\n .bodiedExtensionView-content-wrap\n .extensionView-content-wrap\n .extension-container {\n width: 100%;\n max-width: 100%; // ensure width can't go over 100%;\n }\n"])), blockNodesVerticalMargin, akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow]), akEditorSelectedBorderSize, token('color.border.danger', akEditorDeleteBorder), token('color.background.danger', akEditorDeleteBackground));
|