我正在编辑Slightly Modded Options Framework。我在functions.interface.php
中加入了脚本。这是函数
function of_load_only() {
// add_action('admin_head', 'smof_admin_head');
wp_enqueue_script("jquery-ui-core");
wp_enqueue_script("jquery-ui-sortable");
wp_enqueue_script("jquery-ui-slider");
wp_enqueue_script("jquery-input-mask", ADMIN_DIR ."assets/js/jquery.maskedinput-1.2.2.js", array("jquery"), false, true);
wp_enqueue_script("tipsy", ADMIN_DIR ."assets/js/jquery.tipsy.js", array("jquery"), false, true);
// enqueue codemirror
wp_enqueue_script("codemirror", ADMIN_DIR . "assets/js/codemirror/codemirror.min.js", array(), "3.15", true);
// wp_enqueue_script('color-picker', ADMIN_DIR .'assets/js/colorpicker.js', array('jquery'));
wp_enqueue_script("cookie", ADMIN_DIR . "assets/js/cookie.js", array("jquery"), false, true);
wp_enqueue_script("smof", ADMIN_DIR ."assets/js/smof.js", array("jquery"), false, true);
// Enqueue colorpicker scripts for versions below 3.5 for compatibility
if(!wp_script_is("wp-color-picker", "registered")) {
wp_register_script("iris", ADMIN_DIR ."assets/js/iris.min.js", array("jquery-ui-draggable", "jquery-ui-slider", "jquery-touch-punch"), false, 1);
wp_register_script("wp-color-picker", ADMIN_DIR ."assets/js/color-picker.min.js", array("jquery", "iris"));
}
wp_enqueue_script("wp-color-picker");
// Enqueue scripts for file uploader
if(function_exists("wp_enqueue_media")) {
wp_enqueue_media();
}
do_action("of_load_only_after");
}
Here is a link to the relevant source code
到目前为止,CodeMirror的处理要比Ace少得多。我遇到的问题是CodeMirror最初是隐藏的,直到我在编辑器中按下一个键。我在这里阅读了“解决方案”:
这是代码
$("#custom_css").val("/* Write code here */");
var codemirror_editor = CodeMirror.fromTextArea(document.getElementById("custom_css"), {
lineNumbers: true,
matchBrackets: true,
styleActiveLine: true,
lineWrapping: true,
autoCloseBrackets: true,
showTrailingSpace: true,
indentUnit: 4,
indentWithTabs: true,
viewportMargin: Infinity,
autofocus: true
});
// codemirror_editor.refresh(); // does not work even on the CodeMirror instance
// setTimeout(codemirror_editor.refresh, 0) // does not work per the CodeMirror has content but won't display until keypress solution
以下是两个在按键之前和在编辑器中按下按键后显示的图像。
答案 0 :(得分:0)
这是admin-style.css
第422行的CSS问题。评论说它解决了我的困境!