Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Title bar for Windows & Linux #759

Merged
merged 19 commits into from
Mar 4, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix observable template
  • Loading branch information
haraldox committed Feb 21, 2018
commit fd36235fe44dd9c57669e1f529b9bb56774ece6b
1 change: 0 additions & 1 deletion src/components/layout/AppLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { TitleBar } from 'electron-react-titlebar';

import InfoBar from '../ui/InfoBar';
import globalMessages from '../../i18n/globalMessages';
import Menu from '../../lib/Menu';

function createMarkup(HTMLString) {
return { __html: HTMLString };
Expand Down
8 changes: 5 additions & 3 deletions src/lib/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ const template = [

export default class FranzMenu {
@observable tpl = template;
@observable template = null;

constructor(stores, actions) {
this.stores = stores;
Expand All @@ -124,12 +125,12 @@ export default class FranzMenu {
autorun(this._build.bind(this));
}

@computed get template() {
return toJS(this.tpl);
get template() {
return this.template;
}

_build() {
const tpl = this.template;
const tpl = toJS(this.tpl);

tpl[1].submenu.push({
role: 'toggledevtools',
Expand Down Expand Up @@ -252,6 +253,7 @@ export default class FranzMenu {
tpl[isMac ? 3 : 2].submenu = toJS(this.serviceTpl);
}

this.template = tpl;
const menu = Menu.buildFromTemplate(tpl);
Menu.setApplicationMenu(menu);
}
Expand Down