A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
editor: don't insert empty p tag before hr (fixes #867)
Abdullah Atta09130394de87
diff --git a/packages/editor/src/index.ts b/packages/editor/src/index.tsindex 69876aa6f..6a110bf46 100644--- a/packages/editor/src/index.ts+++ b/packages/editor/src/index.ts@@ -71,6 +71,7 @@ import { Paragraph } from "./extensions/paragraph";import { ClipboardTextSerializer } from "./extensions/clipboard-text-serializer";import { Code } from "@tiptap/extension-code";import { DateTime } from "./extensions/date-time";+import HorizontalRule from "@tiptap/extension-horizontal-rule";const CoreExtensions = Object.entries(TiptapCoreExtensions)// we will implement our own customized clipboard serializer@@ -143,6 +144,25 @@ const useTiptap = (},dropcursor: {class: "drop-cursor"+ },+ horizontalRule: false+ }),+ HorizontalRule.extend({+ addInputRules() {+ return [+ {+ find: /^(?:---|—-|___\s|\*\*\*\s)$/,+ handler: ({ state, range, commands }) => {+ commands.splitBlock();++ const attributes = {};+ const { tr } = state;+ const start = range.from;+ const end = range.to;+ tr.replaceWith(start - 1, end, this.type.create(attributes));+ }+ }+ ];}}),CharacterCount,