fix feedback

This commit is contained in:
2018-11-25 11:52:05 +01:00
parent 3a53121fe2
commit 89da622919
6 changed files with 37 additions and 22 deletions

View File

@@ -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>

View File

@@ -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()

View File

@@ -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;
@@ -308,6 +316,11 @@ class Editor {
this.$NextBtn = $('.next');
this.onKeyStroke = function(){};
//Date format
ThoughtDate.blotName = 'thought_date';
ThoughtDate.tagName = 'div';
Quill.register(ThoughtDate);
this.oQuill = new Quill('#'+sEditorId, {
theme: 'bubble',
@@ -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)

View File

@@ -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