@tiptap/core 3.0.2 → 3.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/jsx-runtime.ts"],"sourcesContent":["export type Attributes = Record<string, any>\n\nexport type DOMOutputSpecElement = 0 | Attributes | DOMOutputSpecArray\n/**\n * Better describes the output of a `renderHTML` function in prosemirror\n * @see https://prosemirror.net/docs/ref/#model.DOMOutputSpec\n */\nexport type DOMOutputSpecArray =\n | [string]\n | [string, Attributes]\n | [string, 0]\n | [string, Attributes, 0]\n | [string, Attributes, DOMOutputSpecArray | 0]\n | [string, DOMOutputSpecArray]\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n // @ts-ignore - conflict with React typings\n type Element = [string, ...any[]]\n // @ts-ignore - conflict with React typings\n interface IntrinsicElements {\n // @ts-ignore - conflict with React typings\n [key: string]: any\n }\n }\n}\n\nexport type JSXRenderer = (\n tag: 'slot' | string | ((props?: Attributes) => DOMOutputSpecArray | DOMOutputSpecElement),\n props?: Attributes,\n ...children: JSXRenderer[]\n) => DOMOutputSpecArray | DOMOutputSpecElement\n\nexport function Fragment(props: { children: JSXRenderer[] }) {\n return props.children\n}\n\nexport const h: JSXRenderer = (tag, attributes) => {\n // Treat the slot tag as the Prosemirror hole to render content into\n if (tag === 'slot') {\n return 0\n }\n\n // If the tag is a function, call it with the props\n if (tag instanceof Function) {\n return tag(attributes)\n }\n\n const { children, ...rest } = attributes ?? {}\n\n if (tag === 'svg') {\n throw new Error('SVG elements are not supported in the JSX syntax, use the array syntax instead')\n }\n\n // Otherwise, return the tag, attributes, and children\n return [tag, rest, children]\n}\n\n// See\n// https://esbuild.github.io/api/#jsx-import-source\n// https://www.typescriptlang.org/tsconfig/#jsxImportSource\n\nexport { h as createElement, h as jsx, h as jsxDEV, h as jsxs }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkCO,SAAS,SAAS,OAAoC;AAC3D,SAAO,MAAM;AACf;AAEO,IAAM,IAAiB,CAAC,KAAK,eAAe;AAEjD,MAAI,QAAQ,QAAQ;AAClB,WAAO;AAAA,EACT;AAGA,MAAI,eAAe,UAAU;AAC3B,WAAO,IAAI,UAAU;AAAA,EACvB;AAEA,QAAM,EAAE,UAAU,GAAG,KAAK,IAAI,kCAAc,CAAC;AAE7C,MAAI,QAAQ,OAAO;AACjB,UAAM,IAAI,MAAM,gFAAgF;AAAA,EAClG;AAGA,SAAO,CAAC,KAAK,MAAM,QAAQ;AAC7B;","names":[]}
1
+ {"version":3,"sources":["../../src/jsx-runtime.ts"],"sourcesContent":["export type Attributes = Record<string, any>\n\nexport type DOMOutputSpecElement = 0 | Attributes | DOMOutputSpecArray\n/**\n * Better describes the output of a `renderHTML` function in prosemirror\n * @see https://prosemirror.net/docs/ref/#model.DOMOutputSpec\n */\nexport type DOMOutputSpecArray =\n | [string]\n | [string, Attributes]\n | [string, 0]\n | [string, Attributes, 0]\n | [string, Attributes, DOMOutputSpecArray | 0]\n | [string, DOMOutputSpecArray]\n\n// JSX types for Tiptap's JSX runtime\n// These types only apply when using @jsxImportSource @tiptap/core\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace JSX {\n export type Element = DOMOutputSpecArray\n export interface IntrinsicElements {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any\n }\n export interface ElementChildrenAttribute {\n children: unknown\n }\n}\n\nexport type JSXRenderer = (\n tag: 'slot' | string | ((props?: Attributes) => DOMOutputSpecArray | DOMOutputSpecElement),\n props?: Attributes,\n ...children: JSXRenderer[]\n) => DOMOutputSpecArray | DOMOutputSpecElement\n\nexport function Fragment(props: { children: JSXRenderer[] }) {\n return props.children\n}\n\nexport const h: JSXRenderer = (tag, attributes) => {\n // Treat the slot tag as the Prosemirror hole to render content into\n if (tag === 'slot') {\n return 0\n }\n\n // If the tag is a function, call it with the props\n if (tag instanceof Function) {\n return tag(attributes)\n }\n\n const { children, ...rest } = attributes ?? {}\n\n if (tag === 'svg') {\n throw new Error('SVG elements are not supported in the JSX syntax, use the array syntax instead')\n }\n\n // Otherwise, return the tag, attributes, and children\n return [tag, rest, children]\n}\n\n// See\n// https://esbuild.github.io/api/#jsx-import-source\n// https://www.typescriptlang.org/tsconfig/#jsxImportSource\n\nexport { h as createElement, h as jsx, h as jsxDEV, h as jsxs }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmCO,SAAS,SAAS,OAAoC;AAC3D,SAAO,MAAM;AACf;AAEO,IAAM,IAAiB,CAAC,KAAK,eAAe;AAEjD,MAAI,QAAQ,QAAQ;AAClB,WAAO;AAAA,EACT;AAGA,MAAI,eAAe,UAAU;AAC3B,WAAO,IAAI,UAAU;AAAA,EACvB;AAEA,QAAM,EAAE,UAAU,GAAG,KAAK,IAAI,kCAAc,CAAC;AAE7C,MAAI,QAAQ,OAAO;AACjB,UAAM,IAAI,MAAM,gFAAgF;AAAA,EAClG;AAGA,SAAO,CAAC,KAAK,MAAM,QAAQ;AAC7B;","names":[]}
@@ -5,12 +5,13 @@ type DOMOutputSpecElement = 0 | Attributes | DOMOutputSpecArray;
5
5
  * @see https://prosemirror.net/docs/ref/#model.DOMOutputSpec
6
6
  */
7
7
  type DOMOutputSpecArray = [string] | [string, Attributes] | [string, 0] | [string, Attributes, 0] | [string, Attributes, DOMOutputSpecArray | 0] | [string, DOMOutputSpecArray];
8
- declare global {
9
- namespace JSX {
10
- type Element = [string, ...any[]];
11
- interface IntrinsicElements {
12
- [key: string]: any;
13
- }
8
+ declare namespace JSX {
9
+ type Element = DOMOutputSpecArray;
10
+ interface IntrinsicElements {
11
+ [key: string]: any;
12
+ }
13
+ interface ElementChildrenAttribute {
14
+ children: unknown;
14
15
  }
15
16
  }
16
17
  type JSXRenderer = (tag: 'slot' | string | ((props?: Attributes) => DOMOutputSpecArray | DOMOutputSpecElement), props?: Attributes, ...children: JSXRenderer[]) => DOMOutputSpecArray | DOMOutputSpecElement;
@@ -19,4 +20,4 @@ declare function Fragment(props: {
19
20
  }): JSXRenderer[];
20
21
  declare const h: JSXRenderer;
21
22
 
22
- export { type Attributes, type DOMOutputSpecArray, type DOMOutputSpecElement, Fragment, type JSXRenderer, h as createElement, h, h as jsx, h as jsxDEV, h as jsxs };
23
+ export { type Attributes, type DOMOutputSpecArray, type DOMOutputSpecElement, Fragment, JSX, type JSXRenderer, h as createElement, h, h as jsx, h as jsxDEV, h as jsxs };
@@ -5,12 +5,13 @@ type DOMOutputSpecElement = 0 | Attributes | DOMOutputSpecArray;
5
5
  * @see https://prosemirror.net/docs/ref/#model.DOMOutputSpec
6
6
  */
7
7
  type DOMOutputSpecArray = [string] | [string, Attributes] | [string, 0] | [string, Attributes, 0] | [string, Attributes, DOMOutputSpecArray | 0] | [string, DOMOutputSpecArray];
8
- declare global {
9
- namespace JSX {
10
- type Element = [string, ...any[]];
11
- interface IntrinsicElements {
12
- [key: string]: any;
13
- }
8
+ declare namespace JSX {
9
+ type Element = DOMOutputSpecArray;
10
+ interface IntrinsicElements {
11
+ [key: string]: any;
12
+ }
13
+ interface ElementChildrenAttribute {
14
+ children: unknown;
14
15
  }
15
16
  }
16
17
  type JSXRenderer = (tag: 'slot' | string | ((props?: Attributes) => DOMOutputSpecArray | DOMOutputSpecElement), props?: Attributes, ...children: JSXRenderer[]) => DOMOutputSpecArray | DOMOutputSpecElement;
@@ -19,4 +20,4 @@ declare function Fragment(props: {
19
20
  }): JSXRenderer[];
20
21
  declare const h: JSXRenderer;
21
22
 
22
- export { type Attributes, type DOMOutputSpecArray, type DOMOutputSpecElement, Fragment, type JSXRenderer, h as createElement, h, h as jsx, h as jsxDEV, h as jsxs };
23
+ export { type Attributes, type DOMOutputSpecArray, type DOMOutputSpecElement, Fragment, JSX, type JSXRenderer, h as createElement, h, h as jsx, h as jsxDEV, h as jsxs };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/jsx-runtime.ts"],"sourcesContent":["export type Attributes = Record<string, any>\n\nexport type DOMOutputSpecElement = 0 | Attributes | DOMOutputSpecArray\n/**\n * Better describes the output of a `renderHTML` function in prosemirror\n * @see https://prosemirror.net/docs/ref/#model.DOMOutputSpec\n */\nexport type DOMOutputSpecArray =\n | [string]\n | [string, Attributes]\n | [string, 0]\n | [string, Attributes, 0]\n | [string, Attributes, DOMOutputSpecArray | 0]\n | [string, DOMOutputSpecArray]\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n // @ts-ignore - conflict with React typings\n type Element = [string, ...any[]]\n // @ts-ignore - conflict with React typings\n interface IntrinsicElements {\n // @ts-ignore - conflict with React typings\n [key: string]: any\n }\n }\n}\n\nexport type JSXRenderer = (\n tag: 'slot' | string | ((props?: Attributes) => DOMOutputSpecArray | DOMOutputSpecElement),\n props?: Attributes,\n ...children: JSXRenderer[]\n) => DOMOutputSpecArray | DOMOutputSpecElement\n\nexport function Fragment(props: { children: JSXRenderer[] }) {\n return props.children\n}\n\nexport const h: JSXRenderer = (tag, attributes) => {\n // Treat the slot tag as the Prosemirror hole to render content into\n if (tag === 'slot') {\n return 0\n }\n\n // If the tag is a function, call it with the props\n if (tag instanceof Function) {\n return tag(attributes)\n }\n\n const { children, ...rest } = attributes ?? {}\n\n if (tag === 'svg') {\n throw new Error('SVG elements are not supported in the JSX syntax, use the array syntax instead')\n }\n\n // Otherwise, return the tag, attributes, and children\n return [tag, rest, children]\n}\n\n// See\n// https://esbuild.github.io/api/#jsx-import-source\n// https://www.typescriptlang.org/tsconfig/#jsxImportSource\n\nexport { h as createElement, h as jsx, h as jsxDEV, h as jsxs }\n"],"mappings":";AAkCO,SAAS,SAAS,OAAoC;AAC3D,SAAO,MAAM;AACf;AAEO,IAAM,IAAiB,CAAC,KAAK,eAAe;AAEjD,MAAI,QAAQ,QAAQ;AAClB,WAAO;AAAA,EACT;AAGA,MAAI,eAAe,UAAU;AAC3B,WAAO,IAAI,UAAU;AAAA,EACvB;AAEA,QAAM,EAAE,UAAU,GAAG,KAAK,IAAI,kCAAc,CAAC;AAE7C,MAAI,QAAQ,OAAO;AACjB,UAAM,IAAI,MAAM,gFAAgF;AAAA,EAClG;AAGA,SAAO,CAAC,KAAK,MAAM,QAAQ;AAC7B;","names":[]}
1
+ {"version":3,"sources":["../../src/jsx-runtime.ts"],"sourcesContent":["export type Attributes = Record<string, any>\n\nexport type DOMOutputSpecElement = 0 | Attributes | DOMOutputSpecArray\n/**\n * Better describes the output of a `renderHTML` function in prosemirror\n * @see https://prosemirror.net/docs/ref/#model.DOMOutputSpec\n */\nexport type DOMOutputSpecArray =\n | [string]\n | [string, Attributes]\n | [string, 0]\n | [string, Attributes, 0]\n | [string, Attributes, DOMOutputSpecArray | 0]\n | [string, DOMOutputSpecArray]\n\n// JSX types for Tiptap's JSX runtime\n// These types only apply when using @jsxImportSource @tiptap/core\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace JSX {\n export type Element = DOMOutputSpecArray\n export interface IntrinsicElements {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any\n }\n export interface ElementChildrenAttribute {\n children: unknown\n }\n}\n\nexport type JSXRenderer = (\n tag: 'slot' | string | ((props?: Attributes) => DOMOutputSpecArray | DOMOutputSpecElement),\n props?: Attributes,\n ...children: JSXRenderer[]\n) => DOMOutputSpecArray | DOMOutputSpecElement\n\nexport function Fragment(props: { children: JSXRenderer[] }) {\n return props.children\n}\n\nexport const h: JSXRenderer = (tag, attributes) => {\n // Treat the slot tag as the Prosemirror hole to render content into\n if (tag === 'slot') {\n return 0\n }\n\n // If the tag is a function, call it with the props\n if (tag instanceof Function) {\n return tag(attributes)\n }\n\n const { children, ...rest } = attributes ?? {}\n\n if (tag === 'svg') {\n throw new Error('SVG elements are not supported in the JSX syntax, use the array syntax instead')\n }\n\n // Otherwise, return the tag, attributes, and children\n return [tag, rest, children]\n}\n\n// See\n// https://esbuild.github.io/api/#jsx-import-source\n// https://www.typescriptlang.org/tsconfig/#jsxImportSource\n\nexport { h as createElement, h as jsx, h as jsxDEV, h as jsxs }\n"],"mappings":";AAmCO,SAAS,SAAS,OAAoC;AAC3D,SAAO,MAAM;AACf;AAEO,IAAM,IAAiB,CAAC,KAAK,eAAe;AAEjD,MAAI,QAAQ,QAAQ;AAClB,WAAO;AAAA,EACT;AAGA,MAAI,eAAe,UAAU;AAC3B,WAAO,IAAI,UAAU;AAAA,EACvB;AAEA,QAAM,EAAE,UAAU,GAAG,KAAK,IAAI,kCAAc,CAAC;AAE7C,MAAI,QAAQ,OAAO;AACjB,UAAM,IAAI,MAAM,gFAAgF;AAAA,EAClG;AAGA,SAAO,CAAC,KAAK,MAAM,QAAQ;AAC7B;","names":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiptap/core",
3
3
  "description": "headless rich text editor",
4
- "version": "3.0.2",
4
+ "version": "3.0.4",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -52,10 +52,10 @@
52
52
  "jsx-dev-runtime"
53
53
  ],
54
54
  "devDependencies": {
55
- "@tiptap/pm": "^3.0.2"
55
+ "@tiptap/pm": "^3.0.4"
56
56
  },
57
57
  "peerDependencies": {
58
- "@tiptap/pm": "^3.0.2"
58
+ "@tiptap/pm": "^3.0.4"
59
59
  },
60
60
  "repository": {
61
61
  "type": "git",
package/src/Extension.ts CHANGED
@@ -31,11 +31,19 @@ export class Extension<Options = any, Storage = any> extends Extendable<
31
31
  return super.configure(options) as Extension<Options, Storage>
32
32
  }
33
33
 
34
+ extend<ExtendedOptions = Options, ExtendedStorage = Storage>(
35
+ extendedConfig: () => Partial<ExtensionConfig<ExtendedOptions, ExtendedStorage>>,
36
+ ): Extension<ExtendedOptions, ExtendedStorage>
37
+ extend<ExtendedOptions = Options, ExtendedStorage = Storage>(
38
+ extendedConfig: Partial<ExtensionConfig<ExtendedOptions, ExtendedStorage>>,
39
+ ): Extension<ExtendedOptions, ExtendedStorage>
34
40
  extend<
35
41
  ExtendedOptions = Options,
36
42
  ExtendedStorage = Storage,
37
43
  ExtendedConfig = ExtensionConfig<ExtendedOptions, ExtendedStorage>,
38
- >(extendedConfig?: Partial<ExtendedConfig> | (() => Partial<ExtendedConfig>)) {
44
+ >(
45
+ extendedConfig?: Partial<ExtendedConfig> | (() => Partial<ExtendedConfig>),
46
+ ): Extension<ExtendedOptions, ExtendedStorage> {
39
47
  // If the extended config is a function, execute it to get the configuration object
40
48
  const resolvedConfig = typeof extendedConfig === 'function' ? extendedConfig() : extendedConfig
41
49
  return super.extend(resolvedConfig) as Extension<ExtendedOptions, ExtendedStorage>
package/src/Mark.ts CHANGED
@@ -188,11 +188,19 @@ export class Mark<Options = any, Storage = any> extends Extendable<Options, Stor
188
188
  return super.configure(options) as Mark<Options, Storage>
189
189
  }
190
190
 
191
+ extend<ExtendedOptions = Options, ExtendedStorage = Storage>(
192
+ extendedConfig: () => Partial<MarkConfig<ExtendedOptions, ExtendedStorage>>,
193
+ ): Mark<ExtendedOptions, ExtendedStorage>
194
+ extend<ExtendedOptions = Options, ExtendedStorage = Storage>(
195
+ extendedConfig: Partial<MarkConfig<ExtendedOptions, ExtendedStorage>>,
196
+ ): Mark<ExtendedOptions, ExtendedStorage>
191
197
  extend<
192
198
  ExtendedOptions = Options,
193
199
  ExtendedStorage = Storage,
194
200
  ExtendedConfig = MarkConfig<ExtendedOptions, ExtendedStorage>,
195
- >(extendedConfig?: Partial<ExtendedConfig> | (() => Partial<ExtendedConfig>)) {
201
+ >(
202
+ extendedConfig?: Partial<ExtendedConfig> | (() => Partial<ExtendedConfig>),
203
+ ): Mark<ExtendedOptions, ExtendedStorage> {
196
204
  // If the extended config is a function, execute it to get the configuration object
197
205
  const resolvedConfig = typeof extendedConfig === 'function' ? extendedConfig() : extendedConfig
198
206
  return super.extend(resolvedConfig) as Mark<ExtendedOptions, ExtendedStorage>
package/src/Node.ts CHANGED
@@ -354,11 +354,19 @@ export class Node<Options = any, Storage = any> extends Extendable<Options, Stor
354
354
  return super.configure(options) as Node<Options, Storage>
355
355
  }
356
356
 
357
+ extend<ExtendedOptions = Options, ExtendedStorage = Storage>(
358
+ extendedConfig: () => Partial<NodeConfig<ExtendedOptions, ExtendedStorage>>,
359
+ ): Node<ExtendedOptions, ExtendedStorage>
360
+ extend<ExtendedOptions = Options, ExtendedStorage = Storage>(
361
+ extendedConfig: Partial<NodeConfig<ExtendedOptions, ExtendedStorage>>,
362
+ ): Node<ExtendedOptions, ExtendedStorage>
357
363
  extend<
358
364
  ExtendedOptions = Options,
359
365
  ExtendedStorage = Storage,
360
366
  ExtendedConfig = NodeConfig<ExtendedOptions, ExtendedStorage>,
361
- >(extendedConfig?: Partial<ExtendedConfig> | (() => Partial<ExtendedConfig>)) {
367
+ >(
368
+ extendedConfig?: Partial<ExtendedConfig> | (() => Partial<ExtendedConfig>),
369
+ ): Node<ExtendedOptions, ExtendedStorage> {
362
370
  // If the extended config is a function, execute it to get the configuration object
363
371
  const resolvedConfig = typeof extendedConfig === 'function' ? extendedConfig() : extendedConfig
364
372
  return super.extend(resolvedConfig) as Node<ExtendedOptions, ExtendedStorage>
@@ -13,16 +13,17 @@ export type DOMOutputSpecArray =
13
13
  | [string, Attributes, DOMOutputSpecArray | 0]
14
14
  | [string, DOMOutputSpecArray]
15
15
 
16
- declare global {
17
- // eslint-disable-next-line @typescript-eslint/no-namespace
18
- namespace JSX {
19
- // @ts-ignore - conflict with React typings
20
- type Element = [string, ...any[]]
21
- // @ts-ignore - conflict with React typings
22
- interface IntrinsicElements {
23
- // @ts-ignore - conflict with React typings
24
- [key: string]: any
25
- }
16
+ // JSX types for Tiptap's JSX runtime
17
+ // These types only apply when using @jsxImportSource @tiptap/core
18
+ // eslint-disable-next-line @typescript-eslint/no-namespace
19
+ export namespace JSX {
20
+ export type Element = DOMOutputSpecArray
21
+ export interface IntrinsicElements {
22
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
+ [key: string]: any
24
+ }
25
+ export interface ElementChildrenAttribute {
26
+ children: unknown
26
27
  }
27
28
  }
28
29