docs: update content

This commit is contained in:
Philipp Kühn
2021-06-04 22:40:36 +02:00
parent ab5a81e3a8
commit 592f62ed0e
6 changed files with 23 additions and 24 deletions

View File

@@ -1,5 +1,5 @@
import * as Y from 'yjs'
import { Extension, Command } from '@tiptap/core'
import { Extension } from '@tiptap/core'
import { AnnotationPlugin, AnnotationPluginKey } from './AnnotationPlugin'
export interface AddAnnotationAction {
@@ -50,11 +50,11 @@ function getMapFromOptions(options: AnnotationOptions): Y.Map<any> {
}
declare module '@tiptap/core' {
interface Commands {
interface Commands<ReturnType> {
annotation: {
addAnnotation: (data: any) => Command,
updateAnnotation: (id: string, data: any) => Command,
deleteAnnotation: (id: string) => Command,
addAnnotation: (data: any) => ReturnType,
updateAnnotation: (id: string, data: any) => ReturnType,
deleteAnnotation: (id: string) => ReturnType,
}
}
}

View File

@@ -1,4 +1,4 @@
import { Node, mergeAttributes, Command } from '@tiptap/core'
import { Node, mergeAttributes } from '@tiptap/core'
export interface DetailsOptions {
HTMLAttributes: {
@@ -7,20 +7,20 @@ export interface DetailsOptions {
}
declare module '@tiptap/core' {
interface Commands {
interface Commands<ReturnType> {
details: {
/**
* Set a details node
*/
setDetails: () => Command,
setDetails: () => ReturnType,
/**
* Toggle a details node
*/
toggleDetails: () => Command,
toggleDetails: () => ReturnType,
/**
* Unset a details node
*/
unsetDetails: () => Command,
unsetDetails: () => ReturnType,
}
}
}

View File

@@ -1,4 +1,4 @@
import { Node, Command } from '@tiptap/core'
import { Node } from '@tiptap/core'
export interface IframeOptions {
allowFullscreen: boolean,
@@ -8,12 +8,12 @@ export interface IframeOptions {
}
declare module '@tiptap/core' {
interface Commands {
interface Commands<ReturnType> {
iframe: {
/**
* Add an iframe
*/
setIframe: (options: { src: string }) => Command,
setIframe: (options: { src: string }) => ReturnType,
}
}
}

View File

@@ -1,5 +1,4 @@
import {
Command,
Node,
nodeInputRule,
mergeAttributes,
@@ -11,7 +10,7 @@ export interface FigureOptions {
}
declare module '@tiptap/core' {
interface Commands {
interface Commands<ReturnType> {
figure: {
/**
* Add a figure element
@@ -21,17 +20,17 @@ declare module '@tiptap/core' {
alt?: string,
title?: string,
caption?: string,
}) => Command,
}) => ReturnType,
/**
* Converts an image to a figure
*/
imageToFigure: () => Command,
imageToFigure: () => ReturnType,
/**
* Converts a figure to an image
*/
figureToImage: () => Command,
figureToImage: () => ReturnType,
}
}
}

View File

@@ -1,4 +1,4 @@
import { Command, Node, mergeAttributes } from '@tiptap/core'
import { Node, mergeAttributes } from '@tiptap/core'
import { exitCode } from 'prosemirror-commands'
export interface WordBreakOptions {
@@ -8,12 +8,12 @@ export interface WordBreakOptions {
}
declare module '@tiptap/core' {
interface Commands {
interface Commands<ReturnType> {
wordBreak: {
/**
* Add a hard break
*/
setWordBreak: () => Command,
setWordBreak: () => ReturnType,
}
}
}

View File

@@ -34,15 +34,15 @@ const CustomExtension = Extension.create<CustomExtensionOptions>({
The core package also exports a `Command` type, which needs to be added to all commands that you specify in your code. Here is an example:
```ts
import { Command, Extension } from '@tiptap/core'
import { Extension } from '@tiptap/core'
declare module '@tiptap/core' {
interface Commands {
interface Commands<ReturnType> {
customExtension: {
/**
* Comments will be added to the autocomplete.
*/
yourCommand: (someProp: any) => Command,
yourCommand: (someProp: any) => ReturnType,
}
}
}