add some extensions

This commit is contained in:
Philipp Kühn
2020-03-05 20:30:58 +01:00
parent aff52325a2
commit 6e85098741
10 changed files with 78 additions and 33 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@tiptap/core",
"version": "0.1.0",
"version": "2.0.0",
"source": "index.ts",
"main": "dist/tiptap-core.js",
"umd:main": "dist/tiptap-core.umd.js",

View File

@@ -16,6 +16,7 @@ type EditorContent = string | JSON
interface Options {
element?: Node
content: EditorContent
extensions: [any?]
injectCSS: Boolean
}
@@ -35,6 +36,7 @@ export class Editor {
options: Options = {
content: '',
injectCSS: true,
extensions: [],
}
constructor(options: Options) {
@@ -141,7 +143,7 @@ export class Editor {
// @ts-ignore
this[name] = this.chainCommand((...args: any) => {
return new Promise(resolve => {
return method(resolve as Function, this as Editor, ...args as any)
return method(resolve, this, ...args)
})
})

View File

@@ -1,6 +1,8 @@
import { Editor } from './Editor'
export default class Extension {
export default abstract class Extension {
public abstract name: string
editor: any
options: { [key: string]: any } = {}
@@ -21,10 +23,6 @@ export default class Extension {
this.editor = editor
}
get name(): any {
return null
}
get type(): any {
return 'extension'
}

View File

@@ -1,6 +1,6 @@
import Extension from './Extension'
export default class Node extends Extension {
export default abstract class Node extends Extension {
constructor(options = {}) {
super(options)
@@ -8,20 +8,22 @@ export default class Node extends Extension {
// protected type = 'node'
get type() {
return 'node'
}
// get type() {
// return 'node'
// }
get view(): any {
return null
}
// get view(): any {
// return null
// }
get schema(): any {
return null
}
// get schema(): any {
// return null
// }
command() {
return () => {}
}
public abstract schema: any
// command() {
// return () => {}
// }
}