@contentful/field-editor-rich-text 3.19.4 → 3.19.5

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.
@@ -21,6 +21,9 @@ _export(exports, {
21
21
  locales: function() {
22
22
  return _locale;
23
23
  },
24
+ resources: function() {
25
+ return _resources;
26
+ },
24
27
  spaces: function() {
25
28
  return _space;
26
29
  }
@@ -29,6 +32,7 @@ const _asset = _interop_require_wildcard(require("./asset"));
29
32
  const _contenttype = _interop_require_wildcard(require("./content-type"));
30
33
  const _entry = _interop_require_wildcard(require("./entry"));
31
34
  const _locale = _interop_require_wildcard(require("./locale"));
35
+ const _resources = _interop_require_wildcard(require("./resources"));
32
36
  const _space = _interop_require_wildcard(require("./space"));
33
37
  function _getRequireWildcardCache(nodeInterop) {
34
38
  if (typeof WeakMap !== "function") return null;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "published", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return published;
9
+ }
10
+ });
11
+ const _entry = require("../entry");
12
+ const _space = require("../space");
13
+ const published = {
14
+ sys: {
15
+ urn: `crn:contentful:::content:spaces/${_space.indifferent.sys.id}/entries/${_entry.published.sys.id}`,
16
+ type: 'ResourceLink',
17
+ linkType: 'Contentful:Entry'
18
+ }
19
+ };
@@ -153,10 +153,12 @@ function ToolbarHeadingButton(props) {
153
153
  editor.onChange = prevOnChange;
154
154
  prevOnChange(...args);
155
155
  };
156
- const isActive = (0, _editor.isBlockSelected)(editor, type);
157
- editor.tracking.onToolbarAction(isActive ? 'remove' : 'insert', {
158
- nodeType: type
159
- });
156
+ if (type !== _richtexttypes.BLOCKS.PARAGRAPH) {
157
+ const isActive = (0, _editor.isBlockSelected)(editor, type);
158
+ editor.tracking.onToolbarAction(isActive ? 'remove' : 'insert', {
159
+ nodeType: type
160
+ });
161
+ }
160
162
  (0, _editor.toggleElement)(editor, {
161
163
  activeType: type,
162
164
  inactiveType: type
@@ -22,10 +22,12 @@ function _interop_require_default(obj) {
22
22
  }
23
23
  const buildHeadingEventHandler = (type)=>(editor, { options: { hotkey } })=>(event)=>{
24
24
  if (editor.selection && hotkey && (0, _ishotkey.default)(hotkey, event)) {
25
- const isActive = (0, _editor.isBlockSelected)(editor, type);
26
- editor.tracking.onShortcutAction(isActive ? 'remove' : 'insert', {
27
- nodeType: type
28
- });
25
+ if (type !== _richtexttypes.BLOCKS.PARAGRAPH) {
26
+ const isActive = (0, _editor.isBlockSelected)(editor, type);
27
+ editor.tracking.onShortcutAction(isActive ? 'remove' : 'insert', {
28
+ nodeType: type
29
+ });
30
+ }
29
31
  (0, _editor.toggleElement)(editor, {
30
32
  activeType: type,
31
33
  inactiveType: _richtexttypes.BLOCKS.PARAGRAPH
@@ -2,5 +2,6 @@ import * as assets from './asset';
2
2
  import * as contentTypes from './content-type';
3
3
  import * as entries from './entry';
4
4
  import * as locales from './locale';
5
+ import * as resources from './resources';
5
6
  import * as spaces from './space';
6
- export { assets, contentTypes, entries, locales, spaces };
7
+ export { assets, contentTypes, entries, locales, resources, spaces };
@@ -0,0 +1,9 @@
1
+ import { published as published_entry } from '../entry';
2
+ import { indifferent } from '../space';
3
+ export const published = {
4
+ sys: {
5
+ urn: `crn:contentful:::content:spaces/${indifferent.sys.id}/entries/${published_entry.sys.id}`,
6
+ type: 'ResourceLink',
7
+ linkType: 'Contentful:Entry'
8
+ }
9
+ };
@@ -97,10 +97,12 @@ export function ToolbarHeadingButton(props) {
97
97
  editor.onChange = prevOnChange;
98
98
  prevOnChange(...args);
99
99
  };
100
- const isActive = isBlockSelected(editor, type);
101
- editor.tracking.onToolbarAction(isActive ? 'remove' : 'insert', {
102
- nodeType: type
103
- });
100
+ if (type !== BLOCKS.PARAGRAPH) {
101
+ const isActive = isBlockSelected(editor, type);
102
+ editor.tracking.onToolbarAction(isActive ? 'remove' : 'insert', {
103
+ nodeType: type
104
+ });
105
+ }
104
106
  toggleElement(editor, {
105
107
  activeType: type,
106
108
  inactiveType: type
@@ -7,10 +7,12 @@ import { COMMAND_PROMPT } from '../CommandPalette/constants';
7
7
  import { HeadingComponents } from './components/Heading';
8
8
  const buildHeadingEventHandler = (type)=>(editor, { options: { hotkey } })=>(event)=>{
9
9
  if (editor.selection && hotkey && isHotkey(hotkey, event)) {
10
- const isActive = isBlockSelected(editor, type);
11
- editor.tracking.onShortcutAction(isActive ? 'remove' : 'insert', {
12
- nodeType: type
13
- });
10
+ if (type !== BLOCKS.PARAGRAPH) {
11
+ const isActive = isBlockSelected(editor, type);
12
+ editor.tracking.onShortcutAction(isActive ? 'remove' : 'insert', {
13
+ nodeType: type
14
+ });
15
+ }
14
16
  toggleElement(editor, {
15
17
  activeType: type,
16
18
  inactiveType: BLOCKS.PARAGRAPH
@@ -2,5 +2,6 @@ import * as assets from './asset';
2
2
  import * as contentTypes from './content-type';
3
3
  import * as entries from './entry';
4
4
  import * as locales from './locale';
5
+ import * as resources from './resources';
5
6
  import * as spaces from './space';
6
- export { assets, contentTypes, entries, locales, spaces };
7
+ export { assets, contentTypes, entries, locales, resources, spaces };
@@ -0,0 +1,7 @@
1
+ export declare const published: {
2
+ sys: {
3
+ urn: string;
4
+ type: string;
5
+ linkType: string;
6
+ };
7
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-rich-text",
3
- "version": "3.19.4",
3
+ "version": "3.19.5",
4
4
  "source": "./src/index.tsx",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -86,5 +86,5 @@
86
86
  "publishConfig": {
87
87
  "registry": "https://npm.pkg.github.com/"
88
88
  },
89
- "gitHead": "b8bb055da4124068226d373e10a4687051b32e43"
89
+ "gitHead": "9958d474180ee4bb18ab6ef289cf3de22f8c81a9"
90
90
  }