PluginProbe
Extendify / 3.1.3
Extendify v3.1.3
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 / library-tour.js

library-tour.js in Extendify 3.1.3, at src/Agent/tours/library-tour.js

132 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { waitUntilExists, waitUntilGone } from '@agent/lib/tour-helpers';
2 import { __, isRTL } from '@wordpress/i18n';
3
4 export default {
5 id: 'library-tour',
6 title: __('Design Library', 'extendify-local'),
7 message: __('Tour the design library', 'extendify-local'),
8 settings: {
9 allowOverflow: true,
10 hideDotsNav: true,
11 startFrom: [
12 window.extSharedData?.showAIPageCreation
13 ? window.extSharedData.adminUrl +
14 'post-new.php?post_type=page&ext-page-creator-close=1'
15 : window.extSharedData.adminUrl +
16 'post-new.php?post_type=page&ext-close=1',
17 `${window.extSharedData.adminUrl}post-new.php?post_type=page`,
18 ],
19 },
20 onStart: async () => {
21 // Wait for gutenberg to be ready
22 await waitUntilExists('#extendify-library-btn');
23
24 // Close sidebar if open
25 document
26 .querySelector(`[aria-label="${__('Settings')}"].is-pressed`)
27 ?.click();
28 },
29 steps: [
30 {
31 title: __('Open the Pattern Library', 'extendify-local'),
32 text: __(
33 'The Extendify pattern library can be opened by clicking the button to the left.',
34 'extendify-local',
35 ),
36 attachTo: {
37 element: '#extendify-library-btn [role="button"]',
38 offset: {
39 marginTop: 0,
40 marginLeft: isRTL() ? -15 : 15,
41 },
42 position: {
43 x: isRTL() ? 'left' : 'right',
44 y: 'top',
45 },
46 hook: isRTL() ? 'top right' : 'top left',
47 },
48 events: {
49 beforeAttach: () => {},
50 },
51 },
52 {
53 title: __('Filter Patterns', 'extendify-local'),
54 text: __(
55 'Click on any pattern category to refine the selection.',
56 'extendify-local',
57 ),
58 attachTo: {
59 element: '#extendify-library-category-control',
60 position: {
61 x: isRTL() ? 'left' : 'right',
62 y: 'top',
63 },
64 hook: isRTL() ? 'top right' : 'top left',
65 },
66 options: {
67 allowPointerEvents: true,
68 },
69 events: {
70 beforeAttach: async () => {
71 // Open the Extendify library panel
72 dispatchEvent(new CustomEvent('extendify::open-library'));
73
74 return await waitUntilExists('#extendify-library-category-control');
75 },
76 },
77 },
78 {
79 title: __('Select a Pattern', 'extendify-local'),
80 text: __(
81 'Simply select any pattern you wish to insert into a page by clicking on it.',
82 'extendify-local',
83 ),
84 attachTo: {
85 element: '#extendify-library-patterns-list',
86 position: {
87 x: isRTL() ? 'right' : 'left',
88 y: 'top',
89 },
90 hook: isRTL() ? 'top right' : 'top left',
91 },
92 events: {
93 beforeAttach: async () => {
94 await waitUntilExists('#extendify-library-patterns-list');
95 },
96 },
97 },
98 {
99 title: __('View the Inserted Pattern', 'extendify-local'),
100 text: __(
101 'The selected pattern has been inserted into the page.',
102 'extendify-local',
103 ),
104 attachTo: {
105 element: '.wp-block-group:last-child',
106 frame: 'iframe[name="editor-canvas"]',
107 offset: {
108 marginTop: 15,
109 marginLeft: 0,
110 },
111 position: {
112 x: isRTL() ? 'left' : 'right',
113 y: 'top',
114 },
115 hook: isRTL() ? 'top left' : 'top right',
116 },
117 events: {
118 beforeAttach: async () => {
119 document
120 .querySelector('#extendify-library-patterns-list .library-pattern')
121 ?.click();
122
123 return await waitUntilGone('#extendify-library-patterns-list');
124 },
125 },
126 options: {
127 hideBackButton: true,
128 },
129 },
130 ],
131 };
132