@tiptap/extension-image 2.0.0-beta.22 → 2.0.0-beta.23

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiptap/extension-image",
3
3
  "description": "image extension for tiptap",
4
- "version": "2.0.0-beta.22",
4
+ "version": "2.0.0-beta.23",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -28,5 +28,5 @@
28
28
  "url": "https://github.com/ueberdosis/tiptap",
29
29
  "directory": "packages/extension-image"
30
30
  },
31
- "gitHead": "d59c6958331c456931cec240aca27384d44fb67e"
31
+ "gitHead": "fce16e805824972834d5a8ce8d60e3ff41d63c7e"
32
32
  }
@@ -1,21 +0,0 @@
1
- import { Node } from '@tiptap/core';
2
- export interface ImageOptions {
3
- inline: boolean;
4
- HTMLAttributes: Record<string, any>;
5
- }
6
- declare module '@tiptap/core' {
7
- interface Commands<ReturnType> {
8
- image: {
9
- /**
10
- * Add an image
11
- */
12
- setImage: (options: {
13
- src: string;
14
- alt?: string;
15
- title?: string;
16
- }) => ReturnType;
17
- };
18
- }
19
- }
20
- export declare const inputRegex: RegExp;
21
- export declare const Image: Node<ImageOptions, any>;
@@ -1,3 +0,0 @@
1
- import { Image } from './image';
2
- export * from './image';
3
- export default Image;
@@ -1,73 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var core = require('@tiptap/core');
6
-
7
- const inputRegex = /(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))/;
8
- const Image = core.Node.create({
9
- name: 'image',
10
- addOptions() {
11
- return {
12
- inline: false,
13
- HTMLAttributes: {},
14
- };
15
- },
16
- inline() {
17
- return this.options.inline;
18
- },
19
- group() {
20
- return this.options.inline ? 'inline' : 'block';
21
- },
22
- draggable: true,
23
- addAttributes() {
24
- return {
25
- src: {
26
- default: null,
27
- },
28
- alt: {
29
- default: null,
30
- },
31
- title: {
32
- default: null,
33
- },
34
- };
35
- },
36
- parseHTML() {
37
- return [
38
- {
39
- tag: 'img[src]',
40
- },
41
- ];
42
- },
43
- renderHTML({ HTMLAttributes }) {
44
- return ['img', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
45
- },
46
- addCommands() {
47
- return {
48
- setImage: options => ({ commands }) => {
49
- return commands.insertContent({
50
- type: this.name,
51
- attrs: options,
52
- });
53
- },
54
- };
55
- },
56
- addInputRules() {
57
- return [
58
- core.nodeInputRule({
59
- find: inputRegex,
60
- type: this.type,
61
- getAttributes: match => {
62
- const [, , alt, src, title] = match;
63
- return { src, alt, title };
64
- },
65
- }),
66
- ];
67
- },
68
- });
69
-
70
- exports.Image = Image;
71
- exports["default"] = Image;
72
- exports.inputRegex = inputRegex;
73
- //# sourceMappingURL=tiptap-extension-image.cjs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tiptap-extension-image.cjs.js","sources":["../src/image.ts"],"sourcesContent":["import {\n Node,\n nodeInputRule,\n mergeAttributes,\n} from '@tiptap/core'\n\nexport interface ImageOptions {\n inline: boolean,\n HTMLAttributes: Record<string, any>,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n image: {\n /**\n * Add an image\n */\n setImage: (options: { src: string, alt?: string, title?: string }) => ReturnType,\n }\n }\n}\n\nexport const inputRegex = /(!\\[(.+|:?)]\\((\\S+)(?:(?:\\s+)[\"'](\\S+)[\"'])?\\))/\n\nexport const Image = Node.create<ImageOptions>({\n name: 'image',\n\n addOptions() {\n return {\n inline: false,\n HTMLAttributes: {},\n }\n },\n\n inline() {\n return this.options.inline\n },\n\n group() {\n return this.options.inline ? 'inline' : 'block'\n },\n\n draggable: true,\n\n addAttributes() {\n return {\n src: {\n default: null,\n },\n alt: {\n default: null,\n },\n title: {\n default: null,\n },\n }\n },\n\n parseHTML() {\n return [\n {\n tag: 'img[src]',\n },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['img', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)]\n },\n\n addCommands() {\n return {\n setImage: options => ({ commands }) => {\n return commands.insertContent({\n type: this.name,\n attrs: options,\n })\n },\n }\n },\n\n addInputRules() {\n return [\n nodeInputRule({\n find: inputRegex,\n type: this.type,\n getAttributes: match => {\n const [,, alt, src, title] = match\n\n return { src, alt, title }\n },\n }),\n ]\n },\n})\n"],"names":["Node","mergeAttributes","nodeInputRule"],"mappings":";;;;;;MAsBa,UAAU,GAAG,kDAAiD;MAE9D,KAAK,GAAGA,SAAI,CAAC,MAAM,CAAe;IAC7C,IAAI,EAAE,OAAO;IAEb,UAAU;QACR,OAAO;YACL,MAAM,EAAE,KAAK;YACb,cAAc,EAAE,EAAE;SACnB,CAAA;KACF;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAA;KAC3B;IAED,KAAK;QACH,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;KAChD;IAED,SAAS,EAAE,IAAI;IAEf,aAAa;QACX,OAAO;YACL,GAAG,EAAE;gBACH,OAAO,EAAE,IAAI;aACd;YACD,GAAG,EAAE;gBACH,OAAO,EAAE,IAAI;aACd;YACD,KAAK,EAAE;gBACL,OAAO,EAAE,IAAI;aACd;SACF,CAAA;KACF;IAED,SAAS;QACP,OAAO;YACL;gBACE,GAAG,EAAE,UAAU;aAChB;SACF,CAAA;KACF;IAED,UAAU,CAAC,EAAE,cAAc,EAAE;QAC3B,OAAO,CAAC,KAAK,EAAEC,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC,CAAA;KAC7E;IAED,WAAW;QACT,OAAO;YACL,QAAQ,EAAE,OAAO,IAAI,CAAC,EAAE,QAAQ,EAAE;gBAChC,OAAO,QAAQ,CAAC,aAAa,CAAC;oBAC5B,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,KAAK,EAAE,OAAO;iBACf,CAAC,CAAA;aACH;SACF,CAAA;KACF;IAED,aAAa;QACX,OAAO;YACLC,kBAAa,CAAC;gBACZ,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,aAAa,EAAE,KAAK;oBAClB,MAAM,KAAI,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,KAAK,CAAA;oBAElC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,CAAA;iBAC3B;aACF,CAAC;SACH,CAAA;KACF;CACF;;;;;;"}
@@ -1,67 +0,0 @@
1
- import { Node, mergeAttributes, nodeInputRule } from '@tiptap/core';
2
-
3
- const inputRegex = /(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))/;
4
- const Image = Node.create({
5
- name: 'image',
6
- addOptions() {
7
- return {
8
- inline: false,
9
- HTMLAttributes: {},
10
- };
11
- },
12
- inline() {
13
- return this.options.inline;
14
- },
15
- group() {
16
- return this.options.inline ? 'inline' : 'block';
17
- },
18
- draggable: true,
19
- addAttributes() {
20
- return {
21
- src: {
22
- default: null,
23
- },
24
- alt: {
25
- default: null,
26
- },
27
- title: {
28
- default: null,
29
- },
30
- };
31
- },
32
- parseHTML() {
33
- return [
34
- {
35
- tag: 'img[src]',
36
- },
37
- ];
38
- },
39
- renderHTML({ HTMLAttributes }) {
40
- return ['img', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
41
- },
42
- addCommands() {
43
- return {
44
- setImage: options => ({ commands }) => {
45
- return commands.insertContent({
46
- type: this.name,
47
- attrs: options,
48
- });
49
- },
50
- };
51
- },
52
- addInputRules() {
53
- return [
54
- nodeInputRule({
55
- find: inputRegex,
56
- type: this.type,
57
- getAttributes: match => {
58
- const [, , alt, src, title] = match;
59
- return { src, alt, title };
60
- },
61
- }),
62
- ];
63
- },
64
- });
65
-
66
- export { Image, Image as default, inputRegex };
67
- //# sourceMappingURL=tiptap-extension-image.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tiptap-extension-image.esm.js","sources":["../src/image.ts"],"sourcesContent":["import {\n Node,\n nodeInputRule,\n mergeAttributes,\n} from '@tiptap/core'\n\nexport interface ImageOptions {\n inline: boolean,\n HTMLAttributes: Record<string, any>,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n image: {\n /**\n * Add an image\n */\n setImage: (options: { src: string, alt?: string, title?: string }) => ReturnType,\n }\n }\n}\n\nexport const inputRegex = /(!\\[(.+|:?)]\\((\\S+)(?:(?:\\s+)[\"'](\\S+)[\"'])?\\))/\n\nexport const Image = Node.create<ImageOptions>({\n name: 'image',\n\n addOptions() {\n return {\n inline: false,\n HTMLAttributes: {},\n }\n },\n\n inline() {\n return this.options.inline\n },\n\n group() {\n return this.options.inline ? 'inline' : 'block'\n },\n\n draggable: true,\n\n addAttributes() {\n return {\n src: {\n default: null,\n },\n alt: {\n default: null,\n },\n title: {\n default: null,\n },\n }\n },\n\n parseHTML() {\n return [\n {\n tag: 'img[src]',\n },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['img', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)]\n },\n\n addCommands() {\n return {\n setImage: options => ({ commands }) => {\n return commands.insertContent({\n type: this.name,\n attrs: options,\n })\n },\n }\n },\n\n addInputRules() {\n return [\n nodeInputRule({\n find: inputRegex,\n type: this.type,\n getAttributes: match => {\n const [,, alt, src, title] = match\n\n return { src, alt, title }\n },\n }),\n ]\n },\n})\n"],"names":[],"mappings":";;MAsBa,UAAU,GAAG,kDAAiD;MAE9D,KAAK,GAAG,IAAI,CAAC,MAAM,CAAe;IAC7C,IAAI,EAAE,OAAO;IAEb,UAAU;QACR,OAAO;YACL,MAAM,EAAE,KAAK;YACb,cAAc,EAAE,EAAE;SACnB,CAAA;KACF;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAA;KAC3B;IAED,KAAK;QACH,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;KAChD;IAED,SAAS,EAAE,IAAI;IAEf,aAAa;QACX,OAAO;YACL,GAAG,EAAE;gBACH,OAAO,EAAE,IAAI;aACd;YACD,GAAG,EAAE;gBACH,OAAO,EAAE,IAAI;aACd;YACD,KAAK,EAAE;gBACL,OAAO,EAAE,IAAI;aACd;SACF,CAAA;KACF;IAED,SAAS;QACP,OAAO;YACL;gBACE,GAAG,EAAE,UAAU;aAChB;SACF,CAAA;KACF;IAED,UAAU,CAAC,EAAE,cAAc,EAAE;QAC3B,OAAO,CAAC,KAAK,EAAE,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC,CAAA;KAC7E;IAED,WAAW;QACT,OAAO;YACL,QAAQ,EAAE,OAAO,IAAI,CAAC,EAAE,QAAQ,EAAE;gBAChC,OAAO,QAAQ,CAAC,aAAa,CAAC;oBAC5B,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,KAAK,EAAE,OAAO;iBACf,CAAC,CAAA;aACH;SACF,CAAA;KACF;IAED,aAAa;QACX,OAAO;YACL,aAAa,CAAC;gBACZ,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,aAAa,EAAE,KAAK;oBAClB,MAAM,KAAI,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,KAAK,CAAA;oBAElC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,CAAA;iBAC3B;aACF,CAAC;SACH,CAAA;KACF;CACF;;;;"}
@@ -1,77 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tiptap/core')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@tiptap/core'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@tiptap/extension-image"] = {}, global.core));
5
- })(this, (function (exports, core) { 'use strict';
6
-
7
- const inputRegex = /(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))/;
8
- const Image = core.Node.create({
9
- name: 'image',
10
- addOptions() {
11
- return {
12
- inline: false,
13
- HTMLAttributes: {},
14
- };
15
- },
16
- inline() {
17
- return this.options.inline;
18
- },
19
- group() {
20
- return this.options.inline ? 'inline' : 'block';
21
- },
22
- draggable: true,
23
- addAttributes() {
24
- return {
25
- src: {
26
- default: null,
27
- },
28
- alt: {
29
- default: null,
30
- },
31
- title: {
32
- default: null,
33
- },
34
- };
35
- },
36
- parseHTML() {
37
- return [
38
- {
39
- tag: 'img[src]',
40
- },
41
- ];
42
- },
43
- renderHTML({ HTMLAttributes }) {
44
- return ['img', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
45
- },
46
- addCommands() {
47
- return {
48
- setImage: options => ({ commands }) => {
49
- return commands.insertContent({
50
- type: this.name,
51
- attrs: options,
52
- });
53
- },
54
- };
55
- },
56
- addInputRules() {
57
- return [
58
- core.nodeInputRule({
59
- find: inputRegex,
60
- type: this.type,
61
- getAttributes: match => {
62
- const [, , alt, src, title] = match;
63
- return { src, alt, title };
64
- },
65
- }),
66
- ];
67
- },
68
- });
69
-
70
- exports.Image = Image;
71
- exports["default"] = Image;
72
- exports.inputRegex = inputRegex;
73
-
74
- Object.defineProperty(exports, '__esModule', { value: true });
75
-
76
- }));
77
- //# sourceMappingURL=tiptap-extension-image.umd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tiptap-extension-image.umd.js","sources":["../src/image.ts"],"sourcesContent":["import {\n Node,\n nodeInputRule,\n mergeAttributes,\n} from '@tiptap/core'\n\nexport interface ImageOptions {\n inline: boolean,\n HTMLAttributes: Record<string, any>,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n image: {\n /**\n * Add an image\n */\n setImage: (options: { src: string, alt?: string, title?: string }) => ReturnType,\n }\n }\n}\n\nexport const inputRegex = /(!\\[(.+|:?)]\\((\\S+)(?:(?:\\s+)[\"'](\\S+)[\"'])?\\))/\n\nexport const Image = Node.create<ImageOptions>({\n name: 'image',\n\n addOptions() {\n return {\n inline: false,\n HTMLAttributes: {},\n }\n },\n\n inline() {\n return this.options.inline\n },\n\n group() {\n return this.options.inline ? 'inline' : 'block'\n },\n\n draggable: true,\n\n addAttributes() {\n return {\n src: {\n default: null,\n },\n alt: {\n default: null,\n },\n title: {\n default: null,\n },\n }\n },\n\n parseHTML() {\n return [\n {\n tag: 'img[src]',\n },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['img', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)]\n },\n\n addCommands() {\n return {\n setImage: options => ({ commands }) => {\n return commands.insertContent({\n type: this.name,\n attrs: options,\n })\n },\n }\n },\n\n addInputRules() {\n return [\n nodeInputRule({\n find: inputRegex,\n type: this.type,\n getAttributes: match => {\n const [,, alt, src, title] = match\n\n return { src, alt, title }\n },\n }),\n ]\n },\n})\n"],"names":["Node","mergeAttributes","nodeInputRule"],"mappings":";;;;;;QAsBa,UAAU,GAAG,kDAAiD;QAE9D,KAAK,GAAGA,SAAI,CAAC,MAAM,CAAe;MAC7C,IAAI,EAAE,OAAO;MAEb,UAAU;UACR,OAAO;cACL,MAAM,EAAE,KAAK;cACb,cAAc,EAAE,EAAE;WACnB,CAAA;OACF;MAED,MAAM;UACJ,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAA;OAC3B;MAED,KAAK;UACH,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;OAChD;MAED,SAAS,EAAE,IAAI;MAEf,aAAa;UACX,OAAO;cACL,GAAG,EAAE;kBACH,OAAO,EAAE,IAAI;eACd;cACD,GAAG,EAAE;kBACH,OAAO,EAAE,IAAI;eACd;cACD,KAAK,EAAE;kBACL,OAAO,EAAE,IAAI;eACd;WACF,CAAA;OACF;MAED,SAAS;UACP,OAAO;cACL;kBACE,GAAG,EAAE,UAAU;eAChB;WACF,CAAA;OACF;MAED,UAAU,CAAC,EAAE,cAAc,EAAE;UAC3B,OAAO,CAAC,KAAK,EAAEC,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC,CAAA;OAC7E;MAED,WAAW;UACT,OAAO;cACL,QAAQ,EAAE,OAAO,IAAI,CAAC,EAAE,QAAQ,EAAE;kBAChC,OAAO,QAAQ,CAAC,aAAa,CAAC;sBAC5B,IAAI,EAAE,IAAI,CAAC,IAAI;sBACf,KAAK,EAAE,OAAO;mBACf,CAAC,CAAA;eACH;WACF,CAAA;OACF;MAED,aAAa;UACX,OAAO;cACLC,kBAAa,CAAC;kBACZ,IAAI,EAAE,UAAU;kBAChB,IAAI,EAAE,IAAI,CAAC,IAAI;kBACf,aAAa,EAAE,KAAK;sBAClB,MAAM,KAAI,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,KAAK,CAAA;sBAElC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,CAAA;mBAC3B;eACF,CAAC;WACH,CAAA;OACF;GACF;;;;;;;;;;;;"}