Clean up markdown help toggle

no issue

The markdown help link was removed from the sidebar so the only link to toggle the markdown help modal is now the markdown editor yet we we still had a more general implementation with a confusing pass-through of closure actions.

- move the markdown modal toggle and display into the `{{gh-markdown-editor}}` component
This commit is contained in:
Kevin Ansfield 2017-11-24 10:41:09 +00:00
parent d33cfdac30
commit d982f7b520
7 changed files with 13 additions and 24 deletions

View File

@ -44,6 +44,7 @@ export default Component.extend(ShortcutsMixin, {
mobiledoc: null, mobiledoc: null,
options: null, options: null,
placeholder: '', placeholder: '',
showMarkdownHelp: false,
uploadedImageUrls: null, uploadedImageUrls: null,
// Closure actions // Closure actions
@ -52,7 +53,6 @@ export default Component.extend(ShortcutsMixin, {
onImageFilesSelected() {}, onImageFilesSelected() {},
onPreviewToggle() {}, onPreviewToggle() {},
onSplitScreenToggle() {}, onSplitScreenToggle() {},
showMarkdownHelp() {},
// Internal attributes // Internal attributes
markdown: null, markdown: null,
@ -132,7 +132,7 @@ export default Component.extend(ShortcutsMixin, {
{ {
name: 'guide', name: 'guide',
action: () => { action: () => {
this.showMarkdownHelp(); this.send('toggleMarkdownHelp');
}, },
className: 'fa fa-question-circle', className: 'fa fa-question-circle',
title: 'Markdown Guide' title: 'Markdown Guide'
@ -605,6 +605,10 @@ export default Component.extend(ShortcutsMixin, {
this._toggleHemingway(); this._toggleHemingway();
}, },
toggleMarkdownHelp() {
this.toggleProperty('showMarkdownHelp');
},
// put the toolbar/statusbar elements back so that SimpleMDE doesn't throw // put the toolbar/statusbar elements back so that SimpleMDE doesn't throw
// errors when it tries to remove them // errors when it tries to remove them
destroyEditor() { destroyEditor() {

View File

@ -78,11 +78,5 @@ export default Component.extend({
iconUrl += `?t=${(new Date()).valueOf()}`; iconUrl += `?t=${(new Date()).valueOf()}`;
this.set('iconStyle', htmlSafe(`background-image: url(${iconUrl})`)); this.set('iconStyle', htmlSafe(`background-image: url(${iconUrl})`));
},
actions: {
showMarkdownHelp() {
this.sendAction('showMarkdownHelp');
}
} }
}); });

View File

@ -20,7 +20,6 @@ export default Controller.extend({
}), }),
topNotificationCount: 0, topNotificationCount: 0,
showMarkdownHelpModal: false,
actions: { actions: {
topNotificationChange(count) { topNotificationChange(count) {

View File

@ -205,10 +205,6 @@ export default Route.extend(ApplicationRouteMixin, ShortcutsRoute, {
} }
}, },
toggleMarkdownHelpModal() {
this.get('controller').toggleProperty('showMarkdownHelpModal');
},
// noop default for unhandled save (used from shortcuts) // noop default for unhandled save (used from shortcuts)
save: K, save: K,

View File

@ -5,10 +5,7 @@
<div class="gh-viewport {{if ui.autoNav 'gh-autonav'}} {{if ui.showSettingsMenu 'settings-menu-expanded'}} {{if ui.showMobileMenu 'mobile-menu-expanded'}}"> <div class="gh-viewport {{if ui.autoNav 'gh-autonav'}} {{if ui.showSettingsMenu 'settings-menu-expanded'}} {{if ui.showMobileMenu 'mobile-menu-expanded'}}">
{{#if showNavMenu}} {{#if showNavMenu}}
{{gh-nav-menu {{gh-nav-menu open=ui.autoNavOpen}}
open=ui.autoNavOpen
icon=settings.settledIcon
showMarkdownHelp="toggleMarkdownHelpModal"}}
{{/if}} {{/if}}
{{#gh-main onMouseEnter=(action "closeAutoNav" target=ui) data-notification-count=topNotificationCount}} {{#gh-main onMouseEnter=(action "closeAutoNav" target=ui) data-notification-count=topNotificationCount}}
@ -24,10 +21,4 @@
</div>{{!gh-viewport}} </div>{{!gh-viewport}}
{{/gh-app}} {{/gh-app}}
{{#if showMarkdownHelpModal}}
{{gh-fullscreen-modal "markdown-help"
close=(route-action "toggleMarkdownHelpModal")
modifier="wide"}}
{{/if}}
{{ember-load-remover}} {{ember-load-remover}}

View File

@ -23,3 +23,9 @@
insert=(action "insertUnsplashPhoto") insert=(action "insertUnsplashPhoto")
close=(action "toggleUnsplash")}} close=(action "toggleUnsplash")}}
{{/if}} {{/if}}
{{#if showMarkdownHelp}}
{{gh-fullscreen-modal "markdown-help"
close=(action "toggleMarkdownHelp")
modifier="wide"}}
{{/if}}

View File

@ -47,7 +47,6 @@
onPreviewToggle=(action editor.togglePreview) onPreviewToggle=(action editor.togglePreview)
onSplitScreenToggle=(action editor.toggleSplitScreen) onSplitScreenToggle=(action editor.toggleSplitScreen)
onImageFilesSelected=(action editor.uploadImages) onImageFilesSelected=(action editor.uploadImages)
showMarkdownHelp=(route-action "toggleMarkdownHelpModal")
imageMimeTypes=editor.imageMimeTypes imageMimeTypes=editor.imageMimeTypes
as |markdown| as |markdown|
}} }}