Remove svelte from editor
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import type {NodeViewProps} from "@tiptap/core"
|
||||
|
||||
export const Bolt11NodeView = ({node}: NodeViewProps) => {
|
||||
const dom = document.createElement("span")
|
||||
|
||||
dom.classList.add("tiptap-object")
|
||||
dom.innerText = `${node.attrs.lnbc.slice(0, 16)}...`
|
||||
|
||||
return {
|
||||
dom,
|
||||
selectNode() {
|
||||
dom.classList.add("tiptap-active")
|
||||
},
|
||||
deselectNode() {
|
||||
dom.classList.remove("tiptap-active")
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import type {NodeViewProps} from "@tiptap/core"
|
||||
import {fromNostrURI} from "@welshman/util"
|
||||
|
||||
export const EventNodeView = ({node}: NodeViewProps) => {
|
||||
const dom = document.createElement("span")
|
||||
|
||||
dom.classList.add("tiptap-object")
|
||||
dom.innerText = `${fromNostrURI(node.attrs.bech32).slice(0, 16)}...`
|
||||
|
||||
return {
|
||||
dom,
|
||||
selectNode() {
|
||||
dom.classList.add("tiptap-active")
|
||||
},
|
||||
deselectNode() {
|
||||
dom.classList.remove("tiptap-active")
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import type {NodeViewProps} from "@tiptap/core"
|
||||
|
||||
export const MediaNodeView = ({node}: NodeViewProps) => {
|
||||
const dom = document.createElement("span")
|
||||
|
||||
const syncUploading = (node: NodeViewProps["node"]) => {
|
||||
if (node.attrs.uploading) {
|
||||
dom.classList.add("tiptap-uploading")
|
||||
} else {
|
||||
dom.classList.remove("tiptap-uploading")
|
||||
}
|
||||
}
|
||||
|
||||
dom.classList.add("tiptap-object")
|
||||
dom.innerText = node.attrs.file?.name || node.attrs.src
|
||||
|
||||
syncUploading(node)
|
||||
|
||||
return {
|
||||
dom,
|
||||
update(node: NodeViewProps["node"]) {
|
||||
syncUploading(node)
|
||||
},
|
||||
selectNode() {
|
||||
dom.classList.add("tiptap-active")
|
||||
},
|
||||
deselectNode() {
|
||||
dom.classList.remove("tiptap-active")
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import type {NodeViewProps} from "@tiptap/core"
|
||||
|
||||
export const MentionNodeView = ({node}: NodeViewProps) => {
|
||||
const dom = document.createElement("span")
|
||||
|
||||
dom.classList.add("tiptap-object")
|
||||
dom.textContent = `@${node.attrs.bech32.slice(0, 16)}...`
|
||||
|
||||
return {
|
||||
dom,
|
||||
selectNode() {
|
||||
dom.classList.add("tiptap-active")
|
||||
},
|
||||
deselectNode() {
|
||||
dom.classList.remove("tiptap-active")
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export * from "./MentionNodeView.js"
|
||||
export * from "./Bolt11NodeView.js"
|
||||
export * from "./EventNodeView.js"
|
||||
export * from "./MediaNodeView.js"
|
||||
Reference in New Issue
Block a user