fix write page

This commit is contained in:
francois
2018-04-09 22:01:42 +02:00
parent ab12b33532
commit 76faf824fc
13 changed files with 445 additions and 398 deletions

View File

@@ -47,8 +47,8 @@
{insert: '\n'},
{insert: "In-extremist, I manage to babble some excuses about a rigorous lunch break time and leave the premises."}
]);*/
oQuill.setContents([{insert:self.vars('default_text')}]);
setLastContent();
setPageHeight();
//Key strokes Events
@@ -96,6 +96,21 @@
self.vars('page_height', iMaxHeight);
}
function setLastContent(oQuill)
{
getInfo
(
'load',
function(sDesc, asData)
{
self.vars('id', asData.id);
oQuill.setContents(asData.ops);
},
{id: 'last'}
);
}
function onChange(delta, oldDelta, source, e)
{
if(source == 'user')
@@ -170,8 +185,7 @@
function incKeyStrokes()
{
self.vars('keystrokes', self.vars('keystrokes') + 1);
if(self.vars('keystrokes') % 10) save();
if(self.vars('keystrokes') % 20 == 0) save();
}
function save()
@@ -183,12 +197,15 @@
getInfo
(
'update',
function(asData)
function(sDesc, asData)
{
self.vars('id', asData.id_thought);
self.vars('id', asData.id);
oMyThoughts.onFeedback('notice', 'Saved ('+asData.led.substr(11, 5)+')');
},
{content:sContent, id:self.vars('id')},
{
id: self.vars('id'),
content: sContent
},
function(sError)
{
oMyThoughts.onFeedback('error', 'Not saved! An error occured: '+sError);