diff --git a/code/client/src/App.tsx b/code/client/src/App.tsx index 6c8a2f1b..6dd9c501 100644 --- a/code/client/src/App.tsx +++ b/code/client/src/App.tsx @@ -1,10 +1,12 @@ import { BrowserRouter as Router, Route, Routes } from 'react-router-dom'; import SlateEditor from '@editor/slate/SlateEditor'; +import Header from '@src/components/header/Header'; import './App.scss'; function App() { return (
+
} /> diff --git a/code/client/src/editor/slate/SlateEditor.tsx b/code/client/src/editor/slate/SlateEditor.tsx index d34e3366..a8051f8b 100644 --- a/code/client/src/editor/slate/SlateEditor.tsx +++ b/code/client/src/editor/slate/SlateEditor.tsx @@ -14,7 +14,6 @@ import useCommunication from '@editor/hooks/useCommunication'; import { withMarkdown } from '@editor/slate/plugins/markdown/withMarkdown'; import markdownHandlers from '@editor/domain/markdown/handlers'; import './SlateEditor.scss'; -import Header from '@src/components/header/Header'; // for testing purposes, we need to be able to pass in an editor type SlateEditorProps = { @@ -40,7 +39,6 @@ function SlateEditor({ editor: _editor }: SlateEditorProps) { return (
-
{/**/} diff --git a/code/client/src/editor/slate/events/inputEvents.ts b/code/client/src/editor/slate/events/inputEvents.ts index 70afce6a..e35c78b2 100644 --- a/code/client/src/editor/slate/events/inputEvents.ts +++ b/code/client/src/editor/slate/events/inputEvents.ts @@ -26,6 +26,7 @@ export default (editor: Editor, fugue: Fugue, communication: Communication) => { onEnter(cursor); break; case 'Backspace': + if (isSelected(editor)) break; onBackspace(cursor); break; case 'Delete': @@ -68,7 +69,7 @@ export default (editor: Editor, fugue: Fugue, communication: Communication) => { function onEnter(cursor: Cursor) { const operations = fugue.insertLocal(cursor, '\n'); const styleOperation = fugue.updateBlockStyleLocal('paragraph', cursor.line, true); - communication.emitChunked('operation', [...operations, styleOperation]); + communication.emitChunked('operation', [styleOperation, ...operations]); } /** diff --git a/code/client/src/editor/slate/utils/selection.ts b/code/client/src/editor/slate/utils/selection.ts index 356fab43..66dcb257 100644 --- a/code/client/src/editor/slate/utils/selection.ts +++ b/code/client/src/editor/slate/utils/selection.ts @@ -44,7 +44,6 @@ function pointToCursor(editor: Editor, point: Point): Cursor { const line = point.path[0]; const children = Node.children(editor, [line]); const cursor: Cursor = { line, column: point.offset }; - for (const entry of children) { if (Path.equals(entry[1], point.path)) break; cursor.column += first(entry).text.length; diff --git a/code/client/tests/editor/slate/SlateEditor.test.tsx b/code/client/tests/editor/slate/SlateEditor.test.tsx index ca98f705..65bbddcb 100644 --- a/code/client/tests/editor/slate/SlateEditor.test.tsx +++ b/code/client/tests/editor/slate/SlateEditor.test.tsx @@ -20,10 +20,7 @@ describe('SlateEditor', () => { }); it('should render the editor', async () => { - const h1Title = screen.getByText('NoteSpace'); const documentTitle = screen.getByPlaceholderText('Untitled'); - - expect(h1Title).toBeInTheDocument(); expect(documentTitle).toBeInTheDocument(); expect(editor).toHaveTextContent(EDITOR_PLACEHOLDER); });