remove deprecated packages

This commit is contained in:
Philipp Kühn 2021-04-06 19:15:46 +02:00
parent 2a64dda01d
commit 70daefa1ca
11 changed files with 0 additions and 914 deletions

View File

@ -1,256 +0,0 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.14](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-beta.13...@tiptap/vue-starter-kit@2.0.0-beta.14) (2021-04-06)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-beta.13](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-beta.12...@tiptap/vue-starter-kit@2.0.0-beta.13) (2021-04-04)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-beta.12](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-beta.11...@tiptap/vue-starter-kit@2.0.0-beta.12) (2021-04-02)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-beta.11](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-beta.10...@tiptap/vue-starter-kit@2.0.0-beta.11) (2021-04-01)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-beta.10](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-beta.9...@tiptap/vue-starter-kit@2.0.0-beta.10) (2021-04-01)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-beta.9](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-beta.8...@tiptap/vue-starter-kit@2.0.0-beta.9) (2021-03-31)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-beta.8](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-beta.7...@tiptap/vue-starter-kit@2.0.0-beta.8) (2021-03-31)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-beta.7](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-beta.6...@tiptap/vue-starter-kit@2.0.0-beta.7) (2021-03-28)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-beta.6](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-beta.5...@tiptap/vue-starter-kit@2.0.0-beta.6) (2021-03-24)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-beta.5](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-beta.4...@tiptap/vue-starter-kit@2.0.0-beta.5) (2021-03-18)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-beta.4](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-beta.3...@tiptap/vue-starter-kit@2.0.0-beta.4) (2021-03-16)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-beta.2...@tiptap/vue-starter-kit@2.0.0-beta.3) (2021-03-09)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-beta.1...@tiptap/vue-starter-kit@2.0.0-beta.2) (2021-03-08)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-alpha.16...@tiptap/vue-starter-kit@2.0.0-beta.1) (2021-03-05)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-alpha.16](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-alpha.15...@tiptap/vue-starter-kit@2.0.0-alpha.16) (2021-02-26)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-alpha.15](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-alpha.14...@tiptap/vue-starter-kit@2.0.0-alpha.15) (2021-02-16)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-alpha.14](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-alpha.13...@tiptap/vue-starter-kit@2.0.0-alpha.14) (2021-02-07)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-alpha.13](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-alpha.12...@tiptap/vue-starter-kit@2.0.0-alpha.13) (2021-02-05)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-alpha.12](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-alpha.11...@tiptap/vue-starter-kit@2.0.0-alpha.12) (2021-01-29)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-alpha.11](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-alpha.10...@tiptap/vue-starter-kit@2.0.0-alpha.11) (2021-01-29)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-alpha.10](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-alpha.9...@tiptap/vue-starter-kit@2.0.0-alpha.10) (2021-01-28)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-alpha.9](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-alpha.8...@tiptap/vue-starter-kit@2.0.0-alpha.9) (2021-01-06)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-alpha.8](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-alpha.7...@tiptap/vue-starter-kit@2.0.0-alpha.8) (2020-12-18)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-alpha.7](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-alpha.6...@tiptap/vue-starter-kit@2.0.0-alpha.7) (2020-12-18)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-alpha.6](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-alpha.5...@tiptap/vue-starter-kit@2.0.0-alpha.6) (2020-12-02)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-alpha.5](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-alpha.4...@tiptap/vue-starter-kit@2.0.0-alpha.5) (2020-11-20)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-alpha.4](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-alpha.3...@tiptap/vue-starter-kit@2.0.0-alpha.4) (2020-11-19)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-alpha.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-alpha.2...@tiptap/vue-starter-kit@2.0.0-alpha.3) (2020-11-19)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-alpha.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@2.0.0-alpha.1...@tiptap/vue-starter-kit@2.0.0-alpha.2) (2020-11-19)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [2.0.0-alpha.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@1.0.0-alpha.2...@tiptap/vue-starter-kit@2.0.0-alpha.1) (2020-11-18)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# [1.0.0-alpha.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue-starter-kit@1.0.0-alpha.1...@tiptap/vue-starter-kit@1.0.0-alpha.2) (2020-11-16)
**Note:** Version bump only for package @tiptap/vue-starter-kit
# 1.0.0-alpha.1 (2020-11-16)
**Note:** Version bump only for package @tiptap/vue-starter-kit

View File

@ -1,14 +0,0 @@
# @tiptap/vue-starter-kit
[![Version](https://img.shields.io/npm/v/@tiptap/vue-starter-kit.svg?label=version)](https://www.npmjs.com/package/@tiptap/vue-starter-kit)
[![Downloads](https://img.shields.io/npm/dm/@tiptap/vue-starter-kit.svg)](https://npmcharts.com/compare/tiptap?minimal=true)
[![License](https://img.shields.io/npm/l/@tiptap/vue-starter-kit.svg)](https://www.npmjs.com/package/@tiptap/vue-starter-kit)
[![Sponsor](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub)](https://github.com/sponsors/ueberdosis)
## Introduction
tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) a toolkit for building rich text WYSIWYG editors, which is already in use at many well-known companies such as *New York Times*, *The Guardian* or *Atlassian*.
## Offical Documentation
Documentation can be found on the [tiptap website](https://tiptap.dev).
## License
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).

View File

@ -1,28 +0,0 @@
{
"name": "@tiptap/vue-starter-kit",
"description": "Vue starter kit for tiptap",
"version": "2.0.0-beta.14",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",
"tiptap starter kit"
],
"license": "MIT",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/ueberdosis"
},
"main": "dist/tiptap-vue-starter-kit.cjs.js",
"umd": "dist/tiptap-vue-starter-kit.umd.js",
"module": "dist/tiptap-vue-starter-kit.esm.js",
"unpkg": "dist/tiptap-vue-starter-kit.bundle.umd.min.js",
"types": "dist/packages/vue-starter-kit/src/index.d.ts",
"files": [
"src",
"dist"
],
"dependencies": {
"@tiptap/starter-kit": "^2.0.0-beta.10",
"@tiptap/vue": "^2.0.0-beta.5"
}
}

View File

@ -1,2 +0,0 @@
export * from '@tiptap/starter-kit'
export * from '@tiptap/vue'

View File

@ -1,160 +0,0 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.5](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue@2.0.0-beta.4...@tiptap/vue@2.0.0-beta.5) (2021-03-31)
**Note:** Version bump only for package @tiptap/vue
# [2.0.0-beta.4](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue@2.0.0-beta.3...@tiptap/vue@2.0.0-beta.4) (2021-03-28)
**Note:** Version bump only for package @tiptap/vue
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue@2.0.0-beta.2...@tiptap/vue@2.0.0-beta.3) (2021-03-24)
**Note:** Version bump only for package @tiptap/vue
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue@2.0.0-beta.1...@tiptap/vue@2.0.0-beta.2) (2021-03-18)
**Note:** Version bump only for package @tiptap/vue
# [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue@2.0.0-alpha.13...@tiptap/vue@2.0.0-beta.1) (2021-03-05)
**Note:** Version bump only for package @tiptap/vue
# [2.0.0-alpha.13](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue@2.0.0-alpha.12...@tiptap/vue@2.0.0-alpha.13) (2021-02-26)
**Note:** Version bump only for package @tiptap/vue
# [2.0.0-alpha.12](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue@2.0.0-alpha.11...@tiptap/vue@2.0.0-alpha.12) (2021-02-16)
**Note:** Version bump only for package @tiptap/vue
# [2.0.0-alpha.11](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue@2.0.0-alpha.10...@tiptap/vue@2.0.0-alpha.11) (2021-02-07)
**Note:** Version bump only for package @tiptap/vue
# [2.0.0-alpha.10](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue@2.0.0-alpha.9...@tiptap/vue@2.0.0-alpha.10) (2021-02-05)
**Note:** Version bump only for package @tiptap/vue
# [2.0.0-alpha.9](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue@2.0.0-alpha.8...@tiptap/vue@2.0.0-alpha.9) (2021-01-29)
**Note:** Version bump only for package @tiptap/vue
# [2.0.0-alpha.8](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue@2.0.0-alpha.7...@tiptap/vue@2.0.0-alpha.8) (2021-01-29)
**Note:** Version bump only for package @tiptap/vue
# [2.0.0-alpha.7](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue@2.0.0-alpha.6...@tiptap/vue@2.0.0-alpha.7) (2021-01-28)
**Note:** Version bump only for package @tiptap/vue
# [2.0.0-alpha.6](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue@2.0.0-alpha.5...@tiptap/vue@2.0.0-alpha.6) (2021-01-06)
**Note:** Version bump only for package @tiptap/vue
# [2.0.0-alpha.5](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue@2.0.0-alpha.4...@tiptap/vue@2.0.0-alpha.5) (2020-12-18)
**Note:** Version bump only for package @tiptap/vue
# [2.0.0-alpha.4](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue@2.0.0-alpha.3...@tiptap/vue@2.0.0-alpha.4) (2020-12-02)
**Note:** Version bump only for package @tiptap/vue
# [2.0.0-alpha.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue@2.0.0-alpha.2...@tiptap/vue@2.0.0-alpha.3) (2020-11-19)
**Note:** Version bump only for package @tiptap/vue
# [2.0.0-alpha.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue@2.0.0-alpha.1...@tiptap/vue@2.0.0-alpha.2) (2020-11-19)
**Note:** Version bump only for package @tiptap/vue
# [2.0.0-alpha.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue@1.0.0-alpha.2...@tiptap/vue@2.0.0-alpha.1) (2020-11-18)
**Note:** Version bump only for package @tiptap/vue
# [1.0.0-alpha.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/vue@1.0.0-alpha.1...@tiptap/vue@1.0.0-alpha.2) (2020-11-16)
**Note:** Version bump only for package @tiptap/vue
# 1.0.0-alpha.1 (2020-11-16)
**Note:** Version bump only for package @tiptap/vue

View File

@ -1,14 +0,0 @@
# @tiptap/vue
[![Version](https://img.shields.io/npm/v/@tiptap/vue.svg?label=version)](https://www.npmjs.com/package/@tiptap/vue)
[![Downloads](https://img.shields.io/npm/dm/@tiptap/vue.svg)](https://npmcharts.com/compare/tiptap?minimal=true)
[![License](https://img.shields.io/npm/l/@tiptap/vue.svg)](https://www.npmjs.com/package/@tiptap/vue)
[![Sponsor](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub)](https://github.com/sponsors/ueberdosis)
## Introduction
tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) a toolkit for building rich text WYSIWYG editors, which is already in use at many well-known companies such as *New York Times*, *The Guardian* or *Atlassian*.
## Offical Documentation
Documentation can be found on the [tiptap website](https://tiptap.dev).
## License
tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).

View File

@ -1,31 +0,0 @@
{
"name": "@tiptap/vue",
"description": "Vue components for tiptap",
"version": "2.0.0-beta.5",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",
"tiptap vue components"
],
"license": "MIT",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/ueberdosis"
},
"main": "dist/tiptap-vue.cjs.js",
"umd": "dist/tiptap-vue.umd.js",
"module": "dist/tiptap-vue.esm.js",
"unpkg": "dist/tiptap-vue.bundle.umd.min.js",
"types": "dist/packages/vue/src/index.d.ts",
"files": [
"src",
"dist"
],
"peerDependencies": {
"@tiptap/core": "^2.0.0-beta.1",
"vue": "^2.6.12"
},
"dependencies": {
"prosemirror-view": "^1.18.2"
}
}

View File

@ -1,331 +0,0 @@
import {
Editor,
Node,
NodeViewRenderer,
NodeViewRendererProps,
} from '@tiptap/core'
import { Decoration, NodeView } from 'prosemirror-view'
import { NodeSelection } from 'prosemirror-state'
import { Node as ProseMirrorNode } from 'prosemirror-model'
import Vue from 'vue'
import { VueConstructor } from 'vue/types/umd'
import VueRenderer from './VueRenderer'
function getComponentFromElement(element: HTMLElement): Vue {
// @ts-ignore
// eslint-disable-next-line
return element.__vue__
}
interface VueNodeViewRendererOptions {
stopEvent: ((event: Event) => boolean) | null,
update: ((node: ProseMirrorNode, decorations: Decoration[]) => boolean) | null,
}
class VueNodeView implements NodeView {
renderer!: VueRenderer
editor: Editor
extension!: Node
node!: ProseMirrorNode
decorations!: Decoration[]
id!: string
getPos!: any
isDragging = false
options: VueNodeViewRendererOptions = {
stopEvent: null,
update: null,
}
constructor(component: Vue | VueConstructor, props: NodeViewRendererProps, options?: Partial<VueNodeViewRendererOptions>) {
this.options = { ...this.options, ...options }
this.editor = props.editor
this.extension = props.extension
this.node = props.node
this.getPos = props.getPos
this.createUniqueId()
this.mount(component)
}
createUniqueId() {
this.id = `id_${Math.floor(Math.random() * 0xFFFFFFFF)}`
}
createNodeViewWrapper() {
const { handleDragStart } = this
const dragstart = handleDragStart.bind(this)
return Vue.extend({
props: {
as: {
type: String,
default: 'div',
},
},
render(createElement) {
return createElement(
this.as, {
style: {
whiteSpace: 'normal',
},
on: {
dragstart,
},
},
this.$slots.default,
)
},
})
}
handleDragStart(event: DragEvent) {
const { view } = this.editor
const target = (event.target as HTMLElement)
if (this.contentDOM?.contains(target)) {
return
}
// sometimes `event.target` is not the `dom` element
event.dataTransfer?.setDragImage(this.dom, 0, 0)
const selection = NodeSelection.create(view.state.doc, this.getPos())
const transaction = view.state.tr.setSelection(selection)
view.dispatch(transaction)
}
createNodeViewContent() {
const { id } = this
const { isEditable } = this.editor
return Vue.extend({
inheritAttrs: false,
props: {
as: {
type: String,
default: 'div',
},
},
render(createElement) {
return createElement(
this.as, {
style: {
whiteSpace: 'pre-wrap',
},
domProps: {
id,
contenteditable: isEditable,
},
},
)
},
})
}
mount(component: Vue | VueConstructor) {
const NodeViewWrapper = this.createNodeViewWrapper()
const NodeViewContent = this.createNodeViewContent()
const Component = Vue
.extend(component)
.extend({
components: {
NodeViewWrapper,
NodeViewContent,
},
})
const propsData = {
NodeViewWrapper,
NodeViewContent,
editor: this.editor,
node: this.node,
decorations: this.decorations,
selected: false,
extension: this.extension,
getPos: () => this.getPos(),
updateAttributes: (attributes = {}) => this.updateAttributes(attributes),
}
const parent = this.editor.view.dom.parentElement
? getComponentFromElement(this.editor.view.dom.parentElement)
: undefined
this.renderer = new VueRenderer(Component, {
parent,
propsData,
})
}
get dom() {
return this.renderer.element
}
get contentDOM() {
if (this.dom.id === this.id) {
return this.dom
}
return this.dom.querySelector(`#${this.id}`)
}
stopEvent(event: Event) {
if (typeof this.options.stopEvent === 'function') {
return this.options.stopEvent(event)
}
const target = (event.target as HTMLElement)
const isInElement = this.dom.contains(target) && !this.contentDOM?.contains(target)
// ignore all events from child nodes
if (!isInElement) {
return false
}
const { isEditable } = this.editor
const { isDragging } = this
const isDraggable = !!this.node.type.spec.draggable
const isSelectable = NodeSelection.isSelectable(this.node)
const isCopyEvent = event.type === 'copy'
const isPasteEvent = event.type === 'paste'
const isCutEvent = event.type === 'cut'
const isClickEvent = event.type === 'mousedown'
const isDragEvent = event.type.startsWith('drag') || event.type === 'drop'
// ProseMirror tries to drag selectable nodes
// even if `draggable` is set to `false`
// this fix prevents that
if (!isDraggable && isSelectable && isDragEvent) {
event.preventDefault()
}
if (isDraggable && isDragEvent && !isDragging) {
event.preventDefault()
return false
}
// we have to store that dragging started
if (isDraggable && isEditable && !isDragging && isClickEvent) {
const dragHandle = target.closest('[data-drag-handle]')
const isValidDragHandle = dragHandle
&& (this.dom === dragHandle || (this.dom.contains(dragHandle)))
if (isValidDragHandle) {
this.isDragging = true
document.addEventListener('dragend', () => {
this.isDragging = false
}, { once: true })
}
}
// these events are handled by prosemirror
if (
isDragging
|| isCopyEvent
|| isPasteEvent
|| isCutEvent
|| (isClickEvent && isSelectable)
) {
return false
}
return true
}
ignoreMutation(mutation: MutationRecord | { type: 'selection'; target: Element }) {
if (mutation.type === 'selection') {
if (this.node.isLeaf) {
return true
}
return false
}
if (!this.contentDOM) {
return true
}
const contentDOMHasChanged = !this.contentDOM.contains(mutation.target)
|| this.contentDOM === mutation.target
return contentDOMHasChanged
}
destroy() {
this.renderer.destroy()
}
update(node: ProseMirrorNode, decorations: Decoration[]) {
if (typeof this.options.update === 'function') {
return this.options.update(node, decorations)
}
if (node.type !== this.node.type) {
return false
}
if (node === this.node && this.decorations === decorations) {
return true
}
this.node = node
this.decorations = decorations
this.renderer.updateProps({ node, decorations })
return true
}
updateAttributes(attributes: {}) {
if (!this.editor.view.editable) {
return
}
const { state } = this.editor.view
const pos = this.getPos()
const transaction = state.tr.setNodeMarkup(pos, undefined, {
...this.node.attrs,
...attributes,
})
this.editor.view.dispatch(transaction)
}
selectNode() {
this.renderer.updateProps({
selected: true,
})
}
deselectNode() {
this.renderer.updateProps({
selected: false,
})
}
}
export default function VueNodeViewRenderer(component: Vue | VueConstructor, options?: Partial<VueNodeViewRendererOptions>): NodeViewRenderer {
return (props: NodeViewRendererProps) => {
// try to get the parent component
// this is important for vue devtools to show the component hierarchy correctly
// maybe its `undefined` because <editor-content> isnt rendered yet
const parent = props.editor.view.dom.parentElement
? getComponentFromElement(props.editor.view.dom.parentElement)
: undefined
if (!parent) {
return {}
}
return new VueNodeView(component, props, options) as NodeView
}
}

View File

@ -1,38 +0,0 @@
import Vue from 'vue'
import { VueConstructor } from 'vue/types/umd'
export default class VueRenderer {
vm!: Vue
constructor(component: Vue | VueConstructor, props: any) {
const Component = Vue.extend(component)
this.vm = new Component(props).$mount()
}
get element() {
return this.vm.$el
}
updateProps(props: { [key: string]: any } = {}) {
if (!this.vm.$props) {
return
}
// prevents `Avoid mutating a prop directly` error message
const originalSilent = Vue.config.silent
Vue.config.silent = true
Object
.entries(props)
.forEach(([key, value]) => {
this.vm.$props[key] = value
})
Vue.config.silent = originalSilent
}
destroy() {
this.vm.$destroy()
}
}

View File

@ -1,36 +0,0 @@
import Vue from 'vue'
export default Vue.extend({
name: 'EditorContent',
props: {
editor: {
default: null,
type: Object,
},
},
watch: {
editor: {
immediate: true,
handler(editor) {
if (editor && editor.options.element) {
this.$nextTick(() => {
this.$el.appendChild(editor.options.element.firstChild)
editor.createNodeViews()
})
}
},
},
},
render(createElement) {
return createElement('div')
},
beforeDestroy() {
this.editor.setOptions({
element: this.$el,
})
},
})

View File

@ -1,4 +0,0 @@
export * from '@tiptap/core'
export { default as VueRenderer } from './VueRenderer'
export { default as VueNodeViewRenderer } from './VueNodeViewRenderer'
export { default as EditorContent } from './components/EditorContent'