Diff: STRATO-apps/wordpress_03/app/wp-content/themes/blocksy/static/js/customizer/preview-events.js

Keine Baseline-Datei – Diff nur gegen leer.
Zur Liste
1 -
1 + import ctEvents from 'ct-events'
2 + import $ from 'jquery'
3 +
4 + let deepLinkLocation = null
5 +
6 + export const getDeepLinkPanel = () =>
7 + deepLinkLocation ? deepLinkLocation.split(':')[1] : false
8 + export const removeDeepLink = () => (deepLinkLocation = null)
9 +
10 + if (wp.customize) {
11 + wp.customize.bind('ready', () => {
12 + wp.customize.previewer.bind('ct-initiate-deep-link', (location) => {
13 + const [section, panel] = location.split(':')
14 + const expanded = Object.values(wp.customize.section._value).find(
15 + (e) => e.expanded()
16 + )
17 +
18 + if (!expanded || expanded.id !== section) {
19 + deepLinkLocation = location
20 + wp.customize.section(section).expand()
21 +
22 + return
23 + }
24 +
25 + ctEvents.trigger('ct-deep-link-start', location)
26 + })
27 +
28 + // wp.customize.preview.send('ct-trigger-autosave')
29 + wp.customize.previewer.bind('ct-trigger-autosave', () => {
30 + // https://github.com/WordPress/WordPress/blob/38fdd7bb3afcd59d51bc7bafcaa3d78820e3593b/wp-admin/js/customize-controls.js#L9336
31 + //
32 + // Trigger customizer autosave
33 + wp.customize
34 + .requestChangesetUpdate({}, { autosave: true })
35 + .done(() => {
36 + wp.customize.previewer.send('ct-trigger-autosave-done')
37 + })
38 + })
39 + })
40 + }
41 +