0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Wired up TK count to confirmation flow (#19107)

closes TryGhost/Product#4185
- display TK count in the TK reminder/confirmation modal
This commit is contained in:
Steve Larson 2023-11-22 13:12:50 -06:00 committed by GitHub
parent 4f518153aa
commit 4b1f61f947
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 17 deletions

View file

@ -2,7 +2,7 @@
<div>Forget something?</div>
</div>
<p class="gh-publish-confirmation">
Looks like you've got some unfinished business. There are <strong>{{@tkCount}} TK reminders</strong> left in your post.
Looks like you've got some unfinished business. There {{if (eq @tkCount 1) "is" "are" }} <strong>{{gh-pluralize @tkCount "TK reminder"}}</strong> left in your post.
</p>
<div class="gh-publish-cta">

View file

@ -536,7 +536,7 @@ export default class KoenigLexicalEditor extends Component {
registerAPI={this.args.registerAPI}
/>
<WordCountPlugin editorResource={this.editorResource} onChange={this.args.updateWordCount} />
{this.feature.tkReminders && <TKPlugin editorResource={this.editorResource} onCountChange={this.args.updateTkCount} />}
{this.feature.tkReminders && <TKPlugin editorResource={this.editorResource} setTkCount={this.args.updateTkCount} />}
</KoenigComposer>
</Suspense>
</ErrorHandler>

View file

@ -127,7 +127,7 @@ export default class LexicalEditorController extends Controller {
// koenig related properties
wordCount = 0;
tkCount = this.getRandomTkCount(); // TODO: set to 0 once onCountChange is wired up
tkCount = 0;
/* private properties ----------------------------------------------------*/
@ -135,14 +135,6 @@ export default class LexicalEditorController extends Controller {
_saveOnLeavePerformed = false;
_previousTagNames = null; // set by setPost and _postSaved, used in hasDirtyAttributes
// TODO: remove once onCountChange is wired up
getRandomTkCount() {
if (!this.feature.tkReminders) {
return 0;
}
return Math.ceil(Math.random() * 10);
}
/* computed properties ---------------------------------------------------*/
@alias('model')
@ -1090,7 +1082,7 @@ export default class LexicalEditorController extends Controller {
this.set('shouldFocusTitle', false);
this.set('showSettingsMenu', false);
this.set('wordCount', 0);
this.set('tkCount', this.getRandomTkCount()); // TODO: set to 0 once onCountChange is wired up
this.set('tkCount', 0);
// remove the onbeforeunload handler as it's only relevant whilst on
// the editor route

View file

@ -46,7 +46,7 @@
"@tryghost/helpers": "1.1.88",
"@tryghost/kg-clean-basic-html": "3.0.41",
"@tryghost/kg-converters": "0.0.22",
"@tryghost/koenig-lexical": "0.5.22",
"@tryghost/koenig-lexical": "0.5.23",
"@tryghost/limit-service": "1.2.12",
"@tryghost/members-csv": "0.0.0",
"@tryghost/nql": "0.12.0",

View file

@ -7932,10 +7932,10 @@
dependencies:
semver "^7.3.5"
"@tryghost/koenig-lexical@0.5.22":
version "0.5.22"
resolved "https://registry.yarnpkg.com/@tryghost/koenig-lexical/-/koenig-lexical-0.5.22.tgz#194c18c36231d1cccd6f728662a6635ca973451c"
integrity sha512-10CVHkRexwGgVrLlT+Xwgvr9Q2FdvX7mtX/ugV3mOCY3XoeqsN12cTFugwugEF2JRPDOMweXI5FfRBCsPLXufQ==
"@tryghost/koenig-lexical@0.5.23":
version "0.5.23"
resolved "https://registry.yarnpkg.com/@tryghost/koenig-lexical/-/koenig-lexical-0.5.23.tgz#6e6be97a364f3386181dd3a7c4e398eecaba1745"
integrity sha512-tUhu5cvQq8T6GvVHTi7CPFWGUELrMtO4GSgYVI3Rbb9u1NGN3uwWhuQjS0RI68fZIb5DlD81NmJbTK8eHV8ljw==
"@tryghost/limit-service@1.2.12", "@tryghost/limit-service@^1.2.10":
version "1.2.12"