@tiptap/extension-image 2.0.0-beta.212 → 2.0.0-beta.214

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/dist/index.cjs CHANGED
@@ -1,77 +1,76 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/image.ts
1
+ 'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
3
4
 
5
+ var core = require('@tiptap/core');
4
6
 
5
-
6
- var _core = require('@tiptap/core');
7
- var inputRegex = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/;
8
- var Image = _core.Node.create({
9
- name: "image",
10
- addOptions() {
11
- return {
12
- inline: false,
13
- allowBase64: false,
14
- HTMLAttributes: {}
15
- };
16
- },
17
- inline() {
18
- return this.options.inline;
19
- },
20
- group() {
21
- return this.options.inline ? "inline" : "block";
22
- },
23
- draggable: true,
24
- addAttributes() {
25
- return {
26
- src: {
27
- default: null
28
- },
29
- alt: {
30
- default: null
31
- },
32
- title: {
33
- default: null
34
- }
35
- };
36
- },
37
- parseHTML() {
38
- return [
39
- {
40
- tag: this.options.allowBase64 ? "img[src]" : 'img[src]:not([src^="data:"])'
41
- }
42
- ];
43
- },
44
- renderHTML({ HTMLAttributes }) {
45
- return ["img", _core.mergeAttributes.call(void 0, this.options.HTMLAttributes, HTMLAttributes)];
46
- },
47
- addCommands() {
48
- return {
49
- setImage: (options) => ({ commands }) => {
50
- return commands.insertContent({
51
- type: this.name,
52
- attrs: options
53
- });
54
- }
55
- };
56
- },
57
- addInputRules() {
58
- return [
59
- _core.nodeInputRule.call(void 0, {
60
- find: inputRegex,
61
- type: this.type,
62
- getAttributes: (match) => {
63
- const [, , alt, src, title] = match;
64
- return { src, alt, title };
65
- }
66
- })
67
- ];
68
- }
7
+ const inputRegex = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/;
8
+ const Image = core.Node.create({
9
+ name: 'image',
10
+ addOptions() {
11
+ return {
12
+ inline: false,
13
+ allowBase64: false,
14
+ HTMLAttributes: {},
15
+ };
16
+ },
17
+ inline() {
18
+ return this.options.inline;
19
+ },
20
+ group() {
21
+ return this.options.inline ? 'inline' : 'block';
22
+ },
23
+ draggable: true,
24
+ addAttributes() {
25
+ return {
26
+ src: {
27
+ default: null,
28
+ },
29
+ alt: {
30
+ default: null,
31
+ },
32
+ title: {
33
+ default: null,
34
+ },
35
+ };
36
+ },
37
+ parseHTML() {
38
+ return [
39
+ {
40
+ tag: this.options.allowBase64
41
+ ? 'img[src]'
42
+ : 'img[src]:not([src^="data:"])',
43
+ },
44
+ ];
45
+ },
46
+ renderHTML({ HTMLAttributes }) {
47
+ return ['img', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
48
+ },
49
+ addCommands() {
50
+ return {
51
+ setImage: options => ({ commands }) => {
52
+ return commands.insertContent({
53
+ type: this.name,
54
+ attrs: options,
55
+ });
56
+ },
57
+ };
58
+ },
59
+ addInputRules() {
60
+ return [
61
+ core.nodeInputRule({
62
+ find: inputRegex,
63
+ type: this.type,
64
+ getAttributes: match => {
65
+ const [, , alt, src, title] = match;
66
+ return { src, alt, title };
67
+ },
68
+ }),
69
+ ];
70
+ },
69
71
  });
70
72
 
71
- // src/index.ts
72
- var src_default = Image;
73
-
74
-
75
-
76
-
77
- exports.Image = Image; exports.default = src_default; exports.inputRegex = inputRegex;
73
+ exports.Image = Image;
74
+ exports["default"] = Image;
75
+ exports.inputRegex = inputRegex;
76
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../src/image.ts"],"sourcesContent":["import {\n mergeAttributes,\n Node,\n nodeInputRule,\n} from '@tiptap/core'\n\nexport interface ImageOptions {\n inline: boolean,\n allowBase64: 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+)[\"'](\\S+)[\"'])?\\))$/\n\nexport const Image = Node.create<ImageOptions>({\n name: 'image',\n\n addOptions() {\n return {\n inline: false,\n allowBase64: 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: this.options.allowBase64\n ? 'img[src]'\n : 'img[src]:not([src^=\"data:\"])',\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":";;;;;;AAuBO,MAAM,UAAU,GAAG,2DAA0D;AAEvE,MAAA,KAAK,GAAGA,SAAI,CAAC,MAAM,CAAe;AAC7C,IAAA,IAAI,EAAE,OAAO;IAEb,UAAU,GAAA;QACR,OAAO;AACL,YAAA,MAAM,EAAE,KAAK;AACb,YAAA,WAAW,EAAE,KAAK;AAClB,YAAA,cAAc,EAAE,EAAE;SACnB,CAAA;KACF;IAED,MAAM,GAAA;AACJ,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAA;KAC3B;IAED,KAAK,GAAA;AACH,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;KAChD;AAED,IAAA,SAAS,EAAE,IAAI;IAEf,aAAa,GAAA;QACX,OAAO;AACL,YAAA,GAAG,EAAE;AACH,gBAAA,OAAO,EAAE,IAAI;AACd,aAAA;AACD,YAAA,GAAG,EAAE;AACH,gBAAA,OAAO,EAAE,IAAI;AACd,aAAA;AACD,YAAA,KAAK,EAAE;AACL,gBAAA,OAAO,EAAE,IAAI;AACd,aAAA;SACF,CAAA;KACF;IAED,SAAS,GAAA;QACP,OAAO;AACL,YAAA;AACE,gBAAA,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW;AAC3B,sBAAE,UAAU;AACZ,sBAAE,8BAA8B;AACnC,aAAA;SACF,CAAA;KACF;IAED,UAAU,CAAC,EAAE,cAAc,EAAE,EAAA;AAC3B,QAAA,OAAO,CAAC,KAAK,EAAEC,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC,CAAA;KAC7E;IAED,WAAW,GAAA;QACT,OAAO;YACL,QAAQ,EAAE,OAAO,IAAI,CAAC,EAAE,QAAQ,EAAE,KAAI;gBACpC,OAAO,QAAQ,CAAC,aAAa,CAAC;oBAC5B,IAAI,EAAE,IAAI,CAAC,IAAI;AACf,oBAAA,KAAK,EAAE,OAAO;AACf,iBAAA,CAAC,CAAA;aACH;SACF,CAAA;KACF;IAED,aAAa,GAAA;QACX,OAAO;AACL,YAAAC,kBAAa,CAAC;AACZ,gBAAA,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,aAAa,EAAE,KAAK,IAAG;oBACrB,MAAM,KAAI,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,KAAK,CAAA;AAElC,oBAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,CAAA;iBAC3B;aACF,CAAC;SACH,CAAA;KACF;AACF,CAAA;;;;;;"}
package/dist/index.js CHANGED
@@ -1,77 +1,70 @@
1
- // src/image.ts
2
- import {
3
- mergeAttributes,
4
- Node,
5
- nodeInputRule
6
- } from "@tiptap/core";
7
- var inputRegex = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/;
8
- var Image = Node.create({
9
- name: "image",
10
- addOptions() {
11
- return {
12
- inline: false,
13
- allowBase64: false,
14
- HTMLAttributes: {}
15
- };
16
- },
17
- inline() {
18
- return this.options.inline;
19
- },
20
- group() {
21
- return this.options.inline ? "inline" : "block";
22
- },
23
- draggable: true,
24
- addAttributes() {
25
- return {
26
- src: {
27
- default: null
28
- },
29
- alt: {
30
- default: null
31
- },
32
- title: {
33
- default: null
34
- }
35
- };
36
- },
37
- parseHTML() {
38
- return [
39
- {
40
- tag: this.options.allowBase64 ? "img[src]" : 'img[src]:not([src^="data:"])'
41
- }
42
- ];
43
- },
44
- renderHTML({ HTMLAttributes }) {
45
- return ["img", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
46
- },
47
- addCommands() {
48
- return {
49
- setImage: (options) => ({ commands }) => {
50
- return commands.insertContent({
51
- type: this.name,
52
- attrs: options
53
- });
54
- }
55
- };
56
- },
57
- addInputRules() {
58
- return [
59
- nodeInputRule({
60
- find: inputRegex,
61
- type: this.type,
62
- getAttributes: (match) => {
63
- const [, , alt, src, title] = match;
64
- return { src, alt, title };
65
- }
66
- })
67
- ];
68
- }
1
+ import { Node, mergeAttributes, nodeInputRule } from '@tiptap/core';
2
+
3
+ const inputRegex = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/;
4
+ const Image = Node.create({
5
+ name: 'image',
6
+ addOptions() {
7
+ return {
8
+ inline: false,
9
+ allowBase64: false,
10
+ HTMLAttributes: {},
11
+ };
12
+ },
13
+ inline() {
14
+ return this.options.inline;
15
+ },
16
+ group() {
17
+ return this.options.inline ? 'inline' : 'block';
18
+ },
19
+ draggable: true,
20
+ addAttributes() {
21
+ return {
22
+ src: {
23
+ default: null,
24
+ },
25
+ alt: {
26
+ default: null,
27
+ },
28
+ title: {
29
+ default: null,
30
+ },
31
+ };
32
+ },
33
+ parseHTML() {
34
+ return [
35
+ {
36
+ tag: this.options.allowBase64
37
+ ? 'img[src]'
38
+ : 'img[src]:not([src^="data:"])',
39
+ },
40
+ ];
41
+ },
42
+ renderHTML({ HTMLAttributes }) {
43
+ return ['img', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
44
+ },
45
+ addCommands() {
46
+ return {
47
+ setImage: options => ({ commands }) => {
48
+ return commands.insertContent({
49
+ type: this.name,
50
+ attrs: options,
51
+ });
52
+ },
53
+ };
54
+ },
55
+ addInputRules() {
56
+ return [
57
+ nodeInputRule({
58
+ find: inputRegex,
59
+ type: this.type,
60
+ getAttributes: match => {
61
+ const [, , alt, src, title] = match;
62
+ return { src, alt, title };
63
+ },
64
+ }),
65
+ ];
66
+ },
69
67
  });
70
68
 
71
- // src/index.ts
72
- var src_default = Image;
73
- export {
74
- Image,
75
- src_default as default,
76
- inputRegex
77
- };
69
+ export { Image, Image as default, inputRegex };
70
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/image.ts"],"sourcesContent":["import {\n mergeAttributes,\n Node,\n nodeInputRule,\n} from '@tiptap/core'\n\nexport interface ImageOptions {\n inline: boolean,\n allowBase64: 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+)[\"'](\\S+)[\"'])?\\))$/\n\nexport const Image = Node.create<ImageOptions>({\n name: 'image',\n\n addOptions() {\n return {\n inline: false,\n allowBase64: 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: this.options.allowBase64\n ? 'img[src]'\n : 'img[src]:not([src^=\"data:\"])',\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":";;AAuBO,MAAM,UAAU,GAAG,2DAA0D;AAEvE,MAAA,KAAK,GAAG,IAAI,CAAC,MAAM,CAAe;AAC7C,IAAA,IAAI,EAAE,OAAO;IAEb,UAAU,GAAA;QACR,OAAO;AACL,YAAA,MAAM,EAAE,KAAK;AACb,YAAA,WAAW,EAAE,KAAK;AAClB,YAAA,cAAc,EAAE,EAAE;SACnB,CAAA;KACF;IAED,MAAM,GAAA;AACJ,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAA;KAC3B;IAED,KAAK,GAAA;AACH,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;KAChD;AAED,IAAA,SAAS,EAAE,IAAI;IAEf,aAAa,GAAA;QACX,OAAO;AACL,YAAA,GAAG,EAAE;AACH,gBAAA,OAAO,EAAE,IAAI;AACd,aAAA;AACD,YAAA,GAAG,EAAE;AACH,gBAAA,OAAO,EAAE,IAAI;AACd,aAAA;AACD,YAAA,KAAK,EAAE;AACL,gBAAA,OAAO,EAAE,IAAI;AACd,aAAA;SACF,CAAA;KACF;IAED,SAAS,GAAA;QACP,OAAO;AACL,YAAA;AACE,gBAAA,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW;AAC3B,sBAAE,UAAU;AACZ,sBAAE,8BAA8B;AACnC,aAAA;SACF,CAAA;KACF;IAED,UAAU,CAAC,EAAE,cAAc,EAAE,EAAA;AAC3B,QAAA,OAAO,CAAC,KAAK,EAAE,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC,CAAA;KAC7E;IAED,WAAW,GAAA;QACT,OAAO;YACL,QAAQ,EAAE,OAAO,IAAI,CAAC,EAAE,QAAQ,EAAE,KAAI;gBACpC,OAAO,QAAQ,CAAC,aAAa,CAAC;oBAC5B,IAAI,EAAE,IAAI,CAAC,IAAI;AACf,oBAAA,KAAK,EAAE,OAAO;AACf,iBAAA,CAAC,CAAA;aACH;SACF,CAAA;KACF;IAED,aAAa,GAAA;QACX,OAAO;AACL,YAAA,aAAa,CAAC;AACZ,gBAAA,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,aAAa,EAAE,KAAK,IAAG;oBACrB,MAAM,KAAI,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,KAAK,CAAA;AAElC,oBAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,CAAA;iBAC3B;aACF,CAAC;SACH,CAAA;KACF;AACF,CAAA;;;;"}
@@ -0,0 +1,80 @@
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+)["'](\S+)["'])?\))$/;
8
+ const Image = core.Node.create({
9
+ name: 'image',
10
+ addOptions() {
11
+ return {
12
+ inline: false,
13
+ allowBase64: false,
14
+ HTMLAttributes: {},
15
+ };
16
+ },
17
+ inline() {
18
+ return this.options.inline;
19
+ },
20
+ group() {
21
+ return this.options.inline ? 'inline' : 'block';
22
+ },
23
+ draggable: true,
24
+ addAttributes() {
25
+ return {
26
+ src: {
27
+ default: null,
28
+ },
29
+ alt: {
30
+ default: null,
31
+ },
32
+ title: {
33
+ default: null,
34
+ },
35
+ };
36
+ },
37
+ parseHTML() {
38
+ return [
39
+ {
40
+ tag: this.options.allowBase64
41
+ ? 'img[src]'
42
+ : 'img[src]:not([src^="data:"])',
43
+ },
44
+ ];
45
+ },
46
+ renderHTML({ HTMLAttributes }) {
47
+ return ['img', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
48
+ },
49
+ addCommands() {
50
+ return {
51
+ setImage: options => ({ commands }) => {
52
+ return commands.insertContent({
53
+ type: this.name,
54
+ attrs: options,
55
+ });
56
+ },
57
+ };
58
+ },
59
+ addInputRules() {
60
+ return [
61
+ core.nodeInputRule({
62
+ find: inputRegex,
63
+ type: this.type,
64
+ getAttributes: match => {
65
+ const [, , alt, src, title] = match;
66
+ return { src, alt, title };
67
+ },
68
+ }),
69
+ ];
70
+ },
71
+ });
72
+
73
+ exports.Image = Image;
74
+ exports["default"] = Image;
75
+ exports.inputRegex = inputRegex;
76
+
77
+ Object.defineProperty(exports, '__esModule', { value: true });
78
+
79
+ }));
80
+ //# sourceMappingURL=index.umd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.umd.js","sources":["../src/image.ts"],"sourcesContent":["import {\n mergeAttributes,\n Node,\n nodeInputRule,\n} from '@tiptap/core'\n\nexport interface ImageOptions {\n inline: boolean,\n allowBase64: 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+)[\"'](\\S+)[\"'])?\\))$/\n\nexport const Image = Node.create<ImageOptions>({\n name: 'image',\n\n addOptions() {\n return {\n inline: false,\n allowBase64: 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: this.options.allowBase64\n ? 'img[src]'\n : 'img[src]:not([src^=\"data:\"])',\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":";;;;;;AAuBO,QAAM,UAAU,GAAG,2DAA0D;AAEvE,QAAA,KAAK,GAAGA,SAAI,CAAC,MAAM,CAAe;EAC7C,IAAA,IAAI,EAAE,OAAO;MAEb,UAAU,GAAA;UACR,OAAO;EACL,YAAA,MAAM,EAAE,KAAK;EACb,YAAA,WAAW,EAAE,KAAK;EAClB,YAAA,cAAc,EAAE,EAAE;WACnB,CAAA;OACF;MAED,MAAM,GAAA;EACJ,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAA;OAC3B;MAED,KAAK,GAAA;EACH,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;OAChD;EAED,IAAA,SAAS,EAAE,IAAI;MAEf,aAAa,GAAA;UACX,OAAO;EACL,YAAA,GAAG,EAAE;EACH,gBAAA,OAAO,EAAE,IAAI;EACd,aAAA;EACD,YAAA,GAAG,EAAE;EACH,gBAAA,OAAO,EAAE,IAAI;EACd,aAAA;EACD,YAAA,KAAK,EAAE;EACL,gBAAA,OAAO,EAAE,IAAI;EACd,aAAA;WACF,CAAA;OACF;MAED,SAAS,GAAA;UACP,OAAO;EACL,YAAA;EACE,gBAAA,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW;EAC3B,sBAAE,UAAU;EACZ,sBAAE,8BAA8B;EACnC,aAAA;WACF,CAAA;OACF;MAED,UAAU,CAAC,EAAE,cAAc,EAAE,EAAA;EAC3B,QAAA,OAAO,CAAC,KAAK,EAAEC,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC,CAAA;OAC7E;MAED,WAAW,GAAA;UACT,OAAO;cACL,QAAQ,EAAE,OAAO,IAAI,CAAC,EAAE,QAAQ,EAAE,KAAI;kBACpC,OAAO,QAAQ,CAAC,aAAa,CAAC;sBAC5B,IAAI,EAAE,IAAI,CAAC,IAAI;EACf,oBAAA,KAAK,EAAE,OAAO;EACf,iBAAA,CAAC,CAAA;eACH;WACF,CAAA;OACF;MAED,aAAa,GAAA;UACX,OAAO;EACL,YAAAC,kBAAa,CAAC;EACZ,gBAAA,IAAI,EAAE,UAAU;kBAChB,IAAI,EAAE,IAAI,CAAC,IAAI;kBACf,aAAa,EAAE,KAAK,IAAG;sBACrB,MAAM,KAAI,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,KAAK,CAAA;EAElC,oBAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,CAAA;mBAC3B;eACF,CAAC;WACH,CAAA;OACF;EACF,CAAA;;;;;;;;;;;;"}
@@ -1,25 +1,22 @@
1
- import { Node } from '@tiptap/core';
2
-
3
- interface ImageOptions {
4
- inline: boolean;
5
- allowBase64: boolean;
6
- HTMLAttributes: Record<string, any>;
7
- }
8
- declare module '@tiptap/core' {
9
- interface Commands<ReturnType> {
10
- image: {
11
- /**
12
- * Add an image
13
- */
14
- setImage: (options: {
15
- src: string;
16
- alt?: string;
17
- title?: string;
18
- }) => ReturnType;
19
- };
20
- }
21
- }
22
- declare const inputRegex: RegExp;
23
- declare const Image: Node<ImageOptions, any>;
24
-
25
- export { Image, ImageOptions, Image as default, inputRegex };
1
+ import { Node } from '@tiptap/core';
2
+ export interface ImageOptions {
3
+ inline: boolean;
4
+ allowBase64: boolean;
5
+ HTMLAttributes: Record<string, any>;
6
+ }
7
+ declare module '@tiptap/core' {
8
+ interface Commands<ReturnType> {
9
+ image: {
10
+ /**
11
+ * Add an image
12
+ */
13
+ setImage: (options: {
14
+ src: string;
15
+ alt?: string;
16
+ title?: string;
17
+ }) => ReturnType;
18
+ };
19
+ }
20
+ }
21
+ export declare const inputRegex: RegExp;
22
+ export declare const Image: Node<ImageOptions, any>;
@@ -0,0 +1,3 @@
1
+ import { Image } from './image';
2
+ export * from './image';
3
+ export default Image;
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.212",
4
+ "version": "2.0.0-beta.214",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -15,14 +15,15 @@
15
15
  "type": "module",
16
16
  "exports": {
17
17
  ".": {
18
- "types": "./dist/index.d.ts",
18
+ "types": "./dist/packages/extension-image/src/index.d.ts",
19
19
  "import": "./dist/index.js",
20
20
  "require": "./dist/index.cjs"
21
21
  }
22
22
  },
23
23
  "main": "dist/index.cjs",
24
24
  "module": "dist/index.js",
25
- "types": "dist/index.d.ts",
25
+ "umd": "dist/index.umd.js",
26
+ "types": "dist/packages/extension-image/src/index.d.ts",
26
27
  "files": [
27
28
  "src",
28
29
  "dist"
@@ -31,7 +32,7 @@
31
32
  "@tiptap/core": "^2.0.0-beta.209"
32
33
  },
33
34
  "devDependencies": {
34
- "@tiptap/core": "^2.0.0-beta.212"
35
+ "@tiptap/core": "^2.0.0-beta.214"
35
36
  },
36
37
  "repository": {
37
38
  "type": "git",
@@ -39,17 +40,7 @@
39
40
  "directory": "packages/extension-image"
40
41
  },
41
42
  "scripts": {
42
- "build": "tsup"
43
- },
44
- "tsup": {
45
- "entry": [
46
- "src/index.ts"
47
- ],
48
- "dts": true,
49
- "splitting": true,
50
- "format": [
51
- "esm",
52
- "cjs"
53
- ]
43
+ "clean": "rm -rf dist",
44
+ "build": "npm run clean && rollup -c"
54
45
  }
55
46
  }