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