@edifice.io/tiptap-extensions 2.0.0-develop-rc.0 → 2.0.0-develop-rc.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/abbr/abbr.cjs +1 -32
- package/dist/abbr/abbr.d.ts +12 -12
- package/dist/abbr/abbr.js +13 -17
- package/dist/alert/alert.cjs +1 -32
- package/dist/alert/alert.js +22 -20
- package/dist/attachment/attachment.cjs +1 -73
- package/dist/attachment/attachment.d.ts +6 -6
- package/dist/attachment/attachment.js +29 -40
- package/dist/audio/audio.cjs +2 -52
- package/dist/audio/audio.d.ts +13 -17
- package/dist/audio/audio.js +25 -28
- package/dist/font-size/font-size.cjs +1 -48
- package/dist/font-size/font-size.d.ts +13 -13
- package/dist/font-size/font-size.js +17 -29
- package/dist/heading/heading.cjs +1 -61
- package/dist/heading/heading.d.ts +12 -10
- package/dist/heading/heading.js +25 -39
- package/dist/highlight/highlight.cjs +1 -25
- package/dist/highlight/highlight.d.ts +1 -4
- package/dist/highlight/highlight.js +13 -11
- package/dist/hyperlink/hyperlink.cjs +1 -47
- package/dist/hyperlink/hyperlink.d.ts +24 -27
- package/dist/hyperlink/hyperlink.js +19 -21
- package/dist/iframe/iframe.cjs +1 -69
- package/dist/iframe/iframe.d.ts +14 -12
- package/dist/iframe/iframe.js +32 -48
- package/dist/image/custom-image.cjs +1 -162
- package/dist/image/custom-image.d.ts +16 -19
- package/dist/image/custom-image.js +130 -179
- package/dist/index.cjs +1 -43
- package/dist/index.js +21 -21
- package/dist/line-height/line-height.cjs +1 -33
- package/dist/line-height/line-height.js +15 -18
- package/dist/linker/linker.cjs +1 -95
- package/dist/linker/linker.d.ts +17 -17
- package/dist/linker/linker.js +49 -57
- package/dist/mathjax/mathjax.cjs +1 -47
- package/dist/mathjax/mathjax.js +20 -30
- package/dist/paragraph/paragraph.cjs +1 -13
- package/dist/paragraph/paragraph.d.ts +1 -4
- package/dist/paragraph/paragraph.js +8 -6
- package/dist/speech-recognition/speech-recognition.cjs +1 -76
- 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 +41 -57
- package/dist/speech-recognition/speech-recognition.js.map +1 -1
- package/dist/speech-synthesis/speech-synthesis.cjs +1 -32
- package/dist/speech-synthesis/speech-synthesis.d.ts +9 -9
- package/dist/speech-synthesis/speech-synthesis.js +10 -19
- package/dist/table-cell/table-cell.cjs +1 -27
- package/dist/table-cell/table-cell.d.ts +1 -4
- package/dist/table-cell/table-cell.js +12 -17
- package/dist/transform/html-to-json/html-to-json.cjs +1 -4
- package/dist/transform/html-to-json/html-to-json.d.ts +1 -4
- package/dist/transform/html-to-json/html-to-json.js +4 -2
- package/dist/transform/json-to-html/json-to-html.cjs +1 -4
- package/dist/transform/json-to-html/json-to-html.js +4 -2
- package/dist/video/video.cjs +2 -111
- package/dist/video/video.d.ts +19 -28
- package/dist/video/video.js +90 -114
- package/package.json +47 -36
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { Extension } from '@tiptap/core';
|
|
2
2
|
export type FontSizeOptions = {
|
|
3
|
-
|
|
3
|
+
types: string[];
|
|
4
4
|
};
|
|
5
5
|
declare module '@tiptap/core' {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
interface Commands<ReturnType> {
|
|
7
|
+
fontSize: {
|
|
8
|
+
/**
|
|
9
|
+
* Set the font size
|
|
10
|
+
*/
|
|
11
|
+
setFontSize: (fontSize: string) => ReturnType;
|
|
12
|
+
/**
|
|
13
|
+
* Unset the font size
|
|
14
|
+
*/
|
|
15
|
+
unsetFontSize: () => ReturnType;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
18
|
}
|
|
19
19
|
export declare const FontSize: Extension<FontSizeOptions, any>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Extension } from
|
|
1
|
+
import "@tiptap/extension-text-style";
|
|
2
|
+
import { Extension } from "@tiptap/core";
|
|
3
3
|
const FontSize = Extension.create({
|
|
4
|
-
name:
|
|
4
|
+
name: "fontSize",
|
|
5
5
|
addOptions() {
|
|
6
6
|
return {
|
|
7
|
-
types: [
|
|
7
|
+
types: ["textStyle"]
|
|
8
8
|
};
|
|
9
9
|
},
|
|
10
10
|
addGlobalAttributes() {
|
|
@@ -16,36 +16,24 @@ const FontSize = Extension.create({
|
|
|
16
16
|
default: null,
|
|
17
17
|
parseHTML: (element) => {
|
|
18
18
|
var _a;
|
|
19
|
-
return (_a = element.style.fontSize) == null
|
|
20
|
-
? void 0
|
|
21
|
-
: _a.replace(/['"]+/g, '');
|
|
19
|
+
return (_a = element.style.fontSize) == null ? void 0 : _a.replace(/['"]+/g, "");
|
|
22
20
|
},
|
|
23
|
-
renderHTML: (attributes) =>
|
|
24
|
-
attributes.fontSize
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
21
|
+
renderHTML: (attributes) => attributes.fontSize ? {
|
|
22
|
+
style: `font-size: ${attributes.fontSize}`
|
|
23
|
+
} : {}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
32
27
|
];
|
|
33
28
|
},
|
|
34
29
|
addCommands() {
|
|
35
30
|
return {
|
|
36
|
-
setFontSize:
|
|
37
|
-
|
|
38
|
-
({ chain }) =>
|
|
39
|
-
chain().setMark('textStyle', { fontSize }).run(),
|
|
40
|
-
unsetFontSize:
|
|
41
|
-
() =>
|
|
42
|
-
({ chain }) =>
|
|
43
|
-
chain()
|
|
44
|
-
.setMark('textStyle', { fontSize: null })
|
|
45
|
-
.removeEmptyTextStyle()
|
|
46
|
-
.run(),
|
|
31
|
+
setFontSize: (fontSize) => ({ chain }) => chain().setMark("textStyle", { fontSize }).run(),
|
|
32
|
+
unsetFontSize: () => ({ chain }) => chain().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run()
|
|
47
33
|
};
|
|
48
|
-
}
|
|
34
|
+
}
|
|
49
35
|
});
|
|
50
|
-
export {
|
|
36
|
+
export {
|
|
37
|
+
FontSize
|
|
38
|
+
};
|
|
51
39
|
//# sourceMappingURL=font-size.js.map
|
package/dist/heading/heading.cjs
CHANGED
|
@@ -1,62 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3
|
-
const core = require('@tiptap/core'),
|
|
4
|
-
extensionHeading = require('@tiptap/extension-heading');
|
|
5
|
-
require('@tiptap/extension-text-style');
|
|
6
|
-
const CustomHeading = extensionHeading.Heading.extend({
|
|
7
|
-
name: 'customHeading',
|
|
8
|
-
addOptions() {
|
|
9
|
-
var _a;
|
|
10
|
-
return {
|
|
11
|
-
...((_a = this.parent) == null ? void 0 : _a.call(this)),
|
|
12
|
-
HTMLAttributes: {},
|
|
13
|
-
};
|
|
14
|
-
},
|
|
15
|
-
parseHTML() {
|
|
16
|
-
return this.options.levels.map((level) => ({
|
|
17
|
-
tag: `h${level}`,
|
|
18
|
-
attrs: { level },
|
|
19
|
-
}));
|
|
20
|
-
},
|
|
21
|
-
renderHTML({ node, HTMLAttributes }) {
|
|
22
|
-
return [
|
|
23
|
-
`h${
|
|
24
|
-
this.options.levels.includes(node.attrs.level)
|
|
25
|
-
? node.attrs.level
|
|
26
|
-
: this.options.levels[0]
|
|
27
|
-
}`,
|
|
28
|
-
core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
|
|
29
|
-
0,
|
|
30
|
-
];
|
|
31
|
-
},
|
|
32
|
-
addCommands() {
|
|
33
|
-
return {
|
|
34
|
-
setCustomHeading:
|
|
35
|
-
(attributes) =>
|
|
36
|
-
({ tr, dispatch, commands }) => {
|
|
37
|
-
if (!this.options.levels.includes(attributes.level)) return !1;
|
|
38
|
-
const { selection } = tr,
|
|
39
|
-
{ from, to } = selection;
|
|
40
|
-
return (
|
|
41
|
-
tr.doc.nodesBetween(from, to, (node, pos) => {
|
|
42
|
-
node.isBlock &&
|
|
43
|
-
from >= pos &&
|
|
44
|
-
to <= pos + node.nodeSize &&
|
|
45
|
-
node.content.forEach((content) => {
|
|
46
|
-
content.marks.forEach((mark) => {
|
|
47
|
-
mark.type.name === 'textStyle' &&
|
|
48
|
-
mark.attrs.fontSize &&
|
|
49
|
-
mark.attrs.fontSize !== null &&
|
|
50
|
-
(tr = tr.removeMark(pos, pos + node.nodeSize, mark.type));
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
}),
|
|
54
|
-
dispatch && dispatch(tr),
|
|
55
|
-
commands.setHeading({ level: attributes.level })
|
|
56
|
-
);
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
exports.CustomHeading = CustomHeading;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core"),extensionHeading=require("@tiptap/extension-heading");require("@tiptap/extension-text-style");const CustomHeading=extensionHeading.Heading.extend({name:"customHeading",addOptions(){var _a;return{...(_a=this.parent)==null?void 0:_a.call(this),HTMLAttributes:{}}},parseHTML(){return this.options.levels.map(level=>({tag:`h${level}`,attrs:{level}}))},renderHTML({node,HTMLAttributes}){return[`h${this.options.levels.includes(node.attrs.level)?node.attrs.level:this.options.levels[0]}`,core.mergeAttributes(this.options.HTMLAttributes,HTMLAttributes),0]},addCommands(){return{setCustomHeading:attributes=>({tr,dispatch,commands})=>{if(!this.options.levels.includes(attributes.level))return!1;const{selection}=tr,{from,to}=selection;return tr.doc.nodesBetween(from,to,(node,pos)=>{node.isBlock&&from>=pos&&to<=pos+node.nodeSize&&node.content.forEach(content=>{content.marks.forEach(mark=>{mark.type.name==="textStyle"&&mark.attrs.fontSize&&mark.attrs.fontSize!==null&&(tr=tr.removeMark(pos,pos+node.nodeSize,mark.type))})})}),dispatch&&dispatch(tr),commands.setHeading({level:attributes.level})}}}});exports.CustomHeading=CustomHeading;
|
|
62
2
|
//# sourceMappingURL=heading.cjs.map
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
export declare type Level = 1 | 2;
|
|
2
2
|
interface Options {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
levels: Level[];
|
|
4
|
+
HTMLAttributes: Record<string, any>;
|
|
5
5
|
}
|
|
6
6
|
declare module '@tiptap/core' {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
interface Commands<ReturnType> {
|
|
8
|
+
customHeading: {
|
|
9
|
+
/**
|
|
10
|
+
* Apply Heading Level
|
|
11
|
+
*/
|
|
12
|
+
setCustomHeading: (attributes: {
|
|
13
|
+
level: Level;
|
|
14
|
+
}) => ReturnType;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
15
17
|
}
|
|
16
18
|
export declare const CustomHeading: import('@tiptap/core').Node<Options, any>;
|
|
17
19
|
export {};
|
package/dist/heading/heading.js
CHANGED
|
@@ -1,60 +1,46 @@
|
|
|
1
|
-
import { mergeAttributes } from
|
|
2
|
-
import { Heading } from
|
|
3
|
-
import
|
|
1
|
+
import { mergeAttributes } from "@tiptap/core";
|
|
2
|
+
import { Heading } from "@tiptap/extension-heading";
|
|
3
|
+
import "@tiptap/extension-text-style";
|
|
4
4
|
const CustomHeading = Heading.extend({
|
|
5
|
-
name:
|
|
5
|
+
name: "customHeading",
|
|
6
6
|
addOptions() {
|
|
7
7
|
var _a;
|
|
8
8
|
return {
|
|
9
|
-
...(
|
|
10
|
-
HTMLAttributes: {}
|
|
9
|
+
...(_a = this.parent) == null ? void 0 : _a.call(this),
|
|
10
|
+
HTMLAttributes: {}
|
|
11
11
|
};
|
|
12
12
|
},
|
|
13
13
|
parseHTML() {
|
|
14
14
|
return this.options.levels.map((level) => ({
|
|
15
15
|
tag: `h${level}`,
|
|
16
|
-
attrs: { level }
|
|
16
|
+
attrs: { level }
|
|
17
17
|
}));
|
|
18
18
|
},
|
|
19
19
|
renderHTML({ node, HTMLAttributes }) {
|
|
20
20
|
return [
|
|
21
|
-
`h${
|
|
22
|
-
this.options.levels.includes(node.attrs.level)
|
|
23
|
-
? node.attrs.level
|
|
24
|
-
: this.options.levels[0]
|
|
25
|
-
}`,
|
|
21
|
+
`h${this.options.levels.includes(node.attrs.level) ? node.attrs.level : this.options.levels[0]}`,
|
|
26
22
|
mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
|
|
27
|
-
0
|
|
23
|
+
0
|
|
28
24
|
];
|
|
29
25
|
},
|
|
30
26
|
addCommands() {
|
|
31
27
|
return {
|
|
32
|
-
setCustomHeading:
|
|
33
|
-
(attributes)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
content.marks.forEach((mark) => {
|
|
45
|
-
mark.type.name === 'textStyle' &&
|
|
46
|
-
mark.attrs.fontSize &&
|
|
47
|
-
mark.attrs.fontSize !== null &&
|
|
48
|
-
(tr = tr.removeMark(pos, pos + node.nodeSize, mark.type));
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
}),
|
|
52
|
-
dispatch && dispatch(tr),
|
|
53
|
-
commands.setHeading({ level: attributes.level })
|
|
54
|
-
);
|
|
55
|
-
},
|
|
28
|
+
setCustomHeading: (attributes) => ({ tr, dispatch, commands }) => {
|
|
29
|
+
if (!this.options.levels.includes(attributes.level))
|
|
30
|
+
return !1;
|
|
31
|
+
const { selection } = tr, { from, to } = selection;
|
|
32
|
+
return tr.doc.nodesBetween(from, to, (node, pos) => {
|
|
33
|
+
node.isBlock && from >= pos && to <= pos + node.nodeSize && node.content.forEach((content) => {
|
|
34
|
+
content.marks.forEach((mark) => {
|
|
35
|
+
mark.type.name === "textStyle" && mark.attrs.fontSize && mark.attrs.fontSize !== null && (tr = tr.removeMark(pos, pos + node.nodeSize, mark.type));
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}), dispatch && dispatch(tr), commands.setHeading({ level: attributes.level });
|
|
39
|
+
}
|
|
56
40
|
};
|
|
57
|
-
}
|
|
41
|
+
}
|
|
58
42
|
});
|
|
59
|
-
export {
|
|
43
|
+
export {
|
|
44
|
+
CustomHeading
|
|
45
|
+
};
|
|
60
46
|
//# sourceMappingURL=heading.js.map
|
|
@@ -1,26 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3
|
-
const Highlight = require('@tiptap/extension-highlight'),
|
|
4
|
-
CustomHighlight = Highlight.extend({
|
|
5
|
-
name: 'customHighlight',
|
|
6
|
-
addOptions() {
|
|
7
|
-
var _a;
|
|
8
|
-
return {
|
|
9
|
-
...((_a = this.parent) == null ? void 0 : _a.call(this)),
|
|
10
|
-
multicolor: !0,
|
|
11
|
-
HTMLAttributes: {},
|
|
12
|
-
};
|
|
13
|
-
},
|
|
14
|
-
parseHTML() {
|
|
15
|
-
var _a;
|
|
16
|
-
return [
|
|
17
|
-
{
|
|
18
|
-
...((_a = this.parent) == null ? void 0 : _a.call(this)),
|
|
19
|
-
style: 'background-color',
|
|
20
|
-
getAttrs: (style) => ({ color: style }),
|
|
21
|
-
},
|
|
22
|
-
];
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
exports.CustomHighlight = CustomHighlight;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Highlight=require("@tiptap/extension-highlight"),CustomHighlight=Highlight.extend({name:"customHighlight",addOptions(){var _a;return{...(_a=this.parent)==null?void 0:_a.call(this),multicolor:!0,HTMLAttributes:{}}},parseHTML(){var _a;return[{...(_a=this.parent)==null?void 0:_a.call(this),style:"background-color",getAttrs:style=>({color:style})}]}});exports.CustomHighlight=CustomHighlight;
|
|
26
2
|
//# sourceMappingURL=highlight.cjs.map
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import Highlight from
|
|
1
|
+
import Highlight from "@tiptap/extension-highlight";
|
|
2
2
|
const CustomHighlight = Highlight.extend({
|
|
3
|
-
name:
|
|
3
|
+
name: "customHighlight",
|
|
4
4
|
addOptions() {
|
|
5
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
13
|
var _a;
|
|
14
14
|
return [
|
|
15
15
|
{
|
|
16
|
-
...(
|
|
17
|
-
style:
|
|
16
|
+
...(_a = this.parent) == null ? void 0 : _a.call(this),
|
|
17
|
+
style: "background-color",
|
|
18
18
|
getAttrs: (style) => ({
|
|
19
|
-
color: style
|
|
20
|
-
})
|
|
21
|
-
}
|
|
19
|
+
color: style
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
22
|
];
|
|
23
|
-
}
|
|
23
|
+
}
|
|
24
24
|
});
|
|
25
|
-
export {
|
|
25
|
+
export {
|
|
26
|
+
CustomHighlight
|
|
27
|
+
};
|
|
26
28
|
//# sourceMappingURL=highlight.js.map
|
|
@@ -1,48 +1,2 @@
|
|
|
1
|
-
|
|
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;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const extensionLink=require("@tiptap/extension-link"),Hyperlink=extensionLink.Link.extend({name:"hyperlink",parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])',getAttrs:node=>{if(node.getAttribute("data-id")&&node.getAttribute("data-app-prefix"))return!1}}]},addOptions(){var _a,_b;return{...(_a=this.parent)==null?void 0:_a.call(this),openOnClick:!1,HTMLAttributes:{...(_b=this.parent)==null?void 0:_b.call(this).HTMLAttributes,target:null}}},addAttributes(){var _a;return{...(_a=this.parent)==null?void 0:_a.call(this),target:{default:this.options.HTMLAttributes.target,parseHTML:element=>element.getAttribute("target")!=="_blank"?null:"_blank",renderHTML:attributes=>({target:attributes.target})},title:{default:this.options.HTMLAttributes.title}}}});exports.Hyperlink=Hyperlink;
|
|
48
2
|
//# sourceMappingURL=hyperlink.cjs.map
|
|
@@ -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,7 +32,4 @@ 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<
|
|
36
|
-
import('@tiptap/extension-link').LinkOptions,
|
|
37
|
-
any
|
|
38
|
-
>;
|
|
35
|
+
export declare const Hyperlink: import('@tiptap/core').Mark<import('@tiptap/extension-link').LinkOptions, any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Link } from
|
|
1
|
+
import { Link } from "@tiptap/extension-link";
|
|
2
2
|
const Hyperlink = Link.extend({
|
|
3
|
-
name:
|
|
3
|
+
name: "hyperlink",
|
|
4
4
|
parseHTML() {
|
|
5
5
|
return [
|
|
6
6
|
{
|
|
@@ -8,24 +8,21 @@ const Hyperlink = Link.extend({
|
|
|
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
10
|
getAttrs: (node) => {
|
|
11
|
-
if (
|
|
12
|
-
node.getAttribute('data-id') &&
|
|
13
|
-
node.getAttribute('data-app-prefix')
|
|
14
|
-
)
|
|
11
|
+
if (node.getAttribute("data-id") && node.getAttribute("data-app-prefix"))
|
|
15
12
|
return !1;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
18
15
|
];
|
|
19
16
|
},
|
|
20
17
|
addOptions() {
|
|
21
18
|
var _a, _b;
|
|
22
19
|
return {
|
|
23
|
-
...(
|
|
20
|
+
...(_a = this.parent) == null ? void 0 : _a.call(this),
|
|
24
21
|
openOnClick: !1,
|
|
25
22
|
HTMLAttributes: {
|
|
26
|
-
...(
|
|
27
|
-
target: null
|
|
28
|
-
}
|
|
23
|
+
...(_b = this.parent) == null ? void 0 : _b.call(this).HTMLAttributes,
|
|
24
|
+
target: null
|
|
25
|
+
}
|
|
29
26
|
};
|
|
30
27
|
},
|
|
31
28
|
/* Manage `title` and `target` attributes. */
|
|
@@ -33,23 +30,24 @@ const Hyperlink = Link.extend({
|
|
|
33
30
|
var _a;
|
|
34
31
|
return {
|
|
35
32
|
// Preserve attributes of parent extension...
|
|
36
|
-
...(
|
|
33
|
+
...(_a = this.parent) == null ? void 0 : _a.call(this),
|
|
37
34
|
// ...then add or override the following :
|
|
38
35
|
//------------------
|
|
39
36
|
target: {
|
|
40
37
|
default: this.options.HTMLAttributes.target,
|
|
41
38
|
// Sanitize target value
|
|
42
|
-
parseHTML: (element) =>
|
|
43
|
-
element.getAttribute('target') !== '_blank' ? null : '_blank',
|
|
39
|
+
parseHTML: (element) => element.getAttribute("target") !== "_blank" ? null : "_blank",
|
|
44
40
|
renderHTML: (attributes) => ({
|
|
45
|
-
target: attributes.target
|
|
46
|
-
})
|
|
41
|
+
target: attributes.target
|
|
42
|
+
})
|
|
47
43
|
},
|
|
48
44
|
title: {
|
|
49
|
-
default: this.options.HTMLAttributes.title
|
|
50
|
-
}
|
|
45
|
+
default: this.options.HTMLAttributes.title
|
|
46
|
+
}
|
|
51
47
|
};
|
|
52
|
-
}
|
|
48
|
+
}
|
|
53
49
|
});
|
|
54
|
-
export {
|
|
50
|
+
export {
|
|
51
|
+
Hyperlink
|
|
52
|
+
};
|
|
55
53
|
//# sourceMappingURL=hyperlink.js.map
|
package/dist/iframe/iframe.cjs
CHANGED
|
@@ -1,70 +1,2 @@
|
|
|
1
|
-
|
|
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;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core"),Iframe=core.Node.create({name:"iframe",group:"block",atom:!0,draggable:!0,addOptions(){return{allowFullscreen:!0,HTMLAttributes:{class:"iframe-wrapper"}}},addAttributes(){return{src:{default:null},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen},width:{renderHTML:attributes=>attributes.width?{width:attributes.width==="100%"?"100%":parseInt(attributes.width)}:{},parseHTML:element=>element.getAttribute("width")},height:{renderHTML:attributes=>attributes.height?{height:parseInt(attributes.height)}:{},parseHTML:element=>element.getAttribute("height")},style:{renderHTML:attributes=>attributes.style?{style:attributes.style}:{},parseHTML:element=>element.getAttribute("style")}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes}){return["div",this.options.HTMLAttributes,["iframe",HTMLAttributes]]},addCommands(){return{setIframe:options=>({tr,dispatch})=>{const{selection}=tr,node=this.type.create(options);return dispatch&&tr.replaceRangeWith(selection.from,selection.to,node),!0}}}});exports.Iframe=Iframe;
|
|
70
2
|
//# sourceMappingURL=iframe.cjs.map
|
package/dist/iframe/iframe.d.ts
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
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
|
-
|
|
9
|
+
interface Commands<ReturnType> {
|
|
10
|
+
iframe: {
|
|
11
|
+
/**
|
|
12
|
+
* Add an iframe
|
|
13
|
+
*/
|
|
14
|
+
setIframe: (options: {
|
|
15
|
+
src: string;
|
|
16
|
+
}) => ReturnType;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
17
19
|
}
|
|
18
20
|
export declare const Iframe: Node<IframeOptions, any>;
|