1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-19 13:19:43 +02:00

Revert section title change on cancel operation

This commit is contained in:
McMatts 2018-04-26 12:01:58 +01:00
parent 7b619101f1
commit f21c80d960
2 changed files with 11 additions and 5 deletions

View file

@ -27,10 +27,16 @@ export default Component.extend(TooltipMixin, ModalMixin, {
return `page-editor-${page.id}`;
}),
previewText: 'Preview',
pageTitle: '',
didReceiveAttrs() {
this._super(...arguments);
this.set('pageTitle', this.get('page.title'));
},
didRender() {
this._super(...arguments);
let msContainer = document.getElementById('section-editor-' + this.get('containerId'));
let mousetrap = this.get('mousetrap');
if (is.null(mousetrap)) {
@ -69,7 +75,7 @@ export default Component.extend(TooltipMixin, ModalMixin, {
actions: {
onAction() {
if (this.get('busy') || is.empty(this.get('page.title'))) {
if (this.get('busy') || is.empty(this.get('pageTitle'))) {
return;
}
@ -78,7 +84,7 @@ export default Component.extend(TooltipMixin, ModalMixin, {
}
let cb = this.get('onAction');
cb(this.get('page.title'));
cb(this.get('pageTitle'));
},
onCancel() {

View file

@ -3,14 +3,14 @@
<div class="col-8 section-editor">
{{#if blockMode}}
<div class="form-group">
{{focus-input id="page-id-{{pageId}}" value=page.title class=(if hasNameError 'form-control mousetrap form-control-lg edit-title is-invalid' 'form-control form-control-lg edit-title mousetrap') placeholder="Enter name"}}
{{focus-input id="page-id-{{pageId}}" value=pageTitle class=(if hasNameError 'form-control mousetrap form-control-lg edit-title is-invalid' 'form-control form-control-lg edit-title mousetrap') placeholder="Enter name"}}
</div>
<div class="form-group">
{{textarea id="page-excerpt-{{pageId}}" value=page.excerpt rows="2" class=(if hasDescError 'form-control mousetrap form-control-lg edit-title is-invalid' 'form-control form-control-lg edit-title mousetrap') placeholder="Enter description"}}
</div>
{{else}}
<div class="form-group">
{{focus-input type="text" id=pageId value=page.title class=(if hasNameError 'form-control mousetrap form-control-lg edit-title is-invalid' 'form-control form-control-lg edit-title mousetrap') placeholder="Enter name"}}
{{focus-input type="text" id=pageId value=pageTitle class=(if hasNameError 'form-control mousetrap form-control-lg edit-title is-invalid' 'form-control form-control-lg edit-title mousetrap') placeholder="Enter name"}}
</div>
{{/if}}
</div>