Skip to content

Commit a035f88

Browse files
authored
feat: collaborative notebook (#346)
* chore: notebook collaborative * chore: collaborative notebook * chore: collaboration * deps: jupyter ydoc * fix: build * license
1 parent b229055 commit a035f88

27 files changed

+198
-66
lines changed

LICENSE

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ This repository contains source code from the following repositories under BSD-3
2525
- JupyterLab https://github.com/jupyterlab/jupyterlab
2626
- JupyterLite https://github.com/jupyterlite/jupyterlite
2727
- JupyterLab KernelSpy: https://github.com/jupyterlab-contrib/jupyterlab-kernelspy
28-
- JupyterLab Variables Inspecdtor: https://github.com/jupyterlab-contrib/jupyterlab-variableInspector
28+
- JupyterLab Variables Inspector: https://github.com/jupyterlab-contrib/jupyterlab-variableInspector
29+
- Jupyter Collaboration: https://github.com/jupyterlab/jupyter-collaboration

examples/lexical/src/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ const Tabs = () => {
9090
<StyledNotebook>
9191
<Box mb={3}>
9292
<Notebook
93-
uid={NOTEBOOK_UID}
93+
id={NOTEBOOK_UID}
9494
nbformat={notebookContent}
9595
CellSidebar={CellSidebar}
96-
/>
96+
/>
9797
<Button
9898
onClick={(e: React.MouseEvent) => {
9999
e.preventDefault();
@@ -119,7 +119,7 @@ export default function App() {
119119
<div className="App">
120120
<h1>Jupyter UI ❤️ Lexical</h1>
121121
</div>
122-
<Jupyter>
122+
<Jupyter startDefaultKernel>
123123
<LexicalProvider>
124124
<Tabs/>
125125
</LexicalProvider>

examples/lexical/src/context/LexicalContext.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
import React, {useState, createContext, useContext} from 'react';
88
import { LexicalEditor } from "lexical";
99

10-
type LexicalCntextType = {
10+
type LexicalContextType = {
1111
editor?: LexicalEditor;
1212
setEditor: (editor?: LexicalEditor) => void;
1313
};
1414

15-
const context = createContext<LexicalCntextType | undefined>(undefined);
15+
const context = createContext<LexicalContextType | undefined>(undefined);
1616

1717
export function useLexical() {
1818
const lexicalContext = useContext(context);

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
"@jupyterlab/ui-components": "4.1.0",
134134
"@jupyterlite/server": "^0.4.0",
135135
"@jupyterlite/server-extension": "^0.4.0",
136-
"@jupyter/ydoc": "1.1.1",
136+
"@jupyter/ydoc": "3.0.2",
137137
"@lumino/algorithm": "2.0.1",
138138
"@lumino/application": "2.2.0",
139139
"@lumino/collections": "2.0.1",
@@ -244,7 +244,7 @@
244244
"@jupyterlab/ui-components": "4.1.0",
245245
"@jupyterlite/server": "^0.4.0",
246246
"@jupyterlite/server-extension": "^0.4.0",
247-
"@jupyter/ydoc": "1.1.1",
247+
"@jupyter/ydoc": "3.0.2",
248248
"@lumino/algorithm": "2.0.1",
249249
"@lumino/application": "2.2.0",
250250
"@lumino/collections": "2.0.1",

packages/lexical/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@datalayer/jupyter-lexical",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "Jupyter UI for Lexical",
55
"license": "MIT",
66
"main": "lib/index.js",

packages/lexical/src/components/JupyterCellComponent.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import { Cell } from '@datalayer/jupyter-react';
99
export const JupyterCellComponent = (props: any) => {
1010
return (
1111
<Cell
12-
// startDefaultKernel={true}
12+
// startDefaultKernel
1313
source="print('Hello Jupyter React')"
14-
autoStart={true}
14+
autoStart
1515
/>
1616
)
1717
}

packages/lexical/src/examples/App1.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const App1 = () => {
4141
<div className="App">
4242
<h1>Jupyter UI ❤️ Lexical</h1>
4343
</div>
44-
<Jupyter startDefaultKernel={true}>
44+
<Jupyter startDefaultKernel>
4545
<LexicalProvider>
4646
<LexicalEditor/>
4747
</LexicalProvider>

packages/lexical/src/examples/App2.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export default function App() {
119119
<div className="App">
120120
<h1>Jupyter UI ❤️ Lexical</h1>
121121
</div>
122-
<Jupyter startDefaultKernel={true}>
122+
<Jupyter startDefaultKernel>
123123
<LexicalProvider>
124124
<Tabs/>
125125
</LexicalProvider>

packages/lexical/src/examples/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
import { createRoot } from "react-dom/client";
8-
import App from "./App1";
8+
import App from "./App2";
99

1010
const rootElement = document.getElementById("root");
1111

packages/lexical/src/examples/plugins/DraggableBlockPlugin/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ function useDraggableBlockMenu(
421421
<div
422422
className="icon draggable-block-menu"
423423
ref={menuRef}
424-
draggable={true}
424+
draggable
425425
onDragStart={onDragStart}
426426
onDragEnd={onDragEnd}>
427427
<div className={isEditable ? 'icon' : ''} />

0 commit comments

Comments
 (0)