PluginProbe
BeyondWords – AI audio for publishers / 7.0.0
BeyondWords – AI audio for publishers v7.0.0
7.1.0 trunk 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.1.0 4.1.1 4.1.2 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.3.0 4.4.0 4.5.0 4.5.1 4.6.0 4.6.1 4.6.2 4.7.0 All 43 releases
speechkit / src / editor / components / inspect-panel / js / inspect.js

inspect.js in BeyondWords – AI audio for publishers 7.0.0, at src/editor/components/inspect-panel/js/inspect.js

66 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /* global ClipboardJS */
2
3 /*
4 * Classic-editor Inspect panel: copy-to-clipboard confirmation + "Remove all
5 * BeyondWords data" toggle.
6 */
7 ( function () {
8 'use strict';
9
10 function init() {
11 const copyButton = document.getElementById(
12 'beyondwords__inspect--copy'
13 );
14
15 if ( copyButton && typeof ClipboardJS !== 'undefined' ) {
16 const clipboard = new ClipboardJS( '#beyondwords__inspect--copy' );
17
18 clipboard.on( 'success', function () {
19 const confirm = document.getElementById(
20 'beyondwords__inspect--copy-confirm'
21 );
22 if ( confirm ) {
23 confirm.style.display = '';
24 }
25 } );
26 }
27
28 document.addEventListener( 'click', function ( event ) {
29 if ( ! event.target.closest( '#beyondwords__inspect--remove' ) ) {
30 return;
31 }
32
33 /* eslint-disable-next-line no-alert */
34 const confirmed = window.confirm(
35 wp.i18n.__(
36 'Remove all BeyondWords data when the post is saved?',
37 'speechkit'
38 )
39 );
40
41 if ( ! confirmed ) {
42 return;
43 }
44
45 const deleteInput = document.getElementById(
46 'beyondwords_delete_content'
47 );
48 if ( deleteInput ) {
49 deleteInput.removeAttribute( 'disabled' );
50 }
51
52 document
53 .querySelectorAll( '[data-beyondwords-metavalue]' )
54 .forEach( ( el ) => {
55 el.value = '';
56 } );
57 } );
58 }
59
60 if ( document.readyState !== 'loading' ) {
61 init();
62 } else {
63 document.addEventListener( 'DOMContentLoaded', init );
64 }
65 } )();
66