@atlaskit/editor-plugin-synced-block
Version:
SyncedBlock plugin for @atlaskit/editor-core
47 lines • 2.08 kB
JavaScript
/* quick-insert.tsx generated by @compiled/babel-plugin v0.39.1 */
import "./quick-insert.compiled.css";
import * as React from 'react';
import { ax, ix } from "@compiled/react/runtime";
import { blockTypeMessages } from '@atlaskit/editor-common/messages';
import { IconSyncBlock } from '@atlaskit/editor-common/quick-insert';
import Lozenge from '@atlaskit/lozenge';
import { fg } from '@atlaskit/platform-feature-flags';
import { createSyncedBlock } from '../editor-commands';
import { SYNCED_BLOCK_BUTTON_TEST_ID } from '../types';
const lozengeWrapperStyles = null;
export const getQuickInsertConfig = (config, api, syncBlockStore) => {
return ({
formatMessage
}) => {
if (!(config !== null && config !== void 0 && config.enableSourceCreation)) {
return [];
}
return [{
id: 'syncBlock',
title: formatMessage(blockTypeMessages.syncedBlock),
description: formatMessage(blockTypeMessages.syncedBlockDescription),
priority: 800,
keywords: ['synced', 'block', 'synced-block', 'sync', 'sync-block', 'auto', 'update', 'excerpt', 'connect'],
isDisabledOffline: true,
keyshortcut: '',
lozenge: /*#__PURE__*/React.createElement("span", {
className: ax(["_1o9zidpf _16jlidpf _1e0c116y"])
}, /*#__PURE__*/React.createElement(Lozenge, {
appearance: fg('confluence_fronend_labels_categorization_migration') ? 'discovery' : 'new'
}, formatMessage(blockTypeMessages.newLozenge))),
icon: () => /*#__PURE__*/React.createElement(IconSyncBlock, {
label: formatMessage(blockTypeMessages.syncedBlock)
}),
action: (insert, state) => {
var _api$analytics;
return createSyncedBlock({
tr: state.tr,
syncBlockStore,
typeAheadInsert: insert,
fireAnalyticsEvent: api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.fireAnalyticsEvent
});
},
testId: SYNCED_BLOCK_BUTTON_TEST_ID.quickInsertCreate
}];
};
};