mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-08-06 13:38:49 +08:00
fix more errors
This commit is contained in:
parent
c330e41a50
commit
54195d29eb
@ -95,7 +95,7 @@ module.exports = function (api) {
|
||||
.test(/\.tsx?$/)
|
||||
.use()
|
||||
.loader('ts-loader')
|
||||
.options({ transpileOnly: true, appendTsSuffixTo: [/\.vue$/] })
|
||||
.options({ transpileOnly: false, appendTsSuffixTo: [/\.vue$/] })
|
||||
|
||||
config.module
|
||||
.rule('jsx')
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { MarkType, NodeType } from 'prosemirror-model'
|
||||
import { Plugin } from 'prosemirror-state'
|
||||
import { Editor } from './Editor'
|
||||
import { GlobalAttributes } from './types'
|
||||
@ -27,7 +26,6 @@ export interface ExtensionSpec<Options = {}, Commands = {}> {
|
||||
addCommands?: (this: {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: NodeType | MarkType,
|
||||
}) => Commands,
|
||||
|
||||
/**
|
||||
@ -36,7 +34,6 @@ export interface ExtensionSpec<Options = {}, Commands = {}> {
|
||||
addKeyboardShortcuts?: (this: {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: NodeType | MarkType,
|
||||
}) => {
|
||||
[key: string]: any
|
||||
},
|
||||
@ -47,7 +44,6 @@ export interface ExtensionSpec<Options = {}, Commands = {}> {
|
||||
addInputRules?: (this: {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
// type: NodeType | MarkType,
|
||||
}) => any[],
|
||||
|
||||
/**
|
||||
@ -56,7 +52,6 @@ export interface ExtensionSpec<Options = {}, Commands = {}> {
|
||||
addPasteRules?: (this: {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: NodeType | MarkType,
|
||||
}) => any[],
|
||||
|
||||
/**
|
||||
@ -65,7 +60,6 @@ export interface ExtensionSpec<Options = {}, Commands = {}> {
|
||||
addProseMirrorPlugins?: (this: {
|
||||
options: Options,
|
||||
editor: Editor,
|
||||
type: NodeType | MarkType,
|
||||
}) => Plugin[],
|
||||
}
|
||||
|
||||
|
@ -3,10 +3,10 @@ import {
|
||||
} from 'prosemirror-model'
|
||||
import { Plugin } from 'prosemirror-state'
|
||||
import { ExtensionSpec, defaultExtension } from './Extension'
|
||||
import { Attributes } from './types'
|
||||
import { Attributes, Overwrite } from './types'
|
||||
import { Editor } from './Editor'
|
||||
|
||||
export interface MarkExtensionSpec<Options = {}, Commands = {}> extends ExtensionSpec<Options, Commands> {
|
||||
export interface MarkExtensionSpec<Options = {}, Commands = {}> extends Overwrite<ExtensionSpec<Options, Commands>, {
|
||||
/**
|
||||
* Inclusive
|
||||
*/
|
||||
@ -104,7 +104,7 @@ export interface MarkExtensionSpec<Options = {}, Commands = {}> extends Extensio
|
||||
editor: Editor,
|
||||
type: MarkType,
|
||||
}) => Plugin[],
|
||||
}
|
||||
}> {}
|
||||
|
||||
export type MarkExtension = Required<Omit<MarkExtensionSpec, 'defaultOptions'> & {
|
||||
type: string,
|
||||
@ -122,7 +122,7 @@ const defaultMark: MarkExtension = {
|
||||
group: null,
|
||||
spanning: null,
|
||||
parseHTML: () => null,
|
||||
renderHTML: () => null,
|
||||
renderHTML: () => '',
|
||||
addAttributes: () => ({}),
|
||||
}
|
||||
|
||||
|
@ -3,10 +3,10 @@ import {
|
||||
} from 'prosemirror-model'
|
||||
import { Plugin } from 'prosemirror-state'
|
||||
import { ExtensionSpec, defaultExtension } from './Extension'
|
||||
import { Attributes } from './types'
|
||||
import { Attributes, Overwrite } from './types'
|
||||
import { Editor } from './Editor'
|
||||
|
||||
export interface NodeExtensionSpec<Options = {}, Commands = {}> extends ExtensionSpec<Options, Commands> {
|
||||
export interface NodeExtensionSpec<Options = {}, Commands = {}> extends Overwrite<ExtensionSpec<Options, Commands>, {
|
||||
/**
|
||||
* TopNode
|
||||
*/
|
||||
@ -139,7 +139,7 @@ export interface NodeExtensionSpec<Options = {}, Commands = {}> extends Extensio
|
||||
editor: Editor,
|
||||
type: NodeType,
|
||||
}) => Plugin[],
|
||||
}
|
||||
}> {}
|
||||
|
||||
export type NodeExtension = Required<Omit<NodeExtensionSpec, 'defaultOptions'> & {
|
||||
type: string,
|
||||
@ -164,7 +164,7 @@ const defaultNode: NodeExtension = {
|
||||
defining: null,
|
||||
isolating: null,
|
||||
parseHTML: () => null,
|
||||
renderHTML: () => null,
|
||||
renderHTML: () => '',
|
||||
addAttributes: () => ({}),
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ export type Attributes = {
|
||||
export type ExtensionAttribute = {
|
||||
type: string,
|
||||
name: string,
|
||||
attribute: Attribute,
|
||||
attribute: Required<Attribute>,
|
||||
}
|
||||
|
||||
export type GlobalAttributes = {
|
||||
@ -33,3 +33,8 @@ export type PickValue<T, K extends keyof T> = T[K]
|
||||
export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I)=>void)
|
||||
? I
|
||||
: never
|
||||
|
||||
export type Diff<T extends keyof any, U extends keyof any> =
|
||||
({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T]
|
||||
|
||||
export type Overwrite<T, U> = Pick<T, Diff<keyof T, keyof U>> & U;
|
||||
|
@ -7,7 +7,7 @@ export interface FocusOptions {
|
||||
nested: boolean,
|
||||
}
|
||||
|
||||
const Focus = createExtension({
|
||||
const FocusClasses = createExtension({
|
||||
defaultOptions: <FocusOptions>{
|
||||
className: 'has-focus',
|
||||
nested: false,
|
||||
@ -47,10 +47,10 @@ const Focus = createExtension({
|
||||
},
|
||||
})
|
||||
|
||||
export default Focus
|
||||
export default FocusClasses
|
||||
|
||||
declare module '@tiptap/core/src/Editor' {
|
||||
interface AllExtensions {
|
||||
Focus: typeof Focus,
|
||||
FocusClasses: typeof FocusClasses,
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,9 @@
|
||||
"files": [
|
||||
"./shims/vue.d.ts"
|
||||
],
|
||||
"filesGlob": [
|
||||
"packages/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"dist"
|
||||
|
Loading…
Reference in New Issue
Block a user