PluginProbe
Extendify / 3.0.6
Extendify v3.0.6
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / src / Agent / tours / style-editor.js

style-editor.js in Extendify 3.0.6, at src/Agent/tours/style-editor.js

336 lines 8.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { waitUntilExists } from '@agent/lib/tour-helpers';
2 import { __, isRTL } from '@wordpress/i18n';
3
4 const { isBlockTheme, themeSlug, adminUrl } = window.extSharedData;
5
6 export default {
7 id: 'style-editor-tour',
8 title: __('Style editor', 'extendify-local'),
9 message: __('Tour the style editor', 'extendify-local'),
10 settings: {
11 allowOverflow: false,
12 startFrom: [
13 adminUrl +
14 // TODO: This needs attention as it was sending me into an infinite frontend loop
15 `site-editor.php?canvas=edit&postType=wp_template&postId=${themeSlug}%2F%2Fhome`,
16 ],
17 enabled: isBlockTheme ?? false,
18 },
19 onStart: () => {
20 // close modal if shown
21 document.querySelector('.components-modal__header > button')?.click();
22 },
23 steps: [
24 {
25 title: __('Style Editor', 'extendify-local'),
26 text: __(
27 'The style editor allows you to edit the styles, colors, and typographic elements of your site. To access the style editor, first open the Editor via Appearance > Editor.',
28 'extendify-local',
29 ),
30 image: 'https://placehold.co/342x240',
31 attachTo: {
32 element: '.interface-pinned-items button:nth-child(2)',
33 offset: {
34 marginTop: 10,
35 marginLeft: -30,
36 },
37 position: {
38 x: isRTL() ? 'right' : 'left',
39 y: 'bottom',
40 },
41 hook: isRTL() ? 'top right' : 'top left',
42 },
43 events: {
44 beforeAttach: () => waitUntilExists('.interface-pinned-items'),
45 },
46 },
47 {
48 title: __('Styles Panel', 'extendify-local'),
49 text: __(
50 'The styles panel allows you to customize the appearance of your site. It includes style variations, colors, typography, and more.',
51 'extendify-local',
52 ),
53 attachTo: {
54 element: '.edit-site-global-styles-sidebar',
55 offset: {
56 marginTop: 1,
57 marginLeft: -15,
58 },
59 position: {
60 x: isRTL() ? 'right' : 'left',
61 y: 'top',
62 },
63 hook: isRTL() ? 'top left' : 'top right',
64 },
65 events: {
66 beforeAttach: async () => {
67 document
68 .querySelector(
69 '.interface-pinned-items button:nth-child(2):not(.is-pressed)',
70 )
71 ?.click();
72 return await waitUntilExists('.edit-site-global-styles-sidebar');
73 },
74 },
75 },
76 {
77 title: __('Style Variations', 'extendify-local'),
78 text: __(
79 'The Browse Styles button opens the style variations panel.',
80 'extendify-local',
81 ),
82 attachTo: {
83 element: '.edit-site-global-styles-sidebar button[id="/variations"]',
84 offset: {
85 marginTop: 0,
86 marginLeft: -15,
87 },
88 position: {
89 x: isRTL() ? 'right' : 'left',
90 y: 'top',
91 },
92 hook: isRTL() ? 'top left' : 'top right',
93 },
94 events: {
95 beforeAttach: async () => {
96 // Press the back button if the next step opened the variations panel, and now we're going back.
97 document
98 .querySelector(
99 '.edit-site-global-styles-sidebar button.components-navigator-back-button',
100 )
101 ?.click();
102 return await waitUntilExists(
103 '.edit-site-global-styles-preview__iframe',
104 );
105 },
106 },
107 },
108 {
109 title: __('Style Variations', 'extendify-local'),
110 text: __(
111 'Choose a style you like to preview how it will look on your site.',
112 'extendify-local',
113 ),
114 attachTo: {
115 element: '.edit-site-global-styles-sidebar__navigator-screen',
116 offset: {
117 marginTop: 0,
118 marginLeft: -15,
119 },
120 position: {
121 x: isRTL() ? 'right' : 'left',
122 y: 'top',
123 },
124 hook: isRTL() ? 'top left' : 'top right',
125 },
126 events: {
127 beforeAttach: async () => {
128 document
129 .querySelector(
130 '.edit-site-global-styles-sidebar button[id="/variations"]',
131 )
132 ?.click();
133 return await waitUntilExists(
134 '.edit-site-global-styles-header__description',
135 );
136 },
137 },
138 },
139 {
140 title: __('Typography', 'extendify-local'),
141 text: __(
142 'The Typography button opens the typography settings panel.',
143 'extendify-local',
144 ),
145 attachTo: {
146 element: '.edit-site-global-styles-sidebar button[id="/typography"]',
147
148 offset: {
149 marginTop: 0,
150 marginLeft: -15,
151 },
152 position: {
153 x: isRTL() ? 'right' : 'left',
154 y: 'top',
155 },
156 hook: isRTL() ? 'top left' : 'top right',
157 },
158 events: {
159 beforeAttach: async () => {
160 // Press the back button if the next step opened the typography panel, and now we're going back.
161 document
162 .querySelector(
163 '.edit-site-global-styles-sidebar button.components-navigator-back-button',
164 )
165 ?.click();
166 return await waitUntilExists(
167 '.edit-site-global-styles-preview__iframe',
168 );
169 },
170 },
171 },
172 {
173 title: __('Typography', 'extendify-local'),
174 text: __('Choose a typographic element to customize.', 'extendify-local'),
175 attachTo: {
176 element: '.edit-site-global-styles-sidebar__navigator-screen',
177 offset: {
178 marginTop: 0,
179 marginLeft: -15,
180 },
181 position: {
182 x: isRTL() ? 'right' : 'left',
183 y: 'top',
184 },
185 hook: isRTL() ? 'top left' : 'top right',
186 },
187 events: {
188 beforeAttach: async () => {
189 document
190 .querySelector(
191 '.edit-site-global-styles-sidebar button[id="/typography"]',
192 )
193 ?.click();
194 return await waitUntilExists(
195 '.edit-site-global-styles-header__description',
196 );
197 },
198 },
199 },
200 {
201 title: __('Colors', 'extendify-local'),
202 text: __(
203 'The Colors button opens the color settings panel.',
204 'extendify-local',
205 ),
206 attachTo: {
207 element: '.edit-site-global-styles-sidebar button[id="/colors"]',
208
209 offset: {
210 marginTop: 0,
211 marginLeft: -15,
212 },
213 position: {
214 x: isRTL() ? 'right' : 'left',
215 y: 'top',
216 },
217 hook: isRTL() ? 'top left' : 'top right',
218 },
219 events: {
220 beforeAttach: async () => {
221 // Press the back button if the next step opened the typography panel, and now we're going back.
222 document
223 .querySelector(
224 '.edit-site-global-styles-sidebar button.components-navigator-back-button',
225 )
226 ?.click();
227 return await waitUntilExists(
228 '.edit-site-global-styles-preview__iframe',
229 );
230 },
231 },
232 },
233 {
234 title: __('Colors', 'extendify-local'),
235 text: __(
236 "Select the theme's palette or individual elements to customize their colors.",
237 'extendify-local',
238 ),
239 attachTo: {
240 element: '.edit-site-global-styles-sidebar__navigator-screen',
241 offset: {
242 marginTop: 0,
243 marginLeft: -15,
244 },
245 position: {
246 x: isRTL() ? 'right' : 'left',
247 y: 'top',
248 },
249 hook: isRTL() ? 'top left' : 'top right',
250 },
251 events: {
252 beforeAttach: async () => {
253 document
254 .querySelector(
255 '.edit-site-global-styles-sidebar button[id="/colors"]',
256 )
257 ?.click();
258 return await waitUntilExists(
259 '.edit-site-global-styles-header__description',
260 );
261 },
262 },
263 },
264 {
265 title: __('Layout', 'extendify-local'),
266 text: __(
267 'The Layout button opens the layout settings panel.',
268 'extendify-local',
269 ),
270 attachTo: {
271 element: '.edit-site-global-styles-sidebar button[id="/layout"]',
272
273 offset: {
274 marginTop: 0,
275 marginLeft: -15,
276 },
277 position: {
278 x: isRTL() ? 'right' : 'left',
279 y: 'top',
280 },
281 hook: isRTL() ? 'top left' : 'top right',
282 },
283 events: {
284 beforeAttach: async () => {
285 // Press the back button if the next step opened the typography panel, and now we're going back.
286 document
287 .querySelector(
288 '.edit-site-global-styles-sidebar button.components-navigator-back-button',
289 )
290 ?.click();
291 return await waitUntilExists(
292 '.edit-site-global-styles-preview__iframe',
293 );
294 },
295 },
296 },
297 {
298 title: __('Layout', 'extendify-local'),
299 text: __(
300 'From here you can customize the dimensions, padding, and margins used for your site layout.',
301 'extendify-local',
302 ),
303 attachTo: {
304 element: '.edit-site-global-styles-sidebar__navigator-screen',
305 offset: {
306 marginTop: 0,
307 marginLeft: -15,
308 },
309 position: {
310 x: isRTL() ? 'right' : 'left',
311 y: 'top',
312 },
313 hook: isRTL() ? 'top left' : 'top right',
314 },
315 events: {
316 beforeAttach: async () => {
317 document
318 .querySelector(
319 '.edit-site-global-styles-sidebar button[id="/layout"]',
320 )
321 ?.click();
322 return await waitUntilExists('.components-tools-panel');
323 },
324 },
325 },
326 ],
327 onFinish: async () => {
328 document
329 .querySelector(
330 '.edit-site-global-styles-sidebar button.components-navigator-back-button',
331 )
332 ?.click();
333 return await waitUntilExists('.edit-site-global-styles-preview__iframe');
334 },
335 };
336