PluginProbe
WP Coder – Insert & Manage Code Snippets / 4.5.2
WP Coder – Insert & Manage Code Snippets v4.5.2
4.5.2 4.5.1 1.1 2.3.1 2.3.2 2.4.1 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.1 3.1.1 3.2 3.2.1 3.3 3.4 3.5 All 40 releases
wp-coder / assets / js / codemirror / tax_editor.js

tax_editor.js in WP Coder – Insert & Manage Code Snippets 4.5.2, at assets/js/codemirror/tax_editor.js

35 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 'use strict';
2
3 jQuery(function ($) {
4
5 (function() {
6 const targets = ['#description', '#tag-description']; // edit term + add term
7 targets.forEach(function(sel){
8 const el = document.querySelector(sel);
9 if (!el) return;
10
11 // Базові налаштування CodeMirror від WP
12 try {
13 const settings = wp.codeEditor.defaultSettings ? _.clone(wp.codeEditor.defaultSettings) : {};
14 // Увімкнути markdown-режим (файли markdown.js/gfm.js вже завантажені)
15 settings.codemirror = Object.assign({}, settings.codemirror || {}, {
16 mode: 'gfm', // або 'markdown'
17 lineNumbers: false,
18 lineWrapping: true,
19 viewportMargin: Infinity, // render all content (no inner scroll)
20 styleActiveLine: true,
21 matchBrackets: true,
22 autoCloseBrackets: true,
23 indentUnit: 2,
24 tabSize: 2,
25 });
26 wp.codeEditor.initialize(el, settings);
27 } catch(e) {
28 // fallback: нічого страшного, просто лишається textarea
29 console.warn('WPCoder: failed to init markdown editor for taxonomy description', e);
30 }
31 });
32 })();
33
34
35 });