Skip to content

有没有纯代码编辑模式? #5264

Answered by t1000ln
t1000ln asked this question in Q&A
Discussion options

You must be logged in to vote

在编辑特定代码的场景中,用工具栏插入代码的方式很笨拙,而且还有个烦人的悬浮框遮挡视线。

有没有专用的设定,默认就是特定的代码类型编辑模式,不要让人用鼠标点啊选语言啊的那么麻烦。

比如我初始化编辑器,默认就是编辑SQL内容的?

自己找到方法,不太完美,将就能用:

<Editor v-model="sqlHtml" :default-config="editorConfig" mode="simple"></Editor>
const sqlHtml = ref('<pre><code class="language-sql"></code></pre>');
const editorConfig: Partial<IEditorConfig> = {
  placeholder: '请输入SQL语句',
  customAlert: function (info: string, type: AlertType): void {
    throw new Error('Function not implemented.');
  },
  scroll: true,
  readOnly: false,
  autoFocus: false,
  hoverbarKeys: {
    'pre': {menuKeys: []}
  },
};

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@t1000ln
Comment options

Answer selected by t1000ln
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant