@datalayer/jupyter-lexical 0.0.1 → 0.0.2
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/components/JupyterCellComponent.js +1 -1
- package/lib/components/JupyterCellComponent.js.map +1 -1
- package/lib/components/JupyterOutputComponent.js +1 -1
- package/lib/components/JupyterOutputComponent.js.map +1 -1
- package/lib/convert/LexicalToNbFormat.js.map +1 -1
- package/lib/convert/NbFormatToLexical.js +2 -2
- package/lib/convert/NbFormatToLexical.js.map +1 -1
- package/lib/convert/markdown/MarkdownImport.d.ts +7 -0
- package/lib/convert/markdown/MarkdownImport.js +1 -0
- package/lib/convert/markdown/MarkdownImport.js.map +1 -1
- package/lib/examples/App1.d.ts +2 -0
- package/lib/examples/{App.js → App1.js} +6 -5
- package/lib/examples/App1.js.map +1 -0
- package/lib/examples/App2.js +70 -0
- package/lib/examples/App2.js.map +1 -0
- package/lib/examples/{Editor.js → editor/Editor.js} +28 -20
- package/lib/examples/editor/Editor.js.map +1 -0
- package/lib/examples/editor/styles/Editor.css +1675 -0
- package/lib/examples/editor/styles/Jupyter.css +10 -0
- package/lib/examples/editor/styles/Rich.css +748 -0
- package/lib/examples/editor/styles/images/README.md +0 -0
- package/lib/examples/editor/styles/images/icons/LICENSE.md +5 -0
- package/lib/examples/editor/styles/images/icons/arrow-clockwise.svg +4 -0
- package/lib/examples/editor/styles/images/icons/arrow-counterclockwise.svg +4 -0
- package/lib/examples/editor/styles/images/icons/bg-color.svg +1 -0
- package/lib/examples/editor/styles/images/icons/camera.svg +4 -0
- package/lib/examples/editor/styles/images/icons/card-checklist.svg +4 -0
- package/lib/examples/editor/styles/images/icons/caret-right-fill.svg +1 -0
- package/lib/examples/editor/styles/images/icons/chat-left-text.svg +4 -0
- package/lib/examples/editor/styles/images/icons/chat-right-dots.svg +4 -0
- package/lib/examples/editor/styles/images/icons/chat-right-text.svg +4 -0
- package/lib/examples/editor/styles/images/icons/chat-right.svg +3 -0
- package/lib/examples/editor/styles/images/icons/chat-square-quote.svg +4 -0
- package/lib/examples/editor/styles/images/icons/check-lg.svg +3 -0
- package/lib/examples/editor/styles/images/icons/chevron-down.svg +3 -0
- package/lib/examples/editor/styles/images/icons/clipboard.svg +4 -0
- package/lib/examples/editor/styles/images/icons/close.svg +1 -0
- package/lib/examples/editor/styles/images/icons/code.svg +3 -0
- package/lib/examples/editor/styles/images/icons/comments.svg +4 -0
- package/lib/examples/editor/styles/images/icons/copy.svg +1 -0
- package/lib/examples/editor/styles/images/icons/diagram-2.svg +3 -0
- package/lib/examples/editor/styles/images/icons/download.svg +4 -0
- package/lib/examples/editor/styles/images/icons/draggable-block-menu.svg +1 -0
- package/lib/examples/editor/styles/images/icons/dropdown-more.svg +3 -0
- package/lib/examples/editor/styles/images/icons/figma.svg +1 -0
- package/lib/examples/editor/styles/images/icons/file-earmark-text.svg +4 -0
- package/lib/examples/editor/styles/images/icons/file-image.svg +4 -0
- package/lib/examples/editor/styles/images/icons/filetype-gif.svg +3 -0
- package/lib/examples/editor/styles/images/icons/font-color.svg +1 -0
- package/lib/examples/editor/styles/images/icons/font-family.svg +3 -0
- package/lib/examples/editor/styles/images/icons/gear.svg +4 -0
- package/lib/examples/editor/styles/images/icons/horizontal-rule.svg +3 -0
- package/lib/examples/editor/styles/images/icons/indent.svg +3 -0
- package/lib/examples/editor/styles/images/icons/journal-code.svg +5 -0
- package/lib/examples/editor/styles/images/icons/journal-text.svg +5 -0
- package/lib/examples/editor/styles/images/icons/justify.svg +3 -0
- package/lib/examples/editor/styles/images/icons/link.svg +4 -0
- package/lib/examples/editor/styles/images/icons/list-ol.svg +4 -0
- package/lib/examples/editor/styles/images/icons/list-ul.svg +3 -0
- package/lib/examples/editor/styles/images/icons/lock-fill.svg +3 -0
- package/lib/examples/editor/styles/images/icons/lock.svg +3 -0
- package/lib/examples/editor/styles/images/icons/markdown.svg +6 -0
- package/lib/examples/editor/styles/images/icons/mic.svg +4 -0
- package/lib/examples/editor/styles/images/icons/outdent.svg +3 -0
- package/lib/examples/editor/styles/images/icons/paint-bucket.svg +3 -0
- package/lib/examples/editor/styles/images/icons/palette.svg +4 -0
- package/lib/examples/editor/styles/images/icons/pencil-fill.svg +3 -0
- package/lib/examples/editor/styles/images/icons/plug-fill.svg +3 -0
- package/lib/examples/editor/styles/images/icons/plug.svg +3 -0
- package/lib/examples/editor/styles/images/icons/plus-slash-minus.svg +3 -0
- package/lib/examples/editor/styles/images/icons/plus.svg +3 -0
- package/lib/examples/editor/styles/images/icons/prettier-error.svg +1 -0
- package/lib/examples/editor/styles/images/icons/prettier.svg +1 -0
- package/lib/examples/editor/styles/images/icons/send.svg +3 -0
- package/lib/examples/editor/styles/images/icons/square-check.svg +4 -0
- package/lib/examples/editor/styles/images/icons/square.svg +3 -0
- package/lib/examples/editor/styles/images/icons/sticky.svg +3 -0
- package/lib/examples/editor/styles/images/icons/success-alt.svg +1 -0
- package/lib/examples/editor/styles/images/icons/success.svg +1 -0
- package/lib/examples/editor/styles/images/icons/table.svg +3 -0
- package/lib/examples/editor/styles/images/icons/text-center.svg +3 -0
- package/lib/examples/editor/styles/images/icons/text-left.svg +3 -0
- package/lib/examples/editor/styles/images/icons/text-paragraph.svg +3 -0
- package/lib/examples/editor/styles/images/icons/text-right.svg +3 -0
- package/lib/examples/editor/styles/images/icons/trash.svg +4 -0
- package/lib/examples/editor/styles/images/icons/trash3.svg +3 -0
- package/lib/examples/editor/styles/images/icons/tweet.svg +3 -0
- package/lib/examples/editor/styles/images/icons/type-bold.svg +3 -0
- package/lib/examples/editor/styles/images/icons/type-h1.svg +3 -0
- package/lib/examples/editor/styles/images/icons/type-h2.svg +3 -0
- package/lib/examples/editor/styles/images/icons/type-h3.svg +3 -0
- package/lib/examples/editor/styles/images/icons/type-h4.svg +3 -0
- package/lib/examples/editor/styles/images/icons/type-h5.svg +3 -0
- package/lib/examples/editor/styles/images/icons/type-h6.svg +3 -0
- package/lib/examples/editor/styles/images/icons/type-italic.svg +3 -0
- package/lib/examples/editor/styles/images/icons/type-strikethrough.svg +3 -0
- package/lib/examples/editor/styles/images/icons/type-subscript.svg +4 -0
- package/lib/examples/editor/styles/images/icons/type-superscript.svg +4 -0
- package/lib/examples/editor/styles/images/icons/type-underline.svg +3 -0
- package/lib/examples/editor/styles/images/icons/upload.svg +4 -0
- package/lib/examples/editor/styles/images/icons/user.svg +1 -0
- package/lib/examples/editor/styles/images/icons/x-lg.svg +4 -0
- package/lib/examples/editor/styles/images/icons/youtube.svg +3 -0
- package/lib/examples/{Example.js → index.js} +2 -2
- package/lib/examples/index.js.map +1 -0
- package/lib/examples/plugins/DraggableBlockPlugin/index.css +42 -0
- package/lib/examples/plugins/DraggableBlockPlugin/index.d.ts +6 -0
- package/lib/examples/plugins/DraggableBlockPlugin/index.js +303 -0
- package/lib/examples/plugins/DraggableBlockPlugin/index.js.map +1 -0
- package/lib/examples/plugins/DraggableBlockPlugin/utils/guard.d.ts +8 -0
- package/lib/examples/plugins/DraggableBlockPlugin/utils/guard.js +16 -0
- package/lib/examples/plugins/DraggableBlockPlugin/utils/guard.js.map +1 -0
- package/lib/examples/plugins/DraggableBlockPlugin/utils/point.d.ts +21 -0
- package/lib/examples/plugins/DraggableBlockPlugin/utils/point.js +49 -0
- package/lib/examples/plugins/DraggableBlockPlugin/utils/point.js.map +1 -0
- package/lib/examples/plugins/DraggableBlockPlugin/utils/rect.d.ts +45 -0
- package/lib/examples/plugins/DraggableBlockPlugin/utils/rect.js +109 -0
- package/lib/examples/plugins/DraggableBlockPlugin/utils/rect.js.map +1 -0
- package/lib/examples/plugins/ToolbarPlugin.css +31 -0
- package/lib/examples/themes/Theme.css +310 -0
- package/lib/index.d.ts +6 -3
- package/lib/index.js +6 -3
- package/lib/index.js.map +1 -1
- package/lib/jupyter/lab/component/MockComponent.js +1 -1
- package/lib/jupyter/lab/component/MockComponent.js.map +1 -1
- package/lib/nodes/CustomComponent.d.ts +7 -0
- package/lib/nodes/CustomComponent.js +7 -0
- package/lib/nodes/CustomComponent.js.map +1 -0
- package/lib/nodes/ImageNode.js +3 -2
- package/lib/nodes/ImageNode.js.map +1 -1
- package/lib/nodes/JupyterCellNode.d.ts +30 -0
- package/lib/nodes/JupyterCellNode.js +67 -0
- package/lib/nodes/JupyterCellNode.js.map +1 -0
- package/lib/nodes/JupyterCodeHighlighter.js +1 -1
- package/lib/nodes/JupyterCodeHighlighter.js.map +1 -1
- package/lib/nodes/JupyterCodeNode.js.map +1 -1
- package/lib/nodes/JupyterOutputNode.d.ts +1 -0
- package/lib/nodes/JupyterOutputNode.js +3 -2
- package/lib/nodes/JupyterOutputNode.js.map +1 -1
- package/lib/plugins/CodeActionMenuPlugin.js +1 -1
- package/lib/plugins/CodeActionMenuPlugin.js.map +1 -1
- package/lib/plugins/ComponentPickerMenuPlugin.js +16 -4
- package/lib/plugins/ComponentPickerMenuPlugin.js.map +1 -1
- package/lib/plugins/ImagesPlugin.js.map +1 -1
- package/lib/plugins/JupyterCellPlugin.d.ts +3 -0
- package/lib/plugins/JupyterCellPlugin.js +26 -0
- package/lib/plugins/JupyterCellPlugin.js.map +1 -0
- package/lib/plugins/JupyterPlugin.d.ts +1 -1
- package/lib/plugins/JupyterPlugin.js +7 -9
- package/lib/plugins/JupyterPlugin.js.map +1 -1
- package/lib/ui/CopyButton.js +1 -1
- package/lib/ui/CopyButton.js.map +1 -1
- package/package.json +74 -71
- package/lib/examples/App.js.map +0 -1
- package/lib/examples/Editor.js.map +0 -1
- package/lib/examples/Example.js.map +0 -1
- package/lib/ui/PrettierButton.tsx_tmp +0 -133
- /package/lib/examples/{App.d.ts → App2.d.ts} +0 -0
- /package/lib/examples/{Editor.d.ts → editor/Editor.d.ts} +0 -0
- /package/lib/examples/{Example.d.ts → index.d.ts} +0 -0
|
@@ -6,7 +6,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
6
6
|
*/
|
|
7
7
|
import { Cell } from '@datalayer/jupyter-react';
|
|
8
8
|
export const JupyterCellComponent = (props) => {
|
|
9
|
-
return (_jsx(Cell, {}));
|
|
9
|
+
return (_jsx(Cell, { source: "print('hello')", autoStart: true }));
|
|
10
10
|
};
|
|
11
11
|
export default JupyterCellComponent;
|
|
12
12
|
//# sourceMappingURL=JupyterCellComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JupyterCellComponent.js","sourceRoot":"","sources":["../../src/components/JupyterCellComponent.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEhD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAU,EAAE,EAAE;IACjD,OAAO,CACL,KAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"JupyterCellComponent.js","sourceRoot":"","sources":["../../src/components/JupyterCellComponent.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEhD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAU,EAAE,EAAE;IACjD,OAAO,CACL,KAAC,IAAI,IACH,MAAM,EAAC,gBAAgB,EACvB,SAAS,EAAE,IAAI,GACf,CACH,CAAA;AACH,CAAC,CAAA;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Output } from "@datalayer/jupyter-react/lib/components/output/Output";
|
|
3
3
|
export const JupyterOutputComponent = (props) => {
|
|
4
4
|
const { outputNodeUuid, code, outputs, executeTrigger, autoRun, outputAdapter } = props;
|
|
5
|
-
return (_jsx(Output, { code: code, outputs: outputs, adapter: outputAdapter, showEditor: false, autoRun: autoRun,
|
|
5
|
+
return (_jsx(Output, { code: code, outputs: outputs, adapter: outputAdapter, showEditor: false, autoRun: autoRun, id: outputNodeUuid, executeTrigger: executeTrigger, lumino: false }));
|
|
6
6
|
};
|
|
7
7
|
export default JupyterOutputComponent;
|
|
8
8
|
//# sourceMappingURL=JupyterOutputComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JupyterOutputComponent.js","sourceRoot":"","sources":["../../src/components/JupyterOutputComponent.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,uDAAuD,CAAC;AAa/E,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAY,EAAE,EAAE;IACrD,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;IACxF,OAAO,CACL,KAAC,MAAM,IACL,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,aAAa,EACtB,UAAU,EAAE,KAAK,EACjB,OAAO,EAAE,OAAO,EAChB,
|
|
1
|
+
{"version":3,"file":"JupyterOutputComponent.js","sourceRoot":"","sources":["../../src/components/JupyterOutputComponent.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,uDAAuD,CAAC;AAa/E,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAY,EAAE,EAAE;IACrD,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;IACxF,OAAO,CACL,KAAC,MAAM,IACL,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,aAAa,EACtB,UAAU,EAAE,KAAK,EACjB,OAAO,EAAE,OAAO,EAChB,EAAE,EAAE,cAAc,EAClB,cAAc,EAAE,cAAc,EAC9B,MAAM,EAAE,KAAK,GACX,CACL,CAAA;AACH,CAAC,CAAA;AAED,eAAe,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LexicalToNbFormat.js","sourceRoot":"","sources":["../../src/convert/LexicalToNbFormat.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAe,cAAc,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAErF,
|
|
1
|
+
{"version":3,"file":"LexicalToNbFormat.js","sourceRoot":"","sources":["../../src/convert/LexicalToNbFormat.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAe,cAAc,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAErF,OAAqB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAoB,EAAE,EAAE;IACxD,MAAM,EAAE,GAAqB;QAC3B,QAAQ,EAAE,CAAC;QACX,cAAc,EAAE,CAAC;QACjB,QAAQ,EAAE;YACR,YAAY,EAAE;gBACZ,eAAe,EAAE,EAAE;gBACnB,cAAc,EAAE,sBAAsB;gBACtC,UAAU,EAAE,QAAQ;gBACpB,MAAM,EAAE,SAAS;aAClB;YACD,eAAe,EAAE;gBACf,iBAAiB,EAAE;oBACjB,MAAM,EAAE,SAAS;oBACjB,SAAS,EAAE,CAAC;iBACb;gBACF,gBAAgB,EAAE,KAAK;gBACvB,UAAU,EAAE,eAAe;gBAC3B,MAAM,EAAE,QAAQ;gBAChB,oBAAoB,EAAE,QAAQ;gBAC9B,gBAAgB,EAAE,UAAU;gBAC5B,SAAS,EAAE,QAAQ;aACnB;SACF;QACD,KAAK,EAAE,EAAE;KACV,CAAA;IACD,KAAK,CAAC,GAAG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ugins/JupyterPlugin";
|
|
8
8
|
import { $convertFromMarkdownString, TRANSFORMERS } from "./markdown";
|
|
9
9
|
export const nbformatToLexical = (notebook, editor) => {
|
|
10
10
|
editor.update(() => {
|
|
@@ -21,7 +21,7 @@ export const nbformatToLexical = (notebook, editor) => {
|
|
|
21
21
|
}
|
|
22
22
|
if (cell.cell_type === 'code') {
|
|
23
23
|
const outputs = cell.outputs;
|
|
24
|
-
editor.dispatchCommand(
|
|
24
|
+
editor.dispatchCommand(INSERT_JUPYTER_COMMAND, { code: source, outputs: outputs, loading: "initial" });
|
|
25
25
|
}
|
|
26
26
|
editor.dispatchCommand(INSERT_PARAGRAPH_COMMAND, undefined);
|
|
27
27
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NbFormatToLexical.js","sourceRoot":"","sources":["../../src/convert/NbFormatToLexical.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAiB,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAElE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"NbFormatToLexical.js","sourceRoot":"","sources":["../../src/convert/NbFormatToLexical.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAiB,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAElE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEtE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,QAA0B,EAAE,MAAqB,EAAE,EAAE;IACrF,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE;QACjB,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YACxB,IAAI,MAAM,GAAG,EAAE,CAAC;YAChB,IAAI,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ,EAAE;gBACnC,MAAM,GAAI,IAAI,CAAC,MAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aAC/C;YACD,IAAI,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ,EAAE;gBACnC,MAAM,GAAG,IAAI,CAAC,MAAgB,CAAC;aAChC;YACD,IAAI,IAAI,CAAC,SAAS,KAAK,UAAU,EAAE;gBACjC,0BAA0B,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;aAClD;YACD,IAAI,IAAI,CAAC,SAAS,KAAK,MAAM,EAAE;gBAC7B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAoB,CAAC;gBAC1C,MAAM,CAAC,eAAe,CAAC,sBAAsB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAA;aACvG;YACD,MAAM,CAAC,eAAe,CAAC,wBAAwB,EAAE,SAAS,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAA;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
1
8
|
import type { Transformer } from '.';
|
|
2
9
|
export declare function createMarkdownImport(transformers: Array<Transformer>): (markdownString: string) => void;
|
|
@@ -87,6 +87,7 @@ function importBlocks(lineText, rootNode, elementTransformers, textFormatTransfo
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
if (targetNode != null && targetNode.getTextContentSize() > 0) {
|
|
90
|
+
// TODO(ECH) Do not use "as any"
|
|
90
91
|
targetNode.splice(targetNode.getChildrenSize(), 0, [
|
|
91
92
|
$createLineBreakNode(),
|
|
92
93
|
...elementNode.getChildren(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownImport.js","sourceRoot":"","sources":["../../../src/convert/markdown/MarkdownImport.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"MarkdownImport.js","sourceRoot":"","sources":["../../../src/convert/markdown/MarkdownImport.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkBH,OAAO,EAAkB,sBAAsB,EAAC,MAAM,+BAA+B,CAAC;AACtF,OAAO,EAAC,eAAe,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAC,mBAAmB,EAAC,MAAM,gBAAgB,CAAC;AACnD,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,QAAQ,EACR,gBAAgB,EAChB,WAAW,GACZ,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAC,oBAAoB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAC;AAEjE,MAAM,2BAA2B,GAAG,WAAW,CAAC;AAChD,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAOjD,MAAM,UAAU,oBAAoB,CAClC,YAAgC;IAEhC,MAAM,MAAM,GAAG,kBAAkB,CAAC,YAAY,CAAC,CAAC;IAChD,MAAM,2BAA2B,GAAG,iCAAiC,CACnE,MAAM,CAAC,UAAU,CAClB,CAAC;IAEF,OAAO,CAAC,cAAsB,EAAE,EAAE;QAChC,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC;QACjC,MAAM,IAAI,GAAG,QAAQ,EAAE,CAAC;QAC5B,mBAAmB;QAEf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,EAAE,CAAC,EAAE,EAAE;YACpC,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YAC1B,+DAA+D;YAC/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C;IAE9C,MAAM,iBAAiB,GAA0C,EAAE,CAAC;IACpE,MAAM,oBAAoB,GAA2B,EAAE,CAAC;IACxD,MAAM,cAAc,GAAG,EAAE,CAAC;IAE1B,KAAK,MAAM,WAAW,IAAI,gBAAgB,EAAE;QAC1C,MAAM,EAAC,GAAG,EAAC,GAAG,WAAW,CAAC;QAC1B,iBAAiB,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC;QACrC,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAClD,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC/B,oBAAoB,CAAC,GAAG,CAAC,GAAG,IAAI,MAAM,CACpC,IAAI,SAAS,QAAQ,SAAS,cAAc,SAAS,QAAQ,SAAS,MAAM,SAAS,GAAG,CACzF,CAAC;KACH;IAED,OAAO;QACL,iDAAiD;QACjD,oBAAoB;QACpB,+BAA+B;QAC/B,cAAc,EAAE,IAAI,MAAM,CAAC,GAAG,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,CAAC;QACrE,iBAAiB;KAClB,CAAC;AACJ,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { Box, Button } from "@primer/react";
|
|
|
3
3
|
import { ThreeBarsIcon } from "@primer/octicons-react";
|
|
4
4
|
import { Jupyter } from "@datalayer/jupyter-react";
|
|
5
5
|
import { useLexical, LexicalProvider } from "./context/LexicalContext";
|
|
6
|
-
import Editor from "./Editor";
|
|
6
|
+
import Editor from "./editor/Editor";
|
|
7
7
|
import initialLexicalModel from "./content/Example.lexical.json";
|
|
8
8
|
import initialNbformatModel from "./content/Example.ipynb.json";
|
|
9
9
|
const LexicalEditor = () => {
|
|
@@ -16,7 +16,8 @@ const LexicalEditor = () => {
|
|
|
16
16
|
}
|
|
17
17
|
}, children: "Load Lexical Model" })] }) }));
|
|
18
18
|
};
|
|
19
|
-
export
|
|
20
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "App", children: _jsx("h1", { children: "Jupyter UI \u2764\uFE0F Lexical" }) }), _jsx(Jupyter, { children: _jsx(LexicalProvider, { children: _jsx(LexicalEditor, {}) }) }), _jsxs("div", { className: "other App", children: [_jsx("a", { href: "https://datalayer.io", target: "_blank", children: _jsx(ThreeBarsIcon, {}) }), _jsxs("h2", { children: ["\u00A9 ", _jsx("a", { href: "https://datalayer.io", target: "_blank", children: "2022 Datalayer, Inc." })] }), _jsx("ul", { children: _jsx("li", { children: _jsx("a", { href: "https://github.com/datalayer/jupyter-ui/tree/main/packages/lexical", target: "_blank", children: "Jupyter
|
|
21
|
-
}
|
|
22
|
-
|
|
19
|
+
export const App1 = () => {
|
|
20
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "App", children: _jsx("h1", { children: "Jupyter UI \u2764\uFE0F Lexical" }) }), _jsx(Jupyter, { jupyterServerUrl: "https://oss.datalayer.run/api/jupyter-server", jupyterServerToken: "60c1661cc408f978c309d04157af55c9588ff9557c9380e4fb50785750703da6", children: _jsx(LexicalProvider, { children: _jsx(LexicalEditor, {}) }) }), _jsxs("div", { className: "other App", children: [_jsx("a", { href: "https://datalayer.io", target: "_blank", children: _jsx(ThreeBarsIcon, {}) }), _jsxs("h2", { children: ["Copyright \u00A9 ", _jsx("a", { href: "https://datalayer.io", target: "_blank", children: "2022-2024 Datalayer, Inc." })] }), _jsx("ul", { children: _jsx("li", { children: _jsx("a", { href: "https://github.com/datalayer/jupyter-ui/tree/main/packages/lexical", target: "_blank", children: "Jupyter UI open-source repository" }) }) })] })] }));
|
|
21
|
+
};
|
|
22
|
+
export default App1;
|
|
23
|
+
//# sourceMappingURL=App1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App1.js","sourceRoot":"","sources":["../../src/examples/App1.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,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ACL,uBACE,uBACE,YAAG,IAAI,EAAC,oEAAoE,EAAC,MAAM,EAAC,QAAQ,kDAAsC,GAC/H,GACF,IACD,IACL,CACJ,CAAA;AACH,CAAC,CAAA;AAED,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
4
|
+
*
|
|
5
|
+
* MIT License
|
|
6
|
+
*/
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
import { Box, TabNav, Button } from "@primer/react";
|
|
9
|
+
import { ThreeBarsIcon } from "@primer/octicons-react";
|
|
10
|
+
import { JSONTree } from "react-json-tree";
|
|
11
|
+
import { $getRoot } from "lexical";
|
|
12
|
+
import styled from "styled-components";
|
|
13
|
+
import { Jupyter, Notebook, CellSidebar, useNotebookStore } from "@datalayer/jupyter-react";
|
|
14
|
+
import { lexicalToNbFormat } from "./../convert/LexicalToNbFormat";
|
|
15
|
+
import { useLexical, LexicalProvider } from "./context/LexicalContext";
|
|
16
|
+
import Editor from "./editor/Editor";
|
|
17
|
+
import initialLexicalModel from "./content/Example.lexical.json";
|
|
18
|
+
import initialNbformatModel from "./content/Example.ipynb.json";
|
|
19
|
+
const StyledNotebook = styled.div `
|
|
20
|
+
&[style] {
|
|
21
|
+
height: 100vh !important;
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
const NOTEBOOK_UID = 'notebook-uid-lexical';
|
|
25
|
+
const Tabs = () => {
|
|
26
|
+
const { editor } = useLexical();
|
|
27
|
+
const notebookStore = useNotebookStore();
|
|
28
|
+
const [tab, setTab] = useState('editor');
|
|
29
|
+
const [notebookContent, setNotebookContent] = useState(initialNbformatModel);
|
|
30
|
+
const notebook = notebookStore.selectNotebook(NOTEBOOK_UID);
|
|
31
|
+
const goToTab = (e, toTab, notebookModel) => {
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
if (tab === 'notebook' && toTab === 'editor') {
|
|
34
|
+
if (notebookModel && editor) {
|
|
35
|
+
setNotebookContent(notebookModel.toJSON());
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (tab === 'editor' && toTab === "notebook") {
|
|
39
|
+
editor?.update(() => {
|
|
40
|
+
const root = $getRoot();
|
|
41
|
+
const children = root.getChildren();
|
|
42
|
+
const nb = lexicalToNbFormat(children);
|
|
43
|
+
setNotebookContent(nb);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (tab === 'notebook' && toTab === 'nbformat') {
|
|
47
|
+
if (notebookModel && editor) {
|
|
48
|
+
setNotebookContent(notebookModel.toJSON());
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
setTab(toTab);
|
|
52
|
+
};
|
|
53
|
+
return (_jsxs(Box, { className: "center", children: [_jsxs(TabNav, { children: [_jsx(TabNav.Link, { href: "", selected: tab === 'editor', onClick: e => goToTab(e, 'editor', notebook?.model), children: "Editor" }), _jsx(TabNav.Link, { href: "", selected: tab === 'notebook', onClick: e => goToTab(e, 'notebook', notebook?.model), children: "Notebook" }), _jsx(TabNav.Link, { href: "", selected: tab === 'nbformat', onClick: e => goToTab(e, 'nbformat', notebook?.model), children: "NbFormat" })] }), tab === 'editor' &&
|
|
54
|
+
_jsxs(Box, { children: [_jsx(Editor, { notebook: notebookContent }), _jsx(Button, { onClick: (e) => {
|
|
55
|
+
e.preventDefault();
|
|
56
|
+
if (editor) {
|
|
57
|
+
const editorState = editor.parseEditorState(initialLexicalModel);
|
|
58
|
+
editor.setEditorState(editorState);
|
|
59
|
+
}
|
|
60
|
+
}, children: "Load Lexical Model" })] }), tab === 'notebook' &&
|
|
61
|
+
_jsx(StyledNotebook, { children: _jsxs(Box, { mb: 3, children: [_jsx(Notebook, { id: NOTEBOOK_UID, nbformat: notebookContent, CellSidebar: CellSidebar }), _jsx(Button, { onClick: (e) => {
|
|
62
|
+
e.preventDefault();
|
|
63
|
+
setNotebookContent(initialNbformatModel);
|
|
64
|
+
}, children: "Reset Nbformat" })] }) }), tab === 'nbformat' &&
|
|
65
|
+
_jsxs(Box, { children: [_jsx(JSONTree, { data: notebookContent }), ";"] })] }));
|
|
66
|
+
};
|
|
67
|
+
export default function App() {
|
|
68
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "App", children: _jsx("h1", { children: "Jupyter UI \u2764\uFE0F Lexical" }) }), _jsx(Jupyter, { children: _jsx(LexicalProvider, { children: _jsx(Tabs, {}) }) }), _jsxs("div", { className: "other App", children: [_jsx("a", { href: "https://datalayer.io", target: "_blank", children: _jsx(ThreeBarsIcon, {}) }), _jsxs("h2", { children: ["copyright \u00A9 ", _jsx("a", { href: "https://datalayer.io", target: "_blank", children: "2022-2024 Datalayer, Inc." })] }), _jsx("ul", { children: _jsx("li", { children: _jsx("a", { href: "https://github.com/datalayer/jupyter-ui", target: "_blank", children: "Jupyter UI open-source repository" }) }) })] })] }));
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=App2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App2.js","sourceRoot":"","sources":["../../src/examples/App2.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAGvC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5F,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCA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C,CAAC;oCACxE,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;iCACpC;4BACH,CAAC,mCAEM,IACL,EAEN,GAAG,KAAK,UAAU;gBAClB,KAAC,cAAc,cACb,MAAC,GAAG,IAAC,EAAE,EAAE,CAAC,aACR,KAAC,QAAQ,IACP,EAAE,EAAE,YAAY,EAChB,QAAQ,EAAE,eAAe,EACzB,WAAW,EAAE,WAAW,GACtB,EACJ,KAAC,MAAM,IACL,OAAO,EAAE,CAAC,CAAmB,EAAE,EAAE;oCAC/B,CAAC,CAAC,cAAc,EAAE,CAAC;oCACnB,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;gCAC3C,CAAC,+BAEM,IACL,GACS,EAEjB,GAAG,KAAK,UAAU;gBAClB,MAAC,GAAG,eACF,KAAC,QAAQ,IAAC,IAAI,EAAE,eAAe,GAAG,SAC9B,IAEJ,CACP,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,GAAG;IACzB,OAAO,CACL,8BACE,cAAK,SAAS,EAAC,KAAK,YAClB,2DAA8B,GAC1B,EACN,KAAC,OAAO,cACN,KAAC,eAAe,cACd,KAAC,IAAI,KAAE,GACS,GACV,EACV,eAAK,SAAS,EAAC,WAAW,aACxB,YAAG,IAAI,EAAC,sBAAsB,EAAC,MAAM,EAAC,QAAQ,YAC5C,KAAC,aAAa,KAAE,GACd,EACJ,8CACc,YAAG,IAAI,EAAC,sBAAsB,EAAC,MAAM,EAAC,QAAQ,0CAA8B,IACrF,EACL,uBACE,uBACE,YAAG,IAAI,EAAC,yCAAyC,EAAC,MAAM,EAAC,QAAQ,kDAAsC,GACpG,GACF,IACD,IACL,CACJ,CAAA;AACH,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/*
|
|
3
3
|
* Copyright (c) 2021-2023 Datalayer, Inc.
|
|
4
4
|
*
|
|
5
5
|
* MIT License
|
|
6
6
|
*/
|
|
7
|
-
import { useEffect } from "react";
|
|
7
|
+
import { useState, useEffect } from "react";
|
|
8
8
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
9
9
|
import { LexicalComposer } from "@lexical/react/LexicalComposer";
|
|
10
10
|
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
|
|
@@ -24,11 +24,12 @@ import { TableCellNode, TableNode, TableRowNode } from "@lexical/table";
|
|
|
24
24
|
import { ListItemNode, ListNode } from "@lexical/list";
|
|
25
25
|
import { AutoLinkNode, LinkNode } from "@lexical/link";
|
|
26
26
|
import { CodeNode } from '@lexical/code';
|
|
27
|
-
import { JupyterPlugin, EquationNode, HorizontalRulePlugin, ListMaxIndentLevelPlugin, AutoLinkPlugin, ComponentPickerMenuPlugin, EquationsPlugin, ImagesPlugin, YouTubePlugin, ImageNode, YouTubeNode, JupyterCodeHighlightNode, JupyterCodeNode, JupyterOutputNode, CodeActionMenuPlugin, AutoEmbedPlugin, NbformatContentPlugin, TableOfContentsPlugin, MarkdownPlugin } from "
|
|
28
|
-
import ExampleTheme from "
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
27
|
+
import { JupyterPlugin, EquationNode, HorizontalRulePlugin, ListMaxIndentLevelPlugin, AutoLinkPlugin, ComponentPickerMenuPlugin, EquationsPlugin, ImagesPlugin, YouTubePlugin, ImageNode, YouTubeNode, JupyterCodeHighlightNode, JupyterCodeNode, JupyterOutputNode, JupyterCellNode, CodeActionMenuPlugin, AutoEmbedPlugin, NbformatContentPlugin, TableOfContentsPlugin, MarkdownPlugin, JupyterCellPlugin } from "../../index";
|
|
28
|
+
import ExampleTheme from "../themes/Theme";
|
|
29
|
+
import { useLexical } from "../context/LexicalContext";
|
|
30
|
+
import TreeViewPlugin from "../plugins/TreeViewPlugin";
|
|
31
|
+
import ToolbarPlugin from "../plugins/ToolbarPlugin";
|
|
32
|
+
import DraggableBlockPlugin from "./../plugins/DraggableBlockPlugin";
|
|
32
33
|
import "./styles/Editor.css";
|
|
33
34
|
import "./styles/Rich.css";
|
|
34
35
|
import "./styles/Jupyter.css";
|
|
@@ -42,24 +43,25 @@ const initialConfig = {
|
|
|
42
43
|
throw error;
|
|
43
44
|
},
|
|
44
45
|
nodes: [
|
|
46
|
+
AutoLinkNode,
|
|
47
|
+
CodeNode,
|
|
48
|
+
JupyterCellNode,
|
|
49
|
+
EquationNode,
|
|
50
|
+
HashtagNode,
|
|
45
51
|
HeadingNode,
|
|
46
|
-
|
|
52
|
+
HorizontalRuleNode,
|
|
53
|
+
ImageNode,
|
|
54
|
+
JupyterCodeHighlightNode,
|
|
55
|
+
JupyterCodeNode,
|
|
56
|
+
JupyterOutputNode,
|
|
57
|
+
LinkNode,
|
|
47
58
|
ListItemNode,
|
|
59
|
+
ListNode,
|
|
48
60
|
QuoteNode,
|
|
49
|
-
CodeNode,
|
|
50
|
-
JupyterCodeNode,
|
|
51
|
-
JupyterCodeHighlightNode,
|
|
52
|
-
TableNode,
|
|
53
61
|
TableCellNode,
|
|
62
|
+
TableNode,
|
|
54
63
|
TableRowNode,
|
|
55
|
-
AutoLinkNode,
|
|
56
|
-
LinkNode,
|
|
57
|
-
JupyterOutputNode,
|
|
58
|
-
EquationNode,
|
|
59
|
-
ImageNode,
|
|
60
64
|
YouTubeNode,
|
|
61
|
-
HorizontalRuleNode,
|
|
62
|
-
HashtagNode,
|
|
63
65
|
]
|
|
64
66
|
};
|
|
65
67
|
const EditorContextPlugin = () => {
|
|
@@ -73,9 +75,15 @@ const EditorContextPlugin = () => {
|
|
|
73
75
|
};
|
|
74
76
|
export default function Editor(props) {
|
|
75
77
|
const { notebook } = props;
|
|
78
|
+
const [floatingAnchorElem, setFloatingAnchorElem] = useState(null);
|
|
79
|
+
const onRef = (_floatingAnchorElem) => {
|
|
80
|
+
if (_floatingAnchorElem !== null) {
|
|
81
|
+
setFloatingAnchorElem(_floatingAnchorElem);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
76
84
|
function onChange(_editorState) {
|
|
77
85
|
// console.log('---', _editorState.toJSON());
|
|
78
86
|
}
|
|
79
|
-
return (_jsx(LexicalComposer, { initialConfig: initialConfig, children: _jsx("div", { className: "editor-shell", children: _jsxs("div", { className: "editor-container", children: [_jsx(ToolbarPlugin, {}), _jsxs("div", { className: "editor-inner", children: [_jsx(RichTextPlugin, { contentEditable: _jsx(ContentEditable, { className: "editor-input" }), placeholder: _jsx(Placeholder, {}), ErrorBoundary: LexicalErrorBoundary }), _jsx(OnChangePlugin, { onChange: onChange }), _jsx(HistoryPlugin, {}), _jsx(TreeViewPlugin, {}), _jsx(AutoFocusPlugin, {}), _jsx(TablePlugin, {}), _jsx(ListPlugin, {}), _jsx(CheckListPlugin, {}), _jsx(LinkPlugin, {}), _jsx(AutoLinkPlugin, {}), _jsx(ListMaxIndentLevelPlugin, { maxDepth: 7 }), _jsx(MarkdownPlugin, {}), _jsx(JupyterPlugin, {}), _jsx(ComponentPickerMenuPlugin, {}), _jsx(EquationsPlugin, {}), _jsx(ImagesPlugin, {}), _jsx(HorizontalRulePlugin, {}), _jsx(YouTubePlugin, {}), _jsx(NbformatContentPlugin, { notebook: notebook }), _jsx(CodeActionMenuPlugin, {}), _jsx(AutoEmbedPlugin, {}), _jsx(EditorContextPlugin, {}), _jsx(TableOfContentsPlugin, {})] })] }) }) }));
|
|
87
|
+
return (_jsx(LexicalComposer, { initialConfig: initialConfig, children: _jsx("div", { className: "editor-shell", children: _jsxs("div", { className: "editor-container", children: [_jsx(ToolbarPlugin, {}), _jsxs("div", { className: "editor-inner", children: [_jsx(RichTextPlugin, { contentEditable: _jsx("div", { className: "editor-scroller", children: _jsx("div", { className: "editor", ref: onRef, children: _jsx(ContentEditable, { className: "editor-input" }) }) }), placeholder: _jsx(Placeholder, {}), ErrorBoundary: LexicalErrorBoundary }), _jsx(OnChangePlugin, { onChange: onChange }), _jsx(HistoryPlugin, {}), _jsx(TreeViewPlugin, {}), _jsx(AutoFocusPlugin, {}), _jsx(TablePlugin, {}), _jsx(ListPlugin, {}), _jsx(CheckListPlugin, {}), _jsx(LinkPlugin, {}), _jsx(AutoLinkPlugin, {}), _jsx(ListMaxIndentLevelPlugin, { maxDepth: 7 }), _jsx(MarkdownPlugin, {}), _jsx(JupyterCellPlugin, {}), _jsx(JupyterPlugin, {}), _jsx(ComponentPickerMenuPlugin, {}), _jsx(EquationsPlugin, {}), _jsx(ImagesPlugin, {}), _jsx(HorizontalRulePlugin, {}), _jsx(YouTubePlugin, {}), _jsx(NbformatContentPlugin, { notebook: notebook }), _jsx(CodeActionMenuPlugin, {}), _jsx(AutoEmbedPlugin, {}), _jsx(EditorContextPlugin, {}), _jsx(TableOfContentsPlugin, {}), floatingAnchorElem && (_jsx(_Fragment, { children: _jsx(DraggableBlockPlugin, { anchorElem: floatingAnchorElem }) }))] })] }) }) }));
|
|
80
88
|
}
|
|
81
89
|
//# sourceMappingURL=Editor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Editor.js","sourceRoot":"","sources":["../../../src/examples/editor/Editor.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MA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