@edifice.io/tiptap-extensions 2.6.9-develop-enabling.20261013152718 → 2.6.9-develop-integration.20261014184332
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/abbr/abbr.cjs +2 -2
- package/dist/abbr/abbr.cjs.map +1 -1
- package/dist/abbr/abbr.js +33 -2
- package/dist/abbr/abbr.js.map +1 -1
- package/dist/alert/alert.cjs +2 -2
- package/dist/alert/alert.cjs.map +1 -1
- package/dist/alert/alert.js +45 -2
- package/dist/alert/alert.js.map +1 -1
- package/dist/attachment/attachment-transformer.cjs +2 -2
- package/dist/attachment/attachment-transformer.cjs.map +1 -1
- package/dist/attachment/attachment-transformer.js +76 -2
- package/dist/attachment/attachment-transformer.js.map +1 -1
- package/dist/attachment/attachment.cjs +2 -2
- package/dist/attachment/attachment.cjs.map +1 -1
- package/dist/attachment/attachment.js +98 -2
- package/dist/attachment/attachment.js.map +1 -1
- package/dist/audio/audio.cjs +2 -2
- package/dist/audio/audio.cjs.map +1 -1
- package/dist/audio/audio.js +52 -3
- package/dist/audio/audio.js.map +1 -1
- package/dist/conversation-history/conversation-history.cjs +2 -2
- package/dist/conversation-history/conversation-history.cjs.map +1 -1
- package/dist/conversation-history/conversation-history.js +63 -2
- package/dist/conversation-history/conversation-history.js.map +1 -1
- package/dist/conversation-history-body/conversation-history-body.cjs +2 -2
- package/dist/conversation-history-body/conversation-history-body.cjs.map +1 -1
- package/dist/conversation-history-body/conversation-history-body.js +24 -2
- package/dist/conversation-history-body/conversation-history-body.js.map +1 -1
- package/dist/font-size/font-size.cjs +2 -2
- package/dist/font-size/font-size.cjs.map +1 -1
- package/dist/font-size/font-size.js +39 -2
- package/dist/font-size/font-size.js.map +1 -1
- package/dist/heading/heading.cjs +2 -2
- package/dist/heading/heading.cjs.map +1 -1
- package/dist/heading/heading.js +46 -2
- package/dist/heading/heading.js.map +1 -1
- package/dist/highlight/highlight.cjs +2 -2
- package/dist/highlight/highlight.cjs.map +1 -1
- package/dist/highlight/highlight.js +28 -2
- package/dist/highlight/highlight.js.map +1 -1
- package/dist/hyperlink/hyperlink.cjs +2 -2
- package/dist/hyperlink/hyperlink.cjs.map +1 -1
- package/dist/hyperlink/hyperlink.js +53 -2
- package/dist/hyperlink/hyperlink.js.map +1 -1
- package/dist/iframe/iframe.cjs +2 -2
- package/dist/iframe/iframe.cjs.map +1 -1
- package/dist/iframe/iframe.js +70 -2
- package/dist/iframe/iframe.js.map +1 -1
- package/dist/iframe/transformers/index.cjs +2 -2
- package/dist/iframe/transformers/index.cjs.map +1 -1
- package/dist/iframe/transformers/index.js +22 -2
- package/dist/iframe/transformers/index.js.map +1 -1
- package/dist/iframe/transformers/pad-transformer.cjs +2 -2
- package/dist/iframe/transformers/pad-transformer.cjs.map +1 -1
- package/dist/iframe/transformers/pad-transformer.js +24 -2
- package/dist/iframe/transformers/pad-transformer.js.map +1 -1
- package/dist/image/image.cjs +2 -2
- package/dist/image/image.cjs.map +1 -1
- package/dist/image/image.js +175 -2
- package/dist/image/image.js.map +1 -1
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +52 -1
- package/dist/index.js.map +1 -0
- package/dist/information-pane/information-pane.cjs +2 -2
- package/dist/information-pane/information-pane.cjs.map +1 -1
- package/dist/information-pane/information-pane.js +57 -2
- package/dist/information-pane/information-pane.js.map +1 -1
- package/dist/line-height/line-height.cjs +2 -2
- package/dist/line-height/line-height.cjs.map +1 -1
- package/dist/line-height/line-height.js +33 -2
- package/dist/line-height/line-height.js.map +1 -1
- package/dist/linker/linker.cjs +2 -2
- package/dist/linker/linker.cjs.map +1 -1
- package/dist/linker/linker.js +96 -2
- package/dist/linker/linker.js.map +1 -1
- package/dist/mathjax/mathjax.cjs +2 -2
- package/dist/mathjax/mathjax.cjs.map +1 -1
- package/dist/mathjax/mathjax.js +40 -2
- package/dist/mathjax/mathjax.js.map +1 -1
- package/dist/paragraph/paragraph.cjs +2 -2
- package/dist/paragraph/paragraph.cjs.map +1 -1
- package/dist/paragraph/paragraph.js +16 -2
- package/dist/paragraph/paragraph.js.map +1 -1
- package/dist/speech-recognition/speech-recognition.cjs +2 -2
- package/dist/speech-recognition/speech-recognition.cjs.map +1 -1
- package/dist/speech-recognition/speech-recognition.js +56 -2
- package/dist/speech-recognition/speech-recognition.js.map +1 -1
- package/dist/speech-synthesis/speech-synthesis.cjs +2 -2
- package/dist/speech-synthesis/speech-synthesis.cjs.map +1 -1
- package/dist/speech-synthesis/speech-synthesis.js +25 -2
- package/dist/speech-synthesis/speech-synthesis.js.map +1 -1
- package/dist/table-cell/table-cell.cjs +2 -2
- package/dist/table-cell/table-cell.cjs.map +1 -1
- package/dist/table-cell/table-cell.js +23 -2
- package/dist/table-cell/table-cell.js.map +1 -1
- package/dist/transform/html-to-json/html-to-json.cjs +2 -2
- package/dist/transform/html-to-json/html-to-json.cjs.map +1 -1
- package/dist/transform/html-to-json/html-to-json.js +6 -2
- package/dist/transform/html-to-json/html-to-json.js.map +1 -1
- package/dist/transform/json-to-html/json-to-html.cjs +2 -2
- package/dist/transform/json-to-html/json-to-html.cjs.map +1 -1
- package/dist/transform/json-to-html/json-to-html.js +6 -2
- package/dist/transform/json-to-html/json-to-html.js.map +1 -1
- package/dist/video/video.cjs +3 -3
- package/dist/video/video.cjs.map +1 -1
- package/dist/video/video.js +92 -3
- package/dist/video/video.js.map +1 -1
- package/package.json +5 -5
- package/dist/_virtual/_rolldown/runtime.cjs +0 -1
package/dist/index.js
CHANGED
|
@@ -1 +1,52 @@
|
|
|
1
|
-
import{Abbr}from"./abbr/abbr.js";
|
|
1
|
+
import { Abbr } from "./abbr/abbr.js";
|
|
2
|
+
import { Alert } from "./alert/alert.js";
|
|
3
|
+
import { Attachment } from "./attachment/attachment.js";
|
|
4
|
+
import { AttachmentTransformer } from "./attachment/attachment-transformer.js";
|
|
5
|
+
import { Audio } from "./audio/audio.js";
|
|
6
|
+
import { ConversationHistory } from "./conversation-history/conversation-history.js";
|
|
7
|
+
import { ConversationHistoryBody } from "./conversation-history-body/conversation-history-body.js";
|
|
8
|
+
import { CustomHeading } from "./heading/heading.js";
|
|
9
|
+
import { CustomHighlight } from "./highlight/highlight.js";
|
|
10
|
+
import { FontSize } from "./font-size/font-size.js";
|
|
11
|
+
import { Hyperlink } from "./hyperlink/hyperlink.js";
|
|
12
|
+
import { IMAGE_INPUT_REGEX, Image } from "./image/image.js";
|
|
13
|
+
import { Iframe } from "./iframe/iframe.js";
|
|
14
|
+
import { InformationPane } from "./information-pane/information-pane.js";
|
|
15
|
+
import { LineHeight } from "./line-height/line-height.js";
|
|
16
|
+
import { Linker } from "./linker/linker.js";
|
|
17
|
+
import { MathJax } from "./mathjax/mathjax.js";
|
|
18
|
+
import { Paragraph } from "./paragraph/paragraph.js";
|
|
19
|
+
import { SpeechRecognition } from "./speech-recognition/speech-recognition.js";
|
|
20
|
+
import { SpeechSynthesis } from "./speech-synthesis/speech-synthesis.js";
|
|
21
|
+
import { TableCell } from "./table-cell/table-cell.js";
|
|
22
|
+
import { Video } from "./video/video.js";
|
|
23
|
+
import { default as default2 } from "./transform/html-to-json/html-to-json.js";
|
|
24
|
+
import { default as default3 } from "./transform/json-to-html/json-to-html.js";
|
|
25
|
+
export {
|
|
26
|
+
Abbr,
|
|
27
|
+
Alert,
|
|
28
|
+
Attachment,
|
|
29
|
+
AttachmentTransformer,
|
|
30
|
+
Audio,
|
|
31
|
+
ConversationHistory,
|
|
32
|
+
ConversationHistoryBody,
|
|
33
|
+
CustomHeading,
|
|
34
|
+
CustomHighlight,
|
|
35
|
+
FontSize,
|
|
36
|
+
Hyperlink,
|
|
37
|
+
IMAGE_INPUT_REGEX,
|
|
38
|
+
Iframe,
|
|
39
|
+
Image,
|
|
40
|
+
InformationPane,
|
|
41
|
+
LineHeight,
|
|
42
|
+
Linker,
|
|
43
|
+
MathJax,
|
|
44
|
+
Paragraph,
|
|
45
|
+
SpeechRecognition,
|
|
46
|
+
SpeechSynthesis,
|
|
47
|
+
TableCell,
|
|
48
|
+
Video,
|
|
49
|
+
default2 as htmlToJson,
|
|
50
|
+
default3 as jsonToHtml
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=information-pane.cjs.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core"),InformationPane=core.Node.create({name:"information-pane",group:"block",content:"block+",defining:!0,marks:"",addAttributes(){return{type:{default:"info",parseHTML:element=>element.getAttribute("data-type")||"info",renderHTML:attributes=>({"data-type":attributes.type})}}},parseHTML(){return[{tag:"div[data-information-pane]"}]},renderHTML({node,HTMLAttributes}){const type=node.attrs.type;return["div",core.mergeAttributes(HTMLAttributes,{"data-information-pane":"",class:`information-pane information-pane-${type}`}),0]},addCommands(){return{setInformationPane:(type="info")=>({commands})=>commands.insertContent([{type:this.name,attrs:{type},content:[{type:"paragraph"}]}])}}});exports.InformationPane=InformationPane;
|
|
2
|
+
//# sourceMappingURL=information-pane.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"information-pane.cjs","
|
|
1
|
+
{"version":3,"file":"information-pane.cjs","sources":["../../src/information-pane/information-pane.ts"],"sourcesContent":["import { Node, mergeAttributes } from '@tiptap/core';\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n informationPane: {\n /**\n * Set a informationPane node\n * @param type The type of the informationPane\n */\n setInformationPane: (type?: string) => ReturnType;\n };\n }\n}\n\nexport const InformationPane = Node.create({\n name: 'information-pane',\n\n group: 'block',\n content: 'block+',\n defining: true,\n marks: '',\n\n addAttributes() {\n return {\n type: {\n default: 'info', // type par défaut\n parseHTML: (element) => element.getAttribute('data-type') || 'info',\n renderHTML: (attributes) => {\n return {\n 'data-type': attributes.type,\n };\n },\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'div[data-information-pane]',\n },\n ];\n },\n\n renderHTML({ node, HTMLAttributes }) {\n const type = node.attrs.type;\n return [\n 'div',\n mergeAttributes(HTMLAttributes, {\n 'data-information-pane': '',\n 'class': `information-pane information-pane-${type}`,\n }),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setInformationPane:\n (type = 'info') =>\n ({ commands }) => {\n return commands.insertContent([\n {\n type: this.name,\n attrs: { type },\n content: [\n {\n type: 'paragraph',\n },\n ],\n },\n ]);\n },\n };\n },\n});\n"],"names":["Node","mergeAttributes"],"mappings":"mHAca,gBAAkBA,KAAAA,KAAK,OAAO,CACzC,KAAM,mBAEN,MAAO,QACP,QAAS,SACT,SAAU,GACV,MAAO,GAEP,eAAgB,CACd,MAAO,CACL,KAAM,CACJ,QAAS,OACT,UAAY,SAAY,QAAQ,aAAa,WAAW,GAAK,OAC7D,WAAa,aACJ,CACL,YAAa,WAAW,IAAA,EAE5B,CACF,CAEJ,EAEA,WAAY,CACV,MAAO,CACL,CACE,IAAK,4BAAA,CACP,CAEJ,EAEA,WAAW,CAAE,KAAM,gBAAkB,CACnC,MAAM,KAAO,KAAK,MAAM,KACxB,MAAO,CACL,MACAC,KAAAA,gBAAgB,eAAgB,CAC9B,wBAAyB,GACzB,MAAS,qCAAqC,IAAI,EAAA,CACnD,EACD,CAAA,CAEJ,EAEA,aAAc,CACZ,MAAO,CACL,mBACE,CAAC,KAAO,SACR,CAAC,CAAE,YACM,SAAS,cAAc,CAC5B,CACE,KAAM,KAAK,KACX,MAAO,CAAE,IAAA,EACT,QAAS,CACP,CACE,KAAM,WAAA,CACR,CACF,CACF,CACD,CACH,CAEN,CACF,CAAC"}
|
|
@@ -1,2 +1,57 @@
|
|
|
1
|
-
import{Node,mergeAttributes}from"@tiptap/core";
|
|
2
|
-
|
|
1
|
+
import { Node, mergeAttributes } from "@tiptap/core";
|
|
2
|
+
const InformationPane = Node.create({
|
|
3
|
+
name: "information-pane",
|
|
4
|
+
group: "block",
|
|
5
|
+
content: "block+",
|
|
6
|
+
defining: !0,
|
|
7
|
+
marks: "",
|
|
8
|
+
addAttributes() {
|
|
9
|
+
return {
|
|
10
|
+
type: {
|
|
11
|
+
default: "info",
|
|
12
|
+
// type par défaut
|
|
13
|
+
parseHTML: (element) => element.getAttribute("data-type") || "info",
|
|
14
|
+
renderHTML: (attributes) => ({
|
|
15
|
+
"data-type": attributes.type
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
parseHTML() {
|
|
21
|
+
return [
|
|
22
|
+
{
|
|
23
|
+
tag: "div[data-information-pane]"
|
|
24
|
+
}
|
|
25
|
+
];
|
|
26
|
+
},
|
|
27
|
+
renderHTML({ node, HTMLAttributes }) {
|
|
28
|
+
const type = node.attrs.type;
|
|
29
|
+
return [
|
|
30
|
+
"div",
|
|
31
|
+
mergeAttributes(HTMLAttributes, {
|
|
32
|
+
"data-information-pane": "",
|
|
33
|
+
class: `information-pane information-pane-${type}`
|
|
34
|
+
}),
|
|
35
|
+
0
|
|
36
|
+
];
|
|
37
|
+
},
|
|
38
|
+
addCommands() {
|
|
39
|
+
return {
|
|
40
|
+
setInformationPane: (type = "info") => ({ commands }) => commands.insertContent([
|
|
41
|
+
{
|
|
42
|
+
type: this.name,
|
|
43
|
+
attrs: { type },
|
|
44
|
+
content: [
|
|
45
|
+
{
|
|
46
|
+
type: "paragraph"
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
])
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
export {
|
|
55
|
+
InformationPane
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=information-pane.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"information-pane.js","
|
|
1
|
+
{"version":3,"file":"information-pane.js","sources":["../../src/information-pane/information-pane.ts"],"sourcesContent":["import { Node, mergeAttributes } from '@tiptap/core';\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n informationPane: {\n /**\n * Set a informationPane node\n * @param type The type of the informationPane\n */\n setInformationPane: (type?: string) => ReturnType;\n };\n }\n}\n\nexport const InformationPane = Node.create({\n name: 'information-pane',\n\n group: 'block',\n content: 'block+',\n defining: true,\n marks: '',\n\n addAttributes() {\n return {\n type: {\n default: 'info', // type par défaut\n parseHTML: (element) => element.getAttribute('data-type') || 'info',\n renderHTML: (attributes) => {\n return {\n 'data-type': attributes.type,\n };\n },\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'div[data-information-pane]',\n },\n ];\n },\n\n renderHTML({ node, HTMLAttributes }) {\n const type = node.attrs.type;\n return [\n 'div',\n mergeAttributes(HTMLAttributes, {\n 'data-information-pane': '',\n 'class': `information-pane information-pane-${type}`,\n }),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setInformationPane:\n (type = 'info') =>\n ({ commands }) => {\n return commands.insertContent([\n {\n type: this.name,\n attrs: { type },\n content: [\n {\n type: 'paragraph',\n },\n ],\n },\n ]);\n },\n };\n },\n});\n"],"names":[],"mappings":";AAcO,MAAM,kBAAkB,KAAK,OAAO;AAAA,EACzC,MAAM;AAAA,EAEN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,UAAU;AAAA,EACV,OAAO;AAAA,EAEP,gBAAgB;AACd,WAAO;AAAA,MACL,MAAM;AAAA,QACJ,SAAS;AAAA;AAAA,QACT,WAAW,CAAC,YAAY,QAAQ,aAAa,WAAW,KAAK;AAAA,QAC7D,YAAY,CAAC,gBACJ;AAAA,UACL,aAAa,WAAW;AAAA,QAAA;AAAA,MAE5B;AAAA,IACF;AAAA,EAEJ;AAAA,EAEA,YAAY;AACV,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MAAA;AAAA,IACP;AAAA,EAEJ;AAAA,EAEA,WAAW,EAAE,MAAM,kBAAkB;AACnC,UAAM,OAAO,KAAK,MAAM;AACxB,WAAO;AAAA,MACL;AAAA,MACA,gBAAgB,gBAAgB;AAAA,QAC9B,yBAAyB;AAAA,QACzB,OAAS,qCAAqC,IAAI;AAAA,MAAA,CACnD;AAAA,MACD;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,cAAc;AACZ,WAAO;AAAA,MACL,oBACE,CAAC,OAAO,WACR,CAAC,EAAE,eACM,SAAS,cAAc;AAAA,QAC5B;AAAA,UACE,MAAM,KAAK;AAAA,UACX,OAAO,EAAE,KAAA;AAAA,UACT,SAAS;AAAA,YACP;AAAA,cACE,MAAM;AAAA,YAAA;AAAA,UACR;AAAA,QACF;AAAA,MACF,CACD;AAAA,IACH;AAAA,EAEN;AACF,CAAC;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=line-height.cjs.map
|
|
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;
|
|
2
|
+
//# sourceMappingURL=line-height.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line-height.cjs","
|
|
1
|
+
{"version":3,"file":"line-height.cjs","sources":["../../src/line-height/line-height.ts"],"sourcesContent":["import '@tiptap/extension-text-style';\n\nimport { Extension } from '@tiptap/core';\n\nexport const LineHeight = Extension.create({\n name: 'lineHeight',\n\n addOptions() {\n return {\n types: ['textStyle'],\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n lineHeight: {\n default: null,\n parseHTML: (element) =>\n element.style.lineHeight?.replace(/['\"]+/g, ''),\n renderHTML: (attributes) => {\n if (!attributes.lineHeight) {\n return {};\n }\n\n return {\n style: `line-height: ${attributes.lineHeight}`,\n };\n },\n },\n },\n },\n ];\n },\n});\n"],"names":["Extension"],"mappings":"2JAIa,WAAaA,KAAAA,UAAU,OAAO,CACzC,KAAM,aAEN,YAAa,CACX,MAAO,CACL,MAAO,CAAC,WAAW,CAAA,CAEvB,EAEA,qBAAsB,CACpB,MAAO,CACL,CACE,MAAO,KAAK,QAAQ,MACpB,WAAY,CACV,WAAY,CACV,QAAS,KACT,UAAY,SAAA,QACV,kBAAQ,MAAM,aAAd,eAA0B,QAAQ,SAAU,KAC9C,WAAa,YACN,WAAW,WAIT,CACL,MAAO,gBAAgB,WAAW,UAAU,EAAA,EAJrC,CAAA,CAMX,CACF,CACF,CACF,CAEJ,CACF,CAAC"}
|
|
@@ -1,2 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import "@tiptap/extension-text-style";
|
|
2
|
+
import { Extension } from "@tiptap/core";
|
|
3
|
+
const LineHeight = Extension.create({
|
|
4
|
+
name: "lineHeight",
|
|
5
|
+
addOptions() {
|
|
6
|
+
return {
|
|
7
|
+
types: ["textStyle"]
|
|
8
|
+
};
|
|
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 ? void 0 : _a.replace(/['"]+/g, "");
|
|
20
|
+
},
|
|
21
|
+
renderHTML: (attributes) => attributes.lineHeight ? {
|
|
22
|
+
style: `line-height: ${attributes.lineHeight}`
|
|
23
|
+
} : {}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
export {
|
|
31
|
+
LineHeight
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=line-height.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line-height.js","
|
|
1
|
+
{"version":3,"file":"line-height.js","sources":["../../src/line-height/line-height.ts"],"sourcesContent":["import '@tiptap/extension-text-style';\n\nimport { Extension } from '@tiptap/core';\n\nexport const LineHeight = Extension.create({\n name: 'lineHeight',\n\n addOptions() {\n return {\n types: ['textStyle'],\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n lineHeight: {\n default: null,\n parseHTML: (element) =>\n element.style.lineHeight?.replace(/['\"]+/g, ''),\n renderHTML: (attributes) => {\n if (!attributes.lineHeight) {\n return {};\n }\n\n return {\n style: `line-height: ${attributes.lineHeight}`,\n };\n },\n },\n },\n },\n ];\n },\n});\n"],"names":[],"mappings":";;AAIO,MAAM,aAAa,UAAU,OAAO;AAAA,EACzC,MAAM;AAAA,EAEN,aAAa;AACX,WAAO;AAAA,MACL,OAAO,CAAC,WAAW;AAAA,IAAA;AAAA,EAEvB;AAAA,EAEA,sBAAsB;AACpB,WAAO;AAAA,MACL;AAAA,QACE,OAAO,KAAK,QAAQ;AAAA,QACpB,YAAY;AAAA,UACV,YAAY;AAAA,YACV,SAAS;AAAA,YACT,WAAW,CAAC,YAAA;;AACV,mCAAQ,MAAM,eAAd,mBAA0B,QAAQ,UAAU;AAAA;AAAA,YAC9C,YAAY,CAAC,eACN,WAAW,aAIT;AAAA,cACL,OAAO,gBAAgB,WAAW,UAAU;AAAA,YAAA,IAJrC,CAAA;AAAA,UAMX;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EAEJ;AACF,CAAC;"}
|
package/dist/linker/linker.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=linker.cjs.map
|
|
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;
|
|
2
|
+
//# sourceMappingURL=linker.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linker.cjs","
|
|
1
|
+
{"version":3,"file":"linker.cjs","sources":["../../src/linker/linker.ts"],"sourcesContent":["import { Node, mergeAttributes } from '@tiptap/core';\nimport { NodeSelection } from '@tiptap/pm/state';\n\n/* Our own model of a link in a rich document. */\nexport type LinkerAttributes = {\n 'href': string | null;\n 'target': '_blank' | null;\n 'title': string | null;\n 'data-id': string | null;\n 'data-app-prefix': string | null;\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n linker: {\n /**\n * Set a linker node\n */\n setLinker: (attributes: LinkerAttributes) => ReturnType;\n /**\n * Unset a linker node\n */\n unsetLinker: () => ReturnType;\n };\n }\n}\n\n/**\n * Internal links extension.\n * Reproduces the legacy angularJs \"linker\" directive.\n *\n * Links to internal resources MAY have a `title` and MUST HAVE `data-id` and `data-app-prefix` attributes :\n * `<a href=\"/blog#/view/35fa4198-blog_id/5e654c71-article_id\" data-app-prefix=\"blog\" data-id=\"35fa4198-blog_id\" target=\"_blank\" title=\"Voir ce billet de blog\" class=\"ng-scope\">/blog#/view/35fa4198-57fe-45eb-94f4-a5e4defff305/5e654c71-1e61-4f84-86dc-6fcfaf33f513</a>`\n */\nexport const Linker = Node.create({\n name: 'linker',\n content: 'text*',\n marks: '',\n group: 'inline',\n\n inline: true,\n selectable: true,\n atom: true,\n draggable: true,\n isolating: true,\n allowGapCursor: false,\n\n priority: 1100,\n keepOnSplit: false,\n\n addOptions() {\n return {\n openOnClick: true,\n HTMLAttributes: {\n 'target': null,\n 'title': null,\n 'class': null,\n 'data-id': null,\n 'data-app-prefix': null,\n },\n validate: undefined,\n };\n },\n\n addAttributes() {\n return {\n 'href': {\n default: null,\n },\n 'class': {\n default: this.options.HTMLAttributes.class,\n },\n 'target': {\n default: this.options.HTMLAttributes.target,\n // Sanitize target value\n parseHTML: (element) =>\n element.getAttribute('target') !== '_blank' ? null : '_blank',\n },\n 'title': {\n default: this.options.HTMLAttributes.title,\n },\n 'data-id': {\n default: this.options.HTMLAttributes['data-id'],\n },\n 'data-app-prefix': {\n default: this.options.HTMLAttributes['data-app-prefix'],\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'a[href]:not([href *= \"javascript:\" i])[data-id][data-app-prefix]',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n if (HTMLAttributes.href?.startsWith('javascript:')) {\n return [\n 'a',\n mergeAttributes(this.options.HTMLAttributes, {\n ...HTMLAttributes,\n href: '',\n }),\n 0,\n ];\n }\n return [\n 'a',\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setLinker:\n (attrs) =>\n ({ commands }) => {\n // Insert a Linker node with inner text node\n commands.insertContent({\n type: this.name,\n attrs,\n content: [\n {\n type: 'text',\n text: attrs.title,\n },\n ],\n });\n return true;\n },\n\n unsetLinker:\n () =>\n ({ state, tr }) => {\n // Which Linker node is actually selected ?\n const { node, from, to } = state.selection as NodeSelection;\n // Delete any selected Linker node\n if (node?.type.name === 'linker') {\n /* The following does not work as one would expected.\n commands.deleteNode(this.name);\n commands.deleteCurrentNode();\n * Replaced by : */\n tr.delete(from, to).scrollIntoView();\n }\n return true;\n },\n };\n },\n});\n"],"names":["Node","mergeAttributes"],"mappings":"mHAkCa,OAASA,KAAAA,KAAK,OAAO,CAChC,KAAM,SACN,QAAS,QACT,MAAO,GACP,MAAO,SAEP,OAAQ,GACR,WAAY,GACZ,KAAM,GACN,UAAW,GACX,UAAW,GACX,eAAgB,GAEhB,SAAU,KACV,YAAa,GAEb,YAAa,CACX,MAAO,CACL,YAAa,GACb,eAAgB,CACd,OAAU,KACV,MAAS,KACT,MAAS,KACT,UAAW,KACX,kBAAmB,IAAA,EAErB,SAAU,MAAA,CAEd,EAEA,eAAgB,CACd,MAAO,CACL,KAAQ,CACN,QAAS,IAAA,EAEX,MAAS,CACP,QAAS,KAAK,QAAQ,eAAe,KAAA,EAEvC,OAAU,CACR,QAAS,KAAK,QAAQ,eAAe,OAErC,UAAY,SACV,QAAQ,aAAa,QAAQ,IAAM,SAAW,KAAO,QAAA,EAEzD,MAAS,CACP,QAAS,KAAK,QAAQ,eAAe,KAAA,EAEvC,UAAW,CACT,QAAS,KAAK,QAAQ,eAAe,SAAS,CAAA,EAEhD,kBAAmB,CACjB,QAAS,KAAK,QAAQ,eAAe,iBAAiB,CAAA,CACxD,CAEJ,EAEA,WAAY,CACV,MAAO,CACL,CACE,IAAK,kEAAA,CACP,CAEJ,EAEA,WAAW,CAAE,gBAAkB,QAC7B,OAAI,kBAAe,OAAf,SAAqB,WAAW,eAC3B,CACL,IACAC,qBAAgB,KAAK,QAAQ,eAAgB,CAC3C,GAAG,eACH,KAAM,EAAA,CACP,EACD,CAAA,EAGG,CACL,IACAA,KAAAA,gBAAgB,KAAK,QAAQ,eAAgB,cAAc,EAC3D,CAAA,CAEJ,EAEA,aAAc,CACZ,MAAO,CACL,UACG,OACD,CAAC,CAAE,aAED,SAAS,cAAc,CACrB,KAAM,KAAK,KACX,MACA,QAAS,CACP,CACE,KAAM,OACN,KAAM,MAAM,KAAA,CACd,CACF,CACD,EACM,IAGX,YACE,IACA,CAAC,CAAE,MAAO,MAAS,CAEjB,KAAM,CAAE,KAAM,KAAM,EAAA,EAAO,MAAM,UAEjC,OAAI,uBAAM,KAAK,QAAS,UAKtB,GAAG,OAAO,KAAM,EAAE,EAAE,eAAA,EAEf,EACT,CAAA,CAEN,CACF,CAAC"}
|
package/dist/linker/linker.js
CHANGED
|
@@ -1,2 +1,96 @@
|
|
|
1
|
-
import{Node,mergeAttributes}from"@tiptap/core";
|
|
2
|
-
|
|
1
|
+
import { Node, mergeAttributes } from "@tiptap/core";
|
|
2
|
+
const Linker = Node.create({
|
|
3
|
+
name: "linker",
|
|
4
|
+
content: "text*",
|
|
5
|
+
marks: "",
|
|
6
|
+
group: "inline",
|
|
7
|
+
inline: !0,
|
|
8
|
+
selectable: !0,
|
|
9
|
+
atom: !0,
|
|
10
|
+
draggable: !0,
|
|
11
|
+
isolating: !0,
|
|
12
|
+
allowGapCursor: !1,
|
|
13
|
+
priority: 1100,
|
|
14
|
+
keepOnSplit: !1,
|
|
15
|
+
addOptions() {
|
|
16
|
+
return {
|
|
17
|
+
openOnClick: !0,
|
|
18
|
+
HTMLAttributes: {
|
|
19
|
+
target: null,
|
|
20
|
+
title: null,
|
|
21
|
+
class: null,
|
|
22
|
+
"data-id": null,
|
|
23
|
+
"data-app-prefix": null
|
|
24
|
+
},
|
|
25
|
+
validate: void 0
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
addAttributes() {
|
|
29
|
+
return {
|
|
30
|
+
href: {
|
|
31
|
+
default: null
|
|
32
|
+
},
|
|
33
|
+
class: {
|
|
34
|
+
default: this.options.HTMLAttributes.class
|
|
35
|
+
},
|
|
36
|
+
target: {
|
|
37
|
+
default: this.options.HTMLAttributes.target,
|
|
38
|
+
// Sanitize target value
|
|
39
|
+
parseHTML: (element) => element.getAttribute("target") !== "_blank" ? null : "_blank"
|
|
40
|
+
},
|
|
41
|
+
title: {
|
|
42
|
+
default: this.options.HTMLAttributes.title
|
|
43
|
+
},
|
|
44
|
+
"data-id": {
|
|
45
|
+
default: this.options.HTMLAttributes["data-id"]
|
|
46
|
+
},
|
|
47
|
+
"data-app-prefix": {
|
|
48
|
+
default: this.options.HTMLAttributes["data-app-prefix"]
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
parseHTML() {
|
|
53
|
+
return [
|
|
54
|
+
{
|
|
55
|
+
tag: 'a[href]:not([href *= "javascript:" i])[data-id][data-app-prefix]'
|
|
56
|
+
}
|
|
57
|
+
];
|
|
58
|
+
},
|
|
59
|
+
renderHTML({ HTMLAttributes }) {
|
|
60
|
+
var _a;
|
|
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
|
+
];
|
|
73
|
+
},
|
|
74
|
+
addCommands() {
|
|
75
|
+
return {
|
|
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
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
export {
|
|
94
|
+
Linker
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=linker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linker.js","
|
|
1
|
+
{"version":3,"file":"linker.js","sources":["../../src/linker/linker.ts"],"sourcesContent":["import { Node, mergeAttributes } from '@tiptap/core';\nimport { NodeSelection } from '@tiptap/pm/state';\n\n/* Our own model of a link in a rich document. */\nexport type LinkerAttributes = {\n 'href': string | null;\n 'target': '_blank' | null;\n 'title': string | null;\n 'data-id': string | null;\n 'data-app-prefix': string | null;\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n linker: {\n /**\n * Set a linker node\n */\n setLinker: (attributes: LinkerAttributes) => ReturnType;\n /**\n * Unset a linker node\n */\n unsetLinker: () => ReturnType;\n };\n }\n}\n\n/**\n * Internal links extension.\n * Reproduces the legacy angularJs \"linker\" directive.\n *\n * Links to internal resources MAY have a `title` and MUST HAVE `data-id` and `data-app-prefix` attributes :\n * `<a href=\"/blog#/view/35fa4198-blog_id/5e654c71-article_id\" data-app-prefix=\"blog\" data-id=\"35fa4198-blog_id\" target=\"_blank\" title=\"Voir ce billet de blog\" class=\"ng-scope\">/blog#/view/35fa4198-57fe-45eb-94f4-a5e4defff305/5e654c71-1e61-4f84-86dc-6fcfaf33f513</a>`\n */\nexport const Linker = Node.create({\n name: 'linker',\n content: 'text*',\n marks: '',\n group: 'inline',\n\n inline: true,\n selectable: true,\n atom: true,\n draggable: true,\n isolating: true,\n allowGapCursor: false,\n\n priority: 1100,\n keepOnSplit: false,\n\n addOptions() {\n return {\n openOnClick: true,\n HTMLAttributes: {\n 'target': null,\n 'title': null,\n 'class': null,\n 'data-id': null,\n 'data-app-prefix': null,\n },\n validate: undefined,\n };\n },\n\n addAttributes() {\n return {\n 'href': {\n default: null,\n },\n 'class': {\n default: this.options.HTMLAttributes.class,\n },\n 'target': {\n default: this.options.HTMLAttributes.target,\n // Sanitize target value\n parseHTML: (element) =>\n element.getAttribute('target') !== '_blank' ? null : '_blank',\n },\n 'title': {\n default: this.options.HTMLAttributes.title,\n },\n 'data-id': {\n default: this.options.HTMLAttributes['data-id'],\n },\n 'data-app-prefix': {\n default: this.options.HTMLAttributes['data-app-prefix'],\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'a[href]:not([href *= \"javascript:\" i])[data-id][data-app-prefix]',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n if (HTMLAttributes.href?.startsWith('javascript:')) {\n return [\n 'a',\n mergeAttributes(this.options.HTMLAttributes, {\n ...HTMLAttributes,\n href: '',\n }),\n 0,\n ];\n }\n return [\n 'a',\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setLinker:\n (attrs) =>\n ({ commands }) => {\n // Insert a Linker node with inner text node\n commands.insertContent({\n type: this.name,\n attrs,\n content: [\n {\n type: 'text',\n text: attrs.title,\n },\n ],\n });\n return true;\n },\n\n unsetLinker:\n () =>\n ({ state, tr }) => {\n // Which Linker node is actually selected ?\n const { node, from, to } = state.selection as NodeSelection;\n // Delete any selected Linker node\n if (node?.type.name === 'linker') {\n /* The following does not work as one would expected.\n commands.deleteNode(this.name);\n commands.deleteCurrentNode();\n * Replaced by : */\n tr.delete(from, to).scrollIntoView();\n }\n return true;\n },\n };\n },\n});\n"],"names":[],"mappings":";AAkCO,MAAM,SAAS,KAAK,OAAO;AAAA,EAChC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EAEP,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,WAAW;AAAA,EACX,WAAW;AAAA,EACX,gBAAgB;AAAA,EAEhB,UAAU;AAAA,EACV,aAAa;AAAA,EAEb,aAAa;AACX,WAAO;AAAA,MACL,aAAa;AAAA,MACb,gBAAgB;AAAA,QACd,QAAU;AAAA,QACV,OAAS;AAAA,QACT,OAAS;AAAA,QACT,WAAW;AAAA,QACX,mBAAmB;AAAA,MAAA;AAAA,MAErB,UAAU;AAAA,IAAA;AAAA,EAEd;AAAA,EAEA,gBAAgB;AACd,WAAO;AAAA,MACL,MAAQ;AAAA,QACN,SAAS;AAAA,MAAA;AAAA,MAEX,OAAS;AAAA,QACP,SAAS,KAAK,QAAQ,eAAe;AAAA,MAAA;AAAA,MAEvC,QAAU;AAAA,QACR,SAAS,KAAK,QAAQ,eAAe;AAAA;AAAA,QAErC,WAAW,CAAC,YACV,QAAQ,aAAa,QAAQ,MAAM,WAAW,OAAO;AAAA,MAAA;AAAA,MAEzD,OAAS;AAAA,QACP,SAAS,KAAK,QAAQ,eAAe;AAAA,MAAA;AAAA,MAEvC,WAAW;AAAA,QACT,SAAS,KAAK,QAAQ,eAAe,SAAS;AAAA,MAAA;AAAA,MAEhD,mBAAmB;AAAA,QACjB,SAAS,KAAK,QAAQ,eAAe,iBAAiB;AAAA,MAAA;AAAA,IACxD;AAAA,EAEJ;AAAA,EAEA,YAAY;AACV,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MAAA;AAAA,IACP;AAAA,EAEJ;AAAA,EAEA,WAAW,EAAE,kBAAkB;;AAC7B,YAAI,oBAAe,SAAf,WAAqB,WAAW,iBAC3B;AAAA,MACL;AAAA,MACA,gBAAgB,KAAK,QAAQ,gBAAgB;AAAA,QAC3C,GAAG;AAAA,QACH,MAAM;AAAA,MAAA,CACP;AAAA,MACD;AAAA,IAAA,IAGG;AAAA,MACL;AAAA,MACA,gBAAgB,KAAK,QAAQ,gBAAgB,cAAc;AAAA,MAC3D;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,cAAc;AACZ,WAAO;AAAA,MACL,WACE,CAAC,UACD,CAAC,EAAE,gBAED,SAAS,cAAc;AAAA,QACrB,MAAM,KAAK;AAAA,QACX;AAAA,QACA,SAAS;AAAA,UACP;AAAA,YACE,MAAM;AAAA,YACN,MAAM,MAAM;AAAA,UAAA;AAAA,QACd;AAAA,MACF,CACD,GACM;AAAA,MAGX,aACE,MACA,CAAC,EAAE,OAAO,SAAS;AAEjB,cAAM,EAAE,MAAM,MAAM,GAAA,IAAO,MAAM;AAEjC,gBAAI,6BAAM,KAAK,UAAS,YAKtB,GAAG,OAAO,MAAM,EAAE,EAAE,eAAA,GAEf;AAAA,MACT;AAAA,IAAA;AAAA,EAEN;AACF,CAAC;"}
|
package/dist/mathjax/mathjax.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=mathjax.cjs.map
|
|
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;
|
|
2
|
+
//# sourceMappingURL=mathjax.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mathjax.cjs","
|
|
1
|
+
{"version":3,"file":"mathjax.cjs","sources":["../../src/mathjax/mathjax.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport const MathJax = Node.create({\n name: 'mathjaxnode',\n group: 'inline',\n inline: true,\n atom: false,\n selectable: true,\n\n parseHTML() {\n return [\n {\n tag: 'mathjax',\n },\n ];\n },\n\n addAttributes() {\n return {\n equation: {\n default: null,\n parseHTML: (element: any) => {\n const children = [...element.childNodes];\n const textNodes = children.filter((child) => child.nodeType === 3);\n return textNodes.length > 0\n ? textNodes[textNodes.length - 1].nodeValue\n : null;\n },\n },\n };\n },\n\n renderHTML({ HTMLAttributes }) {\n let equation = (HTMLAttributes.equation || '')\n // Get what is between \\begin{equation}{... ...}\\end{equation}\n // Or between \\begin{equation}... ...\\end{equation} without enclosing brackets\n .replaceAll(\n /(?:\\\\)?begin{equation}\\s*\\n?\\s*{(.+?)}\\n?\\s*?(?:\\\\)?end{equation}/gm,\n '$$$1$$',\n )\n .replaceAll(\n /(?:\\\\)?begin{equation}\\s*\\n?\\s*(.+?)\\n?\\s*?(?:\\\\)?end{equation}/gm,\n '$$$1$$',\n );\n if (equation.length > 0) {\n if (equation.charAt(0) !== '$') {\n equation = `$${equation}`;\n }\n if (equation.charAt(equation.length - 1) !== '$') {\n equation = `${equation}$`;\n }\n }\n return ['span', {}, equation];\n },\n});\n"],"names":["Node"],"mappings":"mHAEa,QAAUA,KAAAA,KAAK,OAAO,CACjC,KAAM,cACN,MAAO,SACP,OAAQ,GACR,KAAM,GACN,WAAY,GAEZ,WAAY,CACV,MAAO,CACL,CACE,IAAK,SAAA,CACP,CAEJ,EAEA,eAAgB,CACd,MAAO,CACL,SAAU,CACR,QAAS,KACT,UAAY,SAAiB,CAE3B,MAAM,UADW,CAAC,GAAG,QAAQ,UAAU,EACZ,OAAQ,OAAU,MAAM,WAAa,CAAC,EACjE,OAAO,UAAU,OAAS,EACtB,UAAU,UAAU,OAAS,CAAC,EAAE,UAChC,IACN,CAAA,CACF,CAEJ,EAEA,WAAW,CAAE,gBAAkB,CAC7B,IAAI,UAAY,eAAe,UAAY,IAGxC,WACC,sEACA,QAAA,EAED,WACC,oEACA,QAAA,EAEJ,OAAI,SAAS,OAAS,IAChB,SAAS,OAAO,CAAC,IAAM,MACzB,SAAW,IAAI,QAAQ,IAErB,SAAS,OAAO,SAAS,OAAS,CAAC,IAAM,MAC3C,SAAW,GAAG,QAAQ,MAGnB,CAAC,OAAQ,CAAA,EAAI,QAAQ,CAC9B,CACF,CAAC"}
|
package/dist/mathjax/mathjax.js
CHANGED
|
@@ -1,2 +1,40 @@
|
|
|
1
|
-
import{Node}from"@tiptap/core";
|
|
2
|
-
|
|
1
|
+
import { Node } from "@tiptap/core";
|
|
2
|
+
const MathJax = Node.create({
|
|
3
|
+
name: "mathjaxnode",
|
|
4
|
+
group: "inline",
|
|
5
|
+
inline: !0,
|
|
6
|
+
atom: !1,
|
|
7
|
+
selectable: !0,
|
|
8
|
+
parseHTML() {
|
|
9
|
+
return [
|
|
10
|
+
{
|
|
11
|
+
tag: "mathjax"
|
|
12
|
+
}
|
|
13
|
+
];
|
|
14
|
+
},
|
|
15
|
+
addAttributes() {
|
|
16
|
+
return {
|
|
17
|
+
equation: {
|
|
18
|
+
default: null,
|
|
19
|
+
parseHTML: (element) => {
|
|
20
|
+
const textNodes = [...element.childNodes].filter((child) => child.nodeType === 3);
|
|
21
|
+
return textNodes.length > 0 ? textNodes[textNodes.length - 1].nodeValue : null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
renderHTML({ HTMLAttributes }) {
|
|
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$$"
|
|
33
|
+
);
|
|
34
|
+
return equation.length > 0 && (equation.charAt(0) !== "$" && (equation = `$${equation}`), equation.charAt(equation.length - 1) !== "$" && (equation = `${equation}$`)), ["span", {}, equation];
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
export {
|
|
38
|
+
MathJax
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=mathjax.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mathjax.js","
|
|
1
|
+
{"version":3,"file":"mathjax.js","sources":["../../src/mathjax/mathjax.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport const MathJax = Node.create({\n name: 'mathjaxnode',\n group: 'inline',\n inline: true,\n atom: false,\n selectable: true,\n\n parseHTML() {\n return [\n {\n tag: 'mathjax',\n },\n ];\n },\n\n addAttributes() {\n return {\n equation: {\n default: null,\n parseHTML: (element: any) => {\n const children = [...element.childNodes];\n const textNodes = children.filter((child) => child.nodeType === 3);\n return textNodes.length > 0\n ? textNodes[textNodes.length - 1].nodeValue\n : null;\n },\n },\n };\n },\n\n renderHTML({ HTMLAttributes }) {\n let equation = (HTMLAttributes.equation || '')\n // Get what is between \\begin{equation}{... ...}\\end{equation}\n // Or between \\begin{equation}... ...\\end{equation} without enclosing brackets\n .replaceAll(\n /(?:\\\\)?begin{equation}\\s*\\n?\\s*{(.+?)}\\n?\\s*?(?:\\\\)?end{equation}/gm,\n '$$$1$$',\n )\n .replaceAll(\n /(?:\\\\)?begin{equation}\\s*\\n?\\s*(.+?)\\n?\\s*?(?:\\\\)?end{equation}/gm,\n '$$$1$$',\n );\n if (equation.length > 0) {\n if (equation.charAt(0) !== '$') {\n equation = `$${equation}`;\n }\n if (equation.charAt(equation.length - 1) !== '$') {\n equation = `${equation}$`;\n }\n }\n return ['span', {}, equation];\n },\n});\n"],"names":[],"mappings":";AAEO,MAAM,UAAU,KAAK,OAAO;AAAA,EACjC,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,YAAY;AAAA,EAEZ,YAAY;AACV,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MAAA;AAAA,IACP;AAAA,EAEJ;AAAA,EAEA,gBAAgB;AACd,WAAO;AAAA,MACL,UAAU;AAAA,QACR,SAAS;AAAA,QACT,WAAW,CAAC,YAAiB;AAE3B,gBAAM,YADW,CAAC,GAAG,QAAQ,UAAU,EACZ,OAAO,CAAC,UAAU,MAAM,aAAa,CAAC;AACjE,iBAAO,UAAU,SAAS,IACtB,UAAU,UAAU,SAAS,CAAC,EAAE,YAChC;AAAA,QACN;AAAA,MAAA;AAAA,IACF;AAAA,EAEJ;AAAA,EAEA,WAAW,EAAE,kBAAkB;AAC7B,QAAI,YAAY,eAAe,YAAY,IAGxC;AAAA,MACC;AAAA,MACA;AAAA,IAAA,EAED;AAAA,MACC;AAAA,MACA;AAAA,IAAA;AAEJ,WAAI,SAAS,SAAS,MAChB,SAAS,OAAO,CAAC,MAAM,QACzB,WAAW,IAAI,QAAQ,KAErB,SAAS,OAAO,SAAS,SAAS,CAAC,MAAM,QAC3C,WAAW,GAAG,QAAQ,OAGnB,CAAC,QAAQ,CAAA,GAAI,QAAQ;AAAA,EAC9B;AACF,CAAC;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=paragraph.cjs.map
|
|
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;
|
|
2
|
+
//# sourceMappingURL=paragraph.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paragraph.cjs","
|
|
1
|
+
{"version":3,"file":"paragraph.cjs","sources":["../../src/paragraph/paragraph.ts"],"sourcesContent":["import { Paragraph as TiptapParagraph } from '@tiptap/extension-paragraph';\n\n/**\n * Extends `Paragraph` extension from TipTap.\n *\n * This extension is used to parse documents in old-format (version 0),\n * where text alignments were applied on a <div> wrapping a <span>.\n * The new format is a <p> with style attributes.\n *\n * For example :\n * `<div style=\"text-align: right;\"><span style=\"font-size: 20pt;\">A right-aligned text</span></div>`\n * is now parsed and rendered as\n * `<p style=\"text-align: right;\"><span style=\"font-size: 20pt;\">A right-aligned text</span></p>`\n */\nexport const Paragraph = TiptapParagraph.extend({\n parseHTML() {\n const parentRules = this.parent?.() ?? [];\n return [\n ...parentRules,\n {\n tag: 'div[style]:has(> span)',\n },\n ];\n },\n});\n"],"names":["TiptapParagraph"],"mappings":"gJAca,UAAYA,mBAAAA,UAAgB,OAAO,CAC9C,WAAY,QAEV,MAAO,CACL,KAFkB,QAAK,SAAL,4BAAmB,CAAA,EAGrC,CACE,IAAK,wBAAA,CACP,CAEJ,CACF,CAAC"}
|
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
import{Paragraph}from"@tiptap/extension-paragraph";
|
|
2
|
-
|
|
1
|
+
import { Paragraph as Paragraph$1 } from "@tiptap/extension-paragraph";
|
|
2
|
+
const Paragraph = Paragraph$1.extend({
|
|
3
|
+
parseHTML() {
|
|
4
|
+
var _a;
|
|
5
|
+
return [
|
|
6
|
+
...((_a = this.parent) == null ? void 0 : _a.call(this)) ?? [],
|
|
7
|
+
{
|
|
8
|
+
tag: "div[style]:has(> span)"
|
|
9
|
+
}
|
|
10
|
+
];
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
export {
|
|
14
|
+
Paragraph
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=paragraph.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paragraph.js","
|
|
1
|
+
{"version":3,"file":"paragraph.js","sources":["../../src/paragraph/paragraph.ts"],"sourcesContent":["import { Paragraph as TiptapParagraph } from '@tiptap/extension-paragraph';\n\n/**\n * Extends `Paragraph` extension from TipTap.\n *\n * This extension is used to parse documents in old-format (version 0),\n * where text alignments were applied on a <div> wrapping a <span>.\n * The new format is a <p> with style attributes.\n *\n * For example :\n * `<div style=\"text-align: right;\"><span style=\"font-size: 20pt;\">A right-aligned text</span></div>`\n * is now parsed and rendered as\n * `<p style=\"text-align: right;\"><span style=\"font-size: 20pt;\">A right-aligned text</span></p>`\n */\nexport const Paragraph = TiptapParagraph.extend({\n parseHTML() {\n const parentRules = this.parent?.() ?? [];\n return [\n ...parentRules,\n {\n tag: 'div[style]:has(> span)',\n },\n ];\n },\n});\n"],"names":["TiptapParagraph"],"mappings":";AAcO,MAAM,YAAYA,YAAgB,OAAO;AAAA,EAC9C,YAAY;;AAEV,WAAO;AAAA,MACL,KAFkB,UAAK,WAAL,kCAAmB,CAAA;AAAA,MAGrC;AAAA,QACE,KAAK;AAAA,MAAA;AAAA,IACP;AAAA,EAEJ;AACF,CAAC;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=speech-recognition.cjs.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core");class SR_Node extends core.Node{constructor(){super(),this.isStarted=!1}static create(config){return core.Node.create(config)}}const SpeechRecognition=SR_Node.create({name:"SpeechRecognition",addOptions(){return{lang:"fr-FR"}},onCreate(){"SpeechRecognition"in window||"webkitSpeechRecognition"in window||console.warn('"@edifice.io/tiptap-extensions/speechrecognition" requires a browser supporting the SpeechRecognition API".')},addCommands(){return{startSpeechRecognition:()=>({commands})=>{const SpeechRecognition2=window.SpeechRecognition||window.webkitSpeechRecognition;this.recognition=new SpeechRecognition2,this.recognition.lang=this.options.lang,this.recognition.interimResults=!0,this.recognition.maxAlternatives=1,this.recognition.continuous=!0,this.recognition.start();let{from,to}=this.editor.state.selection;return this.recognition.onresult=event=>{let currentResult="";for(let i=event.resultIndex;i<event.results.length;i++)currentResult+=event.results[i][0].transcript;const isFinal=event.results[event.results.length-1].isFinal;this.editor.commands.deleteRange({from,to}),this.editor.commands.insertContentAt(from,isFinal?currentResult:`<code>${currentResult}</code>`,{updateSelection:!isFinal}),to=this.editor.state.selection.to,isFinal&&(from=to)},this.recognition.onerror=event=>{console.log(`[@edifice.io/tiptap-extensions/speech-recognition][error][${event.error}]: ${event.message}`)},this.recognition.onstart=()=>{this.isStarted=!0},this.recognition.onend=()=>{this.isStarted=!1},commands},stopSpeechRecognition:()=>({commands})=>(this.recognition.stop(),this.editor.commands.focus(),commands),isSpeechRecognitionStarted:()=>()=>this.isStarted}}});exports.SpeechRecognition=SpeechRecognition;
|
|
2
|
+
//# sourceMappingURL=speech-recognition.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"speech-recognition.cjs","
|
|
1
|
+
{"version":3,"file":"speech-recognition.cjs","sources":["../../src/speech-recognition/speech-recognition.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface SpeechRecognitionOptions {\n lang: string;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n SpeechRecognition: {\n startSpeechRecognition: () => ReturnType;\n stopSpeechRecognition: () => ReturnType;\n isSpeechRecognitionStarted: () => boolean;\n };\n }\n}\n\nclass SR_Node<O = any, S = any> extends Node<O, S> {\n protected constructor() {\n super();\n }\n\n recognition: SpeechRecognition | undefined;\n readonly isStarted: boolean = false;\n\n static create<O = any, S = any>(config?: any) {\n return Node.create(config) as SR_Node<O, S>;\n }\n}\n\nexport const SpeechRecognition = SR_Node.create<SpeechRecognitionOptions>({\n name: 'SpeechRecognition',\n\n addOptions() {\n return {\n lang: 'fr-FR',\n };\n },\n\n onCreate() {\n if (\n !('SpeechRecognition' in window || 'webkitSpeechRecognition' in window)\n ) {\n console.warn(\n '\"@edifice.io/tiptap-extensions/speechrecognition\" requires a browser supporting the SpeechRecognition API\".',\n );\n }\n },\n\n addCommands() {\n return {\n startSpeechRecognition:\n () =>\n ({ commands }) => {\n const SpeechRecognition =\n window.SpeechRecognition || window.webkitSpeechRecognition;\n this.recognition = new SpeechRecognition();\n\n this.recognition.lang = this.options.lang;\n this.recognition.interimResults = true;\n this.recognition.maxAlternatives = 1;\n this.recognition.continuous = true;\n\n this.recognition.start();\n\n // Memoize initial caret positions\n let { from, to } = this.editor.state.selection;\n\n this.recognition.onresult = (event: SpeechRecognitionEvent) => {\n let currentResult = '';\n\n // Add to the currentResult variable the content of the last recognized sentence\n for (let i = event.resultIndex; i < event.results.length; i++) {\n currentResult += event.results[i][0].transcript;\n }\n\n // Is this the final recognition ?\n const isFinal = event.results[event.results.length - 1].isFinal;\n\n // Replace selection by the last recognized sentence (+ style and select, if not final)\n this.editor.commands.deleteRange({ from, to });\n this.editor.commands.insertContentAt(\n from,\n isFinal ? currentResult : `<code>${currentResult}</code>`,\n { updateSelection: !isFinal },\n );\n to = this.editor.state.selection.to;\n\n if (isFinal) {\n // Next content will go after last insertion\n from = to;\n }\n };\n\n this.recognition.onerror = (event: SpeechRecognitionErrorEvent) => {\n // TODO create a \"feedback\" tiptap extension, to display user friendly error messages ?\n console.log(\n `[@edifice.io/tiptap-extensions/speech-recognition][error][${event.error}]: ${event.message}`,\n );\n };\n\n this.recognition.onstart = () => {\n this.isStarted = true;\n };\n\n this.recognition.onend = () => {\n this.isStarted = false;\n };\n\n return commands;\n },\n\n stopSpeechRecognition:\n () =>\n ({ commands }) => {\n this.recognition.stop();\n this.editor.commands.focus();\n return commands;\n },\n\n isSpeechRecognitionStarted: () => () => this.isStarted,\n };\n },\n});\n"],"names":["Node","SpeechRecognition"],"mappings":"mHAgBA,MAAM,gBAAkCA,KAAAA,IAAW,CACvC,aAAc,CACtB,MAAA,EAIF,KAAS,UAAqB,EAH9B,CAKA,OAAO,OAAyB,OAAc,CAC5C,OAAOA,KAAAA,KAAK,OAAO,MAAM,CAC3B,CACF,CAEO,MAAM,kBAAoB,QAAQ,OAAiC,CACxE,KAAM,oBAEN,YAAa,CACX,MAAO,CACL,KAAM,OAAA,CAEV,EAEA,UAAW,CAEL,sBAAuB,QAAU,4BAA6B,QAEhE,QAAQ,KACN,6GAAA,CAGN,EAEA,aAAc,CACZ,MAAO,CACL,uBACE,IACA,CAAC,CAAE,YAAe,CAChB,MAAMC,mBACJ,OAAO,mBAAqB,OAAO,wBACrC,KAAK,YAAc,IAAIA,mBAEvB,KAAK,YAAY,KAAO,KAAK,QAAQ,KACrC,KAAK,YAAY,eAAiB,GAClC,KAAK,YAAY,gBAAkB,EACnC,KAAK,YAAY,WAAa,GAE9B,KAAK,YAAY,MAAA,EAGjB,GAAI,CAAE,KAAM,EAAA,EAAO,KAAK,OAAO,MAAM,UAErC,YAAK,YAAY,SAAY,OAAkC,CAC7D,IAAI,cAAgB,GAGpB,QAAS,EAAI,MAAM,YAAa,EAAI,MAAM,QAAQ,OAAQ,IACxD,eAAiB,MAAM,QAAQ,CAAC,EAAE,CAAC,EAAE,WAIvC,MAAM,QAAU,MAAM,QAAQ,MAAM,QAAQ,OAAS,CAAC,EAAE,QAGxD,KAAK,OAAO,SAAS,YAAY,CAAE,KAAM,GAAI,EAC7C,KAAK,OAAO,SAAS,gBACnB,KACA,QAAU,cAAgB,SAAS,aAAa,UAChD,CAAE,gBAAiB,CAAC,OAAA,CAAQ,EAE9B,GAAK,KAAK,OAAO,MAAM,UAAU,GAE7B,UAEF,KAAO,GAEX,EAEA,KAAK,YAAY,QAAW,OAAuC,CAEjE,QAAQ,IACN,6DAA6D,MAAM,KAAK,MAAM,MAAM,OAAO,EAAA,CAE/F,EAEA,KAAK,YAAY,QAAU,IAAM,CAC/B,KAAK,UAAY,EACnB,EAEA,KAAK,YAAY,MAAQ,IAAM,CAC7B,KAAK,UAAY,EACnB,EAEO,QACT,EAEF,sBACE,IACA,CAAC,CAAE,aACD,KAAK,YAAY,KAAA,EACjB,KAAK,OAAO,SAAS,MAAA,EACd,UAGX,2BAA4B,IAAM,IAAM,KAAK,SAAA,CAEjD,CACF,CAAC"}
|