@tiptap/extension-code-block-lowlight
Advanced tools
Comparing version 2.6.6 to 2.7.0-pre.0
@@ -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-code-block-lowlight", | ||
"description": "code block extension for tiptap", | ||
"version": "2.6.6", | ||
"version": "2.7.0-pre.0", | ||
"homepage": "https://tiptap.dev", | ||
@@ -32,11 +32,11 @@ "keywords": [ | ||
"devDependencies": { | ||
"@tiptap/core": "^2.6.6", | ||
"@tiptap/extension-code-block": "^2.6.6", | ||
"@tiptap/pm": "^2.6.6", | ||
"@tiptap/core": "^2.7.0-pre.0", | ||
"@tiptap/extension-code-block": "^2.7.0-pre.0", | ||
"@tiptap/pm": "^2.7.0-pre.0", | ||
"lowlight": "^2 || ^3" | ||
}, | ||
"peerDependencies": { | ||
"@tiptap/core": "^2.6.6", | ||
"@tiptap/extension-code-block": "^2.6.6", | ||
"@tiptap/pm": "^2.6.6", | ||
"@tiptap/core": "^2.7.0-pre.0", | ||
"@tiptap/extension-code-block": "^2.7.0-pre.0", | ||
"@tiptap/pm": "^2.7.0-pre.0", | ||
"lowlight": "^2 || ^3", | ||
@@ -43,0 +43,0 @@ "highlight.js": "^11" |
@@ -52,3 +52,3 @@ import { findChildren } from '@tiptap/core' | ||
const nodes = language && (languages.includes(language) || registered(language)) | ||
const nodes = language && (languages.includes(language) || registered(language) || lowlight.registered?.(language)) | ||
? getHighlightNodes(lowlight.highlight(language, block.node.textContent)) | ||
@@ -55,0 +55,0 @@ : getHighlightNodes(lowlight.highlightAuto(block.node.textContent)) |
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 too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
843937
179
11331
1