refactor(tiptap): export isValidUrl and UploadImageNodeView for testability
This commit is contained in:
parent
19532670d3
commit
8ff051689f
@ -247,7 +247,7 @@ interface SlashPopup {
|
||||
}
|
||||
|
||||
/** 校验图片/链接 URL:只允许 http(s) 和 data:image。拒绝 javascript: 等。 */
|
||||
function isValidUrl(url: string): boolean {
|
||||
export function isValidUrl(url: string): boolean {
|
||||
return /^https?:\/\//i.test(url) || /^data:image\//i.test(url)
|
||||
}
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ export interface UploadNodeViewCallbacks {
|
||||
* NodeView 纯渲染,不发起上传——按钮点击转发给注入的 callbacks(实际是 coordinator)。
|
||||
* 属性变化时 ProseMirror 调 update(node),NodeView 比较新旧 data-upload-state 重渲染遮罩。
|
||||
*/
|
||||
class UploadImageNodeView {
|
||||
export class UploadImageNodeView {
|
||||
private node: PMNode
|
||||
private callbacks: UploadNodeViewCallbacks
|
||||
private uploadId: string | null
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user