Skip to content

Commit 98eada1

Browse files
DOC-3181: Update React integration doc (#3688)
* DOC-3181: Update React integration * Update modules/ROOT/partials/integrations/react-quick-start.adoc * DOC-3181: Replace your-api-key with no-api-key. --------- Co-authored-by: Karl Kemister-Sheppard <[email protected]>
1 parent d2078f2 commit 98eada1

File tree

2 files changed

+46
-51
lines changed

2 files changed

+46
-51
lines changed

modules/ROOT/partials/integrations/react-quick-start.adoc

Lines changed: 39 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ This procedure requires https://nodejs.org/[Node.js (and npm)].
1818
+
1919
[source,sh]
2020
----
21+
# npm 7+, extra double-dash is needed
2122
npm create vite@5 tinymce-react-demo -- --template react-swc
2223
----
2324
. Change to the newly created directory.
@@ -28,11 +29,11 @@ cd tinymce-react-demo
2829
----
2930

3031
ifeval::["{productSource}" == "cloud"]
31-
. Install the `+@tinymce/tinymce-react+` package and save it to your `+package.json+` with `+--save+`.
32+
. Install the `+@tinymce/tinymce-react+` package.
3233
+
3334
[source,sh]
3435
----
35-
npm install --save @tinymce/tinymce-react
36+
npm install @tinymce/tinymce-react
3637
----
3738

3839
. Using a text editor, open `+./src/App.jsx+` and replace the contents with:
@@ -50,11 +51,12 @@ export default function App() {
5051
console.log(editorRef.current.getContent());
5152
}
5253
};
54+
5355
return (
5456
<>
5557
<Editor
56-
apiKey='your-api-key'
57-
onInit={(_evt, editor) => editorRef.current = editor}
58+
apiKey='no-api-key'
59+
onInit={ (_evt, editor) => editorRef.current = editor }
5860
initialValue="<p>This is the initial content of the editor.</p>"
5961
init={{
6062
height: 500,
@@ -83,11 +85,11 @@ This JavaScript file will create a component "`+App+`" containing a {productname
8385
endif::[]
8486
ifeval::["{productSource}" == "package-manager"]
8587
ifeval::["{productUse}" == "host"]
86-
. Install the `+tinymce+`, `+@tinymce/tinymce-react+` and `+fs-extra+` packages and save them to your `+package.json+` with `+--save+`.
88+
. Install the `+tinymce+`, `+@tinymce/tinymce-react+` and `+fs-extra+` packages.
8789
+
8890
[source,sh]
8991
----
90-
npm install --save tinymce @tinymce/tinymce-react fs-extra
92+
npm install tinymce @tinymce/tinymce-react fs-extra
9193
----
9294

9395
. Setup a `postinstall` script to copy {productname} to the public directory for hosting
@@ -175,11 +177,11 @@ export default function App() {
175177

176178
endif::[]
177179
ifeval::["{productUse}" == "bundle"]
178-
. Install the `+tinymce+` and `+@tinymce/tinymce-react+` packages and save them to your `+package.json+` with `+--save+`.
180+
. Install the `+tinymce+` and `+@tinymce/tinymce-react+` packages
179181
+
180182
[source,sh]
181183
----
182-
npm install --save tinymce @tinymce/tinymce-react
184+
npm install tinymce @tinymce/tinymce-react
183185
----
184186

185187
. Using a text editor, create `+./src/BundledEditor.jsx+` and set the contents to:
@@ -265,6 +267,7 @@ export default function App() {
265267
console.log(editorRef.current.getContent());
266268
}
267269
};
270+
268271
return (
269272
<>
270273
<BundledEditor
@@ -293,11 +296,10 @@ endif::[]
293296
endif::[]
294297
ifeval::["{productSource}" == "zip"]
295298
ifeval::["{productUse}" == "host"]
296-
. Install the `+@tinymce/tinymce-react+` package and save it to your `+package.json+` with `+--save+`.
297-
+
299+
. Install the `+@tinymce/tinymce-react+` package.
298300
[source,sh]
299301
----
300-
npm install --save @tinymce/tinymce-react
302+
npm install @tinymce/tinymce-react
301303
----
302304

303305
. Unzip the content of the `+tinymce/js+` folder from the link:{download-enterprise}[{productname} zip] into the `+public+` folder. Afterwards the directory listing should be similar to below:
@@ -324,24 +326,17 @@ public
324326
└── tinymce.min.js
325327
----
326328

327-
. Using a text editor, open `+./eslintrc.cjs+` and add `+'src/tinymce'+` to the `+ignorePatterns+` array.
329+
. Using a text editor, open `+./eslint.config.js` and add `+'src/tinymce'+` to the `+ignores+` array.
328330
+
329-
.Diff of `.eslintrc.js`
331+
.Diff of `.eslint.config.js`
330332
[source,patch]
331333
----
332-
diff --git a/.eslintrc.cjs b/.eslintrc.cjs
333-
index 3b3b3b3..4b4b4b4 100644
334-
--- a/.eslintrc.cjs
335-
+++ b/.eslintrc.cjs
336-
@@ -7,7 +7,7 @@ modules.exports = {
337-
'plugin:react/jsx-runtime',
338-
'plugin:react-hooks/recommended',
339-
],
340-
- ignorePatterns: ['dist', '.eslintrc.cjs'],
341-
+ ignorePatterns: ['dist', '.eslintrc.cjs', 'src/tinymce'],
342-
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
343-
settings: { react: { version: '18.2' } },
344-
plugins: ['react-refresh'],
334+
export default tseslint.config(
335+
- { ignores: ['dist'] },
336+
+ { ignores: ['dist', 'src/tinymce'] },
337+
{
338+
extends: [js.configs.recommended, ...tseslint.configs.recommended],
339+
files: ['**/*.{ts,tsx}'],
345340
----
346341

347342
. Using a text editor, open `+./src/App.jsx+` and replace the contents with:
@@ -390,11 +385,11 @@ export default function App() {
390385
endif::[]
391386
ifeval::["{productUse}" == "bundle"]
392387

393-
. Install the `+@tinymce/tinymce-react+` and `+script-loader+` packages and save them to your `+package.json+` with `+--save+`.
388+
. Install the `+@tinymce/tinymce-react+` and `+script-loader+` packages.
394389
+
395390
[source,sh]
396391
----
397-
npm install --save @tinymce/tinymce-react script-loader
392+
npm install @tinymce/tinymce-react script-loader
398393
----
399394

400395
. Unzip the content of the `+tinymce/js+` folder from the link:{download-enterprise}[{productname} zip] into the `+src+` folder. Afterwards the directory listing should be similar to below:
@@ -423,24 +418,24 @@ src
423418
└── tinymce.min.js
424419
----
425420

426-
. Using a text editor, open `+./eslintrc.cjs+` and add `+'src/tinymce'+` to the `+ignorePatterns+` array.
421+
. Using a text editor, open `+./eslint.config.js+` and add `+'src/tinymce'+` to the `+ignores+` array.
427422
+
428-
.Diff of `.eslintrc.js`
423+
.Diff of `.eslint.config.js`
429424
[source,patch]
430425
----
431-
diff --git a/.eslintrc.cjs b/.eslintrc.cjs
432-
index 3b3b3b3..4b4b4b4 100644
433-
--- a/.eslintrc.cjs
434-
+++ b/.eslintrc.cjs
435-
@@ -7,7 +7,7 @@ modules.exports = {
436-
'plugin:react/jsx-runtime',
437-
'plugin:react-hooks/recommended',
438-
],
439-
- ignorePatterns: ['dist', '.eslintrc.cjs'],
440-
+ ignorePatterns: ['dist', '.eslintrc.cjs', 'src/tinymce'],
441-
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
442-
settings: { react: { version: '18.2' } },
443-
plugins: ['react-refresh'],
426+
diff --git a/eslint.config.js b/eslint.config.js
427+
index 092408a..1ab8db4 100644
428+
--- a/eslint.config.js
429+
+++ b/eslint.config.js
430+
@@ -5,7 +5,7 @@ import reactRefresh from 'eslint-plugin-react-refresh'
431+
import tseslint from 'typescript-eslint'
432+
433+
export default tseslint.config(
434+
- { ignores: ['dist'] },
435+
+ { ignores: ['dist', 'src/tinymce'] },
436+
{
437+
extends: [js.configs.recommended, ...tseslint.configs.recommended],
438+
files: ['**/*.{ts,tsx}'],
444439
----
445440

446441
. Using a text editor, create `+./src/BundledEditor.jsx+` and set the contents to:
@@ -596,4 +591,4 @@ endif::[]
596591
* For information on customizing:
597592
** {productname} integration, see: xref:react-ref.adoc[].
598593
** {productname}, see: xref:basic-setup.adoc[].
599-
** The React application, see: https://vitejs.dev/guide/#getting-started[Getting Started with Vite] or https://reactjs.org/docs/getting-started.html[the React documentation].
594+
** The React application, see: https://vitejs.dev/guide/#getting-started[Getting Started with Vite] or https://react.dev/learn[the React documentation].

modules/ROOT/partials/integrations/react-tech-ref.adoc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ To install the `+tinymce-react+` package and save it to your `+package.json+`.
3434

3535
[source,sh]
3636
----
37-
npm install --save @tinymce/tinymce-react
37+
npm install @tinymce/tinymce-react
3838
----
3939

4040
or with Yarn
@@ -104,7 +104,7 @@ The `+tinymce-react+` integration will try to source {productname} in the follow
104104

105105
These props are used to configure how the editor is sourced:
106106

107-
xref:apikey[`+apiKey+`]:: The {cloudname} API key. When loading from {cloudname}, use this prop to remove the "This domain is not registered..." warning message.
107+
xref:apikey[`+apiKey+`]:: The {cloudname} API key. When loading from {cloudname}, use this prop to remove the "A valid API key is required to continue using TinyMCE. Please alert the admin to check the current API key. Click here to learn more." warning message.
108108

109109
xref:licenseKey[`+licenseKey+`]:: The {cloudname} License key. Use this when self-hosting {productname} instead of loading from {cloudname}.
110110

@@ -167,7 +167,7 @@ None of the configuration props are *required* for the {productname} React compo
167167

168168
{cloudname} API key.
169169

170-
Required for deployments using the {cloudname} to provide the {productname} editor without the warning message "This domain is not registered...".
170+
Required for deployments using the {cloudname} to provide the {productname} editor without the warning message "A valid API key is required to continue using TinyMCE. Please alert the admin to check the current API key. Click here to learn more".
171171

172172
include::partial$misc/get-an-api-key.adoc[]
173173

@@ -180,7 +180,7 @@ include::partial$misc/get-an-api-key.adoc[]
180180
[source,jsx]
181181
----
182182
<Editor
183-
apiKey='your-api-key'
183+
apiKey='no-api-key'
184184
/>
185185
----
186186

@@ -229,7 +229,7 @@ Such as:
229229
[source,jsx,subs="attributes+"]
230230
----
231231
<Editor
232-
apiKey='your-api-key'
232+
apiKey='no-api-key'
233233
cloudChannel='{productmajorversion}-dev'
234234
init={{ /* your other settings */ }}
235235
/>
@@ -663,7 +663,7 @@ function MyComponent({initialValue}) {
663663

664664
CAUTION: The controlled component can have performance problems on large documents as it requires converting the entire document to a string on each keystroke or modification.
665665

666-
To use the editor as a https://reactjs.org/docs/forms.html#controlled-components[controlled component], both the `+value+` and `+onEditorChange+` props are required.
666+
To use the editor as a https://legacy.reactjs.org/docs/forms.html#controlled-components[controlled component], both the `+value+` and `+onEditorChange+` props are required.
667667

668668
The `+value+` prop is used to set and re-set the editor content. If it is not updated to the latest version of the editor content, the editor will rollback any changes.
669669

@@ -767,7 +767,7 @@ function MyComponent({initialValue, limit}) {
767767
};
768768
----
769769

770-
For information on controlled components in React, see: https://reactjs.org/docs/forms.html#controlled-components[React Docs - Controlled Components].
770+
For information on controlled components in React, see: https://legacy.reactjs.org/docs/forms.html#controlled-components[React Docs - Controlled Components].
771771

772772
[[event-binding]]
773773
== Event binding

0 commit comments

Comments
 (0)