From 4b1f61f9473fd98a247b82292dbfe63716cbf9d8 Mon Sep 17 00:00:00 2001 From: Steve Larson <9larsons@gmail.com> Date: Wed, 22 Nov 2023 13:12:50 -0600 Subject: [PATCH] Wired up TK count to confirmation flow (#19107) closes TryGhost/Product#4185 - display TK count in the TK reminder/confirmation modal --- .../editor/modals/publish-flow/tk-reminder.hbs | 2 +- ghost/admin/app/components/koenig-lexical-editor.js | 2 +- ghost/admin/app/controllers/lexical-editor.js | 12 ++---------- ghost/admin/package.json | 2 +- yarn.lock | 8 ++++---- 5 files changed, 9 insertions(+), 17 deletions(-) diff --git a/ghost/admin/app/components/editor/modals/publish-flow/tk-reminder.hbs b/ghost/admin/app/components/editor/modals/publish-flow/tk-reminder.hbs index d1df224b19..cbf93d846b 100644 --- a/ghost/admin/app/components/editor/modals/publish-flow/tk-reminder.hbs +++ b/ghost/admin/app/components/editor/modals/publish-flow/tk-reminder.hbs @@ -2,7 +2,7 @@
Forget something?

- Looks like you've got some unfinished business. There are {{@tkCount}} TK reminders left in your post. + Looks like you've got some unfinished business. There {{if (eq @tkCount 1) "is" "are" }} {{gh-pluralize @tkCount "TK reminder"}} left in your post.

diff --git a/ghost/admin/app/components/koenig-lexical-editor.js b/ghost/admin/app/components/koenig-lexical-editor.js index 5f6238ef6a..e46d69efbc 100644 --- a/ghost/admin/app/components/koenig-lexical-editor.js +++ b/ghost/admin/app/components/koenig-lexical-editor.js @@ -536,7 +536,7 @@ export default class KoenigLexicalEditor extends Component { registerAPI={this.args.registerAPI} /> - {this.feature.tkReminders && } + {this.feature.tkReminders && } diff --git a/ghost/admin/app/controllers/lexical-editor.js b/ghost/admin/app/controllers/lexical-editor.js index 44684f6903..a85e31b9c6 100644 --- a/ghost/admin/app/controllers/lexical-editor.js +++ b/ghost/admin/app/controllers/lexical-editor.js @@ -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 diff --git a/ghost/admin/package.json b/ghost/admin/package.json index d71abd1e75..8de0616b5b 100644 --- a/ghost/admin/package.json +++ b/ghost/admin/package.json @@ -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", diff --git a/yarn.lock b/yarn.lock index 39f2b44cd4..6281ce50a0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"