@tiptap/core
Advanced tools
Comparing version 2.2.0-rc.7 to 2.2.0-rc.8
@@ -22,2 +22,4 @@ export * from './blur.js'; | ||
export * from './joinItemForward.js'; | ||
export * from './joinTextblockBackward.js'; | ||
export * from './joinTextblockForward.js'; | ||
export * from './keyboardShortcut.js'; | ||
@@ -24,0 +26,0 @@ export * from './lift.js'; |
@@ -7,2 +7,3 @@ import { MarkType, NodeType, Schema } from '@tiptap/pm/model'; | ||
import * as extensions from './extensions/index.js'; | ||
import { NodePos } from './NodePos.js'; | ||
import { CanCommands, ChainedCommands, EditorEvents, EditorOptions, JSONContent, SingleCommands, TextSerializer } from './types.js'; | ||
@@ -152,2 +153,10 @@ export { extensions }; | ||
get isDestroyed(): boolean; | ||
$node(selector: string, attributes?: { | ||
[key: string]: any; | ||
}): NodePos | null; | ||
$nodes(selector: string, attributes?: { | ||
[key: string]: any; | ||
}): NodePos[] | null; | ||
$pos(pos: number): NodePos; | ||
get $doc(): NodePos; | ||
} |
@@ -10,2 +10,3 @@ export * from './CommandManager.js'; | ||
export * from './Node.js'; | ||
export * from './NodePos.js'; | ||
export * from './NodeView.js'; | ||
@@ -12,0 +13,0 @@ export * from './PasteRule.js'; |
@@ -11,3 +11,3 @@ import { EditorState, Plugin } from '@tiptap/pm/state'; | ||
}; | ||
export declare type PasteRuleFinder = RegExp | ((text: string) => PasteRuleMatch[] | null | undefined); | ||
export declare type PasteRuleFinder = RegExp | ((text: string, event?: ClipboardEvent) => PasteRuleMatch[] | null | undefined); | ||
export declare class PasteRule { | ||
@@ -14,0 +14,0 @@ find: PasteRuleFinder; |
{ | ||
"name": "@tiptap/core", | ||
"description": "headless rich text editor", | ||
"version": "2.2.0-rc.7", | ||
"version": "2.2.0-rc.8", | ||
"homepage": "https://tiptap.dev", | ||
@@ -35,3 +35,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"@tiptap/pm": "^2.2.0-rc.7" | ||
"@tiptap/pm": "^2.2.0-rc.8" | ||
}, | ||
@@ -38,0 +38,0 @@ "peerDependencies": { |
@@ -22,2 +22,4 @@ export * from './blur.js' | ||
export * from './joinItemForward.js' | ||
export * from './joinTextblockBackward.js' | ||
export * from './joinTextblockForward.js' | ||
export * from './keyboardShortcut.js' | ||
@@ -24,0 +26,0 @@ export * from './lift.js' |
@@ -1,3 +0,5 @@ | ||
import { MarkType, NodeType, Schema } from '@tiptap/pm/model' | ||
import { | ||
MarkType, NodeType, Schema, | ||
} from '@tiptap/pm/model' | ||
import { | ||
EditorState, Plugin, PluginKey, Transaction, | ||
@@ -19,2 +21,3 @@ } from '@tiptap/pm/state' | ||
import { resolveFocusPosition } from './helpers/resolveFocusPosition.js' | ||
import { NodePos } from './NodePos.js' | ||
import { style } from './style.js' | ||
@@ -490,2 +493,20 @@ import { | ||
} | ||
public $node(selector: string, attributes?: { [key: string]: any }): NodePos | null { | ||
return this.$doc?.querySelector(selector, attributes) || null | ||
} | ||
public $nodes(selector: string, attributes?: { [key: string]: any }): NodePos[] | null { | ||
return this.$doc?.querySelectorAll(selector, attributes) || null | ||
} | ||
public $pos(pos: number) { | ||
const $pos = this.state.doc.resolve(pos) | ||
return new NodePos($pos, this) | ||
} | ||
get $doc() { | ||
return this.$pos(0) | ||
} | ||
} |
@@ -300,3 +300,3 @@ import { Plugin, Transaction } from '@tiptap/pm/state' | ||
name: this.name, | ||
defaultOptions: undefined, | ||
defaultOptions: {}, | ||
} | ||
@@ -312,3 +312,3 @@ | ||
if (config.defaultOptions) { | ||
if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) { | ||
console.warn( | ||
@@ -315,0 +315,0 @@ `[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`, |
@@ -16,3 +16,2 @@ import { EditorState, Transaction } from '@tiptap/pm/state' | ||
applyTransaction: state.applyTransaction.bind(state), | ||
filterTransaction: state.filterTransaction, | ||
plugins: state.plugins, | ||
@@ -19,0 +18,0 @@ schema: state.schema, |
@@ -29,2 +29,6 @@ import { Node as ProseMirrorNode } from '@tiptap/pm/model' | ||
doc.nodesBetween(from, to, (node, pos) => { | ||
if (!node || node.nodeSize === undefined) { | ||
return | ||
} | ||
marks.push( | ||
@@ -31,0 +35,0 @@ ...node.marks.map(mark => ({ |
@@ -10,2 +10,3 @@ export * from './CommandManager.js' | ||
export * from './Node.js' | ||
export * from './NodePos.js' | ||
export * from './NodeView.js' | ||
@@ -12,0 +13,0 @@ export * from './PasteRule.js' |
@@ -432,3 +432,3 @@ import { | ||
name: this.name, | ||
defaultOptions: undefined, | ||
defaultOptions: {}, | ||
} | ||
@@ -444,3 +444,3 @@ | ||
if (config.defaultOptions) { | ||
if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) { | ||
console.warn( | ||
@@ -447,0 +447,0 @@ `[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`, |
@@ -541,3 +541,3 @@ import { | ||
name: this.name, | ||
defaultOptions: undefined, | ||
defaultOptions: {}, | ||
} | ||
@@ -553,3 +553,3 @@ | ||
if (config.defaultOptions) { | ||
if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) { | ||
console.warn( | ||
@@ -556,0 +556,0 @@ `[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`, |
@@ -24,3 +24,3 @@ import { EditorState, Plugin } from '@tiptap/pm/state' | ||
export type PasteRuleFinder = RegExp | ((text: string) => PasteRuleMatch[] | null | undefined) | ||
export type PasteRuleFinder = RegExp | ((text: string, event?: ClipboardEvent) => PasteRuleMatch[] | null | undefined) | ||
@@ -62,2 +62,3 @@ export class PasteRule { | ||
find: PasteRuleFinder, | ||
event?: ClipboardEvent, | ||
): ExtendedRegExpMatchArray[] => { | ||
@@ -68,3 +69,3 @@ if (isRegExp(find)) { | ||
const matches = find(text) | ||
const matches = find(text, event) | ||
@@ -125,3 +126,3 @@ if (!matches) { | ||
const matches = pasteRuleMatcherHandler(textToMatch, rule.find) | ||
const matches = pasteRuleMatcherHandler(textToMatch, rule.find, pasteEvent) | ||
@@ -128,0 +129,0 @@ matches.forEach(match => { |
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
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
2023688
330
23729