diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e7d26470..056382470 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Alignment issue in Abacus #1607 - Blank screen on iOS when opening a PDF #1618 - Journal instance pop up remain after launching a PDF or an external app #1619 +- Welcome message not displayed in Write activity #1617 ## [1.8.0] - 2024-04-10 ### Added diff --git a/activities/Write.activity/js/activity.js b/activities/Write.activity/js/activity.js index 9eac96b20..664dbf042 100644 --- a/activities/Write.activity/js/activity.js +++ b/activities/Write.activity/js/activity.js @@ -79,56 +79,55 @@ define([ document.getElementById(20).title = l10n.get("ExportToPdf"); document.getElementById(21).title = l10n.get("ExportToDoc"); document.getElementById(22).title = l10n.get("ExportToOdt"); - }); - - if (!environment.objectId && !environment.sharedId) { - // New instance - // Intentionally added setTimeout to allow locale.ini file to be loaded - setTimeout(function(){ - editor.setContents([ - {insert: l10n.get('Welcome',{username: environment.user.name}) + '\n' , attributes: { size: "40px" , color : environment.user.colorvalue.stroke , bold: true }}, - ]); - var length = editor.getLength(); - editor.clipboard.dangerouslyPasteHTML(length,l10n.get('Write')); - length = editor.getLength(); - editor.clipboard.dangerouslyPasteHTML(length,l10n.get('Writefeatures')); - length = editor.getLength(); - editor.clipboard.dangerouslyPasteHTML(length,l10n.get('Enjoy')); - length = editor.getLength(); - editor.clipboard.dangerouslyPasteHTML(length,"

"); - length = editor.getLength(); - editor.updateContents( - new Delta() - .retain(editor.getSelection().index+1) - .insert({ - image: window.initialImageDataUrl - }) - ); - },200); - } else { - // Existing instance - activity.getDatastoreObject().loadAsText(function(error, metadata, data) { - if (error==null && data!=null) { - var delta = JSON.parse(data); - console.log(delta); - editor.setContents(delta); - } - }); - } - // Shared instances - if (environment.sharedId) { - console.log("Shared instance"); - - // Hide GUI of undo and redo for non host users - document.getElementById("edit-undo").style.display = "none"; - document.getElementById("edit-redo").style.display = "none"; - document.getElementById("shared-button").click(); - presence = activity.getPresenceObject(function(error, network) { - network.onDataReceived(onNetworkDataReceived); - network.onSharedActivityUserChanged(onNetworkUserChanged); - }); - } + if (!environment.objectId && !environment.sharedId) { + // New instance + // Intentionally added setTimeout to allow locale.ini file to be loaded + setTimeout(function(){ + editor.setContents([ + {insert: l10n.get('Welcome',{username: environment.user.name}) + '\n' , attributes: { size: "40px" , color : environment.user.colorvalue.stroke , bold: true }}, + ]); + var length = editor.getLength(); + editor.clipboard.dangerouslyPasteHTML(length,l10n.get('Write')); + length = editor.getLength(); + editor.clipboard.dangerouslyPasteHTML(length,l10n.get('Writefeatures')); + length = editor.getLength(); + editor.clipboard.dangerouslyPasteHTML(length,l10n.get('Enjoy')); + length = editor.getLength(); + editor.clipboard.dangerouslyPasteHTML(length,"

"); + length = editor.getLength(); + editor.updateContents( + new Delta() + .retain(editor.getSelection().index+1) + .insert({ + image: window.initialImageDataUrl + }) + ); + },200); + } else { + // Existing instance + activity.getDatastoreObject().loadAsText(function(error, metadata, data) { + if (error==null && data!=null) { + var delta = JSON.parse(data); + console.log(delta); + editor.setContents(delta); + } + }); + } + // Shared instances + if (environment.sharedId) { + console.log("Shared instance"); + + // Hide GUI of undo and redo for non host users + document.getElementById("edit-undo").style.display = "none"; + document.getElementById("edit-redo").style.display = "none"; + document.getElementById("shared-button").click(); + presence = activity.getPresenceObject(function(error, network) { + network.onDataReceived(onNetworkDataReceived); + network.onSharedActivityUserChanged(onNetworkUserChanged); + }); + } + }); }); // Save in Journal on Stop