Add user id to docs/todos/notes tables

This commit is contained in:
2019-09-07 12:38:37 +02:00
parent 81a17332b4
commit 42c6f8eff7
6 changed files with 97 additions and 55 deletions

View File

@@ -277,12 +277,8 @@ function CATC(asGlobals)
};
}
class Editor {
constructor(sEditorId, bReadOnly) {
this.id = 0;
this.keystrokes = 0;
this.readOnly = bReadOnly || false;
this.sCursorPos = '';
@@ -290,7 +286,7 @@ class Editor {
//DOM Elements
this.$Editor = $(sEditorId);
this.onKeyStroke = function(e){};
this.onKeyStroke = function() {};
this.oQuill = new Quill(sEditorId, {
theme: 'snow',
@@ -319,18 +315,6 @@ class Editor {
if(!this.readOnly) this.oQuill.focus();
}
open(iCourseId) {
Tools.ajax(
'get_note',
(asData) => {
this.id = asData.id;
this.oQuill.setContents(asData.ops);
this._postInit();
},
{id: iCourseId}
);
}
_incKeyStrokes() {
this.keystrokes += 1;
}
@@ -339,6 +323,11 @@ class Editor {
return this.oQuill.getContents().ops;
}
setContent(asOps) {
this.oQuill.setContents(asOps);
this._postInit();
}
isEmpty() {
const rEmpty = /^(<p>(<br>|<br\/>|<br\s\/>|\s+|)<\/p>|)$/gm;
return rEmpty.test(this.oQuill.getText().trim());