payload-richtext-tiptap 0.0.52 → 0.0.53
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/src/fields/TiptapEditor/extensions/ImageBlock/ImageBlock.d.ts +2 -0
- package/dist/src/fields/TiptapEditor/extensions/ImageBlock/ImageBlock.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/ImageBlock/ImageBlock.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/ImageUpload/view/ImageUpload.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/ImageUpload/view/ImageUpload.js +29 -16
- package/dist/src/fields/TiptapEditor/extensions/ImageUpload/view/ImageUpload.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/VideoBlock.d.ts +5 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/VideoBlock.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/VideoBlock.js +23 -2
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/VideoBlock.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockMenu.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockMenu.js +23 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockMenu.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockView.d.ts +17 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockView.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockView.js +47 -12
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/VideoBlockView.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/VideoPlayer.d.ts +10 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/VideoPlayer.d.ts.map +1 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/VideoPlayer.js +45 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/VideoPlayer.js.map +1 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/components/QualityOption.d.ts +12 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/components/QualityOption.d.ts.map +1 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/components/QualityOption.js +34 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/components/QualityOption.js.map +1 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/components/QualitySelector.d.ts +22 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/components/QualitySelector.d.ts.map +1 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/components/QualitySelector.js +78 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/components/QualitySelector.js.map +1 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/events.d.ts +10 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/events.d.ts.map +1 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/events.js +10 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/events.js.map +1 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/index.d.ts +3 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/index.d.ts.map +1 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/index.js +52 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/index.js.map +1 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/middleware/SourceInterceptor.d.ts +2 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/middleware/SourceInterceptor.d.ts.map +1 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/middleware/SourceInterceptor.js +35 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/middleware/SourceInterceptor.js.map +1 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/util/SafeSeek.d.ts +16 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/util/SafeSeek.d.ts.map +1 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/util/SafeSeek.js +72 -0
- package/dist/src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/util/SafeSeek.js.map +1 -0
- package/dist/src/fields/TiptapEditor/extensions/extension-kit.d.ts +1 -1
- package/dist/src/fields/TiptapEditor/features/BlockEditor/BlockEditor.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/features/BlockEditor/BlockEditor.js +5 -0
- package/dist/src/fields/TiptapEditor/features/BlockEditor/BlockEditor.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/ai-draft-selector-commands.d.ts +1 -1
- package/dist/src/fields/TiptapEditor/lib/extract.d.ts +1 -0
- package/dist/src/fields/TiptapEditor/lib/extract.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/lib/extract.js +8 -1
- package/dist/src/fields/TiptapEditor/lib/extract.js.map +1 -1
- package/dist/src/fields/TiptapEditor/types.d.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/styles.css +63 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +196 -189
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default function QualityOption(videojs: any): {
|
|
2
|
+
new (player: any, options: any): {
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
source: any;
|
|
5
|
+
/**
|
|
6
|
+
* @inheritdoc
|
|
7
|
+
*/
|
|
8
|
+
handleClick(event: any): void;
|
|
9
|
+
};
|
|
10
|
+
[x: string]: any;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=QualityOption.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QualityOption.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/components/QualityOption.js"],"names":[],"mappings":"AAGA;;;;QAmCI;;WAEG;;;;EAMN"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as events from "../events.js";
|
|
2
|
+
import _ from "underscore";
|
|
3
|
+
export default function QualityOption(videojs) {
|
|
4
|
+
var MenuItem = videojs.getComponent("MenuItem");
|
|
5
|
+
/**
|
|
6
|
+
* A MenuItem to represent a video resolution
|
|
7
|
+
*
|
|
8
|
+
* @class QualityOption
|
|
9
|
+
* @extends videojs.MenuItem
|
|
10
|
+
*/ return class QualityOption extends MenuItem {
|
|
11
|
+
/**
|
|
12
|
+
* @inheritdoc
|
|
13
|
+
*/ constructor(player, options){
|
|
14
|
+
var source = options.source;
|
|
15
|
+
if (!_.isObject(source)) {
|
|
16
|
+
throw new Error('was not provided a "source" object, but rather: ' + typeof source);
|
|
17
|
+
}
|
|
18
|
+
options = _.extend({
|
|
19
|
+
selectable: true,
|
|
20
|
+
label: source.label
|
|
21
|
+
}, options);
|
|
22
|
+
super(player, options);
|
|
23
|
+
this.source = source;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @inheritdoc
|
|
27
|
+
*/ handleClick(event) {
|
|
28
|
+
super.handleClick(event);
|
|
29
|
+
this.player().trigger(events.QUALITY_REQUESTED, this.source);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=QualityOption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/components/QualityOption.js"],"sourcesContent":["import * as events from \"../events.js\";\nimport _ from \"underscore\";\n\nexport default function QualityOption(videojs) {\n var MenuItem = videojs.getComponent(\"MenuItem\");\n\n /**\n * A MenuItem to represent a video resolution\n *\n * @class QualityOption\n * @extends videojs.MenuItem\n */\n return class QualityOption extends MenuItem {\n /**\n * @inheritdoc\n */\n constructor(player, options) {\n var source = options.source;\n\n if (!_.isObject(source)) {\n throw new Error(\n 'was not provided a \"source\" object, but rather: ' + typeof source\n );\n }\n\n options = _.extend(\n {\n selectable: true,\n label: source.label,\n },\n options\n );\n\n super(player, options);\n\n this.source = source;\n }\n\n /**\n * @inheritdoc\n */\n handleClick(event) {\n super.handleClick(event);\n this.player().trigger(events.QUALITY_REQUESTED, this.source);\n }\n };\n}\n"],"names":["events","_","QualityOption","videojs","MenuItem","getComponent","constructor","player","options","source","isObject","Error","extend","selectable","label","handleClick","event","trigger","QUALITY_REQUESTED"],"mappings":"AAAA,YAAYA,YAAY,eAAe;AACvC,OAAOC,OAAO,aAAa;AAE3B,eAAe,SAASC,cAAcC,OAAO;IAC3C,IAAIC,WAAWD,QAAQE,YAAY,CAAC;IAEpC;;;;;GAKC,GACD,OAAO,MAAMH,sBAAsBE;QACjC;;KAEC,GACDE,YAAYC,MAAM,EAAEC,OAAO,CAAE;YAC3B,IAAIC,SAASD,QAAQC,MAAM;YAE3B,IAAI,CAACR,EAAES,QAAQ,CAACD,SAAS;gBACvB,MAAM,IAAIE,MACR,qDAAqD,OAAOF;YAEhE;YAEAD,UAAUP,EAAEW,MAAM,CAChB;gBACEC,YAAY;gBACZC,OAAOL,OAAOK,KAAK;YACrB,GACAN;YAGF,KAAK,CAACD,QAAQC;YAEd,IAAI,CAACC,MAAM,GAAGA;QAChB;QAEA;;KAEC,GACDM,YAAYC,KAAK,EAAE;YACjB,KAAK,CAACD,YAAYC;YAClB,IAAI,CAACT,MAAM,GAAGU,OAAO,CAACjB,OAAOkB,iBAAiB,EAAE,IAAI,CAACT,MAAM;QAC7D;IACF;AACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export default function QualitySelector(videojs: any): {
|
|
2
|
+
new (player: any, options: any): {
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
/**
|
|
5
|
+
* Updates the source that is selected in the menu
|
|
6
|
+
*
|
|
7
|
+
* @param source {object} player source to display as selected
|
|
8
|
+
*/
|
|
9
|
+
setSelectedSource(source: object): void;
|
|
10
|
+
selectedSrc: any;
|
|
11
|
+
/**
|
|
12
|
+
* @inheritdoc
|
|
13
|
+
*/
|
|
14
|
+
createItems(): any;
|
|
15
|
+
/**
|
|
16
|
+
* @inheritdoc
|
|
17
|
+
*/
|
|
18
|
+
buildWrapperCSSClass(): string;
|
|
19
|
+
};
|
|
20
|
+
[x: string]: any;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=QualitySelector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QualitySelector.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/components/QualitySelector.js"],"names":[],"mappings":"AAOA;;;QA2DI;;;;WAIG;kCADe,MAAM;;QAaxB;;WAEG;;QAoBH;;WAEG;;;;EASN"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import * as events from "../events.js";
|
|
2
|
+
import _ from "underscore";
|
|
3
|
+
import { default as qualityOptionFactory } from "./QualityOption.js";
|
|
4
|
+
const QUALITY_CHANGE_CLASS = "vjs-quality-changing";
|
|
5
|
+
export default function QualitySelector(videojs) {
|
|
6
|
+
var MenuButton = videojs.getComponent("MenuButton"), QualityOption = qualityOptionFactory(videojs);
|
|
7
|
+
/**
|
|
8
|
+
* A component for changing video resolutions
|
|
9
|
+
*
|
|
10
|
+
* @class QualitySelector
|
|
11
|
+
* @extends videojs.Button
|
|
12
|
+
*/ class QualitySelector extends MenuButton {
|
|
13
|
+
/**
|
|
14
|
+
* @inheritdoc
|
|
15
|
+
*/ constructor(player, options){
|
|
16
|
+
super(player, options);
|
|
17
|
+
// Update interface instantly so the user's change is acknowledged
|
|
18
|
+
player.on(events.QUALITY_REQUESTED, (function(event, newSource) {
|
|
19
|
+
this.setSelectedSource(newSource);
|
|
20
|
+
player.addClass(QUALITY_CHANGE_CLASS);
|
|
21
|
+
player.one("loadeddata", function() {
|
|
22
|
+
player.removeClass(QUALITY_CHANGE_CLASS);
|
|
23
|
+
});
|
|
24
|
+
}).bind(this));
|
|
25
|
+
// Update the list of menu items only when the list of sources change
|
|
26
|
+
player.on(events.PLAYER_SOURCES_CHANGED, (function() {
|
|
27
|
+
this.update();
|
|
28
|
+
}).bind(this));
|
|
29
|
+
player.on(events.QUALITY_SELECTED, (function(event, newSource) {
|
|
30
|
+
// Update the selected source with the source that was actually selected
|
|
31
|
+
this.setSelectedSource(newSource);
|
|
32
|
+
}).bind(this));
|
|
33
|
+
// Since it's possible for the player to get a source before the selector is
|
|
34
|
+
// created, make sure to update once we get a "ready" signal.
|
|
35
|
+
player.one("ready", (function() {
|
|
36
|
+
this.selectedSrc = player.src();
|
|
37
|
+
this.update();
|
|
38
|
+
}).bind(this));
|
|
39
|
+
this.controlText("Open quality selector menu");
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Updates the source that is selected in the menu
|
|
43
|
+
*
|
|
44
|
+
* @param source {object} player source to display as selected
|
|
45
|
+
*/ setSelectedSource(source) {
|
|
46
|
+
var src = source ? source.src : undefined;
|
|
47
|
+
if (this.selectedSrc !== src) {
|
|
48
|
+
this.selectedSrc = src;
|
|
49
|
+
_.each(this.items, function(item) {
|
|
50
|
+
item.selected(item.source.src === src);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* @inheritdoc
|
|
56
|
+
*/ createItems() {
|
|
57
|
+
var player = this.player(), sources = player.currentSources();
|
|
58
|
+
if (!sources || sources.length < 2) {
|
|
59
|
+
return [];
|
|
60
|
+
}
|
|
61
|
+
return _.map(sources, (function(source) {
|
|
62
|
+
return new QualityOption(player, {
|
|
63
|
+
source: source,
|
|
64
|
+
selected: source.src === this.selectedSrc
|
|
65
|
+
});
|
|
66
|
+
}).bind(this));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @inheritdoc
|
|
70
|
+
*/ buildWrapperCSSClass() {
|
|
71
|
+
return "vjs-quality-selector " + super.buildWrapperCSSClass();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
videojs.registerComponent("QualitySelector", QualitySelector);
|
|
75
|
+
return QualitySelector;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=QualitySelector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/components/QualitySelector.js"],"sourcesContent":["import * as events from \"../events.js\";\nimport _ from \"underscore\";\n\nimport { default as qualityOptionFactory } from \"./QualityOption.js\";\n\nconst QUALITY_CHANGE_CLASS = \"vjs-quality-changing\";\n\nexport default function QualitySelector(videojs) {\n var MenuButton = videojs.getComponent(\"MenuButton\"),\n QualityOption = qualityOptionFactory(videojs);\n\n /**\n * A component for changing video resolutions\n *\n * @class QualitySelector\n * @extends videojs.Button\n */\n class QualitySelector extends MenuButton {\n /**\n * @inheritdoc\n */\n constructor(player, options) {\n super(player, options);\n\n // Update interface instantly so the user's change is acknowledged\n player.on(\n events.QUALITY_REQUESTED,\n function (event, newSource) {\n this.setSelectedSource(newSource);\n player.addClass(QUALITY_CHANGE_CLASS);\n\n player.one(\"loadeddata\", function () {\n player.removeClass(QUALITY_CHANGE_CLASS);\n });\n }.bind(this)\n );\n\n // Update the list of menu items only when the list of sources change\n player.on(\n events.PLAYER_SOURCES_CHANGED,\n function () {\n this.update();\n }.bind(this)\n );\n\n player.on(\n events.QUALITY_SELECTED,\n function (event, newSource) {\n // Update the selected source with the source that was actually selected\n this.setSelectedSource(newSource);\n }.bind(this)\n );\n\n // Since it's possible for the player to get a source before the selector is\n // created, make sure to update once we get a \"ready\" signal.\n player.one(\n \"ready\",\n function () {\n this.selectedSrc = player.src();\n this.update();\n }.bind(this)\n );\n\n this.controlText(\"Open quality selector menu\");\n }\n\n /**\n * Updates the source that is selected in the menu\n *\n * @param source {object} player source to display as selected\n */\n setSelectedSource(source) {\n var src = source ? source.src : undefined;\n\n if (this.selectedSrc !== src) {\n this.selectedSrc = src;\n _.each(this.items, function (item) {\n item.selected(item.source.src === src);\n });\n }\n }\n\n /**\n * @inheritdoc\n */\n createItems() {\n var player = this.player(),\n sources = player.currentSources();\n\n if (!sources || sources.length < 2) {\n return [];\n }\n\n return _.map(\n sources,\n function (source) {\n return new QualityOption(player, {\n source: source,\n selected: source.src === this.selectedSrc,\n });\n }.bind(this)\n );\n }\n\n /**\n * @inheritdoc\n */\n buildWrapperCSSClass() {\n return \"vjs-quality-selector \" + super.buildWrapperCSSClass();\n }\n }\n\n videojs.registerComponent(\"QualitySelector\", QualitySelector);\n\n return QualitySelector;\n}\n"],"names":["events","_","default","qualityOptionFactory","QUALITY_CHANGE_CLASS","QualitySelector","videojs","MenuButton","getComponent","QualityOption","constructor","player","options","on","QUALITY_REQUESTED","event","newSource","setSelectedSource","addClass","one","removeClass","bind","PLAYER_SOURCES_CHANGED","update","QUALITY_SELECTED","selectedSrc","src","controlText","source","undefined","each","items","item","selected","createItems","sources","currentSources","length","map","buildWrapperCSSClass","registerComponent"],"mappings":"AAAA,YAAYA,YAAY,eAAe;AACvC,OAAOC,OAAO,aAAa;AAE3B,SAASC,WAAWC,oBAAoB,QAAQ,qBAAqB;AAErE,MAAMC,uBAAuB;AAE7B,eAAe,SAASC,gBAAgBC,OAAO;IAC7C,IAAIC,aAAaD,QAAQE,YAAY,CAAC,eACpCC,gBAAgBN,qBAAqBG;IAEvC;;;;;GAKC,GACD,MAAMD,wBAAwBE;QAC5B;;KAEC,GACDG,YAAYC,MAAM,EAAEC,OAAO,CAAE;YAC3B,KAAK,CAACD,QAAQC;YAEd,kEAAkE;YAClED,OAAOE,EAAE,CACPb,OAAOc,iBAAiB,EACxB,CAAA,SAAUC,KAAK,EAAEC,SAAS;gBACxB,IAAI,CAACC,iBAAiB,CAACD;gBACvBL,OAAOO,QAAQ,CAACd;gBAEhBO,OAAOQ,GAAG,CAAC,cAAc;oBACvBR,OAAOS,WAAW,CAAChB;gBACrB;YACF,CAAA,EAAEiB,IAAI,CAAC,IAAI;YAGb,qEAAqE;YACrEV,OAAOE,EAAE,CACPb,OAAOsB,sBAAsB,EAC7B,CAAA;gBACE,IAAI,CAACC,MAAM;YACb,CAAA,EAAEF,IAAI,CAAC,IAAI;YAGbV,OAAOE,EAAE,CACPb,OAAOwB,gBAAgB,EACvB,CAAA,SAAUT,KAAK,EAAEC,SAAS;gBACxB,wEAAwE;gBACxE,IAAI,CAACC,iBAAiB,CAACD;YACzB,CAAA,EAAEK,IAAI,CAAC,IAAI;YAGb,4EAA4E;YAC5E,6DAA6D;YAC7DV,OAAOQ,GAAG,CACR,SACA,CAAA;gBACE,IAAI,CAACM,WAAW,GAAGd,OAAOe,GAAG;gBAC7B,IAAI,CAACH,MAAM;YACb,CAAA,EAAEF,IAAI,CAAC,IAAI;YAGb,IAAI,CAACM,WAAW,CAAC;QACnB;QAEA;;;;KAIC,GACDV,kBAAkBW,MAAM,EAAE;YACxB,IAAIF,MAAME,SAASA,OAAOF,GAAG,GAAGG;YAEhC,IAAI,IAAI,CAACJ,WAAW,KAAKC,KAAK;gBAC5B,IAAI,CAACD,WAAW,GAAGC;gBACnBzB,EAAE6B,IAAI,CAAC,IAAI,CAACC,KAAK,EAAE,SAAUC,IAAI;oBAC/BA,KAAKC,QAAQ,CAACD,KAAKJ,MAAM,CAACF,GAAG,KAAKA;gBACpC;YACF;QACF;QAEA;;KAEC,GACDQ,cAAc;YACZ,IAAIvB,SAAS,IAAI,CAACA,MAAM,IACtBwB,UAAUxB,OAAOyB,cAAc;YAEjC,IAAI,CAACD,WAAWA,QAAQE,MAAM,GAAG,GAAG;gBAClC,OAAO,EAAE;YACX;YAEA,OAAOpC,EAAEqC,GAAG,CACVH,SACA,CAAA,SAAUP,MAAM;gBACd,OAAO,IAAInB,cAAcE,QAAQ;oBAC/BiB,QAAQA;oBACRK,UAAUL,OAAOF,GAAG,KAAK,IAAI,CAACD,WAAW;gBAC3C;YACF,CAAA,EAAEJ,IAAI,CAAC,IAAI;QAEf;QAEA;;KAEC,GACDkB,uBAAuB;YACrB,OAAO,0BAA0B,KAAK,CAACA;QACzC;IACF;IAEAjC,QAAQkC,iBAAiB,CAAC,mBAAmBnC;IAE7C,OAAOA;AACT"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const QUALITY_REQUESTED: "qualityRequested";
|
|
2
|
+
export const QUALITY_SELECTED: "qualitySelected";
|
|
3
|
+
export const PLAYER_SOURCES_CHANGED: "playerSourcesChanged";
|
|
4
|
+
declare namespace _default {
|
|
5
|
+
export { QUALITY_REQUESTED };
|
|
6
|
+
export { QUALITY_SELECTED };
|
|
7
|
+
export { PLAYER_SOURCES_CHANGED };
|
|
8
|
+
}
|
|
9
|
+
export default _default;
|
|
10
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/events.js"],"names":[],"mappings":"AAAA,mDAAoD;AACpD,iDAAkD;AAClD,4DAA6D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const QUALITY_REQUESTED = "qualityRequested";
|
|
2
|
+
export const QUALITY_SELECTED = "qualitySelected";
|
|
3
|
+
export const PLAYER_SOURCES_CHANGED = "playerSourcesChanged";
|
|
4
|
+
export default {
|
|
5
|
+
QUALITY_REQUESTED,
|
|
6
|
+
QUALITY_SELECTED,
|
|
7
|
+
PLAYER_SOURCES_CHANGED
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/events.js"],"sourcesContent":["export const QUALITY_REQUESTED = \"qualityRequested\";\nexport const QUALITY_SELECTED = \"qualitySelected\";\nexport const PLAYER_SOURCES_CHANGED = \"playerSourcesChanged\";\n\nexport default {\n QUALITY_REQUESTED,\n QUALITY_SELECTED,\n PLAYER_SOURCES_CHANGED,\n};\n"],"names":["QUALITY_REQUESTED","QUALITY_SELECTED","PLAYER_SOURCES_CHANGED"],"mappings":"AAAA,OAAO,MAAMA,oBAAoB,mBAAmB;AACpD,OAAO,MAAMC,mBAAmB,kBAAkB;AAClD,OAAO,MAAMC,yBAAyB,uBAAuB;AAE7D,eAAe;IACbF;IACAC;IACAC;AACF,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,OAAO,MAAM,UAAU,CAAC;AACpC,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,QAyD/C"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import _ from "underscore";
|
|
2
|
+
import * as events from "./events.js";
|
|
3
|
+
import { default as qualitySelectorFactory } from "./components/QualitySelector.js";
|
|
4
|
+
import { default as sourceInterceptorFactory } from "./middleware/SourceInterceptor.js";
|
|
5
|
+
import SafeSeek from "./util/SafeSeek.js";
|
|
6
|
+
export function QualitySelector(videojs) {
|
|
7
|
+
qualitySelectorFactory(videojs);
|
|
8
|
+
sourceInterceptorFactory(videojs);
|
|
9
|
+
videojs.hook("setup", function(player) {
|
|
10
|
+
function changeQuality(event, newSource) {
|
|
11
|
+
var sources = player.currentSources(), currentTime = player.currentTime(), currentPlaybackRate = player.playbackRate(), isPaused = player.paused(), selectedSource;
|
|
12
|
+
// Clear out any previously selected sources (see: #11)
|
|
13
|
+
_.each(sources, function(source) {
|
|
14
|
+
source.selected = false;
|
|
15
|
+
});
|
|
16
|
+
selectedSource = _.findWhere(sources, {
|
|
17
|
+
src: newSource.src
|
|
18
|
+
});
|
|
19
|
+
// Note: `_.findWhere` returns a reference to an object. Thus the
|
|
20
|
+
// following updates the original object in `sources`.
|
|
21
|
+
selectedSource.selected = true;
|
|
22
|
+
if (player._qualitySelectorSafeSeek) {
|
|
23
|
+
player._qualitySelectorSafeSeek.onQualitySelectionChange();
|
|
24
|
+
}
|
|
25
|
+
player.src(sources);
|
|
26
|
+
player.ready(function() {
|
|
27
|
+
if (!player._qualitySelectorSafeSeek || player._qualitySelectorSafeSeek.hasFinished()) {
|
|
28
|
+
// Either we don't have a pending seek action or the one that we have is no
|
|
29
|
+
// longer applicable. This block must be within a `player.ready` callback
|
|
30
|
+
// because the call to `player.src` above is asynchronous, and so not
|
|
31
|
+
// having it within this `ready` callback would cause the SourceInterceptor
|
|
32
|
+
// to execute after this block instead of before.
|
|
33
|
+
//
|
|
34
|
+
// We save the `currentTime` within the SafeSeek instance because if
|
|
35
|
+
// multiple QUALITY_REQUESTED events are received before the SafeSeek
|
|
36
|
+
// operation finishes, the player's `currentTime` will be `0` if the
|
|
37
|
+
// player's `src` is updated but the player's `currentTime` has not yet
|
|
38
|
+
// been set by the SafeSeek operation.
|
|
39
|
+
player._qualitySelectorSafeSeek = new SafeSeek(player, currentTime);
|
|
40
|
+
player.playbackRate(currentPlaybackRate);
|
|
41
|
+
}
|
|
42
|
+
if (!isPaused) {
|
|
43
|
+
player.play();
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
// Add handler to switch sources when the user requests a change
|
|
48
|
+
player.on(events.QUALITY_REQUESTED, changeQuality);
|
|
49
|
+
});
|
|
50
|
+
} //export const EVENTS = events;
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/index.ts"],"sourcesContent":["import _ from \"underscore\";\nimport * as events from \"./events.js\";\nimport { default as qualitySelectorFactory } from \"./components/QualitySelector.js\";\nimport { default as sourceInterceptorFactory } from \"./middleware/SourceInterceptor.js\";\nimport SafeSeek from \"./util/SafeSeek.js\";\nimport type videojs from \"video.js\";\nexport function QualitySelector(videojs: videojs) {\n qualitySelectorFactory(videojs);\n sourceInterceptorFactory(videojs);\n\n videojs.hook(\"setup\", function (player: videojs.Player) {\n function changeQuality(event: any, newSource: { src: any }) {\n var sources = player.currentSources(),\n currentTime = player.currentTime(),\n currentPlaybackRate = player.playbackRate(),\n isPaused = player.paused(),\n selectedSource;\n\n // Clear out any previously selected sources (see: #11)\n _.each(sources, function (source) {\n source.selected = false;\n });\n\n selectedSource = _.findWhere(sources, { src: newSource.src });\n // Note: `_.findWhere` returns a reference to an object. Thus the\n // following updates the original object in `sources`.\n selectedSource.selected = true;\n\n if (player._qualitySelectorSafeSeek) {\n player._qualitySelectorSafeSeek.onQualitySelectionChange();\n }\n\n player.src(sources);\n\n player.ready(function () {\n if (\n !player._qualitySelectorSafeSeek ||\n player._qualitySelectorSafeSeek.hasFinished()\n ) {\n // Either we don't have a pending seek action or the one that we have is no\n // longer applicable. This block must be within a `player.ready` callback\n // because the call to `player.src` above is asynchronous, and so not\n // having it within this `ready` callback would cause the SourceInterceptor\n // to execute after this block instead of before.\n //\n // We save the `currentTime` within the SafeSeek instance because if\n // multiple QUALITY_REQUESTED events are received before the SafeSeek\n // operation finishes, the player's `currentTime` will be `0` if the\n // player's `src` is updated but the player's `currentTime` has not yet\n // been set by the SafeSeek operation.\n player._qualitySelectorSafeSeek = new SafeSeek(player, currentTime);\n player.playbackRate(currentPlaybackRate);\n }\n\n if (!isPaused) {\n player.play();\n }\n });\n }\n\n // Add handler to switch sources when the user requests a change\n player.on(events.QUALITY_REQUESTED, changeQuality);\n });\n}\n\n//export const EVENTS = events;\n"],"names":["_","events","default","qualitySelectorFactory","sourceInterceptorFactory","SafeSeek","QualitySelector","videojs","hook","player","changeQuality","event","newSource","sources","currentSources","currentTime","currentPlaybackRate","playbackRate","isPaused","paused","selectedSource","each","source","selected","findWhere","src","_qualitySelectorSafeSeek","onQualitySelectionChange","ready","hasFinished","play","on","QUALITY_REQUESTED"],"mappings":"AAAA,OAAOA,OAAO,aAAa;AAC3B,YAAYC,YAAY,cAAc;AACtC,SAASC,WAAWC,sBAAsB,QAAQ,kCAAkC;AACpF,SAASD,WAAWE,wBAAwB,QAAQ,oCAAoC;AACxF,OAAOC,cAAc,qBAAqB;AAE1C,OAAO,SAASC,gBAAgBC,OAAgB;IAC9CJ,uBAAuBI;IACvBH,yBAAyBG;IAEzBA,QAAQC,IAAI,CAAC,SAAS,SAAUC,MAAsB;QACpD,SAASC,cAAcC,KAAU,EAAEC,SAAuB;YACxD,IAAIC,UAAUJ,OAAOK,cAAc,IACjCC,cAAcN,OAAOM,WAAW,IAChCC,sBAAsBP,OAAOQ,YAAY,IACzCC,WAAWT,OAAOU,MAAM,IACxBC;YAEF,uDAAuD;YACvDpB,EAAEqB,IAAI,CAACR,SAAS,SAAUS,MAAM;gBAC9BA,OAAOC,QAAQ,GAAG;YACpB;YAEAH,iBAAiBpB,EAAEwB,SAAS,CAACX,SAAS;gBAAEY,KAAKb,UAAUa,GAAG;YAAC;YAC3D,iEAAiE;YACjE,sDAAsD;YACtDL,eAAeG,QAAQ,GAAG;YAE1B,IAAId,OAAOiB,wBAAwB,EAAE;gBACnCjB,OAAOiB,wBAAwB,CAACC,wBAAwB;YAC1D;YAEAlB,OAAOgB,GAAG,CAACZ;YAEXJ,OAAOmB,KAAK,CAAC;gBACX,IACE,CAACnB,OAAOiB,wBAAwB,IAChCjB,OAAOiB,wBAAwB,CAACG,WAAW,IAC3C;oBACA,2EAA2E;oBAC3E,yEAAyE;oBACzE,qEAAqE;oBACrE,2EAA2E;oBAC3E,iDAAiD;oBACjD,EAAE;oBACF,oEAAoE;oBACpE,qEAAqE;oBACrE,oEAAoE;oBACpE,uEAAuE;oBACvE,sCAAsC;oBACtCpB,OAAOiB,wBAAwB,GAAG,IAAIrB,SAASI,QAAQM;oBACvDN,OAAOQ,YAAY,CAACD;gBACtB;gBAEA,IAAI,CAACE,UAAU;oBACbT,OAAOqB,IAAI;gBACb;YACF;QACF;QAEA,gEAAgE;QAChErB,OAAOsB,EAAE,CAAC9B,OAAO+B,iBAAiB,EAAEtB;IACtC;AACF,EAEA,+BAA+B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SourceInterceptor.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/middleware/SourceInterceptor.js"],"names":[],"mappings":"AAGA,8DA2CC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import _ from "underscore";
|
|
2
|
+
import * as events from "../events.js";
|
|
3
|
+
export default function SourceInterceptor(videojs) {
|
|
4
|
+
videojs.use("*", function(player) {
|
|
5
|
+
return {
|
|
6
|
+
setSource: function(playerSelectedSource, next) {
|
|
7
|
+
var sources = player.currentSources(), userSelectedSource, chosenSource;
|
|
8
|
+
if (player._qualitySelectorSafeSeek) {
|
|
9
|
+
player._qualitySelectorSafeSeek.onPlayerSourcesChange();
|
|
10
|
+
}
|
|
11
|
+
if (!_.isEqual(sources, player._qualitySelectorPreviousSources)) {
|
|
12
|
+
player.trigger(events.PLAYER_SOURCES_CHANGED, sources);
|
|
13
|
+
player._qualitySelectorPreviousSources = sources;
|
|
14
|
+
}
|
|
15
|
+
// There are generally two source options, the one that videojs
|
|
16
|
+
// auto-selects and the one that a "user" of this plugin has
|
|
17
|
+
// supplied via the `selected` property. `selected` can come from
|
|
18
|
+
// either the `<source>` tag or the list of sources passed to
|
|
19
|
+
// videojs using `src()`.
|
|
20
|
+
userSelectedSource = _.find(sources, function(source) {
|
|
21
|
+
// Must check for boolean values as well as either the string 'true' or
|
|
22
|
+
// 'selected'. When sources are set programmatically, the value will be a
|
|
23
|
+
// boolean, but those coming from a `<source>` tag will be a string.
|
|
24
|
+
return source.selected === true || source.selected === "true" || source.selected === "selected";
|
|
25
|
+
});
|
|
26
|
+
chosenSource = userSelectedSource || playerSelectedSource;
|
|
27
|
+
player.trigger(events.QUALITY_SELECTED, chosenSource);
|
|
28
|
+
// Pass along the chosen source
|
|
29
|
+
next(null, chosenSource);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=SourceInterceptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/middleware/SourceInterceptor.js"],"sourcesContent":["import _ from \"underscore\";\nimport * as events from \"../events.js\";\n\nexport default function SourceInterceptor(videojs) {\n videojs.use(\"*\", function (player) {\n return {\n setSource: function (playerSelectedSource, next) {\n var sources = player.currentSources(),\n userSelectedSource,\n chosenSource;\n\n if (player._qualitySelectorSafeSeek) {\n player._qualitySelectorSafeSeek.onPlayerSourcesChange();\n }\n\n if (!_.isEqual(sources, player._qualitySelectorPreviousSources)) {\n player.trigger(events.PLAYER_SOURCES_CHANGED, sources);\n player._qualitySelectorPreviousSources = sources;\n }\n\n // There are generally two source options, the one that videojs\n // auto-selects and the one that a \"user\" of this plugin has\n // supplied via the `selected` property. `selected` can come from\n // either the `<source>` tag or the list of sources passed to\n // videojs using `src()`.\n\n userSelectedSource = _.find(sources, function (source) {\n // Must check for boolean values as well as either the string 'true' or\n // 'selected'. When sources are set programmatically, the value will be a\n // boolean, but those coming from a `<source>` tag will be a string.\n return (\n source.selected === true ||\n source.selected === \"true\" ||\n source.selected === \"selected\"\n );\n });\n\n chosenSource = userSelectedSource || playerSelectedSource;\n\n player.trigger(events.QUALITY_SELECTED, chosenSource);\n\n // Pass along the chosen source\n next(null, chosenSource);\n },\n };\n });\n}\n"],"names":["_","events","SourceInterceptor","videojs","use","player","setSource","playerSelectedSource","next","sources","currentSources","userSelectedSource","chosenSource","_qualitySelectorSafeSeek","onPlayerSourcesChange","isEqual","_qualitySelectorPreviousSources","trigger","PLAYER_SOURCES_CHANGED","find","source","selected","QUALITY_SELECTED"],"mappings":"AAAA,OAAOA,OAAO,aAAa;AAC3B,YAAYC,YAAY,eAAe;AAEvC,eAAe,SAASC,kBAAkBC,OAAO;IAC/CA,QAAQC,GAAG,CAAC,KAAK,SAAUC,MAAM;QAC/B,OAAO;YACLC,WAAW,SAAUC,oBAAoB,EAAEC,IAAI;gBAC7C,IAAIC,UAAUJ,OAAOK,cAAc,IACjCC,oBACAC;gBAEF,IAAIP,OAAOQ,wBAAwB,EAAE;oBACnCR,OAAOQ,wBAAwB,CAACC,qBAAqB;gBACvD;gBAEA,IAAI,CAACd,EAAEe,OAAO,CAACN,SAASJ,OAAOW,+BAA+B,GAAG;oBAC/DX,OAAOY,OAAO,CAAChB,OAAOiB,sBAAsB,EAAET;oBAC9CJ,OAAOW,+BAA+B,GAAGP;gBAC3C;gBAEA,+DAA+D;gBAC/D,4DAA4D;gBAC5D,iEAAiE;gBACjE,6DAA6D;gBAC7D,yBAAyB;gBAEzBE,qBAAqBX,EAAEmB,IAAI,CAACV,SAAS,SAAUW,MAAM;oBACnD,uEAAuE;oBACvE,yEAAyE;oBACzE,oEAAoE;oBACpE,OACEA,OAAOC,QAAQ,KAAK,QACpBD,OAAOC,QAAQ,KAAK,UACpBD,OAAOC,QAAQ,KAAK;gBAExB;gBAEAT,eAAeD,sBAAsBJ;gBAErCF,OAAOY,OAAO,CAAChB,OAAOqB,gBAAgB,EAAEV;gBAExC,+BAA+B;gBAC/BJ,KAAK,MAAMI;YACb;QACF;IACF;AACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default SafeSeek;
|
|
2
|
+
declare class SafeSeek {
|
|
3
|
+
constructor(player: any, seekToTime: any);
|
|
4
|
+
_player: any;
|
|
5
|
+
_seekToTime: any;
|
|
6
|
+
_hasFinished: boolean;
|
|
7
|
+
_keepThisInstanceWhenPlayerSourcesChange: boolean;
|
|
8
|
+
_seekWhenSafe(): void;
|
|
9
|
+
_seekFn: any;
|
|
10
|
+
onPlayerSourcesChange(): void;
|
|
11
|
+
onQualitySelectionChange(): void;
|
|
12
|
+
_seek(): void;
|
|
13
|
+
hasFinished(): boolean;
|
|
14
|
+
cancel(): void;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=SafeSeek.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SafeSeek.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/util/SafeSeek.js"],"names":[],"mappings":";AAAA;IACE,0CAMC;IALC,aAAqB;IACrB,iBAA6B;IAC7B,sBAAyB;IACzB,kDAAqD;IAIvD,sBAwBC;IANG,aAAoC;IAQxC,8BAUC;IAED,iCAWC;IAED,cAIC;IAED,uBAEC;IAED,eAIC;CACF"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
class SafeSeek {
|
|
2
|
+
constructor(player, seekToTime){
|
|
3
|
+
this._player = player;
|
|
4
|
+
this._seekToTime = seekToTime;
|
|
5
|
+
this._hasFinished = false;
|
|
6
|
+
this._keepThisInstanceWhenPlayerSourcesChange = false;
|
|
7
|
+
this._seekWhenSafe();
|
|
8
|
+
}
|
|
9
|
+
_seekWhenSafe() {
|
|
10
|
+
var HAVE_FUTURE_DATA = 3;
|
|
11
|
+
// `readyState` in Video.js is the same as the HTML5 Media element's `readyState`
|
|
12
|
+
// property.
|
|
13
|
+
//
|
|
14
|
+
// `readyState` is an enum of 5 values (0-4), each of which represent a state of
|
|
15
|
+
// readiness to play. The meaning of the values range from HAVE_NOTHING (0), meaning
|
|
16
|
+
// no data is available to HAVE_ENOUGH_DATA (4), meaning all data is loaded and the
|
|
17
|
+
// video can be played all the way through.
|
|
18
|
+
//
|
|
19
|
+
// In order to seek successfully, the `readyState` must be at least HAVE_FUTURE_DATA
|
|
20
|
+
// (3).
|
|
21
|
+
//
|
|
22
|
+
// @see http://docs.videojs.com/player#readyState
|
|
23
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/readyState
|
|
24
|
+
// @see https://dev.w3.org/html5/spec-preview/media-elements.html#seek-the-media-controller
|
|
25
|
+
if (this._player.readyState() < HAVE_FUTURE_DATA) {
|
|
26
|
+
this._seekFn = this._seek.bind(this);
|
|
27
|
+
// The `canplay` event means that the `readyState` is at least HAVE_FUTURE_DATA.
|
|
28
|
+
this._player.one("canplay", this._seekFn);
|
|
29
|
+
} else {
|
|
30
|
+
this._seek();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
onPlayerSourcesChange() {
|
|
34
|
+
if (this._keepThisInstanceWhenPlayerSourcesChange) {
|
|
35
|
+
// By setting this to `false`, we know that if the player sources change again
|
|
36
|
+
// the change did not originate from a quality selection change, the new sources
|
|
37
|
+
// are likely different from the old sources, and so this pending seek no longer
|
|
38
|
+
// applies.
|
|
39
|
+
this._keepThisInstanceWhenPlayerSourcesChange = false;
|
|
40
|
+
} else {
|
|
41
|
+
this.cancel();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
onQualitySelectionChange() {
|
|
45
|
+
// `onPlayerSourcesChange` will cancel this pending seek unless we tell it not to.
|
|
46
|
+
// We need to reuse this same pending seek instance because when the player is
|
|
47
|
+
// paused, the `preload` attribute is set to `none`, and the user selects one
|
|
48
|
+
// quality option and then another, the player cannot seek until the player has
|
|
49
|
+
// enough data to do so (and the `canplay` event is fired) and thus on the second
|
|
50
|
+
// selection the player's `currentTime()` is `0` and when the video plays we would
|
|
51
|
+
// seek to `0` instead of the correct time.
|
|
52
|
+
if (!this.hasFinished()) {
|
|
53
|
+
this._keepThisInstanceWhenPlayerSourcesChange = true;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
_seek() {
|
|
57
|
+
this._player.currentTime(this._seekToTime);
|
|
58
|
+
this._keepThisInstanceWhenPlayerSourcesChange = false;
|
|
59
|
+
this._hasFinished = true;
|
|
60
|
+
}
|
|
61
|
+
hasFinished() {
|
|
62
|
+
return this._hasFinished;
|
|
63
|
+
}
|
|
64
|
+
cancel() {
|
|
65
|
+
this._player.off("canplay", this._seekFn);
|
|
66
|
+
this._keepThisInstanceWhenPlayerSourcesChange = false;
|
|
67
|
+
this._hasFinished = true;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export default SafeSeek;
|
|
71
|
+
|
|
72
|
+
//# sourceMappingURL=SafeSeek.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../../src/fields/TiptapEditor/extensions/VideoBlock/components/videojs/quality-selector/util/SafeSeek.js"],"sourcesContent":["class SafeSeek {\n constructor(player, seekToTime) {\n this._player = player;\n this._seekToTime = seekToTime;\n this._hasFinished = false;\n this._keepThisInstanceWhenPlayerSourcesChange = false;\n this._seekWhenSafe();\n }\n\n _seekWhenSafe() {\n var HAVE_FUTURE_DATA = 3;\n\n // `readyState` in Video.js is the same as the HTML5 Media element's `readyState`\n // property.\n //\n // `readyState` is an enum of 5 values (0-4), each of which represent a state of\n // readiness to play. The meaning of the values range from HAVE_NOTHING (0), meaning\n // no data is available to HAVE_ENOUGH_DATA (4), meaning all data is loaded and the\n // video can be played all the way through.\n //\n // In order to seek successfully, the `readyState` must be at least HAVE_FUTURE_DATA\n // (3).\n //\n // @see http://docs.videojs.com/player#readyState\n // @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/readyState\n // @see https://dev.w3.org/html5/spec-preview/media-elements.html#seek-the-media-controller\n if (this._player.readyState() < HAVE_FUTURE_DATA) {\n this._seekFn = this._seek.bind(this);\n // The `canplay` event means that the `readyState` is at least HAVE_FUTURE_DATA.\n this._player.one(\"canplay\", this._seekFn);\n } else {\n this._seek();\n }\n }\n\n onPlayerSourcesChange() {\n if (this._keepThisInstanceWhenPlayerSourcesChange) {\n // By setting this to `false`, we know that if the player sources change again\n // the change did not originate from a quality selection change, the new sources\n // are likely different from the old sources, and so this pending seek no longer\n // applies.\n this._keepThisInstanceWhenPlayerSourcesChange = false;\n } else {\n this.cancel();\n }\n }\n\n onQualitySelectionChange() {\n // `onPlayerSourcesChange` will cancel this pending seek unless we tell it not to.\n // We need to reuse this same pending seek instance because when the player is\n // paused, the `preload` attribute is set to `none`, and the user selects one\n // quality option and then another, the player cannot seek until the player has\n // enough data to do so (and the `canplay` event is fired) and thus on the second\n // selection the player's `currentTime()` is `0` and when the video plays we would\n // seek to `0` instead of the correct time.\n if (!this.hasFinished()) {\n this._keepThisInstanceWhenPlayerSourcesChange = true;\n }\n }\n\n _seek() {\n this._player.currentTime(this._seekToTime);\n this._keepThisInstanceWhenPlayerSourcesChange = false;\n this._hasFinished = true;\n }\n\n hasFinished() {\n return this._hasFinished;\n }\n\n cancel() {\n this._player.off(\"canplay\", this._seekFn);\n this._keepThisInstanceWhenPlayerSourcesChange = false;\n this._hasFinished = true;\n }\n}\n\nexport default SafeSeek;\n"],"names":["SafeSeek","constructor","player","seekToTime","_player","_seekToTime","_hasFinished","_keepThisInstanceWhenPlayerSourcesChange","_seekWhenSafe","HAVE_FUTURE_DATA","readyState","_seekFn","_seek","bind","one","onPlayerSourcesChange","cancel","onQualitySelectionChange","hasFinished","currentTime","off"],"mappings":"AAAA,MAAMA;IACJC,YAAYC,MAAM,EAAEC,UAAU,CAAE;QAC9B,IAAI,CAACC,OAAO,GAAGF;QACf,IAAI,CAACG,WAAW,GAAGF;QACnB,IAAI,CAACG,YAAY,GAAG;QACpB,IAAI,CAACC,wCAAwC,GAAG;QAChD,IAAI,CAACC,aAAa;IACpB;IAEAA,gBAAgB;QACd,IAAIC,mBAAmB;QAEvB,iFAAiF;QACjF,YAAY;QACZ,EAAE;QACF,gFAAgF;QAChF,oFAAoF;QACpF,mFAAmF;QACnF,2CAA2C;QAC3C,EAAE;QACF,oFAAoF;QACpF,OAAO;QACP,EAAE;QACF,iDAAiD;QACjD,oFAAoF;QACpF,2FAA2F;QAC3F,IAAI,IAAI,CAACL,OAAO,CAACM,UAAU,KAAKD,kBAAkB;YAChD,IAAI,CAACE,OAAO,GAAG,IAAI,CAACC,KAAK,CAACC,IAAI,CAAC,IAAI;YACnC,gFAAgF;YAChF,IAAI,CAACT,OAAO,CAACU,GAAG,CAAC,WAAW,IAAI,CAACH,OAAO;QAC1C,OAAO;YACL,IAAI,CAACC,KAAK;QACZ;IACF;IAEAG,wBAAwB;QACtB,IAAI,IAAI,CAACR,wCAAwC,EAAE;YACjD,8EAA8E;YAC9E,gFAAgF;YAChF,gFAAgF;YAChF,WAAW;YACX,IAAI,CAACA,wCAAwC,GAAG;QAClD,OAAO;YACL,IAAI,CAACS,MAAM;QACb;IACF;IAEAC,2BAA2B;QACzB,kFAAkF;QAClF,8EAA8E;QAC9E,6EAA6E;QAC7E,+EAA+E;QAC/E,iFAAiF;QACjF,kFAAkF;QAClF,2CAA2C;QAC3C,IAAI,CAAC,IAAI,CAACC,WAAW,IAAI;YACvB,IAAI,CAACX,wCAAwC,GAAG;QAClD;IACF;IAEAK,QAAQ;QACN,IAAI,CAACR,OAAO,CAACe,WAAW,CAAC,IAAI,CAACd,WAAW;QACzC,IAAI,CAACE,wCAAwC,GAAG;QAChD,IAAI,CAACD,YAAY,GAAG;IACtB;IAEAY,cAAc;QACZ,OAAO,IAAI,CAACZ,YAAY;IAC1B;IAEAU,SAAS;QACP,IAAI,CAACZ,OAAO,CAACgB,GAAG,CAAC,WAAW,IAAI,CAACT,OAAO;QACxC,IAAI,CAACJ,wCAAwC,GAAG;QAChD,IAAI,CAACD,YAAY,GAAG;IACtB;AACF;AAEA,eAAeN,SAAS"}
|
|
@@ -3,6 +3,6 @@ interface ExtensionKitProps {
|
|
|
3
3
|
dir?: "rtl" | "ltr";
|
|
4
4
|
openAssetHQHandler: openAssetHQType;
|
|
5
5
|
}
|
|
6
|
-
export declare const ExtensionKit: ({ dir, openAssetHQHandler, }: ExtensionKitProps) => (import("@tiptap/core").
|
|
6
|
+
export declare const ExtensionKit: ({ dir, openAssetHQHandler, }: ExtensionKitProps) => (import("@tiptap/core").Node<any, any> | import("@tiptap/core").Extension<any, any> | import("@tiptap/core").Mark<import("@tiptap/extension-subscript").SubscriptExtensionOptions, any>)[];
|
|
7
7
|
export default ExtensionKit;
|
|
8
8
|
//# sourceMappingURL=extension-kit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockEditor.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/features/BlockEditor/BlockEditor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BlockEditor.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/features/BlockEditor/BlockEditor.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAKjD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,eAAO,MAAM,WAAW,sEAKrB,WAAW,GAAG;IACf,kBAAkB,EAAE,eAAe,CAAC;IACpC,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACzC,gCA4FA,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -7,6 +7,7 @@ import { useTranslation } from "@payloadcms/ui/providers/Translation";
|
|
|
7
7
|
import { EditorContext } from "../../context/EditorContext.js";
|
|
8
8
|
import { IframeMenu } from "../../extensions/Iframe/menus/index.js";
|
|
9
9
|
import ImageBlockMenu from "../../extensions/ImageBlock/components/ImageBlockMenu.js";
|
|
10
|
+
import VideoBlockMenu from "../../extensions/VideoBlock/components/VideoBlockMenu.js";
|
|
10
11
|
import { InsideLinksMenu } from "../../extensions/InsideLinks/menus/index.js";
|
|
11
12
|
import { ColumnsMenu } from "../../extensions/MultiColumn/menus/ColumnsMenu.js";
|
|
12
13
|
import { SocialMediaMenu } from "../../extensions/SocialMedia/menus/index.js";
|
|
@@ -116,6 +117,10 @@ export const BlockEditor = ({ handleChange, content, openAssetHQHandler, additio
|
|
|
116
117
|
/*#__PURE__*/ _jsx(ImageBlockMenu, {
|
|
117
118
|
editor: editor,
|
|
118
119
|
appendTo: menuContainerRef
|
|
120
|
+
}),
|
|
121
|
+
/*#__PURE__*/ _jsx(VideoBlockMenu, {
|
|
122
|
+
editor: editor,
|
|
123
|
+
appendTo: menuContainerRef
|
|
119
124
|
})
|
|
120
125
|
]
|
|
121
126
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/features/BlockEditor/BlockEditor.tsx"],"sourcesContent":["\"use client\";\nimport { EditorContent } from \"@tiptap/react\";\nimport { useEffect, useMemo, useRef } from \"react\";\n\nimport { useLocale } from \"@payloadcms/ui/providers/Locale\";\nimport { useTranslation } from \"@payloadcms/ui/providers/Translation\";\nimport { EditorContext } from \"../../context/EditorContext.js\";\nimport { IframeMenu } from \"../../extensions/Iframe/menus/index.js\";\nimport ImageBlockMenu from \"../../extensions/ImageBlock/components/ImageBlockMenu.js\";\nimport { InsideLinksMenu } from \"../../extensions/InsideLinks/menus/index.js\";\nimport { ColumnsMenu } from \"../../extensions/MultiColumn/menus/ColumnsMenu.js\";\nimport { SocialMediaMenu } from \"../../extensions/SocialMedia/menus/index.js\";\nimport {\n TableColumnMenu,\n TableRowMenu,\n} from \"../../extensions/Table/menus/index.js\";\nimport { useBlockEditor } from \"../../hooks/useBlockEditor.js\";\nimport { openAssetHQType } from \"../../types.js\";\nimport { Sidebar } from \"../Sidebar/Sidebar.js\";\nimport { ContentItemMenu } from \"../menus/ContentItemMenu/ContentItemMenu.js\";\nimport { TextMenu } from \"../menus/TextMenu/TextMenu.js\";\nimport { LinkMenu } from \"../menus/index.js\";\nimport { TiptapProps } from \"./types.js\";\nexport const BlockEditor = ({\n handleChange,\n content,\n openAssetHQHandler,\n additionalContext,\n}: TiptapProps & {\n openAssetHQHandler: openAssetHQType;\n additionalContext?: Record<string, any>;\n}) => {\n const menuContainerRef = useRef(null);\n const editorRef = useRef<HTMLDivElement>(null);\n\n const { editor, users, characterCount, leftSidebar } = useBlockEditor({\n content: content,\n handleChange: handleChange,\n openAssetHQHandler: openAssetHQHandler,\n additionalContext: additionalContext,\n });\n\n const { code } = useLocale();\n\n const displayedUsers = users.slice(0, 3);\n\n const providerValue = useMemo(() => {\n return {};\n }, []);\n\n useEffect(() => {\n if (code === \"ar\" || code === \"fa\") {\n editor?.commands?.setTextDirection(\"rtl\");\n editor?.commands?.setContent(\"dwa\");\n }\n }, [code]);\n\n if (!editor) {\n return null;\n }\n const { i18n } = useTranslation();\n\n // Define the content for different languages\n const contentEn = \"للكتابة...\"; // Content for English or default language\n const contentAr = \"انقر هنا للكتابة...\"; // Content for Arabic language\n const contentFa = \"اینجا کلیک کنید تا شروع به نوشتن کنید...\";\n\n /*switch (i18n.language) {\n case 'ar':\n editor.commands.setContent(contentAr)\n break\n case 'fa':\n editor.commands.setContent(contentFa)\n break\n default:\n editor.commands.setContent(contentEn)\n }*/\n\n return (\n <EditorContext.Provider value={providerValue}>\n <div\n lang={i18n.language}\n className=\"flex h-full overflow-visible\"\n ref={menuContainerRef}\n >\n <Sidebar\n isOpen={leftSidebar.isOpen}\n onClose={leftSidebar.close}\n editor={editor}\n />\n <div className=\"relative flex flex-col flex-1 h-full justify-center items-center \">\n {/* <EditorHeader\n characters={characterCount.characters()}\n users={displayedUsers}\n words={characterCount.words()}\n isSidebarOpen={leftSidebar.isOpen}\n toggleSidebar={leftSidebar.toggle}\n /> */}\n <EditorContent\n editor={editor}\n ref={editorRef}\n lang={i18n.language}\n className=\"flex-1 overflow-y-visible w-full h-full outline-none outline-offset-0\"\n style={{\n outline: \"none\",\n }}\n />\n <ContentItemMenu editor={editor} />\n <LinkMenu editor={editor} appendTo={menuContainerRef} />\n\n <TextMenu editor={editor} />\n <IframeMenu editor={editor} appendTo={menuContainerRef} />\n <SocialMediaMenu editor={editor} appendTo={menuContainerRef} />\n <InsideLinksMenu editor={editor} appendTo={menuContainerRef} />\n <ColumnsMenu editor={editor} appendTo={menuContainerRef} />\n <TableRowMenu editor={editor} appendTo={menuContainerRef} />\n <TableColumnMenu editor={editor} appendTo={menuContainerRef} />\n <ImageBlockMenu editor={editor} appendTo={menuContainerRef} />\n </div>\n </div>\n </EditorContext.Provider>\n );\n};\n\nexport default BlockEditor;\n"],"names":["EditorContent","useEffect","useMemo","useRef","useLocale","useTranslation","EditorContext","IframeMenu","ImageBlockMenu","InsideLinksMenu","ColumnsMenu","SocialMediaMenu","TableColumnMenu","TableRowMenu","useBlockEditor","Sidebar","ContentItemMenu","TextMenu","LinkMenu","BlockEditor","handleChange","content","openAssetHQHandler","additionalContext","menuContainerRef","editorRef","editor","users","characterCount","leftSidebar","code","displayedUsers","slice","providerValue","commands","setTextDirection","setContent","i18n","contentEn","contentAr","contentFa","Provider","value","div","lang","language","className","ref","isOpen","onClose","close","style","outline","appendTo"],"mappings":"AAAA;;AACA,SAASA,aAAa,QAAQ,gBAAgB;AAC9C,SAASC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,QAAQ;AAEnD,SAASC,SAAS,QAAQ,kCAAkC;AAC5D,SAASC,cAAc,QAAQ,uCAAuC;AACtE,SAASC,aAAa,QAAQ,iCAAiC;AAC/D,SAASC,UAAU,QAAQ,yCAAyC;AACpE,OAAOC,oBAAoB,2DAA2D;AACtF,SAASC,eAAe,QAAQ,8CAA8C;AAC9E,SAASC,WAAW,QAAQ,oDAAoD;AAChF,SAASC,eAAe,QAAQ,8CAA8C;AAC9E,SACEC,eAAe,EACfC,YAAY,QACP,wCAAwC;AAC/C,SAASC,cAAc,QAAQ,gCAAgC;AAE/D,SAASC,OAAO,QAAQ,wBAAwB;AAChD,SAASC,eAAe,QAAQ,8CAA8C;AAC9E,SAASC,QAAQ,QAAQ,gCAAgC;AACzD,SAASC,QAAQ,QAAQ,oBAAoB;AAE7C,OAAO,MAAMC,cAAc,CAAC,EAC1BC,YAAY,EACZC,OAAO,EACPC,kBAAkB,EAClBC,iBAAiB,EAIlB;IACC,MAAMC,
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/features/BlockEditor/BlockEditor.tsx"],"sourcesContent":["\"use client\";\nimport { EditorContent } from \"@tiptap/react\";\nimport { useEffect, useMemo, useRef } from \"react\";\n\nimport { useLocale } from \"@payloadcms/ui/providers/Locale\";\nimport { useTranslation } from \"@payloadcms/ui/providers/Translation\";\nimport { EditorContext } from \"../../context/EditorContext.js\";\nimport { IframeMenu } from \"../../extensions/Iframe/menus/index.js\";\nimport ImageBlockMenu from \"../../extensions/ImageBlock/components/ImageBlockMenu.js\";\nimport VideoBlockMenu from \"../../extensions/VideoBlock/components/VideoBlockMenu.js\";\nimport { InsideLinksMenu } from \"../../extensions/InsideLinks/menus/index.js\";\nimport { ColumnsMenu } from \"../../extensions/MultiColumn/menus/ColumnsMenu.js\";\nimport { SocialMediaMenu } from \"../../extensions/SocialMedia/menus/index.js\";\nimport {\n TableColumnMenu,\n TableRowMenu,\n} from \"../../extensions/Table/menus/index.js\";\nimport { useBlockEditor } from \"../../hooks/useBlockEditor.js\";\nimport { openAssetHQType } from \"../../types.js\";\nimport { Sidebar } from \"../Sidebar/Sidebar.js\";\nimport { ContentItemMenu } from \"../menus/ContentItemMenu/ContentItemMenu.js\";\nimport { TextMenu } from \"../menus/TextMenu/TextMenu.js\";\nimport { LinkMenu } from \"../menus/index.js\";\nimport { TiptapProps } from \"./types.js\";\nexport const BlockEditor = ({\n handleChange,\n content,\n openAssetHQHandler,\n additionalContext,\n}: TiptapProps & {\n openAssetHQHandler: openAssetHQType;\n additionalContext?: Record<string, any>;\n}) => {\n const menuContainerRef = useRef(null);\n const editorRef = useRef<HTMLDivElement>(null);\n\n const { editor, users, characterCount, leftSidebar } = useBlockEditor({\n content: content,\n handleChange: handleChange,\n openAssetHQHandler: openAssetHQHandler,\n additionalContext: additionalContext,\n });\n\n const { code } = useLocale();\n\n const displayedUsers = users.slice(0, 3);\n\n const providerValue = useMemo(() => {\n return {};\n }, []);\n\n useEffect(() => {\n if (code === \"ar\" || code === \"fa\") {\n editor?.commands?.setTextDirection(\"rtl\");\n editor?.commands?.setContent(\"dwa\");\n }\n }, [code]);\n\n if (!editor) {\n return null;\n }\n const { i18n } = useTranslation();\n\n // Define the content for different languages\n const contentEn = \"للكتابة...\"; // Content for English or default language\n const contentAr = \"انقر هنا للكتابة...\"; // Content for Arabic language\n const contentFa = \"اینجا کلیک کنید تا شروع به نوشتن کنید...\";\n\n /*switch (i18n.language) {\n case 'ar':\n editor.commands.setContent(contentAr)\n break\n case 'fa':\n editor.commands.setContent(contentFa)\n break\n default:\n editor.commands.setContent(contentEn)\n }*/\n\n return (\n <EditorContext.Provider value={providerValue}>\n <div\n lang={i18n.language}\n className=\"flex h-full overflow-visible\"\n ref={menuContainerRef}\n >\n <Sidebar\n isOpen={leftSidebar.isOpen}\n onClose={leftSidebar.close}\n editor={editor}\n />\n <div className=\"relative flex flex-col flex-1 h-full justify-center items-center \">\n {/* <EditorHeader\n characters={characterCount.characters()}\n users={displayedUsers}\n words={characterCount.words()}\n isSidebarOpen={leftSidebar.isOpen}\n toggleSidebar={leftSidebar.toggle}\n /> */}\n <EditorContent\n editor={editor}\n ref={editorRef}\n lang={i18n.language}\n className=\"flex-1 overflow-y-visible w-full h-full outline-none outline-offset-0\"\n style={{\n outline: \"none\",\n }}\n />\n <ContentItemMenu editor={editor} />\n <LinkMenu editor={editor} appendTo={menuContainerRef} />\n\n <TextMenu editor={editor} />\n <IframeMenu editor={editor} appendTo={menuContainerRef} />\n <SocialMediaMenu editor={editor} appendTo={menuContainerRef} />\n <InsideLinksMenu editor={editor} appendTo={menuContainerRef} />\n <ColumnsMenu editor={editor} appendTo={menuContainerRef} />\n <TableRowMenu editor={editor} appendTo={menuContainerRef} />\n <TableColumnMenu editor={editor} appendTo={menuContainerRef} />\n <ImageBlockMenu editor={editor} appendTo={menuContainerRef} />\n <VideoBlockMenu editor={editor} appendTo={menuContainerRef} />\n </div>\n </div>\n </EditorContext.Provider>\n );\n};\n\nexport default BlockEditor;\n"],"names":["EditorContent","useEffect","useMemo","useRef","useLocale","useTranslation","EditorContext","IframeMenu","ImageBlockMenu","VideoBlockMenu","InsideLinksMenu","ColumnsMenu","SocialMediaMenu","TableColumnMenu","TableRowMenu","useBlockEditor","Sidebar","ContentItemMenu","TextMenu","LinkMenu","BlockEditor","handleChange","content","openAssetHQHandler","additionalContext","menuContainerRef","editorRef","editor","users","characterCount","leftSidebar","code","displayedUsers","slice","providerValue","commands","setTextDirection","setContent","i18n","contentEn","contentAr","contentFa","Provider","value","div","lang","language","className","ref","isOpen","onClose","close","style","outline","appendTo"],"mappings":"AAAA;;AACA,SAASA,aAAa,QAAQ,gBAAgB;AAC9C,SAASC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,QAAQ;AAEnD,SAASC,SAAS,QAAQ,kCAAkC;AAC5D,SAASC,cAAc,QAAQ,uCAAuC;AACtE,SAASC,aAAa,QAAQ,iCAAiC;AAC/D,SAASC,UAAU,QAAQ,yCAAyC;AACpE,OAAOC,oBAAoB,2DAA2D;AACtF,OAAOC,oBAAoB,2DAA2D;AACtF,SAASC,eAAe,QAAQ,8CAA8C;AAC9E,SAASC,WAAW,QAAQ,oDAAoD;AAChF,SAASC,eAAe,QAAQ,8CAA8C;AAC9E,SACEC,eAAe,EACfC,YAAY,QACP,wCAAwC;AAC/C,SAASC,cAAc,QAAQ,gCAAgC;AAE/D,SAASC,OAAO,QAAQ,wBAAwB;AAChD,SAASC,eAAe,QAAQ,8CAA8C;AAC9E,SAASC,QAAQ,QAAQ,gCAAgC;AACzD,SAASC,QAAQ,QAAQ,oBAAoB;AAE7C,OAAO,MAAMC,cAAc,CAAC,EAC1BC,YAAY,EACZC,OAAO,EACPC,kBAAkB,EAClBC,iBAAiB,EAIlB;IACC,MAAMC,mBAAmBtB,OAAO;IAChC,MAAMuB,YAAYvB,OAAuB;IAEzC,MAAM,EAAEwB,MAAM,EAAEC,KAAK,EAAEC,cAAc,EAAEC,WAAW,EAAE,GAAGf,eAAe;QACpEO,SAASA;QACTD,cAAcA;QACdE,oBAAoBA;QACpBC,mBAAmBA;IACrB;IAEA,MAAM,EAAEO,IAAI,EAAE,GAAG3B;IAEjB,MAAM4B,iBAAiBJ,MAAMK,KAAK,CAAC,GAAG;IAEtC,MAAMC,gBAAgBhC,QAAQ;QAC5B,OAAO,CAAC;IACV,GAAG,EAAE;IAELD,UAAU;QACR,IAAI8B,SAAS,QAAQA,SAAS,MAAM;YAClCJ,QAAQQ,UAAUC,iBAAiB;YACnCT,QAAQQ,UAAUE,WAAW;QAC/B;IACF,GAAG;QAACN;KAAK;IAET,IAAI,CAACJ,QAAQ;QACX,OAAO;IACT;IACA,MAAM,EAAEW,IAAI,EAAE,GAAGjC;IAEjB,6CAA6C;IAC7C,MAAMkC,YAAY,cAAc,0CAA0C;IAC1E,MAAMC,YAAY,uBAAuB,8BAA8B;IACvE,MAAMC,YAAY;IAElB;;;;;;;;;GASC,GAED,qBACE,KAACnC,cAAcoC,QAAQ;QAACC,OAAOT;kBAC7B,cAAA,MAACU;YACCC,MAAMP,KAAKQ,QAAQ;YACnBC,WAAU;YACVC,KAAKvB;;8BAEL,KAACT;oBACCiC,QAAQnB,YAAYmB,MAAM;oBAC1BC,SAASpB,YAAYqB,KAAK;oBAC1BxB,QAAQA;;8BAEV,MAACiB;oBAAIG,WAAU;;sCAQb,KAAC/C;4BACC2B,QAAQA;4BACRqB,KAAKtB;4BACLmB,MAAMP,KAAKQ,QAAQ;4BACnBC,WAAU;4BACVK,OAAO;gCACLC,SAAS;4BACX;;sCAEF,KAACpC;4BAAgBU,QAAQA;;sCACzB,KAACR;4BAASQ,QAAQA;4BAAQ2B,UAAU7B;;sCAEpC,KAACP;4BAASS,QAAQA;;sCAClB,KAACpB;4BAAWoB,QAAQA;4BAAQ2B,UAAU7B;;sCACtC,KAACb;4BAAgBe,QAAQA;4BAAQ2B,UAAU7B;;sCAC3C,KAACf;4BAAgBiB,QAAQA;4BAAQ2B,UAAU7B;;sCAC3C,KAACd;4BAAYgB,QAAQA;4BAAQ2B,UAAU7B;;sCACvC,KAACX;4BAAaa,QAAQA;4BAAQ2B,UAAU7B;;sCACxC,KAACZ;4BAAgBc,QAAQA;4BAAQ2B,UAAU7B;;sCAC3C,KAACjB;4BAAemB,QAAQA;4BAAQ2B,UAAU7B;;sCAC1C,KAAChB;4BAAekB,QAAQA;4BAAQ2B,UAAU7B;;;;;;;AAKpD,EAAE;AAEF,eAAeL,YAAY"}
|
|
@@ -2,7 +2,7 @@ import { Editor } from "@tiptap/react";
|
|
|
2
2
|
export declare const draftPromptOptions: {
|
|
3
3
|
value: string;
|
|
4
4
|
label: string;
|
|
5
|
-
icon: import("lucide-react").
|
|
5
|
+
icon: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
6
6
|
prompt: string;
|
|
7
7
|
}[];
|
|
8
8
|
interface AIDraftSelectorCommandsProps {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare const extractTiptapJson: (markdownValue: string) => import("@tiptap/core").JSONContent;
|
|
2
|
+
export declare const extractTiptapJsonFromHTML: (htmlinput: string) => Record<string, any>;
|
|
2
3
|
export declare const extractMarkdown: (json: any) => any;
|
|
3
4
|
//# sourceMappingURL=extract.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../../../../src/fields/TiptapEditor/lib/extract.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,kBAAmB,MAAM,uCAWtD,CAAC;AAEF,eAAO,MAAM,eAAe,SAAU,GAAG,QAWxC,CAAC"}
|
|
1
|
+
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../../../../src/fields/TiptapEditor/lib/extract.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,kBAAmB,MAAM,uCAWtD,CAAC;AAEF,eAAO,MAAM,yBAAyB,cAAe,MAAM,wBAO1D,CAAC;AAEF,eAAO,MAAM,eAAe,SAAU,GAAG,QAWxC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Editor } from "@tiptap/core";
|
|
1
|
+
import { Editor, generateJSON } from "@tiptap/core";
|
|
2
2
|
import ExtensionKit from "../extensions/extension-kit.js";
|
|
3
3
|
export const extractTiptapJson = (markdownValue)=>{
|
|
4
4
|
const editor = new Editor({
|
|
@@ -11,6 +11,13 @@ export const extractTiptapJson = (markdownValue)=>{
|
|
|
11
11
|
});
|
|
12
12
|
return editor.getJSON();
|
|
13
13
|
};
|
|
14
|
+
export const extractTiptapJsonFromHTML = (htmlinput)=>{
|
|
15
|
+
return generateJSON(htmlinput, [
|
|
16
|
+
...ExtensionKit({
|
|
17
|
+
openAssetHQHandler: ()=>{}
|
|
18
|
+
})
|
|
19
|
+
]);
|
|
20
|
+
};
|
|
14
21
|
export const extractMarkdown = (json)=>{
|
|
15
22
|
const editor = new Editor({
|
|
16
23
|
content: json,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/fields/TiptapEditor/lib/extract.ts"],"sourcesContent":["import { Editor } from \"@tiptap/core\";\nimport ExtensionKit from \"../extensions/extension-kit.js\";\n\nexport const extractTiptapJson = (markdownValue: string) => {\n const editor = new Editor({\n content: markdownValue,\n extensions: [\n ...ExtensionKit({\n openAssetHQHandler: () => {},\n // provider,\n }),\n ],\n });\n return editor.getJSON();\n};\n\nexport const extractMarkdown = (json: any) => {\n const editor = new Editor({\n content: json,\n extensions: [\n ...ExtensionKit({\n // provider,\n openAssetHQHandler: () => {},\n }),\n ],\n });\n return editor.storage.markdown.getMarkdown();\n};\n"],"names":["Editor","ExtensionKit","extractTiptapJson","markdownValue","editor","content","extensions","openAssetHQHandler","getJSON","extractMarkdown","json","storage","markdown","getMarkdown"],"mappings":"AAAA,SAASA,MAAM,QAAQ,eAAe;
|
|
1
|
+
{"version":3,"sources":["../../../../../src/fields/TiptapEditor/lib/extract.ts"],"sourcesContent":["import { Editor, generateJSON } from \"@tiptap/core\";\nimport ExtensionKit from \"../extensions/extension-kit.js\";\n\nexport const extractTiptapJson = (markdownValue: string) => {\n const editor = new Editor({\n content: markdownValue,\n extensions: [\n ...ExtensionKit({\n openAssetHQHandler: () => {},\n // provider,\n }),\n ],\n });\n return editor.getJSON();\n};\n\nexport const extractTiptapJsonFromHTML = (htmlinput: string) => {\n return generateJSON(htmlinput, [\n ...ExtensionKit({\n openAssetHQHandler: () => {},\n // provider,\n }),\n ]);\n};\n\nexport const extractMarkdown = (json: any) => {\n const editor = new Editor({\n content: json,\n extensions: [\n ...ExtensionKit({\n // provider,\n openAssetHQHandler: () => {},\n }),\n ],\n });\n return editor.storage.markdown.getMarkdown();\n};\n"],"names":["Editor","generateJSON","ExtensionKit","extractTiptapJson","markdownValue","editor","content","extensions","openAssetHQHandler","getJSON","extractTiptapJsonFromHTML","htmlinput","extractMarkdown","json","storage","markdown","getMarkdown"],"mappings":"AAAA,SAASA,MAAM,EAAEC,YAAY,QAAQ,eAAe;AACpD,OAAOC,kBAAkB,iCAAiC;AAE1D,OAAO,MAAMC,oBAAoB,CAACC;IAChC,MAAMC,SAAS,IAAIL,OAAO;QACxBM,SAASF;QACTG,YAAY;eACPL,aAAa;gBACdM,oBAAoB,KAAO;YAE7B;SACD;IACH;IACA,OAAOH,OAAOI,OAAO;AACvB,EAAE;AAEF,OAAO,MAAMC,4BAA4B,CAACC;IACxC,OAAOV,aAAaU,WAAW;WAC1BT,aAAa;YACdM,oBAAoB,KAAO;QAE7B;KACD;AACH,EAAE;AAEF,OAAO,MAAMI,kBAAkB,CAACC;IAC9B,MAAMR,SAAS,IAAIL,OAAO;QACxBM,SAASO;QACTN,YAAY;eACPL,aAAa;gBACd,YAAY;gBACZM,oBAAoB,KAAO;YAC7B;SACD;IACH;IACA,OAAOH,OAAOS,OAAO,CAACC,QAAQ,CAACC,WAAW;AAC5C,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/fields/TiptapEditor/types.d.ts"],"sourcesContent":["export type openAssetHQType = (\n listener: (asset: AssetReturnType) => void,\n file?: File\n) => void;\n\nexport type HitItem = {\n caption: string;\n description: string;\n fileName: string;\n fileSize: number;\n id: string;\n s3key: string;\n source: string;\n title: string;\n type: \"VIDEO\" | \"IMAGE\";\n updated_at: string;\n created_at: string;\n userId: string;\n tags: string[];\n celebrities: string[];\n videos: {\n aspectRatio: string;\n assetId: string;\n averageBitrate: number;\n createdAt: Date;\n downloaded: boolean;\n s3Key: string;\n duration: number;\n fileName: string;\n fileSize: number | null;\n frameRate: number;\n height: number;\n id: string;\n mimeType: string;\n newsAgencyVideoAssetId: string;\n providerSubId: string;\n sampleRate: number;\n updatedAt: Date;\n videoCodec: string;\n width: number;\n }[];\n};\nexport type SelectedAssetInModal = HitItem & {\n selectedVideo?: HitItem[\"videos\"][0];\n};\nexport type AssetReturnType = SelectedAssetInModal & {\n fullUrl: string;\n videoUrl?: string;\n renditions: Record<number, string>;\n};\n"],"names":[],"mappings":"AA6CA,
|
|
1
|
+
{"version":3,"sources":["../../../../src/fields/TiptapEditor/types.d.ts"],"sourcesContent":["export type openAssetHQType = (\n listener: (asset: AssetReturnType) => void,\n file?: File\n) => void;\n\nexport type HitItem = {\n caption: string;\n description: string;\n fileName: string;\n fileSize: number;\n id: string;\n s3key: string;\n source: string;\n title: string;\n type: \"VIDEO\" | \"IMAGE\";\n updated_at: string;\n created_at: string;\n userId: string;\n tags: string[];\n celebrities: string[];\n videos: {\n aspectRatio: string;\n assetId: string;\n averageBitrate: number;\n createdAt: Date;\n downloaded: boolean;\n s3Key: string;\n duration: number;\n fileName: string;\n fileSize: number | null;\n frameRate: number;\n height: number;\n id: string;\n mimeType: string;\n newsAgencyVideoAssetId: string;\n providerSubId: string;\n sampleRate: number;\n updatedAt: Date;\n videoCodec: string;\n width: number;\n }[];\n};\nexport type SelectedAssetInModal = HitItem & {\n selectedVideo?: HitItem[\"videos\"][0];\n};\nexport type AssetReturnType = SelectedAssetInModal & {\n fullUrl: string;\n videoUrl?: string;\n renditions: Record<number, string>;\n playlistUrl?: string;\n};\n"],"names":[],"mappings":"AA6CA,WAKE"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { TipTapEditor } from "./fields/TiptapEditor/index.js";
|
|
2
2
|
export { EditorComponent } from "./fields/TiptapEditor/Components.js";
|
|
3
3
|
export { BlockEditor } from "./fields/TiptapEditor/features/BlockEditor/BlockEditor.js";
|
|
4
|
-
export { extractMarkdown, extractTiptapJson, } from "./fields/TiptapEditor/lib/extract.js";
|
|
4
|
+
export { extractMarkdown, extractTiptapJson, extractTiptapJsonFromHTML, } from "./fields/TiptapEditor/lib/extract.js";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,2DAA2D,CAAC;AACxF,OAAO,EACL,eAAe,EACf,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,2DAA2D,CAAC;AACxF,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,sCAAsC,CAAC"}
|