PluginProbe ʕ •ᴥ•ʔ
Starter Sites & Templates by Neve / trunk
Starter Sites & Templates by Neve vtrunk
1.4.0 1.3.0 1.2.29 1.2.28 1.2.6 1.2.7 1.2.8 1.2.9 trunk 1.0.10 1.0.11 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 1.1.20 1.1.21 1.1.22 1.1.23 1.1.24 1.1.25 1.1.26 1.1.27 1.1.28 1.1.29 1.1.3 1.1.30 1.1.31 1.1.32 1.1.33 1.1.34 1.1.35 1.1.36 1.1.37 1.1.38 1.1.39 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.3 1.2.4 1.2.5
templates-patterns-collection / beaver / src / export.js
templates-patterns-collection / beaver / src Last commit date
components 1 year ago data 1 year ago editor.scss 5 years ago export.js 1 year ago icon.js 5 years ago index.js 5 years ago
export.js
62 lines
1 /* global FLBuilder */
2
3 const contextMenu = document.getElementById( 'tmpl-fl-row-overlay' );
4
5 const tpcExport = ( e ) => {
6 const row = e.closest( '.fl-row' );
7 const node = row.dataset.node;
8
9 const message = `<div class="tpc-template-cloud-export-modal">
10 <h1>${ window.tiTpc.exporter.modalLabel }</h1>
11 <label for="tpc-${ node }">${ window.tiTpc.exporter.textLabel }</label>
12 <input id="tpc-${ node }" type="text" placeholder="${ window.tiTpc.exporter.textPlaceholder }" />
13 </div>`;
14
15 FLBuilder.confirm( {
16 message,
17 ok: () => {
18 const input = document.getElementById( `tpc-${ node }` );
19 const title = input.value || 'Template';
20 setTimeout( function () {
21 FLBuilder.showAjaxLoader();
22 FLBuilder.ajax(
23 {
24 action: 'ti_export_template',
25 node,
26 title,
27 },
28 ( res ) => {
29 if ( undefined !== res.success && ! res.success ) {
30 FLBuilder.alert(
31 `<h1>${ window.tiTpc.exporter.exportFailed }</h1> ${ res.data }`
32 );
33 }
34
35 FLBuilder.hideAjaxLoader();
36 }
37 );
38 }, 1000 );
39 },
40 strings: {
41 ok: window.tiTpc.exporter.buttonLabel,
42 cancel: window.tiTpc.exporter.cancelLabel,
43 },
44 } );
45 };
46
47 window.tiTpc.tpcExport = tpcExport;
48
49 if ( contextMenu ) {
50 const text = contextMenu.textContent;
51 contextMenu.textContent = text.replace(
52 // eslint-disable-next-line prettier/prettier
53 '<li><a class="fl-block-row-reset" href="javascript:void(0);">Reset Row Width</a></li>',
54 // eslint-disable-next-line prettier/prettier
55 '<li><a class="fl-block-row-reset" href="javascript:void(0);">Reset Row Width</a></li><li><a class="fl-block-row-tpc-export" onclick="window.tiTpc.tpcExport(this)" href="javascript:void(0);">Save to Templates Cloud</a></li>'
56 );
57 }
58
59 FLBuilder.addHook( 'tiTpcExport', () => {
60 window.tiTpc.initModalExport();
61 } );
62