@theia/notebook 1.53.0-next.4 → 1.53.0-next.6

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.
Files changed (38) hide show
  1. package/lib/browser/contributions/cell-operations.d.ts.map +1 -1
  2. package/lib/browser/contributions/cell-operations.js +8 -1
  3. package/lib/browser/contributions/cell-operations.js.map +1 -1
  4. package/lib/browser/contributions/notebook-actions-contribution.d.ts.map +1 -1
  5. package/lib/browser/contributions/notebook-actions-contribution.js +7 -6
  6. package/lib/browser/contributions/notebook-actions-contribution.js.map +1 -1
  7. package/lib/browser/contributions/notebook-cell-actions-contribution.d.ts +4 -0
  8. package/lib/browser/contributions/notebook-cell-actions-contribution.d.ts.map +1 -1
  9. package/lib/browser/contributions/notebook-cell-actions-contribution.js +44 -7
  10. package/lib/browser/contributions/notebook-cell-actions-contribution.js.map +1 -1
  11. package/lib/browser/notebook-editor-widget.d.ts.map +1 -1
  12. package/lib/browser/notebook-editor-widget.js +0 -3
  13. package/lib/browser/notebook-editor-widget.js.map +1 -1
  14. package/lib/browser/service/notebook-options.d.ts +1 -0
  15. package/lib/browser/service/notebook-options.d.ts.map +1 -1
  16. package/lib/browser/service/notebook-options.js +1 -0
  17. package/lib/browser/service/notebook-options.js.map +1 -1
  18. package/lib/browser/service/notebook-service.d.ts +1 -0
  19. package/lib/browser/service/notebook-service.d.ts.map +1 -1
  20. package/lib/browser/service/notebook-service.js +7 -0
  21. package/lib/browser/service/notebook-service.js.map +1 -1
  22. package/lib/browser/view/notebook-cell-editor.d.ts.map +1 -1
  23. package/lib/browser/view/notebook-cell-editor.js +10 -0
  24. package/lib/browser/view/notebook-cell-editor.js.map +1 -1
  25. package/lib/browser/view/notebook-cell-list-view.d.ts +1 -0
  26. package/lib/browser/view/notebook-cell-list-view.d.ts.map +1 -1
  27. package/lib/browser/view/notebook-cell-list-view.js +27 -17
  28. package/lib/browser/view/notebook-cell-list-view.js.map +1 -1
  29. package/package.json +7 -7
  30. package/src/browser/contributions/cell-operations.ts +6 -1
  31. package/src/browser/contributions/notebook-actions-contribution.ts +5 -4
  32. package/src/browser/contributions/notebook-cell-actions-contribution.ts +47 -7
  33. package/src/browser/notebook-editor-widget.tsx +0 -3
  34. package/src/browser/service/notebook-options.ts +2 -1
  35. package/src/browser/service/notebook-service.ts +7 -1
  36. package/src/browser/style/index.css +15 -11
  37. package/src/browser/view/notebook-cell-editor.tsx +10 -0
  38. package/src/browser/view/notebook-cell-list-view.tsx +29 -19
@@ -48,6 +48,7 @@ export class NotebookCellListView extends React.Component<CellListProps, Noteboo
48
48
  protected toDispose = new DisposableCollection();
49
49
 
50
50
  protected static dragGhost: HTMLElement | undefined;
51
+ protected cellListRef: React.RefObject<HTMLUListElement> = React.createRef();
51
52
 
52
53
  constructor(props: CellListProps) {
53
54
  super(props);
@@ -82,6 +83,24 @@ export class NotebookCellListView extends React.Component<CellListProps, Noteboo
82
83
  scrollIntoView: e.scrollIntoView
83
84
  });
84
85
  }));
86
+
87
+ this.toDispose.push(onDomEvent(document, 'focusin', () => {
88
+ animationFrame().then(() => {
89
+ if (!this.cellListRef.current) {
90
+ return;
91
+ }
92
+ let hasCellFocus = false;
93
+ let hasFocus = false;
94
+ if (this.cellListRef.current.contains(document.activeElement)) {
95
+ if (this.props.notebookModel.selectedCell) {
96
+ hasCellFocus = true;
97
+ }
98
+ hasFocus = true;
99
+ }
100
+ this.props.notebookContext.changeCellFocus(hasCellFocus);
101
+ this.props.notebookContext.changeCellListFocus(hasFocus);
102
+ });
103
+ }));
85
104
  }
86
105
 
87
106
  override componentWillUnmount(): void {
@@ -89,24 +108,7 @@ export class NotebookCellListView extends React.Component<CellListProps, Noteboo
89
108
  }
90
109
 
91
110
  override render(): React.ReactNode {
92
- return <ul className='theia-notebook-cell-list' ref={
93
- ref => {
94
- this.toDispose.push(onDomEvent(document, 'focusin', () => {
95
- animationFrame().then(() => {
96
- let hasCellFocus = false;
97
- let hasFocus = false;
98
- if (ref?.contains(document.activeElement)) {
99
- if (this.props.notebookModel.selectedCell) {
100
- hasCellFocus = true;
101
- }
102
- hasFocus = true;
103
- }
104
- this.props.notebookContext.changeCellFocus(hasCellFocus);
105
- this.props.notebookContext.changeCellListFocus(hasFocus);
106
- });
107
- }));
108
- }
109
- }>
111
+ return <ul className='theia-notebook-cell-list' ref={this.cellListRef}>
110
112
  {this.props.notebookModel.cells
111
113
  .map((cell, index) =>
112
114
  <React.Fragment key={'cell-' + cell.handle}>
@@ -129,7 +131,15 @@ export class NotebookCellListView extends React.Component<CellListProps, Noteboo
129
131
  onDragOver={e => this.onDragOver(e, cell)}
130
132
  onDrop={e => this.onDrop(e, index)}
131
133
  draggable={true}
132
- ref={ref => cell === this.state.selectedCell && this.state.scrollIntoView && ref?.scrollIntoView({ block: 'nearest' })}>
134
+ tabIndex={-1}
135
+ ref={ref => {
136
+ if (ref && cell === this.state.selectedCell && this.state.scrollIntoView) {
137
+ ref.scrollIntoView({ block: 'nearest' });
138
+ if (cell.cellKind === CellKind.Markup && !cell.editing) {
139
+ ref.focus();
140
+ }
141
+ }
142
+ }}>
133
143
  <div className={'theia-notebook-cell-marker' + (this.state.selectedCell === cell ? ' theia-notebook-cell-marker-selected' : '')}></div>
134
144
  <div className='theia-notebook-cell-content'>
135
145
  {this.renderCellContent(cell, index)}