-
Notifications
You must be signed in to change notification settings - Fork 94
Expand file tree
/
Copy pathEditor.stories.ts
More file actions
190 lines (176 loc) · 5.47 KB
/
Copy pathEditor.stories.ts
File metadata and controls
190 lines (176 loc) · 5.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
import type { Meta, StoryObj } from '@storybook/angular';
import { EditorComponent } from 'tinymce-angular-component/src/main/ts/public_api';
import { apiKey, sampleContent } from './Settings';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { EventBindingComponent } from './event-binding/EventBinding.component';
import { EventForwardingComponent } from './event-forwarding/EventForwarding.component';
import { FormControlComponent } from './form-control/FormControl.component';
import { FormWithOnPushComponent } from './form-with-on-push/form-with-on-push.component';
import { BlogComponent } from './formvalidation/FormValidation.component';
import { DisablingComponent } from './disable/Disable.component';
import { ViewQueryComponent } from './viewquery/Viewquery.component';
import { MaterialTabs } from './materialtabs/MaterialTabs.component';
import { SafePipe } from './pipes/Safe.pipe';
import { MatTabsModule } from '@angular/material/tabs';
import { ContainerComponent, ContentProjectionComponent } from './contentprojection/ContentProjection.component';
import { BindingComponent } from './data-binding/DataBinding.component';
import { ReadonlyComponent } from './readonly/Readonly.component';
import { BrowserModule } from '@angular/platform-browser';
const meta: Meta = {
component: EditorComponent,
title: 'Editor',
};
export default meta;
export const IframeStory: StoryObj<EditorComponent> = {
name: 'Iframe Editor',
args: {
apiKey,
initialValue: sampleContent,
init: {
height: 300,
plugins: 'help code',
},
}
};
export const InlineStory: StoryObj<EditorComponent> = {
name: 'Inline Editor',
render: () => ({
template: `
<div style="padding-top: 100px;">
<editor apiKey="${apiKey}" inline initialValue='${sampleContent}'></editor>
</div>
`
})
};
export const EventBindingStory: StoryObj<EditorComponent> = {
name: 'Event Binding',
render: () => ({
moduleMetadata: {
imports: [ ReactiveFormsModule, FormsModule ],
declarations: [ EventBindingComponent ],
},
template: `<event-binding/>`
})
};
export const EventForwardingStory: StoryObj<EditorComponent> = {
name: 'Event Forwarding',
render: () => ({
moduleMetadata: {
imports: [ ReactiveFormsModule, FormsModule ],
declarations: [ EventForwardingComponent ],
},
template: `<event-forwarding/>`
}),
};
export const DataBindingStory: StoryObj<EditorComponent> = {
name: 'Data Binding',
render: () => ({
moduleMetadata: {
imports: [ ReactiveFormsModule, FormsModule ],
declarations: [ BindingComponent ],
},
template: `<binding/>`
}),
parameters: {
// TODO: show notes, or remove, or show in a different way
notes: 'Simple example of data binding with ngModel'
}
};
export const FormControlStory: StoryObj<EditorComponent> = {
name: 'Form Control',
render: () => ({
moduleMetadata: {
imports: [ ReactiveFormsModule, FormsModule ],
declarations: [ FormControlComponent ],
},
template: `<form-control/>`
}),
parameters: {
notes: 'Simple example of subscribing to valueChanges'
}
};
export const FormStateStory: StoryObj<EditorComponent> = {
name: 'Form with on-push change detection',
render: () => ({
moduleMetadata: {
imports: [ ReactiveFormsModule, FormsModule ],
declarations: [ FormWithOnPushComponent ],
},
template: `<form-with-on-push apiKey="${apiKey}"/>`
}),
};
export const FormValidationStory: StoryObj<EditorComponent> = {
name: 'Form Validation',
render: () => ({
moduleMetadata: {
imports: [ ReactiveFormsModule, FormsModule ],
declarations: [ BlogComponent, SafePipe ],
},
template: `<blog/>`
}),
parameters: {
notes: 'Example of form validation and data binding with ngModel'
}
};
export const DisablingStory: StoryObj<EditorComponent> = {
name: 'Disabling',
render: () => ({
moduleMetadata: {
imports: [ ReactiveFormsModule, FormsModule ],
declarations: [ DisablingComponent ],
},
template: `<disabling/>`
}),
parameters: {
notes: 'Example of disabling/enabling the editor component'
}
};
export const ReadonlyStory: StoryObj<EditorComponent> = {
name: 'Readonly',
render: () => ({
moduleMetadata: {
imports: [ ReactiveFormsModule, FormsModule ],
declarations: [ ReadonlyComponent ],
},
template: `<readonly/>`
}),
parameters: {
notes: 'Example of toggling readonly state in the editor component'
}
};
export const ViewQueryStory: StoryObj<EditorComponent> = {
name: 'View Query',
render: () => ({
moduleMetadata: {
imports: [ ReactiveFormsModule, FormsModule ],
declarations: [ ViewQueryComponent ],
},
template: `<view-query/>`
}),
parameters: {
notes: 'Example of obtaining a reference to the editor with a view query'
}
};
export const MaterialTabsStory: StoryObj<EditorComponent> = {
name: 'Material Tabs',
render: () => ({
moduleMetadata: {
imports: [ ReactiveFormsModule, FormsModule, BrowserModule, MatTabsModule ],
declarations: [ MaterialTabs ],
},
template: `<material-tabs/>`
}),
};
export const ContentProjectionStory: StoryObj<EditorComponent> = {
name: 'Content Projection',
render: () => ({
moduleMetadata: {
declarations: [ ContentProjectionComponent, ContainerComponent ],
imports: [ FormsModule ],
},
template: `<content-projection/>`
}),
parameters: {
notes: 'Content projection workaround.'
}
};