refactor!: move plyr from default bundle

This commit is contained in:
Ankush Menat 2022-06-20 20:05:25 +05:30
parent f40c82d4d8
commit 69cb144b06
6 changed files with 15 additions and 9 deletions

View file

@ -107,6 +107,5 @@ import "./frappe/utils/dashboard_utils.js";
import "./frappe/ui/chart.js";
import "./frappe/ui/datatable.js";
import "./frappe/ui/driver.js";
import "./frappe/ui/plyr.js";
import "./frappe/barcode_scanner/index.js";
import "./frappe/scanner";

View file

@ -33,13 +33,16 @@ frappe.help.show_video = function (youtube_id, title) {
dialog.show();
dialog.$wrapper.addClass("video-modal");
let plyr = new frappe.Plyr(video[0], {
hideControls: true,
resetOnEnd: true,
});
let plyr;
frappe.utils.load_video_player().then(() => {
plyr = new frappe.Plyr(video[0], {
hideControls: true,
resetOnEnd: true,
});
})
dialog.onhide = () => {
plyr.destroy();
plyr?.destroy();
};
}

View file

@ -1528,5 +1528,9 @@ Object.assign(frappe.utils, {
return [doctype, filter, val[0], val[1], false];
});
}
},
load_video_player() {
return frappe.require("video_player.bundle.js");
}
});

View file

@ -5,6 +5,7 @@ frappe.provide("frappe.utils");
export default class OnboardingWidget extends Widget {
async refresh() {
frappe.utils.load_video_player();
this.new && await this.get_onboarding_data();
this.set_title();
this.set_actions();
@ -156,7 +157,6 @@ export default class OnboardingWidget extends Widget {
};
toggle_content();
// toggle_video();
}
go_to_page(step) {

View file

@ -1,3 +1,3 @@
import Plyr from "plyr/dist/plyr.polyfilled";
frappe.Plyr = Plyr;
frappe.Plyr = Plyr;

View file

@ -699,7 +699,7 @@ class TestBenchBuild(BaseTestCommands):
self.assertEqual(result.exit_code, 0)
self.assertEqual(result.exception, None)
CURRENT_SIZE = 3.7 # MB
CURRENT_SIZE = 3.5 # MB
JS_ASSET_THRESHOLD = 0.1
hooks = frappe.get_hooks()