Skip to content

Commit 8871a38

Browse files
authored
DOC-2435: Updated Angular quick start guides (#3332)
1 parent b5000ec commit 8871a38

File tree

1 file changed

+65
-47
lines changed

1 file changed

+65
-47
lines changed

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

Lines changed: 65 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
:packageName: tinymce-angular
22

3-
The https://github.com/tinymce/tinymce-angular[Official {productname} Angular component] integrates {productname} into Angular projects. This procedure creates a https://angular.io/guide/setup-local[basic Angular application] containing a {productname} editor.
3+
The https://github.com/tinymce/tinymce-angular[Official {productname} Angular component] integrates {productname} into Angular projects. This procedure creates a https://angular.dev/tools/cli/setup-local[basic Angular application] containing a {productname} editor.
4+
5+
This procedure uses standalone components. If using Angular Modules, see xref:angular-modules[Angular Modules].
46

57
For examples of the {productname} Angular integration, visit https://tinymce.github.io/tinymce-angular/[the tinymce-angular storybook].
68

@@ -45,44 +47,36 @@ ifeval::["{productSource}" != "package-manager"]
4547
npm install --save @tinymce/tinymce-angular
4648
----
4749
endif::[]
48-
. Using a text editor, open `+/path/to/tinymce-angular-demo/src/app/app.module.ts+` and replace the contents with:
49-
+
50-
[source,ts]
51-
----
52-
import { BrowserModule } from '@angular/platform-browser';
53-
import { NgModule } from '@angular/core';
54-
import { EditorModule } from '@tinymce/tinymce-angular';
55-
import { AppComponent } from './app.component';
56-
57-
@NgModule({
58-
declarations: [
59-
AppComponent
60-
],
61-
imports: [
62-
BrowserModule,
63-
EditorModule
64-
],
65-
providers: [],
66-
bootstrap: [AppComponent]
50+
. Using a text editor, open `+/path/to/tinymce-angular-demo/src/app/app.component.ts+` and replace the contents with:
51+
+
52+
[source,ts,subs="attributes+"]
53+
----
54+
import { Component } from '@angular/core';
55+
import { EditorComponent } from '@tinymce/tinymce-angular';
56+
57+
@Component({
58+
selector: 'app-root',
59+
standalone: true,
60+
imports: [EditorComponent],
61+
template: `
62+
<h1>{productname} {productmajorversion} Angular Demo</h1>
63+
<editor
64+
[init]="init"
65+
/>
66+
`
6767
})
68-
export class AppModule { }
68+
export class AppComponent {
69+
init: EditorComponent['init'] = {
70+
plugins: 'lists link image table code help wordcount'
71+
};
72+
}
6973
----
70-
. Using a text editor, open `+/path/to/tinymce-angular-demo/src/app/app.component.html+` and replace the contents with:
71-
+
72-
[source,tsx,subs="attributes+"]
73-
----
74-
<h1>{productname} {productmajorversion} Angular Demo</h1>
75-
<editor
76-
[init]="{ plugins: 'lists link image table code help wordcount' }"
77-
></editor>
78-
----
79-
8074
ifeval::["{productSource}" == "cloud"]
8175
. Include the `+apiKey+` option in the editor element and include your link:{accountsignup}/[{cloudname} API key]. Such as:
8276
+
8377
[source,tsx]
8478
----
85-
<editor apiKey="your-api-key" [init]={ /* your other settings */ } ></editor>
79+
<editor apiKey="your-api-key" [init]="init" />
8680
----
8781
endif::[]
8882
ifeval::["{productSource}" == "package-manager"]
@@ -96,17 +90,16 @@ ifeval::["{productSource}" == "package-manager"]
9690
----
9791

9892
. Load TinyMCE.
99-
* To load TinyMCE when the editor is initialized (also known as lazy loading), add a dependency provider to the module using the `+TINYMCE_SCRIPT_SRC+` token.
93+
* To load {productname} when the editor is initialized (also known as lazy loading), add a dependency provider to the component using the `+TINYMCE_SCRIPT_SRC+` token.
10094
+
10195
[source,ts]
10296
----
103-
import { EditorModule, TINYMCE_SCRIPT_SRC } from '@tinymce/tinymce-angular';
97+
import { EditorComponent, TINYMCE_SCRIPT_SRC } from '@tinymce/tinymce-angular';
10498
/* ... */
105-
@NgModule({
99+
@Component({
106100
/* ... */
107-
imports: [
108-
EditorModule
109-
],
101+
standalone: true,
102+
imports: [EditorComponent],
110103
providers: [
111104
{ provide: TINYMCE_SCRIPT_SRC, useValue: 'tinymce/tinymce.min.js' }
112105
]
@@ -123,12 +116,16 @@ import { EditorModule, TINYMCE_SCRIPT_SRC } from '@tinymce/tinymce-angular';
123116
----
124117
.. Update the editor configuration to include the `+base_url+` and `+suffix+` options.
125118
+
126-
[source,html]
119+
[source,ts]
127120
----
128-
<editor [init]="{
129-
base_url: '/tinymce', // Root for resources
130-
suffix: '.min' // Suffix to use when loading resources
131-
}"></editor>
121+
export class AppComponent {
122+
/* ... */
123+
init: EditorComponent['init'] = {
124+
/* ... */
125+
base_url: '/tinymce', // Root for resources
126+
suffix: '.min' // Suffix to use when loading resources
127+
};
128+
}
132129
----
133130
endif::[]
134131
ifeval::["{productSource}" == "zip"]
@@ -143,8 +140,6 @@ To use an independent deployment of {productname}, add a script to either the `+
143140
<script src="/path/to/tinymce.min.js"></script>
144141
----
145142
+
146-
To use an independent deployment of {productname} with the create a Angular application, add the script to `+/path/to/tinymce-angular-demo/src/app/app.component.html+`.
147-
+
148143
* Bundling {productname} with the Angular application using a module loader (such as Webpack).
149144
+
150145
--
@@ -174,7 +169,7 @@ endif::[]
174169

175170
== Deploying the application to a HTTP server
176171

177-
The application will require further configuration before it can be deployed to a production environment. For information on configuring the application for deployment, see: https://angular.io/guide/build[Angular Docs - Building and serving Angular apps] or https://angular.io/guide/deployment[Angular Docs - Deployment].
172+
The application will require further configuration before it can be deployed to a production environment. For information on configuring the application for deployment, see: link:https://angular.dev/tools/cli/build[Angular Docs - Building Angular Apps] or link:https://angular.dev/tools/cli/deployment[Angular Docs - Deployment].
178173

179174
To deploy the application to a local HTTP Server:
180175

@@ -190,10 +185,33 @@ The application has now been deployed on the web server.
190185

191186
NOTE: Additional configuration is required to deploy the application outside the web server root directory, such as +http://localhost:<port>/my_angular_application+.
192187

188+
[[angular-modules]]
189+
== Angular Modules
190+
`+EditorModule+` is available to import from `+@tinymce/tinymce-angular+`. Which should be included in your `+my.module.ts+` file.
191+
192+
[source,ts]
193+
----
194+
import { NgModule } from '@angular/core';
195+
import { EditorModule, TINYMCE_SCRIPT_SRC } from '@tinymce/tinymce-angular';
196+
197+
@NgModule({
198+
/* ... */
199+
imports: [
200+
EditorModule
201+
],
202+
providers: [
203+
// If you're self hosting and lazy loading TinyMCE from node_modules:
204+
{ provide: TINYMCE_SCRIPT_SRC, useValue: 'tinymce/tinymce.min.js' }
205+
],
206+
/* ... */
207+
})
208+
export class MyModule {}
209+
----
210+
193211
== Next Steps
194212

195213
* For examples of the {productname} integration, see: https://tinymce.github.io/tinymce-angular/[the tinymce-angular storybook].
196214
* For information on customizing:
197215
** {productname} integration, see: xref:angular-ref.adoc[Angular framework Technical Reference].
198216
** {productname}, see: xref:basic-setup.adoc[Basic setup].
199-
** The Angular application, see: https://angular.io/docs[the Angular documentation].
217+
** The Angular application, see: https://angular.dev[the Angular documentation].

0 commit comments

Comments
 (0)