
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@alauda/code-editor
Advanced tools
安装 monaco-editor 依赖: yarn add monaco-editor ng-monaco-editor
假如你想使用 monaco-yaml 以增加对于 yaml 的格式检查,你还需要安装:
yarn add monaco-languages monaco-yaml
将 monaco-editor 的 monaco-editor/min 目录拷贝到项目 assets 下面。
对于 Angular CLI 配置的项目,你可以增加一条配置
{
"projects": {
"app": {
// 省略无关选项
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"assets": [
{
"glob": "**/*",
"input": "node_modules/monaco-editor/min/vs",
"output": "/lib/vs"
},
// 假如你需要支持 YAML 格式检查,你还需要以下依赖:
{
"glob": "**/*",
"input": "node_modules/monaco-languages/release/min",
"output": "/lib/vs/basic-languages"
},
{
"glob": "**/*",
"input": "node_modules/monaco-yaml/min",
"output": "/lib/vs/language/yaml"
}
// ...
CodeEditorModule
模块:在 Angular 的根模块配置并载入 CodeEditorModule
。以下为参考配置:
const DEFAULT_MONACO_OPTIONS: monaco.editor.IEditorConstructionOptions = {
fontSize: 12,
folding: true,
scrollBeyondLastLine: false,
minimap: { enabled: false },
mouseWheelZoom: true,
scrollbar: {
vertical: 'visible',
horizontal: 'visible',
},
fixedOverflowWidgets: true,
};
@NgModule({
imports: [
CodeEditorModule.forRoot({
baseUrl: 'lib',
defaultOptions: DEFAULT_MONACO_OPTIONS,
}),
],
providers: [
// 可选配置,稍后会解释
{
provide: MonacoProviderService,
useClass: CustomMonacoProviderService,
},
],
})
export class AppModule {}
如上配置中还提供了用户自己的 MonacoProviderService
。以下为实现了几个默认不支持的代码编辑器功能:
import { Injectable } from '@angular/core';
import { MonacoProviderService } from 'alauda-ui';
const CODE_EDITOR_THEME_KEY = 'code-editor-theme';
/**
* Custom monaco provider to do some customizations.
*/
@Injectable()
export class CustomMonacoProviderService extends MonacoProviderService {
async initMonaco() {
await super.initMonaco();
// Load custom yaml language service:
await this.loadModule([
// YAML language services are currently managed manually in thirdparty_lib
'vs/basic-languages/monaco.contribution',
'vs/language/yaml/monaco.contribution',
]);
this.configYaml();
this.changeTheme(localStorage.getItem(CODE_EDITOR_THEME_KEY));
}
changeTheme(theme: string) {
super.changeTheme(theme);
localStorage.setItem(CODE_EDITOR_THEME_KEY, theme);
}
private configYaml() {
monaco.languages.yaml.yamlDefaults.setDiagnosticsOptions({
validate: true,
schemas: [
{
uri: undefined,
fileMatch: ['*'],
schema: {
description: 'YAML',
type: 'object',
},
},
],
});
}
}
FAQs
## 安装依赖
We found that @alauda/code-editor demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 11 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.