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 * as Y from 'yjs'
import { Extension, Command } from '@tiptap/core' import { Extension } from '@tiptap/core'
import { AnnotationPlugin, AnnotationPluginKey } from './AnnotationPlugin' import { AnnotationPlugin, AnnotationPluginKey } from './AnnotationPlugin'
export interface AddAnnotationAction { export interface AddAnnotationAction {
@@ -50,11 +50,11 @@ function getMapFromOptions(options: AnnotationOptions): Y.Map<any> {
} }
declare module '@tiptap/core' { declare module '@tiptap/core' {
interface Commands { interface Commands<ReturnType> {
annotation: { annotation: {
addAnnotation: (data: any) => Command, addAnnotation: (data: any) => ReturnType,
updateAnnotation: (id: string, data: any) => Command, updateAnnotation: (id: string, data: any) => ReturnType,
deleteAnnotation: (id: string) => Command, 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 { export interface DetailsOptions {
HTMLAttributes: { HTMLAttributes: {
@@ -7,20 +7,20 @@ export interface DetailsOptions {
} }
declare module '@tiptap/core' { declare module '@tiptap/core' {
interface Commands { interface Commands<ReturnType> {
details: { details: {
/** /**
* Set a details node * Set a details node
*/ */
setDetails: () => Command, setDetails: () => ReturnType,
/** /**
* Toggle a details node * Toggle a details node
*/ */
toggleDetails: () => Command, toggleDetails: () => ReturnType,
/** /**
* Unset a details node * 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 { export interface IframeOptions {
allowFullscreen: boolean, allowFullscreen: boolean,
@@ -8,12 +8,12 @@ export interface IframeOptions {
} }
declare module '@tiptap/core' { declare module '@tiptap/core' {
interface Commands { interface Commands<ReturnType> {
iframe: { iframe: {
/** /**
* Add an iframe * Add an iframe
*/ */
setIframe: (options: { src: string }) => Command, setIframe: (options: { src: string }) => ReturnType,
} }
} }
} }

View File

@@ -1,5 +1,4 @@
import { import {
Command,
Node, Node,
nodeInputRule, nodeInputRule,
mergeAttributes, mergeAttributes,
@@ -11,7 +10,7 @@ export interface FigureOptions {
} }
declare module '@tiptap/core' { declare module '@tiptap/core' {
interface Commands { interface Commands<ReturnType> {
figure: { figure: {
/** /**
* Add a figure element * Add a figure element
@@ -21,17 +20,17 @@ declare module '@tiptap/core' {
alt?: string, alt?: string,
title?: string, title?: string,
caption?: string, caption?: string,
}) => Command, }) => ReturnType,
/** /**
* Converts an image to a figure * Converts an image to a figure
*/ */
imageToFigure: () => Command, imageToFigure: () => ReturnType,
/** /**
* Converts a figure to an image * 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' import { exitCode } from 'prosemirror-commands'
export interface WordBreakOptions { export interface WordBreakOptions {
@@ -8,12 +8,12 @@ export interface WordBreakOptions {
} }
declare module '@tiptap/core' { declare module '@tiptap/core' {
interface Commands { interface Commands<ReturnType> {
wordBreak: { wordBreak: {
/** /**
* Add a hard break * 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: 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 ```ts
import { Command, Extension } from '@tiptap/core' import { Extension } from '@tiptap/core'
declare module '@tiptap/core' { declare module '@tiptap/core' {
interface Commands { interface Commands<ReturnType> {
customExtension: { customExtension: {
/** /**
* Comments will be added to the autocomplete. * Comments will be added to the autocomplete.
*/ */
yourCommand: (someProp: any) => Command, yourCommand: (someProp: any) => ReturnType,
} }
} }
} }