fix feedback
This commit is contained in:
@@ -3,9 +3,11 @@
|
||||
oMyThoughts.pageInit = function(asHash, bFirstPage) {
|
||||
oEditor = new Editor('#read', true);
|
||||
oEditor.open(asHash.items[0]);
|
||||
}
|
||||
};
|
||||
|
||||
oMyThoughts.onSamePageMove = function(asHash) {
|
||||
return true;
|
||||
}
|
||||
$('#read').empty();
|
||||
self.pageInit(self.getHash());
|
||||
return false;
|
||||
};
|
||||
</script>
|
||||
@@ -16,15 +16,15 @@
|
||||
|
||||
oMyThoughts.onFeedback = function(sType, sMsg)
|
||||
{
|
||||
var $Feedback = $('#edi_feedback');
|
||||
$Feedback
|
||||
.stop()
|
||||
.fadeOut($Feedback.is(':empty')?0:'fast', function(){
|
||||
var $Feedback = $('#write_feedback').stop();
|
||||
if(sMsg != $Feedback.find('span').text()) {
|
||||
$Feedback.fadeOut($Feedback.is(':empty')?0:'fast', function(){
|
||||
$(this)
|
||||
.empty()
|
||||
.append($('<span>', {'class':sType}).text(sMsg))
|
||||
.fadeIn('fast');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
oMyThoughts.onQuitPage = function()
|
||||
|
||||
@@ -290,6 +290,14 @@ function MyThoughts(asGlobals)
|
||||
};
|
||||
}
|
||||
|
||||
class ThoughtDate extends Quill.import('blots/inline') {
|
||||
static create(value) {
|
||||
let node = super.create();
|
||||
node.setAttribute('class', 'edi_header');
|
||||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
class Editor {
|
||||
constructor(sContainerId, bReadOnly) {
|
||||
this.id = 0;
|
||||
@@ -309,6 +317,11 @@ class Editor {
|
||||
|
||||
this.onKeyStroke = function(){};
|
||||
|
||||
//Date format
|
||||
ThoughtDate.blotName = 'thought_date';
|
||||
ThoughtDate.tagName = 'div';
|
||||
Quill.register(ThoughtDate);
|
||||
|
||||
this.oQuill = new Quill('#'+sEditorId, {
|
||||
theme: 'bubble',
|
||||
placeholder: 'What\'s on your mind?',
|
||||
@@ -341,9 +354,11 @@ class Editor {
|
||||
}
|
||||
|
||||
setHeader(sHeader) {
|
||||
this.$Header
|
||||
.toggle(this.readOnly)
|
||||
.text(sHeader);
|
||||
this.$Editor.find('.edi_header').remove();
|
||||
if(this.readOnly) {
|
||||
this.oQuill.insertText(0, sHeader+"\n");
|
||||
this.oQuill.formatText(0, sHeader.length, 'thought_date', true);
|
||||
}
|
||||
}
|
||||
|
||||
open(iThoughtId) {
|
||||
@@ -351,8 +366,8 @@ class Editor {
|
||||
'load',
|
||||
(asData) => {
|
||||
this.id = asData.id;
|
||||
this.setHeader('Thoughts on '+asData.created_f);
|
||||
this.oQuill.setContents(asData.ops);
|
||||
this.setHeader('Thoughts on '+asData.created_f);
|
||||
this._postInit();
|
||||
},
|
||||
{id: iThoughtId}
|
||||
@@ -463,8 +478,6 @@ class Editor {
|
||||
var iContentHeight = this.$Editor.height();
|
||||
var iLastPage = Math.floor(iContentHeight / this.pageHeight);
|
||||
|
||||
console.log(iLastPage);
|
||||
|
||||
if(iNewPage == 'last') iNewPage = iLastPage;
|
||||
|
||||
if(iNewPage >= 0 && iNewPage <= iLastPage)
|
||||
|
||||
@@ -9,14 +9,8 @@
|
||||
position: relative;
|
||||
height:100%;
|
||||
|
||||
.edi_header {
|
||||
color: $gray-500;
|
||||
font-size: 0.8em;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
.edi_container {
|
||||
height: calc(100% - 4em); /* 2 * 2em*/
|
||||
height: calc(100% - 2em); /* 2 * 2em*/
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
|
||||
@@ -36,6 +30,12 @@
|
||||
|
||||
div {
|
||||
margin: 0;
|
||||
|
||||
&.edi_header {
|
||||
color: $gray-500;
|
||||
font-style: italic;
|
||||
line-height: 3em;
|
||||
}
|
||||
}
|
||||
|
||||
p {
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user