1

我能够让 ace-editor 中的 themePath (我正在使用 nom ace-builds bundle )工作。我可以设置基本路径并且编辑器加载正常,但是它仍在默认目录中寻找主题。

import ace
import ace from 'ace-builds'
import {Range, EditSession} from 'ace-builds'

// import modes that you want to include into your main bundle
import "ace-builds/src-noconflict/mode-yaml";

// import webpack resolver to dynamically load modes,
   you need to install file-loader for this to work!
   import "ace-builds/webpack-resolver";

ace.config.set("themePath","../static/js");
ace.config.set("basePath","../static/js");
ace.config.set("modePath","../static/js");

var editor = ace.edit("ace_editor_playbook", {
        maxLines: 25,
        minLines: 25,
        value: "---" + "\n",
        mode: "ace/mode/yaml",
        theme: "ace/theme/vibrant_ink",
        bug: 1
      })

谢谢你。

4

1 回答 1

0

没有使用 themePath 因为https://github.com/ajaxorg/ace-builds/blob/master/webpack-resolver.js明确设置了所有主题的路径。如果你想使用 themePath 不要加载 webpack-resolver

于 2019-02-21T19:30:09.770 回答