diff --git a/ghost/admin/app/components/gh-koenig-editor-lexical.hbs b/ghost/admin/app/components/gh-koenig-editor-lexical.hbs index 38a52d3fab..9526ed31d6 100644 --- a/ghost/admin/app/components/gh-koenig-editor-lexical.hbs +++ b/ghost/admin/app/components/gh-koenig-editor-lexical.hbs @@ -42,6 +42,7 @@ @onChange={{@onBodyChange}} @registerAPI={{this.registerEditorAPI}} @cursorDidExitAtTop={{this.focusTitle}} + @updateWordCount={{@updateWordCount}} /> {{!-- { return <_KoenigEditor {...props} />; }; +const WordCountPlugin = (props) => { + const {WordCountPlugin: _WordCountPlugin} = editorResource.read(); + return <_WordCountPlugin {...props} />; +}; + export default class KoenigLexicalEditor extends Component { @service ajax; @service feature; @@ -503,6 +508,7 @@ export default class KoenigLexicalEditor extends Component { onChange={this.args.onChange} registerAPI={this.args.registerAPI} /> + diff --git a/ghost/admin/app/controllers/lexical-editor.js b/ghost/admin/app/controllers/lexical-editor.js index 22ab2e6602..bce22d4d1a 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 { fromAnalytics = false; // koenig related properties - wordcount = null; + wordCount = 0; /* private properties ----------------------------------------------------*/ @@ -305,8 +305,8 @@ export default class LexicalEditorController extends Controller { } @action - updateWordCount(counts) { - this.set('wordCount', counts); + updateWordCount(count) { + this.set('wordCount', count); } @action diff --git a/ghost/admin/app/templates/lexical-editor.hbs b/ghost/admin/app/templates/lexical-editor.hbs index 972cf3b187..050372997b 100644 --- a/ghost/admin/app/templates/lexical-editor.hbs +++ b/ghost/admin/app/templates/lexical-editor.hbs @@ -75,7 +75,7 @@ @scrollContainerSelector=".gh-koenig-editor" @scrollOffsetBottomSelector=".gh-mobile-nav-bar" @onEditorCreated={{this.setKoenigEditor}} - @onWordCountChange={{this.updateWordCount}} + @updateWordCount={{this.updateWordCount}} @featureImage={{this.post.featureImage}} @featureImageAlt={{this.post.featureImageAlt}} @featureImageCaption={{this.post.featureImageCaption}} @@ -98,9 +98,9 @@ {{/if}}
- {{!--
- {{gh-pluralize this.wordCount.wordCount "word"}} -
--}} +
+ {{gh-pluralize this.wordCount "word"}} +
{{!-- Lexical --}} {{svg-jar "help"}}