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

Commit

Permalink
🎨 Adjusted post settings menu design so it can stay open whilst editing
Browse files Browse the repository at this point in the history
refs TryGhost/Product#840

We wanted to switch to a settings menu that stays open to the right of the editor rather than a popover that blocks all other interaction with the post to solve two use-cases:

1.  when editing it's fairly common to select some text from the post contents when setting excerpt and meta data text, with the previous design not letting you scroll or select whilst the menu got in the way of that
2. having the menu open with meta data visible before publishing can help you see everything is set as you want and help you feel confident when publishing/sending content

---

- removed `psmRedesign` labs flag
- swapped labs component/css for main component and deleted labs component
- cleaned up now-unused `ui.showSettingsMenu` property and related actions/classes
  • Loading branch information
kevinansfield committed Jul 2, 2021
1 parent 9a391a5 commit fb5e083
Show file tree
Hide file tree
Showing 18 changed files with 193 additions and 1,424 deletions.
2 changes: 1 addition & 1 deletion app/components/gh-app.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div class="gh-app" {{did-insert this.setBodyClass}} {{did-update this.setBodyClass @showSettingsMenu}} ...attributes>
<div class="gh-app" ...attributes>
{{yield}}
</div>
9 changes: 0 additions & 9 deletions app/components/gh-app.js

This file was deleted.

1 change: 0 additions & 1 deletion app/components/gh-editor.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{{yield (hash
headerClass=this.headerClass
headerHeight=this.headerHeight
isDraggedOver=this.isDraggedOver
isFullScreen=this.isFullScreen
Expand Down
55 changes: 0 additions & 55 deletions app/components/gh-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export default Component.extend({

// Internal attributes
droppedFiles: null,
headerClass: '',
headerHeight: 0,
imageExtensions: IMAGE_EXTENSIONS,
imageMimeTypes: IMAGE_MIME_TYPES,
Expand All @@ -33,29 +32,10 @@ export default Component.extend({
_onResizeHandler: null,
_viewActionsWidth: 190,

init() {
this._super(...arguments);
this._onResizeHandler = (evt) => {
debounce(this, this._setHeaderClass, evt, 100);
};
},

didInsertElement() {
this._super(...arguments);
window.addEventListener('resize', this._onResizeHandler);
this._setHeaderClass();
},

willDestroyElement() {
this._super(...arguments);
window.removeEventListener('resize', this._onResizeHandler);
},

actions: {
toggleFullScreen(isFullScreen) {
this.set('isFullScreen', isFullScreen);
this.ui.set('isFullScreen', isFullScreen);
run.scheduleOnce('afterRender', this, this._setHeaderClass);
},

togglePreview(isPreview) {
Expand All @@ -64,7 +44,6 @@ export default Component.extend({

toggleSplitScreen(isSplitScreen) {
this.set('isSplitScreen', isSplitScreen);
run.scheduleOnce('afterRender', this, this._setHeaderClass);
},

uploadImages(fileList, resetInput) {
Expand All @@ -85,40 +64,6 @@ export default Component.extend({
}
},

_setHeaderClass() {
if (this.feature.psmRedesign) {
return;
}

let editorTitle = this.element.querySelector('.gh-editor-title, .kg-title-input');
let smallHeaderClass = 'gh-editor-header-small';
let newHeaderClass = '';

this._editorTitleElement = editorTitle;

if (this.isSplitScreen) {
this.set('headerClass', smallHeaderClass);
return;
}

if (editorTitle) {
let boundingRect = editorTitle.getBoundingClientRect();
let maxRight = window.innerWidth - this._viewActionsWidth;

if (boundingRect.right >= maxRight) {
newHeaderClass = smallHeaderClass;
}
}

if (newHeaderClass !== this.headerClass) {
// grab height of header so that we can pass it as an offset to other
// editor components
run.scheduleOnce('afterRender', this, this._setHeaderHeight);
}

this.set('headerClass', newHeaderClass);
},

_setHeaderHeight() {
if (this.headerClass && this._editorTitleElement) {
let height = this._editorTitleElement.offsetHeight;
Expand Down
467 changes: 0 additions & 467 deletions app/components/gh-post-settings-menu-labs.hbs

This file was deleted.

0 comments on commit fb5e083

Please sign in to comment.