editor1.js
2 years ago
handlebars.baldrick2.js
8 years ago
handlebars2.js
8 years ago
jquery.baldrick3.js
8 years ago
panel.js
8 years ago
scripts-pod_reference.js
2 years ago
scripts-view_template.js
1 year ago
scripts-pod_reference.js
49 lines
| 1 | var htmleditor; |
| 2 | |
| 3 | CodeMirror.defineMode("mustache", function (config, parserConfig) { |
| 4 | var mustacheOverlay = { |
| 5 | token: mustache |
| 6 | }; |
| 7 | return CodeMirror.overlayMode(CodeMirror.getMode(config, parserConfig.backdrop || "text/html"), mustacheOverlay); |
| 8 | }); |
| 9 | |
| 10 | // setup pod selection |
| 11 | jQuery(function ($) { |
| 12 | |
| 13 | htmleditor = CodeMirror.fromTextArea(document.getElementById("content"), { |
| 14 | lineNumbers: true, |
| 15 | matchBrackets: true, |
| 16 | mode: "mustache", |
| 17 | indentUnit: 4, |
| 18 | indentWithTabs: true, |
| 19 | enterMode: "keep", |
| 20 | tabMode: "shift", |
| 21 | lineWrapping: true |
| 22 | |
| 23 | }); |
| 24 | |
| 25 | /* Setup autocomplete */ |
| 26 | htmleditor.on('keyup', podFields); |
| 27 | |
| 28 | $('.pod-switch').baldrick({ |
| 29 | request: ajaxurl, method: 'POST' |
| 30 | }); |
| 31 | |
| 32 | $('#pods-magic-tag-list').on('click', 'dd.pods-magic-tag-option', function (e) { |
| 33 | e.preventDefault(); |
| 34 | |
| 35 | var $element = $(this); |
| 36 | |
| 37 | var tag = $element.text(); |
| 38 | |
| 39 | navigator.clipboard.writeText('{@' + tag.trim() + '}'); |
| 40 | |
| 41 | $element.css('background-color', '#ffffb4'); |
| 42 | |
| 43 | setTimeout(function () { |
| 44 | $element.css('background-color', ''); |
| 45 | }, 200); |
| 46 | }); |
| 47 | }); |
| 48 | |
| 49 |