Skip to content

ciqtek/awg-editor

Repository files navigation

awg-editor

🚄 使用教程

安装

  npm i install awg-editor or yarn add awg-editor

使用

import { AwgEditor } from 'awg-editor'
const editor = AwgEditor.getInstance()
AwgEditor.initSuggestions(funName) // 创建代码补全提示
AwgEditor.initHover(hoverHints) // 创建鼠标悬浮提示
AwgEditor.initCodeEditor(dom) // 初始化编辑器

📖 文档

Class: AwgEditor

基于monaco-editor的二次封装,实现快速定义自定义提示和鼠标悬浮提示

Implements

  • CodeEditor

Table of contents

Properties

Methods

Properties

hoverMap

Private hoverMap: Map<string, IMarkdownString[]>

internal

Defined in

AwgEditor.ts:9


hoverTips

Private hoverTips: null | IDisposable

Defined in

AwgEditor.ts:11


language

language: string

Implementation of

CodeEditor.language

Defined in

AwgEditor.ts:12


suggestion

Private suggestion: null | IDisposable

Defined in

AwgEditor.ts:10


instance

Static instance: AwgEditor

Defined in

AwgEditor.ts:13

Methods

defineTheme

defineTheme(): void

自定义编辑器主题,默认使用AWG项目的主题

Returns

void

Implementation of

CodeEditor.defineTheme

Defined in

AwgEditor.ts:46


dispose

dispose(): void

取消原有的自定义提示与鼠标悬浮提示

Returns

void

Implementation of

CodeEditor.dispose

Defined in

AwgEditor.ts:186


formateHover

formateHover(txt): string

提供简单的格式化鼠标悬浮提示的能力

Parameters

Name Type Description
txt string 格式化文字

Returns

string

格式化后的文字

Defined in

AwgEditor.ts:179


initCodeEditor

initCodeEditor(editorDom): null | IStandaloneCodeEditor

初始化编辑器

Parameters

Name Type Description
editorDom HTMLElement monaco-editor的dom容器

Returns

null | IStandaloneCodeEditor

monaco-editor create实例

Implementation of

CodeEditor.initCodeEditor

Defined in

AwgEditor.ts:195


initHover

initHover(params, formate?): void

初始化鼠标悬浮提示

Parameters

Name Type Default value Description
params HoverParams | HoverParams[] undefined 自定义鼠标悬浮提示参数
formate boolean true 是否开启简单的提示格式化功能

Returns

void

Implementation of

CodeEditor.initHover

Defined in

AwgEditor.ts:126


initSuggestions

initSuggestions(params): void

初始化自定义函数提示

Parameters

Name Type Description
params string[] | SuggestionsParams[] 自定义函数提示参数

Returns

void

Implementation of

CodeEditor.initSuggestions

Defined in

AwgEditor.ts:101


setLanguage

setLanguage(lan): void

Parameters

Name Type Description
lan string 设置编辑器语言

Returns

void

Implementation of

CodeEditor.setLanguage

Defined in

AwgEditor.ts:40


getInstance

Static getInstance(): AwgEditor

return(awgeditor)

Returns

AwgEditor

Defined in

AwgEditor.ts:28

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published