@tiptap/extension-mention
Advanced tools
Comparing version 2.6.6 to 2.7.0-pre.0
@@ -36,3 +36,3 @@ import { Node, mergeAttributes } from '@tiptap/core'; | ||
command: ({ editor, range, props }) => { | ||
var _a, _b; | ||
var _a, _b, _c; | ||
// increase range.to by one when the next node is of type "text" | ||
@@ -59,3 +59,4 @@ // and starts with a space character | ||
.run(); | ||
(_b = window.getSelection()) === null || _b === void 0 ? void 0 : _b.collapseToEnd(); | ||
// get reference to `window` object from editor element, to support cross-frame JS usage | ||
(_c = (_b = editor.view.dom.ownerDocument.defaultView) === null || _b === void 0 ? void 0 : _b.getSelection()) === null || _c === void 0 ? void 0 : _c.collapseToEnd(); | ||
}, | ||
@@ -62,0 +63,0 @@ allow: ({ state, range }) => { |
@@ -38,3 +38,3 @@ (function (global, factory) { | ||
command: ({ editor, range, props }) => { | ||
var _a, _b; | ||
var _a, _b, _c; | ||
// increase range.to by one when the next node is of type "text" | ||
@@ -61,3 +61,4 @@ // and starts with a space character | ||
.run(); | ||
(_b = window.getSelection()) === null || _b === void 0 ? void 0 : _b.collapseToEnd(); | ||
// get reference to `window` object from editor element, to support cross-frame JS usage | ||
(_c = (_b = editor.view.dom.ownerDocument.defaultView) === null || _b === void 0 ? void 0 : _b.getSelection()) === null || _c === void 0 ? void 0 : _c.collapseToEnd(); | ||
}, | ||
@@ -64,0 +65,0 @@ allow: ({ state, range }) => { |
@@ -14,2 +14,4 @@ export * from './CommandManager.js'; | ||
export * from './pasteRules/index.js'; | ||
export * from './plugins/DropPlugin.js'; | ||
export * from './plugins/PastePlugin.js'; | ||
export * from './Tracker.js'; | ||
@@ -16,0 +18,0 @@ export * from './types.js'; |
@@ -1,6 +0,4 @@ | ||
import { Node as ProseMirrorNode } from '@tiptap/pm/model'; | ||
import { NodeView as ProseMirrorNodeView } from '@tiptap/pm/view'; | ||
import { Editor as CoreEditor } from './Editor.js'; | ||
import { Node } from './Node.js'; | ||
import { DecorationWithType, NodeViewRendererOptions, NodeViewRendererProps } from './types.js'; | ||
import { NodeViewRendererOptions, NodeViewRendererProps } from './types.js'; | ||
/** | ||
@@ -14,6 +12,9 @@ * Node views are used to customize the rendered DOM structure of a node. | ||
options: Options; | ||
extension: Node; | ||
node: ProseMirrorNode; | ||
decorations: DecorationWithType[]; | ||
getPos: any; | ||
extension: NodeViewRendererProps['extension']; | ||
node: NodeViewRendererProps['node']; | ||
decorations: NodeViewRendererProps['decorations']; | ||
innerDecorations: NodeViewRendererProps['innerDecorations']; | ||
view: NodeViewRendererProps['view']; | ||
getPos: NodeViewRendererProps['getPos']; | ||
HTMLAttributes: NodeViewRendererProps['HTMLAttributes']; | ||
isDragging: boolean; | ||
@@ -26,2 +27,7 @@ constructor(component: Component, props: NodeViewRendererProps, options?: Partial<Options>); | ||
stopEvent(event: Event): boolean; | ||
/** | ||
* Called when a DOM [mutation](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) or a selection change happens within the view. | ||
* @return `false` if the editor should re-read the selection or re-parse the range around the mutation | ||
* @return `true` if it can safely be ignored. | ||
*/ | ||
ignoreMutation(mutation: MutationRecord | { | ||
@@ -31,4 +37,10 @@ type: 'selection'; | ||
}): boolean; | ||
updateAttributes(attributes: {}): void; | ||
/** | ||
* Update the attributes of the prosemirror node. | ||
*/ | ||
updateAttributes(attributes: Record<string, any>): void; | ||
/** | ||
* Delete the node. | ||
*/ | ||
deleteNode(): void; | ||
} |
@@ -1,4 +0,4 @@ | ||
import { Mark as ProseMirrorMark, Node as ProseMirrorNode, NodeType, ParseOptions } from '@tiptap/pm/model'; | ||
import { Mark as ProseMirrorMark, Node as ProseMirrorNode, NodeType, ParseOptions, Slice } from '@tiptap/pm/model'; | ||
import { EditorState, Transaction } from '@tiptap/pm/state'; | ||
import { Decoration, EditorProps, EditorView, NodeView } from '@tiptap/pm/view'; | ||
import { Decoration, EditorProps, EditorView, NodeView, NodeViewConstructor } from '@tiptap/pm/view'; | ||
import { Editor } from './Editor.js'; | ||
@@ -82,4 +82,21 @@ import { Extension } from './Extension.js'; | ||
enablePasteRules: EnableRules; | ||
enableCoreExtensions: boolean; | ||
/** | ||
* Determines whether core extensions are enabled. | ||
* | ||
* If set to `false`, all core extensions will be disabled. | ||
* To disable specific core extensions, provide an object where the keys are the extension names and the values are `false`. | ||
* Extensions not listed in the object will remain enabled. | ||
* | ||
* @example | ||
* // Disable all core extensions | ||
* enabledCoreExtensions: false | ||
* | ||
* @example | ||
* // Disable only the keymap core extension | ||
* enabledCoreExtensions: { keymap: false } | ||
* | ||
* @default true | ||
*/ | ||
enableCoreExtensions?: boolean | Partial<Record<'editable' | 'clipboardTextSerializer' | 'commands' | 'focusEvents' | 'keymap' | 'tabindex', false>>; | ||
/** | ||
* If `true`, the editor will check the content for errors on initialization. | ||
@@ -104,2 +121,4 @@ * Emitting the `contentError` event if the content is invalid. | ||
onDestroy: (props: EditorEvents['destroy']) => void; | ||
onPaste: (e: ClipboardEvent, slice: Slice) => void; | ||
onDrop: (e: DragEvent, slice: Slice, moved: boolean) => void; | ||
} | ||
@@ -175,15 +194,14 @@ export type HTMLContent = string; | ||
}[keyof T]; | ||
export type Simplify<T> = { | ||
[KeyType in keyof T]: T[KeyType]; | ||
} & {}; | ||
export type DecorationWithType = Decoration & { | ||
type: NodeType; | ||
}; | ||
export type NodeViewProps = { | ||
editor: Editor; | ||
node: ProseMirrorNode; | ||
decorations: DecorationWithType[]; | ||
export type NodeViewProps = Simplify<Omit<NodeViewRendererProps, 'decorations'> & { | ||
decorations: readonly DecorationWithType[]; | ||
selected: boolean; | ||
extension: Node; | ||
getPos: () => number; | ||
updateAttributes: (attributes: Record<string, any>) => void; | ||
deleteNode: () => void; | ||
}; | ||
}>; | ||
export interface NodeViewRendererOptions { | ||
@@ -202,10 +220,12 @@ stopEvent: ((props: { | ||
export type NodeViewRendererProps = { | ||
node: Parameters<NodeViewConstructor>[0]; | ||
view: Parameters<NodeViewConstructor>[1]; | ||
getPos: () => number; | ||
decorations: Parameters<NodeViewConstructor>[3]; | ||
innerDecorations: Parameters<NodeViewConstructor>[4]; | ||
editor: Editor; | ||
node: ProseMirrorNode; | ||
getPos: (() => number) | boolean; | ||
extension: Node; | ||
HTMLAttributes: Record<string, any>; | ||
decorations: Decoration[]; | ||
extension: Node; | ||
}; | ||
export type NodeViewRenderer = (props: NodeViewRendererProps) => NodeView | {}; | ||
export type NodeViewRenderer = (props: NodeViewRendererProps) => NodeView; | ||
export type AnyCommands = Record<string, (...args: any[]) => Command>; | ||
@@ -212,0 +232,0 @@ export type UnionCommands<T = Command> = UnionToIntersection<ValuesOf<Pick<Commands<T>, KeysWithTypeOf<Commands<T>, {}>>>>; |
{ | ||
"name": "@tiptap/extension-mention", | ||
"description": "mention extension for tiptap", | ||
"version": "2.6.6", | ||
"version": "2.7.0-pre.0", | ||
"homepage": "https://tiptap.dev", | ||
@@ -32,10 +32,10 @@ "keywords": [ | ||
"devDependencies": { | ||
"@tiptap/core": "^2.6.6", | ||
"@tiptap/pm": "^2.6.6", | ||
"@tiptap/suggestion": "^2.6.6" | ||
"@tiptap/core": "^2.7.0-pre.0", | ||
"@tiptap/pm": "^2.7.0-pre.0", | ||
"@tiptap/suggestion": "^2.7.0-pre.0" | ||
}, | ||
"peerDependencies": { | ||
"@tiptap/core": "^2.6.6", | ||
"@tiptap/pm": "^2.6.6", | ||
"@tiptap/suggestion": "^2.6.6" | ||
"@tiptap/core": "^2.7.0-pre.0", | ||
"@tiptap/pm": "^2.7.0-pre.0", | ||
"@tiptap/suggestion": "^2.7.0-pre.0" | ||
}, | ||
@@ -42,0 +42,0 @@ "repository": { |
@@ -122,3 +122,4 @@ import { mergeAttributes, Node } from '@tiptap/core' | ||
window.getSelection()?.collapseToEnd() | ||
// get reference to `window` object from editor element, to support cross-frame JS usage | ||
editor.view.dom.ownerDocument.defaultView?.getSelection()?.collapseToEnd() | ||
}, | ||
@@ -125,0 +126,0 @@ allow: ({ state, range }) => { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
218886
178
4826
1