@contentful/field-editor-rich-text 3.4.5 → 3.4.6

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.
@@ -1913,12 +1913,39 @@ var removeQuery = function removeQuery(editor) {
1913
1913
  }
1914
1914
  };
1915
1915
 
1916
+ function isCommandPromptPluginEnabled(sdk) {
1917
+ var inlineAllowed = isNodeTypeEnabled(sdk.field, INLINES.EMBEDDED_ENTRY);
1918
+ var entriesAllowed = isNodeTypeEnabled(sdk.field, BLOCKS.EMBEDDED_ENTRY);
1919
+ var assetsAllowed = isNodeTypeEnabled(sdk.field, BLOCKS.EMBEDDED_ASSET);
1920
+ return {
1921
+ inlineAllowed: inlineAllowed,
1922
+ entriesAllowed: entriesAllowed,
1923
+ assetsAllowed: assetsAllowed
1924
+ };
1925
+ }
1926
+
1927
+ function getCommandPermissions(sdk, editor) {
1928
+ var canInsertBlocks = !isNodeTypeSelected(editor, BLOCKS.TABLE);
1929
+
1930
+ var _isCommandPromptPlugi = isCommandPromptPluginEnabled(sdk),
1931
+ inlineAllowed = _isCommandPromptPlugi.inlineAllowed,
1932
+ entriesAllowed = _isCommandPromptPlugi.entriesAllowed,
1933
+ assetsAllowed = _isCommandPromptPlugi.assetsAllowed;
1934
+
1935
+ return {
1936
+ inlineAllowed: inlineAllowed,
1937
+ entriesAllowed: entriesAllowed && canInsertBlocks,
1938
+ assetsAllowed: assetsAllowed && canInsertBlocks
1939
+ };
1940
+ }
1941
+
1916
1942
  var useCommands = function useCommands(sdk, query, editor) {
1917
1943
  var contentTypes = sdk.space.getCachedContentTypes();
1918
- var canInsertBlocks = !isNodeTypeSelected(editor, BLOCKS.TABLE);
1919
- var inlineAllowed = isNodeTypeEnabled(sdk.field, INLINES.EMBEDDED_ENTRY);
1920
- var entriesAllowed = isNodeTypeEnabled(sdk.field, BLOCKS.EMBEDDED_ENTRY) && canInsertBlocks;
1921
- var assetsAllowed = isNodeTypeEnabled(sdk.field, BLOCKS.EMBEDDED_ASSET) && canInsertBlocks;
1944
+
1945
+ var _getCommandPermission = getCommandPermissions(sdk, editor),
1946
+ inlineAllowed = _getCommandPermission.inlineAllowed,
1947
+ entriesAllowed = _getCommandPermission.entriesAllowed,
1948
+ assetsAllowed = _getCommandPermission.assetsAllowed;
1922
1949
 
1923
1950
  var _useState = useState(function () {
1924
1951
  var getEmbedEntry = function getEmbedEntry(contentType) {
@@ -7507,14 +7534,14 @@ var getPlugins = function getPlugins(sdk, onAction, restrictedMarks) {
7507
7534
  return [// AST must come after the HTML deserializer
7508
7535
  createDeserializeHtmlPlugin(), createDeserializeAstPlugin(), createDeserializeDocxPlugin(), // Tracking - This should come first so all plugins below will have access to `editor.tracking`
7509
7536
  createTrackingPlugin(onAction), // Global / Global shortcuts
7510
- createDragAndDropPlugin(), createCommandPalettePlugin(), // Block Elements
7537
+ createDragAndDropPlugin()].concat(Object.values(isCommandPromptPluginEnabled(sdk)).some(Boolean) ? [createCommandPalettePlugin()] : [], [// Block Elements
7511
7538
  createParagraphPlugin(), createListPlugin(), createHrPlugin(), createHeadingPlugin(), createQuotePlugin(), createTablePlugin(), createEmbeddedEntryBlockPlugin(sdk), createEmbeddedAssetBlockPlugin(sdk), // Inline elements
7512
7539
  createHyperlinkPlugin(sdk), createEmbeddedEntityInlinePlugin(sdk), // Marks
7513
7540
  createMarksPlugin(), // Other
7514
7541
  createTrailingParagraphPlugin(), createTextPlugin(restrictedMarks), createVoidsPlugin(), createSelectOnBackspacePlugin(), // Pasting content from other sources
7515
7542
  createPasteHTMLPlugin(), // These plugins drive their configurations from the list of plugins
7516
7543
  // above. They MUST come last.
7517
- createSoftBreakPlugin(), createExitBreakPlugin(), createResetNodePlugin(), createNormalizerPlugin()];
7544
+ createSoftBreakPlugin(), createExitBreakPlugin(), createResetNodePlugin(), createNormalizerPlugin()]);
7518
7545
  };
7519
7546
  var disableCorePlugins = {
7520
7547
  // Temporarily until the upstream issue is fixed.