@edifice.io/tiptap-extensions 2.0.0-develop-rc.0 → 2.0.0-develop-rc.7

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.
Files changed (62) hide show
  1. package/README.md +1 -1
  2. package/dist/abbr/abbr.cjs +1 -32
  3. package/dist/abbr/abbr.d.ts +12 -12
  4. package/dist/abbr/abbr.js +13 -17
  5. package/dist/alert/alert.cjs +1 -32
  6. package/dist/alert/alert.js +22 -20
  7. package/dist/attachment/attachment.cjs +1 -73
  8. package/dist/attachment/attachment.d.ts +6 -6
  9. package/dist/attachment/attachment.js +29 -40
  10. package/dist/audio/audio.cjs +2 -52
  11. package/dist/audio/audio.d.ts +13 -17
  12. package/dist/audio/audio.js +25 -28
  13. package/dist/font-size/font-size.cjs +1 -48
  14. package/dist/font-size/font-size.d.ts +13 -13
  15. package/dist/font-size/font-size.js +17 -29
  16. package/dist/heading/heading.cjs +1 -61
  17. package/dist/heading/heading.d.ts +12 -10
  18. package/dist/heading/heading.js +25 -39
  19. package/dist/highlight/highlight.cjs +1 -25
  20. package/dist/highlight/highlight.d.ts +1 -4
  21. package/dist/highlight/highlight.js +13 -11
  22. package/dist/hyperlink/hyperlink.cjs +1 -47
  23. package/dist/hyperlink/hyperlink.d.ts +24 -27
  24. package/dist/hyperlink/hyperlink.js +19 -21
  25. package/dist/iframe/iframe.cjs +1 -69
  26. package/dist/iframe/iframe.d.ts +14 -12
  27. package/dist/iframe/iframe.js +32 -48
  28. package/dist/image/custom-image.cjs +1 -162
  29. package/dist/image/custom-image.d.ts +16 -19
  30. package/dist/image/custom-image.js +130 -179
  31. package/dist/index.cjs +1 -43
  32. package/dist/index.js +21 -21
  33. package/dist/line-height/line-height.cjs +1 -33
  34. package/dist/line-height/line-height.js +15 -18
  35. package/dist/linker/linker.cjs +1 -95
  36. package/dist/linker/linker.d.ts +17 -17
  37. package/dist/linker/linker.js +49 -57
  38. package/dist/mathjax/mathjax.cjs +1 -47
  39. package/dist/mathjax/mathjax.js +20 -30
  40. package/dist/paragraph/paragraph.cjs +1 -13
  41. package/dist/paragraph/paragraph.d.ts +1 -4
  42. package/dist/paragraph/paragraph.js +8 -6
  43. package/dist/speech-recognition/speech-recognition.cjs +1 -76
  44. package/dist/speech-recognition/speech-recognition.cjs.map +1 -1
  45. package/dist/speech-recognition/speech-recognition.d.ts +12 -12
  46. package/dist/speech-recognition/speech-recognition.js +41 -57
  47. package/dist/speech-recognition/speech-recognition.js.map +1 -1
  48. package/dist/speech-synthesis/speech-synthesis.cjs +1 -32
  49. package/dist/speech-synthesis/speech-synthesis.d.ts +9 -9
  50. package/dist/speech-synthesis/speech-synthesis.js +10 -19
  51. package/dist/table-cell/table-cell.cjs +1 -27
  52. package/dist/table-cell/table-cell.d.ts +1 -4
  53. package/dist/table-cell/table-cell.js +12 -17
  54. package/dist/transform/html-to-json/html-to-json.cjs +1 -4
  55. package/dist/transform/html-to-json/html-to-json.d.ts +1 -4
  56. package/dist/transform/html-to-json/html-to-json.js +4 -2
  57. package/dist/transform/json-to-html/json-to-html.cjs +1 -4
  58. package/dist/transform/json-to-html/json-to-html.js +4 -2
  59. package/dist/video/video.cjs +2 -111
  60. package/dist/video/video.d.ts +19 -28
  61. package/dist/video/video.js +90 -114
  62. package/package.json +47 -36
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  ![npm](https://img.shields.io/npm/v/@edifice.io/tiptap-extensions?style=flat-square)
4
4
  ![bundlephobia](https://img.shields.io/bundlephobia/min/@edifice.io/tiptap-extensions?style=flat-square)
5
5
 
6
- Extensions based on Tiptap Editor
6
+ TypeScript Extensions based on Tiptap Editor
7
7
 
8
8
  ## Getting Started
9
9
 
@@ -1,33 +1,2 @@
1
- 'use strict';
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
- const core = require('@tiptap/core'),
4
- Abbr = core.Mark.create({
5
- name: 'abbr',
6
- addOptions() {
7
- return { HTMLAttributes: {} };
8
- },
9
- parseHTML() {
10
- return [{ tag: 'abbr' }];
11
- },
12
- renderHTML({ HTMLAttributes }) {
13
- return [
14
- 'abbr',
15
- core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
16
- 0,
17
- ];
18
- },
19
- addCommands() {
20
- return {
21
- setAbbr:
22
- () =>
23
- ({ commands }) =>
24
- commands.setMark(this.name),
25
- toggleAbbr:
26
- () =>
27
- ({ commands }) =>
28
- commands.toggleMark(this.name),
29
- };
30
- },
31
- });
32
- exports.Abbr = Abbr;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core"),Abbr=core.Mark.create({name:"abbr",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"abbr"}]},renderHTML({HTMLAttributes}){return["abbr",core.mergeAttributes(this.options.HTMLAttributes,HTMLAttributes),0]},addCommands(){return{setAbbr:()=>({commands})=>commands.setMark(this.name),toggleAbbr:()=>({commands})=>commands.toggleMark(this.name)}}});exports.Abbr=Abbr;
33
2
  //# sourceMappingURL=abbr.cjs.map
@@ -1,16 +1,16 @@
1
1
  import { Mark } from '@tiptap/core';
2
2
  declare module '@tiptap/core' {
3
- interface Commands<ReturnType> {
4
- abbr: {
5
- /**
6
- * Set an abbr mark
7
- */
8
- setAbbr: (src: string) => ReturnType;
9
- /**
10
- * Toggle an abbr mark
11
- */
12
- toggleAbbr: (src: string) => ReturnType;
13
- };
14
- }
3
+ interface Commands<ReturnType> {
4
+ abbr: {
5
+ /**
6
+ * Set an abbr mark
7
+ */
8
+ setAbbr: (src: string) => ReturnType;
9
+ /**
10
+ * Toggle an abbr mark
11
+ */
12
+ toggleAbbr: (src: string) => ReturnType;
13
+ };
14
+ }
15
15
  }
16
16
  export declare const Abbr: Mark<any, any>;
package/dist/abbr/abbr.js CHANGED
@@ -1,37 +1,33 @@
1
- import { Mark, mergeAttributes } from '@tiptap/core';
1
+ import { Mark, mergeAttributes } from "@tiptap/core";
2
2
  const Abbr = Mark.create({
3
- name: 'abbr',
3
+ name: "abbr",
4
4
  addOptions() {
5
5
  return {
6
- HTMLAttributes: {},
6
+ HTMLAttributes: {}
7
7
  };
8
8
  },
9
9
  parseHTML() {
10
10
  return [
11
11
  {
12
- tag: 'abbr',
13
- },
12
+ tag: "abbr"
13
+ }
14
14
  ];
15
15
  },
16
16
  renderHTML({ HTMLAttributes }) {
17
17
  return [
18
- 'abbr',
18
+ "abbr",
19
19
  mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
20
- 0,
20
+ 0
21
21
  ];
22
22
  },
23
23
  addCommands() {
24
24
  return {
25
- setAbbr:
26
- () =>
27
- ({ commands }) =>
28
- commands.setMark(this.name),
29
- toggleAbbr:
30
- () =>
31
- ({ commands }) =>
32
- commands.toggleMark(this.name),
25
+ setAbbr: () => ({ commands }) => commands.setMark(this.name),
26
+ toggleAbbr: () => ({ commands }) => commands.toggleMark(this.name)
33
27
  };
34
- },
28
+ }
35
29
  });
36
- export { Abbr };
30
+ export {
31
+ Abbr
32
+ };
37
33
  //# sourceMappingURL=abbr.js.map
@@ -1,33 +1,2 @@
1
- 'use strict';
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
- const core = require('@tiptap/core'),
4
- Alert = core.Node.create({
5
- name: 'alert',
6
- content: 'inline+',
7
- marks: '',
8
- group: 'block',
9
- inline: !1,
10
- selectable: !0,
11
- draggable: !0,
12
- parseHTML() {
13
- return [
14
- { tag: 'p.info', priority: 60 },
15
- { tag: 'p.warning', priority: 60 },
16
- { tag: 'div.info', priority: 60 },
17
- { tag: 'div.warning', priority: 60 },
18
- ];
19
- },
20
- addAttributes() {
21
- return {
22
- class: {
23
- default: 'info',
24
- parseHTML: (element) => element.getAttribute('class'),
25
- },
26
- };
27
- },
28
- renderHTML({ HTMLAttributes }) {
29
- return ['div', HTMLAttributes, 0];
30
- },
31
- });
32
- exports.Alert = Alert;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core"),Alert=core.Node.create({name:"alert",content:"inline+",marks:"",group:"block",inline:!1,selectable:!0,draggable:!0,parseHTML(){return[{tag:"p.info",priority:60},{tag:"p.warning",priority:60},{tag:"div.info",priority:60},{tag:"div.warning",priority:60}]},addAttributes(){return{class:{default:"info",parseHTML:element=>element.getAttribute("class")}}},renderHTML({HTMLAttributes}){return["div",HTMLAttributes,0]}});exports.Alert=Alert;
33
2
  //# sourceMappingURL=alert.cjs.map
@@ -1,43 +1,45 @@
1
- import { Node } from '@tiptap/core';
1
+ import { Node } from "@tiptap/core";
2
2
  const Alert = Node.create({
3
- name: 'alert',
4
- content: 'inline+',
5
- marks: '',
6
- group: 'block',
3
+ name: "alert",
4
+ content: "inline+",
5
+ marks: "",
6
+ group: "block",
7
7
  inline: !1,
8
8
  selectable: !0,
9
9
  draggable: !0,
10
10
  parseHTML() {
11
11
  return [
12
12
  {
13
- tag: 'p.info',
14
- priority: 60,
13
+ tag: "p.info",
14
+ priority: 60
15
15
  },
16
16
  {
17
- tag: 'p.warning',
18
- priority: 60,
17
+ tag: "p.warning",
18
+ priority: 60
19
19
  },
20
20
  {
21
- tag: 'div.info',
22
- priority: 60,
21
+ tag: "div.info",
22
+ priority: 60
23
23
  },
24
24
  {
25
- tag: 'div.warning',
26
- priority: 60,
27
- },
25
+ tag: "div.warning",
26
+ priority: 60
27
+ }
28
28
  ];
29
29
  },
30
30
  addAttributes() {
31
31
  return {
32
32
  class: {
33
- default: 'info',
34
- parseHTML: (element) => element.getAttribute('class'),
35
- },
33
+ default: "info",
34
+ parseHTML: (element) => element.getAttribute("class")
35
+ }
36
36
  };
37
37
  },
38
38
  renderHTML({ HTMLAttributes }) {
39
- return ['div', HTMLAttributes, 0];
40
- },
39
+ return ["div", HTMLAttributes, 0];
40
+ }
41
41
  });
42
- export { Alert };
42
+ export {
43
+ Alert
44
+ };
43
45
  //# sourceMappingURL=alert.js.map
@@ -1,74 +1,2 @@
1
- 'use strict';
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
- const core = require('@tiptap/core'),
4
- Attachment = core.Node.create({
5
- name: 'attachments',
6
- content: '',
7
- marks: '',
8
- group: 'block',
9
- selectable: !0,
10
- atom: !0,
11
- draggable: !0,
12
- addOptions() {
13
- return { HTMLAttributes: { class: 'attachments' } };
14
- },
15
- parseHTML() {
16
- return [{ tag: 'div[class=attachments]' }];
17
- },
18
- renderHTML({ HTMLAttributes }) {
19
- const renderedLinks = HTMLAttributes.links.map((el) => [
20
- 'a',
21
- {
22
- name: el.name,
23
- href: el.href,
24
- documentId: el.documentId,
25
- dataContentType: el.dataContentType,
26
- },
27
- el.name,
28
- ]);
29
- return ['div', this.options.HTMLAttributes, ...renderedLinks];
30
- },
31
- addAttributes() {
32
- return {
33
- links: {
34
- default: [],
35
- parseHTML: (element) => {
36
- const links = element.getElementsByTagName('a'),
37
- parsedLinks = [];
38
- for (let i = 0; i < links.length; i++) {
39
- const link = links[i],
40
- href = link.getAttribute('href'),
41
- name = link.textContent,
42
- regexResult = href.match(/([^/]+$)/),
43
- documentId =
44
- link.getAttribute('data-document-id') ||
45
- (regexResult && regexResult[0]),
46
- dataContentType = link.getAttribute('data-content-type');
47
- parsedLinks.push({ href, name, documentId, dataContentType });
48
- }
49
- return parsedLinks;
50
- },
51
- renderHTML: (attributes) => ({
52
- links: attributes.links.map((link) => ({
53
- href: link.href,
54
- name: link.name,
55
- documentId: link.documentId,
56
- dataContentType: link.dataContentType,
57
- })),
58
- }),
59
- },
60
- };
61
- },
62
- addCommands() {
63
- return {
64
- setAttachment:
65
- (
66
- attrs = { dataContentType: '', name: '', documentId: '', href: '' },
67
- ) =>
68
- ({ chain }) =>
69
- chain().insertContent({ type: this.name, attrs }).run(),
70
- };
71
- },
72
- });
73
- exports.Attachment = Attachment;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core"),Attachment=core.Node.create({name:"attachments",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){return{HTMLAttributes:{class:"attachments"}}},parseHTML(){return[{tag:"div[class=attachments]"}]},renderHTML({HTMLAttributes}){const renderedLinks=HTMLAttributes.links.map(el=>["a",{name:el.name,href:el.href,documentId:el.documentId,dataContentType:el.dataContentType},el.name]);return["div",this.options.HTMLAttributes,...renderedLinks]},addAttributes(){return{links:{default:[],parseHTML:element=>{const links=element.getElementsByTagName("a"),parsedLinks=[];for(let i=0;i<links.length;i++){const link=links[i],href=link.getAttribute("href"),name=link.textContent,regexResult=href.match(/([^/]+$)/),documentId=link.getAttribute("data-document-id")||regexResult&&regexResult[0],dataContentType=link.getAttribute("data-content-type");parsedLinks.push({href,name,documentId,dataContentType})}return parsedLinks},renderHTML:attributes=>({links:attributes.links.map(link=>({href:link.href,name:link.name,documentId:link.documentId,dataContentType:link.dataContentType}))})}}},addCommands(){return{setAttachment:(attrs={dataContentType:"",name:"",documentId:"",href:""})=>({chain})=>chain().insertContent({type:this.name,attrs}).run()}}});exports.Attachment=Attachment;
74
2
  //# sourceMappingURL=attachment.cjs.map
@@ -1,12 +1,12 @@
1
1
  import { Node } from '@tiptap/core';
2
2
  export interface AttachmentOptions {
3
- HTMLAttributes: Record<string, string>;
3
+ HTMLAttributes: Record<string, string>;
4
4
  }
5
5
  declare module '@tiptap/core' {
6
- interface Commands<ReturnType> {
7
- attachment: {
8
- setAttachment: (attachment: any) => ReturnType;
9
- };
10
- }
6
+ interface Commands<ReturnType> {
7
+ attachment: {
8
+ setAttachment: (attachment: any) => ReturnType;
9
+ };
10
+ }
11
11
  }
12
12
  export declare const Attachment: Node<AttachmentOptions, any>;
@@ -1,56 +1,48 @@
1
- import { Node } from '@tiptap/core';
1
+ import { Node } from "@tiptap/core";
2
2
  const Attachment = Node.create({
3
- name: 'attachments',
4
- content: '',
5
- marks: '',
6
- group: 'block',
3
+ name: "attachments",
4
+ content: "",
5
+ marks: "",
6
+ group: "block",
7
7
  selectable: !0,
8
8
  atom: !0,
9
9
  draggable: !0,
10
10
  addOptions() {
11
11
  return {
12
12
  HTMLAttributes: {
13
- class: 'attachments',
14
- },
13
+ class: "attachments"
14
+ }
15
15
  };
16
16
  },
17
17
  parseHTML() {
18
- return [{ tag: 'div[class=attachments]' }];
18
+ return [{ tag: "div[class=attachments]" }];
19
19
  },
20
20
  renderHTML({ HTMLAttributes }) {
21
21
  const renderedLinks = HTMLAttributes.links.map((el) => [
22
- 'a',
22
+ "a",
23
23
  {
24
24
  name: el.name,
25
25
  href: el.href,
26
26
  documentId: el.documentId,
27
- dataContentType: el.dataContentType,
27
+ dataContentType: el.dataContentType
28
28
  },
29
- el.name,
29
+ el.name
30
30
  ]);
31
- return ['div', this.options.HTMLAttributes, ...renderedLinks];
31
+ return ["div", this.options.HTMLAttributes, ...renderedLinks];
32
32
  },
33
33
  addAttributes() {
34
34
  return {
35
35
  links: {
36
36
  default: [],
37
37
  parseHTML: (element) => {
38
- const links = element.getElementsByTagName('a'),
39
- parsedLinks = [];
38
+ const links = element.getElementsByTagName("a"), parsedLinks = [];
40
39
  for (let i = 0; i < links.length; i++) {
41
- const link = links[i],
42
- href = link.getAttribute('href'),
43
- name = link.textContent,
44
- regexResult = href.match(/([^/]+$)/),
45
- documentId =
46
- link.getAttribute('data-document-id') ||
47
- (regexResult && regexResult[0]),
48
- dataContentType = link.getAttribute('data-content-type');
40
+ const link = links[i], href = link.getAttribute("href"), name = link.textContent, regexResult = href.match(/([^/]+$)/), documentId = link.getAttribute("data-document-id") || regexResult && regexResult[0], dataContentType = link.getAttribute("data-content-type");
49
41
  parsedLinks.push({
50
42
  href,
51
43
  name,
52
44
  documentId,
53
- dataContentType,
45
+ dataContentType
54
46
  });
55
47
  }
56
48
  return parsedLinks;
@@ -60,27 +52,24 @@ const Attachment = Node.create({
60
52
  href: link.href,
61
53
  name: link.name,
62
54
  documentId: link.documentId,
63
- dataContentType: link.dataContentType,
64
- })),
65
- }),
66
- },
55
+ dataContentType: link.dataContentType
56
+ }))
57
+ })
58
+ }
67
59
  };
68
60
  },
69
61
  addCommands() {
70
62
  return {
71
- setAttachment:
72
- (
73
- attrs = {
74
- dataContentType: '',
75
- name: '',
76
- documentId: '',
77
- href: '',
78
- },
79
- ) =>
80
- ({ chain }) =>
81
- chain().insertContent({ type: this.name, attrs }).run(),
63
+ setAttachment: (attrs = {
64
+ dataContentType: "",
65
+ name: "",
66
+ documentId: "",
67
+ href: ""
68
+ }) => ({ chain }) => chain().insertContent({ type: this.name, attrs }).run()
82
69
  };
83
- },
70
+ }
84
71
  });
85
- export { Attachment };
72
+ export {
73
+ Attachment
74
+ };
86
75
  //# sourceMappingURL=attachment.js.map
@@ -1,55 +1,5 @@
1
- 'use strict';
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
- const core = require('@tiptap/core'),
4
- Audio = core.Node.create({
5
- name: 'audio',
6
- group: 'block',
7
- addAttributes() {
8
- return {
9
- src: {
10
- default: null,
11
- parseHTML: (el) => el.getAttribute('src'),
12
- renderHTML: (attrs) => ({ src: attrs.src }),
13
- },
14
- documentId: {
15
- default: '',
16
- renderHTML: (attributes) => ({
17
- 'data-document-id': attributes.documentId,
18
- }),
19
- parseHTML: (element) => element.getAttribute('data-document-id'),
20
- },
21
- };
22
- },
23
- parseHTML() {
24
- return [
25
- {
26
- tag: 'div.audio-wrapper>audio,audio',
27
- getAttrs: (el) => ({ src: el.getAttribute('src') }),
28
- },
29
- ];
30
- },
31
- renderHTML({ HTMLAttributes }) {
32
- return [
33
- 'div',
34
- { class: 'audio-wrapper' },
35
- ['audio', core.mergeAttributes(HTMLAttributes)],
36
- ];
37
- },
38
- addCommands() {
39
- return {
40
- setAudio:
41
- (id, src, options) =>
42
- ({ commands, state }) =>
43
- commands.insertContentAt(
44
- state.selection,
45
- `<audio
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core"),Audio=core.Node.create({name:"audio",group:"block",addAttributes(){return{src:{default:null,parseHTML:el=>el.getAttribute("src"),renderHTML:attrs=>({src:attrs.src})},documentId:{default:"",renderHTML:attributes=>({"data-document-id":attributes.documentId}),parseHTML:element=>element.getAttribute("data-document-id")}}},parseHTML(){return[{tag:"div.audio-wrapper>audio,audio",getAttrs:el=>({src:el.getAttribute("src")})}]},renderHTML({HTMLAttributes}){return["div",{class:"audio-wrapper"},["audio",core.mergeAttributes(HTMLAttributes)]]},addCommands(){return{setAudio:(id,src,options)=>({commands,state})=>commands.insertContentAt(state.selection,`<audio
46
2
  src="${src}"
47
3
  controls preload="none"
48
- data-document-id="${id}"></audio>`,
49
- options,
50
- ),
51
- };
52
- },
53
- });
54
- exports.Audio = Audio;
4
+ data-document-id="${id}"></audio>`,options)}}});exports.Audio=Audio;
55
5
  //# sourceMappingURL=audio.cjs.map
@@ -1,23 +1,19 @@
1
1
  import { Node } from '@tiptap/core';
2
2
  export interface AudioOptions {
3
- url: string;
4
- HTMLAttributes: Record<string, any>;
3
+ url: string;
4
+ HTMLAttributes: Record<string, any>;
5
5
  }
6
6
  declare module '@tiptap/core' {
7
- interface Commands<ReturnType> {
8
- audio: {
9
- /**
10
- * Set a audio node
11
- * @param options.updateSelection set to true will select the newly inserted content
12
- */
13
- setAudio: (
14
- id: string,
15
- src: string,
16
- options?: {
17
- updateSelection: boolean;
18
- },
19
- ) => ReturnType;
20
- };
21
- }
7
+ interface Commands<ReturnType> {
8
+ audio: {
9
+ /**
10
+ * Set a audio node
11
+ * @param options.updateSelection set to true will select the newly inserted content
12
+ */
13
+ setAudio: (id: string, src: string, options?: {
14
+ updateSelection: boolean;
15
+ }) => ReturnType;
16
+ };
17
+ }
22
18
  }
23
19
  export declare const Audio: Node<any, any>;
@@ -1,55 +1,52 @@
1
- import { Node, mergeAttributes } from '@tiptap/core';
1
+ import { Node, mergeAttributes } from "@tiptap/core";
2
2
  const Audio = Node.create({
3
- name: 'audio',
4
- group: 'block',
3
+ name: "audio",
4
+ group: "block",
5
5
  addAttributes() {
6
6
  return {
7
7
  src: {
8
8
  default: null,
9
- parseHTML: (el) => el.getAttribute('src'),
10
- renderHTML: (attrs) => ({ src: attrs.src }),
9
+ parseHTML: (el) => el.getAttribute("src"),
10
+ renderHTML: (attrs) => ({ src: attrs.src })
11
11
  },
12
12
  documentId: {
13
- default: '',
14
- renderHTML: (attributes) => ({
15
- 'data-document-id': attributes.documentId,
16
- }),
17
- parseHTML: (element) => element.getAttribute('data-document-id'),
18
- },
13
+ default: "",
14
+ renderHTML: (attributes) => ({ "data-document-id": attributes.documentId }),
15
+ parseHTML: (element) => element.getAttribute("data-document-id")
16
+ }
19
17
  };
20
18
  },
21
19
  parseHTML() {
22
20
  return [
23
21
  {
24
- tag: 'div.audio-wrapper>audio,audio',
22
+ tag: "div.audio-wrapper>audio,audio",
25
23
  getAttrs: (el) => ({
26
- src: el.getAttribute('src'),
27
- }),
28
- },
24
+ src: el.getAttribute("src")
25
+ })
26
+ }
29
27
  ];
30
28
  },
31
29
  renderHTML({ HTMLAttributes }) {
32
30
  return [
33
- 'div',
34
- { class: 'audio-wrapper' },
35
- ['audio', mergeAttributes(HTMLAttributes)],
31
+ "div",
32
+ { class: "audio-wrapper" },
33
+ ["audio", mergeAttributes(HTMLAttributes)]
36
34
  ];
37
35
  },
38
36
  addCommands() {
39
37
  return {
40
- setAudio:
41
- (id, src, options) =>
42
- ({ commands, state }) =>
43
- commands.insertContentAt(
44
- state.selection,
45
- `<audio
38
+ setAudio: (id, src, options) => ({ commands, state }) => commands.insertContentAt(
39
+ state.selection,
40
+ `<audio
46
41
  src="${src}"
47
42
  controls preload="none"
48
43
  data-document-id="${id}"></audio>`,
49
- options,
50
- ),
44
+ options
45
+ )
51
46
  };
52
- },
47
+ }
53
48
  });
54
- export { Audio };
49
+ export {
50
+ Audio
51
+ };
55
52
  //# sourceMappingURL=audio.js.map
@@ -1,49 +1,2 @@
1
- 'use strict';
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
- require('@tiptap/extension-text-style');
4
- const core = require('@tiptap/core'),
5
- FontSize = core.Extension.create({
6
- name: 'fontSize',
7
- addOptions() {
8
- return { types: ['textStyle'] };
9
- },
10
- addGlobalAttributes() {
11
- return [
12
- {
13
- types: this.options.types,
14
- attributes: {
15
- fontSize: {
16
- default: null,
17
- parseHTML: (element) => {
18
- var _a;
19
- return (_a = element.style.fontSize) == null
20
- ? void 0
21
- : _a.replace(/['"]+/g, '');
22
- },
23
- renderHTML: (attributes) =>
24
- attributes.fontSize
25
- ? { style: `font-size: ${attributes.fontSize}` }
26
- : {},
27
- },
28
- },
29
- },
30
- ];
31
- },
32
- addCommands() {
33
- return {
34
- setFontSize:
35
- (fontSize) =>
36
- ({ chain }) =>
37
- chain().setMark('textStyle', { fontSize }).run(),
38
- unsetFontSize:
39
- () =>
40
- ({ chain }) =>
41
- chain()
42
- .setMark('textStyle', { fontSize: null })
43
- .removeEmptyTextStyle()
44
- .run(),
45
- };
46
- },
47
- });
48
- exports.FontSize = FontSize;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@tiptap/extension-text-style");const core=require("@tiptap/core"),FontSize=core.Extension.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:element=>{var _a;return(_a=element.style.fontSize)==null?void 0:_a.replace(/['"]+/g,"")},renderHTML:attributes=>attributes.fontSize?{style:`font-size: ${attributes.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:fontSize=>({chain})=>chain().setMark("textStyle",{fontSize}).run(),unsetFontSize:()=>({chain})=>chain().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}});exports.FontSize=FontSize;
49
2
  //# sourceMappingURL=font-size.cjs.map