@contentful/field-editor-markdown 1.8.0 → 1.9.1

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.
@@ -88,6 +88,13 @@ function MarkdownEditor(props) {
88
88
  const [selectedTab, setSelectedTab] = _react.useState('editor');
89
89
  const [editor, setEditor] = _react.useState(null);
90
90
  const [canUploadAssets, setCanUploadAssets] = _react.useState(false);
91
+ _react.useEffect(()=>{
92
+ if (props.enableTab) {
93
+ setSelectedTab(props.enableTab);
94
+ }
95
+ }, [
96
+ props.enableTab
97
+ ]);
91
98
  _react.useEffect(()=>{
92
99
  if (editor && props.onReady) {
93
100
  props.onReady(editor);
@@ -139,7 +146,7 @@ function MarkdownEditor(props) {
139
146
  className: styles.container,
140
147
  "data-test-id": "markdown-editor"
141
148
  }, _react.createElement(_MarkdownTabs.MarkdownTabs, {
142
- active: props.enableTab || selectedTab,
149
+ active: selectedTab,
143
150
  onSelect: (tab)=>{
144
151
  if (props.enableTab) return;
145
152
  setSelectedTab(tab);
@@ -24,6 +24,13 @@ export function MarkdownEditor(props) {
24
24
  const [selectedTab, setSelectedTab] = React.useState('editor');
25
25
  const [editor, setEditor] = React.useState(null);
26
26
  const [canUploadAssets, setCanUploadAssets] = React.useState(false);
27
+ React.useEffect(()=>{
28
+ if (props.enableTab) {
29
+ setSelectedTab(props.enableTab);
30
+ }
31
+ }, [
32
+ props.enableTab
33
+ ]);
27
34
  React.useEffect(()=>{
28
35
  if (editor && props.onReady) {
29
36
  props.onReady(editor);
@@ -75,7 +82,7 @@ export function MarkdownEditor(props) {
75
82
  className: styles.container,
76
83
  "data-test-id": "markdown-editor"
77
84
  }, React.createElement(MarkdownTabs, {
78
- active: props.enableTab || selectedTab,
85
+ active: selectedTab,
79
86
  onSelect: (tab)=>{
80
87
  if (props.enableTab) return;
81
88
  setSelectedTab(tab);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-markdown",
3
- "version": "1.8.0",
3
+ "version": "1.9.1",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -38,7 +38,7 @@
38
38
  "@contentful/f36-components": "^4.70.0",
39
39
  "@contentful/f36-icons": "^4.29.0",
40
40
  "@contentful/f36-tokens": "^4.0.5",
41
- "@contentful/field-editor-shared": "^2.4.0",
41
+ "@contentful/field-editor-shared": "^2.4.1",
42
42
  "@types/codemirror": "0.0.109",
43
43
  "codemirror": "^5.65.11",
44
44
  "constate": "^3.3.2",
@@ -61,5 +61,5 @@
61
61
  "publishConfig": {
62
62
  "registry": "https://npm.pkg.github.com/"
63
63
  },
64
- "gitHead": "72399b30c89e7981627429653b82dbd175c06ce6"
64
+ "gitHead": "1d0dc6dc10cf4ad43aa48b04fa67d29ab7edaee8"
65
65
  }