Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
always give editor content focus by default (#748)
Browse files Browse the repository at this point in the history
closes TryGhost/Ghost#8525
- always give focus to the editor content area by default when loading
the editor
- change the editor placeholder text
  • Loading branch information
kevinansfield authored and cobbspur committed Jun 19, 2017
1 parent 95278f1 commit c297359
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 28 deletions.
5 changes: 1 addition & 4 deletions app/mixins/editor-base-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Mixin from 'ember-metal/mixin';
import PostModel from 'ghost-admin/models/post';
import RSVP from 'rsvp';
import boundOneWay from 'ghost-admin/utils/bound-one-way';
import computed, {alias, mapBy, reads} from 'ember-computed';
import computed, {mapBy, reads} from 'ember-computed';
import ghostPaths from 'ghost-admin/utils/ghost-paths';
import injectController from 'ember-controller/inject';
import injectService from 'ember-service/inject';
Expand Down Expand Up @@ -51,9 +51,6 @@ export default Mixin.create({
editor: null,
editorMenuIsOpen: false,

shouldFocusTitle: alias('model.isNew'),
shouldFocusEditor: false,

navIsClosed: reads('application.autoNav'),

init() {
Expand Down
11 changes: 0 additions & 11 deletions app/routes/editor/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ import base from 'ghost-admin/mixins/editor-base-route';
export default AuthenticatedRoute.extend(base, {
titleToken: 'Editor',

beforeModel(transition) {
this.set('_transitionedFromNew', transition.data.fromNew);

this._super(...arguments);
},

model(params) {
/* eslint-disable camelcase */
let query = {
Expand Down Expand Up @@ -42,11 +36,6 @@ export default AuthenticatedRoute.extend(base, {
});
},

setupController(controller) {
this._super(...arguments);
controller.set('shouldFocusEditor', this.get('_transitionedFromNew'));
},

actions: {
authorizationFailed() {
this.get('controller').send('toggleReAuthenticateModal');
Expand Down
10 changes: 0 additions & 10 deletions app/routes/editor/new.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,5 @@ export default AuthenticatedRoute.extend(base, {
controller,
model
});
},

actions: {
willTransition(transition) {
// decorate the transition object so the editor.edit route
// knows this was the previous active route
transition.data.fromNew = true;

this._super(...arguments);
}
}
});
5 changes: 2 additions & 3 deletions app/templates/editor/edit.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
--}}
{{#gh-markdown-editor
tabindex="2"
placeholder="Click here to start..."
autofocus=shouldFocusEditor
placeholder="Now begin writing your story..."
autofocus=true
uploadedImageUrls=editor.uploadedImageUrls
mobiledoc=(readonly model.scratch)
isFullScreen=editor.isFullScreen
Expand All @@ -54,7 +54,6 @@
class="gh-editor-title"
placeholder="Your Post Title"
tabindex="1"
shouldFocus=shouldFocusTitle
autoExpand=".gh-markdown-editor-pane"
focusOut=(action "saveTitle")
update=(action (perform updateTitle))
Expand Down

0 comments on commit c297359

Please sign in to comment.