Skip to content

Commit 170eadd

Browse files
committed
Improve solution for #625
1 parent 42eaa71 commit 170eadd

10 files changed

+85
-126
lines changed

assets/js/classic-editor.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/quick-edit.js

Lines changed: 13 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/quick-edit.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/settings-post-types.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/settings-post-types.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/jsx/bulk-edit.jsx

Lines changed: 33 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -65,52 +65,42 @@ inlineEditPost.setBulk = function (id) {
6565
});
6666
}
6767

68-
const saveButton = document.querySelector('#bulk_edit');
69-
if (saveButton) {
70-
saveButton.onclick = function() {
71-
setTimeout(() => {
72-
root.unmount();
73-
}, delayToUnmountAfterSaving);
74-
};
75-
}
76-
7768
const container = document.getElementById("publishpress-future-bulk-edit");
69+
const component = (
70+
<FutureActionPanelBulkEdit
71+
storeName={storeName}
72+
postType={postType}
73+
isNewPost={isNewPost}
74+
actionsSelectOptions={actionsSelectOptions}
75+
is12Hour={is12Hour}
76+
startOfWeek={startOfWeek}
77+
strings={strings}
78+
taxonomyName={taxonomyName}
79+
nonce={nonce}
80+
/>
81+
);
7882

7983
if (createRoot) {
80-
createRoot(container).render(
81-
<FutureActionPanelBulkEdit
82-
storeName={storeName}
83-
postType={postType}
84-
isNewPost={isNewPost}
85-
actionsSelectOptions={actionsSelectOptions}
86-
is12Hour={is12Hour}
87-
startOfWeek={startOfWeek}
88-
strings={strings}
89-
taxonomyName={taxonomyName}
90-
nonce={nonce}
91-
/>
92-
);
93-
} else {
94-
render(
95-
<FutureActionPanelBulkEdit
96-
storeName={storeName}
97-
postType={postType}
98-
isNewPost={isNewPost}
99-
actionsSelectOptions={actionsSelectOptions}
100-
is12Hour={is12Hour}
101-
startOfWeek={startOfWeek}
102-
strings={strings}
103-
taxonomyName={taxonomyName}
104-
nonce={nonce}
105-
/>,
106-
container
107-
);
108-
}
84+
const root = createRoot(container);
10985

110-
inlineEditPost.revert = function () {
111-
root.unmount();
86+
root.render(component);
11287

113-
// Call the original WP revert function.
114-
wpInlineEditRevert.apply(this, arguments);
115-
};
88+
const saveButton = document.querySelector('#bulk_edit');
89+
if (saveButton) {
90+
saveButton.onclick = function() {
91+
setTimeout(() => {
92+
root.unmount();
93+
}, delayToUnmountAfterSaving);
94+
};
95+
}
96+
97+
inlineEditPost.revert = function () {
98+
root.unmount();
99+
100+
// Call the original WP revert function.
101+
wpInlineEditRevert.apply(this, arguments);
102+
};
103+
} else {
104+
render(component, container);
105+
}
116106
};

assets/jsx/classic-editor.jsx

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,33 +33,22 @@ if (! isGutenbergEnabled()) {
3333
}
3434

3535
const container = document.getElementById("publishpress-future-classic-editor");
36+
const component = (
37+
<FutureActionPanelClassicEditor
38+
storeName={storeName}
39+
postType={postType}
40+
isNewPost={isNewPost}
41+
actionsSelectOptions={actionsSelectOptions}
42+
is12Hour={is12Hour}
43+
startOfWeek={startOfWeek}
44+
strings={strings}
45+
taxonomyName={taxonomyName}
46+
/>
47+
);
3648

3749
if (createRoot) {
38-
createRoot(container).render(
39-
<FutureActionPanelClassicEditor
40-
storeName={storeName}
41-
postType={postType}
42-
isNewPost={isNewPost}
43-
actionsSelectOptions={actionsSelectOptions}
44-
is12Hour={is12Hour}
45-
startOfWeek={startOfWeek}
46-
strings={strings}
47-
taxonomyName={taxonomyName}
48-
/>
49-
);
50+
createRoot(container).render(component);
5051
} else {
51-
render(
52-
<FutureActionPanelClassicEditor
53-
storeName={storeName}
54-
postType={postType}
55-
isNewPost={isNewPost}
56-
actionsSelectOptions={actionsSelectOptions}
57-
is12Hour={is12Hour}
58-
startOfWeek={startOfWeek}
59-
strings={strings}
60-
taxonomyName={taxonomyName}
61-
/>,
62-
container
63-
);
52+
render(component, container);
6453
}
6554
}

assets/jsx/quick-edit.jsx

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,19 @@ inlineEditPost.edit = function (button, id) {
7979
}
8080

8181
const container = document.getElementById("publishpress-future-quick-edit");
82+
const component = (
83+
<FutureActionPanelQuickEdit
84+
storeName={storeName}
85+
postType={postType}
86+
isNewPost={isNewPost}
87+
actionsSelectOptions={actionsSelectOptions}
88+
is12Hour={is12Hour}
89+
startOfWeek={startOfWeek}
90+
strings={strings}
91+
taxonomyName={taxonomyName}
92+
nonce={nonce}
93+
/>
94+
);
8295

8396
if (createRoot) {
8497
const root = createRoot(container);
@@ -92,19 +105,7 @@ inlineEditPost.edit = function (button, id) {
92105
};
93106
}
94107

95-
root.render(
96-
<FutureActionPanelQuickEdit
97-
storeName={storeName}
98-
postType={postType}
99-
isNewPost={isNewPost}
100-
actionsSelectOptions={actionsSelectOptions}
101-
is12Hour={is12Hour}
102-
startOfWeek={startOfWeek}
103-
strings={strings}
104-
taxonomyName={taxonomyName}
105-
nonce={nonce}
106-
/>
107-
);
108+
root.render(component);
108109

109110
inlineEditPost.revert = function () {
110111
root.unmount();
@@ -113,19 +114,6 @@ inlineEditPost.edit = function (button, id) {
113114
wpInlineEditRevert.apply(this, arguments);
114115
};
115116
} else {
116-
render(
117-
<FutureActionPanelQuickEdit
118-
storeName={storeName}
119-
postType={postType}
120-
isNewPost={isNewPost}
121-
actionsSelectOptions={actionsSelectOptions}
122-
is12Hour={is12Hour}
123-
startOfWeek={startOfWeek}
124-
strings={strings}
125-
taxonomyName={taxonomyName}
126-
nonce={nonce}
127-
/>,
128-
container
129-
);
117+
render(component, container);
130118
}
131119
};

assets/jsx/settings-post-types.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ const SettingsFormPanel = (props) => {
5555
};
5656

5757
const container = document.getElementById("publishpress-future-settings-post-types");
58-
58+
const component = (<SettingsFormPanel />);
5959
if (createRoot) {
60-
createRoot(container).render(<SettingsFormPanel />);
60+
createRoot(container).render(component);
6161
} else {
62-
render(<SettingsFormPanel />, container);
62+
render(component, container);
6363
}

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ Yes, the PublishPress Future plugin allows you to schedule automatic changes to
151151
* FIXED: Fix classic meta box when using Classic Editor plugin with the classic editor as default, #624;
152152
* FIXED: Fix default date for new posts, #623;
153153
* FIXED: Fix the quick edit form and future action column for pages, #618;
154+
* FIXED: Fix support for WP before 6.4, #625;
154155

155156
= [3.1.5] - 14 Dec, 2023 =
156157

0 commit comments

Comments
 (0)