@jupyterlab/notebook-extension 4.6.0-alpha.2 → 4.6.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * @packageDocumentation
3
3
  * @module notebook-extension
4
4
  */
5
- import { JupyterFrontEndPlugin } from '@jupyterlab/application';
5
+ import type { JupyterFrontEndPlugin } from '@jupyterlab/application';
6
6
  /**
7
7
  * A plugin providing a CommandEdit status item.
8
8
  */
package/lib/index.js CHANGED
@@ -1121,7 +1121,6 @@ function activateCodeConsole(app, tracker, translator) {
1121
1121
  let fromFirst = curLine > 0;
1122
1122
  let firstLine = 0;
1123
1123
  let lastLine = firstLine + 1;
1124
- // eslint-disable-next-line
1125
1124
  while (true) {
1126
1125
  code = srcLines.slice(firstLine, lastLine).join('\n');
1127
1126
  const reply = await ((_b = (_a = current.context.sessionContext.session) === null || _a === void 0 ? void 0 : _a.kernel) === null || _b === void 0 ? void 0 : _b.requestIsComplete({
@@ -1790,6 +1789,18 @@ function addCommands(app, tracker, translator, sessionDialogs, settings, isEnabl
1790
1789
  const isEnabledAndHeadingSelected = () => {
1791
1790
  return Private.isEnabledAndHeadingSelected(shell, tracker);
1792
1791
  };
1792
+ const executePaste = async (notebook, mode) => {
1793
+ var _a;
1794
+ const stripOutputs = !!((_a = settings === null || settings === void 0 ? void 0 : settings.get('pasteCodeCellsWithoutOutput')) === null || _a === void 0 ? void 0 : _a.composite);
1795
+ if (settings === null || settings === void 0 ? void 0 : settings.get('useSystemClipboardForCells').composite) {
1796
+ await NotebookActions.pasteFromSystemClipboard(notebook, mode, {
1797
+ stripOutputs
1798
+ });
1799
+ }
1800
+ else {
1801
+ NotebookActions.paste(notebook, mode, { stripOutputs });
1802
+ }
1803
+ };
1793
1804
  // Set up signal handler to keep the collapse state consistent
1794
1805
  tracker.currentChanged.connect((sender, panel) => {
1795
1806
  var _a, _b;
@@ -2359,10 +2370,7 @@ function addCommands(app, tracker, translator, sessionDialogs, settings, isEnabl
2359
2370
  execute: async (args) => {
2360
2371
  const current = getCurrent(tracker, shell, args);
2361
2372
  if (current) {
2362
- if (settings === null || settings === void 0 ? void 0 : settings.get('useSystemClipboardForCells').composite) {
2363
- return await NotebookActions.pasteFromSystemClipboard(current.content, 'below');
2364
- }
2365
- return NotebookActions.paste(current.content, 'below');
2373
+ return executePaste(current.content, 'below');
2366
2374
  }
2367
2375
  },
2368
2376
  icon: args => (args.toolbar ? pasteIcon : undefined),
@@ -2397,10 +2405,7 @@ function addCommands(app, tracker, translator, sessionDialogs, settings, isEnabl
2397
2405
  execute: async (args) => {
2398
2406
  const current = getCurrent(tracker, shell, args);
2399
2407
  if (current) {
2400
- if (settings === null || settings === void 0 ? void 0 : settings.get('useSystemClipboardForCells').composite) {
2401
- return await NotebookActions.pasteFromSystemClipboard(current.content, 'above');
2402
- }
2403
- return NotebookActions.paste(current.content, 'above');
2408
+ return executePaste(current.content, 'above');
2404
2409
  }
2405
2410
  },
2406
2411
  isEnabled,
@@ -2460,10 +2465,7 @@ function addCommands(app, tracker, translator, sessionDialogs, settings, isEnabl
2460
2465
  execute: async (args) => {
2461
2466
  const current = getCurrent(tracker, shell, args);
2462
2467
  if (current) {
2463
- if (settings === null || settings === void 0 ? void 0 : settings.get('useSystemClipboardForCells').composite) {
2464
- return await NotebookActions.pasteFromSystemClipboard(current.content, 'replace');
2465
- }
2466
- return NotebookActions.paste(current.content, 'replace');
2468
+ return executePaste(current.content, 'replace');
2467
2469
  }
2468
2470
  },
2469
2471
  isEnabled,
@@ -2518,7 +2520,7 @@ function addCommands(app, tracker, translator, sessionDialogs, settings, isEnabl
2518
2520
  execute: args => {
2519
2521
  const current = getCurrent(tracker, shell, args);
2520
2522
  if (current) {
2521
- return NotebookActions.splitCell(current.content);
2523
+ return NotebookActions.splitCell(current.content, translator);
2522
2524
  }
2523
2525
  },
2524
2526
  isEnabled,
@@ -2536,7 +2538,7 @@ function addCommands(app, tracker, translator, sessionDialogs, settings, isEnabl
2536
2538
  const current = getCurrent(tracker, shell, args);
2537
2539
  if (current) {
2538
2540
  const addExtraLine = (_a = settings === null || settings === void 0 ? void 0 : settings.get('addExtraLineOnCellMerge').composite) !== null && _a !== void 0 ? _a : true;
2539
- return NotebookActions.mergeCells(current.content, false, addExtraLine);
2541
+ return NotebookActions.mergeCells(current.content, false, addExtraLine, translator);
2540
2542
  }
2541
2543
  },
2542
2544
  isEnabled,
@@ -2554,7 +2556,7 @@ function addCommands(app, tracker, translator, sessionDialogs, settings, isEnabl
2554
2556
  const current = getCurrent(tracker, shell, args);
2555
2557
  if (current) {
2556
2558
  const addExtraLine = (_a = settings === null || settings === void 0 ? void 0 : settings.get('addExtraLineOnCellMerge').composite) !== null && _a !== void 0 ? _a : true;
2557
- return NotebookActions.mergeCells(current.content, true, addExtraLine);
2559
+ return NotebookActions.mergeCells(current.content, true, addExtraLine, translator);
2558
2560
  }
2559
2561
  },
2560
2562
  isEnabled,
@@ -2572,7 +2574,7 @@ function addCommands(app, tracker, translator, sessionDialogs, settings, isEnabl
2572
2574
  const current = getCurrent(tracker, shell, args);
2573
2575
  if (current) {
2574
2576
  const addExtraLine = (_a = settings === null || settings === void 0 ? void 0 : settings.get('addExtraLineOnCellMerge').composite) !== null && _a !== void 0 ? _a : true;
2575
- return NotebookActions.mergeCells(current.content, false, addExtraLine);
2577
+ return NotebookActions.mergeCells(current.content, false, addExtraLine, translator);
2576
2578
  }
2577
2579
  },
2578
2580
  isEnabled,
@@ -3889,12 +3891,14 @@ var Private;
3889
3891
  // If the container is not available, append the newly created container
3890
3892
  // to the current notebook panel and set related properties
3891
3893
  if (hiddenAlertContainer.getAttribute('id') !== hiddenAlertContainerId) {
3892
- hiddenAlertContainer.classList.add('sr-only');
3893
3894
  hiddenAlertContainer.setAttribute('id', hiddenAlertContainerId);
3894
- hiddenAlertContainer.setAttribute('role', 'alert');
3895
- hiddenAlertContainer.hidden = true;
3896
3895
  notebookNode.appendChild(hiddenAlertContainer);
3897
3896
  }
3897
+ hiddenAlertContainer.classList.add('jp-sr-only');
3898
+ hiddenAlertContainer.setAttribute('role', 'alert');
3899
+ hiddenAlertContainer.setAttribute('aria-live', 'assertive');
3900
+ hiddenAlertContainer.setAttribute('aria-atomic', 'true');
3901
+ hiddenAlertContainer.hidden = false;
3898
3902
  // Insert/Update alert container with the notification message
3899
3903
  hiddenAlertContainer.innerText = message;
3900
3904
  }