awsmug/torro-forms

View on GitHub
assets/dist/js/template-tag-fields.min.js

Summary

Maintainability
A
0 mins
Test Coverage
/*!
 * Torro Forms Version 1.0.8 (https://torro-forms.com)
 * Licensed under GNU General Public License v2 (or later) (http://www.gnu.org/licenses/gpl-2.0.html)
 */
!function(t,e){"use strict";function i(t){"true"===t.attr("aria-expanded")?t.attr("aria-expanded","false"):(t.attr("aria-expanded","true"),t.next(".template-tag-list").focus(),e("html").one("click",function(){t.attr("aria-expanded","false").focus()}))}t.FieldView.TemplatetagtextFieldView=t.FieldView.extend({preRender:function(t){t.find(".template-tag-list-toggle").off("click"),t.find(".template-tag-button").off("click")},postRender:function(t){var n=t.find(".plugin-lib-control");t.find(".template-tag-list-toggle").on("click",function(t){var n=e(this);i(n),t.stopPropagation(),t.preventDefault()}),t.on("click",".template-tag-button",function(){var t="{"+e(this).data("tag")+"}";n.val(n.val()+t)})}}),t.FieldView.TemplatetagwysiwygFieldView=t.FieldView.WYSIWYGFieldView.extend({preRender:function(e){e.find(".template-tag-list-toggle").off("click"),e.find(".template-tag-button").off("click"),t.FieldView.WYSIWYGFieldView.prototype.preRender.apply(this,arguments)},postRender:function(n){var a=n.find(".plugin-lib-control"),o=n.find(".template-tag-list-wrap");o.remove(),a.one("editorInitialized",function(){n.find(".wp-editor-wrap .wp-editor-tools .wp-media-buttons").length?n.find(".wp-editor-wrap .wp-editor-tools .wp-media-buttons").after(o):n.find(".wp-editor-wrap .wp-editor-tools").prepend(o)}),t.FieldView.WYSIWYGFieldView.prototype.postRender.apply(this,arguments),n.on("click",".template-tag-list-toggle",function(t){var n=e(this);i(n),t.stopPropagation(),t.preventDefault()}),n.on("click",".template-tag-button",function(){var t="{"+e(this).data("tag")+"}",i=window.tinymce.get(a.attr("id"));i&&i.insertContent(t)})}})}(window.pluginLibFieldsAPI,window.jQuery);