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,
|
isMobile: isMobile || false,
|
||||||
element: editorContainer,
|
element: editorContainer,
|
||||||
editable: !readonly,
|
editable: !readonly,
|
||||||
parseOptions: { preserveWhitespace: "full" },
|
|
||||||
content,
|
content,
|
||||||
autofocus: "start",
|
autofocus: "start",
|
||||||
onFocus,
|
onFocus,
|
||||||
@@ -383,7 +382,7 @@ function toIEditor(editor: Editor): IEditor {
|
|||||||
tr.setMeta("preventSave", true);
|
tr.setMeta("preventSave", true);
|
||||||
return true;
|
return true;
|
||||||
})
|
})
|
||||||
.setContent(content, true, { preserveWhitespace: "full" })
|
.setContent(content, true, { preserveWhitespace: true })
|
||||||
.setTextSelection({
|
.setTextSelection({
|
||||||
from,
|
from,
|
||||||
to
|
to
|
||||||
|
|||||||
@@ -102,7 +102,6 @@ const Tiptap = ({
|
|||||||
editorProps: {
|
editorProps: {
|
||||||
editable: () => !settings.readonly
|
editable: () => !settings.readonly
|
||||||
},
|
},
|
||||||
parseOptions: { preserveWhitespace: "full" },
|
|
||||||
content: global.editorController?.content?.current,
|
content: global.editorController?.content?.current,
|
||||||
isMobile: true,
|
isMobile: true,
|
||||||
isKeyboardOpen: settings.keyboardShown,
|
isKeyboardOpen: settings.keyboardShown,
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ export function useEditorController(update: () => void): EditorController {
|
|||||||
if (!editor) break;
|
if (!editor) break;
|
||||||
const { from, to } = editor.state.selection;
|
const { from, to } = editor.state.selection;
|
||||||
editor?.commands.setContent(htmlContentRef.current, false, {
|
editor?.commands.setContent(htmlContentRef.current, false, {
|
||||||
preserveWhitespace: "full"
|
preserveWhitespace: true
|
||||||
});
|
});
|
||||||
editor.commands.setTextSelection({
|
editor.commands.setTextSelection({
|
||||||
from,
|
from,
|
||||||
|
|||||||
@@ -630,7 +630,7 @@ function indentOnEnter(editor: Editor, $from: ResolvedPos, options: Indent) {
|
|||||||
return editor
|
return editor
|
||||||
.chain()
|
.chain()
|
||||||
.insertContent(`${newline}${indentation}`, {
|
.insertContent(`${newline}${indentation}`, {
|
||||||
parseOptions: { preserveWhitespace: "full" }
|
parseOptions: { preserveWhitespace: true }
|
||||||
})
|
})
|
||||||
.focus()
|
.focus()
|
||||||
.run();
|
.run();
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ test("codeblocks should get highlighted after pasting", async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
editor.commands.setContent(CODEBLOCKS_HTML, true, {
|
editor.commands.setContent(CODEBLOCKS_HTML, true, {
|
||||||
preserveWhitespace: "full"
|
preserveWhitespace: true
|
||||||
});
|
});
|
||||||
|
|
||||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||||
|
|||||||
@@ -241,7 +241,8 @@ const useTiptap = (
|
|||||||
editor.storage.portalProviderAPI = PortalProviderAPI;
|
editor.storage.portalProviderAPI = PortalProviderAPI;
|
||||||
if (onBeforeCreate) onBeforeCreate({ editor });
|
if (onBeforeCreate) onBeforeCreate({ editor });
|
||||||
},
|
},
|
||||||
injectCSS: false
|
injectCSS: false,
|
||||||
|
parseOptions: { preserveWhitespace: true }
|
||||||
}),
|
}),
|
||||||
[
|
[
|
||||||
onPreviewAttachment,
|
onPreviewAttachment,
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ export function createEditor<TNodes extends string>(
|
|||||||
const editor = new Editor({
|
const editor = new Editor({
|
||||||
element,
|
element,
|
||||||
content: initialContent,
|
content: initialContent,
|
||||||
parseOptions: { preserveWhitespace: "full" },
|
|
||||||
extensions: [
|
extensions: [
|
||||||
StarterKit.configure({
|
StarterKit.configure({
|
||||||
bulletList: false,
|
bulletList: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user