@atlaskit/editor-core
Version:
A package contains Atlassian editor core functionality
37 lines • 1.38 kB
JavaScript
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
import _regeneratorRuntime from "@babel/runtime/regenerator";
// Please, do not copy or use this kind of code below
// @ts-ignore
var mediaPluginKey = {
key: 'mediaPlugin$',
getState: function getState(state) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return state['mediaPlugin$'];
}
};
export function getEditorValueWithMedia(_x) {
return _getEditorValueWithMedia.apply(this, arguments);
}
function _getEditorValueWithMedia() {
_getEditorValueWithMedia = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(editorView) {
var mediaPluginState;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
mediaPluginState = editorView.state && mediaPluginKey.getState(editorView.state);
if (!(mediaPluginState && mediaPluginState.waitForMediaUpload)) {
_context.next = 4;
break;
}
_context.next = 4;
return mediaPluginState.waitForPendingTasks();
case 4:
return _context.abrupt("return", editorView.state.doc);
case 5:
case "end":
return _context.stop();
}
}, _callee);
}));
return _getEditorValueWithMedia.apply(this, arguments);
}