1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-28 09:39:42 +02:00

all new markdown experience

This commit is contained in:
Harvey Kandola 2017-02-28 13:43:46 +00:00
parent 9d720a1c65
commit b8a0444f18
6 changed files with 122 additions and 46 deletions

View file

@ -18,7 +18,6 @@ const {
export default Ember.Component.extend({
drop: null,
tip: "Short and concise title",
busy: false,
hasNameError: computed.empty('page.title'),
@ -26,6 +25,14 @@ export default Ember.Component.extend({
let page = this.get('page');
return `page-editor-${page.id}`;
}),
cancelId: Ember.computed('page', function () {
let page = this.get('page');
return `cancel-edits-button-${page.id}`;
}),
dialogId: Ember.computed('page', function () {
let page = this.get('page');
return `discard-edits-dialog-${page.id}`;
}),
didRender() {
let self = this;
@ -54,16 +61,16 @@ export default Ember.Component.extend({
actions: {
onCancel() {
if (this.attrs.isDirty() !== null && this.attrs.isDirty()) {
$(".discard-edits-dialog").css("display", "block");
let page = this.get('page');
$('#' + this.get('dialogId')).css("display", "block");
let drop = new Drop({
target: $("#editor-cancel" + page.get('id'))[0],
content: $(".cancel-edits-dialog-" + page.get('id'))[0],
target: $('#' + this.get('cancelId'))[0],
content: $('#' + this.get('dialogId'))[0],
classes: 'drop-theme-basic',
position: "bottom right",
openOn: "always",
constrainToWindow: true,
constrainToScrollParent: false,
tetherOptions: {
offset: "5px 0",
targetOffset: "10px 0"
@ -80,11 +87,7 @@ export default Ember.Component.extend({
},
onAction() {
if (this.get('busy')) {
return;
}
if (is.empty(this.get('page.title'))) {
if (this.get('busy') || is.empty(this.get('page.title'))) {
return;
}