mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
editor: do not convert \n characters to paragraphs
This commit is contained in:
@@ -162,7 +162,6 @@ function TipTap(props: TipTapProps) {
|
||||
isMobile: isMobile || false,
|
||||
element: editorContainer,
|
||||
editable: !readonly,
|
||||
parseOptions: { preserveWhitespace: "full" },
|
||||
content,
|
||||
autofocus: "start",
|
||||
onFocus,
|
||||
@@ -383,7 +382,7 @@ function toIEditor(editor: Editor): IEditor {
|
||||
tr.setMeta("preventSave", true);
|
||||
return true;
|
||||
})
|
||||
.setContent(content, true, { preserveWhitespace: "full" })
|
||||
.setContent(content, true, { preserveWhitespace: true })
|
||||
.setTextSelection({
|
||||
from,
|
||||
to
|
||||
|
||||
@@ -102,7 +102,6 @@ const Tiptap = ({
|
||||
editorProps: {
|
||||
editable: () => !settings.readonly
|
||||
},
|
||||
parseOptions: { preserveWhitespace: "full" },
|
||||
content: global.editorController?.content?.current,
|
||||
isMobile: true,
|
||||
isKeyboardOpen: settings.keyboardShown,
|
||||
|
||||
@@ -118,7 +118,7 @@ export function useEditorController(update: () => void): EditorController {
|
||||
if (!editor) break;
|
||||
const { from, to } = editor.state.selection;
|
||||
editor?.commands.setContent(htmlContentRef.current, false, {
|
||||
preserveWhitespace: "full"
|
||||
preserveWhitespace: true
|
||||
});
|
||||
editor.commands.setTextSelection({
|
||||
from,
|
||||
|
||||
@@ -630,7 +630,7 @@ function indentOnEnter(editor: Editor, $from: ResolvedPos, options: Indent) {
|
||||
return editor
|
||||
.chain()
|
||||
.insertContent(`${newline}${indentation}`, {
|
||||
parseOptions: { preserveWhitespace: "full" }
|
||||
parseOptions: { preserveWhitespace: true }
|
||||
})
|
||||
.focus()
|
||||
.run();
|
||||
|
||||
@@ -57,7 +57,7 @@ test("codeblocks should get highlighted after pasting", async () => {
|
||||
});
|
||||
|
||||
editor.commands.setContent(CODEBLOCKS_HTML, true, {
|
||||
preserveWhitespace: "full"
|
||||
preserveWhitespace: true
|
||||
});
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
|
||||
@@ -241,7 +241,8 @@ const useTiptap = (
|
||||
editor.storage.portalProviderAPI = PortalProviderAPI;
|
||||
if (onBeforeCreate) onBeforeCreate({ editor });
|
||||
},
|
||||
injectCSS: false
|
||||
injectCSS: false,
|
||||
parseOptions: { preserveWhitespace: true }
|
||||
}),
|
||||
[
|
||||
onPreviewAttachment,
|
||||
|
||||
@@ -39,7 +39,6 @@ export function createEditor<TNodes extends string>(
|
||||
const editor = new Editor({
|
||||
element,
|
||||
content: initialContent,
|
||||
parseOptions: { preserveWhitespace: "full" },
|
||||
extensions: [
|
||||
StarterKit.configure({
|
||||
bulletList: false,
|
||||
|
||||
Reference in New Issue
Block a user