|
| 1 | +From 38394f2dbdc7313e8b6f973b4bb44e375a3aee5f Mon Sep 17 00:00:00 2001 |
| 2 | +From: Manuel <30572287+manuel-rw@users.noreply.github.com> |
| 3 | +Date: Mon, 9 Oct 2023 21:12:33 +0200 |
| 4 | +Subject: [PATCH] =?UTF-8?q?=F0=9F=94=92=EF=B8=8F=20Fix=20tiptap=20url=20CV?= |
| 5 | + =?UTF-8?q?E?= |
| 6 | +MIME-Version: 1.0 |
| 7 | +Content-Type: text/plain; charset=UTF-8 |
| 8 | +Content-Transfer-Encoding: 8bit |
| 9 | + |
| 10 | +Source: https://github.com/ajnart/homarr/pull/1459 |
| 11 | + |
| 12 | +--- |
| 13 | + src/widgets/notebook/NotebookEditor.tsx | 13 ++++++++++--- |
| 14 | + 1 file changed, 10 insertions(+), 3 deletions(-) |
| 15 | + |
| 16 | +diff --git a/src/widgets/notebook/NotebookEditor.tsx b/src/widgets/notebook/NotebookEditor.tsx |
| 17 | +index ce71e9f13d9..4ec8ccb6970 100644 |
| 18 | +--- a/src/widgets/notebook/NotebookEditor.tsx |
| 19 | ++++ b/src/widgets/notebook/NotebookEditor.tsx |
| 20 | +@@ -5,12 +5,12 @@ import { IconEdit, IconEditOff } from '@tabler/icons-react'; |
| 21 | + import { BubbleMenu, useEditor } from '@tiptap/react'; |
| 22 | + import StarterKit from '@tiptap/starter-kit'; |
| 23 | + import { useState } from 'react'; |
| 24 | ++import { useEditModeStore } from '~/components/Dashboard/Views/useEditModeStore'; |
| 25 | ++import { useConfigContext } from '~/config/provider'; |
| 26 | + import { useConfigStore } from '~/config/store'; |
| 27 | + import { useColorTheme } from '~/tools/color'; |
| 28 | + import { api } from '~/utils/api'; |
| 29 | + |
| 30 | +-import { useEditModeStore } from '~/components/Dashboard/Views/useEditModeStore'; |
| 31 | +-import { useConfigContext } from '~/config/provider'; |
| 32 | + import { WidgetLoading } from '../loading'; |
| 33 | + import { INotebookWidget } from './NotebookWidgetTile'; |
| 34 | + |
| 35 | +@@ -33,7 +33,14 @@ export function Editor({ widget }: { widget: INotebookWidget }) { |
| 36 | + const [debouncedContent] = useDebouncedValue(content, 500); |
| 37 | + |
| 38 | + const editor = useEditor({ |
| 39 | +- extensions: [StarterKit, Link], |
| 40 | ++ extensions: [ |
| 41 | ++ StarterKit, |
| 42 | ++ Link.configure({ |
| 43 | ++ validate(url) { |
| 44 | ++ return /^https?:\/\//.test(url); |
| 45 | ++ }, |
| 46 | ++ }), |
| 47 | ++ ], |
| 48 | + content, |
| 49 | + editable: false, |
| 50 | + onUpdate: (e) => { |
0 commit comments