/** * 공용 폼 초기화 함수 * @param {HTMLElement} context - 초기화 대상 (없으면 document 전체) */ function initFormJS(context) { const root = context || document; // Datepicker if (root.querySelector(".calender")) { $(root).find(".calender").datepicker({ changeYear: true, changeMonth: true, yearRange: "-10:+0", dateFormat: "yy-mm-dd" }); } // TinyMCE if (root.querySelector(".tinymce")) { if (document.compatMode !== "CSS1Compat") { console.error("문서가 표준 모드가 아닙니다."); return; } tinymce.init({ selector: 'textarea.tinymce', license_key: 'gpl', height: 250, plugins: 'advlist autolink lists link image charmap preview anchor', toolbar: 'undo redo blocks fontfamily fontsize forecolor backcolor | ' + 'bold italic underline strikethrough | align numlist bullist | ' + 'link image | table media | code fullscreen preview', menubar: 'file edit view insert format tools table help' }); } // Select2 if (root.querySelector(".select-field")) { $(root).find(".select-field").select2({ theme: "bootstrap-5", tags: true, // 없는 값 입력 가능 allowClear: true, language: { noResults: function () { return "직접 입력 후 Enter"; } } }); } }