@edifice.io/tiptap-extensions 2.0.0-develop-rc.12 → 2.0.0-develop-rc.13
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/README.md +1 -1
- package/dist/abbr/abbr.cjs +32 -1
- package/dist/abbr/abbr.cjs.map +1 -1
- package/dist/abbr/abbr.d.ts +12 -12
- package/dist/abbr/abbr.js +20 -16
- package/dist/abbr/abbr.js.map +1 -1
- package/dist/alert/alert.cjs +32 -1
- package/dist/alert/alert.cjs.map +1 -1
- package/dist/alert/alert.js +22 -24
- package/dist/alert/alert.js.map +1 -1
- package/dist/attachment/attachment.cjs +73 -1
- package/dist/attachment/attachment.cjs.map +1 -1
- package/dist/attachment/attachment.d.ts +6 -6
- package/dist/attachment/attachment.js +58 -47
- package/dist/attachment/attachment.js.map +1 -1
- package/dist/audio/audio.cjs +53 -3
- package/dist/audio/audio.cjs.map +1 -1
- package/dist/audio/audio.d.ts +17 -13
- package/dist/audio/audio.js +33 -30
- package/dist/audio/audio.js.map +1 -1
- package/dist/font-size/font-size.cjs +48 -1
- package/dist/font-size/font-size.cjs.map +1 -1
- package/dist/font-size/font-size.d.ts +13 -13
- package/dist/font-size/font-size.js +32 -20
- package/dist/font-size/font-size.js.map +1 -1
- package/dist/heading/heading.cjs +61 -1
- package/dist/heading/heading.cjs.map +1 -1
- package/dist/heading/heading.d.ts +10 -12
- package/dist/heading/heading.js +45 -31
- package/dist/heading/heading.js.map +1 -1
- package/dist/highlight/highlight.cjs +25 -1
- package/dist/highlight/highlight.cjs.map +1 -1
- package/dist/highlight/highlight.d.ts +4 -1
- package/dist/highlight/highlight.js +15 -17
- package/dist/highlight/highlight.js.map +1 -1
- package/dist/hyperlink/hyperlink.cjs +47 -1
- package/dist/hyperlink/hyperlink.cjs.map +1 -1
- package/dist/hyperlink/hyperlink.d.ts +27 -24
- package/dist/hyperlink/hyperlink.js +26 -24
- package/dist/hyperlink/hyperlink.js.map +1 -1
- package/dist/iframe/iframe.cjs +69 -1
- package/dist/iframe/iframe.cjs.map +1 -1
- package/dist/iframe/iframe.d.ts +12 -14
- package/dist/iframe/iframe.js +50 -34
- package/dist/iframe/iframe.js.map +1 -1
- package/dist/image/custom-image.cjs +162 -1
- package/dist/image/custom-image.cjs.map +1 -1
- package/dist/image/custom-image.d.ts +19 -16
- package/dist/image/custom-image.js +179 -130
- package/dist/image/custom-image.js.map +1 -1
- package/dist/index.cjs +43 -1
- package/dist/index.js +41 -41
- package/dist/line-height/line-height.cjs +33 -1
- package/dist/line-height/line-height.cjs.map +1 -1
- package/dist/line-height/line-height.js +21 -18
- package/dist/line-height/line-height.js.map +1 -1
- package/dist/linker/linker.cjs +95 -1
- package/dist/linker/linker.cjs.map +1 -1
- package/dist/linker/linker.d.ts +17 -17
- package/dist/linker/linker.js +60 -52
- package/dist/linker/linker.js.map +1 -1
- package/dist/mathjax/mathjax.cjs +47 -1
- package/dist/mathjax/mathjax.cjs.map +1 -1
- package/dist/mathjax/mathjax.js +33 -23
- package/dist/mathjax/mathjax.js.map +1 -1
- package/dist/paragraph/paragraph.cjs +13 -1
- package/dist/paragraph/paragraph.cjs.map +1 -1
- package/dist/paragraph/paragraph.d.ts +4 -1
- package/dist/paragraph/paragraph.js +8 -10
- package/dist/paragraph/paragraph.js.map +1 -1
- package/dist/speech-recognition/speech-recognition.cjs +76 -1
- package/dist/speech-recognition/speech-recognition.cjs.map +1 -1
- package/dist/speech-recognition/speech-recognition.d.ts +12 -12
- package/dist/speech-recognition/speech-recognition.js +61 -45
- package/dist/speech-recognition/speech-recognition.js.map +1 -1
- package/dist/speech-synthesis/speech-synthesis.cjs +32 -1
- package/dist/speech-synthesis/speech-synthesis.cjs.map +1 -1
- package/dist/speech-synthesis/speech-synthesis.d.ts +9 -9
- package/dist/speech-synthesis/speech-synthesis.js +23 -14
- package/dist/speech-synthesis/speech-synthesis.js.map +1 -1
- package/dist/table-cell/table-cell.cjs +27 -1
- package/dist/table-cell/table-cell.cjs.map +1 -1
- package/dist/table-cell/table-cell.d.ts +4 -1
- package/dist/table-cell/table-cell.js +21 -16
- package/dist/table-cell/table-cell.js.map +1 -1
- package/dist/transform/html-to-json/html-to-json.cjs +4 -1
- package/dist/transform/html-to-json/html-to-json.cjs.map +1 -1
- package/dist/transform/html-to-json/html-to-json.d.ts +4 -1
- package/dist/transform/html-to-json/html-to-json.js +3 -5
- package/dist/transform/html-to-json/html-to-json.js.map +1 -1
- package/dist/transform/json-to-html/json-to-html.cjs +4 -1
- package/dist/transform/json-to-html/json-to-html.cjs.map +1 -1
- package/dist/transform/json-to-html/json-to-html.js +3 -5
- package/dist/transform/json-to-html/json-to-html.js.map +1 -1
- package/dist/video/video.cjs +118 -9
- package/dist/video/video.cjs.map +1 -1
- package/dist/video/video.d.ts +28 -19
- package/dist/video/video.js +121 -97
- package/dist/video/video.js.map +1 -1
- package/package.json +36 -47
|
@@ -1,28 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
3
|
-
name:
|
|
1
|
+
import Highlight from '@tiptap/extension-highlight';
|
|
2
|
+
const CustomHighlight = Highlight.extend({
|
|
3
|
+
name: 'customHighlight',
|
|
4
4
|
addOptions() {
|
|
5
|
-
var
|
|
5
|
+
var _a;
|
|
6
6
|
return {
|
|
7
|
-
...(
|
|
7
|
+
...((_a = this.parent) == null ? void 0 : _a.call(this)),
|
|
8
8
|
multicolor: !0,
|
|
9
|
-
HTMLAttributes: {}
|
|
9
|
+
HTMLAttributes: {},
|
|
10
10
|
};
|
|
11
11
|
},
|
|
12
12
|
parseHTML() {
|
|
13
|
-
var
|
|
13
|
+
var _a;
|
|
14
14
|
return [
|
|
15
15
|
{
|
|
16
|
-
...(
|
|
17
|
-
style:
|
|
18
|
-
getAttrs: (
|
|
19
|
-
color:
|
|
20
|
-
})
|
|
21
|
-
}
|
|
16
|
+
...((_a = this.parent) == null ? void 0 : _a.call(this)),
|
|
17
|
+
style: 'background-color',
|
|
18
|
+
getAttrs: (style) => ({
|
|
19
|
+
color: style,
|
|
20
|
+
}),
|
|
21
|
+
},
|
|
22
22
|
];
|
|
23
|
-
}
|
|
23
|
+
},
|
|
24
24
|
});
|
|
25
|
-
export {
|
|
26
|
-
i as CustomHighlight
|
|
27
|
-
};
|
|
25
|
+
export { CustomHighlight };
|
|
28
26
|
//# sourceMappingURL=highlight.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highlight.js","sources":["../../src/highlight/highlight.ts"],"sourcesContent":["import Highlight from '@tiptap/extension-highlight';\n\nexport const CustomHighlight = Highlight.extend({\n name: 'customHighlight',\n\n addOptions() {\n return {\n ...this.parent?.(),\n multicolor: true,\n HTMLAttributes: {},\n };\n },\n\n parseHTML() {\n return [\n {\n ...this.parent?.(),\n style: 'background-color',\n getAttrs: (style) => {\n return {\n color: style,\n };\n },\n },\n ];\n },\n});\n"],"names":[
|
|
1
|
+
{"version":3,"file":"highlight.js","sources":["../../src/highlight/highlight.ts"],"sourcesContent":["import Highlight from '@tiptap/extension-highlight';\n\nexport const CustomHighlight = Highlight.extend({\n name: 'customHighlight',\n\n addOptions() {\n return {\n ...this.parent?.(),\n multicolor: true,\n HTMLAttributes: {},\n };\n },\n\n parseHTML() {\n return [\n {\n ...this.parent?.(),\n style: 'background-color',\n getAttrs: (style) => {\n return {\n color: style,\n };\n },\n },\n ];\n },\n});\n"],"names":[],"mappings":";AAEa,MAAA,kBAAkB,UAAU,OAAO;AAAA,EAC9C,MAAM;AAAA,EAEN,aAAa;;AACJ,WAAA;AAAA,MACL,IAAG,UAAK,WAAL;AAAA,MACH,YAAY;AAAA,MACZ,gBAAgB,CAAC;AAAA,IAAA;AAAA,EAErB;AAAA,EAEA,YAAY;;AACH,WAAA;AAAA,MACL;AAAA,QACE,IAAG,UAAK,WAAL;AAAA,QACH,OAAO;AAAA,QACP,UAAU,CAAC,WACF;AAAA,UACL,OAAO;AAAA,QAAA;AAAA,MAGb;AAAA,IAAA;AAAA,EAEJ;AACF,CAAC;"}
|
|
@@ -1,2 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3
|
+
const extensionLink = require('@tiptap/extension-link'),
|
|
4
|
+
Hyperlink = extensionLink.Link.extend({
|
|
5
|
+
name: 'hyperlink',
|
|
6
|
+
parseHTML() {
|
|
7
|
+
return [
|
|
8
|
+
{
|
|
9
|
+
tag: 'a[href]:not([href *= "javascript:" i])',
|
|
10
|
+
getAttrs: (node) => {
|
|
11
|
+
if (
|
|
12
|
+
node.getAttribute('data-id') &&
|
|
13
|
+
node.getAttribute('data-app-prefix')
|
|
14
|
+
)
|
|
15
|
+
return !1;
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
},
|
|
20
|
+
addOptions() {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
return {
|
|
23
|
+
...((_a = this.parent) == null ? void 0 : _a.call(this)),
|
|
24
|
+
openOnClick: !1,
|
|
25
|
+
HTMLAttributes: {
|
|
26
|
+
...((_b = this.parent) == null
|
|
27
|
+
? void 0
|
|
28
|
+
: _b.call(this).HTMLAttributes),
|
|
29
|
+
target: null,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
addAttributes() {
|
|
34
|
+
var _a;
|
|
35
|
+
return {
|
|
36
|
+
...((_a = this.parent) == null ? void 0 : _a.call(this)),
|
|
37
|
+
target: {
|
|
38
|
+
default: this.options.HTMLAttributes.target,
|
|
39
|
+
parseHTML: (element) =>
|
|
40
|
+
element.getAttribute('target') !== '_blank' ? null : '_blank',
|
|
41
|
+
renderHTML: (attributes) => ({ target: attributes.target }),
|
|
42
|
+
},
|
|
43
|
+
title: { default: this.options.HTMLAttributes.title },
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
exports.Hyperlink = Hyperlink;
|
|
2
48
|
//# sourceMappingURL=hyperlink.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hyperlink.cjs","sources":["../../src/hyperlink/hyperlink.ts"],"sourcesContent":["import { Link } from '@tiptap/extension-link';\n\n/** Our own model of an hyperlink in a rich document. */\nexport type HyperlinkAttributes = {\n href: string | null;\n target: '_blank' | null;\n title: string | null;\n text: string | null;\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n hyperlink: {\n /**\n * Set an hyperlink mark\n */\n setLink: (attributes: Partial<HyperlinkAttributes>) => ReturnType;\n /**\n * Toggle an hyperlink mark\n */\n toggleLink: (attributes: {\n href: string;\n target?: string | null;\n }) => ReturnType;\n /**\n * Unset an hyperlink mark\n */\n unsetLink: () => ReturnType;\n };\n }\n}\n\n/**\n * Hyperlink (external links), extends `Link` extension from TipTap.\n *\n * Links to external resources MUST NOT have a `data-id` nor a `data-app-prefix` attribute.\n * The `target` attribute has to be sanitized, so it is overriden.\n */\nexport const Hyperlink = Link.extend({\n name: 'hyperlink',\n\n parseHTML() {\n return [\n {\n tag: 'a[href]:not([href *= \"javascript:\" i])',\n // Be sure no data-id and data-app-prefix attribute exists :\n // it would then be an Linker, not an Hyperlink !\n getAttrs: (node: HTMLAnchorElement) => {\n // See https://prosemirror.net/docs/ref/version/0.18.0.html#model.ParseRule.getAttrs\n if (\n node.getAttribute('data-id') &&\n node.getAttribute('data-app-prefix')\n )\n return false;\n },\n },\n ];\n },\n\n addOptions() {\n return {\n ...this.parent?.(),\n openOnClick: false,\n HTMLAttributes: {\n ...this.parent?.().HTMLAttributes,\n target: null,\n },\n };\n },\n\n /* Manage `title` and `target` attributes. */\n addAttributes() {\n return {\n // Preserve attributes of parent extension...\n ...this.parent?.(),\n // ...then add or override the following :\n //------------------\n target: {\n default: this.options.HTMLAttributes.target,\n // Sanitize target value\n parseHTML: (element) =>\n element.getAttribute('target') !== '_blank' ? null : '_blank',\n renderHTML: (attributes) => ({\n target: attributes['target'],\n }),\n },\n title: {\n default: this.options.HTMLAttributes.title,\n },\n };\n },\n});\n"],"names":["
|
|
1
|
+
{"version":3,"file":"hyperlink.cjs","sources":["../../src/hyperlink/hyperlink.ts"],"sourcesContent":["import { Link } from '@tiptap/extension-link';\n\n/** Our own model of an hyperlink in a rich document. */\nexport type HyperlinkAttributes = {\n href: string | null;\n target: '_blank' | null;\n title: string | null;\n text: string | null;\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n hyperlink: {\n /**\n * Set an hyperlink mark\n */\n setLink: (attributes: Partial<HyperlinkAttributes>) => ReturnType;\n /**\n * Toggle an hyperlink mark\n */\n toggleLink: (attributes: {\n href: string;\n target?: string | null;\n }) => ReturnType;\n /**\n * Unset an hyperlink mark\n */\n unsetLink: () => ReturnType;\n };\n }\n}\n\n/**\n * Hyperlink (external links), extends `Link` extension from TipTap.\n *\n * Links to external resources MUST NOT have a `data-id` nor a `data-app-prefix` attribute.\n * The `target` attribute has to be sanitized, so it is overriden.\n */\nexport const Hyperlink = Link.extend({\n name: 'hyperlink',\n\n parseHTML() {\n return [\n {\n tag: 'a[href]:not([href *= \"javascript:\" i])',\n // Be sure no data-id and data-app-prefix attribute exists :\n // it would then be an Linker, not an Hyperlink !\n getAttrs: (node: HTMLAnchorElement) => {\n // See https://prosemirror.net/docs/ref/version/0.18.0.html#model.ParseRule.getAttrs\n if (\n node.getAttribute('data-id') &&\n node.getAttribute('data-app-prefix')\n )\n return false;\n },\n },\n ];\n },\n\n addOptions() {\n return {\n ...this.parent?.(),\n openOnClick: false,\n HTMLAttributes: {\n ...this.parent?.().HTMLAttributes,\n target: null,\n },\n };\n },\n\n /* Manage `title` and `target` attributes. */\n addAttributes() {\n return {\n // Preserve attributes of parent extension...\n ...this.parent?.(),\n // ...then add or override the following :\n //------------------\n target: {\n default: this.options.HTMLAttributes.target,\n // Sanitize target value\n parseHTML: (element) =>\n element.getAttribute('target') !== '_blank' ? null : '_blank',\n renderHTML: (attributes) => ({\n target: attributes['target'],\n }),\n },\n title: {\n default: this.options.HTMLAttributes.title,\n },\n };\n },\n});\n"],"names":["Link"],"mappings":"sIAsCa,UAAYA,mBAAK,OAAO,CACnC,KAAM,YAEN,WAAY,CACH,MAAA,CACL,CACE,IAAK,yCAGL,SAAW,MAA4B,CAErC,GACE,KAAK,aAAa,SAAS,GAC3B,KAAK,aAAa,iBAAiB,EAE5B,MAAA,EACX,CACF,CAAA,CAEJ,EAEA,YAAa,WACJ,MAAA,CACL,IAAG,QAAK,SAAL,0BACH,YAAa,GACb,eAAgB,CACd,IAAG,QAAK,SAAL,0BAAgB,eACnB,OAAQ,IACV,CAAA,CAEJ,EAGA,eAAgB,QACP,MAAA,CAEL,IAAG,QAAK,SAAL,0BAGH,OAAQ,CACN,QAAS,KAAK,QAAQ,eAAe,OAErC,UAAY,SACV,QAAQ,aAAa,QAAQ,IAAM,SAAW,KAAO,SACvD,WAAa,aAAgB,CAC3B,OAAQ,WAAW,MAAQ,EAE/B,EACA,MAAO,CACL,QAAS,KAAK,QAAQ,eAAe,KACvC,CAAA,CAEJ,CACF,CAAC"}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
/** Our own model of an hyperlink in a rich document. */
|
|
2
2
|
export type HyperlinkAttributes = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
href: string | null;
|
|
4
|
+
target: '_blank' | null;
|
|
5
|
+
title: string | null;
|
|
6
|
+
text: string | null;
|
|
7
7
|
};
|
|
8
8
|
declare module '@tiptap/core' {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
9
|
+
interface Commands<ReturnType> {
|
|
10
|
+
hyperlink: {
|
|
11
|
+
/**
|
|
12
|
+
* Set an hyperlink mark
|
|
13
|
+
*/
|
|
14
|
+
setLink: (attributes: Partial<HyperlinkAttributes>) => ReturnType;
|
|
15
|
+
/**
|
|
16
|
+
* Toggle an hyperlink mark
|
|
17
|
+
*/
|
|
18
|
+
toggleLink: (attributes: {
|
|
19
|
+
href: string;
|
|
20
|
+
target?: string | null;
|
|
21
|
+
}) => ReturnType;
|
|
22
|
+
/**
|
|
23
|
+
* Unset an hyperlink mark
|
|
24
|
+
*/
|
|
25
|
+
unsetLink: () => ReturnType;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Hyperlink (external links), extends `Link` extension from TipTap.
|
|
@@ -32,4 +32,7 @@ declare module '@tiptap/core' {
|
|
|
32
32
|
* Links to external resources MUST NOT have a `data-id` nor a `data-app-prefix` attribute.
|
|
33
33
|
* The `target` attribute has to be sanitized, so it is overriden.
|
|
34
34
|
*/
|
|
35
|
-
export declare const Hyperlink: import('@tiptap/core').Mark<
|
|
35
|
+
export declare const Hyperlink: import('@tiptap/core').Mark<
|
|
36
|
+
import('@tiptap/extension-link').LinkOptions,
|
|
37
|
+
any
|
|
38
|
+
>;
|
|
@@ -1,53 +1,55 @@
|
|
|
1
|
-
import { Link
|
|
2
|
-
const
|
|
3
|
-
name:
|
|
1
|
+
import { Link } from '@tiptap/extension-link';
|
|
2
|
+
const Hyperlink = Link.extend({
|
|
3
|
+
name: 'hyperlink',
|
|
4
4
|
parseHTML() {
|
|
5
5
|
return [
|
|
6
6
|
{
|
|
7
7
|
tag: 'a[href]:not([href *= "javascript:" i])',
|
|
8
8
|
// Be sure no data-id and data-app-prefix attribute exists :
|
|
9
9
|
// it would then be an Linker, not an Hyperlink !
|
|
10
|
-
getAttrs: (
|
|
11
|
-
if (
|
|
10
|
+
getAttrs: (node) => {
|
|
11
|
+
if (
|
|
12
|
+
node.getAttribute('data-id') &&
|
|
13
|
+
node.getAttribute('data-app-prefix')
|
|
14
|
+
)
|
|
12
15
|
return !1;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
16
|
+
},
|
|
17
|
+
},
|
|
15
18
|
];
|
|
16
19
|
},
|
|
17
20
|
addOptions() {
|
|
18
|
-
var
|
|
21
|
+
var _a, _b;
|
|
19
22
|
return {
|
|
20
|
-
...(
|
|
23
|
+
...((_a = this.parent) == null ? void 0 : _a.call(this)),
|
|
21
24
|
openOnClick: !1,
|
|
22
25
|
HTMLAttributes: {
|
|
23
|
-
...(
|
|
24
|
-
target: null
|
|
25
|
-
}
|
|
26
|
+
...((_b = this.parent) == null ? void 0 : _b.call(this).HTMLAttributes),
|
|
27
|
+
target: null,
|
|
28
|
+
},
|
|
26
29
|
};
|
|
27
30
|
},
|
|
28
31
|
/* Manage `title` and `target` attributes. */
|
|
29
32
|
addAttributes() {
|
|
30
|
-
var
|
|
33
|
+
var _a;
|
|
31
34
|
return {
|
|
32
35
|
// Preserve attributes of parent extension...
|
|
33
|
-
...(
|
|
36
|
+
...((_a = this.parent) == null ? void 0 : _a.call(this)),
|
|
34
37
|
// ...then add or override the following :
|
|
35
38
|
//------------------
|
|
36
39
|
target: {
|
|
37
40
|
default: this.options.HTMLAttributes.target,
|
|
38
41
|
// Sanitize target value
|
|
39
|
-
parseHTML: (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
parseHTML: (element) =>
|
|
43
|
+
element.getAttribute('target') !== '_blank' ? null : '_blank',
|
|
44
|
+
renderHTML: (attributes) => ({
|
|
45
|
+
target: attributes.target,
|
|
46
|
+
}),
|
|
43
47
|
},
|
|
44
48
|
title: {
|
|
45
|
-
default: this.options.HTMLAttributes.title
|
|
46
|
-
}
|
|
49
|
+
default: this.options.HTMLAttributes.title,
|
|
50
|
+
},
|
|
47
51
|
};
|
|
48
|
-
}
|
|
52
|
+
},
|
|
49
53
|
});
|
|
50
|
-
export {
|
|
51
|
-
i as Hyperlink
|
|
52
|
-
};
|
|
54
|
+
export { Hyperlink };
|
|
53
55
|
//# sourceMappingURL=hyperlink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hyperlink.js","sources":["../../src/hyperlink/hyperlink.ts"],"sourcesContent":["import { Link } from '@tiptap/extension-link';\n\n/** Our own model of an hyperlink in a rich document. */\nexport type HyperlinkAttributes = {\n href: string | null;\n target: '_blank' | null;\n title: string | null;\n text: string | null;\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n hyperlink: {\n /**\n * Set an hyperlink mark\n */\n setLink: (attributes: Partial<HyperlinkAttributes>) => ReturnType;\n /**\n * Toggle an hyperlink mark\n */\n toggleLink: (attributes: {\n href: string;\n target?: string | null;\n }) => ReturnType;\n /**\n * Unset an hyperlink mark\n */\n unsetLink: () => ReturnType;\n };\n }\n}\n\n/**\n * Hyperlink (external links), extends `Link` extension from TipTap.\n *\n * Links to external resources MUST NOT have a `data-id` nor a `data-app-prefix` attribute.\n * The `target` attribute has to be sanitized, so it is overriden.\n */\nexport const Hyperlink = Link.extend({\n name: 'hyperlink',\n\n parseHTML() {\n return [\n {\n tag: 'a[href]:not([href *= \"javascript:\" i])',\n // Be sure no data-id and data-app-prefix attribute exists :\n // it would then be an Linker, not an Hyperlink !\n getAttrs: (node: HTMLAnchorElement) => {\n // See https://prosemirror.net/docs/ref/version/0.18.0.html#model.ParseRule.getAttrs\n if (\n node.getAttribute('data-id') &&\n node.getAttribute('data-app-prefix')\n )\n return false;\n },\n },\n ];\n },\n\n addOptions() {\n return {\n ...this.parent?.(),\n openOnClick: false,\n HTMLAttributes: {\n ...this.parent?.().HTMLAttributes,\n target: null,\n },\n };\n },\n\n /* Manage `title` and `target` attributes. */\n addAttributes() {\n return {\n // Preserve attributes of parent extension...\n ...this.parent?.(),\n // ...then add or override the following :\n //------------------\n target: {\n default: this.options.HTMLAttributes.target,\n // Sanitize target value\n parseHTML: (element) =>\n element.getAttribute('target') !== '_blank' ? null : '_blank',\n renderHTML: (attributes) => ({\n target: attributes['target'],\n }),\n },\n title: {\n default: this.options.HTMLAttributes.title,\n },\n };\n },\n});\n"],"names":[
|
|
1
|
+
{"version":3,"file":"hyperlink.js","sources":["../../src/hyperlink/hyperlink.ts"],"sourcesContent":["import { Link } from '@tiptap/extension-link';\n\n/** Our own model of an hyperlink in a rich document. */\nexport type HyperlinkAttributes = {\n href: string | null;\n target: '_blank' | null;\n title: string | null;\n text: string | null;\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n hyperlink: {\n /**\n * Set an hyperlink mark\n */\n setLink: (attributes: Partial<HyperlinkAttributes>) => ReturnType;\n /**\n * Toggle an hyperlink mark\n */\n toggleLink: (attributes: {\n href: string;\n target?: string | null;\n }) => ReturnType;\n /**\n * Unset an hyperlink mark\n */\n unsetLink: () => ReturnType;\n };\n }\n}\n\n/**\n * Hyperlink (external links), extends `Link` extension from TipTap.\n *\n * Links to external resources MUST NOT have a `data-id` nor a `data-app-prefix` attribute.\n * The `target` attribute has to be sanitized, so it is overriden.\n */\nexport const Hyperlink = Link.extend({\n name: 'hyperlink',\n\n parseHTML() {\n return [\n {\n tag: 'a[href]:not([href *= \"javascript:\" i])',\n // Be sure no data-id and data-app-prefix attribute exists :\n // it would then be an Linker, not an Hyperlink !\n getAttrs: (node: HTMLAnchorElement) => {\n // See https://prosemirror.net/docs/ref/version/0.18.0.html#model.ParseRule.getAttrs\n if (\n node.getAttribute('data-id') &&\n node.getAttribute('data-app-prefix')\n )\n return false;\n },\n },\n ];\n },\n\n addOptions() {\n return {\n ...this.parent?.(),\n openOnClick: false,\n HTMLAttributes: {\n ...this.parent?.().HTMLAttributes,\n target: null,\n },\n };\n },\n\n /* Manage `title` and `target` attributes. */\n addAttributes() {\n return {\n // Preserve attributes of parent extension...\n ...this.parent?.(),\n // ...then add or override the following :\n //------------------\n target: {\n default: this.options.HTMLAttributes.target,\n // Sanitize target value\n parseHTML: (element) =>\n element.getAttribute('target') !== '_blank' ? null : '_blank',\n renderHTML: (attributes) => ({\n target: attributes['target'],\n }),\n },\n title: {\n default: this.options.HTMLAttributes.title,\n },\n };\n },\n});\n"],"names":[],"mappings":";AAsCa,MAAA,YAAY,KAAK,OAAO;AAAA,EACnC,MAAM;AAAA,EAEN,YAAY;AACH,WAAA;AAAA,MACL;AAAA,QACE,KAAK;AAAA;AAAA;AAAA,QAGL,UAAU,CAAC,SAA4B;AAErC,cACE,KAAK,aAAa,SAAS,KAC3B,KAAK,aAAa,iBAAiB;AAE5B,mBAAA;AAAA,QACX;AAAA,MACF;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,aAAa;;AACJ,WAAA;AAAA,MACL,IAAG,UAAK,WAAL;AAAA,MACH,aAAa;AAAA,MACb,gBAAgB;AAAA,QACd,IAAG,UAAK,WAAL,8BAAgB;AAAA,QACnB,QAAQ;AAAA,MACV;AAAA,IAAA;AAAA,EAEJ;AAAA;AAAA,EAGA,gBAAgB;;AACP,WAAA;AAAA;AAAA,MAEL,IAAG,UAAK,WAAL;AAAA;AAAA;AAAA,MAGH,QAAQ;AAAA,QACN,SAAS,KAAK,QAAQ,eAAe;AAAA;AAAA,QAErC,WAAW,CAAC,YACV,QAAQ,aAAa,QAAQ,MAAM,WAAW,OAAO;AAAA,QACvD,YAAY,CAAC,gBAAgB;AAAA,UAC3B,QAAQ,WAAW;AAAA,QAAQ;AAAA,MAE/B;AAAA,MACA,OAAO;AAAA,QACL,SAAS,KAAK,QAAQ,eAAe;AAAA,MACvC;AAAA,IAAA;AAAA,EAEJ;AACF,CAAC;"}
|
package/dist/iframe/iframe.cjs
CHANGED
|
@@ -1,2 +1,70 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3
|
+
const core = require('@tiptap/core'),
|
|
4
|
+
Iframe = core.Node.create({
|
|
5
|
+
name: 'iframe',
|
|
6
|
+
group: 'block',
|
|
7
|
+
atom: !0,
|
|
8
|
+
draggable: !0,
|
|
9
|
+
addOptions() {
|
|
10
|
+
return {
|
|
11
|
+
allowFullscreen: !0,
|
|
12
|
+
HTMLAttributes: { class: 'iframe-wrapper' },
|
|
13
|
+
};
|
|
14
|
+
},
|
|
15
|
+
addAttributes() {
|
|
16
|
+
return {
|
|
17
|
+
src: { default: null },
|
|
18
|
+
frameborder: { default: 0 },
|
|
19
|
+
allowfullscreen: {
|
|
20
|
+
default: this.options.allowFullscreen,
|
|
21
|
+
parseHTML: () => this.options.allowFullscreen,
|
|
22
|
+
},
|
|
23
|
+
width: {
|
|
24
|
+
renderHTML: (attributes) =>
|
|
25
|
+
attributes.width
|
|
26
|
+
? {
|
|
27
|
+
width:
|
|
28
|
+
attributes.width === '100%'
|
|
29
|
+
? '100%'
|
|
30
|
+
: parseInt(attributes.width),
|
|
31
|
+
}
|
|
32
|
+
: {},
|
|
33
|
+
parseHTML: (element) => element.getAttribute('width'),
|
|
34
|
+
},
|
|
35
|
+
height: {
|
|
36
|
+
renderHTML: (attributes) =>
|
|
37
|
+
attributes.height ? { height: parseInt(attributes.height) } : {},
|
|
38
|
+
parseHTML: (element) => element.getAttribute('height'),
|
|
39
|
+
},
|
|
40
|
+
style: {
|
|
41
|
+
renderHTML: (attributes) =>
|
|
42
|
+
attributes.style ? { style: attributes.style } : {},
|
|
43
|
+
parseHTML: (element) => element.getAttribute('style'),
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
parseHTML() {
|
|
48
|
+
return [{ tag: 'iframe' }];
|
|
49
|
+
},
|
|
50
|
+
renderHTML({ HTMLAttributes }) {
|
|
51
|
+
return ['div', this.options.HTMLAttributes, ['iframe', HTMLAttributes]];
|
|
52
|
+
},
|
|
53
|
+
addCommands() {
|
|
54
|
+
return {
|
|
55
|
+
setIframe:
|
|
56
|
+
(options) =>
|
|
57
|
+
({ tr, dispatch }) => {
|
|
58
|
+
const { selection } = tr,
|
|
59
|
+
node = this.type.create(options);
|
|
60
|
+
return (
|
|
61
|
+
dispatch &&
|
|
62
|
+
tr.replaceRangeWith(selection.from, selection.to, node),
|
|
63
|
+
!0
|
|
64
|
+
);
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
exports.Iframe = Iframe;
|
|
2
70
|
//# sourceMappingURL=iframe.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iframe.cjs","sources":["../../src/iframe/iframe.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface IframeOptions {\n allowFullscreen: boolean;\n HTMLAttributes: {\n [key: string]: any;\n };\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n iframe: {\n /**\n * Add an iframe\n */\n setIframe: (options: { src: string }) => ReturnType;\n };\n }\n}\n\nexport const Iframe = Node.create<IframeOptions>({\n name: 'iframe',\n group: 'block',\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n allowFullscreen: true,\n HTMLAttributes: {\n class: 'iframe-wrapper',\n },\n };\n },\n\n addAttributes() {\n return {\n src: {\n default: null,\n },\n frameborder: {\n default: 0,\n },\n allowfullscreen: {\n default: this.options.allowFullscreen,\n parseHTML: () => this.options.allowFullscreen,\n },\n width: {\n renderHTML: (attributes) => {\n return attributes.width\n ? {\n width:\n attributes.width === '100%'\n ? '100%'\n : parseInt(attributes.width),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes) => {\n return attributes.height\n ? {\n height: parseInt(attributes.height),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('height'),\n },\n style: {\n renderHTML: (attributes) => {\n return attributes.style\n ? {\n style: attributes.style,\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('style'),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'iframe',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['div', this.options.HTMLAttributes, ['iframe', HTMLAttributes]];\n },\n\n addCommands() {\n return {\n setIframe:\n (options: { src: string }) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n const node = this.type.create(options);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n };\n },\n});\n"],"names":["
|
|
1
|
+
{"version":3,"file":"iframe.cjs","sources":["../../src/iframe/iframe.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface IframeOptions {\n allowFullscreen: boolean;\n HTMLAttributes: {\n [key: string]: any;\n };\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n iframe: {\n /**\n * Add an iframe\n */\n setIframe: (options: { src: string }) => ReturnType;\n };\n }\n}\n\nexport const Iframe = Node.create<IframeOptions>({\n name: 'iframe',\n group: 'block',\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n allowFullscreen: true,\n HTMLAttributes: {\n class: 'iframe-wrapper',\n },\n };\n },\n\n addAttributes() {\n return {\n src: {\n default: null,\n },\n frameborder: {\n default: 0,\n },\n allowfullscreen: {\n default: this.options.allowFullscreen,\n parseHTML: () => this.options.allowFullscreen,\n },\n width: {\n renderHTML: (attributes) => {\n return attributes.width\n ? {\n width:\n attributes.width === '100%'\n ? '100%'\n : parseInt(attributes.width),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes) => {\n return attributes.height\n ? {\n height: parseInt(attributes.height),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('height'),\n },\n style: {\n renderHTML: (attributes) => {\n return attributes.style\n ? {\n style: attributes.style,\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('style'),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'iframe',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['div', this.options.HTMLAttributes, ['iframe', HTMLAttributes]];\n },\n\n addCommands() {\n return {\n setIframe:\n (options: { src: string }) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n const node = this.type.create(options);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n };\n },\n});\n"],"names":["Node"],"mappings":"mHAoBa,OAASA,UAAK,OAAsB,CAC/C,KAAM,SACN,MAAO,QACP,KAAM,GACN,UAAW,GAEX,YAAa,CACJ,MAAA,CACL,gBAAiB,GACjB,eAAgB,CACd,MAAO,gBACT,CAAA,CAEJ,EAEA,eAAgB,CACP,MAAA,CACL,IAAK,CACH,QAAS,IACX,EACA,YAAa,CACX,QAAS,CACX,EACA,gBAAiB,CACf,QAAS,KAAK,QAAQ,gBACtB,UAAW,IAAM,KAAK,QAAQ,eAChC,EACA,MAAO,CACL,WAAa,YACJ,WAAW,MACd,CACE,MACE,WAAW,QAAU,OACjB,OACA,SAAS,WAAW,KAAK,GAEjC,GAEN,UAAY,SAAY,QAAQ,aAAa,OAAO,CACtD,EACA,OAAQ,CACN,WAAa,YACJ,WAAW,OACd,CACE,OAAQ,SAAS,WAAW,MAAM,GAEpC,GAEN,UAAY,SAAY,QAAQ,aAAa,QAAQ,CACvD,EACA,MAAO,CACL,WAAa,YACJ,WAAW,MACd,CACE,MAAO,WAAW,OAEpB,GAEN,UAAY,SAAY,QAAQ,aAAa,OAAO,CACtD,CAAA,CAEJ,EAEA,WAAY,CACH,MAAA,CACL,CACE,IAAK,QACP,CAAA,CAEJ,EAEA,WAAW,CAAE,gBAAkB,CACtB,MAAA,CAAC,MAAO,KAAK,QAAQ,eAAgB,CAAC,SAAU,cAAc,CAAC,CACxE,EAEA,aAAc,CACL,MAAA,CACL,UACG,SACD,CAAC,CAAE,GAAI,YAAe,CACd,KAAA,CAAE,SAAc,EAAA,GAChB,KAAO,KAAK,KAAK,OAAO,OAAO,EAErC,OAAI,UACF,GAAG,iBAAiB,UAAU,KAAM,UAAU,GAAI,IAAI,EAGjD,EACT,CAAA,CAEN,CACF,CAAC"}
|
package/dist/iframe/iframe.d.ts
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { Node } from '@tiptap/core';
|
|
2
2
|
export interface IframeOptions {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
allowFullscreen: boolean;
|
|
4
|
+
HTMLAttributes: {
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
};
|
|
7
7
|
}
|
|
8
8
|
declare module '@tiptap/core' {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
18
|
-
}
|
|
9
|
+
interface Commands<ReturnType> {
|
|
10
|
+
iframe: {
|
|
11
|
+
/**
|
|
12
|
+
* Add an iframe
|
|
13
|
+
*/
|
|
14
|
+
setIframe: (options: { src: string }) => ReturnType;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
19
17
|
}
|
|
20
18
|
export declare const Iframe: Node<IframeOptions, any>;
|
package/dist/iframe/iframe.js
CHANGED
|
@@ -1,69 +1,85 @@
|
|
|
1
|
-
import { Node
|
|
2
|
-
const
|
|
3
|
-
name:
|
|
4
|
-
group:
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
|
+
const Iframe = Node.create({
|
|
3
|
+
name: 'iframe',
|
|
4
|
+
group: 'block',
|
|
5
5
|
atom: !0,
|
|
6
6
|
draggable: !0,
|
|
7
7
|
addOptions() {
|
|
8
8
|
return {
|
|
9
9
|
allowFullscreen: !0,
|
|
10
10
|
HTMLAttributes: {
|
|
11
|
-
class:
|
|
12
|
-
}
|
|
11
|
+
class: 'iframe-wrapper',
|
|
12
|
+
},
|
|
13
13
|
};
|
|
14
14
|
},
|
|
15
15
|
addAttributes() {
|
|
16
16
|
return {
|
|
17
17
|
src: {
|
|
18
|
-
default: null
|
|
18
|
+
default: null,
|
|
19
19
|
},
|
|
20
20
|
frameborder: {
|
|
21
|
-
default: 0
|
|
21
|
+
default: 0,
|
|
22
22
|
},
|
|
23
23
|
allowfullscreen: {
|
|
24
24
|
default: this.options.allowFullscreen,
|
|
25
|
-
parseHTML: () => this.options.allowFullscreen
|
|
25
|
+
parseHTML: () => this.options.allowFullscreen,
|
|
26
26
|
},
|
|
27
27
|
width: {
|
|
28
|
-
renderHTML: (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
renderHTML: (attributes) =>
|
|
29
|
+
attributes.width
|
|
30
|
+
? {
|
|
31
|
+
width:
|
|
32
|
+
attributes.width === '100%'
|
|
33
|
+
? '100%'
|
|
34
|
+
: parseInt(attributes.width),
|
|
35
|
+
}
|
|
36
|
+
: {},
|
|
37
|
+
parseHTML: (element) => element.getAttribute('width'),
|
|
32
38
|
},
|
|
33
39
|
height: {
|
|
34
|
-
renderHTML: (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
renderHTML: (attributes) =>
|
|
41
|
+
attributes.height
|
|
42
|
+
? {
|
|
43
|
+
height: parseInt(attributes.height),
|
|
44
|
+
}
|
|
45
|
+
: {},
|
|
46
|
+
parseHTML: (element) => element.getAttribute('height'),
|
|
38
47
|
},
|
|
39
48
|
style: {
|
|
40
|
-
renderHTML: (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
renderHTML: (attributes) =>
|
|
50
|
+
attributes.style
|
|
51
|
+
? {
|
|
52
|
+
style: attributes.style,
|
|
53
|
+
}
|
|
54
|
+
: {},
|
|
55
|
+
parseHTML: (element) => element.getAttribute('style'),
|
|
56
|
+
},
|
|
45
57
|
};
|
|
46
58
|
},
|
|
47
59
|
parseHTML() {
|
|
48
60
|
return [
|
|
49
61
|
{
|
|
50
|
-
tag:
|
|
51
|
-
}
|
|
62
|
+
tag: 'iframe',
|
|
63
|
+
},
|
|
52
64
|
];
|
|
53
65
|
},
|
|
54
|
-
renderHTML({ HTMLAttributes
|
|
55
|
-
return [
|
|
66
|
+
renderHTML({ HTMLAttributes }) {
|
|
67
|
+
return ['div', this.options.HTMLAttributes, ['iframe', HTMLAttributes]];
|
|
56
68
|
},
|
|
57
69
|
addCommands() {
|
|
58
70
|
return {
|
|
59
|
-
setIframe:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
71
|
+
setIframe:
|
|
72
|
+
(options) =>
|
|
73
|
+
({ tr, dispatch }) => {
|
|
74
|
+
const { selection } = tr,
|
|
75
|
+
node = this.type.create(options);
|
|
76
|
+
return (
|
|
77
|
+
dispatch && tr.replaceRangeWith(selection.from, selection.to, node),
|
|
78
|
+
!0
|
|
79
|
+
);
|
|
80
|
+
},
|
|
63
81
|
};
|
|
64
|
-
}
|
|
82
|
+
},
|
|
65
83
|
});
|
|
66
|
-
export {
|
|
67
|
-
i as Iframe
|
|
68
|
-
};
|
|
84
|
+
export { Iframe };
|
|
69
85
|
//# sourceMappingURL=iframe.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iframe.js","sources":["../../src/iframe/iframe.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface IframeOptions {\n allowFullscreen: boolean;\n HTMLAttributes: {\n [key: string]: any;\n };\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n iframe: {\n /**\n * Add an iframe\n */\n setIframe: (options: { src: string }) => ReturnType;\n };\n }\n}\n\nexport const Iframe = Node.create<IframeOptions>({\n name: 'iframe',\n group: 'block',\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n allowFullscreen: true,\n HTMLAttributes: {\n class: 'iframe-wrapper',\n },\n };\n },\n\n addAttributes() {\n return {\n src: {\n default: null,\n },\n frameborder: {\n default: 0,\n },\n allowfullscreen: {\n default: this.options.allowFullscreen,\n parseHTML: () => this.options.allowFullscreen,\n },\n width: {\n renderHTML: (attributes) => {\n return attributes.width\n ? {\n width:\n attributes.width === '100%'\n ? '100%'\n : parseInt(attributes.width),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes) => {\n return attributes.height\n ? {\n height: parseInt(attributes.height),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('height'),\n },\n style: {\n renderHTML: (attributes) => {\n return attributes.style\n ? {\n style: attributes.style,\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('style'),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'iframe',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['div', this.options.HTMLAttributes, ['iframe', HTMLAttributes]];\n },\n\n addCommands() {\n return {\n setIframe:\n (options: { src: string }) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n const node = this.type.create(options);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n };\n },\n});\n"],"names":[
|
|
1
|
+
{"version":3,"file":"iframe.js","sources":["../../src/iframe/iframe.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface IframeOptions {\n allowFullscreen: boolean;\n HTMLAttributes: {\n [key: string]: any;\n };\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n iframe: {\n /**\n * Add an iframe\n */\n setIframe: (options: { src: string }) => ReturnType;\n };\n }\n}\n\nexport const Iframe = Node.create<IframeOptions>({\n name: 'iframe',\n group: 'block',\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n allowFullscreen: true,\n HTMLAttributes: {\n class: 'iframe-wrapper',\n },\n };\n },\n\n addAttributes() {\n return {\n src: {\n default: null,\n },\n frameborder: {\n default: 0,\n },\n allowfullscreen: {\n default: this.options.allowFullscreen,\n parseHTML: () => this.options.allowFullscreen,\n },\n width: {\n renderHTML: (attributes) => {\n return attributes.width\n ? {\n width:\n attributes.width === '100%'\n ? '100%'\n : parseInt(attributes.width),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes) => {\n return attributes.height\n ? {\n height: parseInt(attributes.height),\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('height'),\n },\n style: {\n renderHTML: (attributes) => {\n return attributes.style\n ? {\n style: attributes.style,\n }\n : {};\n },\n parseHTML: (element) => element.getAttribute('style'),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'iframe',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['div', this.options.HTMLAttributes, ['iframe', HTMLAttributes]];\n },\n\n addCommands() {\n return {\n setIframe:\n (options: { src: string }) =>\n ({ tr, dispatch }) => {\n const { selection } = tr;\n const node = this.type.create(options);\n\n if (dispatch) {\n tr.replaceRangeWith(selection.from, selection.to, node);\n }\n\n return true;\n },\n };\n },\n});\n"],"names":[],"mappings":";AAoBa,MAAA,SAAS,KAAK,OAAsB;AAAA,EAC/C,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AAAA,EACN,WAAW;AAAA,EAEX,aAAa;AACJ,WAAA;AAAA,MACL,iBAAiB;AAAA,MACjB,gBAAgB;AAAA,QACd,OAAO;AAAA,MACT;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,gBAAgB;AACP,WAAA;AAAA,MACL,KAAK;AAAA,QACH,SAAS;AAAA,MACX;AAAA,MACA,aAAa;AAAA,QACX,SAAS;AAAA,MACX;AAAA,MACA,iBAAiB;AAAA,QACf,SAAS,KAAK,QAAQ;AAAA,QACtB,WAAW,MAAM,KAAK,QAAQ;AAAA,MAChC;AAAA,MACA,OAAO;AAAA,QACL,YAAY,CAAC,eACJ,WAAW,QACd;AAAA,UACE,OACE,WAAW,UAAU,SACjB,SACA,SAAS,WAAW,KAAK;AAAA,YAEjC;QAEN,WAAW,CAAC,YAAY,QAAQ,aAAa,OAAO;AAAA,MACtD;AAAA,MACA,QAAQ;AAAA,QACN,YAAY,CAAC,eACJ,WAAW,SACd;AAAA,UACE,QAAQ,SAAS,WAAW,MAAM;AAAA,YAEpC;QAEN,WAAW,CAAC,YAAY,QAAQ,aAAa,QAAQ;AAAA,MACvD;AAAA,MACA,OAAO;AAAA,QACL,YAAY,CAAC,eACJ,WAAW,QACd;AAAA,UACE,OAAO,WAAW;AAAA,YAEpB;QAEN,WAAW,CAAC,YAAY,QAAQ,aAAa,OAAO;AAAA,MACtD;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,YAAY;AACH,WAAA;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MACP;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,WAAW,EAAE,kBAAkB;AACtB,WAAA,CAAC,OAAO,KAAK,QAAQ,gBAAgB,CAAC,UAAU,cAAc,CAAC;AAAA,EACxE;AAAA,EAEA,cAAc;AACL,WAAA;AAAA,MACL,WACE,CAAC,YACD,CAAC,EAAE,IAAI,eAAe;AACd,cAAA,EAAE,UAAc,IAAA,IAChB,OAAO,KAAK,KAAK,OAAO,OAAO;AAErC,eAAI,YACF,GAAG,iBAAiB,UAAU,MAAM,UAAU,IAAI,IAAI,GAGjD;AAAA,MACT;AAAA,IAAA;AAAA,EAEN;AACF,CAAC;"}
|