From a5dd92f1b8863e32537aa02b0635c3913d7e5c49 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Thu, 27 May 2021 18:06:35 +0100 Subject: [PATCH] Changed editor title input to treat '(Untitled)' as blank refs https://github.com/TryGhost/Team/issues/707 - the switch to a hard `'(Untitled)'` when you start typing is jarring and pulls you away from writing to want to set a title - by changing the input to treat '(Untitled)' as a blank value the placeholder continues to be shown so flow isn't broken. Post validation and title display elsewhere in the app is unaffected because we're still setting `'(Untitled')` under the hood, it's only the editor display that changes --- ghost/admin/app/components/gh-koenig-editor.hbs | 2 +- ghost/admin/app/components/gh-koenig-editor.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ghost/admin/app/components/gh-koenig-editor.hbs b/ghost/admin/app/components/gh-koenig-editor.hbs index a0bcd3b89f..72cceb127d 100644 --- a/ghost/admin/app/components/gh-koenig-editor.hbs +++ b/ghost/admin/app/components/gh-koenig-editor.hbs @@ -10,7 +10,7 @@ @placeholder={{@titlePlaceholder}} @tabindex="1" @autoExpand=".gh-koenig-editor" - @value={{readonly @title}} + @value={{readonly this.title}} @input={{this.updateTitle}} @focus-out={{optional @onTitleBlur}} @keyDown={{this.onTitleKeydown}} diff --git a/ghost/admin/app/components/gh-koenig-editor.js b/ghost/admin/app/components/gh-koenig-editor.js index 7e1f4e993c..647f8b3606 100644 --- a/ghost/admin/app/components/gh-koenig-editor.js +++ b/ghost/admin/app/components/gh-koenig-editor.js @@ -7,6 +7,10 @@ export default class GhKoenigEditorComponent extends Component { koenigEditor = null; mousedownY = 0; + get title() { + return this.args.title === '(Untitled)' ? '' : this.args.title; + } + @action registerElement(element) { this.containerElement = element;