@edifice.io/tiptap-extensions 2.6.8-develop-enabling.20261007103744 → 2.6.8-develop-enabling.20261012145010
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/_virtual/_rolldown/runtime.cjs +1 -0
- package/dist/abbr/abbr.cjs +2 -2
- package/dist/abbr/abbr.cjs.map +1 -1
- package/dist/abbr/abbr.js +2 -33
- 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 +2 -45
- 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 +2 -76
- 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 +2 -98
- 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 +3 -52
- 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 +2 -63
- 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 +2 -24
- 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 +2 -39
- 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 +2 -46
- 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 +2 -28
- 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 +2 -53
- 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 +2 -70
- 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 +2 -22
- 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 +2 -24
- 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 +2 -175
- package/dist/image/image.js.map +1 -1
- package/dist/index.cjs +1 -2
- package/dist/index.js +1 -52
- 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 +2 -57
- 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 +2 -33
- 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 +2 -96
- 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 +2 -40
- 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 +2 -16
- 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 +2 -56
- 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 +2 -25
- 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 +2 -23
- 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 +2 -6
- 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 +2 -6
- 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 +3 -92
- package/dist/video/video.js.map +1 -1
- package/package.json +5 -5
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,52 +1 @@
|
|
|
1
|
-
import
|
|
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
|
|
1
|
+
import{Abbr}from"./abbr/abbr.js";import{Alert}from"./alert/alert.js";import{Attachment}from"./attachment/attachment.js";import{AttachmentTransformer}from"./attachment/attachment-transformer.js";import{Audio}from"./audio/audio.js";import{ConversationHistory}from"./conversation-history/conversation-history.js";import{ConversationHistoryBody}from"./conversation-history-body/conversation-history-body.js";import{FontSize}from"./font-size/font-size.js";import{CustomHeading}from"./heading/heading.js";import{CustomHighlight}from"./highlight/highlight.js";import{Hyperlink}from"./hyperlink/hyperlink.js";import{Iframe}from"./iframe/iframe.js";import{IMAGE_INPUT_REGEX,Image}from"./image/image.js";import{InformationPane}from"./information-pane/information-pane.js";import{LineHeight}from"./line-height/line-height.js";import{Linker}from"./linker/linker.js";import{MathJax}from"./mathjax/mathjax.js";import{Paragraph}from"./paragraph/paragraph.js";import{SpeechRecognition}from"./speech-recognition/speech-recognition.js";import{SpeechSynthesis}from"./speech-synthesis/speech-synthesis.js";import{TableCell}from"./table-cell/table-cell.js";import html_to_json_default from"./transform/html-to-json/html-to-json.js";import json_to_html_default from"./transform/json-to-html/json-to-html.js";import{Video}from"./video/video.js";export{Abbr,Alert,Attachment,AttachmentTransformer,Audio,ConversationHistory,ConversationHistoryBody,CustomHeading,CustomHighlight,FontSize,Hyperlink,IMAGE_INPUT_REGEX,Iframe,Image,InformationPane,LineHeight,Linker,MathJax,Paragraph,SpeechRecognition,SpeechSynthesis,TableCell,Video,html_to_json_default as htmlToJson,json_to_html_default as jsonToHtml};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=information-pane.cjs.map
|
|
1
|
+
let _tiptap_core=require("@tiptap/core");var InformationPane=_tiptap_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}){let type=node.attrs.type;return[`div`,(0,_tiptap_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","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"],"
|
|
1
|
+
{"version":3,"file":"information-pane.cjs","names":[],"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"],"mappings":"yCAcA,IAAa,gBAAkB,aAAA,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,IAC1B,EAEJ,CACF,CACF,EAEA,WAAY,CACV,MAAO,CACL,CACE,IAAK,4BACP,CACF,CACF,EAEA,WAAW,CAAE,KAAM,gBAAkB,CACnC,IAAM,KAAO,KAAK,MAAM,KACxB,MAAO,CACL,uCACgB,eAAgB,CAC9B,wBAAyB,GACzB,MAAS,qCAAqC,MAChD,CAAC,EACD,CACF,CACF,EAEA,aAAc,CACZ,MAAO,CACL,oBACG,KAAO,UACP,CAAE,YACM,SAAS,cAAc,CAC5B,CACE,KAAM,KAAK,KACX,MAAO,CAAE,IAAK,EACd,QAAS,CACP,CACE,KAAM,WACR,CACF,CACF,CACF,CAAC,CAEP,CACF,CACF,CAAC"}
|
|
@@ -1,57 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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
|
+
import{Node,mergeAttributes}from"@tiptap/core";var InformationPane=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}){let type=node.attrs.type;return[`div`,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`}]}])}}});export{InformationPane};
|
|
2
|
+
//# sourceMappingURL=information-pane.js.map
|
|
@@ -1 +1 @@
|
|
|
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"],"
|
|
1
|
+
{"version":3,"file":"information-pane.js","names":[],"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"],"mappings":"+CAcA,IAAa,gBAAkB,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,IAC1B,EAEJ,CACF,CACF,EAEA,WAAY,CACV,MAAO,CACL,CACE,IAAK,4BACP,CACF,CACF,EAEA,WAAW,CAAE,KAAM,gBAAkB,CACnC,IAAM,KAAO,KAAK,MAAM,KACxB,MAAO,CACL,MACA,gBAAgB,eAAgB,CAC9B,wBAAyB,GACzB,MAAS,qCAAqC,MAChD,CAAC,EACD,CACF,CACF,EAEA,aAAc,CACZ,MAAO,CACL,oBACG,KAAO,UACP,CAAE,YACM,SAAS,cAAc,CAC5B,CACE,KAAM,KAAK,KACX,MAAO,CAAE,IAAK,EACd,QAAS,CACP,CACE,KAAM,WACR,CACF,CACF,CACF,CAAC,CAEP,CACF,CACF,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=line-height.cjs.map
|
|
1
|
+
let _tiptap_core=require("@tiptap/core");require("@tiptap/extension-text-style");var LineHeight=_tiptap_core.Extension.create({name:`lineHeight`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:element=>element.style.lineHeight?.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","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"],"
|
|
1
|
+
{"version":3,"file":"line-height.cjs","names":[],"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"],"mappings":"iFAIA,IAAa,WAAa,aAAA,UAAU,OAAO,CACzC,KAAM,aAEN,YAAa,CACX,MAAO,CACL,MAAO,CAAC,WAAW,CACrB,CACF,EAEA,qBAAsB,CACpB,MAAO,CACL,CACE,MAAO,KAAK,QAAQ,MACpB,WAAY,CACV,WAAY,CACV,QAAS,KACT,UAAY,SACV,QAAQ,MAAM,YAAY,QAAQ,SAAU,EAAE,EAChD,WAAa,YACN,WAAW,WAIT,CACL,MAAO,gBAAgB,WAAW,YACpC,EALS,CAAC,CAOd,CACF,CACF,CACF,CACF,CACF,CAAC"}
|
|
@@ -1,33 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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
|
+
import{Extension}from"@tiptap/core";import"@tiptap/extension-text-style";var LineHeight=Extension.create({name:`lineHeight`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:element=>element.style.lineHeight?.replace(/['"]+/g,``),renderHTML:attributes=>attributes.lineHeight?{style:`line-height: ${attributes.lineHeight}`}:{}}}}]}});export{LineHeight};
|
|
2
|
+
//# sourceMappingURL=line-height.js.map
|
|
@@ -1 +1 @@
|
|
|
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"],"
|
|
1
|
+
{"version":3,"file":"line-height.js","names":[],"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"],"mappings":"yEAIA,IAAa,WAAa,UAAU,OAAO,CACzC,KAAM,aAEN,YAAa,CACX,MAAO,CACL,MAAO,CAAC,WAAW,CACrB,CACF,EAEA,qBAAsB,CACpB,MAAO,CACL,CACE,MAAO,KAAK,QAAQ,MACpB,WAAY,CACV,WAAY,CACV,QAAS,KACT,UAAY,SACV,QAAQ,MAAM,YAAY,QAAQ,SAAU,EAAE,EAChD,WAAa,YACN,WAAW,WAIT,CACL,MAAO,gBAAgB,WAAW,YACpC,EALS,CAAC,CAOd,CACF,CACF,CACF,CACF,CACF,CAAC"}
|
package/dist/linker/linker.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=linker.cjs.map
|
|
1
|
+
let _tiptap_core=require("@tiptap/core");var Linker=_tiptap_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`?`_blank`:null},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}){return HTMLAttributes.href?.startsWith(`javascript:`)?[`a`,(0,_tiptap_core.mergeAttributes)(this.options.HTMLAttributes,{...HTMLAttributes,href:``}),0]:[`a`,(0,_tiptap_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})=>{let{node,from,to}=state.selection;return 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","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"],"
|
|
1
|
+
{"version":3,"file":"linker.cjs","names":[],"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"],"mappings":"yCAkCA,IAAa,OAAS,aAAA,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,IACrB,EACA,SAAU,IAAA,EACZ,CACF,EAEA,eAAgB,CACd,MAAO,CACL,KAAQ,CACN,QAAS,IACX,EACA,MAAS,CACP,QAAS,KAAK,QAAQ,eAAe,KACvC,EACA,OAAU,CACR,QAAS,KAAK,QAAQ,eAAe,OAErC,UAAY,SACV,QAAQ,aAAa,QAAQ,IAAM,SAAkB,SAAP,IAClD,EACA,MAAS,CACP,QAAS,KAAK,QAAQ,eAAe,KACvC,EACA,UAAW,CACT,QAAS,KAAK,QAAQ,eAAe,UACvC,EACA,kBAAmB,CACjB,QAAS,KAAK,QAAQ,eAAe,kBACvC,CACF,CACF,EAEA,WAAY,CACV,MAAO,CACL,CACE,IAAK,kEACP,CACF,CACF,EAEA,WAAW,CAAE,gBAAkB,CAW7B,OAVI,eAAe,MAAM,WAAW,aAAa,EACxC,CACL,qCACgB,KAAK,QAAQ,eAAgB,CAC3C,GAAG,eACH,KAAM,EACR,CAAC,EACD,CACF,EAEK,CACL,qCACgB,KAAK,QAAQ,eAAgB,cAAc,EAC3D,CACF,CACF,EAEA,aAAc,CACZ,MAAO,CACL,UACG,QACA,CAAE,aAED,SAAS,cAAc,CACrB,KAAM,KAAK,KACX,MACA,QAAS,CACP,CACE,KAAM,OACN,KAAM,MAAM,KACd,CACF,CACF,CAAC,EACM,IAGX,iBAEG,CAAE,MAAO,MAAS,CAEjB,GAAM,CAAE,KAAM,KAAM,IAAO,MAAM,UASjC,OAPI,MAAM,KAAK,OAAS,UAKtB,GAAG,OAAO,KAAM,EAAE,EAAE,eAAe,EAE9B,EACT,CACJ,CACF,CACF,CAAC"}
|
package/dist/linker/linker.js
CHANGED
|
@@ -1,96 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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
|
+
import{Node,mergeAttributes}from"@tiptap/core";var Linker=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`?`_blank`:null},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}){return HTMLAttributes.href?.startsWith(`javascript:`)?[`a`,mergeAttributes(this.options.HTMLAttributes,{...HTMLAttributes,href:``}),0]:[`a`,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})=>{let{node,from,to}=state.selection;return node?.type.name===`linker`&&tr.delete(from,to).scrollIntoView(),!0}}}});export{Linker};
|
|
2
|
+
//# sourceMappingURL=linker.js.map
|
|
@@ -1 +1 @@
|
|
|
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"],"
|
|
1
|
+
{"version":3,"file":"linker.js","names":[],"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"],"mappings":"+CAkCA,IAAa,OAAS,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,IACrB,EACA,SAAU,IAAA,EACZ,CACF,EAEA,eAAgB,CACd,MAAO,CACL,KAAQ,CACN,QAAS,IACX,EACA,MAAS,CACP,QAAS,KAAK,QAAQ,eAAe,KACvC,EACA,OAAU,CACR,QAAS,KAAK,QAAQ,eAAe,OAErC,UAAY,SACV,QAAQ,aAAa,QAAQ,IAAM,SAAkB,SAAP,IAClD,EACA,MAAS,CACP,QAAS,KAAK,QAAQ,eAAe,KACvC,EACA,UAAW,CACT,QAAS,KAAK,QAAQ,eAAe,UACvC,EACA,kBAAmB,CACjB,QAAS,KAAK,QAAQ,eAAe,kBACvC,CACF,CACF,EAEA,WAAY,CACV,MAAO,CACL,CACE,IAAK,kEACP,CACF,CACF,EAEA,WAAW,CAAE,gBAAkB,CAW7B,OAVI,eAAe,MAAM,WAAW,aAAa,EACxC,CACL,IACA,gBAAgB,KAAK,QAAQ,eAAgB,CAC3C,GAAG,eACH,KAAM,EACR,CAAC,EACD,CACF,EAEK,CACL,IACA,gBAAgB,KAAK,QAAQ,eAAgB,cAAc,EAC3D,CACF,CACF,EAEA,aAAc,CACZ,MAAO,CACL,UACG,QACA,CAAE,aAED,SAAS,cAAc,CACrB,KAAM,KAAK,KACX,MACA,QAAS,CACP,CACE,KAAM,OACN,KAAM,MAAM,KACd,CACF,CACF,CAAC,EACM,IAGX,iBAEG,CAAE,MAAO,MAAS,CAEjB,GAAM,CAAE,KAAM,KAAM,IAAO,MAAM,UASjC,OAPI,MAAM,KAAK,OAAS,UAKtB,GAAG,OAAO,KAAM,EAAE,EAAE,eAAe,EAE9B,EACT,CACJ,CACF,CACF,CAAC"}
|
package/dist/mathjax/mathjax.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=mathjax.cjs.map
|
|
1
|
+
var MathJax=require("@tiptap/core").Node.create({name:`mathjaxnode`,group:`inline`,inline:!0,atom:!1,selectable:!0,parseHTML(){return[{tag:`mathjax`}]},addAttributes(){return{equation:{default:null,parseHTML:element=>{let 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","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"],"
|
|
1
|
+
{"version":3,"file":"mathjax.cjs","names":[],"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"],"mappings":"AAEA,IAAa,8BAAU,EAAA,KAAK,OAAO,CACjC,KAAM,cACN,MAAO,SACP,OAAQ,GACR,KAAM,GACN,WAAY,GAEZ,WAAY,CACV,MAAO,CACL,CACE,IAAK,SACP,CACF,CACF,EAEA,eAAgB,CACd,MAAO,CACL,SAAU,CACR,QAAS,KACT,UAAY,SAAiB,CAE3B,IAAM,UAAY,CADA,GAAG,QAAQ,UACX,EAAS,OAAQ,OAAU,MAAM,WAAa,CAAC,EACjE,OAAO,UAAU,OAAS,EACtB,UAAU,UAAU,OAAS,GAAG,UAChC,IACN,CACF,CACF,CACF,EAEA,WAAW,CAAE,gBAAkB,CAC7B,IAAI,UAAY,eAAe,UAAY,IAGxC,WACC,sEACA,QACF,EACC,WACC,oEACA,QACF,EASF,OARI,SAAS,OAAS,IAChB,SAAS,OAAO,CAAC,IAAM,MACzB,SAAW,IAAI,YAEb,SAAS,OAAO,SAAS,OAAS,CAAC,IAAM,MAC3C,SAAW,GAAG,SAAS,KAGpB,CAAC,OAAQ,CAAC,EAAG,QAAQ,CAC9B,CACF,CAAC"}
|
package/dist/mathjax/mathjax.js
CHANGED
|
@@ -1,40 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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
|
+
import{Node}from"@tiptap/core";var MathJax=Node.create({name:`mathjaxnode`,group:`inline`,inline:!0,atom:!1,selectable:!0,parseHTML(){return[{tag:`mathjax`}]},addAttributes(){return{equation:{default:null,parseHTML:element=>{let 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]}});export{MathJax};
|
|
2
|
+
//# sourceMappingURL=mathjax.js.map
|
|
@@ -1 +1 @@
|
|
|
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"],"
|
|
1
|
+
{"version":3,"file":"mathjax.js","names":[],"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"],"mappings":"+BAEA,IAAa,QAAU,KAAK,OAAO,CACjC,KAAM,cACN,MAAO,SACP,OAAQ,GACR,KAAM,GACN,WAAY,GAEZ,WAAY,CACV,MAAO,CACL,CACE,IAAK,SACP,CACF,CACF,EAEA,eAAgB,CACd,MAAO,CACL,SAAU,CACR,QAAS,KACT,UAAY,SAAiB,CAE3B,IAAM,UAAY,CADA,GAAG,QAAQ,UACX,EAAS,OAAQ,OAAU,MAAM,WAAa,CAAC,EACjE,OAAO,UAAU,OAAS,EACtB,UAAU,UAAU,OAAS,GAAG,UAChC,IACN,CACF,CACF,CACF,EAEA,WAAW,CAAE,gBAAkB,CAC7B,IAAI,UAAY,eAAe,UAAY,IAGxC,WACC,sEACA,QACF,EACC,WACC,oEACA,QACF,EASF,OARI,SAAS,OAAS,IAChB,SAAS,OAAO,CAAC,IAAM,MACzB,SAAW,IAAI,YAEb,SAAS,OAAO,SAAS,OAAS,CAAC,IAAM,MAC3C,SAAW,GAAG,SAAS,KAGpB,CAAC,OAAQ,CAAC,EAAG,QAAQ,CAC9B,CACF,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=paragraph.cjs.map
|
|
1
|
+
var Paragraph=require("@tiptap/extension-paragraph").Paragraph.extend({parseHTML(){return[...this.parent?.()??[],{tag:`div[style]:has(> span)`}]}});exports.Paragraph=Paragraph;
|
|
2
|
+
//# sourceMappingURL=paragraph.cjs.map
|
|
@@ -1 +1 @@
|
|
|
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"],"
|
|
1
|
+
{"version":3,"file":"paragraph.cjs","names":[],"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"],"mappings":"AAcA,IAAa,+CAAY,EAAA,UAAgB,OAAO,CAC9C,WAAY,CAEV,MAAO,CACL,GAFkB,KAAK,SAAS,GAAK,CAAC,EAGtC,CACE,IAAK,wBACP,CACF,CACF,CACF,CAAC"}
|
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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
|
+
import{Paragraph}from"@tiptap/extension-paragraph";var Paragraph$1=Paragraph.extend({parseHTML(){return[...this.parent?.()??[],{tag:`div[style]:has(> span)`}]}});export{Paragraph$1 as Paragraph};
|
|
2
|
+
//# sourceMappingURL=paragraph.js.map
|
|
@@ -1 +1 @@
|
|
|
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"],"
|
|
1
|
+
{"version":3,"file":"paragraph.js","names":[],"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"],"mappings":"mDAcA,IAAa,YAAY,UAAgB,OAAO,CAC9C,WAAY,CAEV,MAAO,CACL,GAFkB,KAAK,SAAS,GAAK,CAAC,EAGtC,CACE,IAAK,wBACP,CACF,CACF,CACF,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=speech-recognition.cjs.map
|
|
1
|
+
let _tiptap_core=require("@tiptap/core");var SpeechRecognition=class extends _tiptap_core.Node{constructor(){super(),this.isStarted=!1}static create(config){return _tiptap_core.Node.create(config)}}.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})=>{let SpeechRecognition=window.SpeechRecognition||window.webkitSpeechRecognition;this.recognition=new SpeechRecognition,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;let 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","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"],"
|
|
1
|
+
{"version":3,"file":"speech-recognition.cjs","names":[],"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(ENABLING-1151): 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"],"mappings":"yCA6BA,IAAa,kBAAoB,cAbO,aAAA,IAAW,CACjD,aAAwB,CACtB,MAAM,iBAIsB,EAH9B,CAKA,OAAO,OAAyB,OAAc,CAC5C,OAAO,aAAA,KAAK,OAAO,MAAM,CAC3B,CACF,EAEyC,OAAiC,CACxE,KAAM,oBAEN,YAAa,CACX,MAAO,CACL,KAAM,OACR,CACF,EAEA,UAAW,CAEL,sBAAuB,QAAU,4BAA6B,QAEhE,QAAQ,KACN,6GACF,CAEJ,EAEA,aAAc,CACZ,MAAO,CACL,4BAEG,CAAE,YAAe,CAChB,IAAM,kBACJ,OAAO,mBAAqB,OAAO,wBACrC,KAAK,YAAc,IAAI,kBAEvB,KAAK,YAAY,KAAO,KAAK,QAAQ,KACrC,KAAK,YAAY,eAAiB,GAClC,KAAK,YAAY,gBAAkB,EACnC,KAAK,YAAY,WAAa,GAE9B,KAAK,YAAY,MAAM,EAGvB,GAAI,CAAE,KAAM,IAAO,KAAK,OAAO,MAAM,UA2CrC,MAzCA,MAAK,YAAY,SAAY,OAAkC,CAC7D,IAAI,cAAgB,GAGpB,IAAK,IAAI,EAAI,MAAM,YAAa,EAAI,MAAM,QAAQ,OAAQ,IACxD,eAAiB,MAAM,QAAQ,GAAG,GAAG,WAIvC,IAAM,QAAU,MAAM,QAAQ,MAAM,QAAQ,OAAS,GAAG,QAGxD,KAAK,OAAO,SAAS,YAAY,CAAE,KAAM,EAAG,CAAC,EAC7C,KAAK,OAAO,SAAS,gBACnB,KACA,QAAU,cAAgB,SAAS,cAAc,SACjD,CAAE,gBAAiB,CAAC,OAAQ,CAC9B,EACA,GAAK,KAAK,OAAO,MAAM,UAAU,GAE7B,UAEF,KAAO,GAEX,EAEA,KAAK,YAAY,QAAW,OAAuC,CAEjE,QAAQ,IACN,6DAA6D,MAAM,MAAM,KAAK,MAAM,SACtF,CACF,EAEA,KAAK,YAAY,YAAgB,CAC/B,KAAK,UAAY,EACnB,EAEA,KAAK,YAAY,UAAc,CAC7B,KAAK,UAAY,EACnB,EAEO,QACT,EAEF,2BAEG,CAAE,aACD,KAAK,YAAY,KAAK,EACtB,KAAK,OAAO,SAAS,MAAM,EACpB,UAGX,mCAAwC,KAAK,SAC/C,CACF,CACF,CAAC"}
|