-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Toggle Distributor controls when post status changes #1022
Changes from 3 commits
fd7761a
f384c5d
8a66886
3367955
f538b9d
e66b2f8
b0aa889
d9f355a
9031503
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4,7 +4,7 @@ import jQuery from 'jquery'; | |||||
import _ from 'underscore'; | ||||||
import Mustache from 'mustache'; | ||||||
|
||||||
const { document, dt } = window; | ||||||
const { document, dt, dtGutenberg } = window; | ||||||
|
||||||
let selectedConnections = {}, | ||||||
searchString = ''; | ||||||
|
@@ -344,9 +344,14 @@ jQuery( window ).on( 'load', () => { | |||||
// Determine if we need to hide the admin bar | ||||||
maybeHideAdminBar(); | ||||||
|
||||||
if ( distributorPushWrapper.classList.contains( 'loaded' ) ) { | ||||||
// If the post title has changed, we need to reload the template. | ||||||
if ( | ||||||
distributorPushWrapper.classList.contains( 'loaded' ) && | ||||||
dtGutenberg.postTitle === dtGutenberg.previousPostTitle | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
) { | ||||||
return; | ||||||
} | ||||||
dtGutenberg.previousPostTitle = dtGutenberg.postTitle; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
distributorPushWrapper.classList.remove( 'message-error' ); | ||||||
distributorPushWrapper.classList.add( 'loaded' ); | ||||||
|
@@ -394,13 +399,15 @@ jQuery( window ).on( 'load', () => { | |||||
connections: mustacheData.connections, | ||||||
foundConnections: mustacheData.connections.length, | ||||||
showSearch: 5 < mustacheData.connections.length, | ||||||
postTitle: dtGutenberg.postTitle, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} | ||||||
); | ||||||
|
||||||
setDisabledConnections(); | ||||||
} else { | ||||||
distributorPushWrapper.innerHTML = template( { | ||||||
connections: dtConnections, | ||||||
postTitle: dtGutenberg.postTitle, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} ); | ||||||
} | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,7 @@ | |
}, | ||
"scripts": { | ||
"build": "wp-scripts build", | ||
"watch": "wp-scripts build --watch", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Did you add this because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I didn't realize Do you want me to remove this or alias it to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Let's remove it for now. I'll review our other open-source plugins for the common names, whether it be |
||
"build:docs": "rm -rf docs-built && jsdoc -c hookdoc-conf.json distributor.php includes", | ||
"check-engines": "wp-scripts check-engines", | ||
"check-licenses": "wp-scripts check-licenses", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is strange. If I modify the
const { document, dtGutenberg, MouseEvent } = window;
line and change it toconst { document, dtGutenberg, MouseEvent, dt } = window;
,dt
is undefined. However if I don't make that modification I'm able to reference it in code directly viadt.postTitle
orwindow.dt.postTitle
. Going withwindow.dt.postTitle
for now as it's more explicit and doesn't require an eslint exception, but please let me know if you have a better suggestion.