@atlaskit/editor-core
Version:
A package contains Atlassian editor core functionality
44 lines (43 loc) • 1.66 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getEditorValueWithMedia = getEditorValueWithMedia;
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
// 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$'];
}
};
function getEditorValueWithMedia(_x) {
return _getEditorValueWithMedia.apply(this, arguments);
}
function _getEditorValueWithMedia() {
_getEditorValueWithMedia = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(editorView) {
var mediaPluginState;
return _regenerator.default.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);
}