@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/dist/index.cjs CHANGED
@@ -1,44 +1,2 @@
1
- 'use strict';
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
- const abbr = require('./abbr/abbr.cjs'),
4
- alert = require('./alert/alert.cjs'),
5
- attachment = require('./attachment/attachment.cjs'),
6
- audio = require('./audio/audio.cjs'),
7
- fontSize = require('./font-size/font-size.cjs'),
8
- heading = require('./heading/heading.cjs'),
9
- highlight = require('./highlight/highlight.cjs'),
10
- hyperlink = require('./hyperlink/hyperlink.cjs'),
11
- iframe = require('./iframe/iframe.cjs'),
12
- customImage = require('./image/custom-image.cjs'),
13
- lineHeight = require('./line-height/line-height.cjs'),
14
- linker = require('./linker/linker.cjs'),
15
- mathjax = require('./mathjax/mathjax.cjs'),
16
- paragraph = require('./paragraph/paragraph.cjs'),
17
- speechRecognition = require('./speech-recognition/speech-recognition.cjs'),
18
- speechSynthesis = require('./speech-synthesis/speech-synthesis.cjs'),
19
- tableCell = require('./table-cell/table-cell.cjs'),
20
- htmlToJson = require('./transform/html-to-json/html-to-json.cjs'),
21
- jsonToHtml = require('./transform/json-to-html/json-to-html.cjs'),
22
- video = require('./video/video.cjs');
23
- exports.Abbr = abbr.Abbr;
24
- exports.Alert = alert.Alert;
25
- exports.Attachment = attachment.Attachment;
26
- exports.Audio = audio.Audio;
27
- exports.FontSize = fontSize.FontSize;
28
- exports.CustomHeading = heading.CustomHeading;
29
- exports.CustomHighlight = highlight.CustomHighlight;
30
- exports.Hyperlink = hyperlink.Hyperlink;
31
- exports.Iframe = iframe.Iframe;
32
- exports.CustomImage = customImage.CustomImage;
33
- exports.IMAGE_INPUT_REGEX = customImage.IMAGE_INPUT_REGEX;
34
- exports.LineHeight = lineHeight.LineHeight;
35
- exports.Linker = linker.Linker;
36
- exports.MathJax = mathjax.MathJax;
37
- exports.Paragraph = paragraph.Paragraph;
38
- exports.SpeechRecognition = speechRecognition.SpeechRecognition;
39
- exports.SpeechSynthesis = speechSynthesis.SpeechSynthesis;
40
- exports.TableCell = tableCell.TableCell;
41
- exports.htmlToJson = htmlToJson;
42
- exports.jsonToHtml = jsonToHtml;
43
- exports.Video = video.Video;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const abbr=require("./abbr/abbr.cjs"),alert=require("./alert/alert.cjs"),attachment=require("./attachment/attachment.cjs"),audio=require("./audio/audio.cjs"),fontSize=require("./font-size/font-size.cjs"),heading=require("./heading/heading.cjs"),highlight=require("./highlight/highlight.cjs"),hyperlink=require("./hyperlink/hyperlink.cjs"),iframe=require("./iframe/iframe.cjs"),customImage=require("./image/custom-image.cjs"),lineHeight=require("./line-height/line-height.cjs"),linker=require("./linker/linker.cjs"),mathjax=require("./mathjax/mathjax.cjs"),paragraph=require("./paragraph/paragraph.cjs"),speechRecognition=require("./speech-recognition/speech-recognition.cjs"),speechSynthesis=require("./speech-synthesis/speech-synthesis.cjs"),tableCell=require("./table-cell/table-cell.cjs"),htmlToJson=require("./transform/html-to-json/html-to-json.cjs"),jsonToHtml=require("./transform/json-to-html/json-to-html.cjs"),video=require("./video/video.cjs");exports.Abbr=abbr.Abbr;exports.Alert=alert.Alert;exports.Attachment=attachment.Attachment;exports.Audio=audio.Audio;exports.FontSize=fontSize.FontSize;exports.CustomHeading=heading.CustomHeading;exports.CustomHighlight=highlight.CustomHighlight;exports.Hyperlink=hyperlink.Hyperlink;exports.Iframe=iframe.Iframe;exports.CustomImage=customImage.CustomImage;exports.IMAGE_INPUT_REGEX=customImage.IMAGE_INPUT_REGEX;exports.LineHeight=lineHeight.LineHeight;exports.Linker=linker.Linker;exports.MathJax=mathjax.MathJax;exports.Paragraph=paragraph.Paragraph;exports.SpeechRecognition=speechRecognition.SpeechRecognition;exports.SpeechSynthesis=speechSynthesis.SpeechSynthesis;exports.TableCell=tableCell.TableCell;exports.htmlToJson=htmlToJson;exports.jsonToHtml=jsonToHtml;exports.Video=video.Video;
44
2
  //# sourceMappingURL=index.cjs.map
package/dist/index.js CHANGED
@@ -1,23 +1,23 @@
1
- import { Abbr } from './abbr/abbr.js';
2
- import { Alert } from './alert/alert.js';
3
- import { Attachment } from './attachment/attachment.js';
4
- import { Audio } from './audio/audio.js';
5
- import { FontSize } from './font-size/font-size.js';
6
- import { CustomHeading } from './heading/heading.js';
7
- import { CustomHighlight } from './highlight/highlight.js';
8
- import { Hyperlink } from './hyperlink/hyperlink.js';
9
- import { Iframe } from './iframe/iframe.js';
10
- import { CustomImage, IMAGE_INPUT_REGEX } from './image/custom-image.js';
11
- import { LineHeight } from './line-height/line-height.js';
12
- import { Linker } from './linker/linker.js';
13
- import { MathJax } from './mathjax/mathjax.js';
14
- import { Paragraph } from './paragraph/paragraph.js';
15
- import { SpeechRecognition } from './speech-recognition/speech-recognition.js';
16
- import { SpeechSynthesis } from './speech-synthesis/speech-synthesis.js';
17
- import { TableCell } from './table-cell/table-cell.js';
18
- import { default as default2 } from './transform/html-to-json/html-to-json.js';
19
- import { default as default3 } from './transform/json-to-html/json-to-html.js';
20
- import { Video } from './video/video.js';
1
+ import { Abbr } from "./abbr/abbr.js";
2
+ import { Alert } from "./alert/alert.js";
3
+ import { Attachment } from "./attachment/attachment.js";
4
+ import { Audio } from "./audio/audio.js";
5
+ import { FontSize } from "./font-size/font-size.js";
6
+ import { CustomHeading } from "./heading/heading.js";
7
+ import { CustomHighlight } from "./highlight/highlight.js";
8
+ import { Hyperlink } from "./hyperlink/hyperlink.js";
9
+ import { Iframe } from "./iframe/iframe.js";
10
+ import { CustomImage, IMAGE_INPUT_REGEX } from "./image/custom-image.js";
11
+ import { LineHeight } from "./line-height/line-height.js";
12
+ import { Linker } from "./linker/linker.js";
13
+ import { MathJax } from "./mathjax/mathjax.js";
14
+ import { Paragraph } from "./paragraph/paragraph.js";
15
+ import { SpeechRecognition } from "./speech-recognition/speech-recognition.js";
16
+ import { SpeechSynthesis } from "./speech-synthesis/speech-synthesis.js";
17
+ import { TableCell } from "./table-cell/table-cell.js";
18
+ import { default as default2 } from "./transform/html-to-json/html-to-json.js";
19
+ import { default as default3 } from "./transform/json-to-html/json-to-html.js";
20
+ import { Video } from "./video/video.js";
21
21
  export {
22
22
  Abbr,
23
23
  Alert,
@@ -39,6 +39,6 @@ export {
39
39
  TableCell,
40
40
  Video,
41
41
  default2 as htmlToJson,
42
- default3 as jsonToHtml,
42
+ default3 as jsonToHtml
43
43
  };
44
44
  //# sourceMappingURL=index.js.map
@@ -1,34 +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
- LineHeight = core.Extension.create({
6
- name: 'lineHeight',
7
- addOptions() {
8
- return { types: ['textStyle'] };
9
- },
10
- addGlobalAttributes() {
11
- return [
12
- {
13
- types: this.options.types,
14
- attributes: {
15
- lineHeight: {
16
- default: null,
17
- parseHTML: (element) => {
18
- var _a;
19
- return (_a = element.style.lineHeight) == null
20
- ? void 0
21
- : _a.replace(/['"]+/g, '');
22
- },
23
- renderHTML: (attributes) =>
24
- attributes.lineHeight
25
- ? { style: `line-height: ${attributes.lineHeight}` }
26
- : {},
27
- },
28
- },
29
- },
30
- ];
31
- },
32
- });
33
- exports.LineHeight = LineHeight;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@tiptap/extension-text-style");const core=require("@tiptap/core"),LineHeight=core.Extension.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:element=>{var _a;return(_a=element.style.lineHeight)==null?void 0:_a.replace(/['"]+/g,"")},renderHTML:attributes=>attributes.lineHeight?{style:`line-height: ${attributes.lineHeight}`}:{}}}}]}});exports.LineHeight=LineHeight;
34
2
  //# sourceMappingURL=line-height.cjs.map
@@ -1,10 +1,10 @@
1
- import '@tiptap/extension-text-style';
2
- import { Extension } from '@tiptap/core';
1
+ import "@tiptap/extension-text-style";
2
+ import { Extension } from "@tiptap/core";
3
3
  const LineHeight = Extension.create({
4
- name: 'lineHeight',
4
+ name: "lineHeight",
5
5
  addOptions() {
6
6
  return {
7
- types: ['textStyle'],
7
+ types: ["textStyle"]
8
8
  };
9
9
  },
10
10
  addGlobalAttributes() {
@@ -16,21 +16,18 @@ const LineHeight = Extension.create({
16
16
  default: null,
17
17
  parseHTML: (element) => {
18
18
  var _a;
19
- return (_a = element.style.lineHeight) == null
20
- ? void 0
21
- : _a.replace(/['"]+/g, '');
19
+ return (_a = element.style.lineHeight) == null ? void 0 : _a.replace(/['"]+/g, "");
22
20
  },
23
- renderHTML: (attributes) =>
24
- attributes.lineHeight
25
- ? {
26
- style: `line-height: ${attributes.lineHeight}`,
27
- }
28
- : {},
29
- },
30
- },
31
- },
21
+ renderHTML: (attributes) => attributes.lineHeight ? {
22
+ style: `line-height: ${attributes.lineHeight}`
23
+ } : {}
24
+ }
25
+ }
26
+ }
32
27
  ];
33
- },
28
+ }
34
29
  });
35
- export { LineHeight };
30
+ export {
31
+ LineHeight
32
+ };
36
33
  //# sourceMappingURL=line-height.js.map
@@ -1,96 +1,2 @@
1
- 'use strict';
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
- const core = require('@tiptap/core'),
4
- Linker = core.Node.create({
5
- name: 'linker',
6
- content: 'text*',
7
- marks: '',
8
- group: 'inline',
9
- inline: !0,
10
- selectable: !0,
11
- atom: !0,
12
- draggable: !0,
13
- isolating: !0,
14
- allowGapCursor: !1,
15
- priority: 1100,
16
- keepOnSplit: !1,
17
- addOptions() {
18
- return {
19
- openOnClick: !0,
20
- HTMLAttributes: {
21
- target: null,
22
- title: null,
23
- class: null,
24
- 'data-id': null,
25
- 'data-app-prefix': null,
26
- },
27
- validate: void 0,
28
- };
29
- },
30
- addAttributes() {
31
- return {
32
- href: { default: null },
33
- class: { default: this.options.HTMLAttributes.class },
34
- target: {
35
- default: this.options.HTMLAttributes.target,
36
- parseHTML: (element) =>
37
- element.getAttribute('target') !== '_blank' ? null : '_blank',
38
- },
39
- title: { default: this.options.HTMLAttributes.title },
40
- 'data-id': { default: this.options.HTMLAttributes['data-id'] },
41
- 'data-app-prefix': {
42
- default: this.options.HTMLAttributes['data-app-prefix'],
43
- },
44
- };
45
- },
46
- parseHTML() {
47
- return [
48
- {
49
- tag: 'a[href]:not([href *= "javascript:" i])[data-id][data-app-prefix]',
50
- },
51
- ];
52
- },
53
- renderHTML({ HTMLAttributes }) {
54
- var _a;
55
- return (_a = HTMLAttributes.href) != null && _a.startsWith('javascript:')
56
- ? [
57
- 'a',
58
- core.mergeAttributes(this.options.HTMLAttributes, {
59
- ...HTMLAttributes,
60
- href: '',
61
- }),
62
- 0,
63
- ]
64
- : [
65
- 'a',
66
- core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
67
- 0,
68
- ];
69
- },
70
- addCommands() {
71
- return {
72
- setLinker:
73
- (attrs) =>
74
- ({ commands }) => (
75
- commands.insertContent({
76
- type: this.name,
77
- attrs,
78
- content: [{ type: 'text', text: attrs.title }],
79
- }),
80
- !0
81
- ),
82
- unsetLinker:
83
- () =>
84
- ({ state, tr }) => {
85
- const { node, from, to } = state.selection;
86
- return (
87
- (node == null ? void 0 : node.type.name) === 'linker' &&
88
- tr.delete(from, to).scrollIntoView(),
89
- !0
90
- );
91
- },
92
- };
93
- },
94
- });
95
- exports.Linker = Linker;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core"),Linker=core.Node.create({name:"linker",content:"text*",marks:"",group:"inline",inline:!0,selectable:!0,atom:!0,draggable:!0,isolating:!0,allowGapCursor:!1,priority:1100,keepOnSplit:!1,addOptions(){return{openOnClick:!0,HTMLAttributes:{target:null,title:null,class:null,"data-id":null,"data-app-prefix":null},validate:void 0}},addAttributes(){return{href:{default:null},class:{default:this.options.HTMLAttributes.class},target:{default:this.options.HTMLAttributes.target,parseHTML:element=>element.getAttribute("target")!=="_blank"?null:"_blank"},title:{default:this.options.HTMLAttributes.title},"data-id":{default:this.options.HTMLAttributes["data-id"]},"data-app-prefix":{default:this.options.HTMLAttributes["data-app-prefix"]}}},parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])[data-id][data-app-prefix]'}]},renderHTML({HTMLAttributes}){var _a;return(_a=HTMLAttributes.href)!=null&&_a.startsWith("javascript:")?["a",core.mergeAttributes(this.options.HTMLAttributes,{...HTMLAttributes,href:""}),0]:["a",core.mergeAttributes(this.options.HTMLAttributes,HTMLAttributes),0]},addCommands(){return{setLinker:attrs=>({commands})=>(commands.insertContent({type:this.name,attrs,content:[{type:"text",text:attrs.title}]}),!0),unsetLinker:()=>({state,tr})=>{const{node,from,to}=state.selection;return(node==null?void 0:node.type.name)==="linker"&&tr.delete(from,to).scrollIntoView(),!0}}}});exports.Linker=Linker;
96
2
  //# sourceMappingURL=linker.cjs.map
@@ -1,24 +1,24 @@
1
1
  import { Node } from '@tiptap/core';
2
2
  export type LinkerAttributes = {
3
- href: string | null;
4
- target: '_blank' | null;
5
- title: string | null;
6
- 'data-id': string | null;
7
- 'data-app-prefix': string | null;
3
+ href: string | null;
4
+ target: '_blank' | null;
5
+ title: string | null;
6
+ 'data-id': string | null;
7
+ 'data-app-prefix': string | null;
8
8
  };
9
9
  declare module '@tiptap/core' {
10
- interface Commands<ReturnType> {
11
- linker: {
12
- /**
13
- * Set a linker node
14
- */
15
- setLinker: (attributes: LinkerAttributes) => ReturnType;
16
- /**
17
- * Unset a linker node
18
- */
19
- unsetLinker: () => ReturnType;
20
- };
21
- }
10
+ interface Commands<ReturnType> {
11
+ linker: {
12
+ /**
13
+ * Set a linker node
14
+ */
15
+ setLinker: (attributes: LinkerAttributes) => ReturnType;
16
+ /**
17
+ * Unset a linker node
18
+ */
19
+ unsetLinker: () => ReturnType;
20
+ };
21
+ }
22
22
  }
23
23
  /**
24
24
  * Internal links extension.
@@ -1,9 +1,9 @@
1
- import { Node, mergeAttributes } from '@tiptap/core';
1
+ import { Node, mergeAttributes } from "@tiptap/core";
2
2
  const Linker = Node.create({
3
- name: 'linker',
4
- content: 'text*',
5
- marks: '',
6
- group: 'inline',
3
+ name: "linker",
4
+ content: "text*",
5
+ marks: "",
6
+ group: "inline",
7
7
  inline: !0,
8
8
  selectable: !0,
9
9
  atom: !0,
@@ -19,86 +19,78 @@ const Linker = Node.create({
19
19
  target: null,
20
20
  title: null,
21
21
  class: null,
22
- 'data-id': null,
23
- 'data-app-prefix': null,
22
+ "data-id": null,
23
+ "data-app-prefix": null
24
24
  },
25
- validate: void 0,
25
+ validate: void 0
26
26
  };
27
27
  },
28
28
  addAttributes() {
29
29
  return {
30
30
  href: {
31
- default: null,
31
+ default: null
32
32
  },
33
33
  class: {
34
- default: this.options.HTMLAttributes.class,
34
+ default: this.options.HTMLAttributes.class
35
35
  },
36
36
  target: {
37
37
  default: this.options.HTMLAttributes.target,
38
38
  // Sanitize target value
39
- parseHTML: (element) =>
40
- element.getAttribute('target') !== '_blank' ? null : '_blank',
39
+ parseHTML: (element) => element.getAttribute("target") !== "_blank" ? null : "_blank"
41
40
  },
42
41
  title: {
43
- default: this.options.HTMLAttributes.title,
42
+ default: this.options.HTMLAttributes.title
44
43
  },
45
- 'data-id': {
46
- default: this.options.HTMLAttributes['data-id'],
47
- },
48
- 'data-app-prefix': {
49
- default: this.options.HTMLAttributes['data-app-prefix'],
44
+ "data-id": {
45
+ default: this.options.HTMLAttributes["data-id"]
50
46
  },
47
+ "data-app-prefix": {
48
+ default: this.options.HTMLAttributes["data-app-prefix"]
49
+ }
51
50
  };
52
51
  },
53
52
  parseHTML() {
54
53
  return [
55
54
  {
56
- tag: 'a[href]:not([href *= "javascript:" i])[data-id][data-app-prefix]',
57
- },
55
+ tag: 'a[href]:not([href *= "javascript:" i])[data-id][data-app-prefix]'
56
+ }
58
57
  ];
59
58
  },
60
59
  renderHTML({ HTMLAttributes }) {
61
60
  var _a;
62
- return (_a = HTMLAttributes.href) != null && _a.startsWith('javascript:')
63
- ? [
64
- 'a',
65
- mergeAttributes(this.options.HTMLAttributes, {
66
- ...HTMLAttributes,
67
- href: '',
68
- }),
69
- 0,
70
- ]
71
- : ['a', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
61
+ return (_a = HTMLAttributes.href) != null && _a.startsWith("javascript:") ? [
62
+ "a",
63
+ mergeAttributes(this.options.HTMLAttributes, {
64
+ ...HTMLAttributes,
65
+ href: ""
66
+ }),
67
+ 0
68
+ ] : [
69
+ "a",
70
+ mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
71
+ 0
72
+ ];
72
73
  },
73
74
  addCommands() {
74
75
  return {
75
- setLinker:
76
- (attrs) =>
77
- ({ commands }) => (
78
- commands.insertContent({
79
- type: this.name,
80
- attrs,
81
- content: [
82
- {
83
- type: 'text',
84
- text: attrs.title,
85
- },
86
- ],
87
- }),
88
- !0
89
- ),
90
- unsetLinker:
91
- () =>
92
- ({ state, tr }) => {
93
- const { node, from, to } = state.selection;
94
- return (
95
- (node == null ? void 0 : node.type.name) === 'linker' &&
96
- tr.delete(from, to).scrollIntoView(),
97
- !0
98
- );
99
- },
76
+ setLinker: (attrs) => ({ commands }) => (commands.insertContent({
77
+ type: this.name,
78
+ attrs,
79
+ content: [
80
+ {
81
+ type: "text",
82
+ text: attrs.title
83
+ }
84
+ ]
85
+ }), !0),
86
+ unsetLinker: () => ({ state, tr }) => {
87
+ const { node, from, to } = state.selection;
88
+ return (node == null ? void 0 : node.type.name) === "linker" && tr.delete(from, to).scrollIntoView(), !0;
89
+ }
100
90
  };
101
- },
91
+ }
102
92
  });
103
- export { Linker };
93
+ export {
94
+ Linker
95
+ };
104
96
  //# sourceMappingURL=linker.js.map
@@ -1,48 +1,2 @@
1
- 'use strict';
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
- const core = require('@tiptap/core'),
4
- MathJax = core.Node.create({
5
- name: 'mathjaxnode',
6
- group: 'inline',
7
- inline: !0,
8
- atom: !1,
9
- selectable: !0,
10
- parseHTML() {
11
- return [{ tag: 'mathjax' }];
12
- },
13
- addAttributes() {
14
- return {
15
- equation: {
16
- default: null,
17
- parseHTML: (element) => {
18
- const textNodes = [...element.childNodes].filter(
19
- (child) => child.nodeType === 3,
20
- );
21
- return textNodes.length > 0
22
- ? textNodes[textNodes.length - 1].nodeValue
23
- : null;
24
- },
25
- },
26
- };
27
- },
28
- renderHTML({ HTMLAttributes }) {
29
- let equation = (HTMLAttributes.equation || '')
30
- .replaceAll(
31
- /(?:\\)?begin{equation}\s*\n?\s*{(.+?)}\n?\s*?(?:\\)?end{equation}/gm,
32
- '$$$1$$',
33
- )
34
- .replaceAll(
35
- /(?:\\)?begin{equation}\s*\n?\s*(.+?)\n?\s*?(?:\\)?end{equation}/gm,
36
- '$$$1$$',
37
- );
38
- return (
39
- equation.length > 0 &&
40
- (equation.charAt(0) !== '$' && (equation = `$${equation}`),
41
- equation.charAt(equation.length - 1) !== '$' &&
42
- (equation = `${equation}$`)),
43
- ['span', {}, equation]
44
- );
45
- },
46
- });
47
- exports.MathJax = MathJax;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core"),MathJax=core.Node.create({name:"mathjaxnode",group:"inline",inline:!0,atom:!1,selectable:!0,parseHTML(){return[{tag:"mathjax"}]},addAttributes(){return{equation:{default:null,parseHTML:element=>{const textNodes=[...element.childNodes].filter(child=>child.nodeType===3);return textNodes.length>0?textNodes[textNodes.length-1].nodeValue:null}}}},renderHTML({HTMLAttributes}){let equation=(HTMLAttributes.equation||"").replaceAll(/(?:\\)?begin{equation}\s*\n?\s*{(.+?)}\n?\s*?(?:\\)?end{equation}/gm,"$$$1$$").replaceAll(/(?:\\)?begin{equation}\s*\n?\s*(.+?)\n?\s*?(?:\\)?end{equation}/gm,"$$$1$$");return equation.length>0&&(equation.charAt(0)!=="$"&&(equation=`$${equation}`),equation.charAt(equation.length-1)!=="$"&&(equation=`${equation}$`)),["span",{},equation]}});exports.MathJax=MathJax;
48
2
  //# sourceMappingURL=mathjax.cjs.map
@@ -1,15 +1,15 @@
1
- import { Node } from '@tiptap/core';
1
+ import { Node } from "@tiptap/core";
2
2
  const MathJax = Node.create({
3
- name: 'mathjaxnode',
4
- group: 'inline',
3
+ name: "mathjaxnode",
4
+ group: "inline",
5
5
  inline: !0,
6
6
  atom: !1,
7
7
  selectable: !0,
8
8
  parseHTML() {
9
9
  return [
10
10
  {
11
- tag: 'mathjax',
12
- },
11
+ tag: "mathjax"
12
+ }
13
13
  ];
14
14
  },
15
15
  addAttributes() {
@@ -17,34 +17,24 @@ const MathJax = Node.create({
17
17
  equation: {
18
18
  default: null,
19
19
  parseHTML: (element) => {
20
- const textNodes = [...element.childNodes].filter(
21
- (child) => child.nodeType === 3,
22
- );
23
- return textNodes.length > 0
24
- ? textNodes[textNodes.length - 1].nodeValue
25
- : null;
26
- },
27
- },
20
+ const textNodes = [...element.childNodes].filter((child) => child.nodeType === 3);
21
+ return textNodes.length > 0 ? textNodes[textNodes.length - 1].nodeValue : null;
22
+ }
23
+ }
28
24
  };
29
25
  },
30
26
  renderHTML({ HTMLAttributes }) {
31
- let equation = (HTMLAttributes.equation || '')
32
- .replaceAll(
33
- /(?:\\)?begin{equation}\s*\n?\s*{(.+?)}\n?\s*?(?:\\)?end{equation}/gm,
34
- '$$$1$$',
35
- )
36
- .replaceAll(
37
- /(?:\\)?begin{equation}\s*\n?\s*(.+?)\n?\s*?(?:\\)?end{equation}/gm,
38
- '$$$1$$',
39
- );
40
- return (
41
- equation.length > 0 &&
42
- (equation.charAt(0) !== '$' && (equation = `$${equation}`),
43
- equation.charAt(equation.length - 1) !== '$' &&
44
- (equation = `${equation}$`)),
45
- ['span', {}, equation]
27
+ let equation = (HTMLAttributes.equation || "").replaceAll(
28
+ /(?:\\)?begin{equation}\s*\n?\s*{(.+?)}\n?\s*?(?:\\)?end{equation}/gm,
29
+ "$$$1$$"
30
+ ).replaceAll(
31
+ /(?:\\)?begin{equation}\s*\n?\s*(.+?)\n?\s*?(?:\\)?end{equation}/gm,
32
+ "$$$1$$"
46
33
  );
47
- },
34
+ return equation.length > 0 && (equation.charAt(0) !== "$" && (equation = `$${equation}`), equation.charAt(equation.length - 1) !== "$" && (equation = `${equation}$`)), ["span", {}, equation];
35
+ }
48
36
  });
49
- export { MathJax };
37
+ export {
38
+ MathJax
39
+ };
50
40
  //# sourceMappingURL=mathjax.js.map
@@ -1,14 +1,2 @@
1
- 'use strict';
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
- const extensionParagraph = require('@tiptap/extension-paragraph'),
4
- Paragraph = extensionParagraph.Paragraph.extend({
5
- parseHTML() {
6
- var _a;
7
- return [
8
- ...(((_a = this.parent) == null ? void 0 : _a.call(this)) ?? []),
9
- { tag: 'div[style]:has(> span)' },
10
- ];
11
- },
12
- });
13
- exports.Paragraph = Paragraph;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const extensionParagraph=require("@tiptap/extension-paragraph"),Paragraph=extensionParagraph.Paragraph.extend({parseHTML(){var _a;return[...((_a=this.parent)==null?void 0:_a.call(this))??[],{tag:"div[style]:has(> span)"}]}});exports.Paragraph=Paragraph;
14
2
  //# sourceMappingURL=paragraph.cjs.map
@@ -10,7 +10,4 @@
10
10
  * is now parsed and rendered as
11
11
  * `<p style="text-align: right;"><span style="font-size: 20pt;">A right-aligned text</span></p>`
12
12
  */
13
- export declare const Paragraph: import('@tiptap/core').Node<
14
- import('@tiptap/extension-paragraph').ParagraphOptions,
15
- any
16
- >;
13
+ export declare const Paragraph: import('@tiptap/core').Node<import('@tiptap/extension-paragraph').ParagraphOptions, any>;
@@ -1,14 +1,16 @@
1
- import { Paragraph as Paragraph$1 } from '@tiptap/extension-paragraph';
1
+ import { Paragraph as Paragraph$1 } from "@tiptap/extension-paragraph";
2
2
  const Paragraph = Paragraph$1.extend({
3
3
  parseHTML() {
4
4
  var _a;
5
5
  return [
6
- ...(((_a = this.parent) == null ? void 0 : _a.call(this)) ?? []),
6
+ ...((_a = this.parent) == null ? void 0 : _a.call(this)) ?? [],
7
7
  {
8
- tag: 'div[style]:has(> span)',
9
- },
8
+ tag: "div[style]:has(> span)"
9
+ }
10
10
  ];
11
- },
11
+ }
12
12
  });
13
- export { Paragraph };
13
+ export {
14
+ Paragraph
15
+ };
14
16
  //# sourceMappingURL=paragraph.js.map