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

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