all filters fully functional. reporting system added. multiple fixes. #27
@ -146,11 +146,22 @@ type MenuBarProps = {
|
|||||||
|
|
||||||
const MenuBar = ({ editor }: MenuBarProps) => {
|
const MenuBar = ({ editor }: MenuBarProps) => {
|
||||||
const setLink = () => {
|
const setLink = () => {
|
||||||
const url = prompt('URL')
|
// Prompt the user to enter a URL
|
||||||
|
let url = prompt('URL')
|
||||||
|
|
||||||
|
// Check if the user provided a URL
|
||||||
if (url) {
|
if (url) {
|
||||||
|
// If the URL doesn't start with 'http://' or 'https://',
|
||||||
|
// prepend 'https://' to the URL
|
||||||
|
if (!/^(http|https):\/\//i.test(url)) {
|
||||||
|
url = `https://${url}`
|
||||||
|
}
|
||||||
|
|
||||||
return editor.chain().focus().setLink({ href: url }).run()
|
return editor.chain().focus().setLink({ href: url }).run()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If no URL was provided (e.g., the user cancels the prompt),
|
||||||
|
// return false, indicating that the link was not set.
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user