@contentful/field-editor-rich-text 3.4.5 → 3.4.7
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.
- package/CHANGELOG.md +10 -0
- package/dist/field-editor-rich-text.cjs.development.js +33 -6
- package/dist/field-editor-rich-text.cjs.development.js.map +1 -1
- package/dist/field-editor-rich-text.cjs.production.min.js +1 -1
- package/dist/field-editor-rich-text.cjs.production.min.js.map +1 -1
- package/dist/field-editor-rich-text.esm.js +33 -6
- package/dist/field-editor-rich-text.esm.js.map +1 -1
- package/dist/plugins/CommandPalette/useCommands.d.ts +5 -0
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.4.7](https://github.com/contentful/field-editors/compare/@contentful/field-editor-rich-text@3.4.6...@contentful/field-editor-rich-text@3.4.7) (2023-02-21)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @contentful/field-editor-rich-text
|
|
9
|
+
|
|
10
|
+
## [3.4.6](https://github.com/contentful/field-editors/compare/@contentful/field-editor-rich-text@3.4.5...@contentful/field-editor-rich-text@3.4.6) (2023-02-13)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **rte:** [TOL-960] conditional command palette plugin enablement ([#1342](https://github.com/contentful/field-editors/issues/1342)) ([0dfcf99](https://github.com/contentful/field-editors/commit/0dfcf9925af44bd045c3a0eb869ec9db787afa4a))
|
|
15
|
+
|
|
6
16
|
## [3.4.5](https://github.com/contentful/field-editors/compare/@contentful/field-editor-rich-text@3.4.4...@contentful/field-editor-rich-text@3.4.5) (2023-02-07)
|
|
7
17
|
|
|
8
18
|
### Bug Fixes
|
|
@@ -1920,12 +1920,39 @@ var removeQuery = function removeQuery(editor) {
|
|
|
1920
1920
|
}
|
|
1921
1921
|
};
|
|
1922
1922
|
|
|
1923
|
+
function isCommandPromptPluginEnabled(sdk) {
|
|
1924
|
+
var inlineAllowed = isNodeTypeEnabled(sdk.field, Contentful.INLINES.EMBEDDED_ENTRY);
|
|
1925
|
+
var entriesAllowed = isNodeTypeEnabled(sdk.field, Contentful.BLOCKS.EMBEDDED_ENTRY);
|
|
1926
|
+
var assetsAllowed = isNodeTypeEnabled(sdk.field, Contentful.BLOCKS.EMBEDDED_ASSET);
|
|
1927
|
+
return {
|
|
1928
|
+
inlineAllowed: inlineAllowed,
|
|
1929
|
+
entriesAllowed: entriesAllowed,
|
|
1930
|
+
assetsAllowed: assetsAllowed
|
|
1931
|
+
};
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
function getCommandPermissions(sdk, editor) {
|
|
1935
|
+
var canInsertBlocks = !isNodeTypeSelected(editor, Contentful.BLOCKS.TABLE);
|
|
1936
|
+
|
|
1937
|
+
var _isCommandPromptPlugi = isCommandPromptPluginEnabled(sdk),
|
|
1938
|
+
inlineAllowed = _isCommandPromptPlugi.inlineAllowed,
|
|
1939
|
+
entriesAllowed = _isCommandPromptPlugi.entriesAllowed,
|
|
1940
|
+
assetsAllowed = _isCommandPromptPlugi.assetsAllowed;
|
|
1941
|
+
|
|
1942
|
+
return {
|
|
1943
|
+
inlineAllowed: inlineAllowed,
|
|
1944
|
+
entriesAllowed: entriesAllowed && canInsertBlocks,
|
|
1945
|
+
assetsAllowed: assetsAllowed && canInsertBlocks
|
|
1946
|
+
};
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1923
1949
|
var useCommands = function useCommands(sdk, query, editor) {
|
|
1924
1950
|
var contentTypes = sdk.space.getCachedContentTypes();
|
|
1925
|
-
|
|
1926
|
-
var
|
|
1927
|
-
|
|
1928
|
-
|
|
1951
|
+
|
|
1952
|
+
var _getCommandPermission = getCommandPermissions(sdk, editor),
|
|
1953
|
+
inlineAllowed = _getCommandPermission.inlineAllowed,
|
|
1954
|
+
entriesAllowed = _getCommandPermission.entriesAllowed,
|
|
1955
|
+
assetsAllowed = _getCommandPermission.assetsAllowed;
|
|
1929
1956
|
|
|
1930
1957
|
var _useState = React.useState(function () {
|
|
1931
1958
|
var getEmbedEntry = function getEmbedEntry(contentType) {
|
|
@@ -7514,14 +7541,14 @@ var getPlugins = function getPlugins(sdk, onAction, restrictedMarks) {
|
|
|
7514
7541
|
return [// AST must come after the HTML deserializer
|
|
7515
7542
|
p.createDeserializeHtmlPlugin(), p.createDeserializeAstPlugin(), plateSerializerDocx.createDeserializeDocxPlugin(), // Tracking - This should come first so all plugins below will have access to `editor.tracking`
|
|
7516
7543
|
createTrackingPlugin(onAction), // Global / Global shortcuts
|
|
7517
|
-
createDragAndDropPlugin()
|
|
7544
|
+
createDragAndDropPlugin()].concat(Object.values(isCommandPromptPluginEnabled(sdk)).some(Boolean) ? [createCommandPalettePlugin()] : [], [// Block Elements
|
|
7518
7545
|
createParagraphPlugin(), createListPlugin(), createHrPlugin(), createHeadingPlugin(), createQuotePlugin(), createTablePlugin(), createEmbeddedEntryBlockPlugin(sdk), createEmbeddedAssetBlockPlugin(sdk), // Inline elements
|
|
7519
7546
|
createHyperlinkPlugin(sdk), createEmbeddedEntityInlinePlugin(sdk), // Marks
|
|
7520
7547
|
createMarksPlugin(), // Other
|
|
7521
7548
|
createTrailingParagraphPlugin(), createTextPlugin(restrictedMarks), createVoidsPlugin(), createSelectOnBackspacePlugin(), // Pasting content from other sources
|
|
7522
7549
|
createPasteHTMLPlugin(), // These plugins drive their configurations from the list of plugins
|
|
7523
7550
|
// above. They MUST come last.
|
|
7524
|
-
createSoftBreakPlugin(), createExitBreakPlugin(), createResetNodePlugin(), createNormalizerPlugin()];
|
|
7551
|
+
createSoftBreakPlugin(), createExitBreakPlugin(), createResetNodePlugin(), createNormalizerPlugin()]);
|
|
7525
7552
|
};
|
|
7526
7553
|
var disableCorePlugins = {
|
|
7527
7554
|
// Temporarily until the upstream issue is fixed.
|