@atlaskit/editor-common 72.6.1 → 72.7.1
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 +31 -0
- package/dist/cjs/analytics/types/enums.js +3 -0
- package/dist/cjs/hooks/index.js +8 -1
- package/dist/cjs/hooks/useSharedPluginState.js +102 -0
- package/dist/cjs/messages/{codeBlockCopyButton.js → codeBlockButton.js} +13 -3
- package/dist/cjs/messages/index.js +3 -3
- package/dist/cjs/normalize-feature-flags.js +12 -0
- package/dist/cjs/preset/plugin-injection-api.js +115 -53
- package/dist/cjs/styles/shared/table.js +2 -0
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui-color/ColorPalette/Palettes/borderColorPalette.js +24 -0
- package/dist/cjs/ui-color/ColorPalette/Palettes/index.js +6 -0
- package/dist/cjs/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +25 -2
- package/dist/cjs/ui-color/index.js +14 -1
- package/dist/cjs/utils/validator.js +7 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics/types/enums.js +3 -0
- package/dist/es2019/hooks/index.js +2 -1
- package/dist/es2019/hooks/useSharedPluginState.js +78 -0
- package/dist/{esm/messages/codeBlockCopyButton.js → es2019/messages/codeBlockButton.js} +11 -1
- package/dist/es2019/messages/index.js +1 -1
- package/dist/es2019/normalize-feature-flags.js +9 -0
- package/dist/es2019/preset/plugin-injection-api.js +64 -33
- package/dist/es2019/styles/shared/table.js +2 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui-color/ColorPalette/Palettes/borderColorPalette.js +16 -0
- package/dist/es2019/ui-color/ColorPalette/Palettes/index.js +1 -1
- package/dist/es2019/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +24 -0
- package/dist/es2019/ui-color/index.js +3 -2
- package/dist/es2019/utils/validator.js +7 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics/types/enums.js +3 -0
- package/dist/esm/hooks/index.js +2 -1
- package/dist/esm/hooks/useSharedPluginState.js +95 -0
- package/dist/{es2019/messages/codeBlockCopyButton.js → esm/messages/codeBlockButton.js} +11 -1
- package/dist/esm/messages/index.js +1 -1
- package/dist/esm/normalize-feature-flags.js +11 -0
- package/dist/esm/preset/plugin-injection-api.js +115 -53
- package/dist/esm/styles/shared/table.js +2 -0
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui-color/ColorPalette/Palettes/borderColorPalette.js +16 -0
- package/dist/esm/ui-color/ColorPalette/Palettes/index.js +1 -1
- package/dist/esm/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +22 -0
- package/dist/esm/ui-color/index.js +3 -2
- package/dist/esm/utils/validator.js +7 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/types/enums.d.ts +3 -0
- package/dist/types/analytics/types/media-events.d.ts +3 -1
- package/dist/types/collab/types.d.ts +15 -0
- package/dist/types/collab.d.ts +1 -1
- package/dist/types/extensions/types/extension-handler.d.ts +1 -1
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/useSharedPluginState.d.ts +39 -0
- package/dist/types/messages/codeBlockButton.d.ts +22 -0
- package/dist/types/messages/index.d.ts +1 -1
- package/dist/types/normalize-feature-flags.d.ts +7 -0
- package/dist/types/preset/plugin-injection-api.d.ts +3 -1
- package/dist/types/styles/shared/table.d.ts +2 -0
- package/dist/types/types/feature-flags.d.ts +9 -0
- package/dist/types/types/floating-toolbar.d.ts +5 -0
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/next-editor-plugin.d.ts +5 -4
- package/dist/types/ui/EventHandlers/index.d.ts +2 -2
- package/dist/types/ui-color/ColorPalette/Palettes/borderColorPalette.d.ts +3 -0
- package/dist/types/ui-color/ColorPalette/Palettes/index.d.ts +1 -1
- package/dist/types/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.d.ts +36 -0
- package/dist/types/ui-color/index.d.ts +2 -1
- package/package.json +10 -9
- package/report.api.md +1 -1
- package/dist/types/messages/codeBlockCopyButton.d.ts +0 -12
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
1
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
4
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
5
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
6
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
5
7
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
6
8
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -13,56 +15,78 @@ function hasGetSharedState(plugin) {
|
|
|
13
15
|
function hasActions(plugin) {
|
|
14
16
|
return _typeof(plugin.actions) === 'object';
|
|
15
17
|
}
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
*
|
|
19
|
-
* After some investigations, we discovered this is the best ratio for our current Editor: 80ms. That means is five times bigger than the 60fps dream target.
|
|
20
|
-
*
|
|
21
|
-
* In the future, once we remove the entire WithPluginState, We may decide to reduce this value.
|
|
22
|
-
*
|
|
23
|
-
*/
|
|
24
|
-
var THROTTLE_CALLS_FOR_MILLISECONDS = DREAM_TARGET_60_FPS * 5;
|
|
25
|
-
var notifyListenersThrottled = throttle(function (_ref) {
|
|
26
|
-
var newEditorState = _ref.newEditorState,
|
|
27
|
-
oldEditorState = _ref.oldEditorState,
|
|
28
|
-
listeners = _ref.listeners,
|
|
18
|
+
var filterPluginsWithListeners = function filterPluginsWithListeners(_ref) {
|
|
19
|
+
var listeners = _ref.listeners,
|
|
29
20
|
plugins = _ref.plugins;
|
|
21
|
+
return Array.from(listeners.keys()).map(function (pluginName) {
|
|
22
|
+
return plugins.get(pluginName);
|
|
23
|
+
}).filter(function (plugin) {
|
|
24
|
+
return plugin !== undefined && hasGetSharedState(plugin);
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
var extractSharedStateFromPlugins = function extractSharedStateFromPlugins(_ref2) {
|
|
28
|
+
var oldEditorState = _ref2.oldEditorState,
|
|
29
|
+
newEditorState = _ref2.newEditorState,
|
|
30
|
+
plugins = _ref2.plugins;
|
|
30
31
|
var isInitialization = !oldEditorState && newEditorState;
|
|
31
|
-
var
|
|
32
|
-
var _iterator = _createForOfIteratorHelper(
|
|
32
|
+
var result = new Map();
|
|
33
|
+
var _iterator = _createForOfIteratorHelper(plugins),
|
|
33
34
|
_step;
|
|
34
35
|
try {
|
|
35
|
-
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return "continue";
|
|
36
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
37
|
+
var _plugin = _step.value;
|
|
38
|
+
if (!_plugin || !hasGetSharedState(_plugin)) {
|
|
39
|
+
continue;
|
|
40
40
|
}
|
|
41
|
-
var nextSharedState =
|
|
42
|
-
var prevSharedState = !isInitialization && oldEditorState ?
|
|
41
|
+
var nextSharedState = _plugin.getSharedState(newEditorState);
|
|
42
|
+
var prevSharedState = !isInitialization && oldEditorState ? _plugin.getSharedState(oldEditorState) : undefined;
|
|
43
43
|
var isSamePluginState = isEqual(prevSharedState, nextSharedState);
|
|
44
44
|
if (isInitialization || !isSamePluginState) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
prevSharedState: prevSharedState
|
|
49
|
-
}));
|
|
45
|
+
result.set(_plugin.name, {
|
|
46
|
+
nextSharedState: nextSharedState,
|
|
47
|
+
prevSharedState: prevSharedState
|
|
50
48
|
});
|
|
51
49
|
}
|
|
52
|
-
};
|
|
53
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
54
|
-
var _ret = _loop();
|
|
55
|
-
if (_ret === "continue") continue;
|
|
56
50
|
}
|
|
57
51
|
} catch (err) {
|
|
58
52
|
_iterator.e(err);
|
|
59
53
|
} finally {
|
|
60
54
|
_iterator.f();
|
|
61
55
|
}
|
|
56
|
+
return result;
|
|
57
|
+
};
|
|
58
|
+
var THROTTLE_CALLS_FOR_MILLISECONDS = 0;
|
|
59
|
+
var notifyListenersThrottled = throttle(function (_ref3) {
|
|
60
|
+
var listeners = _ref3.listeners,
|
|
61
|
+
updatesToNotifyQueue = _ref3.updatesToNotifyQueue;
|
|
62
|
+
var callbacks = [];
|
|
63
|
+
var _iterator2 = _createForOfIteratorHelper(updatesToNotifyQueue.entries()),
|
|
64
|
+
_step2;
|
|
65
|
+
try {
|
|
66
|
+
var _loop = function _loop() {
|
|
67
|
+
var _step2$value = _slicedToArray(_step2.value, 2),
|
|
68
|
+
pluginName = _step2$value[0],
|
|
69
|
+
diffs = _step2$value[1];
|
|
70
|
+
var pluginListeners = listeners.get(pluginName) || [];
|
|
71
|
+
pluginListeners.forEach(function (callback) {
|
|
72
|
+
diffs.forEach(function (diff) {
|
|
73
|
+
callbacks.push(callback.bind(callback, diff));
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
78
|
+
_loop();
|
|
79
|
+
}
|
|
80
|
+
} catch (err) {
|
|
81
|
+
_iterator2.e(err);
|
|
82
|
+
} finally {
|
|
83
|
+
_iterator2.f();
|
|
84
|
+
}
|
|
85
|
+
updatesToNotifyQueue.clear();
|
|
62
86
|
if (callbacks.length === 0) {
|
|
63
87
|
return;
|
|
64
88
|
}
|
|
65
|
-
callbacks.forEach(function (cb) {
|
|
89
|
+
callbacks.reverse().forEach(function (cb) {
|
|
66
90
|
cb();
|
|
67
91
|
});
|
|
68
92
|
}, THROTTLE_CALLS_FOR_MILLISECONDS);
|
|
@@ -90,9 +114,10 @@ var ActionsAPI = /*#__PURE__*/function () {
|
|
|
90
114
|
return ActionsAPI;
|
|
91
115
|
}();
|
|
92
116
|
export var SharedStateAPI = /*#__PURE__*/function () {
|
|
93
|
-
function SharedStateAPI(
|
|
94
|
-
var getEditorState =
|
|
117
|
+
function SharedStateAPI(_ref4) {
|
|
118
|
+
var getEditorState = _ref4.getEditorState;
|
|
95
119
|
_classCallCheck(this, SharedStateAPI);
|
|
120
|
+
_defineProperty(this, "updatesToNotifyQueue", new Map());
|
|
96
121
|
this.getEditorState = getEditorState;
|
|
97
122
|
this.listeners = new Map();
|
|
98
123
|
}
|
|
@@ -113,10 +138,10 @@ export var SharedStateAPI = /*#__PURE__*/function () {
|
|
|
113
138
|
var pluginName = plugin.name;
|
|
114
139
|
return {
|
|
115
140
|
currentState: function currentState() {
|
|
116
|
-
|
|
117
|
-
if (!state || !hasGetSharedState(plugin)) {
|
|
141
|
+
if (!hasGetSharedState(plugin)) {
|
|
118
142
|
return undefined;
|
|
119
143
|
}
|
|
144
|
+
var state = _this.getEditorState();
|
|
120
145
|
return plugin.getSharedState(state);
|
|
121
146
|
},
|
|
122
147
|
onChange: function onChange(sub) {
|
|
@@ -124,41 +149,73 @@ export var SharedStateAPI = /*#__PURE__*/function () {
|
|
|
124
149
|
pluginListeners.add(sub);
|
|
125
150
|
_this.listeners.set(pluginName, pluginListeners);
|
|
126
151
|
return function () {
|
|
127
|
-
|
|
152
|
+
return _this.cleanupSubscription(pluginName, sub);
|
|
128
153
|
};
|
|
129
154
|
}
|
|
130
155
|
};
|
|
131
156
|
}
|
|
157
|
+
}, {
|
|
158
|
+
key: "cleanupSubscription",
|
|
159
|
+
value: function cleanupSubscription(pluginName, sub) {
|
|
160
|
+
(this.listeners.get(pluginName) || new Set()).delete(sub);
|
|
161
|
+
}
|
|
132
162
|
}, {
|
|
133
163
|
key: "notifyListeners",
|
|
134
|
-
value: function notifyListeners(
|
|
135
|
-
var newEditorState =
|
|
136
|
-
oldEditorState =
|
|
137
|
-
plugins =
|
|
138
|
-
var listeners = this.listeners
|
|
139
|
-
|
|
140
|
-
|
|
164
|
+
value: function notifyListeners(_ref5) {
|
|
165
|
+
var newEditorState = _ref5.newEditorState,
|
|
166
|
+
oldEditorState = _ref5.oldEditorState,
|
|
167
|
+
plugins = _ref5.plugins;
|
|
168
|
+
var listeners = this.listeners,
|
|
169
|
+
updatesToNotifyQueue = this.updatesToNotifyQueue;
|
|
170
|
+
var pluginsFiltered = filterPluginsWithListeners({
|
|
171
|
+
plugins: plugins,
|
|
172
|
+
listeners: listeners
|
|
173
|
+
});
|
|
174
|
+
var sharedStateDiffs = extractSharedStateFromPlugins({
|
|
141
175
|
oldEditorState: oldEditorState,
|
|
142
|
-
|
|
143
|
-
plugins:
|
|
176
|
+
newEditorState: newEditorState,
|
|
177
|
+
plugins: pluginsFiltered
|
|
178
|
+
});
|
|
179
|
+
if (sharedStateDiffs.size === 0) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
var _iterator3 = _createForOfIteratorHelper(sharedStateDiffs),
|
|
183
|
+
_step3;
|
|
184
|
+
try {
|
|
185
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
186
|
+
var _step3$value = _slicedToArray(_step3.value, 2),
|
|
187
|
+
pluginName = _step3$value[0],
|
|
188
|
+
nextDiff = _step3$value[1];
|
|
189
|
+
var currentDiffQueue = updatesToNotifyQueue.get(pluginName) || [];
|
|
190
|
+
updatesToNotifyQueue.set(pluginName, [].concat(_toConsumableArray(currentDiffQueue), [nextDiff]));
|
|
191
|
+
}
|
|
192
|
+
} catch (err) {
|
|
193
|
+
_iterator3.e(err);
|
|
194
|
+
} finally {
|
|
195
|
+
_iterator3.f();
|
|
196
|
+
}
|
|
197
|
+
notifyListenersThrottled({
|
|
198
|
+
updatesToNotifyQueue: updatesToNotifyQueue,
|
|
199
|
+
listeners: listeners
|
|
144
200
|
});
|
|
145
201
|
}
|
|
146
202
|
}, {
|
|
147
203
|
key: "destroy",
|
|
148
204
|
value: function destroy() {
|
|
149
205
|
this.listeners.clear();
|
|
206
|
+
this.updatesToNotifyQueue.clear();
|
|
150
207
|
}
|
|
151
208
|
}]);
|
|
152
209
|
return SharedStateAPI;
|
|
153
210
|
}();
|
|
154
211
|
export var EditorPluginInjectionAPI = /*#__PURE__*/function () {
|
|
155
|
-
function EditorPluginInjectionAPI(
|
|
212
|
+
function EditorPluginInjectionAPI(_ref6) {
|
|
156
213
|
var _this2 = this;
|
|
157
|
-
var getEditorState =
|
|
214
|
+
var getEditorState = _ref6.getEditorState;
|
|
158
215
|
_classCallCheck(this, EditorPluginInjectionAPI);
|
|
159
|
-
_defineProperty(this, "onEditorViewUpdated", function (
|
|
160
|
-
var newEditorState =
|
|
161
|
-
oldEditorState =
|
|
216
|
+
_defineProperty(this, "onEditorViewUpdated", function (_ref7) {
|
|
217
|
+
var newEditorState = _ref7.newEditorState,
|
|
218
|
+
oldEditorState = _ref7.oldEditorState;
|
|
162
219
|
_this2.sharedStateAPI.notifyListeners({
|
|
163
220
|
newEditorState: newEditorState,
|
|
164
221
|
oldEditorState: oldEditorState,
|
|
@@ -187,8 +244,13 @@ export var EditorPluginInjectionAPI = /*#__PURE__*/function () {
|
|
|
187
244
|
var sharedStateAPI = this.sharedStateAPI,
|
|
188
245
|
actionsAPI = this.actionsAPI,
|
|
189
246
|
getPluginByName = this.getPluginByName;
|
|
190
|
-
var
|
|
247
|
+
var dependencies = new Proxy({}, {
|
|
191
248
|
get: function get(target, prop, receiver) {
|
|
249
|
+
// If we pass this as a prop React hates us
|
|
250
|
+
// Let's just reflect the result and ignore these
|
|
251
|
+
if (prop === 'toJSON') {
|
|
252
|
+
return Reflect.get(target, prop);
|
|
253
|
+
}
|
|
192
254
|
var plugin = getPluginByName(prop);
|
|
193
255
|
if (!plugin) {
|
|
194
256
|
// eslint-disable-next-line
|
|
@@ -205,7 +267,7 @@ export var EditorPluginInjectionAPI = /*#__PURE__*/function () {
|
|
|
205
267
|
}
|
|
206
268
|
});
|
|
207
269
|
return {
|
|
208
|
-
|
|
270
|
+
dependencies: dependencies
|
|
209
271
|
};
|
|
210
272
|
}
|
|
211
273
|
}]);
|
|
@@ -29,6 +29,8 @@ export var TableSharedCssClassName = {
|
|
|
29
29
|
TABLE_STICKY_WRAPPER: "".concat(tablePrefixSelector, "-sticky-wrapper"),
|
|
30
30
|
TABLE_STICKY_SENTINEL_TOP: "".concat(tablePrefixSelector, "-sticky-sentinel-top"),
|
|
31
31
|
TABLE_STICKY_SENTINEL_BOTTOM: "".concat(tablePrefixSelector, "-sticky-sentinel-bottom"),
|
|
32
|
+
TABLE_SHADOW_SENTINEL_LEFT: "".concat(tablePrefixSelector, "-shadow-sentinel-left"),
|
|
33
|
+
TABLE_SHADOW_SENTINEL_RIGHT: "".concat(tablePrefixSelector, "-shadow-sentinel-right"),
|
|
32
34
|
TABLE_CELL_NODEVIEW_CONTENT_DOM: tableCellContentDomSelector,
|
|
33
35
|
TABLE_CELL_WRAPPER: tableCellSelector,
|
|
34
36
|
TABLE_HEADER_CELL_WRAPPER: tableHeaderSelector,
|
|
@@ -18,7 +18,7 @@ import { themed } from '@atlaskit/theme/components';
|
|
|
18
18
|
import { borderRadius, gridSize } from '@atlaskit/theme/constants';
|
|
19
19
|
import Layer from '../Layer';
|
|
20
20
|
var packageName = "@atlaskit/editor-common";
|
|
21
|
-
var packageVersion = "72.
|
|
21
|
+
var packageVersion = "72.7.1";
|
|
22
22
|
var halfFocusRing = 1;
|
|
23
23
|
var dropOffset = "0, ".concat(gridSize(), "px");
|
|
24
24
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { borderColorPalette as colorPalette } from '@atlaskit/adf-schema';
|
|
2
|
+
import { DEFAULT_BORDER_COLOR } from './common';
|
|
3
|
+
import getColorMessage from './getColorMessage';
|
|
4
|
+
import paletteMessages from './paletteMessages';
|
|
5
|
+
var borderColorPalette = [];
|
|
6
|
+
colorPalette.forEach(function (label, color) {
|
|
7
|
+
var key = label.toLowerCase().replace(' ', '-');
|
|
8
|
+
var message = getColorMessage(paletteMessages, key);
|
|
9
|
+
borderColorPalette.push({
|
|
10
|
+
value: color,
|
|
11
|
+
label: label,
|
|
12
|
+
border: DEFAULT_BORDER_COLOR,
|
|
13
|
+
message: message
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
export default borderColorPalette;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { DEFAULT_BORDER_COLOR } from './common';
|
|
2
|
-
export { textPaletteTooltipMessages, backgroundPaletteTooltipMessages } from './paletteMessagesTokenModeNames';
|
|
2
|
+
export { textPaletteTooltipMessages, backgroundPaletteTooltipMessages, borderPaletteTooltipMessages } from './paletteMessagesTokenModeNames';
|
|
@@ -246,4 +246,26 @@ export var darkBackgroundPaletteTooltipMessages = _objectSpread(_objectSpread({}
|
|
|
246
246
|
export var backgroundPaletteTooltipMessages = {
|
|
247
247
|
light: lightBackgroundPaletteTooltipMessages,
|
|
248
248
|
dark: darkBackgroundPaletteTooltipMessages
|
|
249
|
+
};
|
|
250
|
+
var lightBorderPaletteTooltipMessages = defineMessages({
|
|
251
|
+
'#091E4224': {
|
|
252
|
+
id: 'fabric.theme.subtle-gray',
|
|
253
|
+
defaultMessage: 'Subtle gray',
|
|
254
|
+
description: 'Name of a color'
|
|
255
|
+
},
|
|
256
|
+
'#758195': {
|
|
257
|
+
id: 'fabric.theme.gray',
|
|
258
|
+
defaultMessage: 'Gray',
|
|
259
|
+
description: 'Name of a color'
|
|
260
|
+
},
|
|
261
|
+
'#172B4D': {
|
|
262
|
+
id: 'fabric.theme.bold-gray',
|
|
263
|
+
defaultMessage: 'Bold gray',
|
|
264
|
+
description: 'Name of a color'
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
var darkBorderPaletteTooltipMessages = _objectSpread({}, lightBorderPaletteTooltipMessages);
|
|
268
|
+
export var borderPaletteTooltipMessages = {
|
|
269
|
+
light: lightBorderPaletteTooltipMessages,
|
|
270
|
+
dark: darkBorderPaletteTooltipMessages
|
|
249
271
|
};
|
|
@@ -6,5 +6,6 @@ export { default as colorPaletteMessages } from './ColorPalette/Palettes/palette
|
|
|
6
6
|
export { panelBackgroundPalette, panelDarkModeBackgroundPalette } from './ColorPalette/Palettes/panelBackgroundPalette';
|
|
7
7
|
export { lightModeStatusColorPalette, darkModeStatusColorPalette } from './ColorPalette/Palettes/statusColorPalette';
|
|
8
8
|
export { textColorPalette } from './ColorPalette/Palettes/textColorPalette';
|
|
9
|
-
export { backgroundPaletteTooltipMessages, textPaletteTooltipMessages } from './ColorPalette/Palettes';
|
|
10
|
-
export { DEFAULT_BORDER_COLOR } from './ColorPalette/Palettes/common';
|
|
9
|
+
export { backgroundPaletteTooltipMessages, borderPaletteTooltipMessages, textPaletteTooltipMessages } from './ColorPalette/Palettes';
|
|
10
|
+
export { DEFAULT_BORDER_COLOR } from './ColorPalette/Palettes/common';
|
|
11
|
+
export { default as borderColorPalette } from './ColorPalette/Palettes/borderColorPalette';
|
package/dist/esm/version.json
CHANGED
|
@@ -222,6 +222,7 @@ export declare enum ACTION_SUBJECT_ID {
|
|
|
222
222
|
ANNOTATE_BUTTON = "annotateButton",
|
|
223
223
|
AVATAR_GROUP_PLUGIN = "AvatarGroupInPlugin",
|
|
224
224
|
BLOCK_QUOTE = "blockQuote",
|
|
225
|
+
BORDER = "border",
|
|
225
226
|
BUTTON_CATEGORY = "categoryButton",
|
|
226
227
|
BUTTON_FEEDBACK = "feedbackButton",
|
|
227
228
|
BUTTON_HELP = "helpButton",
|
|
@@ -231,6 +232,8 @@ export declare enum ACTION_SUBJECT_ID {
|
|
|
231
232
|
CARD_INLINE = "inlineCard",
|
|
232
233
|
CELL = "cell",
|
|
233
234
|
CODE_BLOCK = "codeBlock",
|
|
235
|
+
CODEBLOCK_COPY = "codeBlockCopy",
|
|
236
|
+
CODEBLOCK_WRAP = "codeBlockWrap",
|
|
234
237
|
DATE = "date",
|
|
235
238
|
DATE_DAY = "day",
|
|
236
239
|
DATE_MONTH = "month",
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID } from './enums';
|
|
2
2
|
import type { TrackAEP, UIAEP } from './utils';
|
|
3
|
+
declare type MediaBorderActionType = ACTION.UPDATED | ACTION.ADDED | ACTION.DELETED;
|
|
4
|
+
export declare type MediaBorderTrackAction = TrackAEP<MediaBorderActionType, ACTION_SUBJECT.MEDIA, ACTION_SUBJECT_ID.BORDER, any, undefined>;
|
|
3
5
|
declare type MediaLinkActionType = ACTION.ADDED | ACTION.EDITED | ACTION.DELETED | ACTION.VISITED | ACTION.ERRORED;
|
|
4
6
|
export declare type MediaLinkAEP = TrackAEP<MediaLinkActionType, ACTION_SUBJECT.MEDIA, ACTION_SUBJECT_ID.LINK, any, undefined>;
|
|
5
7
|
declare type MediaCaptionActionType = ACTION.DELETED | ACTION.EDITED | ACTION.ADDED;
|
|
@@ -12,5 +14,5 @@ declare type ChangeMediaAEP = TrackAEP<ACTION.CHANGED_TYPE, ACTION_SUBJECT.MEDIA
|
|
|
12
14
|
previousType: MediaSwitchType;
|
|
13
15
|
}, undefined>;
|
|
14
16
|
export declare type MediaAltTextActionType = ACTION.ADDED | ACTION.CLOSED | ACTION.EDITED | ACTION.CLEARED | ACTION.OPENED;
|
|
15
|
-
export declare type MediaEventPayload = MediaLinkAEP | MediaAltTextAction | MediaUIAction | CaptionTrackAction | ChangeMediaAEP;
|
|
17
|
+
export declare type MediaEventPayload = MediaLinkAEP | MediaAltTextAction | MediaUIAction | MediaBorderTrackAction | CaptionTrackAction | ChangeMediaAEP;
|
|
16
18
|
export {};
|
|
@@ -39,6 +39,9 @@ export interface CollabEventPresenceData {
|
|
|
39
39
|
sessionId: string;
|
|
40
40
|
}[];
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated use CollabTelepointerPayload from "@atlaskit/collab-provider"
|
|
44
|
+
*/
|
|
42
45
|
export interface CollabEventTelepointerData {
|
|
43
46
|
type: 'telepointer';
|
|
44
47
|
selection: CollabSendableSelection;
|
|
@@ -47,12 +50,21 @@ export interface CollabEventTelepointerData {
|
|
|
47
50
|
export interface CollabEventLocalStepData {
|
|
48
51
|
steps: Array<Step>;
|
|
49
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* @deprecated use CollabSendableSelection from "@atlaskit/collab-provider"
|
|
55
|
+
*/
|
|
50
56
|
export interface CollabSendableSelection {
|
|
51
57
|
type: 'textSelection' | 'nodeSelection';
|
|
52
58
|
anchor: number;
|
|
53
59
|
head: number;
|
|
54
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated use keyof CollabEvents from "@atlaskit/collab-provider"
|
|
63
|
+
*/
|
|
55
64
|
export declare type CollabEvent = keyof CollabEventData;
|
|
65
|
+
/**
|
|
66
|
+
* @deprecated use CollabEvents from "@atlaskit/collab-provider"
|
|
67
|
+
*/
|
|
56
68
|
export interface CollabEventData {
|
|
57
69
|
init: CollabEventInitData;
|
|
58
70
|
connected: CollabEventConnectionData;
|
|
@@ -70,6 +82,9 @@ export declare type ResolvedEditorState<T = any> = {
|
|
|
70
82
|
title: string | null;
|
|
71
83
|
stepVersion: number;
|
|
72
84
|
};
|
|
85
|
+
/**
|
|
86
|
+
* @deprecated use CollabEditProvider from "@atlaskit/collab-provider"
|
|
87
|
+
*/
|
|
73
88
|
export interface CollabEditProvider<Events extends CollabEventData = CollabEventData> {
|
|
74
89
|
initialize(getState: () => any, createStep: (json: object) => Step): this;
|
|
75
90
|
setup(props: {
|
package/dist/types/collab.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { CollabEditProvider, CollabEventPresenceData, CollabEvent, CollabEventConnectionData, CollabEventData, CollabEventInitData, CollabEventRemoteData, CollabEventTelepointerData, CollabParticipant, CollabSendableSelection, CollabEventLocalStepData, ResolvedEditorState, CollabEventConnectingData, } from './collab/types';
|
|
1
|
+
export type { CollabEditProvider, CollabEventPresenceData, CollabEvent, CollabEventConnectionData, CollabEventDisconnectedData, CollabEventData, CollabEventInitData, CollabEventRemoteData, CollabEventTelepointerData, CollabParticipant, CollabSendableSelection, CollabEventLocalStepData, ResolvedEditorState, CollabEventConnectingData, } from './collab/types';
|
|
@@ -22,7 +22,7 @@ export declare type ExtensionAPI<T extends Parameters = Parameters> = {
|
|
|
22
22
|
allowSelectionToNewNode?: boolean;
|
|
23
23
|
}) => void;
|
|
24
24
|
scrollTo: (localId: string) => void;
|
|
25
|
-
update: (localId: string, mutationCallback: (currentValue: Pick<ADFEntity, 'attrs' | 'marks'>) => Pick<ADFEntity, 'attrs' | 'marks'>) => void;
|
|
25
|
+
update: (localId: string, mutationCallback: (currentValue: Pick<ADFEntity, 'content' | 'attrs' | 'marks'>) => Pick<ADFEntity, 'content' | 'attrs' | 'marks'>) => void;
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
28
|
export declare type UpdateExtension<T extends Parameters = Parameters> = (extensionParameters: T, actions?: ExtensionAPI<T>) => Promise<T | void>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ExtractPluginSharedState, NextEditorPluginMetadata, PluginDependenciesAPI, PluginInjectionAPI } from '../types/next-editor-plugin';
|
|
2
|
+
declare type NamedPluginStatesFromInjectionAPI<API extends PluginInjectionAPI<any, any> | undefined, PluginList extends string[]> = Readonly<{
|
|
3
|
+
[K in PluginList[number] as `${K}State`]: API extends PluginInjectionAPI<any, any> ? API['dependencies'][K] extends PluginDependenciesAPI<infer Plugin> | undefined ? ExtractPluginSharedState<Plugin> | undefined : never : never;
|
|
4
|
+
}>;
|
|
5
|
+
declare type ExtractPluginNames<Name extends string, Metadata extends NextEditorPluginMetadata> = keyof PluginInjectionAPI<Name, Metadata>['dependencies'];
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* Used to return the current plugin state of
|
|
9
|
+
* input dependencies
|
|
10
|
+
*
|
|
11
|
+
* Example in plugin:
|
|
12
|
+
*
|
|
13
|
+
* ```typescript
|
|
14
|
+
* function ExampleContent({ api }: Props) {
|
|
15
|
+
* const { dogState, exampleState } = useSharedPluginState(
|
|
16
|
+
* api,
|
|
17
|
+
* ['dog', 'example']
|
|
18
|
+
* )
|
|
19
|
+
* return <p>{ dogState.title } { exampleState.description }</p>
|
|
20
|
+
* }
|
|
21
|
+
*
|
|
22
|
+
* const examplePlugin: NextEditorPlugin<'example', { dependencies: [typeof pluginDog] }> = (_, api) => {
|
|
23
|
+
* return {
|
|
24
|
+
* name: 'example',
|
|
25
|
+
* contentComponent: () =>
|
|
26
|
+
* <ExampleContent
|
|
27
|
+
* api={api}
|
|
28
|
+
* />
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @param injectionApi Plugin injection API from `NextEditorPlugin`
|
|
34
|
+
* @param plugins Plugin names to get the shared plugin state for
|
|
35
|
+
* @returns A corresponding object, the keys are names of the plugin with `State` appended,
|
|
36
|
+
* the values are the shared state exposed by that plugin.
|
|
37
|
+
*/
|
|
38
|
+
export declare function useSharedPluginState<Name extends string, Metadata extends NextEditorPluginMetadata, PluginNames extends ExtractPluginNames<Name, Metadata>[]>(injectionApi: PluginInjectionAPI<Name, Metadata> | undefined, plugins: PluginNames): NamedPluginStatesFromInjectionAPI<typeof injectionApi, PluginNames>;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const codeBlockButtonMessages: {
|
|
2
|
+
copyCodeToClipboard: {
|
|
3
|
+
id: string;
|
|
4
|
+
defaultMessage: string;
|
|
5
|
+
description: string;
|
|
6
|
+
};
|
|
7
|
+
copiedCodeToClipboard: {
|
|
8
|
+
id: string;
|
|
9
|
+
defaultMessage: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
wrapCode: {
|
|
13
|
+
id: string;
|
|
14
|
+
defaultMessage: string;
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
unwrapCode: {
|
|
18
|
+
id: string;
|
|
19
|
+
defaultMessage: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { codeBidiWarningMessages } from './codeBidiWarning';
|
|
2
2
|
export { linkMessages } from './link';
|
|
3
3
|
export { unsupportedContentMessages } from './unsupportedContent';
|
|
4
|
-
export {
|
|
4
|
+
export { codeBlockButtonMessages } from './codeBlockButton';
|
|
5
5
|
export { toolbarInsertBlockMessages } from './insert-block';
|
|
6
6
|
declare const _default: {
|
|
7
7
|
layoutFixedWidth: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FeatureFlags } from './types/feature-flags';
|
|
1
2
|
declare type BooleanFlags = Record<string, boolean>;
|
|
2
3
|
declare type NormalizedFeatureFlags<ObjectFlags> = Partial<ObjectFlags & BooleanFlags>;
|
|
3
4
|
/**
|
|
@@ -17,4 +18,10 @@ declare type NormalizedFeatureFlags<ObjectFlags> = Partial<ObjectFlags & Boolean
|
|
|
17
18
|
export declare function normalizeFeatureFlags<ObjectFlags>(rawFeatureFlags?: Record<string, unknown>, options?: {
|
|
18
19
|
objectFlagKeys: string[];
|
|
19
20
|
}): NormalizedFeatureFlags<ObjectFlags>;
|
|
21
|
+
/**
|
|
22
|
+
* Transforms FeatureFlags to a type safe string array of the enabled feature flags.
|
|
23
|
+
*
|
|
24
|
+
* Useful for analytics and analysis purposes.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getEnabledFeatureFlagKeys(featureFlags: FeatureFlags): (keyof FeatureFlags)[];
|
|
20
27
|
export {};
|
|
@@ -15,6 +15,8 @@ export declare class SharedStateAPI {
|
|
|
15
15
|
private listeners;
|
|
16
16
|
constructor({ getEditorState }: SharedStateAPIProps);
|
|
17
17
|
createAPI(plugin: NextEditorPluginInitializedType | undefined): PluginDependenciesAPI<NextEditorPlugin<any, any>>['sharedState'];
|
|
18
|
+
private cleanupSubscription;
|
|
19
|
+
private updatesToNotifyQueue;
|
|
18
20
|
notifyListeners({ newEditorState, oldEditorState, plugins, }: EditorStateDiff & Record<'plugins', Map<string, NextEditorPluginInitializedType>>): void;
|
|
19
21
|
destroy(): void;
|
|
20
22
|
}
|
|
@@ -33,7 +35,7 @@ export declare class EditorPluginInjectionAPI implements PluginInjectionAPIDefin
|
|
|
33
35
|
private plugins;
|
|
34
36
|
constructor({ getEditorState }: SharedStateAPIProps);
|
|
35
37
|
api<T extends NextEditorPlugin<any, any>>(): {
|
|
36
|
-
|
|
38
|
+
dependencies: import("../types/next-editor-plugin").CreatePluginDependenciesAPI<[NextEditorPlugin<T extends (config?: any, api?: PluginInjectionAPI<infer Name, any> | undefined) => DefaultEditorPlugin<infer Name, any> ? Name : never, T extends NextEditorPlugin<any, infer Metadata> ? Metadata : never>, ..."dependencies" extends keyof (T extends NextEditorPlugin<any, infer Metadata> ? Metadata : never) ? (T extends NextEditorPlugin<any, infer Metadata> ? Metadata : never)["dependencies"] extends (((config?: any, api?: PluginInjectionAPI<any, any> | undefined) => DefaultEditorPlugin<any, any>) | import("../types/next-editor-plugin").OptionalPlugin<(config?: any, api?: PluginInjectionAPI<any, any> | undefined) => DefaultEditorPlugin<any, any>>)[] ? Exclude<(T extends NextEditorPlugin<any, infer Metadata> ? Metadata : never)["dependencies"], undefined> : [] : []]>;
|
|
37
39
|
};
|
|
38
40
|
onEditorViewUpdated: ({ newEditorState, oldEditorState, }: EditorStateDiff) => void;
|
|
39
41
|
onEditorPluginInitialized: (plugin: NextEditorPluginInitializedType) => void;
|
|
@@ -18,6 +18,8 @@ export declare const TableSharedCssClassName: {
|
|
|
18
18
|
TABLE_STICKY_WRAPPER: string;
|
|
19
19
|
TABLE_STICKY_SENTINEL_TOP: string;
|
|
20
20
|
TABLE_STICKY_SENTINEL_BOTTOM: string;
|
|
21
|
+
TABLE_SHADOW_SENTINEL_LEFT: string;
|
|
22
|
+
TABLE_SHADOW_SENTINEL_RIGHT: string;
|
|
21
23
|
TABLE_CELL_NODEVIEW_CONTENT_DOM: string;
|
|
22
24
|
TABLE_CELL_WRAPPER: string;
|
|
23
25
|
TABLE_HEADER_CELL_WRAPPER: string;
|
|
@@ -411,6 +411,15 @@ export declare type FeatureFlags = {
|
|
|
411
411
|
* @default false
|
|
412
412
|
*/
|
|
413
413
|
expandedChartColors?: boolean | undefined;
|
|
414
|
+
/**
|
|
415
|
+
* @description
|
|
416
|
+
* Fix the styling of tables when a fragment mark is applied and it is broken out
|
|
417
|
+
*
|
|
418
|
+
* @see https://product-fabric.atlassian.net/wiki/spaces/EM/pages/3158246501/PP+Link+Picker+-+Standalone
|
|
419
|
+
* @see https://product-fabric.atlassian.net/browse/EDM-2577
|
|
420
|
+
* @default false
|
|
421
|
+
*/
|
|
422
|
+
useFragmentMarkBreakoutWidthStylingFix?: boolean;
|
|
414
423
|
};
|
|
415
424
|
export declare type FeatureFlagKey = keyof FeatureFlags;
|
|
416
425
|
export declare type GetEditorFeatureFlags = () => FeatureFlags;
|
|
@@ -74,6 +74,11 @@ export interface ConfirmDialogOptions {
|
|
|
74
74
|
}
|
|
75
75
|
export declare type ConfirmationDialogProps = {
|
|
76
76
|
onConfirm: (isCheck?: boolean) => void;
|
|
77
|
+
/**
|
|
78
|
+
* onClose is called every time when the dialog is closed.
|
|
79
|
+
* Either clicking on 'Confirm' button or 'Cancel' button,
|
|
80
|
+
* which means it is being called after onConfirm, or by itself when clicking 'Cancel' button.
|
|
81
|
+
*/
|
|
77
82
|
onClose: () => void;
|
|
78
83
|
options?: ConfirmDialogOptions;
|
|
79
84
|
testId?: string;
|
|
@@ -29,7 +29,7 @@ export type { EditorReactContext } from './editor-react-context';
|
|
|
29
29
|
export type { PMPluginFactoryParams, PMPluginFactory, PMPlugin, } from './plugin-factory';
|
|
30
30
|
export type { NodeConfig, MarkConfig, NodeViewConfig, } from './prosemirror-config';
|
|
31
31
|
export type { PluginsOptions, EditorPlugin, getPosHandler, getPosHandlerNode, } from './editor-plugin';
|
|
32
|
-
export type { NextEditorPlugin, AllEditorPresetPluginTypes, PluginDependenciesAPI, ExtractPluginNameFromAllBuilderPlugins, SafePresetCheck, DefaultEditorPlugin, OptionalPlugin, PluginInjectionAPI, CreatePluginDependenciesAPI, NextEditorPluginMetadata, } from './next-editor-plugin';
|
|
32
|
+
export type { NextEditorPlugin, AllEditorPresetPluginTypes, PluginDependenciesAPI, ExtractPluginNameFromAllBuilderPlugins, SafePresetCheck, DefaultEditorPlugin, OptionalPlugin, PluginInjectionAPI, CreatePluginDependenciesAPI, NextEditorPluginMetadata, ExtractInjectionAPI, } from './next-editor-plugin';
|
|
33
33
|
export declare type IconProps = {
|
|
34
34
|
label?: string;
|
|
35
35
|
};
|