@atlaskit/editor-plugin-synced-block
Version:
SyncedBlock plugin for @atlaskit/editor-core
51 lines • 2.43 kB
JavaScript
/* quick-insert.tsx generated by @compiled/babel-plugin v2.0.0 */
import "./quick-insert.compiled.css";
import * as React from 'react';
import { ax, ix } from "@compiled/react/runtime";
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
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 { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
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 [];
}
const syncBlockTitle = expValEquals('platform_editor_sync_block_activation', 'isEnabled', true) ? blockTypeMessages.syncedBlockQuickInsertTitle : blockTypeMessages.syncBlock;
return [{
id: 'syncBlock',
title: formatMessage(syncBlockTitle),
description: formatMessage(blockTypeMessages.syncedBlockDescription),
priority: 400,
keywords: ['synced', 'block', 'synced-block', 'sync', 'sync-block', 'auto', 'update', 'excerpt', 'connect', 'create'],
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(syncBlockTitle)
}),
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,
inputMethod: INPUT_METHOD.QUICK_INSERT
});
},
testId: SYNCED_BLOCK_BUTTON_TEST_ID.quickInsertCreate
}];
};
};