Skip to content

Commit c809930

Browse files
Updates warning message on double file open (#375)
* Updates warning message, refactors * Removes newlines, which are ignored * Clarifies two separate views * Update packages/docprovider-extension/src/filebrowser.ts Co-authored-by: David Brochart <[email protected]> --------- Co-authored-by: David Brochart <[email protected]>
1 parent b3d8d29 commit c809930

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

packages/docprovider-extension/src/filebrowser.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ namespace CommandIDs {
4545
}
4646
const DOCUMENT_TIMELINE_URL = 'api/collaboration/timeline';
4747

48+
const TWO_SESSIONS_WARNING =
49+
'The file %1 has been opened with two different views. ' +
50+
'This is not supported. Please close this view; otherwise, ' +
51+
'some of your edits may not be saved properly.';
52+
4853
/**
4954
* The default collaborative drive provider.
5055
*/
@@ -306,10 +311,7 @@ export const logger: JupyterFrontEndPlugin<void> = {
306311
if (emission.level === 'WARNING') {
307312
showDialog({
308313
title: trans.__('Warning'),
309-
body: trans.__(
310-
`Two collaborative sessions are accessing the file ${emission.path} simultaneously.
311-
\nOpening the same file using different views simultaneously is not supported. Please, close one view; otherwise, you might lose some of your progress.`
312-
),
314+
body: trans.__(TWO_SESSIONS_WARNING, emission.path),
313315
buttons: [Dialog.okButton()]
314316
});
315317
}
@@ -355,11 +357,7 @@ export const logger: JupyterFrontEndPlugin<void> = {
355357
if (emission.level === 'WARNING') {
356358
showDialog({
357359
title: trans.__('Warning'),
358-
body: trans.__(
359-
`Two collaborative sessions are accessing the file %1 simultaneously.
360-
\nOpening a document with multiple views simultaneously is not supported. Please close one view; otherwise, you might lose some of your progress.`,
361-
emission.path
362-
),
360+
body: trans.__(TWO_SESSIONS_WARNING, emission.path),
363361
buttons: [Dialog.warnButton({ label: trans.__('Ok') })]
364362
});
365363
}

0 commit comments

Comments
 (0)